| None -> None
| Some ((_, _), pt) -> Some pt
in
- let demodulate table goal =
- let changed, newmeta, newgoal =
- Indexing.demodulation_goal !maxmeta env table goal in
- maxmeta := newmeta;
- changed, newgoal
- in
+ let demodulate table goal = Indexing.demodulation_goal env table goal in
let changed, goal =
match passive_table with
| None -> demodulate active_table goal
in
let simplified =
List.fold_left
- (fun acc g ->
- match simplify_goal env g ~passive active with
+ (fun acc goal ->
+ match simplify_goal env goal ~passive active with
| _, g -> if find g acc then acc else g::acc)
[] active_goals
in
let selected = hd in
let passive_goals = tl in
let new' = Indexing.superposition_left env (snd active) selected in
+ let metasenv, context, ugraph = env in
+ let names = names_of_context context in
+ List.iter (fun (_,_,x) -> prerr_endline ("X: " ^ CicPp.pp x names)) new';
selected::active_goals, passive_goals @ new'
| _::tl -> aux tl
in
(ProofEngineHelpers.compare_metasenvs
~newmetasenv:metasenv ~oldmetasenv:proof_menv)
in
- let free_metas =
- List.filter (fun i -> i <> goalno)
- (ProofEngineHelpers.compare_metasenvs
- ~oldmetasenv:metasenv ~newmetasenv:proof_menv)
- in
let goal_proof, side_effects_t =
let initial = Equality.build_proof_term newproof in
Equality.build_goal_proof goalproof initial type_of_goal side_effects
let goal_proof = replace goal_proof in
(* ok per le meta libere... ma per quelle che c'erano e sono rimaste?
* what mi pare buono, sostituisce solo le meta farlocche *)
- prerr_endline (CicPp.pp goal_proof names);
let side_effects_t = List.map replace side_effects_t in
+ let free_metas =
+ List.filter (fun i -> i <> goalno)
+ (ProofEngineHelpers.compare_metasenvs
+ ~oldmetasenv:metasenv ~newmetasenv:goal_proof_menv)
+ in
(* check/refine/... build the new proof *)
let replaced_goal =
ProofEngineReduction.replace
(goalno,(context,goal_proof,type_of_goal))::subst_side_effects
in
let _ =
- let ty,_ =
+ try
CicTypeChecker.type_of_aux' real_menv context goal_proof
CicUniv.empty_ugraph
- in
- ty
+ with
+ | CicUtil.Meta_not_found _
+ | CicTypeChecker.TypeCheckerFailure _
+ | CicTypeChecker.AssertFailure _
+ | Invalid_argument "list_fold_left2" as exn ->
+ prerr_endline "THE PROOF DOES NOT TYPECHECK!";
+ prerr_endline (CicPp.pp goal_proof names);
+ raise exn
in
let proof, real_metasenv =
ProofEngineHelpers.subst_meta_and_metasenv_in_proof
proof goalno (CicMetaSubst.apply_subst final_subst) real_menv
in
let open_goals =
- match free_meta with Some (Cic.Meta (m,_)) -> [m] | _ -> []
+ match free_meta with Some(Cic.Meta(m,_)) when m<>goalno ->[m] | _ ->[]
in
Printf.eprintf
"GOALS APERTI: %s\nMETASENV PRIMA:\n%s\nMETASENV DOPO:\n%s\n"
*)
;;
-let demodulate_tac ~dbd ~pattern ((proof,goal) as initialstatus) =
+let demodulate_tac ~dbd ~pattern ((proof,goal)(*s initialstatus*)) =
let module I = Inference in
let curi,metasenv,pbo,pty = proof in
let metano,context,ty = CicUtil.lookup_meta goal metasenv in
(fun tbl eq -> Indexing.index tbl eq)
Indexing.empty equalities
in
- let _, newmeta,(newproof,newmetasenv, newty) =
+ let changed,(newproof,newmetasenv, newty) =
Indexing.demodulation_goal
- maxm (metasenv,context,CicUniv.empty_ugraph) table initgoal
+ (metasenv,context,CicUniv.empty_ugraph) table initgoal
in
- if newmeta != maxm then
+ if changed then
begin
let opengoal = Cic.Meta(maxm,irl) in
let proofterm,_ =
extended_status in
(status,maxm::newgoals)
end
- else if newty = ty then
+ else (* if newty = ty then *)
raise (ProofEngineTypes.Fail (lazy "no progress"))
- else ProofEngineTypes.apply_tactic
+ (*else ProofEngineTypes.apply_tactic
(ReductionTactics.simpl_tac ~pattern)
- initialstatus
+ initialstatus*)
;;
let demodulate_tac ~dbd ~pattern =