AFTD Auto-Formalizing Theoretical Domains

matching_four_switch_simplicial_complement_zero_codegree

theoremverified

A perfect-matching edge uv lies on an alternating four-cycle if v has at least two neighbors, the complement neighbors of u form a clique, and u and v have no common complement neighbor.

Statement

theorem matching_four_switch_simplicial_complement_zero_codegree
    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)
    (u v : V) (huv : P.Adj u v)
    (hdeg : ∃ x y : V, x ≠ y ∧ G.Adj v x ∧ G.Adj v y)
    (hclique : ∀ a b : V, a ≠ b → (Gᶜ).Adj u a → (Gᶜ).Adj u b → (Gᶜ).Adj a b)
    (hsep : ∀ a : V, (Gᶜ).Adj u a → ¬ (Gᶜ).Adj v a) :
    ∃ a b : V, Function.Injective (![u,v,a,b] : Fin 4 → V) ∧ P.Adj a b ∧ G.Adj v a ∧ G.Adj u b
Source
OP-1957: four-switch at a simplicial complement vertex.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

The theorem states that a perfect-matching edge uv lies on an alternating four-cycle in G whenever v has at least two neighbors, the non-neighbors of u form an independent set (a clique in the complement graph), and u and v share no non-neighbors. The proof selects a neighbor w of v distinct from u and lets z be the matching partner of w. If u is adjacent to z in G, the four vertices u, v, w, z directly form an alternating four-cycle. Otherwise, z is a non-neighbor of u, which forces v to be adjacent to z by the zero-codegree condition, and u to be adjacent to w by the complement clique condition, yielding the alternating four-cycle u, v, z, w.

  1. There is a neighbor w of v in G distinct from u, and a unique vertex z matched to w in P.

    Because P is a perfect matching, every vertex has a unique partner in P by SimpleGraph.Subgraph.isPerfectMatching_iff.mp. Since v has at least two distinct neighbors x and y in G, at least one of them, denoted w, is not u. Taking the unique matching mate of w in P gives z.

    lines 8–14

    uses SimpleGraph.Subgraph.isPerfectMatching_iff.mp

      have hP' := SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP
      obtain ⟨x, y, hxy, hvx, hvy⟩ := hdeg
      obtain ⟨w, hvw, hwu⟩ : ∃ w, G.Adj v w ∧ w ≠ u := by
        by_cases hx : x = u
        · exact ⟨y, hvy, fun h => hxy (hx.trans h.symm)⟩
        · exact ⟨x, hvx, hx⟩
      obtain ⟨z, hwz, -⟩ := hP' w
  2. The four vertices u, v, w, and z are pairwise distinct.

    Edges in a simple graph connect distinct vertices, so uv, vw, wz ∈ G give u ≠ v, w ≠ v, and w ≠ z, while w ≠ u holds by choice of w. If z = u, then w and v would both be matched to u in P, which forces w = v by uniqueness of matching partners, contradicting w ≠ v. Similarly, if z = v, then w and u would both be matched to v, forcing w = u, contradicting w ≠ u. Symmetrizing these six inequalities proves all pairs are distinct.

    lines 15–34

      have huv' : G.Adj u v := P.adj_sub huv
      have hwz' : G.Adj w z := P.adj_sub hwz
      have hwv : w ≠ v := (G.ne_of_adj hvw).symm
      have huv_ne : u ≠ v := G.ne_of_adj huv'
      have hwz_ne : w ≠ z := G.ne_of_adj hwz'
      -- z is not u or v: their mates are each other
      have hzu : z ≠ u := by
        rintro rfl
        have : w = v := ((hP' z).unique hwz.symm huv)
        exact hwv this
      have hzv : z ≠ v := by
        rintro rfl
        have : w = u := ((hP' z).unique hwz.symm huv.symm)
        exact hwu this
      have h1 := huv_ne.symm
      have h2 := hwu.symm
      have h3 := hwv.symm
      have h4 := hzu.symm
      have h5 := hzv.symm
      have h6 := hwz_ne.symm
  3. If u is adjacent to z in G, then (a, b) = (w, z) forms the desired alternating four-cycle.

    Assuming G.Adj u z, the vertices a = w and b = z satisfy the required conditions: wz is in P, vw is in G, and uz is in G. Injectivity of the sequence ![u, v, w, z] is verified by exhaustive check over all index pairs in Fin 4, using the pairwise distinctness of u, v, w, z to dismiss off-diagonal cases.

    lines 35–39

      by_cases huz : G.Adj u z
      · refine ⟨w, z, ?_, hwz, hvw, huz⟩
        intro i j hij
        fin_cases i <;> fin_cases j <;> simp at hij ⊢ <;>
          exact absurd hij ‹_›
  4. If u is not adjacent to z in G, then v and z are adjacent in G.

    Since u ≠ z and u is not adjacent to z in G, z is a neighbor of u in the complement graph Gᶜ by SimpleGraph.compl_adj. By the hypothesis hsep, u and v have no common neighbor in Gᶜ, so z cannot be adjacent to v in Gᶜ. Because z ≠ v, this non-adjacency in Gᶜ implies that v and z are adjacent in G.

    lines 40–46

    uses SimpleGraph.compl_adj

      · have hcuz : (Gᶜ).Adj u z := by
          rw [SimpleGraph.compl_adj]; exact ⟨hzu.symm, huz⟩
        have hvz : G.Adj v z := by
          have := hsep z hcuz
          rw [SimpleGraph.compl_adj] at this
          push_neg at this
          exact this hzv.symm
  5. If u is not adjacent to z in G, then u and w are adjacent in G.

    Assume for contradiction that u is not adjacent to w in G. Since u ≠ w, w would also be adjacent to u in Gᶜ by SimpleGraph.compl_adj. The hypothesis hclique states that the complement neighbors of u form a clique in Gᶜ; because w ≠ z, this would imply that w and z are adjacent in Gᶜ, so they cannot be adjacent in G. But wz is an edge of the matching P (and hence of G), which is a contradiction. Therefore, u and w are adjacent in G.

    lines 47–53

    uses SimpleGraph.compl_adj

        have huw : G.Adj u w := by
          by_contra huw
          have hcuw : (Gᶜ).Adj u w := by
            rw [SimpleGraph.compl_adj]; exact ⟨hwu.symm, huw⟩
          have := hclique w z hwz_ne hcuw hcuz
          rw [SimpleGraph.compl_adj] at this
          exact this.2 hwz'
  6. If u is not adjacent to z in G, then (a, b) = (z, w) forms the desired alternating four-cycle.

    Choosing a = z and b = w, the edge ab = zw belongs to P by symmetry of P.Adj w z. The graph edges va = vz and ub = uw were established in the previous two steps. Injectivity of the sequence ![u, v, z, w] again follows by exhausting all pairs of indices in Fin 4.

    lines 54–57

        refine ⟨z, w, ?_, hwz.symm, hvz, huw⟩
        intro i j hij
        fin_cases i <;> fin_cases j <;> simp at hij ⊢ <;>
          exact absurd hij ‹_›
SimpleGraph.Subgraph.isPerfectMatching_iff.mp
In a subgraph that is a perfect matching, every vertex in the ambient graph has a uniquely determined adjacent partner in the matching.
SimpleGraph.compl_adj
Two vertices are adjacent in the complement graph if and only if they are distinct and not adjacent in the original graph.

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

theorem matching_four_switch_simplicial_complement_zero_codegree    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)    (u v : V) (huv : P.Adj u v)    (hdeg : ∃ x y : V, x ≠ y ∧ G.Adj v x ∧ G.Adj v y)    (hclique : ∀ a b : V, a ≠ b → (Gᶜ).Adj u a → (Gᶜ).Adj u b → (Gᶜ).Adj a b)    (hsep : ∀ a : V, (Gᶜ).Adj u a → ¬ (Gᶜ).Adj v a) :    ∃ a b : V, Function.Injective (![u,v,a,b] : Fin 4 → V) ∧ P.Adj a b ∧ G.Adj v a ∧ G.Adj u b := by  have hP' := SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP  obtain ⟨x, y, hxy, hvx, hvy⟩ := hdeg  obtain ⟨w, hvw, hwu⟩ : ∃ w, G.Adj v w ∧ w ≠ u := by    by_cases hx : x = u    · exact ⟨y, hvy, fun h => hxy (hx.trans h.symm)⟩    · exact ⟨x, hvx, hx⟩  obtain ⟨z, hwz, -⟩ := hP' w  have huv' : G.Adj u v := P.adj_sub huv  have hwz' : G.Adj w z := P.adj_sub hwz  have hwv : w ≠ v := (G.ne_of_adj hvw).symm  have huv_ne : u ≠ v := G.ne_of_adj huv'  have hwz_ne : w ≠ z := G.ne_of_adj hwz'  -- z is not u or v: their mates are each other  have hzu : z ≠ u := by    rintro rfl    have : w = v := ((hP' z).unique hwz.symm huv)    exact hwv this  have hzv : z ≠ v := by    rintro rfl    have : w = u := ((hP' z).unique hwz.symm huv.symm)    exact hwu this  have h1 := huv_ne.symm  have h2 := hwu.symm  have h3 := hwv.symm  have h4 := hzu.symm  have h5 := hzv.symm  have h6 := hwz_ne.symm  by_cases huz : G.Adj u z  · refine ⟨w, z, ?_, hwz, hvw, huz⟩    intro i j hij    fin_cases i <;> fin_cases j <;> simp at hij ⊢ <;>      exact absurd hij ‹_›  · have hcuz : (Gᶜ).Adj u z := by      rw [SimpleGraph.compl_adj]; exact ⟨hzu.symm, huz⟩    have hvz : G.Adj v z := by      have := hsep z hcuz      rw [SimpleGraph.compl_adj] at this      push_neg at this      exact this hzv.symm    have huw : G.Adj u w := by      by_contra huw      have hcuw : (Gᶜ).Adj u w := by        rw [SimpleGraph.compl_adj]; exact ⟨hwu.symm, huw⟩      have := hclique w z hwz_ne hcuw hcuz      rw [SimpleGraph.compl_adj] at this      exact this.2 hwz'    refine ⟨z, w, ?_, hwz.symm, hvz, huw⟩    intro i j hij    fin_cases i <;> fin_cases j <;> simp at hij ⊢ <;>      exact absurd hij ‹_›
See it in the graphDiscuss this resultChallenge it