Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

In a phase a lazy adversary pays at least d′d'd′

Proved
CompetitivePaging.Marking.adversary_cost_ge_d_end

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

k-serveronline-algorithmsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1paging

Let MMM be a set of nnn vertices with the uniform metric, enumerated as e(0),…,e(n−1)e(0), \dots, e(n-1)e(0),…,e(n−1), let 1≤k≤n1 \le k \le n1≤k≤n, and consider the phases of the marking algorithm started from V={e(0),…,e(k−1)}V = \{e(0), \dots, e(k-1)\}V={e(0),…,e(k−1)} on a request sequence σ\sigmaσ. Let SSS be a lazy schedule of kkk servers on σ\sigmaσ (the adversary AAA), and let requests i,…,i′−1i, \dots, i'-1i,…,i′−1 form a complete phase. Let S=mki′\mathcal S = \mathrm{mk}_{i'}S=mki′​ be the set of marked vertices at the end of the phase, let

d′=#{ j:Si′(j)∉S }d' = \#\{\,j : S_{i'}(j) \notin \mathcal S\,\}d′=#{j:Si′​(j)∈/S}

be the number of AAA's servers outside S\mathcal SS at the end of the phase, and let CA=∑t=ii′−1dist(St,St+1)C_A = \sum_{t=i}^{i'-1} \mathrm{dist}(S_t, S_{t+1})CA​=∑t=ii′−1​dist(St​,St+1​) be AAA's cost in the phase. Then

CA≥d′.C_A \ge d'.CA​≥d′.

This is the second lower bound on the adversary's cost in a phase used in the proof of Theorem 1; unlike the first, it uses that the adversary is lazy.

Preamble
import Mathlib
import Definitions.Def_KServer_model
import Definitions.Def_CompetitivePaging_Marking_markingAlgorithm
Formal statement
namespace CompetitivePaging.Marking

/-- §3, proof of Theorem 1 (p. 4): in a complete phase, a lazy adversary `A` pays at least
`d'`, the number of `A`'s servers outside the set `S` of marked vertices at the end of the
phase. -/
theorem adversary_cost_ge_d_end {n k : ℕ} {M : Type*} [MetricSpace M] [DecidableEq M]
    (e : Fin n ≃ M) (hdist : ∀ x y : M, x ≠ y → dist x y = 1) (hk : 1 ≤ k) (hkn : k ≤ n)
    (σ : List M) (S : ℕ → KServer.Config k M) (hlazy : IsLazySchedule σ S) (i i' : ℕ)
    (hphase : IsCompletePhase k (initVertices e hkn) σ i i') :
    ((Finset.univ.filter
        (fun j : Fin k => S i' j ∉ marksAt k (initVertices e hkn) σ i')).card : ℝ)
      ≤ ∑ t ∈ Finset.Ico i i', KServer.moveCost (S t) (S (t + 1)) := by sorry

end CompetitivePaging.Marking
Source
Fiat, Karp, Luby, McGeoch, Sleator, Young, Competitive Paging Algorithms, arXiv:cs/0205038v1, p. 4, §3, proof of Theorem 1
Read-back

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

Setting.

  • MMM is a metric space with decidable equality in which distinct points are at distance exactly 111.
  • e:{0,…,n−1}→Me:\{0,\dots,n-1\}\to Me:{0,…,n−1}→M is a bijection and 1≤k≤n1\le k\le n1≤k≤n.
  • V0={e(0),…,e(k−1)}V_0=\{e(0),\dots,e(k-1)\}V0​={e(0),…,e(k−1)}.
  • σ=(σ0,…,σm−1)\sigma=(\sigma_0,\dots,\sigma_{m-1})σ=(σ0​,…,σm−1​) is a request sequence.
  • S:N→Config(k,M)S:\mathbb N\to\mathrm{Config}(k,M)S:N→Config(k,M) is any lazy schedule on σ\sigmaσ. For j<mj<mj<m: if some server of SjS_jSj​ is on σj\sigma_jσj​ then Sj+1=SjS_{j+1}=S_jSj+1​=Sj​; otherwise Sj+1S_{j+1}Sj+1​ is SjS_jSj​ with one server index reassigned to σj\sigma_jσj​. S0S_0S0​ is unconstrained.
  • (i,i′)(i,i')(i,i′) is a complete phase: i<i′i<i'i<i′ are both phase starts, so i′<mi'<mi′<m, and no index strictly between is one. Here Mk(u)\mathrm{Mk}(u)Mk(u) is the marked set just before request uuu, obtained from V0V_0V0​ by the deterministic rule "insert the request; if exactly k+1k+1k+1 points are marked, keep only the request". Index u<mu<mu<m is a phase start when ∣Mk(u)∪{σu}∣=k+1|\mathrm{Mk}(u)\cup\{\sigma_u\}|=k+1∣Mk(u)∪{σu​}∣=k+1.

Quantity.

d′=∣{ j∈{0,…,k−1}:Si′(j)∉Mk(i′)}∣d'=\big|\{\,j\in\{0,\dots,k-1\}: S_{i'}(j)\notin\mathrm{Mk}(i')\}\big|d′=​{j∈{0,…,k−1}:Si′​(j)∈/Mk(i′)}​

is the number of server indices whose position just before request i′i'i′ lies outside the marked set just before request i′i'i′, i.e. before the reset triggered at i′i'i′. Servers sharing a point are counted separately.

Claim.

d′≤∑t=ii′−1moveCost(St,St+1),d' \le \sum_{t=i}^{i'-1}\mathrm{moveCost}(S_t,S_{t+1}),d′≤t=i∑i′−1​moveCost(St​,St+1​),

where moveCost\mathrm{moveCost}moveCost is imported from the k-server model and not defined here.

Degenerate cases.

  • When k=nk=nk=n, no phase start exists and the statement is vacuous.
  • If d′=0d'=0d′=0, the claim only needs the sum to be at least 000.
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