diff options
| author | Gaëtan Gilbert | 2019-01-03 16:59:58 +0100 |
|---|---|---|
| committer | Gaëtan Gilbert | 2019-03-14 15:46:15 +0100 |
| commit | 5cb337a0862e06a5b103b00c43cf9777e3468923 (patch) | |
| tree | ceb750d06d159cf59d51ca71af152de1af5bc466 /kernel/inductive.ml | |
| parent | 23f84f37c674a07e925925b7e0d50d7ee8414093 (diff) | |
Inductives in SProp, forbid primitive records with only sprop fields
For nonsquashed:
Either
- 0 constructors
- primitive record
Diffstat (limited to 'kernel/inductive.ml')
| -rw-r--r-- | kernel/inductive.ml | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml index 8b8295c64b..2d34c02302 100644 --- a/kernel/inductive.ml +++ b/kernel/inductive.ml @@ -1075,8 +1075,19 @@ let inductive_of_mutfix env ((nvect,bodynum),(names,types,bodies as recdef)) = (mind, (env', b)) else check_occur env' (n+1) b else anomaly ~label:"check_one_fix" (Pp.str "Bad occurrence of recursive call.") - | _ -> raise_err env i NotEnoughAbstractionInFixBody in - check_occur fixenv 1 def in + | _ -> raise_err env i NotEnoughAbstractionInFixBody + in + let ((ind, _), _) as res = check_occur fixenv 1 def in + let _, ind = lookup_mind_specif env ind in + (* recursive sprop means non record with projections -> squashed *) + if Sorts.Irrelevant == ind.mind_relevant + then + begin + if names.(i).Context.binder_relevance == Sorts.Relevant + then raise_err env i FixpointOnIrrelevantInductive + end; + res + in (* Do it on every fixpoint *) let rv = Array.map2_i find_ind nvect bodies in (Array.map fst rv, Array.map snd rv) |
