Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The time-averaged pool gain is the expected gain under the Cesàro average

Proved
BitcoinSelfishErgodic.avgPoolGain_eq

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

bitcoincesaroergodicformal-verificationlong-run-averagemarkov-chainmathlibrenewalselfish-mining

avgPoolGain α γ n = expPoolGain α γ (cesaro α γ (delta zero) n).

Preamble
import Definitions.Def_BitcoinSelfishErgodic
open BitcoinSelfishErgodic BitcoinSelfishMining BitcoinSelfishUnique Filter Topology
Formal statement
theorem BitcoinSelfishErgodic.avgPoolGain_eq (α γ : ℝ) (h0 : 0 < α) (h1 : α < 1 / 2) (n : ℕ) :
    BitcoinSelfishErgodic.avgPoolGain α γ n =
      BitcoinSelfishErgodic.expPoolGain α γ
        (BitcoinSelfishErgodic.cesaro α γ (BitcoinSelfishErgodic.delta .zero) n) := by sorry
Source
I. Eyal, E. G. Sirer, Majority is not Enough: Bitcoin Mining is Vulnerable, Financial Cryptography 2014, arXiv:1311.0243, Section 4 (the revenue as a long-run share); the selfish-mining missions BitcoinSelfishMining (chain, revenues, threshold) and BitcoinSelfishUnique (uniqueness of the stationary distribution); standard Markov-chain theory (Cesàro limits, renewal equation)
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: BitcoinSelfishErgodic.avgPoolGain_eq

Setting. α,γ\alpha, \gammaα,γ are real numbers with 0<α<120 < \alpha < \tfrac120<α<21​; there is no hypothesis on γ\gammaγ (it may be any real number, e.g. negative or larger than 111). Also nnn is an arbitrary natural number, including n=0n = 0n=0.

Assertion. The time-averaged pool credit over the first nnn steps from zero\mathsf{zero}zero equals the expected pool credit under the Cesàro average of the first nnn step-functions started from δzero\delta_{\mathsf{zero}}δzero​:

An  =  Epool(Cnδzero),A_n \;=\; E^{\mathrm{pool}}\big(C_n\delta_{\mathsf{zero}}\big),An​=Epool(Cn​δzero​),

that is, written out,

1n∑k=0n−1Σ(s↦(Dkδzero)(s) g(s))  =  Σ(s↦(Cnδzero)(s) g(s)),\frac{1}{n}\sum_{k=0}^{n-1}\Sigma\big(s\mapsto (D^k\delta_{\mathsf{zero}})(s)\,g(s)\big) \;=\; \Sigma\big(s \mapsto (C_n\delta_{\mathsf{zero}})(s)\,g(s)\big),n1​k=0∑n−1​Σ(s↦(Dkδzero​)(s)g(s))=Σ(s↦(Cn​δzero​)(s)g(s)),

where on the left each of the nnn inner sums, and on the right the single sum, uses its own "lead series is 000 if not summable" convention. For n=0n = 0n=0 both sides are 000 (left: factor 1/0=01/0 = 01/0=0; right: C0δzeroC_0\delta_{\mathsf{zero}}C0​δzero​ is the zero function).


Definitions used, unfolded

State space SSS. The states are zero\mathsf{zero}zero, tie\mathsf{tie}tie, and one state leadm\mathsf{lead}_mleadm​ for every natural number m=0,1,2,…m = 0, 1, 2, \dotsm=0,1,2,…; all of these are distinct. (The source comments say that leadm\mathsf{lead}_mleadm​ stands for a private lead of m+1m+1m+1 blocks, so lead0\mathsf{lead}_0lead0​ is "lead 1", lead1\mathsf{lead}_1lead1​ is "lead 2", and so on. Formally these are only labels, and every subscript below is this shifted index.)

Sum over all states. For any f:S→Rf : S \to \mathbb{R}f:S→R,

Σf  =  f(zero)+f(tie)+∑m≥0f(leadm),\Sigma f \;=\; f(\mathsf{zero}) + f(\mathsf{tie}) + \sum_{m \ge 0} f(\mathsf{lead}_m),Σf=f(zero)+f(tie)+m≥0∑​f(leadm​),

