Documentation

CslibFrontier.Computability.Distributed.Paxos.Liveness.AsyncQuorumProtocol

Asynchronous quorum protocol model and split-brain impossibility #

Defines the deterministic crash-tolerant AsyncQuorumProtocol model and proves the original disjoint-quorum partition impossibility (not_synod_safe_of_disjoint_quorums, not_safeSingleQuorum_of_card_le_two_mul).

Main definitions #

Main results #

Part 3: Disjoint-quorum split-brain impossibility #

structure Cslib.Distributed.Paxos.Packet (P : Type u_1) (M : Type u_2) :
Type (max u_1 u_2)

A point-to-point network packet carrying src, dest, and body.

  • src : P

    Sender process identity.

  • dest : P

    Recipient process identity.

  • body : M

    Packet payload.

theorem Cslib.Distributed.Paxos.Packet.ext {P : Type u_1} {M : Type u_2} {x y : Packet P M} (src : x.src = y.src) (dest : x.dest = y.dest) (body : x.body = y.body) :
x = y
theorem Cslib.Distributed.Paxos.Packet.ext_iff {P : Type u_1} {M : Type u_2} {x y : Packet P M} :
x = y ↔ x.src = y.src ∧ x.dest = y.dest ∧ x.body = y.body
def Cslib.Distributed.Paxos.instDecidableEqPacket.decEq {P✝ : Type u_1} {M✝ : Type u_2} [DecidableEq P✝] [DecidableEq M✝] (x✝ x✝¹ : Packet P✝ M✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]
instance Cslib.Distributed.Paxos.instDecidableEqPacket {P✝ : Type u_1} {M✝ : Type u_2} [DecidableEq P✝] [DecidableEq M✝] :
DecidableEq (Packet P✝ M✝)
structure Cslib.Distributed.Paxos.NodeProcState (S : Type u_1) (V : Type u_2) :
Type (max u_1 u_2)

Local process state paired with a write-once consensus decision register out.

  • state : S

    Internal protocol state.

  • out : Option V

    Write-once consensus output (none until decided).

theorem Cslib.Distributed.Paxos.NodeProcState.ext_iff {S : Type u_1} {V : Type u_2} {x y : NodeProcState S V} :
x = y ↔ x.state = y.state ∧ x.out = y.out
theorem Cslib.Distributed.Paxos.NodeProcState.ext {S : Type u_1} {V : Type u_2} {x y : NodeProcState S V} (state : x.state = y.state) (out : x.out = y.out) :
x = y
def Cslib.Distributed.Paxos.instDecidableEqNodeProcState.decEq {S✝ : Type u_1} {V✝ : Type u_2} [DecidableEq S✝] [DecidableEq V✝] (x✝ x✝¹ : NodeProcState S✝ V✝) :
Decidable (x✝ = x✝¹)
@[instance_reducible]
structure Cslib.Distributed.Paxos.NetState (P : Type u_1) (S : Type u_2) (M : Type u_3) (V : Type u_4) :
Type (max (max (max u_1 u_2) u_3) u_4)

Global configuration of an asynchronous message-passing consensus protocol.

  • msgs : Finset (Packet P M)

    Sent network packets (subject to arbitrary reordering, duplication, and delay/partition).

  • proc : P → NodeProcState S V

    Local state of each process.

theorem Cslib.Distributed.Paxos.NetState.ext {P : Type u_1} {S : Type u_2} {M : Type u_3} {V : Type u_4} {x y : NetState P S M V} (msgs : x.msgs = y.msgs) (proc : x.proc = y.proc) :
x = y
theorem Cslib.Distributed.Paxos.NetState.ext_iff {P : Type u_1} {S : Type u_2} {M : Type u_3} {V : Type u_4} {x y : NetState P S M V} :
x = y ↔ x.msgs = y.msgs ∧ x.proc = y.proc
inductive Cslib.Distributed.Paxos.NetAction (P : Type u_1) (L : Type u_2) (M : Type u_3) :
Type (max (max u_1 u_2) u_3)

Transition labels of an AsyncQuorumProtocol: spontaneous local steps, packet deliveries, and stuttering.

  • localStep {P : Type u_1} {L : Type u_2} {M : Type u_3} (p : P) (lbl : L) : NetAction P L M

    Process p takes a local step with parameter lbl.

  • deliver {P : Type u_1} {L : Type u_2} {M : Type u_3} (pkt : Packet P M) : NetAction P L M

    Packet pkt in the network is delivered to pkt.dest.

  • stutter {P : Type u_1} {L : Type u_2} {M : Type u_3} : NetAction P L M

    Dummy stuttering step.

