AFTD Auto-Formalizing Theoretical Domains

matching_zero_codegree_blocked_four_switches_neighborhoods_partition

theoremverified

If uv is a perfect-matching edge with no common complement neighbor and no four-switch, every other vertex lies in exactly one endpoint complement neighborhood.

Statement

theorem matching_zero_codegree_blocked_four_switches_neighborhoods_partition
    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)
    (u v : V) (huv : P.Adj u v)
    (hfar2 : ∀ x : V, ¬ ((Gᶜ).Adj u x ∧ (Gᶜ).Adj v x))
    (h4 : ¬ ∃ a b, Function.Injective (![u,v,a,b] : Fin 4 → V) ∧ P.Adj a b ∧ G.Adj v a ∧ G.Adj u b) :
    ∀ x, x ≠ u → x ≠ v → (Gᶜ).Adj u x ∨ (Gᶜ).Adj v x
Source
OP-1957: blocked four-switch partition of the residual graph; experiment 34747 tests small finite orders.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

To show that every other vertex x lies in the complement neighborhood of u or v, we argue by contradiction: if x were adjacent to neither in the complement, it would be adjacent to both u and v in G. Let y be the unique matching mate of x. Using the uniqueness of matching edges and the hypothesis forbidding four-switches, y must be distinct from and non-adjacent in G to both endpoints u and v. This makes y a common neighbor of u and v in the complement graph, contradicting the zero-codegree hypothesis.

  1. A 4-tuple of pairwise distinct vertices defines an injective map from Fin 4 to V.

    To show that the vector ![a, b, c, d] is injective, we take indices i and j such that their images are equal. By checking all 16 cases for (i, j) in Fin 4, each case either has i = j (holding by reflexivity) or contradicts one of the pairwise distinctness hypotheses.

    lines 8–13

      intro i j hij
      fin_cases i <;> fin_cases j
      exacts [rfl, absurd hij hab, absurd hij hac, absurd hij had,
        absurd hij hab.symm, rfl, absurd hij hbc, absurd hij hbd,
        absurd hij hac.symm, absurd hij hbc.symm, rfl, absurd hij hcd,
        absurd hij had.symm, absurd hij hbd.symm, absurd hij hcd.symm, rfl]
  2. Assume for contradiction that some vertex x distinct from u and v is adjacent to neither u nor v in the complement graph Gᶜ.

    We introduce the vertex x and the hypotheses that x ≠ u and x ≠ v. By contradiction, suppose x is neither a complement neighbor of u nor of v. This splits into two non-adjacency facts: x is not adjacent to u in Gᶜ, and x is not adjacent to v in Gᶜ.

    lines 21–25

    uses Or.inl, Or.inr

      classical
      intro x hxu hxv
      by_contra hnone
      have hUX : ¬ (Gᶜ).Adj u x := fun h => hnone (Or.inl h)
      have hVX : ¬ (Gᶜ).Adj v x := fun h => hnone (Or.inr h)
  3. The vertex x is adjacent to both u and v in G.

    Since x ≠ u and x is not adjacent to u in Gᶜ, the definition of the complement graph implies that u and x must be adjacent in G. By the exact same reasoning with x ≠ v, v and x must be adjacent in G.

    lines 26–31

    uses SimpleGraph.compl_adj

      have hux : G.Adj u x := by
        by_contra h
        exact hUX ((SimpleGraph.compl_adj G u x).2 ⟨hxu.symm,h⟩)
      have hvx : G.Adj v x := by
        by_contra h
        exact hVX ((SimpleGraph.compl_adj G v x).2 ⟨hxv.symm,h⟩)
  4. Every vertex in the perfect matching has a unique mate, and x has a matching mate y distinct from x.

    We record that perfect matchings pair vertices uniquely. Since uv is a matching edge, u ≠ v. We then obtain the unique mate y of x in P, which satisfies x ≠ y because matching edges are graph edges between distinct vertices.

    lines 32–36

    uses SimpleGraph.Subgraph.isPerfectMatching_iff.mp

      have hmate : ∀ {a b c : V}, P.Adj a b → P.Adj a c → b = c :=
        fun {a b c} h1 h2 => (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP a).unique h1 h2
      have huvne : u ≠ v := (P.adj_sub huv).ne
      obtain ⟨y,hxy,_⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) x
      have hxyne : x ≠ y := (P.adj_sub hxy).ne
  5. The mate y is distinct from both u and v, making u, v, x, y all pairwise distinct.

    If y = u, then x is matched to u; but u is already matched to v, so uniqueness of matching mates implies v = x, contradicting x ≠ v. Symmetrically, if y = v, uniqueness forces u = x, contradicting x ≠ u. Hence y is distinct from both u and v.

    lines 37–46

      have hyu : y ≠ u := by
        intro h
        subst y
        have h' : v = x := hmate huv hxy.symm
        exact hxv h'.symm
      have hyv : y ≠ v := by
        intro h
        subst y
        have h' : u = x := hmate huv.symm hxy.symm
        exact hxu h'.symm
  6. The vertex u is not adjacent to y in G.

    If u were adjacent to y in G, then (u, v, x, y) would form a four-switch: the four vertices are pairwise distinct, xy is a matching edge, v is adjacent to x in G, and u is adjacent to y in G. This directly contradicts the assumption h4 forbidding such configurations.

    lines 47–51

    uses in1047_partition_tuple4_injective

      have hUy : ¬ G.Adj u y := by
        intro h
        apply h4
        refine ⟨x,y,?_,hxy,hvx,h⟩
        exact in1047_partition_tuple4_injective u v x y huvne hxu.symm hyu.symm hxv.symm hyv.symm hxyne
  7. The vertex v is not adjacent to y in G.

    Similarly, if v were adjacent to y in G, then (u, v, y, x) would form a four-switch with matching edge yx, edge vy in G, and edge ux in G, contradicting h4.

    lines 52–56

    uses in1047_partition_tuple4_injective

      have hVy : ¬ G.Adj v y := by
        intro h
        apply h4
        refine ⟨y,x,?_,hxy.symm,h,hux⟩
        exact in1047_partition_tuple4_injective u v y x huvne hyu.symm hxu.symm hyv.symm hxv.symm hxyne.symm
  8. The mate y is a common complement neighbor of u and v, yielding a contradiction.

    Because y is distinct from and non-adjacent in G to both u and v, it is adjacent to both u and v in the complement graph Gᶜ. But hfar2 asserts that no vertex is adjacent to both u and v in Gᶜ, which is our desired contradiction.

    lines 57–58

    uses SimpleGraph.compl_adj

      exact hfar2 y ⟨(SimpleGraph.compl_adj G u y).2 ⟨hyu.symm,hUy⟩,
        (SimpleGraph.compl_adj G v y).2 ⟨hyv.symm,hVy⟩⟩
