Documentation

CslibFrontier.Computability.Distributed.ApproxAgreement.Protocol

Unit-interval fixed-horizon approximate Byzantine agreement #

Unit-interval ([0, 1]), fixed-horizon (R-round) deterministic synchronous (3t < n) and single-hop asynchronous (5t < n) approximate Byzantine agreement protocols (SolvesUnitSyncApproxAgreement, SolvesUnitAsyncApproxAgreement), together with arbitrary-range (hi - lo) / 2 ^ R multi-round contraction and 2 ≤ n ≤ 3t unit-interval impossibility bounds.

These declarations formalize bounded-input, fixed-horizon milestone steps toward #7116 and #3261 after the nonterminating approximation phases (Algorithm $S_0$ in Section 3, Lemma 6, p. 506; Algorithm $A_0$ in Section 4, Lemma 8, p. 509; and the fixed-round problem variant in Section 7, p. 516) of Dolev, Lynch, Pinter, Stark and Weihl — not the unbounded-input, dynamically halting Theorems 1 and 2 of that paper. Theorems 1 and 2 of [DLP+86] accept arbitrary real inputs without a pre-agreed horizon R, computing process-dependent halting horizons H = ⌈log_c(δ(V) / ε)⌉ from round-1 / round-0 reduce^{2t} views and echoing (v, halted) tags (Algorithms $S$ and $A$, Figures 1–2), and use f_{t, t} / f_{2t, t} representative means rather than the two-endpoint midpoint midTrim.

Contrast with exact consensus and FLP #

Main definitions #

Main results #

References #

Shared multi-round contraction engine and 3-partition helper #

Part 1: Synchronous approximate Byzantine agreement (3 * t < |P|) #

structure Cslib.Distributed.ApproxAgreement.SyncProtocol (P : Type u_1) (V : Type u_2) (State : Type u_3) (Msg : Type u_4) :
Type (max (max (max u_1 u_2) u_3) u_4)

A deterministic synchronous message-passing protocol on the complete graph of processes P with inputs and outputs in V (extending Cslib.Distributed.Byzantine.Protocol from Bool to an arbitrary value domain V).

  • init : P → V → State

    Initial state of process i on input v : V.

  • send : ℕ → P → State → P → Msg

    send r i s j: message sent by process i in state s to j in round r + 1.

  • update : ℕ → P → State → (P → Msg) → State

    update r i s m: state of i after round r + 1 upon receiving m j from each j.

  • output : P → State → V

    Output value read off from state s of process i.

def Cslib.Distributed.ApproxAgreement.SyncProtocol.state {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : SyncProtocol P V S M) (F : Finset P) (adv : ℕ → P → P → M) (x : P → V) :
ℕ → P → S

State of process i after r synchronous rounds on input vector x when processes in F are faulty and faulty j sends adv r j i to i in round r + 1.

def Cslib.Distributed.ApproxAgreement.SyncProtocol.decision {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : SyncProtocol P V S M) (F : Finset P) (adv : ℕ → P → P → M) (x : P → V) (R : ℕ) (i : P) :
V

Output decision of process i after R rounds.

def Cslib.Distributed.ApproxAgreement.SyncProtocol.adaptiveState {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : SyncProtocol P V S M) (F : Finset P) (strat : ℕ → (P → S) → P → P → M) (x : P → V) :
ℕ → P → S

State after r rounds against a rushing adversary strat that inspects the global state after round r before choosing faulty round-(r + 1) messages.

theorem Cslib.Distributed.ApproxAgreement.SyncProtocol.adaptiveState_eq_state {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : SyncProtocol P V S M) (F : Finset P) (strat : ℕ → (P → S) → P → P → M) (x : P → V) (r : ℕ) :
π.adaptiveState F strat x r = π.state F (fun (r : ℕ) (j i : P) => strat r (π.adaptiveState F strat x r) j i) x r

A rushing adversary in a deterministic synchronous run is equivalent to the fixed message table of messages it sends along that run.

def Cslib.Distributed.ApproxAgreement.SyncProtocol.coverState {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} (π : SyncProtocol P V S M) {N : Type u_5} (label : N → P) (input : N → V) (nbr : N → P → N) :
ℕ → N → S

Run of π on a covering network (label, input, nbr).

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

Covering lemma for value-domain synchronous protocols (Fischer, Lynch and Merritt).

Zero-communication protocol in which each process outputs its own input.

