Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Theorem 5 — the algorithm is best among schedules with properties (a), (b), (c)

Proved
ResourceScheduling.Poly.q2_algorithm_best_abc

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

algorithmp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1resource-constraintsscheduling

Consider Q2∣res1⋅⋅, pj=1∣Cmax⁡Q2\mid res1{\cdot}{\cdot},\,p_j=1\mid C_{\max}Q2∣res1⋅⋅,pj​=1∣Cmax​: two uniform machines M1,M2M_1,M_2M1​,M2​ with speeds q1≥q2>0q_1\ge q_2>0q1​≥q2​>0, one resource of positive integer size s1s_1s1​, nnn unit-time jobs with nonnegative integer requirements r1j≤s1r_{1j}\le s_1r1j​≤s1​, and no precedence constraints. Let π\piπ be any order of the jobs with nonincreasing requirements, and let AAA be the schedule produced by the algorithm of Theorem 5 from π\piπ.

Then AAA is feasible, satisfies properties (a), (b) and (c), and

Cmax⁡(A)≤Cmax⁡(σ)C_{\max}(A)\le C_{\max}(\sigma)Cmax​(A)≤Cmax​(σ)

for every feasible schedule σ\sigmaσ satisfying (a), (b) and (c).

This is the first half of the paper's proof of Theorem 5: "This O(n log n) algorithm clearly generates the best schedule among those satisfying the following properties". Combined with the exchange argument (every feasible schedule can be turned into an (a)–(c) schedule that is at least as good), it gives the optimality of the algorithm.

Formalization Note The hypothesis r1j≤s1r_{1j}\le s_1r1j​≤s1​ (every job fits alone) is implicit in the paper; without it no feasible schedule exists. The running time is not formalized.

Preamble
import Mathlib
import Definitions.Def_ResourceScheduling_Poly_Model
import Definitions.Def_ResourceScheduling_Poly_Q2Properties
import Definitions.Def_ResourceScheduling_Poly_Q2Algorithm
Formal statement
namespace ResourceScheduling.Poly

/-- Proof of Theorem 5 (p. 16): the algorithm generates the best schedule among those satisfying
properties (a), (b) and (c). -/
theorem q2_algorithm_best_abc (I : Instance) (hm : I.m = 2) (hl : I.l = 1)
    (hprec : I.NoPrecedence) (hq : I.q (I.M₂ hm) ≤ I.q (I.M₁ hm)) (hfit : I.EveryJobFits)
    (ord : Fin I.n ≃ Fin I.n) (hord : Antitone fun p => I.r (I.R₁ hl) (ord p)) :
    (q2Algorithm I hm hl ord).Feasible ∧ (q2Algorithm I hm hl ord).SatisfiesABC hm hl ∧
      ∀ σ : Schedule I, σ.Feasible → σ.SatisfiesABC hm hl →
        (q2Algorithm I hm hl ord).makespan ≤ σ.makespan := by sorry

end ResourceScheduling.Poly
Source
Błażewicz, Lenstra & Rinnooy Kan, Scheduling subject to resource constraints: classification and complexity, Discrete Appl. Math. 5 (1983), p. 16, proof of Theorem 5 ("This O(n log n) algorithm clearly generates the best schedule among those satisfying the following properties")
Read-back

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

The instance. Take any instance with nnn jobs, positive real machine speeds, natural-number resource sizes sh≥1s_h \ge 1sh​≥1 and natural-number requirements, and an acyclic precedence relation. Assume:

  • m=2m = 2m=2. Write M1M_1M1​ for machine index 000 (speed q1q_1q1​) and M2M_2M2​ for machine index 111 (speed q2q_2q2​).
  • l=1l = 1l=1. Write rjr_jrj​ for job jjj's requirement and sss for the resource size.
  • There are no precedence arcs.
  • q2≤q1q_2 \le q_1q2​≤q1​.
  • rj≤sr_j \le srj​≤s for every job jjj.
  • π\piπ is a bijection from positions {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1} to jobs such that p≤p′p \le p'p≤p′ implies rπ(p′)≤rπ(p)r_{\pi(p')} \le r_{\pi(p)}rπ(p′)​≤rπ(p)​ (requirements nonincreasing along positions).

The algorithm's schedule. Let AAA be the schedule built from π\piπ as follows.

  • Fits(c,j,t)\mathrm{Fits}(c,j,t)Fits(c,j,t) means: for all u∈[t,t+1/q2)u \in [t, t+1/q_2)u∈[t,t+1/q2​),
