Documentation

CslibFrontier.Computability.Distributed.Byzantine.RecursiveOralMessages

Oral messages: Byzantine agreement for n > 3t #

The oral messages algorithm OM(m) of Lamport, Shostak and Pease, §3, run by every process as commander in parallel, solves Byzantine agreement against t faults among n > 3t processes in t + 1 rounds. With the node bound (CslibFrontier.Computability.Distributed.Byzantine.NodeBound) this gives the exact characterization exists_solvesByzantineAgreement_iff: for R ≥ t + 1, n processes can solve Byzantine agreement against t faults in R rounds exactly when n ≤ 1 or n > 3t.

The algorithm #

OM(0): the commander sends its value to every lieutenant, who uses it. OM(m + 1): the commander sends its value to every lieutenant; each lieutenant l relays the value it received to the other lieutenants by OM(m); lieutenant i takes the strict majority of the value it received from the commander and the values OM(m) gave it for the other lieutenants. Following Lamport, Shostak and Pease, a recursive instance is named by its relay path: the instance at σ = l :: τ is the OM(·) instance in which l relays the value it obtained in the instance at τ, and its lieutenants are the processes not on σ.

om P t runs these instances by exponential information gathering. The state of a process is a tree List P → Bool; the entry at the relay path j :: τ is written in round τ.length + 1 with the entry at τ of the tree that j sent, and is never changed afterwards. Every process sends its whole tree every round, so messages are unbounded, as the model allows. After t + 1 rounds, omResolve i (tree of i) t [c] evaluates OM(t) with commander c as seen by i: at depth 0 it reads the tree, and at depth m + 1 it takes the strict majority (ties false, the default order RETREAT) over the processes l not on the path of the entry σ itself if l = i, and of the value of the subinstance at l :: σ otherwise. The decision is the strict majority over all commanders c. As in om1, a process also obtains its own input through its own instance; for a correct process this returns its input.

Proof #

The core results are stated for an arbitrary family of trees val : P → List P → Bool that is faithful: a correct i holds at j :: τ the entry at τ of a correct j. Runs of om P t give faithful trees (om_state_cons, om_state_freeze).

At the top level τ = []: the processes off τ are all n processes, the generals of the instance of commander c.

Main definitions #

Main results #

References #

OM(m) on a tree #

def Cslib.Distributed.Byzantine.omResolve {P : Type u_1} [Fintype P] [DecidableEq P] (i : P) (val : List P → Bool) :
ℕ → List P → Bool

omResolve i val m σ: the value that process i, holding the tree val, obtains by OM(m) in the instance at the relay path σ, whose commander is the head of σ and whose lieutenants are the processes not on σ Lamport, Shostak and Pease, §3. With m = 0 it is the received value val σ; with m + 1 it is the strict majority over the lieutenants l of val σ if l = i and of the value of OM(m) in the instance at l :: σ otherwise. Ties go to false.

