Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Theorem 10 — the spin-block problem is optimally e/(e−1)e/(e-1)e/(e−1)-competitive against an oblivious adversary

Proved
NonuniformCompetitive.SpinBlock.optimal_ratio

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

competitive-analysisp2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1randomized-algorithmsski-rentalspin-block

Consider the spin-block problem with context-switch cost C>0C>0C>0: for each of a sequence of lock waits, an on-line algorithm chooses how long to spin (cost 111 per unit time) before blocking (cost CCC), not knowing when the lock will be released; the off-line optimum pays min⁡(τ,C)\min(\tau,C)min(τ,C) for a lock released at time τ\tauτ. Then

  1. no randomized on-line algorithm is ccc-competitive against an oblivious adversary for any c<ee−1c<\frac{e}{e-1}c<e−1e​: if ECA(σ)≤c⋅Copt(σ)+a\mathbf{E}C_A(\sigma)\le c\cdot C_{opt}(\sigma)+aECA​(σ)≤c⋅Copt​(σ)+a for some constant aaa and all input sequences σ\sigmaσ, then c≥ee−1c\ge\frac{e}{e-1}c≥e−1e​;
  2. there is a randomized on-line algorithm that is ee−1\frac{e}{e-1}e−1e​-competitive against an oblivious adversary.
inf⁡{c:some randomized algorithm is c-competitive}=ee−1≈1.582, and the infimum is attained.\inf\{c : \text{some randomized algorithm is } c\text{-competitive}\}=\frac{e}{e-1}\approx1.582,\ \text{and the infimum is attained.}inf{c:some randomized algorithm is c-competitive}=e−1e​≈1.582, and the infimum is attained.

This is Theorem 10 of Karlin, Manasse, McGeoch and Owicki, the continuous (ski-rental) counterpart of their optimal randomized snoopy-caching bound; the deterministic optimum is 222.

Formalization Note Randomized algorithms are mixed strategies over deterministic on-line algorithms, each of which chooses the next blocking time from the release times of earlier waits; the cost on each fixed input is required to be measurable in the random outcome. Competitiveness carries an additive constant, as defined in §1 of the paper. The hypothesis C>0C>0C>0 is the paper's "some large cost CCC"; at C=0C=0C=0 blocking at once is free and optimal.

Preamble
import Mathlib
import Definitions.Def_NonuniformCompetitive_SpinBlock_Randomized
Formal statement
namespace NonuniformCompetitive.SpinBlock

/-- Theorem 10 (p. 559): no algorithm for the spin-block problem is competitive against an
oblivious adversary within a factor less than `e/(e − 1)`, and there is a randomized algorithm
that achieves this competitive factor. -/
theorem optimal_ratio (C : ℝ) (hC : 0 < C) :
    (∀ (A : RandomizedAlg C) (c : ℝ), A.IsCompetitive c → Real.exp 1 / (Real.exp 1 - 1) ≤ c) ∧
      ∃ A : RandomizedAlg C, A.IsCompetitive (Real.exp 1 / (Real.exp 1 - 1)) := by sorry

end NonuniformCompetitive.SpinBlock
Source
Karlin, Manasse, McGeoch, Owicki, Competitive Randomized Algorithms for Nonuniform Problems, Algorithmica 11 (1994), p. 559, Theorem 10
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me