Commit b51af294 authored by Robbert Krebbers's avatar Robbert Krebbers
Browse files

Use ε for CMRA unit.

For obsolete reasons, that no longer seem to apply, we used ∅ as the
unit.
parent 391e52d7
...@@ -12,7 +12,7 @@ Instance: Params (@Auth) 1. ...@@ -12,7 +12,7 @@ Instance: Params (@Auth) 1.
Instance: Params (@authoritative) 1. Instance: Params (@authoritative) 1.
Instance: Params (@auth_own) 1. Instance: Params (@auth_own) 1.
Notation "◯ a" := (Auth None a) (at level 20). Notation "◯ a" := (Auth None a) (at level 20).
Notation "● a" := (Auth (Excl' a) ) (at level 20). Notation "● a" := (Auth (Excl' a) ε) (at level 20).
(* COFE *) (* COFE *)
Section cofe. Section cofe.
...@@ -177,7 +177,7 @@ Proof. ...@@ -177,7 +177,7 @@ Proof.
- by rewrite -cmra_discrete_valid_iff. - by rewrite -cmra_discrete_valid_iff.
Qed. Qed.
Instance auth_empty : Empty (auth A) := Auth . Instance auth_empty : Unit (auth A) := Auth ε ε.
Lemma auth_ucmra_mixin : UCMRAMixin (auth A). Lemma auth_ucmra_mixin : UCMRAMixin (auth A).
Proof. Proof.
split; simpl. split; simpl.
...@@ -226,9 +226,9 @@ Proof. ...@@ -226,9 +226,9 @@ Proof.
split; last done. exists bf2. by rewrite -assoc. split; last done. exists bf2. by rewrite -assoc.
Qed. Qed.
Lemma auth_update_alloc a a' b' : (a,) ~l~> (a',b') a ~~> a' b'. Lemma auth_update_alloc a a' b' : (a,ε) ~l~> (a',b') a ~~> a' b'.
Proof. intros. rewrite -(right_id _ _ ( a)). by apply auth_update. Qed. Proof. intros. rewrite -(right_id _ _ ( a)). by apply auth_update. Qed.
Lemma auth_update_dealloc a b a' : (a,b) ~l~> (a',) a b ~~> a'. Lemma auth_update_dealloc a b a' : (a,b) ~l~> (a',ε) a b ~~> a'.
Proof. intros. rewrite -(right_id _ _ ( a')). by apply auth_update. Qed. Proof. intros. rewrite -(right_id _ _ ( a')). by apply auth_update. Qed.
Lemma auth_local_update (a b0 b1 a' b0' b1': A) : Lemma auth_local_update (a b0 b1 a' b0' b1': A) :
......
...@@ -179,12 +179,13 @@ Instance core' `{PCore A} : Core A := λ x, from_option id x (pcore x). ...@@ -179,12 +179,13 @@ Instance core' `{PCore A} : Core A := λ x, from_option id x (pcore x).
Arguments core' _ _ _ /. Arguments core' _ _ _ /.
(** * CMRAs with a unit element *) (** * CMRAs with a unit element *)
(** We use the notation ∅ because for most instances (maps, sets, etc) the Class Unit (A : Type) := ε : A.
`empty' element is the unit. *) Arguments ε {_ _}.
Record UCMRAMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, Empty A} := {
mixin_ucmra_unit_valid : ; Record UCMRAMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, Unit A} := {
mixin_ucmra_unit_left_id : LeftId () (); mixin_ucmra_unit_valid : ε;
mixin_ucmra_pcore_unit : pcore Some mixin_ucmra_unit_left_id : LeftId () ε ();
mixin_ucmra_pcore_unit : pcore ε Some ε
}. }.
Structure ucmraT := UCMRAT' { Structure ucmraT := UCMRAT' {
...@@ -195,7 +196,7 @@ Structure ucmraT := UCMRAT' { ...@@ -195,7 +196,7 @@ Structure ucmraT := UCMRAT' {
ucmra_op : Op ucmra_car; ucmra_op : Op ucmra_car;
ucmra_valid : Valid ucmra_car; ucmra_valid : Valid ucmra_car;
ucmra_validN : ValidN ucmra_car; ucmra_validN : ValidN ucmra_car;
ucmra_empty : Empty ucmra_car; ucmra_unit : Unit ucmra_car;
ucmra_ofe_mixin : OfeMixin ucmra_car; ucmra_ofe_mixin : OfeMixin ucmra_car;
ucmra_cmra_mixin : CMRAMixin ucmra_car; ucmra_cmra_mixin : CMRAMixin ucmra_car;
ucmra_mixin : UCMRAMixin ucmra_car; ucmra_mixin : UCMRAMixin ucmra_car;
...@@ -215,7 +216,7 @@ Arguments ucmra_ofe_mixin : simpl never. ...@@ -215,7 +216,7 @@ Arguments ucmra_ofe_mixin : simpl never.
Arguments ucmra_cmra_mixin : simpl never. Arguments ucmra_cmra_mixin : simpl never.
Arguments ucmra_mixin : simpl never. Arguments ucmra_mixin : simpl never.
Add Printing Constructor ucmraT. Add Printing Constructor ucmraT.
Hint Extern 0 (Empty _) => eapply (@ucmra_empty _) : typeclass_instances. Hint Extern 0 (Unit _) => eapply (@ucmra_unit _) : typeclass_instances.
Coercion ucmra_ofeC (A : ucmraT) : ofeT := OfeT A (ucmra_ofe_mixin A). Coercion ucmra_ofeC (A : ucmraT) : ofeT := OfeT A (ucmra_ofe_mixin A).
Canonical Structure ucmra_ofeC. Canonical Structure ucmra_ofeC.
Coercion ucmra_cmraR (A : ucmraT) : cmraT := Coercion ucmra_cmraR (A : ucmraT) : cmraT :=
...@@ -226,11 +227,11 @@ Canonical Structure ucmra_cmraR. ...@@ -226,11 +227,11 @@ Canonical Structure ucmra_cmraR.
Section ucmra_mixin. Section ucmra_mixin.
Context {A : ucmraT}. Context {A : ucmraT}.
Implicit Types x y : A. Implicit Types x y : A.
Lemma ucmra_unit_valid : ( : A). Lemma ucmra_unit_valid : (ε : A).
Proof. apply (mixin_ucmra_unit_valid _ (ucmra_mixin A)). Qed. Proof. apply (mixin_ucmra_unit_valid _ (ucmra_mixin A)). Qed.
Global Instance ucmra_unit_left_id : LeftId () (@op A _). Global Instance ucmra_unit_left_id : LeftId () ε (@op A _).
Proof. apply (mixin_ucmra_unit_left_id _ (ucmra_mixin A)). Qed. Proof. apply (mixin_ucmra_unit_left_id _ (ucmra_mixin A)). Qed.
Lemma ucmra_pcore_unit : pcore (:A) Some . Lemma ucmra_pcore_unit : pcore (ε:A) Some ε.
Proof. apply (mixin_ucmra_pcore_unit _ (ucmra_mixin A)). Qed. Proof. apply (mixin_ucmra_pcore_unit _ (ucmra_mixin A)). Qed.
End ucmra_mixin. End ucmra_mixin.
...@@ -610,27 +611,27 @@ Section ucmra. ...@@ -610,27 +611,27 @@ Section ucmra.
Context {A : ucmraT}. Context {A : ucmraT}.
Implicit Types x y z : A. Implicit Types x y z : A.
Lemma ucmra_unit_validN n : {n} (:A). Lemma ucmra_unit_validN n : {n} (ε:A).
Proof. apply cmra_valid_validN, ucmra_unit_valid. Qed. Proof. apply cmra_valid_validN, ucmra_unit_valid. Qed.
Lemma ucmra_unit_leastN n x : {n} x. Lemma ucmra_unit_leastN n x : ε {n} x.
Proof. by exists x; rewrite left_id. Qed. Proof. by exists x; rewrite left_id. Qed.
Lemma ucmra_unit_least x : x. Lemma ucmra_unit_least x : ε x.
Proof. by exists x; rewrite left_id. Qed. Proof. by exists x; rewrite left_id. Qed.
Global Instance ucmra_unit_right_id : RightId () (@op A _). Global Instance ucmra_unit_right_id : RightId () ε (@op A _).
Proof. by intros x; rewrite (comm op) left_id. Qed. Proof. by intros x; rewrite (comm op) left_id. Qed.
Global Instance ucmra_unit_persistent : Persistent (:A). Global Instance ucmra_unit_persistent : Persistent (ε:A).
Proof. apply ucmra_pcore_unit. Qed. Proof. apply ucmra_pcore_unit. Qed.
Global Instance cmra_unit_total : CMRATotal A. Global Instance cmra_unit_total : CMRATotal A.
Proof. Proof.
intros x. destruct (cmra_pcore_mono' x ) as (cx&->&?); intros x. destruct (cmra_pcore_mono' ε x ε) as (cx&->&?);
eauto using ucmra_unit_least, (persistent (:A)). eauto using ucmra_unit_least, (persistent (ε:A)).
Qed. Qed.
Global Instance empty_cancelable : Cancelable (:A). Global Instance empty_cancelable : Cancelable (ε:A).
Proof. intros ???. by rewrite !left_id. Qed. Proof. intros ???. by rewrite !left_id. Qed.
(* For big ops *) (* For big ops *)
Global Instance cmra_monoid : Monoid (@op A _) := {| monoid_unit := |}. Global Instance cmra_monoid : Monoid (@op A _) := {| monoid_unit := ε |}.
End ucmra. End ucmra.
Hint Immediate cmra_unit_total. Hint Immediate cmra_unit_total.
...@@ -688,9 +689,9 @@ Section ucmra_leibniz. ...@@ -688,9 +689,9 @@ Section ucmra_leibniz.
Context {A : ucmraT} `{!LeibnizEquiv A}. Context {A : ucmraT} `{!LeibnizEquiv A}.
Implicit Types x y z : A. Implicit Types x y z : A.
Global Instance ucmra_unit_left_id_L : LeftId (=) (@op A _). Global Instance ucmra_unit_left_id_L : LeftId (=) ε (@op A _).
Proof. intros x. unfold_leibniz. by rewrite left_id. Qed. Proof. intros x. unfold_leibniz. by rewrite left_id. Qed.
Global Instance ucmra_unit_right_id_L : RightId (=) (@op A _). Global Instance ucmra_unit_right_id_L : RightId (=) ε (@op A _).
Proof. intros x. unfold_leibniz. by rewrite right_id. Qed. Proof. intros x. unfold_leibniz. by rewrite right_id. Qed.
End ucmra_leibniz. End ucmra_leibniz.
...@@ -925,7 +926,7 @@ Section unit. ...@@ -925,7 +926,7 @@ Section unit.
Proof. apply discrete_cmra_mixin, ra_total_mixin; by eauto. Qed. Proof. apply discrete_cmra_mixin, ra_total_mixin; by eauto. Qed.
Canonical Structure unitR : cmraT := CMRAT unit unit_cmra_mixin. Canonical Structure unitR : cmraT := CMRAT unit unit_cmra_mixin.
Instance unit_empty : Empty () := (). Instance unit_unit : Unit () := ().
Lemma unit_ucmra_mixin : UCMRAMixin (). Lemma unit_ucmra_mixin : UCMRAMixin ().
Proof. done. Qed. Proof. done. Qed.
Canonical Structure unitUR : ucmraT := UCMRAT unit unit_ucmra_mixin. Canonical Structure unitUR : ucmraT := UCMRAT unit unit_ucmra_mixin.
...@@ -960,7 +961,7 @@ Section nat. ...@@ -960,7 +961,7 @@ Section nat.
Global Instance nat_cmra_discrete : CMRADiscrete natR. Global Instance nat_cmra_discrete : CMRADiscrete natR.
Proof. apply discrete_cmra_discrete. Qed. Proof. apply discrete_cmra_discrete. Qed.
Instance nat_empty : Empty nat := 0. Instance nat_unit : Unit nat := 0.
Lemma nat_ucmra_mixin : UCMRAMixin nat. Lemma nat_ucmra_mixin : UCMRAMixin nat.
Proof. split; apply _ || done. Qed. Proof. split; apply _ || done. Qed.
Canonical Structure natUR : ucmraT := UCMRAT nat nat_ucmra_mixin. Canonical Structure natUR : ucmraT := UCMRAT nat nat_ucmra_mixin.
...@@ -972,6 +973,7 @@ End nat. ...@@ -972,6 +973,7 @@ End nat.
Definition mnat := nat. Definition mnat := nat.
Section mnat. Section mnat.
Instance mnat_unit : Unit mnat := 0.
Instance mnat_valid : Valid mnat := λ x, True. Instance mnat_valid : Valid mnat := λ x, True.
Instance mnat_validN : ValidN mnat := λ n x, True. Instance mnat_validN : ValidN mnat := λ n x, True.
Instance mnat_pcore : PCore mnat := Some. Instance mnat_pcore : PCore mnat := Some.
...@@ -997,7 +999,6 @@ Section mnat. ...@@ -997,7 +999,6 @@ Section mnat.
Global Instance mnat_cmra_discrete : CMRADiscrete mnatR. Global Instance mnat_cmra_discrete : CMRADiscrete mnatR.
Proof. apply discrete_cmra_discrete. Qed. Proof. apply discrete_cmra_discrete. Qed.
Instance mnat_empty : Empty mnat := 0.
Lemma mnat_ucmra_mixin : UCMRAMixin mnat. Lemma mnat_ucmra_mixin : UCMRAMixin mnat.
Proof. split; apply _ || done. Qed. Proof. split; apply _ || done. Qed.
Canonical Structure mnatUR : ucmraT := UCMRAT mnat mnat_ucmra_mixin. Canonical Structure mnatUR : ucmraT := UCMRAT mnat mnat_ucmra_mixin.
...@@ -1140,7 +1141,7 @@ Arguments prodR : clear implicits. ...@@ -1140,7 +1141,7 @@ Arguments prodR : clear implicits.
Section prod_unit. Section prod_unit.
Context {A B : ucmraT}. Context {A B : ucmraT}.
Instance prod_empty `{Empty A, Empty B} : Empty (A * B) := (, ). Instance prod_unit `{Unit A, Unit B} : Unit (A * B) := (ε, ε).
Lemma prod_ucmra_mixin : UCMRAMixin (A * B). Lemma prod_ucmra_mixin : UCMRAMixin (A * B).
Proof. Proof.
split. split.
...@@ -1150,11 +1151,11 @@ Section prod_unit. ...@@ -1150,11 +1151,11 @@ Section prod_unit.
Qed. Qed.
Canonical Structure prodUR := UCMRAT (prod A B) prod_ucmra_mixin. Canonical Structure prodUR := UCMRAT (prod A B) prod_ucmra_mixin.
Lemma pair_split (x : A) (y : B) : (x, y) (x, ) (, y). Lemma pair_split (x : A) (y : B) : (x, y) (x, ε) (ε, y).
Proof. by rewrite pair_op left_id right_id. Qed. Proof. by rewrite pair_op left_id right_id. Qed.
Lemma pair_split_L `{!LeibnizEquiv A, !LeibnizEquiv B} (x : A) (y : B) : Lemma pair_split_L `{!LeibnizEquiv A, !LeibnizEquiv B} (x : A) (y : B) :
(x, y) = (x, ) (, y). (x, y) = (x, ε) (ε, y).
Proof. unfold_leibniz. apply pair_split. Qed. Proof. unfold_leibniz. apply pair_split. Qed.
End prod_unit. End prod_unit.
...@@ -1311,7 +1312,7 @@ Section option. ...@@ -1311,7 +1312,7 @@ Section option.
Global Instance option_cmra_discrete : CMRADiscrete A CMRADiscrete optionR. Global Instance option_cmra_discrete : CMRADiscrete A CMRADiscrete optionR.
Proof. split; [apply _|]. by intros [x|]; [apply (cmra_discrete_valid x)|]. Qed. Proof. split; [apply _|]. by intros [x|]; [apply (cmra_discrete_valid x)|]. Qed.
Instance option_empty : Empty (option A) := None. Instance option_unit : Unit (option A) := None.
Lemma option_ucmra_mixin : UCMRAMixin optionR. Lemma option_ucmra_mixin : UCMRAMixin optionR.
Proof. split. done. by intros []. done. Qed. Proof. split. done. by intros []. done. Qed.
Canonical Structure optionUR := UCMRAT (option A) option_ucmra_mixin. Canonical Structure optionUR := UCMRAT (option A) option_ucmra_mixin.
......
...@@ -12,6 +12,7 @@ Section coPset. ...@@ -12,6 +12,7 @@ Section coPset.
Canonical Structure coPsetC := discreteC coPset. Canonical Structure coPsetC := discreteC coPset.
Instance coPset_valid : Valid coPset := λ _, True. Instance coPset_valid : Valid coPset := λ _, True.
Instance coPset_unit : Unit coPset := ( : coPset).
Instance coPset_op : Op coPset := union. Instance coPset_op : Op coPset := union.
Instance coPset_pcore : PCore coPset := Some. Instance coPset_pcore : PCore coPset := Some.
...@@ -70,13 +71,13 @@ Section coPset_disj. ...@@ -70,13 +71,13 @@ Section coPset_disj.
Instance coPset_disj_valid : Valid coPset_disj := λ X, Instance coPset_disj_valid : Valid coPset_disj := λ X,
match X with CoPset _ => True | CoPsetBot => False end. match X with CoPset _ => True | CoPsetBot => False end.
Instance coPset_disj_empty : Empty coPset_disj := CoPset . Instance coPset_disj_unit : Unit coPset_disj := CoPset .
Instance coPset_disj_op : Op coPset_disj := λ X Y, Instance coPset_disj_op : Op coPset_disj := λ X Y,
match X, Y with match X, Y with
| CoPset X, CoPset Y => if decide (X Y) then CoPset (X Y) else CoPsetBot | CoPset X, CoPset Y => if decide (X Y) then CoPset (X Y) else CoPsetBot
| _, _ => CoPsetBot | _, _ => CoPsetBot
end. end.
Instance coPset_disj_pcore : PCore coPset_disj := λ _, Some . Instance coPset_disj_pcore : PCore coPset_disj := λ _, Some ε.
Ltac coPset_disj_solve := Ltac coPset_disj_solve :=
repeat (simpl || case_decide); repeat (simpl || case_decide);
......
...@@ -100,6 +100,7 @@ Section cmra. ...@@ -100,6 +100,7 @@ Section cmra.
Context `{Countable K} {A : cmraT}. Context `{Countable K} {A : cmraT}.
Implicit Types m : gmap K A. Implicit Types m : gmap K A.
Instance gmap_unit : Unit (gmap K A) := ( : gmap K A).
Instance gmap_op : Op (gmap K A) := merge op. Instance gmap_op : Op (gmap K A) := merge op.
Instance gmap_pcore : PCore (gmap K A) := λ m, Some (omap pcore m). Instance gmap_pcore : PCore (gmap K A) := λ m, Some (omap pcore m).
Instance gmap_valid : Valid (gmap K A) := λ m, i, (m !! i). Instance gmap_valid : Valid (gmap K A) := λ m, i, (m !! i).
...@@ -218,8 +219,9 @@ Lemma insert_valid m i x : ✓ x → ✓ m → ✓ <[i:=x]>m. ...@@ -218,8 +219,9 @@ Lemma insert_valid m i x : ✓ x → ✓ m → ✓ <[i:=x]>m.
Proof. by intros ?? j; destruct (decide (i = j)); simplify_map_eq. Qed. Proof. by intros ?? j; destruct (decide (i = j)); simplify_map_eq. Qed.
Lemma singleton_validN n i x : {n} ({[ i := x ]} : gmap K A) {n} x. Lemma singleton_validN n i x : {n} ({[ i := x ]} : gmap K A) {n} x.
Proof. Proof.
split; [|by intros; apply insert_validN, ucmra_unit_validN]. split.
by move=>/(_ i); simplify_map_eq. - move=>/(_ i); by simplify_map_eq.
- intros. apply insert_validN. done. apply: ucmra_unit_validN.
Qed. Qed.
Lemma singleton_valid i x : ({[ i := x ]} : gmap K A) x. Lemma singleton_valid i x : ({[ i := x ]} : gmap K A) x.
Proof. rewrite !cmra_valid_validN. by setoid_rewrite singleton_validN. Qed. Proof. rewrite !cmra_valid_validN. by setoid_rewrite singleton_validN. Qed.
......
...@@ -11,6 +11,7 @@ Section gset. ...@@ -11,6 +11,7 @@ Section gset.
Canonical Structure gsetC := discreteC (gset K). Canonical Structure gsetC := discreteC (gset K).
Instance gset_valid : Valid (gset K) := λ _, True. Instance gset_valid : Valid (gset K) := λ _, True.
Instance gset_unit : Unit (gset K) := ( : gset K).
Instance gset_op : Op (gset K) := union. Instance gset_op : Op (gset K) := union.
Instance gset_pcore : PCore (gset K) := λ X, Some X. Instance gset_pcore : PCore (gset K) := λ X, Some X.
...@@ -82,13 +83,13 @@ Section gset_disj. ...@@ -82,13 +83,13 @@ Section gset_disj.
Instance gset_disj_valid : Valid (gset_disj K) := λ X, Instance gset_disj_valid : Valid (gset_disj K) := λ X,
match X with GSet _ => True | GSetBot => False end. match X with GSet _ => True | GSetBot => False end.
Instance gset_disj_empty : Empty (gset_disj K) := GSet . Instance gset_disj_unit : Unit (gset_disj K) := GSet .
Instance gset_disj_op : Op (gset_disj K) := λ X Y, Instance gset_disj_op : Op (gset_disj K) := λ X Y,
match X, Y with match X, Y with
| GSet X, GSet Y => if decide (X Y) then GSet (X Y) else GSetBot | GSet X, GSet Y => if decide (X Y) then GSet (X Y) else GSetBot
| _, _ => GSetBot | _, _ => GSetBot
end. end.
Instance gset_disj_pcore : PCore (gset_disj K) := λ _, Some . Instance gset_disj_pcore : PCore (gset_disj K) := λ _, Some ε.
Ltac gset_disj_solve := Ltac gset_disj_solve :=
repeat (simpl || case_decide); repeat (simpl || case_decide);
...@@ -183,7 +184,7 @@ Section gset_disj. ...@@ -183,7 +184,7 @@ Section gset_disj.
End fresh_updates. End fresh_updates.
Lemma gset_disj_dealloc_local_update X Y : Lemma gset_disj_dealloc_local_update X Y :
(GSet X, GSet Y) ~l~> (GSet (X Y), ). (GSet X, GSet Y) ~l~> (GSet (X Y), GSet ).
Proof. Proof.
apply local_update_total_valid=> _ _ /gset_disj_included HYX. apply local_update_total_valid=> _ _ /gset_disj_included HYX.
rewrite local_update_unital_discrete=> -[Xf|] _ /leibniz_equiv_iff //=. rewrite local_update_unital_discrete=> -[Xf|] _ /leibniz_equiv_iff //=.
...@@ -192,7 +193,7 @@ Section gset_disj. ...@@ -192,7 +193,7 @@ Section gset_disj.
difference_diag_L !left_id_L difference_disjoint_L. difference_diag_L !left_id_L difference_disjoint_L.
Qed. Qed.
Lemma gset_disj_dealloc_empty_local_update X Z : Lemma gset_disj_dealloc_empty_local_update X Z :
(GSet Z GSet X, GSet Z) ~l~> (GSet X,). (GSet Z GSet X, GSet Z) ~l~> (GSet X, GSet ).
Proof. Proof.
apply local_update_total_valid=> /gset_disj_valid_op HZX _ _. apply local_update_total_valid=> /gset_disj_valid_op HZX _ _.
assert (X = (Z X) Z) as HX by set_solver. assert (X = (Z X) Z) as HX by set_solver.
...@@ -201,7 +202,7 @@ Section gset_disj. ...@@ -201,7 +202,7 @@ Section gset_disj.
Lemma gset_disj_dealloc_op_local_update X Y Z : Lemma gset_disj_dealloc_op_local_update X Y Z :
(GSet Z GSet X, GSet Z GSet Y) ~l~> (GSet X,GSet Y). (GSet Z GSet X, GSet Z GSet Y) ~l~> (GSet X,GSet Y).
Proof. Proof.
rewrite -{2}(left_id _ (GSet Y)). rewrite -{2}(left_id ε _ (GSet Y)).
apply op_local_update_frame, gset_disj_dealloc_empty_local_update. apply op_local_update_frame, gset_disj_dealloc_empty_local_update.
Qed. Qed.
......
...@@ -128,8 +128,8 @@ Section iprod_cmra. ...@@ -128,8 +128,8 @@ Section iprod_cmra.
Qed. Qed.
Canonical Structure iprodR := CMRAT (iprod B) iprod_cmra_mixin. Canonical Structure iprodR := CMRAT (iprod B) iprod_cmra_mixin.
Instance iprod_empty : Empty (iprod B) := λ x, . Instance iprod_unit : Unit (iprod B) := λ x, ε.
Definition iprod_lookup_empty x : x = := eq_refl. Definition iprod_lookup_empty x : ε x = ε := eq_refl.
Lemma iprod_ucmra_mixin : UCMRAMixin (iprod B). Lemma iprod_ucmra_mixin : UCMRAMixin (iprod B).
Proof. Proof.
...@@ -141,7 +141,7 @@ Section iprod_cmra. ...@@ -141,7 +141,7 @@ Section iprod_cmra.
Canonical Structure iprodUR := UCMRAT (iprod B) iprod_ucmra_mixin. Canonical Structure iprodUR := UCMRAT (iprod B) iprod_ucmra_mixin.
Global Instance iprod_empty_timeless : Global Instance iprod_empty_timeless :
( i, Timeless ( : B i)) Timeless ( : iprod B). ( i, Timeless (ε : B i)) Timeless (ε : iprod B).
Proof. intros ? f Hf x. by apply: timeless. Qed. Proof. intros ? f Hf x. by apply: timeless. Qed.
(** Internalized properties *) (** Internalized properties *)
...@@ -179,7 +179,7 @@ Arguments iprodR {_ _ _} _. ...@@ -179,7 +179,7 @@ Arguments iprodR {_ _ _} _.
Arguments iprodUR {_ _ _} _. Arguments iprodUR {_ _ _} _.
Definition iprod_singleton `{Finite A} {B : A ucmraT} Definition iprod_singleton `{Finite A} {B : A ucmraT}
(x : A) (y : B x) : iprod B := iprod_insert x y . (x : A) (y : B x) : iprod B := iprod_insert x y ε.
Instance: Params (@iprod_singleton) 5. Instance: Params (@iprod_singleton) 5.
Section iprod_singleton. Section iprod_singleton.
...@@ -195,11 +195,11 @@ Section iprod_singleton. ...@@ -195,11 +195,11 @@ Section iprod_singleton.
Lemma iprod_lookup_singleton x (y : B x) : (iprod_singleton x y) x = y. Lemma iprod_lookup_singleton x (y : B x) : (iprod_singleton x y) x = y.
Proof. by rewrite /iprod_singleton iprod_lookup_insert. Qed. Proof. by rewrite /iprod_singleton iprod_lookup_insert. Qed.
Lemma iprod_lookup_singleton_ne x x' (y : B x) : Lemma iprod_lookup_singleton_ne x x' (y : B x) :
x x' (iprod_singleton x y) x' = . x x' (iprod_singleton x y) x' = ε.
Proof. intros; by rewrite /iprod_singleton iprod_lookup_insert_ne. Qed. Proof. intros; by rewrite /iprod_singleton iprod_lookup_insert_ne. Qed.
Global Instance iprod_singleton_timeless x (y : B x) : Global Instance iprod_singleton_timeless x (y : B x) :
( i, Timeless ( : B i)) Timeless y Timeless (iprod_singleton x y). ( i, Timeless (ε : B i)) Timeless y Timeless (iprod_singleton x y).
Proof. apply _. Qed. Proof. apply _. Qed.
Lemma iprod_singleton_validN n x (y : B x) : {n} iprod_singleton x y {n} y. Lemma iprod_singleton_validN n x (y : B x) : {n} iprod_singleton x y {n} y.
...@@ -243,7 +243,7 @@ Section iprod_singleton. ...@@ -243,7 +243,7 @@ Section iprod_singleton.
Proof. eauto using iprod_insert_update. Qed. Proof. eauto using iprod_insert_update. Qed.
Lemma iprod_singleton_updateP_empty x (P : B x Prop) (Q : iprod B Prop) : Lemma iprod_singleton_updateP_empty x (P : B x Prop) (Q : iprod B Prop) :
~~>: P ( y2, P y2 Q (iprod_singleton x y2)) ~~>: Q. ε ~~>: P ( y2, P y2 Q (iprod_singleton x y2)) ε ~~>: Q.
Proof. Proof.
intros Hx HQ; apply cmra_total_updateP. intros Hx HQ; apply cmra_total_updateP.
intros n gf Hg. destruct (Hx n (Some (gf x))) as (y2&?&?); first apply Hg. intros n gf Hg. destruct (Hx n (Some (gf x))) as (y2&?&?); first apply Hg.
...@@ -253,10 +253,10 @@ Section iprod_singleton. ...@@ -253,10 +253,10 @@ Section iprod_singleton.
- rewrite iprod_lookup_op iprod_lookup_singleton_ne //. apply Hg. - rewrite iprod_lookup_op iprod_lookup_singleton_ne //. apply Hg.
Qed. Qed.
Lemma iprod_singleton_updateP_empty' x (P : B x Prop) : Lemma iprod_singleton_updateP_empty' x (P : B x Prop) :
~~>: P ~~>: λ g, y2, g = iprod_singleton x y2 P y2. ε ~~>: P ε ~~>: λ g, y2, g = iprod_singleton x y2 P y2.
Proof. eauto using iprod_singleton_updateP_empty. Qed. Proof. eauto using iprod_singleton_updateP_empty. Qed.
Lemma iprod_singleton_update_empty x (y : B x) : Lemma iprod_singleton_update_empty x (y : B x) :
~~> y ~~> iprod_singleton x y. ε ~~> y ε ~~> iprod_singleton x y.
Proof. Proof.
rewrite !cmra_update_updateP; rewrite !cmra_update_updateP;
eauto using iprod_singleton_updateP_empty with subst. eauto using iprod_singleton_updateP_empty with subst.
......
...@@ -221,7 +221,7 @@ Section cmra. ...@@ -221,7 +221,7 @@ Section cmra.
Qed. Qed.
Canonical Structure listR := CMRAT (list A) list_cmra_mixin. Canonical Structure listR := CMRAT (list A) list_cmra_mixin.
Global Instance empty_list : Empty (list A) := []. Global Instance list_unit : Unit (list A) := [].
Definition list_ucmra_mixin : UCMRAMixin (list A). Definition list_ucmra_mixin : UCMRAMixin (list A).
Proof.