Integral Network Flows and the Max-Flow / Min-Cut Theorem #
Formalizes finite directed flow networks with non-negative integral arc capacities, feasible
integral flows, s-t cuts, residual networks, simple augmenting paths, and the Ford–Fulkerson
Max-Flow / Min-Cut Theorem ([FF56], Theorem 1, pp. 400–402; [FF62],
Chapter I, Sections 4–8; [CLRS09], Sections 26.1–26.2, Theorem 26.6).
Model and source mapping #
- Flow network (
Network V): directed capacitiescap : V → V → ℕ(0for absent arcs) with designated sources : Vand sinkt : V. Unlike [CLRS09], Section 26.1, which forbids antiparallel arcs,Network Vpermits arbitrary antiparallel capacitiescap u vandcap v u(as in [EK72], Section 1.1, p. 249) as well as arcs enteringsor leavingt. - Feasible flow (
Network.Flow): non-negative integral arc flowf : V → V → ℕbounded bycap(f u v ≤ cap u v) and satisfying inflow-equals-outflow conservation∑ u, f u v = ∑ w, f v wat every intermediate vertexv ≠ s, t. Its netvalue : ℤis the net outflow froms((∑ w, (f s w : ℤ)) - (∑ u, (f u s : ℤ))). - Residual capacity (
Flow.resCap):resCap f u v = (cap u v - f u v) + f v u, combining unused forward capacity on(u, v)with cancellable reverse flow on(v, u). - Source comparison: [FF56], pp. 399–402 states Theorem 1 (Minimal cut theorem)
in the chain-flow / disconnecting-arc-set model; here we formalize the equivalent arc-flow,
residual-network, and vertex-partition
s-tcut formulation of [FF62], Chapter I, Sections 4–8 and [CLRS09], Theorem 26.6, specialized to non-negative integral capacitiesℕ.
Main definitions #
Cslib.Algorithms.Lean.MaxFlow.Network: integral directed flow network on vertex typeV(with equivalence transportNetwork.reindex).Cslib.Algorithms.Lean.MaxFlow.Network.Flow: feasible integral flow onN.Cslib.Algorithms.Lean.MaxFlow.Network.IsCut,Network.cutCapacity,Network.IsMinCut: vertex-partitions-tcuts and their forward capacities.Cslib.Algorithms.Lean.MaxFlow.Network.Flow.resCap: residual arc capacity.Cslib.Algorithms.Lean.MaxFlow.pathArcs,Flow.IsAugmentingPath,Flow.bottleneck,Flow.augment: simple residuals-taugmenting paths and bottleneck flow augmentation.Cslib.Algorithms.Lean.MaxFlow.Network.Flow.reachableCut: residual-reachabilitys-tcut.
Main results #
Cslib.Algorithms.Lean.MaxFlow.Network.Flow.value_eq_netFlow_across_cut: net flow across anys-tcut equalsf.value.Cslib.Algorithms.Lean.MaxFlow.Network.Flow.value_le_cutCapacity: weak duality (f.value ≤ cutCapacity Sfor every feasible flowfands-tcutS).Cslib.Algorithms.Lean.MaxFlow.Network.Flow.value_eq_cutCapacity_of_resCap_eq_zero: a flow with no residual capacity leaving a cut has the cut's capacity as value.Cslib.Algorithms.Lean.MaxFlow.Network.Flow.isMaxFlow_iff_not_exists_augmentingPathandisMaxFlow_iff_exists_cut_value_eq: Ford–Fulkerson optimality characterizations.Cslib.Algorithms.Lean.MaxFlow.Network.exists_maxFlow_eq_minCut: existence of an integral maximum flow and minimums-tcut of equal value whenN.s ≠ N.t.Cslib.Algorithms.Lean.MaxFlow.Network.Flow.value_eq_zero_of_s_eq_t: every flow has value0whenN.s = N.t.Cslib.Algorithms.Lean.MaxFlow.forall_mem_pathArcs_iff_isChain,exists_list_of_reflTransGen,exists_nodup_list_of_reflTransGen,reflTransGen_of_pathArcs: the bridge betweenpathArcs,List.IsChainandRelation.ReflTransGen.Cslib.Algorithms.Lean.MaxFlow.exists_mem_pathArcs_boundary,exists_mem_pathArcs_snd_eq: a vertex list leaving a set has a boundary arc, and every non-head vertex is entered by an arc.
References #
Constructive loop erasure turning any walk into a duplicate-free (Nodup) simple path with the
same endpoints and a subset of directed arcs.
Instances For
The consecutive pairs of p are all r-steps iff p is an r-chain (List.IsChain).
A reflexive–transitive chain of r-steps from u to v is realized by a vertex list from u
to v whose consecutive pairs are r-steps (List.exists_isChain_ne_nil_of_relationReflTransGen
in pathArcs form).
A vertex list from u to v whose consecutive pairs are r-steps gives a
reflexive–transitive chain of r-steps (List.relationReflTransGen_of_exists_isChain in
pathArcs form).
A vertex list starting inside a predicate S and ending outside it has a consecutive arc
leaving S.
A reflexive–transitive chain of r-steps from u to v is realized by a duplicate-free
vertex list from u to v whose consecutive pairs are r-steps (loop erasure).
Forward capacity of an s-t cut S: total capacity of arcs from S to Finset.univ \ S.
Instances For
S is a minimum s-t cut if it is an s-t cut of minimum cutCapacity.
Instances For
A feasible integral flow on N: non-negative arc flows bounded by N.cap and conserved at
every vertex v ≠ N.s, N.t.
- toFun : V → V → ℕ
Integral flow assigned to each directed arc
(u, v). Capacity bound on every directed arc.
Flow conservation (inflow equals outflow) at every intermediate vertex.
Instances For
Net-flow-across-cut lemma ([FF62], Chapter I, Section 4, Lemma 4.1; [CLRS09],
Lemma 26.4, p. 721): for every feasible flow f and s-t cut S, f.value equals the total
flow leaving S minus the total flow entering S.
Weak duality ([FF56], p. 400; [CLRS09], Corollary 26.5, p. 723): the value
of any feasible flow is bounded above by the capacity of any s-t cut.
Every feasible flow has value bounded above by the outgoing capacity of {N.s}.
Pointwise arc-flow update pushing δ units along simple path p (cancelling reverse flow
first before adding forward flow).
Instances For
Push δ units of flow along a simple s-t path p when δ ≤ f.resCap e.1 e.2 on every
arc of p.
Instances For
Bottleneck augmentation along an augmenting path p.
Instances For
A flow with no residual capacity from a cut S to its complement saturates every arc leaving
S and carries nothing into S, so its value is N.cutCapacity S.
Ford–Fulkerson augmenting-path characterization ([FF56], Theorem 1,
pp. 400–402; [CLRS09], Theorem 26.6, p. 723, (1) ↔ (2)): when N.s ≠ N.t, a feasible flow f
is a maximum flow if and only if it admits no residual s-t augmenting path.
Ford–Fulkerson strong-duality characterization ([FF56], Theorem 1,
pp. 400–402; [CLRS09], Theorem 26.6, p. 723, (1) ↔ (3)): when N.s ≠ N.t, a feasible flow f
is a maximum flow if and only if f.value equals the capacity of some s-t cut S (which is
then automatically a minimum s-t cut).
Existence of an integral maximum flow and minimum s-t cut ([FF56],
Theorem 1, pp. 400–402; [FF62], Chapter I, Theorem 5.1 & Integrity Theorem 8.1):
every finite integral network N with N.s ≠ N.t admits an integral feasible flow f and an
s-t cut S such that f is a maximum flow, S is a minimum s-t cut, and
f.value = N.cutCapacity S.