Theorem 1 (i) with the exact degree, for positive line sums (Spencer's elementary route, formalised)
ProvedMagicSquares.semi_magic_polynomial_exists_degree_eqSpencer's theorem with the exact degree.
Write for the number of arrays of nonnegative integers whose every row and every column sums to . The theorem states that for every order there is a rational polynomial of degree exactly such that
Why the degree is . It is the dimension of the Birkhoff polytope , and is its Ehrhart polynomial, so the value is forced by the BCCG Theorem 1. The proof given here is nevertheless elementary and uses no Ehrhart theory and no lattice-point machinery. It follows J. Spencer, Counting magic squares, Amer. Math. Monthly 87 (1980) 397-399: generating functions, Hall's marriage theorem, and the finite poset of supports ordered by inclusion.
- Partial fractions, discretely. If a sequence satisfies a triangular recurrence with polynomial coefficients of degree , telescoping it against the discrete antiderivative (Faulhaber, in Bernoulli-polynomial form) exhibits it as a polynomial of degree .
- Poset recursion. Birkhoff-von Neumann attaches to each support a permutation with , and splitting off a square of line sum gives over the candidates . Strong induction on then makes each level count a polynomial.
- Aggregation. The support fibres partition the semi-magic squares, so agrees with a polynomial for .
- Degree, both ways. The upper bound is measured by the rank , which strictly increases along proper inclusions of supports. The lower bound is explicit: for order and line sum , put a free block in the top-left corner and let the line-sum equations fill in the last row, last column and corner,
which is injective and gives .
What is not claimed. Agreement at . The support-set recursion only ever sees
positive line sums - the squares of line sum have empty support and the recursion has no
term for it - so the value is out of reach of this route. That value is
exactly Ehrhart-Macdonald reciprocity at , i.e. the statement that has no interior
lattice points for , and it is the separate rung semi_magic_reciprocity. The
mission goal semi_magic_polynomial_exists quantifies over all and is
therefore strictly stronger than this node.
import Mathlib import Definitions.Def_MagicSquares open MagicSquares
namespace MagicSquares
theorem semi_magic_polynomial_exists_degree_eq (n : ℕ) (hn : 1 ≤ n) :
∃ p : Polynomial ℚ, p.natDegree = (n - 1) ^ 2 ∧
∀ t : ℕ, 1 ≤ t → p.eval (t : ℚ) = (semiMagicCount n t : ℚ) := by
sorry
end MagicSquares