Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The induced execution is typical except with probability (L+1)² e^(−rate(λ+1))

Proved
BitcoinBackboneProb.typicalTrunc_failure_le

by pitimespi · Oct 30, 2026 · Mathlib 0df444a (Lean v4.33.1)

backbonebitcoinformal-verificationhoeffdinghonest-majoritymathlibnakamoto-consensusprobabilitytypical-execution

For λ≥2\lambda \ge 2λ≥2, margin >0> 0>0 and 4tp≤(λ−3)4tp \le (\lambda-3)4tp≤(λ−3) margin: P(¬P(\negP(¬TypicalTrunc)≤(L+1)2e−rate(λ+1)) \le (L+1)^2 e^{-\text{rate}(\lambda+1)})≤(L+1)2e−rate(λ+1), covering every window including those crossing the horizon.

Preamble
import Definitions.Def_BitcoinBackboneProb
open BitcoinBackboneProb BitcoinBackbone
open MeasureTheory ProbabilityTheory
Formal statement
theorem BitcoinBackboneProb.typicalTrunc_failure_le (n t : ℕ) (p : unitInterval) (lam L : ℕ)
    (hlam : 2 ≤ lam) (hm : 0 < margin n t p)
    (hk : 4 * t * (p : ℝ) ≤ ((lam : ℝ) - 3) * margin n t p) :
    (P n t p).real {ω | ¬ TypicalTrunc ω lam L} ≤
      ((L : ℝ) + 1) ^ 2 * Real.exp (-rate n t p * ((lam : ℝ) + 1)) := by sorry
Source
J. Garay, A. Kiayias, N. Leonardos, The Bitcoin Backbone Protocol: Analysis and Applications, EUROCRYPT 2015 (full version ePrint 2014/765): https://eprint.iacr.org/2014/765, Definition 9 (typical execution), Theorem 10, the honest-majority assumption; W. Hoeffding (1963) for the concentration bound; the backbone mission BitcoinBackbone (Execution, Typical, chain growth, common prefix, chain quality)
Read-back

What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)

Read-back: BitcoinBackboneProb.typicalTrunc_failure_le

Statement. Let n,t∈Nn, t \in \mathbb Nn,t∈N, p∈[0,1]p \in [0,1]p∈[0,1] and λ,L∈N\lambda, L \in \mathbb Nλ,L∈N. Assume

  • λ≥2\lambda \ge 2λ≥2;
  • m(n,t,p)>0m(n,t,p) > 0m(n,t,p)>0;
  • 4 t p≤(λ−3) m(n,t,p)4\,t\,p \le (\lambda - 3)\, m(n,t,p)4tp≤(λ−3)m(n,t,p) (real arithmetic; λ−3\lambda - 3λ−3 may be negative).

Then

Pn,t,p({ω:not TypTrunc(ω,λ,L)})  ≤  (L+1)2 exp⁡ ⁣(−κ(n,t,p) (λ+1)),P_{n,t,p}\big(\{\omega : \text{not } \mathrm{TypTrunc}(\omega, \lambda, L)\}\big) \;\le\; (L+1)^2 \, \exp\!\big(-\kappa(n,t,p)\,(\lambda+1)\big),Pn,t,p​({ω:not TypTrunc(ω,λ,L)})≤(L+1)2exp(−κ(n,t,p)(λ+1)),

with L,λL, \lambdaL,λ cast to R\mathbb RR. Here TypTrunc(ω,λ,L)\mathrm{TypTrunc}(\omega,\lambda,L)TypTrunc(ω,λ,L) is typicality (over all windows [a,b][a,b][a,b] with a+λ≤ba+\lambda \le ba+λ≤b, of unbounded position) of the execution induced by ω\omegaω with horizon LLL, in which honest successes in rounds 1,…,L1,\dots,L1,…,L and adversarial counts in rounds 0,…,L0,\dots,L0,…,L come from the trace, nobody honest mines in round 000, and after round LLL exactly party 000 mines each round while the adversary finds nothing (both unfolded below).

