AFTD Auto-Formalizing Theoretical Domains

op309_girth9_example_graph_properties

theoremverified

The explicit 132-vertex simple graph G is connected, 3-regular, and has girth at least 9.

Statement

theorem op309_girth9_example_graph_properties
    (G : SimpleGraph (Fin 132)) [DecidableRel G.Adj]
    (hG : ∀ u v : Fin 132, G.Adj u v ↔
      let outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]
      (u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨
      (u.val,v.val) ∈ outside ∨ (v.val,u.val) ∈ outside) :
    G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth
Source
step towards op309_girth9_source_forest_clique5_nonfive_example
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
  • Arena.Reachable.transReachability is transitive.
  • cFor a group $G$ and an element $s \in G$, the local count $c_G(s)$ is the cardinality of the set of elements $g \in G$ such that…
Used by 5

The proof, explained

The 132-vertex graph $G$ is specified by 44 blocks of 3 vertices and 110 additional outside edges, which are shown via computational reflection to be equivalent to an explicit 3-regular neighbor table packed into a large integer. Connectedness is proved by verifying that an explicit parent table and depth function define a spanning tree rooted at vertex 0, so that every vertex can reach 0 by induction on depth. Regularity is proved by showing the neighbor set of every vertex has size 3 via kernel evaluation. Finally, the girth is at least 9 because a recursive function checks that no non-backtracking walk of length between 3 and 8 can return to its starting vertex, a finite check fully discharged by kernel computation.

  1. Base case: a walk of length 1 cannot return to the start vertex if the checker condition holds.

    We proceed by induction on $n$. When $n = 0$, the goal is to show $y(1) \ne s$. The checker definition evaluates to $y(1) \ne s$ directly from `h : in1267_chk 0 s (y 0) (y 1) = true`, so simplification closes the base case.

    lines 24–27

    uses in1267_chk

      induction n with
      | zero =>
        intro s y _ _ h
        simpa [in1267_chk] using h
  2. Inductive step: the checker condition is sound for non-backtracking walks of length $n + 2$.

    Assume the induction hypothesis holds for walks of length $n+1$. For a non-backtracking walk $y$ of length $n+2$, the vertex $y(2)$ is one of the three neighbors of $y(1)$, and $y(2) \ne y(0)$ by the non-backtracking assumption. Expanding `in1267_chk (n+1) s (y 0) (y 1)` shows that for each neighbor of $y(1)$, either it equals $y(0)$ or the checker condition holds for the sub-walk of length $n+1$ starting with step $(y(1), y(2))$. Eliminating the backtracking case gives `in1267_chk n s (y 1) (y 2) = true`. Applying the induction hypothesis to the shifted walk $j \mapsto y(j+1)$ concludes that $y(n+2) \ne s$.

    lines 28–41

    uses in1267_chk, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq

      | succ n ih =>
        intro s y hadj hnb h
        have key : in1267_chk n s (y 1) (y 2) = true := by
          have h2 := hadj 1 (by omega)
          have hne := hnb 0 (by omega)
          simp only [in1267_chk, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq] at h
          obtain ⟨⟨h0, h1⟩, h2'⟩ := h
          rcases h2 with e | e | e <;> rw [e] at hne ⊢
          · exact h0.resolve_left hne
          · exact h1.resolve_left hne
          · exact h2'.resolve_left hne
        have := ih s (fun j => y (j+1)) (fun j hj => hadj (j+1) (by omega))
          (fun j hj => hnb (j+1) (by omega)) key
        simpa using this
  3. All non-backtracking walks of lengths 3 through 8 avoid returning to the start vertex. automation

    For every starting vertex $s < 132$, each of its 3 neighbors, and each walk length $m+2$ with $m < 6$ (lengths 3 through 8), kernel computation verifies that `in1267_chk (m+2) s s (in1267_nb s i) = true`.

    lines 43–46

    theorem in1267_chk_all : ∀ s, s < 132 → ∀ i, i < 3 → ∀ m, m < 6 →
        in1267_chk (m+2) s s (in1267_nb s i) = true := by
      decide +kernel
    
  4. Every edge in the outside edge list is valid and consistent with the neighbor table. automation

    Kernel evaluation checks each pair $(u, v)$ in the outside edge list to verify that $u, v < 132$, $v$ is one of the 3 neighbors of $u$, and $u$ is one of the 3 neighbors of $v$.

    lines 49–53

    theorem in1267_out_fwd : ∀ p ∈ in1267_outside, p.1 < 132 ∧ p.2 < 132 ∧
        (p.2 = in1267_nb p.1 0 ∨ p.2 = in1267_nb p.1 1 ∨ p.2 = in1267_nb p.1 2) ∧
        (p.1 = in1267_nb p.2 0 ∨ p.1 = in1267_nb p.2 1 ∨ p.1 = in1267_nb p.2 2) := by
      decide +kernel
    
  5. Every block edge is consistent with the neighbor table. automation

    Kernel evaluation checks that for all $u, v < 132$ in the same block of 3 with at least one vertex being a multiple of 3, $v$ appears as a neighbor of $u$ in the transition table.

    lines 54–58

    theorem in1267_blk_fwd : ∀ u, u < 132 → ∀ v, v < 132 →
        (u ≠ v ∧ u / 3 = v / 3 ∧ (u % 3 = 0 ∨ v % 3 = 0)) →
        (v = in1267_nb u 0 ∨ v = in1267_nb u 1 ∨ v = in1267_nb u 2) := by
      decide +kernel
    
  6. Every transition table neighbor corresponds to an edge in the graph definition. automation

    Kernel evaluation verifies that for every vertex $u < 132$ and neighbor index $i < 3$, the neighbor is either in the same 3-vertex block as $u$ or forms a pair in the outside edge list.

    lines 59–63

    theorem in1267_bwd : ∀ u, u < 132 → ∀ i, i < 3 →
        (decide (u ≠ in1267_nb u i ∧ u / 3 = in1267_nb u i / 3 ∧ (u % 3 = 0 ∨ in1267_nb u i % 3 = 0)) ||
        in1267_outside.contains (u, in1267_nb u i) || in1267_outside.contains (in1267_nb u i, u)) = true := by
      decide +kernel
    
  7. Graph adjacency is logically equivalent to appearing in the neighbor table.

    Combining the forward checks for block and outside edges shows that any edge in the graph definition corresponds to a neighbor in the table. Conversely, using the backward check and case analysis on the neighbor index shows that every neighbor in the table satisfies the graph's adjacency definition.

    lines 64–92

    uses in1267_blk_fwd, Fin.ext, in1267_out_fwd, in1267_bwd, Bool.or_eq_true, decide_eq_true_eq, List.contains_iff_mem, Or.inl, congrArg, Fin.val, Or.inr

    theorem in1267_adj_check (u v : Fin 132) :
          (let outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]
          (u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨
          (u.val,v.val) ∈ outside ∨ (v.val,u.val) ∈ outside) ↔
          (v.val = in1267_nb u.val 0 ∨ v.val = in1267_nb u.val 1 ∨ v.val = in1267_nb u.val 2) := by
      show ((u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨
          (u.val,v.val) ∈ in1267_outside ∨ (v.val,u.val) ∈ in1267_outside) ↔ _
      constructor
      · rintro (h | h | h)
        · exact in1267_blk_fwd _ u.isLt _ v.isLt ⟨fun e => h.1 (Fin.ext e), h.2⟩
        · exact (in1267_out_fwd _ h).2.2.1
        · exact (in1267_out_fwd _ h).2.2.2
      · intro h
        have key : ∀ i, i < 3 → v.val = in1267_nb u.val i →
            ((u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨
            (u.val,v.val) ∈ in1267_outside ∨ (v.val,u.val) ∈ in1267_outside) := by
          intro i hi e
          have hb := in1267_bwd _ u.isLt i hi
          rw [← e] at hb
          simp only [Bool.or_eq_true, decide_eq_true_eq, List.contains_iff_mem] at hb
          rcases hb with (h' | h') | h'
          · exact Or.inl ⟨fun e' => h'.1 (congrArg Fin.val e'), h'.2⟩
          · exact Or.inr (Or.inl h')
          · exact Or.inr (Or.inr h')
        rcases h with e | e | e
        · exact key 0 (by norm_num) e
        · exact key 1 (by norm_num) e
        · exact key 2 (by norm_num) e
    
  8. The adjacency of $G$ is rewritten to the neighbor table representation and the three goals are stated.

    Using the adjacency equivalence, the graph's edge relation is rewritten in terms of the three neighbor functions. The theorem is then split into three separate goals: connectedness, 3-regularity, and girth at least 9.

    lines 94–104

    uses in1267_adj_check

    theorem op309_girth9_example_graph_properties
        (G : SimpleGraph (Fin 132)) [DecidableRel G.Adj]
        (hG : ∀ u v : Fin 132, G.Adj u v ↔
          let outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]
          (u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨
          (u.val,v.val) ∈ outside ∨ (v.val,u.val) ∈ outside) :
        G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth := by
      have hnb : ∀ u v : Fin 132, G.Adj u v ↔ (v.val = in1267_nb u.val 0 ∨
          v.val = in1267_nb u.val 1 ∨ v.val = in1267_nb u.val 2) :=
        fun u v => (hG u v).trans (in1267_adj_check u v)
      refine ⟨?_, ?_, ?_⟩
  9. $G$ is connected.

    The parent and depth tables encode a directed spanning tree rooted at vertex 0. Kernel evaluation verifies that every vertex $v \ne 0$ has a parent $p$ adjacent to $v$ with strictly smaller depth. By induction on depth, every vertex is reachable from 0. By symmetry and transitivity of reachability, any two vertices $u$ and $v$ are connected.

    lines 105–124

    uses Fin.ext, le_rfl

      · have hpar : ∀ v : Fin 132, v.val = 0 ∨ (in1267_par v.val < 132 ∧
            (v.val = in1267_nb (in1267_par v.val) 0 ∨ v.val = in1267_nb (in1267_par v.val) 1 ∨
              v.val = in1267_nb (in1267_par v.val) 2) ∧
            in1267_dep (in1267_par v.val) < in1267_dep v.val) := by decide +kernel
        have hr : ∀ n, ∀ v : Fin 132, in1267_dep v.val ≤ n → G.Reachable 0 v := by
          intro n
          induction n with
          | zero =>
            intro v hv
            rcases hpar v with h | ⟨_, _, hlt⟩
            · have : v = 0 := Fin.ext h
              subst this; rfl
            · omega
          | succ n ih =>
            intro v hv
            rcases hpar v with h | ⟨hp, hadj, hlt⟩
            · have : v = 0 := Fin.ext h
              subst this; rfl
            · exact (ih ⟨_, hp⟩ (by simp only; omega)).trans ((hnb ⟨_, hp⟩ v).2 hadj).reachable
        exact ⟨fun u v => (hr _ u le_rfl).symm.trans (hr _ v le_rfl)⟩
  10. $G$ is 3-regular. automation

    Rewriting the neighbor set using the transition table gives the explicit 3-element set of table neighbors. The cardinality of this set is converted to a finset cardinality and evaluated for every vertex by the kernel, verifying that every vertex has exactly 3 distinct neighbors.

    lines 125–132

    uses Set.ext, Set.ncard_eq_toFinset_card', Set.toFinset_ofPred

      · intro v
        have e : G.neighborSet v = {w | w.val = in1267_nb v.val 0 ∨ w.val = in1267_nb v.val 1 ∨
            w.val = in1267_nb v.val 2} := Set.ext fun w => hnb v w
        rw [e, Set.ncard_eq_toFinset_card']
        simp only [Set.toFinset_ofPred]
        clear e
        revert v
        decide +kernel
  11. Any hypothetical cycle of length less than 9 has distinct vertices.

    By `SimpleGraph.le_egirth`, it suffices to show every cycle has length at least 9. For contradiction, suppose there is a cycle $w$ of length less than 9. Since $w$ is a cycle, its length is at least 3, and all vertices $w.\text{getVert}(i)$ for $i < w.\text{length}$ are distinct by cycle injectivity.

    lines 133–143

    uses SimpleGraph.le_egirth, Set.mem_ofPred_eq

      · rw [SimpleGraph.le_egirth]
        intro a w hw
        have hl := hw.three_le_length
        by_contra hb
        have hlt : w.length < 9 := by
          by_contra h
          exact hb (by exact_mod_cast (not_lt.mp h))
        have hne : ∀ i j, i < w.length → j < w.length → i ≠ j → w.getVert i ≠ w.getVert j := by
          intro i j hi hj hij he
          apply hij
          apply hw.getVert_injOn' _ _ he <;> simp only [Set.mem_ofPred_eq] <;> omega
  12. The cycle forms a valid, non-backtracking walk.

    Successive vertices along the cycle are adjacent in $G$, hence are neighbors in the transition table. Because the vertices are distinct and the cycle length is at least 3, no two steps can immediately backtrack ($w.\text{getVert}(j+2) \ne w.\text{getVert}(j)$).

    lines 144–156

    uses Fin.ext

        have hadj : ∀ j, j ≤ w.length - 1 →
            ((w.getVert (j+1)).val = in1267_nb (w.getVert j).val 0 ∨
             (w.getVert (j+1)).val = in1267_nb (w.getVert j).val 1 ∨
             (w.getVert (j+1)).val = in1267_nb (w.getVert j).val 2) :=
          fun j hj => (hnb _ _).1 (w.adj_getVert_succ (by omega))
        have hNB : ∀ j, j < w.length - 1 → (w.getVert (j+2)).val ≠ (w.getVert j).val := by
          intro j hj h
          by_cases hj2 : j + 2 < w.length
          · exact hne (j+2) j hj2 (by omega) (by omega) (Fin.ext h)
          · have e2 : j + 2 = w.length := by omega
            rw [e2, w.getVert_length] at h
            have h0 : w.getVert 0 = a := w.getVert_zero
            exact hne 0 j (by omega) (by omega) (by omega) (Fin.ext (by rw [h0]; exact h))
  13. The existence of a short cycle contradicts the walk check soundness.

    Applying `in1267_chk_sound` to the non-backtracking walk of length $w.\text{length} - 1$ implies that the cycle's final vertex cannot equal its start vertex, contradicting the fact that $w$ is a closed cycle. The required check evaluates to `true` by `in1267_chk_all`, because $w.\text{length} - 3 < 6$.

    lines 157–167

    uses in1267_chk_sound, zero_add, in1267_chk_all

        have hsound := in1267_chk_sound (w.length - 1) (w.getVert 0).val (fun j => (w.getVert j).val)
          hadj hNB
        have hfin : (w.getVert (w.length - 1 + 1)).val = (w.getVert 0).val := by
          rw [show w.length - 1 + 1 = w.length by omega, w.getVert_length, w.getVert_zero]
        apply hsound _ hfin
        have hm : w.length - 1 = (w.length - 3) + 2 := by omega
        have hs := (w.getVert 0).isLt
        rcases hadj 0 (by omega) with e | e | e <;> simp only [zero_add] at e <;> rw [e, hm]
        · exact in1267_chk_all _ hs 0 (by norm_num) _ (by omega)
        · exact in1267_chk_all _ hs 1 (by norm_num) _ (by omega)
        · exact in1267_chk_all _ hs 2 (by norm_num) _ (by omega)
Bool.and_eq_true
A boolean conjunction `a && b` is `true` if and only if both `a = true` and `b = true`.
Bool.or_eq_true
A boolean disjunction `a || b` is `true` if and only if `a = true` or `b = true`.
beq_iff_eq
Boolean equality `a == b` is `true` if and only if `a = b`.
Fin.ext
Two elements of `Fin n` are equal if and only if their underlying natural values are equal.
Fin.val
The coercion mapping a bounded natural number in `Fin n` to its underlying value in `ℕ`.
congrArg
Functions preserve equality: if `a₁ = a₂`, then `f a₁ = f a₂`.
decide_eq_true_eq
The decidable evaluation `decide p = true` is equivalent to the proposition `p`.
List.contains_iff_mem
A list contains an element according to boolean membership if and only if the element belongs to the list.
Or.inl
Constructs a proof of the disjunction `A ∨ B` from a proof of `A`.
Or.inr
Constructs a proof of the disjunction `A ∨ B` from a proof of `B`.
Set.ext
Two sets are equal if and only if they contain exactly the same elements.
Set.mem_ofPred_eq
Membership in a set defined by a predicate `{x | p x}` is equivalent to `p x`.
Set.ncard_eq_toFinset_card'
The cardinality (`ncard`) of a finite set equals the cardinality of its corresponding finset.
Set.toFinset_ofPred
The finset of elements satisfying a predicate equals the filter of the universal finset by that predicate.
SimpleGraph.le_egirth
A graph has girth at least $n$ if and only if every cycle in the graph has length at least $n$.
in1267_adj_check
Two vertices in `Fin 132` are adjacent in the graph definition if and only if one is among the three neighbors of the other in the transition table.
in1267_blk_fwd
Any two distinct vertices in the same block of 3 that include the block's base vertex are neighbors in the transition table.
in1267_bwd
Every neighbor in the transition table is either an edge within a 3-vertex block or an edge in the outside edge list.
in1267_chk
A recursive boolean function checking whether every non-backtracking walk of length $n$ starting with edge $(p, c)$ avoids reaching vertex $s$.
in1267_chk_all
The recursive non-backtracking cycle check evaluates to `true` for all vertices, all neighbor choices, and all path lengths from 3 to 8.
in1267_chk_sound
If a non-backtracking walk of length $n+1$ satisfies the check function at its first step, its final vertex cannot be the start vertex $s$.
in1267_out_fwd
Each pair of vertices listed as an outside edge has indices less than 132 and are mutual neighbors in the transition table.
le_rfl
Every element in a preorder is less than or equal to itself ($a \le a$).
zero_add
Adding zero on the left is the identity: $0 + a = a$.

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

set_option maxRecDepth 100000set_option maxHeartbeats 0def in1267_T : ℕ := 232461799712729640564247525039372089448511452463720353006968436875474950818961627868403140802696897099897398420613762977527502534856378705635771086210928057381375841654016340620650142858585019362779163706488108306280834985734352043403375023108962086313558544593032843925611577009146968340910210575595172658636834571228392593063831280715551915275454322682961780041914811759575052651987446941201523134618712971479739562479010431688751898350027229999713299021152081737288024534727571001265920400799119000369425099569042120691168648908019186079253105558857887165369446132808382963222528901770633253439847772721596431084662850100310488971709051692851206456240939509705494106053742120022411842848053147562211379511077598587200705683642685725139401081453137825238945465401857862163994574446221073293364351200818569778423340837186078123287739977647565643279987929177583382809435777317431051903267519277583232967985093219352922878410800000680071423059294010081793def in1267_P : ℕ := 205484735341419258661402951814228508455808514581874589481962138112812867451737961792799298863099385594545686250546821035826759915199047085163286739365484441522586705327108160882762782497571044519248943180998844938414109182130850648764080965042571602784464255479888393481904413139016539881754363546795241682708679622656def in1267_D : ℕ := 15115672263052547865081502645603529893192787986583476082914058514797149339291638340091195438615242946932914277294480027249074893048849241984942905486277809018632647161974766940137519032983007710425024066089811426537403063553911618100838901553671733970016009435643551091374586590538211103725241332946898292441717211392def in1267_nb (u i : ℕ) : ℕ := (in1267_T >>> (8 * (3 * u + i))) % 256def in1267_par (v : ℕ) : ℕ := (in1267_P >>> (8 * v)) % 256def in1267_dep (v : ℕ) : ℕ := (in1267_D >>> (8 * v)) % 256def in1267_chk : ℕ → ℕ → ℕ → ℕ → Bool  | 0, s, _, c => c != s  | n+1, s, p, c =>      (in1267_nb c 0 == p || in1267_chk n s c (in1267_nb c 0)) &&      (in1267_nb c 1 == p || in1267_chk n s c (in1267_nb c 1)) &&      (in1267_nb c 2 == p || in1267_chk n s c (in1267_nb c 2))theorem in1267_chk_sound (n : ℕ) : ∀ (s : ℕ) (y : ℕ → ℕ),    (∀ j, j ≤ n → (y (j+1) = in1267_nb (y j) 0 ∨ y (j+1) = in1267_nb (y j) 1 ∨      y (j+1) = in1267_nb (y j) 2)) →    (∀ j, j < n → y (j+2) ≠ y j) →    in1267_chk n s (y 0) (y 1) = true → y (n+1) ≠ s := by  induction n with  | zero =>    intro s y _ _ h    simpa [in1267_chk] using h  | succ n ih =>    intro s y hadj hnb h    have key : in1267_chk n s (y 1) (y 2) = true := by      have h2 := hadj 1 (by omega)      have hne := hnb 0 (by omega)      simp only [in1267_chk, Bool.and_eq_true, Bool.or_eq_true, beq_iff_eq] at h      obtain ⟨⟨h0, h1⟩, h2'⟩ := h      rcases h2 with e | e | e <;> rw [e] at hne ⊢      · exact h0.resolve_left hne      · exact h1.resolve_left hne      · exact h2'.resolve_left hne    have := ih s (fun j => y (j+1)) (fun j hj => hadj (j+1) (by omega))      (fun j hj => hnb (j+1) (by omega)) key    simpa using thistheorem in1267_chk_all : ∀ s, s < 132 → ∀ i, i < 3 → ∀ m, m < 6 →    in1267_chk (m+2) s s (in1267_nb s i) = true := by  decide +kerneldef in1267_outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]theorem in1267_out_fwd : ∀ p ∈ in1267_outside, p.1 < 132 ∧ p.2 < 132 ∧    (p.2 = in1267_nb p.1 0 ∨ p.2 = in1267_nb p.1 1 ∨ p.2 = in1267_nb p.1 2) ∧    (p.1 = in1267_nb p.2 0 ∨ p.1 = in1267_nb p.2 1 ∨ p.1 = in1267_nb p.2 2) := by  decide +kerneltheorem in1267_blk_fwd : ∀ u, u < 132 → ∀ v, v < 132 →    (u ≠ v ∧ u / 3 = v / 3 ∧ (u % 3 = 0 ∨ v % 3 = 0)) →    (v = in1267_nb u 0 ∨ v = in1267_nb u 1 ∨ v = in1267_nb u 2) := by  decide +kerneltheorem in1267_bwd : ∀ u, u < 132 → ∀ i, i < 3 →    (decide (u ≠ in1267_nb u i ∧ u / 3 = in1267_nb u i / 3 ∧ (u % 3 = 0 ∨ in1267_nb u i % 3 = 0)) ||    in1267_outside.contains (u, in1267_nb u i) || in1267_outside.contains (in1267_nb u i, u)) = true := by  decide +kerneltheorem in1267_adj_check (u v : Fin 132) :      (let outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]      (u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨      (u.val,v.val) ∈ outside ∨ (v.val,u.val) ∈ outside) ↔      (v.val = in1267_nb u.val 0 ∨ v.val = in1267_nb u.val 1 ∨ v.val = in1267_nb u.val 2) := by  show ((u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨      (u.val,v.val) ∈ in1267_outside ∨ (v.val,u.val) ∈ in1267_outside) ↔ _  constructor  · rintro (h | h | h)    · exact in1267_blk_fwd _ u.isLt _ v.isLt ⟨fun e => h.1 (Fin.ext e), h.2⟩    · exact (in1267_out_fwd _ h).2.2.1    · exact (in1267_out_fwd _ h).2.2.2  · intro h    have key : ∀ i, i < 3 → v.val = in1267_nb u.val i →        ((u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨        (u.val,v.val) ∈ in1267_outside ∨ (v.val,u.val) ∈ in1267_outside) := by      intro i hi e      have hb := in1267_bwd _ u.isLt i hi      rw [← e] at hb      simp only [Bool.or_eq_true, decide_eq_true_eq, List.contains_iff_mem] at hb      rcases hb with (h' | h') | h'      · exact Or.inl ⟨fun e' => h'.1 (congrArg Fin.val e'), h'.2⟩      · exact Or.inr (Or.inl h')      · exact Or.inr (Or.inr h')    rcases h with e | e | e    · exact key 0 (by norm_num) e    · exact key 1 (by norm_num) e    · exact key 2 (by norm_num) e/-- The explicit 132-vertex simple graph G is connected, 3-regular, and has girth at least 9. -/theorem op309_girth9_example_graph_properties    (G : SimpleGraph (Fin 132)) [DecidableRel G.Adj]    (hG : ∀ u v : Fin 132, G.Adj u v ↔      let outside : List (ℕ × ℕ) := [(0,34), (1,6), (1,67), (2,10), (2,91), (3,31), (4,29), (4,88), (5,23), (5,71), (7,21), (7,65), (8,30), (8,125), (9,31), (10,116), (11,13), (11,113), (12,37), (13,79), (14,16), (14,85), (15,35), (16,106), (17,18), (17,115), (19,28), (19,124), (20,22), (20,38), (22,46), (23,110), (24,32), (25,94), (25,97), (26,89), (26,104), (27,34), (28,112), (29,62), (32,35), (33,130), (36,39), (37,53), (38,88), (40,61), (40,71), (41,44), (41,116), (42,45), (43,62), (43,103), (44,73), (46,80), (47,95), (47,118), (48,51), (49,77), (49,115), (50,92), (50,98), (52,124), (52,128), (53,104), (54,57), (55,103), (55,119), (56,64), (56,113), (58,89), (58,127), (59,67), (59,76), (60,63), (61,128), (64,100), (65,85), (66,69), (68,109), (68,131), (70,80), (70,122), (72,75), (73,121), (74,119), (74,131), (76,94), (77,79), (78,81), (82,97), (82,110), (83,91), (83,127), (84,87), (86,92), (86,122), (90,93), (95,109), (96,99), (98,107), (100,130), (101,118), (101,125), (102,105), (106,121), (107,112), (108,111), (114,117), (120,123), (126,129)]      (u ≠ v ∧ u.val / 3 = v.val / 3 ∧ (u.val % 3 = 0 ∨ v.val % 3 = 0)) ∨      (u.val,v.val) ∈ outside ∨ (v.val,u.val) ∈ outside) :    G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth := by  have hnb : ∀ u v : Fin 132, G.Adj u v ↔ (v.val = in1267_nb u.val 0 ∨      v.val = in1267_nb u.val 1 ∨ v.val = in1267_nb u.val 2) :=    fun u v => (hG u v).trans (in1267_adj_check u v)  refine ⟨?_, ?_, ?_⟩  · have hpar : ∀ v : Fin 132, v.val = 0 ∨ (in1267_par v.val < 132 ∧        (v.val = in1267_nb (in1267_par v.val) 0 ∨ v.val = in1267_nb (in1267_par v.val) 1 ∨          v.val = in1267_nb (in1267_par v.val) 2) ∧        in1267_dep (in1267_par v.val) < in1267_dep v.val) := by decide +kernel    have hr : ∀ n, ∀ v : Fin 132, in1267_dep v.val ≤ n → G.Reachable 0 v := by      intro n      induction n with      | zero =>        intro v hv        rcases hpar v with h | ⟨_, _, hlt⟩        · have : v = 0 := Fin.ext h          subst this; rfl        · omega      | succ n ih =>        intro v hv        rcases hpar v with h | ⟨hp, hadj, hlt⟩        · have : v = 0 := Fin.ext h          subst this; rfl        · exact (ih ⟨_, hp⟩ (by simp only; omega)).trans ((hnb ⟨_, hp⟩ v).2 hadj).reachable    exact ⟨fun u v => (hr _ u le_rfl).symm.trans (hr _ v le_rfl)⟩  · intro v    have e : G.neighborSet v = {w | w.val = in1267_nb v.val 0 ∨ w.val = in1267_nb v.val 1 ∨        w.val = in1267_nb v.val 2} := Set.ext fun w => hnb v w    rw [e, Set.ncard_eq_toFinset_card']    simp only [Set.toFinset_ofPred]    clear e    revert v    decide +kernel  · rw [SimpleGraph.le_egirth]    intro a w hw    have hl := hw.three_le_length    by_contra hb    have hlt : w.length < 9 := by      by_contra h      exact hb (by exact_mod_cast (not_lt.mp h))    have hne : ∀ i j, i < w.length → j < w.length → i ≠ j → w.getVert i ≠ w.getVert j := by      intro i j hi hj hij he      apply hij      apply hw.getVert_injOn' _ _ he <;> simp only [Set.mem_ofPred_eq] <;> omega    have hadj : ∀ j, j ≤ w.length - 1 →        ((w.getVert (j+1)).val = in1267_nb (w.getVert j).val 0 ∨         (w.getVert (j+1)).val = in1267_nb (w.getVert j).val 1 ∨         (w.getVert (j+1)).val = in1267_nb (w.getVert j).val 2) :=      fun j hj => (hnb _ _).1 (w.adj_getVert_succ (by omega))    have hNB : ∀ j, j < w.length - 1 → (w.getVert (j+2)).val ≠ (w.getVert j).val := by      intro j hj h      by_cases hj2 : j + 2 < w.length      · exact hne (j+2) j hj2 (by omega) (by omega) (Fin.ext h)      · have e2 : j + 2 = w.length := by omega        rw [e2, w.getVert_length] at h        have h0 : w.getVert 0 = a := w.getVert_zero        exact hne 0 j (by omega) (by omega) (by omega) (Fin.ext (by rw [h0]; exact h))    have hsound := in1267_chk_sound (w.length - 1) (w.getVert 0).val (fun j => (w.getVert j).val)      hadj hNB    have hfin : (w.getVert (w.length - 1 + 1)).val = (w.getVert 0).val := by      rw [show w.length - 1 + 1 = w.length by omega, w.getVert_length, w.getVert_zero]    apply hsound _ hfin    have hm : w.length - 1 = (w.length - 3) + 2 := by omega    have hs := (w.getVert 0).isLt    rcases hadj 0 (by omega) with e | e | e <;> simp only [zero_add] at e <;> rw [e, hm]    · exact in1267_chk_all _ hs 0 (by norm_num) _ (by omega)    · exact in1267_chk_all _ hs 1 (by norm_num) _ (by omega)    · exact in1267_chk_all _ hs 2 (by norm_num) _ (by omega)
See it in the graphDiscuss this resultChallenge it