Documentation

CslibFrontier.Algorithms.Lean.MaxFlow.Menger

Menger's Theorem via Integral Max-Flow/Min-Cut #

Derives finite forms of Menger's theorem ([Men27]) from the integral max-flow/min-cut theorem Cslib.Algorithms.Lean.MaxFlow.Network.exists_maxFlow_eq_minCut and flow path decomposition (Cslib.Algorithms.Lean.MaxFlow.Network.Flow.exists_flowPaths). Pure graph notions (Digraph.IsDipath, Digraph.ArcDisjoint, Digraph.InternallyDisjoint, Digraph.IsArcCut, Digraph.IsVertexCut, Digraph.outArcs, Cslib.Multidigraph.IsDipath, Cslib.Multidigraph.IsArcCut, Cslib.Multidigraph.outArcs, SimpleGraph.IsVertexSeparator, SimpleGraph.InternallyDisjoint, SimpleGraph.IsVertexConnected) live in CslibFrontier.Foundations.Combinatorics.

Main results #

Scope #

Finite graphs, finite multidigraphs, and integral capacities only. Infinite graphs (Erdős–Menger) and executable connectivity solvers are not covered here.

References #

Integral-capacity path packing and directed Menger #

The support digraph of a network: arcs of positive capacity.

theorem Cslib.Algorithms.Lean.MaxFlow.card_le_cutCapacity_of_cap {V : Type u_1} [Fintype V] [DecidableEq V] {N : Network V} {k : ℕ} {P : Fin k → List V} (hP : ∀ (i : Fin k), N.posCapDigraph.IsDipath N.s N.t (P i)) (hcap : ∀ (u v : V), {i : Fin k | (u, v) ∈ (P i).consecutivePairs}.card ≤ N.cap u v) {S : Finset V} (hS : N.IsCut S) :

Weak duality for capacity-constrained paths: if k simple s–t paths use each arc (u, v) at most N.cap u v times, then k is at most the capacity of any s–t cut S.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_arcCap_eq_cutCapacity {V : Type u_1} [Fintype V] [DecidableEq V] (N : Network V) (hst : N.s ≠ N.t) :
∃ (S : Finset V), N.IsCut S ∧ ∃ (P : Fin (N.cutCapacity S) → List V), (∀ (i : Fin (N.cutCapacity S)), N.posCapDigraph.IsDipath N.s N.t (P i)) ∧ ∀ (u v : V), {i : Fin (N.cutCapacity S) | (u, v) ∈ (P i).consecutivePairs}.card ≤ N.cap u v

Integral-capacity path packing ([Sch17], §4.1/Theorem 4.2 remark): for N.s ≠ N.t, there exist an s–t cut S and N.cutCapacity S simple s–t paths along positive-capacity arcs using each arc (u, v) at most N.cap u v times.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_arcCap_iff_forall_isCut {V : Type u_1} [Fintype V] [DecidableEq V] (N : Network V) (k : ℕ) :
(∃ (P : Fin k → List V), (∀ (i : Fin k), N.posCapDigraph.IsDipath N.s N.t (P i)) ∧ ∀ (u v : V), {i : Fin k | (u, v) ∈ (P i).consecutivePairs}.card ≤ N.cap u v) ↔ ∀ (S : Finset V), N.IsCut S → k ≤ N.cutCapacity S

Integral-capacity Menger / path-packing characterization: there exist k simple s–t paths in N using each arc (u, v) at most N.cap u v times if and only if every s–t cut has capacity at least k.

Multidigraph arc-disjoint Menger #

theorem Cslib.Algorithms.Lean.MaxFlow.exists_multidigraph_arcDisjoint_eq_outArcs {V : Type u_1} {E : Type u_2} (src tgt : E → V) [Finite V] [DecidableEq V] [Fintype E] {s t : V} (hst : s ≠ t) :
∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ ∃ (Q : Fin (Multidigraph.outArcs src tgt S).card → List E), (∀ (i : Fin (Multidigraph.outArcs src tgt S).card), Multidigraph.IsDipath src tgt s t (Q i)) ∧ Pairwise fun (i j : Fin (Multidigraph.outArcs src tgt S).card) => (Q i).Disjoint (Q j)

