Commit 15bfdc15 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Redefine big ops to get more definitional equalities.

parent a378b828
coq-stdpp https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp 0ac2b4db07bdc471421c5a4c47789087b3df074c coq-stdpp https://gitlab.mpi-sws.org/robbertkrebbers/coq-stdpp a0ce0937cfabe16a184af2d92c0466ebacecbca2
This diff is collapsed.
...@@ -23,15 +23,15 @@ Module ra_reflection. Section ra_reflection. ...@@ -23,15 +23,15 @@ Module ra_reflection. Section ra_reflection.
| EOp e1 e2 => flatten e1 ++ flatten e2 | EOp e1 e2 => flatten e1 ++ flatten e2
end. end.
Lemma eval_flatten Σ e : Lemma eval_flatten Σ e :
eval Σ e big_op ((λ n, from_option id (Σ !! n)) <$> flatten e). eval Σ e [ list] n flatten e, from_option id (Σ !! n).
Proof. Proof.
induction e as [| |e1 IH1 e2 IH2]; rewrite /= ?right_id //. induction e as [| |e1 IH1 e2 IH2]; rewrite /= ?right_id //.
by rewrite fmap_app IH1 IH2 big_op_app. by rewrite IH1 IH2 big_opL_app.
Qed. Qed.
Lemma flatten_correct Σ e1 e2 : Lemma flatten_correct Σ e1 e2 :
flatten e1 + flatten e2 eval Σ e1 eval Σ e2. flatten e1 + flatten e2 eval Σ e1 eval Σ e2.
Proof. Proof.
by intros He; rewrite !eval_flatten; apply big_op_submseteq; rewrite ->He. by intros He; rewrite !eval_flatten; apply big_opL_submseteq; rewrite ->He.
Qed. Qed.
Class Quote (Σ1 Σ2 : list A) (l : A) (e : expr) := {}. Class Quote (Σ1 Σ2 : list A) (l : A) (e : expr) := {}.
......
...@@ -85,27 +85,28 @@ Arguments uPredR : clear implicits. ...@@ -85,27 +85,28 @@ Arguments uPredR : clear implicits.
Arguments uPredUR : clear implicits. Arguments uPredUR : clear implicits.
(* Notations *) (* Notations *)
Notation "'[∗]' Ps" := (big_op (M:=uPredUR _) Ps) (at level 20) : uPred_scope. Notation "'[∗' 'list' ] k ↦ x ∈ l , P" := (big_opL (M:=uPredUR _) (λ k x, P) l)
Notation "'[∗' 'list' ] k ↦ x ∈ l , P" := (big_opL (M:=uPredUR _) l (λ k x, P))
(at level 200, l at level 10, k, x at level 1, right associativity, (at level 200, l at level 10, k, x at level 1, right associativity,
format "[∗ list ] k ↦ x ∈ l , P") : uPred_scope. format "[∗ list ] k ↦ x ∈ l , P") : uPred_scope.
Notation "'[∗' 'list' ] x ∈ l , P" := (big_opL (M:=uPredUR _) l (λ _ x, P)) Notation "'[∗' 'list' ] x ∈ l , P" := (big_opL (M:=uPredUR _) (λ _ x, P) l)
(at level 200, l at level 10, x at level 1, right associativity, (at level 200, l at level 10, x at level 1, right associativity,
format "[∗ list ] x ∈ l , P") : uPred_scope. format "[∗ list ] x ∈ l , P") : uPred_scope.
Notation "'[∗' 'map' ] k ↦ x ∈ m , P" := (big_opM (M:=uPredUR _) m (λ k x, P)) Notation "'[∗]' Ps" :=
(big_opL (M:=uPredUR _) (λ _ x, x) Ps) (at level 20) : uPred_scope.
Notation "'[∗' 'map' ] k ↦ x ∈ m , P" := (big_opM (M:=uPredUR _) (λ k x, P) m)
(at level 200, m at level 10, k, x at level 1, right associativity, (at level 200, m at level 10, k, x at level 1, right associativity,
format "[∗ map ] k ↦ x ∈ m , P") : uPred_scope. format "[∗ map ] k ↦ x ∈ m , P") : uPred_scope.
Notation "'[∗' 'map' ] x ∈ m , P" := (big_opM (M:=uPredUR _) m (λ _ x, P)) Notation "'[∗' 'map' ] x ∈ m , P" := (big_opM (M:=uPredUR _) (λ _ x, P) m)
(at level 200, m at level 10, x at level 1, right associativity, (at level 200, m at level 10, x at level 1, right associativity,
format "[∗ map ] x ∈ m , P") : uPred_scope. format "[∗ map ] x ∈ m , P") : uPred_scope.
Notation "'[∗' 'set' ] x ∈ X , P" := (big_opS (M:=uPredUR _) X (λ x, P)) Notation "'[∗' 'set' ] x ∈ X , P" := (big_opS (M:=uPredUR _) (λ x, P) X)
(at level 200, X at level 10, x at level 1, right associativity, (at level 200, X at level 10, x at level 1, right associativity,
format "[∗ set ] x ∈ X , P") : uPred_scope. format "[∗ set ] x ∈ X , P") : uPred_scope.
Notation "'[∗' 'mset' ] x ∈ X , P" := (big_opMS (M:=uPredUR _) X (λ x, P)) Notation "'[∗' 'mset' ] x ∈ X , P" := (big_opMS (M:=uPredUR _) (λ x, P) X)
(at level 200, X at level 10, x at level 1, right associativity, (at level 200, X at level 10, x at level 1, right associativity,
format "[∗ mset ] x ∈ X , P") : uPred_scope. format "[∗ mset ] x ∈ X , P") : uPred_scope.
...@@ -126,24 +127,6 @@ Context {M : ucmraT}. ...@@ -126,24 +127,6 @@ Context {M : ucmraT}.
Implicit Types Ps Qs : list (uPred M). Implicit Types Ps Qs : list (uPred M).
Implicit Types A : Type. Implicit Types A : Type.
Global Instance big_sep_mono' :
Proper (Forall2 () ==> ()) (big_op (M:=uPredUR M)).
Proof. by induction 1 as [|P Q Ps Qs HPQ ? IH]; rewrite /= ?HPQ ?IH. Qed.
Lemma big_sep_app Ps Qs : [] (Ps ++ Qs) [] Ps [] Qs.
Proof. by rewrite big_op_app. Qed.
Lemma big_sep_submseteq Ps Qs : Qs + Ps [] Ps [] Qs.
Proof. intros. apply uPred_included. by apply: big_op_submseteq. Qed.
Lemma big_sep_elem_of Ps P : P Ps [] Ps P.
Proof. intros. apply uPred_included. by apply: big_sep_elem_of. Qed.
Lemma big_sep_elem_of_acc Ps P : P Ps [] Ps P (P - [] Ps).
Proof. intros [k ->]%elem_of_Permutation. by apply sep_mono_r, wand_intro_l. Qed.
(** ** Persistence *)
Global Instance big_sep_persistent Ps : PersistentL Ps PersistentP ([] Ps).
Proof. induction 1; apply _. Qed.
Global Instance nil_persistent : PersistentL (@nil (uPred M)). Global Instance nil_persistent : PersistentL (@nil (uPred M)).
Proof. constructor. Qed. Proof. constructor. Qed.
Global Instance cons_persistent P Ps : Global Instance cons_persistent P Ps :
...@@ -163,9 +146,7 @@ Proof. ...@@ -163,9 +146,7 @@ Proof.
Qed. Qed.
Global Instance imap_persistent {A} (f : nat A uPred M) xs : Global Instance imap_persistent {A} (f : nat A uPred M) xs :
( i x, PersistentP (f i x)) PersistentL (imap f xs). ( i x, PersistentP (f i x)) PersistentL (imap f xs).
Proof. Proof. revert f. induction xs; simpl; constructor; naive_solver. Qed.
rewrite /PersistentL /imap=> ?. generalize 0. induction xs; constructor; auto.
Qed.
(** ** Timelessness *) (** ** Timelessness *)
Global Instance big_sep_timeless Ps : TimelessL Ps TimelessP ([] Ps). Global Instance big_sep_timeless Ps : TimelessL Ps TimelessP ([] Ps).
...@@ -190,9 +171,7 @@ Proof. ...@@ -190,9 +171,7 @@ Proof.
Qed. Qed.
Global Instance imap_timeless {A} (f : nat A uPred M) xs : Global Instance imap_timeless {A} (f : nat A uPred M) xs :
( i x, TimelessP (f i x)) TimelessL (imap f xs). ( i x, TimelessP (f i x)) TimelessL (imap f xs).
Proof. Proof. revert f. induction xs; simpl; constructor; naive_solver. Qed.
rewrite /TimelessL /imap=> ?. generalize 0. induction xs; constructor; auto.
Qed.
(** ** Big ops over lists *) (** ** Big ops over lists *)
Section list. Section list.
...@@ -226,17 +205,21 @@ Section list. ...@@ -226,17 +205,21 @@ Section list.
l1 + l2 ([ list] y l2, Φ y) [ list] y l1, Φ y. l1 + l2 ([ list] y l2, Φ y) [ list] y l1, Φ y.
Proof. intros ?. apply uPred_included. by apply: big_opL_submseteq. Qed. Proof. intros ?. apply uPred_included. by apply: big_opL_submseteq. Qed.
Global Instance big_sepL_mono' l : Global Instance big_sepL_mono' :
Proper (pointwise_relation _ (pointwise_relation _ ()) ==> ()) Proper (pointwise_relation _ (pointwise_relation _ ()) ==> (=) ==> ())
(big_opL (M:=uPredUR M) l). (big_opL (M:=uPredUR M) (A:=A)).
Proof. intros f g Hf. apply big_opL_forall; apply _ || intros; apply Hf. Qed. Proof. intros f g Hf m ? <-. apply big_opL_forall; apply _ || intros; apply Hf. Qed.
Global Instance big_sep_mono' :
Proper (Forall2 () ==> ()) (big_opL (M:=uPredUR M) (λ _ P, P)).
Proof. by induction 1 as [|P Q Ps Qs HPQ ? IH]; rewrite /= ?HPQ ?IH. Qed.
Lemma big_sepL_lookup_acc Φ l i x : Lemma big_sepL_lookup_acc Φ l i x :
l !! i = Some x l !! i = Some x
([ list] ky l, Φ k y) Φ i x (Φ i x - ([ list] ky l, Φ k y)). ([ list] ky l, Φ k y) Φ i x (Φ i x - ([ list] ky l, Φ k y)).
Proof. Proof.
intros Hli. apply big_sep_elem_of_acc, (elem_of_list_lookup_2 _ i). intros Hli. rewrite -(take_drop_middle l i x) // big_sepL_app /=.
by rewrite list_lookup_imap Hli. rewrite Nat.add_0_r take_length_le; eauto using lookup_lt_Some, Nat.lt_le_incl.
rewrite assoc -!(comm _ (Φ _ _)) -assoc. by apply sep_mono_r, wand_intro_l.
Qed. Qed.
Lemma big_sepL_lookup Φ l i x : Lemma big_sepL_lookup Φ l i x :
...@@ -303,16 +286,21 @@ Section list. ...@@ -303,16 +286,21 @@ Section list.
Global Instance big_sepL_nil_persistent Φ : Global Instance big_sepL_nil_persistent Φ :
PersistentP ([ list] kx [], Φ k x). PersistentP ([ list] kx [], Φ k x).
Proof. rewrite /big_opL. apply _. Qed. Proof. apply _. Qed.
Global Instance big_sepL_persistent Φ l : Global Instance big_sepL_persistent Φ l :
( k x, PersistentP (Φ k x)) PersistentP ([ list] kx l, Φ k x). ( k x, PersistentP (Φ k x)) PersistentP ([ list] kx l, Φ k x).
Proof. rewrite /big_opL. apply _. Qed. Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
Global Instance big_sepL_persistent_id Ps : PersistentL Ps PersistentP ([] Ps).
Proof. induction 1; apply _. Qed.
Global Instance big_sepL_nil_timeless Φ : Global Instance big_sepL_nil_timeless Φ :
TimelessP ([ list] kx [], Φ k x). TimelessP ([ list] kx [], Φ k x).
Proof. rewrite /big_opL. apply _. Qed. Proof. apply _. Qed.
Global Instance big_sepL_timeless Φ l : Global Instance big_sepL_timeless Φ l :
( k x, TimelessP (Φ k x)) TimelessP ([ list] kx l, Φ k x). ( k x, TimelessP (Φ k x)) TimelessP ([ list] kx l, Φ k x).
Proof. rewrite /big_opL. apply _. Qed. Proof. revert Φ. induction l as [|x l IH]=> Φ ? /=; apply _. Qed.
Global Instance big_sepL_timeless_id Ps : TimelessL Ps TimelessP ([] Ps).
Proof. induction 1; apply _. Qed.
End list. End list.
Section list2. Section list2.
...@@ -325,13 +313,13 @@ Section list2. ...@@ -325,13 +313,13 @@ Section list2.
([ list] kx zip_with f l1 l2, Φ k x) ([ list] kx zip_with f l1 l2, Φ k x)
([ list] kx l1, y, l2 !! k = Some y Φ k (f x y)). ([ list] kx l1, y, l2 !! k = Some y Φ k (f x y)).
Proof. Proof.
revert Φ l2; induction l1 as [|x l1 IH]=> Φ [|y l2]//=. revert Φ l2; induction l1 as [|x l1 IH]=> Φ [|y l2]//.
- rewrite big_sepL_nil. apply (anti_symm _), True_intro. - apply (anti_symm _), True_intro.
trans ([ list] __ x :: l1, True : uPred M)%I. trans ([ list] __ x :: l1, True : uPred M)%I.
+ rewrite big_sepL_forall. auto using forall_intro, impl_intro_l, True_intro. + rewrite big_sepL_forall. auto using forall_intro, impl_intro_l, True_intro.
+ apply big_sepL_mono=> k y _. apply forall_intro=> z. + apply big_sepL_mono=> k y _. apply forall_intro=> z.
by apply impl_intro_l, pure_elim_l. by apply impl_intro_l, pure_elim_l.
- rewrite !big_sepL_cons IH. apply sep_proper=> //. apply (anti_symm _). - rewrite /= IH. apply sep_proper=> //. apply (anti_symm _).
+ apply forall_intro=>z /=. by apply impl_intro_r, pure_elim_r=>-[->]. + apply forall_intro=>z /=. by apply impl_intro_r, pure_elim_r=>-[->].
+ rewrite (forall_elim y) /=. by eapply impl_elim, pure_intro. + rewrite (forall_elim y) /=. by eapply impl_elim, pure_intro.
Qed. Qed.
...@@ -348,8 +336,7 @@ Section gmap. ...@@ -348,8 +336,7 @@ Section gmap.
([ map] k x m1, Φ k x) [ map] k x m2, Ψ k x. ([ map] k x m1, Φ k x) [ map] k x m2, Ψ k x.
Proof. Proof.
intros Hm HΦ. trans ([ map] kx m2, Φ k x)%I. intros Hm HΦ. trans ([ map] kx m2, Φ k x)%I.
- apply uPred_included. apply: big_op_submseteq. - rewrite /big_opM. by apply big_sepL_submseteq, map_to_list_submseteq.
by apply fmap_submseteq, map_to_list_submseteq.
- apply big_opM_forall; apply _ || auto. - apply big_opM_forall; apply _ || auto.
Qed. Qed.
Lemma big_sepM_proper Φ Ψ m : Lemma big_sepM_proper Φ Ψ m :
...@@ -357,10 +344,10 @@ Section gmap. ...@@ -357,10 +344,10 @@ Section gmap.
([ map] k x m, Φ k x) ([ map] k x m, Ψ k x). ([ map] k x m, Φ k x) ([ map] k x m, Ψ k x).
Proof. apply big_opM_proper. Qed. Proof. apply big_opM_proper. Qed.
Global Instance big_sepM_mono' m : Global Instance big_sepM_mono' :
Proper (pointwise_relation _ (pointwise_relation _ ()) ==> ()) Proper (pointwise_relation _ (pointwise_relation _ ()) ==> (=) ==> ())
(big_opM (M:=uPredUR M) m). (big_opM (M:=uPredUR M) (A:=A)).
Proof. intros f g Hf. apply big_opM_forall; apply _ || intros; apply Hf. Qed. Proof. intros f g Hf m ? <-. apply big_opM_forall; apply _ || intros; apply Hf. Qed.
Lemma big_sepM_empty Φ : ([ map] kx , Φ k x) True. Lemma big_sepM_empty Φ : ([ map] kx , Φ k x) True.
Proof. by rewrite big_opM_empty. Qed. Proof. by rewrite big_opM_empty. Qed.
...@@ -493,13 +480,13 @@ Section gmap. ...@@ -493,13 +480,13 @@ Section gmap.
Proof. rewrite /big_opM map_to_list_empty. apply _. Qed. Proof. rewrite /big_opM map_to_list_empty. apply _. Qed.
Global Instance big_sepM_persistent Φ m : Global Instance big_sepM_persistent Φ m :
( k x, PersistentP (Φ k x)) PersistentP ([ map] kx m, Φ k x). ( k x, PersistentP (Φ k x)) PersistentP ([ map] kx m, Φ k x).
Proof. intros. apply big_sep_persistent, fmap_persistent=>-[??] /=; auto. Qed. Proof. intros. apply big_sepL_persistent=> _ [??]; apply _. Qed.
Global Instance big_sepM_nil_timeless Φ : Global Instance big_sepM_nil_timeless Φ :
TimelessP ([ map] kx , Φ k x). TimelessP ([ map] kx , Φ k x).
Proof. rewrite /big_opM map_to_list_empty. apply _. Qed. Proof. rewrite /big_opM map_to_list_empty. apply _. Qed.
Global Instance big_sepM_timeless Φ m : Global Instance big_sepM_timeless Φ m :
( k x, TimelessP (Φ k x)) TimelessP ([ map] kx m, Φ k x). ( k x, TimelessP (Φ k x)) TimelessP ([ map] kx m, Φ k x).
Proof. intro. apply big_sep_timeless, fmap_timeless=> -[??] /=; auto. Qed. Proof. intros. apply big_sepL_timeless=> _ [??]; apply _. Qed.
End gmap. End gmap.
...@@ -514,8 +501,7 @@ Section gset. ...@@ -514,8 +501,7 @@ Section gset.
([ set] x X, Φ x) [ set] x Y, Ψ x. ([ set] x X, Φ x) [ set] x Y, Ψ x.
Proof. Proof.
intros HX HΦ. trans ([ set] x Y, Φ x)%I. intros HX HΦ. trans ([ set] x Y, Φ x)%I.
- apply uPred_included. apply: big_op_submseteq. - rewrite /big_opM. by apply big_sepL_submseteq, elements_submseteq.
by apply fmap_submseteq, elements_submseteq.
- apply big_opS_forall; apply _ || auto. - apply big_opS_forall; apply _ || auto.
Qed. Qed.
Lemma big_sepS_proper Φ Ψ X : Lemma big_sepS_proper Φ Ψ X :
...@@ -523,9 +509,9 @@ Section gset. ...@@ -523,9 +509,9 @@ Section gset.
([ set] x X, Φ x) ([ set] x X, Ψ x). ([ set] x X, Φ x) ([ set] x X, Ψ x).
Proof. apply: big_opS_proper. Qed. Proof. apply: big_opS_proper. Qed.
Global Instance big_sepS_mono' X : Global Instance big_sepS_mono' :
Proper (pointwise_relation _ () ==> ()) (big_opS (M:=uPredUR M) X). Proper (pointwise_relation _ () ==> (=) ==> ()) (big_opS (M:=uPredUR M) (A:=A)).
Proof. intros f g Hf. apply big_opS_forall; apply _ || intros; apply Hf. Qed. Proof. intros f g Hf m ? <-. apply big_opS_forall; apply _ || intros; apply Hf. Qed.
Lemma big_sepS_empty Φ : ([ set] x , Φ x) True. Lemma big_sepS_empty Φ : ([ set] x , Φ x) True.
Proof. by rewrite big_opS_empty. Qed. Proof. by rewrite big_opS_empty. Qed.
...@@ -665,8 +651,7 @@ Section gmultiset. ...@@ -665,8 +651,7 @@ Section gmultiset.
([ mset] x X, Φ x) [ mset] x Y, Ψ x. ([ mset] x X, Φ x) [ mset] x Y, Ψ x.
Proof. Proof.
intros HX HΦ. trans ([ mset] x Y, Φ x)%I. intros HX HΦ. trans ([ mset] x Y, Φ x)%I.
- apply uPred_included. apply: big_op_submseteq. - rewrite /big_opM. by apply big_sepL_submseteq, gmultiset_elements_submseteq.
by apply fmap_submseteq, gmultiset_elements_submseteq.
- apply big_opMS_forall; apply _ || auto. - apply big_opMS_forall; apply _ || auto.
Qed. Qed.
Lemma big_sepMS_proper Φ Ψ X : Lemma big_sepMS_proper Φ Ψ X :
...@@ -674,9 +659,9 @@ Section gmultiset. ...@@ -674,9 +659,9 @@ Section gmultiset.
([ mset] x X, Φ x) ([ mset] x X, Ψ x). ([ mset] x X, Φ x) ([ mset] x X, Ψ x).
Proof. apply: big_opMS_proper. Qed. Proof. apply: big_opMS_proper. Qed.
Global Instance big_sepMS_mono' X : Global Instance big_sepMS_mono' :
Proper (pointwise_relation _ () ==> ()) (big_opMS (M:=uPredUR M) X). Proper (pointwise_relation _ () ==> (=) ==> ()) (big_opMS (M:=uPredUR M) (A:=A)).
Proof. intros f g Hf. apply big_opMS_forall; apply _ || intros; apply Hf. Qed. Proof. intros f g Hf m ? <-. apply big_opMS_forall; apply _ || intros; apply Hf. Qed.
Lemma big_sepMS_empty Φ : ([ mset] x , Φ x) True. Lemma big_sepMS_empty Φ : ([ mset] x , Φ x) True.
Proof. by rewrite big_opMS_empty. Qed. Proof. by rewrite big_opMS_empty. Qed.
......
...@@ -23,17 +23,16 @@ Module uPred_reflection. Section uPred_reflection. ...@@ -23,17 +23,16 @@ Module uPred_reflection. Section uPred_reflection.
| ESep e1 e2 => flatten e1 ++ flatten e2 | ESep e1 e2 => flatten e1 ++ flatten e2
end. end.
Notation eval_list Σ l := ([] ((λ n, from_option id True%I (Σ !! n)) <$> l))%I. Notation eval_list Σ l := ([ list] n l, from_option id True (Σ !! n))%I.
Lemma eval_flatten Σ e : eval Σ e eval_list Σ (flatten e). Lemma eval_flatten Σ e : eval Σ e eval_list Σ (flatten e).
Proof. Proof.
induction e as [| |e1 IH1 e2 IH2]; induction e as [| |e1 IH1 e2 IH2];
rewrite /= ?right_id ?fmap_app ?big_sep_app ?IH1 ?IH2 //. rewrite /= ?right_id ?big_sepL_app ?IH1 ?IH2 //.
Qed. Qed.
Lemma flatten_entails Σ e1 e2 : Lemma flatten_entails Σ e1 e2 :
flatten e2 + flatten e1 eval Σ e1 eval Σ e2. flatten e2 + flatten e1 eval Σ e1 eval Σ e2.
Proof. Proof. intros. rewrite !eval_flatten. by apply big_sepL_submseteq. Qed.
intros. rewrite !eval_flatten. by apply big_sep_submseteq, fmap_submseteq.
Qed.
Lemma flatten_equiv Σ e1 e2 : Lemma flatten_equiv Σ e1 e2 :
flatten e2 flatten e1 eval Σ e1 eval Σ e2. flatten e2 flatten e1 eval Σ e1 eval Σ e2.
Proof. intros He. by rewrite !eval_flatten He. Qed. Proof. intros He. by rewrite !eval_flatten He. Qed.
...@@ -90,7 +89,7 @@ Module uPred_reflection. Section uPred_reflection. ...@@ -90,7 +89,7 @@ Module uPred_reflection. Section uPred_reflection.
Proof. Proof.
intros ??. rewrite !eval_flatten. intros ??. rewrite !eval_flatten.
rewrite (flatten_cancel e1 e1' ns) // (flatten_cancel e2 e2' ns) //; csimpl. rewrite (flatten_cancel e1 e1' ns) // (flatten_cancel e2 e2' ns) //; csimpl.
rewrite !fmap_app !big_sep_app. apply sep_mono_r. rewrite !big_sepL_app. apply sep_mono_r.
Qed. Qed.
Fixpoint to_expr (l : list nat) : expr := Fixpoint to_expr (l : list nat) : expr :=
...@@ -110,7 +109,7 @@ Module uPred_reflection. Section uPred_reflection. ...@@ -110,7 +109,7 @@ Module uPred_reflection. Section uPred_reflection.
cancel ns e = Some e' eval Σ e (eval Σ (to_expr ns) eval Σ e'). cancel ns e = Some e' eval Σ e (eval Σ (to_expr ns) eval Σ e').
Proof. Proof.
intros He%flatten_cancel. intros He%flatten_cancel.
by rewrite eval_flatten He fmap_app big_sep_app eval_to_expr eval_flatten. by rewrite eval_flatten He big_sepL_app eval_to_expr eval_flatten.
Qed. Qed.
Lemma split_r Σ e ns e' : Lemma split_r Σ e ns e' :
cancel ns e = Some e' eval Σ e (eval Σ e' eval Σ (to_expr ns)). cancel ns e = Some e' eval Σ e (eval Σ e' eval Σ (to_expr ns)).
......
...@@ -76,7 +76,7 @@ Lemma wp_fork E e Φ : ...@@ -76,7 +76,7 @@ Lemma wp_fork E e Φ :
Φ (LitV LitUnit) WP e {{ _, True }} WP Fork e @ E {{ Φ }}. Φ (LitV LitUnit) WP e {{ _, True }} WP Fork e @ E {{ Φ }}.
Proof. Proof.
rewrite -(wp_lift_pure_det_head_step (Fork e) (Lit LitUnit) [e]) //=; eauto. rewrite -(wp_lift_pure_det_head_step (Fork e) (Lit LitUnit) [e]) //=; eauto.
- by rewrite -step_fupd_intro // later_sep -(wp_value _ _ (Lit _)) // big_sepL_singleton. - by rewrite -step_fupd_intro // later_sep -(wp_value _ _ (Lit _)) // right_id.
- intros; inv_head_step; eauto. - intros; inv_head_step; eauto.
Qed. Qed.
......
...@@ -354,7 +354,7 @@ Proof. intros. by rewrite /FromAnd big_opL_cons always_and_sep_l. Qed. ...@@ -354,7 +354,7 @@ Proof. intros. by rewrite /FromAnd big_opL_cons always_and_sep_l. Qed.
Global Instance from_and_big_sepL_app {A} (Φ : nat A uPred M) l1 l2 : Global Instance from_and_big_sepL_app {A} (Φ : nat A uPred M) l1 l2 :
FromAnd false ([ list] k y l1 ++ l2, Φ k y) FromAnd false ([ list] k y l1 ++ l2, Φ k y)
([ list] k y l1, Φ k y) ([ list] k y l2, Φ (length l1 + k) y). ([ list] k y l1, Φ k y) ([ list] k y l2, Φ (length l1 + k) y).
Proof. by rewrite /FromAnd big_sepL_app. Qed. Proof. by rewrite /FromAnd big_opL_app. Qed.
Global Instance from_sep_big_sepL_app_persistent {A} (Φ : nat A uPred M) l1 l2 : Global Instance from_sep_big_sepL_app_persistent {A} (Φ : nat A uPred M) l1 l2 :
( k y, PersistentP (Φ k y)) ( k y, PersistentP (Φ k y))
FromAnd true ([ list] k y l1 ++ l2, Φ k y) FromAnd true ([ list] k y l1 ++ l2, Φ k y)
......
...@@ -234,14 +234,14 @@ Proof. ...@@ -234,14 +234,14 @@ Proof.
intros j. apply (env_app_disjoint _ _ _ j) in Happ. intros j. apply (env_app_disjoint _ _ _ j) in Happ.
naive_solver eauto using env_app_fresh. naive_solver eauto using env_app_fresh.
+ rewrite (env_app_perm _ _ Γp') //. + rewrite (env_app_perm _ _ Γp') //.
rewrite big_sep_app always_sep. solve_sep_entails. rewrite big_sepL_app always_sep. solve_sep_entails.
- destruct (env_app Γ Γp) eqn:Happ, - destruct (env_app Γ Γp) eqn:Happ,
(env_app Γ Γs) as [Γs'|] eqn:?; simplify_eq/=. (env_app Γ Γs) as [Γs'|] eqn:?; simplify_eq/=.
apply wand_intro_l, sep_intro_True_l; [apply pure_intro|]. apply wand_intro_l, sep_intro_True_l; [apply pure_intro|].
+ destruct Hwf; constructor; simpl; eauto using env_app_wf. + destruct Hwf; constructor; simpl; eauto using env_app_wf.
intros j. apply (env_app_disjoint _ _ _ j) in Happ. intros j. apply (env_app_disjoint _ _ _ j) in Happ.
naive_solver eauto using env_app_fresh. naive_solver eauto using env_app_fresh.
+ rewrite (env_app_perm _ _ Γs') // big_sep_app. solve_sep_entails. + rewrite (env_app_perm _ _ Γs') // big_sepL_app. solve_sep_entails.
Qed. Qed.
Lemma envs_simple_replace_sound' Δ Δ' i p Γ : Lemma envs_simple_replace_sound' Δ Δ' i p Γ :
...@@ -257,14 +257,14 @@ Proof. ...@@ -257,14 +257,14 @@ Proof.
intros j. apply (env_app_disjoint _ _ _ j) in Happ. intros j. apply (env_app_disjoint _ _ _ j) in Happ.
destruct (decide (i = j)); try naive_solver eauto using env_replace_fresh. destruct (decide (i = j)); try naive_solver eauto using env_replace_fresh.
+ rewrite (env_replace_perm _ _ Γp') //. + rewrite (env_replace_perm _ _ Γp') //.
rewrite big_sep_app always_sep. solve_sep_entails. rewrite big_sepL_app always_sep. solve_sep_entails.
- destruct (env_app Γ Γp) eqn:Happ, - destruct (env_app Γ Γp) eqn:Happ,
(env_replace i Γ Γs) as [Γs'|] eqn:?; simplify_eq/=. (env_replace i Γ Γs) as [Γs'|] eqn:?; simplify_eq/=.
apply wand_intro_l, sep_intro_True_l; [apply pure_intro|]. apply wand_intro_l, sep_intro_True_l; [apply pure_intro|].
+ destruct Hwf; constructor; simpl; eauto using env_replace_wf. + destruct Hwf; constructor; simpl; eauto using env_replace_wf.
intros j. apply (env_app_disjoint _ _ _ j) in Happ. intros j. apply (env_app_disjoint _ _ _ j) in Happ.
destruct (decide (i = j)); try naive_solver eauto using env_replace_fresh. destruct (decide (i = j)); try naive_solver eauto using env_replace_fresh.
+ rewrite (env_replace_perm _ _ Γs') // big_sep_app. solve_sep_entails. + rewrite (env_replace_perm _ _ Γs') // big_sepL_app. solve_sep_entails.
Qed. Qed.