AFTD Auto-Formalizing Theoretical Domains

matching_blocked_short_switches_two_missing_saturation

theoremverified

Let a perfect matching contain uv, where u has exactly the two nonneighbors a,b and v is adjacent to both. If no alternating four- or six-cycle through uv exists, the matching pairs a with b, and every vertex other than u,v,a,b is nonadjacent to v,a,b.

Statement

theorem matching_blocked_short_switches_two_missing_saturation
    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)
    (u v a b : V) (huv : P.Adj u v) (hab : a ≠ b)
    (hau : a ≠ u) (hbu : b ≠ u) (hua : ¬ G.Adj u a) (hub : ¬ G.Adj u b)
    (honly : ∀ x : V, x ≠ u → ¬ G.Adj u x → x = a ∨ x = b)
    (hsep : ∀ x : V, x ≠ u → ¬ G.Adj u x → G.Adj v x)
    (h4 : ∀ x y : V, Function.Injective (![u,v,x,y] : Fin 4 → V) → P.Adj x y → ¬ (G.Adj v x ∧ G.Adj u y))
    (h6 : ∀ x y z w : V, Function.Injective (![u,v,x,y,z,w] : Fin 6 → V) → P.Adj x y → P.Adj z w → ¬ (G.Adj v y ∧ G.Adj x z ∧ G.Adj u w)) :
    P.Adj a b ∧ ∀ x : V, x ≠ u → x ≠ v → x ≠ a → x ≠ b → ¬ G.Adj v x ∧ ¬ G.Adj a x ∧ ¬ G.Adj b x
Source
OP-1957: local complement-neighborhood saturation forced by the failure of short alternating switches.
Verified
24 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 3

The proof, explained

