| 1 |
(* This example (found by coqchk) checks that an inductive cannot be |
| 2 |
polymorphic if its constructors induce upper universe constraints. |
| 3 |
Here: I cannot be polymorphic because its type is less than the |
| 4 |
type of the argument of impl. *) |
| 5 |
|
| 6 |
Definition Type1 := Type. |
| 7 |
Definition Type3 : Type1 := Type. (* Type3 < Type1 *) |
| 8 |
Definition Type4 := Type. |
| 9 |
Definition impl (A B:Type3) : Type4 := A->B. (* Type3 <= Type4 *) |
| 10 |
Inductive I (B:Type (*6*)) := C : B -> impl Prop (I B). |
| 11 |
(* Type(6) <= Type(7) because I contains, via C, elements in B |
| 12 |
Type(7) <= Type3 because (I B) is argument of impl |
| 13 |
Type(4) <= Type(7) because type of C less than I (see remark below) |
| 14 |
|
| 15 |
where Type(7) is the auxiliary level used to infer the type of I |
| 16 |
*) |
| 17 |
|
| 18 |
(* We cannot enforce Type1 < Type(6) while we already have |
| 19 |
Type(6) <= Type(7) < Type3 < Type1 *) |
| 20 |
Fail Definition J := I Type1. |
| 21 |
|
| 22 |
(* Open question: should the type of an inductive be the max of the |
| 23 |
types of the _arguments_ of its constructors (here B and Prop, |
| 24 |
after unfolding of impl), or of the max of types of the |
| 25 |
constructors itself (here B -> impl Prop (I B)), as done above. *) |