Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

mmm shuttle algorithms on 2m2m2m vertices whose total cost never exceeds the number of requests

Proved
CompetitivePaging.Combining.exists_shuttle_algorithms

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

competitive-analysisonline-algorithmsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1paging

Let m≥1m\ge1m≥1, let MMM be a set of 2m2m2m vertices with the uniform metric, and number its vertices so that vertex iii and vertex i+mi+mi+m form the iii-th pair, i=1,…,mi=1,\dots,mi=1,…,m. Consider 2m−12m-12m−1 servers. There are deterministic on-line algorithms B(1),…,B(m)B(1),\dots,B(m)B(1),…,B(m) such that

  1. B(i)B(i)B(i) keeps every vertex other than iii and i+mi+mi+m covered at all times, and
  2. at every step of every request sequence the movement costs of B(1),…,B(m)B(1),\dots,B(m)B(1),…,B(m) add up to at most 111: no two of them move a server at the same step, and each moves at most one server; and
  3. consequently, for every request sequence σ\sigmaσ,
∑i=1mCB(i)(σ)≤∣σ∣.\sum_{i=1}^m C_{B(i)}(\sigma)\le|\sigma| .i=1∑m​CB(i)​(σ)≤∣σ∣.

These are the shuttle algorithms of the necessity half of Theorem 6: B(i)B(i)B(i) moves its one free server between iii and i+mi+mi+m, and no two of them ever have to move at the same step.

Formalization Note The pairing is given by a bijection e : Fin m × Fin 2 ≃ M: e (i, 0) and e (i, 1) are the paper's vertices iii and i+mi+mi+m. The number of servers 2m−12m-12m−1 is a natural-number subtraction, which is exact because m≥1m\ge1m≥1.

Preamble
import Mathlib
import Definitions.Def_KServer_model
Formal statement
namespace CompetitivePaging.Combining

/-- Fiat et al. 1991, §6, proof of Theorem 6 (necessity), pp. 9–10. Vertex set `M` of size
`2m`, enumerated by `e : Fin m × Fin 2 ≃ M` (`e (i, 0)` and `e (i, 1)` are the paper's
vertices `i` and `i + m`), with the uniform metric; `2m − 1` servers. There are deterministic
on-line algorithms `B(1), …, B(m)` such that `B(i)` keeps every vertex other than `e (i, 0)`,
`e (i, 1)` covered at all times; at every step of every request sequence the movement costs of
all of them add up to at most `1` (no two of them ever move a server at the same step, and each
moves at most one server); hence on every request sequence `σ` their total cost is at most the
length of `σ`. -/
theorem exists_shuttle_algorithms {m : ℕ} (hm : 0 < m) {M : Type} [MetricSpace M]
    (hM : ∀ x y : M, x ≠ y → dist x y = 1) (e : Fin m × Fin 2 ≃ M) :
    ∃ B : Fin m → KServer.OnlineAlgorithm (2 * m - 1) M,
      (∀ (i : Fin m) (l : List M) (x : M), x ≠ e (i, 0) → x ≠ e (i, 1) →
          ∃ j, (B i).conf l j = x) ∧
      (∀ (σ : List M) (s : ℕ), s < σ.length →
          ∑ i, KServer.moveCost ((B i).conf (σ.take s)) ((B i).conf (σ.take (s + 1))) ≤ 1) ∧
      ∀ σ : List M, ∑ i, (B i).cost σ ≤ (σ.length : ℝ) := by sorry

end CompetitivePaging.Combining
Source
Fiat, Karp, Luby, McGeoch, Sleator, Young, Competitive Paging Algorithms, arXiv:cs/0205038v1, pp. 9–10 (PDF pp. 10–11), §6, proof of Theorem 6 (necessity)
Read-back

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

The setting is:

  • a natural number mmm with m>0m > 0m>0;
  • a type MMM with a metric ddd, in which any two distinct points are at distance exactly 111: d(x,y)=1d(x,y) = 1d(x,y)=1 for x≠yx \ne yx=y;
  • a bijection e:{0,…,m−1}×{0,1}→Me : \{0,\dots,m-1\} \times \{0,1\} \to Me:{0,…,m−1}×{0,1}→M, so MMM has exactly 2m2m2m points. Write ai=e(i,0)a_i = e(i,0)ai​=e(i,0) and bi=e(i,1)b_i = e(i,1)bi​=e(i,1).

