| 1 |
Set Universe Polymorphism. |
| 2 |
|
| 3 |
(** Tests for module subtyping of polymorphic terms *) |
| 4 |
|
| 5 |
Module Type S. |
| 6 |
|
| 7 |
Section Foo. |
| 8 |
|
| 9 |
Universes i j. |
| 10 |
Constraint i <= j. |
| 11 |
|
| 12 |
Inductive foo : Type@{i} -> Type@{j} :=. |
| 13 |
|
| 14 |
End Foo. |
| 15 |
|
| 16 |
End S. |
| 17 |
|
| 18 |
(** Same constraints *) |
| 19 |
|
| 20 |
Module OK_1. |
| 21 |
|
| 22 |
Section Foo. |
| 23 |
|
| 24 |
Universes i j. |
| 25 |
Constraint i <= j. |
| 26 |
|
| 27 |
Inductive foo : Type@{i} -> Type@{j} :=. |
| 28 |
|
| 29 |
End Foo. |
| 30 |
|
| 31 |
End OK_1. |
| 32 |
|
| 33 |
Module OK_1_Test : S := OK_1. |
| 34 |
|
| 35 |
(** More general constraints *) |
| 36 |
|
| 37 |
Module OK_2. |
| 38 |
|
| 39 |
Inductive foo@{i j} : Type@{i} -> Type@{j} :=. |
| 40 |
|
| 41 |
End OK_2. |
| 42 |
|
| 43 |
Module OK_2_Test : S := OK_2. |
| 44 |
|
| 45 |
(** Wrong instance length *) |
| 46 |
|
| 47 |
Module KO_1. |
| 48 |
|
| 49 |
Inductive foo@{i} : Type@{i} -> Type@{i} :=. |
| 50 |
|
| 51 |
End KO_1. |
| 52 |
|
| 53 |
Fail Module KO_Test_1 : S := KO_1. |
| 54 |
|
| 55 |
(** Less general constraints *) |
| 56 |
|
| 57 |
Module KO_2. |
| 58 |
|
| 59 |
Section Foo. |
| 60 |
|
| 61 |
Universe i j. |
| 62 |
Constraint i < j. |
| 63 |
|
| 64 |
Inductive foo : Type@{i} -> Type@{j} :=. |
| 65 |
|
| 66 |
End Foo. |
| 67 |
|
| 68 |
End KO_2. |
| 69 |
|
| 70 |
Fail Module KO_Test_2 : S := KO_2. |
| 71 |
|
| 72 |
(** Less general constraints *) |
| 73 |
|
| 74 |
Module KO_3. |
| 75 |
|
| 76 |
Section Foo. |
| 77 |
|
| 78 |
Universe i j. |
| 79 |
Constraint i = j. |
| 80 |
|
| 81 |
Inductive foo : Type@{i} -> Type@{j} :=. |
| 82 |
|
| 83 |
End Foo. |
| 84 |
|
| 85 |
End KO_3. |
| 86 |
|
| 87 |
Fail Module KO_Test_3 : S := KO_3. |