Consequences of the hypotheses m(n,t,p)>0m(n,t,p) > 0m(n,t,p)>0 and 4tp≤(λ−3) m(n,t,p)4tp \le (\lambda - 3)\,m(n,t,p)4tp≤(λ−3)m(n,t,p) (stated because they restrict which parameter values the statement actually covers). Since m=p (n(1−p)n−˙1−t)m = p\,\big(n(1-p)^{n \dot- 1} - t\big)m=p(n(1−p)n−˙​1−t), the hypothesis m>0m > 0m>0 forces p>0p > 0p>0, n≥1n \ge 1n≥1 and n(1−p)n−˙1>tn(1-p)^{n\dot-1} > tn(1−p)n−˙​1>t; for n=1n = 1n=1 this means t=0t = 0t=0 (any p∈(0,1]p \in (0,1]p∈(0,1]), for n≥2n \ge 2n≥2 it requires in particular p<1p < 1p<1. Since 4tp≥04tp \ge 04tp≥0 and m>0m > 0m>0, the second hypothesis forces λ≥3\lambda \ge 3λ≥3, and when λ=3\lambda = 3λ=3 it forces tp=0tp = 0tp=0, i.e. t=0t = 0t=0. Thus values of λ\lambdaλ below 333 that the stated lower bound on λ\lambdaλ admits make the hypotheses jointly unsatisfiable.

Probabilistic round model (unfolded)

  • Parameters. n,t∈Nn, t \in \mathbb Nn,t∈N are arbitrary natural numbers (either may be 000): nnn is the number of honest parties, ttt the number of adversarial queries per round. ppp is an element of the closed unit interval [0,1][0,1][0,1] (so p=0p = 0p=0 and p=1p = 1p=1 are allowed); wherever it appears in arithmetic it is the real number ppp. All casts of n,tn, tn,t and other naturals into formulas are casts into R\mathbb RR (so (λ−3)(\lambda - 3)(λ−3), (k−1)(k-1)(k−1) etc. below are real subtractions and may be negative), except where a natural-number subtraction is explicitly flagged.
  • Bernoulli law berp\mathrm{ber}_pberp​. The two-point Bernoulli measure on {true,false}\{\mathrm{true}, \mathrm{false}\}{true,false} built by Mathlib's bernoulliMeasure true false p: mass ppp on true\mathrm{true}true and mass 1−p1-p1−p on false\mathrm{false}false. It is a probability measure.
  • Round outcomes Rn,t\mathcal R_{n,t}Rn,t​. A round outcome is a pair ρ=(ρ1,ρ2)\rho = (\rho_1, \rho_2)ρ=(ρ1​,ρ2​) with ρ1:{0,…,n−1}→{true,false}\rho_1 : \{0,\dots,n-1\} \to \{\mathrm{true},\mathrm{false}\}ρ1​:{0,…,n−1}→{true,false} (which honest parties succeeded) and ρ2:{0,…,t−1}→{true,false}\rho_2 : \{0,\dots,t-1\} \to \{\mathrm{true},\mathrm{false}\}ρ2​:{0,…,t−1}→{true,false} (which adversarial queries succeeded). If n=0n = 0n=0 (resp. t=0t = 0t=0) the corresponding component is the unique empty function.
  • Round law μn,t,p\mu_{n,t,p}μn,t,p​. The product measure
μn,t,p=(⨂i=0n−1berp)⊗(⨂j=0t−1berp)\mu_{n,t,p} = \Big(\bigotimes_{i=0}^{n-1} \mathrm{ber}_p\Big) \otimes \Big(\bigotimes_{j=0}^{t-1} \mathrm{ber}_p\Big)μn,t,p​=(i=0⨂n−1​berp​)⊗(j=0⨂t−1​berp​)

