Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 6.1 (= Theorem 1.2) — Ad∗A^*_dAd∗​ has competitive ratio at most (2n−1)ψ(d)(2n-1)\psi(d)(2n−1)ψ(d)

Proved
MetricalTaskSystem.Deterministic.astar_competitive

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 with n≥2n\ge2n≥2 states (the triangle inequality holds, ddd need not be symmetric), and let ψ(d)\psi(d)ψ(d) be its cycle offset ratio. The on-line continuous-time algorithm Ad∗A^*_dAd∗​ has competitive ratio at most (2n−1)ψ(d)(2n-1)\psi(d)(2n−1)ψ(d): for every

w>(2n−1) ψ(d)w>(2n-1)\,\psi(d)w>(2n−1)ψ(d)

there is a constant KKK such that

cAd∗(T)≤w c0(T)+Kc_{A^*_d}(\mathbf T)\le w\,c_0(\mathbf T)+KcAd∗​​(T)≤wc0​(T)+K

for every finite sequence T\mathbf TT of nonnegative tasks and every initial state s0s_0s0​, where cAd∗c_{A^*_d}cAd∗​​ is the continuous-time cost of Ad∗A^*_dAd∗​ and c0c_0c0​ the discrete off-line optimum.

For metrical task systems ψ(d)=1\psi(d)=1ψ(d)=1, so combined with Lemma 3.1 this gives the upper bound w(S,d)≤2n−1w(S,d)\le 2n-1w(S,d)≤2n−1 of Theorem 1.1.

Formalization Note The algorithm is taken with any tie-breaking rule, supplied as a state sequence for each initial state. Its cost lies in [0,∞][0,\infty][0,∞], so the bound also asserts that only finitely many transitions occur before time m+1m+1m+1; the right-hand side is truncated at 000, which is harmless since KKK may be taken nonnegative. "Competitive ratio at most ccc" is rendered as "www-competitive for every w>cw>cw>c". The requirement n≥2n\ge2n≥2 keeps ψ(d)\psi(d)ψ(d) and Ad∗A^*_dAd∗​ defined.

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

/-- **Theorem 6.1 = Theorem 1.2** (Borodin–Linial–Saks 1992, pp. 755 and 747). For any task
system `(S, d)` with `n ≥ 2` states (not necessarily symmetric), the continuous-time on-line
algorithm `A*_d` (with any tie-breaking, given for each initial state `s₀` by a state sequence
`seq s₀` satisfying `IsAstarSeq`) has competitive ratio at most `(2n − 1) ψ(d)`: for every
`w > (2n − 1) ψ(d)` there is a constant `K` with `c_{A*_d}(T) ≤ w · c₀(T) + K` for every
finite nonnegative task sequence `T` and every initial state `s₀`. -/
theorem astar_competitive {S : Type} [Fintype S] [DecidableEq S] [Nontrivial S]
    (d : S → S → ℝ) (hd : IsTaskSystem d)
    (seq : S → ℕ → S) (hseq : ∀ s₀, IsAstarSeq d s₀ (seq s₀))
    (w : ℝ) (hw : (2 * (Fintype.card S : ℝ) - 1) * cycleOffsetRatio d < w) :
    ∃ K : ℝ, ∀ (s₀ : S) (m : ℕ) (T : Fin m → S → ℝ), (∀ i s, 0 ≤ T i s) →
      astarCost d (seq s₀) T ≤ ENNReal.ofReal (w * offlineOpt d s₀ T + K) := by sorry

end MetricalTaskSystem.Deterministic
Source
Borodin, Linial, Saks, An Optimal On-Line Algorithm for Metrical Task System, J. ACM 39(4) (1992), p. 755, Theorem 6.1 (= Theorem 1.2, p. 747)
Read-back

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

Setting. Let SSS be a finite set with n≥2n \ge 2n≥2 elements, and let ddd be a task system; symmetry is not required:

  • 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).

Ad∗A^*_dAd∗​ sequences. Suppose that for each initial state s0s_0s0​ a sequence s0(s0),s1(s0),…s^{(s_0)}_0, s^{(s_0)}_1, \dotss0(s0​)​,s1(s0​)​,… is fixed that is an Ad∗A^*_dAd∗​ sequence from s0s_0s0​:

  • it starts at s0s_0s0​;
  • sk+1≠sks_{k+1} \ne s_ksk+1​=sk​;
  • sk+1s_{k+1}sk+1​ minimizes fk(x)+d(x,sk)f_k(x) + d(x,s_k)fk​(x)+d(x,sk​) over x≠skx \ne s_kx=sk​.

Here f0≡0f_0 \equiv 0f0​≡0, fk+1(sk)=fk(sk+1)+d(sk+1,sk)f_{k+1}(s_k) = f_k(s_{k+1}) + d(s_{k+1},s_k)fk+1​(sk​)=fk​(sk+1​)+d(sk+1​,sk​), and fk+1(x)=fk(x)f_{k+1}(x) = f_k(x)fk+1​(x)=fk​(x) otherwise.

