Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 7.1 — H(n)≤wˉ(S,d)≤2H(n)H(n)\le\bar w(S,d)\le 2H(n)H(n)≤wˉ(S,d)≤2H(n) for the uniform task system

Proved
MetricalTaskSystem.Randomized.uniform_randomizedRatio_bounds

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

competitive-analysisonline-algorithmsp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1randomized-algorithms

Let (S,d)(S,d)(S,d) be the uniform task system on nnn states: every transition between distinct states costs 111. Let H(n)=1+12+⋯+1nH(n)=1+\frac12+\cdots+\frac1nH(n)=1+21​+⋯+n1​ and let wˉ(S,d)\bar w(S,d)wˉ(S,d) be the randomized competitive ratio (against an oblivious adversary). Then

H(n)≤wˉ(S,d)≤2H(n).H(n)\le\bar w(S,d)\le 2H(n).H(n)≤wˉ(S,d)≤2H(n).

Randomization thus lowers the competitive ratio of the uniform task system from 2n−12n-12n−1 (the deterministic value) to Θ(log⁡n)\Theta(\log n)Θ(logn), determined up to a factor of 222.

Formalization Note wˉ(S,d)\bar w(S,d)wˉ(S,d) is the real infimum of the set of all www for which some randomized on-line algorithm is expected www-competitive. The lower half forces this set to be nonempty (otherwise the infimum would be 0<H(n)0<H(n)0<H(n)), so the conjunction is not vacuous. Tasks are finite and nonnegative; the paper also allows +∞+\infty+∞ entries. At n=1n=1n=1 the statement reads 1≤wˉ≤21\le\bar w\le 21≤wˉ≤2.

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

/-- **Theorem 7.1** (Borodin–Linial–Saks 1992, p. 759). If `(S, d)` is the uniform task system on
`n = |S|` states, then `H(n) ≤ w̄(S, d) ≤ 2H(n)`, where `H(n) = 1 + 1/2 + ⋯ + 1/n` and `w̄` is the
randomized competitive ratio. -/
theorem uniform_randomizedRatio_bounds {S : Type} [Fintype S] [DecidableEq S] [Nonempty S] :
    (harmonic (Fintype.card S) : ℝ) ≤ randomizedRatio (uniformD (S := S)) ∧
      randomizedRatio (uniformD (S := S)) ≤ 2 * (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. 759, Theorem 7.1
Read-back

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

Let SSS be any finite, nonempty type with decidable equality, and let n=∣S∣≥1n = |S| \ge 1n=∣S∣≥1 be its number of elements. The type SSS lives in the lowest universe (Type) and is otherwise arbitrary. The statement uses three named objects:

  • H(n)H(n)H(n) is Mathlib's harmonic number, a rational number cast to a real:
H(n)=∑i=1n1i.H(n) = \sum_{i=1}^{n} \frac{1}{i}.H(n)=i=1∑n​i1​.
  • dSd_SdS​ is uniformD for the type SSS. It comes from the imported bundle (Def_MetricalTaskSystem_Randomized_Model / Def_MetricalTaskSystem_Randomized_RandomizedAlgorithm), and its code is not shown here. From its name and use, it is some distance-like structure on SSS that plays the role of the "uniform" metric. Its exact form (for example, whether dS(s,t)=1d_S(s,t) = 1dS​(s,t)=1 for s≠ts \ne ts=t and 000 otherwise) cannot be confirmed from this declaration.
  • wˉ(dS)\bar w(d_S)wˉ(dS​) is randomizedRatio applied to dSd_SdS​. It also comes from the imported bundle, its definition is not shown here, and it is a real number. Whatever the definition does to express an unbounded or unattained ratio (an infimum, a supremum, or a default value) is not visible here. The theorem makes claims only about the real number that definition returns.

The theorem asserts that both of the following inequalities hold, with no further hypotheses:

H(n)  ≤  wˉ(dS)andwˉ(dS)  ≤  2 H(n).H(n) \;\le\; \bar w(d_S) \qquad\text{and}\qquad \bar w(d_S) \;\le\; 2\,H(n).H(n)≤wˉ(dS​)andwˉ(dS​)≤2H(n).

Both are non-strict (≤\le≤). The only information about SSS that appears is its cardinality nnn, apart from anything dSd_SdS​ or wˉ\bar wwˉ depend on internally. The theorem's doc-comment describes this as Theorem 7.1 of Borodin–Linial–Saks (1992), with wˉ\bar wwˉ as "the randomized competitive ratio" of the uniform task system. That comment is not part of the formal claim.

Degenerate cases:

  • Empty SSS: The nonemptiness assumption excludes it, so n=0n = 0n=0 and H(0)=0H(0) = 0H(0)=0 never arise.
  • One-element SSS: Here n=1n = 1n=1 and H(1)=1H(1) = 1H(1)=1, so the statement asserts 1≤wˉ(dS)≤21 \le \bar w(d_S) \le 21≤wˉ(dS​)≤2. It asserts this even though a one-state system has no moves between distinct states. The inequalities hold only if the unseen definition of randomizedRatio returns a value in [1,2][1, 2][1,2] in that case.
  • Default values: If randomizedRatio is defined as an infimum or supremum of a set of reals, Lean returns 000 for an empty set or a set unbounded in the relevant direction. In that situation, the theorem would assert H(n)≤0H(n) \le 0H(n)≤0, which is false for all n≥1n \ge 1n≥1. So whether the statement is true depends entirely on the imported definitions, which are not shown.
  • Division: No division, natural-number subtraction or integral appears in the statement itself. The only arithmetic is the finite harmonic sum and multiplication by 222.
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