Skip to content
Snippets Groups Projects
Commit b36e009e authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Small tweak of spin lock.

parent 169532f7
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,12 @@ Proof. solve_proper. Qed. ...@@ -41,6 +41,12 @@ Proof. solve_proper. Qed.
Global Instance is_lock_persistent l R : PersistentP (is_lock l R). Global Instance is_lock_persistent l R : PersistentP (is_lock l R).
Proof. apply _. Qed. Proof. apply _. Qed.
Lemma locked_is_lock l R : locked l R is_lock l R.
Proof.
iIntros "Hl"; iDestruct "Hl" as {N γ} "(?&?&?&_)".
iExists N, γ; by repeat iSplit.
Qed.
Lemma newlock_spec N (R : iProp) Φ : Lemma newlock_spec N (R : iProp) Φ :
heapN N heapN N
(heap_ctx heapN R ( l, is_lock l R -★ Φ (LocV l))) (heap_ctx heapN R ( l, is_lock l R -★ Φ (LocV l)))
...@@ -69,14 +75,12 @@ Proof. ...@@ -69,14 +75,12 @@ Proof.
Qed. Qed.
Lemma release_spec R l (Φ : val iProp) : Lemma release_spec R l (Φ : val iProp) :
(locked l R R (is_lock l R -★ Φ #())) WP release (%l) {{ Φ }}. (locked l R R Φ #()) WP release (%l) {{ Φ }}.
Proof. Proof.
iIntros "(Hl&HR&HΦ)"; iDestruct "Hl" as {N γ} "(%&#?&#?&Hγ)". iIntros "(Hl&HR&HΦ)"; iDestruct "Hl" as {N γ} "(%&#?&#?&Hγ)".
rewrite /release. wp_let. rewrite /release. wp_let.
iInv N as "Hinv". iDestruct "Hinv" as {b} "[Hl Hγ']"; destruct b. iInv N as "Hinv". iDestruct "Hinv" as {b} "[Hl Hγ']"; destruct b.
- wp_store. iSplitL "Hl HR Hγ". - wp_store. iFrame "HΦ". iNext. iExists false. by iFrame "Hl HR Hγ".
+ iNext. iExists false. by iFrame "Hl HR Hγ".
+ iApply "HΦ". iExists N, γ. by repeat iSplit.
- wp_store. iDestruct "Hγ'" as "[Hγ' _]". - wp_store. iDestruct "Hγ'" as "[Hγ' _]".
iCombine "Hγ" "Hγ'" as "Hγ". by iDestruct own_valid "Hγ" as "%". iCombine "Hγ" "Hγ'" as "Hγ". by iDestruct own_valid "Hγ" as "%".
Qed. Qed.
......
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