Documentation

CslibFrontier.Computability.Distributed.ConcurrentObjects.Linearizability.Basic

Concurrent histories, real-time precedence, and linearizability definitions #

Core definitions and basic structural properties for concurrent invocation/response histories over multiple typed shared objects ([HW90], §§2.1–2.2, §3.3, pp. 467–472) with the amended L2 condition of [SHP21] (§4, Definition 4.1, p. 6).

Main definitions #

Main results #

References #

Events, histories, and subhistory projections #

inductive Cslib.Distributed.ConcurrentObjects.Event (P : Type u_1) {Obj : Type u_2} (Op : Obj → Type u_3) (Resp : Obj → Type u_4) :
Type (max (max (max u_1 u_2) u_3) u_4)

A single invocation or response event in a concurrent object history ([HW90], §2.1, p. 467), parameterized by process type P, object index type Obj, and per-object operation and response families Op and Resp.

  • inv {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (proc : P) (obj : Obj) (op : Op obj) : Event P Op Resp

    Process proc invokes op on object obj (⟨obj op proc⟩).

  • resp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (proc : P) (obj : Obj) (res : Resp obj) : Event P Op Resp

    Process proc receives res from object obj (⟨obj res proc⟩).

def Cslib.Distributed.ConcurrentObjects.Event.proc {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} :
Event P Op Resp → P

Process associated with an event.

def Cslib.Distributed.ConcurrentObjects.Event.obj {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} :
Event P Op Resp → Obj

Object associated with an event.

def Cslib.Distributed.ConcurrentObjects.Event.isResp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} :
Event P Op Resp → Bool

Whether an event is a response event.

