Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

PROOF, p. 689 — from (1)–(3): N_r(y) = N_o(y) − 1 for C_r(j) ≤ y < min[C_o(k), C_o(j)], and N_r(y) = N_o(y) otherwise

Proved
SchrageSRPT.Opt.num_in_system_of_completions

by mikedeng1 · Oct 6, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-in-systemp2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-paperp2o-v1schedulingsrpt

Let δo\delta_oδo​ and δr\delta_rδr​ be two schedules of the same arrival stream, in which only finitely many jobs arrive by any given time. Let j≠kj \ne kj=k be jobs such that

  1. Co(i)=Cr(i)C_o(i) = C_r(i)Co​(i)=Cr​(i) for every i≠j,ki \ne j, ki=j,k;
  2. min⁡[Cr(k),Cr(j)]<min⁡[Co(k),Co(j)]\min[C_r(k), C_r(j)] < \min[C_o(k), C_o(j)]min[Cr​(k),Cr​(j)]<min[Co​(k),Co​(j)];
  3. max⁡[Cr(k),Cr(j)]=max⁡[Co(k),Co(j)]\max[C_r(k), C_r(j)] = \max[C_o(k), C_o(j)]max[Cr​(k),Cr​(j)]=max[Co​(k),Co​(j)];

and jjj is the first of the two to complete under δr\delta_rδr​: Cr(j)≤Cr(k)C_r(j) \le C_r(k)Cr​(j)≤Cr​(k). Then for every time yyy,

Nr(y)=No(y)−1if Cr(j)≤y<min⁡[Co(k),Co(j)],Nr(y)=No(y)otherwise.N_r(y) = N_o(y) - 1 \quad\text{if } C_r(j) \le y < \min[C_o(k), C_o(j)], \qquad N_r(y) = N_o(y) \quad\text{otherwise}.Nr​(y)=No​(y)−1if Cr​(j)≤y<min[Co​(k),Co​(j)],Nr​(y)=No​(y)otherwise.

This is the counting step of the letter's PROOF: it turns relations (1)–(3) on completion times into a comparison of the numbers of jobs in system, showing that the revised schedule has at most as many jobs in system at every time.

Formalization Note. The letter writes the interval as Cr(j)≤y≤min⁡[Co(k),Co(j)]C_r(j) \le y \le \min[C_o(k), C_o(j)]Cr​(j)≤y≤min[Co​(k),Co​(j)]. At y=min⁡[Co(k),Co(j)]y = \min[C_o(k), C_o(j)]y=min[Co​(k),Co​(j)] the job completing then under δo\delta_oδo​ has already left the system (a job is in system on [A(n),C(n))[A(n), C(n))[A(n),C(n))), so the two counts are equal there; the statement uses the half-open interval. The difference is written Nr(y)+1=No(y)N_r(y) + 1 = N_o(y)Nr​(y)+1=No​(y) in natural numbers. Local finiteness of arrivals is added so that NNN is a genuine count. Completion times take values in R∪{+∞}\mathbb R \cup \{+\infty\}R∪{+∞}.

Preamble
import Mathlib
import Definitions.Def_SchrageSRPT_Opt_Model
Formal statement
namespace SchrageSRPT.Opt
theorem num_in_system_of_completions (A P : ℕ → ℝ) (hfin : ∀ t : ℝ, {n | A n ≤ t}.Finite)
    (δo δr : ℕ → ℝ → ℝ) (hδo : IsSchedule A δo) (hδr : IsSchedule A δr)
    (j k : ℕ) (hjk : j ≠ k)
    (h1 : ∀ i, i ≠ j → i ≠ k → completion A P δo i = completion A P δr i)
    (h2 : min (completion A P δr k) (completion A P δr j) <
      min (completion A P δo k) (completion A P δo j))
    (h3 : max (completion A P δr k) (completion A P δr j) =
      max (completion A P δo k) (completion A P δo j))
    (hjr : completion A P δr j ≤ completion A P δr k) :
    ∀ y : ℝ,
      (completion A P δr j ≤ (y : WithTop ℝ) ∧
          (y : WithTop ℝ) < min (completion A P δo k) (completion A P δo j) →
        numInSystem A P δr y + 1 = numInSystem A P δo y) ∧
      (¬ (completion A P δr j ≤ (y : WithTop ℝ) ∧
          (y : WithTop ℝ) < min (completion A P δo k) (completion A P δo j)) →
        numInSystem A P δr y = numInSystem A P δo y) := by sorry
end SchrageSRPT.Opt
Source
Schrage, A proof of the optimality of the shortest remaining processing time discipline, Oper. Res. 16 (1968), p. 689, PROOF, relations (1)–(3) and the sentence "Thus, N_r(y) = N_o(y) − 1 for C_r(j) ≦ y ≦ min[C_o(k), C_o(j)], and N_r(y) = N_o(y) otherwise"
Human review
  • Endorsed by Shuze Chen · Oct 6, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 6, 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