| 1 |
Structure Inner := mkI { is :> Type }. |
| 2 |
Structure Outer := mkO { os :> Inner }. |
| 3 |
Canonical Structure natInner := mkI nat. |
| 4 |
Canonical Structure natOuter := mkO natInner. |
| 5 |
Definition hidden_nat := nat. |
| 6 |
Axiom P : forall S : Outer, is (os S) -> Prop. |
| 7 |
Lemma test1 (n : hidden_nat) : P _ n. |
| 8 |
Admitted. |
| 9 |
|
| 10 |
Structure Pnat := mkP { getp : nat }. |
| 11 |
Definition my_getp := getp. |
| 12 |
Axiom W : nat -> Prop. |
| 13 |
|
| 14 |
(* Fix *) |
| 15 |
Canonical Structure add1Pnat n := mkP (plus n 1). |
| 16 |
Definition test_fix n := (refl_equal _ : W (my_getp _) = W (n + 1)). |
| 17 |
|
| 18 |
(* Case *) |
| 19 |
Definition pred n := match n with 0 => 0 | S m => m end. |
| 20 |
Canonical Structure predSS n := mkP (pred n). |
| 21 |
Definition test_case x := (refl_equal _ : W (my_getp _) = W (pred x)). |
| 22 |
Definition test_case' := (refl_equal _ : W (my_getp _) = W (pred 0)). |
| 23 |
|
| 24 |
Canonical Structure letPnat' := mkP 0. |
| 25 |
Definition letin := (let n := 0 in n). |
| 26 |
Definition test4 := (refl_equal _ : W (getp _) = W letin). |
| 27 |
Definition test41 := (refl_equal _ : W (my_getp _) = W letin). |
| 28 |
Definition letin2 (x : nat) := (let n := x in n). |
| 29 |
Canonical Structure letPnat'' x := mkP (letin2 x). |
| 30 |
Definition test42 x := (refl_equal _ : W (my_getp _) = W (letin2 x)). |
| 31 |
Fail Definition test42' x := (refl_equal _ : W (my_getp _) = W x). |
| 32 |
|
| 33 |
Structure Morph := mkM { f :> nat -> nat }. |
| 34 |
Definition my_f := f. |
| 35 |
Axiom Q : (nat -> nat) -> Prop. |
| 36 |
|
| 37 |
(* Lambda *) |
| 38 |
Canonical Structure addMorh x := mkM (plus x). |
| 39 |
Definition test_lam x := (refl_equal _ : Q (my_f _) = Q (plus x)). |
| 40 |
Definition test_lam' := (refl_equal _ : Q (my_f _) = Q (plus 0)). |
| 41 |
|
| 42 |
(* Simple tests to justify Sort and Prod as "named". |
| 43 |
They are already normal, so they cannot loose their names, |
| 44 |
but still... *) |
| 45 |
Structure Sot := mkS { T : Type }. |
| 46 |
Axiom R : Type -> Prop. |
| 47 |
Canonical Structure tsot := mkS (Type). |
| 48 |
Definition test_sort := (refl_equal _ : R (T _) = R Type). |
| 49 |
Canonical Structure tsot2 := mkS (nat -> nat). |
| 50 |
Definition test_prod := (refl_equal _ : R (T _) = R (nat -> nat)). |
| 51 |
|
| 52 |
(* Var *) |
| 53 |
Section Foo. |
| 54 |
Variable v : nat. |
| 55 |
Definition my_v := v. |
| 56 |
Canonical Structure vP := mkP my_v. |
| 57 |
Definition test_var := (refl_equal _ : W (getp _) = W my_v). |
| 58 |
Canonical Structure vP' := mkP v. |
| 59 |
Definition test_var' := (refl_equal _ : W (my_getp _) = W my_v). |
| 60 |
End Foo. |
| 61 |
|
| 62 |
(* Rel *) |
| 63 |
Definition test_rel v := (refl_equal _ : W (my_getp _) = W (my_v v)). |
| 64 |
Goal True. |
| 65 |
pose (x := test_rel 2). |
| 66 |
match goal with x := _ : W (my_getp (vP 2)) = _ |- _ => idtac end. |
| 67 |
apply I. |
| 68 |
Qed. |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
|