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