Every order-three magic square of line sum 3e is the parametrized one
ProvedMagicSquares.magic_three_param_necessaryThe parametrization is complete. Let be a magic square with nonnegative integer entries and line sum . Then is exactly the parametrized array built from its two top corners:
M \;=\; \begin{pmM_{00}trix} M_{00} & 3e-M_{00}-M_{02} & M_{02}\\ e+M_{02}-M_{00} & e & e+M_{00}-M_{02}\\ 2e-M_{02} & M_{00}+M_{02}-e & 2e-M_{00} \end{pmM_{00}trix} ,where and .
The eight line identities determine the remaining seven cells uniquely. The centre is (MacMahon's identity with ). The two diagonals give and ; row then gives ; column and column give and ; and column gives . Since is a genuine square over , none of these subtractions truncates.
Consequently a magic square of line sum is determined by its two top corners, and the pair satisfies precisely the admissibility inequalities — the count of such squares is therefore the count of admissible pairs, which is MacMahon's .
Formalization Note The proof expands the eight line identities of IsMagic
and closes each of the nine cell equalities by omega; no integrality
hypothesis beyond working over is needed.
import Mathlib import Definitions.Def_MagicSquares import Definitions.Def_MagicSquaresParam3
namespace MagicSquares
theorem magic_three_param_necessary (e : ℕ) (M : Square 3 ℕ)
(hM : IsMagic M (3 * e)) :
M = mkMagic3 e (M 0 0) (M 0 2) := by sorry
end MagicSquares
Confirmed by the mission captain (proposal self-audit).