finite_subset_has_maximum_matching
Every vertex subset of a finite graph contains a maximum matching.
Statement
theorem finite_subset_has_maximum_matching {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset V) : ∃ M : G.Subgraph, M.IsMatching ∧ M.verts ⊆ (S : Set V) ∧ ∀ N : G.Subgraph, N.IsMatching → N.verts ⊆ (S : Set V) → N.edgeSet.ncard ≤ M.edgeSet.ncard
- Source
- Balanced-cut matching symmetry for OP-1957; https://arxiv.org/abs/2611.22690.
- Verified
- 26 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 2
- extendible_matchable_two_k_vertices_complement_matchableIn a finite k-extendible graph, the complement of any matchable set of exactly 2k vertices is matchable.
- op_2037_subgraph_fintypeA graph on a finite decidable vertex type has only finitely many subgraphs.
- Used by 10
- extendible_independent_common_nonneighbor_deficit_le_zeroUnder the stated high-degree extendibility and independence assumptions, a nonempty independent U and a disjoint anticomplete W satisfy…
- extendible_high_degree_balanced_cut_odd_bound_no_separatorIn the displayed high-degree extendible graph with independence bound k, every balanced half has at most two odd components, with no…
- op1957_min_degree_forces_matchingA finite graph on at least 2k vertices with minimum degree at least k has a matching of k edges.
- k7_balanced_cut_bound_of_deficiency_barrierUnder the displayed extendibility, separator, degree and independence conditions, the matching-deficiency barrier hypothesis implies at…
- extendible_balanced_cut_odd_bound_of_near_perfect_hypothesisUnder the displayed assumptions and the explicitly assumed near-perfect maximum-matching property, the opposite side of a balanced cut has…
- extendible_k7_balanced_cut_odd_component_boundIn the stated 28-vertex, 7-extendible, high-degree setting with the separator and independence assumptions, any balanced cut has at most…
- op1957_dense_balanced_half_conditions_do_not_force_separatorThere is a graph on 16 vertices of minimum degree at least 10 and independence number at most two, whose every induced subgraph has at…
- extendible_high_degree_balanced_cut_odd_component_boundUnder the displayed extendibility, separator, degree and independence assumptions, each balanced cut has at most two odd components on the…
- extendible_common_nonneighbor_deficit_equality_matchableUnder the stated high-degree extendibility and independence assumptions, if an independent U with at least two vertices is anticomplete to…
- extendible_independent_common_nonneighbor_deficit_le_oneUnder the stated high-degree extendibility and independence assumptions, a nonempty independent U and a disjoint anticomplete W satisfy…
The proof, explained
The proof defines a predicate P(n) asserting the existence of a matching within S having n edges. Since every matching satisfies 2|E| = |V| ≤ |S|, the number of edges in any matching on S cannot exceed |S|. The empty subgraph witnesses P(0), so the greatest size k ≤ |S| satisfying P is obtained via Nat.findGreatest; any matching M witnessing P(k) is maximum, as a larger matching on S would contradict the maximality of k.
Define a predicate P(n) asserting the existence of an n-edge matching supported on S.
Under classical logic, define P(n) to be the proposition that there exists a subgraph M of G that is a matching, has all its vertices in S, and has exactly n edges.
set_option maxHeartbeats 4000000 in classical let P : ℕ → Prop := fun n => ∃ M : G.Subgraph, M.IsMatching ∧ M.verts ⊆ (S : Set V) ∧ M.edgeSet.ncard = n
P(0) holds, witnessed by the empty subgraph.
The empty subgraph ⊥ has no vertices and no edges. Thus, it vacuously satisfies the matching condition, its vertices are trivially contained in S, and its edge set has cardinality 0.
have hzero : P 0 := by refine ⟨⊥,?_,?_,?_⟩ · intro v hv simp at hv · simp · simp
There exists a valid matching M attaining the maximum edge count bounded by |S|, which serves as the candidate maximum matching.
Since 0 ≤ |S| and P(0) holds, Nat.findGreatest_spec ensures that P holds at the maximal value k ≤ |S| satisfying P, namely Nat.findGreatest P |S|. We unpack this to obtain a matching M with k edges, and propose M as the witness, reducing the goal to showing that M has at least as many edges as any other valid matching.
uses
Nat.findGreatest_spechave hP : P (Nat.findGreatest P S.card) := Nat.findGreatest_spec (by omega : 0 ≤ S.card) hzero obtain ⟨M,hM,hMS,hMcard⟩ := hP refine ⟨M,hM,hMS,?_⟩
Any matching N whose vertices lie in S has at most |S| edges.
Let N be any matching with vertices in S. By in1076_matching_twice_card, 2 * |E(N)| = |V(N)|. Since V(N) ⊆ S and S is finite, Set.ncard_le_ncard, Set.toFinite, and Set.ncard_coe_finset show that |V(N)| ≤ |S|. Combining these gives 2 * |E(N)| ≤ |S|, which implies |E(N)| ≤ |S| by linear arithmetic.
uses
in1076_matching_twice_card,Set.ncard_le_ncard,Set.toFinite,Set.ncard_coe_finsetintro N hN hNS have hNbound : N.edgeSet.ncard ≤ S.card := by have he := in1076_matching_twice_card hN have hv := Set.ncard_le_ncard hNS (Set.toFinite _) rw [Set.ncard_coe_finset] at hv omega
Every valid matching N satisfies |E(N)| ≤ |E(M)|, completing the proof.
Suppose for contradiction that |E(N)| > |E(M)|. Since |E(M)| = Nat.findGreatest P |S| and |E(N)| ≤ |S|, Nat.findGreatest_is_greatest implies that P(|E(N)|) is false. However, N witnesses that P(|E(N)|) is true, giving a contradiction.
uses
Nat.findGreatest_is_greatestby_contra hn have hgt : Nat.findGreatest P S.card < N.edgeSet.ncard := by omega have hno := Nat.findGreatest_is_greatest hgt hNbound exact hno ⟨N,hN,hNS,rfl⟩
Nat.findGreatest_spec- If a predicate P on ℕ holds at some m ≤ n, then P holds at the largest integer ≤ n satisfying P (given by Nat.findGreatest P n).
in1076_matching_twice_card- In any matching in a finite graph, the number of vertices is twice the number of edges.
Set.ncard_le_ncard- If a subset s is contained in a finite set t, then the cardinality of s is at most the cardinality of t.
Set.toFinite- A set is finite if its corresponding subtype is finite.
Set.ncard_coe_finset- The cardinality of a coerced Finset as a Set equals its cardinality as a Finset.
Nat.findGreatest_is_greatest- Any integer k ≤ n strictly greater than Nat.findGreatest P n does not satisfy P.
- The proof finds the maximum matching non-constructively by bounded search on matching sizes up to |S| using `Nat.findGreatest`, which requires classical logic since the existential predicate P is not constructively decidable.
Written by a model (gemini-3.8-flash) from the Lean proof and the goal states Lean reported at each step. Lean verified the proof; this explanation is a reading aid and is not itself machine-checked.
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem finite_subset_has_maximum_matching {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset V) : ∃ M : G.Subgraph, M.IsMatching ∧ M.verts ⊆ (S : Set V) ∧ ∀ N : G.Subgraph, N.IsMatching → N.verts ⊆ (S : Set V) → N.edgeSet.ncard ≤ M.edgeSet.ncard := by set_option maxHeartbeats 4000000 in classical let P : ℕ → Prop := fun n => ∃ M : G.Subgraph, M.IsMatching ∧ M.verts ⊆ (S : Set V) ∧ M.edgeSet.ncard = n have hzero : P 0 := by refine ⟨⊥,?_,?_,?_⟩ · intro v hv simp at hv · simp · simp have hP : P (Nat.findGreatest P S.card) := Nat.findGreatest_spec (by omega : 0 ≤ S.card) hzero obtain ⟨M,hM,hMS,hMcard⟩ := hP refine ⟨M,hM,hMS,?_⟩ intro N hN hNS have hNbound : N.edgeSet.ncard ≤ S.card := by have he := in1076_matching_twice_card hN have hv := Set.ncard_le_ncard hNS (Set.toFinite _) rw [Set.ncard_coe_finset] at hv omega by_contra hn have hgt : Nat.findGreatest P S.card < N.edgeSet.ncard := by omega have hno := Nat.findGreatest_is_greatest hgt hNbound exact hno ⟨N,hN,hNS,rfl⟩