Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Common prefix, round form (Lemma 15 and Theorem 16)

Proved
BitcoinBackbone.common_prefix_rounds

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

backbonebitcoinchain-growthchain-qualitycommon-prefixformal-verificationgaray-kiayias-leonardosmathlibnakamoto-consensus

For a legal, typical execution, honest p1,p2p_1, p_2p1​,p2​, rounds r1≤r2r_1 \le r_2r1​≤r2​ and a window λ≤w≤r1λ \le w \le r_1λ≤w≤r1​: the blocks of chain p₁ r₁ of round ≤r1−w\le r_1 - w≤r1​−w form a prefix of chain p₂ r₂.

Preamble
import Definitions.Def_BitcoinBackbone
Formal statement
theorem BitcoinBackbone.common_prefix_rounds (E : BitcoinBackbone.Execution) (hE : E.Legal)
    (lam : ℕ) (hT : E.Typical lam) (p₁ p₂ : ℕ) (hp₁ : p₁ < E.n) (hp₂ : p₂ < E.n)
    (r₁ r₂ : ℕ) (hr : r₁ ≤ r₂) (w : ℕ) (hw : lam ≤ w) (hwr : w ≤ r₁) :
    (E.chain p₁ r₁).upTo (r₁ - w) <+: E.chain p₂ r₂ := 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; Lemmas 7, 14, 15, Theorem 16, the chain-quality theorem; Bitcoin Core a773e1e33b349dc819b5a0edc1c7a4839dc73b48: GetBlockProof (chain.cpp) through the block mission's chainWork
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: BitcoinBackbone.common_prefix_rounds

Statement. Let EEE be an execution of the backbone model, assumed legal (no mined-flag in round 000; for p<np<np<n, r≥1r\ge1r≥1, base(p,r)\mathrm{base}(p,r)base(p,r) is valid; for p<np<np<n every block of base(p,r)\mathrm{base}(p,r)base(p,r) has round <r<r<r; for p,q<np,q<np,q<n and all rrr, ∣Cq(r)∣≤∣base(p,r+1)∣|\mathcal{C}_q(r)|\le|\mathrm{base}(p,r+1)|∣Cq​(r)∣≤∣base(p,r+1)∣; for j<Zrj<Z_rj<Zr​, advParent(r,j)\mathrm{advParent}(r,j)advParent(r,j) is valid with all blocks of round ≤r\le r≤r). Let λ∈N\lambda\in\mathbb{N}λ∈N and assume EEE is λ\lambdaλ-typical:

∀a,b∈N,a+λ≤b  ⟹  ∑i=abZi<∑i=a+1b−1Yi,\forall a,b\in\mathbb{N},\quad a+\lambda\le b \;\Longrightarrow\; \sum_{i=a}^{b} Z_i < \sum_{i=a+1}^{b-1} Y_i ,∀a,b∈N,a+λ≤b⟹i=a∑b​Zi​<i=a+1∑b−1​Yi​,

with Yi=1Y_i=1Yi​=1 iff exactly one party index p′<np'<np′<n has mined(p′,i)=true\mathrm{mined}(p',i)=\mathtt{true}mined(p′,i)=true, else 000. Let p1<np_1<np1​<n, p2<np_2<np2​<n be party indices, r1≤r2r_1\le r_2r1​≤r2​ rounds, and w∈Nw\in\mathbb{N}w∈N a natural number with

λ  ≤  w  ≤  r1.\lambda \;\le\; w \;\le\; r_1 .λ≤w≤r1​.

Let C1=Cp1(r1)C_1=\mathcal{C}_{p_1}(r_1)C1​=Cp1​​(r1​) and C2=Cp2(r2)C_2=\mathcal{C}_{p_2}(r_2)C2​=Cp2​​(r2​) be the chains at the end of the respective rounds (Cp(0)=[ ]\mathcal{C}_p(0)=[\,]Cp​(0)=[]; for r≥1r\ge1r≥1, base(p,r)\mathrm{base}(p,r)base(p,r) with honest(p,r)\mathsf{honest}(p,r)honest(p,r) appended iff mined(p,r)=true\mathrm{mined}(p,r)=\mathtt{true}mined(p,r)=true). Then

upTo⁡(C1,  r1−w)  ⊑  C2,\operatorname{upTo}\bigl(C_1,\; r_1 - w\bigr) \;\sqsubseteq\; C_2 ,upTo(C1​,r1​−w)⊑C2​,

i.e. there is a list LLL with upTo⁡(C1,r1−w)+ ⁣ ⁣+L=C2\operatorname{upTo}(C_1, r_1-w) \mathbin{+\!\!+} L = C_2upTo(C1​,r1​−w)++L=C2​.

Meaning of upTo⁡\operatorname{upTo}upTo. upTo⁡(C1,t)\operatorname{upTo}(C_1, t)upTo(C1​,t) is the longest initial segment of C1C_1C1​ in which every block has round ≤t\le t≤t: scanning from position 000, blocks are kept while round⁡(B)≤t\operatorname{round}(B)\le tround(B)≤t and the scan stops at the first block with round⁡(B)>t\operatorname{round}(B)>tround(B)>t (that block and everything after it, including any later blocks with round ≤t\le t≤t, are discarded). Here round⁡(honest(p,r))=round⁡(adv(r,j))=r\operatorname{round}(\mathsf{honest}(p,r)) = \operatorname{round}(\mathsf{adv}(r,j)) = rround(honest(p,r))=round(adv(r,j))=r. Because w≤r1w\le r_1w≤r1​ is assumed, r1−wr_1 - wr1​−w is an ordinary (non-truncated) subtraction.

Cases made explicit. When w=r1w = r_1w=r1​ the cut-off is r1−w=0r_1-w=0r1​−w=0, so only an initial run of blocks with round ≤0\le 0≤0 (necessarily of the form adv(0,j)\mathsf{adv}(0,j)adv(0,j), since legality forbids honest(⋅,0)\mathsf{honest}(\cdot,0)honest(⋅,0) in a valid chain, though nothing forbids Z0>0Z_0>0Z0​>0) is required to be a prefix of C2C_2C2​. When w=λw=\lambdaw=λ the cut-off is r1−λr_1-\lambdar1​−λ. p1=p2p_1=p_2p1​=p2​ and r1=r2r_1=r_2r1​=r2​ are permitted. If r1=0r_1=0r1​=0 then w=λ=0w=\lambda=0w=λ=0 is forced by λ≤w≤r1\lambda\le w\le r_1λ≤w≤r1​, but 000-typicality is unsatisfiable, so that case is vacuous; 111-typicality is also unsatisfiable, and typicality forces n≥1n\ge1n≥1. The prefix relation is one-directional.

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

    Confirmed by the moderator at approval.

  • Endorsed by pitimespi · Oct 29, 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