Documentation

CslibFrontier.Computability.Distributed.CausalBroadcast.Causal

Single-Group Vector-Clock Asynchronous Causal Broadcast Step #

This module formalizes a static single-group, single-hop vector-clock causal broadcast (CBCAST) protocol step toward #7297 (after Birman, Schiper, and Stephenson [BSS91], §§4.2–4.3, §5.1, and the broadcast specifications of Hadzilacos and Toueg [HT94], §§3.1, 3.3, 3.8–3.9) over an asynchronous message-passing labelled transition system (Cslib.LTS) with arbitrary message reordering and arbitrary static crash-fault sets F : Set P (requiring no 2t < n majority or quorum assumption).

Each process p : P maintains a vector timestamp vt : P → ℕ (initially 0), a multiset buffer pending of received but not yet deliverable packets, and its chronological delivery log delivered : List (Packet P V).

Model scope relative to primary sources #

[BSS91] additionally studies dynamic group membership views (§4.1, §5.5), token-holder view-synchronous ABCAST (§5.2), multicast stability and vector compression (§§5.3–5.4), and overlapping process groups (§6). Here we formalize the static single-group (dests(m) = P), single-hop CBCAST step of §§4.2–4.3 and §5.1 without diffusion or view-flush forwarding. Because raw point-to-point multicast can be interrupted mid-send if a faulty sender crashes (BSSAction.crashBroadcast), liveness at q ∉ F (bss_live_of_packetSentTo) is proved under the causal-ancestor transmission hypothesis PacketSentTo q (specializing in bss_live_of_atomic_multicast and BSSSolvesAtomicMulticastCausalBroadcast to liveness when crashes occur between atomic multicast steps).

Main definitions #

Main results #

References #

Packets, vector timestamps, and causal deliverability #

structure Cslib.Distributed.CausalBroadcast.Packet (P : Type u_1) (V : Type u_2) :
Type (max u_1 u_2)

A broadcast packet emitted in the Birman–Schiper–Stephenson CBCAST protocol ([BSS91], §5.1, p. 281): sender is the originating broadcaster, ts is the vector timestamp VT(m) : P → ℕ assigned upon broadcast, and payload is the message body.

  • sender : P

    Originating broadcaster process.

  • ts : P → ℕ

    Vector timestamp VT(m) recording causal broadcast counts per sender.

  • payload : V

    Application payload carried by the broadcast.

theorem Cslib.Distributed.CausalBroadcast.Packet.ext {P : Type u_1} {V : Type u_2} {x y : Packet P V} (sender : x.sender = y.sender) (ts : x.ts = y.ts) (payload : x.payload = y.payload) :
x = y

Total coordinate weight ∑ r : P, vt r of a vector timestamp, measuring the size of a broadcast's causal past for liveness induction.

def Cslib.Distributed.CausalBroadcast.Deliverable {P : Type u_1} {V : Type u_2} (vt : P → ℕ) (pkt : Packet P V) :

The Birman–Schiper–Stephenson causal delivery guard ([BSS91], §5.1, step 2, p. 281): a buffered packet pkt from s = pkt.sender is deliverable against local vector time vt iff pkt is the next undelivered broadcast from s (pkt.ts s = vt s + 1) and the recipient has already delivered all broadcasts from other senders r ≠ s that causally precede pkt (pkt.ts r ≤ vt r).