SimpleGraph.compl_adj
In the complement graph Gᶜ, two vertices are adjacent if and only if they are distinct and not adjacent in G.
SimpleGraph.Subgraph.isPerfectMatching_iff.mp
In a perfect matching, every vertex is adjacent to a unique vertex.
Or.inl
A proof of a proposition A yields a proof of the disjunction A ∨ B.
Or.inr
A proof of a proposition B yields a proof of the disjunction A ∨ B.
in1047_partition_tuple4_injective
Given four pairwise distinct vertices in V, the four-element vector formed by them is injective.

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

set_option maxHeartbeats 2000000set_option maxRecDepth 8192private theorem in1047_partition_tuple4_injective {V : Type*} (a b c d : V)    (hab : a ≠ b) (hac : a ≠ c) (had : a ≠ d)    (hbc : b ≠ c) (hbd : b ≠ d) (hcd : c ≠ d) :    Function.Injective (![a,b,c,d] : Fin 4 → V) := by  intro i j hij  fin_cases i <;> fin_cases j  exacts [rfl, absurd hij hab, absurd hij hac, absurd hij had,    absurd hij hab.symm, rfl, absurd hij hbc, absurd hij hbd,    absurd hij hac.symm, absurd hij hbc.symm, rfl, absurd hij hcd,    absurd hij had.symm, absurd hij hbd.symm, absurd hij hcd.symm, rfl]theorem matching_zero_codegree_blocked_four_switches_neighborhoods_partition    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)    (u v : V) (huv : P.Adj u v)    (hfar2 : ∀ x : V, ¬ ((Gᶜ).Adj u x ∧ (Gᶜ).Adj v x))    (h4 : ¬ ∃ a b, Function.Injective (![u,v,a,b] : Fin 4 → V) ∧ P.Adj a b ∧ G.Adj v a ∧ G.Adj u b) :    ∀ x, x ≠ u → x ≠ v → (Gᶜ).Adj u x ∨ (Gᶜ).Adj v x := by  classical  intro x hxu hxv  by_contra hnone  have hUX : ¬ (Gᶜ).Adj u x := fun h => hnone (Or.inl h)  have hVX : ¬ (Gᶜ).Adj v x := fun h => hnone (Or.inr h)  have hux : G.Adj u x := by    by_contra h    exact hUX ((SimpleGraph.compl_adj G u x).2 ⟨hxu.symm,h⟩)  have hvx : G.Adj v x := by    by_contra h    exact hVX ((SimpleGraph.compl_adj G v x).2 ⟨hxv.symm,h⟩)  have hmate : ∀ {a b c : V}, P.Adj a b → P.Adj a c → b = c :=    fun {a b c} h1 h2 => (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP a).unique h1 h2  have huvne : u ≠ v := (P.adj_sub huv).ne  obtain ⟨y,hxy,_⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) x  have hxyne : x ≠ y := (P.adj_sub hxy).ne  have hyu : y ≠ u := by    intro h    subst y    have h' : v = x := hmate huv hxy.symm    exact hxv h'.symm  have hyv : y ≠ v := by    intro h    subst y    have h' : u = x := hmate huv.symm hxy.symm    exact hxu h'.symm  have hUy : ¬ G.Adj u y := by    intro h    apply h4    refine ⟨x,y,?_,hxy,hvx,h⟩    exact in1047_partition_tuple4_injective u v x y huvne hxu.symm hyu.symm hxv.symm hyv.symm hxyne  have hVy : ¬ G.Adj v y := by    intro h    apply h4    refine ⟨y,x,?_,hxy.symm,h,hux⟩    exact in1047_partition_tuple4_injective u v y x huvne hyu.symm hxu.symm hyv.symm hxv.symm hxyne.symm  exact hfar2 y ⟨(SimpleGraph.compl_adj G u y).2 ⟨hyu.symm,hUy⟩,    (SimpleGraph.compl_adj G v y).2 ⟨hyv.symm,hVy⟩⟩
See it in the graphDiscuss this resultChallenge it