Commit a3028b92 authored by Robbert Krebbers's avatar Robbert Krebbers

Consistently de-capitalize acronyms.

Rename `UCMRA` → `Ucmra`
Rename `CMRA` → `Cmra`
Rename `OFE` → `Ofe` (`Ofe` was already used partially, but many occurences were missing)
Rename `STS` → `Sts`
Rename `DRA` → `Dra`
parent 4886e15f
...@@ -131,7 +131,7 @@ Proof. ...@@ -131,7 +131,7 @@ Proof.
- destruct (elem_of_agree x1); naive_solver. - destruct (elem_of_agree x1); naive_solver.
Qed. Qed.
Definition agree_cmra_mixin : CMRAMixin (agree A). Definition agree_cmra_mixin : CmraMixin (agree A).
Proof. Proof.
apply cmra_total_mixin; try apply _ || by eauto. apply cmra_total_mixin; try apply _ || by eauto.
- intros n x; rewrite !agree_validN_def; eauto using dist_S. - intros n x; rewrite !agree_validN_def; eauto using dist_S.
...@@ -142,14 +142,14 @@ Proof. ...@@ -142,14 +142,14 @@ Proof.
+ by rewrite agree_idemp. + by rewrite agree_idemp.
+ by move: Hval; rewrite Hx; move=> /agree_op_invN->; rewrite agree_idemp. + by move: Hval; rewrite Hx; move=> /agree_op_invN->; rewrite agree_idemp.
Qed. Qed.
Canonical Structure agreeR : cmraT := CMRAT (agree A) agree_cmra_mixin. Canonical Structure agreeR : cmraT := CmraT (agree A) agree_cmra_mixin.
Global Instance agree_total : CMRATotal agreeR. Global Instance agree_cmra_total : CmraTotal agreeR.
Proof. rewrite /CMRATotal; eauto. Qed. Proof. rewrite /CmraTotal; eauto. Qed.
Global Instance agree_persistent (x : agree A) : Persistent x. Global Instance agree_persistent (x : agree A) : Persistent x.
Proof. by constructor. Qed. Proof. by constructor. Qed.
Global Instance agree_cmra_discrete : OFEDiscrete A CMRADiscrete agreeR. Global Instance agree_cmra_discrete : OfeDiscrete A CmraDiscrete agreeR.
Proof. Proof.
intros HD. split. intros HD. split.
- intros x y [H H'] n; split=> a; setoid_rewrite <-(discrete_iff_0 _ _); auto. - intros x y [H H'] n; split=> a; setoid_rewrite <-(discrete_iff_0 _ _); auto.
...@@ -267,7 +267,7 @@ Section agree_map. ...@@ -267,7 +267,7 @@ Section agree_map.
- intros (a&->&?). exists (f a). rewrite -Hfg; eauto. - intros (a&->&?). exists (f a). rewrite -Hfg; eauto.
Qed. Qed.
Global Instance agree_map_morphism : CMRAMorphism (agree_map f). Global Instance agree_map_morphism : CmraMorphism (agree_map f).
Proof using Hf. Proof using Hf.
split; first apply _. split; first apply _.
- intros n x. rewrite !agree_validN_def=> Hv b b' /=. - intros n x. rewrite !agree_validN_def=> Hv b b' /=.
......
...@@ -52,7 +52,7 @@ Qed. ...@@ -52,7 +52,7 @@ Qed.
Global Instance Auth_discrete a b : Global Instance Auth_discrete a b :
Discrete a Discrete b Discrete (Auth a b). Discrete a Discrete b Discrete (Auth a b).
Proof. by intros ?? [??] [??]; split; apply: discrete. Qed. Proof. by intros ?? [??] [??]; split; apply: discrete. Qed.
Global Instance auth_ofe_discrete : OFEDiscrete A OFEDiscrete authC. Global Instance auth_ofe_discrete : OfeDiscrete A OfeDiscrete authC.
Proof. intros ? [??]; apply _. Qed. Proof. intros ? [??]; apply _. Qed.
Global Instance auth_leibniz : LeibnizEquiv A LeibnizEquiv (auth A). Global Instance auth_leibniz : LeibnizEquiv A LeibnizEquiv (auth A).
Proof. by intros ? [??] [??] [??]; f_equal/=; apply leibniz_equiv. Qed. Proof. by intros ? [??] [??] [??]; f_equal/=; apply leibniz_equiv. Qed.
...@@ -113,7 +113,7 @@ Proof. ...@@ -113,7 +113,7 @@ Proof.
destruct x as [[[]|]]; naive_solver eauto using cmra_validN_includedN. destruct x as [[[]|]]; naive_solver eauto using cmra_validN_includedN.
Qed. Qed.
Lemma auth_valid_discrete `{CMRADiscrete A} x : Lemma auth_valid_discrete `{CmraDiscrete A} x :
x match authoritative x with x match authoritative x with
| Excl' a => auth_own x a a | Excl' a => auth_own x a a
| None => auth_own x | None => auth_own x
...@@ -125,18 +125,18 @@ Proof. ...@@ -125,18 +125,18 @@ Proof.
Qed. Qed.
Lemma auth_validN_2 n a b : {n} ( a b) b {n} a {n} a. Lemma auth_validN_2 n a b : {n} ( a b) b {n} a {n} a.
Proof. by rewrite auth_validN_eq /= left_id. Qed. Proof. by rewrite auth_validN_eq /= left_id. Qed.
Lemma auth_valid_discrete_2 `{CMRADiscrete A} a b : ( a b) b a a. Lemma auth_valid_discrete_2 `{CmraDiscrete A} a b : ( a b) b a a.
Proof. by rewrite auth_valid_discrete /= left_id. Qed. Proof. by rewrite auth_valid_discrete /= left_id. Qed.
Lemma authoritative_valid x : x authoritative x. Lemma authoritative_valid x : x authoritative x.
Proof. by destruct x as [[[]|]]. Qed. Proof. by destruct x as [[[]|]]. Qed.
Lemma auth_own_valid `{CMRADiscrete A} x : x auth_own x. Lemma auth_own_valid `{CmraDiscrete A} x : x auth_own x.
Proof. Proof.
rewrite auth_valid_discrete. rewrite auth_valid_discrete.
destruct x as [[[]|]]; naive_solver eauto using cmra_valid_included. destruct x as [[[]|]]; naive_solver eauto using cmra_valid_included.
Qed. Qed.
Lemma auth_cmra_mixin : CMRAMixin (auth A). Lemma auth_cmra_mixin : CmraMixin (auth A).
Proof. Proof.
apply cmra_total_mixin. apply cmra_total_mixin.
- eauto. - eauto.
...@@ -166,9 +166,9 @@ Proof. ...@@ -166,9 +166,9 @@ Proof.
as (b1&b2&?&?&?); auto using auth_own_validN. as (b1&b2&?&?&?); auto using auth_own_validN.
by exists (Auth ea1 b1), (Auth ea2 b2). by exists (Auth ea1 b1), (Auth ea2 b2).
Qed. Qed.
Canonical Structure authR := CMRAT (auth A) auth_cmra_mixin. Canonical Structure authR := CmraT (auth A) auth_cmra_mixin.
Global Instance auth_cmra_discrete : CMRADiscrete A CMRADiscrete authR. Global Instance auth_cmra_discrete : CmraDiscrete A CmraDiscrete authR.
Proof. Proof.
split; first apply _. split; first apply _.
intros [[[?|]|] ?]; rewrite auth_valid_eq auth_validN_eq /=; auto. intros [[[?|]|] ?]; rewrite auth_valid_eq auth_validN_eq /=; auto.
...@@ -178,14 +178,14 @@ Proof. ...@@ -178,14 +178,14 @@ Proof.
Qed. Qed.
Instance auth_empty : Unit (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.
- rewrite auth_valid_eq /=. apply ucmra_unit_valid. - rewrite auth_valid_eq /=. apply ucmra_unit_valid.
- by intros x; constructor; rewrite /= left_id. - by intros x; constructor; rewrite /= left_id.
- do 2 constructor; simpl; apply (persistent_core _). - do 2 constructor; simpl; apply (persistent_core _).
Qed. Qed.
Canonical Structure authUR := UCMRAT (auth A) auth_ucmra_mixin. Canonical Structure authUR := UcmraT (auth A) auth_ucmra_mixin.
Global Instance auth_frag_persistent a : Persistent a Persistent ( a). Global Instance auth_frag_persistent a : Persistent a Persistent ( a).
Proof. do 2 constructor; simpl; auto. by apply persistent_core. Qed. Proof. do 2 constructor; simpl; auto. by apply persistent_core. Qed.
...@@ -274,7 +274,7 @@ Proof. ...@@ -274,7 +274,7 @@ Proof.
apply option_fmap_ne; [|done]=> x y ?; by apply excl_map_ne. apply option_fmap_ne; [|done]=> x y ?; by apply excl_map_ne.
Qed. Qed.
Instance auth_map_cmra_morphism {A B : ucmraT} (f : A B) : Instance auth_map_cmra_morphism {A B : ucmraT} (f : A B) :
CMRAMorphism f CMRAMorphism (auth_map f). CmraMorphism f CmraMorphism (auth_map f).
Proof. Proof.
split; try apply _. split; try apply _.
- intros n [[[a|]|] b]; rewrite !auth_validN_eq; try - intros n [[[a|]|] b]; rewrite !auth_validN_eq; try
......
...@@ -41,7 +41,7 @@ Hint Extern 0 (_ ≼{_} _) => reflexivity. ...@@ -41,7 +41,7 @@ Hint Extern 0 (_ ≼{_} _) => reflexivity.
Section mixin. Section mixin.
Local Set Primitive Projections. Local Set Primitive Projections.
Record CMRAMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, ValidN A} := { Record CmraMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, ValidN A} := {
(* setoids *) (* setoids *)
mixin_cmra_op_ne (x : A) : NonExpansive (op x); mixin_cmra_op_ne (x : A) : NonExpansive (op x);
mixin_cmra_pcore_ne n x y cx : mixin_cmra_pcore_ne n x y cx :
...@@ -65,7 +65,7 @@ Section mixin. ...@@ -65,7 +65,7 @@ Section mixin.
End mixin. End mixin.
(** Bundeled version *) (** Bundeled version *)
Structure cmraT := CMRAT' { Structure cmraT := CmraT' {
cmra_car :> Type; cmra_car :> Type;
cmra_equiv : Equiv cmra_car; cmra_equiv : Equiv cmra_car;
cmra_dist : Dist cmra_car; cmra_dist : Dist cmra_car;
...@@ -74,14 +74,14 @@ Structure cmraT := CMRAT' { ...@@ -74,14 +74,14 @@ Structure cmraT := CMRAT' {
cmra_valid : Valid cmra_car; cmra_valid : Valid cmra_car;
cmra_validN : ValidN cmra_car; cmra_validN : ValidN cmra_car;
cmra_ofe_mixin : OfeMixin cmra_car; cmra_ofe_mixin : OfeMixin cmra_car;
cmra_mixin : CMRAMixin cmra_car; cmra_mixin : CmraMixin cmra_car;
_ : Type _ : Type
}. }.
Arguments CMRAT' _ {_ _ _ _ _ _} _ _ _. Arguments CmraT' _ {_ _ _ _ _ _} _ _ _.
(* Given [m : CMRAMixin A], the notation [CMRAT A m] provides a smart (* Given [m : CmraMixin A], the notation [CmraT A m] provides a smart
constructor, which uses [ofe_mixin_of A] to infer the canonical OFE mixin of constructor, which uses [ofe_mixin_of A] to infer the canonical OFE mixin of
the type [A], so that it does not have to be given manually. *) the type [A], so that it does not have to be given manually. *)
Notation CMRAT A m := (CMRAT' A (ofe_mixin_of A%type) m A) (only parsing). Notation CmraT A m := (CmraT' A (ofe_mixin_of A%type) m A) (only parsing).
Arguments cmra_car : simpl never. Arguments cmra_car : simpl never.
Arguments cmra_equiv : simpl never. Arguments cmra_equiv : simpl never.
...@@ -100,7 +100,7 @@ Hint Extern 0 (ValidN _) => eapply (@cmra_validN _) : typeclass_instances. ...@@ -100,7 +100,7 @@ Hint Extern 0 (ValidN _) => eapply (@cmra_validN _) : typeclass_instances.
Coercion cmra_ofeC (A : cmraT) : ofeT := OfeT A (cmra_ofe_mixin A). Coercion cmra_ofeC (A : cmraT) : ofeT := OfeT A (cmra_ofe_mixin A).
Canonical Structure cmra_ofeC. Canonical Structure cmra_ofeC.
Definition cmra_mixin_of' A {Ac : cmraT} (f : Ac A) : CMRAMixin Ac := cmra_mixin Ac. Definition cmra_mixin_of' A {Ac : cmraT} (f : Ac A) : CmraMixin Ac := cmra_mixin Ac.
Notation cmra_mixin_of A := Notation cmra_mixin_of A :=
ltac:(let H := eval hnf in (cmra_mixin_of' A id) in exact H) (only parsing). ltac:(let H := eval hnf in (cmra_mixin_of' A id) in exact H) (only parsing).
...@@ -171,8 +171,8 @@ Instance: Params (@IdFree) 1. ...@@ -171,8 +171,8 @@ Instance: Params (@IdFree) 1.
(** * CMRAs whose core is total *) (** * CMRAs whose core is total *)
(** The function [core] may return a dummy when used on CMRAs without total (** The function [core] may return a dummy when used on CMRAs without total
core. *) core. *)
Class CMRATotal (A : cmraT) := cmra_total (x : A) : is_Some (pcore x). Class CmraTotal (A : cmraT) := cmra_total (x : A) : is_Some (pcore x).
Hint Mode CMRATotal ! : typeclass_instances. Hint Mode CmraTotal ! : typeclass_instances.
Class Core (A : Type) := core : A A. Class Core (A : Type) := core : A A.
Hint Mode Core ! : typeclass_instances. Hint Mode Core ! : typeclass_instances.
...@@ -185,13 +185,13 @@ Arguments core' _ _ _ /. ...@@ -185,13 +185,13 @@ Arguments core' _ _ _ /.
Class Unit (A : Type) := ε : A. Class Unit (A : Type) := ε : A.
Arguments ε {_ _}. Arguments ε {_ _}.
Record UCMRAMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, Unit A} := { Record UcmraMixin A `{Dist A, Equiv A, PCore A, Op A, Valid A, Unit A} := {
mixin_ucmra_unit_valid : ε; mixin_ucmra_unit_valid : ε;
mixin_ucmra_unit_left_id : LeftId () ε (); mixin_ucmra_unit_left_id : LeftId () ε ();
mixin_ucmra_pcore_unit : pcore ε Some ε mixin_ucmra_pcore_unit : pcore ε Some ε
}. }.
Structure ucmraT := UCMRAT' { Structure ucmraT := UcmraT' {
ucmra_car :> Type; ucmra_car :> Type;
ucmra_equiv : Equiv ucmra_car; ucmra_equiv : Equiv ucmra_car;
ucmra_dist : Dist ucmra_car; ucmra_dist : Dist ucmra_car;
...@@ -201,13 +201,13 @@ Structure ucmraT := UCMRAT' { ...@@ -201,13 +201,13 @@ Structure ucmraT := UCMRAT' {
ucmra_validN : ValidN ucmra_car; ucmra_validN : ValidN ucmra_car;
ucmra_unit : Unit 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;
_ : Type; _ : Type;
}. }.
Arguments UCMRAT' _ {_ _ _ _ _ _ _} _ _ _ _. Arguments UcmraT' _ {_ _ _ _ _ _ _} _ _ _ _.
Notation UCMRAT A m := Notation UcmraT A m :=
(UCMRAT' A (ofe_mixin_of A%type) (cmra_mixin_of A%type) m A) (only parsing). (UcmraT' A (ofe_mixin_of A%type) (cmra_mixin_of A%type) m A) (only parsing).
Arguments ucmra_car : simpl never. Arguments ucmra_car : simpl never.
Arguments ucmra_equiv : simpl never. Arguments ucmra_equiv : simpl never.
Arguments ucmra_dist : simpl never. Arguments ucmra_dist : simpl never.
...@@ -223,7 +223,7 @@ Hint Extern 0 (Unit _) => eapply (@ucmra_unit _) : typeclass_instances. ...@@ -223,7 +223,7 @@ 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 :=
CMRAT' A (ucmra_ofe_mixin A) (ucmra_cmra_mixin A) A. CmraT' A (ucmra_ofe_mixin A) (ucmra_cmra_mixin A) A.
Canonical Structure ucmra_cmraR. Canonical Structure ucmra_cmraR.
(** Lifting properties from the mixin *) (** Lifting properties from the mixin *)
...@@ -239,14 +239,14 @@ Section ucmra_mixin. ...@@ -239,14 +239,14 @@ Section ucmra_mixin.
End ucmra_mixin. End ucmra_mixin.
(** * Discrete CMRAs *) (** * Discrete CMRAs *)
Class CMRADiscrete (A : cmraT) := { Class CmraDiscrete (A : cmraT) := {
cmra_discrete_ofe_discrete :> OFEDiscrete A; cmra_discrete_ofe_discrete :> OfeDiscrete A;
cmra_discrete_valid (x : A) : {0} x x cmra_discrete_valid (x : A) : {0} x x
}. }.
Hint Mode CMRADiscrete ! : typeclass_instances. Hint Mode CmraDiscrete ! : typeclass_instances.
(** * Morphisms *) (** * Morphisms *)
Class CMRAMorphism {A B : cmraT} (f : A B) := { Class CmraMorphism {A B : cmraT} (f : A B) := {
cmra_morphism_ne :> NonExpansive f; cmra_morphism_ne :> NonExpansive f;
cmra_morphism_validN n x : {n} x {n} f x; cmra_morphism_validN n x : {n} x {n} f x;
cmra_morphism_pcore x : pcore (f x) f <$> pcore x; cmra_morphism_pcore x : pcore (f x) f <$> pcore x;
...@@ -464,7 +464,7 @@ Qed. ...@@ -464,7 +464,7 @@ Qed.
(** ** Total core *) (** ** Total core *)
Section total_core. Section total_core.
Local Set Default Proof Using "Type*". Local Set Default Proof Using "Type*".
Context `{CMRATotal A}. Context `{CmraTotal A}.
Lemma cmra_core_l x : core x x x. Lemma cmra_core_l x : core x x x.
Proof. Proof.
...@@ -549,12 +549,12 @@ Proof. ...@@ -549,12 +549,12 @@ Proof.
Qed. Qed.
(** ** Discrete *) (** ** Discrete *)
Lemma cmra_discrete_valid_iff `{CMRADiscrete A} n x : x {n} x. Lemma cmra_discrete_valid_iff `{CmraDiscrete A} n x : x {n} x.
Proof. Proof.
split; first by rewrite cmra_valid_validN. split; first by rewrite cmra_valid_validN.
eauto using cmra_discrete_valid, cmra_validN_le with lia. eauto using cmra_discrete_valid, cmra_validN_le with lia.
Qed. Qed.
Lemma cmra_discrete_included_iff `{OFEDiscrete A} n x y : x y x {n} y. Lemma cmra_discrete_included_iff `{OfeDiscrete A} n x y : x y x {n} y.
Proof. Proof.
split; first by apply cmra_included_includedN. split; first by apply cmra_included_includedN.
intros [z ->%(discrete_iff _ _)]; eauto using cmra_included_l. intros [z ->%(discrete_iff _ _)]; eauto using cmra_included_l.
...@@ -565,7 +565,7 @@ Global Instance cancelable_proper : Proper (equiv ==> iff) (@Cancelable A). ...@@ -565,7 +565,7 @@ Global Instance cancelable_proper : Proper (equiv ==> iff) (@Cancelable A).
Proof. unfold Cancelable. intros x x' EQ. by setoid_rewrite EQ. Qed. Proof. unfold Cancelable. intros x x' EQ. by setoid_rewrite EQ. Qed.
Lemma cancelable x `{!Cancelable x} y z : (x y) x y x z y z. Lemma cancelable x `{!Cancelable x} y z : (x y) x y x z y z.
Proof. rewrite !equiv_dist cmra_valid_validN. intros. by apply (cancelableN x). Qed. Proof. rewrite !equiv_dist cmra_valid_validN. intros. by apply (cancelableN x). Qed.
Lemma discrete_cancelable x `{CMRADiscrete A}: Lemma discrete_cancelable x `{CmraDiscrete A}:
( y z, (x y) x y x z y z) Cancelable x. ( y z, (x y) x y x z y z) Cancelable x.
Proof. intros ????. rewrite -!discrete_iff -cmra_discrete_valid_iff. auto. Qed. Proof. intros ????. rewrite -!discrete_iff -cmra_discrete_valid_iff. auto. Qed.
Global Instance cancelable_op x y : Global Instance cancelable_op x y :
...@@ -595,7 +595,7 @@ Lemma id_free_r x `{!IdFree x} y : ✓x → x ⋅ y ≡ x → False. ...@@ -595,7 +595,7 @@ Lemma id_free_r x `{!IdFree x} y : ✓x → x ⋅ y ≡ x → False.
Proof. move=> /cmra_valid_validN ? /equiv_dist. eauto. Qed. Proof. move=> /cmra_valid_validN ? /equiv_dist. eauto. Qed.
Lemma id_free_l x `{!IdFree x} y : x y x x False. Lemma id_free_l x `{!IdFree x} y : x y x x False.
Proof. rewrite comm. eauto using id_free_r. Qed. Proof. rewrite comm. eauto using id_free_r. Qed.
Lemma discrete_id_free x `{CMRADiscrete A}: Lemma discrete_id_free x `{CmraDiscrete A}:
( y, x x y x False) IdFree x. ( y, x x y x False) IdFree x.
Proof. Proof.
intros Hx y ??. apply (Hx y), (discrete _); eauto using cmra_discrete_valid. intros Hx y ??. apply (Hx y), (discrete _); eauto using cmra_discrete_valid.
...@@ -627,7 +627,7 @@ Section ucmra. ...@@ -627,7 +627,7 @@ Section ucmra.
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_cmra_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)).
...@@ -639,7 +639,7 @@ Section ucmra. ...@@ -639,7 +639,7 @@ Section ucmra.
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_cmra_total.
(** * Properties about CMRAs with Leibniz equality *) (** * Properties about CMRAs with Leibniz equality *)
Section cmra_leibniz. Section cmra_leibniz.
...@@ -672,7 +672,7 @@ Section cmra_leibniz. ...@@ -672,7 +672,7 @@ Section cmra_leibniz.
(** ** Total core *) (** ** Total core *)
Section total_core. Section total_core.
Context `{CMRATotal A}. Context `{CmraTotal A}.
Lemma cmra_core_r_L x : x core x = x. Lemma cmra_core_r_L x : x core x = x.
Proof. unfold_leibniz. apply cmra_core_r. Qed. Proof. unfold_leibniz. apply cmra_core_r. Qed.
...@@ -718,7 +718,7 @@ Section cmra_total. ...@@ -718,7 +718,7 @@ Section cmra_total.
Context (extend : n (x y1 y2 : A), Context (extend : n (x y1 y2 : A),
{n} x x {n} y1 y2 {n} x x {n} y1 y2
z1 z2, x z1 z2 z1 {n} y1 z2 {n} y2). z1 z2, x z1 z2 z1 {n} y1 z2 {n} y2).
Lemma cmra_total_mixin : CMRAMixin A. Lemma cmra_total_mixin : CmraMixin A.
Proof using Type*. Proof using Type*.
split; auto. split; auto.
- intros n x y ? Hcx%core_ne Hx; move: Hcx. rewrite /core /= Hx /=. - intros n x y ? Hcx%core_ne Hx; move: Hcx. rewrite /core /= Hx /=.
...@@ -732,12 +732,12 @@ Section cmra_total. ...@@ -732,12 +732,12 @@ Section cmra_total.
End cmra_total. End cmra_total.
(** * Properties about morphisms *) (** * Properties about morphisms *)
Instance cmra_morphism_id {A : cmraT} : CMRAMorphism (@id A). Instance cmra_morphism_id {A : cmraT} : CmraMorphism (@id A).
Proof. split=>//=. apply _. intros. by rewrite option_fmap_id. Qed. Proof. split=>//=. apply _. intros. by rewrite option_fmap_id. Qed.
Instance cmra_morphism_proper {A B : cmraT} (f : A B) `{!CMRAMorphism f} : Instance cmra_morphism_proper {A B : cmraT} (f : A B) `{!CmraMorphism f} :
Proper (() ==> ()) f := ne_proper _. Proper (() ==> ()) f := ne_proper _.
Instance cmra_morphism_compose {A B C : cmraT} (f : A B) (g : B C) : Instance cmra_morphism_compose {A B C : cmraT} (f : A B) (g : B C) :
CMRAMorphism f CMRAMorphism g CMRAMorphism (g f). CmraMorphism f CmraMorphism g CmraMorphism (g f).
Proof. Proof.
split. split.
- apply _. - apply _.
...@@ -748,7 +748,7 @@ Qed. ...@@ -748,7 +748,7 @@ Qed.
Section cmra_morphism. Section cmra_morphism.
Local Set Default Proof Using "Type*". Local Set Default Proof Using "Type*".
Context {A B : cmraT} (f : A B) `{!CMRAMorphism f}. Context {A B : cmraT} (f : A B) `{!CmraMorphism f}.
Lemma cmra_morphism_core x : core (f x) f (core x). Lemma cmra_morphism_core x : core (f x) f (core x).
Proof. unfold core, core'. rewrite cmra_morphism_pcore. by destruct (pcore x). Qed. Proof. unfold core, core'. rewrite cmra_morphism_pcore. by destruct (pcore x). Qed.
Lemma cmra_morphism_monotone x y : x y f x f y. Lemma cmra_morphism_monotone x y : x y f x f y.
...@@ -771,7 +771,7 @@ Structure rFunctor := RFunctor { ...@@ -771,7 +771,7 @@ Structure rFunctor := RFunctor {
(f : A2 -n> A1) (g : A3 -n> A2) (f' : B1 -n> B2) (g' : B2 -n> B3) x : (f : A2 -n> A1) (g : A3 -n> A2) (f' : B1 -n> B2) (g' : B2 -n> B3) x :
rFunctor_map (fg, g'f') x rFunctor_map (g,g') (rFunctor_map (f,f') x); rFunctor_map (fg, g'f') x rFunctor_map (g,g') (rFunctor_map (f,f') x);
rFunctor_mor {A1 A2 B1 B2} (fg : (A2 -n> A1) * (B1 -n> B2)) : rFunctor_mor {A1 A2 B1 B2} (fg : (A2 -n> A1) * (B1 -n> B2)) :
CMRAMorphism (rFunctor_map fg) CmraMorphism (rFunctor_map fg)
}. }.
Existing Instances rFunctor_ne rFunctor_mor. Existing Instances rFunctor_ne rFunctor_mor.
Instance: Params (@rFunctor_map) 5. Instance: Params (@rFunctor_map) 5.
...@@ -804,7 +804,7 @@ Structure urFunctor := URFunctor { ...@@ -804,7 +804,7 @@ Structure urFunctor := URFunctor {
(f : A2 -n> A1) (g : A3 -n> A2) (f' : B1 -n> B2) (g' : B2 -n> B3) x : (f : A2 -n> A1) (g : A3 -n> A2) (f' : B1 -n> B2) (g' : B2 -n> B3) x :
urFunctor_map (fg, g'f') x urFunctor_map (g,g') (urFunctor_map (f,f') x); urFunctor_map (fg, g'f') x urFunctor_map (g,g') (urFunctor_map (f,f') x);
urFunctor_mor {A1 A2 B1 B2} (fg : (A2 -n> A1) * (B1 -n> B2)) : urFunctor_mor {A1 A2 B1 B2} (fg : (A2 -n> A1) * (B1 -n> B2)) :
CMRAMorphism (urFunctor_map fg) CmraMorphism (urFunctor_map fg)
}. }.
Existing Instances urFunctor_ne urFunctor_mor. Existing Instances urFunctor_ne urFunctor_mor.
Instance: Params (@urFunctor_map) 5. Instance: Params (@urFunctor_map) 5.
...@@ -876,7 +876,7 @@ Section discrete. ...@@ -876,7 +876,7 @@ Section discrete.
Existing Instances discrete_dist. Existing Instances discrete_dist.
Instance discrete_validN : ValidN A := λ n x, x. Instance discrete_validN : ValidN A := λ n x, x.
Definition discrete_cmra_mixin : CMRAMixin A. Definition discrete_cmra_mixin : CmraMixin A.
Proof. Proof.
destruct ra_mix; split; try done. destruct ra_mix; split; try done.
- intros x; split; first done. by move=> /(_ 0). - intros x; split; first done. by move=> /(_ 0).
...@@ -884,15 +884,15 @@ Section discrete. ...@@ -884,15 +884,15 @@ Section discrete.
Qed. Qed.
Instance discrete_cmra_discrete : Instance discrete_cmra_discrete :
CMRADiscrete (CMRAT' A (discrete_ofe_mixin Heq) discrete_cmra_mixin A).