Bipartite perfect matching #
A bipartite graph with n left and n right vertices is a subgraph of the complete bipartite
graph K_{n,n}, given by the indicator of its edges, one bit for each pair (i, j) of a left
vertex i and a right vertex j (Cslib.Circuits.BipartiteMatching.graph, numbering the pairs by
finProdFinEquiv). It has a perfect matching when some bijection σ from the left to the right
vertices uses only edges, (i, σ i) for every i (BipartiteMatching.HasPerfectMatching). The
bipartite perfect matching function Cslib.Circuits.bipartitePerfectMatching n of the n * n
possible edges says whether the graph has a perfect matching. It is monotone
(monotone_bipartitePerfectMatching): adding edges keeps a perfect matching.
Relabelling the left and the right vertices along bijections preserves perfect matchings
(BipartiteMatching.hasPerfectMatching_comp_iff). A graph has no perfect matching when a set of
left vertices has fewer neighbours (BipartiteMatching.not_hasPerfectMatching_of_card_lt), the easy
direction of Hall's theorem; Hall's theorem itself, from Mathlib's
Finset.all_card_le_biUnion_card_iff_existsInjective', says that a perfect matching exists exactly
when every set of left vertices has at least as many neighbours
(BipartiteMatching.hasPerfectMatching_iff_forall_card_le).
Main definitions #
Cslib.Circuits.BipartiteMatching.HasPerfectMatching: a bipartite graph onV × Vhas a perfect matching.Cslib.Circuits.BipartiteMatching.graph: the bipartite graph of an input.Cslib.Circuits.bipartitePerfectMatching: the bipartite perfect matching function.
Main results #
Cslib.Circuits.monotone_bipartitePerfectMatching: the function is monotone.Cslib.Circuits.BipartiteMatching.hasPerfectMatching_comp_iff: relabelling vertices.Cslib.Circuits.BipartiteMatching.hasPerfectMatching_iff_forall_card_le: Hall's theorem.
References #
A bipartite graph whose left and right vertices are both indexed by V, given by the indicator
of its edges (left, right), has a perfect matching: a bijection σ from the left to the right
vertices with (v, σ v) an edge for every v.
Instances For
Hall's condition is necessary: if the edges from a set S of left vertices all end in a
set T of fewer right vertices, the graph has no perfect matching.
Hall's theorem for bipartite graphs on V × V: a perfect matching exists exactly when
every set of left vertices has at least as many neighbours.
Adding edges keeps a perfect matching.
The bipartite graph of an input: the left vertex i and the right vertex j are adjacent when
the bit numbered finProdFinEquiv (i, j) is one.
Instances For
The bipartite perfect matching function of the n * n possible edges of the complete
bipartite graph K_{n,n}: whether the graph of the input (BipartiteMatching.graph) has a perfect
matching.
Instances For
The bipartite perfect matching function is true exactly on graphs with a perfect matching.
The bipartite perfect matching function is monotone: adding edges keeps a perfect matching.