We associate each vertex x with its unique partner m(x) in the perfect matching P. Since a and b are the only non-neighbors of u, the partner m(a) must be nonadjacent to u to avoid an alternating 4-cycle switch on (u, v, a, m(a)), which forces m(a) = b and matches a with b in P. For any other vertex x ∉ {u, v, a, b}, its partner m(x) is distinct from u, v, a, b; assuming v is adjacent to x would force m(x) to be a non-neighbor of u, a contradiction that establishes v ≁ x and hence u ~ m(x). Finally, any adjacency between x and a or b would complete an alternating 6-cycle switch through uv, ab, and x m(x), which contradicts the 6-cycle avoidance hypothesis.

  1. We enable classical logic and extract the matching and spanning properties of the perfect matching P.

    A perfect matching consists of a 1-factor in G: every vertex is incident to exactly one matching edge. We unpack this into hM (the matching condition: at most one incident matching edge per vertex) and hS (the spanning condition: every vertex is in P).

    lines 10–11

      classical
      obtain ⟨hM, hS⟩ := hP
  2. Any 4-tuple or 6-tuple of pairwise distinct vertices defines an injective map from Fin 4 or Fin 6 into V.

    We prove two helper lemmas, inj4 and inj6. Assuming pairwise distinctness of the arguments, the injectivity condition f(i) = f(j) → i = j is verified by exhaustive case analysis over all pairs of indices using fin_cases and simp_all.

    lines 12–23

      have inj4 : ∀ {p q r s : V}, p ≠ q → p ≠ r → p ≠ s → q ≠ r → q ≠ s → r ≠ s →
          Function.Injective (![p,q,r,s] : Fin 4 → V) := by
        intro p q r s h1 h2 h3 h4 h5 h6 i j hij
        fin_cases i <;> fin_cases j <;> simp_all
      have inj6 : ∀ {p q r s t w : V},
          p ≠ q → p ≠ r → p ≠ s → p ≠ t → p ≠ w →
          q ≠ r → q ≠ s → q ≠ t → q ≠ w →
          r ≠ s → r ≠ t → r ≠ w →
          s ≠ t → s ≠ w → t ≠ w →
          Function.Injective (![p,q,r,s,t,w] : Fin 6 → V) := by
        intro p q r s t w h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 i j hij
        fin_cases i <;> fin_cases j <;> simp_all
  3. There is an involution m on V giving the matching partner of each vertex, and u, v, a, b satisfy initial distinctness and adjacency relations.

    Using the matching and spanning hypotheses, we define m(x) as the unique vertex matched to x in P. By uniqueness and symmetry of adjacency, m is an involution (m(m(x)) = x) with m(u) = v and m(v) = u. The matching edge uv is also an edge of G (by P.adj_sub), so u ≠ v since G has no self-loops (G.irrefl). Since u is nonadjacent to a and b, neither a nor b can equal v. By hypothesis hsep, v is adjacent to both non-neighbors a and b of u.

    lines 24–35

    uses P.adj_sub, G.irrefl

      let m : V → V := fun x => (hM (hS x)).choose
      have hm : ∀ x, P.Adj x (m x) := fun x => (hM (hS x)).choose_spec.1
      have hm_eq : ∀ x y, P.Adj x y → y = m x := fun x y h => (hM (hS x)).choose_spec.2 y h
      have m_invol : ∀ x, m (m x) = x := fun x => (hm_eq (m x) x (hm x).symm).symm
      have mu : m u = v := (hm_eq u v huv).symm
      have mv : m v = u := (hm_eq v u huv.symm).symm
      have huvG : G.Adj u v := P.adj_sub huv
      have h_uv : u ≠ v := by intro h; rw [h] at huvG; exact G.irrefl huvG
      have hav : a ≠ v := by intro h; apply hua; rw [h]; exact huvG
      have hbv : b ≠ v := by intro h; apply hub; rw [h]; exact huvG
      have hva : G.Adj v a := hsep a hau hua
      have hvb : G.Adj v b := hsep b hbu hub
  4. The matching partner m(a) of a is distinct from u, v, a, and u is not adjacent to m(a) in G.

    If m(a) were u, then a = m(m(a)) = m(u) = v, contradicting a ≠ v; similarly, m(a) = v would imply a = u, contradicting a ≠ u. Also m(a) ≠ a because G has no self-loops (G.irrefl and P.adj_sub). If u were adjacent to m(a), the cycle (u, v, a, m(a)) with matching edges uv, a m(a) and graph edges va, u m(a) would form an alternating 4-cycle switch, contradicting the hypothesis h4.

    lines 36–44

    uses G.irrefl, P.adj_sub

      have hcu : m a ≠ u := by
        intro h; have hinv := m_invol a; rw [h, mu] at hinv; exact hav hinv.symm
      have hcv : m a ≠ v := by
        intro h; have hinv := m_invol a; rw [h, mv] at hinv; exact hau hinv.symm
      have hca : m a ≠ a := by
        intro h; have hh := hm a; rw [h] at hh; exact G.irrefl (P.adj_sub hh)
      have hnu : ¬ G.Adj u (m a) := by
        intro hAdj
        exact h4 a (m a) (inj4 h_uv hau.symm hcu.symm hav.symm hcv.symm hca.symm) (hm a) ⟨hva, hAdj⟩
  5. P matches a to b, so m(a) = b and m(b) = a.

    Suppose for contradiction that a is not matched to b, so m(a) ≠ b. Since m(a) ≠ u and u is not adjacent to m(a), the hypothesis honly dictates that m(a) must be a or b. But we already established m(a) ≠ a and m(a) ≠ b, a contradiction. Thus P matches a to b, which gives m(a) = b and m(b) = a.

    lines 45–52

      have hma : P.Adj a b := by
        by_contra hcon
        have hmab : m a ≠ b := fun h => hcon (h ▸ hm a)
        rcases honly (m a) hcu hnu with h | h
        · exact hca h
        · exact hmab h
      have hma_b : m a = b := (hm_eq a b hma).symm
      have hmb_a : m b = a := (hm_eq b a hma.symm).symm
  6. For any vertex x distinct from u, v, a, b, its matching partner m(x) is distinct from u, v, a, b, x.

    We split the goal and fix x ∉ {u, v, a, b}. If m(x) = u, then x = m(u) = v, contradiction; if m(x) = v, then x = u; if m(x) = a, then x = m(a) = b; and if m(x) = b, then x = m(b) = a. Each case contradicts our assumption that x is distinct from u, v, a, b. Finally, m(x) ≠ x because matching edges cannot be self-loops (G.irrefl and P.adj_sub).

    lines 53–64

    uses G.irrefl, P.adj_sub

      refine ⟨hma, ?_⟩
      intro x hxu hxv hxa hxb
      have hyu : m x ≠ u := by
        intro h; have hinv := m_invol x; rw [h, mu] at hinv; exact hxv hinv.symm
      have hyv : m x ≠ v := by
        intro h; have hinv := m_invol x; rw [h, mv] at hinv; exact hxu hinv.symm
      have hya : m x ≠ a := by
        intro h; have hinv := m_invol x; rw [h, hma_b] at hinv; exact hxb hinv.symm
      have hyb : m x ≠ b := by
        intro h; have hinv := m_invol x; rw [h, hmb_a] at hinv; exact hxa hinv.symm
      have hyx : m x ≠ x := by
        intro h; have hh := hm x; rw [h] at hh; exact G.irrefl (P.adj_sub hh)
  7. v is not adjacent to x in G.

    Suppose v were adjacent to x. If u were adjacent to m(x), the 4-tuple (u, v, x, m(x)) would violate the alternating 4-cycle switch hypothesis h4. Thus u is not adjacent to m(x). Since m(x) ≠ u, hypothesis honly requires m(x) to be a or b, which contradicts the fact that m(x) is distinct from both a and b. Hence v is not adjacent to x.

    lines 65–71

      have hnvx : ¬ G.Adj v x := by
        intro hAdj
        have huny : ¬ G.Adj u (m x) :=
          fun huy => h4 x (m x) (inj4 h_uv hxu.symm hyu.symm hxv.symm hyv.symm hyx.symm) (hm x) ⟨hAdj, huy⟩
        rcases honly (m x) hyu huny with h | h
        · exact hya h
        · exact hyb h
  8. u is adjacent to m(x) in G.

    If u were not adjacent to m(x), then since m(x) ≠ u, hypothesis honly would force m(x) to be either a or b, contradicting the fact that m(x) is distinct from both. Therefore, u must be adjacent to m(x).

    lines 72–76

      have huy : G.Adj u (m x) := by
        by_contra h
        rcases honly (m x) hyu h with h' | h'
        · exact hya h'
        · exact hyb h'
  9. a is not adjacent to x in G.

    Suppose a were adjacent to x. The six vertices (u, v, a, b, x, m(x)) are pairwise distinct, with matching edges ab and x m(x) in P. Combined with the graph edges v ~ b (from hsep), a ~ x (by assumption), and u ~ m(x) (from the previous step), this forms an alternating 6-cycle switch (u ~ v ~ b — a ~ x — m(x) ~ u), directly contradicting hypothesis h6. Hence a is not adjacent to x.

    lines 77–82

      have hnax : ¬ G.Adj a x := by
        intro hAdj
        exact h6 a b x (m x)
          (inj6 h_uv hau.symm hbu.symm hxu.symm hyu.symm hav.symm hbv.symm hxv.symm hyv.symm
            hab hxa.symm hya.symm hxb.symm hyb.symm hyx.symm)
          hma (hm x) ⟨hvb, hAdj, huy⟩
  10. b is not adjacent to x in G.

    Symmetrically, suppose b were adjacent to x. Applying hypothesis h6 to (u, v, b, a, x, m(x)) with matching edges ba and x m(x), and graph edges v ~ a, b ~ x, and u ~ m(x) produces an alternating 6-cycle switch, contradicting h6. Hence b is not adjacent to x.

    lines 83–88

      have hnbx : ¬ G.Adj b x := by
        intro hAdj
        exact h6 b a x (m x)
          (inj6 h_uv hbu.symm hau.symm hxu.symm hyu.symm hbv.symm hav.symm hxv.symm hyv.symm
            hab.symm hxb.symm hyb.symm hxa.symm hya.symm hyx.symm)
          hma.symm (hm x) ⟨hva, hAdj, huy⟩
  11. Every vertex x ∉ {u, v, a, b} is nonadjacent to v, a, and b.

    We combine the three non-adjacencies ¬G.Adj v x, ¬G.Adj a x, and ¬G.Adj b x into a single conjunction, closing the final goal.

    line 89

      exact ⟨hnvx, hnax, hnbx⟩
