diff --git a/theories/proofmode/class_instances.v b/theories/proofmode/class_instances.v index 15ce9ea17f2265f05d56c21c0d1a0c14a2a3ea75..c5888cbb491584d2977723a5f78c24776b538af6 100644 --- a/theories/proofmode/class_instances.v +++ b/theories/proofmode/class_instances.v @@ -831,23 +831,25 @@ Proof. apply later_intro. Qed. Global Instance from_modal_except_0 P : FromModal (◇ P) P. Proof. apply except_0_intro. Qed. +(* IntoExcept0 *) +Global Instance into_timeless_except_0 P : IntoExcept0 (◇ P) P. +Proof. by rewrite /IntoExcept0. Qed. +Global Instance into_timeless_later P : Timeless P → IntoExcept0 (▷ P) P. +Proof. by rewrite /IntoExcept0. Qed. +Global Instance into_timeless_later_if p P : Timeless P → IntoExcept0 (▷?p P) P. +Proof. rewrite /IntoExcept0. destruct p; auto using except_0_intro. Qed. + +Global Instance into_timeless_bare P Q : IntoExcept0 P Q → IntoExcept0 (■P) (■Q). +Proof. rewrite /IntoExcept0=> ->. by rewrite except_0_bare_2. Qed. +Global Instance into_timeless_persistently P Q : IntoExcept0 P Q → IntoExcept0 (□ P) (□ Q). +Proof. rewrite /IntoExcept0=> ->. by rewrite except_0_persistently. Qed. + (* ElimModal *) -Global Instance elim_modal_except_0 P Q : IsExcept0 Q → ElimModal (◇ P) P Q Q. +Global Instance elim_modal_timeless P Q : + IntoExcept0 P P' → IsExcept0 Q → ElimModal P P' Q Q. Proof. intros. rewrite /ElimModal (except_0_intro (_ -∗ _)%I). - by rewrite -except_0_sep wand_elim_r. -Qed. -Global Instance elim_modal_timeless_later P Q : - Timeless P → IsExcept0 Q → ElimModal (▷ P) P Q Q. -Proof. - intros. rewrite /ElimModal (except_0_intro (_ -∗ _)%I) (timeless P). - by rewrite -except_0_sep wand_elim_r. -Qed. -Global Instance elim_modal_timeless_later_if p P Q : - Timeless P → IsExcept0 Q → ElimModal (▷?p P) P Q Q. -Proof. - destruct p; simpl; auto using elim_modal_timeless_later. - intros _ _. by rewrite /ElimModal wand_elim_r. + by rewrite (into_except_0 P) -except_0_sep wand_elim_r. Qed. (* Frame *) diff --git a/theories/proofmode/classes.v b/theories/proofmode/classes.v index 575a5722d17250d87761f37f13650c524c2a24a5..7263098d0b512c55eb1454bb22b1e5883e82a8b5 100644 --- a/theories/proofmode/classes.v +++ b/theories/proofmode/classes.v @@ -211,6 +211,12 @@ Instance maybe_frame_default {PROP : bi} (R P : PROP) : TCOr (Affine R) (Absorbing P) → MaybeFrame false R P P | 100. Proof. intros. rewrite /MaybeFrame /=. apply: sep_elim_r. Qed. +Class IntoExcept0 {PROP : sbi} (P Q : PROP) := into_except_0 : P ⊢ ◇ Q. +Arguments IntoExcept0 {_} _%I _%I : simpl never. +Arguments into_except_0 {_} _%I _%I {_}. +Hint Mode IntoExcept0 + ! - : typeclass_instances. +Hint Mode IntoExcept0 + - ! : typeclass_instances. + (* The class [IntoLaterN] has only two instances: - The default instance [IntoLaterN n P P], i.e. [▷^n P -∗ P] @@ -294,5 +300,7 @@ Instance into_forall_tc_opaque {PROP : bi} {A} (P : PROP) (Φ : A → PROP) : IntoForall P Φ → IntoForall (tc_opaque P) Φ := id. Instance from_modal_tc_opaque {PROP : bi} (P Q : PROP) : FromModal P Q → FromModal (tc_opaque P) Q := id. +(* Higher precedence than [elim_modal_timeless], so that [iAssert] does not + loop (see test [test_iAssert_modality] in proofmode.v). *) Instance elim_modal_tc_opaque {PROP : bi} (P P' Q Q' : PROP) : - ElimModal P P' Q Q' → ElimModal (tc_opaque P) P' Q Q' := id. + ElimModal P P' Q Q' → ElimModal (tc_opaque P) P' Q Q' | 100 := id. diff --git a/theories/tests/proofmode.v b/theories/tests/proofmode.v index ea1a0fc4530a27d09ee8a9d7b828f5cc401ee3f6..c704ba30c1b1ccc80654e72f00e4b13990c548e8 100644 --- a/theories/tests/proofmode.v +++ b/theories/tests/proofmode.v @@ -120,6 +120,9 @@ Proof. by iMod "HF". Qed. +Lemma test_iMod_bare_timeless P `{!Timeless P} : ■▷ P -∗ ◇ ■P. +Proof. iIntros "H". iMod "H". done. Qed. + Lemma test_iAssumption_False P : False -∗ P. Proof. iIntros "H". done. Qed.