Cycle offset ratio. ψ(d)\psi(d)ψ(d) is the real supremum of

∑i=1kd(vi−1,vi)∑i=1kd(vi,vi−1)\frac{\sum_{i=1}^k d(v_{i-1},v_i)}{\sum_{i=1}^k d(v_i,v_{i-1})}∑i=1k​d(vi​,vi−1​)∑i=1k​d(vi−1​,vi​)​

over closed walks v0,…,vk=v0v_0, \dots, v_k = v_0v0​,…,vk​=v0​ with positive denominator. For such ddd this set is nonempty (take a,b,aa, b, aa,b,a) and bounded above by max⁡i≠jd(i,j)/d(j,i)\max_{i \ne j} d(i,j)/d(j,i)maxi=j​d(i,j)/d(j,i), so ψ(d)\psi(d)ψ(d) is its genuine supremum.

Hypothesis on www. www is real and (2n−1) ψ(d)<w(2n-1)\,\psi(d) < w(2n−1)ψ(d)<w.

Cost of Ad∗A^*_dAd∗​. For s0s_0s0​, nonnegative tasks T0,…,Tm−1T_0, \dots, T_{m-1}T0​,…,Tm−1​ and the sequence s=s(s0)s = s^{(s_0)}s=s(s0​):

  • Budgets: cj=fj+1(sj)−fj(sj)c_j = f_{j+1}(s_j) - f_j(s_j)cj​=fj+1​(sj​)−fj​(sj​).
  • Processing cost: Px(a,b)=∑iTi(x)max⁡(0,min⁡(b,i+2)−max⁡(a,i+1))P_x(a,b) = \sum_i T_i(x)\max\big(0, \min(b,i+2) - \max(a,i+1)\big)Px​(a,b)=∑i​Ti​(x)max(0,min(b,i+2)−max(a,i+1)).
  • Entry times: t0=1t_0 = 1t0​=1. The time tj+1t_{j+1}tj+1​ is inf⁡{u≥tj:Psj(tj,u)≥cj}\inf\{u \ge t_j : P_{s_j}(t_j,u) \ge c_j\}inf{u≥tj​:Psj​​(tj​,u)≥cj​} if some such uuu is <m+1< m+1<m+1; otherwise tj+1t_{j+1}tj+1​ and all later entry times are undefined.
  • Stage jjj costs:
    • 000 if tjt_jtj​ is undefined;
    • max⁡(0,Psj(tj,m+1))\max\big(0, P_{s_j}(t_j, m+1)\big)max(0,Psj​​(tj​,m+1)) if only tjt_jtj​ is defined;
    • max⁡(0,Psj(tj,tj+1)+d(sj,sj+1))\max\big(0, P_{s_j}(t_j,t_{j+1}) + d(s_j,s_{j+1})\big)max(0,Psj​​(tj​,tj+1​)+d(sj​,sj+1​)) otherwise.
  • The cost C∗(s0,T)∈[0,∞]C^*(s_0, T) \in [0,\infty]C∗(s0​,T)∈[0,∞] is the sum of all stage costs.

Conclusion. There is a real constant KKK, depending only on ddd, the fixed sequences and www, such that

C∗(s0,T)≤max⁡(0, w c0(T)+K)C^*(s_0, T) \le \max\big(0,\ w\, c_0(T) + K\big)C∗(s0​,T)≤max(0, wc0​(T)+K)

for every s0s_0s0​, every mmm, and every TTT with all Ti(s)≥0T_i(s) \ge 0Ti​(s)≥0. Here c0(T)c_0(T)c0​(T) is the discrete off-line optimum:

c0(T)=min⁡σ(0)=s0∑i<m(d(σ(i),σ(i+1))+Ti(σ(i+1))).c_0(T) = \min_{\sigma(0) = s_0} \sum_{i<m} \Big( d\big(\sigma(i),\sigma(i+1)\big) + T_i\big(\sigma(i+1)\big) \Big).c0​(T)=σ(0)=s0​min​i<m∑​(d(σ(i),σ(i+1))+Ti​(σ(i+1))).

In particular C∗C^*C∗ is finite. The conclusion is not stated through the definition of www-competitiveness.

Degenerate cases.

  • m=0m = 0m=0. C∗=0C^* = 0C∗=0 and c0=0c_0 = 0c0​=0, so the inequality reads 0≤max⁡(0,K)0 \le \max(0, K)0≤max(0,K). It holds for any KKK, and so does not force K≥0K \ge 0K≥0.
  • Negative right side. Whenever w c0(T)+K<0w\, c_0(T) + K < 0wc0​(T)+K<0, the right side is 000, and the claim demands C∗=0C^* = 0C∗=0.
  • Excluded cases. One-element or empty SSS is excluded. No Ad∗A^*_dAd∗​ sequence would exist there.
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