Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Theorem 1 — the minimum C_max is n − |S|

Proved
ResourceScheduling.Poly.p2_min_makespan_matching

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

graph-theorymatchingp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1resource-constraintsscheduling

Consider P2∣res⋅⋅⋅, pj=1∣Cmax⁡P2\mid res{\cdot}{\cdot}{\cdot},\,p_j=1\mid C_{\max}P2∣res⋅⋅⋅,pj​=1∣Cmax​: two identical machines (speed 111), nnn unit-time jobs, lll resources with positive integer sizes shs_hsh​ and nonnegative integer requirements rhj≤shr_{hj}\le s_hrhj​≤sh​, and no precedence constraints. Let GGG be the graph on the jobs with an edge {j,k}\{j,k\}{j,k} whenever rhj+rhk≤shr_{hj}+r_{hk}\le s_hrhj​+rhk​≤sh​ for all hhh, and let SSS be a matching of maximum cardinality in GGG. Then the minimum value of Cmax⁡C_{\max}Cmax​ is

n−∣S∣:n-|S|:n−∣S∣:

some feasible schedule has Cmax⁡=n−∣S∣C_{\max}=n-|S|Cmax​=n−∣S∣, and every feasible schedule has Cmax⁡≥n−∣S∣C_{\max}\ge n-|S|Cmax​≥n−∣S∣.

This is the content of the proof of Theorem 1 (Garey & Johnson): "Obviously, the minimum value of Cmax⁡C_{\max}Cmax​ is equal to n−∣S∣n-|S|n−∣S∣." It reduces two-machine scheduling under arbitrary resource constraints to maximum matching.

Formalization Note The matching is a Mathlib Subgraph of GGG with IsMatching; maximality is over all matchings of GGG, and ∣S∣|S|∣S∣ is the number of its edges. The value is computed in R\mathbb RR, so there is no natural-number subtraction. The hypothesis rhj≤shr_{hj}\le s_hrhj​≤sh​ is implicit in the paper. The running time O(ln2+n5/2)O(ln^2+n^{5/2})O(ln2+n5/2) is not formalized.

Preamble
import Mathlib
import Definitions.Def_ResourceScheduling_Poly_Model
import Definitions.Def_ResourceScheduling_Poly_CompatibilityGraph
Formal statement
namespace ResourceScheduling.Poly

/-- Proof of Theorem 1 (p. 15): for `P2 | res···, p_j = 1 | C_max` with every job fitting alone,
if `S` is a matching of maximum cardinality in the compatibility graph `G`, the minimum value of
`C_max` over feasible schedules is `n - |S|`: it is attained, and no feasible schedule does
better. -/
theorem p2_min_makespan_matching (I : Instance) (hm : I.m = 2) (hq : ∀ i, I.q i = 1)
    (hprec : I.NoPrecedence) (hfit : I.EveryJobFits)
    (S : I.compatGraph.Subgraph) (hS : S.IsMatching)
    (hmax : ∀ S' : I.compatGraph.Subgraph, S'.IsMatching → S'.edgeSet.ncard ≤ S.edgeSet.ncard) :
    (∃ σ : Schedule I, σ.Feasible ∧ σ.makespan = (I.n : ℝ) - S.edgeSet.ncard) ∧
      ∀ σ : Schedule I, σ.Feasible → (I.n : ℝ) - S.edgeSet.ncard ≤ σ.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. 15, proof of Theorem 1 (statement p. 13)
Read-back

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

Hypotheses. Take any instance with nnn jobs, an arbitrary number lll of resources with sizes sh≥1s_h \ge 1sh​≥1, natural-number requirements rhjr_{hj}rhj​, and an acyclic precedence relation, such that:

  • there are m=2m = 2m=2 machines, both with speed qi=1q_i = 1qi​=1, so every processing time is 111;
  • there are no precedence arcs;
  • rhj≤shr_{hj} \le s_hrhj​≤sh​ for every resource hhh and every job jjj.

Let GGG be the graph on the jobs in which j≠kj \ne kj=k are adjacent if and only if rhj+rhk≤shr_{hj} + r_{hk} \le s_hrhj​+rhk​≤sh​ for every hhh.

Let SSS be a subgraph of GGG that is a matching: every vertex of SSS has exactly one neighbour in SSS. Assume SSS is of maximum size: every matching subgraph S′S'S′ of GGG has at most as many edges as SSS. Write ∣S∣|S|∣S∣ for the number of edges of SSS.

A schedule gives each job jjj a machine and a real start SjS_jSj​, with Cj=Sj+1C_j = S_j + 1Cj​=Sj​+1. It is feasible if:

  • Sj≥0S_j \ge 0Sj​≥0;
  • distinct jobs on one machine have Cj≤SkC_j \le S_kCj​≤Sk​ or Ck≤SjC_k \le S_jCk​≤Sj​;
  • precedence is respected (vacuous here);
  • at every real ttt, the jobs with Sj≤t<CjS_j \le t < C_jSj​≤t<Cj​ satisfy ∑rhj≤sh\sum r_{hj} \le s_h∑rhj​≤sh​ for every hhh.

Cmax⁡C_{\max}Cmax​ is the largest CjC_jCj​, or 000 if n=0n = 0n=0.

Conclusion.

  1. Some feasible schedule has Cmax⁡=n−∣S∣C_{\max} = n - |S|Cmax​=n−∣S∣, computed as a real number.
  2. Every feasible schedule has Cmax⁡≥n−∣S∣C_{\max} \ge n - |S|Cmax​≥n−∣S∣.

Degenerate cases.

  • If n=0n = 0n=0, SSS has no edges and the claim is Cmax⁡=0C_{\max} = 0Cmax​=0 for the empty schedule.
  • If l=0l = 0l=0, GGG is complete and the resource condition is vacuous.
  • The subtraction is in R\mathbb{R}R, so no truncation occurs.
  • The hypotheses are satisfiable: a maximum matching always exists since GGG is finite.
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