The mysterious polynomial, checked in Lean
This is the full write-up behind my post Proving my leftover PhD conjectures with AI and Lean. It is for anyone who wants to check the mathematics: what the conjectures about \(P_n(z)\) said, which parts are now proved in Lean 4 with Mathlib, how each proof goes, and how to rebuild the Lean proofs on your own machine. The Lean source is on its own page, and as a zip.
- What Lean checked, and what you still have to read
- Background
- The conjecture
- The definitions in Lean
- Results and proofs
- 1. \(D_n\) divides \(VH_n\) (
thm:cyclotomic) - 2. Conjecture (a), as printed, is false
- 3. Lemma A: the low coefficients of \(VH_n\) (
conj:vhcon(a)) - 4. Conjecture (a), corrected
- 5. The top coefficients of \(VH_n\) (
conj:vhcon(b)) - 6. Conjecture (e): the value \(P_n(-1)\)
- 7. Conjecture (c): no real roots for even \(n\)
- 8. Where the real roots are: half of (b)
- 9. \(P_n\) modulo 2, its leading coefficient and its degree
- 1. \(D_n\) divides \(VH_n\) (
- What is not formalized, and what is still open
- Who did what
- Building it yourself
- The source
What Lean checked, and what you still have to read
Lean’s kernel has checked every proof listed here, step by step, from the definitions and Mathlib. None of them contains a sorry (Lean’s placeholder for a missing proof). A small audit file prints the axioms each main theorem depends on, and every one depends only on Lean’s three standard axioms: propext, Classical.choice and Quot.sound. A hidden gap would show up there as sorryAx. So each proof is correct for its statement as written in Lean.
What Lean cannot tell you is whether those statements say what the thesis means. That part is short, and it is the part a reader has to check:
- The four definitions
S,VH,DandP, inTatami/Basic.lean. They are quoted and explained below. - The theorem statements. Each is a few lines, and each is quoted next to its mathematical statement in Results and proofs.
- The scope. Everything is about the polynomial \(VH_n(z)\) as given by the formula of the thesis’s
thm:vdominoes, not about tatami coverings. The thesis derives that formula from the coverings by sorting them by their longest flipped diagonal and flipping diagonals independently. A note left in the thesis source marks the independence of those flips as a step it takes for granted, citing Theorem 2 of Erickson and Schurch (2012). None of that is formalized here: Lean starts from the formula.
To verify the work yourself:
- Read the definitions in
Basic.leanand compare them with the formulas below. - Read the statements of the main theorems, listed in the status table.
- Build the project and run the axiom audit (Building it yourself). The build takes about a minute once Mathlib’s precompiled files are downloaded.
The proofs on this page are written for a person. You don’t need them to trust the results (that is Lean’s job), but they say why each result is true, and where the Lean proof takes a different route from the September 2026 proofs it checks.
Background
A tatami covering of a grid is a covering by monominoes (\(1\times 1\)) and dominoes (\(1\times 2\)) in which no four tiles meet at a point. Let \(\mathbf{T}_n\) be the set of tatami coverings of the \(n\times n\) grid with the maximum number of monominoes, which is \(n\), oriented so that there is a monomino in each of the top-left and top-right corners. My thesis (University of Victoria, 2013, handle 1828/4902), Chapter 4, and the paper with Frank Ruskey, Enumerating maximal tatami mat coverings of square grids with v vertical dominoes (arXiv:1304.0070), count these coverings by their number of vertical dominoes (\(n\) even) or horizontal dominoes (\(n\) odd). Write
\[S_k(z) = \prod_{i=1}^{k}(1+z^i), \qquad S_0 = 1.\]The generating polynomial is given by the formula (thm:vdominoes)
Don Knuth found, from computer experiments for small \(n\), that this polynomial is a product of cyclotomic polynomials and a “mainly mysterious, irreducible polynomial” (private communication, December 2010, as the thesis records). Ruskey and I proved the general form of the cyclotomic part (thm:cyclotomic):
with \(P_n(z)\) a polynomial with integer coefficients. \(P_n\) is the mysterious polynomial. The thesis also proves that \(\deg P_n = \sum_{k=1}^{n-2} \mathrm{Od}(k)\), where \(\mathrm{Od}(k)\) is the largest odd divisor of \(k\) (thm:degpn), and that \(P_n(1) = n\, 2^{\nu(n-2)-1}\), where \(\nu(m)\) is the number of 1s in the binary representation of \(m\) (thm:nu). Those two are not formalized.
For example, \(\mathbf{T}_6\) has 48 coverings, and \(VH_6 = D_6 P_6\) with \(D_6 = S_2S_1\):
\[\begin{aligned} VH_6(z) &= 1 + 2z + 3z^2 + 6z^3 + 9z^4 \\ &\quad + 8z^5 + 7z^6 + 6z^7 + 2z^8 \\ &\quad + 2z^9 + 2z^{10} \\ &= (1+z)^2(1+z^2) \\ &\quad \cdot (1 + z^2 + 2z^3 + 2z^4 \\ &\qquad - 2z^5 + 2z^6). \end{aligned}\]Here are the first few \(P_n\), computed exactly with integer arithmetic. The coefficients are listed from \(z^0\) up.
| \(n\) | \(\deg P_n\) | coefficients of \(P_n\) | \(P_n(1)\) | \(P_n(-1)\) |
|---|---|---|---|---|
| 2 | 0 | 1 |
1 | 1 |
| 3 | 1 | 1 2 |
3 | −1 |
| 4 | 2 | 1 1 2 |
4 | 2 |
| 5 | 5 | 1 1 2 4 0 2 |
10 | −4 |
| 6 | 6 | 1 0 1 2 2 -2 2 |
6 | 6 |
| 7 | 11 | 1 0 1 2 2 4 -2 4 0 2 -2 2 |
14 | −14 |
| 8 | 14 | 1 0 1 1 2 3 4 -2 2 0 4 -2 2 -2 2 |
16 | 20 |
| 9 | 21 | 1 0 1 1 2 3 4 6 -2 6 0 8 -2 4 -4 6 -2 4 -2 2 -2 2 |
36 | −48 |
| 10 | 22 | 1 -1 1 0 1 1 1 2 2 -6 6 -2 6 -6 4 -4 6 -6 6 -4 4 -4 2 |
10 | 70 |
The conjecture
The thesis (Chapter 4) and my 2013 note Three open problems on tatami covers state the following, as conj:Pcon. Here \([z^i]Q\) is the coefficient of \(z^i\) in \(Q\).
Conjecture.
- (a) If \(k\ge 1\) and \(n \pmod{2^k} = 2\), then \([z^i]P_n(z) = [z^i]P_{n+j}(z)\) for \(i \le \frac{n-2}{2^{k-1}}\) and \(j \le 2^k\).
- (b) When \(n\) is odd, \(P_n(z)\) has exactly one real root \(\alpha_n\), with \(-1 < \alpha_n \le -0.5\), and \(\{\alpha_n\}_{n \text{ odd}}\) is a monotonically decreasing sequence.
- (c) When \(n\) is even, \(P_n(z)\) has no real root.
- (d) The polynomial \(P_n(z)\) is irreducible over the integers for \(n \ge 2\). (It should say \(n\ge 3\), since \(P_2 = 1\).)
- (e) The alternating sums of coefficients are given by the generating function \(\sum_{n\ge 2} P_n(-1)\, z^{n-2} = \frac{(1+z)(1-2z)}{(1-2z^2)\sqrt{1-4z^2}}.\)
- (f) For even \(n\), the sum of the absolute values of the coefficients of \(P_n(z)\) is equal to \(P_n(-1)\) when \(n \ge 20\).
The thesis also states a smaller conjecture about \(VH_n\) itself (conj:vhcon):
- (a) For \(k \le n-2\), \([z^k]VH_n(z) = [z^k]\prod_{m\ge 1}(1+z^m)^2\).
- (b) For \(0 \le k < n-3\), \([z^{\deg VH_n - k}]VH_n(z) = 2\,[z^k]\prod_{m\ge 1}(1+z^m)\), twice the number of partitions of \(k\) into distinct parts.
(The thesis writes \(\prod_{m\ge 0}\) in both, a typo: the factor \(1+z^0 = 2\) would make both statements wrong, and the OEIS sequences the thesis cites, A022567 and A000009, are for \(m\ge 1\).)
Status
| Statement | Status | Lean theorem | File |
|---|---|---|---|
thm:cyclotomic |
thesis theorem, now Lean-checked | D_dvd_VH, VH_eq_D_mul_P |
Cyclotomic.lean |
conj:vhcon(a) |
proved | VH_congr_S_sq, conj_vhcon_a |
LowCoefficients.lean |
conj:vhcon(b) |
proved | conj_vhcon_b |
TopCoefficients.lean |
| (a) as printed | false | conjA_as_printed_false, conjA_literal_false |
ConjA.lean |
| (a) with \(j < 2^k\) | proved | conj_a_corrected |
LowCoefficients.lean |
| (b), existence and location | proved: for \(n\ge 4\) every real root is in \((-1,-\tfrac12)\), and every odd \(n\ge 5\) has one | real_root_mem, odd_has_real_root_in |
RealRoots.lean |
| (b), uniqueness and monotonicity | open | ||
| (c) | proved | conj_c |
ConjC.lean |
| (d) | open; the structure of \(P_n\) mod 2 is proved | P_mod_two (and S_sq_eq_D_mul_B, P_leadingCoeff, natDegree_P_eq) |
ModTwo.lean, TopDegree.lean |
| (e) | proved, as the values \(P_n(-1)\) | P_eval_neg_one_even, P_eval_neg_one_odd, conj_e |
AtMinusOne.lean, AtMinusOneOdd.lean |
| (f) | open; not formalized |
The definitions in Lean
Here is the heart of Tatami/Basic.lean, quoted exactly. ℤ[X] is the ring of polynomials with integer coefficients, X is the variable, and Finset.Icc 1 k is the set \(\{1, \dots, k\}\).
/-- `S k = (1 + X) (1 + X²) ⋯ (1 + X^k)`, and `S 0 = 1` (the empty product). -/
noncomputable def S (k : ℕ) : ℤ[X] := ∏ i ∈ Finset.Icc 1 k, (1 + X ^ i)
/-- `VH n`, thesis `thm:vdominoes`:
`VH_n(z) = 2 ∑_{i=1}^{⌊(n−1)/2⌋} S_{n−i−2}(z) S_{i−1}(z) z^{n−i−1} + S_{⌊(n−2)/2⌋}(z)²`. -/
noncomputable def VH (n : ℕ) : ℤ[X] :=
2 * ∑ i ∈ Finset.Icc 1 ((n - 1) / 2), S (n - i - 2) * S (i - 1) * X ^ (n - i - 1)
+ S ((n - 2) / 2) ^ 2
/-- `D n = ∏_{j ≥ 1} S_{⌊(n−2)/2^j⌋}`, thesis `thm:cyclotomic`. The factors with
`2^j > n − 2` are `S 0 = 1`, so stopping the product at `j = n` changes nothing. -/
noncomputable def D (n : ℕ) : ℤ[X] := ∏ j ∈ Finset.Icc 1 n, S ((n - 2) / 2 ^ j)
/-- The mysterious polynomial `P n = VH n / D n`. Here `/ₘ` is division by a monic
polynomial. That the division is exact is thesis `thm:cyclotomic`, proved in
`Tatami.Cyclotomic` as `Tatami.D_dvd_VH`, which gives `VH n = D n * P n`. -/
noncomputable def P (n : ℕ) : ℤ[X] := VH n /ₘ D n
Two Lean conventions matter when you compare these with the formulas:
- Subtraction of natural numbers is truncated:
n - 2is 0 whenn < 2. In the range the sum actually runs over (n ≥ 2and1 ≤ i ≤ (n−1)/2), none ofn − i − 2,i − 1andn − i − 1is truncated, so the formula is the thesis’s. The lemmaVH_add_tworestatesVH (N + 2)without any subtraction that could truncate. - Division of natural numbers is floor division:
7 / 2 = 3, so(n - 1) / 2is \(\lfloor (n-1)/2 \rfloor\) and(n - 2) / 2 ^ jis \(\lfloor (n-2)/2^j \rfloor\).
\(D_n\) is a product of monic polynomials, so it is monic, and /ₘ (Mathlib’s division by a monic polynomial) gives a quotient and a remainder. The remainder is zero by thm:cyclotomic, proved below, so P n is the exact quotient. The lemma P_eq_of_VH_eq says it is the only polynomial \(Q\) with \(VH_n = D_n Q\); the counterexamples to (a) use it to compute \(P_4\), \(P_6\) and \(P_{10}\) exactly.
The other Mathlib notions that appear in the statements are standard: (P n).coeff i is \([z^i]P_n\), (P n).eval (-1) is \(P_n(-1)\) over the integers, aeval x (P n) is \(P_n(x)\) for a real \(x\), cyclotomic d ℤ is \(\Phi_d\), and Nat.centralBinom a is \(\binom{2a}{a}\).
Results and proofs
Throughout, \(N = n-2\), and “\(F \equiv G \pmod{z^K}\)” means that \(F\) and \(G\) have the same coefficients of \(z^0, \dots, z^{K-1}\) (in Lean, X ^ K ∣ F - G). With \(N\), the formula reads
Two facts about \(S_k\) are used over and over:
- \(S_{k+1} = S_k\,(1+z^{k+1})\), and
- \(S_b \equiv S_a \pmod{z^{a+1}}\) whenever \(a \le b\), because the extra factors \(1+z^t\) all have \(t > a\) (
S_sub_S_dvd).
1. \(D_n\) divides \(VH_n\) (thm:cyclotomic)
Theorem. For every \(n\), \(D_n \mid VH_n\) in \(\mathbb{Z}[z]\). Hence \(VH_n = D_n P_n\).
theorem D_dvd_VH (n : ℕ) : D n ∣ VH n
theorem VH_eq_D_mul_P (n : ℕ) : VH n = D n * P n
Proof. This is the thesis’s proof: count how often each cyclotomic polynomial divides each side. For \(i\ge 1\), \(1+z^i = (z^{2i}-1)/(z^i-1) = \prod \Phi_d\) over the divisors \(d\) of \(2i\) that do not divide \(i\). So \(\Phi_d\) divides \(S_k\) exactly
\[c(k,d) = \#\{1\le i\le k : d \mid 2i,\ d\nmid i\}\]times. If \(d\) is odd, \(d\mid 2i\) forces \(d \mid i\), so \(c(k,d)=0\). If \(d = 2j\), the condition says \(j \mid i\) and \(i/j\) is odd, so \(c(k,2j) = \lfloor k/j\rfloor - \lfloor k/2j\rfloor\).
In \(D_{N+2} = \prod_{l\ge 1} S_{\lfloor N/2^l\rfloor}\), put \(x_l = \lfloor N/(2^l j)\rfloor\). The exponent of \(\Phi_{2j}\) is \(\sum_{l\ge1} (x_l - x_{l+1})\), which telescopes to \(x_1 = \lfloor N/2j\rfloor\).
Every term of \(VH_{N+2}\) is a multiple of a product \(S_a S_b\) with \(a+b+1 \ge N\): for the sum terms \((N-i)+(i-1)+1 = N\), and for the square \(2\lfloor N/2\rfloor + 1 \ge N\). Put \(A = \lfloor a/j\rfloor\) and \(B = \lfloor b/j\rfloor\). The exponent of \(\Phi_{2j}\) in \(S_aS_b\) is
\[\begin{aligned} \Big(A - \big\lfloor \tfrac{A}{2}\big\rfloor\Big) + \Big(B - \big\lfloor \tfrac{B}{2}\big\rfloor\Big) &= \big\lceil \tfrac{A}{2}\big\rceil + \big\lceil \tfrac{B}{2}\big\rceil \\ &\ge \Big\lfloor \tfrac{A+B+1}{2}\Big\rfloor \\ &\ge \Big\lfloor \tfrac{\lfloor N/j\rfloor}{2}\Big\rfloor = \Big\lfloor \tfrac{N}{2j}\Big\rfloor, \end{aligned}\]because \(\lfloor N/j\rfloor \le \lfloor (a+b+1)/j\rfloor \le A+B+1\). So every cyclotomic factor occurs in \(D_{N+2}\) at most as often as in \(S_aS_b\), and \(D_{N+2}\) divides every term. ∎
In Lean, S_eq_prod_cyclotomic writes each \(S_k\) as \(\prod_d \Phi_d^{c(k,d)}\), cnt_even and cnt_odd compute \(c\), cnt_D_le is the inequality above, and D_dvd_S_mul_S concludes. The cases \(n<2\) are checked directly.
2. Conjecture (a), as printed, is false
ConjA_as_printed transcribes (a) word for word, reading “\(n \pmod{2^k} = 2\)” as the congruence \(n\equiv 2 \pmod{2^k}\):
def ConjA_as_printed : Prop :=
∀ k n i j : ℕ, 1 ≤ k → n % 2 ^ k = 2 % 2 ^ k → i ≤ (n - 2) / 2 ^ (k - 1) → j ≤ 2 ^ k →
(P n).coeff i = (P (n + j)).coeff i
theorem conjA_as_printed_false : ¬ ConjA_as_printed
theorem conjA_literal_false :
¬ ∀ k n i j : ℕ, 2 ≤ k → n % 2 ^ k = 2 → i ≤ (n - 2) / 2 ^ (k - 1) → j ≤ 2 ^ k →
(P n).coeff i = (P (n + j)).coeff i
Proof. Take \(n = 4\), \(k = 1\), \(j = 2\), \(i = 1\): then \(4 \equiv 2 \pmod 2\), \(i \le (4-2)/1\) and \(j \le 2\), but
\[\begin{aligned} P_4 &= 1 + z + 2z^2, \\ P_6 &= 1 + 0\cdot z + z^2 + 2z^3 + 2z^4 - 2z^5 + 2z^6 \end{aligned}\]differ at \(z^1\). Read literally, “\(n \bmod 2^k = 2\)” rules out \(k=1\), and the statement still fails: at \(n=6\), \(k=2\), \(j=4\), \(i=1\), \([z]P_6 = 0\) but \([z]P_{10} = -1\). ∎
Lean computes P 4, P 6 and P 10 exactly: it expands \(VH_n\) and \(D_n\) symbolically and checks \(VH_n = D_n Q\) for the claimed \(Q\) with ring, then applies P_eq_of_VH_eq. The September 2026 report also shows that (a) fails for every \(j = 2^k\) once \(n\ge 4\), and gives an exact rule for where two \(P_n\) first differ; neither is formalized.
3. Lemma A: the low coefficients of \(VH_n\) (conj:vhcon(a))
Theorem (Lemma A). \(VH_{N+2} \equiv S_N^2 \pmod{z^{N+1}}\). Consequently, for \(k \le n-2\), \([z^k]VH_n = [z^k]S_K^2\) for every \(K\ge n-2\), which is \([z^k]\prod_{m\ge1}(1+z^m)^2\): conj:vhcon(a).
theorem VH_congr_S_sq (N : ℕ) : X ^ (N + 1) ∣ S N ^ 2 - VH (N + 2)
theorem conj_vhcon_a (N k K : ℕ) (hk : k ≤ N) (hK : N ≤ K) :
(VH (N + 2)).coeff k = (S K ^ 2).coeff k
Proof. This is the algebraic proof the Lean file uses (the September report proves it through a model of pairs of sets). Since \(N - \lceil N/2\rceil = \lfloor N/2\rfloor\), the telescoping sum
\[\begin{aligned} &S_N^2 - S_{\lfloor N/2\rfloor}^2 \\ &\quad = \sum_{i=1}^{\lceil N/2\rceil}\big(S_{N+1-i}^2 - S_{N-i}^2\big) \end{aligned}\]gives
\[\begin{aligned} S_N^2 - VH_{N+2} &= \sum_{i=1}^{\lceil N/2\rceil} E_i, \\ E_i &= S_{N+1-i}^2 - S_{N-i}^2 \\ &\quad - 2\,S_{N-i}S_{i-1}z^{N+1-i}. \end{aligned}\]With \(S_{N+1-i} = S_{N-i}(1+z^{N+1-i})\), each \(E_i\) equals
\[\begin{aligned} &2z^{N+1-i}\,S_{N-i}\,\big(S_{N-i} - S_{i-1}\big) \\ &\quad + z^{2(N+1-i)}\,S_{N-i}^2 . \end{aligned}\]Since \(i \le \lceil N/2\rceil\), we have \(i-1 \le N-i\), so \(z^i\) divides \(S_{N-i} - S_{i-1}\), and the first part is divisible by \(z^{N+1}\). Also \(2(N+1-i) \ge N+1\), so the second part is too. ∎
The September report also finds the exact defect: \([z^{n-1}]VH_n = [z^{n-1}]\prod(1+z^m)^2 - n\). That is not formalized.
4. Conjecture (a), corrected
Theorem. If \(k\ge1\), \(n \ge 2\), \(n\equiv 2\pmod{2^k}\) and \(0\le j<2^k\), then \([z^i]P_n = [z^i]P_{n+j}\) for all \(i \le (n-2)/2^{k-1}\).
theorem conj_a_corrected (k n j : ℕ) (hk : 1 ≤ k) (hn2 : 2 ≤ n) (hn : n % 2 ^ k = 2 % 2 ^ k)
(hj : j < 2 ^ k) (i : ℕ) (hi : i ≤ (n - 2) / 2 ^ (k - 1)) :
(P n).coeff i = (P (n + j)).coeff i
Proof. This is shorter than the September report’s proof, which goes through its exact rule for the first difference. Write \(n - 2 = 2^k q\), so the bound is \(M = (n-2)/2^{k-1} = 2q\), and put \(n' = n+j\).
- \(VH_n \equiv VH_{n'} \pmod{z^{n-1}}\). By Lemma A, \(VH_n \equiv S_{n-2}^2\) and \(VH_{n'} \equiv S_{n'-2}^2\), and \(S_{n'-2}^2 \equiv S_{n-2}^2 \pmod{z^{n-1}}\). Since \(n - 1 \ge 2q+1\), the congruence holds mod \(z^{M+1}\).
- \(D_n \equiv D_{n'} \pmod{z^{M+1}}\), factor by factor. Write \(N = 2^kq\) and compare \(S_{\lfloor N/2^l\rfloor}\) with \(S_{\lfloor (N+j)/2^l\rfloor}\). For \(l<k\), \(\lfloor N/2^l\rfloor = 2^{k-l}q \ge 2q\), so both indices are at least \(2q\) and the two factors agree mod \(z^{2q+1}\). For \(l\ge k\), \(\lfloor (N+j)/2^k\rfloor = q = \lfloor N/2^k\rfloor\) because \(j<2^k\), so the indices are equal.
- \(D_n(P_n - P_{n'}) = (VH_n - VH_{n'}) - (D_n - D_{n'})P_{n'} \equiv 0 \pmod{z^{M+1}}\). \(D_n\) has constant term 1, so it is coprime to \(z^{M+1}\), and \(z^{M+1}\) divides \(P_n - P_{n'}\). ∎
The report also proves that this bound is sharp for \(2^{k-1}\le j<2^k\), and a sharper form of (a); those are not formalized.
5. The top coefficients of \(VH_n\) (conj:vhcon(b))
Theorem. For \(k \le N-2\) (that is, \(k < n-3\)), the coefficient \(k\) places below the top of \(VH_{N+2}\) is \(2[z^k]S_K\) for any \(K\ge k\), which is twice the number of partitions of \(k\) into distinct parts.
theorem conj_vhcon_b (N k K : ℕ) (hk : k + 2 ≤ N) (hK : k ≤ K) :
(VH (N + 2)).coeff ((VH (N + 2)).natDegree - k) = 2 * (S K).coeff k
Proof. \(\deg S_k = k(k+1)/2\), and \(S_k\) is a palindrome: \(z^{\deg S_k}S_k(1/z) = S_k(z)\). The \(i\)-th sum term \(z^{N+1-i}S_{N-i}S_{i-1}\) has degree \(e_i\) with
\[\begin{aligned} e_1 &= \frac{N(N+1)}{2}, \\ e_1 - e_i &= (i-1)(N+1-i) \ge N-1 \quad (i\ge 2), \end{aligned}\]and the square term has degree \(m(m+1)\) with \(m = \lfloor N/2\rfloor\), which is \(m^2\) or \((m+1)^2\) below \(e_1\), again at least \(N-1\). So the top \(N-1\) coefficients of \(VH_{N+2}\) come from the \(i=1\) term \(2z^N S_{N-1}\) alone. By the palindrome property, the coefficient \(k\) below its top is \(2[z^k]S_{N-1}\), and \([z^k]S_{N-1} = [z^k]S_K\) because \(k \le \min(N-1, K)\). ∎
6. Conjecture (e): the value \(P_n(-1)\)
Theorem. For \(n\ge2\),
\[P_n(-1) = \begin{cases} \dbinom{n-2}{(n-2)/2} & n \text{ even},\\[2ex] -\displaystyle\sum_{i=0}^{k} 2^{k-i}\binom{2i}{i} & n = 2k+3 \text{ odd}.\end{cases}\]theorem P_eval_neg_one_even {n : ℕ} (hn : Even n) :
(P n).eval (-1) = (Nat.centralBinom ((n - 2) / 2) : ℤ)
theorem P_eval_neg_one_odd (k : ℕ) :
(P (2 * k + 3)).eval (-1) = -∑ i ∈ Finset.range (k + 1), 2 ^ (k - i) * (Nat.centralBinom i : ℤ)
theorem conj_e (n : ℕ) (hn : 2 ≤ n) :
(P n).eval (-1) = if n % 2 = 0 then (Nat.centralBinom ((n - 2) / 2) : ℤ)
else -∑ i ∈ Finset.range ((n - 3) / 2 + 1), 2 ^ ((n - 3) / 2 - i) * (Nat.centralBinom i : ℤ)
These are exactly the coefficients of the generating function in (e); the last step, from the values to the closed form, is classical and not formalized.
The method. You can’t substitute \(z=-1\) into \(VH_n/D_n\), because both vanish there. Instead, substitute \(z = w-1\) and compare lowest powers of \(w\). Say \(F\) has order at least \(k\) with leading constant \(L\) at \(-1\) if \(F(w-1) = w^k\,(L + w\,G(w))\) for some polynomial \(G\) (in Lean, HasLead F k L). This is multiplicative (orders add, constants multiply) and additive at a common order.
- \(1+z^i\) has order 1 and constant \(i\) when \(i\) is odd, since \((1+z^i)/(1+z) = 1 - z + \cdots + z^{i-1}\) equals \(i\) at \(-1\); and order 0 and constant 2 when \(i\) is even.
- So \(S_k\) has order \(\lceil k/2\rceil\) and constant \(\mathrm{lead}(k)\), the product of the odd \(i\le k\) times a factor 2 for each even \(i \le k\). This is \(k!/\lfloor k/2\rfloor!\).
- \(D_{N+2}\) has order \(\lfloor N/2\rfloor\) and constant \(\lfloor N/2\rfloor!\). With \(m_l = \lfloor N/2^l\rfloor\), the orders add up to \(\sum_{l}\lceil m_l/2\rceil\), which telescopes to \(m_1\) because \(\lceil m_l/2\rceil = m_l - m_{l+1}\); the constants multiply to \(\prod_l m_l!/m_{l+1}! = m_1!\).
- If \(VH_n\) and \(D_n\) both have order \(k\), with constants \(c\) and \(d\), then \(d\cdot P_n(-1) = c\), because \(VH_n = D_nP_n\) (
eval_P_of_hasLead).
Even \(n = 2a+2\). Here
\[VH_n = S_a^2 + 2\sum_{i=1}^{a} S_{2a-i}S_{i-1}z^{2a+1-i}.\]Since \((2a-i)+(i-1)\) is odd, each sum term has order exactly \(a\), with constant \(2(-1)^{i+1}t_i\) where \(t_i = \mathrm{lead}(2a-i)\,\mathrm{lead}(i-1)\). From \(\mathrm{lead}(2b) = 2\,\mathrm{lead}(2b-1)\) we get \(t_{2c} = t_{2c+1}\) whenever \(2c+1\le a\), so neighbouring terms cancel in pairs, and
\[\sum_{i=1}^{a}(-1)^{i+1}t_i = t_1 - [a \text{ even}]\,t_a .\]The square term \(S_a^2\) has order \(2\lceil a/2\rceil\): when \(a\) is odd it vanishes to higher order and contributes nothing at order \(a\); when \(a\) is even it contributes \(\mathrm{lead}(a)^2 = 2t_a\) and cancels the leftover. Either way the constant of \(VH_{2a+2}\) at order \(a\) is \(2t_1 = 2\,\mathrm{lead}(2a-1) = \mathrm{lead}(2a)\) (for \(a = 0\), \(VH_2 = D_2 = 1\) directly), and
\[\begin{aligned} P_{2a+2}(-1) &= \frac{\mathrm{lead}(2a)}{a!} \\ &= \frac{(2a)!}{a!\,a!} = \binom{2a}{a}. \end{aligned}\]Odd \(n = 2a+3\). Now
\[VH_n = 2\sum_{i=1}^{a+1} S_{2a+1-i}S_{i-1}z^{2a+2-i} + S_a^2 .\]The term with \(i = 2c+1\) has order \(a\) and constant \(-2T(a,c)\), where \(T(a,c) = \mathrm{lead}(2a-2c)\,\mathrm{lead}(2c)\); the terms with even \(i\) have order \(a+1\) and drop out; the square contributes \(T(a,a/2)\) when \(a\) is even. Because \(T(a,c) = T(a,a-c)\), these fold into \(-U(a)\) with \(U(a) = \sum_{c=0}^{a}T(a,c)\).
The September report evaluates \(U(a)\) with Euler’s Beta integral. The Lean proof uses a finite recurrence instead. From \(\mathrm{lead}(2b+2) = 2(2b+1)\,\mathrm{lead}(2b)\),
\[\begin{aligned} &T(a+1,c+1) + T(a+1,c) \\ &\quad = \big(2(2c+1) + 2(2a-2c+1)\big)\,T(a,c) \\ &\quad = 4(a+1)\,T(a,c), \end{aligned}\]and summing over \(0\le c\le a\), with \(T(a+1,a+1) = T(a+1,0)\),
\[U(a+1) = 2(a+1)\,U(a) + T(a+1,0).\]With \(R(a) = \sum_{i=0}^{a}2^{a-i}\binom{2i}{i}\), which satisfies \(R(a+1) = 2R(a) + \binom{2a+2}{a+1}\), and \(T(a+1,0) = \mathrm{lead}(2a+2) = \binom{2a+2}{a+1}(a+1)!\), induction gives \(U(a) = a!\,R(a)\). So \(P_{2a+3}(-1) = -U(a)/a! = -R(a)\). ∎
From the values to the generating function
This step is not in Lean; it is the standard computation from the report. With \(\sum_a \binom{2a}{a}y^a = (1-4y)^{-1/2}\) and \(\sum_a R(a)\,y^a = (1-2y)^{-1}(1-4y)^{-1/2}\), put \(y = z^2\):
\[\begin{aligned} \sum_{n\ge2}P_n(-1)z^{n-2} &= \frac{1}{\sqrt{1-4z^2}} - \frac{z}{(1-2z^2)\sqrt{1-4z^2}} \\ &= \frac{1 - z - 2z^2}{(1-2z^2)\sqrt{1-4z^2}} \\ &= \frac{(1+z)(1-2z)}{(1-2z^2)\sqrt{1-4z^2}}. \end{aligned}\]7. Conjecture (c): no real roots for even \(n\)
Theorem. For even \(n\), \(P_n(x)\ne0\) for every real \(x\).
theorem conj_c {n : ℕ} (hn : Even n) (x : ℝ) : aeval x (P n) ≠ 0
Proof. \(D_n(x)\) is a product of factors \(1+x^i\), none of which vanishes at a real \(x\ne-1\). So away from \(-1\), a root of \(P_n\) would be a root of \(VH_n = D_nP_n\). At \(x=-1\), \(P_n(-1) = \binom{n-2}{(n-2)/2} \ne 0\) by (e). It remains to show \(VH_n(x)\neq0\) on three ranges (conj_c_of_VH). Write \(n = 2h+2\) and
Consecutive terms satisfy
\[t_{i+1}\cdot x\,(1+x^{2h-i}) = t_i\,(1+x^i). \tag{R}\]\(x\ge0\). Every coefficient of \(VH_n\) is nonnegative and the constant term is positive. (VH_pos_of_nonneg)
\(-1<x<0\). This is Theorem 1 of the September root-gap report. Every factor \(1+x^i\) is positive, so every \(S_k(x)>0\), and \(t_i\) has the sign \((-1)^{i+1}\). For \(i = 2c\) with \(2c+1\le h\), both \(2c\) and \(2h-2c\) are even and \(2c < 2h-2c\), so (R) gives
\[\frac{\vert t_{2c+1}\vert }{\vert t_{2c}\vert } = \frac{1+x^{2c}}{\vert x\vert \,(1+x^{2h-2c})} > 1 .\]So \(t_1>0\) and every pair \(t_{2c}+t_{2c+1}\) is positive. If \(h\) is odd, that accounts for every term and \(VH_n(x)>0\). If \(h\) is even, one negative term \(t_h = S_hS_{h-1}x^{h+1}\) is left over, and the square beats it:
\[S_h^2 + 2t_h = S_h S_{h-1}\,\big(1 + x^h(1+2x)\big) > 0,\]since \(\vert x^h(1+2x)\vert <1\). (VH_pos_of_neg_one_lt_of_neg)
\(x<-1\). The September report proves this through a reciprocal polynomial; the Lean proof works with \(x\) directly. Here \(i\) and \(2h-i\) have the same parity and \(i \le 2h-i\), so \(\vert 1+x^i\vert \le \vert 1+x^{2h-i}\vert\) with both of the same sign, and by (R) \(t_{i+1} = \rho_i t_i\) with \(-1<\rho_i<0\): the terms alternate in sign and shrink. The first term \(t_1 = S_{2h-1}(x)\,x^{2h}\) has the sign \((-1)^h\), one minus sign for each odd \(i\le 2h-1\).
- \(h\) even: \(t_1>0\), so the alternating sum is positive and \(VH_n(x)>0\).
- \(h\) odd: \(t_1<0\). Pairing from the front, \(\sum t_i \le t_h\), so \(VH_n(x) \le S_h^2 + 2t_h = S_hS_{h-1}\big(1 + x^h(1+2x)\big)\). Here \(x^h(1+2x) > 0\), while \(S_hS_{h-1} = S_{h-1}^2(1+x^h) < 0\), so \(VH_n(x)<0\). ∎ (
VH_ne_zero_of_lt_neg_one)
8. Where the real roots are: half of (b)
Theorem. For \(n\ge4\), every real root of \(P_n\) lies in the open interval \((-1,-\tfrac12)\). For odd \(n\ge5\), \(P_n\) has a real root there.
theorem real_root_mem {n : ℕ} (hn : 4 ≤ n) {x : ℝ} (hx : aeval x (P n) = 0) :
-1 < x ∧ x < -1 / 2
theorem odd_has_real_root_in {n : ℕ} (ho : Odd n) (h5 : 5 ≤ n) :
∃ x : ℝ, -1 < x ∧ x < -1 / 2 ∧ aeval x (P n) = 0
For \(n=3\), \(P_3 = 1+2z\) has its root exactly at \(-\tfrac12\), the equality case in (b). Uniqueness of the root for odd \(n\), and monotonicity of \(\alpha_n\), are still open.
Proof. Even \(n\) have no real roots at all, by (c). For odd \(n = 2m+3\ge5\), away from \(-1\) a root of \(P_n\) is a root of \(VH_n\), and at \(-1\), \(P_n(-1) = -R(m) < 0\) by (e). Write
\[\begin{aligned} t_i &= S_{2m+1-i}(x)\,S_{i-1}(x)\,x^{2m+2-i}, \\ VH_n(x) &= 2\sum_{i=1}^{m+1}t_i + S_m(x)^2, \end{aligned}\]with \(t_{i+1}\cdot x\,(1+x^{2m+1-i}) = t_i\,(1+x^i)\). These are Theorems A and B of the September real-roots report.
\(x<-1\) (VH_ne_zero_of_lt_neg_one_odd). Now \(i\) and \(2m+1-i\) have opposite parities, so exactly one of \(1+x^i\) and \(1+x^{2m+1-i}\) is negative, and the ratio \(t_{i+1}/t_i\) is positive: every \(t_i\) has the sign of \(t_1 = S_{2m}(x)\,x^{2m+1}\), which is \((-1)^{m+1}\).
- \(m\) odd: every term of \(VH_n(x)\) is positive.
- \(m\) even: every \(t_i<0\), so \(VH_n(x) \le 2t_1 + S_m^2\). For each \(i\le m\), \(i\) and \(i+m\) have the same parity and \(\vert 1+x^i\vert \le \vert 1+x^{i+m}\vert\), so \(S_m(x)^2 \le \vert S_{2m}(x)\vert \le \vert t_1\vert\), and \(VH_n(x) \le 2t_1 + \vert t_1\vert = t_1 < 0\). (This is the even-\(m\) half of the report’s Lemma 1; the odd half is never used.)
\(-\tfrac12\le x<0\) (VH_pos_of_neg_half_le_odd). Every \(S_k(x)>0\) and \(t_i\) has the sign \((-1)^i\). For \(2\le i\le m\), \(\vert x\vert \,\vert 1+x^j\vert \le \tfrac12\cdot\tfrac32 = \tfrac34 \le \vert 1+x^i\vert\), so \(\vert t_i\vert \le\vert t_{i+1}\vert\). Pairing from \(t_3\) gives \(\sum t_i \ge t_1 + t_2 - \vert t_{m+1}\vert\). The ratio identity at \(i=1\) gives \(t_1 + t_2 \ge -t_2/2\), and \(t_2 \le \vert t_{m+1}\vert = \vert x\vert ^{m+1}S_m^2 \le S_m^2/4\). So
This replaces the numerical constants of the report (0.419, 1.356 and 6.48, which are correct but tight: \(\prod_k(1-2^{1-2k}) = 0.41942\ldots\)) with the chain \(\vert t_1\vert \le\tfrac32 t_2\), \(t_2\le\vert t_{m+1}\vert\).
\(x\ge0\). As in (c), \(VH_n(x)>0\).
So every real root is in \((-1,-\tfrac12)\). For existence (odd_has_real_root), \(P_n(-1)<0\) and \(P_n(0) = 1\) (the constant term of \(VH_n\) and of \(D_n\) is 1), so the intermediate value theorem gives a root in \((-1,0)\), which then lies in \((-1,-\tfrac12)\). ∎
9. \(P_n\) modulo 2, its leading coefficient and its degree
Let \(m = \lfloor (n-2)/2\rfloor\), \(J = \{1\le j\le m : (m \bmod 2j)\ge j\}\) and \(B_n = \prod_{j\in J}\Phi_{2j}\). These are Theorem 1 (a) to (d) of the September irreducibility report.
def Jset (m : ℕ) : Finset ℕ := (Finset.Icc 1 m).filter (fun j => j ≤ m % (2 * j))
noncomputable def B (n : ℕ) : ℤ[X] := ∏ j ∈ Jset ((n - 2) / 2), cyclotomic (2 * j) ℤ
theorem S_sq_eq_D_mul_B (n : ℕ) : S ((n - 2) / 2) ^ 2 = D n * B n
theorem P_mod_two (n : ℕ) :
(P n).map (Int.castRingHom (ZMod 2)) = (B n).map (Int.castRingHom (ZMod 2))
theorem P_leadingCoeff {n : ℕ} (hn : 3 ≤ n) : (P n).leadingCoeff = 2
theorem natDegree_P_eq {n : ℕ} (hn : 3 ≤ n) :
(P n).natDegree = (B n).natDegree + ((n - 1) / 2) ^ 2
(a) \(S_m^2 = D_n B_n\). By the count in section 1, \(\Phi_{2j}\) occurs \(\lfloor (n-2)/2j\rfloor = \lfloor m/j\rfloor\) times in \(D_n\) (as \(n-2\in\{2m,2m+1\}\)) and \(\lfloor m/j\rfloor - \lfloor m/2j\rfloor\) times in \(S_m\). Writing \(m = 2jq + r\) with \(0\le r<2j\), these are \(2q + [r\ge j]\) and \(q + [r\ge j]\), so \(\Phi_{2j}\) occurs in \(S_m^2/D_n\) exactly \([r \ge j]\) times: once if \(j\in J\), otherwise not at all.
(b) \(P_n \equiv B_n \pmod 2\). Write \(VH_n = 2A_n + S_m^2\). Then \(D_n(P_n - B_n) = 2A_n\). Reduce mod 2: \(\bar D_n(\bar P_n - \bar B_n) = 0\) in \(\mathbb{F}_2[z]\), and \(\bar D_n\) is monic, hence not zero, so \(\bar P_n = \bar B_n\). For example \(P_4 = 1+z+2z^2 \equiv \Phi_2\) and \(P_6 \equiv 1+z^2 = \Phi_4\). Since \(B_n\) depends only on \(m\), \(P_{2m+2}\equiv P_{2m+3}\pmod 2\).
(c) The leading coefficient of \(P_n\) is 2 for \(n\ge3\). As in section 5, only the \(i=1\) term \(2z^NS_{N-1}\) reaches the top degree \(N(N+1)/2\) of \(VH_{N+2}\) when \(N\ge1\), so \(VH_n\) has leading coefficient 2, and \(D_n\) is monic.
(d) \(\deg P_n = \deg B_n + \lfloor (n-1)/2\rfloor^2\) for \(n\ge3\). \(\deg P_n - \deg B_n = (\deg VH_n - \deg D_n) - (\deg S_m^2 - \deg D_n) = N(N+1)/2 - m(m+1)\), which is \(m^2\) for \(n = 2m+2\) and \((m+1)^2\) for \(n=2m+3\). ∎
The report goes on to show, with Newton polygons over the 2-adic numbers, that any factorization of \(P_n\) over \(\mathbb{Z}\) must split off a small monic factor whose roots are units; that step is not formalized (Mathlib has no Newton polygons), and (d) remains open.
What is not formalized, and what is still open
Open, with no proof for Lean to check:
- (b): that the real root of \(P_n\) is unique for odd \(n\), and that \(\alpha_n\) decreases. Exact computation finds exactly one real root for every odd \(n\le401\), and certifies that \(\alpha_n\) decreases for odd \(5\le n\le 399\).
- (d): irreducibility. Exact computation confirms it for \(3\le n\le245\) (the thesis checked \(1<n<200\)).
- (f), in the middle of \(P_n\). Exact computation confirms (f) for every even \(n\) with \(20\le n\le460\).
Proved in September 2026 (by AI agents, checked by AI referees), but not formalized:
- (f) in both end windows, the first \(n-1\) and last \(n-3\) coefficients, for every even \(n\ge20\). The proof cites DeSalvo and Pak’s log-concavity of the partition function, which has no Lean formalization the AI could find, and an exact computation up to about \(n = 10{,}000\), too large to redo in Lean’s checker.
- The 2-adic Newton-polygon step towards (d) (Mathlib has no Newton polygons).
- That all but \(O(n)\) zeros of \(P_n\) lie near the unit circle, with evenly spread arguments. The proof needs the Erdős–Turán theorem.
- The exact rule for where \(P_n\) and \(P_{n'}\) first differ, the sharp forms of (a), the defect \(-n\) in Lemma A, the explicit product formulas for both ends of \(P_n\), and a formula for \(P_n\) as a sum of products of distinct cyclotomic polynomials.
Thesis results not formalized: \(\deg P_n = \sum_{k\le n-2}\mathrm{Od}(k)\) (thm:degpn) and \(P_n(1) = n2^{\nu(n-2)-1}\) (thm:nu). And, as above, the step from coverings to the formula for \(VH_n\).
Who did what
- The thesis results (the formula for \(VH_n\),
thm:cyclotomic,thm:degpn,thm:nu, and the conjecturesconj:Pconandconj:vhcon) are mine, with Frank Ruskey; Don Knuth first noticed the factorization for small \(n\). - The September 2026 proofs were written by AI agents. A separate AI referee agent checked each one, and every step was also checked by exact computation.
- The November 2026 Lean formalization was written by AI, with two helper agents writing the real-inequality files (
RealVH.leanandRealVHOdd.lean), and checked by Lean. It found no mathematical error in the September proofs it formalized, and it simplified some of them, as noted in each section.
Building it yourself
The project is pinned to Lean v4.36.0 (lean-toolchain) and Mathlib v4.36.0 (lakefile.toml; lake-manifest.json fixes the commit, fc4f59e577feb1a4956671bc04ac18aaaf8cd842). Install Lean with elan, download tatami-lean.zip, and check it:
shasum -a 256 tatami-lean.zip
# 2518b9c77ad3f3ebf4326eee07b2328553496aa8f62004f99b43079c14eb0355
unzip tatami-lean.zip && cd tatami-lean
lake exe cache get # precompiled Mathlib, a few GB, once
lake build # checks every proof
lake env lean Audit/Axioms.lean # the axioms each main theorem uses
On 2026-11-24 my AI agent rebuilt the 15 library files from scratch on my Apple-silicon Mac, with Mathlib’s precompiled files already in place. It took 1 minute 7 seconds and ended with
Build completed successfully (18282 jobs).
The build prints 37 warnings and no errors: 34 are deprecation notices for the Mathlib lemmas if_pos and if_neg, 2 suggest Lean’s new module system for Basic.lean, and 1 is an unused variable name in ModTwo.lean. No file contains sorry, admit, axiom or native_decide. The axiom audit printed:
'Tatami.D_dvd_VH' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.VH_eq_D_mul_P' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conjA_as_printed_false' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conjA_literal_false' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conj_a_corrected' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conj_vhcon_a' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conj_vhcon_b' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.P_eval_neg_one_even' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.P_eval_neg_one_odd' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conj_e' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.conj_c' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.odd_has_real_root' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.S_sq_eq_D_mul_B' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.P_mod_two' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.P_leadingCoeff' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.natDegree_P_eq' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.real_root_mem' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.odd_has_real_root_in' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.VH_ne_zero_of_lt_neg_one_odd' depends on axioms: [propext, Classical.choice, Quot.sound]
'Tatami.VH_pos_of_neg_half_le_odd' depends on axioms: [propext, Classical.choice, Quot.sound]
To step through a proof, open the folder in VS Code with the Lean 4 extension and put the cursor inside it: the goal view shows what is left to prove at each step.
The source
All 17 Lean files (2,637 lines) are on the source page, in import order, exactly as committed. The file that matters most for checking is Tatami/Basic.lean, 70 lines.