theorem Cslib.Distributed.Byzantine.omResolve_congr {P : Type u_1} [Fintype P] [DecidableEq P] (i : P) {val val' : List P → Bool} (m : ℕ) (σ : List P) :
(∀ (τ : List P), τ.length ≤ σ.length + m → val τ = val' τ) → omResolve i val m σ = omResolve i val' m σ

OM(m) at σ reads only the entries at paths of length at most σ.length + m.

theorem Cslib.Distributed.Byzantine.omResolve_eq_of_notMem {P : Type u_1} [Fintype P] [DecidableEq P] {F : Finset P} {val : P → List P → Bool} (hval : ∀ i ∉ F, ∀ j ∉ F, ∀ (τ : List P), val i (j :: τ) = val j τ) {k : ℕ} (m : ℕ) (j : P) (τ : List P) :
j ∉ F → (F \ τ.toFinset).card ≤ k → 2 * k + m < τ.toFinsetᶜ.card → ∀ i ∉ F, omResolve i (val i) m (j :: τ) = val j τ

Lemma 1 of Lamport, Shostak and Pease, for faithful trees: OM(m) satisfies IC2 when there are more than 2k + m generals and at most k traitors Lamport, Shostak and Pease, §3, Lemma 1. Here the trees val are faithful (hval: a correct i holds at j :: τ the entry at τ of a correct j), the instance at j :: τ has a correct commander j, at most k processes off τ are faulty and more than 2k + m processes are off τ. Then every correct process, the commander included, obtains the value val j τ that j relays.

theorem Cslib.Distributed.Byzantine.omResolve_eq_omResolve {P : Type u_1} [Fintype P] [DecidableEq P] {F : Finset P} {val : P → List P → Bool} (hval : ∀ i ∉ F, ∀ j ∉ F, ∀ (τ : List P), val i (j :: τ) = val j τ) (m : ℕ) (j : P) (τ : List P) :
j ∉ τ → (F \ τ.toFinset).card ≤ m → 3 * m < τ.toFinsetᶜ.card → ∀ p ∉ F, ∀ q ∉ F, omResolve p (val p) m (j :: τ) = omResolve q (val q) m (j :: τ)

Theorem 1 of Lamport, Shostak and Pease, for faithful trees: OM(m) satisfies IC1 when there are more than 3m generals and at most m traitors Lamport, Shostak and Pease, §3, Theorem 1. Here the trees val are faithful (hval), the commander j of the instance at j :: τ is not on τ, at most m processes off τ are faulty and more than 3m processes are off τ; the commander may be faulty. Then all correct processes obtain the same value. (IC2 is omResolve_eq_of_notMem with k = m.)

The protocol #

def Cslib.Distributed.Byzantine.om (P : Type u_1) [Fintype P] [DecidableEq P] (t : ℕ) :
Protocol P (List P → Bool) (List P → Bool)

OM(t) run by every process as commander in parallel, by exponential information gathering Lamport, Shostak and Pease, §§1, 3. The state of a process is a tree List P → Bool whose entry at [] is its input. Every process sends its tree every round; in round r + 1 a process writes, at every path j :: τ of length r + 1, the entry at τ of the tree received from j, and keeps all other entries. The decision is the strict majority, over all commanders c, of the value omResolve i s t [c] of OM(t) with commander c.

def Cslib.Distributed.Byzantine.omValue {P : Type u_1} [Fintype P] [DecidableEq P] (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) (m R : ℕ) (i c : P) :

The value that process i obtains for the input of c by OM(m) in the run of om P m after R rounds.

theorem Cslib.Distributed.Byzantine.om_state_nil {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) (i : P) (r : ℕ) :
(om P t).state F adv x r i [] = x i

The entry at [] is the own input.

theorem Cslib.Distributed.Byzantine.om_state_freeze {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) (i : P) (σ : List P) (d : ℕ) :
(om P t).state F adv x (σ.length + d) i σ = (om P t).state F adv x σ.length i σ

An entry at a path of length ℓ does not change after round ℓ.

theorem Cslib.Distributed.Byzantine.om_state_cons {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) (i j : P) (τ : List P) :
(om P t).state F adv x (j :: τ).length i (j :: τ) = if j ∈ F then adv τ.length j i τ else (om P t).state F adv x τ.length j τ

The entry at j :: τ is written in round τ.length + 1 with what j sent: the entry at τ of the tree of j if j is correct.

theorem Cslib.Distributed.Byzantine.omValue_eq_of_notMem {P : Type u_1} [Fintype P] [DecidableEq P] (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) {k m R : ℕ} (hF : F.card ≤ k) (hn : 2 * k + m < Fintype.card P) (hR : m + 1 ≤ R) {i c : P} (hi : i ∉ F) (hc : c ∉ F) :
omValue F adv x m R i c = x c

Lemma 1 (IC2) Lamport, Shostak and Pease, §3, Lemma 1: with at most k faults among more than 2k + m processes, after R ≥ m + 1 rounds every correct process obtains the input of a correct commander c by OM(m).

theorem Cslib.Distributed.Byzantine.omValue_eq_omValue {P : Type u_1} [Fintype P] [DecidableEq P] (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) {m R : ℕ} (hF : F.card ≤ m) (hn : 3 * m < Fintype.card P) (hR : m + 1 ≤ R) {i j : P} (hi : i ∉ F) (hj : j ∉ F) (c : P) :
omValue F adv x m R i c = omValue F adv x m R j c

Theorem 1 (IC1) Lamport, Shostak and Pease, §3, Theorem 1: with at most m faults among more than 3m processes, after R ≥ m + 1 rounds all correct processes obtain the same value for every commander c by OM(m), even when c is faulty.

theorem Cslib.Distributed.Byzantine.om_decision {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) (R : ℕ) (i : P) :
(om P t).decision F adv x R i = BitString.strictMajorityOn Finset.univ (omValue F adv x t R i)

The decision of om P t is the strict majority of the values of OM(t).

theorem Cslib.Distributed.Byzantine.om_decision_eq_decision_succ {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (F : Finset P) (adv : ℕ → P → P → List P → Bool) (x : P → Bool) {R : ℕ} (hR : t + 1 ≤ R) (i : P) :
(om P t).decision F adv x R i = (om P t).decision F adv x (t + 1) i

om P t decides in round t + 1: later rounds do not change the decision.

theorem Cslib.Distributed.Byzantine.solvesByzantineAgreement_om {P : Type u_1} [Fintype P] [DecidableEq P] {t : ℕ} (hn : 3 * t < Fintype.card P) {R : ℕ} (hR : t + 1 ≤ R) :

Oral messages Lamport, Shostak and Pease, §§1, 3: om P t solves Byzantine agreement against t faults among n > 3t processes in any R ≥ t + 1 rounds. Agreement is Theorem 1 (IC1) for every commander, and validity is Lemma 1 (IC2) for the more than n / 2 correct commanders.

theorem Cslib.Distributed.Byzantine.exists_solvesByzantineAgreement_iff (n t : ℕ) {R : ℕ} (hR : t + 1 ≤ R) :
(∃ (S : Type) (M : Type) (π : Protocol (Fin n) S M), π.SolvesByzantineAgreement t R) ↔ n ≤ 1 ∨ 3 * t < n

Byzantine agreement is solvable exactly when n ≤ 1 or n > 3t. For R ≥ t + 1, some protocol on n processes solves Byzantine agreement against t faults in R rounds exactly when n ≤ 1 or 3t < n: Protocol.ownInput and om solve it Lamport, Shostak and Pease, Theorem 1, and the node bound Fischer, Lynch and Merritt, Theorem 1 excludes 2 ≤ n ≤ 3t. Whether fewer than t + 1 rounds suffice is not addressed here.

om1 is OM(1) #

def Cslib.Distributed.Byzantine.om1Adv {P : Type u_1} (adv : ℕ → P → P → P → Bool) :
ℕ → P → P → List P → Bool

The messages of the faulty processes in a run of om1, replayed in a run of om P 1: the bit adv r j i k that j sends to i in round r + 1 about k becomes the entry for the relay path k :: τ; in round 1 the path is empty and adv 0 j i i is used, as om1 does.

theorem Cslib.Distributed.Byzantine.om1_decision_eq_om_decision {P : Type u_1} [Fintype P] [DecidableEq P] (F : Finset P) (x : P → Bool) (adv : ℕ → P → P → P → Bool) {R : ℕ} (hR : 2 ≤ R) {i : P} (hi : i ∉ F) :
(om1 P).decision F adv x R i = (om P 1).decision F (om1Adv adv) x R i

om1 is OM(1): the single-fault protocol om1 decides, at every correct process and after every R ≥ 2 rounds, as om P 1 against the replayed faulty messages om1Adv adv.