Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The corner parameter enumerates the symmetric order-three magic squares

Proved
MagicSquares.symm_three_bij

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

combinatoricsenumerative-combinatoricsmagic-squares

A bijection onto an interval.

Let Sn(t)S_{n}(t)Sn​(t) denote the number of symmetric magic squares of order nnn and line sum ttt, and let symmParamSet(e)={0,1,…,2e}\mathrm{symmParamSet}(e)=\{0,1,\dots,2e\}symmParamSet(e)={0,1,…,2e} be the admissible corner parameters of the symmetric family, with symmParamCount(e)=2e+1\mathrm{symmParamCount}(e)=2e+1symmParamCount(e)=2e+1. The theorem states

S3(3e)=symmParamCount(e).S_{3}(3e)=\mathrm{symmParamCount}(e).S3​(3e)=symmParamCount(e).

That is, sending a symmetric magic square of order three and line sum 3e3e3e to its top-left corner M00M_{00}M00​ is a bijection onto {0,…,2e}\{0,\dots,2e\}{0,…,2e}.

Proof. The classification MagicSquares.symmetric_magic_three_classify shows that such a square is symmMagic3(e,a)\mathrm{symmMagic3}(e,a)symmMagic3(e,a) with a=M00a=M_{00}a=M00​, whose (0,1)(0,1)(0,1) entry is 2e−a2e-a2e−a; the row-000 identity a+(2e−a)+e=3ea+(2e-a)+e=3ea+(2e−a)+e=3e is then satisfiable in N\mathbb{N}N only for a≤2ea\le 2ea≤2e, so the map lands in symmParamSet(e)\mathrm{symmParamSet}(e)symmParamSet(e). It is injective because aaa determines the whole square, and surjective because for every a≤2ea\le 2ea≤2e the array symmMagic3(e,a)\mathrm{symmMagic3}(e,a)symmMagic3(e,a) is symmetric, is magic of line sum 3e3e3e, and has all entries at most 2e2e2e, hence may be read over the ambient type Fin(3e+1)\mathrm{Fin}(3e+1)Fin(3e+1) of the counting function.

Context. This is the order-three counterpart of the bijection magic_three_param_bij used in Mission I: there, MacMahon's two parameters (a,c)(a,c)(a,c) enumerate the magic squares of line sum 3e3e3e; here the extra symmetry condition cuts the parameter set down from the ℓ1\ell_{1}ℓ1​ ball {(a,c):∣a−e∣+∣c−e∣≤e}\{(a,c):|a-e|+|c-e|\le e\}{(a,c):∣a−e∣+∣c−e∣≤e} to its diagonal slice c=ec=ec=e, an interval of 2e+12e+12e+1 points. Composing the bijection with the cardinality of an interval gives the closed form S3(3e)=2e+1S_{3}(3e)=2e+1S3​(3e)=2e+1, and it also isolates why the count is linear rather than quadratic in eee.

Preamble
import Mathlib
import Definitions.Def_MagicSquares
import Definitions.Def_MagicSquaresSpecial3
open MagicSquares
Formal statement
namespace MagicSquares

theorem symm_three_bij (e : ℕ) : symmetricMagicCount 3 (3 * e) = symmParamCount e := by sorry

end MagicSquares
Source
P. A. MacMahon, Combinatory Analysis, Vol. II, Cambridge University Press, 1916; M. Beck, T. Cohen, J. Cuomo and P. Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707--717 (arXiv:math/0201013); W. S. Andrews, Magic Squares and Cubes, 2nd ed., Dover, 1960.
Human review
  • Endorsed by Shuze Chen · Sep 18, 2026

  • Endorsed by Yuxuan Xu · Sep 18, 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