AFTD Auto-Formalizing Theoretical Domains

op309_girth_nine_no_four_cycle

theoremverified

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

Statement

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

The proof, explained

The proof proceeds by contradiction. From the four given edges connecting distinct vertices a, b, c, d in a loop, we construct a closed walk w of length 4. Since the vertices are pairwise distinct, w is a cycle, which bounds the extended girth of G from above by 4. Transitivity with the assumption that the girth is at least 9 yields 9 ≤ 4, an arithmetic contradiction.

  1. We extract the individual edge adjacencies and construct a closed walk w of length 4 from a back to a.

    We decompose the hypothesis hedges into the four directed edges a ~ b, b ~ c, c ~ d, and d ~ a, and assemble them via Walk.cons and Walk.nil into a closed walk w traversing the sequence of vertices a, b, c, d, a.

    lines 5–6

    uses SimpleGraph.Walk.cons, SimpleGraph.Walk.nil

      rcases hedges with ⟨hab, hbc, hcd, hda⟩
      let w : G.Walk a a := SimpleGraph.Walk.cons hab (SimpleGraph.Walk.cons hbc (SimpleGraph.Walk.cons hcd (SimpleGraph.Walk.cons hda SimpleGraph.Walk.nil)))
  2. The walk w is a cycle.

    By SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length, a closed walk is a cycle if and only if its length is at least 3 and its tail is a path. The length condition 3 ≤ 4 holds by arithmetic. By SimpleGraph.Walk.isPath_def, the tail walk is a path if and only if its vertex support [b, c, d, a] has no duplicates. Expanding the no-duplicates condition for both the assumption [a, b, c, d] and the target [b, c, d, a] into pairwise disequalities leaves a propositional tautology, which is verified automatically.

    lines 7–13

    uses SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length, SimpleGraph.Walk.isPath_def, List.nodup_cons, List.mem_cons, not_or, List.not_mem_nil, and_true, not_false_eq_true

      have hw : w.IsCycle := by
        rw [SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length]
        refine ⟨?_, by norm_num [w]⟩
        rw [SimpleGraph.Walk.isPath_def]
        change [b, c, d, a].Nodup
        simp only [List.nodup_cons, List.mem_cons, not_or, List.not_mem_nil, and_true, not_false_eq_true] at hvertices ⊢
        tauto
  3. The extended girth of G is at most 4.

    Since the extended girth is the infimum of cycle lengths in G, the existence of the cycle w of length 4 implies G.egirth ≤ 4 by SimpleGraph.egirth_le_length.

    line 14

    uses SimpleGraph.egirth_le_length

      have hle : G.egirth ≤ (4 : ℕ∞) := SimpleGraph.egirth_le_length hw
  4. We obtain a contradiction from 9 ≤ 4.

    Combining the hypothesis 9 ≤ G.egirth with G.egirth ≤ 4 by transitivity of inequality gives 9 ≤ 4. Numeric evaluation detects that 9 ≤ 4 is false, closing the proof.

    lines 15–17

    uses le_trans

      have h94 : (9 : ℕ∞) ≤ (4 : ℕ∞) := le_trans hgirth hle
      revert h94
      norm_num
and_true
For any proposition p, the conjunction p ∧ True is equivalent to p.
le_trans
In any preorder, if a ≤ b and b ≤ c, then a ≤ c.
List.mem_cons
An element a is in the list b :: l if and only if a = b or a is in l.
List.nodup_cons
The list a :: l has no duplicates if and only if a is not in l and l has no duplicates.
List.not_mem_nil
No element belongs to the empty list.
not_false_eq_true
The negation of False is True.
not_or
The negation of a disjunction p ∨ q is equivalent to ¬p ∧ ¬q.
SimpleGraph.egirth_le_length
The extended girth of a graph is at most the length of any cycle in that graph.
SimpleGraph.Walk.cons
Prepending an edge between u and v to a walk from v to w yields a walk from u to w.
SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length
A closed walk is a cycle if and only if its tail walk is a path and its length is at least 3.
SimpleGraph.Walk.isPath_def
A walk is a path if and only if its vertex sequence (support) has no duplicate entries.
SimpleGraph.Walk.nil
The trivial walk from a vertex u to itself with length 0.

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_four_cycle    {V : Type*} (G : SimpleGraph V) (hgirth : (9 : ℕ∞) ≤ G.egirth)    (a b c d : V) (hvertices : [a,b,c,d].Nodup)    (hedges : G.Adj a b ∧ G.Adj b c ∧ G.Adj c d ∧ G.Adj d a) : False := by  rcases hedges with ⟨hab, hbc, hcd, hda⟩  let w : G.Walk a a := SimpleGraph.Walk.cons hab (SimpleGraph.Walk.cons hbc (SimpleGraph.Walk.cons hcd (SimpleGraph.Walk.cons hda SimpleGraph.Walk.nil)))  have hw : w.IsCycle := by    rw [SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length]    refine ⟨?_, by norm_num [w]⟩    rw [SimpleGraph.Walk.isPath_def]    change [b, c, d, a].Nodup    simp only [List.nodup_cons, List.mem_cons, not_or, List.not_mem_nil, and_true, not_false_eq_true] at hvertices ⊢    tauto  have hle : G.egirth ≤ (4 : ℕ∞) := SimpleGraph.egirth_le_length hw  have h94 : (9 : ℕ∞) ≤ (4 : ℕ∞) := le_trans hgirth hle  revert h94  norm_num
See it in the graphDiscuss this resultChallenge it