aboutsummaryrefslogtreecommitdiff
path: root/plugins/ssr/ssrequality.ml
diff options
context:
space:
mode:
authorPierre-Marie Pédrot2019-03-20 15:02:33 +0100
committerPierre-Marie Pédrot2019-03-20 15:02:33 +0100
commitd3f40cad021e3c794be99cb90f0e2869ab389f40 (patch)
treea77a4de1a1da4ea6cd7aff1a05e3e0324b36e2c1 /plugins/ssr/ssrequality.ml
parentba33839754bb6ac0f85070e95466a2b8030fdc1b (diff)
parent6d91a9becb10ed0554a00444f5aaf023375d68b8 (diff)
Merge PR #9678: Stop accessing proof env via Pfedit in printers
Ack-by: JasonGross Ack-by: ejgallego Ack-by: gares Ack-by: maximedenes Ack-by: ppedrot
Diffstat (limited to 'plugins/ssr/ssrequality.ml')
-rw-r--r--plugins/ssr/ssrequality.ml34
1 files changed, 17 insertions, 17 deletions
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index 18461c0533..15480c7a45 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -199,13 +199,13 @@ let simplintac occ rdx sim gl =
| SimplCut (n,m) -> tclTHEN (simptac m) (tclTRY (donetac n)) gl
| _ -> simpltac sim gl
-let rec get_evalref sigma c = match EConstr.kind sigma c with
+let rec get_evalref env sigma c = match EConstr.kind sigma c with
| Var id -> EvalVarRef id
| Const (k,_) -> EvalConstRef k
- | App (c', _) -> get_evalref sigma c'
- | Cast (c', _, _) -> get_evalref sigma c'
+ | App (c', _) -> get_evalref env sigma c'
+ | Cast (c', _, _) -> get_evalref env sigma c'
| Proj(c,_) -> EvalConstRef(Projection.constant c)
- | _ -> errorstrm Pp.(str "The term " ++ pr_constr_pat (EConstr.Unsafe.to_constr c) ++ str " is not unfoldable")
+ | _ -> errorstrm Pp.(str "The term " ++ pr_constr_pat env sigma (EConstr.Unsafe.to_constr c) ++ str " is not unfoldable")
(* Strip a pattern generated by a prenex implicit to its constant. *)
let strip_unfold_term _ ((sigma, t) as p) kt = match EConstr.kind sigma t with
@@ -230,7 +230,7 @@ let unfoldintac occ rdx t (kt,_) gl =
let sigma0, concl0, env0 = project gl, pf_concl gl, pf_env gl in
let (sigma, t), const = strip_unfold_term env0 t kt in
let body env t c =
- Tacred.unfoldn [AllOccurrences, get_evalref sigma t] env sigma0 c in
+ Tacred.unfoldn [AllOccurrences, get_evalref env sigma t] env sigma0 c in
let easy = occ = None && rdx = None in
let red_flags = if easy then CClosure.betaiotazeta else CClosure.betaiota in
let beta env = Reductionops.clos_norm_flags red_flags env sigma0 in
@@ -244,7 +244,7 @@ let unfoldintac occ rdx t (kt,_) gl =
try find_T env c h ~k:(fun env c _ _ -> EConstr.Unsafe.to_constr (body env t (EConstr.of_constr c)))
with NoMatch when easy -> c
| NoMatch | NoProgress -> errorstrm Pp.(str"No occurrence of "
- ++ pr_constr_pat (EConstr.Unsafe.to_constr t) ++ spc() ++ str "in " ++ Printer.pr_constr_env env sigma c)),
+ ++ pr_constr_pat env sigma (EConstr.Unsafe.to_constr t) ++ spc() ++ str "in " ++ Printer.pr_constr_env env sigma c)),
(fun () -> try end_T () with
| NoMatch when easy -> fake_pmatcher_end ()
| NoMatch -> anomaly "unfoldintac")
@@ -270,12 +270,12 @@ let unfoldintac occ rdx t (kt,_) gl =
else
try EConstr.Unsafe.to_constr @@ body env t (fs (unify_HO env sigma (EConstr.of_constr c) t) t)
with _ -> errorstrm Pp.(str "The term " ++
- pr_constr_env env sigma c ++spc()++ str "does not unify with " ++ pr_constr_pat (EConstr.Unsafe.to_constr t))),
+ pr_constr_env env sigma c ++spc()++ str "does not unify with " ++ pr_constr_pat env sigma (EConstr.Unsafe.to_constr t))),
fake_pmatcher_end in
let concl =
let concl0 = EConstr.Unsafe.to_constr concl0 in
try beta env0 (EConstr.of_constr (eval_pattern env0 sigma0 concl0 rdx occ unfold))
- with Option.IsNone -> errorstrm Pp.(str"Failed to unfold " ++ pr_constr_pat (EConstr.Unsafe.to_constr t)) in
+ with Option.IsNone -> errorstrm Pp.(str"Failed to unfold " ++ pr_constr_pat env0 sigma (EConstr.Unsafe.to_constr t)) in
let _ = conclude () in
Proofview.V82.of_tactic (convert_concl concl) gl
;;
@@ -298,8 +298,8 @@ let foldtac occ rdx ft gl =
try
let sigma = unify_HO env sigma (EConstr.of_constr c) (EConstr.of_constr t) in
EConstr.to_constr ~abort_on_undefined_evars:false sigma (EConstr.of_constr t)
- with _ -> errorstrm Pp.(str "fold pattern " ++ pr_constr_pat t ++ spc ()
- ++ str "does not match redex " ++ pr_constr_pat c)),
+ with _ -> errorstrm Pp.(str "fold pattern " ++ pr_constr_pat env sigma t ++ spc ()
+ ++ str "does not match redex " ++ pr_constr_pat env sigma c)),
fake_pmatcher_end in
let concl0 = EConstr.Unsafe.to_constr concl0 in
let concl = eval_pattern env0 sigma0 concl0 rdx occ fold in
@@ -412,7 +412,7 @@ let rwcltac cl rdx dir sr gl =
let dc, r2 = EConstr.decompose_lam_n_assum (project gl) n r' in
let r3, _, r3t =
try EConstr.destCast (project gl) r2 with _ ->
- errorstrm Pp.(str "no cast from " ++ pr_constr_pat (EConstr.Unsafe.to_constr (snd sr))
+ errorstrm Pp.(str "no cast from " ++ pr_constr_pat (pf_env gl) (project gl) (EConstr.Unsafe.to_constr (snd sr))
++ str " to " ++ pr_econstr_env (pf_env gl) (project gl) r2) in
let cl' = EConstr.mkNamedProd (make_annot rule_id Sorts.Relevant) (EConstr.it_mkProd_or_LetIn r3t dc) (EConstr.Vars.lift 1 cl) in
let cl'' = EConstr.mkNamedProd (make_annot pattern_id Sorts.Relevant) rdxt cl' in
@@ -473,7 +473,7 @@ let rwprocess_rule dir rule gl =
let t =
if red = 1 then Tacred.hnf_constr env sigma t0
else Reductionops.whd_betaiotazeta sigma t0 in
- ppdebug(lazy Pp.(str"rewrule="++pr_constr_pat (EConstr.Unsafe.to_constr t)));
+ ppdebug(lazy Pp.(str"rewrule="++pr_constr_pat env sigma (EConstr.Unsafe.to_constr t)));
match EConstr.kind sigma t with
| Prod (_, xt, at) ->
let sigma = Evd.create_evar_defs sigma in
@@ -532,8 +532,8 @@ let rwprocess_rule dir rule gl =
sigma, (d, r', lhs, rhs) :: rs
| _ ->
if red = 0 then loop d sigma r t rs 1
- else errorstrm Pp.(str "not a rewritable relation: " ++ pr_constr_pat (EConstr.Unsafe.to_constr t)
- ++ spc() ++ str "in rule " ++ pr_constr_pat (EConstr.Unsafe.to_constr (snd rule)))
+ else errorstrm Pp.(str "not a rewritable relation: " ++ pr_constr_pat env sigma (EConstr.Unsafe.to_constr t)
+ ++ spc() ++ str "in rule " ++ pr_constr_pat env sigma (EConstr.Unsafe.to_constr (snd rule)))
in
let sigma, r = rule in
let t = Retyping.get_type_of env sigma r in
@@ -547,9 +547,9 @@ let rwrxtac occ rdx_pat dir rule gl =
let find_rule rdx =
let rec rwtac = function
| [] ->
- errorstrm Pp.(str "pattern " ++ pr_constr_pat (EConstr.Unsafe.to_constr rdx) ++
+ errorstrm Pp.(str "pattern " ++ pr_constr_pat env (project gl) (EConstr.Unsafe.to_constr rdx) ++
str " does not match " ++ pr_dir_side dir ++
- str " of " ++ pr_constr_pat (EConstr.Unsafe.to_constr (snd rule)))
+ str " of " ++ pr_constr_pat env (project gl) (EConstr.Unsafe.to_constr (snd rule)))
| (d, r, lhs, rhs) :: rs ->
try
let ise = unify_HO env (Evd.create_evar_defs r_sigma) lhs rdx in
@@ -640,7 +640,7 @@ let ssrrewritetac ist rwargs =
let unfoldtac occ ko t kt gl =
let env = pf_env gl in
let cl, c = pf_fill_occ_term gl occ (fst (strip_unfold_term env t kt)) in
- let cl' = EConstr.Vars.subst1 (pf_unfoldn [OnlyOccurrences [1], get_evalref (project gl) c] gl c) cl in
+ let cl' = EConstr.Vars.subst1 (pf_unfoldn [OnlyOccurrences [1], get_evalref env (project gl) c] gl c) cl in
let f = if ko = None then CClosure.betaiotazeta else CClosure.betaiota in
Proofview.V82.of_tactic
(convert_concl (pf_reduce (Reductionops.clos_norm_flags f) gl cl')) gl