| 1 |
Set Universe Polymorphism. |
| 2 |
Module A. |
| 3 |
Inductive paths A (x : A) : A -> Type := idpath : paths A x x. |
| 4 |
|
| 5 |
Notation "x = y" := (paths _ x y). |
| 6 |
|
| 7 |
Inductive IsTrunc : nat -> Type -> Type := |
| 8 |
| BuildContr : forall A (center : A) (contr : forall y, center = y), IsTrunc 0 A |
| 9 |
| trunc_S : forall A n, (forall x y : A, IsTrunc n (x = y)) -> IsTrunc (S n) A. |
| 10 |
|
| 11 |
Existing Class IsTrunc. |
| 12 |
|
| 13 |
|
| 14 |
#[export] Instance is_trunc_unit : IsTrunc 0 unit. |
| 15 |
Proof. apply BuildContr with (center:=tt). now intros []. Defined. |
| 16 |
|
| 17 |
Check (_ : IsTrunc 0 unit). |
| 18 |
End A. |
| 19 |
|
| 20 |
Module B. |
| 21 |
Fixpoint IsTrunc (n : nat) (A : Type) : Type := |
| 22 |
match n with |
| 23 |
| O => True |
| 24 |
| S _ => False |
| 25 |
end. |
| 26 |
|
| 27 |
Existing Class IsTrunc. |
| 28 |
|
| 29 |
#[export] Instance is_trunc_unit : IsTrunc 0 unit. |
| 30 |
Proof. exact I. Defined. |
| 31 |
|
| 32 |
Check (_ : IsTrunc 0 unit). |
| 33 |
Fail Definition foo := (_ : IsTrunc 1 unit). |
| 34 |
End B. |