k_extendable_essential_edge_unextendible_matching
If G is k-extendable and deleting edge e destroys k-extendability, then a k-matching remains after the deletion but fails to extend to a perfect matching.
Statement
theorem k_extendable_essential_edge_unextendible_matching {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ) (hG : is_k_extendable G k) (e : Sym2 V) (he : e ∈ G.edgeSet) (hessential : ¬ is_k_extendable (G.deleteEdges {e}) k) : ∃ M : (G.deleteEdges {e}).Subgraph, M.IsMatching ∧ M.edgeSet.ncard = k ∧ ¬ ∃ P : (G.deleteEdges {e}).Subgraph, P.IsPerfectMatching ∧ M ≤ P
- Source
- OP-1957: reusable extraction of a matching witness from minimality, needed before applying any residual-graph obstruction.
- Verified
- 20 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 3
- 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…
- matching_vertices_card_at_most_twice_edgesThe vertices of a matching with k edges fit in a set of at most 2k vertices.
- op_2037_subgraph_fintypeA graph on a finite decidable vertex type has only finitely many subgraphs.
- Used by 3
- factorcritical_saturated_twin_first_forced_edge_has_removable_incident_edgeA 2k-factor-critical k-extendible graph with the displayed saturated complement twins, first forced zero-codegree residual edge and order…
- k_extendable_essential_low_codegree_edge_yields_small_vertex_cutAn essential graph edge of complement codegree at most one gives a vertex separator of size at most 2k+1 in a k-extendable graph of…
- k_extendable_essential_edge_has_forced_matching_residualAn essential edge of a k-extendible graph is forced in a perfect-matching residual on n−2k vertices.
The proof, explained
We prove the theorem by contradiction: if every k-matching in G \ {e} extended to a perfect matching, then G \ {e} would be k-extendable (since the vertex count |V| ≥ 2k + 2 is preserved), contradicting the assumption that e is essential. The core task is to show that G \ {e} still contains at least one k-matching. Starting from a k-matching M0 of G, if e ∉ M0 then M0 remains valid in G \ {e}; if e ∈ M0, we extend M0 to a perfect matching P0 and, using |V| ≥ 2k + 2, locate an edge of P0 entirely disjoint from M0 to replace e.
The edge e is an edge uv between distinct vertices, G has at least 2k + 2 vertices and contains a k-matching M0, and adjacency in G \ {uv} is characterized.
We represent the undirected edge e as an unordered pair s(u, v) using Sym2.ind. Because e is an edge of G, u and v are adjacent, hence distinct. From the assumption that G is k-extendable, we extract that |V| ≥ 2k + 2 (hcard), that G contains a matching M0 of size k (hM0, hM0k), and that every k-matching of G extends to a perfect matching (hext). We also record that an edge is in G \ {uv} iff it is in G and distinct from uv (SimpleGraph.deleteEdges_adj), and that two unordered pairs are equal iff their endpoints coincide in some order (Sym2.eq_iff).
uses
Sym2.ind,SimpleGraph.deleteEdges_adj,Sym2.eq_iffclassical induction e using Sym2.ind with | _ u v => have huv : G.Adj u v := G.mem_edgeSet.mp he obtain ⟨hcard, ⟨M0, hM0, hM0k⟩, hext⟩ := hG have hG' : ∀ x y : V, (G.deleteEdges {s(u, v)}).Adj x y ↔ G.Adj x y ∧ s(x, y) ≠ s(u, v) := by intro x y simp [SimpleGraph.deleteEdges_adj] have hsym : ∀ x y : V, s(x, y) = s(u, v) → (x = u ∧ y = v) ∨ (x = v ∧ y = u) := by intro x y h simpa [Sym2.eq_iff] using h have huvne : u ≠ v := huv.ne
If M0 contains the edge uv, there is an edge ww' in a perfect extension P0 of M0 that avoids all vertices of M0 (and hence avoids u and v).
We observe that no vertex in M0 is incident to two distinct edges (hM0u). We case-split on whether M0 contains the edge uv. If it does, M0 extends to a perfect matching P0 of G. Because M0 has size k, its vertices are contained in a subset S0 of size at most 2k by matching_vertices_card_at_most_twice_edges. Since |V| ≥ 2k + 2, not all vertices can lie in S0 (by Finset.card_univ, not_exists, not_not, Finset.eq_univ_iff_forall.mpr, and linear arithmetic), yielding a vertex w outside M0. In P0, w is matched to some w' (via SimpleGraph.Subgraph.isPerfectMatching_iff.mp). If w' were covered by M0, the uniqueness of the partner of w' in P0 would force its M0-partner to be w, contradicting that w is outside M0. Thus both w and w' avoid M0, meaning neither is u or v. Finally, every other edge of M0 cannot meet u or v (hoff, using Sym2.eq_swap).
uses
SimpleGraph.Subgraph.isPerfectMatching_iff.mp,matching_vertices_card_at_most_twice_edges,not_exists,not_not,Finset.eq_univ_iff_forall.mpr,Finset.card_univ,Sym2.eq_swaphave hb : ∃ M : (G.deleteEdges {s(u, v)}).Subgraph, M.IsMatching ∧ M.edgeSet.ncard = k := by have hM0u : ∀ {x y y' : V}, M0.Adj x y → M0.Adj x y' → y = y' := by intro x y y' h h' exact (hM0 (M0.edge_vert h)).unique h h' by_cases hM0uv : M0.Adj u v · obtain ⟨P0, hP0, hM0P0⟩ := hext M0 hM0 hM0k have hP0' := SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP0 obtain ⟨S0, hS0, hS0c⟩ := matching_vertices_card_at_most_twice_edges M0 hM0 hM0k obtain ⟨w, hw⟩ : ∃ w : V, w ∉ S0 := by by_contra hall simp only [not_exists, not_not] at hall have h1 : S0 = Finset.univ := Finset.eq_univ_iff_forall.mpr hall rw [h1, Finset.card_univ] at hS0c omega have hwM : w ∉ M0.verts := fun h => hw (hS0 w h) obtain ⟨w', hww', -⟩ := hP0' w have hw'M : w' ∉ M0.verts := by intro h obtain ⟨c, hc, -⟩ := hM0 h have : c = w := (hP0' w').unique (hM0P0.2 hc) hww'.symm exact hwM (this ▸ M0.edge_vert hc.symm) have hwne : w ≠ w' := (P0.adj_sub hww').ne have huM : u ∈ M0.verts := M0.edge_vert hM0uv have hvM : v ∈ M0.verts := M0.edge_vert hM0uv.symm have hwu : w ≠ u := fun h => hwM (h ▸ huM) have hwv : w ≠ v := fun h => hwM (h ▸ hvM) -- an M0-edge other than uv avoids u and v have hoff : ∀ {x y : V}, M0.Adj x y → s(x, y) ≠ s(u, v) → x ≠ u ∧ x ≠ v := by intro x y hxy hne constructor · rintro rfl exact hne (by rw [hM0u hxy hM0uv]) · rintro rfl exact hne (by rw [hM0u hxy hM0uv.symm]; exact Sym2.eq_swap)
Replacing uv with ww' in M0 yields a well-defined subgraph M1 of G \ {uv}.
We define M1 with vertex set (V(M0) \ {u, v}) ∪ {w, w'} and edge set consisting of the edges of M0 other than uv, together with ww'. Every edge of M0 \ {uv} remains in G \ {uv}, and ww' is an edge of P0 ⊆ G that avoids uv since w ∉ {u, v}. Furthermore, the endpoints of edges in M0 \ {uv} lie in V(M0) \ {u, v} because no other edge touches u or v (hoff), and the endpoints of ww' lie in {w, w'} (using Or.inl and Or.inr). Finally, adjacency is symmetric (using Sym2.eq_swap).
uses
Or.inl,Or.inr,Sym2.eq_swaplet M1 : (G.deleteEdges {s(u, v)}).Subgraph := { verts := (M0.verts \ {u, v}) ∪ {w, w'} Adj := fun x y => (M0.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ (x = w ∧ y = w') ∨ (x = w' ∧ y = w) adj_sub := by rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact (hG' x y).mpr ⟨M0.adj_sub h, hne⟩ · refine (hG' _ _).mpr ⟨P0.adj_sub hww', fun he => ?_⟩ rcases hsym _ _ he with ⟨h1, -⟩ | ⟨h1, -⟩ · exact hwu h1 · exact hwv h1 · refine (hG' _ _).mpr ⟨P0.adj_sub hww'.symm, fun he => ?_⟩ rcases hsym _ _ he with ⟨-, h1⟩ | ⟨-, h1⟩ · exact hwv h1 · exact hwu h1 edge_vert := by rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · obtain ⟨h1, h2⟩ := hoff h hne exact Or.inl ⟨M0.edge_vert h, by simp [h1, h2]⟩ · exact Or.inr (by simp) · exact Or.inr (by simp) symm := by refine ⟨?_⟩ rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact Or.inl ⟨h.symm, by rwa [Sym2.eq_swap]⟩ · exact Or.inr (Or.inr ⟨rfl, rfl⟩) · exact Or.inr (Or.inl ⟨rfl, rfl⟩) }
The subgraph M1 is a matching.
We verify that each vertex x of M1 has a unique incident edge in M1, splitting into cases via Set.mem_insert_iff, Set.mem_singleton_iff, and not_or. If x ∈ V(M0) \ {u, v}, its incident edge in M0 is not uv and its partner is also in V(M0) \ {u, v}; it cannot be incident to ww' because w, w' ∉ V(M0). If x = w or x = w', it cannot be incident to any edge of M0 (since w, w' ∉ V(M0)), so its unique incident edge is ww' (using Or.inl and Or.inr).
uses
Set.mem_insert_iff,Set.mem_singleton_iff,not_or,Or.inl,Or.inrrefine ⟨M1, ?_, ?_⟩ · intro x hx rcases hx with ⟨hx0, hxuv⟩ | hxw · simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hxuv obtain ⟨y, hy, -⟩ := hM0 hx0 have hne : s(x, y) ≠ s(u, v) := by intro he rcases hsym _ _ he with ⟨h1, -⟩ | ⟨h1, -⟩ · exact hxuv.1 h1 · exact hxuv.2 h1 refine ⟨y, Or.inl ⟨hy, hne⟩, ?_⟩ rintro y' (⟨h', -⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact hM0u h' hy · exact absurd hx0 hwM · exact absurd hx0 hw'M · simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hxw rcases hxw with rfl | rfl · refine ⟨w', Or.inr (Or.inl ⟨rfl, rfl⟩), ?_⟩ rintro y' (⟨h', -⟩ | ⟨-, rfl⟩ | ⟨h1, -⟩) · exact absurd (M0.edge_vert h') hwM · rfl · exact absurd h1 hwne · refine ⟨w, Or.inr (Or.inr ⟨rfl, rfl⟩), ?_⟩ rintro y' (⟨h', -⟩ | ⟨h1, -⟩ | ⟨-, rfl⟩) · exact absurd (M0.edge_vert h') hw'M · exact absurd h1.symm hwne · rfl
The edge set of M1 has cardinality k.
Using Sym2.ind, Set.mem_singleton_iff, and Sym2.eq_iff, we identify the edge set of M1 as (E(M0) \ {uv}) ∪ {ww'}. Since w ∉ V(M0), the edge ww' is disjoint from E(M0) \ {uv} by Set.disjoint_singleton_right. Because uv ∈ E(M0), removing uv subtracts 1 (Set.ncard_sdiff_singleton_of_mem), and taking the disjoint union with {ww'} adds 1 (Set.ncard_union_eq, Set.toFinite, Set.ncard_singleton). Since M0 has k edges and is nonempty (Set.ncard_pos), the size of M1 is (k - 1) + 1 = k.
uses
Sym2.ind,Set.mem_singleton_iff,Sym2.eq_iff,Set.disjoint_singleton_right,Set.ncard_union_eq,Set.toFinite,Set.ncard_sdiff_singleton_of_mem,Set.ncard_singleton,Set.ncard_pos· have hE : M1.edgeSet = (M0.edgeSet \ {s(u, v)}) ∪ {s(w, w')} := by ext e induction e using Sym2.ind with | h x y => simp only [SimpleGraph.Subgraph.mem_edgeSet, Set.mem_union, Set.mem_sdiff, Set.mem_singleton_iff] show ((M0.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ (x = w ∧ y = w') ∨ (x = w' ∧ y = w)) ↔ _ simp only [Sym2.eq_iff, ne_eq] have hdisj : Disjoint (M0.edgeSet \ {s(u, v)}) {s(w, w')} := by rw [Set.disjoint_singleton_right] rintro ⟨h, -⟩ exact hwM (M0.edge_vert h) have hmem : s(u, v) ∈ M0.edgeSet := hM0uv rw [hE, Set.ncard_union_eq hdisj (Set.toFinite _) (Set.toFinite _), Set.ncard_sdiff_singleton_of_mem hmem, Set.ncard_singleton, hM0k] have hpos : 0 < M0.edgeSet.ncard := Set.ncard_pos (Set.toFinite _) |>.mpr ⟨_, hmem⟩ omega
If M0 does not contain uv, M0 itself is a k-matching in G \ {uv}, completing the proof that G \ {uv} contains a k-matching.
If uv is not in M0, then no edge of M0 is deleted, so M0 is already a subgraph of G \ {uv}. Its matching property is inherited directly from M0, and its edge set has cardinality k by congrArg, Eq.trans, Sym2.ind, and Iff.rfl. This establishes that G \ {uv} always admits a matching of size k (hb).
uses
Eq.trans,congrArg,Sym2.ind,Iff.rfl· refine ⟨⟨M0.verts, M0.Adj, fun {x y} h => (hG' x y).mpr ⟨M0.adj_sub h, fun he => ?_⟩, M0.edge_vert, M0.symm⟩, fun x hx => hM0 hx, ?_⟩ · rcases hsym _ _ he with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact hM0uv h · exact hM0uv h.symm · refine Eq.trans (congrArg Set.ncard ?_) hM0k ext e; induction e using Sym2.ind; exact Iff.rfl
There exists a k-matching in G \ {e} that does not extend to a perfect matching in G \ {e}.
We argue by contradiction (by_contra). If every k-matching in G \ {e} extended to a perfect matching in G \ {e}, then G \ {e} would satisfy all three requirements of k-extendability: the vertex bound |V| ≥ 2k + 2 is inherited from G (hcard), G \ {e} has a k-matching (hb), and every k-matching extends. This contradicts the hypothesis hessential that deleting e destroys k-extendability.
by_contra hcon push Not at hcon exact hessential ⟨hcard, hb, fun M hM hk => hcon M hM hk⟩
congrArg- Congruence of functions across equality: if a₁ = a₂, then f(a₁) = f(a₂).
Eq.trans- Transitivity of equality: if a = b and b = c, then a = c.
Finset.card_univ- The cardinality of the universal finset on a finite type equals the cardinality of the type.
Finset.eq_univ_iff_forall.mpr- A finset is the universal finset if every element of the type belongs to it.
Iff.rfl- Reflexivity of logical equivalence: P ↔ P.
matching_vertices_card_at_most_twice_edges- The vertices covered by any matching of size k are contained in a subset of size at most 2k.
not_exists- Negation distributes over existential quantification: ¬(∃ x, p x) ↔ ∀ x, ¬p x.
not_not- Double negation elimination: ¬¬P ↔ P.
not_or- De Morgan's law for disjunction: ¬(P ∨ Q) ↔ ¬P ∧ ¬Q.
Or.inl- Constructs a proof of P ∨ Q from a proof of P.
Or.inr- Constructs a proof of P ∨ Q from a proof of Q.
Set.disjoint_singleton_right- A set is disjoint from a singleton {a} if and only if a is not in the set.
Set.mem_insert_iff- Membership in an inserted set: x ∈ insert a s ↔ x = a ∨ x ∈ s.
Set.mem_singleton_iff- Membership in a singleton set: a ∈ {b} ↔ a = b.
Set.ncard_pos- The cardinality of a finite set is strictly positive if and only if the set is nonempty.
Set.ncard_sdiff_singleton_of_mem- Removing an element from a set reduces its cardinality by 1 if the element belongs to the set.
Set.ncard_singleton- The cardinality of a singleton set is 1.
Set.ncard_union_eq- The cardinality of the union of two disjoint finite sets is the sum of their cardinalities.
Set.toFinite- Any set on a finite type is finite.
SimpleGraph.deleteEdges_adj- Adjacency in a graph with deleted edges: x and y are adjacent in G \ s iff they are adjacent in G and the edge xy is not in s.
SimpleGraph.Subgraph.isPerfectMatching_iff.mp- A subgraph is a perfect matching iff every vertex of the ambient graph has a unique incident edge in the subgraph.
Sym2.eq_iff- Two unordered pairs s(x, y) and s(z, w) are equal iff (x = z ∧ y = w) ∨ (x = w ∧ y = z).
Sym2.eq_swap- An unordered pair is symmetric in its arguments: s(a, b) = s(b, a).
Sym2.ind- Induction on unordered pairs: to prove a property of an unordered pair, it suffices to prove it for pairs of the form s(x, y).
- The existence of a vertex outside the matching vertices S0 relies on Presburger arithmetic (omega) to conclude that the subset S0 of size at most 2k cannot cover the entire vertex set of cardinality at least 2k + 2.
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 k_extendable_essential_edge_unextendible_matching {V : Type*} [Fintype V] [DecidableEq V] (G : SimpleGraph V) (k : ℕ) (hG : is_k_extendable G k) (e : Sym2 V) (he : e ∈ G.edgeSet) (hessential : ¬ is_k_extendable (G.deleteEdges {e}) k) : ∃ M : (G.deleteEdges {e}).Subgraph, M.IsMatching ∧ M.edgeSet.ncard = k ∧ ¬ ∃ P : (G.deleteEdges {e}).Subgraph, P.IsPerfectMatching ∧ M ≤ P := by classical induction e using Sym2.ind with | _ u v => have huv : G.Adj u v := G.mem_edgeSet.mp he obtain ⟨hcard, ⟨M0, hM0, hM0k⟩, hext⟩ := hG have hG' : ∀ x y : V, (G.deleteEdges {s(u, v)}).Adj x y ↔ G.Adj x y ∧ s(x, y) ≠ s(u, v) := by intro x y simp [SimpleGraph.deleteEdges_adj] have hsym : ∀ x y : V, s(x, y) = s(u, v) → (x = u ∧ y = v) ∨ (x = v ∧ y = u) := by intro x y h simpa [Sym2.eq_iff] using h have huvne : u ≠ v := huv.ne -- (b) a k-matching of G - uv have hb : ∃ M : (G.deleteEdges {s(u, v)}).Subgraph, M.IsMatching ∧ M.edgeSet.ncard = k := by have hM0u : ∀ {x y y' : V}, M0.Adj x y → M0.Adj x y' → y = y' := by intro x y y' h h' exact (hM0 (M0.edge_vert h)).unique h h' by_cases hM0uv : M0.Adj u v · obtain ⟨P0, hP0, hM0P0⟩ := hext M0 hM0 hM0k have hP0' := SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP0 obtain ⟨S0, hS0, hS0c⟩ := matching_vertices_card_at_most_twice_edges M0 hM0 hM0k obtain ⟨w, hw⟩ : ∃ w : V, w ∉ S0 := by by_contra hall simp only [not_exists, not_not] at hall have h1 : S0 = Finset.univ := Finset.eq_univ_iff_forall.mpr hall rw [h1, Finset.card_univ] at hS0c omega have hwM : w ∉ M0.verts := fun h => hw (hS0 w h) obtain ⟨w', hww', -⟩ := hP0' w have hw'M : w' ∉ M0.verts := by intro h obtain ⟨c, hc, -⟩ := hM0 h have : c = w := (hP0' w').unique (hM0P0.2 hc) hww'.symm exact hwM (this ▸ M0.edge_vert hc.symm) have hwne : w ≠ w' := (P0.adj_sub hww').ne have huM : u ∈ M0.verts := M0.edge_vert hM0uv have hvM : v ∈ M0.verts := M0.edge_vert hM0uv.symm have hwu : w ≠ u := fun h => hwM (h ▸ huM) have hwv : w ≠ v := fun h => hwM (h ▸ hvM) -- an M0-edge other than uv avoids u and v have hoff : ∀ {x y : V}, M0.Adj x y → s(x, y) ≠ s(u, v) → x ≠ u ∧ x ≠ v := by intro x y hxy hne constructor · rintro rfl exact hne (by rw [hM0u hxy hM0uv]) · rintro rfl exact hne (by rw [hM0u hxy hM0uv.symm]; exact Sym2.eq_swap) let M1 : (G.deleteEdges {s(u, v)}).Subgraph := { verts := (M0.verts \ {u, v}) ∪ {w, w'} Adj := fun x y => (M0.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ (x = w ∧ y = w') ∨ (x = w' ∧ y = w) adj_sub := by rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact (hG' x y).mpr ⟨M0.adj_sub h, hne⟩ · refine (hG' _ _).mpr ⟨P0.adj_sub hww', fun he => ?_⟩ rcases hsym _ _ he with ⟨h1, -⟩ | ⟨h1, -⟩ · exact hwu h1 · exact hwv h1 · refine (hG' _ _).mpr ⟨P0.adj_sub hww'.symm, fun he => ?_⟩ rcases hsym _ _ he with ⟨-, h1⟩ | ⟨-, h1⟩ · exact hwv h1 · exact hwu h1 edge_vert := by rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · obtain ⟨h1, h2⟩ := hoff h hne exact Or.inl ⟨M0.edge_vert h, by simp [h1, h2]⟩ · exact Or.inr (by simp) · exact Or.inr (by simp) symm := by refine ⟨?_⟩ rintro x y (⟨h, hne⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact Or.inl ⟨h.symm, by rwa [Sym2.eq_swap]⟩ · exact Or.inr (Or.inr ⟨rfl, rfl⟩) · exact Or.inr (Or.inl ⟨rfl, rfl⟩) } refine ⟨M1, ?_, ?_⟩ · intro x hx rcases hx with ⟨hx0, hxuv⟩ | hxw · simp only [Set.mem_insert_iff, Set.mem_singleton_iff, not_or] at hxuv obtain ⟨y, hy, -⟩ := hM0 hx0 have hne : s(x, y) ≠ s(u, v) := by intro he rcases hsym _ _ he with ⟨h1, -⟩ | ⟨h1, -⟩ · exact hxuv.1 h1 · exact hxuv.2 h1 refine ⟨y, Or.inl ⟨hy, hne⟩, ?_⟩ rintro y' (⟨h', -⟩ | ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩) · exact hM0u h' hy · exact absurd hx0 hwM · exact absurd hx0 hw'M · simp only [Set.mem_insert_iff, Set.mem_singleton_iff] at hxw rcases hxw with rfl | rfl · refine ⟨w', Or.inr (Or.inl ⟨rfl, rfl⟩), ?_⟩ rintro y' (⟨h', -⟩ | ⟨-, rfl⟩ | ⟨h1, -⟩) · exact absurd (M0.edge_vert h') hwM · rfl · exact absurd h1 hwne · refine ⟨w, Or.inr (Or.inr ⟨rfl, rfl⟩), ?_⟩ rintro y' (⟨h', -⟩ | ⟨h1, -⟩ | ⟨-, rfl⟩) · exact absurd (M0.edge_vert h') hw'M · exact absurd h1.symm hwne · rfl · have hE : M1.edgeSet = (M0.edgeSet \ {s(u, v)}) ∪ {s(w, w')} := by ext e induction e using Sym2.ind with | h x y => simp only [SimpleGraph.Subgraph.mem_edgeSet, Set.mem_union, Set.mem_sdiff, Set.mem_singleton_iff] show ((M0.Adj x y ∧ s(x, y) ≠ s(u, v)) ∨ (x = w ∧ y = w') ∨ (x = w' ∧ y = w)) ↔ _ simp only [Sym2.eq_iff, ne_eq] have hdisj : Disjoint (M0.edgeSet \ {s(u, v)}) {s(w, w')} := by rw [Set.disjoint_singleton_right] rintro ⟨h, -⟩ exact hwM (M0.edge_vert h) have hmem : s(u, v) ∈ M0.edgeSet := hM0uv rw [hE, Set.ncard_union_eq hdisj (Set.toFinite _) (Set.toFinite _), Set.ncard_sdiff_singleton_of_mem hmem, Set.ncard_singleton, hM0k] have hpos : 0 < M0.edgeSet.ncard := Set.ncard_pos (Set.toFinite _) |>.mpr ⟨_, hmem⟩ omega · refine ⟨⟨M0.verts, M0.Adj, fun {x y} h => (hG' x y).mpr ⟨M0.adj_sub h, fun he => ?_⟩, M0.edge_vert, M0.symm⟩, fun x hx => hM0 hx, ?_⟩ · rcases hsym _ _ he with ⟨rfl, rfl⟩ | ⟨rfl, rfl⟩ · exact hM0uv h · exact hM0uv h.symm · refine Eq.trans (congrArg Set.ncard ?_) hM0k ext e; induction e using Sym2.ind; exact Iff.rfl by_contra hcon push Not at hcon exact hessential ⟨hcard, hb, fun M hM hk => hcon M hM hk⟩