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

Merge branch 'ralf/wp-pures-val' into 'master'

wp_pures: also handle [WP v]

See merge request iris/iris!578
parents 8fab551a 74d678e2
No related branches found
No related tags found
No related merge requests found
......@@ -135,6 +135,10 @@ With this release, we dropped support for Coq 8.9.
threads instead of only a single thread. The derived adequacy lemmas
are unchanged.
**Changes in `heap_lang`:**
* `wp_pures` now turns goals of the form `WP v {{ Φ }}` into `Φ v`.
The following `sed` script helps adjust your code to the renaming (on macOS,
replace `sed` by `gsed`, installed via e.g. `brew install gnu-sed`).
Note that the script is not idempotent, do not run it twice.
......
......@@ -60,6 +60,8 @@ Tactics to take one or more pure program steps:
well as unary and binary arithmetic operators.
- `wp_pures`: Perform as many pure reduction steps as possible. This
tactic will **not** reduce lambdas/recs that are hidden behind a definition.
If the computation reaches a value, the `WP` will be entirely removed and the
postcondition becomes the new goal.
- `wp_rec`, `wp_lam`: Perform a beta reduction. Unlike `wp_pure`, this will
also reduce lambdas that are hidden behind a definition.
- `wp_let`, `wp_seq`: Reduce a let-binding or a sequential composition.
......
......@@ -142,6 +142,13 @@ Section tests.
P -∗ ( Q Φ, Q -∗ WP e {{ Φ }}) -∗ WP e {{ _, True }}.
Proof. iIntros "HP HW". wp_apply "HW". iExact "HP". Qed.
Lemma wp_pures_val (b : bool) :
WP #b {{ _, True }}.
Proof. wp_pures. done. Qed.
Lemma twp_pures_val (b : bool) :
WP #b [{ _, True }].
Proof. wp_pures. done. Qed.
Lemma wp_cmpxchg l v :
val_is_unboxed v
l v -∗ WP CmpXchg #l v v {{ _, True }}.
......
......@@ -107,8 +107,10 @@ Tactic Notation "wp_pure" open_constr(efoc) :=
(* TODO: do this in one go, without [repeat]. *)
Ltac wp_pures :=
iStartProof;
repeat (wp_pure _; []). (* The `;[]` makes sure that no side-condition
magically spawns. *)
first [ (* The `;[]` makes sure that no side-condition magically spawns. *)
progress repeat (wp_pure _; [])
| wp_finish (* In case wp_pure never ran, make sure we do the usual cleanup. *)
].
(** Unlike [wp_pures], the tactics [wp_rec] and [wp_lam] should also reduce
lambdas/recs that are hidden behind a definition, i.e. they should use
......
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