diff --git a/theories/proofmode/class_instances.v b/theories/proofmode/class_instances.v index 7955e6e8c5d8a683ebd89836932e2af1a106aa4d..f87011afb918ff41dc0800d90515353242c61bfa 100644 --- a/theories/proofmode/class_instances.v +++ b/theories/proofmode/class_instances.v @@ -6,6 +6,7 @@ Import bi. Section bi_modalities. Context {PROP : bi}. + Lemma modality_persistently_mixin : modality_mixin (@bi_persistently PROP) MIEnvId MIEnvClear. Proof. @@ -54,15 +55,6 @@ Section bi_modalities. Definition modality_affinely_plainly := Modality _ modality_affinely_plainly_mixin. - Lemma modality_absorbingly_mixin : - modality_mixin (@bi_absorbingly PROP) MIEnvId MIEnvId. - Proof. - split; simpl; eauto using equiv_entails_sym, absorbingly_intro, - absorbingly_mono, absorbingly_sep. - Qed. - Definition modality_absorbingly := - Modality _ modality_absorbingly_mixin. - Lemma modality_embed_mixin `{BiEmbedding PROP PROP'} : modality_mixin (@bi_embed PROP PROP' _) (MIEnvTransform IntoEmbed) (MIEnvTransform IntoEmbed). @@ -80,15 +72,6 @@ End bi_modalities. Section sbi_modalities. Context {PROP : sbi}. - Lemma modality_except_0_mixin : - modality_mixin (@sbi_except_0 PROP) MIEnvId MIEnvId. - Proof. - split; simpl; eauto using equiv_entails_sym, - except_0_intro, except_0_mono, except_0_sep. - Qed. - Definition modality_except_0 := - Modality _ modality_except_0_mixin. - Lemma modality_laterN_mixin n : modality_mixin (@sbi_laterN PROP n) (MIEnvTransform (MaybeIntoLaterN false n)) (MIEnvTransform (MaybeIntoLaterN false n)). @@ -99,18 +82,6 @@ Section sbi_modalities. Qed. Definition modality_laterN n := Modality _ (modality_laterN_mixin n). - - Lemma modality_bupd_mixin `{BUpdFacts PROP} : - modality_mixin (@bupd PROP _) MIEnvId MIEnvId. - Proof. split; simpl; eauto using bupd_intro, bupd_mono, bupd_sep. Qed. - Definition modality_bupd `{BUpdFacts PROP} := - Modality _ modality_bupd_mixin. - - Lemma modality_fupd_mixin `{FUpdFacts PROP} E : - modality_mixin (@fupd PROP _ E E) MIEnvId MIEnvId. - Proof. split; simpl; eauto using fupd_intro, fupd_mono, fupd_sep. Qed. - Definition modality_fupd `{FUpdFacts PROP} E := - Modality _ (modality_fupd_mixin E). End sbi_modalities. Section bi_instances. @@ -1137,8 +1108,8 @@ Qed. (* FromModal *) Global Instance from_modal_absorbingly P : - FromModal modality_absorbingly (bi_absorbingly P) P. -Proof. by rewrite /FromModal. Qed. + FromModal modality_id (bi_absorbingly P) P. +Proof. by rewrite /FromModal /= -absorbingly_intro. Qed. Global Instance from_modal_embed `{BiEmbedding PROP PROP'} (P : PROP) : FromModal (@modality_embed PROP PROP' _ _) ⎡P⎤ P. Proof. by rewrite /FromModal. Qed. @@ -1482,15 +1453,15 @@ Global Instance from_modal_later n P Q : TCIf (TCEq n 0) False TCTrue → FromModal (modality_laterN n) P Q | 100. Proof. rewrite /FromLaterN /FromModal. by intros [?] [_ []|?]. Qed. -Global Instance from_modal_except_0 P : FromModal modality_except_0 (â—‡ P) P. -Proof. by rewrite /FromModal. Qed. +Global Instance from_modal_except_0 P : FromModal modality_id (â—‡ P) P. +Proof. by rewrite /FromModal /= -except_0_intro. Qed. Global Instance from_modal_bupd `{BUpdFacts PROP} P : - FromModal modality_bupd (|==> P) P. -Proof. by rewrite /FromModal. Qed. + FromModal modality_id (|==> P) P. +Proof. by rewrite /FromModal /= -bupd_intro. Qed. Global Instance from_modal_fupd E P `{FUpdFacts PROP} : - FromModal (modality_fupd E) (|={E}=> P) P. -Proof. by rewrite /FromModal. Qed. + FromModal modality_id (|={E}=> P) P. +Proof. by rewrite /FromModal /= -fupd_intro. Qed. (* IntoInternalEq *) Global Instance into_internal_eq_internal_eq {A : ofeT} (x y : A) : diff --git a/theories/proofmode/classes.v b/theories/proofmode/classes.v index ed91bf00aa833b4a530963cb076465e67504bb08..a285aa8d6fb7bbdf3212e3f79c0fa6efa8f8ffef 100644 --- a/theories/proofmode/classes.v +++ b/theories/proofmode/classes.v @@ -236,6 +236,16 @@ Arguments FromModal {_ _} _ _%I _%I : simpl never. Arguments from_modal {_ _} _ _%I _%I {_}. Hint Mode FromModal - + - ! - : typeclass_instances. +(** The identity modality [modality_id] can be used in combination with +[FromModal modality_id] to support introduction for modalities that enjoy +[P ⊢ M P]. This is done by defining an instance [FromModal modality_id (M P) P], +which will instruct [iModIntro] to introduce the modality without modifying the +proof mode context. Examples of such modalities are [bupd], [fupd], [except_0], +[monPred_relatively] and [bi_absorbingly]. *) +Lemma modality_id_mixin {PROP : bi} : modality_mixin (@id PROP) MIEnvId MIEnvId. +Proof. split; simpl; eauto. Qed. +Definition modality_id {PROP : bi} := Modality (@id PROP) modality_id_mixin. + Class FromAffinely {PROP : bi} (P Q : PROP) := from_affinely : bi_affinely Q ⊢ P. Arguments FromAffinely {_} _%I _%type_scope : simpl never. diff --git a/theories/proofmode/monpred.v b/theories/proofmode/monpred.v index aa15d3dd2754a6bca062610434aca5e9a68a95c2..8554d1845594314fb7fd39ef559b1a1d5618b069 100644 --- a/theories/proofmode/monpred.v +++ b/theories/proofmode/monpred.v @@ -43,6 +43,9 @@ Implicit Types i j : I. Global Instance from_modal_absolutely P : FromModal modality_absolutely (∀ᵢ P) P | 1. Proof. by rewrite /FromModal. Qed. +Global Instance from_modal_relatively P : + FromModal modality_id (∃ᵢ P) P | 1. +Proof. by rewrite /FromModal /= -monPred_relatively_intro. Qed. Global Instance make_monPred_at_pure φ i : MakeMonPredAt i ⌜φ⌠⌜φâŒ. Proof. by rewrite /MakeMonPredAt monPred_at_pure. Qed. @@ -349,11 +352,9 @@ Proof. ?monPred_at_persistently monPred_at_embed. Qed. -(* FIXME Global Instance from_modal_monPred_at i P Q ð“ : - FromModal P Q → MakeMonPredAt i Q ð“ → FromModal (P i) ð“ . + FromModal modality_id P Q → MakeMonPredAt i Q ð“ → FromModal modality_id (P i) ð“ . Proof. by rewrite /FromModal /MakeMonPredAt=> <- <-. Qed. -*) Global Instance into_embed_absolute P : Absolute P → IntoEmbed P (∀ i, P i). Proof. rewrite /IntoEmbed=> ?. by rewrite {1}(absolute_absolutely P). Qed.