Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 3 — Algorithm EATR is 3/23/23/2-competitive for the uniform 2-server problem

Proved
CompetitivePaging.EATR.eatr_competitive

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

competitive-analysisk-serverp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1pagingrandomized-algorithms

Let MMM be a set of n≥2n\ge 2n≥2 vertices, enumerated as e(0),…,e(n−1)e(0),\dots,e(n-1)e(0),…,e(n−1), carrying the uniform metric: any two distinct vertices are at distance 111. Run algorithm EATR with its two servers initially on the vertices e(0)e(0)e(0) and e(1)e(1)e(1) (the paper's vertices 111 and 222), and let CEATR(σ)C_{\mathrm{EATR}}(\sigma)CEATR​(σ) be its expected cost on a request sequence σ\sigmaσ. Let OPT(σ)\mathrm{OPT}(\sigma)OPT(σ) be the optimal off-line cost of serving σ\sigmaσ with two servers starting on e(0)e(0)e(0) and e(1)e(1)e(1). Then there is a constant ccc such that for every request sequence σ\sigmaσ,

CEATR(σ) ≤ 32 OPT(σ)+c.C_{\mathrm{EATR}}(\sigma)\ \le\ \frac32\,\mathrm{OPT}(\sigma)+c.CEATR​(σ) ≤ 23​OPT(σ)+c.

Since every deterministic algorithm BBB, on-line or off-line, pays at least OPT(σ)\mathrm{OPT}(\sigma)OPT(σ) on σ\sigmaσ (up to a constant for another starting position), this is the paper's statement that EATR is 3/23/23/2-competitive. As 3/2=H2=1+123/2=H_2=1+\tfrac123/2=H2​=1+21​, the second harmonic number, and the paper shows that no randomized paging algorithm is better than HkH_kHk​-competitive, EATR is strongly competitive for two servers.

Formalization Note OPT\mathrm{OPT}OPT is KServer.offlineCost from the published KServer model, the infimum of the movement cost over all schedules that serve σ\sigmaσ from the configuration (e(0),e(1))(e(0),e(1))(e(0),e(1)). The constant ccc is quantified before σ\sigmaσ. The uniform metric is a hypothesis on an abstract metric space, not the metric of Fin n.

Preamble
import Mathlib
import Definitions.Def_KServer_model
import Definitions.Def_CompetitivePaging_EATR_eatr

open scoped ENNReal
Formal statement
namespace CompetitivePaging.EATR

theorem eatr_competitive {n : ℕ} {M : Type*} [MetricSpace M] [DecidableEq M]
    (e : Fin n ≃ M) (hn : 2 ≤ n) (hunif : ∀ x y : M, x ≠ y → dist x y = 1) :
    ∃ c : ℝ, ∀ σ : List M,
      eatrExpCost (e ⟨0, by omega⟩) (e ⟨1, hn⟩) σ
        ≤ (3 / 2 : ℝ) * KServer.offlineCost ![e ⟨0, by omega⟩, e ⟨1, hn⟩] σ + c := by sorry

end CompetitivePaging.EATR
Source
Fiat, Karp, Luby, McGeoch, Sleator, Young, Competitive Paging Algorithms, arXiv:cs/0205038v1, p. 6, Theorem 3 (definition of c-competitive: p. 1)
Read-back

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

Let nnn be a natural number and MMM a type carrying a metric ddd (a genuine metric space structure) and decidable equality. The statement assumes the following:

  • e:{0,1,…,n−1}→Me : \{0, 1, \dots, n-1\} \to Me:{0,1,…,n−1}→M is a bijection, so MMM has exactly nnn points, labelled e(0),…,e(n−1)e(0), \dots, e(n-1)e(0),…,e(n−1).
  • n≥2n \ge 2n≥2.
  • Uniform metric: for all x,y∈Mx, y \in Mx,y∈M with x≠yx \neq yx=y, d(x,y)=1d(x, y) = 1d(x,y)=1. Since d(x,x)=0d(x,x) = 0d(x,x)=0 in any metric space, ddd is the discrete {0,1}\{0,1\}{0,1} metric on MMM.

Write p0=e(0)p_0 = e(0)p0​=e(0) and p1=e(1)p_1 = e(1)p1​=e(1). Because eee is injective, these are two distinct points of MMM, at distance 111 from each other.

The conclusion is that there is a single real constant ccc such that, for every finite sequence σ=(σ1,…,σm)\sigma = (\sigma_1, \dots, \sigma_m)σ=(σ1​,…,σm​) of points of MMM (any length m≥0m \ge 0m≥0, repetitions allowed):

eatrExpCost(p0,p1,σ)  ≤  32 OPT(s,σ)+c.\mathrm{eatrExpCost}(p_0, p_1, \sigma) \;\le\; \frac{3}{2}\,\mathrm{OPT}(\mathbf{s}, \sigma) + c .eatrExpCost(p0​,p1​,σ)≤23​OPT(s,σ)+c.

The two cost terms are:

  • eatrExpCost(p0,p1,σ)\mathrm{eatrExpCost}(p_0, p_1, \sigma)eatrExpCost(p0​,p1​,σ) is a real-valued quantity from the imported definition eatrExpCost in the namespace CompetitivePaging.EATR. It is applied to the two starting points p0p_0p0​ and p1p_1p1​ and the request sequence σ\sigmaσ. That definition's body is not part of this declaration, so this read-back cannot say what it computes. The name alone does not establish that it is an expected cost or the cost of any particular algorithm.
  • OPT(s,σ)\mathrm{OPT}(\mathbf{s}, \sigma)OPT(s,σ) is the imported KServer.offlineCost, also not shown here. It is applied to the two-entry configuration s=(s0,s1)\mathbf{s} = (s_0, s_1)s=(s0​,s1​) with s0=p0s_0 = p_0s0​=p0​ and s1=p1s_1 = p_1s1​=p1​, and to the same sequence σ\sigmaσ.

The factor on the right is exactly 3/23/23/2, and the inequality is non-strict (≤\le≤).

The constant ccc is chosen once, after nnn, MMM, the metric, the decidable-equality instance and eee are fixed, and before σ\sigmaσ. So it may depend on all of those but not on σ\sigmaσ. Nothing constrains ccc further: it is not required to be non-negative, and it may be arbitrarily large. The opened notation for extended non-negative reals is not used in the statement.

Degenerate cases:

  • Small MMM: n=0n = 0n=0 and n=1n = 1n=1 are excluded by the hypothesis n≥2n \ge 2n≥2, so MMM always has at least two points. When n=2n = 2n=2, M={p0,p1}M = \{p_0, p_1\}M={p0​,p1​}, so every request in σ\sigmaσ is one of the two starting points.
  • Empty σ\sigmaσ: for the empty sequence, the claim is only eatrExpCost(p0,p1,∅)≤32 OPT(s,∅)+c\mathrm{eatrExpCost}(p_0,p_1,\varnothing) \le \tfrac32\,\mathrm{OPT}(\mathbf{s},\varnothing) + ceatrExpCost(p0​,p1​,∅)≤23​OPT(s,∅)+c. For any single fixed σ\sigmaσ, some large enough ccc would satisfy the inequality. The statement has content only because one ccc must work for all sequences at once, of unbounded length.
  • Hypotheses are satisfiable: for every n≥2n \ge 2n≥2, the discrete metric on an nnn-point set meets all of them, so the statement is not vacuous.
  • Totality and junk values: whether either cost can take a default value from a total function (for example division by zero, or an infinite quantity collapsed to a real number) depends on the imported definitions, which are not visible here. The statement asserts nothing about them beyond the inequality above.
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