@[instance_reducible]
instance Cslib.Distributed.Paxos.instDecidableEqNetAction {P✝ : Type u_1} {L✝ : Type u_2} {M✝ : Type u_3} [DecidableEq P✝] [DecidableEq L✝] [DecidableEq M✝] :
DecidableEq (NetAction P✝ L✝ M✝)
def Cslib.Distributed.Paxos.instDecidableEqNetAction.decEq {P✝ : Type u_1} {L✝ : Type u_2} {M✝ : Type u_3} [DecidableEq P✝] [DecidableEq L✝] [DecidableEq M✝] (x✝ x✝¹ : NetAction P✝ L✝ M✝) :
Decidable (x✝ = x✝¹)
def Cslib.Distributed.Paxos.NetAction.InGroup {P : Type u_1} {L : Type u_2} {M : Type u_3} (Q : Finset P) :
NetAction P L M → Prop

Whether act touches only processes and channels internal to subset Q.

structure Cslib.Distributed.Paxos.StepResult (P : Type u_1) (S : Type u_2) (M : Type u_3) (V : Type u_4) :
Type (max (max (max u_1 u_2) u_3) u_4)

Output of a single local or receive step: updated state, outgoing (dest, body) pairs, and optional decision candidate.

  • nextState : S

    Updated internal node state.

  • outgoing : Finset (P × M)

    Outgoing (dest, body) pairs to be tagged with the executing node as src.

  • decideVal : Option V

    Optional decision value (recorded only if out was none).

structure Cslib.Distributed.Paxos.AsyncQuorumProtocol (P : Type u_1) (S : Type u_2) (L : Type u_3) (M : Type u_4) (V : Type u_5) :
Type (max (max (max (max u_1 u_2) u_3) u_4) u_5)

General deterministic asynchronous crash-tolerant message-passing protocol over processes P, local state S, local-step labels L, messages M, and value domain V.

  • init : P → V → S

    Initial local state of process p given its input inp p : V.

  • localEnabled : P → L → NodeProcState S V → Prop

    Guard for spontaneous local step (p, lbl).

  • onLocal : P → L → NodeProcState S V → StepResult P S M V

    Transition function for spontaneous local step (p, lbl).

  • onRecv : P → P → M → NodeProcState S V → StepResult P S M V

    Transition function when dest receives body from src.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.start {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} (π : AsyncQuorumProtocol P S L M V) (inp : P → V) :
NetState P S M V

Initial network state for input assignment inp : P → V.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.applyResult {P : Type u_1} {S : Type u_2} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] (p : P) (res : StepResult P S M V) (s : NetState P S M V) :
NetState P S M V

Apply a StepResult emitted by process p to global state s.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.lts {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] (π : AsyncQuorumProtocol P S L M V) :
LTS (NetState P S M V) (NetAction P L M)

Labelled transition system of π.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.Reachable {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] (π : AsyncQuorumProtocol P S L M V) (inp : P → V) (s : NetState P S M V) :

π.Reachable inp s holds when s is reachable from π.start inp in π.lts.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.SafeConsensus {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] (π : AsyncQuorumProtocol P S L M V) :

Consensus safety: in every reachable state, all decided values agree with one another and every decided value equals some process's initial input.

def Cslib.Distributed.Paxos.AsyncQuorumProtocol.CanDecideIn {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] (π : AsyncQuorumProtocol P S L M V) (Q : Finset P) :

Single-quorum progress on subset Q: for every uniform input fun _ => v, there exists a finite Q-internal execution (InGroup Q, i.e., with all nodes outside Q silent/crashed from the start) in which some node q ∈ Q decides a value.

theorem Cslib.Distributed.Paxos.not_synod_safe_of_disjoint_quorums {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [DecidableEq P] [DecidableEq M] [Nontrivial V] (π : AsyncQuorumProtocol P S L M V) {Q₁ Q₂ : Finset P} (hdisj : Disjoint Q₁ Q₂) :

Original asynchronous partition / split-brain impossibility over AsyncQuorumProtocol (motivating the quorum-intersection condition B2 of [Lam98] §§1.2, 2.1 and [Lam01] §2.2, rather than formalizing a numbered theorem of those papers): over any nontrivial value domain [Nontrivial V], if subsets Q₁, Q₂ : Finset P are disjoint (Disjoint Q₁ Q₂), no deterministic asynchronous message-passing protocol π can simultaneously guarantee SafeConsensus and single-quorum progress (CanDecideIn) on both Q₁ and Q₂.

theorem Cslib.Distributed.Paxos.not_safeSingleQuorum_of_card_le_two_mul {P : Type u_1} {S : Type u_2} {L : Type u_3} {M : Type u_4} {V : Type u_5} [Fintype P] [DecidableEq P] [DecidableEq M] [Nontrivial V] {t : ℕ} (hcard₂ : 2 ≤ Fintype.card P) (hle : Fintype.card P ≤ 2 * t) (π : AsyncQuorumProtocol P S L M V) :
¬(π.SafeConsensus ∧ ∀ (Q : Finset P), Fintype.card P - t ≤ Q.card → π.CanDecideIn Q)

Original split-brain impossibility corollary at 2 ≤ |P| ≤ 2t over AsyncQuorumProtocol: over any nontrivial value domain [Nontrivial V], when 2 ≤ Fintype.card P ≤ 2 * t, no AsyncQuorumProtocol can guarantee SafeConsensus together with single-quorum progress on every (n - t)-element subset (i.e., progress tolerating t process crashes).