Commit 58bd4b02 authored by Robbert Krebbers's avatar Robbert Krebbers

Rename except_last -> except_0.

parent fc3ac148
......@@ -12,11 +12,11 @@ Arguments uPred_always_if _ !_ _/.
Notation "□? p P" := (uPred_always_if p P)
(at level 20, p at level 0, P at level 20, format "□? p P").
Definition uPred_except_last {M} (P : uPred M) : uPred M := False P.
Notation "◇ P" := (uPred_except_last P)
Definition uPred_except_0 {M} (P : uPred M) : uPred M := False P.
Notation "◇ P" := (uPred_except_0 P)
(at level 20, right associativity) : uPred_scope.
Instance: Params (@uPred_except_last) 1.
Typeclasses Opaque uPred_except_last.
Instance: Params (@uPred_except_0) 1.
Typeclasses Opaque uPred_except_0.
Class TimelessP {M} (P : uPred M) := timelessP : P P.
Arguments timelessP {_} _ {_}.
......@@ -547,50 +547,50 @@ Proof. destruct p; simpl; auto using always_later. Qed.
(* True now *)
Global Instance except_last_ne n : Proper (dist n ==> dist n) (@uPred_except_last M).
Global Instance except_0_ne n : Proper (dist n ==> dist n) (@uPred_except_0 M).
Proof. solve_proper. Qed.
Global Instance except_last_proper : Proper (() ==> ()) (@uPred_except_last M).
Global Instance except_0_proper : Proper (() ==> ()) (@uPred_except_0 M).
Proof. solve_proper. Qed.
Global Instance except_last_mono' : Proper (() ==> ()) (@uPred_except_last M).
Global Instance except_0_mono' : Proper (() ==> ()) (@uPred_except_0 M).
Proof. solve_proper. Qed.
Global Instance except_last_flip_mono' :
Proper (flip () ==> flip ()) (@uPred_except_last M).
Global Instance except_0_flip_mono' :
Proper (flip () ==> flip ()) (@uPred_except_0 M).
Proof. solve_proper. Qed.
Lemma except_last_intro P : P P.
Proof. rewrite /uPred_except_last; auto. Qed.
Lemma except_last_mono P Q : (P Q) P Q.
Lemma except_0_intro P : P P.
Proof. rewrite /uPred_except_0; auto. Qed.
Lemma except_0_mono P Q : (P Q) P Q.
Proof. by intros ->. Qed.
Lemma except_last_idemp P : P P.
Proof. rewrite /uPred_except_last; auto. Qed.
Lemma except_last_True : True True.
Proof. rewrite /uPred_except_last. apply (anti_symm _); auto. Qed.
Lemma except_last_or P Q : (P Q) P Q.
Proof. rewrite /uPred_except_last. apply (anti_symm _); auto. Qed.
Lemma except_last_and P Q : (P Q) P Q.
Proof. by rewrite /uPred_except_last or_and_l. Qed.
Lemma except_last_sep P Q : (P Q) P Q.
Proof.
rewrite /uPred_except_last. apply (anti_symm _).
Lemma except_0_idemp P : P P.
Proof. rewrite /uPred_except_0; auto. Qed.
Lemma except_0_True : True True.
Proof. rewrite /uPred_except_0. apply (anti_symm _); auto. Qed.
Lemma except_0_or P Q : (P Q) P Q.
Proof. rewrite /uPred_except_0. apply (anti_symm _); auto. Qed.
Lemma except_0_and P Q : (P Q) P Q.
Proof. by rewrite /uPred_except_0 or_and_l. Qed.
Lemma except_0_sep P Q : (P Q) P Q.
Proof.
rewrite /uPred_except_0. apply (anti_symm _).
- apply or_elim; last by auto.
by rewrite -!or_intro_l -always_pure -always_later -always_sep_dup'.
- rewrite sep_or_r sep_elim_l sep_or_l; auto.
Qed.
Lemma except_last_forall {A} (Φ : A uPred M) : ( a, Φ a) a, Φ a.
Lemma except_0_forall {A} (Φ : A uPred M) : ( a, Φ a) a, Φ a.
Proof. apply forall_intro=> a. by rewrite (forall_elim a). Qed.
Lemma except_last_exist {A} (Φ : A uPred M) : ( a, Φ a) a, Φ a.
Lemma except_0_exist {A} (Φ : A uPred M) : ( a, Φ a) a, Φ a.
Proof. apply exist_elim=> a. by rewrite (exist_intro a). Qed.
Lemma except_last_later P : P P.
Proof. by rewrite /uPred_except_last -later_or False_or. Qed.
Lemma except_last_always P : P P.
Proof. by rewrite /uPred_except_last always_or always_later always_pure. Qed.
Lemma except_last_always_if p P : ?p P ?p P.
Proof. destruct p; simpl; auto using except_last_always. Qed.
Lemma except_last_frame_l P Q : P Q (P Q).
Proof. by rewrite {1}(except_last_intro P) except_last_sep. Qed.
Lemma except_last_frame_r P Q : P Q (P Q).
Proof. by rewrite {1}(except_last_intro Q) except_last_sep. Qed.
Lemma except_0_later P : P P.
Proof. by rewrite /uPred_except_0 -later_or False_or. Qed.
Lemma except_0_always P : P P.
Proof. by rewrite /uPred_except_0 always_or always_later always_pure. Qed.
Lemma except_0_always_if p P : ?p P ?p P.
Proof. destruct p; simpl; auto using except_0_always. Qed.
Lemma except_0_frame_l P Q : P Q (P Q).
Proof. by rewrite {1}(except_0_intro P) except_0_sep. Qed.
Lemma except_0_frame_r P Q : P Q (P Q).
Proof. by rewrite {1}(except_0_intro Q) except_0_sep. Qed.
(* Own and valid derived *)
Lemma always_ownM (a : M) : Persistent a uPred_ownM a uPred_ownM a.
......@@ -628,9 +628,9 @@ Proof.
intros; rewrite (bupd_ownM_updateP _ (y =)); last by apply cmra_update_updateP.
by apply bupd_mono, exist_elim=> y'; apply pure_elim_l=> ->.
Qed.
Lemma except_last_bupd P : (|==> P) (|==> P).
Lemma except_0_bupd P : (|==> P) (|==> P).
Proof.
rewrite /uPred_except_last. apply or_elim; auto using bupd_mono.
rewrite /uPred_except_0. apply or_elim; auto using bupd_mono.
by rewrite -bupd_intro -or_intro_l.
Qed.
......@@ -643,25 +643,25 @@ Global Instance valid_timeless {A : cmraT} `{CMRADiscrete A} (a : A) :
TimelessP ( a : uPred M)%I.
Proof. rewrite /TimelessP !discrete_valid. apply (timelessP _). Qed.
Global Instance and_timeless P Q: TimelessP P TimelessP Q TimelessP (P Q).
Proof. intros; rewrite /TimelessP except_last_and later_and; auto. Qed.
Proof. intros; rewrite /TimelessP except_0_and later_and; auto. Qed.
Global Instance or_timeless P Q : TimelessP P TimelessP Q TimelessP (P Q).
Proof. intros; rewrite /TimelessP except_last_or later_or; auto. Qed.
Proof. intros; rewrite /TimelessP except_0_or later_or; auto. Qed.
Global Instance impl_timeless P Q : TimelessP Q TimelessP (P Q).
Proof.
rewrite /TimelessP=> HQ. rewrite later_false_excluded_middle.
apply or_mono, impl_intro_l; first done.
rewrite -{2}(löb Q); apply impl_intro_l.
rewrite HQ /uPred_except_last !and_or_r. apply or_elim; last auto.
rewrite HQ /uPred_except_0 !and_or_r. apply or_elim; last auto.
by rewrite assoc (comm _ _ P) -assoc !impl_elim_r.
Qed.
Global Instance sep_timeless P Q: TimelessP P TimelessP Q TimelessP (P Q).
Proof. intros; rewrite /TimelessP except_last_sep later_sep; auto. Qed.
Proof. intros; rewrite /TimelessP except_0_sep later_sep; auto. Qed.
Global Instance wand_timeless P Q : TimelessP Q TimelessP (P - Q).
Proof.
rewrite /TimelessP=> HQ. rewrite later_false_excluded_middle.
apply or_mono, wand_intro_l; first done.
rewrite -{2}(löb Q); apply impl_intro_l.
rewrite HQ /uPred_except_last !and_or_r. apply or_elim; last auto.
rewrite HQ /uPred_except_0 !and_or_r. apply or_elim; last auto.
rewrite -(always_pure) -always_later always_and_sep_l'.
by rewrite assoc (comm _ _ P) -assoc -always_and_sep_l' impl_elim_r wand_elim_r.
Qed.
......@@ -671,18 +671,18 @@ Proof.
rewrite /TimelessP=> HQ. rewrite later_false_excluded_middle.
apply or_mono; first done. apply forall_intro=> x.
rewrite -(löb (Ψ x)); apply impl_intro_l.
rewrite HQ /uPred_except_last !and_or_r. apply or_elim; last auto.
rewrite HQ /uPred_except_0 !and_or_r. apply or_elim; last auto.
by rewrite impl_elim_r (forall_elim x).
Qed.
Global Instance exist_timeless {A} (Ψ : A uPred M) :
( x, TimelessP (Ψ x)) TimelessP ( x, Ψ x).
Proof.
rewrite /TimelessP=> ?. rewrite later_exist_false. apply or_elim.
- rewrite /uPred_except_last; auto.
- rewrite /uPred_except_0; auto.
- apply exist_elim=> x. rewrite -(exist_intro x); auto.
Qed.
Global Instance always_timeless P : TimelessP P TimelessP ( P).
Proof. intros; rewrite /TimelessP except_last_always -always_later; auto. Qed.
Proof. intros; rewrite /TimelessP except_0_always -always_later; auto. Qed.
Global Instance always_if_timeless p P : TimelessP P TimelessP (?p P).
Proof. destruct p; apply _. Qed.
Global Instance eq_timeless {A : cofeT} (a b : A) :
......@@ -691,8 +691,8 @@ Proof. intros. rewrite /TimelessP !timeless_eq. apply (timelessP _). Qed.
Global Instance ownM_timeless (a : M) : Timeless a TimelessP (uPred_ownM a).
Proof.
intros ?. rewrite /TimelessP later_ownM. apply exist_elim=> b.
rewrite (timelessP (ab)) (except_last_intro (uPred_ownM b)) -except_last_and.
apply except_last_mono. rewrite eq_sym.
rewrite (timelessP (ab)) (except_0_intro (uPred_ownM b)) -except_0_and.
apply except_0_mono. rewrite eq_sym.
apply (eq_rewrite b a (uPred_ownM)); first apply _; auto.
Qed.
......
......@@ -52,11 +52,11 @@ Lemma fupd_intro_mask E1 E2 P : E2 ⊆ E1 → P ⊢ |={E1,E2}=> |={E2,E1}=> P.
Proof.
intros (E1''&->&?)%subseteq_disjoint_union_L.
rewrite fupd_eq /fupd_def ownE_op //. iIntros "H ($ & $ & HE) !==>".
iApply except_last_intro. iIntros "[$ $] !==>" . iApply except_last_intro.
iApply except_0_intro. iIntros "[$ $] !==>" . iApply except_0_intro.
by iFrame.
Qed.
Lemma except_last_fupd E1 E2 P : (|={E1,E2}=> P) ={E1,E2}= P.
Lemma except_0_fupd E1 E2 P : (|={E1,E2}=> P) ={E1,E2}= P.
Proof.
rewrite fupd_eq. iIntros "H [Hw HE]". iTimeless "H". iApply "H"; by iFrame.
Qed.
......@@ -64,7 +64,7 @@ Qed.
Lemma bupd_fupd E P : (|==> P) ={E}= P.
Proof.
rewrite fupd_eq /fupd_def. iIntros "H [$ $]"; iUpd "H".
iUpdIntro. by iApply except_last_intro.
iUpdIntro. by iApply except_0_intro.
Qed.
Lemma fupd_mono E1 E2 P Q : (P Q) (|={E1,E2}=> P) ={E1,E2}= Q.
......@@ -85,7 +85,7 @@ Proof.
intros. rewrite fupd_eq /fupd_def ownE_op //. iIntros "Hvs (Hw & HE1 &HEf)".
iUpd ("Hvs" with "[Hw HE1]") as ">($ & HE2 & HP)"; first by iFrame.
iDestruct (ownE_op' with "[HE2 HEf]") as "[? $]"; first by iFrame.
iUpdIntro; iApply except_last_intro. by iApply "HP".
iUpdIntro; iApply except_0_intro. by iApply "HP".
Qed.
Lemma fupd_frame_r E1 E2 P Q : (|={E1,E2}=> P) Q ={E1,E2}= P Q.
......@@ -102,8 +102,8 @@ Lemma fupd_intro E P : P ={E}=★ P.
Proof. iIntros "HP". by iApply bupd_fupd. Qed.
Lemma fupd_intro_mask' E1 E2 : E2 E1 True |={E1,E2}=> |={E2,E1}=> True.
Proof. exact: fupd_intro_mask. Qed.
Lemma fupd_except_last E1 E2 P : (|={E1,E2}=> P) ={E1,E2}= P.
Proof. by rewrite {1}(fupd_intro E2 P) except_last_fupd fupd_trans. Qed.
Lemma fupd_except_0 E1 E2 P : (|={E1,E2}=> P) ={E1,E2}= P.
Proof. by rewrite {1}(fupd_intro E2 P) except_0_fupd fupd_trans. Qed.
Lemma fupd_frame_l E1 E2 P Q : (P |={E1,E2}=> Q) ={E1,E2}= P Q.
Proof. rewrite !(comm _ P); apply fupd_frame_r. Qed.
......@@ -180,8 +180,8 @@ Section proofmode_classes.
Frame R P Q Frame R (|={E1,E2}=> P) (|={E1,E2}=> Q).
Proof. rewrite /Frame=><-. by rewrite fupd_frame_l. Qed.
Global Instance is_except_last_fupd E1 E2 P : IsExceptLast (|={E1,E2}=> P).
Proof. by rewrite /IsExceptLast except_last_fupd. Qed.
Global Instance is_except_0_fupd E1 E2 P : IsExcept0 (|={E1,E2}=> P).
Proof. by rewrite /IsExcept0 except_0_fupd. Qed.
Global Instance from_upd_fupd E P : FromUpd (|={E}=> P) P.
Proof. by rewrite /FromUpd -bupd_fupd. Qed.
......
......@@ -39,7 +39,7 @@ Proof.
eapply nclose_infinite, (difference_finite_inv _ _), Hfin.
apply of_gset_finite.
- by iFrame.
- rewrite /uPred_except_last; eauto.
- rewrite /uPred_except_0; eauto.
Qed.
Lemma inv_open E N P :
......@@ -49,9 +49,9 @@ Proof.
iDestruct "Hi" as % ?%elem_of_subseteq_singleton.
rewrite {1 4}(union_difference_L (nclose N) E) // ownE_op; last set_solver.
rewrite {1 5}(union_difference_L {[ i ]} (nclose N)) // ownE_op; last set_solver.
iIntros "(Hw & [HE $] & $)"; iUpdIntro; iApply except_last_intro.
iIntros "(Hw & [HE $] & $)"; iUpdIntro; iApply except_0_intro.
iDestruct (ownI_open i P with "[Hw HE]") as "($ & $ & HD)"; first by iFrame.
iIntros "HP [Hw $] !==>"; iApply except_last_intro. iApply ownI_close; by iFrame.
iIntros "HP [Hw $] !==>"; iApply except_0_intro. iApply ownI_close; by iFrame.
Qed.
Lemma inv_open_timeless E N P `{!TimelessP P} :
......
......@@ -222,8 +222,8 @@ Section proofmode_classes.
( v, Frame R (Φ v) (Ψ v)) Frame R (WP e @ E {{ Φ }}) (WP e @ E {{ Ψ }}).
Proof. rewrite /Frame=> HR. rewrite wp_frame_l. apply wp_mono, HR. Qed.
Global Instance is_except_last_wp E e Φ : IsExceptLast (WP e @ E {{ Φ }}).
Proof. by rewrite /IsExceptLast -{2}fupd_wp -except_last_fupd -fupd_intro. Qed.
Global Instance is_except_0_wp E e Φ : IsExcept0 (WP e @ E {{ Φ }}).
Proof. by rewrite /IsExcept0 -{2}fupd_wp -except_0_fupd -fupd_intro. Qed.
Global Instance elim_upd_bupd_wp E e P Φ :
ElimUpd (|==> P) P (WP e @ E {{ Φ }}) (WP e @ E {{ Φ }}).
......
......@@ -298,17 +298,17 @@ Proof.
rewrite /Frame /MakeLater /IntoLater=>-> <- <-. by rewrite later_sep.
Qed.
Class MakeExceptLast (P Q : uPred M) := make_except_last : P Q.
Global Instance make_except_last_True : MakeExceptLast True True.
Proof. by rewrite /MakeExceptLast except_last_True. Qed.
Global Instance make_except_last_default P : MakeExceptLast P ( P) | 100.
Class MakeExcept0 (P Q : uPred M) := make_except_0 : P Q.
Global Instance make_except_0_True : MakeExcept0 True True.
Proof. by rewrite /MakeExcept0 except_0_True. Qed.
Global Instance make_except_0_default P : MakeExcept0 P ( P) | 100.
Proof. done. Qed.
Global Instance frame_except_last R P Q Q' :
Frame R P Q MakeExceptLast Q Q' Frame R ( P) Q'.
Global Instance frame_except_0 R P Q Q' :
Frame R P Q MakeExcept0 Q Q' Frame R ( P) Q'.
Proof.
rewrite /Frame /MakeExceptLast=><- <-.
by rewrite except_last_sep -(except_last_intro R).
rewrite /Frame /MakeExcept0=><- <-.
by rewrite except_0_sep -(except_0_intro R).
Qed.
Global Instance frame_exist {A} R (Φ Ψ : A uPred M) :
......@@ -357,21 +357,21 @@ Global Instance into_exist_always {A} P (Φ : A → uPred M) :
IntoExist P Φ IntoExist ( P) (λ a, (Φ a))%I.
Proof. rewrite /IntoExist=> HP. by rewrite HP always_exist. Qed.
(* IntoExceptLast *)
Global Instance into_except_last_except_last P : IntoExceptLast ( P) P.
(* IntoExcept0 *)
Global Instance into_except_0_except_0 P : IntoExcept0 ( P) P.
Proof. done. Qed.
Global Instance into_except_last_timeless P : TimelessP P IntoExceptLast ( P) P.
Global Instance into_except_0_timeless P : TimelessP P IntoExcept0 ( P) P.
Proof. done. Qed.
(* IsExceptLast *)
Global Instance is_except_last_except_last P : IsExceptLast ( P).
Proof. by rewrite /IsExceptLast except_last_idemp. Qed.
Global Instance is_except_last_later P : IsExceptLast ( P).
Proof. by rewrite /IsExceptLast except_last_later. Qed.
Global Instance is_except_last_bupd P : IsExceptLast P IsExceptLast (|==> P).
(* IsExcept0 *)
Global Instance is_except_0_except_0 P : IsExcept0 ( P).
Proof. by rewrite /IsExcept0 except_0_idemp. Qed.
Global Instance is_except_0_later P : IsExcept0 ( P).
Proof. by rewrite /IsExcept0 except_0_later. Qed.
Global Instance is_except_0_bupd P : IsExcept0 P IsExcept0 (|==> P).
Proof.
rewrite /IsExceptLast=> HP.
by rewrite -{2}HP -(except_last_idemp P) -except_last_bupd -(except_last_intro P).
rewrite /IsExcept0=> HP.
by rewrite -{2}HP -(except_0_idemp P) -except_0_bupd -(except_0_intro P).
Qed.
(* FromUpd *)
......
......@@ -62,11 +62,11 @@ Class IntoExist {A} (P : uPred M) (Φ : A → uPred M) :=
into_exist : P x, Φ x.
Global Arguments into_exist {_} _ _ {_}.
Class IntoExceptLast (P Q : uPred M) := into_except_last : P Q.
Global Arguments into_except_last : clear implicits.
Class IntoExcept0 (P Q : uPred M) := into_except_0 : P Q.
Global Arguments into_except_0 : clear implicits.
Class IsExceptLast (Q : uPred M) := is_except_last : Q Q.
Global Arguments is_except_last : clear implicits.
Class IsExcept0 (Q : uPred M) := is_except_0 : Q Q.
Global Arguments is_except_0 : clear implicits.
Class FromUpd (P Q : uPred M) := from_upd : (|==> Q) P.
Global Arguments from_upd : clear implicits.
......
......@@ -446,14 +446,14 @@ Proof.
Qed.
Lemma tac_timeless Δ Δ' i p P P' Q :
IsExceptLast Q
envs_lookup i Δ = Some (p, P) IntoExceptLast P P'
IsExcept0 Q
envs_lookup i Δ = Some (p, P) IntoExcept0 P P'
envs_simple_replace i p (Esnoc Enil i P') Δ = Some Δ'
(Δ' Q) Δ Q.
Proof.
intros ???? HQ. rewrite envs_simple_replace_sound //; simpl.
rewrite right_id HQ -{2}(is_except_last Q).
by rewrite (into_except_last P) -except_last_always_if except_last_frame_r wand_elim_r.
rewrite right_id HQ -{2}(is_except_0 Q).
by rewrite (into_except_0 P) -except_0_always_if except_0_frame_r wand_elim_r.
Qed.
(** * Always *)
......
......@@ -612,10 +612,10 @@ Tactic Notation "iNext":=
Tactic Notation "iTimeless" constr(H) :=
eapply tac_timeless with _ H _ _ _;
[let Q := match goal with |- IsExceptLast ?Q => Q end in
[let Q := match goal with |- IsExcept0 ?Q => Q end in
apply _ || fail "iTimeless: cannot remove later when goal is" Q
|env_cbv; reflexivity || fail "iTimeless:" H "not found"
|let P := match goal with |- IntoExceptLast ?P _ => P end in
|let P := match goal with |- IntoExcept0 ?P _ => P end in
apply _ || fail "iTimeless: cannot turn" P "into ◇"
|env_cbv; reflexivity|].
......
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