Instances For
    @[instance_reducible]
    theorem Cslib.Distributed.CausalBroadcast.sup_ts_eq_update_of_deliverable {P : Type u_1} {V : Type u_2} [DecidableEq P] {vt : P → ℕ} {pkt : Packet P V} (h : Deliverable vt pkt) :
    vt ⊔ pkt.ts = Function.update vt pkt.sender (vt pkt.sender + 1)

    Under Deliverable vt pkt, the coordinatewise max rule of [BSS91], §4.3 (p. 280), coincides with incrementing vt only at pkt.sender.

    Network state, actions, and transition system #

    structure Cslib.Distributed.CausalBroadcast.NetMsg (P : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    A point-to-point network message in flight to dest carrying broadcast pkt.

    • dest : P

      Recipient process identity.

    • pkt : Packet P V

      Broadcast packet in transit.

    theorem Cslib.Distributed.CausalBroadcast.NetMsg.ext_iff {P : Type u_1} {V : Type u_2} {x y : NetMsg P V} :
    x = y ↔ x.dest = y.dest ∧ x.pkt = y.pkt
    theorem Cslib.Distributed.CausalBroadcast.NetMsg.ext {P : Type u_1} {V : Type u_2} {x y : NetMsg P V} (dest : x.dest = y.dest) (pkt : x.pkt = y.pkt) :
    x = y
    structure Cslib.Distributed.CausalBroadcast.BSSProcState (P : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    Local state of a process in the Birman–Schiper–Stephenson CBCAST protocol. Note that protocol guards and transitions inspect only vt, pending, and halted; delivered records the sequence of locally delivered packets for specification.

    • vt : P → ℕ

      Current vector timestamp VT(p) of delivered broadcasts per sender.

    • pending : Multiset (Packet P V)

      Delay buffer of received packets awaiting causal delivery.

    • delivered : List (Packet P V)

      Chronological log of broadcasts delivered to the local application.

    • halted : Bool

      Whether this process has halted due to a crash fault.

    theorem Cslib.Distributed.CausalBroadcast.BSSProcState.ext {P : Type u_1} {V : Type u_2} {x y : BSSProcState P V} (vt : x.vt = y.vt) (pending : x.pending = y.pending) (delivered : x.delivered = y.delivered) (halted : x.halted = y.halted) :
    x = y
    structure Cslib.Distributed.CausalBroadcast.BSSState (P : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    Global asynchronous network state of the CBCAST protocol: unordered multiset inFlight of point-to-point packets in transit and per-process local states proc.

    • inFlight : Multiset (NetMsg P V)

      Unordered multiset of point-to-point network packets currently in transit.

    • proc : P → BSSProcState P V

      Local state of each process.

    theorem Cslib.Distributed.CausalBroadcast.BSSState.ext {P : Type u_1} {V : Type u_2} {x y : BSSState P V} (inFlight : x.inFlight = y.inFlight) (proc : x.proc = y.proc) :
    x = y

    Initial configuration of the CBCAST protocol: empty channels, zero vector clocks, empty delay buffers, empty delivery logs, and all processes operational (halted = false).

    def Cslib.Distributed.CausalBroadcast.bssNextTimestamp {P : Type u_1} [DecidableEq P] (vt : P → ℕ) (p : P) :
    P → ℕ

    Increment coordinate p of vector clock vt by 1.

    def Cslib.Distributed.CausalBroadcast.bssBroadcastPacket {P : Type u_1} {V : Type u_2} [DecidableEq P] (s : BSSState P V) (p : P) (payload : V) :
    Packet P V

    The Packet constructed when process p broadcasts payload in state s.

    def Cslib.Distributed.CausalBroadcast.bssExecBroadcast {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] (s : BSSState P V) (p : P) (payload : V) :

    Execute an atomic broadcast by p of payload: increment vt p, deliver locally at p immediately, and enqueue network copies to all q ≠ p.

    def Cslib.Distributed.CausalBroadcast.bssExecCrashBroadcast {P : Type u_1} {V : Type u_2} [DecidableEq P] (s : BSSState P V) (p : P) (dests : Finset P) (payload : V) :

    Execute a crash-interrupted broadcast by a faulty process p: p increments vt p, delivers locally, transmits copies only to dests, and halts.

    Receive an in-flight network message m into m.dest's pending delay buffer.

    def Cslib.Distributed.CausalBroadcast.bssExecDeliver {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (s : BSSState P V) (q : P) (pkt : Packet P V) :

    Deliver a buffered packet pkt at q, incrementing vt q pkt.sender and appending pkt to delivered.

    def Cslib.Distributed.CausalBroadcast.bssExecCrash {P : Type u_1} {V : Type u_2} [DecidableEq P] (s : BSSState P V) (p : P) :

    Halt process p due to a crash fault.

    inductive Cslib.Distributed.CausalBroadcast.BSSAction (P : Type u_1) (V : Type u_2) :
    Type (max u_1 u_2)

    Transition labels of the CBCAST labelled transition system.

    • broadcast {P : Type u_1} {V : Type u_2} (p : P) (payload : V) : BSSAction P V

      Process p broadcasts payload to all q ≠ p.

    • crashBroadcast {P : Type u_1} {V : Type u_2} (p : P) (dests : Finset P) (payload : V) : BSSAction P V

      Faulty process p ∈ F crashes mid-multicast after sending payload only to dests.

    • recv {P : Type u_1} {V : Type u_2} (m : NetMsg P V) : BSSAction P V

      Network message m arrives at m.dest and enters its delay buffer.

    • deliver {P : Type u_1} {V : Type u_2} (q : P) (pkt : Packet P V) : BSSAction P V

      Process q causally delivers pkt from its delay buffer.

    • crash {P : Type u_1} {V : Type u_2} (p : P) : BSSAction P V

      Faulty process p ∈ F crashes and halts.

    • stutter {P : Type u_1} {V : Type u_2} : BSSAction P V

      Dummy stuttering step leaving the global state unchanged.

    Deterministic state-update function for BSSAction.

    def Cslib.Distributed.CausalBroadcast.BSSEnabled {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] (F : Set P) (s : BSSState P V) :
    BSSAction P V → Prop

    Guard predicate specifying when act is enabled in state s under crash-fault set F.

    Instances For

      Labelled transition system of the Birman–Schiper–Stephenson CBCAST protocol for an arbitrary crash-fault set F : Set P (with no cardinality restriction on F).

      def Cslib.Distributed.CausalBroadcast.bssRun {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (s₀ : BSSState P V) (xl : List (BSSAction P V)) :

      Fold a finite list of BSSActions starting from s₀.

      Check whether every action in xl is enabled from s₀ under fault set F.

      Instances For
        @[instance_reducible]
        instance Cslib.Distributed.CausalBroadcast.instDecidableBSSValidTrace {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (F : Set P) [DecidablePred fun (x : P) => x ∈ F] (s : BSSState P V) (xl : List (BSSAction P V)) :
        theorem Cslib.Distributed.CausalBroadcast.bssLTS_mTr_iff {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (F : Set P) (s₀ : BSSState P V) (xl : List (BSSAction P V)) (s : BSSState P V) :
        (bssLTS F).MTr s₀ xl s ↔ bssValidTrace F s₀ xl ∧ s = bssRun s₀ xl

        Equivalence between LTS.MTr on bssLTS F and bssValidTrace + bssRun.

        Trace snapshots and causal precedence #

        State after the first i actions of a trace starting from bssInit P V.

        The Packet newly broadcast by act from state s, or none if act is not a broadcast.

        Set of packets broadcast along the finite trace xl from bssInit P V.

        def Cslib.Distributed.CausalBroadcast.CausalStep {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (xl : List (BSSAction P V)) (b₁ b₂ : Packet P V) :

        Direct (single-hop) causal relation between two packets broadcast along xl: either the same process broadcast b₁ strictly before b₂, or b₂.sender had already delivered b₁ when it broadcast b₂ ([BSS91], §4.2, pp. 278–279; [HT94], §3.3, p. 11).

        def Cslib.Distributed.CausalBroadcast.CausalPrec {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (xl : List (BSSAction P V)) :
        Packet P V → Packet P V → Prop

        Broadcast causal precedence b₁ ≺_bcast b₂, the transitive closure of CausalStep xl.

        Trace-extension and monotonicity lemmas #

        Inductive protocol invariant #

        Step-preservation lemmas for BSSInv #

        Integrity and duplicate freedom #

        theorem Cslib.Distributed.CausalBroadcast.bss_integrity {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {xl : List (BSSAction P V)} {s : BSSState P V} (hmtr : (bssLTS F).MTr (bssInit P V) xl s) (q : P) {pkt : Packet P V} (hdeliv : pkt ∈ (s.proc q).delivered) :

        Single-group single-hop CBCAST uniform-integrity step (toward #7297, after [BSS91], §5.1, p. 281 and [HT94], §3.1, p. 10 & §3.8, p. 14): in any execution of bssLTS F (for arbitrary F : Set P), every packet delivered at any process q (faulty or correct) was broadcast earlier in the trace by pkt.sender.

        theorem Cslib.Distributed.CausalBroadcast.bss_no_duplicates {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {xl : List (BSSAction P V)} {s : BSSState P V} (hmtr : (bssLTS F).MTr (bssInit P V) xl s) (q : P) :

        Single-group single-hop CBCAST duplicate-freedom step (toward #7297, after [BSS91], §5.1, p. 281 and [HT94], §3.1, p. 10 & §3.8, p. 14): in any reachable state of bssLTS F (for arbitrary F : Set P), every process q's delivery log (s.proc q).delivered contains no duplicate packets.

        Vector-clock characterization and causal delivery order #

        theorem Cslib.Distributed.CausalBroadcast.bss_causalPrec_iff_ts_lt {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {xl : List (BSSAction P V)} {s : BSSState P V} (hmtr : (bssLTS F).MTr (bssInit P V) xl s) {b₁ b₂ : Packet P V} (hb₁ : b₁ ∈ BroadcastIn xl) (hb₂ : b₂ ∈ BroadcastIn xl) :
        CausalPrec xl b₁ b₂ ↔ b₁.ts < b₂.ts

        Vector-clock causal-precedence characterization for single-group single-hop CBCAST (toward #7297, after [BSS91], §4.3, p. 280): along any execution of bssLTS F, for any two broadcast packets b₁, b₂ ∈ BroadcastIn xl, b₁ causally precedes b₂ iff b₁.ts < b₂.ts.

        theorem Cslib.Distributed.CausalBroadcast.bss_causal_delivery {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {xl : List (BSSAction P V)} {s : BSSState P V} (hmtr : (bssLTS F).MTr (bssInit P V) xl s) {b₁ b₂ : Packet P V} (hb₁ : b₁ ∈ BroadcastIn xl) (hb₂ : b₂ ∈ BroadcastIn xl) (hprec : CausalPrec xl b₁ b₂) (q : P) (hdel₂ : b₂ ∈ (s.proc q).delivered) :

        Single-group single-hop CBCAST uniform causal-delivery step (toward #7297, after [BSS91], §5.1, Safety, p. 282 and [HT94], §3.3 & §3.8, pp. 11, 15): in any execution of bssLTS F (for arbitrary F : Set P), if b₁ causally precedes b₂ (CausalPrec xl b₁ b₂), then at every process q : P (faulty or correct) that has delivered b₂, b₁ has already been delivered at q strictly prior to b₂.

        Fairness and infinite-execution specification #

        structure Cslib.Distributed.CausalBroadcast.BSSFair {P : Type u_1} {V : Type u_2} (F : Set P) (ss : ωSequence (BSSState P V)) (xs : ωSequence (BSSAction P V)) :

        Weak eventual-delivery fairness for bssLTS F on an infinite execution (ss, xs):

        1. Every network packet m addressed to a non-faulty process m.dest ∉ F is eventually received.
        2. Every buffered packet at q ∉ F that satisfies Deliverable is eventually delivered at q. (See deliverable_stable_until_delivered showing Deliverable remains continuously enabled until pkt is delivered.)
        def Cslib.Distributed.CausalBroadcast.PacketSentTo {P : Type u_1} {V : Type u_2} [DecidableEq P] (q : P) (ss : ωSequence (BSSState P V)) (xs : ωSequence (BSSAction P V)) (b : Packet P V) :

        Packet b was emitted along (ss, xs) and its copy to q was placed in flight (or b originated at q itself).

        def Cslib.Distributed.CausalBroadcast.OmegaCausalPrec {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] (_ss : ωSequence (BSSState P V)) (xs : ωSequence (BSSAction P V)) (b₁ b₂ : Packet P V) :

        Causal precedence between packets along an infinite execution (ss, xs).

        theorem Cslib.Distributed.CausalBroadcast.bss_omega_delivered_mono {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {ss : ωSequence (BSSState P V)} {xs : ωSequence (BSSAction P V)} (he : (bssLTS F).OmegaExecution ss xs) {i j : ℕ} (hij : i ≤ j) {q : P} {pkt : Packet P V} (h : pkt ∈ ((ss i).proc q).delivered) :
        pkt ∈ ((ss j).proc q).delivered

        Monotonicity of delivered along an OmegaExecution of bssLTS F: once pkt has been delivered at q at step i, it remains in ((ss j).proc q).delivered at every step j ≥ i.

        Stability of buffered deliverable packets #

        theorem Cslib.Distributed.CausalBroadcast.deliverable_stable_until_delivered {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {ss : ωSequence (BSSState P V)} {xs : ωSequence (BSSAction P V)} (hinit : ss 0 = bssInit P V) (he : (bssLTS F).OmegaExecution ss xs) {q : P} {pkt : Packet P V} {k j : ℕ} (hkj : k ≤ j) (hpend : pkt ∈ ((ss k).proc q).pending) (hdeliv : Deliverable ((ss k).proc q).vt pkt) (hnot_del : pkt ∉ ((ss j).proc q).delivered) :
        pkt ∈ ((ss j).proc q).pending ∧ Deliverable ((ss j).proc q).vt pkt

        Once a buffered packet pkt at q satisfies Deliverable at step k, it remains buffered and Deliverable at every subsequent step j ≥ k until q delivers pkt.

        Liveness under packet transmission and atomic multicast #

        theorem Cslib.Distributed.CausalBroadcast.bss_live_of_packetSentTo {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {ss : ωSequence (BSSState P V)} {xs : ωSequence (BSSAction P V)} (hinit : ss 0 = bssInit P V) (he : (bssLTS F).OmegaExecution ss xs) (hfair : BSSFair F ss xs) {q : P} (hq : q ∉ F) {b : Packet P V} (hsent_b : PacketSentTo q ss xs b) (hsent_pred : ∀ (b' : Packet P V), OmegaCausalPrec ss xs b' b → PacketSentTo q ss xs b') :
        ∃ (k : ℕ), b ∈ ((ss k).proc q).delivered

        Single-group single-hop CBCAST liveness step under causal-ancestor packet transmission (toward #7297, after [BSS91], §5.1, Liveness, p. 283): for any crash-fault set F : Set P (without any quorum or majority bound), in any fair infinite execution (ss, xs) starting from bssInit P V, if q ∉ F and b (along with every causal predecessor b' ≺_bcast b) was transmitted to q (PacketSentTo q ss xs), then q eventually delivers b.

        Proved by strong induction on total vector-timestamp weight vtWeight b.ts = ∑ r, b.ts r.

        Predicate stating that an action is not a mid-multicast partial crash (crashBroadcast).

        theorem Cslib.Distributed.CausalBroadcast.bss_live_of_atomic_multicast {P : Type u_1} {V : Type u_2} [Fintype P] [DecidableEq P] [DecidableEq V] {F : Set P} {ss : ωSequence (BSSState P V)} {xs : ωSequence (BSSAction P V)} (hinit : ss 0 = bssInit P V) (he : (bssLTS F).OmegaExecution ss xs) (hfair : BSSFair F ss xs) (hatomic : ∀ (k : ℕ), IsAtomicMulticastAction (xs k)) {q : P} (hq : q ∉ F) {k₀ : ℕ} {b : Packet P V} (hem : emittedPacket (ss k₀) (xs k₀) = some b) :
        ∃ (k : ℕ), b ∈ ((ss k).proc q).delivered

        Single-group CBCAST liveness step under atomic multicast steps without mid-send crashes (toward #7297, after [BSS91], §5.1, p. 283): in any fair execution where IsAtomicMulticastAction holds at every step (no torn crashBroadcast), every broadcast packet b is eventually delivered by every non-faulty process q ∉ F, for arbitrary F : Set P.

        Bundled single-group CBCAST safety and atomic-multicast liveness specification (toward #7297) satisfied by bssLTS F for an arbitrary crash-fault set F : Set P: uniform integrity, duplicate freedom, uniform causal delivery order, and fair liveness at q ∉ F under IsAtomicMulticastAction.

        Single-group single-hop CBCAST safety and atomic-multicast liveness step (toward #7297, after [BSS91], §5.1): for every static crash-fault set F : Set P (without any quorum or majority restriction), bssLTS F satisfies BSSSolvesAtomicMulticastCausalBroadcast P V F.