perfect_matching_twins_switch_partner
Any matching edge incident to one of two distinct vertices with identical neighbors outside the pair can be avoided by another perfect matching, provided the edge does not join the pair.
Statement
theorem perfect_matching_twins_switch_partner {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching) (x y z : V) (hxy : x ≠ y) (hzy : z ≠ y) (htwin : ∀ a, a ≠ x → a ≠ y → (G.Adj x a ↔ G.Adj y a)) (hxz : P.Adj x z) : ∃ Q : G.Subgraph, Q.IsPerfectMatching ∧ ¬ Q.Adj x z
- Source
- OP-1957: extension of the false-twin bridge route to adjacent and nonadjacent twins.
- Verified
- 22 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- forced_matching_edge_blocks_four_and_six_switchesA forced matching edge blocks the specified four- and six-vertex switches.
- Used by 1
- factorcritical_twins_forced_edge_is_bridgeIn a finite 1-factor-critical graph, if two distinct vertices have identical neighborhoods outside the pair, any forced matching edge…
The proof, explained
The proof proceeds by contradiction. If no perfect matching avoids the edge xz, then xz must belong to every perfect matching of G (it is forced). Since x and y are twins outside {x, y}, the matching edges xz and yw together with graph edges zy and xw form an alternating 4-cycle x - z - y - w - x. However, switching edges along an alternating 4-cycle yields a valid perfect matching that avoids xz, contradicting the fact that xz is forced.
The edge xz must belong to every perfect matching of G.
We proceed by contradiction: suppose there is no perfect matching avoiding xz. Then any perfect matching Q must contain the edge xz, since otherwise Q would provide an immediate counterexample.
classical by_contra hno have hforced : ∀ Q : G.Subgraph, Q.IsPerfectMatching → Q.Adj x z := by intro Q hQ by_contra hn exact hno ⟨Q,hQ,hn⟩
There is a vertex w matched to y in P, with z ≠ x and w ≠ y.
Because P is a perfect matching, every vertex has a unique matched neighbor in P; let w be the partner of y. Since xz and yw are edges in G, their endpoints are distinct, giving z ≠ x and w ≠ y.
uses
SimpleGraph.Subgraph.isPerfectMatching_iff.mpobtain ⟨w, hyw, _⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) y have hxzG : G.Adj x z := P.adj_sub hxz have hywG : G.Adj y w := P.adj_sub hyw have hzx : z ≠ x := hxzG.ne.symm have hwy : w ≠ y := hywG.ne.symm
w is distinct from x and from z.
If w = x, then x would be matched in P to both z and y. Because a matching gives each vertex at most one partner, this would imply z = y, contradicting the assumption z ≠ y. Likewise, if w = z, then z would be matched to both x and y, implying x = y and contradicting x ≠ y.
have hwx : w ≠ x := by intro h subst w have he : z = y := hP.1.eq_of_adj_left hxz hyw.symm exact hzy he have hwz : w ≠ z := by intro h subst w have he : x = y := hP.1.eq_of_adj_left hxz.symm hyw.symm exact hxy he
The four vertices x, z, y, and w are pairwise distinct.
Having established all six pairwise inequalities among x, z, y, and w, the map sending indices in {0, 1, 2, 3} to the vertices x, z, y, w is injective. In the proof, this is checked by exhausting all sixteen pairs of indices.
have hinj : Function.Injective (![x,z,y,w] : Fin 4 → V) := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all
y is adjacent to z, and x is adjacent to w in G.
By the twin hypothesis, x and y have identical neighbors outside {x, y}. Since z is distinct from both x and y, the edge xz in G implies that yz is an edge in G. Similarly, since w is distinct from both x and y, the edge yw in G implies that xw is an edge in G.
have hyz : G.Adj y z := (htwin z hzx hzy).mp hxzG have hxw : G.Adj x w := (htwin w hwx hwy).mpr hywG
Contradiction: the forced edge xz cannot belong to an alternating 4-cycle.
The matching edges xz, yw in P and graph edges zy, xw in G form an alternating 4-cycle on the four distinct vertices x, z, y, w. By forced_matching_edge_blocks_four_and_six_switches, a forced matching edge cannot lie on an alternating 4-cycle, as swapping edges along the cycle would produce a perfect matching avoiding xz.
uses
forced_matching_edge_blocks_four_and_six_switchesexact (forced_matching_edge_blocks_four_and_six_switches G P hP x z hxz hforced).1 ⟨y,w,hinj,hyw,hyz.symm,hxw⟩
SimpleGraph.Subgraph.isPerfectMatching_iff.mp- A subgraph is a perfect matching if and only if every vertex has a unique neighbor in the subgraph; the forward implication provides a unique matched partner for any given vertex.
forced_matching_edge_blocks_four_and_six_switches- If an edge of a perfect matching is forced (it belongs to every perfect matching of the graph), then it cannot belong to an alternating cycle of length 4 or 6.
- Injectivity of the sequence of four vertices is verified formally by exhaustive case analysis over Fin 4 using the fin_cases tactic.
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 perfect_matching_twins_switch_partner {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching) (x y z : V) (hxy : x ≠ y) (hzy : z ≠ y) (htwin : ∀ a, a ≠ x → a ≠ y → (G.Adj x a ↔ G.Adj y a)) (hxz : P.Adj x z) : ∃ Q : G.Subgraph, Q.IsPerfectMatching ∧ ¬ Q.Adj x z := by classical by_contra hno have hforced : ∀ Q : G.Subgraph, Q.IsPerfectMatching → Q.Adj x z := by intro Q hQ by_contra hn exact hno ⟨Q,hQ,hn⟩ obtain ⟨w, hyw, _⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) y have hxzG : G.Adj x z := P.adj_sub hxz have hywG : G.Adj y w := P.adj_sub hyw have hzx : z ≠ x := hxzG.ne.symm have hwy : w ≠ y := hywG.ne.symm have hwx : w ≠ x := by intro h subst w have he : z = y := hP.1.eq_of_adj_left hxz hyw.symm exact hzy he have hwz : w ≠ z := by intro h subst w have he : x = y := hP.1.eq_of_adj_left hxz.symm hyw.symm exact hxy he have hinj : Function.Injective (![x,z,y,w] : Fin 4 → V) := by intro i j hij fin_cases i <;> fin_cases j <;> simp_all have hyz : G.Adj y z := (htwin z hzx hzy).mp hxzG have hxw : G.Adj x w := (htwin w hwx hwy).mpr hywG exact (forced_matching_edge_blocks_four_and_six_switches G P hP x z hxz hforced).1 ⟨y,w,hinj,hyw,hyz.symm,hxw⟩