AFTD Auto-Formalizing Theoretical Domains

op309_girth_nine_no_three_cycle

theoremverified

A graph of girth at least nine has no cycle of length 3 on distinct vertices.

Statement

theorem op309_girth_nine_no_three_cycle
    {V : Type*} (G : SimpleGraph V) (hgirth : (9 : ℕ∞) ≤ G.egirth)
    (a b c : V) (hvertices : [a,b,c].Nodup)
    (hedges : G.Adj a b ∧ G.Adj b c ∧ G.Adj c a) : False
Source
OP-309 girth-nine canonical-port local cycle exclusions.
Verified
27 Nov 2026
Axioms
Classical.choiceQuot.soundpropext

The proof, explained

We construct a closed walk p of length 3 from the triangle edges a → b → c → a. Because the vertices a, b, c are pairwise distinct, the tail of this walk is duplicate-free, which makes p a valid cycle. The girth of a graph is at most the length of any of its cycles, forcing G.egirth ≤ 3, which contradicts the hypothesis that G has girth at least 9.

  1. Construct a non-empty closed walk p of length 3 tracing the cycle a → b → c → a.

    Unpack the hypothesis hedges into the three edges a ∼ b, b ∼ c, and c ∼ a. Chain these edges together into a closed walk p from a to a. By definition, p has length 3 and is not the nil walk.

    lines 5–9

      open SimpleGraph in
      rcases hedges with ⟨hab, hbc, hca⟩
      let p : G.Walk a a := Walk.cons hab (Walk.cons hbc (Walk.cons hca Walk.nil))
      have hlen : p.length = 3 := rfl
      have hnotnil : ¬ p.Nil := by simp [p]
  2. The tail of the walk p is a path, meaning the vertex list [b, c, a] contains no duplicates.

    By Walk.isPath_def, a walk is a path when its vertex list contains no duplicates. Since p is non-nil, Walk.support_tail_of_not_nil shows that the vertices of p.tail are the tail of the vertices of p, which is [b, c, a]. Expanding the list duplicate-freeness condition (via List.nodup_cons, List.mem_cons, List.not_mem_nil, and not_false_eq_true) on both the assumption that [a, b, c] is duplicate-free and the goal reduces the problem to propositional logic: the distinctness of a, b, c implies the distinctness of b, c, a, which is solved by propositional reasoning (tauto).

    lines 10–14

    uses Walk.isPath_def, Walk.support_tail_of_not_nil, List.nodup_cons, List.mem_cons, List.not_mem_nil, not_false_eq_true

      have hpath : p.tail.IsPath := by
        rw [Walk.isPath_def, Walk.support_tail_of_not_nil p hnotnil]
        change [b, c, a].Nodup
        simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, not_false_eq_true] at hvertices ⊢
        tauto
  3. The walk p is a cycle in G.

    By Walk.isCycle_iff_isPath_tail_and_le_length, a closed walk is a cycle if and only if its tail is a path and its length is at least 3. Both conditions are satisfied: p.tail was shown to be a path, and the length of p is 3, satisfying 3 ≤ 3.

    lines 15–17

    uses Walk.isCycle_iff_isPath_tail_and_le_length

      have hcycle : p.IsCycle := by
        rw [Walk.isCycle_iff_isPath_tail_and_le_length]
        exact ⟨hpath, by rw [hlen]⟩
  4. The existence of a 3-cycle contradicts the girth bound 9 ≤ G.egirth.

    By G.egirth_le_length, the girth of G is bounded above by the length of any cycle, giving G.egirth ≤ 3. Chaining this with the assumption 9 ≤ G.egirth via transitivity yields 9 ≤ 3, which norm_num refutes as numerically false.

    lines 18–21

    uses G.egirth_le_length

      have hle := G.egirth_le_length hcycle
      rw [hlen] at hle
      have : (9 : ℕ∞) ≤ 3 := hgirth.trans hle
      norm_num at this
G.egirth_le_length
The extended girth of a graph is at most the length of any cycle in that graph.
List.mem_cons
An element belongs to a list constructed by prepending a head to a tail if and only if it equals the head or belongs to the tail.
List.nodup_cons
A list with a head prepended is duplicate-free if and only if the head does not appear in the tail and the tail is duplicate-free.
List.not_mem_nil
The empty list contains no elements.
not_false_eq_true
The negation of false is true.
Walk.isCycle_iff_isPath_tail_and_le_length
A closed walk is a cycle if and only if its tail is a path and its length is at least 3.
Walk.isPath_def
A walk is a path if and only if its list of vertices (support) contains no duplicate entries.
Walk.support_tail_of_not_nil
For any walk that is not nil, the vertex list of its tail equals the tail of its vertex list.

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_girth_nine_no_three_cycle    {V : Type*} (G : SimpleGraph V) (hgirth : (9 : ℕ∞) ≤ G.egirth)    (a b c : V) (hvertices : [a,b,c].Nodup)    (hedges : G.Adj a b ∧ G.Adj b c ∧ G.Adj c a) : False := by  open SimpleGraph in  rcases hedges with ⟨hab, hbc, hca⟩  let p : G.Walk a a := Walk.cons hab (Walk.cons hbc (Walk.cons hca Walk.nil))  have hlen : p.length = 3 := rfl  have hnotnil : ¬ p.Nil := by simp [p]  have hpath : p.tail.IsPath := by    rw [Walk.isPath_def, Walk.support_tail_of_not_nil p hnotnil]    change [b, c, a].Nodup    simp only [List.nodup_cons, List.mem_cons, List.not_mem_nil, not_false_eq_true] at hvertices ⊢    tauto  have hcycle : p.IsCycle := by    rw [Walk.isCycle_iff_isPath_tail_and_le_length]    exact ⟨hpath, by rw [hlen]⟩  have hle := G.egirth_le_length hcycle  rw [hlen] at hle  have : (9 : ℕ∞) ≤ 3 := hgirth.trans hle  norm_num at this
See it in the graphDiscuss this resultChallenge it