Menger's theorem, directed multidigraph arc-disjoint form, with a matching cut ([Men27]; [Sch17], §4.1, Corollary 4.1b for directed multigraphs): for distinct s, t in a finite multidigraph src tgt : E → V, there are (outArcs src tgt S).card pairwise arc-disjoint simple directed s–t paths for some S with s ∈ S, t ∉ S.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_multidigraph_arcDisjoint_iff_forall_isArcCut {V : Type u_1} {E : Type u_2} (src tgt : E → V) [Finite V] [Finite E] (s t : V) (k : ℕ) :
(∃ (Q : Fin k → List E), (∀ (i : Fin k), Multidigraph.IsDipath src tgt s t (Q i)) ∧ Pairwise fun (i j : Fin k) => (Q i).Disjoint (Q j)) ↔ ∀ (C : Finset E), Multidigraph.IsArcCut src tgt s t C → k ≤ C.card

Menger's theorem, directed multidigraph arc-disjoint form ([Men27]; [Sch17], §4.1, Corollary 4.1b for directed multigraphs): in a finite multidigraph src tgt : E → V, there are k pairwise arc-disjoint simple directed s–t paths if and only if every s–t arc cut has at least k arcs.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_arcDisjoint_eq_outArcs {V : Type u_1} [Fintype V] [DecidableEq V] (G : Digraph V) [DecidableRel G.Adj] {s t : V} (hst : s ≠ t) :
∃ (S : Finset V), s ∈ S ∧ t ∉ S ∧ ∃ (P : Fin (G.outArcs S).card → List V), (∀ (i : Fin (G.outArcs S).card), G.IsDipath s t (P i)) ∧ Digraph.ArcDisjoint P

Menger's theorem, directed arc-disjoint form, with a matching cut ([Men27]; [Sch17], §4.1, Corollary 4.1b): for distinct s, t there are (G.outArcs S).card pairwise arc-disjoint directed s–t paths for some S with s ∈ S, t ∉ S.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_arcDisjoint_iff_forall_isArcCut {V : Type u_1} [Finite V] (G : Digraph V) (s t : V) (k : ℕ) :
(∃ (P : Fin k → List V), (∀ (i : Fin k), G.IsDipath s t (P i)) ∧ Digraph.ArcDisjoint P) ↔ ∀ (C : Finset (V × V)), G.IsArcCut s t C → k ≤ C.card

Menger's theorem, directed arc-disjoint form ([Men27]; [Sch17], §4.1, Corollary 4.1b): in a finite digraph there are k pairwise arc-disjoint directed s–t paths if and only if every s–t arc cut has at least k arcs.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_internallyDisjoint_eq_isVertexCut {V : Type u_1} [Finite V] (G : Digraph V) {s t : V} (hst : s ≠ t) (hadj : ¬G.Adj s t) :
∃ (m : ℕ) (P : Fin m → List V), (∀ (i : Fin m), G.IsDipath s t (P i)) ∧ Digraph.InternallyDisjoint s t P ∧ ∃ (T : Finset V), G.IsVertexCut s t T ∧ T.card = m

Menger's theorem, directed vertex form, with a matching cut ([Men27]; [Sch17], §4.1, Corollary 4.1a): for distinct s, t with ¬ G.Adj s t, there are m pairwise internally disjoint directed s–t paths and an s–t vertex cut with m vertices.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_internallyDisjoint_iff_forall_isVertexCut {V : Type u_1} [Finite V] (G : Digraph V) (s t : V) (k : ℕ) :
(∃ (P : Fin k → List V), (∀ (i : Fin k), G.IsDipath s t (P i)) ∧ Digraph.InternallyDisjoint s t P) ↔ ∀ (T : Finset V), G.IsVertexCut s t T → k ≤ T.card

Menger's theorem, directed vertex form ([Men27]; [Sch17], §4.1, Corollary 4.1a): in a finite digraph there are k pairwise internally disjoint directed s–t paths if and only if every s–t vertex cut has at least k vertices.

Set-to-set A–B Menger (directed) #

theorem Cslib.Algorithms.Lean.MaxFlow.exists_vertexDisjoint_eq_isSeparator {V : Type u_1} [Finite V] (G : Digraph V) (A B : Set V) :
∃ (m : ℕ) (P : Fin m → List V), (∀ (i : Fin m), ∃ a ∈ A, ∃ b ∈ B, G.IsDipath a b (P i)) ∧ (Pairwise fun (i j : Fin m) => (P i).Disjoint (P j)) ∧ ∃ (Y : Finset V), G.IsSeparator A B ↑Y ∧ Y.card = m

