Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

p. 67, (III) ⟺ (IV) — interchanging adjacent items

Proved
JohnsonFlowShop.ThreeStage.interchange_iff

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

flow-shopjohnson-rulep2o-batch-p200bp2o-gran-per-chapterp2o-plan-paperp2o-v1scheduling

Let Ai,Bi,CiA_i, B_i, C_iAi​,Bi​,Ci​ be real numbers and σ\sigmaσ an ordering of the items. Let jjj and j+1j+1j+1 be adjacent positions and let σ′\sigma'σ′ be σ\sigmaσ with the items in these two positions interchanged; write H′,K′H', K'H′,K′ for the quantities of σ′\sigma'σ′. Then

  1. Hv′=HvH'_v = H_vHv′​=Hv​ and Kv′=KvK'_v = K_vKv′​=Kv​ for every position v∉{j,j+1}v \notin \{j, j+1\}v∈/{j,j+1};
  2. relation (III),
max⁡(Hj+1+Kj+1, Hj+Kj)<max⁡(Hj+1′+Kj+1′, Hj′+Kj′),\max\bigl(H_{j+1} + K_{j+1},\ H_j + K_j\bigr) < \max\bigl(H'_{j+1} + K'_{j+1},\ H'_j + K'_j\bigr),max(Hj+1​+Kj+1​, Hj​+Kj​)<max(Hj+1′​+Kj+1′​, Hj′​+Kj′​),

holds if and only if relation (IV) holds for the items a=σ(j)a = \sigma(j)a=σ(j) and b=σ(j+1)b = \sigma(j+1)b=σ(j+1):

min⁡(Aa+Ba, Cb+Bb)<min⁡(Ab+Bb, Ca+Ba).\min\bigl(A_a + B_a,\ C_b + B_b\bigr) < \min\bigl(A_b + B_b,\ C_a + B_a\bigr).min(Aa​+Ba​, Cb​+Bb​)<min(Ab​+Bb​, Ca​+Ba​).

Relation (III) says that, in the special case min⁡A≥max⁡B\min A \ge \max BminA≥maxB, keeping the jjj-th item before the (j+1)(j+1)(j+1)-st gives a strictly smaller elapsed time than interchanging them; (IV) is the same condition in terms of the two items alone.

Formalization Note The equivalence is pure algebra and is stated for arbitrary real times, without positivity and without the special-case hypothesis; this is stronger than what the page needs. Positions are 0-based (k = j + 1), and σ′=σ∘(j k)\sigma' = \sigma \circ (j\ k)σ′=σ∘(j k).

Preamble
import Mathlib
import Definitions.Def_JohnsonFlowShop_Shared_K
import Definitions.Def_JohnsonFlowShop_ThreeStage_H
Formal statement
namespace JohnsonFlowShop.ThreeStage

/-- p. 67, (III) ⟺ (IV): let `σ'` be the order `σ` with the items in the adjacent positions
`j` and `k = j + 1` interchanged. Then `H` and `K` are unchanged at every other position, and
`max (H_k + K_k, H_j + K_j) < max (H'_k + K'_k, H'_j + K'_j)` (relation (III)) holds if and
only if `min (A_{σ j} + B_{σ j}, C_{σ k} + B_{σ k}) < min (A_{σ k} + B_{σ k}, C_{σ j} + B_{σ j})`
(relation (IV)). This holds for arbitrary real processing times. -/
theorem interchange_iff {n : ℕ} (A B C : Fin n → ℝ) (σ : Equiv.Perm (Fin n))
    (j k : Fin n) (hjk : k.val = j.val + 1) :
    let σ' := σ * Equiv.swap j k
    (∀ v : Fin n, v ≠ j → v ≠ k → H B C σ' v = H B C σ v ∧ Shared.K A B σ' v = Shared.K A B σ v) ∧
    (max (H B C σ k + Shared.K A B σ k) (H B C σ j + Shared.K A B σ j) <
        max (H B C σ' k + Shared.K A B σ' k) (H B C σ' j + Shared.K A B σ' j) ↔
      min (A (σ j) + B (σ j)) (C (σ k) + B (σ k)) <
        min (A (σ k) + B (σ k)) (C (σ j) + B (σ j))) := by sorry

end JohnsonFlowShop.ThreeStage
Source
Johnson, Optimal Two- and Three-Stage Production Schedules with Setup Times Included, NRLQ 1(1) 1954, p. 67, Special case where min A_i ≥ max B_j, relations (III) and (IV); p. 66 ("the H's and K's are unchanged except possibly those with subscripts j and j+1")
Human review
  • Endorsed by Shuze Chen · Oct 1, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 1, 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 paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me