Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 8 — optimality conditions (5a)–(5f) for the Hitchcock problem

Proved
EdmondsKarp.Scaling.extreme_iff_potentials

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

linear-programming-dualityminimum-cost-flowp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1transportation-problem

Consider the Hitchcock network of Figure 1 with m,n≥1m, n \ge 1m,n≥1, positive capacities ai>0a_i > 0ai​>0, bj>0b_j > 0bj​>0 satisfying ∑iai=∑jbj\sum_i a_i = \sum_j b_j∑i​ai​=∑j​bj​, and nonnegative costs dij≥0d_{ij} \ge 0dij​≥0. Let fff be a maximum flow. Then fff is extreme (of minimum cost among the maximum flows) if and only if there exist real numbers u0,u1,…,umu_0, u_1, \dots, u_mu0​,u1​,…,um​ and v0,v1,…,vnv_0, v_1, \dots, v_nv0​,v1​,…,vn​ such that, for all i=1,…,mi = 1,\dots,mi=1,…,m and j=1,…,nj = 1,\dots,nj=1,…,n,

ui−vj+dij≥0,(5a)ui−vj+dij>0⇒fij=0,(5b)u0>ui⇒f0i=0,(5c)u0<ui⇒f0i=ai,(5d)vj>v0⇒fj0=0,(5e)vj<v0⇒fj0=bj.(5f)\begin{aligned} &u_i - v_j + d_{ij} \ge 0, && (5a)\\ &u_i - v_j + d_{ij} > 0 \Rightarrow f_{ij} = 0, && (5b)\\ &u_0 > u_i \Rightarrow f_{0i} = 0, && (5c)\\ &u_0 < u_i \Rightarrow f_{0i} = a_i, && (5d)\\ &v_j > v_0 \Rightarrow f_{j0} = 0, && (5e)\\ &v_j < v_0 \Rightarrow f_{j0} = b_j. && (5f) \end{aligned}​ui​−vj​+dij​≥0,ui​−vj​+dij​>0⇒fij​=0,u0​>ui​⇒f0i​=0,u0​<ui​⇒f0i​=ai​,vj​>v0​⇒fj0​=0,vj​<v0​⇒fj0​=bj​.​​(5a)(5b)(5c)(5d)(5e)(5f)​

This is the specialization to the transportation network of the characterization of minimum-cost flows by labeling functions (ui=π(si)u_i = \pi(s_i)ui​=π(si​), vj=π(tj)v_j = \pi(t_j)vj​=π(tj​), u0=π(s)u_0 = \pi(s)u0​=π(s), v0=π(t)v_0 = \pi(t)v0​=π(t)). It is the certificate of optimality that the scaling method maintains.

Formalization Note The page prints the second family as "v0,v1,…,vmv_0, v_1, \dots, v_mv0​,v1​,…,vm​"; the conditions index vvv by j=0,…,nj = 0, \dots, nj=0,…,n, which is what is stated. "Extreme among maximum flows" is formalized with fff assumed to be a maximum flow: without that assumption the "if" direction would fail, since the zero flow satisfies (5a)–(5f) for suitable potentials. For a maximum flow, extreme (minimum cost among flows of the same value) is the same as minimum cost among maximum flows. The potentials are real numbers.

Preamble
import Mathlib
import Definitions.Def_EdmondsKarp_Scaling_Transport
Formal statement
namespace EdmondsKarp.Scaling

