| 1 |
Set Universe Polymorphism. |
| 2 |
|
| 3 |
Inductive unit' := tt'. |
| 4 |
|
| 5 |
Inductive eq {A : Type} (x : A) : A -> Prop := |
| 6 |
eq_refl : eq x x. |
| 7 |
|
| 8 |
Register eq as core.eq.type. |
| 9 |
Register eq_refl as core.eq.refl. |
| 10 |
|
| 11 |
Lemma posttest : True. |
| 12 |
Proof. |
| 13 |
destruct tt eqn:V. |
| 14 |
Check V : eq tt tt. (* check that we did use the non stdlib eq *) |
| 15 |
|
| 16 |
destruct tt' eqn:V'. |
| 17 |
exact I. |
| 18 |
Qed. |
| 19 |
(* |
| 20 |
In environment |
| 21 |
u := tt : unit |
| 22 |
The term "eq_refl u" has type "eq u u" while it is expected to have type "eq tt u". |
| 23 |
|
| 24 |
if we remove the first destruct: |
| 25 |
Error: Illegal application: |
| 26 |
The term "@eq_refl@{foo.18}" of type "forall (A : Type@{foo.18}) (x : A), @eq@{foo.18} A x x" |
| 27 |
cannot be applied to the terms |
| 28 |
"unit'@{foo.16}" : "Type@{foo.16}" |
| 29 |
"u" : "unit'@{foo.16}" |
| 30 |
The 1st term has type "Type@{foo.16}" which should be a subtype of "Type@{foo.18}". |
| 31 |
|
| 32 |
(the difference is because unit : Set but unit'@{u} : Type@{u}) |
| 33 |
*) |