| 1 |
Set Universe Polymorphism. |
| 2 |
|
| 3 |
Inductive bool@{q; |} : Type@{q;Set} := | true : bool | false : bool. |
| 4 |
|
| 5 |
Definition nand@{q; |} (a b : bool@{q;}) : bool@{q;} := |
| 6 |
match a , b with |
| 7 |
| true , true => false |
| 8 |
| _ , _ => true |
| 9 |
end. |
| 10 |
|
| 11 |
Inductive seq@{q;u|} {A : Type@{q;u}} (a : A) : A -> Type@{q;u} := | srefl : seq a a. |
| 12 |
Arguments srefl {_ _}. |
| 13 |
|
| 14 |
Definition seq_elim@{q;u v|} := |
| 15 |
fun (A : Type@{q;u}) (x : A) (P : A -> Type@{q;v}) (f : P x) (a : A) (e : seq x a) => |
| 16 |
match e in (seq _ a0) return (P a0) with |
| 17 |
| srefl => f |
| 18 |
end. |
| 19 |
|
| 20 |
Definition seq_Has_Leibniz_elim@{s; l l' l''} : Has_Leibniz@{s s s;l l' l''} (@seq) := |
| 21 |
@seq_elim. |
| 22 |
|
| 23 |
Hint Resolve seq_Has_Leibniz_elim : rewrite_instances. |
| 24 |
|
| 25 |
Register seq as core.eq.type. |
| 26 |
Register srefl as core.eq.refl. |
| 27 |
Register seq_elim as core.eq.rect. |
| 28 |
|
| 29 |
Lemma foo@{q; |} (f : bool@{q;} -> bool@{q;}) (x : bool@{q;}) : seq (f true) (f true). |
| 30 |
Proof. |
| 31 |
remember (f true) as b eqn : ftrue. |
| 32 |
reflexivity. |
| 33 |
Qed. |
| 34 |
|
| 35 |
Lemma f3_eq_f@{q; |} (f : bool@{q;} -> bool@{q;}) (x : bool@{q;}) : seq (f (f (f x))) (f x). |
| 36 |
Proof. |
| 37 |
remember (f true) as b eqn : ftrue. |
| 38 |
|
| 39 |
remember (f false) as c eqn : ffalse. |
| 40 |
Validate Proof. |
| 41 |
|
| 42 |
destruct x,b,c. |
| 43 |
all:repeat rewrite <-?ftrue, <-?ffalse. |
| 44 |
all: reflexivity. |
| 45 |
Qed. |