Commit f2eaf912 authored by Robbert Krebbers's avatar Robbert Krebbers Committed by Jacques-Henri Jourdan

Drop positivity axiom of the BI canonical structure.

The absence of this axiom has two consequences:

- We no longer have `■ (P ∗ Q) ⊢ ■ P ∗ ■ Q` and `□ (P ∗ Q) ⊢ □ P ∗ □ Q`,
  and as a result, separating conjunctions in the unrestricted/persistent
  context cannot be eliminated.
- When having `(P -∗ ⬕ Q) ∗ P`, we do not get `⬕ Q ∗ P`. In the proof
  mode this means when having:

    H1 : P -∗ ⬕ Q
    H2 : P

  We cannot say `iDestruct ("H1" with "H2") as "#H1"` and keep `H2`.

However, there is now a type class `PositiveBI PROP`, and when there is an
instance of this type class, one gets the above reasoning principle back.

TODO: Can we describe positivity of individual propositions instead of the
whole BI? That way, we would get the above reasoning principles even when
the BI is not positive, but the propositions involved are.
parent 96501a4f
......@@ -185,8 +185,8 @@ Section proofmode_classes.
Context `{inG Σ A}.
Implicit Types a b : A.
Global Instance into_sep_own p γ a b1 b2 :
IsOp a b1 b2 IntoSep p (own γ a) (own γ b1) (own γ b2).
Global Instance into_sep_own γ a b1 b2 :
IsOp a b1 b2 IntoSep (own γ a) (own γ b1) (own γ b2).
Proof. intros. by rewrite /IntoSep (is_op a) own_op. Qed.
Global Instance into_and_own p γ a b1 b2 :
IsOp a b1 b2 IntoAnd p (own γ a) (own γ b1) (own γ b2).
......
......@@ -88,8 +88,8 @@ Proof.
intros. apply bare_persistently_if_mono. by rewrite (is_op a) ownM_op sep_and.
Qed.
Global Instance into_sep_ownM p (a b1 b2 : M) :
IsOp a b1 b2 IntoSep p (uPred_ownM a) (uPred_ownM b1) (uPred_ownM b2).
Global Instance into_sep_ownM (a b1 b2 : M) :
IsOp a b1 b2 IntoSep (uPred_ownM a) (uPred_ownM b1) (uPred_ownM b2).
Proof. intros. by rewrite /IntoSep (is_op a) ownM_op. Qed.
Global Instance from_sep_bupd P Q1 Q2 :
......
......@@ -438,9 +438,6 @@ Proof.
- (* (P ⊢ Q -∗ R) → P ∗ Q ⊢ R *)
intros P Q R. unseal=> HPQR. split; intros n x ? (?&?&?&?&?). ofe_subst.
eapply HPQR; eauto using cmra_validN_op_l.
- (* emp ∧ (Q ∗ R) ⊢ (emp ∧ Q) ∗ R (ADMISSIBLE) *)
intros Q R. unfold uPred_emp; unseal; split; intros n x ? [_ (x1&x2&?&?&?)].
exists x1, x2; simpl; auto.
- (* (P ⊢ Q) → □ P ⊢ □ Q *)
intros P QR HP. unseal; split=> n x ? /=. by apply HP, cmra_core_validN.
- (* □ P ⊢ □ □ P *)
......
......@@ -34,6 +34,9 @@ Hint Mode Affine + ! : typeclass_instances.
Class AffineBI (PROP : bi) := absorbing_bi (Q : PROP) : Affine Q.
Existing Instance absorbing_bi | 0.
Class PositiveBI (PROP : bi) :=
positive_bi (P Q : PROP) : (P Q) P Q.
Class Absorbing {PROP : bi} (P : PROP) := absorbing Q : P Q P.
Arguments Absorbing {_} _%I : simpl never.
Arguments absorbing {_} _%I _%I.
......@@ -705,28 +708,22 @@ Proof.
rewrite /bi_bare -(comm _ P) (assoc _ (_ _)%I) -!(assoc _ P).
by rewrite idemp !assoc (comm _ P).
Qed.
Lemma bare_sep P Q : (P Q) P Q.
Lemma bare_sep_2 P Q : P Q (P Q).
Proof.
rewrite /bi_bare. apply (anti_symm _).
- rewrite -{1}(idemp bi_and emp%I) -assoc emp_and_sep_assoc_1.
by rewrite (comm bi_sep) emp_and_sep_assoc_1 comm.
- apply and_intro.
+ by rewrite !and_elim_l right_id.
+ by rewrite !and_elim_r.
rewrite /bi_bare. apply and_intro.
- by rewrite !and_elim_l right_id.
- by rewrite !and_elim_r.
Qed.
Lemma bare_sep `{PositiveBI PROP} P Q : (P Q) P Q.
Proof.
apply (anti_symm _), bare_sep_2.
by rewrite -{1}bare_idemp positive_bi !(comm _ ( P)%I) positive_bi.
Qed.
Lemma bare_forall {A} (Φ : A PROP) : ( a, Φ a) a, Φ a.
Proof. apply forall_intro=> a. by rewrite (forall_elim a). Qed.
Lemma bare_exist {A} (Φ : A PROP) : ( a, Φ a) a, Φ a.
Proof. by rewrite /bi_bare and_exist_l. Qed.
Lemma bare_sep_l P Q : (P Q) P.
Proof.
rewrite /bi_bare. apply and_intro; auto.
by rewrite (comm _ P) emp_and_sep_assoc_1 {1}and_elim_l left_id.
Qed.
Lemma bare_sep_r P Q : (P Q) Q.
Proof. by rewrite (comm _ P) bare_sep_l. Qed.
Lemma bare_True_emp : True emp.
Proof. apply (anti_symm _); rewrite /bi_bare; auto. Qed.
......@@ -838,8 +835,10 @@ Proof. apply (anti_symm _); auto using sep_True_2. Qed.
Section affine_bi.
Context `{AffineBI PROP}.
Global Instance affine_bi P : Absorbing P | 0.
Global Instance affine_bi_absorbing P : Absorbing P | 0.
Proof. intros Q. by rewrite (affine Q) right_id. Qed.
Global Instance affine_bi_positive : PositiveBI PROP.
Proof. intros P Q. by rewrite !affine_bare. Qed.
Lemma True_emp : True emp.
Proof. apply (anti_symm _); auto using affine. Qed.
......@@ -876,19 +875,23 @@ Proof. intros P Q; apply persistently_mono. Qed.
Global Instance persistently_absorbing P : Absorbing ( P).
Proof. rewrite /Absorbing=> R. apply persistently_absorbing. Qed.
Lemma persistently_and_sep_assoc_1 P Q R : P (Q R) ( P Q) R.
Lemma persistently_and_sep_assoc P Q R : P (Q R) ( P Q) R.
Proof.
rewrite {1}persistently_idemp_2 persistently_and_sep_elim assoc.
apply sep_mono_l, and_intro.
- by rewrite and_elim_r absorbing.
- by rewrite and_elim_l left_id.
apply (anti_symm ()).
- rewrite {1}persistently_idemp_2 persistently_and_sep_elim assoc.
apply sep_mono_l, and_intro.
+ by rewrite and_elim_r absorbing.
+ by rewrite and_elim_l left_id.
- apply and_intro.
+ by rewrite and_elim_l sep_elim_l.
+ by rewrite and_elim_r.
Qed.
Lemma persistently_and_emp_elim P : emp P P.
Proof. by rewrite comm persistently_and_sep_elim right_id and_elim_r. Qed.
Lemma persistently_elim_True P : P P True.
Proof.
rewrite -(right_id True%I _ ( _)%I) -{1}(left_id emp%I _ True%I).
by rewrite persistently_and_sep_assoc_1 (comm bi_and) persistently_and_emp_elim.
by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim.
Qed.
Lemma persistently_elim P `{!Absorbing P} : P P.
Proof. by rewrite persistently_elim_True sep_elim_l. Qed.
......@@ -939,24 +942,9 @@ Lemma persistently_sep_dup P : □ P ⊣⊢ □ P ∗ □ P.
Proof.
apply (anti_symm _); last by eauto using sep_elim_l with typeclass_instances.
rewrite -{1}(idemp bi_and ( _)%I) -{2}(left_id emp%I _ ( _)%I).
by rewrite persistently_and_sep_assoc_1 and_elim_l.
by rewrite persistently_and_sep_assoc and_elim_l.
Qed.
Lemma persistently_and_sep_assoc P Q R : P (Q R) ( P Q) R.
Proof.
apply (anti_symm ()); auto using persistently_and_sep_assoc_1.
apply and_intro.
- by rewrite and_elim_l sep_elim_l.
- by rewrite and_elim_r.
Qed.
Lemma persistently_sep_elim_l P Q : (P Q) P.
Proof.
rewrite -(left_id True%I bi_and ( _)%I) (persistently_emp_intro True%I).
by rewrite -persistently_and (comm bi_sep) emp_and_sep_assoc_1 and_elim_l left_id.
Qed.
Lemma persistently_sep_elim_r P Q : (P Q) Q.
Proof. by rewrite comm persistently_sep_elim_l. Qed.
Lemma persistently_and_sep_l_1 P Q : P Q P Q.
Proof.
by rewrite -{1}(left_id emp%I _ Q%I) persistently_and_sep_assoc and_elim_l.
......@@ -966,12 +954,17 @@ Proof. by rewrite !(comm _ P) persistently_and_sep_l_1. Qed.
Lemma persistently_True_emp : True emp.
Proof. apply (anti_symm _); auto using persistently_emp_intro. Qed.
Lemma persistently_and_sep P Q : (P Q) (P Q).
Lemma persistently_and_sep P Q : (P Q) (P Q).
Proof.
rewrite persistently_and. apply (anti_symm ()).
- rewrite -{1}persistently_idemp -persistently_and -{1}(left_id emp%I _ Q%I).
by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim.
- auto using persistently_sep_elim_l, persistently_sep_elim_r.
rewrite persistently_and.
rewrite -{1}persistently_idemp -persistently_and -{1}(left_id emp%I _ Q%I).
by rewrite persistently_and_sep_assoc (comm bi_and) persistently_and_emp_elim.
Qed.
Lemma persistently_bare P : P P.
Proof.
by rewrite /bi_bare persistently_and -persistently_True_emp
persistently_pure left_id.
Qed.
Lemma and_sep_persistently P Q : P Q P Q.
......@@ -980,11 +973,17 @@ Proof.
- auto using persistently_and_sep_l_1.
- eauto 10 using sep_elim_l, sep_elim_r with typeclass_instances.
Qed.
Lemma persistently_sep P Q : (P Q) P Q.
Lemma persistently_sep_2 P Q : P Q (P Q).
Proof. by rewrite -persistently_and_sep persistently_and -and_sep_persistently. Qed.
Lemma persistently_sep `{PositiveBI PROP} P Q : (P Q) P Q.
Proof.
apply (anti_symm _); auto using persistently_sep_2.
by rewrite -persistently_bare bare_sep sep_and !bare_elim persistently_and
and_sep_persistently.
Qed.
Lemma persistently_wand P Q : (P - Q) P - Q.
Proof. by apply wand_intro_r; rewrite -persistently_sep wand_elim_l. Qed.
Proof. apply wand_intro_r. by rewrite persistently_sep_2 wand_elim_l. Qed.
Lemma persistently_entails_l P Q : (P Q) P Q P.
Proof. intros; rewrite -persistently_and_sep_l_1; auto. Qed.
......@@ -1023,53 +1022,48 @@ Section persistently_bare_bi.
Proof.
apply (anti_symm ()).
- rewrite -(right_id True%I bi_sep (P - Q)%I) -(exist_intro (P - Q)%I).
apply sep_mono_r. rewrite -persistently_pure. apply persistently_intro', impl_intro_l.
apply sep_mono_r. rewrite -persistently_pure.
apply persistently_intro', impl_intro_l.
by rewrite wand_elim_r persistently_pure right_id.
- apply exist_elim=> R. apply wand_intro_l. rewrite assoc -persistently_and_sep_r.
- apply exist_elim=> R. apply wand_intro_l.
rewrite assoc -persistently_and_sep_r.
by rewrite persistently_elim impl_elim_r.
Qed.
Lemma impl_alt P Q : (P Q) R, R (P R - Q).
Proof.
apply (anti_symm ()).
- rewrite -(right_id True%I bi_and (P Q)%I) -(exist_intro (P Q)%I).
apply and_mono_r. rewrite -persistently_pure. apply persistently_intro', wand_intro_l.
apply and_mono_r. rewrite -persistently_pure.
apply persistently_intro', wand_intro_l.
by rewrite impl_elim_r persistently_pure right_id.
- apply exist_elim=> R. apply impl_intro_l. rewrite assoc persistently_and_sep_r.
by rewrite persistently_elim wand_elim_r.
Qed.
End persistently_bare_bi.
(* The combined bare persistently modality *)
Lemma persistently_bare P : P P.
Proof.
by rewrite /bi_bare persistently_and -persistently_True_emp
persistently_pure left_id.
Qed.
(* The combined bare persistently modality *)
Lemma bare_persistently_elim P : P P.
Proof. apply persistently_and_emp_elim. Qed.
Lemma bare_persistently_intro' P Q : ( P Q) P Q.
Proof. intros <-. by rewrite persistently_bare persistently_idemp. Qed.
Lemma bare_persistently_emp : emp emp.
Proof.
by rewrite -persistently_True_emp persistently_pure bare_True_emp bare_emp.
Qed.
Proof. by rewrite -persistently_True_emp persistently_pure bare_True_emp bare_emp. Qed.
Lemma bare_persistently_and P Q : (P Q) P Q.
Proof. by rewrite persistently_and bare_and. Qed.
Lemma bare_persistently_or P Q : (P Q) P Q.
Proof. by rewrite persistently_or bare_or. Qed.
Lemma bare_persistently_exist {A} (Φ : A PROP) : ( x, Φ x) x, Φ x.
Proof. by rewrite persistently_exist bare_exist. Qed.
Lemma bare_persistently_sep P Q : (P Q) P Q.
Proof. by rewrite persistently_sep bare_sep. Qed.
Lemma bare_persistently_sep_2 P Q : P Q (P Q).
Proof. by rewrite bare_sep_2 persistently_sep_2. Qed.
Lemma bare_persistently_sep `{PositiveBI PROP} P Q : (P Q) P Q.
Proof. by rewrite -bare_sep -persistently_sep. Qed.
Lemma bare_persistently_idemp P : P P.
Proof. by rewrite persistently_bare persistently_idemp. Qed.
Lemma bare_persistently_sep_dup P : P P P.
Proof. by rewrite {1}persistently_sep_dup bare_sep. Qed.
Lemma persistently_and_bare_sep_l P Q : P Q P Q.
Proof.
apply (anti_symm _).
......@@ -1078,6 +1072,11 @@ Proof.
Qed.
Lemma persistently_and_bare_sep_r P Q : P Q P Q.
Proof. by rewrite !(comm _ P) persistently_and_bare_sep_l. Qed.
Lemma and_sep_bare_persistently P Q : P Q P Q.
Proof. by rewrite -persistently_and_bare_sep_l -bare_and bare_and_l. Qed.
Lemma bare_persistently_sep_dup P : P P P.
Proof. by rewrite -persistently_and_bare_sep_l bare_and_l bare_and idemp. Qed.
(* Conditional bare modality *)
Global Instance bare_if_ne p : NonExpansive (@bi_bare_if PROP p).
......@@ -1108,7 +1107,9 @@ Lemma bare_if_or p P Q : ■?p (P ∨ Q) ⊣⊢ ■?p P ∨ ■?p Q.
Proof. destruct p; simpl; auto using bare_or. Qed.
Lemma bare_if_exist {A} p (Ψ : A PROP) : (?p a, Ψ a) a, ?p Ψ a.
Proof. destruct p; simpl; auto using bare_exist. Qed.
Lemma bare_if_sep p P Q : ?p (P Q) ?p P ?p Q.
Lemma bare_if_sep_2 p P Q : ?p P ?p Q ?p (P Q).
Proof. destruct p; simpl; auto using bare_sep_2. Qed.
Lemma bare_if_sep `{PositiveBI PROP} p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using bare_sep. Qed.
Lemma bare_if_idemp p P : ?p ?p P ?p P.
......@@ -1138,7 +1139,9 @@ Lemma persistently_if_or p P Q : □?p (P ∨ Q) ⊣⊢ □?p P ∨ □?p Q.
Proof. destruct p; simpl; auto using persistently_or. Qed.
Lemma persistently_if_exist {A} p (Ψ : A PROP) : (?p a, Ψ a) a, ?p Ψ a.
Proof. destruct p; simpl; auto using persistently_exist. Qed.
Lemma persistently_if_sep p P Q : ?p (P Q) ?p P ?p Q.
Lemma persistently_if_sep_2 p P Q : ?p P ?p Q ?p (P Q).
Proof. destruct p; simpl; auto using persistently_sep_2. Qed.
Lemma persistently_if_sep `{PositiveBI PROP} p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using persistently_sep. Qed.
Lemma persistently_if_idemp p P : ?p ?p P ?p P.
......@@ -1161,10 +1164,11 @@ Lemma bare_persistently_if_and p P Q : ⬕?p (P ∧ Q) ⊣⊢ ⬕?p P ∧ ⬕?p
Proof. destruct p; simpl; auto using bare_persistently_and. Qed.
Lemma bare_persistently_if_or p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using bare_persistently_or. Qed.
Lemma bare_persistently_if_exist {A} p (Ψ : A PROP) :
(?p a, Ψ a) a, ?p Ψ a.
Lemma bare_persistently_if_exist {A} p (Ψ : A PROP) : (?p a, Ψ a) a, ?p Ψ a.
Proof. destruct p; simpl; auto using bare_persistently_exist. Qed.
Lemma bare_persistently_if_sep p P Q : ?p (P Q) ?p P ?p Q.
Lemma bare_persistently_if_sep_2 p P Q : ?p P ?p Q ?p (P Q).
Proof. destruct p; simpl; auto using bare_persistently_sep_2. Qed.
Lemma bare_persistently_if_sep `{PositiveBI PROP} p P Q : ?p (P Q) ?p P ?p Q.
Proof. destruct p; simpl; auto using bare_persistently_sep. Qed.
Lemma bare_persistently_if_idemp p P : ?p ?p P ?p P.
......@@ -1211,7 +1215,7 @@ Proof. intros. rewrite pure_wand_forall. apply _. Qed.
Global Instance sep_persistent P Q :
Persistent P Persistent Q Persistent (P Q).
Proof. intros. by rewrite /Persistent persistently_sep -!persistent. Qed.
Proof. intros. by rewrite /Persistent -persistently_sep_2 -!persistent. Qed.
Global Instance from_option_persistent {A} P (Ψ : A PROP) (mx : option A) :
( x, Persistent (Ψ x)) Persistent P Persistent (from_option Ψ P mx).
......@@ -1294,7 +1298,7 @@ Global Instance bi_persistently_or_homomorphism :
MonoidHomomorphism bi_or bi_or () (@bi_persistently PROP).
Proof. split; [split|]; try apply _. apply persistently_or. apply persistently_pure. Qed.
Global Instance bi_persistently_sep_weak_homomorphism :
Global Instance bi_persistently_sep_weak_homomorphism `{PositiveBI PROP} :
WeakMonoidHomomorphism bi_sep bi_sep () (@bi_persistently PROP).
Proof. split; try apply _. apply persistently_sep. Qed.
......@@ -1304,7 +1308,7 @@ Proof. split. apply _. apply persistently_emp. Qed.
Global Instance bi_persistently_sep_entails_weak_homomorphism :
WeakMonoidHomomorphism bi_sep bi_sep (flip ()) (@bi_persistently PROP).
Proof. split; try apply _. intros P Q; by rewrite persistently_sep. Qed.
Proof. split; try apply _. intros P Q; by rewrite persistently_sep_2. Qed.
Global Instance bi_persistently_sep_entails_homomorphism :
MonoidHomomorphism bi_sep bi_sep (flip ()) (@bi_persistently PROP).
......@@ -1421,7 +1425,10 @@ Lemma bare_persistently_if_later p P : ⬕?p ▷ P ⊢ ▷ ⬕?p P.
Proof. destruct p; simpl; auto using bare_persistently_later. Qed.
Global Instance later_persistent P : Persistent P Persistent ( P).
Proof. intros. by rewrite /Persistent {1}(persistent_persistently_2 P) later_persistently. Qed.
Proof.
intros. by rewrite /Persistent {1}(persistent_persistently_2 P)
later_persistently.
Qed.
Global Instance later_absorbing P : Absorbing P Absorbing ( P).
Proof. intros ? Q. by rewrite {1}(later_intro Q) -later_sep absorbing. Qed.
......
......@@ -131,14 +131,14 @@ Section fractional.
FromSep Q P P.
Proof. rewrite /FromSep=>-[-> <-] [-> _]. by rewrite Qp_div_2. Qed.
Global Instance into_sep_fractional p P P1 P2 Φ q1 q2 :
Global Instance into_sep_fractional P P1 P2 Φ q1 q2 :
AsFractional P Φ (q1 + q2) AsFractional P1 Φ q1 AsFractional P2 Φ q2
IntoSep p P P1 P2.
IntoSep P P1 P2.
Proof. intros. rewrite /IntoSep [P]fractional_split //. Qed.
Global Instance into_sep_fractional_half p P Q Φ q :
Global Instance into_sep_fractional_half P Q Φ q :
AsFractional P Φ q AsFractional Q Φ (q/2)
IntoSep p P Q Q | 100.
IntoSep P Q Q | 100.
Proof. intros. rewrite /IntoSep [P]fractional_half //. Qed.
(* The instance [frame_fractional] can be tried at all the nodes of
......
......@@ -99,8 +99,6 @@ Section bi_mixin.
bi_mixin_wand_intro_r P Q R : (P Q R) P Q - R;
bi_mixin_wand_elim_l' P Q R : (P Q - R) P Q R;
bi_mixin_emp_and_sep_assoc_1 Q R : emp (Q R) (emp Q) R;
(* Persistently *)
bi_mixin_persistently_mono P Q : (P Q) P Q;
bi_mixin_persistently_idemp_2 P : P P;
......@@ -401,9 +399,6 @@ Proof. eapply bi_mixin_wand_intro_r, bi_bi_mixin. Qed.
Lemma wand_elim_l' P Q R : (P Q - R) P Q R.
Proof. eapply bi_mixin_wand_elim_l', bi_bi_mixin. Qed.
Lemma emp_and_sep_assoc_1 Q R : emp (Q R) (emp Q) R.
Proof. eapply bi_mixin_emp_and_sep_assoc_1, bi_bi_mixin. Qed.
(* Persistently *)
Lemma persistently_mono P Q : (P Q) P Q.
Proof. eapply bi_mixin_persistently_mono, bi_bi_mixin. Qed.
......
......@@ -185,8 +185,8 @@ Global Instance into_wand_impl_true_true P Q P' :
FromAssumption true P P' IntoWand true true (P' Q) P Q.
Proof.
rewrite /FromAssumption /IntoWand /= => <-. apply wand_intro_l.
rewrite -{1}(bare_persistently_idemp P) -bare_persistently_sep -persistently_and_sep.
by rewrite impl_elim_r bare_persistently_elim.
rewrite -{1}(bare_persistently_idemp P) -and_sep_bare_persistently.
by rewrite -bare_persistently_and impl_elim_r bare_persistently_elim.
Qed.
Global Instance into_wand_and_l p q R1 R2 P' Q' :
......@@ -266,10 +266,10 @@ Proof. by rewrite /FromSep pure_and sep_and. Qed.
Global Instance from_sep_bare P Q1 Q2 :
FromSep P Q1 Q2 FromSep ( P) ( Q1) ( Q2).
Proof. rewrite /FromSep=> <-. by rewrite bare_sep. Qed.
Proof. rewrite /FromSep=> <-. by rewrite bare_sep_2. Qed.
Global Instance from_sep_persistently P Q1 Q2 :
FromSep P Q1 Q2 FromSep ( P) ( Q1) ( Q2).
Proof. rewrite /FromSep=> <-. by rewrite persistently_sep. Qed.
Proof. rewrite /FromSep=> <-. by rewrite persistently_sep_2. Qed.
Global Instance from_sep_big_sepL_cons {A} (Φ : nat A PROP) x l :
FromSep ([ list] k y x :: l, Φ k y) (Φ 0 x) ([ list] k y l, Φ (S k) y).
......@@ -282,11 +282,8 @@ Proof. by rewrite /FromSep big_opL_app. Qed.
(* IntoAnd *)
Global Instance into_and_and p P Q : IntoAnd p (P Q) P Q.
Proof. by rewrite /IntoAnd bare_persistently_if_and. Qed.
Global Instance into_and_sep P Q : IntoAnd true (P Q) P Q.
Proof.
by rewrite /IntoAnd /= bare_persistently_sep -bare_persistently_sep
persistently_and_sep.
Qed.
Global Instance into_and_sep `{PositiveBI PROP} P Q : IntoAnd true (P Q) P Q.
Proof. by rewrite /IntoAnd /= persistently_sep -and_sep_persistently persistently_and. Qed.
Global Instance into_and_pure p φ ψ : @IntoAnd PROP p ⌜φ ψ⌝ ⌜φ⌝ ⌜ψ⌝.
Proof. by rewrite /IntoAnd pure_and bare_persistently_if_and. Qed.
......@@ -307,55 +304,44 @@ Proof.
Qed.
(* IntoSep *)
Global Instance into_sep_sep p P Q : IntoSep p (P Q) P Q.
Proof. by rewrite /IntoSep bare_persistently_if_sep. Qed.
Global Instance into_sep_and P Q : IntoSep true (P Q) P Q.
Proof. by rewrite /IntoSep /= persistently_and_sep. Qed.
Global Instance into_sep_sep P Q : IntoSep (P Q) P Q.
Proof. by rewrite /IntoSep. Qed.
Global Instance into_sep_and_persistent_l P P' Q :
Persistent P FromBare P' P IntoSep false (P Q) P' Q.
Persistent P FromBare P' P IntoSep (P Q) P' Q.
Proof.
rewrite /FromBare /IntoSep /=. intros ? <-.
by rewrite persistent_and_bare_sep_l_1.
Qed.
Global Instance into_sep_and_persistent_r P Q Q' :
Persistent Q FromBare Q' Q IntoSep false (P Q) P Q'.
Persistent Q FromBare Q' Q IntoSep (P Q) P Q'.
Proof.
rewrite /FromBare /IntoSep /=. intros ? <-.
by rewrite persistent_and_bare_sep_r_1.
Qed.
Global Instance into_sep_pure p φ ψ : @IntoSep PROP p ⌜φ ψ⌝ ⌜φ⌝ ⌜ψ⌝.
Proof.
by rewrite /IntoSep pure_and persistent_and_sep_1 bare_persistently_if_sep.
Qed.
Global Instance into_sep_bare p P Q1 Q2 :
IntoSep p P Q1 Q2 IntoSep p ( P) ( Q1) ( Q2).
Proof.
rewrite /IntoSep /=. destruct p; simpl.
- by rewrite -bare_sep !persistently_bare.
- intros ->. by rewrite bare_sep.
Qed.
Global Instance into_sep_persistently p P Q1 Q2 :
IntoSep p P Q1 Q2 IntoSep p ( P) ( Q1) ( Q2).
Proof.
rewrite /IntoSep /=. destruct p; simpl.
- by rewrite -persistently_sep !persistently_idemp.
- intros ->. by rewrite persistently_sep.
Qed.
Global Instance into_sep_pure φ ψ : @IntoSep PROP ⌜φ ψ⌝ ⌜φ⌝ ⌜ψ⌝.
Proof. by rewrite /IntoSep pure_and persistent_and_sep_1. Qed.
Global Instance into_sep_bare `{PositiveBI PROP} P Q1 Q2 :
IntoSep P Q1 Q2 IntoSep ( P) ( Q1) ( Q2).
Proof. rewrite /IntoSep /= => ->. by rewrite bare_sep. Qed.
Global Instance into_sep_persistently `{PositiveBI PROP} P Q1 Q2 :
IntoSep P Q1 Q2 IntoSep ( P) ( Q1) ( Q2).
Proof. rewrite /IntoSep /= => ->. by rewrite persistently_sep. Qed.
(* We use [IsCons] and [IsApp] to make sure that [frame_big_sepL_cons] and
[frame_big_sepL_app] cannot be applied repeatedly often when having
[ [∗ list] k ↦ x ∈ ?e, Φ k x] with [?e] an evar. *)
Global Instance into_sep_big_sepL_cons {A} p (Φ : nat A PROP) l x l' :
Global Instance into_sep_big_sepL_cons {A} (Φ : nat A PROP) l x l' :
IsCons l x l'
IntoSep p ([ list] k y l, Φ k y)
IntoSep ([ list] k y l, Φ k y)
(Φ 0 x) ([ list] k y l', Φ (S k) y).
Proof. rewrite /IsCons=>->. by rewrite /IntoSep big_sepL_cons. Qed.
Global Instance into_sep_big_sepL_app {A} p (Φ : nat A PROP) l l1 l2 :
Global Instance into_sep_big_sepL_app {A} (Φ : nat A PROP) l l1 l2 :
IsApp l l1 l2
IntoSep p ([ list] k y l, Φ k y)
IntoSep ([ list] k y l, Φ k y)
([ list] k y l1, Φ k y) ([ list] k y l2, Φ (length l1 + k) y).
Proof. rewrite /IsApp=>->. by rewrite /IntoSep big_sepL_app. Qed.
......@@ -499,7 +485,7 @@ Global Instance frame_sep_persistent_l R P1 P2 Q1 Q2 Q' :
Frame true R (P1 P2) Q' | 9.
Proof.
rewrite /Frame /MaybeFrame /MakeSep /= => <- <- <-.
rewrite {1}(persistently_sep_dup R) bare_sep. solve_sep_entails.
rewrite {1}(bare_persistently_sep_dup R). solve_sep_entails.
Qed.
Global Instance frame_sep_l R P1 P2 Q Q' :
Frame false R P1 Q MakeSep Q P2 Q' Frame false R (P1 P2) Q' | 9.
......@@ -602,7 +588,10 @@ Proof. by rewrite /MakeBare. Qed.
Global Instance frame_bare R P Q Q' :
Frame true R P Q MakeBare Q Q' Frame true R ( P) Q'.
Proof. rewrite /Frame /MakeBare=> <- <- /=. by rewrite bare_sep bare_idemp. Qed.
Proof.
rewrite /Frame /MakeBare=> <- <- /=.
by rewrite -{1}bare_idemp bare_sep_2.
Qed.
Class MakePersistently (P Q : PROP) := make_persistently : P Q.
Arguments MakePersistently _%I _%I.
......@@ -616,9 +605,9 @@ Proof. by rewrite /MakePersistently. Qed.
Global Instance frame_persistently R P Q Q' :
Frame true R P Q MakePersistently Q Q' Frame true R ( P) Q'.
Proof.
rewrite /Frame /MakePersistently=> <- <- /=.
by rewrite -persistently_and_bare_sep_l persistently_sep persistently_bare
persistently_idemp -persistently_and_sep_l_1.
rewrite /Frame /MakePersistently=> <- <- /=. rewrite -persistently_and_bare_sep_l.
by rewrite -persistently_sep_2 -persistently_and_sep_l_1 persistently_bare
persistently_idemp.
Qed.
Global Instance frame_exist {A} p R (Φ Ψ : A PROP) :
......@@ -722,24 +711,15 @@ Proof.
Qed.
(* IntoSep *)