Menger's theorem, directed A–B vertex-disjoint form, with a matching separator ([Men27]; [Sch17], §4.1, Theorem 4.1): in a finite digraph, for any vertex sets A, B : Set V, there exist m pairwise vertex-disjoint simple directed A–B paths and an A–B separator Y : Finset V of size m.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_vertexDisjoint_iff_forall_isSeparator {V : Type u_1} [Finite V] (G : Digraph V) (A B : Set V) (k : ℕ) :
(∃ (P : Fin k → List V), (∀ (i : Fin k), ∃ a ∈ A, ∃ b ∈ B, G.IsDipath a b (P i)) ∧ Pairwise fun (i j : Fin k) => (P i).Disjoint (P j)) ↔ ∀ (Y : Finset V), G.IsSeparator A B ↑Y → k ≤ Y.card

Menger's theorem, directed A–B vertex-disjoint form ([Men27]; [Sch17], §4.1, Theorem 4.1): in a finite digraph, there are k pairwise vertex-disjoint directed A–B paths iff every A–B separator has at least k vertices.

Undirected Menger, set-to-set and global k-connectivity #

theorem Cslib.Algorithms.Lean.MaxFlow.exists_edgeDisjoint_eq_not_reachable {V : Type u_1} [Finite V] (G : SimpleGraph V) {u v : V} (huv : u ≠ v) :
∃ (m : ℕ) (W : Fin m → G.Walk u v), (∀ (i : Fin m), (W i).IsPath) ∧ (Pairwise fun (i j : Fin m) => ∀ e ∈ (W i).edges, e ∉ (W j).edges) ∧ ∃ (C : Finset (Sym2 V)), C.card = m ∧ ¬(G.deleteEdges ↑C).Reachable u v

Menger's theorem, undirected edge form, with a matching cut ([Men27]; [Die25], Corollary 3.3.5 (ii)): for distinct u, v there are m pairwise edge-disjoint u–v paths and a set of m edges whose deletion disconnects u from v.

theorem Cslib.Algorithms.Lean.MaxFlow.isEdgeReachable_iff_exists_edgeDisjoint {V : Type u_1} [Finite V] (G : SimpleGraph V) (u v : V) (k : ℕ) :
G.IsEdgeReachable (↑k) u v ↔ ∃ (W : Fin k → G.Walk u v), (∀ (i : Fin k), (W i).IsPath) ∧ Pairwise fun (i j : Fin k) => ∀ e ∈ (W i).edges, e ∉ (W j).edges

Menger's theorem, undirected edge form ([Men27]; [Die25], Corollary 3.3.5 (ii)): in a finite simple graph, u and v are k-edge-reachable if and only if there are k pairwise edge-disjoint u–v paths.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_internallyDisjoint_eq_isVertexSeparator {V : Type u_1} [Finite V] (G : SimpleGraph V) {u v : V} (huv : u ≠ v) (hadj : ¬G.Adj u v) :
∃ (m : ℕ) (W : Fin m → G.Walk u v), (∀ (i : Fin m), (W i).IsPath) ∧ SimpleGraph.InternallyDisjoint W ∧ ∃ (T : Finset V), G.IsVertexSeparator u v T ∧ T.card = m

Menger's theorem, undirected vertex form, with a matching separator ([Men27]; [Die25], Corollary 3.3.5 (i)): for distinct, non-adjacent u, v there are m pairwise internally disjoint u–v paths and a u–v separator with m vertices.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_internallyDisjoint_iff_forall_isVertexSeparator {V : Type u_1} [Finite V] (G : SimpleGraph V) (u v : V) (k : ℕ) :
(∃ (W : Fin k → G.Walk u v), (∀ (i : Fin k), (W i).IsPath) ∧ SimpleGraph.InternallyDisjoint W) ↔ ∀ (T : Finset V), G.IsVertexSeparator u v T → k ≤ T.card

Menger's theorem, undirected vertex form ([Men27]; [Die25], Corollary 3.3.5 (i)): in a finite simple graph there are k pairwise internally disjoint u–v paths if and only if every u–v separator has at least k vertices.

