Documentation

Cslib.Computability.Distributed.Consistency.Specification

Consistency specifications #

We formalize several notions of consistency for replicated data types defined in [Bur14], listed below in decreasing order of strength:

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:

References #

structure Cslib.DistributedConsistency.BaseHistory (Event : Type u_5) (Operation : Type u_6) (Value : Type u_7) (Session : Type u_8) :
Type (max (max (max u_5 u_6) u_7) u_8)

BaseHistory is an auxiliary definition containing all data fields of History below.

  • op : Event → Operation

    op assigns each event its operation.

  • se : Event → Session

    se assigns each event its session.

  • rval : Event → Option Value

    rval assigns each event its return value, where none indicates that the event never returns.

  • rb : Event → Event → Prop

    rb is the "returns before" order on events.

Instances For
    def Cslib.DistributedConsistency.BaseHistory.so {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (h : BaseHistory Event Operation Value Session) (s : Session) :
    Event → Event → Prop

    so (for "session order") is rb restricted to a single session.

    Equations
    Instances For
      structure Cslib.DistributedConsistency.History (Event : Type u_5) (Operation : Type u_6) (Value : Type u_7) (Session : Type u_8) extends Cslib.DistributedConsistency.BaseHistory Event Operation Value Session :
      Type (max (max (max u_5 u_6) u_7) u_8)

      History extends BaseHistory with well-formedness conditions.

      • op : Event → Operation
      • se : Event → Session
      • rval : Event → Option Value
      • rb : Event → Event → Prop
      • rb_strict_order : IsStrictOrder Event self.rb

        rb is 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 rb order.

      • rb_interval_order : Relation.IsIntervalOrder self.rb

        The rb order is an interval order.

      • rb_rval_ne_none (x y : Event) : self.rb x y → self.rval x ≠ none

        If an event x returns before another event y, then x cannot return none.

      • 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 so order is a strict total order of the events of each session.

      Instances For
        structure Cslib.DistributedConsistency.AbstractExecution (Event : Type u_5) (Operation : Type u_6) (Value : Type u_7) (Session : Type u_8) extends Cslib.DistributedConsistency.History Event Operation Value Session :
        Type (max (max (max u_5 u_6) u_7) u_8)

        AbstractExecution extends History with two more orders and additional well-formedness conditions.

        Instances For
          def Cslib.DistributedConsistency.History.Satisfies {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (h : History Event Operation Value Session) (p : AbstractExecution Event Operation Value Session → Prop) :

          A history satisfies a predicte p on abstract executions iff it can be extended to an abstract execution satisfying p.

          Equations
          Instances For
            def Cslib.DistributedConsistency.AbstractExecution.ReadMyWrites {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

            ReadMyWrites says that if two events are ordered by so, then they are also ordered by vis.

            Equations
            Instances For
              def Cslib.DistributedConsistency.AbstractExecution.MonotonicReads {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

              MonotonicReads says that if x is visible to y, then x is also visible to all successors of y under the so order.

              Equations
              Instances For
                def Cslib.DistributedConsistency.AbstractExecution.ConsistentPrefix {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                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
                  def Cslib.DistributedConsistency.AbstractExecution.hb {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :
                  Event → Event → Prop

                  The happens before order is transitive closure of the union of the vis order and the so s orders for all sessions s.

                  Equations
                  Instances For
                    def Cslib.DistributedConsistency.AbstractExecution.NoCircularCausality {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                    NoCircularCausality says that the hb order is acyclic.

                    Equations
                    Instances For
                      def Cslib.DistributedConsistency.AbstractExecution.CausalArbitration {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                      CausalArbitration says that if two events are ordered by hb, then they are also ordered by ar.

                      Equations
                      Instances For
                        def Cslib.DistributedConsistency.AbstractExecution.CausalVisibility {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                        CausalVisibility says that if two events are ordered by hb, then they are also ordered by vis.

                        Equations
                        Instances For
                          def Cslib.DistributedConsistency.AbstractExecution.Causality {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                          Causality is the conjunction of CausalArbitration and CausalVisibility.

                          Equations
                          Instances For
                            def Cslib.DistributedConsistency.AbstractExecution.SingleOrder {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                            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
                              def Cslib.DistributedConsistency.AbstractExecution.RealTime {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                              RealTime says that if two events are ordered by rb, then they are also ordered by ar.

                              Equations
                              Instances For
                                def Cslib.DistributedConsistency.AbstractExecution.nonVisibleEvents {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (x : Event) (s : Session) :
                                Set Event

                                a.nonVisibleEvents x s is the set of events in session s which returns after x but does not see x.

                                Equations
                                Instances For
                                  def Cslib.DistributedConsistency.AbstractExecution.EventualVisibility {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) :

                                  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
                                  Instances For
                                    structure Cslib.DistributedConsistency.OperationContext (Event : Type u_5) (Operation : Type u_6) :
                                    Type (max u_5 u_6)

                                    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
                                      structure Cslib.DistributedConsistency.OperationContext.Equiv {Event : Type u_1} {Operation : Type u_2} (c1 c2 : OperationContext Event Operation) :
                                      Type u_1

                                      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.

                                      Instances For
                                        structure Cslib.DistributedConsistency.ReplicatedDataType (Event : Type u_5) (Operation : Type u_6) (Value : Type u_7) :
                                        Type (max (max u_5 u_6) u_7)

                                        The notion of a replicated data type.

                                        • rval : Operation → OperationContext Event Operation → Option Value

                                          rval takes 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, rval must returns the same value on equivalent operation contexts.

                                        Instances For
                                          def Cslib.DistributedConsistency.AbstractExecution.context {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (xs : Set Event) :
                                          OperationContext Event Operation

                                          a.context xs is the operation context obtained by restricting a to xs.

                                          Equations
                                          Instances For
                                            def Cslib.DistributedConsistency.AbstractExecution.RVal {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (d : ReplicatedDataType Event Operation Value) :

                                            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
                                              def Cslib.DistributedConsistency.AbstractExecution.Linearizability {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (d : ReplicatedDataType Event Operation Value) :

                                              Linearizability is the conjunction of SingleOrder, RealTime, and RVal.

                                              Equations
                                              Instances For
                                                def Cslib.DistributedConsistency.AbstractExecution.SequentialConsistency {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (d : ReplicatedDataType Event Operation Value) :

                                                SequentialConsistency is the conjunction of SingleOrder, ReadMyWrites, and RVal.

                                                Equations
                                                Instances For
                                                  def Cslib.DistributedConsistency.AbstractExecution.CausalConsistency {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (d : ReplicatedDataType Event Operation Value) :

                                                  CausalConsistency is the conjunction of EventualVisibility, Causality, and RVal.

                                                  Equations
                                                  Instances For
                                                    def Cslib.DistributedConsistency.AbstractExecution.BasicEventualConsistency {Event : Type u_1} {Operation : Type u_2} {Value : Type u_3} {Session : Type u_4} (a : AbstractExecution Event Operation Value Session) (d : ReplicatedDataType Event Operation Value) :

                                                    BasicEventualConsistency is the conjunction of EventualVisibility, NoCircularCausality, and RVal.

                                                    Equations
                                                    Instances For