Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

At the start of every phase the marked vertices are the covered ones

Proved
CompetitivePaging.Marking.phase_start_marked_eq_covered

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

online-algorithmsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1pagingrandomized-algorithms

Let MMM be a set of nnn vertices 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 run the marking algorithm with kkk servers starting from the covered and marked set V={e(0),…,e(k−1)}V = \{e(0), \dots, e(k-1)\}V={e(0),…,e(k−1)}. Let σ\sigmaσ be a request sequence and let request ttt start a phase, i.e. the marked set mkt\mathrm{mk}_tmkt​ after the first ttt requests satisfies ∣mkt∪{σ(t)}∣=k+1|\mathrm{mk}_t \cup \{\sigma(t)\}| = k+1∣mkt​∪{σ(t)}∣=k+1.

Then for every state (cov,mk)(\mathrm{cov}, \mathrm{mk})(cov,mk) that the algorithm reaches with positive probability after the first ttt requests,

mk=covandσ(t)∉mk.\mathrm{mk} = \mathrm{cov} \quad\text{and}\quad \sigma(t) \notin \mathrm{mk}.mk=covandσ(t)∈/mk.

In words: at the start of every phase the marked vertices are precisely the ones occupied by the algorithm's servers, and the first request of every phase is to an unmarked vertex. This is the structural fact that makes the phase analysis of Theorem 1 possible: at every phase boundary the random configuration of the marking algorithm is in fact determined by the request sequence.

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): at the start of every phase the marked vertices are
precisely the ones occupied by the marking algorithm's servers, and the first request of the
phase is to an unmarked vertex. -/
theorem phase_start_marked_eq_covered {n k : ℕ} {M : Type*} [DecidableEq M]
    (e : Fin n ≃ M) (hk : 1 ≤ k) (hkn : k ≤ n) (σ : List M) (t : ℕ) (ht : t < σ.length)
    (hstart : IsPhaseStart k (initVertices e hkn) σ t) :
    ∀ s ∈ (lawAfter k (initVertices e hkn) (σ.take t)).support,
      s.marked = s.covered ∧ σ.get ⟨t, ht⟩ ∉ s.marked := 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.

  • n,kn, kn,k are natural numbers with 1≤k≤n1 \le k \le n1≤k≤n.
  • MMM is a type with decidable equality, and e:{0,…,n−1}→Me : \{0,\dots,n-1\}\to Me:{0,…,n−1}→M is a bijection, so MMM has exactly nnn elements.
  • 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 finite sequence of points of MMM, and t<mt < mt<m.
  • ttt is a phase start: ∣Mk(σ,t)∪{σt}∣=k+1|\mathrm{Mk}(\sigma,t)\cup\{\sigma_t\}| = k+1∣Mk(σ,t)∪{σt​}∣=k+1, where Mk(σ,t)\mathrm{Mk}(\sigma,t)Mk(σ,t) is obtained from V0V_0V0​ by applying the mark update ("insert rrr; if the result has exactly k+1k+1k+1 elements, replace it by {r}\{r\}{r}") to σ0,…,σt−1\sigma_0,\dots,\sigma_{t-1}σ0​,…,σt−1​.

Claim. Consider the randomized marking process that starts from the state (covered, marked) =(V0,V0)= (V_0, V_0)=(V0​,V0​) and serves σ0,…,σt−1\sigma_0,\dots,\sigma_{t-1}σ0​,…,σt−1​. At each step:

  • marks are updated;
  • a covered request moves nothing;
  • an uncovered request rrr replaces a uniformly random element of (covered ∖\setminus∖ new marks) by rrr, or changes nothing if that set is empty.

Then every state (cov,mk)(\mathrm{cov}, \mathrm{mk})(cov,mk) with positive probability after these ttt requests satisfies

mk=covandσt∉mk.\mathrm{mk} = \mathrm{cov}\quad\text{and}\quad \sigma_t \notin \mathrm{mk}.mk=covandσt​∈/mk.

Degenerate cases.

  • At t=0t = 0t=0, the only state is (V0,V0)(V_0, V_0)(V0​,V0​). The phase-start hypothesis says ∣V0∪{σ0}∣=k+1|V_0\cup\{\sigma_0\}| = k+1∣V0​∪{σ0​}∣=k+1, i.e. σ0∉V0\sigma_0\notin V_0σ0​∈/V0​.
  • The hypothesis t<mt < mt<m repeats what the phase-start hypothesis already contains.
  • When k=nk = nk=n, no index can be a phase start, since MMM has only nnn elements. The statement is then vacuous.
  • k=0k = 0k=0 and n=0n = 0n=0 are excluded by 1≤k1 \le k1≤k.
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