AFTD Auto-Formalizing Theoretical Domains

matching_zero_codegree_blocked_switches_neighborhoods_complete

theoremverified

If uv is a perfect-matching edge with no common complement neighbor, and four- and six-switches at uv are blocked, every complement neighbor of u is adjacent in the complement to every complement neighbor of v.

Statement

theorem matching_zero_codegree_blocked_switches_neighborhoods_complete
    {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)
    (h6 : ¬ ∃ a b c d, Function.Injective (![u,v,a,b,c,d] : Fin 6 → V) ∧ P.Adj a b ∧ P.Adj c d ∧ G.Adj v b ∧ G.Adj a c ∧ G.Adj u d) :
    ∀ x z, (Gᶜ).Adj u x → (Gᶜ).Adj v z → (Gᶜ).Adj x z
Source
OP-1957: complete cross-neighborhood strengthening of the four-cycle switch lemma; experiment 34746 checks residual orders six through twelve.
Verified
20 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 1

The proof, explained

To show that every complement neighbor x of u is adjacent in the complement to every complement neighbor z of v, we assume for contradiction that x and z are adjacent in G. Since u and v share no complement neighbor, the non-adjacencies u ≁ x and v ≁ z force the cross-adjacencies v ~ x and u ~ z. The blocked 4-switch condition at uv forces the matching mates y of x and t of z to satisfy v ~ y and u ~ t. Finally, if x were adjacent to z, the six distinct vertices (u, v, x, y, z, t) would form an alternating 6-switch, contradicting the assumption that 6-switches at uv are blocked.

  1. A 4-tuple of pairwise distinct elements defines an injective map from Fin 4.

    We introduce indices i and j in Fin 4 with equal values in the tuple, and perform case analysis on both i and j. In all 16 cases, either i = j (which holds by reflexivity) or i ≠ j (which produces an immediate contradiction against the hypothesis that those distinct tuple entries are unequal).

    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. A 6-tuple of pairwise distinct elements defines an injective map from Fin 6.

    Similarly, we introduce indices i and j in Fin 6 and exhaustively analyze all 36 pairs (i, j). The diagonal cases i = j hold by reflexivity, while every off-diagonal case contradicts the pairwise distinctness hypotheses.

    lines 21–28

      intro i j hij
      fin_cases i <;> fin_cases j
      exacts [rfl, absurd hij hab, absurd hij hac, absurd hij had, absurd hij hae, absurd hij haf,
        absurd hij hab.symm, rfl, absurd hij hbc, absurd hij hbd, absurd hij hbe, absurd hij hbf,
        absurd hij hac.symm, absurd hij hbc.symm, rfl, absurd hij hcd, absurd hij hce, absurd hij hcf,
        absurd hij had.symm, absurd hij hbd.symm, absurd hij hcd.symm, rfl, absurd hij hde, absurd hij hdf,
        absurd hij hae.symm, absurd hij hbe.symm, absurd hij hce.symm, absurd hij hde.symm, rfl, absurd hij hef,
        absurd hij haf.symm, absurd hij hbf.symm, absurd hij hcf.symm, absurd hij hdf.symm, absurd hij hef.symm, rfl]
  3. Let x be a complement neighbor of u and z a complement neighbor of v; then u, v, x, z are pairwise distinct (except possibly x and z), with u not adjacent to x, v not adjacent to z, and matching partners in P are unique.

    We introduce arbitrary vertices x and z satisfying u ~ x and v ~ z in the complement Gᶜ. Because P is a perfect matching, matching edges are unique at each vertex (hmate, using SimpleGraph.Subgraph.isPerfectMatching_iff.mp). Since uv is an edge of P, it is an edge of G (so u ≠ v). Complement adjacency means x ≠ u, z ≠ v, u is not adjacent to x in G, and v is not adjacent to z in G. Furthermore, x ≠ v because x = v would imply u is adjacent to x in G, contradicting u not adjacent to x; symmetrically, z ≠ u because z = u would contradict v not adjacent to z.

    lines 37–54

    uses SimpleGraph.Subgraph.isPerfectMatching_iff.mp

      classical
      intro x z huxH hvzH
      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 huvG : G.Adj u v := P.adj_sub huv
      have huvne : u ≠ v := huvG.ne
      have hxu : x ≠ u := huxH.ne.symm
      have hzv : z ≠ v := hvzH.ne.symm
      have huxx : ¬ G.Adj u x := (SimpleGraph.compl_adj G u x).1 huxH |>.2
      have hvz : ¬ G.Adj v z := (SimpleGraph.compl_adj G v z).1 hvzH |>.2
      have hxv : x ≠ v := by
        intro h
        subst x
        exact huxx huvG
      have hzu : z ≠ u := by
        intro h
        subst z
        exact hvz huvG.symm
  4. v is adjacent to x in G, and u is adjacent to z in G.

    The hypothesis hfar2 states that u and v have no common complement neighbor, so any vertex distinct from u and v must be adjacent in G to u or to v. Since u is not adjacent to x in G, x must be adjacent to v in G (v ~ x). Symmetrically, since v is not adjacent to z in G, z must be adjacent to u in G (u ~ z).

    lines 55–60

    uses SimpleGraph.compl_adj

      have hvx : G.Adj v x := by
        by_contra h
        exact hfar2 x ⟨huxH, (SimpleGraph.compl_adj G v x).2 ⟨hxv.symm,h⟩⟩
      have huz : G.Adj u z := by
        by_contra h
        exact hfar2 z ⟨(SimpleGraph.compl_adj G u z).2 ⟨hzu.symm,h⟩,hvzH⟩
  5. x has a matching partner y in P that is distinct from x, u, and v.

    Because P is a perfect matching, x has a matching mate y with P.Adj x y, which implies x ≠ y. If y = u, then u would be matched to both v and x, forcing x = v by uniqueness of matching edges, which contradicts x ≠ v. Similarly, if y = v, then v would be matched to both u and x, forcing x = u, which contradicts x ≠ u. Hence y ≠ u and y ≠ v.

    lines 61–72

    uses SimpleGraph.Subgraph.isPerfectMatching_iff.mp

      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
  6. u is not adjacent to y in G, and consequently v is adjacent to y in G.

    If u were adjacent to y in G, then (u, v, x, y) would be four pairwise distinct vertices (injective by in1047_allcross_tuple4_injective) forming an alternating 4-switch with matching edge xy and graph edges vx and uy, contradicting hypothesis h4. Hence u is not adjacent to y in G. By the zero common complement neighbor condition hfar2, y cannot be non-adjacent to both u and v, which forces v to be adjacent to y in G.

    lines 73–81

    uses in1047_allcross_tuple4_injective, SimpleGraph.compl_adj

      have huxy : ¬ G.Adj u y := by
        intro h
        apply h4
        refine ⟨x,y,?_,hxy,hvx,h⟩
        exact in1047_allcross_tuple4_injective u v x y huvne hxu.symm hyu.symm hxv.symm hyv.symm hxyne
      have hvy : G.Adj v y := by
        by_contra h
        exact hfar2 y ⟨(SimpleGraph.compl_adj G u y).2 ⟨hyu.symm,huxy⟩,
          (SimpleGraph.compl_adj G v y).2 ⟨hyv.symm,h⟩⟩
  7. z has a matching partner t in P that is distinct from z, u, and v.

    By the perfect matching property, z has a matching mate t with P.Adj z t, so z ≠ t. If t = u, uniqueness of matching mates implies z = v, contradicting z ≠ v. If t = v, uniqueness implies z = u, contradicting z ≠ u. Hence t ≠ u and t ≠ v.

    lines 82–93

    uses SimpleGraph.Subgraph.isPerfectMatching_iff.mp

      obtain ⟨t,hzt,_⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) z
      have hztne : z ≠ t := (P.adj_sub hzt).ne
      have htu : t ≠ u := by
        intro h
        subst t
        have h' : v = z := hmate huv hzt.symm
        exact hzv h'.symm
      have htv : t ≠ v := by
        intro h
        subst t
        have h' : u = z := hmate huv.symm hzt.symm
        exact hzu h'.symm
  8. v is not adjacent to t in G, and consequently u is adjacent to t in G.

    If v were adjacent to t in G, then (u, v, t, z) would be four pairwise distinct vertices (injective by in1047_allcross_tuple4_injective) forming an alternating 4-switch with matching edge tz and graph edges vt and uz, contradicting hypothesis h4. Hence v is not adjacent to t in G. By hfar2, t must be adjacent in G to at least one of u or v, so u is adjacent to t in G.

    lines 94–102

    uses in1047_allcross_tuple4_injective, SimpleGraph.compl_adj

      have hvt : ¬ G.Adj v t := by
        intro h
        apply h4
        refine ⟨t,z,?_,hzt.symm,h,huz⟩
        exact in1047_allcross_tuple4_injective u v t z huvne htu.symm hzu.symm htv.symm hzv.symm hztne.symm
      have hut : G.Adj u t := by
        by_contra h
        exact hfar2 t ⟨(SimpleGraph.compl_adj G u t).2 ⟨htu.symm,h⟩,
          (SimpleGraph.compl_adj G v t).2 ⟨htv.symm,hvt⟩⟩
  9. x ≠ z, x ≠ t, y ≠ z, and y ≠ t.

    Each potential coincidence contradicts known adjacencies with v: if x = z, then v ~ x implies v ~ z, contradicting v not adjacent to z; if x = t, then v ~ x implies v ~ t, contradicting v not adjacent to t; if y = z, then v ~ y implies v ~ z, contradicting v not adjacent to z; and if y = t, then v ~ y implies v ~ t, contradicting v not adjacent to t.

    lines 103–118

      have hxz : x ≠ z := by
        intro h
        subst z
        exact hvz hvx
      have hxt : x ≠ t := by
        intro h
        subst t
        exact hvt hvx
      have hyz : y ≠ z := by
        intro h
        subst z
        exact hvz hvy
      have hyt : y ≠ t := by
        intro h
        subst t
        exact hvt hvy
  10. x is not adjacent to z in G, and therefore x and z are adjacent in the complement Gᶜ.

    Suppose for contradiction that x is adjacent to z in G. Then the six vertices u, v, x, y, z, t are all pairwise distinct (injective by in1047_allcross_tuple6_injective) and satisfy P.Adj x y, P.Adj z t, G.Adj v y, G.Adj x z, and G.Adj u d (with d = t). This is an alternating 6-switch at uv, contradicting hypothesis h6. Thus x is not adjacent to z in G. Since x ≠ z and x is not adjacent to z in G, by SimpleGraph.compl_adj, x and z are adjacent in the complement graph Gᶜ.

    lines 119–125

    uses in1047_allcross_tuple6_injective, SimpleGraph.compl_adj

      have hxzH : ¬ G.Adj x z := by
        intro h
        apply h6
        refine ⟨x,y,z,t,?_,hxy,hzt,hvy,h,hut⟩
        exact in1047_allcross_tuple6_injective u v x y z t huvne hxu.symm hyu.symm hzu.symm htu.symm
          hxv.symm hyv.symm hzv.symm htv.symm hxyne hxz hxt hyz hyt hztne
      exact (SimpleGraph.compl_adj G x z).2 ⟨hxz,hxzH⟩
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.
SimpleGraph.Subgraph.isPerfectMatching_iff.mp
A subgraph is a perfect matching if and only if every vertex in the graph has a unique neighbor in the subgraph.
in1047_allcross_tuple4_injective
A four-tuple of pairwise distinct elements defines an injective map from Fin 4.
in1047_allcross_tuple6_injective
A six-tuple of pairwise distinct elements defines an injective map from Fin 6.

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_allcross_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]private theorem in1047_allcross_tuple6_injective {V : Type*} (a b c d e f : V)    (hab : a ≠ b) (hac : a ≠ c) (had : a ≠ d) (hae : a ≠ e) (haf : a ≠ f)    (hbc : b ≠ c) (hbd : b ≠ d) (hbe : b ≠ e) (hbf : b ≠ f)    (hcd : c ≠ d) (hce : c ≠ e) (hcf : c ≠ f)    (hde : d ≠ e) (hdf : d ≠ f) (hef : e ≠ f) :    Function.Injective (![a,b,c,d,e,f] : Fin 6 → 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 hae, absurd hij haf,    absurd hij hab.symm, rfl, absurd hij hbc, absurd hij hbd, absurd hij hbe, absurd hij hbf,    absurd hij hac.symm, absurd hij hbc.symm, rfl, absurd hij hcd, absurd hij hce, absurd hij hcf,    absurd hij had.symm, absurd hij hbd.symm, absurd hij hcd.symm, rfl, absurd hij hde, absurd hij hdf,    absurd hij hae.symm, absurd hij hbe.symm, absurd hij hce.symm, absurd hij hde.symm, rfl, absurd hij hef,    absurd hij haf.symm, absurd hij hbf.symm, absurd hij hcf.symm, absurd hij hdf.symm, absurd hij hef.symm, rfl]theorem matching_zero_codegree_blocked_switches_neighborhoods_complete    {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)    (h6 : ¬ ∃ a b c d, Function.Injective (![u,v,a,b,c,d] : Fin 6 → V) ∧ P.Adj a b ∧ P.Adj c d ∧ G.Adj v b ∧ G.Adj a c ∧ G.Adj u d) :    ∀ x z, (Gᶜ).Adj u x → (Gᶜ).Adj v z → (Gᶜ).Adj x z := by  classical  intro x z huxH hvzH  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 huvG : G.Adj u v := P.adj_sub huv  have huvne : u ≠ v := huvG.ne  have hxu : x ≠ u := huxH.ne.symm  have hzv : z ≠ v := hvzH.ne.symm  have huxx : ¬ G.Adj u x := (SimpleGraph.compl_adj G u x).1 huxH |>.2  have hvz : ¬ G.Adj v z := (SimpleGraph.compl_adj G v z).1 hvzH |>.2  have hxv : x ≠ v := by    intro h    subst x    exact huxx huvG  have hzu : z ≠ u := by    intro h    subst z    exact hvz huvG.symm  have hvx : G.Adj v x := by    by_contra h    exact hfar2 x ⟨huxH, (SimpleGraph.compl_adj G v x).2 ⟨hxv.symm,h⟩⟩  have huz : G.Adj u z := by    by_contra h    exact hfar2 z ⟨(SimpleGraph.compl_adj G u z).2 ⟨hzu.symm,h⟩,hvzH⟩  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 huxy : ¬ G.Adj u y := by    intro h    apply h4    refine ⟨x,y,?_,hxy,hvx,h⟩    exact in1047_allcross_tuple4_injective u v x y huvne hxu.symm hyu.symm hxv.symm hyv.symm hxyne  have hvy : G.Adj v y := by    by_contra h    exact hfar2 y ⟨(SimpleGraph.compl_adj G u y).2 ⟨hyu.symm,huxy⟩,      (SimpleGraph.compl_adj G v y).2 ⟨hyv.symm,h⟩⟩  obtain ⟨t,hzt,_⟩ := (SimpleGraph.Subgraph.isPerfectMatching_iff.mp hP) z  have hztne : z ≠ t := (P.adj_sub hzt).ne  have htu : t ≠ u := by    intro h    subst t    have h' : v = z := hmate huv hzt.symm    exact hzv h'.symm  have htv : t ≠ v := by    intro h    subst t    have h' : u = z := hmate huv.symm hzt.symm    exact hzu h'.symm  have hvt : ¬ G.Adj v t := by    intro h    apply h4    refine ⟨t,z,?_,hzt.symm,h,huz⟩    exact in1047_allcross_tuple4_injective u v t z huvne htu.symm hzu.symm htv.symm hzv.symm hztne.symm  have hut : G.Adj u t := by    by_contra h    exact hfar2 t ⟨(SimpleGraph.compl_adj G u t).2 ⟨htu.symm,h⟩,      (SimpleGraph.compl_adj G v t).2 ⟨htv.symm,hvt⟩⟩  have hxz : x ≠ z := by    intro h    subst z    exact hvz hvx  have hxt : x ≠ t := by    intro h    subst t    exact hvt hvx  have hyz : y ≠ z := by    intro h    subst z    exact hvz hvy  have hyt : y ≠ t := by    intro h    subst t    exact hvt hvy  have hxzH : ¬ G.Adj x z := by    intro h    apply h6    refine ⟨x,y,z,t,?_,hxy,hzt,hvy,h,hut⟩    exact in1047_allcross_tuple6_injective u v x y z t huvne hxu.symm hyu.symm hzu.symm htu.symm      hxv.symm hyv.symm hzv.symm htv.symm hxyne hxz hxt hyz hyt hztne  exact (SimpleGraph.compl_adj G x z).2 ⟨hxz,hxzH⟩
See it in the graphDiscuss this resultChallenge it