Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Order four: the Ehrhart polynomial of the Birkhoff polytope B_4

Proved
MagicSquares.semi_magic_count_four

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

combinatoricsehrhartenumerative-combinatoricsmagic-squares

Order four, with the denominators cleared. The counting function H4(t)H_{4}(t)H4​(t), the number of 4×44\times44×4 arrays of nonnegative integers whose every row and every column sums to ttt, is the Ehrhart polynomial of the four-dimensional Birkhoff polytope B4B_{4}B4​, whose degree is (4−1)2=9(4-1)^{2}=9(4−1)2=9. Multiplying by the common denominator 113401134011340 of its coefficients gives the displayed identity in the natural numbers. The leading coefficient is 11/1134011/1134011/11340, which is vol⁡(B4)\operatorname{vol}(B_{4})vol(B4​); the normalised volume 9!⋅11113409!\cdot\tfrac{11}{11340}9!⋅1134011​ equals 352352352. This rung is the concrete order at which the general statement can be approached without building any lattice-point machinery.

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

theorem semi_magic_count_four (t : ℕ) :
    11340 * semiMagicCount 4 t
      = 11 * t ^ 9 + 198 * t ^ 8 + 1596 * t ^ 7 + 7560 * t ^ 6 + 23289 * t ^ 5
        + 48762 * t ^ 4 + 70234 * t ^ 3 + 68220 * t ^ 2 + 40950 * t + 11340 := by
  sorry

end MagicSquares
Source
M. Beck, M. Cohen, J. Cuomo and P. Gribelyuk, The number of "magic" squares, cubes and hypercubes, Amer. Math. Monthly 110 (2003), 707--717 (arXiv:math/0201013); E. Ehrhart (1973); R. P. Stanley, Duke Math. J. 40 (1973) 607--632; J. Spencer, Amer. Math. Monthly 87 (1980) 397--399; M. Beck and D. Paxton, The Ehrhart polynomial of the Birkhoff polytope (arXiv:math.CO/0202267).
Read-back

What the Lean code literally says, in plain math · deepseek-v4.1-flash (WorkBuddy blind sub-agent)

For every natural number ttt,

11340⋅semiMagicCount⁡(4,t)=11 t9+198 t8+1596 t7+7560 t6+23289 t5+48762 t4+70234 t3+68220 t2+40950 t+11340.11340\cdot \operatorname{semiMagicCount}(4,t)=11\,t^{9}+198\,t^{8}+1596\,t^{7}+7560\,t^{6}+23289\,t^{5}+48762\,t^{4}+70234\,t^{3}+68220\,t^{2}+40950\,t+11340.11340⋅semiMagicCount(4,t)=11t9+198t8+1596t7+7560t6+23289t5+48762t4+70234t3+68220t2+40950t+11340.

Here semiMagicCount⁡(4,t)\operatorname{semiMagicCount}(4,t)semiMagicCount(4,t) is the number of 4×44\times 44×4 arrays with entries in Fin⁡(t+1)\operatorname{Fin}(t+1)Fin(t+1) (each entry an integer 0,1,…,t0,1,\dots,t0,1,…,t) whose every row and every column sums to ttt. All arithmetic in the displayed identity is performed in the natural numbers N\mathbb{N}N: the multiplication 11340⋅(⋅)11340\cdot(\cdot)11340⋅(⋅), the powers tkt^ktk, the products of coefficients with powers, and the additions on the right-hand side, and the equality is an equality of natural numbers. The theorem asserts only this numerical identity in N\mathbb{N}N; it does not, as written, separately assert that the right-hand side is divisible by 113401134011340.

Human review
  • Endorsed by Shuze Chen · Sep 19, 2026

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