| 1 |
Require Import ssreflect ssrbool. |
| 2 |
|
| 3 |
Set Universe Polymorphism. |
| 4 |
|
| 5 |
Cumulative Variant paths {A} (x:A) : A -> Type |
| 6 |
:= idpath : paths x x. |
| 7 |
|
| 8 |
Register paths as core.eq.type. |
| 9 |
Register idpath as core.eq.refl. |
| 10 |
|
| 11 |
Structure type := Pack {sort; op : rel sort}. |
| 12 |
|
| 13 |
Example unfold_fold (T : type) (x : sort T) (a : op T x x) : op T x x. |
| 14 |
Proof. |
| 15 |
rewrite /op. rewrite -/(op _ _ _). assumption. |
| 16 |
Qed. |
| 17 |
|
| 18 |
Example pattern_unfold_fold (b:bool) (a := b) : paths a b. |
| 19 |
Proof. |
| 20 |
rewrite [in X in paths X _]/a. |
| 21 |
rewrite -[in X in paths X _]/a. |
| 22 |
constructor. |
| 23 |
Qed. |
| 24 |
|
| 25 |
Example unfold_in_hyp (b:bool) (a := b) : unit. |
| 26 |
Proof. |
| 27 |
assert (paths a a) as A by reflexivity. |
| 28 |
rewrite [in X in paths X _]/a in A. |
| 29 |
rewrite /a in (B := idpath a). |
| 30 |
rewrite [in X in paths _ X]/a in (C := idpath a). |
| 31 |
constructor. |
| 32 |
Qed. |
| 33 |
|
| 34 |
Example fold_in_hyp (b:bool) (p := idpath b) : unit. |
| 35 |
Proof. |
| 36 |
assert (paths (idpath b) (idpath b)) as A by reflexivity. |
| 37 |
rewrite -[in X in paths X _]/p in A. |
| 38 |
rewrite -[in X in paths _ X]/p in (C := idpath (idpath b)). |
| 39 |
constructor. |
| 40 |
Qed. |