From 61a2faa2694907757dd617175e0144705e79d65a Mon Sep 17 00:00:00 2001 From: Ferruccio Guidi Date: Wed, 10 Jan 2007 14:27:27 +0000 Subject: [PATCH] attributes now in the proof status: commit 2 --- helm/software/components/cic/cic.ml | 1 + helm/software/components/cic/cicParser.ml | 3 +- helm/software/components/cic_acic/cic2Xml.ml | 1 + .../grafite_engine/grafiteEngine.ml | 20 +++++------ .../components/grafite_engine/grafiteTypes.ml | 14 ++++---- helm/software/components/tactics/auto.ml | 34 +++++++++---------- .../software/components/tactics/autoTactic.ml | 12 +++---- .../components/tactics/declarative.ml | 4 +-- .../tactics/discriminationTactics.ml | 8 ++--- .../components/tactics/eliminationTactics.ml | 6 ++-- .../components/tactics/equalityTactics.ml | 20 +++++------ helm/software/components/tactics/fourierR.ml | 30 ++++++++-------- .../components/tactics/fwdSimplTactic.ml | 12 +++---- .../components/tactics/introductionTactics.ml | 2 +- helm/software/components/tactics/inversion.ml | 16 ++++----- .../components/tactics/inversion_principle.ml | 9 ++--- .../components/tactics/metadataQuery.ml | 10 +++--- .../components/tactics/negationTactics.ml | 2 +- .../tactics/paramodulation/saturation.ml | 6 ++-- .../components/tactics/primitiveTactics.ml | 24 ++++++------- .../components/tactics/proofEngineHelpers.ml | 10 +++--- .../tactics/proofEngineStructuralRules.ml | 14 ++++---- .../components/tactics/proofEngineTypes.ml | 16 ++++----- .../components/tactics/proofEngineTypes.mli | 5 +-- .../components/tactics/reductionTactics.ml | 8 ++--- helm/software/components/tactics/ring.ml | 6 ++-- helm/software/components/tactics/setoids.ml | 2 +- .../components/tactics/statefulProofEngine.ml | 29 ++++++++-------- .../tactics/statefulProofEngine.mli | 3 ++ helm/software/components/tactics/tacticals.ml | 6 ++-- .../components/tactics/variousTactics.ml | 8 ++--- 31 files changed, 175 insertions(+), 166 deletions(-) diff --git a/helm/software/components/cic/cic.ml b/helm/software/components/cic/cic.ml index 549587215..c5a5c1e40 100644 --- a/helm/software/components/cic/cic.ml +++ b/helm/software/components/cic/cic.ml @@ -74,6 +74,7 @@ type object_class = the record fields names and if they are coercions and then the coercion arity *) | `Projection (** record projection *) + | `InversionPrinciple (** inversion principle *) ] type attribute = diff --git a/helm/software/components/cic/cicParser.ml b/helm/software/components/cic/cicParser.ml index 150fe4ad9..3122affd4 100644 --- a/helm/software/components/cic/cicParser.ml +++ b/helm/software/components/cic/cicParser.ml @@ -716,7 +716,8 @@ let end_element ctxt tag = in Obj_class (`Record fields) | ["value", "projection"] -> Obj_class `Projection - | _ -> attribute_error ()) + | ["value", "inversion"] -> Obj_class `InversionPrinciple + | _ -> attribute_error ()) | tag -> match find_helm_exception ctxt with | Some (exn, arg) -> raise (Getter_failure (exn, arg)) diff --git a/helm/software/components/cic_acic/cic2Xml.ml b/helm/software/components/cic_acic/cic2Xml.ml index 31765f055..afe22d374 100644 --- a/helm/software/components/cic_acic/cic2Xml.ml +++ b/helm/software/components/cic_acic/cic2Xml.ml @@ -290,6 +290,7 @@ let xml_of_attrs attributes = res >] ) field_names [<>]) | `Projection -> Xml.xml_empty "class" [None,"value","projection"] + | `InversionPrinciple -> Xml.xml_empty "class" [None,"value","inversion"] in let flavour_of = function | `Definition -> Xml.xml_empty "flavour" [None, "value", "definition"] diff --git a/helm/software/components/grafite_engine/grafiteEngine.ml b/helm/software/components/grafite_engine/grafiteEngine.ml index 95e396003..09ceecebc 100644 --- a/helm/software/components/grafite_engine/grafiteEngine.ml +++ b/helm/software/components/grafite_engine/grafiteEngine.ml @@ -331,7 +331,7 @@ prerr_endline("opened: " ^ String.concat ", " (List.map string_of_int opened)); prerr_endline("closed_goals: " ^ String.concat ", " (List.map string_of_int closed_goals)); *) let proof, opened_goals = if needs_reordering then begin - let uri, metasenv_after_tactic, t, ty = proof in + let uri, metasenv_after_tactic, t, ty, attrs = proof in (* prerr_endline ("goal prima del riordino: " ^ String.concat " " (List.map string_of_int (ProofEngineTypes.goals_of_proof proof))); *) let reordered_metasenv, opened_goals = reorder_metasenv @@ -339,7 +339,7 @@ prerr_endline("closed_goals: " ^ String.concat ", " (List.map string_of_int clos metasenv_after_refinement metasenv_after_tactic opened goal always_opens_a_goal in - let proof' = uri, reordered_metasenv, t, ty in + let proof' = uri, reordered_metasenv, t, ty, attrs in (* prerr_endline ("goal dopo il riordino: " ^ String.concat " " (List.map string_of_int (ProofEngineTypes.goals_of_proof proof'))); *) proof', opened_goals end @@ -684,16 +684,16 @@ let rec eval_command = {ec_go = fun ~disambiguate_command opts status *) status,[] | GrafiteAst.Print (_,"proofterm") -> - let _,_,p,_ = GrafiteTypes.get_current_proof status in + let _,_,p,_, _ = GrafiteTypes.get_current_proof status in print_endline (AutoTactic.pp_proofterm p); status,[] | GrafiteAst.Print (_,_) -> status,[] | GrafiteAst.Qed loc -> - let uri, metasenv, bo, ty = + let uri, metasenv, bo, ty, attrs = match status.GrafiteTypes.proof_status with - | GrafiteTypes.Proof (Some uri, metasenv, body, ty) -> - uri, metasenv, body, ty - | GrafiteTypes.Proof (None, metasenv, body, ty) -> + | GrafiteTypes.Proof (Some uri, metasenv, body, ty, attrs) -> + uri, metasenv, body, ty, attrs + | GrafiteTypes.Proof (None, metasenv, body, ty, attrs) -> raise (GrafiteTypes.Command_error ("Someone allows to start a theorem without giving the "^ "name/uri. This should be fixed!")) @@ -706,7 +706,7 @@ let rec eval_command = {ec_go = fun ~disambiguate_command opts status (GrafiteTypes.Command_error "Proof not completed! metasenv is not empty!"); let name = UriManager.name_of_uri uri in - let obj = Cic.Constant (name,Some bo,ty,[],[]) in + let obj = Cic.Constant (name,Some bo,ty,[],attrs) in let status, lemmas = add_obj uri obj status in {status with GrafiteTypes.proof_status = GrafiteTypes.No_proof}, @@ -758,7 +758,7 @@ let rec eval_command = {ec_go = fun ~disambiguate_command opts status let obj = CicRefine.pack_coercion_obj obj in let metasenv = GrafiteTypes.get_proof_metasenv status in match obj with - | Cic.CurrentProof (_,metasenv',bo,ty,_,_) -> + | Cic.CurrentProof (_,metasenv',bo,ty,_, attrs) -> let name = UriManager.name_of_uri uri in if not(CicPp.check name ty) then HLog.error ("Bad name: " ^ name); @@ -790,7 +790,7 @@ let rec eval_command = {ec_go = fun ~disambiguate_command opts status ("Theorem already proved: " ^ UriManager.string_of_uri x ^ "\nPlease use a variant.")); end; - let initial_proof = (Some uri, metasenv', bo, ty) in + let initial_proof = (Some uri, metasenv', bo, ty, attrs) in let initial_stack = Continuationals.Stack.of_metasenv metasenv' in { status with GrafiteTypes.proof_status = GrafiteTypes.Incomplete_proof diff --git a/helm/software/components/grafite_engine/grafiteTypes.ml b/helm/software/components/grafite_engine/grafiteTypes.ml index 43d8e7f17..fe872c128 100644 --- a/helm/software/components/grafite_engine/grafiteTypes.ml +++ b/helm/software/components/grafite_engine/grafiteTypes.ml @@ -69,8 +69,8 @@ let get_current_proof status = let get_proof_metasenv status = match status.proof_status with | No_proof -> [] - | Proof (_, metasenv, _, _) - | Incomplete_proof { proof = (_, metasenv, _, _) } + | Proof (_, metasenv, _, _, _) + | Incomplete_proof { proof = (_, metasenv, _, _, _) } | Intermediate metasenv -> metasenv @@ -93,11 +93,11 @@ let set_metasenv metasenv status = let proof_status = match status.proof_status with | No_proof -> Intermediate metasenv - | Incomplete_proof ({ proof = (uri, _, proof, ty) } as incomplete_proof) -> + | Incomplete_proof ({ proof = (uri, _, proof, ty, attrs) } as incomplete_proof) -> Incomplete_proof - { incomplete_proof with proof = (uri, metasenv, proof, ty) } + { incomplete_proof with proof = (uri, metasenv, proof, ty, attrs) } | Intermediate _ -> Intermediate metasenv - | Proof (_, metasenv', _, _) -> + | Proof (_, metasenv', _, _, _) -> assert (metasenv = metasenv'); status.proof_status in @@ -105,14 +105,14 @@ let set_metasenv metasenv status = let get_proof_context status goal = match status.proof_status with - | Incomplete_proof { proof = (_, metasenv, _, _) } -> + | Incomplete_proof { proof = (_, metasenv, _, _, _) } -> let (_, context, _) = CicUtil.lookup_meta goal metasenv in context | _ -> [] let get_proof_conclusion status goal = match status.proof_status with - | Incomplete_proof { proof = (_, metasenv, _, _) } -> + | Incomplete_proof { proof = (_, metasenv, _, _, _) } -> let (_, _, conclusion) = CicUtil.lookup_meta goal metasenv in conclusion | _ -> raise (Statement_error "no ongoing proof") diff --git a/helm/software/components/tactics/auto.ml b/helm/software/components/tactics/auto.ml index 65087f8cb..59e90e6da 100644 --- a/helm/software/components/tactics/auto.ml +++ b/helm/software/components/tactics/auto.ml @@ -192,7 +192,7 @@ let empty_tables = let init_cache_and_tables dbd use_library paramod universe (proof, goal) = (* the local cache in initially empty *) let cache = AutoCache.cache_empty in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let signature = MetadataQuery.signature_of metasenv goal in let newmeta = CicMkImplicit.new_meta metasenv [] in let _,context,_ = CicUtil.lookup_meta goal metasenv in @@ -335,7 +335,7 @@ let build_equalities auto context metasenv tables universe cache newmeta equatio let close_more tables maxmeta context status auto universe cache = let (active,passive,bag) = tables in let proof, goalno = status in - let _, metasenv,_,_ = proof in + let _, metasenv,_,_, _ = proof in let signature = MetadataQuery.signature_of metasenv goalno in let equations = retrieve_equations signature universe cache context in let eqs_and_types = @@ -368,7 +368,7 @@ let find_context_equalities let module C = Cic in let module S = CicSubstitution in let module T = CicTypeChecker in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let newmeta = max (ProofEngineHelpers.new_meta_of_proof ~proof) maxmeta in (* if use_auto is true, we try to close the hypothesis of equational statements using auto; a naif, and probably wrong approach *) @@ -435,8 +435,8 @@ let new_metasenv_and_unify_and_t match arguments with [] -> term' | _ -> Cic.Appl (term'::arguments) in let proof',oldmetasenv = - let (puri,metasenv,pbo,pty) = proof in - (puri,newmetasenv,pbo,pty),metasenv + let (puri,metasenv,pbo,pty, attrs) = proof in + (puri,newmetasenv,pbo,pty, attrs),metasenv in let goal_for_paramod = match LibraryObjects.eq_URI () with @@ -446,7 +446,7 @@ let new_metasenv_and_unify_and_t in let newmeta = CicMkImplicit.new_meta newmetasenv (*subst*) [] in let metasenv_for_paramod = (newmeta,context,goal_for_paramod)::newmetasenv in - let proof'' = let uri,_,p,ty = proof' in uri,metasenv_for_paramod,p,ty in + let proof'' = let uri,_,p,ty, attrs = proof' in uri,metasenv_for_paramod,p,ty, attrs in let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in let proof''',goals = ProofEngineTypes.apply_tactic @@ -471,7 +471,7 @@ let new_metasenv_and_unify_and_t | Some (_,proof''''',_), active,passive,_ -> subst,proof''''', ProofEngineHelpers.compare_metasenvs ~oldmetasenv - ~newmetasenv:(let _,m,_,_ = proof''''' in m), active, passive + ~newmetasenv:(let _,m,_,_, _ = proof''''' in m), active, passive ;; let rec count_prods context ty = @@ -483,7 +483,7 @@ let apply_smart ~dbd ~term ~subst ~universe ?tables flags (proof, goal) = let module T = CicTypeChecker in let module R = CicReduction in let module C = Cic in - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let newmeta = CicMkImplicit.new_meta metasenv subst in let exp_named_subst_diff,newmeta',newmetasenvfragment,term' = @@ -653,7 +653,7 @@ let equational_case with | None, active, passive, maxmeta -> [], (active,passive,bag), cache, maxmeta, flags - | Some(subst',(_,metasenv,proof,_),open_goals),active,passive,maxmeta -> + | Some(subst',(_,metasenv,proof,_, _),open_goals),active,passive,maxmeta -> assert_subst_are_disjoint subst subst'; let subst = subst@subst' in let open_goals = order_new_goals metasenv subst open_goals ppterm in @@ -668,7 +668,7 @@ let equational_case assert (maxmeta >= maxm); let res' = List.map - (fun subst',(_,metasenv,proof,_),open_goals -> + (fun subst',(_,metasenv,proof,_, _),open_goals -> assert_subst_are_disjoint subst subst'; let subst = subst@subst' in let open_goals = order_new_goals metasenv subst open_goals ppterm in @@ -702,7 +702,7 @@ let try_candidate = let ppterm = ppterm context in try - let subst', ((_,metasenv,_,_), open_goals), maxmeta = + let subst', ((_,metasenv,_,_, _), open_goals), maxmeta = PrimitiveTactics.apply_with_subst ~maxmeta:maxm ~term:cand ~subst (fake_proof,goalno) in @@ -863,7 +863,7 @@ let rec auto_main tables maxm context flags elems universe cache = | Notfound | Failed_in _ when depth > 0 -> (* we have more depth now *) let cache = cache_add_underinspection cache goalty depth in - let fake_proof = None,metasenv,Cic.Meta(goalno,irl),goalty in + let fake_proof = None,metasenv,Cic.Meta(goalno,irl),goalty, [] in (* FG: attrs *) let elems, tables, cache, maxm, flags = if is_equational_case goalty flags then let elems,tables,cache,maxm1, flags = @@ -1044,7 +1044,7 @@ let rec position_of i x = function let superposition_tac ~target ~table ~subterms_only ~demod_table status = Saturation.reset_refs(); let proof,goalno = status in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goalno metasenv in let eq_uri,tty = eq_and_ty_of_goal ty in let env = (metasenv, context, CicUniv.empty_ugraph) in @@ -1148,7 +1148,7 @@ let auto_tac ~(dbd:HMysql.dbd) ~params ~universe (proof, goal) = ~target ~table ~subterms_only ~demod_table (proof,goal) | false -> (* this is the real auto *) - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,_ = CicUtil.lookup_meta goal metasenv in let flags = flags_of_params params () in (* just for testing *) @@ -1162,7 +1162,7 @@ let auto_tac ~(dbd:HMysql.dbd) ~params ~universe (proof, goal) = tables newmeta context (proof, goal) auto_all_solutions universe cache else tables,cache,newmeta in let initial_time = Unix.gettimeofday() in - let (_,oldmetasenv,_,_) = proof in + let (_,oldmetasenv,_,_, _) = proof in let elem = metasenv,[],[goal,flags.maxdepth,AutoTypes.P] in match auto_main tables newmeta context flags [elem] universe cache with | Success (metasenv,subst,_), tables,cache,_ -> @@ -1191,7 +1191,7 @@ let eq_of_goal = function (* DEMODULATE *) let demodulate_tac ~dbd ~universe (proof,goal)= - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in let initgoal = [], [], ty in @@ -1218,7 +1218,7 @@ let demodulate_tac ~dbd ~universe (proof,goal)= in let extended_metasenv = (maxm,context,newty)::metasenv in let extended_status = - (curi,extended_metasenv,pbo,pty),goal in + (curi,extended_metasenv,pbo,pty, attrs),goal in let (status,newgoals) = ProofEngineTypes.apply_tactic (PrimitiveTactics.apply_tac ~term:proofterm) diff --git a/helm/software/components/tactics/autoTactic.ml b/helm/software/components/tactics/autoTactic.ml index e8d034a32..79cf52e65 100644 --- a/helm/software/components/tactics/autoTactic.ml +++ b/helm/software/components/tactics/autoTactic.ml @@ -56,7 +56,7 @@ let search_theorems_in_context status = let module S = CicSubstitution in let module PET = ProofEngineTypes in let module PT = PrimitiveTactics in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,ty = CicUtil.lookup_meta goal metasenv in let rec find n = function | [] -> [] @@ -89,7 +89,7 @@ let search_theorems_in_context status = let compare_goals proof goal1 goal2 = - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let (_, ey1, ty1) = CicUtil.lookup_meta goal1 metasenv in let (_, ey2, ty2) = CicUtil.lookup_meta goal2 metasenv in let ty_sort1,_ = CicTypeChecker.type_of_aux' metasenv ey1 ty1 @@ -129,7 +129,7 @@ let rec auto_single dbd proof goal ey ty depth width sign already_seen_goals if List.mem ty already_seen_goals then [] else let already_seen_goals = ty::already_seen_goals in let facts = (depth = 1) in - let _,metasenv,p,_ = proof in + let _,metasenv,p,_, _ = proof in (* first of all we check if the goal has been already inspected *) assert (CicUtil.exists_meta goal metasenv); @@ -228,7 +228,7 @@ let rec auto_single dbd proof goal ey ty depth width sign already_seen_goals and auto_new dbd width already_seen_goals universe = function | [] -> [] | (subst,(proof, goals, sign))::tl -> - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let goals'= List.filter (fun (goal, _) -> CicUtil.exists_meta goal metasenv) goals in @@ -244,7 +244,7 @@ and auto_new_aux dbd width already_seen_goals universe = function (List.length goals) > width -> auto_new dbd width already_seen_goals universe tl | (subst,(proof, (goal,depth)::gtl, sign))::tl -> - let _,metasenv,p,_ = proof in + let _,metasenv,p,_, _ = proof in let (_, ey ,ty) = CicUtil.lookup_meta goal metasenv in match (auto_single dbd proof goal ey ty depth (width - (List.length gtl)) sign already_seen_goals) universe @@ -284,7 +284,7 @@ let auto_tac_old ?(depth=default_depth) ?(width=default_width) ~(dbd:HMysql.dbd) | (_,(proof,[],_))::_ -> let t2 = Unix.gettimeofday () in debug_print (lazy "AUTO_TAC HA FINITO"); - let _,_,p,_ = proof in + let _,_,p,_, _ = proof in debug_print (lazy (CicPp.ppterm p)); debug_print (lazy (Printf.sprintf "tempo: %.9f\n" (t2 -. t1))); (proof,[]) diff --git a/helm/software/components/tactics/declarative.ml b/helm/software/components/tactics/declarative.ml index 26276f97c..c669a4161 100644 --- a/helm/software/components/tactics/declarative.ml +++ b/helm/software/components/tactics/declarative.ml @@ -136,7 +136,7 @@ let andelim = existselim;; let rewritingstep ~dbd ~universe lhs rhs just last_step = let aux ((proof,goal) as status) = - let (curi,metasenv,proofbo,proofty) = proof in + let (curi,metasenv,proofbo,proofty, attrs) = proof in let _,context,gty = CicUtil.lookup_meta goal metasenv in let eq,trans = match LibraryObjects.eq_URI () with @@ -196,7 +196,7 @@ let rewritingstep ~dbd ~universe lhs rhs just last_step = FreshNamesGenerator.mk_fresh_name ~subst:[] metasenv context (Cic.Name name) ~typ in - let proof = curi,metasenv,proofbo,proofty in + let proof = curi,metasenv,proofbo,proofty, attrs in let proof,goals = ProofEngineTypes.apply_tactic (Tacticals.thens diff --git a/helm/software/components/tactics/discriminationTactics.ml b/helm/software/components/tactics/discriminationTactics.ml index ebf772844..5f3e16d37 100644 --- a/helm/software/components/tactics/discriminationTactics.ml +++ b/helm/software/components/tactics/discriminationTactics.ml @@ -142,7 +142,7 @@ let discriminate_tac ~term = in let discriminate'_tac ~term status = let (proof, goal) = status in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,_ = CicUtil.lookup_meta goal metasenv in let termty,_ = CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph @@ -201,7 +201,7 @@ let rec injection_tac ~first_time ~term ~liftno ~continuation = let module U = UriManager in let module P = PrimitiveTactics in let module T = Tacticals in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,_ = CicUtil.lookup_meta goal metasenv in let term = CicSubstitution.lift liftno term in let termty,_ = (* TASSI: FIXME *) @@ -307,7 +307,7 @@ and injection1_tac ~term ~i ~liftno ~continuation = let module P = PrimitiveTactics in let module T = Tacticals in let term = CicSubstitution.lift liftno term in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,_ = CicUtil.lookup_meta goal metasenv in let termty,_ = (* TASSI: FIXME *) CicTypeChecker.type_of_aux' metasenv context term CicUniv.empty_ugraph @@ -424,7 +424,7 @@ and injection1_tac ~term ~i ~liftno ~continuation = ~start:(ProofEngineTypes.mk_tactic (fun status -> let (proof, goal) = status in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,gty = CicUtil.lookup_meta goal metasenv in diff --git a/helm/software/components/tactics/eliminationTactics.ml b/helm/software/components/tactics/eliminationTactics.ml index f1a9988eb..d05826ec0 100644 --- a/helm/software/components/tactics/eliminationTactics.ml +++ b/helm/software/components/tactics/eliminationTactics.ml @@ -58,7 +58,7 @@ let premise_pattern what = None, [what, C.Implicit (Some `Hole)], None let rec scan_tac ~old_context_length ~index ~tactic = let scan_tac status = let (proof, goal) = status in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let context_length = List.length context in let rec aux index = @@ -86,7 +86,7 @@ let rec check_types types = function let elim_clear_unfold_tac ~mk_fresh_name_callback ~types ~what = let elim_clear_unfold_tac status = let (proof, goal) = status in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let index, ty = H.lookup_type metasenv context what in match check_types types ty with @@ -136,7 +136,7 @@ let decompose_tac ?(mk_fresh_name_callback = F.mk_fresh_name ~subst:[]) ?(user_types=[]) ?what ~dbd = let decompose_tac status = let (proof, goal) = status in - let _, metasenv,_,_ = proof in + let _, metasenv,_,_, _ = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let types = List.rev_append user_types (FwdQueries.decomposables dbd) in let tactic = elim_clear_unfold_tac ~mk_fresh_name_callback ~types in diff --git a/helm/software/components/tactics/equalityTactics.ml b/helm/software/components/tactics/equalityTactics.ml index 89da5c9fd..839d0532a 100644 --- a/helm/software/components/tactics/equalityTactics.ml +++ b/helm/software/components/tactics/equalityTactics.ml @@ -44,7 +44,7 @@ let rec rewrite_tac ~direction ~pattern:(wanted,hyps_pat,concl_pat) equality = let _rewrite_tac status = assert (wanted = None); (* this should be checked syntactically *) let proof,goal = status in - let curi, metasenv, pbo, pty = proof in + let curi, metasenv, pbo, pty, attrs = proof in let (metano,context,gty) = CicUtil.lookup_meta goal metasenv in match hyps_pat with he::(_::_ as tl) -> @@ -184,7 +184,7 @@ let rec rewrite_tac ~direction ~pattern:(wanted,hyps_pat,concl_pat) equality = try let (proof',goals) = PET.apply_tactic - (tac ~term:exact_proof newtyp) ((curi,metasenv',pbo,pty),goal) + (tac ~term:exact_proof newtyp) ((curi,metasenv',pbo,pty, attrs),goal) in let goals = goals@(ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv @@ -217,7 +217,7 @@ let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what = let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what status = let _wanted, hyps_pat, concl_pat = pattern in let (proof, goal) = status in - let uri,metasenv,pbo,pty = proof in + let uri,metasenv,pbo,pty, attrs = proof in let (_,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in assert (hyps_pat = []); (*CSC: not implemented yet *) let eq_URI = @@ -234,7 +234,7 @@ let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what = let with_what = CicMetaSubst.apply_subst subst with_what in let pbo = CicMetaSubst.apply_subst subst pbo in let pty = CicMetaSubst.apply_subst subst pty in - let status = (uri,metasenv,pbo,pty),goal in + let status = (uri,metasenv,pbo,pty, attrs),goal in let ty_of_with_what,u = CicTypeChecker.type_of_aux' metasenv context with_what CicUniv.empty_ugraph in @@ -301,7 +301,7 @@ let replace_tac ~(pattern: ProofEngineTypes.lazy_pattern) ~with_what = ~start:( ProofEngineTypes.mk_tactic (function ((proof,goal) as status) -> - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,_ = CicUtil.lookup_meta goal metasenv in let hyps = try @@ -330,7 +330,7 @@ let reflexivity_tac = let symmetry_tac = let symmetry_tac (proof, goal) = - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in match (R.whd context ty) with (C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) @@ -348,7 +348,7 @@ let symmetry_tac = let transitivity_tac ~term = let transitivity_tac ~term status = let (proof, goal) = status in - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in match (R.whd context ty) with (C.Appl [(C.MutInd (uri, 0, [])); _; _; _]) @@ -379,7 +379,7 @@ let try_tactic ~tactic = let rec lift_rewrite_tac ~context ~direction ~pattern equality = let lift_rewrite_tac status = let (proof, goal) = status in - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let _, new_context, _ = CicUtil.lookup_meta goal metasenv in let n = List.length new_context - List.length context in let equality = if n > 0 then S.lift n equality else equality in @@ -396,7 +396,7 @@ let subst_tac ~hyp = let hole = C.Implicit (Some `Hole) in let subst_tac status = let (proof, goal) = status in - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let what = match PEH.get_rel context hyp with | Some t -> t @@ -440,7 +440,7 @@ let subst_tac = in let subst_tac status = let (proof, goal) = status in - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let tactics = HEL.list_rev_map_filter map context in PET.apply_tactic (T.seq ~tactics) status diff --git a/helm/software/components/tactics/fourierR.ml b/helm/software/components/tactics/fourierR.ml index 1123b506f..4d4f305ae 100644 --- a/helm/software/components/tactics/fourierR.ml +++ b/helm/software/components/tactics/fourierR.ml @@ -577,7 +577,7 @@ let tac_zero_inf_pos (n,d) = (*let cste = pf_parse_constr gl in*) let pall str (proof,goal) t = debug ("tac "^str^" :\n" ); - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in debug ("th = "^ CicPp.ppterm t ^"\n"); debug ("ty = "^ CicPp.ppterm ty^"\n"); @@ -675,7 +675,7 @@ let tac_zero_inf_false gl (n,d) = let tac_zero_infeq_false gl (n,d) = let tac_zero_infeq_false gl (n,d) status = let (proof, goal) = status in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in debug("faccio fold di " ^ CicPp.ppterm @@ -713,13 +713,13 @@ let tac_zero_infeq_false gl (n,d) = let apply_type_tac ~cast:t ~applist:al = let apply_type_tac ~cast:t ~applist:al (proof,goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in let metasenv' = (fresh_meta,context,t)::metasenv in - let proof' = curi,metasenv',pbo,pty in + let proof' = curi,metasenv',pbo,pty, attrs in let proof'',goals = apply_tactic (PrimitiveTactics.apply_tac @@ -734,13 +734,13 @@ let apply_type_tac ~cast:t ~applist:al = let my_cut ~term:c = let my_cut ~term:c (proof,goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in let irl = CicMkImplicit.identity_relocation_list_for_metavariable context in let metasenv' = (fresh_meta,context,c)::metasenv in - let proof' = curi,metasenv',pbo,pty in + let proof' = curi,metasenv',pbo,pty, attrs in let proof'',goals = apply_tactic (apply_type_tac @@ -762,7 +762,7 @@ let tac_use h = let tac_use h status = let (proof, goal) = status in debug("Inizio TC_USE\n"); - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in debug ("hname = "^ CicPp.ppterm h.hname ^"\n"); debug ("ty = "^ CicPp.ppterm ty^"\n"); @@ -873,7 +873,7 @@ let equality_replace a b = debug("inizio EQ\n"); let module C = Cic in let proof,goal = status in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let a_eq_b = C.Appl [ _eqT ; _R ; a ; b ] in let fresh_meta = ProofEngineHelpers.new_meta_of_proof proof in @@ -886,7 +886,7 @@ let equality_replace a b = ~direction:`LeftToRight ~pattern:(ProofEngineTypes.conclusion_pattern None) (C.Meta (fresh_meta,irl)) []) - ((curi,metasenv',pbo,pty),goal) + ((curi,metasenv',pbo,pty, attrs),goal) in let new_goals = fresh_meta::goals in debug("fine EQ -> goals : "^string_of_int( List.length new_goals) ^" = " @@ -934,7 +934,7 @@ let contradiction_tac (proof,goal)= (* ********************* TATTICA ******************************** *) let rec fourier (s_proof,s_goal)= - let s_curi,s_metasenv,s_pbo,s_pty = s_proof in + let s_curi,s_metasenv,s_pbo,s_pty, attrs = s_proof in let s_metano,s_context,s_ty = CicUtil.lookup_meta s_goal s_metasenv in debug ("invoco fourier_tac sul goal "^string_of_int(s_goal)^" e contesto:\n"); debug_pcontext s_context; @@ -974,7 +974,7 @@ let rec fourier (s_proof,s_goal)= (* now we have all the right environment *) - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in (* now we want to convert hp to inequations, but first we must lift @@ -1061,7 +1061,7 @@ let rec fourier (s_proof,s_goal)= (Tacticals.thens ~start:(mk_tactic (fun status -> debug ("inizio t1 strict\n"); - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in debug ("th = "^ CicPp.ppterm _Rfourier_lt ^"\n"); debug ("ty = "^ CicPp.ppterm ty^"\n"); @@ -1092,7 +1092,7 @@ let rec fourier (s_proof,s_goal)= tac1:=(Tacticals.thens ~start:(mk_tactic (fun status -> debug("INIZIO TAC 1 2\n"); - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in debug ("th = "^ CicPp.ppterm _Rfourier_lt_le ^"\n"); debug ("ty = "^ CicPp.ppterm ty^"\n"); @@ -1128,7 +1128,7 @@ let rec fourier (s_proof,s_goal)= ~continuations:[Tacticals.then_ ~start:( mk_tactic (fun status -> let (proof, goal) = status in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in apply_tactic (ReductionTactics.change_tac @@ -1167,7 +1167,7 @@ let rec fourier (s_proof,s_goal)= Tacticals.then_ ~start:(mk_tactic (fun status -> let (proof, goal) = status in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in (* check if ty is of type *) let w1 = diff --git a/helm/software/components/tactics/fwdSimplTactic.ml b/helm/software/components/tactics/fwdSimplTactic.ml index fa7d4aef1..60d43e7c7 100644 --- a/helm/software/components/tactics/fwdSimplTactic.ml +++ b/helm/software/components/tactics/fwdSimplTactic.ml @@ -47,7 +47,7 @@ let error msg = raise (PET.Fail (lazy msg)) let id_tac = let id_tac (proof,goal) = try - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, _, _ = CicUtil.lookup_meta goal metasenv in (proof,[goal]) with CicUtil.Meta_not_found _ -> (proof, []) @@ -62,7 +62,7 @@ let clearbody ~index = in let clearbody status = let (proof, goal) = status in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in PET.apply_tactic (PESR.clearbody ~hyp:(find_name index context)) status in @@ -109,7 +109,7 @@ let lapply_tac_aux ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name (* ?(substs = []) *) ?how_many ?(to_what = []) what = let letin_tac term = PT.letin_tac ~mk_fresh_name_callback term in let lapply_tac (proof, goal) = - let xuri, metasenv, u, t = proof in + let xuri, metasenv, u, t, attrs = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let lemma, _ = TC.type_of_aux' metasenv context what U.empty_ugraph in let lemma = FNG.clean_dummy_dependent_types lemma in @@ -121,7 +121,7 @@ let lapply_tac_aux ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name T.then_ ~start:(letin_tac conclusion) ~continuation:(clearbody ~index:1) in - let proof = (xuri, metasenv, u, t) in + let proof = (xuri, metasenv, u, t, attrs) in let aux (proof, goals) (tac, goal) = let proof, new_goals = PET.apply_tactic tac (proof, goal) in proof, goals @ new_goals @@ -134,7 +134,7 @@ let lapply_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~sub (* ?(substs = []) *) ?(linear = false) ?how_many ?(to_what = []) what = let lapply_tac status = let proof, goal = status in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, context, _ = CicUtil.lookup_meta goal metasenv in let lapply = lapply_tac_aux ~mk_fresh_name_callback ?how_many ~to_what what in let tac = @@ -159,7 +159,7 @@ let fwd_simpl_tac in let fwd_simpl_tac status = let (proof, goal) = status in - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, context, ty = CicUtil.lookup_meta goal metasenv in let index, major = PEH.lookup_type metasenv context hyp in match FwdQueries.fwd_simpl ~dbd major with diff --git a/helm/software/components/tactics/introductionTactics.ml b/helm/software/components/tactics/introductionTactics.ml index 9ed3647c1..07a0c40b5 100644 --- a/helm/software/components/tactics/introductionTactics.ml +++ b/helm/software/components/tactics/introductionTactics.ml @@ -28,7 +28,7 @@ let fake_constructor_tac ~n (proof, goal) = let module C = Cic in let module R = CicReduction in - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in match (R.whd context ty) with (C.MutInd (uri, typeno, exp_named_subst)) diff --git a/helm/software/components/tactics/inversion.ml b/helm/software/components/tactics/inversion.ml index e7adcb7a8..d80814fc3 100644 --- a/helm/software/components/tactics/inversion.ml +++ b/helm/software/components/tactics/inversion.ml @@ -181,7 +181,7 @@ let private_inversion_tac ~term = let private_inversion_tac ~term (proof, goal) = (*DEBUG*) debug_print (lazy ("private inversion begins")); - let (_,metasenv,_,_) = proof in + let _,metasenv,_,_, _ = proof in let uri_of_eq = match LibraryObjects.eq_URI () with None -> raise EqualityNotDefinedYet @@ -238,7 +238,7 @@ let private_inversion_tac ~term = (*DEBUG*) debug_print (lazy ("after apply HCUT;reflexivity in private inversion")); (* apply (ledx_ind( lambda x. lambda y, ...)) *) - let (t1,metasenv,t3,t4) = proof2 in + let t1,metasenv,t3,t4, attrs = proof2 in let goal2 = List.hd (List.tl gl1) in let (_,context,_) = CicUtil.lookup_meta goal2 metasenv in (* rightparameters type list *) @@ -263,13 +263,13 @@ let private_inversion_tac ~term = in (*DEBUG*) debug_print (lazy ("private inversion: termine after refinement: " ^ CicPp.ppterm ref_t)); - let proof2 = (t1,metasenv'',t3,t4) in + let proof2 = (t1,metasenv'',t3,t4, attrs) in let my_apply_tac = let my_apply_tac status = let proof,goals = ProofEngineTypes.apply_tactic (P.apply_tac ref_t) status in let patched_new_goals = - let (_,metasenv''',_,_) = proof in + let (_,metasenv''',_,_, _) = proof in let new_goals = ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv ~newmetasenv:metasenv'' in @@ -303,7 +303,7 @@ let inversion_tac ~term = let module PET = ProofEngineTypes in let inversion_tac ~term (proof, goal) = (*DEBUG*) debug_print (lazy ("inversion begins")); - let (_,metasenv,_,_) = proof in + let _,metasenv,_,_, _ = proof in let (_,context,goalty) = CicUtil.lookup_meta goal metasenv in let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in let uri, typeno = @@ -338,15 +338,15 @@ let inversion_tac ~term = Cic.Appl ([Cic.Const(uri,[])] @ !a @ [Cic.Rel 1]) in let t = appl_term (arity_length + (List.length cons_list)) inversor_uri in - let (t1,metasenv,t3,t4) = proof in + let (t1,metasenv,t3,t4, attrs) = proof in let (ref_t,_,metasenv'',_) = CicRefine.type_of_aux' metasenv context t CicUniv.empty_ugraph in - let proof = (t1,metasenv'',t3,t4) in + let proof = (t1,metasenv'',t3,t4, attrs) in let proof3,gl3 = ProofEngineTypes.apply_tactic (P.apply_tac ref_t) (proof,goal) in let patched_new_goals = - let (_,metasenv''',_,_) = proof3 in + let (_,metasenv''',_,_, _) = proof3 in let new_goals = ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv ~newmetasenv:metasenv'' in diff --git a/helm/software/components/tactics/inversion_principle.ml b/helm/software/components/tactics/inversion_principle.ml index 1d56cab72..b0f4d236f 100644 --- a/helm/software/components/tactics/inversion_principle.ml +++ b/helm/software/components/tactics/inversion_principle.ml @@ -8,7 +8,7 @@ * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. -* + * * HELM is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -153,8 +153,9 @@ let build_inversion uri obj = UriManager.uri_of_string (buri ^ "/" ^ name ^ "_inv" ^ ".con") in let goal = CicMkImplicit.new_meta metasenv [] in let metasenv' = (goal,[],ref_theorem)::metasenv in + let attrs = [`Class (`InversionPrinciple); `Generated] in let proof= - (Some inversor_uri,metasenv',Cic.Meta(goal,[]),ref_theorem) in + (Some inversor_uri,metasenv',Cic.Meta(goal,[]),ref_theorem, attrs) in let _,applies = List.fold_right (fun _ (i,applies) -> @@ -184,8 +185,8 @@ let build_inversion uri obj = )) (proof,goal) in - let metasenv,bo,ty = - match proof1 with (_,metasenv,bo,ty) -> metasenv,bo,ty + let metasenv,bo,ty, attrs = + match proof1 with (_,metasenv,bo,ty, attrs) -> metasenv,bo,ty, attrs in assert (metasenv = []); Some diff --git a/helm/software/components/tactics/metadataQuery.ml b/helm/software/components/tactics/metadataQuery.ml index 443ae973f..2cfd95e9a 100644 --- a/helm/software/components/tactics/metadataQuery.ml +++ b/helm/software/components/tactics/metadataQuery.ml @@ -109,7 +109,7 @@ let filter_uris_backward ~dbd ~facts signature uris = intersect uris siguris let compare_goal_list proof goal1 goal2 = - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let (_, ey1, ty1) = CicUtil.lookup_meta goal1 metasenv in let (_, ey2, ty2) = CicUtil.lookup_meta goal2 metasenv in let ty_sort1,_ = @@ -195,7 +195,7 @@ let cmatch' = Constr.cmatch' (* used only by te old auto *) let signature_of_goal ~(dbd:HMysql.dbd) ((proof, goal) as _status) = - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let (_, context, ty) = CicUtil.lookup_meta goal metasenv in let main, sig_constants = Constr.signature_of ty in let set = signature_of_hypothesis context metasenv in @@ -344,7 +344,7 @@ let equations_for_goal ~(dbd:HMysql.dbd) ?signature ((proof, goal) as _status) = ^ "\n}" in *) - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let (_, context, ty) = CicUtil.lookup_meta goal metasenv in let main, sig_constants = match signature with @@ -394,7 +394,7 @@ let equations_for_goal ~(dbd:HMysql.dbd) ?signature ((proof, goal) as _status) = let experimental_hint ~(dbd:HMysql.dbd) ?(facts=false) ?signature ((proof, goal) as status) = - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let (_, context, ty) = CicUtil.lookup_meta goal metasenv in let (uris, (main, sig_constants)) = match signature with @@ -478,7 +478,7 @@ let new_experimental_hint ~(dbd:HMysql.dbd) ?(facts=false) ?signature ~universe ((proof, goal) as status) = - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let (_, context, ty) = CicUtil.lookup_meta goal metasenv in let (uris, (main, sig_constants)) = match signature with diff --git a/helm/software/components/tactics/negationTactics.ml b/helm/software/components/tactics/negationTactics.ml index c973d75f4..e77fdf4de 100644 --- a/helm/software/components/tactics/negationTactics.ml +++ b/helm/software/components/tactics/negationTactics.ml @@ -31,7 +31,7 @@ let absurd_tac ~term = let module C = Cic in let module U = UriManager in let module P = PrimitiveTactics in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,ty = CicUtil.lookup_meta goal metasenv in let absurd_URI = match LibraryObjects.absurd_URI () with diff --git a/helm/software/components/tactics/paramodulation/saturation.ml b/helm/software/components/tactics/paramodulation/saturation.ml index 8442779d3..514cd049e 100644 --- a/helm/software/components/tactics/paramodulation/saturation.ml +++ b/helm/software/components/tactics/paramodulation/saturation.ml @@ -1319,7 +1319,7 @@ let build_proof if proof_menv = [] then prerr_endline "+++++++++++++++VUOTA" else prerr_endline (CicMetaSubst.ppmetasenv [] proof_menv); let proof, goalno = status in - let uri, metasenv, meta_proof, term_to_prove = proof in + let uri, metasenv, meta_proof, term_to_prove, attrs = proof in let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in let eq_uri = eq_of_goal type_of_goal in let names = Utils.names_of_context context in @@ -1557,7 +1557,7 @@ let pump_actives context bag maxm active passive saturation_steps max_time = let all_subsumed bag maxm status active passive = maxmeta := maxm; let proof, goalno = status in - let uri, metasenv, meta_proof, term_to_prove = proof in + let uri, metasenv, meta_proof, term_to_prove, attrs = proof in let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in let env = metasenv,context,CicUniv.empty_ugraph in let cleaned_goal = Utils.remove_local_context type_of_goal in @@ -1602,7 +1602,7 @@ let given_clause let ma = max_l active_l in let mp = max_l passive_l in let proof, goalno = status in - let uri, metasenv, meta_proof, term_to_prove = proof in + let uri, metasenv, meta_proof, term_to_prove, attrs = proof in let _, context, type_of_goal = CicUtil.lookup_meta goalno metasenv in let eq_uri = eq_of_goal type_of_goal in let cleaned_goal = Utils.remove_local_context type_of_goal in diff --git a/helm/software/components/tactics/primitiveTactics.ml b/helm/software/components/tactics/primitiveTactics.ml index 2e9a3db33..d716ed2d4 100644 --- a/helm/software/components/tactics/primitiveTactics.ml +++ b/helm/software/components/tactics/primitiveTactics.ml @@ -251,7 +251,7 @@ let apply_with_subst ~term ~subst ~maxmeta (proof, goal) = let module T = CicTypeChecker in let module R = CicReduction in let module C = Cic in - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let newmeta = max (CicMkImplicit.new_meta metasenv subst) maxmeta in let exp_named_subst_diff,newmeta',newmetasenvfragment,term' = @@ -365,7 +365,7 @@ let intros_tac ?howmany ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_ = let module C = Cic in let module R = CicReduction in - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in let (context',ty',bo') = @@ -385,7 +385,7 @@ let cut_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst: term (proof, goal) = let module C = Cic in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let newmeta1 = ProofEngineHelpers.new_meta_of_proof ~proof in let newmeta2 = newmeta1 + 1 in @@ -420,7 +420,7 @@ let letin_tac ?(mk_fresh_name_callback=FreshNamesGenerator.mk_fresh_name ~subst: term (proof, goal) = let module C = Cic in - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in (* occur check *) let occur i t = let m = CicUtil.metas_of_term t in @@ -456,7 +456,7 @@ let letin_tac ?(mk_fresh_name_callback=FreshNamesGenerator.mk_fresh_name ~subst: let exact_tac ~term = let exact_tac ~term (proof, goal) = (* Assumption: the term bo must be closed in the current context *) - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let module T = CicTypeChecker in let module R = CicReduction in @@ -480,7 +480,7 @@ let elim_tac ~term = let module U = UriManager in let module R = CicReduction in let module C = Cic in - let (curi,metasenv,proofbo,proofty) = proof in + let (curi,metasenv,proofbo,proofty, attrs) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in let termty = CicReduction.whd context termty in @@ -544,13 +544,13 @@ let elim_tac ~term = ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv ~newmetasenv:metasenv'' in - let proof' = curi,metasenv'',proofbo,proofty in + let proof' = curi,metasenv'',proofbo,proofty, attrs in let proof'', new_goals' = apply_tactic (apply_tac ~term:refined_term) (proof',goal) in (* The apply_tactic can have closed some of the new_goals *) let patched_new_goals = - let (_,metasenv''',_,_) = proof'' in + let (_,metasenv''',_,_, _) = proof'' in List.filter (function i -> List.exists (function (j,_,_) -> j=i) metasenv''' ) new_goals @ new_goals' @@ -566,7 +566,7 @@ let cases_intros_tac ?(mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_nam let module U = UriManager in let module R = CicReduction in let module C = Cic in - let (curi,metasenv,proofbo,proofty) = proof in + let (curi,metasenv,proofbo,proofty, attrs) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in let termty,_ = T.type_of_aux' metasenv context term CicUniv.empty_ugraph in let termty = CicReduction.whd context termty in @@ -637,13 +637,13 @@ prerr_endline (CicMetaSubst.ppterm_in_context ~metasenv:metasenv' [] term_to_ref ProofEngineHelpers.compare_metasenvs ~oldmetasenv:metasenv ~newmetasenv:metasenv'' in - let proof' = curi,metasenv'',proofbo,proofty in + let proof' = curi,metasenv'',proofbo,proofty, attrs in let proof'', new_goals' = apply_tactic (apply_tac ~term:refined_term) (proof',goal) in (* The apply_tactic can have closed some of the new_goals *) let patched_new_goals = - let (_,metasenv''',_,_) = proof'' in + let (_,metasenv''',_,_,_) = proof'' in List.filter (function i -> List.exists (function (j,_,_) -> j=i) metasenv''' ) new_goals @ new_goals' @@ -680,7 +680,7 @@ let letout_tac = let mk_fresh_name_callback = FreshNamesGenerator.mk_fresh_name ~subst:[] in let term = C.Sort C.Set in let letout_tac (proof, goal) = - let curi, metasenv, pbo, pty = proof in + let curi, metasenv, pbo, pty, attrs = proof in let metano, context, ty = CicUtil.lookup_meta goal metasenv in let newmeta = ProofEngineHelpers.new_meta_of_proof ~proof in let fresh_name = mk_fresh_name_callback metasenv context (Cic.Name "hole") ~typ:term in diff --git a/helm/software/components/tactics/proofEngineHelpers.ml b/helm/software/components/tactics/proofEngineHelpers.ml index 9dfad7651..c2d0d15e1 100644 --- a/helm/software/components/tactics/proofEngineHelpers.ml +++ b/helm/software/components/tactics/proofEngineHelpers.ml @@ -27,11 +27,11 @@ exception Bad_pattern of string Lazy.t -let new_meta_of_proof ~proof:(_, metasenv, _, _) = +let new_meta_of_proof ~proof:(_, metasenv, _, _, _) = CicMkImplicit.new_meta metasenv [] let subst_meta_in_proof proof meta term newmetasenv = - let uri,metasenv,bo,ty = proof in + let uri,metasenv,bo,ty, attrs = proof in (* empty context is ok for term since it wont be used by apply_subst *) (* hack: since we do not know the context and the type of term, we create a substitution with cc =[] and type = Implicit; they will be @@ -62,7 +62,7 @@ let subst_meta_in_proof proof meta term newmetasenv = * since the parser does not reject as statements terms with * metavariable therein *) let ty' = subst_in ty in - let newproof = uri,metasenv'',bo',ty' in + let newproof = uri,metasenv'',bo',ty', attrs in (newproof, metasenv'') (*CSC: commento vecchio *) @@ -78,7 +78,7 @@ let subst_meta_in_proof proof meta term newmetasenv = (*CSC: Attenzione! Ora questa funzione applica anche [subst_in] a *) (*CSC: [newmetasenv]. *) let subst_meta_and_metasenv_in_proof proof meta subst_in newmetasenv = - let (uri,_,bo,ty) = proof in + let (uri,_,bo,ty, attrs) = proof in let bo' = subst_in bo in (* Metavariables can appear also in the *statement* of the theorem * since the parser does not reject as statements terms with @@ -104,7 +104,7 @@ let subst_meta_and_metasenv_in_proof proof meta subst_in newmetasenv = | _ -> i ) newmetasenv [] in - let newproof = uri,metasenv',bo',ty' in + let newproof = uri,metasenv',bo',ty', attrs in (newproof, metasenv') let compare_metasenvs ~oldmetasenv ~newmetasenv = diff --git a/helm/software/components/tactics/proofEngineStructuralRules.ml b/helm/software/components/tactics/proofEngineStructuralRules.ml index acc4bb164..3db6d4ff3 100644 --- a/helm/software/components/tactics/proofEngineStructuralRules.ml +++ b/helm/software/components/tactics/proofEngineStructuralRules.ml @@ -30,7 +30,7 @@ module C = Cic let clearbody ~hyp = let clearbody (proof, goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,_,_ = CicUtil.lookup_meta goal metasenv in let string_of_name = function @@ -93,13 +93,13 @@ let clearbody ~hyp = | t -> t ) metasenv in - (curi,metasenv',pbo,pty), [goal] + (curi,metasenv',pbo,pty, attrs), [goal] in PET.mk_tactic clearbody let clear_one ~hyp = let clear_one (proof, goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in @@ -151,7 +151,7 @@ let clear_one ~hyp = | t -> t ) metasenv in - (curi,metasenv',pbo,pty), [goal] + (curi,metasenv',pbo,pty, attrs), [goal] in PET.mk_tactic clear_one @@ -176,7 +176,7 @@ let rename ~froms ~tos = try List.combine froms tos with Invalid_argument _ -> raise (PET.Fail (lazy error)) in - let curi, metasenv, pbo, pty = proof in + let curi, metasenv, pbo, pty, attrs = proof in let metano, _, _ = CicUtil.lookup_meta goal metasenv in let rename_map = function | Some (Cic.Name hyp, decl_or_def) as entry -> @@ -191,14 +191,14 @@ let rename ~froms ~tos = | conjecture -> conjecture in let metasenv = List.map map metasenv in - (curi, metasenv, pbo, pty), [goal] + (curi, metasenv, pbo, pty, attrs), [goal] in PET.mk_tactic rename let set_goal n = PET.mk_tactic (fun (proof, goal) -> - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in if CicUtil.exists_meta n metasenv then (proof, [n]) else diff --git a/helm/software/components/tactics/proofEngineTypes.ml b/helm/software/components/tactics/proofEngineTypes.ml index b887c4bcd..eb48ff3e8 100644 --- a/helm/software/components/tactics/proofEngineTypes.ml +++ b/helm/software/components/tactics/proofEngineTypes.ml @@ -28,12 +28,12 @@ (** current proof (proof uri * metas * (in)complete proof * term to be prooved) *) -type proof = UriManager.uri option * Cic.metasenv * Cic.term * Cic.term +type proof = UriManager.uri option * Cic.metasenv * Cic.term * Cic.term * Cic.attribute list (** current goal, integer index *) type goal = int type status = proof * goal -let initial_status ty metasenv = +let initial_status ty metasenv attrs = let rec aux max = function | [] -> max + 1 | (idx, _, _) :: tl -> @@ -44,7 +44,7 @@ let initial_status ty metasenv = in let newmeta_idx = aux 0 metasenv in let proof = - None, (newmeta_idx, [], ty) :: metasenv, Cic.Meta (newmeta_idx, []), ty + None, (newmeta_idx, [], ty) :: metasenv, Cic.Meta (newmeta_idx, []), ty, attrs in (proof, newmeta_idx) @@ -90,13 +90,13 @@ exception Fail of string Lazy.t calls the opaque tactic on the status *) let apply_tactic t status = - let (uri,metasenv,bo,ty), gl = t status in + let (uri,metasenv,bo,ty, attrs), gl = t status in match CicRefine.pack_coercion_obj - (Cic.CurrentProof ("",metasenv,Cic.Rel ~-1,ty,[],[])) + (Cic.CurrentProof ("",metasenv,Cic.Rel ~-1,ty,[],attrs)) with - | Cic.CurrentProof (_,metasenv,_,ty,_,_) -> - (uri,metasenv,bo,ty), gl + | Cic.CurrentProof (_,metasenv,_,ty,_, attrs) -> + (uri,metasenv,bo,ty, attrs), gl | _ -> assert false ;; @@ -104,5 +104,5 @@ let apply_tactic t status = type mk_fresh_name_type = Cic.metasenv -> Cic.context -> Cic.name -> typ:Cic.term -> Cic.name -let goals_of_proof (_,metasenv,_,_) = List.map (fun (g,_,_) -> g) metasenv +let goals_of_proof (_,metasenv,_,_,_) = List.map (fun (g,_,_) -> g) metasenv diff --git a/helm/software/components/tactics/proofEngineTypes.mli b/helm/software/components/tactics/proofEngineTypes.mli index 4396ea78f..f326a469f 100644 --- a/helm/software/components/tactics/proofEngineTypes.mli +++ b/helm/software/components/tactics/proofEngineTypes.mli @@ -26,7 +26,8 @@ (** current proof (proof uri * metas * (in)complete proof * term to be prooved) *) -type proof = UriManager.uri option * Cic.metasenv * Cic.term * Cic.term +type proof = + UriManager.uri option * Cic.metasenv * Cic.term * Cic.term * Cic.attribute list (** current goal, integer index *) type goal = int type status = proof * goal @@ -34,7 +35,7 @@ type status = proof * goal (** @param goal * @param goal's metasenv * @return initial proof status for the given goal *) -val initial_status: Cic.term -> Cic.metasenv -> status +val initial_status: Cic.term -> Cic.metasenv -> Cic.attribute list -> status (** a tactic: make a transition from one status to another one or, usually, diff --git a/helm/software/components/tactics/reductionTactics.ml b/helm/software/components/tactics/reductionTactics.ml index 115faa80b..754b2c0c5 100644 --- a/helm/software/components/tactics/reductionTactics.ml +++ b/helm/software/components/tactics/reductionTactics.ml @@ -30,7 +30,7 @@ open ProofEngineTypes (* Note: this code is almost identical to change_tac and * it could be unified by making the change function a callback *) let reduction_tac ~reduction ~pattern (proof,goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let (metano,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in let change subst where terms metasenv ugraph = if terms = [] then where, metasenv, ugraph @@ -88,7 +88,7 @@ let reduction_tac ~reduction ~pattern (proof,goal) = | _ as t -> t ) metasenv in - (curi,metasenv',pbo,pty), [metano] + (curi,metasenv',pbo,pty, attrs), [metano] ;; let simpl_tac ~pattern = @@ -131,7 +131,7 @@ exception NotConvertible term(s) to be replaced. *) let change_tac ~pattern with_what = let change_tac ~pattern ~with_what (proof, goal) = - let curi,metasenv,pbo,pty = proof in + let curi,metasenv,pbo,pty, attrs = proof in let (metano,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in let change subst where terms metasenv ugraph = if terms = [] then where, metasenv, ugraph @@ -200,7 +200,7 @@ let change_tac ~pattern with_what = | _ as t -> t) metasenv in - (curi,metasenv',pbo,pty), [metano] + (curi,metasenv',pbo,pty, attrs), [metano] in mk_tactic (change_tac ~pattern ~with_what) diff --git a/helm/software/components/tactics/ring.ml b/helm/software/components/tactics/ring.ml index 4d05ab333..0bc26514d 100644 --- a/helm/software/components/tactics/ring.ml +++ b/helm/software/components/tactics/ring.ml @@ -122,14 +122,14 @@ let cic_is_const ?(uri: uri option = None) term = @param proof a proof @return the uri of a given proof *) -let uri_of_proof ~proof:(uri, _, _, _) = uri +let uri_of_proof ~proof:(uri, _, _, _, _) = uri (** @param status current proof engine status @raise Failure if proof is None @return current goal's metasenv *) -let metasenv_of_status ((_,m,_,_), _) = m +let metasenv_of_status ((_,m,_,_, _), _) = m (** @param status a proof engine status @@ -447,7 +447,7 @@ let purge_hyps_tac ~count = (ProofEngineTypes.apply_tactic (S.clear ~hyps:[name_of_hyp]) status)) | (_, []) -> failwith "Ring.purge_hyps_tac: no hypotheses left" in - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let (_, context, _) = CicUtil.lookup_meta goal metasenv in let proof',goal' = aux count context status in assert (goal = goal') ; diff --git a/helm/software/components/tactics/setoids.ml b/helm/software/components/tactics/setoids.ml index f81fe99ef..1e650cc7a 100644 --- a/helm/software/components/tactics/setoids.ml +++ b/helm/software/components/tactics/setoids.ml @@ -1816,7 +1816,7 @@ let setoid_replace_in id relation c1 c2 ~new_goals (*COQgl*) = let setoid_reflexivity_tac = let tac ((proof,goal) as status) = - let (_,metasenv,_,_) = proof in + let (_,metasenv,_,_, _) = proof in let metano,context,ty = CicUtil.lookup_meta goal metasenv in try let relation_class = diff --git a/helm/software/components/tactics/statefulProofEngine.ml b/helm/software/components/tactics/statefulProofEngine.ml index 9529c897c..4e3badea4 100644 --- a/helm/software/components/tactics/statefulProofEngine.ml +++ b/helm/software/components/tactics/statefulProofEngine.ml @@ -44,7 +44,7 @@ exception Data_failure of exn class ['a] status ?(history_size = default_history_size) - ?uri ~typ ~body ~metasenv init_data compute_data () + ?uri ~typ ~body ~metasenv ~attrs init_data compute_data () = let next_observer_id = let next_id = ref 0 in @@ -52,11 +52,11 @@ class ['a] status incr next_id; !next_id in - let initial_proof = ((uri: UriManager.uri option), metasenv, body, typ) in + let initial_proof = ((uri: UriManager.uri option), metasenv, body, typ, attrs) in let next_goal (goals, proof) = match goals, proof with | goal :: _, _ -> Some goal - | [], (_, (goal, _, _) :: _, _, _) -> + | [], (_, (goal, _, _) :: _, _, _, _) -> (* the tactic left no open goal: let's choose the first open goal *) Some goal | _, _ -> None @@ -109,23 +109,24 @@ class ['a] status raise exn *) - method uri = let (uri, _, _, _) = _proof in uri - method metasenv = let (_, metasenv, _, _) = _proof in metasenv - method body = let (_, _, body, _) = _proof in body - method typ = let (_, _, _, typ) = _proof in typ + method uri = let (uri, _, _, _, _) = _proof in uri + method metasenv = let (_, metasenv, _, _, _) = _proof in metasenv + method body = let (_, _, body, _, _) = _proof in body + method typ = let (_, _, _, typ, _) = _proof in typ + method attrs = let (_, _, _, _, attrs) = _proof in attrs method set_metasenv metasenv = - let (uri, _, body, typ) = _proof in - _proof <- (uri, metasenv, body, typ) + let (uri, _, body, typ, attes) = _proof in + _proof <- (uri, metasenv, body, typ, attrs) method set_uri uri = - let (old_uri, metasenv, body, typ) = _proof in + let (old_uri, metasenv, body, typ, attrs) = _proof in if old_uri <> None then raise Uri_redefinition; - _proof <- (Some uri, metasenv, body, typ) + _proof <- (Some uri, metasenv, body, typ, attrs) method conjecture goal = - let (_, metasenv, _, _) = _proof in + let (_, metasenv, _, _, _) = _proof in CicUtil.lookup_meta goal metasenv method apply_tactic tactic = @@ -209,6 +210,6 @@ class ['a] status end -let trivial_status ?uri ~typ ~body ~metasenv () = - new status ?uri ~typ ~body ~metasenv (fun _ -> ()) (fun _ _ -> ()) () +let trivial_status ?uri ~typ ~body ~metasenv ~attrs () = + new status ?uri ~typ ~body ~metasenv ~attrs (fun _ -> ()) (fun _ _ -> ()) () diff --git a/helm/software/components/tactics/statefulProofEngine.mli b/helm/software/components/tactics/statefulProofEngine.mli index 4198876ca..64a394d74 100644 --- a/helm/software/components/tactics/statefulProofEngine.mli +++ b/helm/software/components/tactics/statefulProofEngine.mli @@ -63,6 +63,7 @@ class ['a] status: ?history_size:int -> (** default 20 *) ?uri:UriManager.uri -> typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv -> + attrs:Cic.attribute list -> (proof_status -> 'a) -> (* init data *) (proof_status * 'a -> proof_status -> 'a) -> (* update data *) unit -> @@ -72,6 +73,7 @@ class ['a] status: method metasenv: Cic.metasenv method body: Cic.term method typ: Cic.term + method attrs: Cic.attribute list (** change metasenv _without_ triggering any notification *) method set_metasenv: Cic.metasenv -> unit @@ -115,6 +117,7 @@ class ['a] status: val trivial_status: ?uri:UriManager.uri -> typ:Cic.term -> body:Cic.term -> metasenv:Cic.metasenv -> + attrs:Cic.attribute list -> unit -> unit status diff --git a/helm/software/components/tactics/tacticals.ml b/helm/software/components/tactics/tacticals.ml index 28bd71b2d..c6fbc36a4 100644 --- a/helm/software/components/tactics/tacticals.ml +++ b/helm/software/components/tactics/tacticals.ml @@ -42,7 +42,7 @@ module PET = ProofEngineTypes let id_tac = let id_tac (proof,goal) = - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, _, _ = CicUtil.lookup_meta goal metasenv in (proof,[goal]) in @@ -50,7 +50,7 @@ let id_tac = let fail_tac = let fail_tac (proof,goal) = - let _, metasenv, _, _ = proof in + let _, metasenv, _, _, _ = proof in let _, _, _ = CicUtil.lookup_meta goal metasenv in raise (PET.Fail (lazy "fail tactical")) in @@ -293,7 +293,7 @@ struct let progress_tactic ~tactic = let msg = lazy "Failed to progress" in let get_sequent (proof, goal) = - let (_, metasenv, _, _) = proof in + let (_, metasenv, _, _, _) = proof in let _, context, ty = CicUtil.lookup_meta goal metasenv in context, ty in diff --git a/helm/software/components/tactics/variousTactics.ml b/helm/software/components/tactics/variousTactics.ml index bc7b52200..16a9c2267 100644 --- a/helm/software/components/tactics/variousTactics.ml +++ b/helm/software/components/tactics/variousTactics.ml @@ -38,7 +38,7 @@ let assumption_tac = let module R = CicReduction in let module S = CicSubstitution in let module PT = PrimitiveTactics in - let _,metasenv,_,_ = proof in + let _,metasenv,_,_, _ = proof in let _,context,ty = CicUtil.lookup_meta goal metasenv in let rec find n = function hd::tl -> @@ -83,7 +83,7 @@ let generalize_tac let module C = Cic in let module P = PrimitiveTactics in let module T = Tacticals in - let uri,metasenv,pbo,pty = proof in + let uri,metasenv,pbo,pty, attrs = proof in let (_,context,ty) as conjecture = CicUtil.lookup_meta goal metasenv in let subst,metasenv,u,selected_hyps,terms_with_context = ProofEngineHelpers.select ~metasenv ~ugraph:CicUniv.empty_ugraph @@ -157,7 +157,7 @@ let generalize_tac else u1 ) u terms_with_context) ; - let status = (uri,metasenv',pbo,pty),goal in + let status = (uri,metasenv',pbo,pty, attrs),goal in let proof,goals = PET.apply_tactic (T.thens @@ -177,7 +177,7 @@ let generalize_tac T.id_tac]) status in - let _,metasenv'',_,_ = proof in + let _,metasenv'',_,_, _ = proof in (* CSC: the following is just a bad approximation since a meta can be closed and then re-opened! *) (proof, -- 2.39.2