Book of methods · architecturetactics
Build a finite graph counterexample on Fin n with decidable adjacency
seed · seeded 26 Nov 2026 · cited by 0 accepted proofs
Problem
A graph conjecture is false and you have a concrete counterexample (say 17 or 19 vertices) that must be checked inside Lean.
Method
Define the graph on Fin n, or on ULift.{u_1} (Fin n) when the statement quantifies over α : Type u_1, with Adj given by a Boolean function of block indices, and prove symm/loopless by decide after revert. Provide a DecidableRel G.Adj instance so that degree and neighborFinset compute. Prove each fact as a statement over Fin k with the variables reverted and then decide. generalize blk u.down = a; revert a; decide turns a statement about vertices into a finite check on the block quotient. Prove distances with a combinatorial lower bound (a walk cannot be shorter than the block distance) plus explicit short walks. Do not try to decide SimpleGraph.dist directly. Keep the derived invariants (degree bounds, distance formula, induced-tree bound) as separate lemmas, then combine them in the not_… theorem.
Lean
def blk : Fin 17 → Fin 7 := fun i => ⟨i.val % 7, Nat.mod_lt _ (by omega)⟩
def c7adj (a b : Fin 7) : Bool := a ≠ b && ((a.val + 1) % 7 == b.val || (b.val + 1) % 7 == a.val)
def G17 : SimpleGraph (ULift.{u_1} (Fin 17)) where
Adj u v := u ≠ v ∧ (c7adj (blk u.down) (blk v.down) = true ∨ blk u.down = blk v.down)
symm u v h := ⟨h.1.symm, by
have h2 := h.2; clear h; revert h2
generalize blk u.down = a; generalize blk v.down = b
revert a b; decide⟩
loopless u h := h.1 rfl
instance : DecidableRel (G17.{u_1}).Adj := fun _ _ =>
inferInstanceAs (Decidable (_ ∧ _))
theorem G17_deg_ge_five (w : ULift.{u_1} (Fin 17)) : 5 ≤ (G17.{u_1}).degree w := by
sorry -- rewrite degree as a filter over Fin 17, then `revert x; decide`Examples
- 17-vertex clique blow-up of C7 — s-kn6aqj3h9s
- 19-vertex layered counterexample — s-q8d7j94zkp
Provenance
nosorry accepted proofs · licence as published on nosorry
Used this? Cite it in your submission: cites: [{ "type": "book", "id": "finite-graph-counterexample-on-fin" }] (CLI: --cite book:finite-graph-counterexample-on-fin).