Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The three-parameter array is a magic square of line sum 3e

Proved
MagicSquares.magic_three_param_sufficient

by Yuxuan Xu · Sep 16, 2026 · Mathlib 0df444a (Lean v4.33.1)

combinatoricsmagic-squares

The parametrization is sound. Let e,a,ce,a,ce,a,c be nonnegative integers satisfying the admissibility inequalities

e≤a+c,a+c≤3e,a≤e+c,c≤e+a,e \le a+c,\qquad a+c \le 3e,\qquad a \le e+c,\qquad c \le e+a ,e≤a+c,a+c≤3e,a≤e+c,c≤e+a,

and let M(a,c)M(a,c)M(a,c) be the array

(a3e−a−cce+c−aee+a−c2e−ca+c−e2e−a).\begin{pmatrix} a & 3e-a-c & c\\ e+c-a & e & e+a-c\\ 2e-c & a+c-e & 2e-a \end{pmatrix} .​ae+c−a2e−c​3e−a−cea+c−e​ce+a−c2e−a​​.

Then M(a,c)M(a,c)M(a,c) is a magic square of line sum 3e3e3e: all three rows, all three columns, and both main diagonals sum to 3e3e3e.

The inequalities are exactly what makes the truncations in N\mathbb{N}N harmless. Row 000 needs a+c≤3ea+c\le 3ea+c≤3e so that 3e−a−c3e-a-c3e−a−c is not truncated; row 111 needs a≤e+ca\le e+ca≤e+c and c≤e+ac\le e+ac≤e+a for the same reason on e+c−ae+c-ae+c−a and e+a−ce+a-ce+a−c; row 222 needs c≤2ec\le 2ec≤2e, a+c≥ea+c\ge ea+c≥e and a≤2ea\le 2ea≤2e, and the bounds a,c≤2ea,c\le 2ea,c≤2e follow from the hypotheses by adding a≤e+ca\le e+ca≤e+c to a+c≤3ea+c\le 3ea+c≤3e (giving 2a≤4e2a\le 4e2a≤4e) and symmetrically. The columns and diagonals are then pure cancellation.

Together with the companion necessary direction this shows that the map (a,c)↦M(a,c)(a,c)\mapsto M(a,c)(a,c)↦M(a,c) is a parametrization of the order-three magic squares of line sum 3e3e3e.

Formalization Note mkMagic3 is defined over N\mathbb{N}N with truncated subtraction, so every line identity is proved by omega after discharging the relevant non-truncation side condition. The statement is otherwise unconditional apart from admissibility.

Preamble
import Mathlib
import Definitions.Def_MagicSquares
import Definitions.Def_MagicSquaresParam3
Formal statement
namespace MagicSquares

theorem magic_three_param_sufficient (e a c : ℕ) (h : IsParam3 e a c) :
    IsMagic (mkMagic3 e a c) (3 * e) := by sorry

end MagicSquares
Source
Beck, Cohen, Cuomo & Gribelyuk, The number of ``magic'' squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707--717; arXiv:math/0201013v3. G. Xin, Constructing all magic squares of order three, Discrete Math. 308 (2008); arXiv:math/0610771.
Human review
  • Endorsed by Shuze Chen · Sep 16, 2026

  • Endorsed by Yuxuan Xu · Sep 16, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, licensed under Apache 2.0.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTermsJoin SlackJoin Zulip© 2026 Prove2Me