| 1 |
|
| 2 |
|
| 3 |
Section Foo. |
| 4 |
|
| 5 |
Variable X : Type. |
| 6 |
|
| 7 |
Polymorphic Section Bar. |
| 8 |
|
| 9 |
Variable A : Type. |
| 10 |
|
| 11 |
Definition id (a:A) := a. |
| 12 |
|
| 13 |
End Bar. |
| 14 |
Check id@{_}. |
| 15 |
End Foo. |
| 16 |
Check id@{_}. |
| 17 |
|
| 18 |
Polymorphic Section Foo. |
| 19 |
Variable A : Type. |
| 20 |
Section Bar. |
| 21 |
Variable B : Type. |
| 22 |
|
| 23 |
Inductive prod := Prod : A -> B -> prod. |
| 24 |
End Bar. |
| 25 |
Check prod@{_}. |
| 26 |
End Foo. |
| 27 |
Check prod@{_ _}. |
| 28 |
|
| 29 |
Section Foo. |
| 30 |
|
| 31 |
Universe K. |
| 32 |
Inductive bla := Bla : Type@{K} -> bla. |
| 33 |
|
| 34 |
Polymorphic Definition bli@{j} := Type@{j} -> bla. |
| 35 |
|
| 36 |
Definition bloo := bli@{_}. |
| 37 |
|
| 38 |
Polymorphic Universe i. |
| 39 |
|
| 40 |
Fail Definition x := Type. |
| 41 |
Fail Inductive x : Type := . |
| 42 |
Polymorphic Definition x := Type. |
| 43 |
Polymorphic Inductive y : x := . |
| 44 |
|
| 45 |
Variable A : Type. (* adds a mono univ for the Type, which is unrelated to the others *) |
| 46 |
|
| 47 |
Fail Variable B : (y : Type@{i}). |
| 48 |
(* not allowed: mono constraint (about a fresh univ for y) regarding |
| 49 |
poly univ i *) |
| 50 |
|
| 51 |
Polymorphic Variable B : Type. (* new polymorphic stuff always OK *) |
| 52 |
|
| 53 |
Variable C : Type@{i}. (* no new univs so no problems *) |
| 54 |
|
| 55 |
Polymorphic Definition thing := bloo -> y -> A -> B. |
| 56 |
|
| 57 |
End Foo. |
| 58 |
Check bli@{_}. |
| 59 |
Check bloo@{}. |
| 60 |
|
| 61 |
Check thing@{_ _ _}. |
| 62 |
|
| 63 |
Section Foo. |
| 64 |
|
| 65 |
Polymorphic Universes i k. |
| 66 |
Universe j. |
| 67 |
Fail Constraint i < j. |
| 68 |
Fail Constraint i < k. |
| 69 |
|
| 70 |
(* referring to mono univs in poly constraints is OK. *) |
| 71 |
Polymorphic Constraint i < j. Polymorphic Constraint j < k. |
| 72 |
|
| 73 |
Polymorphic Definition foo := Type@{j}. |
| 74 |
End Foo. |