Prove2Me
Navigate
DiscoverFormalpediaBlogsUsersMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

The semi-magic squares of order one

Proved
MagicSquares.semi_magic_count_one

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

combinatoricsehrhartenumerative-combinatoricsmagic-squares

Order one. For every natural number ttt there is exactly one 1×11\times11×1 array of nonnegative integers whose row and column both sum to ttt, namely [t][t][t]; hence H1(t)=1H_{1}(t)=1H1​(t)=1. This is the base case of the ladder, and it is the n=1n=1n=1 instance of the degree formula, whose asserted degree (n−1)2(n-1)^{2}(n−1)2 is 000.

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

theorem semi_magic_count_one (t : ℕ) : semiMagicCount 1 t = 1 := 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, the value semiMagicCount⁡(1,t)\operatorname{semiMagicCount}(1,t)semiMagicCount(1,t) equals 111. Here semiMagicCount⁡(n,t)\operatorname{semiMagicCount}(n,t)semiMagicCount(n,t) is the cardinality of the set of n×nn\times nn×n arrays whose entries lie in the finite type Fin⁡(t+1)\operatorname{Fin}(t+1)Fin(t+1) — that is, each entry is an integer between 000 and ttt inclusive, coerced to a natural number before use — such that every row and every column sums to ttt (the predicate IsSemiMagic⁡\operatorname{IsSemiMagic}IsSemiMagic requires ∑jMij=t\sum_j M_{ij}=t∑j​Mij​=t for all rows iii and ∑iMij=t\sum_i M_{ij}=t∑i​Mij​=t for all columns jjj). For n=1n=1n=1 this set consists of the 1×11\times 11×1 arrays [a][a][a] with a∈{0,1,…,t}a\in\{0,1,\dots,t\}a∈{0,1,…,t} whose single row-sum and single column-sum both equal ttt; this forces a=ta=ta=t, so exactly one such array exists. The theorem asserts this count is 111 for all t:Nt:\mathbb{N}t:N.

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