aboutsummaryrefslogtreecommitdiff
path: root/plugins/decl_mode
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/decl_mode')
-rw-r--r--plugins/decl_mode/decl_interp.ml6
-rw-r--r--plugins/decl_mode/decl_proof_instr.ml141
-rw-r--r--plugins/decl_mode/decl_proof_instr.mli2
-rw-r--r--plugins/decl_mode/ppdecl_proof.ml2
4 files changed, 87 insertions, 64 deletions
diff --git a/plugins/decl_mode/decl_interp.ml b/plugins/decl_mode/decl_interp.ml
index 2b63ed6d6e..3aa5725295 100644
--- a/plugins/decl_mode/decl_interp.ml
+++ b/plugins/decl_mode/decl_interp.ml
@@ -174,7 +174,7 @@ let get_eq_typ info env =
typ
let interp_constr_in_type typ env sigma c =
- fst (understand env sigma (fst c) ~expected_type:(OfType typ))(*FIXME*)
+ fst (understand env sigma (fst c) ~expected_type:(OfType (EConstr.of_constr typ)))(*FIXME*)
let interp_statement interp_it env sigma st =
{st_label=st.st_label;
@@ -317,7 +317,7 @@ let rec match_aliases names constr = function
let args,bnames,body = match_aliases qnames body q in
st::args,bnames,body
-let detype_ground env c = Detyping.detype false [] env Evd.empty c
+let detype_ground env c = Detyping.detype false [] env Evd.empty (EConstr.of_constr c)
let interp_cases info env sigma params (pat:cases_pattern_expr) hyps =
let et,pinfo =
@@ -375,7 +375,7 @@ let interp_cases info env sigma params (pat:cases_pattern_expr) hyps =
match st'.st_it with
Thesis nam -> {st_it=Thesis nam;st_label=st'.st_label}
| This _ -> {st_it = This st.st_it;st_label=st.st_label} in
- let thyps = fst (match_hyps blend nam2 (Termops.pop rest1) hyps) in
+ let thyps = fst (match_hyps blend nam2 (Vars.lift (-1) rest1) hyps) in
tparams,{pat_vars=tpatvars;
pat_aliases=taliases;
pat_constr=pat_pat;
diff --git a/plugins/decl_mode/decl_proof_instr.ml b/plugins/decl_mode/decl_proof_instr.ml
index deb2ede1d5..2ea4538c31 100644
--- a/plugins/decl_mode/decl_proof_instr.ml
+++ b/plugins/decl_mode/decl_proof_instr.ml
@@ -89,7 +89,7 @@ let tcl_erase_info gls =
let special_whd gl=
let infos=CClosure.create_clos_infos CClosure.all (pf_env gl) in
- (fun t -> CClosure.whd_val infos (CClosure.inject t))
+ (fun t -> CClosure.whd_val infos (CClosure.inject (EConstr.Unsafe.to_constr t)))
let special_nf gl=
let infos=CClosure.create_clos_infos CClosure.betaiotazeta (pf_env gl) in
@@ -131,7 +131,7 @@ let clean_tmp gls =
clean_all (tmp_ids gls) gls
let assert_postpone id t =
- assert_before (Name id) t
+ assert_before (Name id) (EConstr.of_constr t)
(* start a proof *)
@@ -269,6 +269,7 @@ let add_justification_hyps keep items gls =
| _ ->
let id=pf_get_new_id local_hyp_prefix gls in
keep:=Id.Set.add id !keep;
+ let c = EConstr.of_constr c in
tclTHEN (Proofview.V82.of_tactic (letin_tac None (Names.Name id) c None Locusops.nowhere))
(Proofview.V82.of_tactic (clear_body [id])) gls in
tclMAP add_aux items gls
@@ -342,7 +343,7 @@ let rec replace_in_list m l = function
| c::q -> if Int.equal m (fst c) then l@q else c::replace_in_list m l q
let enstack_subsubgoals env se stack gls=
- let hd,params = decompose_app (special_whd gls se.se_type) in
+ let hd,params = decompose_app (special_whd gls (EConstr.of_constr se.se_type)) in
match kind_of_term hd with
Ind (ind,u as indu) when is_good_inductive env ind -> (* MS: FIXME *)
let mib,oib=
@@ -353,7 +354,7 @@ let enstack_subsubgoals env se stack gls=
let constructor = mkConstructU ((ind,succ i),u)
(* constructors numbering*) in
let appterm = applist (constructor,params) in
- let apptype = prod_applist gentyp params in
+ let apptype = Term.prod_applist gentyp params in
let rc,_ = Reduction.dest_prod env apptype in
let rec meta_aux last lenv = function
[] -> (last,lenv,[])
@@ -382,6 +383,9 @@ let enstack_subsubgoals env se stack gls=
Array.iteri process gentypes
| _ -> ()
+let nf_meta sigma c =
+ EConstr.Unsafe.to_constr (Reductionops.nf_meta sigma (EConstr.of_constr c))
+
let rec nf_list evd =
function
[] -> []
@@ -389,11 +393,12 @@ let rec nf_list evd =
if meta_defined evd m then
nf_list evd others
else
- (m,Reductionops.nf_meta evd typ)::nf_list evd others
+ (m,nf_meta evd typ)::nf_list evd others
let find_subsubgoal c ctyp skip submetas gls =
let env= pf_env gls in
let concl = pf_concl gls in
+ let concl = EConstr.Unsafe.to_constr concl in
let evd = mk_evd ((0,concl)::submetas) gls in
let stack = Stack.create () in
let max_meta =
@@ -409,7 +414,7 @@ let find_subsubgoal c ctyp skip submetas gls =
try
let unifier =
Unification.w_unify env se.se_evd Reduction.CUMUL
- ~flags:(Unification.elim_flags ()) ctyp se.se_type in
+ ~flags:(Unification.elim_flags ()) ctyp (EConstr.of_constr se.se_type) in
if n <= 0 then
{se with
se_evd=meta_assign se.se_meta
@@ -424,21 +429,22 @@ let find_subsubgoal c ctyp skip submetas gls =
dfs n
end in
let nse= try dfs skip with Stack.Empty -> raise Not_found in
- nf_list nse.se_evd nse.se_meta_list,Reductionops.nf_meta nse.se_evd (mkMeta 0)
+ nf_list nse.se_evd nse.se_meta_list,nf_meta nse.se_evd (mkMeta 0)
let concl_refiner metas body gls =
let concl = pf_concl gls in
let evd = sig_sig gls in
let env = pf_env gls in
let sort = family_of_sort (Typing.e_sort_of env (ref evd) concl) in
+ let concl = EConstr.Unsafe.to_constr concl in
let rec aux env avoid subst = function
[] -> anomaly ~label:"concl_refiner" (Pp.str "cannot happen")
| (n,typ)::rest ->
let _A = subst_meta subst typ in
- let x = id_of_name_using_hdchar env _A Anonymous in
+ let x = id_of_name_using_hdchar env evd (EConstr.of_constr _A) Anonymous in
let _x = fresh_id avoid x gls in
let nenv = Environ.push_named (LocalAssum (_x,_A)) env in
- let asort = family_of_sort (Typing.e_sort_of nenv (ref evd) _A) in
+ let asort = family_of_sort (Typing.e_sort_of nenv (ref evd) (EConstr.of_constr _A)) in
let nsubst = (n,mkVar _x)::subst in
if List.is_empty rest then
asort,_A,mkNamedLambda _x _A (subst_meta nsubst body)
@@ -446,7 +452,7 @@ let concl_refiner metas body gls =
let bsort,_B,nbody =
aux nenv (_x::avoid) ((n,mkVar _x)::subst) rest in
let body = mkNamedLambda _x _A nbody in
- if occur_term (mkVar _x) _B then
+ if local_occur_var evd _x (EConstr.of_constr _B) then
begin
let _P = mkNamedLambda _x _A _B in
match bsort,sort with
@@ -489,10 +495,11 @@ let thus_tac c ctyp submetas gls =
with Not_found ->
error "I could not relate this statement to the thesis." in
if List.is_empty list then
+ let proof = EConstr.of_constr proof in
Proofview.V82.of_tactic (exact_check proof) gls
else
let refiner = concl_refiner list proof gls in
- Tacmach.refine refiner gls
+ Tacmach.refine (EConstr.of_constr refiner) gls
(* general forward step *)
@@ -500,7 +507,7 @@ let mk_stat_or_thesis info gls = function
This c -> c
| Thesis (For _ ) ->
error "\"thesis for ...\" is not applicable here."
- | Thesis Plain -> pf_concl gls
+ | Thesis Plain -> EConstr.Unsafe.to_constr (pf_concl gls)
let just_tac _then cut info gls0 =
let last_item =
@@ -532,7 +539,7 @@ let instr_cut mkstat _thus _then cut gls0 =
let c_stat = mkstat info gls0 stat.st_it in
let thus_tac gls=
if _thus then
- thus_tac (mkVar c_id) c_stat [] gls
+ thus_tac (mkVar c_id) (EConstr.of_constr c_stat) [] gls
else tclIDTAC gls in
tclTHENS (Proofview.V82.of_tactic (assert_postpone c_id c_stat))
[tclTHEN tcl_erase_info (just_tac _then cut info);
@@ -547,7 +554,7 @@ let decompose_eq id gls =
let whd = (special_whd gls typ) in
match kind_of_term whd with
App (f,args)->
- if eq_constr f (Lazy.force _eq) && Int.equal (Array.length args) 3
+ if Term.eq_constr f (Lazy.force _eq) && Int.equal (Array.length args) 3
then (args.(0),
args.(1),
args.(2))
@@ -578,22 +585,22 @@ let instr_rew _thus rew_side cut gls0 =
| Name id -> id,true in
let thus_tac new_eq gls=
if _thus then
- thus_tac (mkVar c_id) new_eq [] gls
+ thus_tac (mkVar c_id) (EConstr.of_constr new_eq) [] gls
else tclIDTAC gls in
match rew_side with
Lhs ->
let new_eq = mkApp(Lazy.force _eq,[|typ;cut.cut_stat.st_it;rhs|]) in
tclTHENS (Proofview.V82.of_tactic (assert_postpone c_id new_eq))
[tclTHEN tcl_erase_info
- (tclTHENS (Proofview.V82.of_tactic (transitivity lhs))
- [just_tac;Proofview.V82.of_tactic (exact_check (mkVar last_id))]);
+ (tclTHENS (Proofview.V82.of_tactic (transitivity (EConstr.of_constr lhs)))
+ [just_tac;Proofview.V82.of_tactic (exact_check (EConstr.mkVar last_id))]);
thus_tac new_eq] gls0
| Rhs ->
let new_eq = mkApp(Lazy.force _eq,[|typ;lhs;cut.cut_stat.st_it|]) in
tclTHENS (Proofview.V82.of_tactic (assert_postpone c_id new_eq))
[tclTHEN tcl_erase_info
- (tclTHENS (Proofview.V82.of_tactic (transitivity rhs))
- [Proofview.V82.of_tactic (exact_check (mkVar last_id));just_tac]);
+ (tclTHENS (Proofview.V82.of_tactic (transitivity (EConstr.of_constr rhs)))
+ [Proofview.V82.of_tactic (exact_check (EConstr.mkVar last_id));just_tac]);
thus_tac new_eq] gls0
@@ -606,7 +613,7 @@ let instr_claim _thus st gls0 =
| Name id -> id,true in
let thus_tac gls=
if _thus then
- thus_tac (mkVar id) st.st_it [] gls
+ thus_tac (mkVar id) (EConstr.of_constr st.st_it) [] gls
else tclIDTAC gls in
let ninfo1 = {pm_stack=
(if _thus then Focus_claim else Claim)::info.pm_stack} in
@@ -632,7 +639,7 @@ let assume_tac hyps gls =
tclTHEN
(push_intro_tac
(fun id ->
- Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,st.st_it)))) st.st_label))
+ Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,EConstr.of_constr st.st_it)))) st.st_label))
hyps tclIDTAC gls
let assume_hyps_or_theses hyps gls =
@@ -642,7 +649,7 @@ let assume_hyps_or_theses hyps gls =
tclTHEN
(push_intro_tac
(fun id ->
- Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,c)))) nam)
+ Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,EConstr.of_constr c)))) nam)
| Hprop {st_label=nam;st_it=Thesis (tk)} ->
tclTHEN
(push_intro_tac
@@ -654,7 +661,7 @@ let assume_st hyps gls =
(fun st ->
tclTHEN
(push_intro_tac
- (fun id -> Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,st.st_it)))) st.st_label))
+ (fun id -> Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,EConstr.of_constr st.st_it)))) st.st_label))
hyps tclIDTAC gls
let assume_st_letin hyps gls =
@@ -663,7 +670,7 @@ let assume_st_letin hyps gls =
tclTHEN
(push_intro_tac
(fun id ->
- Proofview.V82.of_tactic (convert_hyp (LocalDef (id, fst st.st_it, snd st.st_it)))) st.st_label))
+ Proofview.V82.of_tactic (convert_hyp (LocalDef (id, EConstr.of_constr (fst st.st_it), EConstr.of_constr (snd st.st_it))))) st.st_label))
hyps tclIDTAC gls
(* suffices *)
@@ -673,14 +680,14 @@ let rec metas_from n hyps =
_ :: q -> n :: metas_from (succ n) q
| [] -> []
-let rec build_product args body =
+let rec build_product sigma args body =
match args with
(Hprop st| Hvar st )::rest ->
- let pprod= lift 1 (build_product rest body) in
+ let pprod= lift 1 (build_product sigma rest body) in
let lbody =
match st.st_label with
Anonymous -> pprod
- | Name id -> subst_term (mkVar id) pprod in
+ | Name id -> subst_var id pprod in
mkProd (st.st_label, st.st_it, lbody)
| [] -> body
@@ -688,19 +695,19 @@ let rec build_applist prod = function
[] -> [],prod
| n::q ->
let (_,typ,_) = destProd prod in
- let ctx,head = build_applist (prod_applist prod [mkMeta n]) q in
+ let ctx,head = build_applist (Term.prod_applist prod [mkMeta n]) q in
(n,typ)::ctx,head
let instr_suffices _then cut gls0 =
let info = get_its_info gls0 in
let c_id = pf_get_new_id (Id.of_string "_cofact") gls0 in
let ctx,hd = cut.cut_stat in
- let c_stat = build_product ctx (mk_stat_or_thesis info gls0 hd) in
+ let c_stat = build_product (project gls0) ctx (mk_stat_or_thesis info gls0 hd) in
let metas = metas_from 1 ctx in
let c_ctx,c_head = build_applist c_stat metas in
let c_term = applist (mkVar c_id,List.map mkMeta metas) in
let thus_tac gls=
- thus_tac c_term c_head c_ctx gls in
+ thus_tac c_term (EConstr.of_constr c_head) c_ctx gls in
tclTHENS (Proofview.V82.of_tactic (assert_postpone c_id c_stat))
[tclTHENLIST
[ assume_tac ctx;
@@ -721,7 +728,7 @@ let conjunction_arity id gls =
let gentypes=
Inductive.arities_of_constructors indu (mib,oib) in
let _ = if not (Int.equal (Array.length gentypes) 1) then raise Not_found in
- let apptype = prod_applist gentypes.(0) params in
+ let apptype = Term.prod_applist gentypes.(0) params in
let rc,_ = Reduction.dest_prod env apptype in
List.length rc
| _ -> raise Not_found
@@ -757,7 +764,7 @@ let rec consider_match may_intro introduced available expected gls =
error "Not enough sub-hypotheses to match statements."
(* should tell which ones *)
| id::rest_ids,(Hvar st | Hprop st)::rest ->
- tclIFTHENELSE (Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,st.st_it))))
+ tclIFTHENELSE (Proofview.V82.of_tactic (convert_hyp (LocalAssum (id,EConstr.of_constr st.st_it))))
begin
match st.st_label with
Anonymous ->
@@ -773,7 +780,7 @@ let rec consider_match may_intro introduced available expected gls =
try conjunction_arity id gls with
Not_found -> error "Matching hypothesis not found." in
tclTHENLIST
- [Proofview.V82.of_tactic (simplest_case (mkVar id));
+ [Proofview.V82.of_tactic (simplest_case (EConstr.mkVar id));
intron_then nhyps []
(fun l -> consider_match may_intro introduced
(List.rev_append l rest_ids) expected)] gls)
@@ -781,7 +788,8 @@ let rec consider_match may_intro introduced available expected gls =
gls
let consider_tac c hyps gls =
- match kind_of_term (strip_outer_cast c) with
+ let c = EConstr.of_constr c in
+ match EConstr.kind (project gls) (strip_outer_cast (project gls) c) with
Var id ->
consider_match false [] [id] hyps gls
| _ ->
@@ -800,29 +808,34 @@ let rec take_tac wits gls =
match wits with
[] -> tclIDTAC gls
| wit::rest ->
- let typ = pf_unsafe_type_of gls wit in
+ let typ = pf_unsafe_type_of gls (EConstr.of_constr wit) in
tclTHEN (thus_tac wit typ []) (take_tac rest) gls
(* tactics for define *)
-let rec build_function args body =
+let subst_term sigma c t =
+ EConstr.Unsafe.to_constr (subst_term sigma c t)
+
+let rec build_function sigma args body =
match args with
st::rest ->
- let pfun= lift 1 (build_function rest body) in
+ let pfun= lift 1 (build_function sigma rest body) in
let id = match st.st_label with
Anonymous -> assert false
| Name id -> id in
- mkLambda (Name id, st.st_it, subst_term (mkVar id) pfun)
+ mkLambda (Name id, st.st_it, subst_term sigma (EConstr.mkVar id) (EConstr.of_constr pfun))
| [] -> body
let define_tac id args body gls =
- let t = build_function args body in
+ let t = build_function (project gls) args body in
+ let t = EConstr.of_constr t in
Proofview.V82.of_tactic (letin_tac None (Name id) t None Locusops.nowhere) gls
(* tactics for reconsider *)
let cast_tac id_or_thesis typ gls =
+ let typ = EConstr.of_constr typ in
match id_or_thesis with
| This id ->
Proofview.V82.of_tactic (id |> pf_get_hyp gls |> NamedDecl.set_id id |> NamedDecl.set_type typ |> convert_hyp) gls
@@ -880,8 +893,8 @@ let start_tree env ind rp =
let build_per_info etype casee gls =
let concl=pf_concl gls in
let env=pf_env gls in
- let ctyp=pf_unsafe_type_of gls casee in
- let is_dep = dependent casee concl in
+ let ctyp=pf_unsafe_type_of gls (EConstr.of_constr casee) in
+ let is_dep = dependent (project gls) (EConstr.of_constr casee) concl in
let hd,args = decompose_app (special_whd gls ctyp) in
let (ind,u) =
try
@@ -895,10 +908,12 @@ let build_per_info etype casee gls =
| _ -> mind.mind_nparams,None in
let params,real_args = List.chop nparams args in
let abstract_obj c body =
- let typ=pf_unsafe_type_of gls c in
- lambda_create env (typ,subst_term c body) in
+ let typ=pf_unsafe_type_of gls (EConstr.of_constr c) in
+ lambda_create env (project gls) (typ,Termops.subst_term (project gls) (EConstr.of_constr c) body) in
let pred= List.fold_right abstract_obj
- real_args (lambda_create env (ctyp,subst_term casee concl)) in
+ real_args (lambda_create env (project gls) (ctyp,Termops.subst_term (project gls) (EConstr.of_constr casee) concl)) in
+ let ctyp = EConstr.Unsafe.to_constr ctyp in
+ let pred = EConstr.Unsafe.to_constr pred in
is_dep,
{per_casee=casee;
per_ctype=ctyp;
@@ -953,8 +968,9 @@ let register_nodep_subcase id= function
let suppose_tac hyps gls0 =
let info = get_its_info gls0 in
let thesis = pf_concl gls0 in
+ let thesis = EConstr.Unsafe.to_constr thesis in
let id = pf_get_new_id (Id.of_string "subcase_") gls0 in
- let clause = build_product hyps thesis in
+ let clause = build_product (project gls0) hyps thesis in
let ninfo1 = {pm_stack=Suppose_case::info.pm_stack} in
let old_clauses,stack = register_nodep_subcase id info.pm_stack in
let ninfo2 = {pm_stack=stack} in
@@ -1088,12 +1104,12 @@ let thesis_for obj typ per_info env=
((Printer.pr_constr_env env Evd.empty obj) ++ spc () ++
str"cannot give an induction hypothesis (wrong inductive type).") in
let params,args = List.chop per_info.per_nparams all_args in
- let _ = if not (List.for_all2 eq_constr params per_info.per_params) then
+ let _ = if not (List.for_all2 Term.eq_constr params per_info.per_params) then
user_err ~hdr:"thesis_for"
((Printer.pr_constr_env env Evd.empty obj) ++ spc () ++
str "cannot give an induction hypothesis (wrong parameters).") in
let hd2 = (applist ((lift (List.length rc) per_info.per_pred),args@[obj])) in
- compose_prod rc (Reductionops.whd_beta Evd.empty hd2)
+ compose_prod rc (EConstr.Unsafe.to_constr (Reductionops.whd_beta Evd.empty (EConstr.of_constr hd2)))
let rec build_product_dep pat_info per_info args body gls =
match args with
@@ -1122,7 +1138,7 @@ let rec build_product_dep pat_info per_info args body gls =
with Not_found ->
snd (st_assoc (Name id) pat_info.pat_aliases) in
thesis_for obj typ per_info (pf_env gls)
- | Plain -> pf_concl gls in
+ | Plain -> EConstr.Unsafe.to_constr (pf_concl gls) in
mkProd (st.st_label,ptyp,lbody)
| [] -> body
@@ -1215,15 +1231,16 @@ let pop_stacks stacks =
let hrec_for fix_id per_info gls obj_id =
let obj=mkVar obj_id in
let typ=pf_get_hyp_typ gls obj_id in
+ let typ = EConstr.Unsafe.to_constr typ in
let rc,hd1=decompose_prod typ in
let cind,all_args=decompose_app typ in
let ind,u = destInd cind in assert (eq_ind ind per_info.per_ind);
let params,args= List.chop per_info.per_nparams all_args in
assert begin
- try List.for_all2 eq_constr params per_info.per_params with
+ try List.for_all2 Term.eq_constr params per_info.per_params with
Invalid_argument _ -> false end;
let hd2 = applist (mkVar fix_id,args@[obj]) in
- compose_lam rc (Reductionops.whd_beta gls.sigma hd2)
+ EConstr.of_constr (compose_lam rc (EConstr.Unsafe.to_constr (Reductionops.whd_beta gls.sigma (EConstr.of_constr hd2))))
let warn_missing_case =
CWarnings.create ~name:"declmode-missing-case" ~category:"declmode"
@@ -1257,21 +1274,23 @@ let rec execute_cases fix_name per_info tacnext args objs nhrec tree gls =
let nparams = mind.mind_nparams in
let concl=pf_concl gls in
let env=pf_env gls in
- let ctyp=pf_unsafe_type_of gls casee in
+ let ctyp=pf_unsafe_type_of gls (EConstr.of_constr casee) in
let hd,all_args = decompose_app (special_whd gls ctyp) in
let ind', u = destInd hd in
let _ = assert (eq_ind ind' ind) in (* just in case *)
let params,real_args = List.chop nparams all_args in
let abstract_obj c body =
- let typ=pf_unsafe_type_of gls c in
- lambda_create env (typ,subst_term c body) in
+ let typ=pf_unsafe_type_of gls (EConstr.of_constr c) in
+ lambda_create env (project gls) (typ,Termops.subst_term (project gls) (EConstr.of_constr c) body) in
let elim_pred = List.fold_right abstract_obj
- real_args (lambda_create env (ctyp,subst_term casee concl)) in
+ real_args (lambda_create env (project gls) (ctyp,Termops.subst_term (project gls) (EConstr.of_constr casee) concl)) in
+ let elim_pred = EConstr.Unsafe.to_constr elim_pred in
let case_info = Inductiveops.make_case_info env ind RegularStyle in
let gen_arities = Inductive.arities_of_constructors (ind,u) spec in
let f_ids typ =
let sign =
- (prod_assum (prod_applist typ params)) in
+ (prod_assum (Term.prod_applist typ params)) in
+ let sign = List.map (fun d -> Termops.map_rel_decl EConstr.of_constr d) sign in
find_intro_names sign gls in
let constr_args_ids = Array.map f_ids gen_arities in
let case_term =
@@ -1315,7 +1334,7 @@ let rec execute_cases fix_name per_info tacnext args objs nhrec tree gls =
execute_cases fix_name per_info tacnext
p_args objs nhrec tree] gls0 in
tclTHENSV
- (refine case_term)
+ (refine (EConstr.of_constr case_term))
(Array.mapi branch_tac br) gls
| Split_patt (_, _, _) , [] ->
anomaly ~label:"execute_cases " (Pp.str "Nothing to split")
@@ -1326,6 +1345,7 @@ let rec execute_cases fix_name per_info tacnext args objs nhrec tree gls =
let understand_my_constr env sigma c concl =
let env = env in
+ let c = EConstr.of_constr c in
let rawc = Detyping.detype false [] env Evd.empty c in
let rec frob = function
| GEvar _ -> GHole (Loc.ghost,Evar_kinds.QuestionMark Evar_kinds.Expand,Misctypes.IntroAnonymous,None)
@@ -1367,14 +1387,14 @@ let end_tac et2 gls =
begin
match et,ek with
_,EK_unknown ->
- tclSOLVE [Proofview.V82.of_tactic (simplest_elim pi.per_casee)]
+ tclSOLVE [Proofview.V82.of_tactic (simplest_elim (EConstr.of_constr pi.per_casee))]
| ET_Case_analysis,EK_nodep ->
tclTHEN
- (Proofview.V82.of_tactic (simplest_case pi.per_casee))
+ (Proofview.V82.of_tactic (simplest_case (EConstr.of_constr pi.per_casee)))
(default_justification (List.map mkVar clauses))
| ET_Induction,EK_nodep ->
tclTHENLIST
- [Proofview.V82.of_tactic (generalize (pi.per_args@[pi.per_casee]));
+ [Proofview.V82.of_tactic (generalize (List.map EConstr.of_constr (pi.per_args@[pi.per_casee])));
Proofview.V82.of_tactic (simple_induct (AnonHyp (succ (List.length pi.per_args))));
default_justification (List.map mkVar clauses)]
| ET_Case_analysis,EK_dep tree ->
@@ -1386,7 +1406,7 @@ let end_tac et2 gls =
(initial_instance_stack clauses) [pi.per_casee] 0 tree
| ET_Induction,EK_dep tree ->
let nargs = (List.length pi.per_args) in
- tclTHEN (Proofview.V82.of_tactic (generalize (pi.per_args@[pi.per_casee])))
+ tclTHEN (Proofview.V82.of_tactic (generalize (List.map EConstr.of_constr (pi.per_args@[pi.per_casee]))))
begin
fun gls0 ->
let fix_id =
@@ -1488,6 +1508,7 @@ let rec postprocess pts instr =
| Pend (B_elim ET_Induction) ->
begin
let pfterm = List.hd (Proof.partial_proof pts) in
+ let pfterm = EConstr.Unsafe.to_constr pfterm in
let { it = gls ; sigma = sigma } = Proof.V82.subgoals pts in
let env = try
Goal.V82.env sigma (List.hd gls)
diff --git a/plugins/decl_mode/decl_proof_instr.mli b/plugins/decl_mode/decl_proof_instr.mli
index 325969dadb..ba196ff01b 100644
--- a/plugins/decl_mode/decl_proof_instr.mli
+++ b/plugins/decl_mode/decl_proof_instr.mli
@@ -89,7 +89,7 @@ val push_arg : Term.constr ->
val hrec_for:
Id.t ->
Decl_mode.per_info -> Proof_type.goal Tacmach.sigma ->
- Id.t -> Term.constr
+ Id.t -> EConstr.constr
val consider_match :
bool ->
diff --git a/plugins/decl_mode/ppdecl_proof.ml b/plugins/decl_mode/ppdecl_proof.ml
index f5de638ed2..92045e775b 100644
--- a/plugins/decl_mode/ppdecl_proof.ml
+++ b/plugins/decl_mode/ppdecl_proof.ml
@@ -207,6 +207,8 @@ let pr_glob_proof_instr pconstr1 pconstr2 ptac (instr : glob_proof_instr) =
instr
let pr_proof_instr pconstr1 pconstr2 ptac (instr : proof_instr) =
+ let pconstr1 c = pconstr1 (EConstr.of_constr c) in
+ let pconstr2 c = pconstr2 (EConstr.of_constr c) in
pr_gen_proof_instr
(fun st -> pr_statement pconstr1 st)
pconstr2