Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 3.1 — every on-line continuous-time algorithm is matched by an on-line discrete-time one

Proved
MetricalTaskSystem.Deterministic.ctsa_to_dtsa

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

competitive-analysismetrical-task-systemsonline-algorithmsp2o-batch-p100ap2o-gran-per-chapterp2o-plan-paperp2o-v1

Let (S,d)(S,d)(S,d) be a task system (triangle inequality, not necessarily symmetric). For every on-line continuous-time scheduling algorithm A′A'A′ there is an on-line discrete-time scheduling algorithm AAA that performs at least as well as A′A'A′ on every task sequence:

cA(T) ≤ cA′(T)for all finite nonnegative task sequences T and all initial states s0.c_A(\mathbf T)\ \le\ c_{A'}(\mathbf T)\qquad\text{for all finite nonnegative task sequences }\mathbf T\text{ and all initial states } s_0 .cA​(T) ≤ cA′​(T)for all finite nonnegative task sequences T and all initial states s0​.

This lemma allows the upper bounds of the paper to be proved for algorithms that move at non-integral times.

Formalization Note The printed statement says "at least as well as AAA"; the intended comparison is with A′A'A′, as the proof shows. A CTSA is in list form (pieces of each unit interval with nonnegative lengths summing to 111); see the ContinuousTime definition.

Preamble
import Mathlib
import Definitions.Def_MetricalTaskSystem_Deterministic_Model
import Definitions.Def_MetricalTaskSystem_Deterministic_ContinuousTime
Formal statement
namespace MetricalTaskSystem.Deterministic

/-- **Lemma 3.1** (Borodin–Linial–Saks 1992, p. 752). For any on-line continuous-time
scheduling algorithm `A'` there is an on-line discrete-time scheduling algorithm `A` that
performs at least as well as `A'` on every (nonnegative) task sequence, from every initial
state. -/
theorem ctsa_to_dtsa {S : Type} [Fintype S] [DecidableEq S] [Nonempty S]
    (d : S → S → ℝ) (hd : IsTaskSystem d) (A' : CTSA S) (hA' : IsCTSA A') :
    ∃ A : OnlineAlgorithm S, ∀ (s₀ : S) (m : ℕ) (T : Fin m → S → ℝ), (∀ i s, 0 ≤ T i s) →
      onlineCost d A s₀ T ≤ ctsaCost d A' s₀ T := by sorry

end MetricalTaskSystem.Deterministic
Source
Borodin, Linial, Saks, An Optimal On-Line Algorithm for Metrical Task System, J. ACM 39(4) (1992), p. 752, Lemma 3.1
Read-back

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

Setting. Let SSS be a finite, nonempty set, and let ddd be a task system:

  • d(i,i)=0d(i,i) = 0d(i,i)=0;
  • d(i,j)>0d(i,j) > 0d(i,j)>0 for i≠ji \ne ji=j;
  • d(i,k)≤d(i,j)+d(j,k)d(i,k) \le d(i,j) + d(j,k)d(i,k)≤d(i,j)+d(j,k).

Let A′A'A′ be a well-formed continuous-time on-line algorithm. That is, A′A'A′ is any function mapping (s0,finite list of tasks)(s_0, \text{finite list of tasks})(s0​,finite list of tasks) to a finite list of pieces (x,ℓ)∈S×R(x,\ell) \in S \times \mathbb{R}(x,ℓ)∈S×R, such that on every nonempty task list all lengths are ≥0\ge 0≥0 and sum to 111. Its output on the empty list is unconstrained.

Cost of A′A'A′. For s0∈Ss_0 \in Ss0​∈S and tasks T0,…,Tm−1T_0, \dots, T_{m-1}T0​,…,Tm−1​:

  • The pieces for TiT_iTi​ are A′(s0,[T0,…,Ti])A'(s_0, [T_0, \dots, T_i])A′(s0​,[T0​,…,Ti​]).
  • Concatenate these lists for i=0,…,m−1i = 0, \dots, m-1i=0,…,m−1, with states x1,x2,…x_1, x_2, \dotsx1​,x2​,….

The cost is

CA′(T)=∑d(consecutive states of s0,x1,x2,… )+∑i=0m−1 ∑(x,ℓ)∈A′(s0,[T0,…,Ti])ℓ Ti(x).C_{A'}(T) = \sum d(\text{consecutive states of } s_0, x_1, x_2, \dots) + \sum_{i=0}^{m-1} \ \sum_{(x,\ell) \in A'(s_0,[T_0,\dots,T_i])} \ell\, T_i(x).CA′​(T)=∑d(consecutive states of s0​,x1​,x2​,…)+i=0∑m−1​ (x,ℓ)∈A′(s0​,[T0​,…,Ti​])∑​ℓTi​(x).

Conclusion. There exists an on-line algorithm AAA, meaning an arbitrary function mapping (s0,list of tasks)(s_0, \text{list of tasks})(s0​,list of tasks) to a state, such that

cA(T)≤CA′(T)c_A(T) \le C_{A'}(T)cA​(T)≤CA′​(T)

for every s0∈Ss_0 \in Ss0​∈S, every mmm, and every T0,…,Tm−1T_0, \dots, T_{m-1}T0​,…,Tm−1​ with all Ti(s)≥0T_i(s) \ge 0Ti​(s)≥0. Here:

  • cA(T)=∑i<m(d(σ(i),σ(i+1))+Ti(σ(i+1)))c_A(T) = \sum_{i<m} \big( d(\sigma(i), \sigma(i+1)) + T_i(\sigma(i+1)) \big)cA​(T)=∑i<m​(d(σ(i),σ(i+1))+Ti​(σ(i+1)));
  • σ(0)=s0\sigma(0) = s_0σ(0)=s0​ and σ(i)=A(s0,[T0,…,Ti−1])\sigma(i) = A(s_0, [T_0, \dots, T_{i-1}])σ(i)=A(s0​,[T0​,…,Ti−1​]).

The single algorithm AAA is chosen after ddd and A′A'A′, before s0s_0s0​, mmm and TTT. It need not be computable.

Degenerate cases.

  • m=0m = 0m=0. Both sides are 000.
  • S={s}S = \{s\}S={s}. Both sides equal ∑iTi(s)\sum_i T_i(s)∑i​Ti​(s).
  • Negative tasks. These are not covered.
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