AFTD Auto-Formalizing Theoretical Domains

op309_cycle_persists_after_low_degree_removal

theoremverified

A graph cycle survives if a vertex with at most one neighbor is removed and every other edge is retained.

Statement

theorem op309_cycle_persists_after_low_degree_removal
    {V : Type*} [Fintype V] [DecidableEq V] (H H' : SimpleGraph V) (b : V)
    (hleaf : ∀ x y, H.Adj b x → H.Adj b y → x = y)
    (hkeep : ∀ x y, x ≠ b → y ≠ b → H.Adj x y → H'.Adj x y)
    (hc : ¬ H.IsAcyclic) : ¬ H'.IsAcyclic
Source
Cycle persistence under one-to-two P3 switches for OP-309.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

The proof proceeds by contradiction: assuming H' is acyclic, we show H must be acyclic by transferring any cycle p of H into H'. A vertex on a cycle must have degree at least 2 in the cycle's subgraph, but the removed vertex b has degree at most 1 in all of H, so b cannot belong to p. Therefore, all edges of p avoid b and are preserved in H', forming a cycle in H' and yielding a contradiction.

  1. To deduce that H' is not acyclic, it suffices to derive a contradiction from an assumed cycle in H.

    We proceed by contradiction. Assume H' is acyclic. To contradict the hypothesis that H is not acyclic, we assume H has a cycle p based at some vertex u.

    lines 6–9

      classical
      intro ha
      apply hc
      intro u p hp
  2. The vertex b does not lie on the cycle p.

    If b were in the support of the cycle p, its degree in the subgraph induced by p would be exactly 2. However, every neighbor of b in that subgraph is also a neighbor of b in H, where b has at most one neighbor by hypothesis hleaf. Thus the neighbor set of b in the cycle's subgraph is a subsingleton, so by Set.ncard_le_one_iff_subsingleton.mpr its cardinality is at most 1. The omega tactic derives a contradiction from 2 ≤ 1.

    lines 10–18

    uses Set.ncard_le_one_iff_subsingleton.mpr

      have hb : b ∉ p.support := by
        intro hm
        have htwo := hp.ncard_neighborSet_toSubgraph_eq_two hm
        have hsmall : (p.toSubgraph.neighborSet b).Subsingleton := by
          intro x hx y hy
          exact hleaf x y (p.toSubgraph.adj_sub hx) (p.toSubgraph.adj_sub hy)
        have hone : (p.toSubgraph.neighborSet b).ncard ≤ 1 :=
          Set.ncard_le_one_iff_subsingleton.mpr hsmall
        omega
  3. Every edge of the cycle p is retained in H'.

    Let e be an edge of the cycle p. Expressing e as an unordered pair s(x, y) via Sym2.ind, the vertices x and y are adjacent in the subgraph of p. Since endpoints of edges in p belong to the support of p and b is not in the support, neither x nor y can equal b. Because x and y are adjacent in H and both differ from b, hypothesis hkeep guarantees that the edge s(x, y) is also present in H'.

    lines 19–32

    uses Sym2.ind

      have htransfer : ∀ e ∈ p.edges, e ∈ H'.edgeSet := by
        intro e he
        induction e using Sym2.ind with
        | _ x y =>
          have hxy : p.toSubgraph.Adj x y := p.adj_toSubgraph_iff_mem_edges.mpr he
          have hxb : x ≠ b := by
            intro heq
            subst x
            exact hb (p.mem_support_of_adj_toSubgraph hxy)
          have hyb : y ≠ b := by
            intro heq
            subst y
            exact hb (p.mem_support_of_adj_toSubgraph hxy.symm)
          exact hkeep x y hxb hyb (p.toSubgraph.adj_sub hxy)
  4. The cycle p transfers to a cycle in H', producing a contradiction.

    Because all edges of p are preserved in H', the cycle p transfers directly to a cycle in H', which contradicts the assumption that H' is acyclic.

    line 33

      exact ha (p.transfer H' htransfer) (hp.transfer htransfer)
Set.ncard_le_one_iff_subsingleton.mpr
A set containing at most one element (a subsingleton) has cardinality at most 1.
Sym2.ind
Every unordered pair in the symmetric square of a type is of the form s(x, y) for some elements x and y.

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 op309_cycle_persists_after_low_degree_removal    {V : Type*} [Fintype V] [DecidableEq V] (H H' : SimpleGraph V) (b : V)    (hleaf : ∀ x y, H.Adj b x → H.Adj b y → x = y)    (hkeep : ∀ x y, x ≠ b → y ≠ b → H.Adj x y → H'.Adj x y)    (hc : ¬ H.IsAcyclic) : ¬ H'.IsAcyclic := by  classical  intro ha  apply hc  intro u p hp  have hb : b ∉ p.support := by    intro hm    have htwo := hp.ncard_neighborSet_toSubgraph_eq_two hm    have hsmall : (p.toSubgraph.neighborSet b).Subsingleton := by      intro x hx y hy      exact hleaf x y (p.toSubgraph.adj_sub hx) (p.toSubgraph.adj_sub hy)    have hone : (p.toSubgraph.neighborSet b).ncard ≤ 1 :=      Set.ncard_le_one_iff_subsingleton.mpr hsmall    omega  have htransfer : ∀ e ∈ p.edges, e ∈ H'.edgeSet := by    intro e he    induction e using Sym2.ind with    | _ x y =>      have hxy : p.toSubgraph.Adj x y := p.adj_toSubgraph_iff_mem_edges.mpr he      have hxb : x ≠ b := by        intro heq        subst x        exact hb (p.mem_support_of_adj_toSubgraph hxy)      have hyb : y ≠ b := by        intro heq        subst y        exact hb (p.mem_support_of_adj_toSubgraph hxy.symm)      exact hkeep x y hxb hyb (p.toSubgraph.adj_sub hxy)  exact ha (p.transfer H' htransfer) (hp.transfer htransfer)
See it in the graphDiscuss this resultChallenge it