maximum_matching_forbids_one_edge_two_uncovered_exchange
A maximum matching cannot contain an edge whose two endpoints have distinct uncovered neighbors.
Statement
theorem maximum_matching_forbids_one_edge_two_uncovered_exchange {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset V) (M : G.Subgraph) (hM : M.IsMatching) (hMS : M.verts ⊆ (S : Set V)) (hmax : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (S : Set V) → T.edgeSet.ncard ≤ M.edgeSet.ncard) (u v a b : V) (huS : u ∈ S) (hvS : v ∈ S) (hu : u ∉ M.verts) (hv : v ∉ M.verts) (huv : u ≠ v) (hab : M.Adj a b) (hua : G.Adj u a) (hvb : G.Adj v b) : False
- Source
- Maximum-matching exchange for OP-1957; https://arxiv.org/abs/1011.3384.
- Verified
- 28 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 4
- is_k_extendableFor a finite vertex type V (with [Fintype V]), a simple graph G : SimpleGraph V and k : ℕ, is_k_extendable G k is the Prop that is the…
- indexed_disjoint_cross_edges_form_matchingInjectively indexed edges with disjoint endpoint ranges form a matching of the expected size.
- extendible_graph_matchable_deletion_inherits_extendibilityIf a graph is (r+j)-extendible and a 2j-vertex set U induces a perfect matching, then its induced complement is r-extendible, provided the…
- residual_matching_num_single_edge_exchange_iff_criticalLet G be a finite simple graph on a finite vertex type V, M a maximum matching of G, u an M-free vertex, and vw an edge of M such that uv…
- Used by 2
- maximum_matching_uncovered_incidence_independence_boundFor a maximum matching with t uncovered vertices, a global independent-set bound k bounds the number of edges from uncovered vertices to…
- op1957_min_degree_forces_matchingA finite graph on at least 2k vertices with minimum degree at least k has a matching of k edges.
The proof, explained
Suppose for contradiction that a maximum matching M on S contains an edge {a, b} whose endpoints have distinct uncovered neighbors u and v in S. Deleting {a, b} from M leaves a residual matching D with one fewer edge that covers neither a nor b. Adding the two disjoint edges {u, a} and {v, b} yields a new matching D ⊔ E on S with |M| + 1 edges, contradicting the maximality of M.
The endpoints a and b are distinct vertices covered by the matching M.
Enable classical logic. Since (a, b) is an edge of M, both a and b are vertices of M. Moreover, since they are connected by an edge in the simple graph G, they are distinct (a ≠ b).
set_option maxHeartbeats 4000000 in classical have haM : a ∈ M.verts := M.edge_vert hab have hbM : b ∈ M.verts := M.edge_vert hab.symm have habne : a ≠ b := G.ne_of_adj (M.adj_sub hab)
Deleting the edge {a, b} from M produces a matching D whose vertices are contained in M.
By residual_matching_num_single_edge_exchange_iff_critical_del, removing the single edge {a, b} from M yields a subgraph D that is also a matching, with edges D.edgeSet = M.edgeSet \ {{a, b}}. Every vertex in D is incident to some edge of D, which is also an edge of M, so D.verts ⊆ M.verts.
uses
residual_matching_num_single_edge_exchange_iff_critical_del,SimpleGraph.Subgraph.mem_edgeSet.mpr,SimpleGraph.Subgraph.mem_edgeSet.mpobtain ⟨D,hD,hDedge⟩ := residual_matching_num_single_edge_exchange_iff_critical_del hM ({s(a,b)} : Set (Sym2 V)) have hDsub : D.verts ⊆ M.verts := by intro x hx obtain ⟨y,hxy,_⟩ := hD hx have hh : s(x,y) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hxy rw [hDedge] at hh exact M.edge_vert (SimpleGraph.Subgraph.mem_edgeSet.mp hh.1)
Neither a nor b is a vertex in the residual matching D.
If a were in D.verts, it would be incident to an edge {a, z} in D, which is also an edge in M. But in matching M, a is incident to b, so by uniqueness of matching partners, z = b. This would force {a, b} to be in D.edgeSet = M.edgeSet \ {{a, b}}, a contradiction. The exact same argument, using symmetry of unordered pairs (Sym2.eq_swap), shows b ∉ D.verts.
uses
SimpleGraph.Subgraph.mem_edgeSet.mpr,SimpleGraph.Subgraph.mem_edgeSet.mp,Sym2.eq_swaphave haD : a ∉ D.verts := by intro ha obtain ⟨z,haz,_⟩ := hD ha have hh : s(a,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr haz rw [hDedge] at hh have hazM : M.Adj a z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=b := (hM haM).unique hazM hab subst z exact hh.2 (by simp) have hbD : b ∉ D.verts := by intro hb obtain ⟨z,hbz,_⟩ := hD hb have hh : s(b,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hbz rw [hDedge] at hh have hbzM : M.Adj b z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=a := (hM hbM).unique hbzM hab.symm subst z apply hh.2 simp [Sym2.eq_swap]
The residual matching D has exactly one fewer edge than M, so |D.edgeSet| + 1 = |M.edgeSet|.
The edge {a, b} is in M.edgeSet, so the singleton {{a, b}} is a subset of the finite set M.edgeSet. Applying Set.ncard_sdiff_add_ncard_of_subset to {{a, b}} ⊆ M.edgeSet shows that |M.edgeSet \ {{a, b}}| + 1 = |M.edgeSet|.
uses
SimpleGraph.Subgraph.mem_edgeSet.mpr,Set.ncard_sdiff_add_ncard_of_subset,Set.toFinitehave he : s(a,b) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hab have hcard : D.edgeSet.ncard + 1 = M.edgeSet.ncard := by have hs : ({s(a,b)} : Set (Sym2 V)) ⊆ M.edgeSet := by simpa using he have hh := Set.ncard_sdiff_add_ncard_of_subset hs (Set.toFinite M.edgeSet) simpa [← hDedge] using hh
The two cross edges {u, a} and {v, b} form a 2-edge matching E on {u, v, a, b}.
Define sequences f = ![u, v] and g = ![a, b]. Both f and g are injective because u ≠ v and a ≠ b. Their ranges are disjoint because u, v are uncovered by M while a, b belong to M.verts. Since u ~ a and v ~ b in G, indexed_disjoint_cross_edges_form_matching packages these two edges into a matching E with 2 edges and vertices {u, v, a, b}.
uses
indexed_disjoint_cross_edges_form_matchinglet f : Fin 2 → V := ![u,v] let g : Fin 2 → V := ![a,b] have hf : Function.Injective f := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [f] have hg : Function.Injective g := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [g] have hfg : ∀ i j, f i ≠ g j := by intro i j heq fin_cases i <;> fin_cases j <;> simp_all [f,g] have hadj : ∀ i, G.Adj (f i) (g i) := by intro i fin_cases i <;> simp_all [f,g] obtain ⟨E,hE,hEcard,hEverts⟩ := indexed_disjoint_cross_edges_form_matching G 2 f g hf hg hfg hadj
The vertex sets of D and E are disjoint.
Using Set.disjoint_left.mpr, we show no vertex of E can be in D. The vertices of E are {u, v, a, b}. Any vertex in {u, v} cannot be in D.verts because D.verts ⊆ M.verts and u, v ∉ M.verts. Neither a nor b can be in D.verts because both were shown to be excluded from D.
uses
Set.disjoint_left.mprhave hDE : Disjoint D.verts E.verts := by apply Set.disjoint_left.mpr intro x hxD hxE rw [hEverts] at hxE rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · have hxM := hDsub hxD fin_cases i <;> simp_all [f] · fin_cases i <;> simp_all [g]
The union D ⊔ E is a matching contained in S with |D.edgeSet| + 2 edges.
By extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard, the union of the vertex-disjoint matchings D and E is a matching whose size is |D.edgeSet| + |E.edgeSet| = |D.edgeSet| + 2. All vertices of D ⊔ E belong to S because D.verts ⊆ M.verts ⊆ S, u, v ∈ S by assumption, and a, b ∈ M.verts ⊆ S.
uses
extendible_graph_matchable_deletion_inherits_extendibility_sup_ncardhave hsup := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard D E hD hE hDE have hsub : (D ⊔ E).verts ⊆ (S : Set V) := by intro x hx change x ∈ D.verts ∪ E.verts at hx rcases hx with hxD | hxE · exact hMS (hDsub hxD) · rw [hEverts] at hxE rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · fin_cases i <;> simp_all [f] · have haS := hMS haM have hbS := hMS hbM fin_cases i <;> simp_all [g]
Contradiction with the maximality of M.
By the maximality of M among matchings contained in S, |(D ⊔ E).edgeSet| ≤ |M.edgeSet|. Substituting the computed cardinalities gives |D.edgeSet| + 2 ≤ |D.edgeSet| + 1, which omega refutes by linear integer arithmetic.
have hh := hmax (D ⊔ E) hsup.1 hsub rw [hsup.2,hEcard] at hh omega
residual_matching_num_single_edge_exchange_iff_critical_del- Deleting any set of edges from a matching yields a subgraph that is also a matching, with those edges removed.
SimpleGraph.Subgraph.mem_edgeSet.mpr- If two vertices are adjacent in a subgraph, then the unordered pair connecting them belongs to its edge set.
SimpleGraph.Subgraph.mem_edgeSet.mp- If an unordered pair belongs to the edge set of a subgraph, then its endpoints are adjacent in that subgraph.
Sym2.eq_swap- An unordered pair is symmetric in its endpoints: s(a, b) = s(b, a).
Set.ncard_sdiff_add_ncard_of_subset- For any subset s of a finite set t, the cardinality of t \ s plus the cardinality of s equals the cardinality of t.
Set.toFinite- A set whose coerced subtype is finite is a finite set.
indexed_disjoint_cross_edges_form_matching- A family of disjoint edges connecting two injective, disjoint sequences of vertices forms a matching subgraph whose vertices are the endpoints.
Set.disjoint_left.mpr- Two sets are disjoint if no element of the first belongs to the second.
extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard- The union of two vertex-disjoint matchings is a matching, and its edge count is the sum of their edge counts.
- The proof checks injectivity and vertex-disjointness for the two new edges by exhaustive case analysis (`fin_cases`) on `Fin 2` rather than general set-theoretic lemmas.
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 maximum_matching_forbids_one_edge_two_uncovered_exchange {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (S : Finset V) (M : G.Subgraph) (hM : M.IsMatching) (hMS : M.verts ⊆ (S : Set V)) (hmax : ∀ T : G.Subgraph, T.IsMatching → T.verts ⊆ (S : Set V) → T.edgeSet.ncard ≤ M.edgeSet.ncard) (u v a b : V) (huS : u ∈ S) (hvS : v ∈ S) (hu : u ∉ M.verts) (hv : v ∉ M.verts) (huv : u ≠ v) (hab : M.Adj a b) (hua : G.Adj u a) (hvb : G.Adj v b) : False := by set_option maxHeartbeats 4000000 in classical have haM : a ∈ M.verts := M.edge_vert hab have hbM : b ∈ M.verts := M.edge_vert hab.symm have habne : a ≠ b := G.ne_of_adj (M.adj_sub hab) obtain ⟨D,hD,hDedge⟩ := residual_matching_num_single_edge_exchange_iff_critical_del hM ({s(a,b)} : Set (Sym2 V)) have hDsub : D.verts ⊆ M.verts := by intro x hx obtain ⟨y,hxy,_⟩ := hD hx have hh : s(x,y) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hxy rw [hDedge] at hh exact M.edge_vert (SimpleGraph.Subgraph.mem_edgeSet.mp hh.1) have haD : a ∉ D.verts := by intro ha obtain ⟨z,haz,_⟩ := hD ha have hh : s(a,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr haz rw [hDedge] at hh have hazM : M.Adj a z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=b := (hM haM).unique hazM hab subst z exact hh.2 (by simp) have hbD : b ∉ D.verts := by intro hb obtain ⟨z,hbz,_⟩ := hD hb have hh : s(b,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hbz rw [hDedge] at hh have hbzM : M.Adj b z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=a := (hM hbM).unique hbzM hab.symm subst z apply hh.2 simp [Sym2.eq_swap] have he : s(a,b) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hab have hcard : D.edgeSet.ncard + 1 = M.edgeSet.ncard := by have hs : ({s(a,b)} : Set (Sym2 V)) ⊆ M.edgeSet := by simpa using he have hh := Set.ncard_sdiff_add_ncard_of_subset hs (Set.toFinite M.edgeSet) simpa [← hDedge] using hh let f : Fin 2 → V := ![u,v] let g : Fin 2 → V := ![a,b] have hf : Function.Injective f := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [f] have hg : Function.Injective g := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all [g] have hfg : ∀ i j, f i ≠ g j := by intro i j heq fin_cases i <;> fin_cases j <;> simp_all [f,g] have hadj : ∀ i, G.Adj (f i) (g i) := by intro i fin_cases i <;> simp_all [f,g] obtain ⟨E,hE,hEcard,hEverts⟩ := indexed_disjoint_cross_edges_form_matching G 2 f g hf hg hfg hadj have hDE : Disjoint D.verts E.verts := by apply Set.disjoint_left.mpr intro x hxD hxE rw [hEverts] at hxE rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · have hxM := hDsub hxD fin_cases i <;> simp_all [f] · fin_cases i <;> simp_all [g] have hsup := extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard D E hD hE hDE have hsub : (D ⊔ E).verts ⊆ (S : Set V) := by intro x hx change x ∈ D.verts ∪ E.verts at hx rcases hx with hxD | hxE · exact hMS (hDsub hxD) · rw [hEverts] at hxE rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · fin_cases i <;> simp_all [f] · have haS := hMS haM have hbS := hMS hbM fin_cases i <;> simp_all [g] have hh := hmax (D ⊔ E) hsup.1 hsub rw [hsup.2,hEcard] at hh omega