Documentation

CslibFrontier.Algorithms.Lean.MaxFlow.Dilworth

Dilworth's theorem by Fulkerson's reduction to König's theorem #

Dilworth's decomposition theorem ([Dil50]; [Sch17], Theorem 7.6): in a finite poset, the maximum size of an antichain equals the minimum number of chains covering it. The dual statement, Mirsky's theorem, is exists_isChain_and_antichain_coloring.

This file follows the bipartite-matching proof usually credited to Fulkerson ([Ful56]). Join a left copy of x to a right copy of y whenever x < y (ltGraph, a graph on α × α in the sense of IsMatching). Then:

König's theorem (exists_maxMatching_eq_minVertexCover) supplies M and C with |M| = |C|, which gives an antichain A and a covering by |A| chains. Weak duality (IsAntichain.card_le_of_isChain_fibre) makes both optimal.

Chains and antichains are Mathlib's IsChain (· ≤ ·) and IsAntichain (· ≤ ·). A covering by k chains is a colouring α → Fin k whose fibres are chains. The results are for finite posets only. The executable version, through Hopcroft–Karp, is Cslib.Algorithms.Lean.MaxFlow.minChainCover (with its O(n^{5/2}) word-RAM realization in CslibFrontier.Algorithms.WordRAM.HopcroftKarp).

Main definitions #

Main results #

References #

def Cslib.Algorithms.Lean.MaxFlow.ltGraph {α : Type u_1} [LT α] [DecidableLT α] :
α × α → Bool

Fulkerson's bipartite graph of a strict order: the left copy of x is joined to the right copy of y when x < y.

@[simp]
theorem Cslib.Algorithms.Lean.MaxFlow.ltGraph_apply {α : Type u_1} [LT α] [DecidableLT α] (e : α × α) :
ltGraph e = true ↔ e.1 < e.2
def Cslib.Algorithms.Lean.MaxFlow.mergeLabel {α : Type u_1} {γ : Type u_2} [DecidableEq γ] (f : α → γ) :
α × α → α → γ

Relabel along the edge (u, v): every element carrying v's label receives u's label.

theorem Cslib.Algorithms.Lean.MaxFlow.foldl_mergeLabel_spec {α : Type u_1} {γ : Type u_2} [PartialOrder α] [Fintype α] [DecidableEq α] [DecidableEq γ] [DecidableLT α] {f : α → γ} (hf : Function.Injective f) {l : List (α × α)} (hl : l.Nodup) (hM : IsMatching ltGraph l.toFinset) :
(∀ (c : γ), IsChain (fun (x1 x2 : α) => x1 ≤ x2) (List.foldl (fun (x : α → γ) => mergeLabel x) f l ⁻¹' {c})) ∧ (Finset.image (List.foldl (fun (x : α → γ) => mergeLabel x) f l) Finset.univ).card + l.length = Fintype.card α

Fulkerson's chain construction. Folding mergeLabel over the edges of a matching of ltGraph, starting from an injective labelling, leaves chain fibres, and the number of labels drops by one per edge.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_chain_coloring_of_isMatching {α : Type u_1} [PartialOrder α] [Fintype α] [DecidableLT α] {M : Finset (α × α)} (hM : IsMatching ltGraph M) :
∃ (f : α → Fin (Fintype.card α - M.card)), ∀ (i : Fin (Fintype.card α - M.card)), IsChain (fun (x1 x2 : α) => x1 ≤ x2) (f ⁻¹' {i})

Fulkerson's reduction, matchings to chains. A matching M of ltGraph yields a covering by |α| - |M| chains.

The elements whose left and right copies are both missed by a vertex cover of a graph on α × α.

theorem Cslib.Algorithms.Lean.MaxFlow.mem_uncovered {α : Type u_1} [Fintype α] [DecidableEq α] {C : VertexCover α α} {x : α} :
x ∈ C.uncovered ↔ x ∉ C.left ∧ x ∉ C.right
theorem Cslib.Algorithms.Lean.MaxFlow.isAntichain_uncovered {α : Type u_1} [PartialOrder α] [Fintype α] [DecidableEq α] [DecidableLT α] {C : VertexCover α α} (hC : IsVertexCover ltGraph C) :
IsAntichain (fun (x1 x2 : α) => x1 ≤ x2) ↑C.uncovered

Fulkerson's reduction, covers to antichains. The elements that a vertex cover of ltGraph misses on both sides form an antichain.

A vertex cover of size |C| misses at least |α| - |C| elements on both sides.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_isAntichain_and_chain_coloring {α : Type u_1} [PartialOrder α] [Finite α] :
∃ (A : Finset α) (f : α → Fin A.card), IsAntichain (fun (x1 x2 : α) => x1 ≤ x2) ↑A ∧ ∀ (i : Fin A.card), IsChain (fun (x1 x2 : α) => x1 ≤ x2) (f ⁻¹' {i})

Dilworth's decomposition theorem ([Dil50]; [Sch17], Theorem 7.6): a finite poset has an antichain A and a covering by |A| chains. The proof is Fulkerson's reduction ([Ful56]): a maximum matching M of ltGraph gives |α| - |M| chains, and König's theorem gives a vertex cover of size |M|, which misses an antichain of at least |α| - |M| elements. By weak duality A is a largest antichain and the covering uses the fewest chains.

theorem Cslib.Algorithms.Lean.MaxFlow.exists_chain_coloring_iff {α : Type u_1} [PartialOrder α] [Finite α] {k : ℕ} :
(∃ (f : α → Fin k), ∀ (i : Fin k), IsChain (fun (x1 x2 : α) => x1 ≤ x2) (f ⁻¹' {i})) ↔ ∀ (A : Finset α), IsAntichain (fun (x1 x2 : α) => x1 ≤ x2) ↑A → A.card ≤ k

Dilworth's decomposition theorem, min–max form ([Sch17], Theorem 7.6): a finite poset can be covered by k chains if and only if every antichain has at most k elements.