AFTD Auto-Formalizing Theoretical Domains

toroidal_king_graph

def

The king graph toroidal_king_graph n on the vertex type Fin n × Fin n, where two distinct vertices p and q are adjacent if and only if in each coordinate their components are equal or adjacent in SimpleGraph.cycleGraph n.

Statement

def toroidal_king_graph (n : ℕ) : SimpleGraph (Fin n × Fin n)
Defined in
scout/2611-22830-independent-sets-in-the-2-token-graph-of-a-cycle-and-kings.md:93
Verified
20 Nov 2026
Axioms
none listed
Used by 2
  • token_king_sharp_family_eight_unliftableOn the 8-cycle, the candidate sharp family token_king_sharp_family 8 has no nonattacking king lift: ¬ has_nonattacking_king_lift 8…
  • has_nonattacking_king_liftGiven a natural number n with [NeZero n] and a family I : Finset { s : Finset (Fin n) // s.card = 2 }, has_nonattacking_king_lift n I…

Read back from the Lean

Given a natural number n, toroidal_king_graph n is the simple graph with vertex set Fin n × Fin n where two vertices p and q are adjacent if and only if: 1. p ≠ q, 2. either p.1 = q.1 or p.1 is adjacent to q.1 in SimpleGraph.cycleGraph n, and 3. either p.2 = q.2 or p.2 is adjacent to q.2 in SimpleGraph.cycleGraph n. This is the strong product of SimpleGraph.cycleGraph n with itself.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- The king graph on the n × n toroidal board with vertex type Fin n × Fin n. -/
def toroidal_king_graph (n : ℕ) : SimpleGraph (Fin n × Fin n) := {
  Adj := fun p q => p ≠ q ∧ (p.1 = q.1 ∨ (SimpleGraph.cycleGraph n).Adj p.1 q.1) ∧
    (p.2 = q.2 ∨ (SimpleGraph.cycleGraph n).Adj p.2 q.2)
  symm := ⟨by
    rintro p q ⟨hne, h1, h2⟩
    refine ⟨hne.symm, ?_, ?_⟩
    · rcases h1 with h | h
      · left; exact h.symm
      · right; exact (SimpleGraph.cycleGraph n).adj_symm h
    · rcases h2 with h | h
      · left; exact h.symm
      · right; exact (SimpleGraph.cycleGraph n).adj_symm h⟩
  loopless := ⟨by
    rintro p ⟨hne, -⟩
    exact hne rfl⟩
}
See it in the graphDiscuss this resultChallenge it