The statement uses several notions from an external definitions file (KServer) whose text is not shown here, so this read-back cannot unfold them. By their names alone:

  • "on-line algorithm with kkk servers on MMM";
  • the configuration map confB(ℓ)\mathrm{conf}_B(\ell)confB​(ℓ), which gives a configuration for each finite request list ℓ\ellℓ and assigns a point of MMM to each server index jjj;
  • a movement cost mv(C,C′)\mathrm{mv}(C, C')mv(C,C′) between two configurations;
  • a total cost costB(σ)\mathrm{cost}_B(\sigma)costB​(σ) of an algorithm on a request list σ\sigmaσ.

What these require is whatever the external definitions say. For example, whether an algorithm must place a server on each requested point, and in what sense it is "on-line", cannot be seen from this statement.

Claim: there exist mmm algorithms B0,…,Bm−1B_0, \dots, B_{m-1}B0​,…,Bm−1​, each an on-line algorithm with 2m−12m - 12m−1 servers on MMM, such that all three of the following hold. (With m>0m > 0m>0, 2m−12m-12m−1 is the ordinary value, at least 111.)

  1. Coverage: for every iii, every finite list ℓ\ellℓ of points of MMM (including the empty list), and every point x∈Mx \in Mx∈M with x≠aix \ne a_ix=ai​ and x≠bix \ne b_ix=bi​, some server index jjj has confBi(ℓ)(j)=x\mathrm{conf}_{B_i}(\ell)(j) = xconfBi​​(ℓ)(j)=x.
  2. Per-step movement bound: for every finite list σ=(σ1,…,σn)\sigma = (\sigma_1, \dots, \sigma_n)σ=(σ1​,…,σn​) and every sss with 0≤s<n0 \le s < n0≤s<n,
∑i=0m−1mv(confBi(σ1,…,σs), confBi(σ1,…,σs+1))≤1.\sum_{i=0}^{m-1} \mathrm{mv}\Bigl(\mathrm{conf}_{B_i}(\sigma_1,\dots,\sigma_s),\ \mathrm{conf}_{B_i}(\sigma_1,\dots,\sigma_{s+1})\Bigr) \le 1.i=0∑m−1​mv(confBi​​(σ1​,…,σs​), confBi​​(σ1​,…,σs+1​))≤1.

The statement bounds only this sum. It does not separately say that at most one BiB_iBi​ moves at a step, or that each moves at most one server. Those would follow only if the movement costs are non-negative and suitably quantized, which depends on the unseen definition of mv\mathrm{mv}mv. 3. Total cost bound: for every finite list σ\sigmaσ,

∑i=0m−1costBi(σ)≤∣σ∣,\sum_{i=0}^{m-1} \mathrm{cost}_{B_i}(\sigma) \le |\sigma|,i=0∑m−1​costBi​​(σ)≤∣σ∣,

where ∣σ∣|\sigma|∣σ∣ is the length of σ\sigmaσ, taken as a real number. This is asserted as its own conjunct, not derived from item 2 within the statement.

Degenerate cases.

  • m=0m = 0m=0: excluded by the hypothesis m>0m > 0m>0.
  • m=1m = 1m=1: MMM has exactly two points, a0a_0a0​ and b0b_0b0​, and there is one server. The coverage condition is vacuous, because every point is a0a_0a0​ or b0b_0b0​. The claim then reduces to one algorithm whose per-step movement cost is at most 111 and whose total cost on any σ\sigmaσ is at most ∣σ∣|\sigma|∣σ∣.
  • Empty request list σ\sigmaσ: item 2 is vacuous, and item 3 says the summed costs are at most 000.
  • Empty list ℓ\ellℓ: the coverage condition applies to confBi\mathrm{conf}_{B_i}confBi​​ of the empty list as well, which is presumably the initial configuration.
  • The metric: the hypothesis d(x,y)=1d(x,y) = 1d(x,y)=1 for x≠yx \ne yx=y fixes ddd as the uniform metric, whatever metric structure MMM carries.
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