aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorMaxime Dénès2019-04-05 12:18:49 +0200
committerMaxime Dénès2019-04-10 15:41:45 +0200
commit5af486406e366bf23558311a7367e573c617e078 (patch)
treee2996582ca8eab104141dd75b82ac1777e53cb72 /plugins
parentf6dc8b19760aaf0cc14e6d9eb2d581ba1a05a762 (diff)
Remove calls to global env in Inductiveops
Diffstat (limited to 'plugins')
-rw-r--r--plugins/cc/cctac.ml2
-rw-r--r--plugins/extraction/extraction.ml2
-rw-r--r--plugins/firstorder/formula.ml8
-rw-r--r--plugins/firstorder/sequent.ml2
-rw-r--r--plugins/funind/glob_term_to_relation.ml6
-rw-r--r--plugins/funind/glob_termops.ml2
-rw-r--r--plugins/ltac/tauto.ml18
-rw-r--r--plugins/ssr/ssrequality.ml4
8 files changed, 25 insertions, 19 deletions
diff --git a/plugins/cc/cctac.ml b/plugins/cc/cctac.ml
index 50fc2448fc..0e3b9fc2b6 100644
--- a/plugins/cc/cctac.ml
+++ b/plugins/cc/cctac.ml
@@ -67,7 +67,7 @@ let rec decompose_term env sigma t=
let canon_mind = MutInd.make1 (MutInd.canonical mind) in
let canon_ind = canon_mind,i_ind in
let (oib,_)=Global.lookup_inductive (canon_ind) in
- let nargs=constructor_nallargs_env env (canon_ind,i_con) in
+ let nargs=constructor_nallargs env (canon_ind,i_con) in
Constructor {ci_constr= ((canon_ind,i_con),u);
ci_arity=nargs;
ci_nhyps=nargs-oib.mind_nparams}
diff --git a/plugins/extraction/extraction.ml b/plugins/extraction/extraction.ml
index c9cfd74362..9db7c8d8d3 100644
--- a/plugins/extraction/extraction.ml
+++ b/plugins/extraction/extraction.ml
@@ -854,7 +854,7 @@ and extract_cons_app env sg mle mlt (((kn,i) as ip,j) as cp) args =
and extract_case env sg mle ((kn,i) as ip,c,br) mlt =
(* [br]: bodies of each branch (in functional form) *)
(* [ni]: number of arguments without parameters in each branch *)
- let ni = constructors_nrealargs_env env ip in
+ let ni = constructors_nrealargs env ip in
let br_size = Array.length br in
assert (Int.equal (Array.length ni) br_size);
if Int.equal br_size 0 then begin
diff --git a/plugins/firstorder/formula.ml b/plugins/firstorder/formula.ml
index 56b3dc97cf..4b7bc707d6 100644
--- a/plugins/firstorder/formula.ml
+++ b/plugins/firstorder/formula.ml
@@ -82,13 +82,13 @@ let pop t = Vars.lift (-1) t
let kind_of_formula env sigma term =
let normalize = special_nf env sigma in
let cciterm = special_whd env sigma term in
- match match_with_imp_term sigma cciterm with
+ match match_with_imp_term env sigma cciterm with
Some (a,b)-> Arrow (a, pop b)
|_->
- match match_with_forall_term sigma cciterm with
+ match match_with_forall_term env sigma cciterm with
Some (_,a,b)-> Forall (a, b)
|_->
- match match_with_nodep_ind sigma cciterm with
+ match match_with_nodep_ind env sigma cciterm with
Some (i,l,n)->
let ind,u=EConstr.destInd sigma i in
let u = EConstr.EInstance.kind sigma u in
@@ -111,7 +111,7 @@ let kind_of_formula env sigma term =
else
Or((ind,u),l,is_trivial)
| _ ->
- match match_with_sigma_type sigma cciterm with
+ match match_with_sigma_type env sigma cciterm with
Some (i,l)->
let (ind, u) = EConstr.destInd sigma i in
let u = EConstr.EInstance.kind sigma u in
diff --git a/plugins/firstorder/sequent.ml b/plugins/firstorder/sequent.ml
index 01b18e2f30..9f2ceb2c28 100644
--- a/plugins/firstorder/sequent.ml
+++ b/plugins/firstorder/sequent.ml
@@ -188,7 +188,7 @@ let empty_seq depth=
let expand_constructor_hints =
List.map_append (function
| GlobRef.IndRef ind ->
- List.init (Inductiveops.nconstructors ind)
+ List.init (Inductiveops.nconstructors (Global.env()) ind)
(fun i -> GlobRef.ConstructRef (ind,i+1))
| gr ->
[gr])
diff --git a/plugins/funind/glob_term_to_relation.ml b/plugins/funind/glob_term_to_relation.ml
index 275b58f0aa..45a4e61846 100644
--- a/plugins/funind/glob_term_to_relation.ml
+++ b/plugins/funind/glob_term_to_relation.ml
@@ -317,7 +317,7 @@ let build_constructors_of_type ind' argl =
Impargs.implicits_of_global constructref
in
let cst_narg =
- Inductiveops.constructor_nallargs_env
+ Inductiveops.constructor_nallargs
(Global.env ())
construct
in
@@ -330,7 +330,7 @@ let build_constructors_of_type ind' argl =
let pat_as_term =
mkGApp(mkGRef (ConstructRef(ind',i+1)),argl)
in
- cases_pattern_of_glob_constr Anonymous pat_as_term
+ cases_pattern_of_glob_constr (Global.env()) Anonymous pat_as_term
)
ind.Declarations.mind_consnames
@@ -415,7 +415,7 @@ let rec pattern_to_term_and_type env typ = DAst.with_val (function
mkGVar id
| PatCstr(constr,patternl,_) ->
let cst_narg =
- Inductiveops.constructor_nallargs_env
+ Inductiveops.constructor_nallargs
(Global.env ())
constr
in
diff --git a/plugins/funind/glob_termops.ml b/plugins/funind/glob_termops.ml
index 13ff19a46b..7b758da8e8 100644
--- a/plugins/funind/glob_termops.ml
+++ b/plugins/funind/glob_termops.ml
@@ -361,7 +361,7 @@ let rec pattern_to_term pt = DAst.with_val (function
mkGVar id
| PatCstr(constr,patternl,_) ->
let cst_narg =
- Inductiveops.constructor_nallargs_env
+ Inductiveops.constructor_nallargs
(Global.env ())
constr
in
diff --git a/plugins/ltac/tauto.ml b/plugins/ltac/tauto.ml
index 4c65445b89..d1951cc18d 100644
--- a/plugins/ltac/tauto.ml
+++ b/plugins/ltac/tauto.ml
@@ -98,16 +98,18 @@ let split = Tactics.split_with_bindings false [Tactypes.NoBindings]
(** Test *)
let is_empty _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
- if is_empty_type sigma (assoc_var "X1" ist) then idtac else fail
+ if is_empty_type genv sigma (assoc_var "X1" ist) then idtac else fail
(* Strictly speaking, this exceeds the propositional fragment as it
matches also equality types (and solves them if a reflexivity) *)
let is_unit_or_eq _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
let flags = assoc_flags ist in
let test = if flags.strict_unit then is_unit_type else is_unit_or_eq_type in
- if test sigma (assoc_var "X1" ist) then idtac else fail
+ if test genv sigma (assoc_var "X1" ist) then idtac else fail
let bugged_is_binary sigma t =
isApp sigma t &&
@@ -121,23 +123,25 @@ let bugged_is_binary sigma t =
(** Dealing with conjunction *)
let is_conj _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
let flags = assoc_flags ist in
let ind = assoc_var "X1" ist in
if (not flags.binary_mode_bugged_detection || bugged_is_binary sigma ind) &&
- is_conjunction sigma
+ is_conjunction genv sigma
~strict:flags.strict_in_hyp_and_ccl
~onlybinary:flags.binary_mode ind
then idtac
else fail
let flatten_contravariant_conj _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
let flags = assoc_flags ist in
let typ = assoc_var "X1" ist in
let c = assoc_var "X2" ist in
let hyp = assoc_var "id" ist in
- match match_with_conjunction sigma
+ match match_with_conjunction genv sigma
~strict:flags.strict_in_contravariant_hyp
~onlybinary:flags.binary_mode typ
with
@@ -151,23 +155,25 @@ let flatten_contravariant_conj _ ist =
(** Dealing with disjunction *)
let is_disj _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
let flags = assoc_flags ist in
let t = assoc_var "X1" ist in
if (not flags.binary_mode_bugged_detection || bugged_is_binary sigma t) &&
- is_disjunction sigma
+ is_disjunction genv sigma
~strict:flags.strict_in_hyp_and_ccl
~onlybinary:flags.binary_mode t
then idtac
else fail
let flatten_contravariant_disj _ ist =
+ Proofview.tclENV >>= fun genv ->
Proofview.tclEVARMAP >>= fun sigma ->
let flags = assoc_flags ist in
let typ = assoc_var "X1" ist in
let c = assoc_var "X2" ist in
let hyp = assoc_var "id" ist in
- match match_with_disjunction sigma
+ match match_with_disjunction genv sigma
~strict:flags.strict_in_contravariant_hyp
~onlybinary:flags.binary_mode
typ with
diff --git a/plugins/ssr/ssrequality.ml b/plugins/ssr/ssrequality.ml
index a7a3fee942..4433f2fce7 100644
--- a/plugins/ssr/ssrequality.ml
+++ b/plugins/ssr/ssrequality.ml
@@ -504,9 +504,9 @@ let rwprocess_rule dir rule gl =
let sigma, rs2 = loop d sigma s a.(1) rs 0 in
let s, sigma = sr sigma 1 in
loop d sigma s a.(0) rs2 0
- | App (r_eq, a) when Hipattern.match_with_equality_type sigma t != None ->
+ | App (r_eq, a) when Hipattern.match_with_equality_type env sigma t != None ->
let (ind, u) = EConstr.destInd sigma r_eq and rhs = Array.last a in
- let np = Inductiveops.inductive_nparamdecls ind in
+ let np = Inductiveops.inductive_nparamdecls env ind in
let indu = (ind, EConstr.EInstance.kind sigma u) in
let ind_ct = Inductiveops.type_of_constructors env indu in
let lhs0 = last_arg sigma (EConstr.of_constr (strip_prod_assum ind_ct.(0))) in