Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 2 — maximum-augmentation paths reach a maximum flow within 1+log⁡M/(M−1)f∗(t,s)1 + \log_{M/(M-1)} f^*(t,s)1+logM/(M−1)​f∗(t,s) augmentations

Proved
EdmondsKarp.MaxCapacity.maximum_augmentation_bound

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

augmenting-pathscomplexitymaximum-flownetwork-flowsp2o-batch-p100bp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let NNN be a network in which every capacity is an integer. Let M>1M > 1M>1 be an integer such that, for every partition of the nodes of NNN into two sets XXX and Xˉ\bar XXˉ with s∈Xs \in Xs∈X and t∈Xˉt \in \bar Xt∈Xˉ, the number of arcs of NNN with one end in XXX and the other in Xˉ\bar XXˉ is at most MMM. Let f∗(t,s)f^*(t,s)f∗(t,s) be the value of a maximum flow in NNN.

Consider a run of the labeling method: flows f0,f1,…,fKf^0, f^1, \dots, f^Kf0,f1,…,fK, where f0f^0f0 is integer-valued (for instance the zero flow) and, for each k<Kk < Kk<K, fk+1f^{k+1}fk+1 is obtained from fkf^kfk by augmenting along an augmenting path relative to fkf^kfk that gives the maximum possible augmentation. Then:

  1. the number of augmentations satisfies
K  ≤  1+log⁡M/(M−1)f∗(t,s);K \;\le\; 1 + \log_{M/(M-1)} f^*(t,s);K≤1+logM/(M−1)​f∗(t,s);
  1. if there is no augmenting path relative to fKf^KfK, then fKf^KfK is a maximum flow.

Together the two parts say that the labeling method with the largest-augmentation rule stops at a maximum flow after at most 1+log⁡M/(M−1)f∗(t,s)1 + \log_{M/(M-1)} f^*(t,s)1+logM/(M−1)​f∗(t,s) augmentations — a bound that depends on the capacities only logarithmically, in contrast with the bound f∗(t,s)f^*(t,s)f∗(t,s) that holds for an arbitrary choice of augmenting paths.

Formalization Note The maximum flow ggg with f∗(t,s)=g(t,s)f^*(t,s) = g(t,s)f∗(t,s)=g(t,s) is taken as a hypothesis; this is not restrictive, since every network has a maximum flow (the set of flows is nonempty and compact). The logarithm is Real.logb (M / (M - 1)) with MMM cast to R\mathbb RR; when f∗(t,s)=0f^*(t,s) = 0f∗(t,s)=0 Lean's Real.logb returns 000 and the bound reads K≤1K \le 1K≤1, which is the paper's statement in that case since no augmentation is then possible. The crossing arcs counted by MMM are the arcs of NNN, the return arc included (the literal reading of p. 253). The initial flow must be integer-valued on the arcs of NNN; the paper starts from the zero flow (p. 250) and uses its integrality (p. 254).

Preamble
import Mathlib
import Definitions.Def_EdmondsKarp_MaxCapacity_Network
import Definitions.Def_EdmondsKarp_MaxCapacity_Augmentation
import Definitions.Def_EdmondsKarp_MaxCapacity_Run
Formal statement
namespace EdmondsKarp.MaxCapacity

/-- **Theorem 2** (Edmonds–Karp 1972, p. 253). Let `N` be a network with integer capacities and let
`M > 1` be an integer such that every partition of the nodes into `X ∋ s` and `X̄ ∋ t` has at most `M`
arcs of `N` with one end in `X` and the other in `X̄`; let `f*(t, s)` be the value of a maximum flow.
If the labeling method, started from an integer-valued flow `f^0`, performs `K` augmentations, each
along an augmenting path giving the maximum possible augmentation, then
(a) `K ≤ 1 + log_{M/(M−1)} f*(t, s)`, and
(b) if there is no augmenting path relative to `f^K`, then `f^K` is a maximum flow. -/
theorem maximum_augmentation_bound {V : Type} [Fintype V] [DecidableEq V] (N : Network V)
    (hcap : IntegralCaps N) (M : ℕ) (hM : 1 < M) (hcross : CrossArcsBounded N M)
    (g : V → V → ℝ) (hg : IsMaxFlow N g)
    (K : ℕ) (f : ℕ → V → V → ℝ) (P : ℕ → List V) (hrun : IsMaxAugRun N K f P)
    (hint : IsIntegralOn N (f 0)) :
    (K : ℝ) ≤ 1 + Real.logb ((M : ℝ) / ((M : ℝ) - 1)) (g N.t N.s) ∧
      ((¬ ∃ Q : List V, IsAugPath N (f K) Q) → IsMaxFlow N (f K)) := by sorry

end EdmondsKarp.MaxCapacity
Source
Edmonds, Karp, Theoretical Improvements in Algorithmic Efficiency for Network Flow Problems, J. ACM 19(2), 1972, p. 253, §1.3, Theorem 2 (with the hypotheses on N, M and f*(t, s) stated just before it)
Read-back

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

