Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

In a phase the adversary pays at least max⁡(l−d,d′)≥12(l−d+d′)\max(l-d, d') \ge \frac12(l-d+d')max(l−d,d′)≥21​(l−d+d′)

Proved
CompetitivePaging.Marking.adversary_phase_cost_ge_half

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

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

In the setting of the two preceding milestones (uniform metric on nnn vertices, 1≤k≤n1 \le k \le n1≤k≤n, a lazy adversary schedule SSS and a complete phase i,…,i′−1i, \dots, i'-1i,…,i′−1 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)}), let lll be the number of clean vertices requested in the phase, ddd the number of AAA's servers outside the marking algorithm's servers at the start of the phase, d′d'd′ the same quantity at the end of the phase, and CAC_ACA​ the adversary's cost in the phase. Then

CA≥max⁡(l−d, d′)≥12 (l−d+d′).C_A \ge \max(l - d,\ d') \ge \tfrac12\,(l - d + d').CA​≥max(l−d, d′)≥21​(l−d+d′).

Summed over the phases, the ddd and d′d'd′ terms telescope, so up to an additive constant the adversary's cost is at least half the total number of clean requests; this is the adversary side of the comparison in Theorem 1.

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's cost `C_A`
satisfies `C_A ≥ max(l - d, d') ≥ (l - d + d')/2`. -/
theorem adversary_phase_cost_ge_half {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') :
    max (((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 : ℝ))
        ((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)) ∧
      (((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 : ℝ)
          + ((Finset.univ.filter
              (fun j : Fin k => S i' j ∉ marksAt k (initVertices e hkn) σ i')).card : ℝ)) / 2
        ≤ max (((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 : ℝ))
        ((Finset.univ.filter
          (fun j : Fin k => S i' j ∉ marksAt k (initVertices e hkn) σ i')).card : ℝ) := 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 (displayed inequality)
Read-back

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

Setting. The hypotheses are the same as in the previous two statements:

  • 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σ, with S0S_0S0​ unconstrained.
  • (i,i′)(i,i')(i,i′) is a complete phase for the deterministic mark process started from V0V_0V0​. Mk(u)\mathrm{Mk}(u)Mk(u) is the marked set just before request uuu, and u<mu<mu<m is a phase start iff ∣Mk(u)∪{σu}∣=k+1|\mathrm{Mk}(u)\cup\{\sigma_u\}|=k+1∣Mk(u)∪{σu​}∣=k+1. The phase condition means i<i′i<i'i<i′ are phase starts, so i′<mi'<mi′<m, with none strictly between.

Quantities.

  • ℓ=∣{σi,…,σi′−1}∖Mk(i)∣\ell=|\{\sigma_i,\dots,\sigma_{i'-1}\}\setminus\mathrm{Mk}(i)|ℓ=∣{σi​,…,σi′−1​}∖Mk(i)∣.
  • d=∣{j<k:Si(j)∉Mk(i)}∣d=|\{j<k: S_i(j)\notin\mathrm{Mk}(i)\}|d=∣{j<k:Si​(j)∈/Mk(i)}∣.
  • d′=∣{j<k:Si′(j)∉Mk(i′)}∣d'=|\{j<k: S_{i'}(j)\notin\mathrm{Mk}(i')\}|d′=∣{j<k:Si′​(j)∈/Mk(i′)}∣.
  • CA=∑t=ii′−1moveCost(St,St+1)C_A=\sum_{t=i}^{i'-1}\mathrm{moveCost}(S_t,S_{t+1})CA​=∑t=ii′−1​moveCost(St​,St+1​), with moveCost\mathrm{moveCost}moveCost imported and not defined here.

Claim. Both of the following hold, in real arithmetic:

max⁡(ℓ−d, d′)≤CAandℓ−d+d′2≤max⁡(ℓ−d, d′).\max(\ell-d,\ d')\le C_A \qquad\text{and}\qquad \frac{\ell-d+d'}{2}\le\max(\ell-d,\ d').max(ℓ−d, d′)≤CA​and2ℓ−d+d′​≤max(ℓ−d, d′).

The second inequality holds for any real numbers and does not depend on the hypotheses.

Degenerate cases.

  • ℓ−d\ell-dℓ−d may be negative.
  • When k=nk=nk=n, no phase start exists and the whole statement is vacuous.
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