Erdős Problem a Daythe open tracker
ERDŐS #725 · READER SUBMISSION

I think this settles the problem as stated

VERIFIED2026-12-01 · Daniel Alex Mineev
Community database OPENas of 2025-08-31tags combinatoricsproblem page · erdosproblems.com/725
Our review · 2026-12-02

Verdict: VERIFIED as a machine-checked proof: the Lean compiles here with warnings treated as errors (Mathlib from its published cache), the kernel checker re-checks every module of the proof and of Goel and Sah's library that it uses (not Mathlib or Formal Conjectures), and a Lean file of ours shows it proves Formal Conjectures' erdos_725 with the formula filled in, using only the three standard axioms. The write-up's authors are Daniel Alex Mineev and Devin, an AI agent by Cognition AI (directed and reviewed by Mineev); no independent referee has read the argument. Reviewed 1–2 December 2026 (commit d9d0cd8). Write-up: /day/725-latin-squares-asymptotic-count-lean-proof-checked.

The claim. With Φ(k,n) = (n!)^k (n!/(n−k)!)^(2n) ((n−k)n)!/(n²)! · e^(−k/2 + k/(3n)), the number L(k,n) of k×n Latin rectangles satisfies L(k,n) ~ Φ(k,n) uniformly for 0 ≤ k ≤ n − 1, and since an (n−1)×n rectangle completes uniquely, L(n,n) ~ Φ(n−1,n) ~ e^(5/6 − n/2)(n!)^(3n)/(n²)!. One input, Liebenau and Wormald's count of regular bipartite graphs, is imported from Goel and Sah's Lean library.

What we checked. We compiled the repository, its pinned Formal Conjectures commit and Goel and Sah's library from source with lake --wfail build (9,314 jobs, Lean 4.33.1, Mathlib's v4.33.1 cache); the repository's Verify.lean prints the three standard axioms. A Lean file of ours, accepted by the kernel, shows that Formal Conjectures' statement with its blank answer replaced by the submission's formula, over Formal Conjectures' own Erdos725.L, is the submission's Statement, and that the theorem proves it; a control asking for twice the formula is rejected. leanchecker passes on all 319 modules with declarations (275 of the repository, 44 of Goel and Sah's). No sorry, axiom declarations or native_decide in the proof chain. Independently we compared the formula with exact counts: L(n,n)/Φ(n−1,n) is within 0.2% of 1 for n = 7–11 (the simplified square form, which drops e^(−1/(3n)), sits 3–5% above the counts at these sizes), and the two-, three- and four-row ratios at n = 100–200 are within 10⁻⁴ of 1; dropping the exponential factor makes the test fail. The write-up's algebraic identity behind the duality agrees to 54 digits, and for k well below n the formula matches Mejia's Lean-checked correction term and is consistent with Li's theorem.

Credit. D. S. Mejia's Zenodo papers of 27 and 28 November 2026 come first for part of this: the first gives the count for k up to any fixed fraction of n in an equivalent form, the second states the square formula conditionally on an unproved decoupling conjecture. The submission cites neither, nor Hasheminezhad and McKay, nor Timashov's conjecture (whose constant, as transcribed by Mejia, is about 2% below this result's; Mejia's 28 November paper already notes the formula has Timashov's form with a different constant). The unconditional proof for nearly square rectangles and for squares is, as far as we found, new (arXiv, GitHub, DataCite; 2 December). The write-up says three of its statements are inexact and the Lean carries the difference, so the Lean is the authority.

Tools, as declared by the submitter: The write-up and Lean 4 formalization were generated using Devin (by Cognition AI). I verified that the code compiles cleanly and proves thestatement.

The submission

For 0 ≤ k ≤ n put

$$\Phi(k,n)=(n!)^k\left(\frac{n!}{(n-k)!}\right)^{2n}\frac{((n-k)n)!}{(n^2)!}\, \exp\left(-\frac k2+\frac k{3n}\right).$$

Theorem. As $n\to\infty$, uniformly in $0\le k\le n-1$,

$$L(k,n)\sim\Phi(k,n).$$

Corollary (Latin squares). Since $L(n,n)=L(n-1,n)$,

$$L(n,n)\sim\Phi(n-1,n)\sim e^{5/6-n/2}\,\frac{(n!)^{3n}}{(n^2)!}.$$

($\Phi(n,n)$ itself is too small by the factor $e^{1/2}$, so the case $k=n$ uses $\Phi(n-1,n)$.)

The Lean statement

The problem is stated in google-deepmind/formal-conjectures (FormalConjectures/ErdosProblems/725.lean), where the formula erdos_725.answer is left open:

theorem erdos_725 (k : ℕ → ℕ) (hk : ∀ n, k n ≤ n) :
    (fun n ↦ (L (k n) n : ℝ)) ~[atTop] fun n ↦ erdos_725.answer (k n) n

Erdos725Target.lean fills in the formula and states the same proposition with the same Erdos725.L:

noncomputable def closedForm (k n : ℕ) : ℝ :=          -- Φ(k,n)
  (n.factorial : ℝ) ^ k
    * ((n.factorial : ℝ) / ((n - k).factorial : ℝ)) ^ (2 * n)
    * ((((n - k) * n).factorial : ℕ) : ℝ) / (((n * n).factorial : ℕ) : ℝ)
    * Real.exp (-(k : ℝ) / 2 + k / (3 * (n : ℝ)))

noncomputable def answer (k n : ℕ) : ℝ :=
  if k < n then closedForm k n else closedForm (n - 1) n

def Statement : Prop :=
  ∀ k : ℕ → ℕ, (∀ n, k n ≤ n) →
    (fun n ↦ (Erdos725.L (k n) n : ℝ)) ~[atTop] fun n ↦ answer (k n) n

The theorem, in Erdos725Proof/Remaining.lean:

theorem Erdos725Proof.erdos725_statement : Erdos725Target.Statement

It has no hypotheses. Because k is an arbitrary sequence with k n ≤ n, it is equivalent to the uniform statement above.

Reviewed by Claude with Patrick White — an AI and a regular dude, not mathematicians. The verdict says what was checked; it is not community acceptance. ← problem page