op309_girth_nine_no_eight_cycle
A graph of girth at least nine has no cycle of length 8 on distinct vertices.
Statement
theorem op309_girth_nine_no_eight_cycle {V : Type*} (G : SimpleGraph V) (hgirth : (9 : ℕ∞) ≤ G.egirth) (a b c d e f g h : V) (hvertices : [a,b,c,d,e,f,g,h].Nodup) (hedges : G.Adj a b ∧ G.Adj b c ∧ G.Adj c d ∧ G.Adj d e ∧ G.Adj e f ∧ G.Adj f g ∧ G.Adj g h ∧ G.Adj h a) : False
- Source
- OP-309 girth-nine canonical-port local cycle exclusions.
- Verified
- 27 Nov 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 1
- op309_girth9_disjoint_p3_leaf_hosts_uniqueIn a graph of girth at least nine, two vertex-disjoint three-vertex paths cannot both have leaves adjacent to each of two distinct outside…
The proof, explained
The proof proceeds by contradiction from the definition of graph girth. Assuming the existence of an 8-cycle on distinct vertices a, b, c, d, e, f, g, h, we construct the corresponding closed walk p of length 8. We show that p is a cycle by proving its tail is duplicate-free (as a cyclic rotation of the distinct vertices) and its length is at least 3. Since the girth of G is bounded above by the length of any cycle, we obtain girth(G) ≤ 8, which contradicts the hypothesis that girth(G) ≥ 9.
Unpack the edge adjacencies and construct a closed walk p of length 8 from a to a.
We destruct the hypothesis hedges into individual adjacencies between successive vertices: a ~ b, b ~ c, c ~ d, d ~ e, e ~ f, f ~ g, g ~ h, and h ~ a. Using these edges and the walk constructors (SimpleGraph.Walk.cons and SimpleGraph.Walk.nil), we define p as the closed walk starting at a, traversing the vertices in sequence, and returning to a.
uses
SimpleGraph.Walk.cons,SimpleGraph.Walk.nilrcases hedges with ⟨hab, hbc, hcd, hde, hef, hfg, hgh, hha⟩ let p : G.Walk a a := SimpleGraph.Walk.cons hab (SimpleGraph.Walk.cons hbc (SimpleGraph.Walk.cons hcd (SimpleGraph.Walk.cons hde (SimpleGraph.Walk.cons hef (SimpleGraph.Walk.cons hfg (SimpleGraph.Walk.cons hgh (SimpleGraph.Walk.cons hha SimpleGraph.Walk.nil)))))))
p is not the empty (nil) walk.
By definition, p begins with an edge prepended via SimpleGraph.Walk.cons. Supposing for contradiction that p is nil, case analysis on this hypothesis immediately produces a contradiction because a cons walk can never be nil.
have hnotnil : ¬ p.Nil := by dsimp [p] intro hc cases hc
p is a cycle in the graph G.
A closed walk is a cycle if and only if removing its first edge leaves a path and its length is at least 3 (SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length). First, a walk is a path when its vertex sequence has no duplicates (SimpleGraph.Walk.isPath_def). Because p is non-nil, the vertices visited by its tail are [b, c, d, e, f, g, h, a] (SimpleGraph.Walk.support_tail_of_not_nil). This list is the 1-step cyclic rotation of [a, b, c, d, e, f, g, h] (List.rotate_cons_succ, List.rotate_zero). Since rotating a list preserves the absence of duplicate elements (List.nodup_rotate) and the original vertices are assumed distinct, the tail is a path. Second, p has length 8, and the condition 3 ≤ 8 holds by direct evaluation (decide).
uses
SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length,SimpleGraph.Walk.isPath_def,SimpleGraph.Walk.support_tail_of_not_nil,List.rotate_cons_succ,List.rotate_zero,List.nodup_rotatehave hcycle : p.IsCycle := by rw [SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length] refine ⟨?_, ?_⟩ · rw [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_tail_of_not_nil _ hnotnil] have hrot : [b, c, d, e, f, g, h, a] = [a, b, c, d, e, f, g, h].rotate 1 := by rw [List.rotate_cons_succ, List.rotate_zero] rfl change [b, c, d, e, f, g, h, a].Nodup rw [hrot] rwa [List.nodup_rotate] · change 3 ≤ 8 decide
The girth of G is at most 8.
The extended girth of a graph is bounded above by the length of any cycle in the graph (G.egirth_le_length). Since p is a cycle and has length 8 by definition, the girth of G is at most 8.
uses
G.egirth_le_lengthhave hle : G.egirth ≤ ↑p.length := G.egirth_le_length hcycle have hlen : p.length = 8 := rfl rw [hlen] at hle
A contradiction is derived, completing the proof.
Combining the assumption that the girth of G is at least 9 with the upper bound that the girth is at most 8 yields 9 ≤ 8 by transitivity. This false numerical inequality is refuted by direct computation (decide), proving False.
have hcontra : (9 : ℕ∞) ≤ 8 := hgirth.trans hle revert hcontra decide
SimpleGraph.Walk.cons- Prepends an edge to a walk to produce a walk that is one edge longer.
SimpleGraph.Walk.nil- The empty walk of length 0 starting and ending at the same vertex.
SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length- A closed walk is a cycle if and only if removing its first edge yields a path and its total length is at least 3.
SimpleGraph.Walk.isPath_def- A walk is a path if and only if its sequence of visited vertices contains no duplicate elements.
SimpleGraph.Walk.support_tail_of_not_nil- For any non-nil walk, the vertex sequence of its tail is obtained by dropping the first vertex of the original walk's vertex sequence.
List.rotate_cons_succ- Rotating a non-empty list a :: l by n + 1 positions is the same as rotating l ++ [a] by n positions.
List.rotate_zero- Rotating a list by 0 positions leaves it unchanged.
List.nodup_rotate- Rotating a list preserves the property of having no duplicate elements.
G.egirth_le_length- The girth (extended girth) of a graph G is at most the length of any cycle in G.
- Mathlib defines a cycle as a closed walk whose tail is a path and whose length is at least 3. In the formalization, showing that the tail is a path requires verifying that the walk is non-nil and using list rotation properties to transfer the distinctness of the original vertex list to the tail's vertex support.
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
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
theorem op309_girth_nine_no_eight_cycle {V : Type*} (G : SimpleGraph V) (hgirth : (9 : ℕ∞) ≤ G.egirth) (a b c d e f g h : V) (hvertices : [a,b,c,d,e,f,g,h].Nodup) (hedges : G.Adj a b ∧ G.Adj b c ∧ G.Adj c d ∧ G.Adj d e ∧ G.Adj e f ∧ G.Adj f g ∧ G.Adj g h ∧ G.Adj h a) : False := by rcases hedges with ⟨hab, hbc, hcd, hde, hef, hfg, hgh, hha⟩ let p : G.Walk a a := SimpleGraph.Walk.cons hab (SimpleGraph.Walk.cons hbc (SimpleGraph.Walk.cons hcd (SimpleGraph.Walk.cons hde (SimpleGraph.Walk.cons hef (SimpleGraph.Walk.cons hfg (SimpleGraph.Walk.cons hgh (SimpleGraph.Walk.cons hha SimpleGraph.Walk.nil))))))) have hnotnil : ¬ p.Nil := by dsimp [p] intro hc cases hc have hcycle : p.IsCycle := by rw [SimpleGraph.Walk.isCycle_iff_isPath_tail_and_le_length] refine ⟨?_, ?_⟩ · rw [SimpleGraph.Walk.isPath_def, SimpleGraph.Walk.support_tail_of_not_nil _ hnotnil] have hrot : [b, c, d, e, f, g, h, a] = [a, b, c, d, e, f, g, h].rotate 1 := by rw [List.rotate_cons_succ, List.rotate_zero] rfl change [b, c, d, e, f, g, h, a].Nodup rw [hrot] rwa [List.nodup_rotate] · change 3 ≤ 8 decide have hle : G.egirth ≤ ↑p.length := G.egirth_le_length hcycle have hlen : p.length = 8 := rfl rw [hlen] at hle have hcontra : (9 : ℕ∞) ≤ 8 := hgirth.trans hle revert hcontra decide