Commit 49f9097f authored by Ralf Jung's avatar Ralf Jung
Browse files

Merge branch 'robbert/seal' into 'master'

Rename seal lemmas from `_eq` to `_unseal` and make sealing stuff `Local`.

See merge request !793
parents d080eb82 a3534b51
Pipeline #65899 passed with stage
in 9 minutes and 6 seconds
...@@ -5,6 +5,13 @@ lemma. ...@@ -5,6 +5,13 @@ lemma.
## Iris master ## Iris master
**General changes:**
- Rename "unsealing" lemmas from `_eq` to `_unseal`. This particularly
affects `envs_entails_eq`, which is commonly used in the definition of
custom proof mode tactics. All other unsealing lemmas should be internal, so
in principle you should not rely on them.
**Changes in `bi`:** **Changes in `bi`:**
* Generalize `big_op` lemmas that were previously assuming `Absorbing`ness of * Generalize `big_op` lemmas that were previously assuming `Absorbing`ness of
......
...@@ -28,7 +28,7 @@ tags: [ ...@@ -28,7 +28,7 @@ tags: [
depends: [ depends: [
"coq" { (>= "8.13" & < "8.16~") | (= "dev") } "coq" { (>= "8.13" & < "8.16~") | (= "dev") }
"coq-stdpp" { (= "dev.2022-05-13.0.53c9d7f7") | (= "dev") } "coq-stdpp" { (= "dev.2022-05-13.1.ebb89887") | (= "dev") }
] ]
build: ["./make-package" "iris" "-j%{jobs}%"] build: ["./make-package" "iris" "-j%{jobs}%"]
......
...@@ -35,12 +35,13 @@ Notation "'[^' o 'list]' x ∈ l , P" := (big_opL o (λ _ x, P) l) ...@@ -35,12 +35,13 @@ Notation "'[^' o 'list]' x ∈ l , P" := (big_opL o (λ _ x, P) l)
(at level 200, o at level 1, l at level 10, x at level 1, right associativity, (at level 200, o at level 1, l at level 10, x at level 1, right associativity,
format "[^ o list] x ∈ l , P") : stdpp_scope. format "[^ o list] x ∈ l , P") : stdpp_scope.
Definition big_opM_def `{Monoid M o} `{Countable K} {A} (f : K A M) Local Definition big_opM_def `{Monoid M o} `{Countable K} {A} (f : K A M)
(m : gmap K A) : M := big_opL o (λ _, uncurry f) (map_to_list m). (m : gmap K A) : M := big_opL o (λ _, uncurry f) (map_to_list m).
Definition big_opM_aux : seal (@big_opM_def). Proof. by eexists. Qed. Local Definition big_opM_aux : seal (@big_opM_def). Proof. by eexists. Qed.
Definition big_opM := big_opM_aux.(unseal). Definition big_opM := big_opM_aux.(unseal).
Global Arguments big_opM {M} o {_ K _ _ A} _ _. Global Arguments big_opM {M} o {_ K _ _ A} _ _.
Definition big_opM_eq : @big_opM = @big_opM_def := big_opM_aux.(seal_eq). Local Definition big_opM_unseal :
@big_opM = @big_opM_def := big_opM_aux.(seal_eq).
Global Instance: Params (@big_opM) 7 := {}. Global Instance: Params (@big_opM) 7 := {}.
Notation "'[^' o 'map]' k ↦ x ∈ m , P" := (big_opM o (λ k x, P) m) Notation "'[^' o 'map]' k ↦ x ∈ m , P" := (big_opM o (λ k x, P) m)
(at level 200, o at level 1, m at level 10, k, x at level 1, right associativity, (at level 200, o at level 1, m at level 10, k, x at level 1, right associativity,
...@@ -49,23 +50,25 @@ Notation "'[^' o 'map]' x ∈ m , P" := (big_opM o (λ _ x, P) m) ...@@ -49,23 +50,25 @@ Notation "'[^' o 'map]' x ∈ m , P" := (big_opM o (λ _ x, P) m)
(at level 200, o at level 1, m at level 10, x at level 1, right associativity, (at level 200, o at level 1, m at level 10, x at level 1, right associativity,
format "[^ o map] x ∈ m , P") : stdpp_scope. format "[^ o map] x ∈ m , P") : stdpp_scope.
Definition big_opS_def `{Monoid M o} `{Countable A} (f : A M) Local Definition big_opS_def `{Monoid M o} `{Countable A} (f : A M)
(X : gset A) : M := big_opL o (λ _, f) (elements X). (X : gset A) : M := big_opL o (λ _, f) (elements X).
Definition big_opS_aux : seal (@big_opS_def). Proof. by eexists. Qed. Local Definition big_opS_aux : seal (@big_opS_def). Proof. by eexists. Qed.
Definition big_opS := big_opS_aux.(unseal). Definition big_opS := big_opS_aux.(unseal).
Global Arguments big_opS {M} o {_ A _ _} _ _. Global Arguments big_opS {M} o {_ A _ _} _ _.
Definition big_opS_eq : @big_opS = @big_opS_def := big_opS_aux.(seal_eq). Local Definition big_opS_unseal :
@big_opS = @big_opS_def := big_opS_aux.(seal_eq).
Global Instance: Params (@big_opS) 6 := {}. Global Instance: Params (@big_opS) 6 := {}.
Notation "'[^' o 'set]' x ∈ X , P" := (big_opS o (λ x, P) X) Notation "'[^' o 'set]' x ∈ X , P" := (big_opS o (λ x, P) X)
(at level 200, o at level 1, X at level 10, x at level 1, right associativity, (at level 200, o at level 1, X at level 10, x at level 1, right associativity,
format "[^ o set] x ∈ X , P") : stdpp_scope. format "[^ o set] x ∈ X , P") : stdpp_scope.
Definition big_opMS_def `{Monoid M o} `{Countable A} (f : A M) Local Definition big_opMS_def `{Monoid M o} `{Countable A} (f : A M)
(X : gmultiset A) : M := big_opL o (λ _, f) (elements X). (X : gmultiset A) : M := big_opL o (λ _, f) (elements X).
Definition big_opMS_aux : seal (@big_opMS_def). Proof. by eexists. Qed. Local Definition big_opMS_aux : seal (@big_opMS_def). Proof. by eexists. Qed.
Definition big_opMS := big_opMS_aux.(unseal). Definition big_opMS := big_opMS_aux.(unseal).
Global Arguments big_opMS {M} o {_ A _ _} _ _. Global Arguments big_opMS {M} o {_ A _ _} _ _.
Definition big_opMS_eq : @big_opMS = @big_opMS_def := big_opMS_aux.(seal_eq). Local Definition big_opMS_unseal :
@big_opMS = @big_opMS_def := big_opMS_aux.(seal_eq).
Global Instance: Params (@big_opMS) 6 := {}. Global Instance: Params (@big_opMS) 6 := {}.
Notation "'[^' o 'mset]' x ∈ X , P" := (big_opMS o (λ x, P) X) Notation "'[^' o 'mset]' x ∈ X , P" := (big_opMS o (λ x, P) X)
(at level 200, o at level 1, X at level 10, x at level 1, right associativity, (at level 200, o at level 1, X at level 10, x at level 1, right associativity,
...@@ -252,12 +255,12 @@ Proof. by apply big_opL_sep_zip_with. Qed. ...@@ -252,12 +255,12 @@ Proof. by apply big_opL_sep_zip_with. Qed.
Lemma big_opM_empty `{Countable K} {B} (f : K B M) : Lemma big_opM_empty `{Countable K} {B} (f : K B M) :
([^o map] kx , f k x) = monoid_unit. ([^o map] kx , f k x) = monoid_unit.
Proof. by rewrite big_opM_eq /big_opM_def map_to_list_empty. Qed. Proof. by rewrite big_opM_unseal /big_opM_def map_to_list_empty. Qed.
Lemma big_opM_insert `{Countable K} {B} (f : K B M) (m : gmap K B) i x : Lemma big_opM_insert `{Countable K} {B} (f : K B M) (m : gmap K B) i x :
m !! i = None m !! i = None
([^o map] ky <[i:=x]> m, f k y) f i x `o` [^o map] ky m, f k y. ([^o map] ky <[i:=x]> m, f k y) f i x `o` [^o map] ky m, f k y.
Proof. intros ?. by rewrite big_opM_eq /big_opM_def map_to_list_insert. Qed. Proof. intros ?. by rewrite big_opM_unseal /big_opM_def map_to_list_insert. Qed.
Lemma big_opM_delete `{Countable K} {B} (f : K B M) (m : gmap K B) i x : Lemma big_opM_delete `{Countable K} {B} (f : K B M) (m : gmap K B) i x :
m !! i = Some x m !! i = Some x
...@@ -304,7 +307,7 @@ Section gmap. ...@@ -304,7 +307,7 @@ Section gmap.
( k x, m !! k = Some x R (f k x) (g k x)) ( k x, m !! k = Some x R (f k x) (g k x))
R ([^o map] k x m, f k x) ([^o map] k x m, g k x). R ([^o map] k x m, f k x) ([^o map] k x m, g k x).
Proof. Proof.
intros ?? Hf. rewrite big_opM_eq. apply (big_opL_gen_proper R); auto. intros ?? Hf. rewrite big_opM_unseal. apply (big_opL_gen_proper R); auto.
intros k [i x] ?%elem_of_list_lookup_2. by apply Hf, elem_of_map_to_list. intros k [i x] ?%elem_of_list_lookup_2. by apply Hf, elem_of_map_to_list.
Qed. Qed.
...@@ -353,7 +356,7 @@ Section gmap. ...@@ -353,7 +356,7 @@ Section gmap.
[setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *) [setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *)
Lemma big_opM_map_to_list f m : Lemma big_opM_map_to_list f m :
([^o map] kx m, f k x) [^o list] xk map_to_list m, f (xk.1) (xk.2). ([^o map] kx m, f k x) [^o list] xk map_to_list m, f (xk.1) (xk.2).
Proof. rewrite big_opM_eq. apply big_opL_proper'; [|done]. by intros ? [??]. Qed. Proof. rewrite big_opM_unseal. apply big_opL_proper'; [|done]. by intros ? [??]. Qed.
Lemma big_opM_singleton f i x : ([^o map] ky {[i:=x]}, f k y) f i x. Lemma big_opM_singleton f i x : ([^o map] ky {[i:=x]}, f k y) f i x.
Proof. Proof.
...@@ -363,13 +366,13 @@ Section gmap. ...@@ -363,13 +366,13 @@ Section gmap.
Lemma big_opM_unit m : ([^o map] ky m, monoid_unit) (monoid_unit : M). Lemma big_opM_unit m : ([^o map] ky m, monoid_unit) (monoid_unit : M).
Proof. Proof.
by induction m using map_ind; rewrite /= ?big_opM_insert ?left_id // big_opM_eq. by induction m using map_ind; rewrite /= ?big_opM_insert ?left_id // big_opM_unseal.
Qed. Qed.
Lemma big_opM_fmap {B} (h : A B) (f : K B M) m : Lemma big_opM_fmap {B} (h : A B) (f : K B M) m :
([^o map] ky h <$> m, f k y) ([^o map] ky m, f k (h y)). ([^o map] ky h <$> m, f k y) ([^o map] ky m, f k (h y)).
Proof. Proof.
rewrite big_opM_eq /big_opM_def map_to_list_fmap big_opL_fmap. rewrite big_opM_unseal /big_opM_def map_to_list_fmap big_opL_fmap.
by apply big_opL_proper=> ? [??]. by apply big_opL_proper=> ? [??].
Qed. Qed.
...@@ -445,7 +448,7 @@ Section gmap. ...@@ -445,7 +448,7 @@ Section gmap.
([^o map] kx m, f k x `o` g k x) ([^o map] kx m, f k x `o` g k x)
([^o map] kx m, f k x) `o` ([^o map] kx m, g k x). ([^o map] kx m, f k x) `o` ([^o map] kx m, g k x).
Proof. Proof.
rewrite big_opM_eq /big_opM_def -big_opL_op. by apply big_opL_proper=> ? [??]. rewrite big_opM_unseal /big_opM_def -big_opL_op. by apply big_opL_proper=> ? [??].
Qed. Qed.
End gmap. End gmap.
...@@ -483,7 +486,7 @@ Section gset. ...@@ -483,7 +486,7 @@ Section gset.
( x, x X R (f x) (g x)) ( x, x X R (f x) (g x))
R ([^o set] x X, f x) ([^o set] x X, g x). R ([^o set] x X, f x) ([^o set] x X, g x).
Proof. Proof.
rewrite big_opS_eq. intros ?? Hf. apply (big_opL_gen_proper R); auto. rewrite big_opS_unseal. intros ?? Hf. apply (big_opL_gen_proper R); auto.
intros k x ?%elem_of_list_lookup_2. by apply Hf, elem_of_elements. intros k x ?%elem_of_list_lookup_2. by apply Hf, elem_of_elements.
Qed. Qed.
...@@ -514,10 +517,10 @@ Section gset. ...@@ -514,10 +517,10 @@ Section gset.
[setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *) [setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *)
Lemma big_opS_elements f X : Lemma big_opS_elements f X :
([^o set] x X, f x) [^o list] x elements X, f x. ([^o set] x X, f x) [^o list] x elements X, f x.
Proof. by rewrite big_opS_eq. Qed. Proof. by rewrite big_opS_unseal. Qed.
Lemma big_opS_empty f : ([^o set] x , f x) = monoid_unit. Lemma big_opS_empty f : ([^o set] x , f x) = monoid_unit.
Proof. by rewrite big_opS_eq /big_opS_def elements_empty. Qed. Proof. by rewrite big_opS_unseal /big_opS_def elements_empty. Qed.
Lemma big_opS_insert f X x : Lemma big_opS_insert f X x :
x X ([^o set] y {[ x ]} X, f y) (f x `o` [^o set] y X, f y). x X ([^o set] y {[ x ]} X, f y) (f x `o` [^o set] y X, f y).
...@@ -557,7 +560,7 @@ Section gset. ...@@ -557,7 +560,7 @@ Section gset.
Lemma big_opS_unit X : ([^o set] y X, monoid_unit) (monoid_unit : M). Lemma big_opS_unit X : ([^o set] y X, monoid_unit) (monoid_unit : M).
Proof. Proof.
by induction X using set_ind_L; rewrite /= ?big_opS_insert ?left_id // big_opS_eq. by induction X using set_ind_L; rewrite /= ?big_opS_insert ?left_id // big_opS_unseal.
Qed. Qed.
Lemma big_opS_filter' (φ : A Prop) `{ x, Decision (φ x)} f X : Lemma big_opS_filter' (φ : A Prop) `{ x, Decision (φ x)} f X :
...@@ -605,7 +608,7 @@ Lemma big_opM_dom `{Countable K} {A} (f : K → M) (m : gmap K A) : ...@@ -605,7 +608,7 @@ Lemma big_opM_dom `{Countable K} {A} (f : K → M) (m : gmap K A) :
([^o map] k_ m, f k) ([^o set] k dom m, f k). ([^o map] k_ m, f k) ([^o set] k dom m, f k).
Proof. Proof.
induction m as [|i x ?? IH] using map_ind. induction m as [|i x ?? IH] using map_ind.
{ by rewrite big_opM_eq big_opS_eq dom_empty_L. } { by rewrite big_opM_unseal big_opS_unseal dom_empty_L. }
by rewrite dom_insert_L big_opM_insert // IH big_opS_insert ?not_elem_of_dom. by rewrite dom_insert_L big_opM_insert // IH big_opS_insert ?not_elem_of_dom.
Qed. Qed.
...@@ -620,7 +623,7 @@ Section gmultiset. ...@@ -620,7 +623,7 @@ Section gmultiset.
( x, x X R (f x) (g x)) ( x, x X R (f x) (g x))
R ([^o mset] x X, f x) ([^o mset] x X, g x). R ([^o mset] x X, f x) ([^o mset] x X, g x).
Proof. Proof.
rewrite big_opMS_eq. intros ?? Hf. apply (big_opL_gen_proper R); auto. rewrite big_opMS_unseal. intros ?? Hf. apply (big_opL_gen_proper R); auto.
intros k x ?%elem_of_list_lookup_2. by apply Hf, gmultiset_elem_of_elements. intros k x ?%elem_of_list_lookup_2. by apply Hf, gmultiset_elem_of_elements.
Qed. Qed.
...@@ -651,18 +654,18 @@ Section gmultiset. ...@@ -651,18 +654,18 @@ Section gmultiset.
[setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *) [setoid_rewrite] in the proof of [big_sepS_sepS]. See Coq issue #14349. *)
Lemma big_opMS_elements f X : Lemma big_opMS_elements f X :
([^o mset] x X, f x) [^o list] x elements X, f x. ([^o mset] x X, f x) [^o list] x elements X, f x.
Proof. by rewrite big_opMS_eq. Qed. Proof. by rewrite big_opMS_unseal. Qed.
Lemma big_opMS_empty f : ([^o mset] x , f x) = monoid_unit. Lemma big_opMS_empty f : ([^o mset] x , f x) = monoid_unit.
Proof. by rewrite big_opMS_eq /big_opMS_def gmultiset_elements_empty. Qed. Proof. by rewrite big_opMS_unseal /big_opMS_def gmultiset_elements_empty. Qed.
Lemma big_opMS_disj_union f X Y : Lemma big_opMS_disj_union f X Y :
([^o mset] y X Y, f y) ([^o mset] y X, f y) `o` [^o mset] y Y, f y. ([^o mset] y X Y, f y) ([^o mset] y X, f y) `o` [^o mset] y Y, f y.
Proof. by rewrite big_opMS_eq /big_opMS_def gmultiset_elements_disj_union big_opL_app. Qed. Proof. by rewrite big_opMS_unseal /big_opMS_def gmultiset_elements_disj_union big_opL_app. Qed.
Lemma big_opMS_singleton f x : ([^o mset] y {[+ x +]}, f y) f x. Lemma big_opMS_singleton f x : ([^o mset] y {[+ x +]}, f y) f x.
Proof. Proof.
intros. by rewrite big_opMS_eq /big_opMS_def gmultiset_elements_singleton /= right_id. intros. by rewrite big_opMS_unseal /big_opMS_def gmultiset_elements_singleton /= right_id.
Qed. Qed.
Lemma big_opMS_insert f X x : Lemma big_opMS_insert f X x :
...@@ -679,12 +682,12 @@ Section gmultiset. ...@@ -679,12 +682,12 @@ Section gmultiset.
Lemma big_opMS_unit X : ([^o mset] y X, monoid_unit) (monoid_unit : M). Lemma big_opMS_unit X : ([^o mset] y X, monoid_unit) (monoid_unit : M).
Proof. Proof.
by induction X using gmultiset_ind; by induction X using gmultiset_ind;
rewrite /= ?big_opMS_disj_union ?big_opMS_singleton ?left_id // big_opMS_eq. rewrite /= ?big_opMS_disj_union ?big_opMS_singleton ?left_id // big_opMS_unseal.
Qed. Qed.
Lemma big_opMS_op f g X : Lemma big_opMS_op f g X :
([^o mset] y X, f y `o` g y) ([^o mset] y X, f y) `o` ([^o mset] y X, g y). ([^o mset] y X, f y `o` g y) ([^o mset] y X, f y) `o` ([^o mset] y X, g y).
Proof. by rewrite big_opMS_eq /big_opMS_def -big_opL_op. Qed. Proof. by rewrite big_opMS_unseal /big_opMS_def -big_opL_op. Qed.
End gmultiset. End gmultiset.
(** Commuting lemmas *) (** Commuting lemmas *)
......
...@@ -13,7 +13,8 @@ Qed. ...@@ -13,7 +13,8 @@ Qed.
Lemma big_opM_None {M : cmra} `{Countable K} {A} (f : K A option M) m : Lemma big_opM_None {M : cmra} `{Countable K} {A} (f : K A option M) m :
([^op map] kx m, f k x) = None k x, m !! k = Some x f k x = None. ([^op map] kx m, f k x) = None k x, m !! k = Some x f k x = None.
Proof. Proof.
induction m as [|i x m ? IH] using map_ind=> /=; first by rewrite big_opM_eq. induction m as [|i x m ? IH] using map_ind=> /=.
{ by rewrite big_opM_empty. }
rewrite -None_equiv_eq big_opM_insert // None_equiv_eq op_None IH. split. rewrite -None_equiv_eq big_opM_insert // None_equiv_eq op_None IH. split.
{ intros [??] k y. rewrite lookup_insert_Some; naive_solver. } { intros [??] k y. rewrite lookup_insert_Some; naive_solver. }
intros Hm; split. intros Hm; split.
...@@ -23,7 +24,8 @@ Qed. ...@@ -23,7 +24,8 @@ Qed.
Lemma big_opS_None {M : cmra} `{Countable A} (f : A option M) X : Lemma big_opS_None {M : cmra} `{Countable A} (f : A option M) X :
([^op set] x X, f x) = None x, x X f x = None. ([^op set] x X, f x) = None x, x X f x = None.
Proof. Proof.
induction X as [|x X ? IH] using set_ind_L; [by rewrite big_opS_eq |]. induction X as [|x X ? IH] using set_ind_L.
{ by rewrite big_opS_empty. }
rewrite -None_equiv_eq big_opS_insert // None_equiv_eq op_None IH. set_solver. rewrite -None_equiv_eq big_opS_insert // None_equiv_eq op_None IH. set_solver.
Qed. Qed.
Lemma big_opMS_None {M : cmra} `{Countable A} (f : A option M) X : Lemma big_opMS_None {M : cmra} `{Countable A} (f : A option M) X :
......
...@@ -623,7 +623,7 @@ Proof. ...@@ -623,7 +623,7 @@ Proof.
right order, namely the order in which they appear in map_to_list. Here, right order, namely the order in which they appear in map_to_list. Here,
we achieve this by unfolding [big_opM] and doing induction over that list we achieve this by unfolding [big_opM] and doing induction over that list
instead. *) instead. *)
rewrite big_opM_eq /big_opM_def -{2}(list_to_map_to_list m). rewrite big_op.big_opM_unseal /big_op.big_opM_def -{2}(list_to_map_to_list m).
assert (NoDup (map_to_list m).*1) as Hnodup by apply NoDup_fst_map_to_list. assert (NoDup (map_to_list m).*1) as Hnodup by apply NoDup_fst_map_to_list.
revert Hnodup. induction (map_to_list m) as [|[k x] l IH]; csimpl; first done. revert Hnodup. induction (map_to_list m) as [|[k x] l IH]; csimpl; first done.
intros [??]%NoDup_cons. rewrite IH //. intros [??]%NoDup_cons. rewrite IH //.
......
...@@ -330,12 +330,13 @@ Next Obligation. ...@@ -330,12 +330,13 @@ Next Obligation.
- apply (contractive_S f), IH; auto with lia. - apply (contractive_S f), IH; auto with lia.
Qed. Qed.
Program Definition fixpoint_def `{Cofe A, Inhabited A} (f : A A) Local Program Definition fixpoint_def `{Cofe A, Inhabited A} (f : A A)
`{!Contractive f} : A := compl (fixpoint_chain f). `{!Contractive f} : A := compl (fixpoint_chain f).
Definition fixpoint_aux : seal (@fixpoint_def). Proof. by eexists. Qed. Local Definition fixpoint_aux : seal (@fixpoint_def). Proof. by eexists. Qed.
Definition fixpoint := fixpoint_aux.(unseal). Definition fixpoint := fixpoint_aux.(unseal).
Global Arguments fixpoint {A _ _} f {_}. Global Arguments fixpoint {A _ _} f {_}.
Definition fixpoint_eq : @fixpoint = @fixpoint_def := fixpoint_aux.(seal_eq). Local Definition fixpoint_unseal :
@fixpoint = @fixpoint_def := fixpoint_aux.(seal_eq).
Section fixpoint. Section fixpoint.
Context `{Cofe A, Inhabited A} (f : A A) `{!Contractive f}. Context `{Cofe A, Inhabited A} (f : A A) `{!Contractive f}.
...@@ -346,7 +347,7 @@ Section fixpoint. ...@@ -346,7 +347,7 @@ Section fixpoint.
Lemma fixpoint_unfold : fixpoint f f (fixpoint f). Lemma fixpoint_unfold : fixpoint f f (fixpoint f).
Proof. Proof.
apply equiv_dist=>n. apply equiv_dist=>n.
rewrite fixpoint_eq /fixpoint_def (conv_compl n (fixpoint_chain f)) //. rewrite fixpoint_unseal /fixpoint_def (conv_compl n (fixpoint_chain f)) //.
induction n as [|n IH]; simpl; eauto using contractive_0, contractive_S. induction n as [|n IH]; simpl; eauto using contractive_0, contractive_S.
Qed. Qed.
...@@ -360,7 +361,7 @@ Section fixpoint. ...@@ -360,7 +361,7 @@ Section fixpoint.
Lemma fixpoint_ne (g : A A) `{!Contractive g} n : Lemma fixpoint_ne (g : A A) `{!Contractive g} n :
( z, f z {n} g z) fixpoint f {n} fixpoint g. ( z, f z {n} g z) fixpoint f {n} fixpoint g.
Proof. Proof.
intros Hfg. rewrite fixpoint_eq /fixpoint_def intros Hfg. rewrite fixpoint_unseal /fixpoint_def
(conv_compl n (fixpoint_chain f)) (conv_compl n (fixpoint_chain g)) /=. (conv_compl n (fixpoint_chain f)) (conv_compl n (fixpoint_chain g)) /=.
induction n as [|n IH]; simpl in *; [by rewrite !Hfg|]. induction n as [|n IH]; simpl in *; [by rewrite !Hfg|].
rewrite Hfg; apply contractive_S, IH; auto using dist_S. rewrite Hfg; apply contractive_S, IH; auto using dist_S.
......
...@@ -7,54 +7,56 @@ From iris.prelude Require Import options. ...@@ -7,54 +7,56 @@ From iris.prelude Require Import options.
Export invGS. Export invGS.
Import uPred. Import uPred.
Definition uPred_fupd_def `{!invGS Σ} (E1 E2 : coPset) (P : iProp Σ) : iProp Σ := Local Definition uPred_fupd_def `{!invGS Σ} (E1 E2 : coPset) (P : iProp Σ) : iProp Σ :=
wsat ownE E1 == (wsat ownE E2 P). wsat ownE E1 == (wsat ownE E2 P).
Definition uPred_fupd_aux : seal (@uPred_fupd_def). Proof. by eexists. Qed. Local Definition uPred_fupd_aux : seal (@uPred_fupd_def). Proof. by eexists. Qed.
Definition uPred_fupd := uPred_fupd_aux.(unseal). Definition uPred_fupd := uPred_fupd_aux.(unseal).
Global Arguments uPred_fupd {Σ _}. Global Arguments uPred_fupd {Σ _}.
Lemma uPred_fupd_eq `{!invGS Σ} : @fupd _ uPred_fupd = uPred_fupd_def. Local Lemma uPred_fupd_unseal `{!invGS Σ} : @fupd _ uPred_fupd = uPred_fupd_def.
Proof. rewrite -uPred_fupd_aux.(seal_eq) //. Qed. Proof. rewrite -uPred_fupd_aux.(seal_eq) //. Qed.
Lemma uPred_fupd_mixin `{!invGS Σ} : BiFUpdMixin (uPredI (iResUR Σ)) uPred_fupd. Lemma uPred_fupd_mixin `{!invGS Σ} : BiFUpdMixin (uPredI (iResUR Σ)) uPred_fupd.
Proof. Proof.
split. split.
- rewrite uPred_fupd_eq. solve_proper. - rewrite uPred_fupd_unseal. solve_proper.
- intros E1 E2 (E1''&->&?)%subseteq_disjoint_union_L. - intros E1 E2 (E1''&->&?)%subseteq_disjoint_union_L.
rewrite uPred_fupd_eq /uPred_fupd_def ownE_op //. rewrite uPred_fupd_unseal /uPred_fupd_def ownE_op //.
by iIntros "($ & $ & HE) !> !> [$ $] !> !>" . by iIntros "($ & $ & HE) !> !> [$ $] !> !>" .
- rewrite uPred_fupd_eq. iIntros (E1 E2 P) ">H [Hw HE]". iApply "H"; by iFrame. - rewrite uPred_fupd_unseal.
- rewrite uPred_fupd_eq. iIntros (E1 E2 P Q HPQ) "HP HwE". rewrite -HPQ. by iApply "HP". iIntros (E1 E2 P) ">H [Hw HE]". iApply "H"; by iFrame.
- rewrite uPred_fupd_eq. iIntros (E1 E2 E3 P) "HP HwE". - rewrite uPred_fupd_unseal.
iIntros (E1 E2 P Q HPQ) "HP HwE". rewrite -HPQ. by iApply "HP".
- rewrite uPred_fupd_unseal. iIntros (E1 E2 E3 P) "HP HwE".
iMod ("HP" with "HwE") as ">(Hw & HE & HP)". iApply "HP"; by iFrame. iMod ("HP" with "HwE") as ">(Hw & HE & HP)". iApply "HP"; by iFrame.
- intros E1 E2 Ef P HE1Ef. rewrite uPred_fupd_eq /uPred_fupd_def ownE_op //. - intros E1 E2 Ef P HE1Ef. rewrite uPred_fupd_unseal /uPred_fupd_def ownE_op //.
iIntros "Hvs (Hw & HE1 &HEf)". iIntros "Hvs (Hw & HE1 &HEf)".
iMod ("Hvs" with "[Hw HE1]") as ">($ & HE2 & HP)"; first by iFrame. iMod ("Hvs" with "[Hw HE1]") as ">($ & HE2 & HP)"; first by iFrame.
iDestruct (ownE_op' with "[HE2 HEf]") as "[? $]"; first by iFrame. iDestruct (ownE_op' with "[HE2 HEf]") as "[? $]"; first by iFrame.
iIntros "!> !>". by iApply "HP". iIntros "!> !>". by iApply "HP".
- rewrite uPred_fupd_eq /uPred_fupd_def. by iIntros (????) "[HwP $]". - rewrite uPred_fupd_unseal /uPred_fupd_def. by iIntros (????) "[HwP $]".
Qed. Qed.
Global Instance uPred_bi_fupd `{!invGS Σ} : BiFUpd (uPredI (iResUR Σ)) := Global Instance uPred_bi_fupd `{!invGS Σ} : BiFUpd (uPredI (iResUR Σ)) :=
{| bi_fupd_mixin := uPred_fupd_mixin |}. {| bi_fupd_mixin := uPred_fupd_mixin |}.
Global Instance uPred_bi_bupd_fupd `{!invGS Σ} : BiBUpdFUpd (uPredI (iResUR Σ)). Global Instance uPred_bi_bupd_fupd `{!invGS Σ} : BiBUpdFUpd (uPredI (iResUR Σ)).
Proof. rewrite /BiBUpdFUpd uPred_fupd_eq. by iIntros (E P) ">? [$ $] !> !>". Qed. Proof. rewrite /BiBUpdFUpd uPred_fupd_unseal. by iIntros (E P) ">? [$ $] !> !>". Qed.
Global Instance uPred_bi_fupd_plainly `{!invGS Σ} : BiFUpdPlainly (uPredI (iResUR Σ)). Global Instance uPred_bi_fupd_plainly `{!invGS Σ} : BiFUpdPlainly (uPredI (iResUR Σ)).
Proof. Proof.
split. split.
- rewrite uPred_fupd_eq /uPred_fupd_def. iIntros (E P) "H [Hw HE]". - rewrite uPred_fupd_unseal /uPred_fupd_def. iIntros (E P) "H [Hw HE]".
iAssert ( P)%I as "#>HP". iAssert ( P)%I as "#>HP".
{ by iMod ("H" with "[$]") as "(_ & _ & HP)". } { by iMod ("H" with "[$]") as "(_ & _ & HP)". }
by iFrame. by iFrame.
- rewrite uPred_fupd_eq /uPred_fupd_def. iIntros (E P Q) "[H HQ] [Hw HE]". - rewrite uPred_fupd_unseal /uPred_fupd_def. iIntros (E P Q) "[H HQ] [Hw HE]".
iAssert ( P)%I as "#>HP". iAssert ( P)%I as "#>HP".
{ by iMod ("H" with "HQ [$]") as "(_ & _ & HP)". } { by iMod ("H" with "HQ [$]") as "(_ & _ & HP)". }
by iFrame. by iFrame.
- rewrite uPred_fupd_eq /uPred_fupd_def. iIntros (E P) "H [Hw HE]". - rewrite uPred_fupd_unseal /uPred_fupd_def. iIntros (E P) "H [Hw HE]".
iAssert ( P)%I as "#HP". iAssert ( P)%I as "#HP".
{ iNext. by iMod ("H" with "[$]") as "(_ & _ & HP)". } { iNext. by iMod ("H" with "[$]") as "(_ & _ & HP)". }
iFrame. iIntros "!> !> !>". by iMod "HP". iFrame. iIntros "!> !> !>". by iMod "HP".
- rewrite uPred_fupd_eq /uPred_fupd_def. iIntros (E A Φ) "HΦ [Hw HE]". - rewrite uPred_fupd_unseal /uPred_fupd_def. iIntros (E A Φ) "HΦ [Hw HE]".
iAssert ( x : A, Φ x)%I as "#>HP". iAssert ( x : A, Φ x)%I as "#>HP".
{ iIntros (x). by iMod ("HΦ" with "[$Hw $HE]") as "(_&_&?)". }