Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Section 7, lower bound — the coupon-collector expectation nH(n)nH(n)nH(n)

Proved
MetricalTaskSystem.Randomized.coupon_collector_expectation

by mikedeng1 · Sep 26, 2026 · Mathlib 0df444a (Lean v4.33.1)

coupon-collectorp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1probability

Let SSS be a set of n≥1n\ge 1n≥1 states and let ω0,ω1,…\omega_0,\omega_1,\dotsω0​,ω1​,… be independent, each uniformly distributed on SSS. Let YYY be the least kkk such that ω0,…,ωk−1\omega_0,\dots,\omega_{k-1}ω0​,…,ωk−1​ contains every state of SSS (Y=∞Y=\inftyY=∞ if there is none). Then

E(Y)=nH(n)=n(1+12+⋯+1n).E(Y)=nH(n)=n\Big(1+\frac12+\cdots+\frac1n\Big).E(Y)=nH(n)=n(1+21​+⋯+n1​).

In the paper this computes the mean length of a renewal cycle of the off-line strategy, which gives the off-line cost rate 1/(nH(n))1/(nH(n))1/(nH(n)).

Formalization Note YYY is valued in [0,∞][0,\infty][0,∞] and E(Y)E(Y)E(Y) is a lower Lebesgue integral, so no integrability hypothesis is involved. The law of the sequence is Measure.infinitePi of the uniform distribution on SSS.

Preamble
import Mathlib
import Definitions.Def_MetricalTaskSystem_Randomized_Model
import Definitions.Def_MetricalTaskSystem_Randomized_TaskDistribution
Formal statement
namespace MetricalTaskSystem.Randomized

open MeasureTheory

/-- **Section 7, proof of the lower bound, coupon collector** (Borodin–Linial–Saks 1992,
p. 760). For a sequence of independent states, each uniform on the `n`-element set `S`, the
expected number of states until every state has appeared is `n·H(n)`. -/
theorem coupon_collector_expectation {S : Type} [Fintype S] [Nonempty S]
    [MeasurableSpace S] [MeasurableSingletonClass S] :
    ∫⁻ ω, collectTime ω ∂(uniformStateSeq S) =
      ENNReal.ofReal ((Fintype.card S : ℝ) * (harmonic (Fintype.card S) : ℝ)) := by sorry

end MetricalTaskSystem.Randomized
Source
Borodin, Linial, Saks, An Optimal On-Line Algorithm for Metrical Task System, J. ACM 39(4) (1992), p. 760, Section 7, proof of Theorem 7.1 (lower bound), computation of Exp(Y_k)
Read-back

What the Lean code literally says, in plain math · claude-opus-5-5

Setting. SSS is a finite, nonempty type with n=∣S∣≥1n = |S| \ge 1n=∣S∣≥1. Its σ-algebra has measurable singletons. Let ω0,ω1,…\omega_0,\omega_1,\dotsω0​,ω1​,… be independent, each uniformly distributed on SSS (the infinite product of the uniform distribution). Let τ(ω)∈[0,∞]\tau(\omega) \in [0,\infty]τ(ω)∈[0,∞] be the least kkk such that every state of SSS appears among ω0,…,ωk−1\omega_0,\dots,\omega_{k-1}ω0​,…,ωk−1​, with τ(ω)=+∞\tau(\omega) = +\inftyτ(ω)=+∞ if some state never appears.

Conclusion. The Lebesgue integral of τ\tauτ in [0,∞][0,\infty][0,∞] equals

∫τ dP  =  n H(n),H(n)=1+12+⋯+1n.\int \tau \, d\mathbb{P} \;=\; n\,H(n), \qquad H(n) = 1 + \tfrac12 + \dots + \tfrac1n.∫τdP=nH(n),H(n)=1+21​+⋯+n1​.

The right-hand side is a nonnegative real, so the claim also asserts that this expectation is finite.

Degenerate cases.

  • n=1n = 1n=1: τ≡1\tau \equiv 1τ≡1, since k=0k = 0k=0 fails because SSS is nonempty and k=1k = 1k=1 succeeds. The claim is 1=1⋅11 = 1 \cdot 11=1⋅1.
  • Empty SSS: excluded by the hypotheses.
  • Where τ=+∞\tau = +\inftyτ=+∞: this set is included in the integral, and it contributes 000 exactly when it has probability zero.
Human review
  • Endorsed by Shuze Chen · Sep 27, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Sep 27, 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