/-- Theorem 8 (p. 259). For the Hitchcock network of Figure 1 with positive capacities `a_i`, `b_j`,
`∑ a_i = ∑ b_j` and nonnegative costs `d_ij`, a maximum flow `f` is extreme (of minimum cost among
the maximum flows) if and only if there exist real `u_0, u_1, …, u_m` and `v_0, v_1, …, v_n` with
(5a)–(5f). The page prints `v_0, …, v_m`; the index of `v` runs over `0, …, n` as (5a)–(5f) show.
"Extreme among maximum flows" is read with `f` ranging over maximum flows (hypothesis `hx`): the zero
flow satisfies (5a)–(5f) for suitable potentials but is not maximum. -/
theorem extreme_iff_potentials {m n : ℕ} (hm : 1 ≤ m) (hn : 1 ≤ n) (T : Transport m n)
    (ha : ∀ i, 0 < T.a i) (hb : ∀ j, 0 < T.b j) (hsum : ∑ i, T.a i = ∑ j, T.b j)
    (hd : ∀ i j, 0 ≤ T.d i j) (x : Flow m n) (hx : IsMaxFlow T x) :
    IsExtreme T x ↔
      ∃ (u0 : ℝ) (u : Fin m → ℝ) (v0 : ℝ) (v : Fin n → ℝ),
        (∀ i j, 0 ≤ u i - v j + T.d i j) ∧
        (∀ i j, 0 < u i - v j + T.d i j → x.fx i j = 0) ∧
        (∀ i, u0 > u i → x.f0 i = 0) ∧
        (∀ i, u0 < u i → x.f0 i = T.a i) ∧
        (∀ j, v j > v0 → x.fz j = 0) ∧
        (∀ j, v j < v0 → x.fz j = T.b j) := by sorry

end EdmondsKarp.Scaling
Source
Edmonds, Karp, Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems, J. ACM 19(2), 1972, p. 259, Theorem 8, (5a)–(5f)
Read-back

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

Setting. Let m≥1m\ge1m≥1 and n≥1n\ge1n≥1. Let T=(a,b,d)T=(a,b,d)T=(a,b,d) be a transport problem.

Hypotheses on the data.

  • ai>0a_i>0ai​>0 for all iii, and bj>0b_j>0bj​>0 for all jjj;
  • ∑iai=∑jbj\sum_i a_i = \sum_j b_j∑i​ai​=∑j​bj​;
  • dij≥0d_{ij}\ge 0dij​≥0 for all i,ji,ji,j.

Hypothesis on xxx. xxx is a maximum flow for TTT. That is, xxx is a flow (nonnegative components, f0i≤aif_{0i}\le a_if0i​≤ai​, fj0≤bjf_{j0}\le b_jfj0​≤bj​, conservation at every node) with r(y)≤r(x)r(y)\le r(x)r(y)≤r(x) for every flow yyy.

Conclusion. xxx is extreme if and only if certain potentials exist. Being extreme means ∑i,jdijfij≤∑i,jdijgij\sum_{i,j} d_{ij} f_{ij} \le \sum_{i,j} d_{ij} g_{ij}∑i,j​dij​fij​≤∑i,j​dij​gij​ for every flow y=(g)y=(g)y=(g) with the same return value as xxx. The potentials are reals u0u_0u0​, u1,…,umu_1,\dots,u_mu1​,…,um​, v0v_0v0​ and v1,…,vnv_1,\dots,v_nv1​,…,vn​ such that, for all i,ji,ji,j:

(5a)ui−vj+dij≥0,(5b)ui−vj+dij>0  ⟹  fij=0,(5c)u0>ui  ⟹  f0i=0,(5d)u0<ui  ⟹  f0i=ai,(5e)vj>v0  ⟹  fj0=0,(5f)vj<v0  ⟹  fj0=bj.\begin{aligned} &\text{(5a)}\quad u_i - v_j + d_{ij} \ge 0,\\ &\text{(5b)}\quad u_i - v_j + d_{ij} > 0 \implies f_{ij}=0,\\ &\text{(5c)}\quad u_0 > u_i \implies f_{0i} = 0,\\ &\text{(5d)}\quad u_0 < u_i \implies f_{0i} = a_i,\\ &\text{(5e)}\quad v_j > v_0 \implies f_{j0} = 0,\\ &\text{(5f)}\quad v_j < v_0 \implies f_{j0} = b_j. \end{aligned}​(5a)ui​−vj​+dij​≥0,(5b)ui​−vj​+dij​>0⟹fij​=0,(5c)u0​>ui​⟹f0i​=0,(5d)u0​<ui​⟹f0i​=ai​,(5e)vj​>v0​⟹fj0​=0,(5f)vj​<v0​⟹fj0​=bj​.​

No condition links u0u_0u0​ with v0v_0v0​, or constrains either one beyond (5c)–(5f).

Degenerate cases. The hypotheses exclude m=0m=0m=0 and n=0n=0n=0. The positivity hypotheses exclude zero capacities. The equivalence is asserted only for maximum flows xxx.

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