Documentation

CslibFrontier.Algorithms.Lean.Matroid.Intersection.Konig

Bipartite matching as matroid intersection #

A matching of a bipartite graph G : L × R → Bool is a set of edges that is independent in two unit-capacity partition matroids on L × R: the one whose blocks are the fibres of Prod.fst and the one whose blocks are the fibres of Prod.snd ([Sch17], Example 10.5a). This module proves that correspondence and shows that a separator U from Edmonds' matroid intersection theorem gives a vertex cover of size M₁.eRk U + M₂.eRk (E \ U). Edmonds' theorem then yields a maximum matching together with a vertex cover of the same size. This is König's theorem ([Kon31]), derived by the matroid route of [Sch17], Exercise 10.22.

The library's primary statement of König's theorem is the flow-based Cslib.Algorithms.Lean.MaxFlow.exists_maxMatching_eq_minVertexCover. This module gives a second, flow-independent derivation via matroid intersection, with an explicit separator cover. It is stated with the existing Cslib.Algorithms.Lean.MaxFlow.IsMatching, VertexCover and IsVertexCover API, and shares with the flow proof only the matching/cover weak duality Cslib.Algorithms.Lean.MaxFlow.card_le_size_of_matching_vertexCover, used to conclude minimality of the cover.

Main definitions #

Main results #

References #

Unit-capacity partition matroids #

def Cslib.Algorithms.Lean.Matroid.unitPartitionMatroid {α : Type u_1} {β : Type u_2} (f : α → β) :

The unit-capacity partition matroid of f : α → β: its ground set is all of α, and a set I is independent exactly when f is injective on I, so each fibre of f is a block of capacity one. It is the free matroid on β pulled back along f.

theorem Cslib.Algorithms.Lean.Matroid.unitPartitionMatroid_eRk {α : Type u_1} {β : Type u_2} (f : α → β) (X : Set α) :

The rank of X in the unit-capacity partition matroid of f is the number of blocks that X meets.

Matchings, separators and vertex covers #

def Cslib.Algorithms.Lean.Matroid.bipartiteEdges {L : Type u_1} {R : Type u_2} [Fintype L] [Fintype R] (G : L × R → Bool) :
Finset (L × R)

The edge set {e | G e = true} of a bipartite graph G : L × R → Bool on finite vertex types.

theorem Cslib.Algorithms.Lean.Matroid.mem_bipartiteEdges {L : Type u_1} {R : Type u_2} [Fintype L] [Fintype R] {G : L × R → Bool} {e : L × R} :

Bipartite matchings are common independent sets ([Sch17], Example 10.5a): M is a matching of G exactly when M ⊆ bipartiteEdges G and M is independent in both unit-capacity partition matroids unitPartitionMatroid Prod.fst and unitPartitionMatroid Prod.snd.

The vertex cover read off from a separator U ⊆ E: the left endpoints of edges in U and the right endpoints of edges in E \ U.

For every U, separatorCover (bipartiteEdges G) U covers every edge of G: an edge in U is covered by its left endpoint, and an edge outside U by its right endpoint.

The size of separatorCover E U is the rank sum (unitPartitionMatroid Prod.fst).eRk U + (unitPartitionMatroid Prod.snd).eRk (E \ U) from Edmonds' theorem.

König's theorem by matroid intersection ([Sch17], Example 10.5a and Exercise 10.22; [Kon31]): for a bipartite graph G on finite vertex types, Edmonds' theorem for the two unit-capacity partition matroids on bipartiteEdges G gives a maximum matching M and a separator U ⊆ bipartiteEdges G whose separatorCover is a minimum vertex cover of size M.card. The flow-based proof of the same equality is Cslib.Algorithms.Lean.MaxFlow.exists_maxMatching_eq_minVertexCover.