What the Lean code literally says, in plain math · claude-fable-5-1 (independent sub-agent, blind: Lean code + auditor instructions only)
Read-back: Thm_BitcoinSelfishUnique_stationary_isStationary.lean
Theorem BitcoinSelfishUnique.stationary_isStationary. For every real number α and every real number γ, under the hypotheses
- h0:0<α (strict),
- h1:α<1/2 (strict; 1/2 is the real number one half),
the specific function σα (the definition stationary α, unfolded in the last block below; it does not depend on γ) satisfies IsStationaryα,γ(σα). There is no hypothesis on γ: it is an arbitrary real number (possibly negative or larger than 1), and it enters only through the kernel Pα,γ in the invariant condition. Unfolding, the theorem asserts the conjunction of the following four statements, with D(α)=2α3−4α2+1, q:=α/(1−α) and c:=(α−2α2)/D(α) (real division, with x/0=0; the statement contains no separate hypothesis that D(α)=0 or 1−α=0, though h1 gives 1−α=0):
- nonneg: 0≤D(α)1−2α, 0≤D(α)(1−α)(α−2α2), and 0≤qnc for every n≥0 (non-strict inequalities).
- summable: the family (qnc)n∈N is summable in R.
- mass: D(α)1−2α+D(α)(1−α)(α−2α2)+∑n=0∞′qnc=1, where the tail is Mathlib's
tsum (the genuine sum when the family is summable, 0 otherwise).
- invariant: for every state s, σα(s)=σα(0)Pα,γ(0,s)+σα(0′)Pα,γ(0′,s)+∑n′σα(ℓn)Pα,γ(ℓn,s); by the kernel table below this is exactly the five families of equations, with h=(1−α)γ+(1−α)(1−γ):
- D(α)1−2α=h⋅D(α)1−2α+(α+h)⋅D(α)(1−α)(α−2α2)+h⋅qc;
- D(α)(1−α)(α−2α2)=h⋅c;
- c=α⋅D(α)1−2α;
- qc=αc+hq2c;
- for every m≥0: qm+2c=αqm+1c+hqm+3c.
The theorem is an existence-type claim about one explicit function; it does not say that σα is the only function with these properties.
Setting and unfolded definitions (as they are actually defined in the bundle)
Throughout, α and γ are real numbers. Unless a hypothesis is listed explicitly for the declaration below, nothing restricts them: they need not lie in [0,1], so the "probabilities" below are simply real numbers that may be negative or exceed 1.
States. The state type has exactly these elements: a state 0 (the constructor zero), a state 0′ (the constructor tie), and, for every natural number n=0,1,2,…, a state ℓn (the constructor lead n). The documentation in the definition file says that ℓn encodes a private lead of n+1 blocks, so ℓ0 is "lead 1", ℓ1 is "lead 2", and ℓn+2 is "lead n+3"; the code itself only ever works with the index n.
Outcomes and their weights. There are exactly three outcomes, pool, hP (honest miner on the pool's branch) and hO (honest miner on the honest branch), with real weights
wα,γ(pool)=α,wα,γ(hP)=(1−α)γ,wα,γ(hO)=(1−α)(1−γ).
Write h(α,γ):=(1−α)γ+(1−α)(1−γ) for the sum of the two honest weights. As a polynomial identity, valid for all real α,γ, one has h(α,γ)=1−α and α+h(α,γ)=1; the definitions, however, are written with the unsimplified expressions.
One-step map. The function step(s,o) sends a state and an outcome to a state:
- step(0,pool)=ℓ0; step(0,hP)=step(0,hO)=0;
- step(0′,o)=0 for each of the three outcomes o;
- step(ℓ0,pool)=ℓ1; step(ℓ0,hP)=step(ℓ0,hO)=0′;
- step(ℓ1,pool)=ℓ2; step(ℓ1,hP)=step(ℓ1,hO)=0;
- for every n≥0: step(ℓn+2,pool)=ℓn+3; step(ℓn+2,hP)=step(ℓn+2,hO)=ℓn+1.
Transition kernel. For states s,t,
Pα,γ(s,t):=o∈{pool,hP,hO}∑[step(s,o)=t]wα,γ(o),
where [⋅] is 1 if the equality holds and 0 otherwise (the three-term sum is taken in the order pool, hP, hO). Reading off the step map, the only entries that are not literally a sum of three zeros are:
| from s | to t | Pα,γ(s,t) |
|---|
| 0 | ℓ0 | α |
| 0 | 0 | h(α,γ) |
| 0′ | 0 | α+h(α,γ) |
| ℓ0 | ℓ1 | α |
| ℓ0 | 0′ | h(α,γ) |
| ℓ1 | ℓ2 | α |
| ℓ1 | 0 | h(α,γ) |
| ℓn+2 (n≥0) | ℓn+3 | α |
| ℓn+2 (n≥0) | ℓn+1 | h(α,γ) |
Every other pair (s,t) has Pα,γ(s,t)=0.
Sums over all states. For a real-valued function f on states,
stateSum(f):=f(0)+f(0′)+n=0∑∞′f(ℓn),
where ∑′ is Mathlib's tsum: if the family (f(ℓn))n∈N is summable (unconditionally summable in R, which for real numbers is the same as absolute convergence), it is the ordinary infinite sum; if the family is not summable, the tail is defined to be 0. A family with only finitely many nonzero terms is summable and its tsum is the finite sum of those terms.
The predicate "IsStationary". For real α,γ and a function π from states to R, IsStationaryα,γ(π) is the conjunction of the following four conditions (it is a structure with four fields; being given it as a hypothesis means all four are available, and the statement of a theorem does not say which of them its proof uses):
- nonneg: for every state s, 0≤π(s).
- summable: the family (π(ℓn))n∈N is summable in R.
- mass: stateSum(π)=1, i.e. π(0)+π(0′)+∑n′π(ℓn)=1. (Because of condition 2 the tail here is the genuine infinite sum, not the 0 fallback.)
- invariant: for every state s,
π(s)=stateSum(t↦π(t)Pα,γ(t,s))=π(0)Pα,γ(0,s)+π(0′)Pα,γ(0′,s)+n=0∑∞′π(ℓn)Pα,γ(ℓn,s).
By the table above, for each fixed target s the family n↦π(ℓn)Pα,γ(ℓn,s) has at most one nonzero term, so this tail is always a genuine (finite) sum. Unfolding the table, condition 4 says exactly the following five families of equations, where h=h(α,γ)=(1−α)γ+(1−α)(1−γ):
- at s=0: π(0)=hπ(0)+(α+h)π(0′)+hπ(ℓ1);
- at s=0′: π(0′)=hπ(ℓ0);
- at s=ℓ0: π(ℓ0)=απ(0);
- at s=ℓ1: π(ℓ1)=απ(ℓ0)+hπ(ℓ2);
- at s=ℓm+2 for every m≥0: π(ℓm+2)=απ(ℓm+1)+hπ(ℓm+3).
Note that the invariant condition does not mention γ except through h(α,γ) and α+h(α,γ), which simplify to 1−α and 1 for every real γ.
The candidate distribution "stationary". Let D(α):=2α3−4α2+1 (the definition denom). The function σα (the definition stationary α) from states to R is
σα(0)=D(α)1−2α,σα(0′)=D(α)(1−α)(α−2α2),σα(ℓn)=(1−αα)n⋅D(α)α−2α2(n≥0).
Here / is real division with the convention x/0=0: if D(α)=0 then all three values are 0, and if α=1 then α/(1−α)=0. The exponent n is a natural number, so (α/(1−α))0=1 (even when the base is 0). The function σα does not depend on γ.
Confirmed by the moderator at approval.