Commit 46799c39 authored by Robbert Krebbers's avatar Robbert Krebbers

More powerful rule for allocation of channels.

parent 6eee4a54
...@@ -697,15 +697,14 @@ Section proto. ...@@ -697,15 +697,14 @@ Section proto.
Qed. Qed.
(** Specifications of send and receive *) (** Specifications of send and receive *)
Lemma new_chan_proto_spec p : Lemma new_chan_proto_spec :
{{{ True }}} {{{ True }}}
new_chan #() new_chan #()
{{{ c1 c2, RET (c1,c2); c1 p @ N c2 iProto_dual p @ N }}}. {{{ c1 c2, RET (c1,c2); ( p, |={}=> c1 p @ N c2 iProto_dual p @ N) }}}.
Proof. Proof.
iIntros (Ψ _) "HΨ". iApply wp_fupd. wp_apply new_chan_spec=> //. iIntros (Ψ _) "HΨ". iApply wp_fupd. wp_apply new_chan_spec=> //.
iIntros (c1 c2 γ) "(Hc & Hl & Hr)". iIntros (c1 c2 γ) "(Hc & Hl & Hr)". iApply "HΨ"; iIntros "!>" (p).
iMod (proto_init γ c1 c2 p with "Hc Hl Hr") as "[Hp Hdp]". iApply (proto_init γ c1 c2 p with "Hc Hl Hr").
iApply "HΨ". by iFrame.
Qed. Qed.
Lemma start_chan_proto_spec p Ψ (f : val) : Lemma start_chan_proto_spec p Ψ (f : val) :
...@@ -714,7 +713,8 @@ Section proto. ...@@ -714,7 +713,8 @@ Section proto.
WP start_chan f {{ Ψ }}. WP start_chan f {{ Ψ }}.
Proof. Proof.
iIntros "Hfork HΨ". wp_lam. iIntros "Hfork HΨ". wp_lam.
wp_apply (new_chan_proto_spec p with "[//]"); iIntros (c1 c2) "[Hc1 Hc2]". wp_apply (new_chan_proto_spec with "[//]"); iIntros (c1 c2) "Hc".
iMod ("Hc" $! p) as "[Hc1 Hc2]".
wp_apply (wp_fork with "[Hfork Hc2]"). wp_apply (wp_fork with "[Hfork Hc2]").
{ iNext. wp_apply ("Hfork" with "Hc2"). } { iNext. wp_apply ("Hfork" with "Hc2"). }
wp_pures. iApply ("HΨ" with "Hc1"). wp_pures. iApply ("HΨ" with "Hc1").
......
Markdown is supported
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