| 1 |
(* Check that resolved status of evars follows "restrict" *) |
| 2 |
|
| 3 |
Axiom H : forall (v : nat), Some 0 = Some v -> True. |
| 4 |
Lemma L : True. |
| 5 |
eapply H with _; |
| 6 |
match goal with |
| 7 |
| |- Some 0 = Some ?v => change (Some (0+0) = Some v) |
| 8 |
end. |
| 9 |
Abort. |
| 10 |
|
| 11 |
(* The original example *) |
| 12 |
|
| 13 |
Set Default Proof Using "Type". |
| 14 |
|
| 15 |
Module heap_lang. |
| 16 |
|
| 17 |
Inductive expr := |
| 18 |
| InjR (e : expr). |
| 19 |
|
| 20 |
Inductive val := |
| 21 |
| InjRV (v : val). |
| 22 |
|
| 23 |
Bind Scope val_scope with val. |
| 24 |
|
| 25 |
Fixpoint of_val (v : val) : expr := |
| 26 |
match v with |
| 27 |
| InjRV v => InjR (of_val v) |
| 28 |
end. |
| 29 |
|
| 30 |
Fixpoint to_val (e : expr) : option val := None. |
| 31 |
|
| 32 |
End heap_lang. |
| 33 |
Export heap_lang. |
| 34 |
|
| 35 |
Module W. |
| 36 |
Inductive expr := |
| 37 |
| Val (v : val) |
| 38 |
(* Sums *) |
| 39 |
| InjR (e : expr). |
| 40 |
|
| 41 |
Fixpoint to_expr (e : expr) : heap_lang.expr := |
| 42 |
match e with |
| 43 |
| Val v => of_val v |
| 44 |
| InjR e => heap_lang.InjR (to_expr e) |
| 45 |
end. |
| 46 |
|
| 47 |
End W. |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
Section Tests. |
| 52 |
|
| 53 |
Context (iProp: Type). |
| 54 |
Context (WPre: expr -> Prop). |
| 55 |
|
| 56 |
Context (tac_wp_alloc : |
| 57 |
forall (e : expr) (v : val), |
| 58 |
to_val e = Some v -> WPre e). |
| 59 |
|
| 60 |
Lemma push_atomic_spec (x: val) : |
| 61 |
WPre (InjR (of_val x)). |
| 62 |
Proof. |
| 63 |
(* This works. *) |
| 64 |
eapply tac_wp_alloc with _. |
| 65 |
match goal with |
| 66 |
| |- to_val ?e = Some ?v => |
| 67 |
change (to_val (W.to_expr (W.InjR (W.Val x))) = Some v) |
| 68 |
end. |
| 69 |
Undo. Undo. |
| 70 |
(* This is fixed *) |
| 71 |
eapply tac_wp_alloc with _; |
| 72 |
match goal with |
| 73 |
| |- to_val ?e = Some ?v => |
| 74 |
change (to_val (W.to_expr (W.InjR (W.Val x))) = Some v) |
| 75 |
end. |
| 76 |
Abort. |
| 77 |
End Tests. |