Documentation

CslibFrontier.Computability.Distributed.ByzantineGraph.Basic

Synchronous Boolean consensus on general communication graphs #

Deterministic synchronous message passing over an undirected communication graph G : SimpleGraph P in the presence of static Byzantine faults, for the Boolean consensus problem of Pease, Shostak and Lamport and Fischer, Lynch and Merritt (§3, p. 61: every process holds a Boolean input, all correct processes agree, and unanimous correct inputs force that decision; this differs from the single-sender broadcast problem Agreement B of Dolev, §1, pp. 15–16).

In GraphProtocol G State Msg, processes communicate only along edges of G: in round r + 1, process i sends send r i s j hij to each adjacent process j (hij : G.Adj i j) and updates its local state via update r i s m, where m j hji is the message received along edge hji : G.Adj j i. A process needs no self-loop on G because update already receives its own current state s. When the processes in F : Finset P are faulty, a faulty neighbour j ∈ F injects adv r j i hji along each incident edge hji : G.Adj j i. Because adv is indexed only by actual edges of G, SolvesByzantineAgreement has no vacuity on sparse or edgeless graphs even when Msg is empty. As in Cslib.Distributed.Byzantine.Protocol, termination is at a fixed uniform round R: protocols whose decision round varies with the execution are not modelled directly (for finite P and Msg, König's lemma yields a uniform round bound).

Three simulation and covering tools connect GraphProtocol to the complete-graph theory of CslibFrontier.Computability.Distributed.Byzantine.Basic and CslibFrontier.Computability.Distributed.Byzantine.NodeBound:

Main definitions #

Main results #

References #

structure Cslib.Distributed.ByzantineGraph.GraphProtocol {P : Type u_1} (G : SimpleGraph P) (State : Type u_2) (Msg : Type u_3) :
Type (max (max u_1 u_2) u_3)

A deterministic synchronous message-passing protocol on the communication graph G : SimpleGraph P.

Process i with input bit b starts in state init i b. In round r + 1 it sends send r i s j hij to each neighbour j (hij : G.Adj i j) and moves to update r i s m, where s is its current state and m j hji is the message received along edge hji : G.Adj j i. Its decision in state s is output i s.

  • init : P → Bool → State

    The initial state of a process with a given input bit.

  • send : ℕ → (i : P) → State → (j : P) → G.Adj i j → Msg

    send r i s j hij: the message process i in state s sends to neighbour j in round r + 1.

  • update : ℕ → (i : P) → State → ((j : P) → G.Adj j i → Msg) → State

    update r i s m: the state of i after round r + 1, where m j hji came from neighbour j.

  • output : P → State → Bool

    The decision of a process in a given state.

def Cslib.Distributed.ByzantineGraph.GraphProtocol.state {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} (π : GraphProtocol G S M) (F : Finset P) (adv : ℕ → (j i : P) → G.Adj j i → M) (x : P → Bool) :
ℕ → P → S

The state of process i after r rounds on inputs x when the processes in F are faulty and a faulty neighbour j ∈ F sends adv r j i hji along edge hji : G.Adj j i in round r + 1.

def Cslib.Distributed.ByzantineGraph.GraphProtocol.decision {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} (π : GraphProtocol G S M) (F : Finset P) (adv : ℕ → (j i : P) → G.Adj j i → M) (x : P → Bool) (R : ℕ) (i : P) :

The decision of process i after R rounds.

π solves synchronous Boolean Byzantine agreement on G against at most t faults in R rounds: whenever at most t processes are faulty, whatever messages they send along incident edges of G, the correct processes agree after R rounds and decide v when all correct processes have input v (Fischer, Lynch and Merritt, §3, p. 61).

  • agreement (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → (j i : P) → G.Adj j i → M) (x : P → Bool), ∀ i ∉ F, ∀ j ∉ F, π.decision F adv x R i = π.decision F adv x R j

    Agreement: all correct processes decide the same value.

  • validity (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → (j i : P) → G.Adj j i → M) (x : P → Bool) (v : Bool), (∀ i ∉ F, x i = v) → ∀ i ∉ F, π.decision F adv x R i = v

    Validity: if all correct processes have input v, they decide v.

theorem Cslib.Distributed.ByzantineGraph.GraphProtocol.SolvesByzantineAgreement.mono {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} {π : GraphProtocol G S M} {t t' R : ℕ} (h : π.SolvesByzantineAgreement t R) (ht : t' ≤ t) :

Tolerating t faults implies tolerating at most t' ≤ t faults.

def Cslib.Distributed.ByzantineGraph.GraphProtocol.adaptiveState {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} (π : GraphProtocol G S M) (F : Finset P) (strat : ℕ → (P → S) → (j i : P) → G.Adj j i → M) (x : P → Bool) :
ℕ → P → S

The state of process i after r rounds against a rushing adversary: in round r + 1 a faulty neighbour j chooses strat r σ j i hji as a function of the global state σ after r rounds.

theorem Cslib.Distributed.ByzantineGraph.GraphProtocol.adaptiveState_eq_state {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} (π : GraphProtocol G S M) (F : Finset P) (strat : ℕ → (P → S) → (j i : P) → G.Adj j i → M) (x : P → Bool) (r : ℕ) :
π.adaptiveState F strat x r = π.state F (fun (r : ℕ) (j i : P) (hji : G.Adj j i) => strat r (π.adaptiveState F strat x r) j i hji) x r

A rushing adversary is no stronger than a fixed edge-message table: the execution against strat coincides with the execution against the table of messages strat sends along that run.

theorem Cslib.Distributed.ByzantineGraph.GraphProtocol.SolvesByzantineAgreement.adaptive {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} {π : GraphProtocol G S M} {t R : ℕ} (h : π.SolvesByzantineAgreement t R) {F : Finset P} (hF : F.card ≤ t) (strat : ℕ → (P → S) → (j i : P) → G.Adj j i → M) (x : P → Bool) :
(∀ i ∉ F, ∀ j ∉ F, π.output i (π.adaptiveState F strat x R i) = π.output j (π.adaptiveState F strat x R j)) ∧ ∀ (v : Bool), (∀ i ∉ F, x i = v) → ∀ i ∉ F, π.output i (π.adaptiveState F strat x R i) = v

Agreement and validity hold against rushing adversaries as well.

The protocol on G in which every process decides its own input without communicating.

On at most one process, deciding the own input solves Byzantine agreement on any graph G against any number of faults and for any decision round R.

Supergraph simulation and complete-graph equivalence #

def Cslib.Distributed.ByzantineGraph.GraphProtocol.toSupergraph {P : Type u_1} {S : Type u_2} {M : Type u_3} {G : SimpleGraph P} [DecidableRel G.Adj] {H : SimpleGraph P} (hle : G ≤ H) (π : GraphProtocol G S M) :

Simulate a protocol on G over any supergraph H (G ≤ H) using Option M messages: processes send some along edges of G and none along edges in H \ G, and replace a spurious none received from a faulty G-neighbour j (hji : G.Adj j i) by the locally well-typed fallback π.send r i s j hji.symm.

Supergraph simulation preserves SolvesByzantineAgreement in both directions.

View a GraphProtocol on the complete simple graph ⊤ as a complete-network Cslib.Distributed.Byzantine.Protocol with Option M payloads (none on self-loops).

A protocol on the complete simple graph ⊤ solves Byzantine agreement iff its Byzantine.Protocol translation does.

Restrict a complete-network Cslib.Distributed.Byzantine.Protocol to GraphProtocol ⊤, computing self-messages locally from the process's own current state.

Restricting a Byzantine.Protocol to GraphProtocol ⊤ preserves SolvesByzantineAgreement in both directions, keeping the state and message types unchanged.

No synchronous Boolean consensus with n ≤ 3t processes on any graph ([PSL80]; [FLM85], Theorem 1, §3.1, pp. 61–62): on any communication graph G over n processes with 2 ≤ n ≤ 3t, no protocol solves synchronous fixed-round Boolean Byzantine agreement against t faults in any round count R. Obtained immediately by simulating π on ⊤ (toSupergraph le_top) and applying the complete-graph node bound Cslib.Distributed.Byzantine.Protocol.not_solvesByzantineAgreement.

Covering networks on a communication graph #

def Cslib.Distributed.ByzantineGraph.GraphProtocol.coverState {P : Type u_1} {S : Type u_2} {M : Type u_3} {G : SimpleGraph P} (π : GraphProtocol G S M) {N : Type u_4} (label : N → P) (input : N → Bool) (nbr : N → P → N) :
ℕ → N → S

The state of node a of a covering network over G after r rounds. Node a runs the code of process label a on input input a, and receives the message along each incident G-edge hji : G.Adj j (label a) from node nbr a j, which sends it as j would.

theorem Cslib.Distributed.ByzantineGraph.GraphProtocol.state_eq_coverState {P : Type u_1} {S : Type u_2} {M : Type u_3} [DecidableEq P] {G : SimpleGraph P} (π : GraphProtocol G S M) {N : Type u_4} (label : N → P) (input : N → Bool) (nbr : N → P → N) (F : Finset P) (adv : ℕ → (j i : P) → G.Adj j i → M) (x : P → Bool) (e : P → N) (hlabel : ∀ i ∉ F, label (e i) = i) (hinput : ∀ i ∉ F, input (e i) = x i) (hnbr : ∀ i ∉ F, ∀ j ∉ F, G.Adj j i → nbr (e i) j = e j) (hadv : ∀ (r : ℕ), ∀ i ∉ F, ∀ j ∈ F, ∀ (hji : G.Adj j i), adv r j i hji = π.send r j (π.coverState label input nbr r (nbr (e i) j)) i hji) (r : ℕ) (i : P) :
i ∉ F → π.state F adv x r i = π.coverState label input nbr r (e i)

The graph covering lemma (after Fischer, Lynch and Merritt, §2, pp. 60–61). Suppose the correct processes embed into a covering network by e, preserving their labels, inputs, and mutual G-edges (G.Adj j i → nbr (e i) j = e j), and that along every G-edge from a faulty process j ∈ F to a correct process i ∉ F, j sends what nbr (e i) j sends in the covering network. Then every correct process i has the same state as e i after every round.

On the complete simple graph ⊤, GraphProtocol ⊤ and Cslib.Distributed.Byzantine.Protocol admit solutions for the exact same fault thresholds t and round bounds R.