Consistency specifications #
We formalize several notions of consistency for replicated data types defined in [Bur14], listed below in decreasing order of strength:
- Linearizability,
- Sequential consistency.
- Causal consistency,
- Basic eventual consistency,
We follow [Bur14] closely in the formalization except for one detail:
instead of using an equivalence relation "same-session" to model the notion of sessions,
we use a map se : Event → Session and regard two events x and y to belong to the
same session iff se x = se y. These two approaches are clearly equivalent and se is
chosen because it is easier to work with.
NOTE: We left out the definition of quiescent consistency, for two reasons:
- Quiescent consistency is too weak a notion to be practically useful (see the remark on page 44 of [Bur14]).
- We found during the process of formalization that the only theoretic result about quiescent consistency in [Bur14], that it is implied by causal consistency, is incorrect given the definitions in [Bur14].
References #
BaseHistory is an auxiliary definition containing all data fields of History below.
- op : Event → Operation
opassigns each event its operation. - se : Event → Session
seassigns each event its session. - rval : Event → Option Value
rvalassigns each event its return value, wherenoneindicates that the event never returns. - rb : Event → Event → Prop
rbis the "returns before" order on events.
Instances For
so (for "session order") is rb restricted to a single session.
Instances For
History extends BaseHistory with well-formedness conditions.
- op : Event → Operation
- se : Event → Session
- rb_strict_order : IsStrictOrder Event self.rb
rbis a strict order on events (namely, it is irreflexive and transitive). - rb_pred_finite (x : Event) : (Relation.predecessors self.rb x).Finite
Each event has only a finite number of predecessors in the
rborder. - rb_interval_order : Relation.IsIntervalOrder self.rb
The
rborder is an interval order. If an event
xreturns before another eventy, thenxcannot returnnone.- so_strict_total_order (s : Session) : IsStrictTotalOrder ↑{x : Event | self.se x = s} fun (a b : ↑{x : Event | self.se x = s}) => self.so s ↑a ↑b
The
soorder is a strict total order of the events of each session.
Instances For
AbstractExecution extends History with two more orders and additional
well-formedness conditions.
- op : Event → Operation
- se : Event → Session
- rb_strict_order : IsStrictOrder Event self.rb
- vis : Event → Event → Prop
vis x ymeans thatxis visible toy. - ar : Event → Event → Prop
aris the arbitration order of the whole system. - vis_acyclic : Relation.Acyclic self.vis
The visibility order
visis acyclic. - vis_pred_finite (x : Event) : (Relation.predecessors self.vis x).Finite
Each event has only a finite number of predecessors in the
visorder. - ar_strict_total_order : IsStrictTotalOrder Event self.ar
The arbitration order is a strict total order of all events.
Instances For
A history satisfies a predicte p on abstract executions iff it can be extended
to an abstract execution satisfying p.
Equations
Instances For
ReadMyWrites says that if two events are ordered by so,
then they are also ordered by vis.
Equations
- a.ReadMyWrites = ∀ (s : Session), a.so s ≤ a.vis
Instances For
MonotonicReads says that if x is visible to y, then x is also visible to all
successors of y under the so order.
Equations
- a.MonotonicReads = ∀ (s : Session) (x y z : Event), a.vis x y → a.so s y z → a.vis x z
Instances For
ConsistentPrefix says that if x is visible to y in a different session,
then all predecessors of x in the arbitration order are also visible to y.
Equations
Instances For
The happens before order is transitive closure of the union of the vis order
and the so s orders for all sessions s.
Instances For
NoCircularCausality says that the hb order is acyclic.
Equations
Instances For
CausalArbitration says that if two events are ordered by hb,
then they are also ordered by ar.
Equations
- a.CausalArbitration = (a.hb ≤ a.ar)
Instances For
CausalVisibility says that if two events are ordered by hb,
then they are also ordered by vis.
Equations
- a.CausalVisibility = (a.hb ≤ a.vis)
Instances For
Causality is the conjunction of CausalArbitration and CausalVisibility.
Equations
- a.Causality = (a.CausalArbitration ∧ a.CausalVisibility)
Instances For
SingleOrder says that vis and ar are the same order except that there may be
a set of events which never returns and are not visible.
Equations
Instances For
RealTime says that if two events are ordered by rb, then they are also ordered by ar.
Instances For
a.nonVisibleEvents x s is the set of events in session s which returns after x
but does not see x.
Instances For
EventualVisibility says that for any event x and any session s, there can be at most
finitely many events in s that return after x and do not see x.
Equations
- a.EventualVisibility = ∀ (x : Event) (s : Session), (a.nonVisibleEvents x s).Finite
Instances For
An OperationContext is the data used by a replicated data type to determine the
return value of an operation. It is an abstraction of the notion of states.
- events : Set Event
The set of events in the operation context.
- op : Event → Operation
Operation labeling of events.
- vis : Event → Event → Prop
Visibility order.
- ar : Event → Event → Prop
Arbitration order.
Instances For
The notion of equivalence on OperationContext, which is essentially an isomorphism
that ignores the identities of events and the behavior of op, vis, and ar outside
the set of events in the operation context.
A bijection from
c1's events toc2's events.opis preserved by the bijection.- vis_equiv (x y : { x : Event // x ∈ c1.events }) : c1.vis ↑x ↑y ↔ c2.vis ↑(self.equiv x) ↑(self.equiv y)
visis preserved by the bijection. - ar_equiv (x y : { x : Event // x ∈ c1.events }) : c1.ar ↑x ↑y ↔ c2.ar ↑(self.equiv x) ↑(self.equiv y)
aris preserved by the bijection.
Instances For
The notion of a replicated data type.
- rval : Operation → OperationContext Event Operation → Option Value
rvaltakes an operation and an operation context and returns a value. - rval_equiv (o : Operation) (c1 c2 : OperationContext Event Operation) : ∀ (x : c1.Equiv c2), self.rval o c1 = self.rval o c2
For any operation,
rvalmust returns the same value on equivalent operation contexts.
Instances For
a.context xs is the operation context obtained by restricting a to xs.
Instances For
a.RVal d says that the return value of any event in the abstract execution a is
the same as the value returned by the replicated data type d in the context consisting of
the predecessors of the event.
Equations
Instances For
Linearizability is the conjunction of SingleOrder, RealTime, and RVal.
Equations
- a.Linearizability d = (a.SingleOrder ∧ a.RealTime ∧ a.RVal d)
Instances For
SequentialConsistency is the conjunction of SingleOrder, ReadMyWrites, and RVal.
Equations
- a.SequentialConsistency d = (a.SingleOrder ∧ a.ReadMyWrites ∧ a.RVal d)
Instances For
CausalConsistency is the conjunction of EventualVisibility, Causality, and RVal.
Equations
- a.CausalConsistency d = (a.EventualVisibility ∧ a.Causality ∧ a.RVal d)
Instances For
BasicEventualConsistency is the conjunction of EventualVisibility, NoCircularCausality,
and RVal.
Equations
- a.BasicEventualConsistency d = (a.EventualVisibility ∧ a.NoCircularCausality ∧ a.RVal d)