where the infinite series is the value of the series when the real sequence (f(leadm))m≥0\big(f(\mathsf{lead}_m)\big)_{m \ge 0}(f(leadm​))m≥0​ is summable (for real sequences: absolutely summable). The series is defined to be 000 when that sequence is not summable.

One-step transition weights Pα,γP_{\alpha,\gamma}Pα,γ​. For arbitrary real numbers α,γ\alpha, \gammaα,γ (the definitions themselves impose no range), there are three outcomes, with weights

qpool=α,qhP=(1−α)γ,qhO=(1−α)(1−γ).q_{\mathrm{pool}} = \alpha, \qquad q_{\mathrm{hP}} = (1-\alpha)\gamma, \qquad q_{\mathrm{hO}} = (1-\alpha)(1-\gamma).qpool​=α,qhP​=(1−α)γ,qhO​=(1−α)(1−γ).

A deterministic successor map step(s,o)\mathrm{step}(s, o)step(s,o) is given by

current stateoutcome pooloutcome hPoutcome hO
zero\mathsf{zero}zerolead0\mathsf{lead}_0lead0​zero\mathsf{zero}zerozero\mathsf{zero}zero
tie\mathsf{tie}tiezero\mathsf{zero}zerozero\mathsf{zero}zerozero\mathsf{zero}zero
lead0\mathsf{lead}_0lead0​lead1\mathsf{lead}_1lead1​tie\mathsf{tie}tietie\mathsf{tie}tie
lead1\mathsf{lead}_1lead1​lead2\mathsf{lead}_2lead2​zero\mathsf{zero}zerozero\mathsf{zero}zero
leadm+2\mathsf{lead}_{m+2}leadm+2​ (m≥0m \ge 0m≥0)leadm+3\mathsf{lead}_{m+3}leadm+3​leadm+1\mathsf{lead}_{m+1}leadm+1​leadm+1\mathsf{lead}_{m+1}leadm+1​

and Pα,γ(s,t)=∑o : step(s,o)=tqoP_{\alpha,\gamma}(s, t) = \sum_{o \,:\, \mathrm{step}(s,o) = t} q_oPα,γ​(s,t)=∑o:step(s,o)=t​qo​ (sum of the weights of the outcomes leading from sss to ttt). Using qhP+qhO=1−αq_{\mathrm{hP}} + q_{\mathrm{hO}} = 1-\alphaqhP​+qhO​=1−α and qpool+qhP+qhO=1q_{\mathrm{pool}} + q_{\mathrm{hP}} + q_{\mathrm{hO}} = 1qpool​+qhP​+qhO​=1, the only entries that can be nonzero are

P(zero,lead0)=α,P(zero,zero)=1−α,P(tie,zero)=1,P(lead0,lead1)=α,P(lead0,tie)=1−α,P(lead1,lead2)=α,P(lead1,zero)=1−α,P(leadm+2,leadm+3)=α,P(leadm+2,leadm+1)=1−α(m≥0),\begin{aligned} &P(\mathsf{zero},\mathsf{lead}_0) = \alpha, && P(\mathsf{zero},\mathsf{zero}) = 1-\alpha, && P(\mathsf{tie},\mathsf{zero}) = 1,\\ &P(\mathsf{lead}_0,\mathsf{lead}_1) = \alpha, && P(\mathsf{lead}_0,\mathsf{tie}) = 1-\alpha, && \\ &P(\mathsf{lead}_1,\mathsf{lead}_2) = \alpha, && P(\mathsf{lead}_1,\mathsf{zero}) = 1-\alpha, && \\ &P(\mathsf{lead}_{m+2},\mathsf{lead}_{m+3}) = \alpha, && P(\mathsf{lead}_{m+2},\mathsf{lead}_{m+1}) = 1-\alpha \quad (m \ge 0), && \end{aligned}​P(zero,lead0​)=α,P(lead0​,lead1​)=α,P(lead1​,lead2​)=α,P(leadm+2​,leadm+3​)=α,​​P(zero,zero)=1−α,P(lead0​,tie)=1−α,P(lead1​,zero)=1−α,P(leadm+2​,leadm+1​)=1−α(m≥0),​​P(tie,zero)=1,​

and every other entry is 000. These identities hold for every real α,γ\alpha, \gammaα,γ: the transition weights do not depend on γ\gammaγ, each row sums to 111, and all entries are ≥0\ge 0≥0 exactly when 0≤α≤10 \le \alpha \le 10≤α≤1.

