Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 1.1 — every nnn-state metrical task system has competitive ratio w(S,d)=2n−1w(S,d)=2n-1w(S,d)=2n−1

Proved
MetricalTaskSystem.Deterministic.competitiveRatio_eq

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

competitive-analysismetrical-task-systemsonline-algorithmsp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let (S,d)(S,d)(S,d) be a metrical task system with n≥1n\ge1n≥1 states: d(i,i)=0d(i,i)=0d(i,i)=0, d(i,j)=d(j,i)>0d(i,j)=d(j,i)>0d(i,j)=d(j,i)>0 for i≠ji\neq ji=j, and ddd satisfies the triangle inequality. Then its competitive ratio, the infimum over all deterministic on-line algorithms AAA of the infimum of all www for which AAA is www-competitive, equals

w(S,d)=2n−1.w(S,d)=2n-1 .w(S,d)=2n−1.

In particular the optimal competitive ratio depends only on the number of states, not on the distances.

Formalization Note Tasks are finite and nonnegative (the paper also allows +∞+\infty+∞ entries; these are excluded, which affects neither bound). The competitive ratio is the real infimum of all www for which some on-line algorithm is www-competitive; since the right-hand side is at least 111, the statement also asserts that some algorithm is competitive. At n=1n=1n=1 the statement is the true claim w(S,d)=1w(S,d)=1w(S,d)=1.

Preamble
import Mathlib
import Definitions.Def_MetricalTaskSystem_Deterministic_Model
Formal statement
namespace MetricalTaskSystem.Deterministic

/-- **Theorem 1.1** (Borodin–Linial–Saks 1992, p. 747). For any metrical task system `(S, d)`
with `n` states, the competitive ratio is `w(S, d) = 2n − 1`. -/
theorem competitiveRatio_eq {S : Type} [Fintype S] [DecidableEq S] [Nonempty S]
    (d : S → S → ℝ) (hd : IsMetrical d) :
    competitiveRatio d = 2 * (Fintype.card S : ℝ) - 1 := by sorry

end MetricalTaskSystem.Deterministic
Source
Borodin, Linial, Saks, An Optimal On-Line Algorithm for Metrical Task System, J. ACM 39(4) (1992), p. 747, Theorem 1.1
Read-back

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

The statement concerns an arbitrary finite, nonempty type SSS with decidable equality, which we think of as a set of states. It also takes a real-valued function of two states

d:S×S→R,d : S \times S \to \mathbb{R},d:S×S→R,

and a hypothesis IsMetrical(d)\mathrm{IsMetrical}(d)IsMetrical(d). That hypothesis is a predicate from the imported bundle (Definitions.Def_MetricalTaskSystem_Deterministic_Model), whose source was not provided to this auditor. Its exact content is therefore unknown here. In particular, it cannot be confirmed whether it requires any of the following:

  • nonnegativity,
  • d(s,s)=0d(s,s)=0d(s,s)=0,
  • d(s,t)>0d(s,t)>0d(s,t)>0 for s≠ts\ne ts=t,
  • symmetry,
  • the triangle inequality,

or something weaker or different.

Under these assumptions the statement asserts the equality of real numbers

competitiveRatio(d)  =  2 ∣S∣−1,\mathrm{competitiveRatio}(d) \;=\; 2\,|S| - 1,competitiveRatio(d)=2∣S∣−1,

where ∣S∣|S|∣S∣ is the number of elements of SSS, cast to a real number. Here competitiveRatio(d)\mathrm{competitiveRatio}(d)competitiveRatio(d) is a real-valued quantity defined in the same imported bundle, whose definition was also not provided. The auditor therefore cannot say:

  • over what class of algorithms or task sequences it ranges;
  • whether it is an infimum, a supremum, or a minimum;
  • whether it restricts to deterministic online algorithms;
  • how it handles additive constants in the competitiveness inequality;
  • what default value it takes if the underlying set is empty or unbounded.

The only facts about it visible from the statement are these. It depends only on ddd (and implicitly on the type SSS). It returns a real number, not an extended real, so an unbounded or empty optimisation set would have to be mapped to some finite junk value by its definition.

The right-hand side is computed in R\mathbb{R}R, so no natural-number truncation occurs.

Degenerate cases:

  • Empty SSS. This is excluded by the nonemptiness assumption.
  • One-element SSS. The claim reads competitiveRatio(d)=2⋅1−1=1\mathrm{competitiveRatio}(d) = 2\cdot 1 - 1 = 1competitiveRatio(d)=2⋅1−1=1.
  • Satisfiability of the hypothesis. Whether IsMetrical(d)\mathrm{IsMetrical}(d)IsMetrical(d) can be satisfied, possibly vacuously or only by degenerate ddd such as the zero function, depends on its unseen definition.
  • Uniformity in ddd. Because the right-hand side does not involve ddd at all, the statement claims the same value for every ddd satisfying IsMetrical\mathrm{IsMetrical}IsMetrical on a given SSS. This includes d≡0d \equiv 0d≡0 if that function satisfies the predicate.
  • Junk values. If competitiveRatio\mathrm{competitiveRatio}competitiveRatio is defined as an infimum or supremum of a real set, Lean's convention returns 000 for an empty or unbounded set. In that case the statement would assert 0=2∣S∣−10 = 2|S|-10=2∣S∣−1 in any such case. That is impossible for ∣S∣≥1|S| \ge 1∣S∣≥1, so the theorem would implicitly assert that no such degenerate case arises under IsMetrical(d)\mathrm{IsMetrical}(d)IsMetrical(d).
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