maximum_matching_forbids_two_edge_three_edge_exchange
A maximum matching forbids replacing two matching edges by two edges from distinct uncovered vertices and an edge joining the two remaining endpoints.
Statement
theorem maximum_matching_forbids_two_edge_three_edge_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 c d : V) (huS : u ∈ S) (hvS : v ∈ S) (hu : u ∉ M.verts) (hv : v ∉ M.verts) (huv : u ≠ v) (hab : M.Adj a b) (hcd : M.Adj c d) (hac : a ≠ c) (had : a ≠ d) (hbc : b ≠ c) (hbd : b ≠ d) (hua : G.Adj u a) (hvc : G.Adj v c) (hbdEdge : G.Adj b d) : 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 1
- 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…
The proof, explained
The theorem proves that a maximum matching M supported on a vertex set S cannot admit an alternating path of length 5 of the form u - a - b - d - c - v, where ab and cd belong to M and u, v are distinct uncovered vertices in S. Deleting the two matching edges ab and cd produces a residual matching D of size |M| - 2 whose vertices are disjoint from {a, b, c, d}. Adding the three edges ua, vc, and bd yields a new matching D ⊔ E supported on S with |M| + 1 edges, which directly contradicts the maximality of M.
The endpoints a, b, c, d belong to the matching M, with a ≠ b and c ≠ d.
Because ab and cd are edges of the matching subgraph M, all four endpoints a, b, c, d belong to M.verts. Since G is a simple graph, adjacent vertices cannot be equal, so a ≠ b and c ≠ d.
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 hcM : c ∈ M.verts := M.edge_vert hcd have hdM : d ∈ M.verts := M.edge_vert hcd.symm have habne : a ≠ b := G.ne_of_adj (M.adj_sub hab) have hcdne : c ≠ d := G.ne_of_adj (M.adj_sub hcd)
The set T = {s(a, b), s(c, d)} consists of two distinct edges of M, so T ⊆ M.edgeSet.
The pairs s(a, b) and s(c, d) belong to M.edgeSet by definition of subgraph adjacency. If they were equal as unordered pairs, then either a = c or a = d by Sym2.eq_iff.mp, contradicting the hypotheses hac and had. Thus the two edges are distinct, and both belong to M.edgeSet.
uses
SimpleGraph.Subgraph.mem_edgeSet.mpr,Sym2.eq_iff.mp,Set.mem_insert_iff,Set.mem_singleton_ifflet T : Set (Sym2 V) := {s(a,b),s(c,d)} have he1 : s(a,b) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hab have he2 : s(c,d) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hcd have hene : s(a,b) ≠ s(c,d) := by intro he rcases Sym2.eq_iff.mp he with ⟨h,_⟩ | ⟨h,_⟩ · exact hac h · exact had h have hTM : T ⊆ M.edgeSet := by intro e he simp only [T,Set.mem_insert_iff,Set.mem_singleton_iff] at he rcases he with rfl | rfl <;> assumption
Deleting T from M yields a matching D disjoint from {a, b, c, d} with |D.edgeSet| + 2 = |M.edgeSet|.
By residual_matching_num_single_edge_exchange_iff_critical_del, deleting the edges T from M leaves a matching D with edge set M.edgeSet \ T. Every vertex of D is incident to an edge of D ⊆ M, so D.verts ⊆ M.verts. If an endpoint p of an edge pq ∈ T were in D.verts, it would be matched to some z in D; by uniqueness of matching edges in M, z = q, implying pq ∈ D.edgeSet = M.edgeSet \ T, a contradiction. Thus none of a, b, c, d belong to D.verts. Since T contains two distinct edges of the finite set M.edgeSet, |D.edgeSet| + 2 = |M.edgeSet| by Set.ncard_sdiff_add_ncard_of_subset and Set.ncard_pair.
uses
residual_matching_num_single_edge_exchange_iff_critical_del,SimpleGraph.Subgraph.mem_edgeSet.mp,SimpleGraph.Subgraph.mem_edgeSet.mpr,Sym2.eq_swap,Set.ncard_pair,Set.ncard_sdiff_add_ncard_of_subset,Set.toFiniteobtain ⟨D,hD,hDedge⟩ := residual_matching_num_single_edge_exchange_iff_critical_del hM T 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 hnotD : ∀ p q, M.Adj p q → s(p,q) ∈ T → p ∉ D.verts := by intro p q hpq hpT hpD obtain ⟨z,hpz,_⟩ := hD hpD have hh : s(p,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hpz rw [hDedge] at hh have hpzM : M.Adj p z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=q := (hM (M.edge_vert hpq)).unique hpzM hpq subst z exact hh.2 hpT have haD : a ∉ D.verts := hnotD a b hab (by simp [T]) have hbD : b ∉ D.verts := hnotD b a hab.symm (by simp [T,Sym2.eq_swap]) have hcD : c ∉ D.verts := hnotD c d hcd (by simp [T]) have hdD : d ∉ D.verts := hnotD d c hcd.symm (by simp [T,Sym2.eq_swap]) have hTcard : T.ncard = 2 := by simpa [T] using (Set.ncard_pair hene) have hcard : D.edgeSet.ncard + 2 = M.edgeSet.ncard := by have hh := Set.ncard_sdiff_add_ncard_of_subset hTM (Set.toFinite M.edgeSet) rw [← hDedge,hTcard] at hh exact hh
The three edges ua, vc, bd form a matching E of size 3 with vertices {u, v, b, a, c, d}.
We define two maps from Fin 3 to V by f = (u, v, b) and g = (a, c, d). Both maps are injective and their ranges are disjoint because u and v do not belong to M.verts while a, b, c, d do, and the hypotheses ensure no collisions among a, b, c, d. Furthermore, each pair (f(i), g(i)) is an edge of G (ua, vc, and bd). By indexed_disjoint_cross_edges_form_matching, these edges form a matching E of cardinality 3 whose vertex set is {u, v, b, a, c, d}.
uses
indexed_disjoint_cross_edges_form_matchinglet f : Fin 3 → V := ![u,v,b] let g : Fin 3 → V := ![a,c,d] 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 3 f g hf hg hfg hadj
The vertex sets of D and E are disjoint.
Any common vertex x would have to be in E.verts = {u, v, b, a, c, d}. But x ∈ D.verts ⊆ M.verts rules out u and v (which are not in M.verts), and none of a, b, c, d belong to D.verts as established earlier. Hence by Set.disjoint_left.mpr, D.verts and E.verts are disjoint.
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 on S with |M.edgeSet| + 1 edges, contradicting the maximality of M.
By extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard, the union of the vertex-disjoint matchings D and E is a matching with |D.edgeSet| + 3 edges. Its vertices all lie in S because D.verts ⊆ M.verts ⊆ S, u, v ∈ S, and a, b, c, d ∈ M.verts ⊆ S. Maximality of M then implies |D.edgeSet| + 3 ≤ |M.edgeSet|. Combined with |D.edgeSet| + 2 = |M.edgeSet|, this yields |M.edgeSet| + 1 ≤ |M.edgeSet|, an impossibility that omega refutes.
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 have haS := hMS haM have hbS := hMS hbM have hcS := hMS hcM have hdS := hMS hdM rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · fin_cases i <;> simp_all [f] · fin_cases i <;> simp_all [g] have hh := hmax (D ⊔ E) hsup.1 hsub rw [hsup.2,hEcard] at hh omega
SimpleGraph.Subgraph.mem_edgeSet.mpr- An adjacency between two vertices in a subgraph implies that the unordered pair of those vertices belongs to the subgraph's edge set.
Sym2.eq_iff.mp- Two unordered pairs s(a, b) and s(c, d) are equal only if either (a = c and b = d) or (a = d and b = c).
Set.mem_insert_iff- An element x belongs to {a} ∪ s if and only if x = a or x ∈ s.
Set.mem_singleton_iff- An element x belongs to the singleton set {b} if and only if x = b.
residual_matching_num_single_edge_exchange_iff_critical_del- For any matching N and any edge set T, deleting T leaves a matching N' with edge set N.edgeSet \ T.
SimpleGraph.Subgraph.mem_edgeSet.mp- If an unordered pair of vertices belongs to a subgraph's edge set, then those two vertices are adjacent in the subgraph.
Sym2.eq_swap- The unordered pair s(a, b) equals s(b, a).
Set.ncard_pair- If a ≠ b, the unordered pair set {a, b} has cardinality 2.
Set.ncard_sdiff_add_ncard_of_subset- If s ⊆ t and t is finite, then |t \ s| + |s| = |t|.
Set.toFinite- A set whose subtype is finite is a finite set.
indexed_disjoint_cross_edges_form_matching- If f, g : Fin r → V are injective with disjoint ranges and f(i) is adjacent to g(i) for all i, then the r edges between f(i) and g(i) form a matching of size r with vertices range(f) ∪ range(g).
Set.disjoint_left.mpr- Two sets s and t are disjoint if no element of s belongs to t.
extendible_graph_matchable_deletion_inherits_extendibility_sup_ncard- The union of two vertex-disjoint matchings is a matching whose edge count is the sum of their edge counts.
- The disjointness and injectivity of the three added cross edges are verified by exhaustive case analysis (`fin_cases`) over index pairs in `Fin 3`.
- The final arithmetic contradiction (|M| + 1 ≤ |M|) is closed by `omega`.
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_two_edge_three_edge_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 c d : V) (huS : u ∈ S) (hvS : v ∈ S) (hu : u ∉ M.verts) (hv : v ∉ M.verts) (huv : u ≠ v) (hab : M.Adj a b) (hcd : M.Adj c d) (hac : a ≠ c) (had : a ≠ d) (hbc : b ≠ c) (hbd : b ≠ d) (hua : G.Adj u a) (hvc : G.Adj v c) (hbdEdge : G.Adj b d) : 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 hcM : c ∈ M.verts := M.edge_vert hcd have hdM : d ∈ M.verts := M.edge_vert hcd.symm have habne : a ≠ b := G.ne_of_adj (M.adj_sub hab) have hcdne : c ≠ d := G.ne_of_adj (M.adj_sub hcd) let T : Set (Sym2 V) := {s(a,b),s(c,d)} have he1 : s(a,b) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hab have he2 : s(c,d) ∈ M.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hcd have hene : s(a,b) ≠ s(c,d) := by intro he rcases Sym2.eq_iff.mp he with ⟨h,_⟩ | ⟨h,_⟩ · exact hac h · exact had h have hTM : T ⊆ M.edgeSet := by intro e he simp only [T,Set.mem_insert_iff,Set.mem_singleton_iff] at he rcases he with rfl | rfl <;> assumption obtain ⟨D,hD,hDedge⟩ := residual_matching_num_single_edge_exchange_iff_critical_del hM T 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 hnotD : ∀ p q, M.Adj p q → s(p,q) ∈ T → p ∉ D.verts := by intro p q hpq hpT hpD obtain ⟨z,hpz,_⟩ := hD hpD have hh : s(p,z) ∈ D.edgeSet := SimpleGraph.Subgraph.mem_edgeSet.mpr hpz rw [hDedge] at hh have hpzM : M.Adj p z := SimpleGraph.Subgraph.mem_edgeSet.mp hh.1 have hz : z=q := (hM (M.edge_vert hpq)).unique hpzM hpq subst z exact hh.2 hpT have haD : a ∉ D.verts := hnotD a b hab (by simp [T]) have hbD : b ∉ D.verts := hnotD b a hab.symm (by simp [T,Sym2.eq_swap]) have hcD : c ∉ D.verts := hnotD c d hcd (by simp [T]) have hdD : d ∉ D.verts := hnotD d c hcd.symm (by simp [T,Sym2.eq_swap]) have hTcard : T.ncard = 2 := by simpa [T] using (Set.ncard_pair hene) have hcard : D.edgeSet.ncard + 2 = M.edgeSet.ncard := by have hh := Set.ncard_sdiff_add_ncard_of_subset hTM (Set.toFinite M.edgeSet) rw [← hDedge,hTcard] at hh exact hh let f : Fin 3 → V := ![u,v,b] let g : Fin 3 → V := ![a,c,d] 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 3 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 have haS := hMS haM have hbS := hMS hbM have hcS := hMS hcM have hdS := hMS hdM rcases hxE with ⟨i,hi⟩ | ⟨i,hi⟩ · fin_cases i <;> simp_all [f] · fin_cases i <;> simp_all [g] have hh := hmax (D ⊔ E) hsup.1 hsub rw [hsup.2,hEcard] at hh omega