Commit 3f8c5a06 authored by Zhen Zhang's avatar Zhen Zhang

finish client side rewrite

parent 5c18c7eb
...@@ -29,4 +29,8 @@ Section lemmas. ...@@ -29,4 +29,8 @@ Section lemmas.
((p + q)%Qp, DecAgree g') ~~> (((p, DecAgree g') (q, DecAgree g'))). ((p + q)%Qp, DecAgree g') ~~> (((p, DecAgree g') (q, DecAgree g'))).
Proof. by rewrite pair_op dec_agree_idemp frac_op'. Qed. Proof. by rewrite pair_op dec_agree_idemp frac_op'. Qed.
Lemma pair_l_frac_op_1' (g g': val):
(1%Qp, DecAgree g') ~~> (((1/2)%Qp, DecAgree g') ((1/2)%Qp, DecAgree g')).
Proof. by rewrite pair_op dec_agree_idemp frac_op' Qp_div_2. Qed.
End lemmas. End lemmas.
...@@ -119,46 +119,37 @@ Section proof. ...@@ -119,46 +119,37 @@ Section proof.
iFrame "Hinv". iIntros (lk γlk) "#Hlk". iFrame "Hinv". iIntros (lk γlk) "#Hlk".
wp_let. wp_apply wp_fork. wp_let. wp_apply wp_fork.
iSplitR "Ho2". iSplitR "Ho2".
- (* (* client closure *) *) - (* client closure *)
(* iVsIntro. wp_seq. iVsIntro. *) iVsIntro. wp_seq. iVsIntro.
(* iAlways. iIntros (x). *) iAlways. iIntros (x).
(* wp_let. wp_bind (acquire _). iApply acquire_spec. *) wp_let. wp_bind (acquire _). iApply acquire_spec.
(* iFrame "Hlk". iIntros "Hlked Ho". *) iFrame "Hlk". iIntros "Hlked Ho".
(* iDestruct "Ho" as (x') "[Hx [Hissued Hfinished]]". *) iDestruct "Ho" as (x') "[Hx Ho4]".
(* wp_seq. wp_bind (_ <- _)%E. *) wp_seq. wp_bind (_ <- _)%E.
(* iInv N as ">Hinv" "Hclose". *) iInv N as ">Hinv" "Hclose".
(* rewrite /srv_inv. *) iDestruct "Hinv" as "[Hinv|[Hinv|[Hinv|Hinv]]]".
(* iDestruct "Hinv" as "[Hinv|[Hinv|Hinv]]". *) + iDestruct "Hinv" as (?) "(Hp & Ho1 & Ho3)".
(* + iDestruct "Hinv" as (x'') "[Hp Hempty]". *) wp_store. iAssert (|=r=> own γx (1%Qp, DecAgree x))%I with "[Hx]" as "==>Hx".
(* wp_store. *) { iDestruct (own_update with "Hx") as "Hx"; last by iAssumption.
(* iAssert (|=r=> own γx (1%Qp, DecAgree x))%I with "[Hx]" as "Ho". *) apply cmra_update_exclusive. done. }
(* { iDestruct (own_update with "Hx") as "Hx"; last by iAssumption. *) iAssert (|=r=> own γx (((1/2)%Qp, DecAgree x) ((1/2)%Qp, DecAgree x)))%I with "[Hx]" as "==>[Hx1 Hx2]".
(* apply cmra_update_exclusive. done. } *) { iDestruct (own_update with "Hx") as "Hx"; last by iAssumption.
(* iVs "Ho". iDestruct (own_update with "Ho") as "==>[Ho1 Ho2]"; first by apply pair_l_frac_op'. *) by apply pair_l_frac_op_1'. }
(* iVs ("Hclose" with "[Hp Hissued Ho1]"). *) iVs ("Hclose" with "[Hp Hx1 Ho1 Ho4]").
(* { rewrite /locked. iNext. iRight. iLeft. *) { iNext. iRight. iLeft. iExists x. by iFrame. }
(* iExists x. by iFrame. } *) iVsIntro. wp_seq.
(* iVsIntro. wp_seq. *) wp_bind (wait _).
(* wp_bind (wait _). *) iApply (wait_spec with "[Hx2 Ho3 Hlked]"); first by done.
(* iApply (wait_spec with "[Hempty Hfinished Ho2 Hlked]"); first by done. *) iFrame "Hh". iFrame "#". iFrame.
(* { iFrame "Hh". iFrame "#". iFrame. *) iIntros (y) "Ho4 Hx %".
(* iIntros (y3) "[Hempty Hissued] Hx %". *) wp_let. wp_bind (release _).
(* wp_let. wp_bind (release _). *) iApply release_spec. iFrame "Hlk Hlked".
(* iApply pvs_wp. *) iSplitL.
(* iInv N as ">[Hinv|[Hinv|Hinv]]" "Hclose". *) * iExists x. by iFrame.
(* - admit. *) * wp_seq. done.
(* - admit. *) + admit.
(* - iDestruct "Hinv" as (x4 y4) "(Hp & _ & _ & Hfinished)". *) + admit.
(* iVs ("Hclose" with "[Hp Hempty]"). *) + admit.
(* { iNext. iLeft. iExists y4. by iFrame. } *)
(* iApply release_spec. *)
(* iFrame "Hlk Hlked". *)
(* iSplitL "Hissued Hfinished Hx". *)
(* { iExists x. by iFrame. } *)
(* by wp_seq. *)
(* } *)
(* + admit. *)
(* + admit. *) admit.
- (* server side *) - (* server side *)
iLöb as "IH". iLöb as "IH".
wp_rec. wp_let. wp_bind (! _)%E. wp_rec. wp_let. wp_bind (! _)%E.
......
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