structure Cslib.Distributed.ApproxAgreement.SyncProtocol.SolvesUnitSyncApproxAgreement {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] {K : Type u_5} [Field K] [LinearOrder K] (πK : SyncProtocol P K S M) (t R : ℕ) (ε : K) :

Unit-interval, fixed-horizon synchronous ε-approximate Byzantine agreement (a [0, 1]-bounded, fixed-round milestone step toward #7116, after Section 3 and Section 7, p. 516 of Dolev, Lynch, Pinter, Stark and Weihl, rather than that paper's unbounded-input, dynamically halting Theorem 1): whenever F.card ≤ t and all correct inputs lie in [0, 1], after the fixed round horizon R:

  • validity (convex hull): for every closed interval [lo, hi] containing all correct inputs, every correct process's decision lies in [lo, hi];
  • agreement (ε-closeness): any two correct processes' decisions differ by at most ε.
  • validity (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → P → P → M) (x : P → K) (lo hi : K), (∀ k ∉ F, x k ∈ Set.Icc 0 1) → (∀ k ∉ F, x k ∈ Set.Icc lo hi) → ∀ i ∉ F, πK.decision F adv x R i ∈ Set.Icc lo hi

    Convex-hull validity: decisions remain within every [lo, hi] containing correct inputs.

  • agreement (F : Finset P) : F.card ≤ t → ∀ (adv : ℕ → P → P → M) (x : P → K), (∀ k ∉ F, x k ∈ Set.Icc 0 1) → ∀ i ∉ F, ∀ j ∉ F, |πK.decision F adv x R i - πK.decision F adv x R j| ≤ ε

    Approximate agreement: correct decisions lie within ε of each other.

theorem Cslib.Distributed.ApproxAgreement.SyncProtocol.SolvesUnitSyncApproxAgreement.mono {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] {K : Type u_5} [Field K] [LinearOrder K] {πK : SyncProtocol P K S M} {t t' R : ℕ} {ε ε' : K} (h : πK.SolvesUnitSyncApproxAgreement t R ε) (ht : t' ≤ t) (hε : ε ≤ ε') :
theorem Cslib.Distributed.ApproxAgreement.SyncProtocol.SolvesUnitSyncApproxAgreement.adaptive {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] {K : Type u_5} [Field K] [LinearOrder K] {πK : SyncProtocol P K S M} {t R : ℕ} {ε : K} (h : πK.SolvesUnitSyncApproxAgreement t R ε) {F : Finset P} (hF : F.card ≤ t) (strat : ℕ → (P → S) → P → P → M) (x : P → K) (hx : ∀ k ∉ F, x k ∈ Set.Icc 0 1) :
(∀ (lo hi : K), (∀ k ∉ F, x k ∈ Set.Icc lo hi) → ∀ i ∉ F, πK.output i (πK.adaptiveState F strat x R i) ∈ Set.Icc lo hi) ∧ ∀ i ∉ F, ∀ j ∉ F, |πK.output i (πK.adaptiveState F strat x R i) - πK.output j (πK.adaptiveState F strat x R j)| ≤ ε

Unit-interval fixed-horizon synchronous approximate agreement guarantees also hold against rushing adversaries.

theorem Cslib.Distributed.ApproxAgreement.SyncProtocol.not_solvesUnitSyncApproxAgreement_of_partition {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] {K : Type u_5} [Field K] [LinearOrder K] (πK : SyncProtocol P K S M) [Fintype P] [IsStrictOrderedRing K] {t R : ℕ} {ε : K} (hε : ε < 1) (g : P → Fin 3) (hcard : ∀ (k : Fin 3), {i : P | g i = k}.card ≤ t) {a c : P} (ha : g a = 0) (hc : g c = 2) :

Covering impossibility for unit-interval synchronous ε-approximate Byzantine agreement (ε < 1): if P splits into three groups of size at most t with witnesses a in group 0 and c in group 2, no protocol achieves SolvesUnitSyncApproxAgreement t R ε for ε < 1 (in particular for ε < 1 / 2), adapting Fischer, Lynch and Merritt.

theorem Cslib.Distributed.ApproxAgreement.SyncProtocol.not_solvesUnitSyncApproxAgreement {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] {K : Type u_5} [Field K] [LinearOrder K] (πK : SyncProtocol P K S M) [Fintype P] [IsStrictOrderedRing K] {t R : ℕ} {ε : K} (h2 : 2 ≤ Fintype.card P) (h3 : Fintype.card P ≤ 3 * t) (hε : ε < 1) :

No unit-interval synchronous ε-approximate Byzantine agreement for 2 ≤ |P| ≤ 3 * t and ε < 1: adapts the 3t + 1 covering lower bound proved in Fischer, Lynch and Merritt (and cited in Section 7, p. 515 of Dolev, Lynch, Pinter, Stark and Weihl) to SolvesUnitSyncApproxAgreement (including |P| = 2 via an empty middle group).

Fixed-horizon synchronous iterative trimmed-midpoint protocol (step after the nonterminating Algorithm $S_0$ in Section 3, p. 506 of Dolev, Lynch, Pinter, Stark and Weihl, using multisetMidTrim t in place of f_{t, t} and evaluated at a caller-chosen horizon R rather than Algorithm $S$'s input-dependent halting tag): in each round every process broadcasts its current estimate, collects the |P| values received, and moves to multisetMidTrim t.

theorem Cslib.Distributed.ApproxAgreement.syncApproxProtocol_decision_mem_Icc {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {t : ℕ} (h3t : 3 * t < Fintype.card P) {F : Finset P} (hF : F.card ≤ t) (adv : ℕ → P → P → K) (x : P → K) {lo hi : K} (hx : ∀ k ∉ F, x k ∈ Set.Icc lo hi) (R : ℕ) {i : P} (hiF : i ∉ F) :
(syncApproxProtocol P K t).decision F adv x R i ∈ Set.Icc lo hi

Synchronous convex-hull validity: for 3 * t < Fintype.card P, if all correct inputs lie in [lo, hi], then after every round R every correct process's output in syncApproxProtocol lies in [lo, hi].

theorem Cslib.Distributed.ApproxAgreement.syncApproxProtocol_abs_decision_sub_le {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {t : ℕ} (h3t : 3 * t < Fintype.card P) {F : Finset P} (hF : F.card ≤ t) (adv : ℕ → P → P → K) (x : P → K) {lo hi : K} (hx : ∀ k ∉ F, x k ∈ Set.Icc lo hi) (R : ℕ) {i j : P} (hiF : i ∉ F) (hjF : j ∉ F) :
|(syncApproxProtocol P K t).decision F adv x R i - (syncApproxProtocol P K t).decision F adv x R j| ≤ (hi - lo) / 2 ^ R

Synchronous multi-round contraction: for 3 * t < Fintype.card P, if all correct inputs lie in [lo, hi], then after R rounds any two correct processes' outputs in syncApproxProtocol differ by at most (hi - lo) / 2 ^ R.

Unit-interval, fixed-horizon step toward #7116 (after Section 3 of Dolev, Lynch, Pinter, Stark and Weihl): when 3 * t < Fintype.card P and (1 : K) / 2 ^ R ≤ ε, syncApproxProtocol achieves SolvesUnitSyncApproxAgreement t R ε.

theorem Cslib.Distributed.ApproxAgreement.exists_solvesUnitSyncApproxAgreement_iff (P : Type u_3) (K : Type u) [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] [Archimedean K] (t : ℕ) {ε : K} (hε0 : 0 < ε) (hε1 : ε < 1) :
(∃ (S : Type u) (M : Type u) (π : SyncProtocol P K S M) (R : ℕ), π.SolvesUnitSyncApproxAgreement t R ε) ↔ Fintype.card P ≤ 1 ∨ 3 * t < Fintype.card P

Sharp threshold for unit-interval, fixed-horizon synchronous approximate Byzantine agreement (milestone step toward #7116, after Section 3 and Section 7, p. 515 of Dolev, Lynch, Pinter, Stark and Weihl, rather than that paper's unbounded-input, dynamically halting Theorem 1): over any Archimedean linearly ordered field K and accuracy 0 < ε < 1, a deterministic synchronous protocol on P solving SolvesUnitSyncApproxAgreement t R ε for some fixed horizon R exists if and only if Fintype.card P ≤ 1 ∨ 3 * t < Fintype.card P. The degenerate |P| ≤ 1 branch is witnessed by SyncProtocol.ownInput; 3 * t < |P| sufficiency is witnessed by syncApproxProtocol; and necessity for 2 ≤ |P| ≤ 3 * t follows from SyncProtocol.not_solvesUnitSyncApproxAgreement adapting Fischer, Lynch and Merritt.

Part 2: Asynchronous approximate Byzantine agreement (5 * t < |P|) #

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

A deterministic multi-party asynchronous authenticated message-passing protocol on P with inputs and write-once outputs in V, local states S, and message payloads M. Global states (AsyncByzantine.State), authenticated envelopes (AsyncByzantine.Envelope), transition actions (AsyncByzantine.Action), and fairness (AsyncByzantine.Protocol.Fair) are reused directly from Cslib.Distributed.AsyncByzantine.

  • init : P → V → S

    Initial internal state of process p with input v : V.

  • initMsgs : P → V → Multiset (P × M)

    Initial outgoing (dest, body) messages emitted by process p with input v : V.

  • next : P → AsyncByzantine.ProcState S V → P → M → S

    State transition when dest receives body from src.

  • send : P → AsyncByzantine.ProcState S V → P → M → Multiset (P × M)

    Outgoing messages (q, m) emitted when dest receives body from src.

  • out : P → AsyncByzantine.ProcState S V → P → M → Option V

    Write-once output value (some v) delivered when dest receives body from src.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.toBroadcast {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} (π : AsyncProtocol P V S M) (x : P → V) (d : P) :

Embed π with fixed input vector x : P → V and any witness process d : P as an AsyncByzantine.Protocol, sharing the exact same LTS transitions and initial configuration.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.start {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : AsyncProtocol P V S M) [Fintype P] (F : Finset P) (x : P → V) :

Initial global configuration for static faulty set F and input vector x : P → V.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.updateProc {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} (π : AsyncProtocol P V S M) (dest src : P) (body : M) (st : AsyncByzantine.ProcState S V) :

Local write-once state update upon message delivery.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.recvCore {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : AsyncProtocol P V S M) (src dest : P) (body : M) (msgsBase : Multiset (AsyncByzantine.Envelope P M)) (s : AsyncByzantine.State P S M V) :

Core global transition shared by authentic delivery and Byzantine injection.

State resulting from delivering authentic in-flight envelope e to e.dest.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.recvByz {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : AsyncProtocol P V S M) (src dest : P) (body : M) (s : AsyncByzantine.State P S M V) :

State resulting from delivering adversary-injected (src, body) to dest.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.lts {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) (F : Finset P) :

Labelled transition system of π for static Byzantine set F.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.Reachable {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) [Fintype P] (F : Finset P) (x : P → V) (s : AsyncByzantine.State P S M V) :

Reachability from π.start F x under π.lts F.

def Cslib.Distributed.ApproxAgreement.AsyncProtocol.AdmissibleRun {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) [Fintype P] (F : Finset P) (x : P → V) (ss : ωSequence (AsyncByzantine.State P S M V)) (xs : ωSequence (AsyncByzantine.Action P M)) :

Admissible infinite execution of π for static faulty set F and inputs x : P → V.

@[simp]
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.toBroadcast_lts {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) (x : P → V) (d : P) (F : Finset P) :
(π.toBroadcast x d).lts F = π.lts F
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.toBroadcast_start {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] (π : AsyncProtocol P V S M) [Fintype P] (F : Finset P) (x : P → V) (d : P) (inp : Option V) :
(π.toBroadcast x d).start F inp = π.start F x
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.admissibleRun_iff_toBroadcast {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) [Fintype P] (F : Finset P) (x : P → V) (d : P) (ss : ωSequence (AsyncByzantine.State P S M V)) (xs : ωSequence (AsyncByzantine.Action P M)) :
π.AdmissibleRun F x ss xs ↔ (π.toBroadcast x d).AdmissibleRun F none ss xs
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.admissibleRun_reachable {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) [Fintype P] {F : Finset P} {x : P → V} {ss : ωSequence (AsyncByzantine.State P S M V)} {xs : ωSequence (AsyncByzantine.Action P M)} (ha : π.AdmissibleRun F x ss xs) (k : ℕ) :
π.Reachable F x (ss k)
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.procDecided_stable {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) {F : Finset P} {s s' : AsyncByzantine.State P S M V} {p : P} {v : V} (hd : s.ProcDecided p v) (hreach : (π.lts F).CanReach s s') :
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.omega_procDecided_stable {P : Type u_1} {V : Type u_2} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] (π : AsyncProtocol P V S M) {F : Finset P} {ss : ωSequence (AsyncByzantine.State P S M V)} {xs : ωSequence (AsyncByzantine.Action P M)} (he : (π.lts F).OmegaExecution ss xs) {k j : ℕ} (hkj : k ≤ j) {p : P} {v : V} (hd : (ss k).ProcDecided p v) :
(ss j).ProcDecided p v

Trivial single-process asynchronous protocol: each process sends a unit self-message at start and outputs its own input upon receiving any message. Uses ULift on local state so State lives in Type (max u v) for independent process and value universes.

structure Cslib.Distributed.ApproxAgreement.AsyncProtocol.SolvesUnitAsyncApproxAgreement {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] {K : Type u_5} [Field K] [LinearOrder K] (πK : AsyncProtocol P K S M) [Fintype P] (t : ℕ) (ε : K) :

Unit-interval asynchronous ε-approximate Byzantine agreement (a [0, 1]-bounded milestone step toward #7116 and #3261, after Section 4 of Dolev, Lynch, Pinter, Stark and Weihl, rather than that paper's unbounded-input Theorem 2): whenever F.card ≤ t and all correct inputs lie in [0, 1],

  • termination: in every fair execution, every correct process eventually outputs a value;
  • validity: for every [lo, hi] containing all correct inputs, every value output by a correct process in any reachable state lies in [lo, hi];
  • agreement: in any reachable state, any two values output by correct processes differ by at most ε.
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.SolvesUnitAsyncApproxAgreement.mono {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] {K : Type u_5} [Field K] [LinearOrder K] [Fintype P] {πK : AsyncProtocol P K S M} {t t' : ℕ} {ε ε' : K} (h : πK.SolvesUnitAsyncApproxAgreement t ε) (ht : t' ≤ t) (hε : ε ≤ ε') :
theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.SolvesUnitAsyncApproxAgreement.agreement_admissible {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] {K : Type u_5} [Field K] [LinearOrder K] [Fintype P] {πK : AsyncProtocol P K S M} {t : ℕ} {ε : K} (h : πK.SolvesUnitAsyncApproxAgreement t ε) {F : Finset P} (hF : F.card ≤ t) {x : P → K} (hx : ∀ k ∉ F, x k ∈ Set.Icc 0 1) {ss : ωSequence (AsyncByzantine.State P S M K)} {xs : ωSequence (AsyncByzantine.Action P M)} (ha : πK.AdmissibleRun F x ss xs) {i j : P} (hi : i ∉ F) (hj : j ∉ F) {n₁ n₂ : ℕ} {v₁ v₂ : K} (h₁ : (ss n₁).ProcDecided i v₁) (h₂ : (ss n₂).ProcDecided j v₂) :
|v₁ - v₂| ≤ ε

Unit-interval agreement along any admissible run at arbitrary decision steps n₁, n₂.

Asynchronous 2 ≤ |P| ≤ 3 * t split-brain impossibility #

theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.not_solvesUnitAsyncApproxAgreement_of_partition {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] {K : Type u_5} [Field K] [LinearOrder K] (πK : AsyncProtocol P K S M) [Fintype P] [IsStrictOrderedRing K] {t : ℕ} {ε : K} (hε : ε < 1) (A B C : Finset P) (hAB : Disjoint A B) (hAC : Disjoint A C) (hBC : Disjoint B C) (hcover : ∀ (p : P), p ∈ A ∨ p ∈ B ∨ p ∈ C) (hA : A.card ≤ t) (hB : B.card ≤ t) (hC : C.card ≤ t) {a₀ c₀ : P} (ha₀ : a₀ ∈ A) (hc₀ : c₀ ∈ C) :

Split-brain impossibility for unit-interval asynchronous ε-approximate Byzantine agreement (ε < 1): if P is partitioned into pairwise disjoint groups A, B, C each of size at most t with a₀ ∈ A and c₀ ∈ C (B may be empty), no protocol solves SolvesUnitAsyncApproxAgreement t ε for ε < 1.

theorem Cslib.Distributed.ApproxAgreement.AsyncProtocol.not_solvesUnitAsyncApproxAgreement {P : Type u_1} {S : Type u_3} {M : Type u_4} [DecidableEq P] [DecidableEq M] {K : Type u_5} [Field K] [LinearOrder K] (πK : AsyncProtocol P K S M) [Fintype P] [IsStrictOrderedRing K] {t : ℕ} {ε : K} (h2 : 2 ≤ Fintype.card P) (h3 : Fintype.card P ≤ 3 * t) (hε : ε < 1) :

No unit-interval asynchronous ε-approximate Byzantine agreement for 2 ≤ |P| ≤ 3 * t and ε < 1: asynchronous split-brain analogue of the 3t + 1 bound of Fischer, Lynch and Merritt (cited in Section 7, p. 515 of Dolev, Lynch, Pinter, Stark and Weihl). Covers both n = 2 (empty middle group) and 3 ≤ n ≤ 3 * t, and in particular every ε < 1 / 2.

Fixed-horizon single-hop round-tagged asynchronous protocol (5 * t < |P|) #

Round-tagged payload exchanged by asyncApproxProtocol.

  • round : ℕ

    Asynchronous round tag 0 ≤ round < R.

  • val : K

    Proposed value for round.

theorem Cslib.Distributed.ApproxAgreement.RoundMsg.ext {K : Type u_1} {x y : RoundMsg K} (round : x.round = y.round) (val : x.val = y.val) :
x = y
structure Cslib.Distributed.ApproxAgreement.AsyncApproxState (P : Type u_1) (K : Type u_2) :
Type (max u_1 u_2)

Local state of a process running asyncApproxProtocol. Retaining only the first message per (round, src) deduplicates Byzantine replays and equivocations, while buffering messages for all current and future rounds st.round ≤ r < R handles out-of-order asynchronous arrival and ignores stale messages from already-completed rounds.

  • round : ℕ

    Current active round (0 ≤ round ≤ R); reaches R when all R rounds finish.

  • est : K

    Current estimate (x p at round 0, updated by multisetMidTrim at each round).

  • heard : ℕ → P → Option K

    First round-r value received from each sender src : P: heard r src.

Distinct senders recorded so far by st for round r.

Multiset of values recorded so far by st for round r.

def Cslib.Distributed.ApproxAgreement.recordHeard {P : Type u_1} {K : Type u_2} [DecidableEq P] (st : AsyncApproxState P K) (r : ℕ) (src : P) (val : K) :

Record val as the round-r value heard from src in st.

structure Cslib.Distributed.ApproxAgreement.AsyncApproxStepResult (P : Type u_1) (K : Type u_2) :
Type (max u_1 u_2)

Output record of a local step of asyncApproxProtocol.

  • nextState : AsyncApproxState P K

    Updated local internal state.

  • outgoing : Multiset (P × RoundMsg K)

    Outgoing (dest, msg) multiset emitted in this step.

  • delivered : Option K

    Value delivered (some v) upon completing round R.

Initial local state of process p with input v in asyncApproxProtocol.

Bounded cascade advancing st through consecutive rounds while st.round < R and at least Fintype.card P - t distinct senders are buffered for st.round. Accumulates outgoing broadcasts for every intermediate round < R entered during the cascade.

def Cslib.Distributed.ApproxAgreement.asyncApproxStep {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] (t R : ℕ) (st : AsyncApproxState P K) (src : P) (msg : RoundMsg K) :

Local transition handler for asyncApproxProtocol. When R = 0, the first received message delivers st.est immediately; when R > 0, a fresh (msg.round, src) with st.round ≤ msg.round < R is buffered and triggers asyncApproxAdvance (stale messages with msg.round < st.round or after st.round = R are ignored).

Fixed-horizon single-hop asynchronous approximate agreement protocol (step after the nonterminating Algorithm $A_0$ in Section 4, p. 509 of Dolev, Lynch, Pinter, Stark and Weihl, using multisetMidTrim t in place of f_{2t, t} and halting after a caller-chosen round horizon R rather than Algorithm $A$'s round-0 reduce^{2t} spread estimation and (v, halted) tags): at start every process broadcasts ⟨0, x p⟩; in each round r < R, upon collecting |P| - t distinct round-r senders, a process updates its estimate via multisetMidTrim t, broadcasts ⟨r + 1, est'⟩ if r + 1 < R, and delivers est' once round = R.

Private invariant & liveness proofs for asyncApproxProtocol #

Monotonicity and round-by-round liveness helpers along AdmissibleRun #

Public correctness theorems for asyncApproxProtocol #

theorem Cslib.Distributed.ApproxAgreement.asyncApproxProtocol_terminates {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] {t R : ℕ} (ht : t < Fintype.card P) {F : Finset P} (hF : F.card ≤ t) (x : P → K) {ss : ωSequence (AsyncByzantine.State P (AsyncApproxState P K) (RoundMsg K) K)} {xs : ωSequence (AsyncByzantine.Action P (RoundMsg K))} (ha : (asyncApproxProtocol P K t R).AdmissibleRun F x ss xs) {i : P} (hiF : i ∉ F) :
∃ (n : ℕ) (v : K), (ss n).ProcDecided i v

Asynchronous fair-delivery termination: when F.card ≤ t and t < Fintype.card P (so in particular whenever 5 * t < Fintype.card P), in every admissible (fair) execution of asyncApproxProtocol P K t R every correct process i ∉ F eventually outputs a value.

theorem Cslib.Distributed.ApproxAgreement.asyncApproxProtocol_mem_Icc {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {t R : ℕ} (h5t : 5 * t < Fintype.card P) {F : Finset P} (hF : F.card ≤ t) {x : P → K} {lo hi : K} (hx : ∀ k ∉ F, x k ∈ Set.Icc lo hi) {s : AsyncByzantine.State P (AsyncApproxState P K) (RoundMsg K) K} (hr : (asyncApproxProtocol P K t R).Reachable F x s) {i : P} (hiF : i ∉ F) {v : K} (hdec : s.ProcDecided i v) :
v ∈ Set.Icc lo hi

Asynchronous convex-hull validity: when 5 * t < Fintype.card P, in every reachable state s of asyncApproxProtocol P K t R, if all correct inputs lie in [lo, hi], then any value v decided by a correct process i ∉ F lies in [lo, hi].

theorem Cslib.Distributed.ApproxAgreement.asyncApproxProtocol_abs_sub_le {P : Type u_1} {K : Type u_2} [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] {t R : ℕ} (h5t : 5 * t < Fintype.card P) {F : Finset P} (hF : F.card ≤ t) {x : P → K} {lo hi : K} (hx : ∀ k ∉ F, x k ∈ Set.Icc lo hi) {s : AsyncByzantine.State P (AsyncApproxState P K) (RoundMsg K) K} (hr : (asyncApproxProtocol P K t R).Reachable F x s) {i j : P} (hiF : i ∉ F) (hjF : j ∉ F) {v₁ v₂ : K} (h₁ : s.ProcDecided i v₁) (h₂ : s.ProcDecided j v₂) :
|v₁ - v₂| ≤ (hi - lo) / 2 ^ R

Asynchronous multi-round contraction: when 5 * t < Fintype.card P, in every reachable state s of asyncApproxProtocol P K t R, if all correct inputs lie in [lo, hi], then any two values v₁, v₂ decided by correct processes i, j ∉ F satisfy |v₁ - v₂| ≤ (hi - lo) / 2 ^ R.

Unit-interval, fixed-horizon step toward #7116 and #3261 (after Algorithm $A_0$ in Section 4 of Dolev, Lynch, Pinter, Stark and Weihl): when 5 * t < Fintype.card P and (1 : K) / 2 ^ R ≤ ε, asyncApproxProtocol P K t R achieves SolvesUnitAsyncApproxAgreement t ε.

theorem Cslib.Distributed.ApproxAgreement.exists_solvesUnitAsyncApproxAgreement (P : Type u) (K : Type v) [Fintype P] [DecidableEq P] [Field K] [LinearOrder K] [IsStrictOrderedRing K] [Archimedean K] (t : ℕ) {ε : K} (hε : 0 < ε) (hn : Fintype.card P ≤ 1 ∨ 5 * t < Fintype.card P) :
∃ (S : Type (max u v)) (M : Type v) (x : DecidableEq M) (π : AsyncProtocol P K S M), π.SolvesUnitAsyncApproxAgreement t ε

Unit-interval fixed-horizon asynchronous approximate Byzantine agreement (milestone step toward #7116 and #3261 after Algorithm $A_0$ in Section 4, p. 509 of Dolev, Lynch, Pinter, Stark and Weihl, rather than that paper's unbounded-input, dynamically halting Algorithm $A$ / Theorem 2): over any Archimedean linearly ordered field K, for every 0 < ε and Fintype.card P ≤ 1 ∨ 5 * t < Fintype.card P, there exists a deterministic asynchronous protocol solving SolvesUnitAsyncApproxAgreement t ε (AsyncProtocol.ownInput for |P| ≤ 1, and fixed-horizon asyncApproxProtocol P K t R with (1 : K) / 2 ^ R ≤ ε for 5 * t < |P|), contrasting with exact consensus impossibility (Cslib.FLP) even on [0, 1] inputs.