diff options
author | 2016-11-26 01:25:11 +0100 | |
---|---|---|
committer | 2017-02-14 17:30:43 +0100 | |
commit | 01849481fbabc3a3fa6c483e703996b01e37fca5 (patch) | |
tree | 80798846a962da7754ddb0b3fae34434de3f7213 /tactics | |
parent | 8beca748d992cd08e2dd7448c8b28dadbcea4a16 (diff) |
Removing compatibility layers from Tacticals
Diffstat (limited to 'tactics')
-rw-r--r-- | tactics/equality.ml | 2 | ||||
-rw-r--r-- | tactics/tacticals.ml | 17 | ||||
-rw-r--r-- | tactics/tacticals.mli | 8 | ||||
-rw-r--r-- | tactics/tactics.ml | 6 |
4 files changed, 17 insertions, 16 deletions
diff --git a/tactics/equality.ml b/tactics/equality.ml index 7dcfd419e..c80cf4416 100644 --- a/tactics/equality.ml +++ b/tactics/equality.ml @@ -647,9 +647,7 @@ let replace_using_leibniz clause c1 c2 l2r unsafe try_prove_eq_opt = let sym = build_coq_eq_sym () in Tacticals.New.pf_constr_of_global sym (fun sym -> Tacticals.New.pf_constr_of_global e (fun e -> - let e = EConstr.of_constr e in let eq = applist (e, [t1;c1;c2]) in - let sym = EConstr.of_constr sym in tclTHENLAST (replace_core clause l2r eq) (tclFIRST diff --git a/tactics/tacticals.ml b/tactics/tacticals.ml index 89acc149c..9cf3c4187 100644 --- a/tactics/tacticals.ml +++ b/tactics/tacticals.ml @@ -11,6 +11,7 @@ open CErrors open Util open Names open Term +open EConstr open Termops open Declarations open Tacmach @@ -73,7 +74,7 @@ let nthDecl m gl = with Failure _ -> error "No such assumption." let nthHypId m gl = nthDecl m gl |> NamedDecl.get_id -let nthHyp m gl = EConstr.mkVar (nthHypId m gl) +let nthHyp m gl = mkVar (nthHypId m gl) let lastDecl gl = nthDecl 1 gl let lastHypId gl = nthHypId 1 gl @@ -83,7 +84,7 @@ let nLastDecls n gl = try List.firstn n (pf_hyps gl) with Failure _ -> error "Not enough hypotheses in the goal." -let nLastHypsId n gl = List.map NamedDecl.get_id (nLastDecls n gl) +let nLastHypsId n gl = List.map (NamedDecl.get_id) (nLastDecls n gl) let nLastHyps n gl = List.map mkVar (nLastHypsId n gl) let onNthDecl m tac gl = tac (nthDecl m gl) gl @@ -147,9 +148,9 @@ let ifOnHyp pred tac1 tac2 id gl = type branch_args = { ity : pinductive; (* the type we were eliminating on *) - largs : EConstr.constr list; (* its arguments *) + largs : constr list; (* its arguments *) branchnum : int; (* the branch number *) - pred : EConstr.constr; (* the predicate we used *) + pred : constr; (* the predicate we used *) nassums : int; (* number of assumptions/letin to be introduced *) branchsign : bool list; (* the signature of the branch. true=assumption, false=let-in *) @@ -226,6 +227,7 @@ let compute_induction_names = compute_induction_names_gen true (* Compute the let-in signature of case analysis or standard induction scheme *) let compute_constructor_signatures isrec ((_,k as ity),u) = + let open Term in let rec analrec c recargs = match kind_of_term c, recargs with | Prod (_,_,c), recarg::rest -> @@ -263,7 +265,7 @@ let pf_with_evars glsev k gls = tclTHEN (Refiner.tclEVARS evd) (k a) gls let pf_constr_of_global gr k = - pf_with_evars (fun gls -> pf_apply Evd.fresh_global gls gr) k + pf_with_evars (fun gls -> on_snd EConstr.of_constr (pf_apply Evd.fresh_global gls gr)) k (* computing the case/elim combinators *) @@ -565,7 +567,7 @@ module New = struct let gl = Proofview.Goal.assume gl in nthDecl m gl |> NamedDecl.get_id let nthHyp m gl = - EConstr.mkVar (nthHypId m gl) + mkVar (nthHypId m gl) let onNthHypId m tac = Proofview.Goal.enter { enter = begin fun gl -> tac (nthHypId m gl) end } @@ -657,7 +659,7 @@ module New = struct let elimclause' = match predicate with | None -> elimclause' - | Some p -> clenv_unify ~flags Reduction.CONV (EConstr.mkMeta pmv) p elimclause' + | Some p -> clenv_unify ~flags Reduction.CONV (mkMeta pmv) p elimclause' in let clenv' = Tacmach.New.of_old (clenv_unique_resolver ~flags elimclause') gl in let after_tac i = @@ -726,6 +728,7 @@ module New = struct let env = Proofview.Goal.env gl in let sigma = Tacmach.New.project gl in let (sigma, c) = Evd.fresh_global env sigma ref in + let c = EConstr.of_constr c in Proofview.Unsafe.tclEVARS sigma <*> (tac c) end } diff --git a/tactics/tacticals.mli b/tactics/tacticals.mli index ba5452e33..2b07d937e 100644 --- a/tactics/tacticals.mli +++ b/tactics/tacticals.mli @@ -65,14 +65,14 @@ val onLastHypId : (Id.t -> tactic) -> tactic val onLastHyp : (constr -> tactic) -> tactic val onLastDecl : (Context.Named.Declaration.t -> tactic) -> tactic val onNLastHypsId : int -> (Id.t list -> tactic) -> tactic -val onNLastHyps : int -> (Constr.constr list -> tactic) -> tactic +val onNLastHyps : int -> (constr list -> tactic) -> tactic val onNLastDecls : int -> (Context.Named.t -> tactic) -> tactic val lastHypId : goal sigma -> Id.t val lastHyp : goal sigma -> constr val lastDecl : goal sigma -> Context.Named.Declaration.t val nLastHypsId : int -> goal sigma -> Id.t list -val nLastHyps : int -> goal sigma -> Constr.constr list +val nLastHyps : int -> goal sigma -> constr list val nLastDecls : int -> goal sigma -> Context.Named.t val afterHyp : Id.t -> goal sigma -> Context.Named.t @@ -135,7 +135,7 @@ val elimination_sort_of_hyp : Id.t -> goal sigma -> sorts_family val elimination_sort_of_clause : Id.t option -> goal sigma -> sorts_family val pf_with_evars : (goal sigma -> Evd.evar_map * 'a) -> ('a -> tactic) -> tactic -val pf_constr_of_global : Globnames.global_reference -> (Constr.constr -> tactic) -> tactic +val pf_constr_of_global : Globnames.global_reference -> (constr -> tactic) -> tactic val elim_on_ba : (branch_assumptions -> tactic) -> branch_args -> tactic val case_on_ba : (branch_assumptions -> tactic) -> branch_args -> tactic @@ -267,5 +267,5 @@ module New : sig val elim_on_ba : (branch_assumptions -> unit Proofview.tactic) -> branch_args -> unit Proofview.tactic val case_on_ba : (branch_assumptions -> unit Proofview.tactic) -> branch_args -> unit Proofview.tactic - val pf_constr_of_global : Globnames.global_reference -> (Constr.constr -> unit Proofview.tactic) -> unit Proofview.tactic + val pf_constr_of_global : Globnames.global_reference -> (constr -> unit Proofview.tactic) -> unit Proofview.tactic end diff --git a/tactics/tactics.ml b/tactics/tactics.ml index e4dd9eea2..10582288c 100644 --- a/tactics/tactics.ml +++ b/tactics/tactics.ml @@ -4742,7 +4742,7 @@ let symmetry_red allowred = | Some eq_data,_,_ -> Tacticals.New.tclTHEN (convert_concl_no_check concl DEFAULTcast) - (Tacticals.New.pf_constr_of_global eq_data.sym (EConstr.of_constr %> apply)) + (Tacticals.New.pf_constr_of_global eq_data.sym apply) | None,eq,eq_kind -> prove_symmetry eq eq_kind end } @@ -4838,8 +4838,8 @@ let transitivity_red allowred t = Tacticals.New.tclTHEN (convert_concl_no_check concl DEFAULTcast) (match t with - | None -> Tacticals.New.pf_constr_of_global eq_data.trans (EConstr.of_constr %> eapply) - | Some t -> Tacticals.New.pf_constr_of_global eq_data.trans (fun trans -> apply_list [EConstr.of_constr trans;t])) + | None -> Tacticals.New.pf_constr_of_global eq_data.trans eapply + | Some t -> Tacticals.New.pf_constr_of_global eq_data.trans (fun trans -> apply_list [trans;t])) | None,eq,eq_kind -> match t with | None -> Tacticals.New.tclZEROMSG (str"etransitivity not supported for this relation.") |