Commit 6aac0120 authored by Robbert Krebbers's avatar Robbert Krebbers

A type class for plainly.

Based on an earlier MR by @jung.
parent e39f72fe
......@@ -28,6 +28,7 @@ theories/algebra/proofmode_classes.v
theories/bi/interface.v
theories/bi/derived_connectives.v
theories/bi/derived_laws.v
theories/bi/plainly.v
theories/bi/big_op.v
theories/bi/updates.v
theories/bi/bi.v
......
......@@ -30,11 +30,8 @@ Global Instance ownM_mono : Proper (flip (≼) ==> (⊢)) (@uPred_ownM M).
Proof. intros a b [b' ->]. by rewrite ownM_op sep_elim_l. Qed.
Lemma ownM_unit' : uPred_ownM ε True.
Proof. apply (anti_symm _); first by apply pure_intro. apply ownM_unit. Qed.
Lemma affinely_plainly_cmra_valid {A : cmraT} (a : A) : a a.
Proof.
rewrite affine_affinely.
apply (anti_symm _), plainly_cmra_valid_1. apply plainly_elim, _.
Qed.
Lemma plainly_cmra_valid {A : cmraT} (a : A) : a a.
Proof. apply (anti_symm _), plainly_cmra_valid_1. apply plainly_elim, _. Qed.
Lemma affinely_persistently_cmra_valid {A : cmraT} (a : A) : a a.
Proof.
rewrite affine_affinely. intros; apply (anti_symm _); first by rewrite persistently_elim.
......
......@@ -30,6 +30,16 @@ Proof.
iDestruct (ownE_op' with "[HE2 HEf]") as "[? $]"; first by iFrame.
iIntros "!> !>". by iApply "HP".
- rewrite uPred_fupd_eq /uPred_fupd_def. by iIntros (????) "[HwP $]".
Qed.
Instance uPred_bi_fupd `{invG Σ} : BiFUpd (uPredSI (iResUR Σ)) :=
{| bi_fupd_mixin := uPred_fupd_mixin |}.
Instance uPred_bi_bupd_fupd `{invG Σ} : BiBUpdFUpd (uPredSI (iResUR Σ)).
Proof. rewrite /BiBUpdFUpd uPred_fupd_eq. by iIntros (E P) ">? [$ $] !> !>". Qed.
Instance uPred_bi_fupd_plainly `{invG Σ} : BiFUpdPlainly (uPredSI (iResUR Σ)).
Proof.
split.
- iIntros (E1 E2 E2' P Q ? (E3&->&HE)%subseteq_disjoint_union_L) "HQP HQ".
rewrite uPred_fupd_eq /uPred_fupd_def ownE_op //. iIntros "H".
iMod ("HQ" with "H") as ">(Hws & [HE1 HE3] & HQ)"; iModIntro.
......@@ -39,9 +49,4 @@ Proof.
- rewrite uPred_fupd_eq /uPred_fupd_def. iIntros (E P ?) "HP [Hw HE]".
iAssert ( P)%I with "[-]" as "#$"; last by iFrame.
iNext. by iMod ("HP" with "[$]") as "(_ & _ & HP)".
Qed.
Instance uPred_bi_fupd `{invG Σ} : BiFUpd (uPredSI (iResUR Σ)) :=
{| bi_fupd_mixin := uPred_fupd_mixin |}.
Instance uPred_bi_bupd_fupd `{invG Σ} : BiBUpdFUpd (uPredSI (iResUR Σ)).
Proof. rewrite /BiBUpdFUpd uPred_fupd_eq. by iIntros (E P) ">? [$ $] !> !>". Qed.
Qed.
\ No newline at end of file
This diff is collapsed.
From iris.bi Require Export derived_laws big_op updates embedding.
From iris.bi Require Export derived_laws big_op updates plainly embedding.
Set Default Proof Using "Type".
Module Import bi.
......@@ -16,4 +16,4 @@ Hint Resolve sep_elim_l sep_elim_r sep_mono : BI.
Hint Immediate True_intro False_elim : BI.
(*
Hint Immediate iff_refl internal_eq_refl' : BI.
*)
\ No newline at end of file
*)
From iris.algebra Require Export big_op.
From iris.bi Require Export derived_laws.
From iris.bi Require Import plainly.
From stdpp Require Import countable fin_collections functions.
Set Default Proof Using "Type".
......@@ -125,10 +126,6 @@ Section sep_list.
([ list] kx l, Φ k x) ([ list] kx l, Ψ k x).
Proof. auto using and_intro, big_sepL_mono, and_elim_l, and_elim_r. Qed.
Lemma big_sepL_plainly `{BiAffine PROP} Φ l :
bi_plainly ([ list] kx l, Φ k x) [ list] kx l, bi_plainly (Φ k x).
Proof. apply (big_opL_commute _). Qed.
Lemma big_sepL_persistently `{BiAffine PROP} Φ l :
bi_persistently ([ list] kx l, Φ k x)
[ list] kx l, bi_persistently (Φ k x).
......@@ -163,16 +160,6 @@ Section sep_list.
apply forall_intro=> k. by rewrite (forall_elim (S k)).
Qed.
Global Instance big_sepL_nil_plain Φ :
Plain ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
Global Instance big_sepL_plain Φ l :
( k x, Plain (Φ k x)) Plain ([ list] kx l, Φ k x).
Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
Global Instance big_sepL_plain_id Ps :
TCForall Plain Ps Plain ([] Ps).
Proof. induction 1; simpl; apply _. Qed.
Global Instance big_sepL_nil_persistent Φ :
Persistent ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
......@@ -278,10 +265,6 @@ Section and_list.
([ list] kx l, Φ k x) ([ list] kx l, Ψ k x).
Proof. auto using and_intro, big_andL_mono, and_elim_l, and_elim_r. Qed.
Lemma big_andL_plainly Φ l :
bi_plainly ([ list] kx l, Φ k x) [ list] kx l, bi_plainly (Φ k x).
Proof. apply (big_opL_commute _). Qed.
Lemma big_andL_persistently Φ l :
bi_persistently ([ list] kx l, Φ k x)
[ list] kx l, bi_persistently (Φ k x).
......@@ -299,19 +282,13 @@ Section and_list.
- rewrite -IH. apply forall_intro=> k; by rewrite (forall_elim (S k)).
Qed.
Global Instance big_andL_nil_plain Φ :
Plain ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
Global Instance big_andL_plain Φ l :
( k x, Plain (Φ k x)) Plain ([ list] kx l, Φ k x).
Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
Global Instance big_andL_nil_persistent Φ :
Persistent ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
Global Instance big_andL_persistent Φ l :
( k x, Persistent (Φ k x)) Persistent ([ list] kx l, Φ k x).
Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
End and_list.
(** ** Big ops over finite maps *)
......@@ -420,10 +397,6 @@ Section gmap.
([ map] kx m, Φ k x) ([ map] kx m, Ψ k x).
Proof. auto using and_intro, big_sepM_mono, and_elim_l, and_elim_r. Qed.
Lemma big_sepM_plainly `{BiAffine PROP} Φ m :
bi_plainly ([ map] kx m, Φ k x) [ map] kx m, bi_plainly (Φ k x).
Proof. apply (big_opM_commute _). Qed.
Lemma big_sepM_persistently `{BiAffine PROP} Φ m :
(bi_persistently ([ map] kx m, Φ k x))
([ map] kx m, bi_persistently (Φ k x)).
......@@ -464,12 +437,6 @@ Section gmap.
by rewrite pure_True // True_impl.
Qed.
Global Instance big_sepM_empty_plain Φ : Plain ([ map] kx , Φ k x).
Proof. rewrite /big_opM map_to_list_empty. apply _. Qed.
Global Instance big_sepM_plain Φ m :
( k x, Plain (Φ k x)) Plain ([ map] kx m, Φ k x).
Proof. intros. apply (big_sepL_plain _ _)=> _ [??]; apply _. Qed.
Global Instance big_sepM_empty_persistent Φ :
Persistent ([ map] kx , Φ k x).
Proof. rewrite /big_opM map_to_list_empty. apply _. Qed.
......@@ -596,10 +563,6 @@ Section gset.
([ set] y X, Φ y Ψ y) ([ set] y X, Φ y) ([ set] y X, Ψ y).
Proof. auto using and_intro, big_sepS_mono, and_elim_l, and_elim_r. Qed.
Lemma big_sepS_plainly `{BiAffine PROP} Φ X :
bi_plainly ([ set] y X, Φ y) [ set] y X, bi_plainly (Φ y).
Proof. apply (big_opS_commute _). Qed.
Lemma big_sepS_persistently `{BiAffine PROP} Φ X :
bi_persistently ([ set] y X, Φ y) [ set] y X, bi_persistently (Φ y).
Proof. apply (big_opS_commute _). Qed.
......@@ -633,12 +596,6 @@ Section gset.
by rewrite pure_True ?True_impl; last set_solver.
Qed.
Global Instance big_sepS_empty_plain Φ : Plain ([ set] x , Φ x).
Proof. rewrite /big_opS elements_empty. apply _. Qed.
Global Instance big_sepS_plain Φ X :
( x, Plain (Φ x)) Plain ([ set] x X, Φ x).
Proof. rewrite /big_opS. apply _. Qed.
Global Instance big_sepS_empty_persistent Φ :
Persistent ([ set] x , Φ x).
Proof. rewrite /big_opS elements_empty. apply _. Qed.
......@@ -714,21 +671,11 @@ Section gmultiset.
([ mset] y X, Φ y Ψ y) ([ mset] y X, Φ y) ([ mset] y X, Ψ y).
Proof. auto using and_intro, big_sepMS_mono, and_elim_l, and_elim_r. Qed.
Lemma big_sepMS_plainly `{BiAffine PROP} Φ X :
bi_plainly ([ mset] y X, Φ y) [ mset] y X, bi_plainly (Φ y).
Proof. apply (big_opMS_commute _). Qed.
Lemma big_sepMS_persistently `{BiAffine PROP} Φ X :
bi_persistently ([ mset] y X, Φ y)
[ mset] y X, bi_persistently (Φ y).
Proof. apply (big_opMS_commute _). Qed.
Global Instance big_sepMS_empty_plain Φ : Plain ([ mset] x , Φ x).
Proof. rewrite /big_opMS gmultiset_elements_empty. apply _. Qed.
Global Instance big_sepMS_plain Φ X :
( x, Plain (Φ x)) Plain ([ mset] x X, Φ x).
Proof. rewrite /big_opMS. apply _. Qed.
Global Instance big_sepMS_empty_persistent Φ :
Persistent ([ mset] x , Φ x).
Proof. rewrite /big_opMS gmultiset_elements_empty. apply _. Qed.
......@@ -773,6 +720,34 @@ Section list.
Global Instance big_sepL_timeless_id `{!Timeless (emp%I : PROP)} Ps :
TCForall Timeless Ps Timeless ([] Ps).
Proof. induction 1; simpl; apply _. Qed.
Section plainly.
Context `{!BiPlainly PROP}.
Lemma big_sepL_plainly `{!BiAffine PROP} Φ l :
([ list] kx l, Φ k x) [ list] kx l, (Φ k x).
Proof. apply (big_opL_commute _). Qed.
Global Instance big_sepL_nil_plain `{!BiAffine PROP} Φ :
Plain ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
Global Instance big_sepL_plain `{!BiAffine PROP} Φ l :
( k x, Plain (Φ k x)) Plain ([ list] kx l, Φ k x).
Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
Lemma big_andL_plainly Φ l :
([ list] kx l, Φ k x) [ list] kx l, (Φ k x).
Proof. apply (big_opL_commute _). Qed.
Global Instance big_andL_nil_plain Φ :
Plain ([ list] kx [], Φ k x).
Proof. simpl; apply _. Qed.
Global Instance big_andL_plain Φ l :
( k x, Plain (Φ k x)) Plain ([ list] kx l, Φ k x).
Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
End plainly.
End list.
(** ** Big ops over finite maps *)
......@@ -795,6 +770,21 @@ Section gmap.
Global Instance big_sepM_timeless `{!Timeless (emp%I : PROP)} Φ m :
( k x, Timeless (Φ k x)) Timeless ([ map] kx m, Φ k x).
Proof. intros. apply big_sepL_timeless=> _ [??]; apply _. Qed.
Section plainly.
Context `{!BiPlainly PROP}.
Lemma big_sepM_plainly `{BiAffine PROP} Φ m :
([ map] kx m, Φ k x) [ map] kx m, (Φ k x).
Proof. apply (big_opM_commute _). Qed.
Global Instance big_sepM_empty_plain `{BiAffine PROP} Φ :
Plain ([ map] kx , Φ k x).
Proof. rewrite /big_opM map_to_list_empty. apply _. Qed.
Global Instance big_sepM_plain `{BiAffine PROP} Φ m :
( k x, Plain (Φ k x)) Plain ([ map] kx m, Φ k x).
Proof. intros. apply (big_sepL_plain _ _)=> _ [??]; apply _. Qed.
End plainly.
End gmap.
(** ** Big ops over finite sets *)
......@@ -817,6 +807,20 @@ Section gset.
Global Instance big_sepS_timeless `{!Timeless (emp%I : PROP)} Φ X :
( x, Timeless (Φ x)) Timeless ([ set] x X, Φ x).
Proof. rewrite /big_opS. apply _. Qed.
Section plainly.
Context `{!BiPlainly PROP}.
Lemma big_sepS_plainly `{BiAffine PROP} Φ X :
([ set] y X, Φ y) [ set] y X, (Φ y).
Proof. apply (big_opS_commute _). Qed.
Global Instance big_sepS_empty_plain `{BiAffine PROP} Φ : Plain ([ set] x , Φ x).
Proof. rewrite /big_opS elements_empty. apply _. Qed.
Global Instance big_sepS_plain `{BiAffine PROP} Φ X :
( x, Plain (Φ x)) Plain ([ set] x X, Φ x).
Proof. rewrite /big_opS. apply _. Qed.
End plainly.
End gset.
(** ** Big ops over finite multisets *)
......@@ -839,6 +843,20 @@ Section gmultiset.
Global Instance big_sepMS_timeless `{!Timeless (emp%I : PROP)} Φ X :
( x, Timeless (Φ x)) Timeless ([ mset] x X, Φ x).
Proof. rewrite /big_opMS. apply _. Qed.
Section plainly.
Context `{!BiPlainly PROP}.
Lemma big_sepMS_plainly `{BiAffine PROP} Φ X :
([ mset] y X, Φ y) [ mset] y X, (Φ y).
Proof. apply (big_opMS_commute _). Qed.
Global Instance big_sepMS_empty_plain `{BiAffine PROP} Φ : Plain ([ mset] x , Φ x).
Proof. rewrite /big_opMS gmultiset_elements_empty. apply _. Qed.
Global Instance big_sepMS_plain `{BiAffine PROP} Φ X :
( x, Plain (Φ x)) Plain ([ mset] x X, Φ x).
Proof. rewrite /big_opMS. apply _. Qed.
End plainly.
End gmultiset.
End sbi_big_op.
End bi.
......@@ -13,12 +13,6 @@ Arguments bi_wand_iff {_} _%I _%I : simpl never.
Instance: Params (@bi_wand_iff) 1.
Infix "∗-∗" := bi_wand_iff (at level 95, no associativity) : bi_scope.
Class Plain {PROP : bi} (P : PROP) := plain : P bi_plainly P.
Arguments Plain {_} _%I : simpl never.
Arguments plain {_} _%I {_}.
Hint Mode Plain + ! : typeclass_instances.
Instance: Params (@Plain) 1.
Class Persistent {PROP : bi} (P : PROP) := persistent : P bi_persistently P.
Arguments Persistent {_} _%I : simpl never.
Arguments persistent {_} _%I {_}.
......@@ -31,8 +25,6 @@ Instance: Params (@bi_affinely) 1.
Typeclasses Opaque bi_affinely.
Notation "□ P" := (bi_affinely (bi_persistently P))%I
(at level 20, right associativity) : bi_scope.
Notation "■ P" := (bi_affinely (bi_plainly P))%I
(at level 20, right associativity) : bi_scope.
Class Affine {PROP : bi} (Q : PROP) := affine : Q emp.
Arguments Affine {_} _%I : simpl never.
......@@ -45,11 +37,6 @@ Existing Instance absorbing_bi | 0.
Class BiPositive (PROP : bi) :=
bi_positive (P Q : PROP) : bi_affinely (P Q) bi_affinely P Q.
Class BiPlainlyExist (PROP : bi) :=
plainly_exist_1 A (Ψ : A PROP) :
bi_plainly ( a, Ψ a) a, bi_plainly (Ψ a).
Arguments plainly_exist_1 _ {_ _} _.
Definition bi_absorbingly {PROP : bi} (P : PROP) : PROP := (True P)%I.
Arguments bi_absorbingly {_} _%I : simpl never.
Instance: Params (@bi_absorbingly) 1.
......@@ -59,12 +46,6 @@ Class Absorbing {PROP : bi} (P : PROP) := absorbing : bi_absorbingly P ⊢ P.
Arguments Absorbing {_} _%I : simpl never.
Arguments absorbing {_} _%I.
Definition bi_plainly_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then bi_plainly P else P)%I.
Arguments bi_plainly_if {_} !_ _%I /.
Instance: Params (@bi_plainly_if) 2.
Typeclasses Opaque bi_plainly_if.
Definition bi_persistently_if {PROP : bi} (p : bool) (P : PROP) : PROP :=
(if p then bi_persistently P else P)%I.
Arguments bi_persistently_if {_} !_ _%I /.
......@@ -79,9 +60,6 @@ Typeclasses Opaque bi_affinely_if.
Notation "□? p P" := (bi_affinely_if p (bi_persistently_if p P))%I
(at level 20, p at level 9, P at level 20,
right associativity, format "□? p P") : bi_scope.
Notation "■? p P" := (bi_affinely_if p (bi_plainly_if p P))%I
(at level 20, p at level 9, P at level 20,
right associativity, format "■? p P") : bi_scope.
Fixpoint bi_hexist {PROP : bi} {As} : himpl As PROP PROP :=
match As return himpl As PROP PROP with
......
This diff is collapsed.
From iris.algebra Require Import monoid.
From iris.bi Require Import interface derived_laws big_op.
From iris.bi Require Import interface derived_laws big_op plainly.
From stdpp Require Import hlist.
Class Embed (A B : Type) := embed : A B.
......@@ -21,7 +21,6 @@ Record BiEmbedMixin (PROP1 PROP2 : bi) `(Embed PROP1 PROP2) := {
bi_embed_mixin_exist_1 A (Φ : A PROP1) : x, Φ x x, ⎡Φ x;
bi_embed_mixin_sep P Q : P Q P Q;
bi_embed_mixin_wand_2 P Q : (P - Q) P - Q;
bi_embed_mixin_plainly P : bi_plainly P bi_plainly P;
bi_embed_mixin_persistently P : bi_persistently P bi_persistently P
}.
......@@ -35,7 +34,8 @@ Arguments bi_embed_embed : simpl never.
Class SbiEmbed (PROP1 PROP2 : sbi) `{BiEmbed PROP1 PROP2} := {
embed_internal_eq_1 (A : ofeT) (x y : A) : x y x y;
embed_later P : ⎡▷ P P
embed_later P : ⎡▷ P P;
embed_interal_inj (PROP' : sbi) (P Q : PROP1) : P Q (P Q : PROP');
}.
Section embed_laws.
......@@ -62,8 +62,6 @@ Section embed_laws.
Proof. eapply bi_embed_mixin_sep, bi_embed_mixin. Qed.
Lemma embed_wand_2 P Q : (P - Q) P - Q.
Proof. eapply bi_embed_mixin_wand_2, bi_embed_mixin. Qed.
Lemma embed_plainly P : bi_plainly P bi_plainly P.
Proof. eapply bi_embed_mixin_plainly, bi_embed_mixin. Qed.
Lemma embed_persistently P : bi_persistently P bi_persistently P.
Proof. eapply bi_embed_mixin_persistently, bi_embed_mixin. Qed.
End embed_laws.
......@@ -121,6 +119,7 @@ Section embed.
last apply bi.True_intro.
apply bi.impl_intro_l. by rewrite right_id.
Qed.
Lemma embed_iff P Q : P Q (P Q).
Proof. by rewrite embed_and !embed_impl. Qed.
Lemma embed_wand_iff P Q : P - Q (P - Q).
......@@ -129,8 +128,6 @@ Section embed.
Proof. by rewrite embed_and embed_emp. Qed.
Lemma embed_absorbingly P : bi_absorbingly P bi_absorbingly P.
Proof. by rewrite embed_sep embed_pure. Qed.
Lemma embed_plainly_if P b : bi_plainly_if b P bi_plainly_if b P.
Proof. destruct b; simpl; auto using embed_plainly. Qed.
Lemma embed_persistently_if P b :
bi_persistently_if b P bi_persistently_if b P.
Proof. destruct b; simpl; auto using embed_persistently. Qed.
......@@ -143,8 +140,6 @@ Section embed.
bi_hexist Φ⎤ bi_hexist (hcompose embed Φ).
Proof. induction As=>//. rewrite /= embed_exist. by do 2 f_equiv. Qed.
Global Instance embed_plain P : Plain P Plain P.
Proof. intros ?. by rewrite /Plain -embed_plainly -plain. Qed.
Global Instance embed_persistent P : Persistent P Persistent P.
Proof. intros ?. by rewrite /Persistent -embed_persistently -persistent. Qed.
Global Instance embed_affine P : Affine P Affine P.
......@@ -201,8 +196,26 @@ Section sbi_embed.
Lemma embed_except_0 P : ⎡◇ P P.
Proof. by rewrite embed_or embed_later embed_pure. Qed.
Lemma embed_plainly `{!BiPlainly PROP1, !BiPlainly PROP2} P : ⎡■ P P.
Proof.
rewrite !plainly_alt embed_internal_eq. apply (anti_symm _).
- rewrite -embed_affinely -embed_emp. apply bi.f_equiv, _.
- by rewrite -embed_affinely -embed_emp embed_interal_inj.
Qed.
Lemma embed_plainly_if `{!BiPlainly PROP1, !BiPlainly PROP2} p P : ⎡■?p P ?p P.
Proof. destruct p; simpl; auto using embed_plainly. Qed.
Lemma embed_plain `{!BiPlainly PROP1, !BiPlainly PROP2} P : Plain P Plain P.
Proof. intros ?. by rewrite /Plain -embed_plainly -plain. Qed.
Global Instance embed_timeless P : Timeless P Timeless P.
Proof.
intros ?. by rewrite /Timeless -embed_except_0 -embed_later timeless.
Qed.
End sbi_embed.
(* Not defined using an ordinary [Instance] because the default
[class_apply @bi_embed_plainly] shelves the [BiPlainly] premise, making proof
search for the other premises fail. See the proof of [monPred_absolutely_plain]
for an example where it would fail with a regular [Instance].*)
Hint Extern 4 (Plain _) => eapply @embed_plain : typeclass_instances.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
From stdpp Require Import coPset.
From iris.bi Require Import interface derived_laws big_op.
From iris.bi Require Import interface derived_laws big_op plainly.
(* We first define operational type classes for the notations, and then later
bundle these operational type classes with the laws. *)
......@@ -57,7 +57,6 @@ Record BiBUpdMixin (PROP : bi) `(BUpd PROP) := {
bi_bupd_mixin_bupd_mono (P Q : PROP) : (P Q) (|==> P) == Q;
bi_bupd_mixin_bupd_trans (P : PROP) : (|==> |==> P) == P;
bi_bupd_mixin_bupd_frame_r (P R : PROP) : (|==> P) R == P R;
bi_bupd_mixin_bupd_plainly (P : PROP) : (|==> bi_plainly P) - P;
}.
Record BiFUpdMixin (PROP : sbi) `(FUpd PROP) := {
......@@ -69,10 +68,6 @@ Record BiFUpdMixin (PROP : sbi) `(FUpd PROP) := {
bi_fupd_mixin_fupd_mask_frame_r' E1 E2 Ef (P : PROP) :
E1 ## Ef (|={E1,E2}=> E2 ## Ef P) ={E1 Ef,E2 Ef}= P;
bi_fupd_mixin_fupd_frame_r E1 E2 (P Q : PROP) : (|={E1,E2}=> P) Q ={E1,E2}= P Q;
bi_fupd_mixin_fupd_plain' E1 E2 E2' (P Q : PROP) `{!Plain P} :
E1 E2
(Q ={E1, E2'}= P) - (|={E1, E2}=> Q) ={E1}= (|={E1, E2}=> Q) P;
bi_fupd_mixin_later_fupd_plain E (P : PROP) `{!Plain P} : ( |={E}=> P) ={E}= P;
}.
Class BiBUpd (PROP : bi) := {
......@@ -92,6 +87,17 @@ Arguments bi_fupd_fupd : simpl never.
Class BiBUpdFUpd (PROP : sbi) `{BiBUpd PROP, BiFUpd PROP} :=
bupd_fupd E (P : PROP) : (|==> P) ={E}= P.
Class BiBUpdPlainly (PROP : sbi) `{!BiBUpd PROP, !BiPlainly PROP} :=
bupd_plainly (P : PROP) : (|==> P) - P.
Class BiFUpdPlainly (PROP : sbi) `{!BiFUpd PROP, !BiPlainly PROP} := {
fupd_plain' E1 E2 E2' (P Q : PROP) `{!Plain P} :
E1 E2
(Q ={E1, E2'}= P) - (|={E1, E2}=> Q) ={E1}= (|={E1, E2}=> Q) P;
later_fupd_plain E (P : PROP) `{!Plain P} :
( |={E}=> P) ={E}= P;
}.
Section bupd_laws.
Context `{BiBUpd PROP}.
Implicit Types P : PROP.
......@@ -106,8 +112,6 @@ Section bupd_laws.
Proof. eapply bi_bupd_mixin_bupd_trans, bi_bupd_mixin. Qed.
Lemma bupd_frame_r (P R : PROP) : (|==> P) R == P R.
Proof. eapply bi_bupd_mixin_bupd_frame_r, bi_bupd_mixin. Qed.
Lemma bupd_plainly (P : PROP) : (|==> bi_plainly P) - P.
Proof. eapply bi_bupd_mixin_bupd_plainly, bi_bupd_mixin. Qed.
End bupd_laws.
Section fupd_laws.
......@@ -129,12 +133,6 @@ Section fupd_laws.
Proof. eapply bi_fupd_mixin_fupd_mask_frame_r', bi_fupd_mixin. Qed.
Lemma fupd_frame_r E1 E2 (P Q : PROP) : (|={E1,E2}=> P) Q ={E1,E2}= P Q.
Proof. eapply bi_fupd_mixin_fupd_frame_r, bi_fupd_mixin. Qed.
Lemma fupd_plain' E1 E2 E2' (P Q : PROP) `{!Plain P} :
E1 E2
(Q ={E1, E2'}= P) - (|={E1, E2}=> Q) ={E1}= (|={E1, E2}=> Q) P.
Proof. eapply bi_fupd_mixin_fupd_plain'; eauto using bi_fupd_mixin. Qed.
Lemma later_fupd_plain E (P : PROP) `{!Plain P} : ( |={E}=> P) ={E}= P.
Proof. eapply bi_fupd_mixin_later_fupd_plain; eauto using bi_fupd_mixin. Qed.
End fupd_laws.
Section bupd_derived.
......@@ -159,10 +157,6 @@ Section bupd_derived.
Proof. by rewrite bupd_frame_r bi.wand_elim_r. Qed.
Lemma bupd_sep P Q : (|==> P) (|==> Q) == P Q.
Proof. by rewrite bupd_frame_r bupd_frame_l bupd_trans. Qed.
Lemma bupd_affinely_plainly `{BiAffine PROP} P : (|==> P) P.
Proof. by rewrite bi.affine_affinely bupd_plainly. Qed.
Lemma bupd_plain P `{!Plain P} : (|==> P) P.
Proof. by rewrite {1}(plain P) bupd_plainly. Qed.
End bupd_derived.
Section bupd_derived_sbi.
......@@ -174,6 +168,9 @@ Section bupd_derived_sbi.
rewrite /sbi_except_0. apply bi.or_elim; eauto using bupd_mono, bi.or_intro_r.
by rewrite -bupd_intro -bi.or_intro_l.
Qed.
Lemma bupd_plain P `{BiBUpdPlainly PROP, !Plain P} : (|==> P) P.
Proof. by rewrite {1}(plain P) bupd_plainly. Qed.
End bupd_derived_sbi.
Section fupd_derived.
......@@ -243,7 +240,7 @@ Section fupd_derived.
intros P1 P2 HP Q1 Q2 HQ. by rewrite HP HQ -fupd_sep.
Qed.
Lemma fupd_plain 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.
Proof.
intros HE. rewrite -(fupd_plain' _ _ E1) //. apply bi.wand_intro_l.
......
This diff is collapsed.
......@@ -215,7 +215,8 @@ Hint Mode IntoForall + - ! - : typeclass_instances.
Class FromForall {PROP : bi} {A} (P : PROP) (Φ : A PROP) :=
from_forall : ( x, Φ x) P.
Arguments from_forall {_ _} _ _ {_}.
Arguments FromForall {_ _} _%I _%I : simpl never.
Arguments from_forall {_ _} _%I _%I {_}.
Hint Mode FromForall + - ! - : typeclass_instances.
Class IsExcept0 {PROP : sbi} (Q : PROP) := is_except_0 : Q Q.
......
......@@ -34,26 +34,6 @@ Section bi_modalities.
Definition modality_affinely_persistently :=
Modality _ modality_affinely_persistently_mixin.
Lemma modality_plainly_mixin :
modality_mixin (@bi_plainly PROP) (MIEnvForall Plain) MIEnvClear.
Proof.
split; simpl; split_and?; eauto using equiv_entails_sym, plainly_intro,
plainly_mono, plainly_and, plainly_sep_2 with typeclass_instances.
Qed.
Definition modality_plainly :=
Modality _ modality_plainly_mixin.
Lemma modality_affinely_plainly_mixin :
modality_mixin (λ P : PROP, P)%I (MIEnvForall Plain) MIEnvIsEmpty.
Proof.
split; simpl; split_and?; eauto using equiv_entails_sym,
affinely_plainly_emp, affinely_intro,
plainly_intro, affinely_mono, plainly_mono, affinely_plainly_idemp,
affinely_plainly_and, affinely_plainly_sep_2 with typeclass_instances.
Qed.
Definition modality_affinely_plainly :=
Modality _ modality_affinely_plainly_mixin.
Lemma modality_embed_mixin `{BiEmbed PROP PROP'} :
modality_mixin (@embed PROP PROP' _)
(MIEnvTransform IntoEmbed) (MIEnvTransform IntoEmbed).
......@@ -71,6 +51,15 @@ End bi_modalities.
Section sbi_modalities.
Context {PROP : sbi}.
Lemma modality_plainly_mixin `{BiPlainly PROP} :
modality_mixin (@plainly PROP _) (MIEnvForall Plain) MIEnvClear.
Proof.
split; simpl; split_and?; eauto using equiv_entails_sym, plainly_intro,
plainly_mono, plainly_and, plainly_sep_2 with typeclass_instances.
Qed.
Definition modality_plainly `{BiPlainly PROP} :=
Modality _ modality_plainly_mixin.
Lemma modality_laterN_mixin n :
modality_mixin (@sbi_laterN PROP n)
(MIEnvTransform (MaybeIntoLaterN false n)) (MIEnvTransform (MaybeIntoLaterN false n)).
......
From iris.bi Require Export monpred.
From iris.bi Require Import plainly.
From iris.proofmode Require Import tactics class_instances.
Class MakeMonPredAt {I : biIndex} {PROP : bi} (i : I)
......@@ -33,6 +34,7 @@ End modalities.
Section bi.
Context {I : biIndex} {PROP : bi}.
Local Notation monPredI := (monPredI I PROP).
Local Notation monPred := (monPred I PROP).
Local Notation MakeMonPredAt := (@MakeMonPredAt I PROP).
Implicit Types P Q R : monPred.
......@@ -290,21 +292,6 @@ Proof.
by rewrite monPred_at_exist.
Qed.
Global Instance foram_forall_monPred_at_plainly i P Φ :
( i, MakeMonPredAt i P (Φ i))
FromForall (bi_plainly P i) (λ j, bi_plainly (Φ j)).
Proof.
rewrite /FromForall /MakeMonPredAt=>H. rewrite monPred_at_plainly.
by setoid_rewrite H.
Qed.
Global Instance into_forall_monPred_at_plainly i P Φ :