Finite max-flow / min-cut #
Source: url:https://github.com/jtraverso/erdos-81-chordal-clique-partitions/blob/b3423f3e8c8db7c2d1b279673293ef3079faf903/preprints/PAPER_III/05_formalization/lean_v1.4_freeze/Contrib/MaxFlowMinCut.lean
Authors: Juan Pablo Traverso Gianini, Aristotle
Status: verified
Main declarations: Contrib.MaxFlowMinCut.maxflow_eq_mincut
Tags: combinatorial-optimization, graph-theory, network-flows
MSC: 05C21, 90C35
Finite max-flow / min-cut #
A self-contained, Mathlib-only development of the finite max-flow / min-cut theorem for a network with real, nonnegative capacities on a finite node type.
Contents:
Network,Flow,Flow.value,Cut,Cut.capacity— the basic objects.Flow.value_eq_flow_across— the cut-flow identity.value_le_capacity— weak duality: every flow value is at most every cut capacity.exists_nodup_chain— from a reflexive-transitive-closure path between distinct points one can extract a duplicate-free chain (simple path).pairs,pairs_antisymm,pairs_rel,degree_balance— edge-set combinatorics of a simple path: no 2-cycles, consecutive nodes are related, and the unit degree balance.max_flow_exists— a maximum-value flow exists (the flow polytope is compact andvalueis continuous).augEdges_exists,t_not_reachable_of_max— the augmenting-path step.maxflow_eq_mincut— strong duality: there is a flow and an s–t cut of equal value.
The development is sorry-free and uses only the standard axioms
propext, Classical.choice, Quot.sound.
Duplicate-free chains from reflexive-transitive-closure paths #
From a reflexive-transitive-closure path between two DISTINCT points, extract a simple
(duplicate-free) chain list from s to t.
Edge sets of simple paths and their degree balance #
The set of consecutive directed pairs (edges) of a list.
Equations
- Contrib.MaxFlowMinCut.pairs l = (l.zip l.tail).toFinset
Instances For
An edge of pairs l relates its endpoints under any relation the list is a chain for.
Equations
- Contrib.MaxFlowMinCut.instDecidablePOut l u = decidable_of_iff (∃ i ∈ Finset.range l.length, i + 1 < l.length ∧ l[i]? = some u) ⋯
Equations
- Contrib.MaxFlowMinCut.instDecidablePIn l u = decidable_of_iff (∃ i ∈ Finset.range l.length, i + 1 < l.length ∧ l[i + 1]? = some u) ⋯
Degree balance: along a duplicate-free list, every node has out-degree minus in-degree equal
to 1 at the head, -1 at the last element, and 0 elsewhere.
Networks, flows, cuts and weak duality #
A finite s–t network: capacities (assumed nonnegative) with distinct source and sink.
- cap : N → N → ℝ
The capacity assigned to each ordered pair of vertices.
- s : N
The source vertex.
- t : N
The sink vertex.
Instances For
A feasible flow on a network.
- f : N → N → ℝ
The signed flow on each ordered pair of vertices.
Instances For
The flow across a cut equals the value of the flow.
Residual reachability #
Residual step: there is spare capacity on the (skew) edge u → v.
Instances For
Residual reachability from the source.
Equations
- Contrib.MaxFlowMinCut.Reaches Net F v = Relation.ReflTransGen (Contrib.MaxFlowMinCut.ResStep Net F) Net.s v
Instances For
The set of nodes reachable from s in the residual graph.
Equations
- Contrib.MaxFlowMinCut.reachableSet F = {v : N | Contrib.MaxFlowMinCut.Reaches Net F v}.toFinset
Instances For
Saturated-cut value. If every edge leaving S is saturated, then the flow
value equals the cut capacity. No augmenting paths — pure flow/cut accounting.
The residual-reachable set saturates its outgoing edges. If a node u is
reachable and v is not, the edge u → v has no residual capacity, hence is saturated.
Existence of a maximum flow #
The underlying set of feasible flow-functions of a network.
Equations
Instances For
A maximum-value flow exists. The flow polytope is compact (closed + bounded
in the finite-dimensional space N → N → ℝ) and value is continuous, so it is attained.
Augmenting paths #
Augmenting edge-set kernel. If the sink is residual-reachable, a
simple residual s→t path yields a finite set P of directed residual edges with a uniform slack
δ > 0, no 2-cycles, and unit s-to-t degree balance (source has net out-degree +1, sink
−1, every other node balanced). This is pure path combinatorics — no flow content.
Maximality ⇒ sink unreachable. Given the augmenting edge-set,
the pushed flow F' = F + δ·(P − Pᵀ) is feasible with value F.value + δ > F.value,
contradicting maximality.
Max-flow / min-cut. There is a flow and an s–t cut with equal value.
Combined with weak duality (value_le_capacity), this flow is of maximum value and this cut is
of minimum capacity.