| 1 |
Universes a b c ω ω'. |
| 2 |
Definition Typeω := Type@{ω}. |
| 3 |
Definition Type2 : Typeω := Type@{c}. |
| 4 |
Definition Type1 : Type2 := Type@{b}. |
| 5 |
Definition Type0 : Type1 := Type@{a}. |
| 6 |
|
| 7 |
Set Universe Polymorphism. |
| 8 |
Set Printing Universes. |
| 9 |
|
| 10 |
Definition Typei' (n : nat) |
| 11 |
:= match n return Type@{ω'} with |
| 12 |
| 0 => Type0 |
| 13 |
| 1 => Type1 |
| 14 |
| 2 => Type2 |
| 15 |
| _ => Typeω |
| 16 |
end. |
| 17 |
Definition TypeOfTypei' {n} (x : Typei' n) : Type@{ω'} |
| 18 |
:= match n return Typei' n -> Type@{ω'} with |
| 19 |
| 0 | 1 | 2 | _ => fun x => x |
| 20 |
end x. |
| 21 |
Definition Typei (n : nat) : Typei' (S n) |
| 22 |
:= match n return Typei' (S n) with |
| 23 |
| 0 => Type0 |
| 24 |
| 1 => Type1 |
| 25 |
| _ => Type2 |
| 26 |
end. |
| 27 |
Definition TypeOfTypei {n} (x : TypeOfTypei' (Typei n)) : Type@{ω'} |
| 28 |
:= match n return TypeOfTypei' (Typei n) -> Type@{ω'} with |
| 29 |
| 0 | 1 | _ => fun x => x |
| 30 |
end x. |
| 31 |
Check Typei 0 : Typei 1. |
| 32 |
Check Typei 1 : Typei 2. |
| 33 |
|
| 34 |
Definition lift' {n} : TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)) |
| 35 |
:= match n return TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)) with |
| 36 |
| 0 | 1 | 2 | _ => fun x => (x : Type) |
| 37 |
end. |
| 38 |
Definition lift'' {n} : TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)) |
| 39 |
:= match n return TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)) with |
| 40 |
| 0 | 1 | 2 | _ => fun x => x |
| 41 |
end. (* The command has indeed failed with message: |
| 42 |
In environment |
| 43 |
n : nat |
| 44 |
x : TypeOfTypei' (Typei 0) |
| 45 |
The term "x" has type "TypeOfTypei' (Typei 0)" while it is expected to have type |
| 46 |
"TypeOfTypei' (Typei 1)" (universe inconsistency: Cannot enforce b = a because a < b). |
| 47 |
*) |
| 48 |
Check (fun x : TypeOfTypei' (Typei 0) => TypeOfTypei' (Typei 1)). |
| 49 |
|
| 50 |
Definition lift''' {n} : TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)). |
| 51 |
refine match n return TypeOfTypei' (Typei n) -> TypeOfTypei' (Typei (S n)) with |
| 52 |
| 0 | 1 | 2 | _ => fun x => _ |
| 53 |
end. |
| 54 |
exact x. |
| 55 |
Undo. |
| 56 |
(* The command has indeed failed with message: |
| 57 |
In environment |
| 58 |
n : nat |
| 59 |
x : TypeOfTypei' (Typei 0) |
| 60 |
The term "x" has type "TypeOfTypei' (Typei 0)" while it is expected to have type |
| 61 |
"TypeOfTypei' (Typei 1)" (universe inconsistency: Cannot enforce b = a because a < b). |
| 62 |
*) |
| 63 |
all:compute in *. |
| 64 |
all:exact x. |
| 65 |
Abort. |