G.irrefl
A simple graph has no self-loops; no vertex is adjacent to itself.
P.adj_sub
An edge in a subgraph is also an edge in the ambient 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_blocked_short_switches_two_missing_saturation    {V : Type*} (G : SimpleGraph V) (P : G.Subgraph) (hP : P.IsPerfectMatching)    (u v a b : V) (huv : P.Adj u v) (hab : a ≠ b)    (hau : a ≠ u) (hbu : b ≠ u) (hua : ¬ G.Adj u a) (hub : ¬ G.Adj u b)    (honly : ∀ x : V, x ≠ u → ¬ G.Adj u x → x = a ∨ x = b)    (hsep : ∀ x : V, x ≠ u → ¬ G.Adj u x → G.Adj v x)    (h4 : ∀ x y : V, Function.Injective (![u,v,x,y] : Fin 4 → V) → P.Adj x y → ¬ (G.Adj v x ∧ G.Adj u y))    (h6 : ∀ x y z w : V, Function.Injective (![u,v,x,y,z,w] : Fin 6 → V) → P.Adj x y → P.Adj z w → ¬ (G.Adj v y ∧ G.Adj x z ∧ G.Adj u w)) :    P.Adj a b ∧ ∀ x : V, x ≠ u → x ≠ v → x ≠ a → x ≠ b → ¬ G.Adj v x ∧ ¬ G.Adj a x ∧ ¬ G.Adj b x := by  classical  obtain ⟨hM, hS⟩ := hP  have inj4 : ∀ {p q r s : V}, p ≠ q → p ≠ r → p ≠ s → q ≠ r → q ≠ s → r ≠ s →      Function.Injective (![p,q,r,s] : Fin 4 → V) := by    intro p q r s h1 h2 h3 h4 h5 h6 i j hij    fin_cases i <;> fin_cases j <;> simp_all  have inj6 : ∀ {p q r s t w : V},      p ≠ q → p ≠ r → p ≠ s → p ≠ t → p ≠ w →      q ≠ r → q ≠ s → q ≠ t → q ≠ w →      r ≠ s → r ≠ t → r ≠ w →      s ≠ t → s ≠ w → t ≠ w →      Function.Injective (![p,q,r,s,t,w] : Fin 6 → V) := by    intro p q r s t w h1 h2 h3 h4 h5 h6 h7 h8 h9 h10 h11 h12 h13 h14 h15 i j hij    fin_cases i <;> fin_cases j <;> simp_all  let m : V → V := fun x => (hM (hS x)).choose  have hm : ∀ x, P.Adj x (m x) := fun x => (hM (hS x)).choose_spec.1  have hm_eq : ∀ x y, P.Adj x y → y = m x := fun x y h => (hM (hS x)).choose_spec.2 y h  have m_invol : ∀ x, m (m x) = x := fun x => (hm_eq (m x) x (hm x).symm).symm  have mu : m u = v := (hm_eq u v huv).symm  have mv : m v = u := (hm_eq v u huv.symm).symm  have huvG : G.Adj u v := P.adj_sub huv  have h_uv : u ≠ v := by intro h; rw [h] at huvG; exact G.irrefl huvG  have hav : a ≠ v := by intro h; apply hua; rw [h]; exact huvG  have hbv : b ≠ v := by intro h; apply hub; rw [h]; exact huvG  have hva : G.Adj v a := hsep a hau hua  have hvb : G.Adj v b := hsep b hbu hub  have hcu : m a ≠ u := by    intro h; have hinv := m_invol a; rw [h, mu] at hinv; exact hav hinv.symm  have hcv : m a ≠ v := by    intro h; have hinv := m_invol a; rw [h, mv] at hinv; exact hau hinv.symm  have hca : m a ≠ a := by    intro h; have hh := hm a; rw [h] at hh; exact G.irrefl (P.adj_sub hh)  have hnu : ¬ G.Adj u (m a) := by    intro hAdj    exact h4 a (m a) (inj4 h_uv hau.symm hcu.symm hav.symm hcv.symm hca.symm) (hm a) ⟨hva, hAdj⟩  have hma : P.Adj a b := by    by_contra hcon    have hmab : m a ≠ b := fun h => hcon (h ▸ hm a)    rcases honly (m a) hcu hnu with h | h    · exact hca h    · exact hmab h  have hma_b : m a = b := (hm_eq a b hma).symm  have hmb_a : m b = a := (hm_eq b a hma.symm).symm  refine ⟨hma, ?_⟩  intro x hxu hxv hxa hxb  have hyu : m x ≠ u := by    intro h; have hinv := m_invol x; rw [h, mu] at hinv; exact hxv hinv.symm  have hyv : m x ≠ v := by    intro h; have hinv := m_invol x; rw [h, mv] at hinv; exact hxu hinv.symm  have hya : m x ≠ a := by    intro h; have hinv := m_invol x; rw [h, hma_b] at hinv; exact hxb hinv.symm  have hyb : m x ≠ b := by    intro h; have hinv := m_invol x; rw [h, hmb_a] at hinv; exact hxa hinv.symm  have hyx : m x ≠ x := by    intro h; have hh := hm x; rw [h] at hh; exact G.irrefl (P.adj_sub hh)  have hnvx : ¬ G.Adj v x := by    intro hAdj    have huny : ¬ G.Adj u (m x) :=      fun huy => h4 x (m x) (inj4 h_uv hxu.symm hyu.symm hxv.symm hyv.symm hyx.symm) (hm x) ⟨hAdj, huy⟩    rcases honly (m x) hyu huny with h | h    · exact hya h    · exact hyb h  have huy : G.Adj u (m x) := by    by_contra h    rcases honly (m x) hyu h with h' | h'    · exact hya h'    · exact hyb h'  have hnax : ¬ G.Adj a x := by    intro hAdj    exact h6 a b x (m x)      (inj6 h_uv hau.symm hbu.symm hxu.symm hyu.symm hav.symm hbv.symm hxv.symm hyv.symm        hab hxa.symm hya.symm hxb.symm hyb.symm hyx.symm)      hma (hm x) ⟨hvb, hAdj, huy⟩  have hnbx : ¬ G.Adj b x := by    intro hAdj    exact h6 b a x (m x)      (inj6 h_uv hbu.symm hau.symm hxu.symm hyu.symm hbv.symm hav.symm hxv.symm hyv.symm        hab.symm hxb.symm hyb.symm hxa.symm hya.symm hyx.symm)      hma.symm (hm x) ⟨hva, hAdj, huy⟩  exact ⟨hnvx, hnax, hnbx⟩
See it in the graphDiscuss this resultChallenge it