Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

In a phase the adversary pays at least l−dl - dl−d

Proved
CompetitivePaging.Marking.adversary_cost_ge_clean_sub_d

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 (distinct vertices at distance 111), 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; its starting configuration is arbitrary), and let requests i,…,i′−1i, \dots, i'-1i,…,i′−1 form a complete phase. Write mki\mathrm{mk}_imki​ for the marked set just before the phase (the vertices occupied by the marking algorithm's servers at the start of the phase) and R(i,i′)R(i,i')R(i,i′) for the set of vertices requested in the phase. Put

  1. l=∣R(i,i′)∖mki∣l = |R(i,i') \setminus \mathrm{mk}_i|l=∣R(i,i′)∖mki​∣, the number of requests to clean vertices in the phase;
  2. ddd = the number of servers jjj of AAA with Si(j)∉mkiS_i(j) \notin \mathrm{mk}_iSi​(j)∈/mki​, i.e. the number of AAA's servers that do not coincide with any of the marking algorithm's servers at the beginning of the phase;
  3. 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​), the cost incurred by AAA in the phase.

Then

CA≥l−d.C_A \ge l - d.CA​≥l−d.

This is the first of the two lower bounds on the adversary's cost in a phase used in the proof of Theorem 1.

Formalization Note. The marking algorithm's servers at the start of a phase are identified with the (deterministic) marked set there; the preceding milestone shows that the two coincide with probability one. For the first phase the "previous phase" is the initial configuration VVV.

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
`l - d`, where `l` is the number of clean vertices requested in the phase and `d` is the
number of `A`'s servers outside the marking algorithm's servers (= the marked set) at the
start of the phase. -/
theorem adversary_cost_ge_clean_sub_d {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') :
    ((phaseRequested σ i i' \ marksAt k (initVertices e hkn) σ i).card : ℝ)
        - ((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 any two 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σ, with SjS_jSj​ read as the configuration just before request jjj. For each j<mj<mj<m: if some server is on σj\sigma_jσj​ nothing changes; otherwise exactly one server index is reassigned to σj\sigma_jσj​. S0S_0S0​ is arbitrary.
  • (i,i′)(i, i')(i,i′) is a complete phase for the mark process started from V0V_0V0​: i<i′i < i'i<i′ are both phase starts, so i′<mi' < mi′<m, and no index strictly between them is one. An index uuu is a phase start if ∣Mk(u)∪{σu}∣=k+1|\mathrm{Mk}(u)\cup\{\sigma_u\}| = k+1∣Mk(u)∪{σu​}∣=k+1, where Mk(u)\mathrm{Mk}(u)Mk(u) is the marked set just before request uuu (the deterministic mark update applied to σ0,…,σu−1\sigma_0,\dots,\sigma_{u-1}σ0​,…,σu−1​ starting from V0V_0V0​).

Quantities.

  • ℓ=∣{σi,…,σi′−1}∖Mk(i)∣\ell = \big|\{\sigma_i,\dots,\sigma_{i'-1}\}\setminus \mathrm{Mk}(i)\big|ℓ=​{σi​,…,σi′−1​}∖Mk(i)​ is the number of distinct points requested at indices i,…,i′−1i,\dots,i'-1i,…,i′−1 that were not marked just before request iii. Note that Mk(i)\mathrm{Mk}(i)Mk(i) is taken before the reset triggered at iii.
  • 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)}​ counts server indices, not points. Several servers on the same point are counted separately.

Claim. In real arithmetic,

ℓ−d  ≤  ∑t=ii′−1moveCost(St,St+1),\ell - 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 comes from the imported k-server model and its definition is not shown here.

Degenerate cases.

  • ℓ−d\ell - dℓ−d may be negative, and then the claim only asks the sum to exceed a negative number.
  • When k=nk = nk=n, there are no phase starts and the statement is vacuous.
  • The schedule is not required to start at any particular configuration.
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