Commit 8db4eba0 authored by Robbert Krebbers's avatar Robbert Krebbers

Unify `iAlways` and `iModIntro`.

parent 69cf8016
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -14,21 +14,21 @@ Proof. by rewrite /IsBiIndexRel. Qed. ...@@ -14,21 +14,21 @@ Proof. by rewrite /IsBiIndexRel. Qed.
Hint Extern 1 (IsBiIndexRel _ _) => unfold IsBiIndexRel; assumption Hint Extern 1 (IsBiIndexRel _ _) => unfold IsBiIndexRel; assumption
: typeclass_instances. : typeclass_instances.
Section always_modalities. Section modalities.
Context {I : biIndex} {PROP : bi}. Context {I : biIndex} {PROP : bi}.
Lemma always_modality_absolutely_mixin : Lemma modality_absolutely_mixin :
always_modality_mixin (@monPred_absolutely I PROP) modality_mixin (@monPred_absolutely I PROP)
(AIEnvFilter Absolute) (AIEnvFilter Absolute). (MIEnvFilter Absolute) (MIEnvFilter Absolute).
Proof. Proof.
split; split_and?; intros; try match goal with H : TCDiag _ _ _ |- _ => destruct H end; split; split_and?; intros; try match goal with H : TCDiag _ _ _ |- _ => destruct H end;
eauto using bi.equiv_entails_sym, absolute_absolutely, eauto using bi.equiv_entails_sym, absolute_absolutely,
monPred_absolutely_mono, monPred_absolutely_and, monPred_absolutely_mono, monPred_absolutely_and,
monPred_absolutely_sep_2 with typeclass_instances. monPred_absolutely_sep_2 with typeclass_instances.
Qed. Qed.
Definition always_modality_absolutely := Definition modality_absolutely :=
AlwaysModality _ always_modality_absolutely_mixin. Modality _ modality_absolutely_mixin.
End always_modalities. End modalities.
Section bi. Section bi.
Context {I : biIndex} {PROP : bi}. Context {I : biIndex} {PROP : bi}.
...@@ -39,9 +39,9 @@ Implicit Types 𝓟 𝓠 𝓡 : PROP. ...@@ -39,9 +39,9 @@ Implicit Types 𝓟 𝓠 𝓡 : PROP.
Implicit Types φ : Prop. Implicit Types φ : Prop.
Implicit Types i j : I. Implicit Types i j : I.
Global Instance from_always_absolutely P : Global Instance from_modal_absolutely P :
FromAlways always_modality_absolutely ( P) P | 1. FromModal modality_absolutely ( P) P | 1.
Proof. by rewrite /FromAlways. Qed. Proof. by rewrite /FromModal. Qed.
Global Instance make_monPred_at_pure φ i : MakeMonPredAt i ⌜φ⌝ ⌜φ⌝. Global Instance make_monPred_at_pure φ i : MakeMonPredAt i ⌜φ⌝ ⌜φ⌝.
Proof. by rewrite /MakeMonPredAt monPred_at_pure. Qed. Proof. by rewrite /MakeMonPredAt monPred_at_pure. Qed.
...@@ -154,23 +154,23 @@ Proof. ...@@ -154,23 +154,23 @@ Proof.
by rewrite -monPred_at_persistently -monPred_at_persistently_if. by rewrite -monPred_at_persistently -monPred_at_persistently_if.
Qed. Qed.
Global Instance from_always_affinely_monPred_at P Q 𝓠 i : Global Instance from_modal_affinely_monPred_at P Q 𝓠 i :
FromAlways always_modality_affinely P Q MakeMonPredAt i Q 𝓠 FromModal modality_affinely P Q MakeMonPredAt i Q 𝓠
FromAlways always_modality_affinely (P i) 𝓠 | 0. FromModal modality_affinely (P i) 𝓠 | 0.
Proof. Proof.
rewrite /FromAlways /MakeMonPredAt /==> <- <-. by rewrite monPred_at_affinely. rewrite /FromModal /MakeMonPredAt /==> <- <-. by rewrite monPred_at_affinely.
Qed. Qed.
Global Instance from_always_persistently_monPred_at P Q 𝓠 i : Global Instance from_modal_persistently_monPred_at P Q 𝓠 i :
FromAlways always_modality_persistently P Q MakeMonPredAt i Q 𝓠 FromModal modality_persistently P Q MakeMonPredAt i Q 𝓠
FromAlways always_modality_persistently (P i) 𝓠 | 0. FromModal modality_persistently (P i) 𝓠 | 0.
Proof. Proof.
rewrite /FromAlways /MakeMonPredAt /==> <- <-. by rewrite monPred_at_persistently. rewrite /FromModal /MakeMonPredAt /==> <- <-. by rewrite monPred_at_persistently.
Qed. Qed.
Global Instance from_always_affinely_persistently_monPred_at P Q 𝓠 i : Global Instance from_modal_affinely_persistently_monPred_at P Q 𝓠 i :
FromAlways always_modality_affinely_persistently P Q MakeMonPredAt i Q 𝓠 FromModal modality_affinely_persistently P Q MakeMonPredAt i Q 𝓠
FromAlways always_modality_affinely_persistently (P i) 𝓠 | 0. FromModal modality_affinely_persistently (P i) 𝓠 | 0.
Proof. Proof.
rewrite /FromAlways /MakeMonPredAt /==> <- <-. rewrite /FromModal /MakeMonPredAt /==> <- <-.
by rewrite monPred_at_affinely monPred_at_persistently. by rewrite monPred_at_affinely monPred_at_persistently.
Qed. Qed.
...@@ -348,10 +348,11 @@ Proof. ...@@ -348,10 +348,11 @@ Proof.
?monPred_at_persistently monPred_at_embed. ?monPred_at_persistently monPred_at_embed.
Qed. Qed.
(* FIXME
Global Instance from_modal_monPred_at i P Q 𝓠 : Global Instance from_modal_monPred_at i P Q 𝓠 :
FromModal P Q → MakeMonPredAt i Q 𝓠 → FromModal (P i) 𝓠. FromModal P Q → MakeMonPredAt i Q 𝓠 → FromModal (P i) 𝓠.
Proof. by rewrite /FromModal /MakeMonPredAt=> <- <-. Qed. Proof. by rewrite /FromModal /MakeMonPredAt=> <- <-. Qed.
*)
End bi. End bi.
(* When P and/or Q are evars when doing typeclass search on [IntoWand (* When P and/or Q are evars when doing typeclass search on [IntoWand
......
...@@ -961,31 +961,32 @@ Local Tactic Notation "iExistDestruct" constr(H) ...@@ -961,31 +961,32 @@ Local Tactic Notation "iExistDestruct" constr(H)
[env_reflexivity || fail "iExistDestruct:" Hx "not fresh" [env_reflexivity || fail "iExistDestruct:" Hx "not fresh"
|revert y; intros x]. |revert y; intros x].
(** * Always *) (** * Modality introduction *)
Tactic Notation "iAlways":= Tactic Notation "iModIntro":=
iStartProof; iStartProof;
eapply tac_always_intro; eapply tac_modal_intro;
[apply _ || [apply _ ||
fail "iAlways: the goal is not an always-style modality" fail "iModIntro: the goal is not a modality"
|hnf; env_cbv; |hnf; env_cbv;
apply _ || apply _ ||
lazymatch goal with lazymatch goal with
| |- TCAnd (TCForall ?C _) _ => fail "iAlways: persistent context does not satisfy" C | |- TCAnd (TCForall ?C _) _ => fail "iModIntro: persistent context does not satisfy" C
| |- TCAnd (TCEq _ Enil) _ => fail "iAlways: persistent context is non-empty" | |- TCAnd (TCEq _ Enil) _ => fail "iModIntro: persistent context is non-empty"
end end
|hnf; env_cbv; |hnf; env_cbv;
lazymatch goal with lazymatch goal with
| |- _, TransformSpatialEnv _ _ _ _ _ _ => | |- _, TransformSpatialEnv _ _ _ _ _ _ =>
eexists; split; eexists; split;
[apply _ [apply _
|apply _ || fail "iAlways: cannot filter spatial context when goal is not absorbing"] |apply _ || fail "iModIntro: cannot filter spatial context when goal is not absorbing"]
| |- TCAnd (TCForall ?C _) _ => | |- TCAnd (TCForall ?C _) _ =>
apply _ || fail "iAlways: spatial context does not satisfy" C apply _ || fail "iModIntro: spatial context does not satisfy" C
| |- TCAnd (TCEq _ Enil) _ => | |- TCAnd (TCEq _ Enil) _ =>
apply _ || fail "iAlways: spatial context is non-empty" apply _ || fail "iModIntro: spatial context is non-empty"
| |- _ => apply _ | |- _ => apply _
end end
|env_cbv]. |env_cbv].
Tactic Notation "iAlways" := iModIntro.
(** * Later *) (** * Later *)
Tactic Notation "iNext" open_constr(n) := Tactic Notation "iNext" open_constr(n) :=
...@@ -1006,13 +1007,6 @@ Tactic Notation "iNext" open_constr(n) := ...@@ -1006,13 +1007,6 @@ Tactic Notation "iNext" open_constr(n) :=
Tactic Notation "iNext":= iNext _. Tactic Notation "iNext":= iNext _.
(** * Update modality *) (** * Update modality *)
Tactic Notation "iModIntro" :=
iStartProof;
eapply tac_modal_intro;
[apply _ ||
let P := match goal with |- FromModal ?P _ => P end in
fail "iModIntro:" P "not a modality"|].
Tactic Notation "iModCore" constr(H) := Tactic Notation "iModCore" constr(H) :=
eapply tac_modal_elim with _ H _ _ _ _ _; eapply tac_modal_elim with _ H _ _ _ _ _;
[env_reflexivity || fail "iMod:" H "not found" [env_reflexivity || fail "iMod:" H "not found"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment