AFTD Auto-Formalizing Theoretical Domains

is_magic_arrangement3

def

An arrangement $S : \mathrm{Fin}\,3 \times \mathrm{Fin}\,3 \simeq \mathrm{Fin}\,9$ is a magic square if every row sum $\sum_{j=0}^2 (S(i,j)+1) = 15$, every column sum $\sum_{i=0}^2 (S(i,j)+1) = 15$, the main diagonal sum $\sum_{i=0}^2 (S(i,i)+1) = 15$, and the anti-diagonal sum $\sum_{i=0}^2 (S(i, 2-i)+1) = 15$.

Statement

def is_magic_arrangement3 (S : Fin 3 × Fin 3 ≃ Fin 9) : Prop
Defined in
arXiv:2610.38386, Proposition 5.1
Verified
01 Nov 2026
Axioms
none listed
Used by 2

Read back from the Lean

is_magic_arrangement3 defines a predicate on equivalences (bijections) S : Fin 3 × Fin 3 ≃ Fin 9, asserting that: 1. for all row indices i : Fin 3, the sum over j : Fin 3 of (S (i, j)).val + 1 (as an integer) equals 15; 2. for all column indices j : Fin 3, the sum over i : Fin 3 of (S (i, j)).val + 1 (as an integer) equals 15; 3. the main diagonal sum over i : Fin 3 of (S (i, i)).val + 1 (as an integer) equals 15; and 4. the anti-diagonal sum over i : Fin 3 of (S (i, Fin.rev i)).val + 1 (as an integer) equals 15.

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

/-- Magic square predicate for an order-3 arrangement. -/
def is_magic_arrangement3 (S : Fin 3 × Fin 3 ≃ Fin 9) : Prop :=
  (∀ i : Fin 3, ∑ j : Fin 3, ((S (i, j)).val + 1 : ℤ) = 15) ∧
  (∀ j : Fin 3, ∑ i : Fin 3, ((S (i, j)).val + 1 : ℤ) = 15) ∧
  (∑ i : Fin 3, ((S (i, i)).val + 1 : ℤ) = 15) ∧
  (∑ i : Fin 3, ((S (i, Fin.rev i)).val + 1 : ℤ) = 15)
See it in the graphDiscuss this resultChallenge it