Matchings, the Matching Number, and Saturation
Lax117284.BipartiteMatching · concepts/Lax117284/BipartiteMatching.lean · lax-117284
No public endorsements yet.
Loading review…
Sign in with ORCIDNatural Language Statement
Definition
A matching of a graph is a set of edges no two of which share a vertex; the matching number is the largest number of edges in a matching; a matching saturates a set of vertices when it covers every one of them, and it is perfect when it covers every vertex of the graph.
Concept map
Lean source view on GitHub
| 1 | import Mathlib.Combinatorics.SimpleGraph.Matching |
| 2 | import Mathlib.Data.Set.Card |
| 3 | |
| 4 | /-! |
| 5 | --- |
| 6 | title: Matchings, the Matching Number, and Saturation |
| 7 | type: definition |
| 8 | --- |
| 9 | A matching of a graph is a set of edges no two of which share a vertex; the matching number is |
| 10 | the largest number of edges in a matching; a matching saturates a set of vertices when it covers |
| 11 | every one of them, and it is perfect when it covers every vertex of the graph. |
| 12 | |
| 13 | # Formalization Notes |
| 14 | |
| 15 | Matchings are Mathlib's: a subgraph `M` of `G` is a matching, `M.IsMatching`, when every vertex |
| 16 | of `M` has exactly one neighbour in `M`; its edges are `M.edgeSet`. Perfect matchings are |
| 17 | Mathlib's `IsPerfectMatching`. Only the size, the matching number, saturation and maximality are |
| 18 | named here. |
| 19 | |
| 20 | The matching number is the supremum of the sizes of the matchings. For a finite graph the set of |
| 21 | sizes is bounded by the number of edges and contains `0`, so the supremum is a maximum, attained |
| 22 | by some matching; a maximum matching is one that attains it. |
| 23 | -/ |
| 24 | |
| 25 | namespace Lax117284.BipartiteMatching |
| 26 | |
| 27 | variable {V : Type*} (G : SimpleGraph V) |
| 28 | |
| 29 | /-- The size of a subgraph: the number of its edges. -/ |
| 30 | noncomputable def size (M : G.Subgraph) : ℕ := M.edgeSet.ncard |
| 31 | |
| 32 | /-- **The matching number**: the largest size of a matching. -/ |
| 33 | noncomputable def matchingNumber : ℕ := |
| 34 | sSup {k | ∃ M : G.Subgraph, M.IsMatching ∧ size G M = k} |
| 35 | |
| 36 | /-- **A maximum matching**: a matching no matching outnumbers. -/ |
| 37 | def IsMaximumMatching (M : G.Subgraph) : Prop := |
| 38 | M.IsMatching ∧ ∀ M' : G.Subgraph, M'.IsMatching → size G M' ≤ size G M |
| 39 | |
| 40 | /-- **A subgraph saturates a set of vertices** when it contains every one of them. -/ |
| 41 | def Saturates (M : G.Subgraph) (S : Set V) : Prop := S ⊆ M.verts |
| 42 | |
| 43 | end Lax117284.BipartiteMatching |
| 44 |
Formalization Notes
Matchings are Mathlib's: a subgraph of is a matching, , when every vertex of has exactly one neighbour in ; its edges are . Perfect matchings are Mathlib's . Only the size, the matching number, saturation and maximality are named here.
The matching number is the supremum of the sizes of the matchings. For a finite graph the set of sizes is bounded by the number of edges and contains , so the supremum is a maximum, attained by some matching; a maximum matching is one that attains it.
Builds on
none
Discussion
Ask a question or add context. Endorsements and structured flags are kept in the review panel above.
0 comments