on Rn,t\mathcal R_{n,t}Rn,t​ (product σ\sigmaσ-algebra): all n+tn + tn+t coordinates are independent, each true\mathrm{true}true with probability ppp. It is a probability measure.

  • Traces Ωn,t\Omega_{n,t}Ωn,t​. A trace is an infinite sequence ω=(ω0,ω1,ω2,… )\omega = (\omega_0, \omega_1, \omega_2, \dots)ω=(ω0​,ω1​,ω2​,…) of round outcomes, indexed by all r∈Nr \in \mathbb Nr∈N starting at r=0r = 0r=0; Ωn,t=Rn,tN\Omega_{n,t} = \mathcal R_{n,t}^{\mathbb N}Ωn,t​=Rn,tN​ with the product σ\sigmaσ-algebra.
  • Trace law Pn,t,pP_{n,t,p}Pn,t,p​. The infinite product probability measure Pn,t,p=⨂r∈Nμn,t,pP_{n,t,p} = \bigotimes_{r \in \mathbb N} \mu_{n,t,p}Pn,t,p​=⨂r∈N​μn,t,p​ on Ωn,t\Omega_{n,t}Ωn,t​ (Mathlib's Measure.infinitePi): the coordinates ωr\omega_rωr​ are i.i.d. with law μn,t,p\mu_{n,t,p}μn,t,p​. It is a probability measure. For any set A⊆Ωn,tA \subseteq \Omega_{n,t}A⊆Ωn,t​ (measurable or not; non-measurable sets get their outer measure), Pn,t,p(A)P_{n,t,p}(A)Pn,t,p​(A) below denotes the real number obtained by converting the (extended-nonnegative) measure of AAA to R\mathbb RR; it lies in [0,1][0,1][0,1].
  • Counts in one round. For ρ∈Rn,t\rho \in \mathcal R_{n,t}ρ∈Rn,t​:
#H(ρ)=#{ i<n:ρ1(i)=true }∈{0,…,n},#A(ρ)=#{ j<t:ρ2(j)=true }∈{0,…,t}.\#_H(\rho) = \#\{\, i < n : \rho_1(i) = \mathrm{true} \,\} \in \{0,\dots,n\}, \qquad \#_A(\rho) = \#\{\, j < t : \rho_2(j) = \mathrm{true} \,\} \in \{0,\dots,t\}.#H​(ρ)=#{i<n:ρ1​(i)=true}∈{0,…,n},#A​(ρ)=#{j<t:ρ2​(j)=true}∈{0,…,t}.
  • Round indicators. x(ρ)=1x(\rho) = 1x(ρ)=1 if #H(ρ)>0\#_H(\rho) > 0#H​(ρ)>0 and 000 otherwise; y(ρ)=1y(\rho) = 1y(ρ)=1 if #H(ρ)=1\#_H(\rho) = 1#H​(ρ)=1 and 000 otherwise (both natural numbers); w(ρ)=#A(ρ)−y(ρ)w(\rho) = \#_A(\rho) - y(\rho)w(ρ)=#A​(ρ)−y(ρ) computed in R\mathbb RR.
  • Trace variables. For ω∈Ωn,t\omega \in \Omega_{n,t}ω∈Ωn,t​ and r∈Nr \in \mathbb Nr∈N (including r=0r = 0r=0): Xr(ω)=x(ωr)X_r(\omega) = x(\omega_r)Xr​(ω)=x(ωr​), Yr(ω)=y(ωr)Y_r(\omega) = y(\omega_r)Yr​(ω)=y(ωr​), Zr(ω)=#A(ωr)Z_r(\omega) = \#_A(\omega_r)Zr​(ω)=#A​(ωr​) (natural numbers), Wr(ω)=w(ωr)∈RW_r(\omega) = w(\omega_r) \in \mathbb RWr​(ω)=w(ωr​)∈R. So Xr,Yr∈{0,1}X_r, Y_r \in \{0,1\}Xr​,Yr​∈{0,1} and Zr∈{0,…,t}Z_r \in \{0,\dots,t\}Zr​∈{0,…,t}.
  • Margin.
m(n,t,p)=n p (1−p) n −˙ 1−t p∈R,m(n,t,p) = n\,p\,(1-p)^{\,n \,\dot-\, 1} - t\,p \in \mathbb R,m(n,t,p)=np(1−p)n−˙​1−tp∈R,

where n−˙1n \dot- 1n−˙​1 is natural-number subtraction (truncated at 000): for n=0n = 0n=0 the exponent is 000 and m=−tpm = -t pm=−tp; for n=1n = 1n=1, m=p−tpm = p - tpm=p−tp; the convention 00=10^0 = 100=1 applies, so for n=1n = 1n=1, p=1p = 1p=1 the factor (1−p)0(1-p)^0(1−p)0 equals 111.

  • Rate.
κ(n,t,p)=m(n,t,p)22 (t+1)2 ≥0\kappa(n,t,p) = \frac{m(n,t,p)^2}{2\,(t+1)^2} \ \ge 0κ(n,t,p)=2(t+1)2m(n,t,p)2​ ≥0

(the denominator is at least 222, never zero).

Window conventions

For natural numbers a,ba, ba,b: [a,b]={a,a+1,…,b}[a,b] = \{a, a+1, \dots, b\}[a,b]={a,a+1,…,b} (closed window; empty if a>ba > ba>b, a single point if a=ba = ba=b) and (a,b)={a+1,…,b−1}(a,b) = \{a+1, \dots, b-1\}(a,b)={a+1,…,b−1} (open window; empty whenever b≤a+1b \le a + 1b≤a+1). A sum over an empty index set is 000. Sums of the natural-number variables Yi,ZiY_i, Z_iYi​,Zi​ are computed in N\mathbb NN and compared there.

Deterministic executions (unfolded)

  • Blocks and chains. A block is either honest(q,r)\mathrm{honest}(q, r)honest(q,r) (with q,r∈Nq, r \in \mathbb Nq,r∈N; "found by honest party qqq in round rrr") or adv(r,j)\mathrm{adv}(r, j)adv(r,j) (with r,j∈Nr, j \in \mathbb Nr,j∈N; "the jjj-th adversarial block of round rrr"). The round of a block is its rrr. A chain is a finite list of blocks (oldest first; the empty list is allowed).
  • Executions. An execution EEE consists of: a number E.n∈NE.n \in \mathbb NE.n∈N; a function minedE:N×N→{true,false}\mathrm{mined}_E : \mathbb N \times \mathbb N \to \{\mathrm{true},\mathrm{false}\}minedE​:N×N→{true,false} (minedE(q,r)\mathrm{mined}_E(q,r)minedE​(q,r): party qqq found a block in round rrr); a function ZE:N→NZ^E : \mathbb N \to \mathbb NZE:N→N (adversarial block count per round); and two functions baseE,advParentE:N×N→Chain\mathrm{base}_E, \mathrm{advParent}_E : \mathbb N \times \mathbb N \to \text{Chain}baseE​,advParentE​:N×N→Chain. Derived notions:
    • honest chain at the end of round rrr: chainE(q,0)=[ ]\mathrm{chain}_E(q, 0) = [\,]chainE​(q,0)=[] and chainE(q,r+1)=baseE(q,r+1)\mathrm{chain}_E(q, r+1) = \mathrm{base}_E(q, r+1)chainE​(q,r+1)=baseE​(q,r+1) followed by the block honest(q,r+1)\mathrm{honest}(q, r+1)honest(q,r+1) if minedE(q,r+1)\mathrm{mined}_E(q, r+1)minedE​(q,r+1), else just baseE(q,r+1)\mathrm{base}_E(q, r+1)baseE​(q,r+1);
    • #HE(r)=#{ q∈{0,…,E.n−1}:minedE(q,r) }\#^E_H(r) = \#\{\, q \in \{0,\dots,E.n - 1\} : \mathrm{mined}_E(q, r) \,\}#HE​(r)=#{q∈{0,…,E.n−1}:minedE​(q,r)}, and YrE=1Y^E_r = 1YrE​=1 if #HE(r)=1\#^E_H(r) = 1#HE​(r)=1, else 000;
    • EEE extends a chain CCC by block BBB: if B=honest(q,r)B = \mathrm{honest}(q,r)B=honest(q,r), this means q<E.nq < E.nq<E.n, minedE(q,r)=true\mathrm{mined}_E(q,r) = \mathrm{true}minedE​(q,r)=true and C=baseE(q,r)C = \mathrm{base}_E(q,r)C=baseE​(q,r); if B=adv(r,j)B = \mathrm{adv}(r,j)B=adv(r,j), it means j<ZrEj < Z^E_rj<ZrE​ and C=advParentE(r,j)C = \mathrm{advParent}_E(r,j)C=advParentE​(r,j);
    • a chain C=(C0,…,Cℓ−1)C = (C_0, \dots, C_{\ell-1})C=(C0​,…,Cℓ−1​) is valid for EEE iff for every i<ℓi < \elli<ℓ, CiC_iCi​ extends the prefix (C0,…,Ci−1)(C_0,\dots,C_{i-1})(C0​,…,Ci−1​) in the above sense (in particular C0C_0C0​ extends the empty chain).
  • Typical execution. Typical(E,λ)\mathrm{Typical}(E, \lambda)Typical(E,λ) holds iff for all a,b∈Na, b \in \mathbb Na,b∈N with a+λ≤ba + \lambda \le ba+λ≤b (no upper bound on bbb):
∑i∈[a,b]ZiE  <  ∑i∈(a,b)YiE.\sum_{i \in [a,b]} Z^E_i \;<\; \sum_{i \in (a,b)} Y^E_i .i∈[a,b]∑​ZiE​<i∈(a,b)∑​YiE​.

It depends only on E.nE.nE.n, minedE\mathrm{mined}_EminedE​ and ZEZ^EZE, not on baseE,advParentE\mathrm{base}_E, \mathrm{advParent}_EbaseE​,advParentE​. Edge case: if λ≤1\lambda \le 1λ≤1 the window a=0a = 0a=0, b=λb = \lambdab=λ has an empty open window, so Typical(E,λ)\mathrm{Typical}(E,\lambda)Typical(E,λ) is false for every execution EEE.

  • Legal execution. Legal(E)\mathrm{Legal}(E)Legal(E) is the conjunction of the following six conditions:
    1. minedE(q,0)=false\mathrm{mined}_E(q, 0) = \mathrm{false}minedE​(q,0)=false for every q∈Nq \in \mathbb Nq∈N;
    2. for all q<E.nq < E.nq<E.n and r≥1r \ge 1r≥1, baseE(q,r)\mathrm{base}_E(q, r)baseE​(q,r) is a valid chain;
    3. for all q<E.nq < E.nq<E.n, all rrr, every block of baseE(q,r)\mathrm{base}_E(q,r)baseE​(q,r) has round <r< r<r (so baseE(q,0)\mathrm{base}_E(q,0)baseE​(q,0) is empty);
    4. for all q,q′<E.nq, q' < E.nq,q′<E.n and all rrr: the length of chainE(q′,r)\mathrm{chain}_E(q', r)chainE​(q′,r) is at most the length of baseE(q,r+1)\mathrm{base}_E(q, r+1)baseE​(q,r+1);
    5. for all r,jr, jr,j with j<ZrEj < Z^E_rj<ZrE​, advParentE(r,j)\mathrm{advParent}_E(r,j)advParentE​(r,j) is a valid chain;
    6. for all r,jr, jr,j with j<ZrEj < Z^E_rj<ZrE​, every block of advParentE(r,j)\mathrm{advParent}_E(r,j)advParentE​(r,j) has round ≤r\le r≤r.
  • Execution induced by a trace. For a trace ω∈Ωn,t\omega \in \Omega_{n,t}ω∈Ωn,t​, a horizon L∈NL \in \mathbb NL∈N and arbitrary functions β,α:N×N→Chain\beta, \alpha : \mathbb N \times \mathbb N \to \text{Chain}β,α:N×N→Chain, the execution Eω,L[β,α]E^{\omega,L}[\beta,\alpha]Eω,L[β,α] has E.n=nE.n = nE.n=n, base=β\mathrm{base} = \betabase=β, advParent=α\mathrm{advParent} = \alphaadvParent=α, and
