Commit ee12aa64 authored by Ralf Jung's avatar Ralf Jung
Browse files

rename affinely_persistently -> intuitionistically; and make it a TC-opaque definition

parent b1ddcc68
...@@ -73,7 +73,7 @@ Qed. ...@@ -73,7 +73,7 @@ Qed.
Global Instance into_and_ownM p (a b1 b2 : M) : Global Instance into_and_ownM p (a b1 b2 : M) :
IsOp a b1 b2 IntoAnd p (uPred_ownM a) (uPred_ownM b1) (uPred_ownM b2). IsOp a b1 b2 IntoAnd p (uPred_ownM a) (uPred_ownM b1) (uPred_ownM b2).
Proof. Proof.
intros. apply affinely_persistently_if_mono. by rewrite (is_op a) ownM_op sep_and. intros. apply intuitionistically_if_mono. by rewrite (is_op a) ownM_op sep_and.
Qed. Qed.
Global Instance into_sep_ownM (a b1 b2 : M) : Global Instance into_sep_ownM (a b1 b2 : M) :
......
...@@ -20,7 +20,8 @@ Lemma persistently_cmra_valid_1 {A : cmraT} (a : A) : ✓ a ⊢ <pers> (✓ a : ...@@ -20,7 +20,8 @@ Lemma persistently_cmra_valid_1 {A : cmraT} (a : A) : ✓ a ⊢ <pers> (✓ a :
Proof. by rewrite {1}plainly_cmra_valid_1 plainly_elim_persistently. Qed. Proof. by rewrite {1}plainly_cmra_valid_1 plainly_elim_persistently. Qed.
Lemma affinely_persistently_ownM (a : M) : CoreId a uPred_ownM a uPred_ownM a. Lemma affinely_persistently_ownM (a : M) : CoreId a uPred_ownM a uPred_ownM a.
Proof. Proof.
rewrite affine_affinely=>?; apply (anti_symm _); [by rewrite persistently_elim|]. rewrite /bi_intuitionistically affine_affinely=>?; apply (anti_symm _);
[by rewrite persistently_elim|].
by rewrite {1}persistently_ownM_core core_id_core. by rewrite {1}persistently_ownM_core core_id_core.
Qed. Qed.
Lemma ownM_invalid (a : M) : ¬ {0} a uPred_ownM a False. Lemma ownM_invalid (a : M) : ¬ {0} a uPred_ownM a False.
...@@ -33,7 +34,8 @@ Lemma plainly_cmra_valid {A : cmraT} (a : A) : ■ ✓ a ⊣⊢ ✓ a. ...@@ -33,7 +34,8 @@ Lemma plainly_cmra_valid {A : cmraT} (a : A) : ■ ✓ a ⊣⊢ ✓ a.
Proof. apply (anti_symm _), plainly_cmra_valid_1. apply plainly_elim, _. Qed. Proof. apply (anti_symm _), plainly_cmra_valid_1. apply plainly_elim, _. Qed.
Lemma affinely_persistently_cmra_valid {A : cmraT} (a : A) : a a. Lemma affinely_persistently_cmra_valid {A : cmraT} (a : A) : a a.
Proof. Proof.
rewrite affine_affinely. intros; apply (anti_symm _); first by rewrite persistently_elim. rewrite /bi_intuitionistically affine_affinely. intros; apply (anti_symm _);
first by rewrite persistently_elim.
apply:persistently_cmra_valid_1. apply:persistently_cmra_valid_1.
Qed. Qed.
Lemma bupd_ownM_update x y : x ~~> y uPred_ownM x |==> uPred_ownM y. Lemma bupd_ownM_update x y : x ~~> y uPred_ownM x |==> uPred_ownM y.
......
...@@ -68,4 +68,4 @@ Proof. ...@@ -68,4 +68,4 @@ Proof.
iIntros "[Hvs HQ]". iDestruct "Hvs" as (R) "[HR Hvs]". iIntros "[Hvs HQ]". iDestruct "Hvs" as (R) "[HR Hvs]".
iExists (R Q)%I. iFrame "HR HQ". by iApply vs_frame_r. iExists (R Q)%I. iFrame "HR HQ". by iApply vs_frame_r.
Qed. Qed.
End fupd. End fupd.
\ No newline at end of file
...@@ -150,10 +150,10 @@ Section sep_list. ...@@ -150,10 +150,10 @@ Section sep_list.
Proof. Proof.
apply wand_intro_l. revert Φ Ψ. induction l as [|x l IH]=> Φ Ψ /=. apply wand_intro_l. revert Φ Ψ. induction l as [|x l IH]=> Φ Ψ /=.
{ by rewrite sep_elim_r. } { by rewrite sep_elim_r. }
rewrite affinely_persistently_sep_dup -assoc [( _ _)%I]comm -!assoc assoc. rewrite intuitionistically_sep_dup -assoc [( _ _)%I]comm -!assoc assoc.
apply sep_mono. apply sep_mono.
- rewrite (forall_elim 0) (forall_elim x) pure_True // True_impl. - rewrite (forall_elim 0) (forall_elim x) pure_True // True_impl.
by rewrite affinely_persistently_elim wand_elim_l. by rewrite intuitionistically_elim wand_elim_l.
- rewrite comm -(IH (Φ S) (Ψ S)) /=. - rewrite comm -(IH (Φ S) (Ψ S)) /=.
apply sep_mono_l, affinely_mono, persistently_mono. apply sep_mono_l, affinely_mono, persistently_mono.
apply forall_intro=> k. by rewrite (forall_elim (S k)). apply forall_intro=> k. by rewrite (forall_elim (S k)).
...@@ -423,10 +423,10 @@ Section gmap. ...@@ -423,10 +423,10 @@ Section gmap.
Proof. Proof.
apply wand_intro_l. induction m as [|i x m ? IH] using map_ind. apply wand_intro_l. induction m as [|i x m ? IH] using map_ind.
{ by rewrite sep_elim_r. } { by rewrite sep_elim_r. }
rewrite !big_sepM_insert // affinely_persistently_sep_dup. rewrite !big_sepM_insert // intuitionistically_sep_dup.
rewrite -assoc [( _ _)%I]comm -!assoc assoc. apply sep_mono. rewrite -assoc [( _ _)%I]comm -!assoc assoc. apply sep_mono.
- rewrite (forall_elim i) (forall_elim x) pure_True ?lookup_insert //. - rewrite (forall_elim i) (forall_elim x) pure_True ?lookup_insert //.
by rewrite True_impl affinely_persistently_elim wand_elim_l. by rewrite True_impl intuitionistically_elim wand_elim_l.
- rewrite comm -IH /=. - rewrite comm -IH /=.
apply sep_mono_l, affinely_mono, persistently_mono, forall_mono=> k. apply sep_mono_l, affinely_mono, persistently_mono, forall_mono=> k.
apply forall_mono=> y. apply impl_intro_l, pure_elim_l=> ?. apply forall_mono=> y. apply impl_intro_l, pure_elim_l=> ?.
...@@ -584,10 +584,10 @@ Section gset. ...@@ -584,10 +584,10 @@ Section gset.
Proof. Proof.
apply wand_intro_l. induction X as [|x X ? IH] using collection_ind_L. apply wand_intro_l. induction X as [|x X ? IH] using collection_ind_L.
{ by rewrite sep_elim_r. } { by rewrite sep_elim_r. }
rewrite !big_sepS_insert // affinely_persistently_sep_dup. rewrite !big_sepS_insert // intuitionistically_sep_dup.
rewrite -assoc [( _ _)%I]comm -!assoc assoc. apply sep_mono. rewrite -assoc [( _ _)%I]comm -!assoc assoc. apply sep_mono.
- rewrite (forall_elim x) pure_True; last set_solver. - rewrite (forall_elim x) pure_True; last set_solver.
by rewrite True_impl affinely_persistently_elim wand_elim_l. by rewrite True_impl intuitionistically_elim wand_elim_l.
- rewrite comm -IH /=. apply sep_mono_l, affinely_mono, persistently_mono. - rewrite comm -IH /=. apply sep_mono_l, affinely_mono, persistently_mono.
apply forall_mono=> y. apply impl_intro_l, pure_elim_l=> ?. apply forall_mono=> y. apply impl_intro_l, pure_elim_l=> ?.
by rewrite pure_True ?True_impl; last set_solver. by rewrite pure_True ?True_impl; last set_solver.
......
...@@ -26,9 +26,6 @@ Typeclasses Opaque bi_affinely. ...@@ -26,9 +26,6 @@ Typeclasses Opaque bi_affinely.
Notation "'<affine>' P" := (bi_affinely P) Notation "'<affine>' P" := (bi_affinely P)
(at level 20, right associativity) : bi_scope. (at level 20, right associativity) : bi_scope.
Notation "□ P" := (<affine> <pers> P)%I
(at level 20, right associativity) : bi_scope.
Class Affine {PROP : bi} (Q : PROP) := affine : Q emp. Class Affine {PROP : bi} (Q : PROP) := affine : Q emp.
Arguments Affine {_} _%I : simpl never. Arguments Affine {_} _%I : simpl never.
Arguments affine {_} _%I {_}. Arguments affine {_} _%I {_}.
...@@ -72,9 +69,22 @@ Notation "'<affine>?' p P" := (bi_affinely_if p P) ...@@ -72,9 +69,22 @@ Notation "'<affine>?' p P" := (bi_affinely_if p P)
(at level 20, p at level 9, P at level 20, (at level 20, p at level 9, P at level 20,
right associativity, format "'<affine>?' p P") : bi_scope. right associativity, format "'<affine>?' p P") : bi_scope.
Notation "□? p P" := (<affine>?p <pers>?p P)%I Definition bi_intuitionistically {PROP : bi} (P : PROP) : PROP :=
(<affine> <pers> P)%I.
Arguments bi_intuitionistically {_} _%I : simpl never.
Instance: Params (@bi_intuitionistically) 1.
Typeclasses Opaque bi_intuitionistically.
Notation "□ P" := (bi_intuitionistically P)%I
(at level 20, right associativity) : bi_scope.
Definition bi_intuitionistically_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then P else P)%I.
Arguments bi_intuitionistically_if {_} !_ _%I /.
Instance: Params (@bi_intuitionistically_if) 2.
Typeclasses Opaque bi_intuitionistically_if.
Notation "'□?' p P" := (bi_intuitionistically_if p P)
(at level 20, p at level 9, P at level 20, (at level 20, p at level 9, P at level 20,
right associativity, format "□? p P") : bi_scope. right associativity, format "'□?' p P") : bi_scope.
Fixpoint bi_hexist {PROP : bi} {As} : himpl As PROP PROP := Fixpoint bi_hexist {PROP : bi} {As} : himpl As PROP PROP :=
match As return himpl As PROP PROP with match As return himpl As PROP PROP with
......
...@@ -879,7 +879,7 @@ Qed. ...@@ -879,7 +879,7 @@ Qed.
Lemma impl_wand_persistently_2 P Q : (<pers> P - Q) (<pers> P Q). Lemma impl_wand_persistently_2 P Q : (<pers> P - Q) (<pers> P Q).
Proof. apply impl_intro_l. by rewrite persistently_and_sep_l_1 wand_elim_r. Qed. Proof. apply impl_intro_l. by rewrite persistently_and_sep_l_1 wand_elim_r. Qed.
Section persistently_affinely_bi. Section persistently_affine_bi.
Context `{BiAffine PROP}. Context `{BiAffine PROP}.
Lemma persistently_emp : <pers> emp emp. Lemma persistently_emp : <pers> emp emp.
...@@ -926,72 +926,114 @@ Section persistently_affinely_bi. ...@@ -926,72 +926,114 @@ Section persistently_affinely_bi.
- apply exist_elim=> R. apply impl_intro_l. - apply exist_elim=> R. apply impl_intro_l.
by rewrite assoc persistently_and_sep_r persistently_elim wand_elim_r. by rewrite assoc persistently_and_sep_r persistently_elim wand_elim_r.
Qed. Qed.
End persistently_affinely_bi. End persistently_affine_bi.
(* The combined affinely persistently modality *) (* The intuitionistic modality *)
Lemma affinely_persistently_elim P : P P. Global Instance intuitionistically_ne : NonExpansive (@bi_intuitionistically PROP).
Proof. solve_proper. Qed.
Global Instance intuitionistically_proper : Proper (() ==> ()) (@bi_intuitionistically PROP).
Proof. solve_proper. Qed.
Global Instance intuitionistically_mono' : Proper (() ==> ()) (@bi_intuitionistically PROP).
Proof. solve_proper. Qed.
Global Instance intuitionistically_flip_mono' :
Proper (flip () ==> flip ()) (@bi_intuitionistically PROP).
Proof. solve_proper. Qed.
Lemma intuitionistically_elim P : P P.
Proof. apply persistently_and_emp_elim. Qed. Proof. apply persistently_and_emp_elim. Qed.
Lemma affinely_persistently_intro' P Q : ( P Q) P Q. Lemma intuitionistically_elim_emp P : P emp.
Proof. intros <-. by rewrite persistently_affinely persistently_idemp. Qed. Proof. rewrite /bi_intuitionistically affinely_elim_emp //. Qed.
Lemma intuitionistically_intro' P Q : ( P Q) P Q.
Proof.
intros <-.
by rewrite /bi_intuitionistically persistently_affinely persistently_idemp.
Qed.
Lemma affinely_persistently_emp : emp emp. Lemma intuitionistically_emp : emp emp.
Proof.
by rewrite /bi_intuitionistically -persistently_True_emp persistently_pure
affinely_True_emp affinely_emp.
Qed.
Lemma intuitionistically_True_emp : True emp.
Proof. Proof.
by rewrite -persistently_True_emp persistently_pure affinely_True_emp rewrite -intuitionistically_emp /bi_intuitionistically
affinely_emp. persistently_True_emp //.
Qed. Qed.
Lemma affinely_persistently_and P Q : (P Q) P Q. Lemma intuitionistically_and P Q : (P Q) P Q.
Proof. by rewrite persistently_and affinely_and. Qed. Proof. by rewrite /bi_intuitionistically persistently_and affinely_and. Qed.
Lemma affinely_persistently_or P Q : (P Q) P Q. Lemma intuitionistically_or P Q : (P Q) P Q.
Proof. by rewrite persistently_or affinely_or. Qed. Proof. by rewrite /bi_intuitionistically persistently_or affinely_or. Qed.
Lemma affinely_persistently_exist {A} (Φ : A PROP) : ( x, Φ x) x, Φ x. Lemma intuitionistically_exist {A} (Φ : A PROP) : ( x, Φ x) x, Φ x.
Proof. by rewrite persistently_exist affinely_exist. Qed. Proof. by rewrite /bi_intuitionistically persistently_exist affinely_exist. Qed.
Lemma affinely_persistently_sep_2 P Q : P Q (P Q). Lemma intuitionistically_sep_2 P Q : P Q (P Q).
Proof. by rewrite affinely_sep_2 persistently_sep_2. Qed. Proof. by rewrite /bi_intuitionistically affinely_sep_2 persistently_sep_2. Qed.
Lemma affinely_persistently_sep `{BiPositive PROP} P Q : (P Q) P Q. Lemma intuitionistically_sep `{BiPositive PROP} P Q : (P Q) P Q.
Proof. by rewrite -affinely_sep -persistently_sep. Qed. Proof. by rewrite /bi_intuitionistically -affinely_sep -persistently_sep. Qed.
Lemma affinely_persistently_idemp P : P P. Lemma intuitionistically_idemp P : P P.
Proof. by rewrite persistently_affinely persistently_idemp. Qed. Proof. by rewrite /bi_intuitionistically persistently_affinely persistently_idemp. Qed.
Lemma persistently_and_affinely_sep_l P Q : <pers> P Q P Q. Lemma intuitionistically_persistently_1 P : P <pers> P.
Proof. rewrite /bi_intuitionistically affinely_elim //. Qed.
Lemma intuitionistically_persistently_persistently P : <pers> P P.
Proof. rewrite /bi_intuitionistically persistently_idemp //. Qed.
Lemma intuitionistically_affinely P : P <affine> P.
Proof. Proof.
apply (anti_symm _). rewrite /bi_intuitionistically /bi_affinely. apply and_intro.
- rewrite and_elim_l //.
- apply persistently_and_emp_elim.
Qed.
Lemma intuitionistically_affinely_affinely P : <affine> P P.
Proof. rewrite /bi_intuitionistically persistently_affinely //. Qed.
Lemma persistently_and_intuitionistically_sep_l P Q : <pers> P Q P Q.
Proof.
rewrite /bi_intuitionistically. apply (anti_symm _).
- by rewrite /bi_affinely -(comm bi_and (<pers> P)%I) - by rewrite /bi_affinely -(comm bi_and (<pers> P)%I)
-persistently_and_sep_assoc left_id. -persistently_and_sep_assoc left_id.
- apply and_intro. - apply and_intro.
+ by rewrite affinely_elim persistently_absorbing. + by rewrite affinely_elim persistently_absorbing.
+ by rewrite affinely_elim_emp left_id. + by rewrite affinely_elim_emp left_id.
Qed. Qed.
Lemma persistently_and_affinely_sep_r P Q : P <pers> Q P Q. Lemma persistently_and_intuitionistically_sep_r P Q : P <pers> Q P Q.
Proof. by rewrite !(comm _ P) persistently_and_affinely_sep_l. Qed. Proof. by rewrite !(comm _ P) persistently_and_intuitionistically_sep_l. Qed.
Lemma and_sep_affinely_persistently P Q : P Q P Q. Lemma and_sep_intuitionistically P Q : P Q P Q.
Proof. Proof.
by rewrite -persistently_and_affinely_sep_l -affinely_and affinely_and_r. by rewrite -persistently_and_intuitionistically_sep_l -affinely_and affinely_and_r.
Qed. Qed.
Lemma affinely_persistently_sep_dup P : P P P. Lemma intuitionistically_sep_dup P : P P P.
Proof. Proof.
by rewrite -persistently_and_affinely_sep_l affinely_and_r idemp. by rewrite -persistently_and_intuitionistically_sep_l affinely_and_r idemp.
Qed. Qed.
Lemma impl_wand_affinely_persistently P Q : (<pers> P Q) ( P - Q). Lemma impl_wand_intuitionistically P Q : (<pers> P Q) ( P - Q).
Proof. Proof.
apply (anti_symm ()). apply (anti_symm ()).
- apply wand_intro_l. by rewrite -persistently_and_affinely_sep_l impl_elim_r. - apply wand_intro_l. by rewrite -persistently_and_intuitionistically_sep_l impl_elim_r.
- apply impl_intro_l. by rewrite persistently_and_affinely_sep_l wand_elim_r. - apply impl_intro_l. by rewrite persistently_and_intuitionistically_sep_l wand_elim_r.
Qed. Qed.
Lemma affinely_persistently_alt_fixpoint P : Lemma intuitionistically_alt_fixpoint P :
P emp (P P). P emp (P P).
Proof. Proof.
apply (anti_symm ()). apply (anti_symm ()).
- apply and_intro; first exact: affinely_elim_emp. - apply and_intro; first exact: affinely_elim_emp.
rewrite {1}affinely_persistently_sep_dup. apply sep_mono; last done. rewrite {1}intuitionistically_sep_dup. apply sep_mono; last done.
apply affinely_persistently_elim. apply intuitionistically_elim.
- apply and_mono; first done. rewrite {2}persistently_alt_fixpoint. - apply and_mono; first done. rewrite /bi_intuitionistically {2}persistently_alt_fixpoint.
apply sep_mono; first done. apply and_elim_r. apply sep_mono; first done. apply and_elim_r.
Qed. Qed.
Section bi_affine_intuitionistically.
Context `{BiAffine PROP}.
Lemma intuitionistically_persistently P : P <pers> P.
Proof. rewrite /bi_intuitionistically affine_affinely //. Qed.
End bi_affine_intuitionistically.
(* Conditional affinely modality *) (* Conditional affinely modality *)
Global Instance affinely_if_ne p : NonExpansive (@bi_affinely_if PROP p). Global Instance affinely_if_ne p : NonExpansive (@bi_affinely_if PROP p).
Proof. solve_proper. Qed. Proof. solve_proper. Qed.
...@@ -1067,37 +1109,49 @@ Proof. destruct p; simpl; auto using persistently_sep. Qed. ...@@ -1067,37 +1109,49 @@ Proof. destruct p; simpl; auto using persistently_sep. Qed.
Lemma persistently_if_idemp p P : <pers>?p <pers>?p P <pers>?p P. Lemma persistently_if_idemp p P : <pers>?p <pers>?p P <pers>?p P.
Proof. destruct p; simpl; auto using persistently_idemp. Qed. Proof. destruct p; simpl; auto using persistently_idemp. Qed.
(* Conditional affinely persistently *) (* Conditional intuitionistically *)
Lemma affinely_persistently_if_mono p P Q : (P Q) ?p P ?p Q. Global Instance intuitionistically_if_ne p : NonExpansive (@bi_intuitionistically_if PROP p).
Proof. solve_proper. Qed.
Global Instance intuitionistically_if_proper p :
Proper (() ==> ()) (@bi_intuitionistically_if PROP p).
Proof. solve_proper. Qed.
Global Instance intuitionistically_if_mono' p :
Proper (() ==> ()) (@bi_intuitionistically_if PROP p).
Proof. solve_proper. Qed.
Global Instance intuitionistically_if_flip_mono' p :
Proper (flip () ==> flip ()) (@bi_intuitionistically_if PROP p).
Proof. solve_proper. Qed.
Lemma intuitionistically_if_mono p P Q : (P Q) ?p P ?p Q.
Proof. by intros ->. Qed. Proof. by intros ->. Qed.
Lemma affinely_persistently_if_flag_mono (p q : bool) P : Lemma intuitionistically_if_flag_mono (p q : bool) P :
(q p) ?p P ?q P. (q p) ?p P ?q P.
Proof. destruct p, q; naive_solver auto using affinely_persistently_elim. Qed. Proof. destruct p, q; naive_solver auto using intuitionistically_elim. Qed.
Lemma affinely_persistently_if_elim p P : ?p P P. Lemma intuitionistically_if_elim p P : ?p P P.
Proof. destruct p; simpl; auto using affinely_persistently_elim. Qed. Proof. destruct p; simpl; auto using intuitionistically_elim. Qed.
Lemma affinely_persistently_affinely_persistently_if p P : P ?p P. Lemma intuitionistically_intuitionistically_if p P : P ?p P.
Proof. destruct p; simpl; auto using affinely_persistently_elim. Qed. Proof. destruct p; simpl; auto using intuitionistically_elim. Qed.
Lemma affinely_persistently_if_intro' p P Q : (?p P Q) ?p P ?p Q. Lemma intuitionistically_if_intro' p P Q : (?p P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using affinely_persistently_intro'. Qed. Proof. destruct p; simpl; auto using intuitionistically_intro'. Qed.
Lemma affinely_persistently_if_emp p : ?p emp emp. Lemma intuitionistically_if_emp p : ?p emp emp.
Proof. destruct p; simpl; auto using affinely_persistently_emp. Qed. Proof. destruct p; simpl; auto using intuitionistically_emp. Qed.
Lemma affinely_persistently_if_and p P Q : ?p (P Q) ?p P ?p Q. Lemma intuitionistically_if_and p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using affinely_persistently_and. Qed. Proof. destruct p; simpl; auto using intuitionistically_and. Qed.
Lemma affinely_persistently_if_or p P Q : ?p (P Q) ?p P ?p Q. Lemma intuitionistically_if_or p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using affinely_persistently_or. Qed. Proof. destruct p; simpl; auto using intuitionistically_or. Qed.
Lemma affinely_persistently_if_exist {A} p (Ψ : A PROP) : Lemma intuitionistically_if_exist {A} p (Ψ : A PROP) :
(?p a, Ψ a) a, ?p Ψ a. (?p a, Ψ a) a, ?p Ψ a.
Proof. destruct p; simpl; auto using affinely_persistently_exist. Qed. Proof. destruct p; simpl; auto using intuitionistically_exist. Qed.
Lemma affinely_persistently_if_sep_2 p P Q : ?p P ?p Q ?p (P Q). Lemma intuitionistically_if_sep_2 p P Q : ?p P ?p Q ?p (P Q).
Proof. destruct p; simpl; auto using affinely_persistently_sep_2. Qed. Proof. destruct p; simpl; auto using intuitionistically_sep_2. Qed.
Lemma affinely_persistently_if_sep `{BiPositive PROP} p P Q : Lemma intuitionistically_if_sep `{BiPositive PROP} p P Q :
?p (P Q) ?p P ?p Q. ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using affinely_persistently_sep. Qed. Proof. destruct p; simpl; auto using intuitionistically_sep. Qed.
Lemma affinely_persistently_if_idemp p P : ?p ?p P ?p P. Lemma intuitionistically_if_idemp p P : ?p ?p P ?p P.
Proof. destruct p; simpl; auto using affinely_persistently_idemp. Qed. Proof. destruct p; simpl; auto using intuitionistically_idemp. Qed.
(* Properties of persistent propositions *) (* Properties of persistent propositions *)
Global Instance Persistent_proper : Proper (() ==> iff) (@Persistent PROP). Global Instance Persistent_proper : Proper (() ==> iff) (@Persistent PROP).
...@@ -1114,18 +1168,18 @@ Lemma persistently_intro P Q `{!Persistent P} : (P ⊢ Q) → P ⊢ <pers> Q. ...@@ -1114,18 +1168,18 @@ Lemma persistently_intro P Q `{!Persistent P} : (P ⊢ Q) → P ⊢ <pers> Q.
Proof. intros HP. by rewrite (persistent P) HP. Qed. Proof. intros HP. by rewrite (persistent P) HP. Qed.
Lemma persistent_and_affinely_sep_l_1 P Q `{!Persistent P} : P Q <affine> P Q. Lemma persistent_and_affinely_sep_l_1 P Q `{!Persistent P} : P Q <affine> P Q.
Proof. Proof.
rewrite {1}(persistent_persistently_2 P) persistently_and_affinely_sep_l. rewrite {1}(persistent_persistently_2 P) persistently_and_intuitionistically_sep_l.
by rewrite -affinely_idemp affinely_persistently_elim. rewrite intuitionistically_affinely //.
Qed. Qed.
Lemma persistent_and_affinely_sep_r_1 P Q `{!Persistent Q} : P Q P <affine> Q. Lemma persistent_and_affinely_sep_r_1 P Q `{!Persistent Q} : P Q P <affine> Q.
Proof. by rewrite !(comm _ P) persistent_and_affinely_sep_l_1. Qed. Proof. by rewrite !(comm _ P) persistent_and_affinely_sep_l_1. Qed.
Lemma persistent_and_affinely_sep_l P Q `{!Persistent P, !Absorbing P} : Lemma persistent_and_affinely_sep_l P Q `{!Persistent P, !Absorbing P} :
P Q <affine> P Q. P Q <affine> P Q.
Proof. by rewrite -(persistent_persistently P) persistently_and_affinely_sep_l. Qed. Proof. by rewrite -(persistent_persistently P) persistently_and_intuitionistically_sep_l. Qed.
Lemma persistent_and_affinely_sep_r P Q `{!Persistent Q, !Absorbing Q} : Lemma persistent_and_affinely_sep_r P Q `{!Persistent Q, !Absorbing Q} :
P Q P <affine> Q. P Q P <affine> Q.
Proof. by rewrite -(persistent_persistently Q) persistently_and_affinely_sep_r. Qed. Proof. by rewrite -(persistent_persistently Q) persistently_and_intuitionistically_sep_r. Qed.
Lemma persistent_and_sep_1 P Q `{HPQ : !TCOr (Persistent P) (Persistent Q)} : Lemma persistent_and_sep_1 P Q `{HPQ : !TCOr (Persistent P) (Persistent Q)} :
P Q P Q. P Q P Q.
...@@ -1143,24 +1197,24 @@ Proof. intros. rewrite -persistent_and_sep_1; auto. Qed. ...@@ -1143,24 +1197,24 @@ Proof. intros. rewrite -persistent_and_sep_1; auto. Qed.
Lemma persistent_entails_r P Q `{!Persistent Q} : (P Q) P P Q. Lemma persistent_entails_r P Q `{!Persistent Q} : (P Q) P P Q.
Proof. intros. rewrite -persistent_and_sep_1; auto. Qed. Proof. intros. rewrite -persistent_and_sep_1; auto. Qed.
Lemma absorbingly_affinely_persistently P : <absorb> P <pers> P. Lemma absorbingly_intuitionistically P : <absorb> P <pers> P.
Proof. Proof.
apply (anti_symm _). apply (anti_symm _).
- by rewrite affinely_elim absorbingly_persistently. - by rewrite intuitionistically_persistently_1 absorbingly_persistently.
- rewrite -{1}(idemp bi_and (<pers> _)%I) persistently_and_affinely_sep_r. - rewrite -{1}(idemp bi_and (<pers> _)%I) persistently_and_intuitionistically_sep_r.
by rewrite {1} (True_intro (<pers> _)%I). by rewrite {1} (True_intro (<pers> _)%I).
Qed. Qed.
Lemma persistent_absorbingly_affinely_2 P `{!Persistent P} : Lemma persistent_absorbingly_affinely_2 P `{!Persistent P} :
P <absorb> <affine> P. P <absorb> <affine> P.
Proof. Proof.
rewrite {1}(persistent P) -absorbingly_affinely_persistently. rewrite {1}(persistent P) -absorbingly_intuitionistically.
by rewrite -{1}affinely_idemp affinely_persistently_elim. by rewrite intuitionistically_affinely.
Qed. Qed.
Lemma persistent_absorbingly_affinely P `{!Persistent P, !Absorbing P} : Lemma persistent_absorbingly_affinely P `{!Persistent P, !Absorbing P} :
<absorb> <affine> P P. <absorb> <affine> P P.
Proof. Proof.
by rewrite -(persistent_persistently P) absorbingly_affinely_persistently. by rewrite -(persistent_persistently P) absorbingly_intuitionistically.
Qed. Qed.
Lemma persistent_and_sep_assoc P `{!Persistent P, !Absorbing P} Q R : Lemma persistent_and_sep_assoc P `{!Persistent P, !Absorbing P} Q R :
...@@ -1205,6 +1259,8 @@ Global Instance sep_affine P Q : Affine P → Affine Q → Affine (P ∗ Q). ...@@ -1205,6 +1259,8 @@ Global Instance sep_affine P Q : Affine P → Affine Q → Affine (P ∗ Q).
Proof. rewrite /Affine=>-> ->. by rewrite left_id. Qed. Proof. rewrite /Affine=>-> ->. by rewrite left_id. Qed.
Global Instance affinely_affine P : Affine (<affine> P). Global Instance affinely_affine P : Affine (<affine> P).
Proof. rewrite /bi_affinely. apply _. Qed. Proof. rewrite /bi_affinely. apply _. Qed.
Global Instance intuitionistically_affine P : Affine ( P).
Proof. rewrite /bi_intuitionistically. apply _. Qed.
(* Absorbing instances *) (* Absorbing instances *)
Global Instance pure_absorbing φ : Absorbing (⌜φ⌝%I : PROP). Global Instance pure_absorbing φ : Absorbing (⌜φ⌝%I : PROP).
...@@ -1282,6 +1338,8 @@ Global Instance persistently_persistent P : Persistent (<pers> P). ...@@ -1282,6 +1338,8 @@ Global Instance persistently_persistent P : Persistent (<pers> P).
Proof. by rewrite /Persistent persistently_idemp. Qed. Proof. by rewrite /Persistent persistently_idemp. Qed.
Global Instance affinely_persistent P : Persistent P Persistent (<affine> P). Global Instance affinely_persistent P : Persistent P Persistent (<affine> P).
Proof. rewrite /bi_affinely. apply _. Qed. Proof. rewrite /bi_affinely. apply _. Qed.