Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Window failure in rate form

Proved
BitcoinBackboneProb.window_bound_rate

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

backbonebitcoinformal-verificationhoeffdinghonest-majoritymathlibnakamoto-consensusprobabilitytypical-execution

If margin >0> 0>0 and 4tp≤(k−3)4tp \le (k-3)4tp≤(k−3) margin: the window fails with probability at most exp⁡(−rate⋅(k+1))\exp(-\text{rate}\cdot(k+1))exp(−rate⋅(k+1)).

Preamble
import Definitions.Def_BitcoinBackboneProb
open BitcoinBackboneProb BitcoinBackbone
open MeasureTheory ProbabilityTheory
Formal statement
theorem BitcoinBackboneProb.window_bound_rate (n t : ℕ) (p : unitInterval) (a k : ℕ)
    (hk1 : 1 ≤ k) (hm : 0 < margin n t p) (hk : 4 * t * (p : ℝ) ≤ ((k : ℝ) - 3) * margin n t p) :
    (P n t p).real {ω | ∑ i ∈ Finset.Ioo a (a + k), Y ω i ≤ ∑ i ∈ Finset.Icc a (a + k), Z ω i} ≤
      Real.exp (-rate n t p * ((k : ℝ) + 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.window_bound_rate

Statement. Let n,t∈Nn, t \in \mathbb Nn,t∈N, p∈[0,1]p \in [0,1]p∈[0,1] and a,k∈Na, k \in \mathbb Na,k∈N. Assume

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

Then

Pn,t,p({ω:∑i∈(a, a+k)Yi(ω)  ≤  ∑i∈[a, a+k]Zi(ω)})  ≤  exp⁡ ⁣(−κ(n,t,p) (k+1)).P_{n,t,p}\Big(\Big\{\omega : \sum_{i \in (a,\,a+k)} Y_i(\omega) \;\le\; \sum_{i \in [a,\,a+k]} Z_i(\omega)\Big\}\Big) \;\le\; \exp\!\big(-\kappa(n,t,p)\,(k+1)\big).Pn,t,p​({ω:i∈(a,a+k)∑​Yi​(ω)≤i∈[a,a+k]∑​Zi​(ω)})≤exp(−κ(n,t,p)(k+1)).

Here (a,a+k)={a+1,…,a+k−1}(a, a+k) = \{a+1, \dots, a+k-1\}(a,a+k)={a+1,…,a+k−1} (k−1k-1k−1 rounds) and [a,a+k]={a,…,a+k}[a, a+k] = \{a, \dots, a+k\}[a,a+k]={a,…,a+k} (k+1k+1k+1 rounds); the event is that the number of uniquely successful rounds strictly inside the window is at most (non-strict) the number of adversarial blocks in the closed window. The start aaa is arbitrary (including a=0a = 0a=0).

Consequences of the hypotheses. 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: t=0t = 0t=0; for n≥2n \ge 2n≥2: in particular p<1p < 1p<1). Since 4tp≥04tp \ge 04tp≥0 and m>0m > 0m>0, the third hypothesis forces k≥3k \ge 3k≥3, and k=3k = 3k=3 forces t=0t = 0t=0; so the values k=1,2k = 1, 2k=1,2 admitted by k≥1k \ge 1k≥1 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.

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