summaryrefslogtreecommitdiff
path: root/checker/inductive.ml
diff options
context:
space:
mode:
Diffstat (limited to 'checker/inductive.ml')
-rw-r--r--checker/inductive.ml19
1 files changed, 11 insertions, 8 deletions
diff --git a/checker/inductive.ml b/checker/inductive.ml
index 0e489fbf..1e12f610 100644
--- a/checker/inductive.ml
+++ b/checker/inductive.ml
@@ -1,6 +1,6 @@
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
+(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2014 *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
@@ -277,9 +277,10 @@ let is_correct_arity env c (p,pj) ind specif params =
(try conv env a1 a1'
with NotConvertible -> raise (LocalArity None));
srec (push_rel (na1,None,a1) env) t ar'
- | Prod (_,a1,a2), [] -> (* whnf of t was not needed here! *)
- let ksort = match (whd_betadeltaiota env a2) with
- | Sort s -> family_of_sort s
+ | Prod (na1,a1,a2), [] -> (* whnf of t was not needed here! *)
+ let env' = push_rel (na1,None,a1) env in
+ let ksort = match (whd_betadeltaiota env' a2) with
+ | Sort s -> family_of_sort s
| _ -> raise (LocalArity None) in
let dep_ind = build_dependent_inductive ind specif params in
(try conv env a1 dep_ind
@@ -289,6 +290,8 @@ let is_correct_arity env c (p,pj) ind specif params =
| Sort s', [] ->
check_allowed_sort (family_of_sort s') specif;
false
+ | _, (_,Some _,_ as d)::ar' ->
+ srec (push_rel d env) (lift 1 pt') ar'
| _ ->
raise (LocalArity None)
in
@@ -895,12 +898,12 @@ let check_one_cofix env nbfix def deftype =
raise (CoFixGuardError (env,RecCallInTypeOfAbstraction a))
| CoFix (j,(_,varit,vdefs as recdef)) ->
- if (List.for_all (noccur_with_meta n nbfix) args)
+ if List.for_all (noccur_with_meta n nbfix) args
then
- let nbfix = Array.length vdefs in
- if (array_for_all (noccur_with_meta n nbfix) varit) then
+ if array_for_all (noccur_with_meta n nbfix) varit then
+ let nbfix = Array.length vdefs in
let env' = push_rec_types recdef env in
- (Array.iter (check_rec_call env' alreadygrd (n+1) vlra) vdefs;
+ (Array.iter (check_rec_call env' alreadygrd (n+nbfix) vlra) vdefs;
List.iter (check_rec_call env alreadygrd n vlra) args)
else
raise (CoFixGuardError (env,RecCallInTypeOfDef c))