Skip to content
Snippets Groups Projects
Commit 7791266a authored by Ralf Jung's avatar Ralf Jung
Browse files

fix wp_bind with empty context

parent 3bd32904
No related branches found
No related tags found
No related merge requests found
...@@ -138,6 +138,11 @@ Section tests. ...@@ -138,6 +138,11 @@ Section tests.
by replace (S n - 1)%Z with (n:Z) by lia. by replace (S n - 1)%Z with (n:Z) by lia.
Qed. Qed.
(* Make sure [wp_bind] works even when it changes nothing. *)
Lemma wp_bind_nop (e : expr) :
WP e + #0 {{ _, True }}.
Proof. wp_bind (e + #0)%E. Abort.
Lemma wp_apply_evar e P : Lemma wp_apply_evar e P :
P -∗ ( Q Φ, Q -∗ WP e {{ Φ }}) -∗ WP e {{ _, True }}. P -∗ ( Q Φ, Q -∗ WP e {{ Φ }}) -∗ WP e {{ _, True }}.
Proof. iIntros "HP HW". wp_apply "HW". iExact "HP". Qed. Proof. iIntros "HP HW". wp_apply "HW". iExact "HP". Qed.
......
...@@ -167,11 +167,11 @@ Tactic Notation "wp_bind" open_constr(efoc) := ...@@ -167,11 +167,11 @@ Tactic Notation "wp_bind" open_constr(efoc) :=
iStartProof; iStartProof;
lazymatch goal with lazymatch goal with
| |- envs_entails _ (wp ?s ?E ?e ?Q) => | |- envs_entails _ (wp ?s ?E ?e ?Q) =>
reshape_expr e ltac:(fun K e' => unify e' efoc; wp_bind_core K) first [ reshape_expr e ltac:(fun K e' => unify e' efoc; wp_bind_core K)
|| fail "wp_bind: cannot find" efoc "in" e | fail "wp_bind: cannot find" efoc "in" e ]
| |- envs_entails _ (twp ?s ?E ?e ?Q) => | |- envs_entails _ (twp ?s ?E ?e ?Q) =>
reshape_expr e ltac:(fun K e' => unify e' efoc; twp_bind_core K) first [ reshape_expr e ltac:(fun K e' => unify e' efoc; twp_bind_core K)
|| fail "wp_bind: cannot find" efoc "in" e | fail "wp_bind: cannot find" efoc "in" e ]
| _ => fail "wp_bind: not a 'wp'" | _ => fail "wp_bind: not a 'wp'"
end. end.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment