Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Before the terminating request there are l+1l+1l+1 stale vertices, each covered with probability 1/(l+1)1/(l+1)1/(l+1)

Proved
CompetitivePaging.EATR.phase_stale_uniform

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

competitive-analysisp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1pagingrandomized-algorithms

Let algorithm EATR start with its servers on two distinct vertices a,ba,ba,b, let σ\sigmaσ be a request sequence, and let the requests with indices i,…,i′−1i,\dots,i'-1i,…,i′−1 form a complete EATR phase in which lll clean vertices are requested. Just before the request σ(i′−1)\sigma(i'-1)σ(i′−1) to the stale vertex that terminates the phase:

  1. the number of stale vertices is l+1l+1l+1;
  2. every stale vertex vvv is covered by a server of EATR with probability
Pr⁡[v is covered]=1l+1.\Pr[v \text{ is covered}] = \frac{1}{l+1}.Pr[v is covered]=l+11​.

This is the probabilistic core of the analysis of EATR: it gives the expected cost of the terminating request, the only request of a phase whose cost is random.

Preamble
import Mathlib
import Definitions.Def_KServer_model
import Definitions.Def_CompetitivePaging_EATR_eatr

open scoped ENNReal
Formal statement
namespace CompetitivePaging.EATR

theorem phase_stale_uniform {M : Type*} [DecidableEq M] (a b : M) (hab : a ≠ b)
    (σ : List M) (i i' : ℕ) (hph : IsCompletePhase a b σ i i') :
    (stale (bookAfter a b (σ.take (i' - 1)))).card = numClean a b σ i i' + 1 ∧
      ∀ v ∈ stale (bookAfter a b (σ.take (i' - 1))),
        (lawAfter a b (σ.take (i' - 1))).toOuterMeasure {s | v ∈ servers s}
          = ((numClean a b σ i i' : ℝ≥0∞) + 1)⁻¹ := by sorry

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

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

Setting.

  • MMM is any type with decidable equality. No metric is assumed.
  • a,b∈Ma, b \in Ma,b∈M with a≠ba \neq ba=b.
  • σ\sigmaσ is a request list, and i,i′i, i'i,i′ are such that σi,…,σi′−1\sigma_i, \dots, \sigma_{i'-1}σi​,…,σi′−1​ form a complete phase (as in the bundle above): request iii starts a phase, request i′−1i'-1i′−1 ends it, i<i′i < i'i<i′, and no request in [i,i′−1)[i, i'-1)[i,i′−1) ends a phase.

Notation.

  • B=Bi′−1B = B_{i'-1}B=Bi′−1​ is the bookkeeping after the first i′−1i'-1i′−1 requests, i.e. just before the phase-ending request.
  • L=Li′−1\mathcal L = \mathcal L_{i'-1}L=Li′−1​ is the distribution of EATR's random state at the same moment.
  • ℓ\ellℓ is the number of indices t∈[i,i′)t \in [i, i')t∈[i,i′) whose request σt\sigma_tσt​ was clean just before it was served.

Claim. Both of the following hold.

  1. The stale set stale(B)=(prev∪req)∖{last}\mathrm{stale}(B) = (\mathrm{prev} \cup \mathrm{req}) \setminus \{\mathrm{last}\}stale(B)=(prev∪req)∖{last} has exactly ℓ+1\ell + 1ℓ+1 elements.
  2. For every v∈stale(B)v \in \mathrm{stale}(B)v∈stale(B):
Pr⁡s∼L[v∈servers(s)]=1ℓ+1.\Pr_{s \sim \mathcal L}\bigl[v \in \mathrm{servers}(s)\bigr] = \frac{1}{\ell+1}.s∼LPr​[v∈servers(s)]=ℓ+11​.

Here servers(s)\mathrm{servers}(s)servers(s) is {last,other}\{\mathrm{last}, \mathrm{other}\}{last,other} during a phase and prev\mathrm{prev}prev otherwise. The probability is the total mass of the states satisfying the condition, and the equation is stated in [0,∞][0,\infty][0,∞].

Degenerate cases.

  • If MMM has at most two points, no phase can start (every request is in prev={a,b}\mathrm{prev} = \{a,b\}prev={a,b}), so the statement is vacuous.
  • ℓ+1≥1\ell + 1 \ge 1ℓ+1≥1, so the reciprocal is never ∞\infty∞.
  • The count ℓ\ellℓ runs over [i,i′)[i, i')[i,i′) and so includes index i′−1i'-1i′−1. That request is stale, i.e. in prev∪req\mathrm{prev} \cup \mathrm{req}prev∪req, so it is not clean and does not contribute.
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