| 1 |
Set Primitive Projections. |
| 2 |
|
| 3 |
(** Variant of VM conversion that exercises the reification part of the VM *) |
| 4 |
Ltac norm := match goal with [ |- ?P ] => let Q := eval vm_compute in P in change Q end. |
| 5 |
|
| 6 |
Module T. |
| 7 |
|
| 8 |
Record prod (A : Type) (B : A -> Type) := pair { fst : A; snd : B fst }. |
| 9 |
|
| 10 |
Arguments fst {_ _}. |
| 11 |
Arguments snd {_ _}. |
| 12 |
|
| 13 |
Goal forall (p : prod nat (fun n => n = 0)), fst p = 0. |
| 14 |
Proof. |
| 15 |
intros p. |
| 16 |
norm. |
| 17 |
apply (snd p). |
| 18 |
Qed. |
| 19 |
|
| 20 |
End T. |
| 21 |
|
| 22 |
Module M. |
| 23 |
|
| 24 |
CoInductive foo := Foo { |
| 25 |
foo0 : foo; |
| 26 |
foo1 : bar; |
| 27 |
} |
| 28 |
with bar := Bar { |
| 29 |
bar0 : foo; |
| 30 |
bar1 : bar; |
| 31 |
}. |
| 32 |
|
| 33 |
CoFixpoint f : foo := Foo f g |
| 34 |
with g : bar := Bar f g. |
| 35 |
|
| 36 |
Goal f.(foo0).(foo0) = g.(bar0). |
| 37 |
Proof. |
| 38 |
norm. |
| 39 |
match goal with [ |- ?t = ?t ] => idtac end. |
| 40 |
reflexivity. |
| 41 |
Qed. |
| 42 |
|
| 43 |
Goal g.(bar1).(bar0).(foo1) = g. |
| 44 |
Proof. |
| 45 |
norm. |
| 46 |
match goal with [ |- ?t = ?t ] => idtac end. |
| 47 |
reflexivity. |
| 48 |
Qed. |
| 49 |
|
| 50 |
End M. |
| 51 |
|
| 52 |
Module N. |
| 53 |
|
| 54 |
Inductive foo := Foo { |
| 55 |
foo0 : option foo; |
| 56 |
foo1 : list bar; |
| 57 |
} |
| 58 |
with bar := Bar { |
| 59 |
bar0 : option bar; |
| 60 |
bar1 : list foo; |
| 61 |
}. |
| 62 |
|
| 63 |
Definition f_0 := Foo None nil. |
| 64 |
Definition g_0 := Bar None nil. |
| 65 |
|
| 66 |
Definition f := Foo (Some f_0) (cons g_0 nil). |
| 67 |
|
| 68 |
Goal f.(foo1) = cons g_0 nil. |
| 69 |
Proof. |
| 70 |
norm. |
| 71 |
match goal with [ |- ?t = ?t ] => idtac end. |
| 72 |
reflexivity. |
| 73 |
Qed. |
| 74 |
|
| 75 |
End N. |