Undirected A–B Menger #

theorem Cslib.Algorithms.Lean.MaxFlow.exists_disjoint_walk_eq_isSeparator {V : Type u_1} [Finite V] (G : SimpleGraph V) (A B : Set V) :
∃ (m : ℕ) (a : Fin m → V) (b : Fin m → V) (W : (i : Fin m) → G.Walk (a i) (b i)), (∀ (i : Fin m), a i ∈ A) ∧ (∀ (i : Fin m), b i ∈ B) ∧ (∀ (i : Fin m), (W i).IsPath) ∧ (Pairwise fun (i j : Fin m) => (W i).support.Disjoint (W j).support) ∧ ∃ (Y : Finset V), G.IsSeparator A B ↑Y ∧ Y.card = m

Menger's theorem, undirected A–B set form, with a matching separator ([Men27]; [Die25], Theorem 3.3.1): in a finite simple graph, for any A, B : Set V, there exist m pairwise vertex-disjoint A–B paths and an A–B separator Y : Finset V of size m.

An A–B path here starts in A, ends in B and may pass through further vertices of A or B (the endpoint convention of [Sch17], Section 4.1), whereas [Die25], Section 1.3, lets A–B paths meet A and B only at their ends. Single-vertex paths at vertices of A ∩ B are allowed, so every separator meets A ∩ B, but such vertices need not appear as single-vertex paths in the family.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_disjoint_walk_iff_forall_isSeparator {V : Type u_1} [Finite V] (G : SimpleGraph V) (A B : Set V) (k : ℕ) :
(∃ (a : Fin k → V) (b : Fin k → V) (W : (i : Fin k) → G.Walk (a i) (b i)), (∀ (i : Fin k), a i ∈ A) ∧ (∀ (i : Fin k), b i ∈ B) ∧ (∀ (i : Fin k), (W i).IsPath) ∧ Pairwise fun (i j : Fin k) => (W i).support.Disjoint (W j).support) ↔ ∀ (Y : Finset V), G.IsSeparator A B ↑Y → k ≤ Y.card

Menger's theorem, undirected A–B set form ([Men27]; [Die25], Theorem 3.3.1): in a finite simple graph, there exist k pairwise vertex-disjoint A–B paths if and only if every A–B separator has at least k vertices. The paths follow the endpoint convention of exists_disjoint_walk_eq_isSeparator, not Diestel's: they may pass through further vertices of A or B.

Global k-connectivity Menger #

theorem Cslib.Algorithms.Lean.MaxFlow.exists_disjoint_walk_induce_compl_of_isVertexConnected {V : Type u_1} [Finite V] {G : SimpleGraph V} {k : ℕ} {Z : Finset V} (hG : G.IsVertexConnected (k + Z.card)) (A B : Finset ↑(↑Z)ᶜ) (hA : k ≤ A.card) (hB : k ≤ B.card) :
∃ (a : Fin k → ↑(↑Z)ᶜ) (b : Fin k → ↑(↑Z)ᶜ) (W : (i : Fin k) → (SimpleGraph.induce (↑Z)ᶜ G).Walk (a i) (b i)), (∀ (i : Fin k), a i ∈ A) ∧ (∀ (i : Fin k), b i ∈ B) ∧ (∀ (i : Fin k), (W i).IsPath) ∧ Pairwise fun (i j : Fin k) => (W i).support.Disjoint (W j).support

After deleting a finite set Z from a (k + Z.card)-vertex-connected graph, any two surviving sets of at least k vertices are joined by k vertex-disjoint paths in the induced graph. The endpoint convention is that of exists_disjoint_walk_iff_forall_isSeparator.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_two_disjoint_walk_induce_compl_of_isVertexConnected {V : Type u_1} [Finite V] {G : SimpleGraph V} {Z : Finset V} (hG : G.IsVertexConnected (2 + Z.card)) {a b c d : ↑(↑Z)ᶜ} (hab : a ≠ b) (hcd : c ≠ d) :
have H := SimpleGraph.induce (↑Z)ᶜ G; ∃ (c' : ↑(↑Z)ᶜ) (d' : ↑(↑Z)ᶜ), (c' = c ∧ d' = d ∨ c' = d ∧ d' = c) ∧ ∃ (p : H.Walk a c') (q : H.Walk b d'), p.IsPath ∧ q.IsPath ∧ p.support.Disjoint q.support

