Skip to the content.

Pentagonal Number Theorem

A Lean 4 / Mathlib formalization of Euler’s Pentagonal Number Theorem and the Jacobi Triple Product, together with a written-out, machine-checkable blueprint of the proof structure.

The theorem

For $|q| < 1$,

\[\prod_{i=1}^{\infty}(1-q^i) \;=\; 1+\sum_{k=1}^\infty (-1)^k\,\bigl(q^{(3k^2-k)/2}+q^{(3k^2+k)/2}\bigr) \;=\; \sum_{k\in\mathbb{Z}}(-1)^k\,q^{(3k^2-k)/2}.\]

The exponents $(3k^2-k)/2$ are the generalized pentagonal numbers.

Two independent proof routes

This repository formalizes the result twice, by genuinely different arguments. Neither depends on the other.

1. Franklin’s involution — combinatorial

A sign-reversing involution on partitions of $n$ into distinct parts, whose fixed points are exactly the “staircase” partitions occurring at pentagonal $n$. This yields the coefficient identity

\[[q^n]\prod_{k=1}^{n}(1-q^k) \;=\; p_e(n)-p_o(n) \;=\; \begin{cases}(-1)^{|k|} & n = k(3k-1)/2,\\ 0 & \text{otherwise,}\end{cases}\]

where $p_e$ and $p_o$ count partitions into an even resp. odd number of distinct parts. Note this route works with the truncated product $\prod_{k=1}^{n}$, which agrees with the infinite product in degree $n$.

Source: EulerPentagonalNumberTheorem_Franklin/

2. q-series and the Jacobi Triple Product — analytic

A self-contained development of q-Pochhammer symbols, Euler’s identities and the Cauchy identity, culminating in the Jacobi Triple Product

\[\prod_{n=1}^{\infty}(1-q^{n})(1+zq^{n-1})(1+z^{-1}q^{n}) \;=\;\sum_{k\in\mathbb{Z}}z^{k}q^{k(k-1)/2},\]

from which the pentagonal number theorem follows by specialization. The triple product is proved in two settings: as a formal power series identity over any commutative ring with discrete topology (no convergence needed), and analytically over $\mathbb{C}$ for $|q|<1$, $z\neq 0$.

Source: Qseries_Formalization/QSeries/

Where to look

Status

Both routes are complete: the project builds with no sorry placeholders, no additional axioms beyond Lean’s standard three (propext, Classical.choice, Quot.sound), and no linter warnings.

Franklin route — all fully proved:

q-series / JTP route — all fully proved:

Contributing

Open an issue on GitHub for typos or mathematical errors in the blueprint. See the repository README for build instructions.

Use of AI

The Lean proofs in both routes were largely generated by Aristotle (Harmonic). The two routes differ in how much human direction and checking went into them:

Claude assisted with Lean proof development, blueprint maintenance and CI/deployment infrastructure across the project.

Every result is machine-checked regardless of how it was produced: the project builds with no sorry, no axioms beyond Lean’s standard three, and CI fails on any warning from Mathlib’s linter set.

License

Apache License 2.0 — see LICENSE.

Authors

Jonathan Conrad, Paula Muermann, Maryna Viazovska.