@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.proc_inv {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (op : Op x) :
(inv p x op).proc = p
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.proc_resp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (res : Resp x) :
(resp p x res).proc = p
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.obj_inv {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (op : Op x) :
(inv p x op).obj = x
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.obj_resp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (res : Resp x) :
(resp p x res).obj = x
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.isResp_inv {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (op : Op x) :
(inv p x op).isResp = false
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.Event.isResp_resp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (p : P) (x : Obj) (res : Resp x) :
(resp p x res).isResp = true
@[instance_reducible]
instance Cslib.Distributed.ConcurrentObjects.Event.instDecidableEq {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] [(x : Obj) → DecidableEq (Op x)] [(x : Obj) → DecidableEq (Resp x)] :
DecidableEq (Event P Op Resp)
@[reducible, inline]
abbrev Cslib.Distributed.ConcurrentObjects.History (P : Type u_1) {Obj : Type u_2} (Op : Obj → Type u_3) (Resp : Obj → Type u_4) :
Type (max (max (max u_4 u_3) u_2) u_1)

A history is a finite sequence of invocation and response events ([HW90], §2.1, p. 467).

structure Cslib.Distributed.ConcurrentObjects.OpCall (P : Type u_1) {Obj : Type u_2} (Op : Obj → Type u_3) (Resp : Obj → Type u_4) :
Type (max (max (max u_1 u_2) u_3) u_4)

Completed operation call (proc, obj, op, res) pairing an invocation with its matching response.

  • proc : P

    Invoking process.

  • obj : Obj

    Target object.

  • op : Op self.obj

    Invoked operation.

  • res : Resp self.obj

    Returned response.

def Cslib.Distributed.ConcurrentObjects.OpCall.toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (c : OpCall P Op Resp) :
History P Op Resp

Expand a completed OpCall into its adjacent [inv, resp] event pair.

Per-process operation identifier (proc, idx) naming the idx-th operation invoked by process proc in a history.

  • proc : P

    Process that invoked this operation.

  • idx : ℕ

    Zero-based index among operations invoked by proc.

theorem Cslib.Distributed.ConcurrentObjects.OpId.ext {P : Type u_1} {x y : OpId P} (proc : x.proc = y.proc) (idx : x.idx = y.idx) :
x = y
def Cslib.Distributed.ConcurrentObjects.instDecidableEqOpId.decEq {P✝ : Type u_1} [DecidableEq P✝] (x✝ x✝¹ : OpId P✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]
def Cslib.Distributed.ConcurrentObjects.History.procSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (p : P) :
History P Op Resp

Process subhistory H | p ([HW90], §2.1, p. 467): the subsequence of all events in H whose process is p.

def Cslib.Distributed.ConcurrentObjects.History.objSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (H : History P Op Resp) (x : Obj) :
History P Op Resp

Object subhistory H | x ([HW90], §2.1, p. 467): the subsequence of all events in H whose object is x.

@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_nil {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (p : P) :
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_cons {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (e : Event P Op Resp) (H : History P Op Resp) (p : P) :
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_append {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H₁ H₂ : History P Op Resp) (p : P) :
(H₁ ++ H₂).procSubhistory p = H₁.procSubhistory p ++ H₂.procSubhistory p
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_nil {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (x : Obj) :
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_cons {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (e : Event P Op Resp) (H : History P Op Resp) (x : Obj) :
@[simp]
theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_append {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (H₁ H₂ : History P Op Resp) (x : Obj) :
(H₁ ++ H₂).objSubhistory x = H₁.objSubhistory x ++ H₂.objSubhistory x
theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_objSubhistory_comm {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] (H : History P Op Resp) (p : P) (x : Obj) :

Process and object subhistory projections commute.

theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_idem {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (H : History P Op Resp) (x : Obj) :

Object subhistory projection is idempotent.

theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_of_ne {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (H : History P Op Resp) {x y : Obj} (hne : x ≠ y) :

Projecting onto two distinct objects yields the empty history.

theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_eq_self_of_forall_obj {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] {H : History P Op Resp} {x : Obj} (h : ∀ e ∈ H, e.obj = x) :

If every event of H targets x, then H | x = H.

theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_eq_nil_of_forall_ne {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] {H : History P Op Resp} {x : Obj} (h : ∀ e ∈ H, e.obj ≠ x) :

If no event of H targets x, then H | x = [].

def Cslib.Distributed.ConcurrentObjects.History.Equivalent {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H₁ H₂ : History P Op Resp) :

Two histories are equivalent if they have identical process subhistories for every process p ([HW90], §2.1, p. 467).

theorem Cslib.Distributed.ConcurrentObjects.History.Equivalent.refl {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) :

Reflexivity of History.Equivalent.

theorem Cslib.Distributed.ConcurrentObjects.History.Equivalent.symm {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H₁ H₂ : History P Op Resp} (h : H₁.Equivalent H₂) :
H₂.Equivalent H₁

Symmetry of History.Equivalent.

theorem Cslib.Distributed.ConcurrentObjects.History.Equivalent.trans {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H₁ H₂ H₃ : History P Op Resp} (h₁₂ : H₁.Equivalent H₂) (h₂₃ : H₂.Equivalent H₃) :
H₁.Equivalent H₃

Transitivity of History.Equivalent.

theorem Cslib.Distributed.ConcurrentObjects.History.Equivalent.objSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] {H₁ H₂ : History P Op Resp} (h : H₁.Equivalent H₂) (x : Obj) :

Equivalent histories have equivalent object subhistories on every object x.

def Cslib.Distributed.ConcurrentObjects.History.IsSequential {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} :
History P Op Resp → Prop

Sequential history ([HW90], §2.1, p. 467): starts with an invocation (when nonempty), alternates invocations with immediately matching responses (proc and obj agree), and optionally ends with a single pending invocation.

Instances For
    @[instance_reducible]
    instance Cslib.Distributed.ConcurrentObjects.History.instDecidableIsSequential {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] (H : History P Op Resp) :
    def Cslib.Distributed.ConcurrentObjects.History.WellFormed {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) :

    A history is well-formed if every process subhistory H | p is sequential ([HW90], §2.1, p. 467).

    theorem Cslib.Distributed.ConcurrentObjects.History.wellFormed_nil {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] :

    The empty history is well-formed.

    theorem Cslib.Distributed.ConcurrentObjects.History.isSequential_objSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] {H : History P Op Resp} (hseq : H.IsSequential) (x : Obj) :

    Restricting a sequential history to a single object preserves sequentiality.

    theorem Cslib.Distributed.ConcurrentObjects.History.WellFormed.objSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] {H : History P Op Resp} (hwf : H.WellFormed) (x : Obj) :

    Restricting a well-formed history to a single object preserves well-formedness.

    theorem Cslib.Distributed.ConcurrentObjects.History.isSequential_flatMap_toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (calls : List (OpCall P Op Resp)) :

    Expanding a list of completed OpCalls produces a sequential history.

    theorem Cslib.Distributed.ConcurrentObjects.History.length_flatMap_toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (calls : List (OpCall P Op Resp)) :

    Expanding calls into [inv, resp] pairs doubles the list length.

    theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_flatMap_toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (calls : List (OpCall P Op Resp)) (p : P) :

    Process subhistory commutes with List.flatMap OpCall.toEvents.

    theorem Cslib.Distributed.ConcurrentObjects.History.objSubhistory_flatMap_toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (calls : List (OpCall P Op Resp)) (x : Obj) :

    Object subhistory commutes with List.flatMap OpCall.toEvents.

    theorem Cslib.Distributed.ConcurrentObjects.History.wellFormed_flatMap_toEvents {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (calls : List (OpCall P Op Resp)) :

    Expanding any list of completed OpCalls yields a well-formed history.

    theorem Cslib.Distributed.ConcurrentObjects.History.isSequential_decomp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {S : History P Op Resp} (hseq : S.IsSequential) :
    (∃ (calls : List (OpCall P Op Resp)), S = List.flatMap OpCall.toEvents calls) ∨ ∃ (calls : List (OpCall P Op Resp)) (p : P) (x : Obj) (op : Op x), S = List.flatMap OpCall.toEvents calls ++ [Event.inv p x op]

    Every sequential history decomposes into completed OpCalls optionally followed by one trailing pending invocation.

    theorem Cslib.Distributed.ConcurrentObjects.History.exists_calls_of_isSequential_even {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {S : History P Op Resp} (hseq : S.IsSequential) (heven : List.length S % 2 = 0) :
    ∃ (calls : List (OpCall P Op Resp)), S = List.flatMap OpCall.toEvents calls

    Every even-length sequential history is the expansion of a list of completed OpCalls.

    theorem Cslib.Distributed.ConcurrentObjects.History.isSequential_append_pair {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {S : History P Op Resp} (hseq : S.IsSequential) (heven : List.length S % 2 = 0) (p : P) (x : Obj) (op : Op x) (res : Resp x) :

    Appending a matched [inv, resp] pair to an even-length sequential history preserves sequentiality.

    def Cslib.Distributed.ConcurrentObjects.History.complete {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] :
    History P Op Resp → History P Op Resp

    Maximal completed subhistory complete(H) ([HW90], §2.1, p. 467): drops pending invocations (those with no subsequent event of the same process) while retaining all matched invocations and responses.

    @[simp]
    theorem Cslib.Distributed.ConcurrentObjects.History.complete_nil {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] :
    theorem Cslib.Distributed.ConcurrentObjects.History.procSubhistory_complete {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (p : P) :

    Process subhistory commutes with History.complete.

    theorem Cslib.Distributed.ConcurrentObjects.History.complete_isSequential {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} (hseq : H.IsSequential) :

    Completing a sequential history yields an even-length sequential history.

    theorem Cslib.Distributed.ConcurrentObjects.History.complete_eq_self_of_isSequential_even {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} (hseq : H.IsSequential) (heven : List.length H % 2 = 0) :

    An even-length sequential history has no pending invocations, so complete H = H.

    theorem Cslib.Distributed.ConcurrentObjects.History.complete_wellFormed {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} (hwf : H.WellFormed) :

    Completing a well-formed history preserves well-formedness.

    theorem Cslib.Distributed.ConcurrentObjects.History.complete_objSubhistory {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] {H : History P Op Resp} (hwf : H.WellFormed) (x : Obj) :

    On well-formed histories, complete commutes with object subhistory projection.

    Extensions by response events #

    def Cslib.Distributed.ConcurrentObjects.History.IsRespList {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} (R : History P Op Resp) :

    R consists solely of response events.

    def Cslib.Distributed.ConcurrentObjects.History.IsExtension {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H H' : History P Op Resp) :

    H' is a well-formed completion extension of H obtained by appending zero or more response events ([HW90], §2.2, p. 469).

    theorem Cslib.Distributed.ConcurrentObjects.History.IsExtension.refl {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} (hwf : H.WellFormed) :

    Every well-formed history is a trivial extension of itself.

    Operation positions and real-time precedence <_H #

    def Cslib.Distributed.ConcurrentObjects.History.nthProcPos {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (p : P) (H : History P Op Resp) (n : ℕ) :

    Position in H of the n-th event belonging to process p (none if p has at most n events in H).

    def Cslib.Distributed.ConcurrentObjects.History.invPos {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e : OpId P) :

    Position in H of the invocation event of operation e = (proc, idx).

    def Cslib.Distributed.ConcurrentObjects.History.respPos {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e : OpId P) :

    Position in H of the matching response event of operation e = (proc, idx).

    def Cslib.Distributed.ConcurrentObjects.History.IsCompletedOp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e : OpId P) :

    e is a completed operation in H when its matching response is present in H (2 * e.idx + 1 < (H | e.proc).length).

    def Cslib.Distributed.ConcurrentObjects.History.prec {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e₀ e₁ : OpId P) :

    Real-time precedence e₀ <_H e₁ ([HW90], §2.2, p. 468): the response of e₀ strictly precedes the invocation of e₁ in H.

    theorem Cslib.Distributed.ConcurrentObjects.History.isCompletedOp_iff_lt_length {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e : OpId P) :

    e is completed in H iff 2 * e.idx + 1 < (H | e.proc).length.

    theorem Cslib.Distributed.ConcurrentObjects.History.Equivalent.isCompletedOp_iff {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H₁ H₂ : History P Op Resp} (heq : H₁.Equivalent H₂) (e : OpId P) :

    Equivalent histories have the same set of completed operations.

    theorem Cslib.Distributed.ConcurrentObjects.History.invPos_of_respPos {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} {e : OpId P} {r : ℕ} (hr : H.respPos e = some r) :
    ∃ (i : ℕ), H.invPos e = some i ∧ i < r

    Every operation with a response at index r has an earlier invocation at some index i < r.

    theorem Cslib.Distributed.ConcurrentObjects.History.prec_irrefl {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) (e : OpId P) :
    ¬H.prec e e

    Real-time precedence <_H is irreflexive ([HW90], §2.2, p. 468).

    theorem Cslib.Distributed.ConcurrentObjects.History.prec_trans {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} {e₀ e₁ e₂ : OpId P} (h₀₁ : H.prec e₀ e₁) (h₁₂ : H.prec e₁ e₂) :
    H.prec e₀ e₂

    Real-time precedence <_H is transitive ([HW90], §2.2, p. 468).

    theorem Cslib.Distributed.ConcurrentObjects.History.isIntervalOrder_prec_completed {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] (H : History P Op Resp) :
    Relation.IsIntervalOrder fun (a b : { e : OpId P // H.IsCompletedOp e }) => H.prec ↑a ↑b

    On the subtype of completed operations of H, real-time precedence <_H forms a Relation.IsIntervalOrder (Cslib.Foundations.Relation.Defs).

    theorem Cslib.Distributed.ConcurrentObjects.History.prec_of_same_proc_lt {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] {H : History P Op Resp} {e₀ e₁ : OpId P} (hp : e₀.proc = e₁.proc) (hidx : e₀.idx < e₁.idx) (hc₀ : H.IsCompletedOp e₀) (hc₁ : H.IsCompletedOp e₁) :
    H.prec e₀ e₁

    Completed operations of the same process are ordered in <_H by their invocation index.

    Sequential specification, legality, linearizability, and sequential consistency #

    structure Cslib.Distributed.ConcurrentObjects.SeqSpec (P : Type u_1) {Obj : Type u_2} (Op : Obj → Type u_3) (Resp : Obj → Type u_4) (x : Obj) :
    Type (max (max (max u_1 u_2) u_3) u_4)

    A sequential specification for object x : Obj ([HW90], §2.1, p. 468): a nonempty, prefix-closed set of single-object sequential histories on x.

    • allowed : Set (History P Op Resp)

      Set of allowed single-object sequential histories for x.

    • nil_mem : [] ∈ self.allowed

      The empty history is allowed.

    • obj_eq {H : History P Op Resp} : H ∈ self.allowed → ∀ e ∈ H, e.obj = x

      Every allowed history contains only events for object x.

    • isSequential {H : History P Op Resp} : H ∈ self.allowed → H.IsSequential

      Every allowed history is sequential.

    • prefix_closed {H₁ H₂ : List (Event P Op Resp)} : H₁ <+: H₂ → H₂ ∈ self.allowed → H₁ ∈ self.allowed

      Prefix-closure ([HW90], §2.1, p. 468).

    def Cslib.Distributed.ConcurrentObjects.SeqSpec.evalMachine {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {State : Type u_5} (x : Obj) (step : State → Op x → State × Resp x) :
    State → History P Op Resp → Prop

    Evaluate a single-object sequential history on x against a deterministic state machine (s, step), permitting an optional trailing pending invocation so the resulting set is event-wise prefix-closed.

    def Cslib.Distributed.ConcurrentObjects.SeqSpec.ofMachine {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {State : Type u_5} (x : Obj) (init : State) (step : State → Op x → State × Resp x) :
    SeqSpec P Op Resp x

    Construct a SeqSpec for object x from a deterministic sequential state machine (init, step).

    @[simp]
    theorem Cslib.Distributed.ConcurrentObjects.SeqSpec.mem_ofMachine_allowed {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {State : Type u_5} (x : Obj) (init : State) (step : State → Op x → State × Resp x) (H : History P Op Resp) :
    H ∈ (ofMachine x init step).allowed ↔ evalMachine x step init H
    def Cslib.Distributed.ConcurrentObjects.SeqSpec.IsTotalOp {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {x : Obj} (spec : SeqSpec P Op Resp x) (op : Op x) :

    An operation op : Op x is total for spec ([HW90], §2.1, p. 468 & §3.2, Theorem 2, p. 471) if every complete legal history of x can be extended by op for any invoking process p with some valid response res.

    theorem Cslib.Distributed.ConcurrentObjects.SeqSpec.isTotalOp_ofMachine {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} {State : Type u_5} (x : Obj) (init : State) (step : State → Op x → State × Resp x) (op : Op x) :
    (ofMachine x init step).IsTotalOp op

    Every operation of a deterministic total state machine SeqSpec.ofMachine is total.

    def Cslib.Distributed.ConcurrentObjects.History.IsLegal {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq Obj] (spec : (x : Obj) → SeqSpec P Op Resp x) (S : History P Op Resp) :

    A sequential history S is legal with respect to spec if for every object x, History.objSubhistory S x belongs to (spec x).allowed ([HW90], §2.1, p. 468).

    def Cslib.Distributed.ConcurrentObjects.IsLinearizable {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] (spec : (x : Obj) → SeqSpec P Op Resp x) (H : History P Op Resp) :

    Linearizability ([HW90], §2.2, p. 469, with the amended L2 condition of [SHP21], §4, Definition 4.1, p. 6): history H can be extended by appending zero or more responses to a well-formed history H' such that:

    • L1: complete(H') is equivalent to some legal sequential history S, and
    • L2: real-time precedence <_H (History.prec H) on all operations completed in H' (History.IsCompletedOp H', equivalently <_{H'} ⊆ <_S by History.prec_append_resp_iff) is preserved by <_S.

    Unlike the literal printed L2 in [HW90] (which restricts <_H to operations already completed in H and fails locality and nonblocking; see [SHP21], §§3.2–3.3, pp. 5–6), History.prec H e₀ e₁ sees invocations e₁ pending in H and IsLinearizable enforces precedence across all operations completed in the extension H'.

    def Cslib.Distributed.ConcurrentObjects.IsSequentiallyConsistent {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] (spec : (x : Obj) → SeqSpec P Op Resp x) (H : History P Op Resp) :

    Sequential consistency (extending [HW90], §3.3, p. 472 to incomplete histories via History.IsExtension and History.complete in parallel with IsLinearizable, coinciding with §3.3 on complete histories): history H can be extended by appending zero or more responses to a well-formed history H' such that complete(H') is equivalent to some legal sequential history S (preserving per-process program order without requiring cross-process real-time precedence <_H ⊆ <_S).

    theorem Cslib.Distributed.ConcurrentObjects.IsLinearizable.isSequentiallyConsistent {P : Type u_1} {Obj : Type u_2} {Op : Obj → Type u_3} {Resp : Obj → Type u_4} [DecidableEq P] [DecidableEq Obj] {spec : (x : Obj) → SeqSpec P Op Resp x} {H : History P Op Resp} (h : IsLinearizable spec H) :

    Every linearizable history is sequentially consistent (after [HW90], §3.3, p. 472).