Point mass. For a state ttt, δt(s)=1\delta_t(s) = 1δt​(s)=1 if s=ts = ts=t and δt(s)=0\delta_t(s) = 0δt​(s)=0 otherwise.

One step applied to a function. For any μ:S→R\mu : S \to \mathbb{R}μ:S→R (not required to be nonnegative, summable or normalized),

(Dμ)(s)  =  Σ(t↦μ(t) Pα,γ(t,s))  =  μ(zero)P(zero,s)+μ(tie)P(tie,s)+∑m≥0μ(leadm)P(leadm,s).(D\mu)(s) \;=\; \Sigma\big(t \mapsto \mu(t)\, P_{\alpha,\gamma}(t, s)\big) \;=\; \mu(\mathsf{zero})P(\mathsf{zero},s) + \mu(\mathsf{tie})P(\mathsf{tie},s) + \sum_{m\ge 0}\mu(\mathsf{lead}_m)P(\mathsf{lead}_m,s).(Dμ)(s)=Σ(t↦μ(t)Pα,γ​(t,s))=μ(zero)P(zero,s)+μ(tie)P(tie,s)+m≥0∑​μ(leadm​)P(leadm​,s).

(The parameters α,γ\alpha,\gammaα,γ are implicit in D=Dα,γD = D_{\alpha,\gamma}D=Dα,γ​.) For a fixed target sss, at most two lead states ttt have P(t,s)≠0P(t,s) \ne 0P(t,s)=0, so the lead series here has only finitely many nonzero terms and is an ordinary finite sum.

nnn steps. D0μ=μD^0\mu = \muD0μ=μ and Dn+1μ=D(Dnμ)D^{n+1}\mu = D(D^n\mu)Dn+1μ=D(Dnμ) for n≥0n \ge 0n≥0.

Cesàro average. For μ:S→R\mu : S \to \mathbb{R}μ:S→R, n∈Nn \in \mathbb{N}n∈N and a state sss,

(Cnμ)(s)  =  1n∑k=0n−1(Dkμ)(s),(C_n\mu)(s) \;=\; \frac{1}{n}\sum_{k=0}^{n-1} (D^k\mu)(s),(Cn​μ)(s)=n1​k=0∑n−1​(Dkμ)(s),

with the real-number convention 1/0=01/0 = 01/0=0; in particular C0μC_0\muC0​μ is the zero function.

Per-step credits. Blocks credited at a transition from state sss under outcome ooo (natural numbers, cast to reals):

current statepool credit (pool / hP / hO)others credit (pool / hP / hO)
zero\mathsf{zero}zero0 / 0 / 00 \,/\, 0 \,/\, 00/0/00 / 1 / 10 \,/\, 1 \,/\, 10/1/1
tie\mathsf{tie}tie2 / 1 / 02 \,/\, 1 \,/\, 02/1/00 / 1 / 20 \,/\, 1 \,/\, 20/1/2
lead0\mathsf{lead}_0lead0​0 / 0 / 00 \,/\, 0 \,/\, 00/0/00 / 0 / 00 \,/\, 0 \,/\, 00/0/0
lead1\mathsf{lead}_1lead1​0 / 2 / 20 \,/\, 2 \,/\, 20/2/20 / 0 / 00 \,/\, 0 \,/\, 00/0/0
leadm+2\mathsf{lead}_{m+2}leadm+2​ (m≥0m\ge0m≥0)0 / 1 / 10 \,/\, 1 \,/\, 10/1/10 / 0 / 00 \,/\, 0 \,/\, 00/0/0

The expected per-step credits are the weight-averages gα,γ(s)=∑oqo⋅(pool credit)g_{\alpha,\gamma}(s) = \sum_o q_o \cdot(\text{pool credit})gα,γ​(s)=∑o​qo​⋅(pool credit) and hα,γ(s)=∑oqo⋅(others credit)h_{\alpha,\gamma}(s) = \sum_o q_o \cdot(\text{others credit})hα,γ​(s)=∑o​qo​⋅(others credit) with the (possibly negative, if α,γ\alpha,\gammaα,γ are out of range) weights qoq_oqo​ above. Explicitly, for all real α,γ\alpha,\gammaα,γ:

