(* (Cic.name * Cic.term * Cic.term * Cic.term * Cic.term) * *)
(Utils.pos * equality) * proof
| ProofGoalBlock of proof * proof (* equality *)
- | ProofSymBlock of Cic.term Cic.explicit_named_substitution * proof
+(* | ProofSymBlock of Cic.term Cic.explicit_named_substitution * proof *)
+ | ProofSymBlock of Cic.term list * proof
| SubProof of Cic.term * int * proof
;;
;;
+let build_ens_for_sym_eq sym_eq_URI termlist =
+ let obj, _ = CicEnvironment.get_obj CicUniv.empty_ugraph sym_eq_URI in
+ match obj with
+ | Cic.Constant (_, _, _, uris, _) ->
+ assert (List.length uris <= List.length termlist);
+ let rec aux = function
+ | [], tl -> [], tl
+ | (uri::uris), (term::tl) ->
+ let ens, args = aux (uris, tl) in
+ (uri, term)::ens, args
+ | _, _ -> assert false
+ in
+ aux (uris, termlist)
+ | _ -> assert false
+(* [(UriManager.uri_of_string *)
+(* "cic:/Coq/Init/Logic/Logic_lemmas/equality/A.var", ty); *)
+(* (UriManager.uri_of_string *)
+(* "cic:/Coq/Init/Logic/Logic_lemmas/equality/x.var", x); *)
+(* (UriManager.uri_of_string *)
+(* "cic:/Coq/Init/Logic/Logic_lemmas/equality/y.var", y)] *)
+;;
+
+
let build_proof_term proof =
let rec do_build_proof proof =
match proof with
| ProofGoalBlock (proofbit, proof) ->
print_endline "found ProofGoalBlock, going up...";
do_build_goal_proof proofbit proof
- | ProofSymBlock (ens, proof) ->
+(* | ProofSymBlock (ens, proof) -> *)
+(* let proof = do_build_proof proof in *)
+(* Cic.Appl [ *)
+(* Cic.Const (Utils.sym_eq_URI (), ens); (\* symmetry *\) *)
+(* proof *)
+(* ] *)
+ | ProofSymBlock (termlist, proof) ->
let proof = do_build_proof proof in
- Cic.Appl [
- Cic.Const (HelmLibraryObjects.Logic.sym_eq_URI, ens); (* symmetry *)
- proof
- ]
+ let ens, args = build_ens_for_sym_eq (Utils.sym_eq_URI ()) termlist in
+ Cic.Appl ([Cic.Const (Utils.sym_eq_URI (), ens)] @ args @ [proof])
| ProofBlock (subst, eq_URI, (name, ty), bo(* t' *), (pos, eq), eqproof) ->
let t' = Cic.Lambda (name, ty, bo) in
let proof' =
;;
-let find_equalities ?(eq_uri=HelmLibraryObjects.Logic.eq_URI) context proof =
+let find_equalities context proof =
let module C = Cic in
let module S = CicSubstitution in
let module T = CicTypeChecker in
+ let eq_uri = LibraryObjects.eq_URI () in
let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in
let ok_types ty menv =
List.for_all (fun (_, _, mt) -> mt = ty) menv
let module C = Cic in
let module S = CicSubstitution in
let module T = CicTypeChecker in
+ let blacklist =
+ List.fold_left
+ (fun s u -> UriManager.UriSet.add u s)
+ equations_blacklist
+ [eq_XURI (); sym_eq_URI (); trans_eq_URI (); eq_ind_URI ();
+ eq_ind_r_URI ()]
+ in
let candidates =
List.fold_left
(fun l uri ->
let suri = UriManager.string_of_uri uri in
- if UriManager.UriSet.mem uri equations_blacklist then
+ if UriManager.UriSet.mem uri blacklist then
l
else
let t = CicUtil.term_of_uri uri in
[]
(MetadataQuery.equations_for_goal ~dbd status)
in
- let eq_uri1 = UriManager.uri_of_string HelmLibraryObjects.Logic.eq_XURI
- and eq_uri2 = HelmLibraryObjects.Logic.eq_URI in
+ let eq_uri1 = eq_XURI () (* UriManager.uri_of_string HelmLibraryObjects.Logic.eq_XURI *)
+ and eq_uri2 = LibraryObjects.eq_URI () in (* HelmLibraryObjects.Logic.eq_URI in *)
let iseq uri =
(UriManager.eq uri eq_uri1) || (UriManager.eq uri eq_uri2)
in
let blacklist =
let refl_equal =
UriManager.uri_of_string "cic:/Coq/Init/Logic/eq.ind#xpointer(1/1/1)" in
- UriManager.UriSet.remove refl_equal
- (UriManager.UriSet.union equalities_uris equations_blacklist)
+ let s =
+ UriManager.UriSet.remove refl_equal
+ (UriManager.UriSet.union equalities_uris equations_blacklist)
+ in
+ List.fold_left
+ (fun s u -> UriManager.UriSet.add u s)
+ s [sym_eq_URI (); trans_eq_URI (); eq_ind_URI (); eq_ind_r_URI ()]
in
let metasenv, context, ugraph = env in
let candidates =
;;
-let term_is_equality ?(eq_uri=HelmLibraryObjects.Logic.eq_URI) term =
- let iseq uri = UriManager.eq uri eq_uri in
+let term_is_equality term =
+ let iseq uri = UriManager.eq uri (LibraryObjects.eq_URI ()) in
match term with
| Cic.Appl [Cic.MutInd (uri, _, _); _; _; _] when iseq uri -> true
| _ -> false
exception TermIsNotAnEquality;;
-let equality_of_term ?(eq_uri=HelmLibraryObjects.Logic.eq_URI) proof term =
+let equality_of_term proof term =
+ let eq_uri = LibraryObjects.eq_URI () in
let iseq uri = UriManager.eq uri eq_uri in
match term with
| Cic.Appl [Cic.MutInd (uri, _, _); ty; t1; t2] when iseq uri ->