Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

The greedy punishing rule punishes each B(i)B(i)B(i) at least ⌊r/c(i)⌋\lfloor r/c(i)\rfloor⌊r/c(i)⌋ times by cost rrr

Proved
CompetitivePaging.Combining.greedy_punishing_meets_quotas

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

combinatoricsonline-algorithmsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1scheduling

Let c(1),…,c(m)c(1),\dots,c(m)c(1),…,c(m) be positive reals with

∑i=1m1c(i)≤1.\sum_{i=1}^m\frac1{c(i)}\le 1 .i=1∑m​c(i)1​≤1.

Index the units of cost incurred by an on-line algorithm AAA by r=0,1,2,…r=0,1,2,\dotsr=0,1,2,…, and let PUNr(i)\mathrm{PUN}_r(i)PUNr​(i) be the number of times AAA has punished B(i)B(i)B(i) by the time it has incurred cost rrr, with PUN0(i)=0\mathrm{PUN}_0(i)=0PUN0​(i)=0. When AAA incurs its (r+1)(r+1)(r+1)-st unit of cost it punishes an algorithm ir+1i_{r+1}ir+1​ chosen greedily: ir+1i_{r+1}ir+1​ minimizes c(i) (PUNr(i)+1)c(i)\,(\mathrm{PUN}_r(i)+1)c(i)(PUNr​(i)+1) over all iii, ties broken arbitrarily. The count of ir+1i_{r+1}ir+1​ then grows by at least one, PUNr+1(ir+1)≥PUNr(ir+1)+1\mathrm{PUN}_{r+1}(i_{r+1})\ge\mathrm{PUN}_r(i_{r+1})+1PUNr+1​(ir+1​)≥PUNr​(ir+1​)+1, and no count ever decreases (other algorithms may be punished incidentally). Then for every positive integer rrr and every iii,

PUNr(i)≥⌊rc(i)⌋.\mathrm{PUN}_r(i)\ge\left\lfloor\frac{r}{c(i)}\right\rfloor .PUNr​(i)≥⌊c(i)r​⌋.

This is the scheduling claim that completes the sufficiency proof of Theorem 6: once AAA has incurred cost rrr, algorithm B(i)B(i)B(i) has been punished at least ⌊r/c(i)⌋\lfloor r/c(i)\rfloor⌊r/c(i)⌋ times.

Formalization Note The choice sequence is indexed from 000: choice r is ir+1i_{r+1}ir+1​ and pun r i is PUNr(i)\mathrm{PUN}_r(i)PUNr​(i). The counts are an arbitrary function subject to pun 0 i = 0 and pun r i + [choice r = i] ≤ pun (r+1) i, so punishments of algorithms other than the chosen one are allowed, as in the paper, where PUN\mathrm{PUN}PUN counts every punishment. The floor is Nat.floor of a real number. For m=0m=0m=0 no choice sequence exists and the statement is vacuous, as is the paper's.

Preamble
import Mathlib
Formal statement
namespace CompetitivePaging.Combining

/-- Fiat et al. 1991, §6, proof of Theorem 6, p. 9, the scheduling claim. Index `A`'s units of
cost by `r = 0, 1, 2, …` (a lazy `A` pays one unit per fault). `pun r i` is `PUN(i, ·, σ)`, the
number of times `A` has punished `B(i)` by the time it has incurred cost `r`; it starts at `0`.
At its `(r+1)`-st unit of cost `A` punishes `choice r`, the `B(i)` for which
`c(i) · (PUN(i) + 1)` is least (ties broken arbitrarily); the chosen count grows by at least one,
and any count may also grow by incidental punishments. If every `c(i) > 0` and `∑ 1/c(i) ≤ 1`,
then for all positive integers `r` and all `i`, `B(i)` has been punished at least `⌊r / c(i)⌋`
times by the time `A` incurs cost `r`. -/
theorem greedy_punishing_meets_quotas {m : ℕ} (c : Fin m → ℝ) (hc : ∀ i, 0 < c i)
    (hsum : ∑ i, 1 / c i ≤ 1) (choice : ℕ → Fin m) (pun : ℕ → Fin m → ℕ)
    (hpun0 : ∀ i, pun 0 i = 0)
    (hpun : ∀ (r : ℕ) (i : Fin m), pun r i + (if choice r = i then 1 else 0) ≤ pun (r + 1) i)
    (hgreedy : ∀ (r : ℕ) (j : Fin m),
      c (choice r) * ((pun r (choice r) : ℝ) + 1) ≤ c j * ((pun r j : ℝ) + 1)) :
    ∀ r : ℕ, 0 < r → ∀ i : Fin m, ⌊(r : ℝ) / c i⌋₊ ≤ pun r i := by sorry