g(zero)=0,g(tie)=2α+(1−α)γ,g(lead0)=0,g(lead1)=2(1−α),g(leadm+2)=1−α;h(zero)=1−α,h(tie)=(1−α)(2−γ),h(leadm)=0 for all m.\begin{aligned} &g(\mathsf{zero}) = 0,\quad g(\mathsf{tie}) = 2\alpha + (1-\alpha)\gamma,\quad g(\mathsf{lead}_0) = 0,\quad g(\mathsf{lead}_1) = 2(1-\alpha),\quad g(\mathsf{lead}_{m+2}) = 1-\alpha;\\ &h(\mathsf{zero}) = 1-\alpha,\quad h(\mathsf{tie}) = (1-\alpha)(2-\gamma),\quad h(\mathsf{lead}_m) = 0 \text{ for all } m. \end{aligned}​g(zero)=0,g(tie)=2α+(1−α)γ,g(lead0​)=0,g(lead1​)=2(1−α),g(leadm+2​)=1−α;h(zero)=1−α,h(tie)=(1−α)(2−γ),h(leadm​)=0 for all m.​

Expected credit under a function μ\muμ. For μ:S→R\mu : S \to \mathbb{R}μ:S→R,

Epool(μ)=Σ(s↦μ(s) g(s))=μ(tie)(2α+(1−α)γ)+∑m≥0μ(leadm) g(leadm),E^{\mathrm{pool}}(\mu) = \Sigma\big(s \mapsto \mu(s)\,g(s)\big) = \mu(\mathsf{tie})\big(2\alpha + (1-\alpha)\gamma\big) + \sum_{m\ge0}\mu(\mathsf{lead}_m)\,g(\mathsf{lead}_m),Epool(μ)=Σ(s↦μ(s)g(s))=μ(tie)(2α+(1−α)γ)+m≥0∑​μ(leadm​)g(leadm​),

where the series is set to 000 if not summable, and

Eoth(μ)=Σ(s↦μ(s) h(s))=(1−α) μ(zero)+(1−α)(2−γ) μ(tie)E^{\mathrm{oth}}(\mu) = \Sigma\big(s \mapsto \mu(s)\,h(s)\big) = (1-\alpha)\,\mu(\mathsf{zero}) + (1-\alpha)(2-\gamma)\,\mu(\mathsf{tie})Eoth(μ)=Σ(s↦μ(s)h(s))=(1−α)μ(zero)+(1−α)(2−γ)μ(tie)

(the lead terms of EothE^{\mathrm{oth}}Eoth are all 000).

Time-averaged credits from zero\mathsf{zero}zero. For n∈Nn \in \mathbb{N}n∈N,

An=1n∑k=0n−1Σ(s↦(Dkδzero)(s) g(s)),Bn=1n∑k=0n−1Σ(s↦(Dkδzero)(s) h(s)),A_n = \frac{1}{n}\sum_{k=0}^{n-1}\Sigma\big(s \mapsto (D^k\delta_{\mathsf{zero}})(s)\, g(s)\big), \qquad B_n = \frac{1}{n}\sum_{k=0}^{n-1}\Sigma\big(s \mapsto (D^k\delta_{\mathsf{zero}})(s)\, h(s)\big),An​=n1​k=0∑n−1​Σ(s↦(Dkδzero​)(s)g(s)),Bn​=n1​k=0∑n−1​Σ(s↦(Dkδzero​)(s)h(s)),

with 1/0=01/0 = 01/0=0, so A0=B0=0A_0 = B_0 = 0A0​=B0​=0. Each inner Σ\SigmaΣ uses the "series is 000 if not summable" convention separately for each kkk. Since hhh vanishes on the lead states, Bn=1n∑k<n[(1−α)(Dkδzero)(zero)+(1−α)(2−γ)(Dkδzero)(tie)]B_n = \frac1n\sum_{k<n}\big[(1-\alpha)(D^k\delta_{\mathsf{zero}})(\mathsf{zero}) + (1-\alpha)(2-\gamma)(D^k\delta_{\mathsf{zero}})(\mathsf{tie})\big]Bn​=n1​∑k<n​[(1−α)(Dkδzero​)(zero)+(1−α)(2−γ)(Dkδzero​)(tie)].

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