| 1 |
Set Universe Polymorphism. |
| 2 |
Section foo. |
| 3 |
Universe i. |
| 4 |
Context (foo : Type@{i}) (bar : Type@{i}). |
| 5 |
Definition qux@{i} (baz : Type@{i}) := foo -> bar. |
| 6 |
End foo. |
| 7 |
Set Printing Universes. |
| 8 |
Print qux. (* qux@{Top.42 Top.43} = |
| 9 |
fun foo bar _ : Type@{Top.42} => foo -> bar |
| 10 |
: Type@{Top.42} -> Type@{Top.42} -> Type@{Top.42} -> Type@{Top.42} |
| 11 |
(* Top.42 Top.43 |= *) |
| 12 |
(* This is wrong; the first two types are equal, but the last one is not *) |
| 13 |
|
| 14 |
qux is universe polymorphic |
| 15 |
Argument scopes are [type_scope type_scope type_scope] |
| 16 |
*) |
| 17 |
Check qux nat nat nat : Set. |
| 18 |
Check qux nat nat Set : Set. (* Error: |
| 19 |
The term "qux@{Top.50 Top.51} ?T ?T0 Set" has type "Type@{Top.50}" while it is |
| 20 |
expected to have type "Set" |
| 21 |
(universe inconsistency: Cannot enforce Top.50 = Set because Set < Top.50). *) |