Commit b05660a6 authored by Robbert Krebbers's avatar Robbert Krebbers

Rename `Discrete` → `OFEDiscrete` (OFEs whose elements are all discrete).

parent d9417f9a
...@@ -149,7 +149,7 @@ Proof. rewrite /CMRATotal; eauto. Qed. ...@@ -149,7 +149,7 @@ 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_discrete : Discrete A CMRADiscrete agreeR. Global Instance agree_ofe_discrete : OFEDiscrete A CMRADiscrete agreeR.
Proof. Proof.
intros HD. split. intros HD. split.
- intros x y [H H'] n; split=> a; setoid_rewrite <-(timeless_iff_0 _ _); auto. - intros x y [H H'] n; split=> a; setoid_rewrite <-(timeless_iff_0 _ _); auto.
......
...@@ -52,7 +52,7 @@ Qed. ...@@ -52,7 +52,7 @@ Qed.
Global Instance Auth_timeless a b : Global Instance Auth_timeless a b :
Timeless a Timeless b Timeless (Auth a b). Timeless a Timeless b Timeless (Auth a b).
Proof. by intros ?? [??] [??]; split; apply: timeless. Qed. Proof. by intros ?? [??] [??]; split; apply: timeless. Qed.
Global Instance auth_discrete : Discrete A Discrete 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.
......
...@@ -240,7 +240,7 @@ End ucmra_mixin. ...@@ -240,7 +240,7 @@ End ucmra_mixin.
(** * Discrete CMRAs *) (** * Discrete CMRAs *)
Class CMRADiscrete (A : cmraT) := { Class CMRADiscrete (A : cmraT) := {
cmra_discrete :> Discrete 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.
...@@ -554,7 +554,7 @@ Proof. ...@@ -554,7 +554,7 @@ 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 `{Discrete 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 ->%(timeless_iff _ _)]; eauto using cmra_included_l. intros [z ->%(timeless_iff _ _)]; eauto using cmra_included_l.
...@@ -597,7 +597,9 @@ Lemma id_free_l x `{!IdFree x} y : ✓x → y ⋅ x ≡ x → False. ...@@ -597,7 +597,9 @@ 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. repeat intro. eauto using cmra_discrete_valid, cmra_discrete, timeless. Qed. Proof.
intros Hx y ??. apply (Hx y), (timeless _); eauto using cmra_discrete_valid.
Qed.
Global Instance id_free_op_r x y : IdFree y Cancelable x IdFree (x y). Global Instance id_free_op_r x y : IdFree y Cancelable x IdFree (x y).
Proof. Proof.
intros ?? z ? Hid%symmetry. revert Hid. rewrite -assoc=>/(cancelableN x) ?. intros ?? z ? Hid%symmetry. revert Hid. rewrite -assoc=>/(cancelableN x) ?.
......
...@@ -96,7 +96,7 @@ Next Obligation. ...@@ -96,7 +96,7 @@ Next Obligation.
+ rewrite (conv_compl n (csum_chain_r c b')) /=. destruct (c n); naive_solver. + rewrite (conv_compl n (csum_chain_r c b')) /=. destruct (c n); naive_solver.
Qed. Qed.
Global Instance csum_discrete : Discrete A Discrete B Discrete csumC. Global Instance csum_ofe_discrete : OFEDiscrete A OFEDiscrete B OFEDiscrete csumC.
Proof. by inversion_clear 3; constructor; apply (timeless _). Qed. Proof. by inversion_clear 3; constructor; apply (timeless _). Qed.
Global Instance csum_leibniz : Global Instance csum_leibniz :
LeibnizEquiv A LeibnizEquiv B LeibnizEquiv (csumC A B). LeibnizEquiv A LeibnizEquiv B LeibnizEquiv (csumC A B).
......
...@@ -59,7 +59,7 @@ Proof. ...@@ -59,7 +59,7 @@ Proof.
- by intros []; constructor. - by intros []; constructor.
Qed. Qed.
Global Instance excl_discrete : Discrete A Discrete exclC. Global Instance excl_ofe_discrete : OFEDiscrete A OFEDiscrete exclC.
Proof. by inversion_clear 2; constructor; apply (timeless _). Qed. Proof. by inversion_clear 2; constructor; apply (timeless _). Qed.
Global Instance excl_leibniz : LeibnizEquiv A LeibnizEquiv (excl A). Global Instance excl_leibniz : LeibnizEquiv A LeibnizEquiv (excl A).
Proof. by destruct 2; f_equal; apply leibniz_equiv. Qed. Proof. by destruct 2; f_equal; apply leibniz_equiv. Qed.
...@@ -91,7 +91,7 @@ Proof. ...@@ -91,7 +91,7 @@ Proof.
Qed. Qed.
Canonical Structure exclR := CMRAT (excl A) excl_cmra_mixin. Canonical Structure exclR := CMRAT (excl A) excl_cmra_mixin.
Global Instance excl_cmra_discrete : Discrete A CMRADiscrete exclR. Global Instance excl_cmra_discrete : OFEDiscrete A CMRADiscrete exclR.
Proof. split. apply _. by intros []. Qed. Proof. split. apply _. by intros []. Qed.
(** Internalized properties *) (** Internalized properties *)
......
...@@ -37,7 +37,7 @@ Next Obligation. ...@@ -37,7 +37,7 @@ Next Obligation.
by rewrite conv_compl /=; apply reflexive_eq. by rewrite conv_compl /=; apply reflexive_eq.
Qed. Qed.
Global Instance gmap_discrete : Discrete A Discrete gmapC. Global Instance gmap_ofe_discrete : OFEDiscrete A OFEDiscrete gmapC.
Proof. intros ? m m' ? i. by apply (timeless _). Qed. Proof. intros ? m m' ? i. by apply (timeless _). Qed.
(* why doesn't this go automatic? *) (* why doesn't this go automatic? *)
Global Instance gmapC_leibniz: LeibnizEquiv A LeibnizEquiv gmapC. Global Instance gmapC_leibniz: LeibnizEquiv A LeibnizEquiv gmapC.
......
...@@ -77,7 +77,7 @@ Next Obligation. ...@@ -77,7 +77,7 @@ Next Obligation.
by rewrite Hcn. by rewrite Hcn.
Qed. Qed.
Global Instance list_discrete : Discrete A Discrete listC. Global Instance list_ofe_discrete : OFEDiscrete A OFEDiscrete listC.
Proof. induction 2; constructor; try apply (timeless _); auto. Qed. Proof. induction 2; constructor; try apply (timeless _); auto. Qed.
Global Instance nil_timeless : Timeless (@nil A). Global Instance nil_timeless : Timeless (@nil A).
......
...@@ -107,8 +107,8 @@ Arguments timeless {_} _ {_} _ _. ...@@ -107,8 +107,8 @@ Arguments timeless {_} _ {_} _ _.
Hint Mode Timeless + ! : typeclass_instances. Hint Mode Timeless + ! : typeclass_instances.
Instance: Params (@Timeless) 1. Instance: Params (@Timeless) 1.
Class Discrete (A : ofeT) := discrete_timeless (x : A) :> Timeless x. Class OFEDiscrete (A : ofeT) := ofe_discrete_timeless (x : A) :> Timeless x.
Hint Mode Discrete ! : typeclass_instances. Hint Mode OFEDiscrete ! : typeclass_instances.
(** OFEs with a completion *) (** OFEs with a completion *)
Record chain (A : ofeT) := { Record chain (A : ofeT) := {
...@@ -653,7 +653,7 @@ Section unit. ...@@ -653,7 +653,7 @@ Section unit.
Global Program Instance unit_cofe : Cofe unitC := { compl x := () }. Global Program Instance unit_cofe : Cofe unitC := { compl x := () }.
Next Obligation. by repeat split; try exists 0. Qed. Next Obligation. by repeat split; try exists 0. Qed.
Global Instance unit_discrete_cofe : Discrete unitC. Global Instance unit_ofe_discrete : OFEDiscrete unitC.
Proof. done. Qed. Proof. done. Qed.
End unit. End unit.
...@@ -686,7 +686,7 @@ Section product. ...@@ -686,7 +686,7 @@ Section product.
Global Instance prod_timeless (x : A * B) : Global Instance prod_timeless (x : A * B) :
Timeless (x.1) Timeless (x.2) Timeless x. Timeless (x.1) Timeless (x.2) Timeless x.
Proof. by intros ???[??]; split; apply (timeless _). Qed. Proof. by intros ???[??]; split; apply (timeless _). Qed.
Global Instance prod_discrete_cofe : Discrete A Discrete B Discrete prodC. Global Instance prod_ofe_discrete : OFEDiscrete A OFEDiscrete B OFEDiscrete prodC.
Proof. intros ?? [??]; apply _. Qed. Proof. intros ?? [??]; apply _. Qed.
End product. End product.
...@@ -868,7 +868,7 @@ Section sum. ...@@ -868,7 +868,7 @@ Section sum.
Proof. inversion_clear 2; constructor; by apply (timeless _). Qed. Proof. inversion_clear 2; constructor; by apply (timeless _). Qed.
Global Instance inr_timeless (y : B) : Timeless y Timeless (inr y). Global Instance inr_timeless (y : B) : Timeless y Timeless (inr y).
Proof. inversion_clear 2; constructor; by apply (timeless _). Qed. Proof. inversion_clear 2; constructor; by apply (timeless _). Qed.
Global Instance sum_discrete_ofe : Discrete A Discrete B Discrete sumC. Global Instance sum_ofe_discrete : OFEDiscrete A OFEDiscrete B OFEDiscrete sumC.
Proof. intros ?? [?|?]; apply _. Qed. Proof. intros ?? [?|?]; apply _. Qed.
End sum. End sum.
...@@ -923,7 +923,7 @@ Section discrete_ofe. ...@@ -923,7 +923,7 @@ Section discrete_ofe.
- done. - done.
Qed. Qed.
Global Instance discrete_discrete_ofe : Discrete (OfeT A discrete_ofe_mixin). Global Instance discrete_ofe_discrete : OFEDiscrete (OfeT A discrete_ofe_mixin).
Proof. by intros x y. Qed. Proof. by intros x y. Qed.
Global Program Instance discrete_cofe : Cofe (OfeT A discrete_ofe_mixin) := Global Program Instance discrete_cofe : Cofe (OfeT A discrete_ofe_mixin) :=
...@@ -992,7 +992,7 @@ Section option. ...@@ -992,7 +992,7 @@ Section option.
destruct (c n); naive_solver. destruct (c n); naive_solver.
Qed. Qed.
Global Instance option_discrete : Discrete A Discrete optionC. Global Instance option_ofe_discrete : OFEDiscrete A OFEDiscrete optionC.
Proof. destruct 2; constructor; by apply (timeless _). Qed. Proof. destruct 2; constructor; by apply (timeless _). Qed.
Global Instance Some_ne : NonExpansive (@Some A). Global Instance Some_ne : NonExpansive (@Some A).
...@@ -1226,7 +1226,7 @@ Section sigma. ...@@ -1226,7 +1226,7 @@ Section sigma.
Global Instance sig_timeless (x : sig P) : Timeless (`x) Timeless x. Global Instance sig_timeless (x : sig P) : Timeless (`x) Timeless x.
Proof. intros ? y. rewrite sig_dist_alt sig_equiv_alt. apply (timeless _). Qed. Proof. intros ? y. rewrite sig_dist_alt sig_equiv_alt. apply (timeless _). Qed.
Global Instance sig_discrete_ofe : Discrete A Discrete sigC. Global Instance sig_ofe_discrete : OFEDiscrete A OFEDiscrete sigC.
Proof. intros ??. apply _. Qed. Proof. intros ??. apply _. Qed.
End sigma. End sigma.
......
...@@ -29,7 +29,7 @@ Section ofe. ...@@ -29,7 +29,7 @@ Section ofe.
intros ?? v' ?. inv_vec v'=>x' v'. inversion_clear 1. intros ?? v' ?. inv_vec v'=>x' v'. inversion_clear 1.
constructor. by apply timeless. change (v v'). by apply timeless. constructor. by apply timeless. change (v v'). by apply timeless.
Qed. Qed.
Global Instance vec_discrete_cofe m : Discrete A Discrete (vecC m). Global Instance vec_ofe_discrete m : OFEDiscrete A OFEDiscrete (vecC m).
Proof. intros ? v. induction v; apply _. Qed. Proof. intros ? v. induction v; apply _. Qed.
End ofe. End ofe.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment