Commit d5272bc5 authored by Zhen Zhang's avatar Zhen Zhang
Browse files

safe flat

parent 0fa11100
......@@ -341,4 +341,21 @@ Section proof.
by iApply "HΦ".
Lemma flat_spec (f: val) Q:
heapN N
heap_ctx ( x:val, WP f x {{ v, Q x v }})%I
WP flat f {{ f', True%I }}.
iIntros (HN) "(#Hh & #?)".
wp_seq. wp_alloc lk as "Hl".
iVs (own_alloc (Excl ())) as (γ2) "Ho2"; first done.
iVs (own_alloc (Excl ())) as (γlk) "Hγlk"; first done.
iVs (inv_alloc N _ (lock_inv γlk lk (own γ2 (Excl ()))) with "[-]") as "#?".
{ iIntros "!>". iExists false. by iFrame. }
wp_let. wp_bind (new_stack _).
iApply new_stack_spec=>//.
iFrame "Hh". iIntros (s) "Hs".
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment