Commit f123ff1e authored by Ralf Jung's avatar Ralf Jung

make emp_wand a LeftId instance, like True_impl

parent bf5df6e8
...@@ -373,12 +373,13 @@ Proof. ...@@ -373,12 +373,13 @@ Proof.
apply sep_mono_r, wand_elim_r. apply sep_mono_r, wand_elim_r.
Qed. Qed.
Lemma emp_wand P : (emp - P) P. Global Instance emp_wand : LeftId () emp%I (@bi_wand PROP).
Proof. Proof.
apply (anti_symm _). intros P. apply (anti_symm _).
- by rewrite -[(emp - P)%I]left_id wand_elim_r. - by rewrite -[(emp - P)%I]left_id wand_elim_r.
- apply wand_intro_l. by rewrite left_id. - apply wand_intro_l. by rewrite left_id.
Qed. Qed.
Lemma False_wand P : (False - P) True. Lemma False_wand P : (False - P) True.
Proof. Proof.
apply (anti_symm ()); [by auto|]. apply (anti_symm ()); [by auto|].
...@@ -426,7 +427,7 @@ Lemma wand_iff_refl P : emp ⊢ P ∗-∗ P. ...@@ -426,7 +427,7 @@ Lemma wand_iff_refl P : emp ⊢ P ∗-∗ P.
Proof. apply and_intro; apply wand_intro_l; by rewrite right_id. Qed. Proof. apply and_intro; apply wand_intro_l; by rewrite right_id. Qed.
Lemma wand_entails P Q : (P - Q)%I P Q. Lemma wand_entails P Q : (P - Q)%I P Q.
Proof. intros. rewrite -[P]left_id. by apply wand_elim_l'. Qed. Proof. intros. rewrite -[P]emp_sep. by apply wand_elim_l'. Qed.
Lemma entails_wand P Q : (P Q) (P - Q)%I. Lemma entails_wand P Q : (P Q) (P - Q)%I.
Proof. intros ->. apply wand_intro_r. by rewrite left_id. Qed. Proof. intros ->. apply wand_intro_r. by rewrite left_id. Qed.
...@@ -531,7 +532,7 @@ Lemma pure_wand_forall φ P `{!Absorbing P} : (⌜φ⌝ -∗ P) ⊣⊢ (∀ _ : ...@@ -531,7 +532,7 @@ Lemma pure_wand_forall φ P `{!Absorbing P} : (⌜φ⌝ -∗ P) ⊣⊢ (∀ _ :
Proof. Proof.
apply (anti_symm _). apply (anti_symm _).
- apply forall_intro=> Hφ. - apply forall_intro=> Hφ.
by rewrite -(left_id emp%I _ (_ - _)%I) (pure_intro φ emp%I) // wand_elim_r. rewrite -(pure_intro φ emp%I) // emp_wand //.
- apply wand_intro_l, wand_elim_l', pure_elim'=> Hφ. - apply wand_intro_l, wand_elim_l', pure_elim'=> Hφ.
apply wand_intro_l. rewrite (forall_elim Hφ) comm. by apply absorbing. apply wand_intro_l. rewrite (forall_elim Hφ) comm. by apply absorbing.
Qed. Qed.
...@@ -667,8 +668,8 @@ Lemma True_affine_all_affine P : Affine (PROP:=PROP) True → Affine P. ...@@ -667,8 +668,8 @@ Lemma True_affine_all_affine P : Affine (PROP:=PROP) True → Affine P.
Proof. rewrite /Affine=> <-; auto. Qed. Proof. rewrite /Affine=> <-; auto. Qed.
Lemma emp_absorbing_all_absorbing P : Absorbing (PROP:=PROP) emp Absorbing P. Lemma emp_absorbing_all_absorbing P : Absorbing (PROP:=PROP) emp Absorbing P.
Proof. Proof.
intros. rewrite /Absorbing -{2}(left_id emp%I _ P). intros. rewrite /Absorbing -{2}(emp_sep P).
by rewrite -(absorbing emp) absorbingly_sep_l left_id. rewrite -(absorbing emp) absorbingly_sep_l left_id //.
Qed. Qed.
Lemma sep_elim_l P Q `{H : TCOr (Affine Q) (Absorbing P)} : P Q P. Lemma sep_elim_l P Q `{H : TCOr (Affine Q) (Absorbing P)} : P Q P.
...@@ -819,8 +820,8 @@ Lemma persistently_and_emp_elim P : emp ∧ <pers> P ⊢ P. ...@@ -819,8 +820,8 @@ Lemma persistently_and_emp_elim P : emp ∧ <pers> P ⊢ P.
Proof. by rewrite comm persistently_and_sep_elim_emp right_id and_elim_r. Qed. Proof. by rewrite comm persistently_and_sep_elim_emp right_id and_elim_r. Qed.
Lemma persistently_into_absorbingly P : <pers> P <absorb> P. Lemma persistently_into_absorbingly P : <pers> P <absorb> P.
Proof. Proof.
rewrite -(right_id True%I _ (<pers> _)%I) -{1}(left_id emp%I _ True%I). rewrite -(right_id True%I _ (<pers> _)%I) -{1}(emp_sep True%I).
by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim comm. rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim comm //.
Qed. Qed.
Lemma persistently_elim P `{!Absorbing P} : <pers> P P. Lemma persistently_elim P `{!Absorbing P} : <pers> P P.
Proof. by rewrite persistently_into_absorbingly absorbing_absorbingly. Qed. Proof. by rewrite persistently_into_absorbingly absorbing_absorbingly. Qed.
...@@ -846,14 +847,14 @@ Lemma persistently_sep_dup P : <pers> P ⊣⊢ <pers> P ∗ <pers> P. ...@@ -846,14 +847,14 @@ Lemma persistently_sep_dup P : <pers> P ⊣⊢ <pers> P ∗ <pers> P.
Proof. Proof.
apply (anti_symm _). apply (anti_symm _).
- rewrite -{1}(idemp bi_and (<pers> _)%I). - rewrite -{1}(idemp bi_and (<pers> _)%I).
by rewrite -{2}(left_id emp%I _ (<pers> _)%I) by rewrite -{2}(emp_sep (<pers> _)%I)
persistently_and_sep_assoc and_elim_l. persistently_and_sep_assoc and_elim_l.
- by rewrite persistently_absorbing. - by rewrite persistently_absorbing.
Qed. Qed.
Lemma persistently_and_sep_l_1 P Q : <pers> P Q <pers> P Q. Lemma persistently_and_sep_l_1 P Q : <pers> P Q <pers> P Q.
Proof. Proof.
by rewrite -{1}(left_id emp%I _ Q%I) persistently_and_sep_assoc and_elim_l. by rewrite -{1}(emp_sep Q%I) persistently_and_sep_assoc and_elim_l.
Qed. Qed.
Lemma persistently_and_sep_r_1 P Q : P <pers> Q P <pers> Q. Lemma persistently_and_sep_r_1 P Q : P <pers> Q P <pers> Q.
Proof. by rewrite !(comm _ P) persistently_and_sep_l_1. Qed. Proof. by rewrite !(comm _ P) persistently_and_sep_l_1. Qed.
...@@ -861,7 +862,7 @@ Proof. by rewrite !(comm _ P) persistently_and_sep_l_1. Qed. ...@@ -861,7 +862,7 @@ Proof. by rewrite !(comm _ P) persistently_and_sep_l_1. Qed.
Lemma persistently_and_sep P Q : <pers> (P Q) <pers> (P Q). Lemma persistently_and_sep P Q : <pers> (P Q) <pers> (P Q).
Proof. Proof.
rewrite persistently_and. rewrite persistently_and.
rewrite -{1}persistently_idemp -persistently_and -{1}(left_id emp%I _ Q%I). rewrite -{1}persistently_idemp -persistently_and -{1}(emp_sep Q%I).
by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim. by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim.
Qed. Qed.
...@@ -914,7 +915,7 @@ Proof. intros; rewrite -persistently_and_sep_r_1; auto. Qed. ...@@ -914,7 +915,7 @@ Proof. intros; rewrite -persistently_and_sep_r_1; auto. Qed.
Lemma persistently_impl_wand_2 P Q : <pers> (P - Q) <pers> (P Q). Lemma persistently_impl_wand_2 P Q : <pers> (P - Q) <pers> (P Q).
Proof. Proof.
apply persistently_intro', impl_intro_r. apply persistently_intro', impl_intro_r.
rewrite -{2}(left_id emp%I _ P%I) persistently_and_sep_assoc. rewrite -{2}(emp_sep P%I) persistently_and_sep_assoc.
by rewrite (comm bi_and) persistently_and_emp_elim wand_elim_l. by rewrite (comm bi_and) persistently_and_emp_elim wand_elim_l.
Qed. Qed.
......
...@@ -192,12 +192,12 @@ Lemma plainly_sep_dup P : ■ P ⊣⊢ ■ P ∗ ■ P. ...@@ -192,12 +192,12 @@ Lemma plainly_sep_dup P : ■ P ⊣⊢ ■ P ∗ ■ P.
Proof. Proof.
apply (anti_symm _). apply (anti_symm _).
- rewrite -{1}(idemp bi_and ( _)%I). - rewrite -{1}(idemp bi_and ( _)%I).
by rewrite -{2}(left_id emp%I _ ( _)%I) plainly_and_sep_assoc and_elim_l. by rewrite -{2}(emp_sep ( _)%I) plainly_and_sep_assoc and_elim_l.
- by rewrite plainly_absorb. - by rewrite plainly_absorb.
Qed. Qed.
Lemma plainly_and_sep_l_1 P Q : P Q P Q. Lemma plainly_and_sep_l_1 P Q : P Q P Q.
Proof. by rewrite -{1}(left_id emp%I _ Q%I) plainly_and_sep_assoc and_elim_l. Qed. Proof. by rewrite -{1}(emp_sep Q%I) plainly_and_sep_assoc and_elim_l. Qed.
Lemma plainly_and_sep_r_1 P Q : P Q P Q. Lemma plainly_and_sep_r_1 P Q : P Q P Q.
Proof. by rewrite !(comm _ P) plainly_and_sep_l_1. Qed. Proof. by rewrite !(comm _ P) plainly_and_sep_l_1. Qed.
...@@ -206,7 +206,7 @@ Proof. apply (anti_symm _); eauto using plainly_mono, plainly_emp_intro. Qed. ...@@ -206,7 +206,7 @@ Proof. apply (anti_symm _); eauto using plainly_mono, plainly_emp_intro. Qed.
Lemma plainly_and_sep P Q : (P Q) (P Q). Lemma plainly_and_sep P Q : (P Q) (P Q).
Proof. Proof.
rewrite plainly_and. rewrite plainly_and.
rewrite -{1}plainly_idemp -plainly_and -{1}(left_id emp%I _ Q%I). rewrite -{1}plainly_idemp -plainly_and -{1}(emp_sep Q%I).
by rewrite plainly_and_sep_assoc (comm bi_and) plainly_and_emp_elim. by rewrite plainly_and_sep_assoc (comm bi_and) plainly_and_emp_elim.
Qed. Qed.
...@@ -249,7 +249,7 @@ Proof. intros; rewrite -plainly_and_sep_r_1; auto. Qed. ...@@ -249,7 +249,7 @@ Proof. intros; rewrite -plainly_and_sep_r_1; auto. Qed.
Lemma plainly_impl_wand_2 P Q : (P - Q) (P Q). Lemma plainly_impl_wand_2 P Q : (P - Q) (P Q).
Proof. Proof.
apply plainly_intro', impl_intro_r. apply plainly_intro', impl_intro_r.
rewrite -{2}(left_id emp%I _ P%I) plainly_and_sep_assoc. rewrite -{2}(emp_sep P%I) plainly_and_sep_assoc.
by rewrite (comm bi_and) plainly_and_emp_elim wand_elim_l. by rewrite (comm bi_and) plainly_and_emp_elim wand_elim_l.
Qed. Qed.
......
From stdpp Require Import coPset. From stdpp Require Import coPset.
From iris.bi Require Import interface derived_laws_sbi big_op plainly. From iris.bi Require Import interface derived_laws_sbi big_op plainly.
Import interface.bi derived_laws_bi.bi derived_laws_sbi.bi.
(* We first define operational type classes for the notations, and then later (* We first define operational type classes for the notations, and then later
bundle these operational type classes with the laws. *) bundle these operational type classes with the laws. *)
...@@ -135,9 +136,9 @@ Section bupd_derived. ...@@ -135,9 +136,9 @@ Section bupd_derived.
Lemma bupd_frame_l R Q : (R |==> Q) == R Q. Lemma bupd_frame_l R Q : (R |==> Q) == R Q.
Proof. rewrite !(comm _ R); apply bupd_frame_r. Qed. Proof. rewrite !(comm _ R); apply bupd_frame_r. Qed.
Lemma bupd_wand_l P Q : (P - Q) (|==> P) == Q. Lemma bupd_wand_l P Q : (P - Q) (|==> P) == Q.
Proof. by rewrite bupd_frame_l bi.wand_elim_l. Qed. Proof. by rewrite bupd_frame_l wand_elim_l. Qed.
Lemma bupd_wand_r P Q : (|==> P) (P - Q) == Q. Lemma bupd_wand_r P Q : (|==> P) (P - Q) == Q.
Proof. by rewrite bupd_frame_r bi.wand_elim_r. Qed. Proof. by rewrite bupd_frame_r wand_elim_r. Qed.
Lemma bupd_sep P Q : (|==> P) (|==> Q) == P Q. Lemma bupd_sep P Q : (|==> P) (|==> Q) == P Q.
Proof. by rewrite bupd_frame_r bupd_frame_l bupd_trans. Qed. Proof. by rewrite bupd_frame_r bupd_frame_l bupd_trans. Qed.
End bupd_derived. End bupd_derived.
...@@ -148,8 +149,8 @@ Section bupd_derived_sbi. ...@@ -148,8 +149,8 @@ Section bupd_derived_sbi.
Lemma except_0_bupd P : (|==> P) (|==> P). Lemma except_0_bupd P : (|==> P) (|==> P).
Proof. Proof.
rewrite /sbi_except_0. apply bi.or_elim; eauto using bupd_mono, bi.or_intro_r. rewrite /sbi_except_0. apply or_elim; eauto using bupd_mono, or_intro_r.
by rewrite -bupd_intro -bi.or_intro_l. by rewrite -bupd_intro -or_intro_l.
Qed. Qed.
Lemma bupd_plain P `{BiBUpdPlainly PROP, !Plain P} : (|==> P) P. Lemma bupd_plain P `{BiBUpdPlainly PROP, !Plain P} : (|==> P) P.
...@@ -180,14 +181,14 @@ Section fupd_derived. ...@@ -180,14 +181,14 @@ Section fupd_derived.
Lemma fupd_frame_l E1 E2 P Q : (P |={E1,E2}=> Q) ={E1,E2}= P Q. Lemma fupd_frame_l E1 E2 P Q : (P |={E1,E2}=> Q) ={E1,E2}= P Q.
Proof. rewrite !(comm _ P); apply fupd_frame_r. Qed. Proof. rewrite !(comm _ P); apply fupd_frame_r. Qed.
Lemma fupd_wand_l E1 E2 P Q : (P - Q) (|={E1,E2}=> P) ={E1,E2}= Q. Lemma fupd_wand_l E1 E2 P Q : (P - Q) (|={E1,E2}=> P) ={E1,E2}= Q.
Proof. by rewrite fupd_frame_l bi.wand_elim_l. Qed. Proof. by rewrite fupd_frame_l wand_elim_l. Qed.
Lemma fupd_wand_r E1 E2 P Q : (|={E1,E2}=> P) (P - Q) ={E1,E2}= Q. Lemma fupd_wand_r E1 E2 P Q : (|={E1,E2}=> P) (P - Q) ={E1,E2}= Q.
Proof. by rewrite fupd_frame_r bi.wand_elim_r. Qed. Proof. by rewrite fupd_frame_r wand_elim_r. Qed.
Lemma fupd_trans_frame E1 E2 E3 P Q : Lemma fupd_trans_frame E1 E2 E3 P Q :
((Q ={E2,E3}= emp) |={E1,E2}=> (Q P)) ={E1,E3}= P. ((Q ={E2,E3}= emp) |={E1,E2}=> (Q P)) ={E1,E3}= P.
Proof. Proof.
rewrite fupd_frame_l assoc -(comm _ Q) bi.wand_elim_r. rewrite fupd_frame_l assoc -(comm _ Q) wand_elim_r.
by rewrite fupd_frame_r left_id fupd_trans. by rewrite fupd_frame_r left_id fupd_trans.
Qed. Qed.
...@@ -199,7 +200,7 @@ Section fupd_derived. ...@@ -199,7 +200,7 @@ Section fupd_derived.
E1 ## Ef (|={E1,E2}=> P) ={E1 Ef,E2 Ef}= P. E1 ## Ef (|={E1,E2}=> P) ={E1 Ef,E2 Ef}= P.
Proof. Proof.
intros ?. rewrite -fupd_mask_frame_r' //. f_equiv. intros ?. rewrite -fupd_mask_frame_r' //. f_equiv.
apply bi.impl_intro_l, bi.and_elim_r. apply impl_intro_l, and_elim_r.
Qed. Qed.
Lemma fupd_mask_mono E1 E2 P : E1 E2 (|={E1}=> P) ={E2}= P. Lemma fupd_mask_mono E1 E2 P : E1 E2 (|={E1}=> P) ={E2}= P.
Proof. Proof.
...@@ -226,8 +227,8 @@ Section fupd_derived. ...@@ -226,8 +227,8 @@ Section fupd_derived.
(Q - |={EE2,E'}=> ( R, (|={E1E2,E1}=> R) - |={EE2,E}=> R) - P) - (Q - |={EE2,E'}=> ( R, (|={E1E2,E1}=> R) - |={EE2,E}=> R) - P) -
(|={E,E'}=> P). (|={E,E'}=> P).
Proof. Proof.
intros HE. apply bi.wand_intro_r. rewrite fupd_frame_r. intros HE. apply wand_intro_r. rewrite fupd_frame_r.
rewrite bi.wand_elim_r. clear Q. rewrite wand_elim_r. clear Q.
rewrite -(fupd_mask_frame E E'); first apply fupd_mono; last done. rewrite -(fupd_mask_frame E E'); first apply fupd_mono; last done.
(* The most horrible way to apply fupd_intro_mask *) (* The most horrible way to apply fupd_intro_mask *)
rewrite -[X in (X - _)](right_id emp%I). rewrite -[X in (X - _)](right_id emp%I).
...@@ -235,9 +236,9 @@ Section fupd_derived. ...@@ -235,9 +236,9 @@ Section fupd_derived.
{ rewrite {1}(union_difference_L _ _ HE). set_solver. } { rewrite {1}(union_difference_L _ _ HE). set_solver. }
rewrite fupd_frame_l fupd_frame_r. apply fupd_elim. rewrite fupd_frame_l fupd_frame_r. apply fupd_elim.
apply fupd_mono. apply fupd_mono.
eapply bi.wand_apply; eapply wand_apply;
last (apply bi.sep_mono; first reflexivity); first reflexivity. last (apply sep_mono; first reflexivity); first reflexivity.
apply bi.forall_intro=>R. apply bi.wand_intro_r. apply forall_intro=>R. apply wand_intro_r.
rewrite fupd_frame_r. apply fupd_elim. rewrite left_id. rewrite fupd_frame_r. apply fupd_elim. rewrite left_id.
rewrite (fupd_mask_frame_r _ _ (E E1)); last set_solver+. rewrite (fupd_mask_frame_r _ _ (E E1)); last set_solver+.
rewrite {4}(union_difference_L _ _ HE). done. rewrite {4}(union_difference_L _ _ HE). done.
...@@ -271,16 +272,16 @@ Section fupd_derived. ...@@ -271,16 +272,16 @@ Section fupd_derived.
Lemma fupd_plain `{BiPlainly PROP, !BiFUpdPlainly PROP} E1 E2 P Q `{!Plain P} : Lemma fupd_plain `{BiPlainly PROP, !BiFUpdPlainly PROP} E1 E2 P Q `{!Plain P} :
E1 E2 (Q - P) - (|={E1, E2}=> Q) ={E1}= (|={E1, E2}=> Q) P. E1 E2 (Q - P) - (|={E1, E2}=> Q) ={E1}= (|={E1, E2}=> Q) P.
Proof. Proof.
intros HE. rewrite -(fupd_plain' _ _ E1) //. apply bi.wand_intro_l. intros HE. rewrite -(fupd_plain' _ _ E1) //. apply wand_intro_l.
by rewrite bi.wand_elim_r -fupd_intro. by rewrite wand_elim_r -fupd_intro.
Qed. Qed.
(** Fancy updates that take a step derived rules. *) (** Fancy updates that take a step derived rules. *)
Lemma step_fupd_wand E1 E2 P Q : (|={E1,E2}=> P) - (P - Q) - |={E1,E2}=> Q. Lemma step_fupd_wand E1 E2 P Q : (|={E1,E2}=> P) - (P - Q) - |={E1,E2}=> Q.
Proof. Proof.
apply bi.wand_intro_l. apply wand_intro_l.
by rewrite (bi.later_intro (P - Q)%I) fupd_frame_l -bi.later_sep fupd_frame_l by rewrite (later_intro (P - Q)%I) fupd_frame_l -later_sep fupd_frame_l
bi.wand_elim_l. wand_elim_l.
Qed. Qed.
Lemma step_fupd_mask_frame_r E1 E2 Ef P : Lemma step_fupd_mask_frame_r E1 E2 Ef P :
...@@ -292,13 +293,13 @@ Section fupd_derived. ...@@ -292,13 +293,13 @@ Section fupd_derived.
Lemma step_fupd_mask_mono E1 E2 F1 F2 P : Lemma step_fupd_mask_mono E1 E2 F1 F2 P :
F1 F2 E1 E2 (|={E1,F2}=> P) |={E2,F1}=> P. F1 F2 E1 E2 (|={E1,F2}=> P) |={E2,F1}=> P.
Proof. Proof.
intros ??. rewrite -(left_id emp%I _ (|={E1,F2}=> P)%I). intros ??. rewrite -(emp_sep (|={E1,F2}=> P)%I).
rewrite (fupd_intro_mask E2 E1 emp%I) //. rewrite (fupd_intro_mask E2 E1 emp%I) //.
rewrite fupd_frame_r -(fupd_trans E2 E1 F1). f_equiv. rewrite fupd_frame_r -(fupd_trans E2 E1 F1). f_equiv.
rewrite fupd_frame_l -(fupd_trans E1 F2 F1). f_equiv. rewrite fupd_frame_l -(fupd_trans E1 F2 F1). f_equiv.
rewrite (fupd_intro_mask F2 F1 (|={_,_}=> emp)%I) //. rewrite (fupd_intro_mask F2 F1 (|={_,_}=> emp)%I) //.
rewrite fupd_frame_r. f_equiv. rewrite fupd_frame_r. f_equiv.
rewrite [X in (X _)%I]bi.later_intro -bi.later_sep. f_equiv. rewrite [X in (X _)%I]later_intro -later_sep. f_equiv.
rewrite fupd_frame_r -(fupd_trans F1 F2 E2). f_equiv. rewrite fupd_frame_r -(fupd_trans F1 F2 E2). f_equiv.
rewrite fupd_frame_l -(fupd_trans F2 E1 E2). f_equiv. rewrite fupd_frame_l -(fupd_trans F2 E1 E2). f_equiv.
by rewrite fupd_frame_r left_id. by rewrite fupd_frame_r left_id.
......
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