end CompetitivePaging.Combining
Source
Fiat, Karp, Luby, McGeoch, Sleator, Young, Competitive Paging Algorithms, arXiv:cs/0205038v1, p. 9 (PDF p. 10), §6, proof of Theorem 6 (sufficiency), last paragraph
Read-back

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

This statement concerns mmm weights and two sequences indexed by a step counter r=0,1,2,…r = 0, 1, 2, \dotsr=0,1,2,…. The data are:

  • a natural number mmm and the index set {0,1,…,m−1}\{0, 1, \dots, m-1\}{0,1,…,m−1};
  • real weights c0,…,cm−1c_0, \dots, c_{m-1}c0​,…,cm−1​;
  • a choice function ch:N→{0,…,m−1}\mathrm{ch} : \mathbb{N} \to \{0, \dots, m-1\}ch:N→{0,…,m−1}, which picks one index at each step rrr;
  • a counting function P:N×{0,…,m−1}→NP : \mathbb{N} \times \{0, \dots, m-1\} \to \mathbb{N}P:N×{0,…,m−1}→N, written Pr(i)P_r(i)Pr​(i).

The hypotheses are:

  1. Positive weights: ci>0c_i > 0ci​>0 for every iii.
  2. Sum condition:
∑i=0m−11ci≤1.\sum_{i=0}^{m-1} \frac{1}{c_i} \le 1.i=0∑m−1​ci​1​≤1.

Since every term is positive, this forces ci≥1c_i \ge 1ci​≥1 for each iii. 3. Initial counts are zero: P0(i)=0P_0(i) = 0P0​(i)=0 for every iii. 4. Growth: for every r∈Nr \in \mathbb{N}r∈N and every iii,

Pr(i)+[ch(r)=i]≤Pr+1(i),P_r(i) + [\mathrm{ch}(r) = i] \le P_{r+1}(i),Pr​(i)+[ch(r)=i]≤Pr+1​(i),

where [⋅][\cdot][⋅] is 111 if the condition holds and 000 otherwise. So every count is non-decreasing in rrr, and the count of the chosen index goes up by at least 111 at each step. Any count may also go up by any larger amount. 5. Greedy choice: for every r∈Nr \in \mathbb{N}r∈N and every index jjj,

cch(r)(Pr(ch(r))+1)≤cj(Pr(j)+1).c_{\mathrm{ch}(r)} \bigl(P_r(\mathrm{ch}(r)) + 1\bigr) \le c_j \bigl(P_r(j) + 1\bigr).cch(r)​(Pr​(ch(r))+1)≤cj​(Pr​(j)+1).

So at step rrr the chosen index minimizes cj(Pr(j)+1)c_j (P_r(j)+1)cj​(Pr​(j)+1). When several indices tie, any of them may be chosen.

Conclusion: for every natural number r≥1r \ge 1r≥1 and every index iii,

⌊rci⌋≤Pr(i).\left\lfloor \frac{r}{c_i} \right\rfloor \le P_r(i).⌊ci​r​⌋≤Pr​(i).

Here ⌊⋅⌋\lfloor\cdot\rfloor⌊⋅⌋ is the floor taken as a natural number, which returns 000 on negative inputs. Because ci>0c_i > 0ci​>0, the quotient r/cir/c_ir/ci​ is non-negative, so this is the ordinary floor. No division by zero can occur.

Degenerate cases.

  • m=0m = 0m=0: there are no indices, so no choice function N→∅\mathbb{N} \to \emptysetN→∅ exists. The hypotheses cannot all be supplied and the statement is vacuous. The conclusion, which quantifies over no indices, is also empty.
  • m=1m = 1m=1: the sum condition says c0≥1c_0 \ge 1c0​≥1, and the choice is always index 000. The hypotheses give Pr(0)≥rP_r(0) \ge rPr​(0)≥r, and the conclusion claims ⌊r/c0⌋≤Pr(0)\lfloor r / c_0 \rfloor \le P_r(0)⌊r/c0​⌋≤Pr​(0).
  • r=0r = 0r=0: excluded by the hypothesis 0<r0 < r0<r. It would read 0≤P0(i)0 \le P_0(i)0≤P0​(i) anyway.
  • Coupling between sequences: nothing ties PPP or ch\mathrm{ch}ch to any underlying process beyond hypotheses 3–5. The claim covers every pair (ch,P)(\mathrm{ch}, P)(ch,P) that satisfies them, including counts that grow arbitrarily fast.
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