AFTD Auto-Formalizing Theoretical Domains

op309_girth9_block_ring_graph_properties

theoremverified

For every k at least two, the graph on 132k vertices formed by k copies of the explicit 132-vertex cubic girth-nine graph, with each copy's edge 36-39 deleted and vertex 36 of copy j joined to vertex 39 of copy j+1 (mod k), is connected, 3-regular and has girth at least 9.

Statement

theorem op309_girth9_block_ring_graph_properties (k : ℕ) (hk : 2 ≤ k)
    (G : SimpleGraph (Fin (132 * k))) [DecidableRel G.Adj]
    (hG : ∀ u v : Fin (132 * k), 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)]
      let base : ℕ → ℕ → Prop := fun a b =>
        (a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ outside ∨ (b, a) ∈ outside
      (u.val / 132 = v.val / 132 ∧ base (u.val % 132) (v.val % 132) ∧
        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :
    G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth
Source
OP-309 girth-nine block-ring construction (experiment 42423): helper for op309_girth9_acyclic_source_unbounded_switch_cost.
Verified
28 Nov 2026
Axioms
Classical.choiceQuot.soundpropext
Built on 2
Used by 4

The proof, explained

The theorem proves that arranging k ≥ 2 copies of an explicit 132-vertex cubic girth-9 graph into a ring—deleting the edge {36, 39} within each copy and adding ring edges from vertex 36 of block j to vertex 39 of block j+1 (mod k)—yields a connected, 3-regular graph with girth at least 9. Connectedness holds because an explicit spanning tree certified by parent-pointer arithmetic preserves connectivity within each block, while the ring edges connect all blocks in a single cycle. Every vertex has degree 3 because vertices 36 and 39 exchange their deleted internal edge for a ring edge to an adjacent block, while all other vertices keep their original three neighbors. Finally, any cycle in the ring graph projects locally injectively to a closed non-backtracking walk of the same length in the original 132-vertex graph; an exhaustive computational check confirms that the base graph has no such closed walk of length less than 9, establishing that the girth is at least 9.

  1. In the 132-vertex base graph, every vertex has three distinct neighbors, and vertices 36 and 39 are adjacent. automation

    The lemmas in1267_nb_facts and in1267_nb_36 verify the local structure of the base graph. For every vertex a < 132, its three tabulated neighbors in1267_nb a 0, in1267_nb a 1, and in1267_nb a 2 are bounded by 132 and mutually distinct. In particular, the 2nd neighbor of 36 is 39, and the 0th neighbor of 39 is 36. Both properties are proved by kernel evaluation of the finite graph data.

    lines 7–13

    theorem in1267_nb_facts : ∀ a, a < 132 → in1267_nb a 0 < 132 ∧ in1267_nb a 1 < 132 ∧
        in1267_nb a 2 < 132 ∧ in1267_nb a 0 ≠ in1267_nb a 1 ∧ in1267_nb a 0 ≠ in1267_nb a 2 ∧
        in1267_nb a 1 ≠ in1267_nb a 2 := by
      decide +kernel
    
    theorem in1267_nb_36 : in1267_nb 36 2 = 39 ∧ in1267_nb 39 0 = 36 := by decide +kernel
    
  2. Every vertex other than 0 in the base graph connects towards 0 via a spanning tree that avoids the edge between 36 and 39. automation

    The lemma in1267_par2_facts verifies that for every vertex v < 132, either v = 0 or v has a parent in the base graph of strictly smaller depth such that the edge joining them is not {36, 39}. This confirms that deleting the edge {36, 39} does not disconnect the 132-vertex graph, verified by kernel computation.

    lines 14–20

    theorem in1267_par2_facts : ∀ v, v < 132 → v = 0 ∨ (in1267_par2 v < 132 ∧
        (v = in1267_nb (in1267_par2 v) 0 ∨ v = in1267_nb (in1267_par2 v) 1 ∨
          v = in1267_nb (in1267_par2 v) 2) ∧
        ¬ (in1267_par2 v = 36 ∧ v = 39) ∧ ¬ (in1267_par2 v = 39 ∧ v = 36) ∧
        in1267_dep2 (in1267_par2 v) < in1267_dep2 v) := by
      decide +kernel
    
  3. Base graph adjacency defined by block cliques and the outside edge list is equivalent to the neighbor lookup function.

    The lemma in1267_base_iff establishes that two vertices a, b < 132 are adjacent in the base graph—meaning they either share a 3-element clique block with a multiple of 3 or appear in the list in1267_outside—if and only if b is one of the three tabulated neighbors in1267_nb a i for i ∈ {0, 1, 2}. The forward implication uses in1267_blk_fwd and in1267_out_fwd, while the reverse implication uses in1267_bwd across the three neighbor indices.

    lines 21–46

    uses in1267_blk_fwd, in1267_out_fwd, in1267_bwd, Bool.or_eq_true, decide_eq_true_eq, List.contains_iff_mem, Or.inl, Or.inr

    theorem in1267_base_iff (a b : ℕ) (ha : a < 132) (hb : b < 132) :
        ((a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ in1267_outside ∨
          (b, a) ∈ in1267_outside) ↔
        (b = in1267_nb a 0 ∨ b = in1267_nb a 1 ∨ b = in1267_nb a 2) := by
      constructor
      · rintro (h | h | h)
        · exact in1267_blk_fwd _ ha _ hb h
        · exact (in1267_out_fwd _ h).2.2.1
        · exact (in1267_out_fwd _ h).2.2.2
      · intro h
        have key : ∀ i, i < 3 → b = in1267_nb a i →
            ((a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ in1267_outside ∨
              (b, a) ∈ in1267_outside) := by
          intro i hi e
          have hb' := in1267_bwd _ ha 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 h'
          · 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
    
  4. Block indices stay within bounds and modular shifting by 1 is injective on block indices.

    The lemma in1267_lt proves that 132j + b < 132k whenever j < k and b < 132. The lemma in1267_modinj shows that if x, y < k satisfy (x + 1) % k = (y + 1) % k, then x = y; this is proved by splitting into cases with Nat.lt_or_ge, simplifying modulo operations with Nat.mod_eq_of_lt and Nat.mod_self, and linear arithmetic.

    lines 47–58

    uses Nat.lt_or_ge, Nat.mod_eq_of_lt, Nat.mod_self

    def in1267_mk (k j b : ℕ) (h : 132 * j + b < 132 * k) : Fin (132 * k) := ⟨132 * j + b, h⟩
    
    theorem in1267_lt {k j b : ℕ} (hj : j < k) (hb : b < 132) : 132 * j + b < 132 * k := by omega
    
    theorem in1267_modinj {k x y : ℕ} (hx : x < k) (hy : y < k) (h : (x + 1) % k = (y + 1) % k) :
        x = y := by
      rcases Nat.lt_or_ge (x + 1) k with h1 | h1 <;> rcases Nat.lt_or_ge (y + 1) k with h2 | h2
      · rw [Nat.mod_eq_of_lt h1, Nat.mod_eq_of_lt h2] at h; omega
      · rw [Nat.mod_eq_of_lt h1, show y + 1 = k by omega, Nat.mod_self] at h; omega
      · rw [Nat.mod_eq_of_lt h2, show x + 1 = k by omega, Nat.mod_self] at h; omega
      · omega
    
  5. The adjacency relation of the ring graph G is rewritten in terms of the neighbor lookup function.

    The theorem in1267_ring_hA transforms the assumed adjacency relation hG by replacing the internal base graph condition with the neighbor function in1267_nb, applying the list definition in1267_outside_def and the equivalence in1267_base_iff on vertex coordinates modulo 132.

    lines 61–80

    uses in1267_outside_def, in1267_base_iff, Nat.mod_lt

    theorem in1267_ring_hA (k : ℕ) (G : SimpleGraph (Fin (132 * k)))
        (hG : ∀ u v : Fin (132 * k), 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)]
          let base : ℕ → ℕ → Prop := fun a b =>
            (a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ outside ∨ (b, a) ∈ outside
          (u.val / 132 = v.val / 132 ∧ base (u.val % 132) (v.val % 132) ∧
            ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
          (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
          (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :
        ∀ u v : Fin (132 * k), G.Adj u v ↔
          (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨
              v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧
            ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
          (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
          (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k) := by
      intro u v
      rw [hG u v]
      dsimp only
      rw [← in1267_outside_def, in1267_base_iff _ _ (Nat.mod_lt _ (by norm_num)) (Nat.mod_lt _ (by norm_num))]
    
  6. Every edge in the ring graph G projects modulo 132 to an edge in the 132-vertex base graph.

    The lemma in1267_ring_hom shows that whenever u and v are adjacent in G, v % 132 is one of the three base neighbors of u % 132. For intra-block edges, this follows immediately from the definition of intra-block adjacency. For inter-block ring edges connecting 36 and 39 across adjacent blocks, in1267_nb_36.1 and in1267_nb_36.2 verify that 36 and 39 are mutual neighbors in the base graph.

    lines 81–95

    uses in1267_nb_36.1, in1267_nb_36.2

    theorem in1267_ring_hom (k : ℕ) (G : SimpleGraph (Fin (132 * k)))
        (hA : ∀ u v : Fin (132 * k), G.Adj u v ↔
          (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨
              v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧
            ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
          (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
          (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :
        ∀ u v : Fin (132 * k), G.Adj u v → (v.val % 132 = in1267_nb (u.val % 132) 0 ∨
          v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) := by
      intro u v h
      rcases (hA u v).1 h with ⟨-, h1, -⟩ | ⟨a1, b1, -⟩ | ⟨a1, b1, -⟩
      · exact h1
      · rw [a1, b1, in1267_nb_36.1]; simp
      · rw [a1, b1, in1267_nb_36.2]; simp
    
  7. Neighbors in the ring graph G are uniquely determined by their local coordinates modulo 132.

    The lemma in1267_ring_inj shows that if v is adjacent to both w1 and w2 in G and w1 % 132 = w2 % 132, then w1 = w2. By case analysis on the edge types in the adjacency characterization, mismatched cases are ruled out because 36 ≠ 39, while matching cases imply w1 / 132 = w2 / 132 (using in1267_modinj for ring edges). Having both identical quotients and remainders modulo 132 yields w1 = w2 by Fin.ext.

    lines 96–115

    uses in1267_modinj, Fin.ext

    theorem in1267_ring_inj (k : ℕ) (G : SimpleGraph (Fin (132 * k)))
        (hA : ∀ u v : Fin (132 * k), G.Adj u v ↔
          (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨
              v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧
            ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
          (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
          (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :
        ∀ v w1 w2 : Fin (132 * k), G.Adj v w1 → G.Adj v w2 →
          w1.val % 132 = w2.val % 132 → w1 = w2 := by
      have hbl : ∀ v : Fin (132 * k), v.val / 132 < k := fun v => by have := v.isLt; omega
      intro v w1 w2 h1 h2 e
      have hb : w1.val / 132 = w2.val / 132 := by
        rcases (hA v w1).1 h1 with ⟨a1, -, b1, c1⟩ | ⟨a1, b1, c1⟩ | ⟨a1, b1, c1⟩ <;>
        rcases (hA v w2).1 h2 with ⟨a2, -, b2, c2⟩ | ⟨a2, b2, c2⟩ | ⟨a2, b2, c2⟩ <;>
        first
          | omega
          | exact c1.trans c2.symm
          | exact in1267_modinj (hbl w1) (hbl w2) (c1.symm.trans c2)
      exact Fin.ext (by omega)
    
  8. Local coordinate projections and neighbor characterization are established for the main theorem.

    The proof of op309_girth9_block_ring_graph_properties sets up local coordinate helpers: hA applies in1267_ring_hA, hloc bounds local coordinates via Nat.mod_lt, hbl bounds block indices, and hAmk gives an explicit formula for adjacency in terms of block and local coordinates. The projection homomorphism in1267_ring_hom and local injectivity in1267_ring_inj are instantiated, and refine splits the goal into connectivity, 3-regularity, and girth at least 9.

    lines 116–144

    uses in1267_ring_hA, Nat.mod_lt, in1267_ring_hom, in1267_ring_inj

    theorem op309_girth9_block_ring_graph_properties (k : ℕ) (hk : 2 ≤ k)
        (G : SimpleGraph (Fin (132 * k))) [DecidableRel G.Adj]
        (hG : ∀ u v : Fin (132 * k), 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)]
          let base : ℕ → ℕ → Prop := fun a b =>
            (a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ outside ∨ (b, a) ∈ outside
          (u.val / 132 = v.val / 132 ∧ base (u.val % 132) (v.val % 132) ∧
            ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨
          (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨
          (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :
        G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth := by
      have hA := in1267_ring_hA k G hG
      have hloc : ∀ v : Fin (132 * k), v.val % 132 < 132 := fun v => Nat.mod_lt _ (by norm_num)
      have hbl : ∀ v : Fin (132 * k), v.val / 132 < k := fun v => by have := v.isLt; omega
      have hAmk : ∀ (u v : Fin (132 * k)) (i a j b : ℕ), u.val = 132 * i + a → v.val = 132 * j + b →
          a < 132 → b < 132 → (G.Adj u v ↔
          (i = j ∧ (b = in1267_nb a 0 ∨ b = in1267_nb a 1 ∨ b = in1267_nb a 2) ∧
            ¬ (a = 36 ∧ b = 39) ∧ ¬ (a = 39 ∧ b = 36)) ∨
          (a = 36 ∧ b = 39 ∧ j = (i + 1) % k) ∨ (a = 39 ∧ b = 36 ∧ i = (j + 1) % k)) := by
        intro u v i a j b hu hv ha hb
        rw [hA u v, hu, hv]
        have e1 : (132 * i + a) % 132 = a := by omega
        have e2 : (132 * i + a) / 132 = i := by omega
        have e3 : (132 * j + b) % 132 = b := by omega
        have e4 : (132 * j + b) / 132 = j := by omega
        rw [e1, e2, e3, e4]
      have hhom := in1267_ring_hom k G hA
      have hinj := in1267_ring_inj k G hA
      refine ⟨?_, ?_, ?_⟩
  9. The ring graph G is connected.

    First, hin proves by induction on tree depth that vertex (j, 0) can reach any vertex (j, b) in block j using the spanning tree edges verified by in1267_par2_facts. Second, hblk proves by induction on j that (0, 0) can reach (j, 0) for all j < k by traversing from (j, 36) to (j+1, 39) across the inter-block ring edges. Thus, hall shows every vertex is reachable from (0, 0), which makes G connected.

    lines 145–182

    uses in1267_par2_facts, SimpleGraph.Adj.reachable, le_rfl, Nat.mod_eq_of_lt, Fin.ext, in1267_lt

      · -- connected
        have hk0 : 0 < k := by omega
        have hin : ∀ j (hj : j < k) n b (hb : b < 132), in1267_dep2 b ≤ n →
            G.Reachable (in1267_mk k j 0 (in1267_lt hj (by norm_num))) (in1267_mk k j b (in1267_lt hj hb)) := by
          intro j hj n
          induction n with
          | zero =>
            intro b hb hd
            rcases in1267_par2_facts b hb with h | ⟨_, _, _, _, hlt⟩
            · subst h; rfl
            · omega
          | succ n ih =>
            intro b hb hd
            rcases in1267_par2_facts b hb with h | ⟨hp, hadj, hx1, hx2, hlt⟩
            · subst h; rfl
            · refine (ih _ hp (by omega)).trans (SimpleGraph.Adj.reachable ?_)
              rw [hAmk _ _ j _ j b rfl rfl hp hb]
              exact Or.inl ⟨rfl, hadj, hx1, hx2⟩
        have hblk : ∀ j (hj : j < k), G.Reachable (in1267_mk k 0 0 (in1267_lt hk0 (by norm_num)))
            (in1267_mk k j 0 (in1267_lt hj (by norm_num))) := by
          intro j
          induction j with
          | zero => intro _; rfl
          | succ j ih =>
            intro hj
            have hj' : j < k := by omega
            refine ((ih hj').trans (hin j hj' _ 36 (by norm_num) le_rfl)).trans ?_
            refine (SimpleGraph.Adj.reachable ?_).trans (hin (j+1) hj _ 39 (by norm_num) le_rfl).symm
            rw [hAmk _ _ j 36 (j+1) 39 rfl rfl (by norm_num) (by norm_num)]
            exact Or.inr (Or.inl ⟨rfl, rfl, (Nat.mod_eq_of_lt hj).symm⟩)
        have hall : ∀ v : Fin (132 * k), G.Reachable (in1267_mk k 0 0 (in1267_lt hk0 (by norm_num))) v := by
          intro v
          have ev : v = in1267_mk k (v.val / 132) (v.val % 132) (in1267_lt (hbl v) (hloc v)) :=
            Fin.ext (by simp only [in1267_mk]; omega)
          rw [ev]
          exact (hblk _ (hbl v)).trans (hin _ (hbl v) _ _ (hloc v) le_rfl)
        haveI : Nonempty (Fin (132 * k)) := ⟨in1267_mk k 0 0 (in1267_lt hk0 (by norm_num))⟩
        exact ⟨fun u v => (hall u).symm.trans (hall v)⟩
  10. Every vertex in the ring graph G has degree 3.

    Local injectivity on neighbors implies that the cardinality of the neighbor set N(v) equals the cardinality of its projection modulo 132 via Set.ncard_image_of_injOn. By in1267_nb_facts, the local base vertex has 3 distinct neighbors. The lemma hsurj shows each base neighbor is realized by an actual neighbor in G: if the target is 36 or 39, an inter-block ring edge to the adjacent block is used; otherwise, the internal edge within block v / 132 is used. The image is thus exactly the 3-element set of base neighbors, proving 3-regularity.

    lines 183–224

    uses Set.ncard_image_of_injOn, in1267_nb_facts, Nat.mod_lt, in1267_lt, Nat.mod_self, Nat.mod_eq_of_lt

      · intro v
        have hinjOn : Set.InjOn (fun w : Fin (132 * k) => w.val % 132) (G.neighborSet v) :=
          fun w1 h1 w2 h2 e => hinj v w1 w2 h1 h2 e
        rw [← Set.ncard_image_of_injOn hinjOn]
        obtain ⟨n0, n1, n2, h01, h02, h12⟩ := in1267_nb_facts _ (hloc v)
        have hsurj : ∀ x, (x = in1267_nb (v.val % 132) 0 ∨ x = in1267_nb (v.val % 132) 1 ∨
            x = in1267_nb (v.val % 132) 2) → ∃ w, G.Adj v w ∧ w.val % 132 = x := by
          intro x hx
          have hx132 : x < 132 := by rcases hx with e | e | e <;> rw [e] <;> assumption
          have hvv : v.val = 132 * (v.val / 132) + v.val % 132 := by omega
          by_cases s1 : v.val % 132 = 36 ∧ x = 39
          · have hm : (v.val / 132 + 1) % k < k := Nat.mod_lt _ (by omega)
            refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩
            rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]
            exact Or.inr (Or.inl ⟨s1.1, s1.2, rfl⟩)
          by_cases s2 : v.val % 132 = 39 ∧ x = 36
          · by_cases hj0 : v.val / 132 = 0
            · have hm : k - 1 < k := by omega
              refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩
              rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]
              refine Or.inr (Or.inr ⟨s2.1, s2.2, ?_⟩)
              rw [show k - 1 + 1 = k by omega, Nat.mod_self, hj0]
            · have hm : v.val / 132 - 1 < k := by have := hbl v; omega
              refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩
              rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]
              refine Or.inr (Or.inr ⟨s2.1, s2.2, ?_⟩)
              rw [show v.val / 132 - 1 + 1 = v.val / 132 by omega, Nat.mod_eq_of_lt (hbl v)]
          · refine ⟨in1267_mk k (v.val / 132) x (in1267_lt (hbl v) hx132), ?_, by simp only [in1267_mk]; omega⟩
            rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]
            exact Or.inl ⟨rfl, hx, s1, s2⟩
        have himg : (fun w : Fin (132 * k) => w.val % 132) '' G.neighborSet v =
            {in1267_nb (v.val % 132) 0, in1267_nb (v.val % 132) 1, in1267_nb (v.val % 132) 2} := by
          ext x
          simp only [Set.mem_image, SimpleGraph.mem_neighborSet, Set.mem_insert_iff,
            Set.mem_singleton_iff]
          constructor
          · rintro ⟨w, hw, rfl⟩
            exact hhom v w hw
          · intro hx
            exact hsurj x hx
        rw [himg]
        exact Set.ncard_eq_three.mpr ⟨_, _, _, h01, h02, h12, rfl⟩
  11. Any cycle of length less than 9 in G projects to a non-backtracking walk of the same length in the base graph.

    Using SimpleGraph.le_egirth, suppose for contradiction that w is a cycle of length L < 9. Since w is a cycle, its vertices are pairwise distinct. Under the projection j ↦ w(j) % 132, consecutive vertices are adjacent in the base graph by the homomorphism property. Furthermore, the projected walk is non-backtracking: if w(j+2) % 132 = w(j) % 132, then local injectivity on the neighbors of w(j+1) would force w(j+2) = w(j), contradicting the distinctness of cycle vertices.

    lines 225–252

    uses SimpleGraph.le_egirth

      · 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 % 132 = in1267_nb ((w.getVert j).val % 132) 0 ∨
             (w.getVert (j+1)).val % 132 = in1267_nb ((w.getVert j).val % 132) 1 ∨
             (w.getVert (j+1)).val % 132 = in1267_nb ((w.getVert j).val % 132) 2) :=
          fun j hj => hhom _ _ (w.adj_getVert_succ (by omega))
        have hNB : ∀ j, j < w.length - 1 →
            (w.getVert (j+2)).val % 132 ≠ (w.getVert j).val % 132 := by
          intro j hj h
          have h1 : G.Adj (w.getVert (j+1)) (w.getVert (j+1+1)) := w.adj_getVert_succ (by omega)
          have h2 : G.Adj (w.getVert (j+1)) (w.getVert j) := (w.adj_getVert_succ (by omega)).symm
          have heq := hinj _ _ _ h1 h2 h
          by_cases hj2 : j + 2 < w.length
          · exact hne (j+2) j hj2 (by omega) (by omega) heq
          · have e2 : j + 1 + 1 = w.length := by omega
            rw [e2, w.getVert_length] at heq
            have h0 : w.getVert 0 = a := w.getVert_zero
            exact hne 0 j (by omega) (by omega) (by omega) (by rw [h0]; exact heq)
  12. The girth of the ring graph G is at least 9.

    The sound computational certificate in1267_chk_sound ensures that no non-backtracking walk in the base graph can close on itself if in1267_chk evaluates to true. The lemma in1267_chk_all establishes that this check succeeds for all start vertices, all neighbor directions, and all walk lengths from 3 to 8. But the cycle w closes on itself (having w(L) = w(0)), yielding a contradiction. Therefore, no cycle of length less than 9 exists, and the girth is at least 9.

    lines 253–263

    uses in1267_chk_sound, zero_add, in1267_chk_all

        have hsound := in1267_chk_sound (w.length - 1) ((w.getVert 0).val % 132)
          (fun j => (w.getVert j).val % 132) hadj hNB
        have hfin : (w.getVert (w.length - 1 + 1)).val % 132 = (w.getVert 0).val % 132 := 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 := hloc (w.getVert 0)
        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)
in1267_blk_fwd
If two distinct vertices u, v < 132 share a 3-element clique block and at least one is a multiple of 3, then v is one of the three tabulated neighbors of u.
in1267_out_fwd
If an edge pair belongs to the outside edge list, both vertices are strictly bounded by 132 and each is a tabulated neighbor of the other.
in1267_bwd
For every vertex u < 132 and neighbor index i < 3, the edge between u and its i-th neighbor lies in the block relation or the outside edge list.
Bool.or_eq_true
A Boolean disjunction evaluates to true if and only if at least one of its disjuncts is true.
decide_eq_true_eq
Evaluating a decidable proposition produces true if and only if the proposition holds.
List.contains_iff_mem
A list contains an item under Boolean equality if and only if the item is a member of the list.
Or.inl
From a proof of P, deduces the disjunction P ∨ Q.
Or.inr
From a proof of Q, deduces the disjunction P ∨ Q.
Nat.lt_or_ge
For any natural numbers n and m, either n < m or n ≥ m.
Nat.mod_eq_of_lt
If a natural number a is strictly less than b, then a % b = a.
Nat.mod_self
For any natural number n, n % n = 0.
in1267_outside_def
Defines the explicit list of outside edges in the 132-vertex base graph.
in1267_base_iff
Two vertices a, b < 132 are adjacent in the base graph if and only if b is one of the three tabulated neighbors of a.
Nat.mod_lt
For any positive natural number y, x % y < y.
in1267_nb_36.1
The second tabulated neighbor of vertex 36 is vertex 39.
in1267_nb_36.2
The zeroth tabulated neighbor of vertex 39 is vertex 36.
in1267_modinj
For x, y < k, if (x + 1) % k = (y + 1) % k, then x = y.
Fin.ext
Two elements of Fin n are equal if and only if their underlying natural values are equal.
in1267_ring_hA
Rewrites ring graph adjacency so that intra-block edges are given directly by the neighbor lookup function.
in1267_ring_hom
Any edge in the ring graph projects modulo 132 to an edge in the 132-vertex base graph.
in1267_ring_inj
Two distinct neighbors of any vertex in the ring graph must have distinct coordinates modulo 132.
in1267_par2_facts
Every vertex other than 0 in the base graph has a parent of strictly smaller depth connected by an edge other than {36, 39}.
SimpleGraph.Adj.reachable
Adjacent vertices in a graph are mutually reachable.
le_rfl
Any element of a preordered type satisfies x ≤ x.
in1267_lt
If j < k and b < 132, then 132j + b < 132k.
Set.ncard_image_of_injOn
A function injective on a set preserves the cardinality of that set.
in1267_nb_facts
For every vertex a < 132, its three tabulated neighbors are strictly bounded by 132 and pairwise distinct.
SimpleGraph.le_egirth
The girth of a simple graph is at least n if and only if every cycle has length at least n.
in1267_chk_sound
A non-backtracking walk in the base graph cannot return to its start vertex if the verified walk check returns true.
zero_add
Adding zero on the left is the identity: 0 + a = a.
in1267_chk_all
The non-backtracking return check evaluates to true for all starting vertices, all initial edges, and all path lengths from 2 to 7.

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

def in1267_P2 : ℕ := 205484735341419258661402951814228508455808514581874589481962138112812867451737961792799298863099385594545686250546821035826759915199047085163286739365484441522586705327108160882762782497571044519248943180998844938414109182130850648266757728632784960629082007333067553381448262341668822441290386653635744670175304089600def in1267_D2 : ℕ := 15115672263052547865081502645603529893192787986583476082914058514797149339291638340091195438615242946932914277294480027249074893048849241984942905486277809018632647161974766940137519032983007710425024066089811426537403063553911618598162137963458376125398257582464391191830737387885928544189218226106395304975092744448def in1267_par2 (v : ℕ) : ℕ := (in1267_P2 >>> (8 * v)) % 256def in1267_dep2 (v : ℕ) : ℕ := (in1267_D2 >>> (8 * v)) % 256theorem in1267_nb_facts : ∀ a, a < 132 → in1267_nb a 0 < 132 ∧ in1267_nb a 1 < 132 ∧    in1267_nb a 2 < 132 ∧ in1267_nb a 0 ≠ in1267_nb a 1 ∧ in1267_nb a 0 ≠ in1267_nb a 2 ∧    in1267_nb a 1 ≠ in1267_nb a 2 := by  decide +kerneltheorem in1267_nb_36 : in1267_nb 36 2 = 39 ∧ in1267_nb 39 0 = 36 := by decide +kerneltheorem in1267_par2_facts : ∀ v, v < 132 → v = 0 ∨ (in1267_par2 v < 132 ∧    (v = in1267_nb (in1267_par2 v) 0 ∨ v = in1267_nb (in1267_par2 v) 1 ∨      v = in1267_nb (in1267_par2 v) 2) ∧    ¬ (in1267_par2 v = 36 ∧ v = 39) ∧ ¬ (in1267_par2 v = 39 ∧ v = 36) ∧    in1267_dep2 (in1267_par2 v) < in1267_dep2 v) := by  decide +kerneltheorem in1267_base_iff (a b : ℕ) (ha : a < 132) (hb : b < 132) :    ((a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ in1267_outside ∨      (b, a) ∈ in1267_outside) ↔    (b = in1267_nb a 0 ∨ b = in1267_nb a 1 ∨ b = in1267_nb a 2) := by  constructor  · rintro (h | h | h)    · exact in1267_blk_fwd _ ha _ hb h    · exact (in1267_out_fwd _ h).2.2.1    · exact (in1267_out_fwd _ h).2.2.2  · intro h    have key : ∀ i, i < 3 → b = in1267_nb a i →        ((a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ in1267_outside ∨          (b, a) ∈ in1267_outside) := by      intro i hi e      have hb' := in1267_bwd _ ha 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 h'      · 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) edef in1267_mk (k j b : ℕ) (h : 132 * j + b < 132 * k) : Fin (132 * k) := ⟨132 * j + b, h⟩theorem in1267_lt {k j b : ℕ} (hj : j < k) (hb : b < 132) : 132 * j + b < 132 * k := by omegatheorem in1267_modinj {k x y : ℕ} (hx : x < k) (hy : y < k) (h : (x + 1) % k = (y + 1) % k) :    x = y := by  rcases Nat.lt_or_ge (x + 1) k with h1 | h1 <;> rcases Nat.lt_or_ge (y + 1) k with h2 | h2  · rw [Nat.mod_eq_of_lt h1, Nat.mod_eq_of_lt h2] at h; omega  · rw [Nat.mod_eq_of_lt h1, show y + 1 = k by omega, Nat.mod_self] at h; omega  · rw [Nat.mod_eq_of_lt h2, show x + 1 = k by omega, Nat.mod_self] at h; omega  · omegatheorem in1267_outside_def : in1267_outside = [(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)] := rfltheorem in1267_ring_hA (k : ℕ) (G : SimpleGraph (Fin (132 * k)))    (hG : ∀ u v : Fin (132 * k), 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)]      let base : ℕ → ℕ → Prop := fun a b =>        (a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ outside ∨ (b, a) ∈ outside      (u.val / 132 = v.val / 132 ∧ base (u.val % 132) (v.val % 132) ∧        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :    ∀ u v : Fin (132 * k), G.Adj u v ↔      (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨          v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k) := by  intro u v  rw [hG u v]  dsimp only  rw [← in1267_outside_def, in1267_base_iff _ _ (Nat.mod_lt _ (by norm_num)) (Nat.mod_lt _ (by norm_num))]theorem in1267_ring_hom (k : ℕ) (G : SimpleGraph (Fin (132 * k)))    (hA : ∀ u v : Fin (132 * k), G.Adj u v ↔      (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨          v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :    ∀ u v : Fin (132 * k), G.Adj u v → (v.val % 132 = in1267_nb (u.val % 132) 0 ∨      v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) := by  intro u v h  rcases (hA u v).1 h with ⟨-, h1, -⟩ | ⟨a1, b1, -⟩ | ⟨a1, b1, -⟩  · exact h1  · rw [a1, b1, in1267_nb_36.1]; simp  · rw [a1, b1, in1267_nb_36.2]; simptheorem in1267_ring_inj (k : ℕ) (G : SimpleGraph (Fin (132 * k)))    (hA : ∀ u v : Fin (132 * k), G.Adj u v ↔      (u.val / 132 = v.val / 132 ∧ (v.val % 132 = in1267_nb (u.val % 132) 0 ∨          v.val % 132 = in1267_nb (u.val % 132) 1 ∨ v.val % 132 = in1267_nb (u.val % 132) 2) ∧        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :    ∀ v w1 w2 : Fin (132 * k), G.Adj v w1 → G.Adj v w2 →      w1.val % 132 = w2.val % 132 → w1 = w2 := by  have hbl : ∀ v : Fin (132 * k), v.val / 132 < k := fun v => by have := v.isLt; omega  intro v w1 w2 h1 h2 e  have hb : w1.val / 132 = w2.val / 132 := by    rcases (hA v w1).1 h1 with ⟨a1, -, b1, c1⟩ | ⟨a1, b1, c1⟩ | ⟨a1, b1, c1⟩ <;>    rcases (hA v w2).1 h2 with ⟨a2, -, b2, c2⟩ | ⟨a2, b2, c2⟩ | ⟨a2, b2, c2⟩ <;>    first      | omega      | exact c1.trans c2.symm      | exact in1267_modinj (hbl w1) (hbl w2) (c1.symm.trans c2)  exact Fin.ext (by omega)theorem op309_girth9_block_ring_graph_properties (k : ℕ) (hk : 2 ≤ k)    (G : SimpleGraph (Fin (132 * k))) [DecidableRel G.Adj]    (hG : ∀ u v : Fin (132 * k), 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)]      let base : ℕ → ℕ → Prop := fun a b =>        (a ≠ b ∧ a / 3 = b / 3 ∧ (a % 3 = 0 ∨ b % 3 = 0)) ∨ (a, b) ∈ outside ∨ (b, a) ∈ outside      (u.val / 132 = v.val / 132 ∧ base (u.val % 132) (v.val % 132) ∧        ¬ (u.val % 132 = 36 ∧ v.val % 132 = 39) ∧ ¬ (u.val % 132 = 39 ∧ v.val % 132 = 36)) ∨      (u.val % 132 = 36 ∧ v.val % 132 = 39 ∧ v.val / 132 = (u.val / 132 + 1) % k) ∨      (u.val % 132 = 39 ∧ v.val % 132 = 36 ∧ u.val / 132 = (v.val / 132 + 1) % k)) :    G.Connected ∧ (∀ v, (G.neighborSet v).ncard = 3) ∧ (9 : ℕ∞) ≤ G.egirth := by  have hA := in1267_ring_hA k G hG  have hloc : ∀ v : Fin (132 * k), v.val % 132 < 132 := fun v => Nat.mod_lt _ (by norm_num)  have hbl : ∀ v : Fin (132 * k), v.val / 132 < k := fun v => by have := v.isLt; omega  have hAmk : ∀ (u v : Fin (132 * k)) (i a j b : ℕ), u.val = 132 * i + a → v.val = 132 * j + b →      a < 132 → b < 132 → (G.Adj u v ↔      (i = j ∧ (b = in1267_nb a 0 ∨ b = in1267_nb a 1 ∨ b = in1267_nb a 2) ∧        ¬ (a = 36 ∧ b = 39) ∧ ¬ (a = 39 ∧ b = 36)) ∨      (a = 36 ∧ b = 39 ∧ j = (i + 1) % k) ∨ (a = 39 ∧ b = 36 ∧ i = (j + 1) % k)) := by    intro u v i a j b hu hv ha hb    rw [hA u v, hu, hv]    have e1 : (132 * i + a) % 132 = a := by omega    have e2 : (132 * i + a) / 132 = i := by omega    have e3 : (132 * j + b) % 132 = b := by omega    have e4 : (132 * j + b) / 132 = j := by omega    rw [e1, e2, e3, e4]  have hhom := in1267_ring_hom k G hA  have hinj := in1267_ring_inj k G hA  refine ⟨?_, ?_, ?_⟩  · -- connected    have hk0 : 0 < k := by omega    have hin : ∀ j (hj : j < k) n b (hb : b < 132), in1267_dep2 b ≤ n →        G.Reachable (in1267_mk k j 0 (in1267_lt hj (by norm_num))) (in1267_mk k j b (in1267_lt hj hb)) := by      intro j hj n      induction n with      | zero =>        intro b hb hd        rcases in1267_par2_facts b hb with h | ⟨_, _, _, _, hlt⟩        · subst h; rfl        · omega      | succ n ih =>        intro b hb hd        rcases in1267_par2_facts b hb with h | ⟨hp, hadj, hx1, hx2, hlt⟩        · subst h; rfl        · refine (ih _ hp (by omega)).trans (SimpleGraph.Adj.reachable ?_)          rw [hAmk _ _ j _ j b rfl rfl hp hb]          exact Or.inl ⟨rfl, hadj, hx1, hx2⟩    have hblk : ∀ j (hj : j < k), G.Reachable (in1267_mk k 0 0 (in1267_lt hk0 (by norm_num)))        (in1267_mk k j 0 (in1267_lt hj (by norm_num))) := by      intro j      induction j with      | zero => intro _; rfl      | succ j ih =>        intro hj        have hj' : j < k := by omega        refine ((ih hj').trans (hin j hj' _ 36 (by norm_num) le_rfl)).trans ?_        refine (SimpleGraph.Adj.reachable ?_).trans (hin (j+1) hj _ 39 (by norm_num) le_rfl).symm        rw [hAmk _ _ j 36 (j+1) 39 rfl rfl (by norm_num) (by norm_num)]        exact Or.inr (Or.inl ⟨rfl, rfl, (Nat.mod_eq_of_lt hj).symm⟩)    have hall : ∀ v : Fin (132 * k), G.Reachable (in1267_mk k 0 0 (in1267_lt hk0 (by norm_num))) v := by      intro v      have ev : v = in1267_mk k (v.val / 132) (v.val % 132) (in1267_lt (hbl v) (hloc v)) :=        Fin.ext (by simp only [in1267_mk]; omega)      rw [ev]      exact (hblk _ (hbl v)).trans (hin _ (hbl v) _ _ (hloc v) le_rfl)    haveI : Nonempty (Fin (132 * k)) := ⟨in1267_mk k 0 0 (in1267_lt hk0 (by norm_num))⟩    exact ⟨fun u v => (hall u).symm.trans (hall v)⟩  · intro v    have hinjOn : Set.InjOn (fun w : Fin (132 * k) => w.val % 132) (G.neighborSet v) :=      fun w1 h1 w2 h2 e => hinj v w1 w2 h1 h2 e    rw [← Set.ncard_image_of_injOn hinjOn]    obtain ⟨n0, n1, n2, h01, h02, h12⟩ := in1267_nb_facts _ (hloc v)    have hsurj : ∀ x, (x = in1267_nb (v.val % 132) 0 ∨ x = in1267_nb (v.val % 132) 1 ∨        x = in1267_nb (v.val % 132) 2) → ∃ w, G.Adj v w ∧ w.val % 132 = x := by      intro x hx      have hx132 : x < 132 := by rcases hx with e | e | e <;> rw [e] <;> assumption      have hvv : v.val = 132 * (v.val / 132) + v.val % 132 := by omega      by_cases s1 : v.val % 132 = 36 ∧ x = 39      · have hm : (v.val / 132 + 1) % k < k := Nat.mod_lt _ (by omega)        refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩        rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]        exact Or.inr (Or.inl ⟨s1.1, s1.2, rfl⟩)      by_cases s2 : v.val % 132 = 39 ∧ x = 36      · by_cases hj0 : v.val / 132 = 0        · have hm : k - 1 < k := by omega          refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩          rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]          refine Or.inr (Or.inr ⟨s2.1, s2.2, ?_⟩)          rw [show k - 1 + 1 = k by omega, Nat.mod_self, hj0]        · have hm : v.val / 132 - 1 < k := by have := hbl v; omega          refine ⟨in1267_mk k _ x (in1267_lt hm hx132), ?_, by simp only [in1267_mk]; omega⟩          rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]          refine Or.inr (Or.inr ⟨s2.1, s2.2, ?_⟩)          rw [show v.val / 132 - 1 + 1 = v.val / 132 by omega, Nat.mod_eq_of_lt (hbl v)]      · refine ⟨in1267_mk k (v.val / 132) x (in1267_lt (hbl v) hx132), ?_, by simp only [in1267_mk]; omega⟩        rw [hAmk _ _ _ _ _ _ hvv rfl (hloc v) hx132]        exact Or.inl ⟨rfl, hx, s1, s2⟩    have himg : (fun w : Fin (132 * k) => w.val % 132) '' G.neighborSet v =        {in1267_nb (v.val % 132) 0, in1267_nb (v.val % 132) 1, in1267_nb (v.val % 132) 2} := by      ext x      simp only [Set.mem_image, SimpleGraph.mem_neighborSet, Set.mem_insert_iff,        Set.mem_singleton_iff]      constructor      · rintro ⟨w, hw, rfl⟩        exact hhom v w hw      · intro hx        exact hsurj x hx    rw [himg]    exact Set.ncard_eq_three.mpr ⟨_, _, _, h01, h02, h12, rfl⟩  · 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 % 132 = in1267_nb ((w.getVert j).val % 132) 0 ∨         (w.getVert (j+1)).val % 132 = in1267_nb ((w.getVert j).val % 132) 1 ∨         (w.getVert (j+1)).val % 132 = in1267_nb ((w.getVert j).val % 132) 2) :=      fun j hj => hhom _ _ (w.adj_getVert_succ (by omega))    have hNB : ∀ j, j < w.length - 1 →        (w.getVert (j+2)).val % 132 ≠ (w.getVert j).val % 132 := by      intro j hj h      have h1 : G.Adj (w.getVert (j+1)) (w.getVert (j+1+1)) := w.adj_getVert_succ (by omega)      have h2 : G.Adj (w.getVert (j+1)) (w.getVert j) := (w.adj_getVert_succ (by omega)).symm      have heq := hinj _ _ _ h1 h2 h      by_cases hj2 : j + 2 < w.length      · exact hne (j+2) j hj2 (by omega) (by omega) heq      · have e2 : j + 1 + 1 = w.length := by omega        rw [e2, w.getVert_length] at heq        have h0 : w.getVert 0 = a := w.getVert_zero        exact hne 0 j (by omega) (by omega) (by omega) (by rw [h0]; exact heq)    have hsound := in1267_chk_sound (w.length - 1) ((w.getVert 0).val % 132)      (fun j => (w.getVert j).val % 132) hadj hNB    have hfin : (w.getVert (w.length - 1 + 1)).val % 132 = (w.getVert 0).val % 132 := 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 := hloc (w.getVert 0)    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