AFTD Auto-Formalizing Theoretical Domains

modular_queens_attack

def

Two queens at positions x and y in (Z/nZ)^d attack each other if their difference x - y is a nonzero scalar multiple of a nonzero vector with coordinates in {-1, 0, 1}.

Statement

def modular_queens_attack {d n : ℕ} (x y : Fin d → ZMod n) : Prop
Defined in
arXiv:2611.14754 Sec. 1
Verified
14 Nov 2026
Axioms
none listed
Used by 3

Read back from the Lean

Given natural numbers $d$ and $n$, and two vectors $x, y \in (\mathbb{Z}/n\mathbb{Z})^d$, modular_queens_attack x y asserts that there exist a scalar $c \in \mathbb{Z}/n\mathbb{Z}$ and a sign vector $v : \mathrm{Fin}\ d \to \mathrm{SignType}$ such that: 1. $c \neq 0$, 2. $v \neq 0$ (i.e., $v$ is not the all-zero vector), and 3. for every coordinate $i \in \mathrm{Fin}\ d$, $x_i - y_i = c \cdot \mathrm{cast}(v_i)$ in $\mathbb{Z}/n\mathbb{Z}$ (where $\mathrm{cast}(v_i) \in \{-1, 0, 1\}$). In other words, the difference vector $x - y$ is a non-zero scalar multiple in $(\mathbb{Z}/n\mathbb{Z})^d$ of a non-zero direction vector with entries in $\{-1, 0, 1\}$.

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

/-- Two queens at positions x and y in (Z/nZ)^d attack each other if x - y = c * v for nonzero c and nonzero v in {-1,0,1}^d. -/
def modular_queens_attack {d n : ℕ} (x y : Fin d → ZMod n) : Prop := ∃ (c : ZMod n) (v : Fin d → SignType), c ≠ 0 ∧ v ≠ 0 ∧
    ∀ i : Fin d, x i - y i = c * (SignType.cast (v i) : ZMod n)
See it in the graphDiscuss this resultChallenge it