Skip to content
Snippets Groups Projects
Commit 6291445a authored by Daniël Louwrink's avatar Daniël Louwrink
Browse files

prove wp_cas_loc_nondet

parent 57254a34
Branches
No related tags found
No related merge requests found
...@@ -396,24 +396,34 @@ Proof. ...@@ -396,24 +396,34 @@ Proof.
iApply "HΦ". iFrame "Hl Hl' Hl1 Hstk". iApply "HΦ". iFrame "Hl Hl' Hl1 Hstk".
Qed. Qed.
(* Lemma wp_cas_loc_nondet E l tg l1 tg1 e2 l2 tg2 ll tgl : *) Lemma wp_cas_loc_nondet E l tg l1 tg1 e2 l2 tg2 ll tgl q gstk :
(* IntoVal e2 (LitV $ LitLoc l2 tg2) → ↑stborN ⊆ E → *) IntoVal e2 (LitV $ LitLoc l2 tg2) stborN E
(* {{{ ▷ l ↦ LitV (LitLoc ll tgl) }}} *) ghost_grants_write gstk tg -∗
(* CAS (Lit $ LitLoc l tg) (Lit $ LitLoc l1 tg1) e2 @ E *) {{{ l LitV (LitLoc ll tgl) stbor_active l q gstk }}}
(* {{{ b, RET LitV (lit_of_bool b); *) CAS (Lit $ LitLoc l tg) (Lit $ LitLoc l1 tg1) e2 @ E
(* if b is true then l ↦ LitV (LitLoc l2 tg2) *) {{{ b, RET LitV (lit_of_bool b);
(* else ⌜l1 ≠ ll⌝ ∗ l ↦ LitV (LitLoc ll tgl) }}}. *) if b is true then l LitV (LitLoc l2 tg2) stbor_active l q gstk
(* Proof. *) else l1 ll l LitV (LitLoc ll tgl) stbor_active l q gstk }}}.
(* iIntros (<- Φ) ">Hv HΦ". *) Proof.
(* iApply wp_lift_atomic_head_step_no_fork; auto. *) iIntros (<- ?) "#Hgrantsw !>". iIntros (Φ) "[>Hv >Hstk] HΦ".
(* iIntros ([σ1 stbor] ???) "[Hσ Hstbor]". iDestruct (heap_read_1 with "Hσ Hv") as %?. *) iDestruct (ghost_grants_write_to_read with "Hgrantsw") as "#Hgrantsr".
(* iModIntro; iSplit; first (destruct (decide (ll = l1)) as [->|]; by eauto). *) iApply wp_lift_atomic_head_step_no_fork; auto.
(* iNext; iIntros (v2 σ2 efs Hstep); inv_head_step; last lia. *) iIntros ([σ1 stbor] ???) "(Hσ & Hstbor & #BOR)".
(* - inv_lit. iModIntro; iSplit; [done|]; iFrame "Hσ Hstbor". *) iDestruct (heap_read_1 with "Hσ Hv") as %?.
(* iApply "HΦ"; simpl; auto. *) iMod (stbor_inv_set stbor with "BOR Hstbor") as "(Hctx & Hstbor & Hclose)"; first done.
(* - iMod (heap_write with "Hσ Hv") as "[$ Hv]". iFrame "Hstbor". *) iDestruct (stbor_read_ctx_1 with "Hgrantsr Hctx Hstk") as %[? Hstborstepr].
(* iModIntro; iSplit; [done|]. iApply "HΦ"; iFrame. *) iDestruct (stbor_write_ctx_1 with "Hgrantsw Hctx Hstk") as %[? Hstborstepw].
(* Qed. *) iMod ("Hclose" with "Hctx") as "_".
iModIntro; iSplit; first (destruct (decide (ll = l1)) as [->|]; by eauto).
iNext; iIntros (v2 σ2 efs Hstep); inv_head_step; last lia.
- inv_lit.
iMod (stbor_read with "BOR Hgrantsr Hstbor Hstk") as "[Hstbor Hstk]"; [done|done|].
iModIntro; iSplit; [done|]; iFrame "Hσ Hstbor BOR". iApply "HΦ"; simpl; iFrame "Hv Hstk"; auto.
- iMod (heap_write with "Hσ Hv") as "[$ Hv]".
iMod (stbor_write with "BOR Hgrantsw Hstbor Hstk") as "[Hstbor Hstk]"; [done|done|].
iFrame "Hstbor BOR".
iModIntro; iSplit; [done|]. iApply "HΦ"; iFrame.
Qed.
Lemma wp_eq_loc E (l1 : loc) (l2: loc) tg1 tg2 q1 q2 v1 v2 P Φ : Lemma wp_eq_loc E (l1 : loc) (l2: loc) tg1 tg2 q1 q2 v1 v2 P Φ :
(P -∗ l1 {q1} v1) (P -∗ l1 {q1} v1)
......
...@@ -308,6 +308,15 @@ Section defs. ...@@ -308,6 +308,15 @@ Section defs.
Global Instance ghost_grants_read_pers gstk tg : Persistent (ghost_grants_read gstk tg). Global Instance ghost_grants_read_pers gstk tg : Persistent (ghost_grants_read gstk tg).
Proof. induction gstk as [|[| |]]; apply _. Qed. Proof. induction gstk as [|[| |]]; apply _. Qed.
Lemma ghost_grants_write_to_read tg gstk :
ghost_grants_write gstk tg -∗
ghost_grants_read gstk tg.
Proof.
iIntros "#Hwrite".
destruct gstk as [|[| |] gstk]; try done.
iLeft. iFrame "Hwrite".
Qed.
Lemma ghost_grants_write_log tg gstk stklog : Lemma ghost_grants_write_log tg gstk stklog :
ghost_grants_write gstk tg -∗ ghost_grants_write gstk tg -∗
stbor_ghost_stack stklog gstk -∗ stbor_ghost_stack stklog gstk -∗
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment