Commit bf610ff2 authored by Ralf Jung's avatar Ralf Jung
Browse files

rename: minus -> div. Also change notation accordingly.

parent 9ac5d31a
...@@ -61,7 +61,7 @@ Program Instance agree_op : Op (agree A) := λ x y, ...@@ -61,7 +61,7 @@ Program Instance agree_op : Op (agree A) := λ x y,
agree_is_valid n := agree_is_valid x n agree_is_valid y n x {n} y |}. agree_is_valid n := agree_is_valid x n agree_is_valid y n x {n} y |}.
Next Obligation. naive_solver eauto using agree_valid_S, dist_S. Qed. Next Obligation. naive_solver eauto using agree_valid_S, dist_S. Qed.
Instance agree_unit : Unit (agree A) := id. Instance agree_unit : Unit (agree A) := id.
Instance agree_minus : Minus (agree A) := λ x y, x. Instance agree_div : Div (agree A) := λ x y, x.
Instance: Comm () (@op (agree A) _). Instance: Comm () (@op (agree A) _).
Proof. intros x y; split; [naive_solver|by intros n (?&?&Hxy); apply Hxy]. Qed. Proof. intros x y; split; [naive_solver|by intros n (?&?&Hxy); apply Hxy]. Qed.
......
...@@ -89,8 +89,8 @@ Instance auth_unit : Unit (auth A) := λ x, ...@@ -89,8 +89,8 @@ Instance auth_unit : Unit (auth A) := λ x,
Auth (unit (authoritative x)) (unit (own x)). Auth (unit (authoritative x)) (unit (own x)).
Instance auth_op : Op (auth A) := λ x y, Instance auth_op : Op (auth A) := λ x y,
Auth (authoritative x authoritative y) (own x own y). Auth (authoritative x authoritative y) (own x own y).
Instance auth_minus : Minus (auth A) := λ x y, Instance auth_div : Div (auth A) := λ x y,
Auth (authoritative x authoritative y) (own x own y). Auth (authoritative x ÷ authoritative y) (own x ÷ own y).
Lemma auth_included (x y : auth A) : Lemma auth_included (x y : auth A) :
x y authoritative x authoritative y own x own y. x y authoritative x authoritative y own x own y.
...@@ -126,7 +126,7 @@ Proof. ...@@ -126,7 +126,7 @@ Proof.
intros n [[a1| |] b1] [[a2| |] b2]; intros n [[a1| |] b1] [[a2| |] b2];
naive_solver eauto using cmra_validN_op_l, cmra_validN_includedN. naive_solver eauto using cmra_validN_op_l, cmra_validN_includedN.
- by intros ??; rewrite auth_included; - by intros ??; rewrite auth_included;
intros [??]; split; simpl; apply cmra_op_minus. intros [??]; split; simpl; apply cmra_op_div.
- intros n x y1 y2 ? [??]; simpl in *. - intros n x y1 y2 ? [??]; simpl in *.
destruct (cmra_extend n (authoritative x) (authoritative y1) destruct (cmra_extend n (authoritative x) (authoritative y1)
(authoritative y2)) as (ea&?&?&?); auto using authoritative_validN. (authoritative y2)) as (ea&?&?&?); auto using authoritative_validN.
......
...@@ -14,9 +14,9 @@ Notation "(≼)" := included (only parsing) : C_scope. ...@@ -14,9 +14,9 @@ Notation "(≼)" := included (only parsing) : C_scope.
Hint Extern 0 (_ _) => reflexivity. Hint Extern 0 (_ _) => reflexivity.
Instance: Params (@included) 3. Instance: Params (@included) 3.
Class Minus (A : Type) := minus : A A A. Class Div (A : Type) := div : A A A.
Instance: Params (@minus) 2. Instance: Params (@div) 2.
Infix "" := minus (at level 40) : C_scope. Infix "÷" := div : C_scope.
Class ValidN (A : Type) := validN : nat A Prop. Class ValidN (A : Type) := validN : nat A Prop.
Instance: Params (@validN) 3. Instance: Params (@validN) 3.
...@@ -34,12 +34,12 @@ Instance: Params (@includedN) 4. ...@@ -34,12 +34,12 @@ Instance: Params (@includedN) 4.
Hint Extern 0 (_ {_} _) => reflexivity. Hint Extern 0 (_ {_} _) => reflexivity.
Record CMRAMixin A Record CMRAMixin A
`{Dist A, Equiv A, Unit A, Op A, Valid A, ValidN A, Minus A} := { `{Dist A, Equiv A, Unit A, Op A, Valid A, ValidN A, Div A} := {
(* setoids *) (* setoids *)
mixin_cmra_op_ne n (x : A) : Proper (dist n ==> dist n) (op x); mixin_cmra_op_ne n (x : A) : Proper (dist n ==> dist n) (op x);
mixin_cmra_unit_ne n : Proper (dist n ==> dist n) unit; mixin_cmra_unit_ne n : Proper (dist n ==> dist n) unit;
mixin_cmra_validN_ne n : Proper (dist n ==> impl) (validN n); mixin_cmra_validN_ne n : Proper (dist n ==> impl) (validN n);
mixin_cmra_minus_ne n : Proper (dist n ==> dist n ==> dist n) minus; mixin_cmra_div_ne n : Proper (dist n ==> dist n ==> dist n) div;
(* valid *) (* valid *)
mixin_cmra_valid_validN x : x n, {n} x; mixin_cmra_valid_validN x : x n, {n} x;
mixin_cmra_validN_S n x : {S n} x {n} x; mixin_cmra_validN_S n x : {S n} x {n} x;
...@@ -50,7 +50,7 @@ Record CMRAMixin A ...@@ -50,7 +50,7 @@ Record CMRAMixin A
mixin_cmra_unit_idemp x : unit (unit x) unit x; mixin_cmra_unit_idemp x : unit (unit x) unit x;
mixin_cmra_unit_preserving x y : x y unit x unit y; mixin_cmra_unit_preserving x y : x y unit x unit y;
mixin_cmra_validN_op_l n x y : {n} (x y) {n} x; mixin_cmra_validN_op_l n x y : {n} (x y) {n} x;
mixin_cmra_op_minus x y : x y x y x y; mixin_cmra_op_div x y : x y x y ÷ x y;
mixin_cmra_extend n x y1 y2 : mixin_cmra_extend n x y1 y2 :
{n} x x {n} y1 y2 {n} x x {n} y1 y2
{ z | x z.1 z.2 z.1 {n} y1 z.2 {n} y2 } { z | x z.1 z.2 z.1 {n} y1 z.2 {n} y2 }
...@@ -66,7 +66,7 @@ Structure cmraT := CMRAT { ...@@ -66,7 +66,7 @@ Structure cmraT := CMRAT {
cmra_op : Op cmra_car; cmra_op : Op cmra_car;
cmra_valid : Valid cmra_car; cmra_valid : Valid cmra_car;
cmra_validN : ValidN cmra_car; cmra_validN : ValidN cmra_car;
cmra_minus : Minus cmra_car; cmra_div : Div cmra_car;
cmra_cofe_mixin : CofeMixin cmra_car; cmra_cofe_mixin : CofeMixin cmra_car;
cmra_mixin : CMRAMixin cmra_car cmra_mixin : CMRAMixin cmra_car
}. }.
...@@ -79,11 +79,11 @@ Arguments cmra_unit : simpl never. ...@@ -79,11 +79,11 @@ Arguments cmra_unit : simpl never.
Arguments cmra_op : simpl never. Arguments cmra_op : simpl never.
Arguments cmra_valid : simpl never. Arguments cmra_valid : simpl never.
Arguments cmra_validN : simpl never. Arguments cmra_validN : simpl never.
Arguments cmra_minus : simpl never. Arguments cmra_div : simpl never.
Arguments cmra_cofe_mixin : simpl never. Arguments cmra_cofe_mixin : simpl never.
Arguments cmra_mixin : simpl never. Arguments cmra_mixin : simpl never.
Add Printing Constructor cmraT. Add Printing Constructor cmraT.
Existing Instances cmra_unit cmra_op cmra_valid cmra_validN cmra_minus. Existing Instances cmra_unit cmra_op cmra_valid cmra_validN cmra_div.
Coercion cmra_cofeC (A : cmraT) : cofeT := CofeT (cmra_cofe_mixin A). Coercion cmra_cofeC (A : cmraT) : cofeT := CofeT (cmra_cofe_mixin A).
Canonical Structure cmra_cofeC. Canonical Structure cmra_cofeC.
...@@ -97,9 +97,9 @@ Section cmra_mixin. ...@@ -97,9 +97,9 @@ Section cmra_mixin.
Proof. apply (mixin_cmra_unit_ne _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_unit_ne _ (cmra_mixin A)). Qed.
Global Instance cmra_validN_ne n : Proper (dist n ==> impl) (@validN A _ n). Global Instance cmra_validN_ne n : Proper (dist n ==> impl) (@validN A _ n).
Proof. apply (mixin_cmra_validN_ne _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_validN_ne _ (cmra_mixin A)). Qed.
Global Instance cmra_minus_ne n : Global Instance cmra_div_ne n :
Proper (dist n ==> dist n ==> dist n) (@minus A _). Proper (dist n ==> dist n ==> dist n) (@div A _).
Proof. apply (mixin_cmra_minus_ne _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_div_ne _ (cmra_mixin A)). Qed.
Lemma cmra_valid_validN x : x n, {n} x. Lemma cmra_valid_validN x : x n, {n} x.
Proof. apply (mixin_cmra_valid_validN _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_valid_validN _ (cmra_mixin A)). Qed.
Lemma cmra_validN_S n x : {S n} x {n} x. Lemma cmra_validN_S n x : {S n} x {n} x.
...@@ -116,8 +116,8 @@ Section cmra_mixin. ...@@ -116,8 +116,8 @@ Section cmra_mixin.
Proof. apply (mixin_cmra_unit_preserving _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_unit_preserving _ (cmra_mixin A)). Qed.
Lemma cmra_validN_op_l n x y : {n} (x y) {n} x. Lemma cmra_validN_op_l n x y : {n} (x y) {n} x.
Proof. apply (mixin_cmra_validN_op_l _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_validN_op_l _ (cmra_mixin A)). Qed.
Lemma cmra_op_minus x y : x y x y x y. Lemma cmra_op_div x y : x y x y ÷ x y.
Proof. apply (mixin_cmra_op_minus _ (cmra_mixin A)). Qed. Proof. apply (mixin_cmra_op_div _ (cmra_mixin A)). Qed.
Lemma cmra_extend n x y1 y2 : Lemma cmra_extend n x y1 y2 :
{n} x x {n} y1 y2 {n} x x {n} y1 y2
{ z | x z.1 z.2 z.1 {n} y1 z.2 {n} y2 }. { z | x z.1 z.2 z.1 {n} y1 z.2 {n} y2 }.
...@@ -188,7 +188,7 @@ Global Instance cmra_validN_ne' : Proper (dist n ==> iff) (@validN A _ n) | 1. ...@@ -188,7 +188,7 @@ Global Instance cmra_validN_ne' : Proper (dist n ==> iff) (@validN A _ n) | 1.
Proof. by split; apply cmra_validN_ne. Qed. Proof. by split; apply cmra_validN_ne. Qed.
Global Instance cmra_validN_proper : Proper (() ==> iff) (@validN A _ n) | 1. Global Instance cmra_validN_proper : Proper (() ==> iff) (@validN A _ n) | 1.
Proof. by intros n x1 x2 Hx; apply cmra_validN_ne', equiv_dist. Qed. Proof. by intros n x1 x2 Hx; apply cmra_validN_ne', equiv_dist. Qed.
Global Instance cmra_minus_proper : Proper (() ==> () ==> ()) (@minus A _). Global Instance cmra_div_proper : Proper (() ==> () ==> ()) (@div A _).
Proof. apply (ne_proper_2 _). Qed. Proof. apply (ne_proper_2 _). Qed.
Global Instance cmra_valid_proper : Proper (() ==> iff) (@valid A _). Global Instance cmra_valid_proper : Proper (() ==> iff) (@valid A _).
...@@ -246,16 +246,16 @@ Proof. rewrite -{1}(cmra_unit_l x); apply cmra_validN_op_l. Qed. ...@@ -246,16 +246,16 @@ Proof. rewrite -{1}(cmra_unit_l x); apply cmra_validN_op_l. Qed.
Lemma cmra_unit_valid x : x unit x. Lemma cmra_unit_valid x : x unit x.
Proof. rewrite -{1}(cmra_unit_l x); apply cmra_valid_op_l. Qed. Proof. rewrite -{1}(cmra_unit_l x); apply cmra_valid_op_l. Qed.
(** ** Minus *) (** ** Div *)
Lemma cmra_op_minus' n x y : x {n} y x y x {n} y. Lemma cmra_op_div' n x y : x {n} y x y ÷ x {n} y.
Proof. intros [z ->]. by rewrite cmra_op_minus; last exists z. Qed. Proof. intros [z ->]. by rewrite cmra_op_div; last exists z. Qed.
(** ** Order *) (** ** Order *)
Lemma cmra_included_includedN x y : x y n, x {n} y. Lemma cmra_included_includedN x y : x y n, x {n} y.
Proof. Proof.
split; [by intros [z Hz] n; exists z; rewrite Hz|]. split; [by intros [z Hz] n; exists z; rewrite Hz|].
intros Hxy; exists (y x); apply equiv_dist=> n. intros Hxy; exists (y ÷ x); apply equiv_dist=> n.
by rewrite cmra_op_minus'. by rewrite cmra_op_div'.
Qed. Qed.
Global Instance cmra_includedN_preorder n : PreOrder (@includedN A _ _ n). Global Instance cmra_includedN_preorder n : PreOrder (@includedN A _ _ n).
Proof. Proof.
...@@ -486,12 +486,12 @@ End cmra_transport. ...@@ -486,12 +486,12 @@ End cmra_transport.
(** * Instances *) (** * Instances *)
(** ** Discrete CMRA *) (** ** Discrete CMRA *)
Class RA A `{Equiv A, Unit A, Op A, Valid A, Minus A} := { Class RA A `{Equiv A, Unit A, Op A, Valid A, Div A} := {
(* setoids *) (* setoids *)
ra_op_ne (x : A) : Proper (() ==> ()) (op x); ra_op_ne (x : A) : Proper (() ==> ()) (op x);
ra_unit_ne :> Proper (() ==> ()) unit; ra_unit_ne :> Proper (() ==> ()) unit;
ra_validN_ne :> Proper (() ==> impl) valid; ra_validN_ne :> Proper (() ==> impl) valid;
ra_minus_ne :> Proper (() ==> () ==> ()) minus; ra_div_ne :> Proper (() ==> () ==> ()) div;
(* monoid *) (* monoid *)
ra_assoc :> Assoc () (); ra_assoc :> Assoc () ();
ra_comm :> Comm () (); ra_comm :> Comm () ();
...@@ -499,12 +499,12 @@ Class RA A `{Equiv A, Unit A, Op A, Valid A, Minus A} := { ...@@ -499,12 +499,12 @@ Class RA A `{Equiv A, Unit A, Op A, Valid A, Minus A} := {
ra_unit_idemp x : unit (unit x) unit x; ra_unit_idemp x : unit (unit x) unit x;
ra_unit_preserving x y : x y unit x unit y; ra_unit_preserving x y : x y unit x unit y;
ra_valid_op_l x y : (x y) x; ra_valid_op_l x y : (x y) x;
ra_op_minus x y : x y x y x y ra_op_div x y : x y x y ÷ x y
}. }.
Section discrete. Section discrete.
Context {A : cofeT} `{Discrete A}. Context {A : cofeT} `{Discrete A}.
Context `{Unit A, Op A, Valid A, Minus A} (ra : RA A). Context `{Unit A, Op A, Valid A, Div A} (ra : RA A).
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.
...@@ -525,7 +525,7 @@ Section unit. ...@@ -525,7 +525,7 @@ Section unit.
Instance unit_valid : Valid () := λ x, True. Instance unit_valid : Valid () := λ x, True.
Instance unit_unit : Unit () := λ x, x. Instance unit_unit : Unit () := λ x, x.
Instance unit_op : Op () := λ x y, (). Instance unit_op : Op () := λ x y, ().
Instance unit_minus : Minus () := λ x y, (). Instance unit_div : Div () := λ x y, ().
Global Instance unit_empty : Empty () := (). Global Instance unit_empty : Empty () := ().
Definition unit_ra : RA (). Definition unit_ra : RA ().
Proof. by split. Qed. Proof. by split. Qed.
...@@ -544,7 +544,7 @@ Section prod. ...@@ -544,7 +544,7 @@ Section prod.
Instance prod_unit : Unit (A * B) := λ x, (unit (x.1), unit (x.2)). Instance prod_unit : Unit (A * B) := λ x, (unit (x.1), unit (x.2)).
Instance prod_valid : Valid (A * B) := λ x, x.1 x.2. Instance prod_valid : Valid (A * B) := λ x, x.1 x.2.
Instance prod_validN : ValidN (A * B) := λ n x, {n} x.1 {n} x.2. Instance prod_validN : ValidN (A * B) := λ n x, {n} x.1 {n} x.2.
Instance prod_minus : Minus (A * B) := λ x y, (x.1 y.1, x.2 y.2). Instance prod_div : Div (A * B) := λ x y, (x.1 ÷ y.1, x.2 ÷ y.2).
Lemma prod_included (x y : A * B) : x y x.1 y.1 x.2 y.2. Lemma prod_included (x y : A * B) : x y x.1 y.1 x.2 y.2.
Proof. Proof.
split; [intros [z Hz]; split; [exists (z.1)|exists (z.2)]; apply Hz|]. split; [intros [z Hz]; split; [exists (z.1)|exists (z.2)]; apply Hz|].
...@@ -575,7 +575,7 @@ Section prod. ...@@ -575,7 +575,7 @@ Section prod.
by intros [??]; split; apply cmra_unit_preserving. by intros [??]; split; apply cmra_unit_preserving.
- intros n x y [??]; split; simpl in *; eauto using cmra_validN_op_l. - intros n x y [??]; split; simpl in *; eauto using cmra_validN_op_l.
- intros x y; rewrite prod_included; intros [??]. - intros x y; rewrite prod_included; intros [??].
by split; apply cmra_op_minus. by split; apply cmra_op_div.
- intros n x y1 y2 [??] [??]; simpl in *. - intros n x y1 y2 [??] [??]; simpl in *.
destruct (cmra_extend n (x.1) (y1.1) (y2.1)) as (z1&?&?&?); auto. destruct (cmra_extend n (x.1) (y1.1) (y2.1)) as (z1&?&?&?); auto.
destruct (cmra_extend n (x.2) (y1.2) (y2.2)) as (z2&?&?&?); auto. destruct (cmra_extend n (x.2) (y1.2) (y2.2)) as (z2&?&?&?); auto.
......
...@@ -27,7 +27,7 @@ Instance dec_agree_op : Op (dec_agree A) := λ x y, ...@@ -27,7 +27,7 @@ Instance dec_agree_op : Op (dec_agree A) := λ x y,
| _, _ => DecAgreeBot | _, _ => DecAgreeBot
end. end.
Instance dec_agree_unit : Unit (dec_agree A) := id. Instance dec_agree_unit : Unit (dec_agree A) := id.
Instance dec_agree_minus : Minus (dec_agree A) := λ x y, x. Instance dec_agree_div : Div (dec_agree A) := λ x y, x.
Definition dec_agree_ra : RA (dec_agree A). Definition dec_agree_ra : RA (dec_agree A).
Proof. Proof.
......
...@@ -18,18 +18,18 @@ Definition dra_included `{Equiv A, Valid A, Disjoint A, Op A} := λ x y, ...@@ -18,18 +18,18 @@ Definition dra_included `{Equiv A, Valid A, Disjoint A, Op A} := λ x y,
Instance: Params (@dra_included) 4. Instance: Params (@dra_included) 4.
Local Infix "≼" := dra_included. Local Infix "≼" := dra_included.
Class DRA A `{Equiv A, Valid A, Unit A, Disjoint A, Op A, Minus A} := { Class DRA A `{Equiv A, Valid A, Unit A, Disjoint A, Op A, Div A} := {
(* setoids *) (* setoids *)
dra_equivalence :> Equivalence (() : relation A); dra_equivalence :> Equivalence (() : relation A);
dra_op_proper :> Proper (() ==> () ==> ()) (); dra_op_proper :> Proper (() ==> () ==> ()) ();
dra_unit_proper :> Proper (() ==> ()) unit; dra_unit_proper :> Proper (() ==> ()) unit;
dra_valid_proper :> Proper (() ==> impl) valid; dra_valid_proper :> Proper (() ==> impl) valid;
dra_disjoint_proper :> x, Proper (() ==> impl) (disjoint x); dra_disjoint_proper :> x, Proper (() ==> impl) (disjoint x);
dra_minus_proper :> Proper (() ==> () ==> ()) minus; dra_div_proper :> Proper (() ==> () ==> ()) div;
(* validity *) (* validity *)
dra_op_valid x y : x y x y (x y); dra_op_valid x y : x y x y (x y);
dra_unit_valid x : x unit x; dra_unit_valid x : x unit x;
dra_minus_valid x y : x y x y (y x); dra_div_valid x y : x y x y (y ÷ x);
(* monoid *) (* monoid *)
dra_assoc :> Assoc () (); dra_assoc :> Assoc () ();
dra_disjoint_ll x y z : x y z x y x y z x z; dra_disjoint_ll x y z : x y z x y x y z x z;
...@@ -40,8 +40,8 @@ Class DRA A `{Equiv A, Valid A, Unit A, Disjoint A, Op A, Minus A} := { ...@@ -40,8 +40,8 @@ Class DRA A `{Equiv A, Valid A, Unit A, Disjoint A, Op A, Minus A} := {
dra_unit_l x : x unit x x x; dra_unit_l x : x unit x x x;
dra_unit_idemp x : x unit (unit x) unit x; dra_unit_idemp x : x unit (unit x) unit x;
dra_unit_preserving x y : x y x y unit x unit y; dra_unit_preserving x y : x y x y unit x unit y;
dra_disjoint_minus x y : x y x y x y x; dra_disjoint_div x y : x y x y x y ÷ x;
dra_op_minus x y : x y x y x y x y dra_op_div x y : x y x y x y ÷ x y
}. }.
Section dra. Section dra.
...@@ -95,10 +95,10 @@ Program Instance validity_op : Op T := λ x y, ...@@ -95,10 +95,10 @@ Program Instance validity_op : Op T := λ x y,
Validity (validity_car x validity_car y) Validity (validity_car x validity_car y)
( x y validity_car x validity_car y) _. ( x y validity_car x validity_car y) _.
Solve Obligations with naive_solver auto using dra_op_valid. Solve Obligations with naive_solver auto using dra_op_valid.
Program Instance validity_minus : Minus T := λ x y, Program Instance validity_div : Div T := λ x y,
Validity (validity_car x validity_car y) Validity (validity_car x ÷ validity_car y)
( x y validity_car y validity_car x) _. ( x y validity_car y validity_car x) _.
Solve Obligations with naive_solver auto using dra_minus_valid. Solve Obligations with naive_solver auto using dra_div_valid.
Definition validity_ra : RA (discreteC T). Definition validity_ra : RA (discreteC T).
Proof. Proof.
...@@ -120,15 +120,15 @@ Proof. ...@@ -120,15 +120,15 @@ Proof.
- intros [x px ?]; split; - intros [x px ?]; split;
naive_solver eauto using dra_unit_l, dra_unit_disjoint_l. naive_solver eauto using dra_unit_l, dra_unit_disjoint_l.
- intros [x px ?]; split; naive_solver eauto using dra_unit_idemp. - intros [x px ?]; split; naive_solver eauto using dra_unit_idemp.
- intros x y Hxy; exists (unit y unit x). - intros x y Hxy; exists (unit y ÷ unit x).
destruct x as [x px ?], y as [y py ?], Hxy as [[z pz ?] [??]]; simpl in *. destruct x as [x px ?], y as [y py ?], Hxy as [[z pz ?] [??]]; simpl in *.
assert (py unit x unit y) assert (py unit x unit y)
by intuition eauto 10 using dra_unit_preserving. by intuition eauto 10 using dra_unit_preserving.
constructor; [|symmetry]; simpl in *; constructor; [|symmetry]; simpl in *;
intuition eauto using dra_op_minus, dra_disjoint_minus, dra_unit_valid. intuition eauto using dra_op_div, dra_disjoint_div, dra_unit_valid.
- by intros [x px ?] [y py ?] (?&?&?). - by intros [x px ?] [y py ?] (?&?&?).
- intros [x px ?] [y py ?] [[z pz ?] [??]]; split; simpl in *; - intros [x px ?] [y py ?] [[z pz ?] [??]]; split; simpl in *;
intuition eauto 10 using dra_disjoint_minus, dra_op_minus. intuition eauto 10 using dra_disjoint_div, dra_op_div.
Qed. Qed.
Definition validityRA : cmraT := discreteRA validity_ra. Definition validityRA : cmraT := discreteRA validity_ra.
Instance validity_cmra_discrete : Instance validity_cmra_discrete :
......
...@@ -98,7 +98,7 @@ Instance excl_op : Op (excl A) := λ x y, ...@@ -98,7 +98,7 @@ Instance excl_op : Op (excl A) := λ x y,
| ExclUnit, ExclUnit => ExclUnit | ExclUnit, ExclUnit => ExclUnit
| _, _=> ExclBot | _, _=> ExclBot
end. end.
Instance excl_minus : Minus (excl A) := λ x y, Instance excl_div : Div (excl A) := λ x y,
match x, y with match x, y with
| _, ExclUnit => x | _, ExclUnit => x
| Excl _, Excl _ => ExclUnit | Excl _, Excl _ => ExclUnit
......
...@@ -96,11 +96,11 @@ Instance map_op : Op (gmap K A) := merge op. ...@@ -96,11 +96,11 @@ Instance map_op : Op (gmap K A) := merge op.
Instance map_unit : Unit (gmap K A) := fmap unit. Instance map_unit : Unit (gmap K A) := fmap unit.
Instance map_valid : Valid (gmap K A) := λ m, i, (m !! i). Instance map_valid : Valid (gmap K A) := λ m, i, (m !! i).
Instance map_validN : ValidN (gmap K A) := λ n m, i, {n} (m !! i). Instance map_validN : ValidN (gmap K A) := λ n m, i, {n} (m !! i).
Instance map_minus : Minus (gmap K A) := merge minus. Instance map_div : Div (gmap K A) := merge div.
Lemma lookup_op m1 m2 i : (m1 m2) !! i = m1 !! i m2 !! i. Lemma lookup_op m1 m2 i : (m1 m2) !! i = m1 !! i m2 !! i.
Proof. by apply lookup_merge. Qed. Proof. by apply lookup_merge. Qed.
Lemma lookup_minus m1 m2 i : (m1 m2) !! i = m1 !! i m2 !! i. Lemma lookup_div m1 m2 i : (m1 ÷ m2) !! i = m1 !! i ÷ m2 !! i.
Proof. by apply lookup_merge. Qed. Proof. by apply lookup_merge. Qed.
Lemma lookup_unit m i : unit m !! i = unit (m !! i). Lemma lookup_unit m i : unit m !! i = unit (m !! i).
Proof. by apply lookup_fmap. Qed. Proof. by apply lookup_fmap. Qed.
...@@ -109,16 +109,16 @@ Lemma map_included_spec (m1 m2 : gmap K A) : m1 ≼ m2 ↔ ∀ i, m1 !! i ≼ m2 ...@@ -109,16 +109,16 @@ Lemma map_included_spec (m1 m2 : gmap K A) : m1 ≼ m2 ↔ ∀ i, m1 !! i ≼ m2
Proof. Proof.
split. split.
- by intros [m Hm]; intros i; exists (m !! i); rewrite -lookup_op Hm. - by intros [m Hm]; intros i; exists (m !! i); rewrite -lookup_op Hm.
- intros Hm; exists (m2 m1); intros i. - intros Hm; exists (m2 ÷ m1); intros i.
by rewrite lookup_op lookup_minus cmra_op_minus. by rewrite lookup_op lookup_div cmra_op_div.
Qed. Qed.
Lemma map_includedN_spec (m1 m2 : gmap K A) n : Lemma map_includedN_spec (m1 m2 : gmap K A) n :
m1 {n} m2 i, m1 !! i {n} m2 !! i. m1 {n} m2 i, m1 !! i {n} m2 !! i.
Proof. Proof.
split. split.
- by intros [m Hm]; intros i; exists (m !! i); rewrite -lookup_op Hm. - by intros [m Hm]; intros i; exists (m !! i); rewrite -lookup_op Hm.
- intros Hm; exists (m2 m1); intros i. - intros Hm; exists (m2 ÷ m1); intros i.
by rewrite lookup_op lookup_minus cmra_op_minus'. by rewrite lookup_op lookup_div cmra_op_div'.
Qed. Qed.
Definition map_cmra_mixin : CMRAMixin (gmap K A). Definition map_cmra_mixin : CMRAMixin (gmap K A).
...@@ -127,7 +127,7 @@ Proof. ...@@ -127,7 +127,7 @@ Proof.
- by intros n m1 m2 m3 Hm i; rewrite !lookup_op (Hm i). - by intros n m1 m2 m3 Hm i; rewrite !lookup_op (Hm i).
- by intros n m1 m2 Hm i; rewrite !lookup_unit (Hm i). - by intros n m1 m2 Hm i; rewrite !lookup_unit (Hm i).
- by intros n m1 m2 Hm ? i; rewrite -(Hm i). - by intros n m1 m2 Hm ? i; rewrite -(Hm i).
- by intros n m1 m1' Hm1 m2 m2' Hm2 i; rewrite !lookup_minus (Hm1 i) (Hm2 i). - by intros n m1 m1' Hm1 m2 m2' Hm2 i; rewrite !lookup_div (Hm1 i) (Hm2 i).
- intros m; split. - intros m; split.
+ by intros ? n i; apply cmra_valid_validN. + by intros ? n i; apply cmra_valid_validN.
+ intros Hm i; apply cmra_valid_validN=> n; apply Hm. + intros Hm i; apply cmra_valid_validN=> n; apply Hm.
...@@ -141,7 +141,7 @@ Proof. ...@@ -141,7 +141,7 @@ Proof.
- intros n m1 m2 Hm i; apply cmra_validN_op_l with (m2 !! i). - intros n m1 m2 Hm i; apply cmra_validN_op_l with (m2 !! i).
by rewrite -lookup_op. by rewrite -lookup_op.
- intros x y; rewrite map_included_spec=> ? i. - intros x y; rewrite map_included_spec=> ? i.
by rewrite lookup_op lookup_minus cmra_op_minus. by rewrite lookup_op lookup_div cmra_op_div.
- intros n m m1 m2 Hm Hm12. - intros n m m1 m2 Hm Hm12.
assert ( i, m !! i {n} m1 !! i m2 !! i) as Hm12' assert ( i, m !! i {n} m1 !! i m2 !! i) as Hm12'
by (by intros i; rewrite -lookup_op). by (by intros i; rewrite -lookup_op).
......
...@@ -3,7 +3,7 @@ From algebra Require Export cmra. ...@@ -3,7 +3,7 @@ From algebra Require Export cmra.
From algebra Require Import functor upred. From algebra Require Import functor upred.
Local Arguments validN _ _ _ !_ /. Local Arguments validN _ _ _ !_ /.
Local Arguments valid _ _ !_ /. Local Arguments valid _ _ !_ /.
Local Arguments minus _ _ !_ !_ /.