aboutsummaryrefslogtreecommitdiff
path: root/pretyping
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 /pretyping
parentf6dc8b19760aaf0cc14e6d9eb2d581ba1a05a762 (diff)
Remove calls to global env in Inductiveops
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/cases.ml8
-rw-r--r--pretyping/classops.ml4
-rw-r--r--pretyping/detyping.ml14
-rw-r--r--pretyping/detyping.mli4
-rw-r--r--pretyping/evarsolve.ml12
-rw-r--r--pretyping/glob_ops.ml8
-rw-r--r--pretyping/glob_ops.mli2
-rw-r--r--pretyping/inductiveops.ml143
-rw-r--r--pretyping/inductiveops.mli49
-rw-r--r--pretyping/pretyping.ml2
-rw-r--r--pretyping/retyping.ml2
11 files changed, 123 insertions, 125 deletions
diff --git a/pretyping/cases.ml b/pretyping/cases.ml
index e22368d5e5..d7a6c4c832 100644
--- a/pretyping/cases.ml
+++ b/pretyping/cases.ml
@@ -284,7 +284,7 @@ let rec find_row_ind = function
let inductive_template env sigma tmloc ind =
let sigma, indu = Evd.fresh_inductive_instance env sigma ind in
- let arsign = inductive_alldecls_env env indu in
+ let arsign = inductive_alldecls env indu in
let indu = on_snd EInstance.make indu in
let hole_source i = match tmloc with
| Some loc -> Loc.tag ~loc @@ Evar_kinds.TomatchTypeParameter (ind,i)
@@ -313,7 +313,7 @@ let try_find_ind env sigma typ realnames =
| Some names -> names
| None ->
let ind = fst (fst (dest_ind_family indf)) in
- List.make (inductive_nrealdecls ind) Anonymous in
+ List.make (inductive_nrealdecls env ind) Anonymous in
IsInd (typ,ind,names)
let inh_coerce_to_ind env sigma0 loc ty tyi =
@@ -1796,7 +1796,7 @@ let build_inversion_problem ~program_mode loc env sigma tms t =
| Construct (cstr,u) -> DAst.make (PatCstr (cstr,[],Anonymous)), acc
| App (f,v) when isConstruct sigma f ->
let cstr,u = destConstruct sigma f in
- let n = constructor_nrealargs_env !!env cstr in
+ let n = constructor_nrealargs !!env cstr in
let l = List.lastn n (Array.to_list v) in
let l,acc = List.fold_right_map reveal_pattern l acc in
DAst.make (PatCstr (cstr,l,Anonymous)), acc
@@ -1929,7 +1929,7 @@ let extract_arity_signature ?(dolift=true) env0 tomatchl tmsign =
| IsInd (term,IndType(indf,realargs),_) ->
let indf' = if dolift then lift_inductive_family n indf else indf in
let ((ind,u),_) = dest_ind_family indf' in
- let nrealargs_ctxt = inductive_nrealdecls_env env0 ind in
+ let nrealargs_ctxt = inductive_nrealdecls env0 ind in
let arsign, inds = get_arity env0 indf' in
let arsign = List.map (fun d -> map_rel_decl EConstr.of_constr d) arsign in
let realnal =
diff --git a/pretyping/classops.ml b/pretyping/classops.ml
index 0203819051..90ce1cc594 100644
--- a/pretyping/classops.ml
+++ b/pretyping/classops.ml
@@ -287,7 +287,7 @@ let get_coercion_constructor env coe =
let red x = fst (Reductionops.whd_all_stack env evd x) in
match EConstr.kind evd (red (mkNamed coe.coe_value)) with
| Constr.Construct (c, _) ->
- c, Inductiveops.constructor_nrealargs c -1
+ c, Inductiveops.constructor_nrealargs env c -1
| _ -> raise Not_found
let lookup_pattern_path_between env (s,t) =
@@ -442,7 +442,7 @@ module CoercionPrinting =
struct
type t = coe_typ
let compare = GlobRef.Ordered.compare
- let encode = coercion_of_reference
+ let encode _env = coercion_of_reference
let subst = subst_coe_typ
let printer x = Nametab.pr_global_env Id.Set.empty x
let key = ["Printing";"Coercion"]
diff --git a/pretyping/detyping.ml b/pretyping/detyping.ml
index 5003d0eec6..eaa5736336 100644
--- a/pretyping/detyping.ml
+++ b/pretyping/detyping.ml
@@ -145,9 +145,9 @@ let add_name_opt na b t (nenv, env) =
(****************************************************************************)
(* Tools for printing of Cases *)
-let encode_inductive r =
+let encode_inductive env r =
let indsp = Nametab.global_inductive r in
- let constr_lengths = constructors_nrealargs indsp in
+ let constr_lengths = constructors_nrealargs env indsp in
(indsp,constr_lengths)
(* Parameterization of the translation from constr to ast *)
@@ -159,15 +159,15 @@ let has_two_constructors lc =
let isomorphic_to_tuple lc = Int.equal (Array.length lc) 1
-let encode_bool ({CAst.loc} as r) =
- let (x,lc) = encode_inductive r in
+let encode_bool env ({CAst.loc} as r) =
+ let (x,lc) = encode_inductive env r in
if not (has_two_constructors lc) then
user_err ?loc ~hdr:"encode_if"
(str "This type has not exactly two constructors.");
x
-let encode_tuple ({CAst.loc} as r) =
- let (x,lc) = encode_inductive r in
+let encode_tuple env ({CAst.loc} as r) =
+ let (x,lc) = encode_inductive env r in
if not (isomorphic_to_tuple lc) then
user_err ?loc ~hdr:"encode_tuple"
(str "This type cannot be seen as a tuple type.");
@@ -175,7 +175,7 @@ let encode_tuple ({CAst.loc} as r) =
module PrintingInductiveMake =
functor (Test : sig
- val encode : qualid -> inductive
+ val encode : Environ.env -> qualid -> inductive
val member_message : Pp.t -> bool -> Pp.t
val field : string
val title : string
diff --git a/pretyping/detyping.mli b/pretyping/detyping.mli
index 425fd5096e..1a8e97efb8 100644
--- a/pretyping/detyping.mli
+++ b/pretyping/detyping.mli
@@ -87,7 +87,7 @@ val subst_genarg_hook :
module PrintingInductiveMake :
functor (Test : sig
- val encode : Libnames.qualid -> Names.inductive
+ val encode : Environ.env -> Libnames.qualid -> Names.inductive
val member_message : Pp.t -> bool -> Pp.t
val field : string
val title : string
@@ -95,7 +95,7 @@ module PrintingInductiveMake :
sig
type t = Names.inductive
val compare : t -> t -> int
- val encode : Libnames.qualid -> Names.inductive
+ val encode : Environ.env -> Libnames.qualid -> Names.inductive
val subst : substitution -> t -> t
val printer : t -> Pp.t
val key : Goptions.option_name
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml
index 6d2d07d1dc..4a941a68b1 100644
--- a/pretyping/evarsolve.ml
+++ b/pretyping/evarsolve.ml
@@ -1203,17 +1203,17 @@ exception CannotProject of evar_map * EConstr.existential
of subterms to eventually discard so as to be allowed to keep ti.
*)
-let rec is_constrainable_in top evd k (ev,(fv_rels,fv_ids) as g) t =
+let rec is_constrainable_in top env evd k (ev,(fv_rels,fv_ids) as g) t =
let f,args = decompose_app_vect evd t in
match EConstr.kind evd f with
| Construct ((ind,_),u) ->
- let n = Inductiveops.inductive_nparams ind in
+ let n = Inductiveops.inductive_nparams env ind in
if n > Array.length args then true (* We don't try to be more clever *)
else
let params = fst (Array.chop n args) in
- Array.for_all (is_constrainable_in false evd k g) params
- | Ind _ -> Array.for_all (is_constrainable_in false evd k g) args
- | Prod (na,t1,t2) -> is_constrainable_in false evd k g t1 && is_constrainable_in false evd k g t2
+ Array.for_all (is_constrainable_in false env evd k g) params
+ | Ind _ -> Array.for_all (is_constrainable_in false env evd k g) args
+ | Prod (na,t1,t2) -> is_constrainable_in false env evd k g t1 && is_constrainable_in false env evd k g t2
| Evar (ev',_) -> top || not (Evar.equal ev' ev) (*If ev' needed, one may also try to restrict it*)
| Var id -> Id.Set.mem id fv_ids
| Rel n -> n <= k || Int.Set.mem n fv_rels
@@ -1238,7 +1238,7 @@ let has_constrainable_free_vars env evd aliases force k ev (fv_rels,fv_ids,let_r
| None ->
(* t is an instance for a proper variable; we filter it along *)
(* the free variables allowed to occur *)
- (not force || noccur_evar env evd ev t) && is_constrainable_in true evd k (ev,(fv_rels,fv_ids)) t
+ (not force || noccur_evar env evd ev t) && is_constrainable_in true env evd k (ev,(fv_rels,fv_ids)) t
exception EvarSolvedOnTheFly of evar_map * EConstr.constr
diff --git a/pretyping/glob_ops.ml b/pretyping/glob_ops.ml
index 82e42d41be..6da168711c 100644
--- a/pretyping/glob_ops.ml
+++ b/pretyping/glob_ops.ml
@@ -492,7 +492,7 @@ let is_gvar id c = match DAst.get c with
| GVar id' -> Id.equal id id'
| _ -> false
-let rec cases_pattern_of_glob_constr na c =
+let rec cases_pattern_of_glob_constr env na c =
(* Forcing evaluation to ensure that the possible raising of
Not_found is not delayed *)
let c = DAst.force c in
@@ -509,14 +509,14 @@ let rec cases_pattern_of_glob_constr na c =
| GApp (c, l) ->
begin match DAst.get c with
| GRef (ConstructRef cstr,_) ->
- let nparams = Inductiveops.inductive_nparams (fst cstr) in
+ let nparams = Inductiveops.inductive_nparams env (fst cstr) in
let _,l = List.chop nparams l in
- PatCstr (cstr,List.map (cases_pattern_of_glob_constr Anonymous) l,na)
+ PatCstr (cstr,List.map (cases_pattern_of_glob_constr env Anonymous) l,na)
| _ -> raise Not_found
end
| GLetIn (Name id as na',b,None,e) when is_gvar id e && na = Anonymous ->
(* A canonical encoding of aliases *)
- DAst.get (cases_pattern_of_glob_constr na' b)
+ DAst.get (cases_pattern_of_glob_constr env na' b)
| _ -> raise Not_found
) c
diff --git a/pretyping/glob_ops.mli b/pretyping/glob_ops.mli
index 47c65c2a72..df902a8fa7 100644
--- a/pretyping/glob_ops.mli
+++ b/pretyping/glob_ops.mli
@@ -94,7 +94,7 @@ val map_pattern : (glob_constr -> glob_constr) ->
Evaluation is forced.
Take the current alias as parameter,
@raise Not_found if translation is impossible *)
-val cases_pattern_of_glob_constr : Name.t -> 'a glob_constr_g -> 'a cases_pattern_g
+val cases_pattern_of_glob_constr : Environ.env -> Name.t -> 'a glob_constr_g -> 'a cases_pattern_g
val glob_constr_of_closed_cases_pattern : Environ.env -> 'a cases_pattern_g -> Name.t * 'a glob_constr_g
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index 678aebfbe6..b1c98da2c7 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -112,162 +112,145 @@ let mis_nf_constructor_type ((ind,u),mib,mip) j =
(* Number of constructors *)
-let nconstructors ind =
- let (_,mip) = Global.lookup_inductive ind in
- Array.length mip.mind_consnames
-
-let nconstructors_env env ind =
+let nconstructors env ind =
let (_,mip) = Inductive.lookup_mind_specif env ind in
Array.length mip.mind_consnames
-(* Arity of constructors excluding parameters, excluding local defs *)
+let nconstructors_env env ind = nconstructors env ind
+[@@ocaml.deprecated "Alias for Inductiveops.nconstructors"]
-let constructors_nrealargs ind =
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_consnrealargs
+(* Arity of constructors excluding parameters, excluding local defs *)
-let constructors_nrealargs_env env ind =
+let constructors_nrealargs env ind =
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealargs
-(* Arity of constructors excluding parameters, including local defs *)
+let constructors_nrealargs_env env ind = constructors_nrealargs env ind
+[@@ocaml.deprecated "Alias for Inductiveops.constructors_nrealargs"]
-let constructors_nrealdecls ind =
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_consnrealdecls
+(* Arity of constructors excluding parameters, including local defs *)
-let constructors_nrealdecls_env env ind =
+let constructors_nrealdecls env ind =
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealdecls
+let constructors_nrealdecls_env env ind = constructors_nrealdecls env ind
+[@@ocaml.deprecated "Alias for Inductiveops.constructors_nrealdecls"]
+
(* Arity of constructors including parameters, excluding local defs *)
-let constructor_nallargs (indsp,j) =
- let (mib,mip) = Global.lookup_inductive indsp in
+let constructor_nallargs env (ind,j) =
+ let (mib,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealargs.(j-1) + mib.mind_nparams
-let constructor_nallargs_env env ((kn,i),j) =
- let mib = Environ.lookup_mind kn env in
- let mip = mib.mind_packets.(i) in
- mip.mind_consnrealargs.(j-1) + mib.mind_nparams
+let constructor_nallargs_env env (indsp,j) = constructor_nallargs env (indsp,j)
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nallargs"]
(* Arity of constructors including params, including local defs *)
-let constructor_nalldecls (indsp,j) = (* TOCHANGE en decls *)
- let (mib,mip) = Global.lookup_inductive indsp in
+let constructor_nalldecls env (ind,j) = (* TOCHANGE en decls *)
+ let (mib,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealdecls.(j-1) + Context.Rel.length (mib.mind_params_ctxt)
-let constructor_nalldecls_env env ((kn,i),j) = (* TOCHANGE en decls *)
- let mib = Environ.lookup_mind kn env in
- let mip = mib.mind_packets.(i) in
- mip.mind_consnrealdecls.(j-1) + Context.Rel.length (mib.mind_params_ctxt)
+let constructor_nalldecls_env env (indsp,j) = constructor_nalldecls env (indsp,j)
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nalldecls"]
(* Arity of constructors excluding params, excluding local defs *)
-let constructor_nrealargs (ind,j) =
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_consnrealargs.(j-1)
-
-let constructor_nrealargs_env env (ind,j) =
+let constructor_nrealargs env (ind,j) =
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealargs.(j-1)
-(* Arity of constructors excluding params, including local defs *)
+let constructor_nrealargs_env env (ind,j) = constructor_nrealargs env (ind,j)
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nrealargs"]
-let constructor_nrealdecls (ind,j) = (* TOCHANGE en decls *)
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_consnrealdecls.(j-1)
+(* Arity of constructors excluding params, including local defs *)
-let constructor_nrealdecls_env env (ind,j) = (* TOCHANGE en decls *)
+let constructor_nrealdecls env (ind,j) = (* TOCHANGE en decls *)
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_consnrealdecls.(j-1)
-(* Length of arity, excluding params, excluding local defs *)
+let constructor_nrealdecls_env env (ind,j) = constructor_nrealdecls env (ind,j)
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nrealdecls"]
-let inductive_nrealargs ind =
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_nrealargs
+(* Length of arity, excluding params, excluding local defs *)
-let inductive_nrealargs_env env ind =
+let inductive_nrealargs env ind =
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_nrealargs
-(* Length of arity, excluding params, including local defs *)
+let inductive_nrealargs_env env ind = inductive_nrealargs env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nrealargs"]
-let inductive_nrealdecls ind =
- let (_,mip) = Global.lookup_inductive ind in
- mip.mind_nrealdecls
+(* Length of arity, excluding params, including local defs *)
-let inductive_nrealdecls_env env ind =
+let inductive_nrealdecls env ind =
let (_,mip) = Inductive.lookup_mind_specif env ind in
mip.mind_nrealdecls
-(* Full length of arity (w/o local defs) *)
+let inductive_nrealdecls_env env ind = inductive_nrealdecls env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nrealdecls"]
-let inductive_nallargs ind =
- let (mib,mip) = Global.lookup_inductive ind in
- mib.mind_nparams + mip.mind_nrealargs
+(* Full length of arity (w/o local defs) *)
-let inductive_nallargs_env env ind =
+let inductive_nallargs env ind =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
mib.mind_nparams + mip.mind_nrealargs
-(* Length of arity (w/o local defs) *)
+let inductive_nallargs_env env ind = inductive_nallargs env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nallargs"]
-let inductive_nparams ind =
- let (mib,mip) = Global.lookup_inductive ind in
- mib.mind_nparams
+(* Length of arity (w/o local defs) *)
-let inductive_nparams_env env ind =
+let inductive_nparams env ind =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
mib.mind_nparams
-(* Length of arity (with local defs) *)
+let inductive_nparams_env env ind = inductive_nparams env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nparams"]
-let inductive_nparamdecls ind =
- let (mib,mip) = Global.lookup_inductive ind in
- Context.Rel.length mib.mind_params_ctxt
+(* Length of arity (with local defs) *)
-let inductive_nparamdecls_env env ind =
+let inductive_nparamdecls env ind =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
Context.Rel.length mib.mind_params_ctxt
-(* Full length of arity (with local defs) *)
+let inductive_nparamdecls_env env ind = inductive_nparamdecls env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nparamsdecls"]
-let inductive_nalldecls ind =
- let (mib,mip) = Global.lookup_inductive ind in
- Context.Rel.length (mib.mind_params_ctxt) + mip.mind_nrealdecls
+(* Full length of arity (with local defs) *)
-let inductive_nalldecls_env env ind =
+let inductive_nalldecls env ind =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
Context.Rel.length (mib.mind_params_ctxt) + mip.mind_nrealdecls
-(* Others *)
+let inductive_nalldecls_env env ind = inductive_nalldecls env ind
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nalldecls"]
-let inductive_paramdecls (ind,u) =
- let (mib,mip) = Global.lookup_inductive ind in
- Inductive.inductive_paramdecls (mib,u)
+(* Others *)
-let inductive_paramdecls_env env (ind,u) =
+let inductive_paramdecls env (ind,u) =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
Inductive.inductive_paramdecls (mib,u)
-let inductive_alldecls (ind,u) =
- let (mib,mip) = Global.lookup_inductive ind in
- Vars.subst_instance_context u mip.mind_arity_ctxt
+let inductive_paramdecls_env env (ind,u) = inductive_paramdecls env (ind,u)
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_paramsdecls"]
-let inductive_alldecls_env env (ind,u) =
+let inductive_alldecls env (ind,u) =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
Vars.subst_instance_context u mip.mind_arity_ctxt
-let constructor_has_local_defs (indsp,j) =
- let (mib,mip) = Global.lookup_inductive indsp in
+let inductive_alldecls_env env (ind,u) = inductive_alldecls env (ind,u)
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_alldecls"]
+
+let constructor_has_local_defs env (indsp,j) =
+ let (mib,mip) = Inductive.lookup_mind_specif env indsp in
let l1 = mip.mind_consnrealdecls.(j-1) + Context.Rel.length (mib.mind_params_ctxt) in
let l2 = recarg_length mip.mind_recargs j + mib.mind_nparams in
not (Int.equal l1 l2)
-let inductive_has_local_defs ind =
- let (mib,mip) = Global.lookup_inductive ind in
+let inductive_has_local_defs env ind =
+ let (mib,mip) = Inductive.lookup_mind_specif env ind in
let l1 = Context.Rel.length (mib.mind_params_ctxt) + mip.mind_nrealdecls in
let l2 = mib.mind_nparams + mip.mind_nrealargs in
not (Int.equal l1 l2)
diff --git a/pretyping/inductiveops.mli b/pretyping/inductiveops.mli
index c74bbfe98b..cfc650938e 100644
--- a/pretyping/inductiveops.mli
+++ b/pretyping/inductiveops.mli
@@ -61,70 +61,85 @@ val mis_nf_constructor_type :
(** {6 Extract information from an inductive name} *)
(** @return number of constructors *)
-val nconstructors : inductive -> int
+val nconstructors : env -> inductive -> int
val nconstructors_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.nconstructors"]
(** @return arity of constructors excluding parameters, excluding local defs *)
-val constructors_nrealargs : inductive -> int array
+val constructors_nrealargs : env -> inductive -> int array
val constructors_nrealargs_env : env -> inductive -> int array
+[@@ocaml.deprecated "Alias for Inductiveops.constructors_nrealargs"]
(** @return arity of constructors excluding parameters, including local defs *)
-val constructors_nrealdecls : inductive -> int array
+val constructors_nrealdecls : env -> inductive -> int array
val constructors_nrealdecls_env : env -> inductive -> int array
+[@@ocaml.deprecated "Alias for Inductiveops.constructors_nrealdecls"]
(** @return the arity, excluding params, excluding local defs *)
-val inductive_nrealargs : inductive -> int
+val inductive_nrealargs : env -> inductive -> int
val inductive_nrealargs_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nrealargs"]
(** @return the arity, excluding params, including local defs *)
-val inductive_nrealdecls : inductive -> int
+val inductive_nrealdecls : env -> inductive -> int
val inductive_nrealdecls_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nrealdecls"]
(** @return the arity, including params, excluding local defs *)
-val inductive_nallargs : inductive -> int
+val inductive_nallargs : env -> inductive -> int
val inductive_nallargs_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nallargs"]
(** @return the arity, including params, including local defs *)
-val inductive_nalldecls : inductive -> int
+val inductive_nalldecls : env -> inductive -> int
val inductive_nalldecls_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nalldecls"]
(** @return nb of params without local defs *)
-val inductive_nparams : inductive -> int
+val inductive_nparams : env -> inductive -> int
val inductive_nparams_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nparams"]
(** @return nb of params with local defs *)
-val inductive_nparamdecls : inductive -> int
+val inductive_nparamdecls : env -> inductive -> int
val inductive_nparamdecls_env : env -> inductive -> int
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_nparamsdecls"]
(** @return params context *)
-val inductive_paramdecls : pinductive -> Constr.rel_context
+val inductive_paramdecls : env -> pinductive -> Constr.rel_context
val inductive_paramdecls_env : env -> pinductive -> Constr.rel_context
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_paramsdecl"]
(** @return full arity context, hence with letin *)
-val inductive_alldecls : pinductive -> Constr.rel_context
+val inductive_alldecls : env -> pinductive -> Constr.rel_context
val inductive_alldecls_env : env -> pinductive -> Constr.rel_context
+[@@ocaml.deprecated "Alias for Inductiveops.inductive_alldecls"]
(** {7 Extract information from a constructor name} *)
(** @return param + args without letin *)
-val constructor_nallargs : constructor -> int
+val constructor_nallargs : env -> constructor -> int
val constructor_nallargs_env : env -> constructor -> int
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nallargs"]
(** @return param + args with letin *)
-val constructor_nalldecls : constructor -> int
+val constructor_nalldecls : env -> constructor -> int
val constructor_nalldecls_env : env -> constructor -> int
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nalldecls"]
(** @return args without letin *)
-val constructor_nrealargs : constructor -> int
+val constructor_nrealargs : env -> constructor -> int
val constructor_nrealargs_env : env -> constructor -> int
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nrealargs"]
(** @return args with letin *)
-val constructor_nrealdecls : constructor -> int
+val constructor_nrealdecls : env -> constructor -> int
val constructor_nrealdecls_env : env -> constructor -> int
+[@@ocaml.deprecated "Alias for Inductiveops.constructor_nrealdecls"]
(** Is there local defs in params or args ? *)
-val constructor_has_local_defs : constructor -> bool
-val inductive_has_local_defs : inductive -> bool
+val constructor_has_local_defs : env -> constructor -> bool
+val inductive_has_local_defs : env -> inductive -> bool
val allowed_sorts : env -> inductive -> Sorts.family list
diff --git a/pretyping/pretyping.ml b/pretyping/pretyping.ml
index e29672b6bc..0f7676cd19 100644
--- a/pretyping/pretyping.ml
+++ b/pretyping/pretyping.ml
@@ -644,7 +644,7 @@ let rec pretype ~program_mode ~poly k0 resolve_tc (tycon : type_constraint) (env
| None -> []
| Some ty ->
let ((ind, i), u) = destConstruct sigma fj.uj_val in
- let npars = inductive_nparams ind in
+ let npars = inductive_nparams !!env ind in
if Int.equal npars 0 then []
else
try
diff --git a/pretyping/retyping.ml b/pretyping/retyping.ml
index 20120f4182..38e254a5b4 100644
--- a/pretyping/retyping.ml
+++ b/pretyping/retyping.ml
@@ -121,7 +121,7 @@ let retype ?(polyprop=true) sigma =
Inductiveops.find_rectype env sigma t
with Not_found -> retype_error BadRecursiveType
in
- let n = inductive_nrealdecls_env env (fst (fst (dest_ind_family indf))) in
+ let n = inductive_nrealdecls env (fst (fst (dest_ind_family indf))) in
let t = betazetaevar_applist sigma n p realargs in
(match EConstr.kind sigma (whd_all env sigma (type_of env t)) with
| Prod _ -> whd_beta sigma (applist (t, [c]))