From b21816e8ecf23fa3cbd0683f5403a4a55870f5ab Mon Sep 17 00:00:00 2001 From: jihgfee <jihgfee@gmail.com> Date: Mon, 23 Nov 2020 17:30:54 +0100 Subject: [PATCH] Added an equivalence lemma for iProto_choice --- theories/channel/channel.v | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/theories/channel/channel.v b/theories/channel/channel.v index 6a69f5e..dabfc95 100644 --- a/theories/channel/channel.v +++ b/theories/channel/channel.v @@ -157,6 +157,44 @@ Section channel. Proper ((≡) ==> (≡) ==> (≡) ==> (≡) ==> (≡)) (@iProto_choice Σ a). Proof. solve_proper. Qed. + Lemma iProto_choice_equiv a1 a2 (P11 P12 P21 P22 : iProp Σ) + (p11 p12 p21 p22 : iProto Σ) : + ⌜a1 = a2⌠-∗ ((P11 ≡ P12):iProp Σ) -∗ (P21 ≡ P22) -∗ + ▷ (p11 ≡ p12) -∗ ▷ (p21 ≡ p22) -∗ + (iProto_choice a1 P11 P21 p11 p21 ≡ iProto_choice a2 P12 P22 p12 p22). + Proof. + iIntros (->) "#HP1 #HP2 #Hp1 #Hp2". + rewrite iProto_message_equivI. + iSplit; [ done | ]. + iIntros (v lp). + rewrite iMsg_exist_eq iMsg_base_eq /=. + iApply prop_ext; iIntros "!>"; iSplit. + - iDestruct 1 as (b Hbeq) "[Hp HP]". + iExists b. rewrite Hbeq. + destruct lp as [lp]. destruct b. + + iRewrite -"HP1". + iSplit; [ done | ]. iFrame "HP". + iIntros "!>". + by iRewrite -"Hp1". + + iRewrite -"HP2". + iSplit; [ done | ]. iFrame "HP". + iIntros "!>". + by iRewrite -"Hp2". + - iDestruct 1 as (b Hbeq) "[Hp HP]". + iExists b. rewrite Hbeq. + destruct lp as [lp]. + destruct b. + + iRewrite "HP1". + iSplit; [ done | ]. iFrame "HP". + iIntros "!>". + by iRewrite "Hp1". + + iRewrite "HP2". + iSplit; [ done | ]. iFrame "HP". + iIntros "!>". + by iRewrite "Hp2". + Qed. + + Lemma iProto_dual_choice a P1 P2 p1 p2 : iProto_dual (iProto_choice a P1 P2 p1 p2) ≡ iProto_choice (action_dual a) P1 P2 (iProto_dual p1) (iProto_dual p2). -- GitLab