mined(q,r)={falseq≥n,(ωr)1(q)q<n, 1≤r≤L,falseq<n, r=0,true iff q=0q<n, r>L,ZrE={Zr(ω)r≤L (including r=0),0r>L.\mathrm{mined}(q,r) = \begin{cases} \mathrm{false} & q \ge n,\\ (\omega_r)_1(q) & q < n,\ 1 \le r \le L,\\ \mathrm{false} & q < n,\ r = 0,\\ \mathrm{true} \text{ iff } q = 0 & q < n,\ r > L,\end{cases} \qquad Z^E_r = \begin{cases} Z_r(\omega) & r \le L \ (\text{including } r = 0),\\ 0 & r > L.\end{cases}mined(q,r)=⎩⎨⎧​false(ωr​)1​(q)falsetrue iff q=0​q≥n,q<n, 1≤r≤L,q<n, r=0,q<n, r>L,​ZrE​={Zr​(ω)0​r≤L (including r=0),r>L.​

Consequently YrE=Yr(ω)Y^E_r = Y_r(\omega)YrE​=Yr​(ω) for 1≤r≤L1 \le r \le L1≤r≤L, Y0E=0Y^E_0 = 0Y0E​=0, and for r>Lr > Lr>L: YrE=1Y^E_r = 1YrE​=1 if n≥1n \ge 1n≥1 (only party 000 mines) and YrE=0Y^E_r = 0YrE​=0 if n=0n = 0n=0 (nobody ever mines when n=0n = 0n=0). The adversarial count of round 000 is taken from the trace even though no honest party mines in round 000. Condition 1 of Legal\mathrm{Legal}Legal holds automatically for these executions; the other conditions depend on β,α\beta, \alphaβ,α.

  • Truncated typicality. TypTrunc(ω,λ,L):  ⟺  Typical(Eω,L[β0,α0],λ)\mathrm{TypTrunc}(\omega, \lambda, L) :\iff \mathrm{Typical}(E^{\omega,L}[\beta_0,\alpha_0], \lambda)TypTrunc(ω,λ,L):⟺Typical(Eω,L[β0​,α0​],λ) where β0,α0\beta_0, \alpha_0β0​,α0​ are the constant functions returning the empty chain. Explicitly: for all a,ba, ba,b with a+λ≤ba + \lambda \le ba+λ≤b (arbitrarily large bbb, windows may lie partly or wholly beyond LLL),
∑i∈[a,b]ZiE<∑i∈(a,b)YiE\sum_{i \in [a,b]} Z^E_i < \sum_{i \in (a,b)} Y^E_ii∈[a,b]∑​ZiE​<i∈(a,b)∑​YiE​

with ZE,YEZ^E, Y^EZE,YE as just described. Edge cases: TypTrunc\mathrm{TypTrunc}TypTrunc is false for every ω\omegaω if λ≤1\lambda \le 1λ≤1 (see above), and also false for every ω\omegaω if n=0n = 0n=0 (the window a=L+1a = L+1a=L+1, b=L+1+λb = L+1+\lambdab=L+1+λ gives 0<00 < 00<0).

Human review
  • Endorsed by Shuze Chen · Oct 30, 2026

    Confirmed by the moderator at approval.

  • Endorsed by pitimespi · Oct 30, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me