After deleting Z from a (2 + Z.card)-vertex-connected graph, two distinct surviving starts can be joined to two distinct surviving finishes by vertex-disjoint paths. The two paths determine which start is paired with which finish.

theorem Cslib.Algorithms.Lean.MaxFlow.isEdgeConnected_iff_forall_exists_edgeDisjoint {V : Type u_1} [Finite V] (G : SimpleGraph V) (k : ℕ) :
G.IsEdgeConnected ↑k ↔ ∀ (u v : V), ∃ (W : Fin k → G.Walk u v), (∀ (i : Fin k), (W i).IsPath) ∧ Pairwise fun (i j : Fin k) => ∀ e ∈ (W i).edges, e ∉ (W j).edges

Menger's theorem, global edge-connectivity form ([Die25], Theorem 3.3.6 (ii)): a finite simple graph is k-edge-connected iff every pair of vertices is joined by k pairwise edge-disjoint paths.

k-edge-connectivity is Mathlib's SimpleGraph.IsEdgeConnected, which extends the convention of [Die25], Section 1.4: Diestel requires more than one vertex, whereas IsEdgeConnected k holds for every k on empty and one-vertex types. Pairs u = v are included, and are joined by k copies of the trivial walk.

theorem Cslib.Algorithms.Lean.MaxFlow.isEdgeConnected_iff_forall_ne_exists_injective_edgeDisjoint {V : Type u_1} [Finite V] (G : SimpleGraph V) (k : ℕ) :
G.IsEdgeConnected ↑k ↔ ∀ ⦃u v : V⦄, u ≠ v → ∃ (W : Fin k → G.Walk u v), Function.Injective W ∧ (∀ (i : Fin k), (W i).IsPath) ∧ Pairwise fun (i j : Fin k) => ∀ e ∈ (W i).edges, e ∉ (W j).edges

Menger's theorem, global edge-connectivity form on distinct vertices: a finite simple graph is k-edge-connected iff every pair of distinct vertices is joined by k distinct pairwise edge-disjoint paths.

Menger's theorem, global vertex-connectivity form ([Men27]; [Die25], Theorem 3.3.6 (i)): a finite simple graph is k-vertex-connected iff |V| > k and every pair of distinct vertices is joined by k distinct pairwise internally disjoint paths. (The injectivity condition prevents repeating the single-edge path [u, v] when u and v are adjacent.)

theorem Cslib.Algorithms.Lean.MaxFlow.isVertexConnected_iff_of_nontrivial {V : Type u_1} [Finite V] [Nontrivial V] (G : SimpleGraph V) (k : ℕ) :
G.IsVertexConnected k ↔ ∀ ⦃u v : V⦄, u ≠ v → ∃ (W : Fin k → G.Walk u v), Function.Injective W ∧ (∀ (i : Fin k), (W i).IsPath) ∧ SimpleGraph.InternallyDisjoint W

Menger's theorem, global vertex-connectivity form for nontrivial graphs: on a finite vertex type with at least two vertices, G is k-vertex-connected iff every pair of distinct vertices is joined by k distinct pairwise internally disjoint paths.

theorem Cslib.Algorithms.Lean.MaxFlow.isVertexConnected_iff_forall_exists_finset {V : Type u_1} [Finite V] (G : SimpleGraph V) (k : ℕ) :
G.IsVertexConnected k ↔ ↑k < ENat.card V ∧ ∀ ⦃u v : V⦄, u ≠ v → ∃ (P : Finset (G.Walk u v)), P.card = k ∧ (∀ w ∈ P, w.IsPath) ∧ (↑P).Pairwise fun (w₁ w₂ : G.Walk u v) => ∀ x ∈ w₁.support, x ∈ w₂.support → x = u ∨ x = v

Menger's theorem, global vertex-connectivity form with Finset path families: a finite simple graph is k-vertex-connected iff |V| > k and every pair of distinct vertices has a k-element Finset of pairwise internally disjoint paths.

Every finite k-vertex-connected simple graph is k-edge-connected (κ(G) ≤ λ(G), [Die25], Proposition 1.4.2).