aboutsummaryrefslogtreecommitdiff
path: root/pretyping/inductiveops.ml
diff options
context:
space:
mode:
authorherbelin2003-09-06 14:17:55 +0000
committerherbelin2003-09-06 14:17:55 +0000
commitcb8db3f7af710970a4ddba2fc559910ff7feaffb (patch)
treee8f7756f762a7d8abedf4e49e54caa47bf7f985a /pretyping/inductiveops.ml
parentd36b4c46cc1cadf73808f4f9e7ef3d1e320c72aa (diff)
Mise en place possibilité de définitions locales dans les paramètres des inductifs
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@4316 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping/inductiveops.ml')
-rw-r--r--pretyping/inductiveops.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/pretyping/inductiveops.ml b/pretyping/inductiveops.ml
index adc5932f18..792fe6d2d9 100644
--- a/pretyping/inductiveops.ml
+++ b/pretyping/inductiveops.ml
@@ -150,10 +150,16 @@ let get_constructors env (ind,params) =
Array.init (Array.length mip.mind_consnames)
(fun j -> get_constructor (ind,mib,mip,params) (j+1))
+let rec instantiate args c = match kind_of_term c, args with
+ | Prod (_,_,c), a::args -> instantiate args (subst1 a c)
+ | LetIn (_,b,_,c), args -> instantiate args (subst1 b c)
+ | _, [] -> c
+ | _ -> anomaly "too short arity"
+
let get_arity env (ind,params) =
let (mib,mip) = Inductive.lookup_mind_specif env ind in
- let arity = body_of_type mip.mind_nf_arity in
- destArity (prod_applist arity params)
+ let arity = mip.mind_nf_arity in
+ destArity (instantiate params arity)
(* Functions to build standard types related to inductive *)
let build_dependent_constructor cs =