Let VVV be a finite type of vertices with decidable equality, and let NNN be a network on VVV in the sense of the imported Network structure. The network has a distinguished source vertex s=N.ss = N.ss=N.s and sink vertex t=N.tt = N.tt=N.t. None of the definitions this statement uses are included in the code shown (Network, IntegralCaps, CrossArcsBounded, IsMaxFlow, IsMaxAugRun, IsIntegralOn, IsAugPath). Their meanings are fixed by those imported files, and this read-back refers to them only by name. The theorem makes the following assumptions:

  • NNN satisfies the predicate IntegralCaps.
  • MMM is a natural number with M>1M > 1M>1, so M≥2M \ge 2M≥2.
  • NNN and MMM together satisfy the predicate CrossArcsBounded.
  • g:V×V→Rg : V \times V \to \mathbb{R}g:V×V→R is a real-valued function on ordered pairs of vertices, and it satisfies IsMaxFlow for NNN.
  • KKK is a natural number.
  • f=(fk)k∈Nf = (f_k)_{k \in \mathbb{N}}f=(fk​)k∈N​ is a sequence of functions fk:V×V→Rf_k : V \times V \to \mathbb{R}fk​:V×V→R.
  • P=(Pk)k∈NP = (P_k)_{k \in \mathbb{N}}P=(Pk​)k∈N​ is a sequence of finite lists of vertices.
  • NNN, KKK, fff and PPP together satisfy IsMaxAugRun. The code does not show which indices kkk this constrains.
  • f0f_0f0​ satisfies IsIntegralOn with respect to NNN. No such hypothesis is made about any other fkf_kfk​.

Under these assumptions the theorem asserts both of the following:

  1. The number KKK, viewed as a real number, satisfies
K  ≤  1+log⁡M/(M−1) g(t,s),K \;\le\; 1 + \log_{M/(M-1)}\, g(t,s),K≤1+logM/(M−1)​g(t,s),

where log⁡bx=ln⁡xln⁡b\log_b x = \dfrac{\ln x}{\ln b}logb​x=lnblnx​ is Mathlib's real logarithm to base bbb. The argument is literally the value of ggg at the ordered pair (sink, source), that is g(t,s)g(t,s)g(t,s) and not g(s,t)g(s,t)g(s,t). No statement here relates g(t,s)g(t,s)g(t,s) to a flow value. 2. If no finite list QQQ of vertices satisfies IsAugPath for NNN and the function fKf_KfK​, then fKf_KfK​ satisfies IsMaxFlow for NNN. This is an implication only: it says nothing when such a list exists. The list QQQ ranges over all finite lists, including the empty list.

Degenerate cases:

  • Vertex set. VVV cannot be empty in practice, because NNN names the vertices sss and ttt. Whether s=ts = ts=t is allowed, and whether VVV may have exactly one element, depends on the unshown definition of Network.

  • Logarithm base. M≥2M \ge 2M≥2, so the base M/(M−1)M/(M-1)M/(M−1) lies in (1,2](1, 2](1,2] and has a positive logarithm. For M=2M = 2M=2 the base is 222.

  • Junk values of the logarithm. Mathlib's ln⁡\lnln is defined on all reals by ln⁡0=0\ln 0 = 0ln0=0 and ln⁡x=ln⁡∣x∣\ln x = \ln |x|lnx=ln∣x∣. So:

    • If g(t,s)=0g(t,s) = 0g(t,s)=0, the bound reads K≤1K \le 1K≤1.
    • If g(t,s)<0g(t,s) < 0g(t,s)<0, the bound is K≤1+log⁡M/(M−1)∣g(t,s)∣K \le 1 + \log_{M/(M-1)} |g(t,s)|K≤1+logM/(M−1)​∣g(t,s)∣.
    • If 0<∣g(t,s)∣<10 < |g(t,s)| < 10<∣g(t,s)∣<1, the logarithm is negative and the bound is strictly below 111.

    Which of these can happen depends on the unshown predicates IsMaxFlow and IntegralCaps.

  • K=0K = 0K=0. Part 1 becomes 0≤1+log⁡M/(M−1)g(t,s)0 \le 1 + \log_{M/(M-1)} g(t,s)0≤1+logM/(M−1)​g(t,s). Part 2 then concerns f0f_0f0​ itself.

  • Values of fff beyond KKK. The entries fkf_kfk​ and PkP_kPk​ for k>Kk > Kk>K appear only through IsMaxAugRun, and the code does not show how that predicate treats them.

  • Vacuous hypotheses. If the hypotheses cannot all hold together, the theorem is vacuously true. Examples: no ggg satisfies IsMaxFlow, CrossArcsBounded fails for every M≥2M \ge 2M≥2, or IsMaxAugRun cannot hold together with IsIntegralOn for f0f_0f0​. Nothing in the displayed code rules this out.

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