Commit 8b94528d authored by Dan Frumin's avatar Dan Frumin

rel_apply_l/r tactics

parent d7cada37
......@@ -50,15 +50,15 @@ Section CG_Counter.
Proof.
iIntros (?) "Hx Hl Hlog".
unfold CG_increment. unlock. simpl_subst/=.
rel_rec_r.
rel_bind_r (acquire #l).
iApply (bin_log_related_acquire_r with "Hl"); eauto. iIntros "Hl". simpl.
rel_rec_r.
rel_apply_r (bin_log_related_acquire_r with "Hl"); eauto.
iIntros "Hl".
rel_rec_r.
rel_load_r.
rel_op_r.
rel_store_r. simpl.
rel_rec_r.
iApply (bin_log_related_release_r with "Hl"); eauto.
rel_apply_r (bin_log_related_release_r with "Hl"); eauto.
by iApply "Hlog".
Qed.
......@@ -150,8 +150,7 @@ Section CG_Counter.
iLöb as "IH".
rel_rec_l.
iPoseProof "H" as "H2". (* lolwhat *)
rel_bind_l (Load #x).
iApply (bin_log_related_load_l).
rel_load_l_atomic.
iMod "H" as (n) "[Hx [HR Hrev]]". iModIntro.
iExists (#nv n). iFrame. iNext. iIntros "Hx".
iDestruct "Hrev" as "[Hrev _]".
......@@ -160,8 +159,7 @@ Section CG_Counter.
{ iExists _. iFrame. } iModIntro. simpl.
rel_rec_l.
rel_op_l.
rel_bind_l (CAS _ _ _).
iApply (bin_log_related_cas_l); auto.
rel_cas_l_atomic.
iMod "H2" as (n') "[Hx [HR HQ]]". iModIntro. simpl.
destruct (decide (n = n')); subst.
- iExists (#nv n'). iFrame.
......@@ -169,12 +167,12 @@ Section CG_Counter.
iIntros "_ !> Hx". simpl.
iDestruct "HQ" as "[_ HQ]".
iSpecialize ("HQ" $! n' with "[Hx HR]"). { iFrame. }
iApply bin_log_related_if_true_masked_l; auto.
rel_if_true_l. done.
- iExists (#nv n'). iFrame.
iSplitL; eauto; last first.
{ iDestruct 1 as %Hfoo. exfalso. simplify_eq. }
iIntros "_ !> Hx". simpl.
iApply bin_log_related_if_false_masked_l; auto.
rel_if_false_l.
iDestruct "HQ" as "[HQ _]".
iMod ("HQ" with "[Hx HR]").
{ iExists _; iFrame. }
......@@ -192,7 +190,7 @@ Section CG_Counter.
iIntros "#H".
unfold counter_read. unlock. simpl.
rel_rec_l.
iApply bin_log_related_load_l.
rel_load_l_atomic.
iMod "H" as (n) "[Hx [HR Hfin]]". iModIntro.
iExists _; iFrame "Hx". iNext.
iIntros "Hx".
......@@ -267,8 +265,7 @@ Section CG_Counter.
iApply bin_log_related_arrow; try by (unlock; eauto).
iAlways. iIntros ([? ?]) "/= [% %]"; simplify_eq/=.
unlock. rel_rec_l. rel_rec_r.
rel_bind_r (newlock ())%E.
iApply (bin_log_related_newlock_r); auto; simpl.
rel_apply_r bin_log_related_newlock_r; auto.
iIntros (l) "Hl".
rel_rec_r.
rel_alloc_r as cnt' "Hcnt'".
......
......@@ -50,8 +50,7 @@ Section Refinement.
iIntros (?) "#Hs Hlog".
unfold rand. unlock. simpl.
rel_rec_l.
rel_bind_l (Alloc _).
iApply bin_log_related_alloc_l'; first eauto. iNext. iIntros (y) "Hy". simpl.
rel_alloc_l as y "Hy". simpl.
rel_rec_l.
iMod (inv_alloc choiceN _ ( b, y ↦ᵢ (#v b))%I with "[Hy]") as "#Hinv".
{ iNext. eauto. }
......@@ -65,10 +64,10 @@ Section Refinement.
done.
- simpl.
rel_rec_l.
rel_load_l under choiceN as "Hy" "Hcl".
iDestruct "Hy" as (b) "Hy".
iExists (#v b). iFrame.
iModIntro. iNext. iIntros "Hy".
rel_load_l_atomic.
iInv choiceN as (b) "Hy" "Hcl".
iExists (#v b). iFrame.
iModIntro. iNext. iIntros "Hy".
iMod ("Hcl" with "[Hy]").
{ iNext. iExists b. iFrame. }
done.
......@@ -104,8 +103,7 @@ Section Refinement.
rel_rec_l.
rel_store_l. simpl.
rel_rec_l.
rel_bind_l (rand ())%E.
iApply (rand_l with "Hs"); eauto. simpl.
rel_apply_l (rand_l with "Hs"); eauto.
by iApply "Hlog".
Qed.
......@@ -119,12 +117,11 @@ Section Refinement.
unfold earlyChoice. unlock.
rel_rec_r.
rel_bind_r (rand ())%E.
iApply (rand_r b with "Hspec"); eauto. simpl.
rel_apply_r (rand_r b with "Hspec"); eauto.
rel_rec_r.
rel_store_r. simpl.
rel_rec_r.
rel_vals; simpl; eauto.
rel_vals; eauto.
Qed.
Lemma prerefinement2 Δ Γ x x' n ρ :
......@@ -134,20 +131,19 @@ Section Refinement.
iIntros "#Hspec Hx Hx'".
unfold earlyChoice. unlock.
rel_rec_l.
rel_bind_l (rand ())%E.
iApply (rand_l with "Hspec"); eauto. simpl. iIntros (b).
rel_apply_l (rand_l with "Hspec"); eauto.
iIntros (b).
rel_rec_l.
unfold lateChoice. unlock.
rel_rec_r.
rel_store_r. simpl.
rel_rec_r.
rel_bind_r (rand ())%E.
iApply (rand_r b with "Hspec"); eauto. simpl.
rel_apply_r (rand_r b with "Hspec"); eauto.
rel_store_l. simpl.
rel_rec_l.
rel_vals; simpl; eauto.
rel_vals; eauto.
Qed.
End Refinement.
......@@ -671,8 +671,8 @@ Section masked.
Qed.
End masked.
Theorem binary_fundamental Γ e τ :
Γ ⊢ₜ e : τ (Γ e log e : τ)%I.
Theorem binary_fundamental Δ Γ e τ :
Γ ⊢ₜ e : τ ({,;Δ;Γ} e log e : τ)%I.
Proof. by eapply binary_fundamental_masked. Qed.
End fundamental.
This diff is collapsed.
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