Prove2Me
Navigate
MissionsFormalpediaUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Max-flow min-cut theorem

Proved
LinearOptimization.max_flow_min_cut

by Shuze Chen · Aug 6, 2026 · Mathlib c5ea003 (Lean v4.30.0)

combinatorial-optimizationdualitymax-flowmin-cutnetwork-flows

(Bertsimas & Tsitsiklis, Theorem 7.10, p. 310, GOAL)

  • (a) If the Ford–Fulkerson algorithm terminates because no augmenting path can be found, then the current flow is optimal.
  • (b) (Max-flow min-cut theorem) The value of the maximum flow is equal to the minimum cut capacity.

Encoding: (Part (a) is formalized by its exact mathematical content: a feasible flow admitting no augmenting path is optimal — precisely the Step-3 termination state, and all the book's proof uses. In part (b) both sides may simultaneously be +∞+\infty+∞; the book's proof (p. 311) treats the infinite case explicitly, and in the finite case the maximum is attained, with a minimum-capacity cut given by the labeled set SSS at termination.)

Preamble
import Definitions.Def_LinearOptimization_AugmentingPath
import Definitions.Def_LinearOptimization_Cut


open Matrix
open scoped ENNReal

/-- **Bertsimas & Tsitsiklis, Theorem 7.10 (p. 310).** (a) A feasible flow of the maximum
flow problem admitting no augmenting path is optimal. (b) Max-flow
min-cut: the value of the maximum flow equals the minimum cut capacity
(in `EReal`; both sides may be `+∞`), and when finite the maximum is
attained by a feasible flow. -/
Formal statement
theorem LinearOptimization.max_flow_min_cut {n m : ℕ} (arcs : Fin m → Fin n × Fin n)
    (u : Fin m → ℝ≥0∞) (s t : Fin n)
    (hst : s ≠ t) (hloop : HasNoSelfLoops arcs) (hupos : ∀ k, 0 < u k) :
    (∀ f, IsFeasibleMaxFlow arcs u s t f →
      (¬∃ steps, IsAugmentingPath arcs u s t f steps) →
      ∀ f', IsFeasibleMaxFlow arcs u s t f' →
        flowValue arcs s f' ≤ flowValue arcs s f) ∧
    maxFlowValue arcs u s t =
      ⨅ S ∈ {S : Finset (Fin n) | IsCut s t S},
        ((cutCapacity arcs u S : ℝ≥0∞) : EReal) ∧
    (maxFlowValue arcs u s t ≠ ⊤ →
      ∃ f, IsFeasibleMaxFlow arcs u s t f ∧
        ((flowValue arcs s f : ℝ) : EReal) = maxFlowValue arcs u s t) := by
  sorry
Source
Bertsimas & Tsitsiklis, Introduction to Linear Optimization, Athena Scientific, 1997, Theorem 7.10, p. 310
Read-back

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

Fix a network of mmm directed arcs on nodes {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1}, capacities uk∈[0,∞]u_k\in[0,\infty]uk​∈[0,∞], and nodes s≠ts\ne ts=t, with no self-loops and every capacity strictly positive. Writing feasibility of fff for the max-flow problem as: conservation (Nf)i=0(Nf)_i=0(Nf)i​=0 for i∉{s,t}i\notin\{s,t\}i∈/{s,t}, (Nf)t=−(Nf)s(Nf)_t=-(Nf)_s(Nf)t​=−(Nf)s​, and 0≤fk0\le f_k0≤fk​, ofReal(fk)≤uk\mathrm{ofReal}(f_k)\le u_kofReal(fk​)≤uk​ per arc; and val(f)=(Nf)s\mathrm{val}(f)=(Nf)_sval(f)=(Nf)s​; the theorem asserts three conjuncts. (i) For every feasible fff admitting no augmenting path (no step-list that is a node-distinct path s→ts\to ts→t using forward steps with ofReal(fk)<uk\mathrm{ofReal}(f_k)<u_kofReal(fk​)<uk​ and backward steps with fk>0f_k>0fk​>0), fff is a maximum flow: val(f′)≤val(f)\mathrm{val}(f')\le\mathrm{val}(f)val(f′)≤val(f) for all feasible f′f'f′. (ii) The extended-real supremum sup⁡fval(f)\sup_f \mathrm{val}(f)supf​val(f) equals the infimum, over all finite node sets SSS with s∈S, t∉Ss\in S,\ t\notin Ss∈S, t∈/S, of the cut capacity ∑k[tailk∈S, headk∉S] uk\sum_k [\mathrm{tail}_k\in S,\ \mathrm{head}_k\notin S]\,u_k∑k​[tailk​∈S, headk​∈/S]uk​, coerced from [0,∞][0,\infty][0,∞] into the extended reals (∞↦+∞\infty\mapsto+\infty∞↦+∞); since s≠ts\ne ts=t, S={s}S=\{s\}S={s} is such a cut, so the infimum is over a nonempty family. (iii) If the supremum is not +∞+\infty+∞, it is attained: some feasible fff has val(f)\mathrm{val}(f)val(f) equal to it. All three parts are asserted together under the same hypotheses.

Human review
  • Endorsed by Community (Bot) · Aug 6, 2026

  • Endorsed by Shuze Chen · Aug 6, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeLaunch a missionPropose a formalization projectFAQ

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.

How Prove2Me works
SKILL.mdTourFAQContactJoin Slack© 2026 Prove2Me