rj+∑p<c, p/q1≤u<(p+1)/q1rπ(p)≤s.r_j + \sum_{p<c,\ p/q_1 \le u < (p+1)/q_1} r_{\pi(p)} \le s.rj​+p<c, p/q1​≤u<(p+1)/q1​∑​rπ(p)​≤s.
  • ms(e,c,j)=inf⁡{t≥e:Fits(c,j,t)}\mathrm{ms}(e,c,j) = \inf\{t \ge e : \mathrm{Fits}(c,j,t)\}ms(e,c,j)=inf{t≥e:Fits(c,j,t)}, with the value 000 if the set is empty.
  • E0=0E_0 = 0E0​=0. For i<ni<ni<n: Ti=ms(Ei,n−1−i,π(n−1−i))T_i = \mathrm{ms}(E_i, n-1-i, \pi(n-1-i))Ti​=ms(Ei​,n−1−i,π(n−1−i)) and Ei+1=Ti+1/q2E_{i+1} = T_i + 1/q_2Ei+1​=Ti​+1/q2​.
  • σk\sigma_kσk​ puts job jjj, with position ρj\rho_jρj​, on M1M_1M1​ at start ρj/q1\rho_j/q_1ρj​/q1​ if ρj+k<n\rho_j + k < nρj​+k<n. Otherwise it puts jjj on M2M_2M2​ at start Tn−1−ρjT_{n-1-\rho_j}Tn−1−ρj​​.
  • A=σk∗A = \sigma_{k^*}A=σk∗​, where k∗k^*k∗ is the least kkk with k≥nk \ge nk≥n or Cmax⁡(σk+1)≮Cmax⁡(σk)C_{\max}(\sigma_{k+1}) \not< C_{\max}(\sigma_k)Cmax​(σk+1​)<Cmax​(σk​).

In a schedule, job jjj has a machine μ(j)\mu(j)μ(j), a real start SjS_jSj​ and a completion time Cj=Sj+1/qμ(j)C_j = S_j + 1/q_{\mu(j)}Cj​=Sj​+1/qμ(j)​. The makespan is Cmax⁡=max⁡jCjC_{\max} = \max_j C_jCmax​=maxj​Cj​, or 000 if n=0n = 0n=0.

Feasible means all of the following:

  • all Sj≥0S_j \ge 0Sj​≥0;
  • distinct jobs on the same machine satisfy Cj≤SkC_j \le S_kCj​≤Sk​ or Ck≤SjC_k \le S_jCk​≤Sj​;
  • Cj≤SkC_j \le S_kCj​≤Sk​ whenever kkk is reachable from jjj by arcs (vacuous here);
  • at every real ttt, the jobs with Sj≤t<CjS_j \le t < C_jSj​≤t<Cj​ have total requirement ≤s\le s≤s.

Properties (a)(b)(c). Let ccc be the number of jobs on M1M_1M1​.

  • (a) Each job on M1M_1M1​ starts at some p/q1p/q_1p/q1​ with p<cp<cp<c. Distinct jobs on M1M_1M1​ have distinct starts. On M1M_1M1​, Sj<SkS_j < S_kSj​<Sk​ implies rk≤rjr_k \le r_jrk​≤rj​.
  • (b) On M2M_2M2​, Sj<SkS_j < S_kSj​<Sk​ implies rj≤rkr_j \le r_krj​≤rk​.
  • (c) Every job on M1M_1M1​ has rrr at least that of every job on M2M_2M2​.

The theorem asserts:

  1. AAA is feasible;
  2. AAA satisfies (a), (b) and (c);
  3. for every feasible schedule σ\sigmaσ that satisfies (a), (b) and (c), Cmax⁡(A)≤Cmax⁡(σ)C_{\max}(A) \le C_{\max}(\sigma)Cmax​(A)≤Cmax​(σ).

Degenerate cases.

  • If n=0n = 0n=0, AAA is the empty schedule with Cmax⁡=0C_{\max} = 0Cmax​=0, and all three claims are immediate.
  • The resource-size hypothesis ensures each job fits alone. The statement does not separately assert anything about infima being attained. If a computed start were the junk value, claim 1 still asserts feasibility of the resulting schedule.
  • The hypotheses are satisfiable, for example by any instance with rj≤sr_j \le srj​≤s and q2≤q1q_2 \le q_1q2​≤q1​.
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