Positive semi-magic squares shift to line sum t - n
ProvedMagicSquares.positive_shift_countThe shift bijection between positive and ordinary semi-magic squares. Let and . Subtracting the all-ones matrix gives a bijection between the positive semi-magic squares of line sum (every entry at least one) and all semi-magic squares of line sum , so that
The map is its own inverse up to adding back: since itself has every line sum equal to , subtracting it drops every line sum by exactly while preserving nonnegativity precisely for the positive squares. This is the elementary combinatorial half of Stanley's reciprocity argument: it converts the geometric interior count supplied by Ehrhart--Macdonald reciprocity into an ordinary value of the counting function, with no polyhedral machinery of its own.
Formalization Note Lean states both sides as cardinals over Square n (Fin (t+1))-style finsets via positiveInteriorCount and semiMagicCount, with t - n the truncated natural subtraction (exact here since ).
import Mathlib import Definitions.Def_MagicSquares import Definitions.Def_MagicSquares_positiveInteriorCount open MagicSquares
namespace MagicSquares
theorem positive_shift_count (n t : ℕ) (hn : 1 ≤ n) (hnt : n ≤ t) :
positiveInteriorCount n t = semiMagicCount n (t - n) := by sorry
end MagicSquares