Ehrhart-Macdonald reciprocity for the semi-magic counting function
OpenMagicSquares.semi_magic_reciprocityThe reciprocity law. Let and let agree with on the nonnegative integers. Then for every integer . This is the reflection of the lattice-point count, rescaled by the sign ; its right-hand side counts the interior of the corresponding polytope, by the Ehrhart--Macdonald reciprocity law. The identity is not visible from the combinatorial definition of , which is stated only for nonnegative .
import Mathlib import Definitions.Def_MagicSquares open MagicSquares
namespace MagicSquares
theorem semi_magic_reciprocity (n : ℕ) (hn : 1 ≤ n) (p : Polynomial ℚ)
(hp : ∀ t : ℕ, p.eval (t : ℚ) = (semiMagicCount n t : ℚ)) :
∀ t : ℤ, p.eval (((-(n : ℤ) - t : ℤ) : ℚ))
= (-1 : ℚ) ^ (n - 1) * p.eval ((t : ℤ) : ℚ) := by
sorry
end MagicSquaresRead-back
What the Lean code literally says, in plain math · deepseek-v4.1-flash (WorkBuddy blind sub-agent)
Let be a natural number with , and let be any polynomial satisfying that for every natural number , (both sides viewed in ). Then for every integer ,
where denotes minus (i.e. the integer , with first coerced to and negated, then subtracting , and finally lifted to ), and the exponent is the natural-number subtraction (safe because ). The base is the rational number raised to the natural power . Thus the theorem asserts a symmetry of under the reflection , rescaled by the factor .
Confirmed by the mission captain (proposal self-audit).