prerr_endline ("GOALLIST = " ^ string_of_int (List.length goallist));
(try
List.fold_left
- (fun (proof,opengoals) goal ->
- let newproof, newgoals = auto_tac mqi_handle (level-1) proof goal in
- (newproof, newgoals@opengoals))
- (proof,[]) goallist
+ (fun proof goal ->
+ (* It may happen that to close the first open goal
+ also some other goals are closed *)
+ let _,metasenv,_,_ = proof in
+ if List.exists (fun (i,_,_) -> i = goal) metasenv then
+ let newproof =
+ auto_tac mqi_handle (level-1) proof goal
+ in
+ newproof
+ else
+ (* goal already closed *)
+ proof)
+ proof goallist
with
| MaxDepth
| NotApplicableTheorem ->
let auto_tac mqi_handle ~status:(proof,goal) =
prerr_endline "Entro in Auto";
try
- let res = auto_tac mqi_handle depth proof goal in
+ let proof = auto_tac mqi_handle depth proof goal in
prerr_endline "AUTO_TAC HA FINITO";
- res
+ (proof,[])
with
| MaxDepth -> assert false (* this should happens only if depth is 0 above *)
| NotApplicableTheorem ->