Formalization Blueprint for “An Introduction to Algebraic Combinatorics” by Darij Grinberg

2.2 Euler’s pentagonal number theorem and Jacobi’s triple product identity

2.2.1 Euler’s pentagonal number theorem

Definition 2.67
#

For any \(k\in \mathbb {Z}\), define a nonnegative integer \(w_{k}\in \mathbb {N}\) by

\[ w_{k}=\frac{\left( 3k-1\right) k}{2}. \]

This is called the \(k\)-th pentagonal number.

Theorem 2.68 Euler’s pentagonal number theorem

We have

\[ \prod _{k=1}^{\infty }\left( 1-x^{k}\right) =\sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}x^{w_{k}}. \]
Proof

Set \(q=x^{3}\) and \(z=-x\) in Theorem 2.81. (This means that we apply Theorem 2.81 to \(a=3\) and \(b=1\) and \(u=1\) and \(v=-1\).) We get

\begin{align} & \prod _{n{\gt}0}\left( \left( 1+\left( x^{3}\right) ^{2n-1}\left( -x\right) \right) \left( 1+\left( x^{3}\right) ^{2n-1}\left( -x\right) ^{-1}\right) \left( 1-\left( x^{3}\right) ^{2n}\right) \right) \nonumber \\ & =\sum _{\ell \in \mathbb {Z}}\left( x^{3}\right) ^{\ell ^{2}}\left( -x\right) ^{\ell }. \label{pf.thm.pars.pent.1} \end{align}

The left hand side of this equality simplifies as follows:

\begin{align*} & \prod _{n{\gt}0}\left( \left( 1-x^{6n-2}\right) \left( 1-x^{6n-4}\right) \left( 1-x^{6n}\right) \right) \\ & =\prod _{n{\gt}0}\left( \left( 1-\left( x^{2}\right) ^{3n-1}\right) \left( 1-\left( x^{2}\right) ^{3n-2}\right) \left( 1-\left( x^{2}\right) ^{3n}\right) \right) \\ & =\prod _{k{\gt}0}\left( 1-\left( x^{2}\right) ^{k}\right) , \end{align*}

since each positive integer \(k\) can be uniquely represented as \(3n-1\) or \(3n-2\) or \(3n\) for some positive integer \(n\).

Comparing this with (3), we obtain

\begin{align} & \prod _{k{\gt}0}\left( 1-\left( x^{2}\right) ^{k}\right) \nonumber \\ & =\sum _{\ell \in \mathbb {Z}}\left( -1\right) ^{\ell }x^{3\ell ^{2}+\ell }=\sum _{\ell \in \mathbb {Z}}\left( -1\right) ^{\ell }x^{2w_{-\ell }} \nonumber \\ & =\sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}\left( x^{2}\right) ^{w_{k}} \label{pf.thm.pars.pent.2} \end{align}

(here, we have substituted \(k\) for \(-\ell \) in the sum, and used the identity \(3\ell ^{2}+\ell = 2w_{-\ell }\)).

Now, we “substitute \(x\) for \(x^{2}\)” in this equality using Lemma 2.119. As a result, we obtain

\[ \prod _{k{\gt}0}\left( 1-x^{k}\right) =\sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}x^{w_{k}}. \]

This is Euler’s pentagonal number theorem (Theorem 2.68).

The Lean proof proceeds by first proving the identity over \(\mathbb {Q}\) (using Lemma 2.122, Lemma 2.120, Lemma 2.121, and Lemma 2.119), and then transferring to \(\mathbb {Z}\) by comparing coefficients via the ring homomorphism \(\mathbb {Z}\to \mathbb {Q}\) (using Lemma 2.123).

Pentagonal number properties

Lemma 2.69

The function \(k\mapsto w_k\) is injective: if \(w_j = w_k\) then \(j = k\).

Proof

By monotonicity on the positive integers (strictly increasing) and on the negative integers (also strictly increasing in absolute value), and the fact that \(w_k = w_j\) forces \(k, j\) to have the same sign.

Lemma 2.70

For any \(n\in \mathbb {N}\), the set \(\{ k\in \mathbb {Z} : w_k {\lt} n\} \) is finite.

Proof

Since \(w_k\) grows quadratically (specifically \(w_k \geq |k|\) for \(k\neq 0\)), only finitely many \(k\) satisfy \(w_k {\lt} n\).

Definition 2.71
#

The pentagonal coefficient at \(n\in \mathbb {N}\) is

\[ \mathrm{pentagonalCoeff}(n) = \begin{cases} (-1)^{|k|} & \text{if } n = w_k \text{ for some } k\in \mathbb {Z}, \\ 0 & \text{otherwise}. \end{cases} \]

This is well-defined by the injectivity of pentagonal numbers (Lemma 2.69).

Lemma 2.72

For any \(k\in \mathbb {Z}\), \(\mathrm{pentagonalCoeff}(w_k) = (-1)^{|k|}\).

Proof

Immediate from the definitions, since the inverse lookup recovers \(k\) from \(w_k\) by injectivity (Lemma 2.69).

Lemma 2.73

If \(m\in \mathbb {N}\) is not a pentagonal number (i.e., \(w_k \neq m\) for all \(k\in \mathbb {Z}\)), then \(\mathrm{pentagonalCoeff}(m) = 0\).

Proof

By definition of pentagonal coefficients.

Generating function definitions

Definition 2.74
#

The pentagonal series is the formal power series

\[ Q = \sum _{n\geq 0} \mathrm{pentagonalCoeff}(n)\, x^n = \sum _{k\in \mathbb {Z}} (-1)^k x^{w_k} \in R[[x]]. \]
Definition 2.75
#

The Euler product is the infinite product

\[ \prod _{k=1}^{\infty }(1 - x^k) \in R[[x]], \]

defined as a multipliable product in the Pi topology on \(R[[x]]\).

Definition 2.76
#

The partition generating function is

\[ P = \sum _{n\geq 0} p(n)\, x^n \in \mathbb {Z}[[x]], \]

where \(p(n)\) denotes the number of partitions of \(n\).

Lemma 2.77

The partition generating function satisfies

\[ P = \sum _{n\geq 0} p(n)\, x^n = \prod _{k=1}^{\infty }\frac{1}{1-x^k}. \]
Proof

By Mathlib’s partition generating function infrastructure.

Lemma 2.78

The Euler product times the partition generating function equals \(1\):

\[ \prod _{k=1}^{\infty }(1-x^k) \cdot \prod _{k=1}^{\infty }\frac{1}{1-x^k} = 1. \]
Proof

Each factor \((1-x^k)\) cancels with its inverse, using the per-term identity \((1 + x^k + x^{2k} + \cdots )(1 - x^k) = 1\) and multipliability of the products.

Corollary 2.79

For each positive integer \(n\), we have

\begin{align*} p\left( n\right) & =\sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , k, \neq , 0]}}\left( -1\right) ^{k-1}p\left( n-w_{k}\right) \\ & =p\left( n-1\right) +p\left( n-2\right) -p\left( n-5\right) -p\left( n-7\right) \\ & \ \ \ \ \ \ \ \ \ \ +p\left( n-12\right) +p\left( n-15\right) -p\left( n-22\right) -p\left( n-26\right) \pm \cdots . \end{align*}
theorem AlgebraicCombinatorics.partition_recursive (n : ) (hn : n > 0) :
(partitionCount n) = ∑' (k : { k : // k 0 pentagonalNumber k n }), (if (↑k).natAbs % 2 = 1 then 1 else -1) * (partitionCount (n - pentagonalNumber k))
Proof

We have

\[ \sum _{m\in \mathbb {N}}p\left( m\right) x^{m}=\prod \limits _{k=1}^{\infty }\frac{1}{1-x^{k}} \]

(by Theorem 2.30) and

\[ \sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}x^{w_{k}}=\prod \limits _{k=1} ^{\infty }\left( 1-x^{k}\right) \]

(by Theorem 2.68). Multiplying these two equalities, we obtain

\begin{align} \left( \sum _{m\in \mathbb {N}}p\left( m\right) x^{m}\right) \cdot \left( \sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}x^{w_{k}}\right) & =\left( \prod \limits _{k=1}^{\infty }\frac{1}{1-x^{k}}\right) \cdot \left( \prod \limits _{k=1}^{\infty }\left( 1-x^{k}\right) \right) =1. \label{pf.cor.pars.pn-rec.1} \end{align}

Now, let us fix a positive integer \(n\). We shall compare the \(x^{n}\)-coefficients on both sides of (7).

The \(x^{n}\)-coefficient on the left hand side of (7) is

\begin{align*} \sum _{k\in \mathbb {Z}}\left( -1\right) ^{k}p\left( n-w_{k}\right) & =p\left( n\right) +\sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , k, \neq , 0]}}\left( -1\right) ^{k}p\left( n-w_{k}\right) . \end{align*}

But the \(x^{n}\)-coefficient on the right hand side of (7) is \(0\) (since \(n\) is positive). Hence, comparing the coefficients yields

\[ p\left( n\right) +\sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , k, \neq , 0]}}\left( -1\right) ^{k}p\left( n-w_{k}\right) =0. \]

Solving this for \(p\left( n\right) \), we find

\[ p\left( n\right) =\sum _{\substack{[k, \in , \mathbb , {, Z, }, , ;, \\ , k, \neq , 0]}}\left( -1\right) ^{k-1}p\left( n-w_{k}\right) . \]

Corollary 2.79 is thus proved.

2.2.2 Jacobi’s triple product identity

The identity

Theorem 2.80 Jacobi’s triple product identity, take 1

In the ring \(\left( \mathbb {Z}\left[ z^{\pm }\right] \right) \left[ \left[ q\right] \right] \), we have

\[ \prod _{n{\gt}0}\left( \left( 1+q^{2n-1}z\right) \left( 1+q^{2n-1} z^{-1}\right) \left( 1-q^{2n}\right) \right) =\sum _{\ell \in \mathbb {Z} }q^{\ell ^{2}}z^{\ell }. \]
Proof

Both sides are equal after multiplying by the partition generating function \(\prod _{k{\gt}0}(1-q^{2k})^{-1}\). This is shown in Lemma 2.112 (for the RHS) and Lemma 2.113 (for the LHS). Since the partition generating function is a unit (Lemma 2.111), the result follows by cancellation.

Theorem 2.81 Jacobi’s triple product identity, take 2

Let \(a\) and \(b\) be two integers such that \(a{\gt}0\) and \(a\geq \left\vert b\right\vert \). Let \(u,v\in \mathbb {Q}\) be rational numbers with \(v\neq 0\). In the ring \(\mathbb {Q}\left[\left[ x\right]\right] \), set \(q=ux^{a}\) and \(z=vx^{b}\). Then,

\[ \prod _{n{\gt}0}\left( \left( 1+q^{2n-1}z\right) \left( 1+q^{2n-1} z^{-1}\right) \left( 1-q^{2n}\right) \right) =\sum _{\ell \in \mathbb {Z} }q^{\ell ^{2}}z^{\ell }. \]
theorem AlgebraicCombinatorics.jacobi_triple_product (a b : ) (ha : a > 0) (hab : a |b|) (u v : ) (hv : v 0) :
jacobiLHSEval a b u v = jacobiRHSEval a b u v
Proof

Both sides are equal after multiplying by the partition generating function \(\prod _{k{\gt}0}(1-q^{2k})^{-1}\). This is shown in Lemma 2.116 (for the RHS) and Lemma 2.117 (for the LHS). Since the partition generating function is a unit (Lemma 2.114), the result follows by cancellation.

Borcherds’ state infrastructure

Definition 2.82
#

A level is a number of the form \(p+\frac{1}{2}\) with \(p\in \mathbb {Z}\). A state is a set of levels that contains all but finitely many negative levels, and only finitely many positive levels.

For any state \(S\), we define:

  • the energy of \(S\) to be

    \[ \operatorname {energy}S:=\sum _{\substack{[p, {\gt}, 0, ;, \\ , p, \in , S]}}2p -\sum _{\substack{[p, {\lt}, 0, ;, \\ , p, \notin , S]}}2p \in \mathbb {N}; \]
  • the particle number of \(S\) to be

    \[ \operatorname {parnum}S:=\left(\text{\# of positive levels in } S\right) -\left(\text{\# of negative levels not in } S\right)\in \mathbb {Z}. \]
  • levels : Set Level

    The set of levels in this state

  • finite_nonneg : {p : Level | p 0 p self.levels}.Finite

    Only finitely many nonnegative levels (p ≥ 0, representing positive half-integers p+1/2 > 0) are in the state

  • finite_negative_missing : {p : Level | p < 0 pself.levels}.Finite

    Only finitely many negative levels (p < 0, representing negative half-integers p+1/2 < 0) are NOT in the state

Definition 2.83
#

For \(\ell \in \mathbb {Z}\), the \(\ell \)-ground state is

\[ G_{\ell }:=\left\{ \text{all levels }{\lt}\ell \right\} . \]
Theorem 2.84

For any \(\ell \in \mathbb {Z}\), we have \(\operatorname {energy}G_{\ell }=\ell ^{2}\) and \(\operatorname {parnum}G_{\ell }=\ell \).

Proof

If \(\ell \geq 0\), the energy is \(1+3+5+\cdots +(2\ell -1)=\ell ^{2}\) and the particle number is \(\ell -0=\ell \). If \(\ell {\lt}0\), the energy is \(-(-1)-(-3)-\cdots -(2\ell +1)=\ell ^{2}\) and the particle number is \(0-(-\ell )=\ell \).

Definition 2.85
#

If \(S\) is a state, \(p\in S\), and \(q\) is a positive integer such that \(p+q\notin S\), then the state

\[ \operatorname {jump}_{p,q}S:=\left( S\setminus \left\{ p\right\} \right) \cup \left\{ p+q\right\} \]

is said to be obtained from \(S\) by letting the electron at level \(p\) jump \(q\) steps to the right.

def AlgebraicCombinatorics.State.jump (S : State) (p : Level) (q : ) (_hp : p S.levels) (_hpq : p + qS.levels) (_hq : q > 0) :
  • S.jump p q _hp _hpq _hq = { levels := S.levels \ {p} {p + q}, finite_nonneg := , finite_negative_missing := }
Theorem 2.86

A jump by \(q\) steps keeps the particle number unchanged and raises the energy by \(2q\).

Proof

Three cases are checked: the particle jumps from a positive to a positive level, from a negative to a positive level, or from a negative to a negative level.

Definition 2.87
#

For any partition \(\lambda =(\lambda _{1},\lambda _{2},\ldots ,\lambda _{k})\) and any \(\ell \in \mathbb {Z}\), the excited state \(E_{\ell ,\lambda }\) is defined by starting with the \(\ell \)-ground state \(G_{\ell }\) and then successively letting the \(k\) electrons at the highest levels jump \(\lambda _{1},\lambda _{2},\ldots ,\lambda _{k}\) steps to the right, respectively:

\[ E_{\ell ,\lambda }=\left\{ \text{all levels }{\lt}\ell -k\right\} \cup \left\{ \ell -i+\tfrac {1}{2}+\lambda _{i}\ \mid \ i\in \{ 1,\ldots ,k\} \right\} . \]
Lemma 2.88

The excited state \(E_{\ell ,\lambda }\) is reachable from the ground state \(G_\ell \) by a sequence of jumps (in the sense of Definition 2.85).

Proof

By induction on the number of parts: starting from \(G_\ell \), one performs \(k\) successive jumps of sizes \(\lambda _1, \ldots , \lambda _k\). The intermediate state construction ensures each jump is valid (source is occupied, target is vacant).

Theorem 2.89

The excited state \(E_{\ell ,\lambda }\) has energy \(\ell ^{2}+2|\lambda |\) and particle number \(\ell \).

Proof

The state \(E_{\ell ,\lambda }\) is obtained from \(G_{\ell }\) by \(k\) jumps of \(\lambda _{1},\ldots ,\lambda _{k}\) steps. Each jump by \(q\) steps raises the energy by \(2q\) and keeps the particle number unchanged. Since the ground state has energy \(\ell ^{2}\) and particle number \(\ell \), the result follows.

The partition–state bijection

Lemma 2.90
#

For fixed \(\ell \in \mathbb {Z}\), the map \(\lambda \mapsto E_{\ell ,\lambda }\) is injective: if \(E_{\ell ,\mu _1} = E_{\ell ,\mu _2}\), then \(\mu _1 = \mu _2\).

Proof

Two excited states are equal if and only if their level sets agree. The partition \(\lambda \) is recovered from the excited levels via \(\lambda _i = (\)

\(\)i\(-th largest excited level\)) - (ℓ- i + )\(\), so equal level sets force equal partitions. The key step is that \(i\mapsto \lambda _i - i\) is strictly decreasing for sorted parts, making the level encoding injective.

Proof
Lemma 2.91
#

For any \(\ell \in \mathbb {Z}\) and any state \(S\) with \(\operatorname {parnum}(S) = \ell \), there exists a partition \(\mu \) such that \(S = E_{\ell ,\mu }\).

Proof

Given \(S\) with particle number \(\ell \), we construct \(\mu \) by listing the excited levels of \(S\) (those above the base level) in decreasing order and computing \(\mu _i = (\)

\(\)i\(-th excited level\)) - (ℓ- i + )\(\). The proof shows these differences are positive integers forming a valid partition, and that the resulting excited state equals \(S\).

Proof
Theorem 2.92

For each \(\ell \in \mathbb {Z}\), the map

\begin{align*} \Phi _{\ell }:\left\{ \text{partitions}\right\} & \rightarrow \left\{ \text{states with particle number }\ell \right\} ,\\ \lambda & \mapsto E_{\ell ,\lambda } \end{align*}

is a bijection.

Proof

Injectivity is Lemma 2.90. Surjectivity is Lemma 2.91.

Theorem 2.93

The global map

\begin{align*} \Phi : \mathbb {Z} \times \{ \text{partitions}\} & \to \{ \text{states}\} , \\ (\ell , \mu ) & \mapsto E_{\ell ,\mu } \end{align*}

is a bijection. The inverse sends a state \(S\) to \((\operatorname {parnum}(S), \mu )\) where \(\mu \) is the unique partition with \(E_{\operatorname {parnum}(S), \mu } = S\).

Proof

Injectivity: if \(E_{\ell _1,\mu _1} = E_{\ell _2,\mu _2}\), comparing particle numbers gives \(\ell _1 = \ell _2\), and then injectivity of \(\Phi _\ell \) gives \(\mu _1 = \mu _2\). Surjectivity: any state \(S\) has particle number \(\ell = \operatorname {parnum}(S)\), and by the surjectivity of \(\Phi _\ell \), there exists \(\mu \) with \(E_{\ell ,\mu } = S\).

Lemma 2.94

For any state \(S\), there exists \(n\geq 0\) such that

\[ \operatorname {energy}(S) = |\operatorname {parnum}(S)|^2 + 2n. \]

In particular, the energy is always at least \(|\operatorname {parnum}(S)|^2\), and the excess is always even.

Proof

By surjectivity (Lemma 2.91), \(S = E_{\ell ,\mu }\) for some \(\ell = \operatorname {parnum}(S)\) and partition \(\mu \) of some \(n\). Then \(\operatorname {energy}(S) = \ell ^2 + 2n\) by Theorem 2.89.

Finset pair bijection with states

Definition 2.95
#

Given a pair \((P, N)\) of finite subsets of \(\mathbb {N}\), define the state \(\operatorname {fromFinsetPair}(P, N)\) whose levels are

\[ \{ p\geq 0 : p \in P\} \cup \{ p {\lt} 0 : (-p-1) \notin N\} . \]

Here \(P\) encodes the nonneg levels present, and \(N\) encodes the negative levels missing (with \(n \in N\) meaning level \(-(n+1)\) is missing).

  • One or more equations did not get rendered due to their size.
Lemma 2.96

For any pair \((P, N)\) of finite subsets of \(\mathbb {N}\),

\[ \operatorname {energy}(\operatorname {fromFinsetPair}(P,N)) = \sum _{n\in P}(2n+1) + \sum _{n\in N}(2n+1). \]
theorem AlgebraicCombinatorics.State.fromFinsetPair_energy (P N : Finset ) :
(fromFinsetPair P N).energy = nP, (2 * n + 1) + nN, (2 * n + 1)
Proof

For nonneg level \(n\in P\): contribution is \(2n+1\). For missing negative level \(-(n+1)\) with \(n\in N\): \(|{-}(n{+}1)| = n+1\), so contribution is \(2(n+1)-1 = 2n+1\). Both give \(2n+1\).

Lemma 2.97

For any pair \((P, N)\) of finite subsets of \(\mathbb {N}\),

\[ \operatorname {parnum}(\operatorname {fromFinsetPair}(P,N)) = |P| - |N|. \]
Proof

The number of nonneg levels present is \(|P|\), and the number of negative levels missing is \(|N|\).

Theorem 2.98

The map \((P,N)\mapsto \operatorname {fromFinsetPair}(P,N)\) is a bijection from pairs of finite subsets of \(\mathbb {N}\) to states.

Proof

Injectivity: \(P\) and \(N\) are recovered from any state \(S\) by taking \(P = \{ p \geq 0 : p \in S\} \) and \(N = \{ n \in \mathbb {N} : -(n+1) \notin S\} \). Surjectivity: any state \(S\) equals \(\operatorname {fromFinsetPair}(P, N)\) where \(P\) and \(N\) are constructed as above.

Lemma 2.99

For any \(d\in \mathbb {N}\) and function \(f:\mathbb {Z}\to \mathbb {Z}[z^{\pm }]\),

\[ \sum _{\substack{[(, P, ,, N, ), :, \\ , \operatorname , {, e, n, e, r, g, y, }, =, d]}} f(|P|-|N|) = \sum _{\substack{[(, \ell , ,, \mu , ), :, \\ , \ell , ^, 2, +, 2, |, \mu , |, =, d]}} f(\ell ). \]

Both sums are over finite sets, and equality holds because both sides can be rewritten as \(\sum _{S:\operatorname {energy}(S)=d} f(\operatorname {parnum}(S))\) using the two bijections (finset pairs and integer–partition pairs with states).

Proof

Both sides equal \(\sum _{S:\operatorname {energy}(S)=d} f(\operatorname {parnum}(S))\) via the respective bijections. The LHS uses the finset pair bijection (Theorem 2.98), and the RHS uses the integer–partition bijection (Theorem 2.93).

Jacobi ring definitions and state generating function

Definition 2.100
#

The state monomial with energy \(e\) and particle number \(p\) is the element \(q^e z^p \in (\mathbb {Z}[z^{\pm }])[[q]]\).

Definition 2.101
#

The state generating function is the formal sum over all integer–partition pairs \((\ell , \mu )\):

\[ \mathcal{S} = \sum _{\ell \in \mathbb {Z}} \sum _{\mu \text{ partition}} q^{\ell ^2 + 2|\mu |} z^\ell \in (\mathbb {Z}[z^{\pm }])[[q]]. \]

It is defined as the formal sum \(\sum '_{(\ell , \mu )} q^{\ell ^2 + 2|\mu |} z^\ell \) over all integer–partition pairs.

Definition 2.102
#

The partition generating function in JacobiRing is

\[ \sum _{\mu \text{ partition}} q^{2|\mu |} = \prod _{k{\gt}0}(1-q^{2k})^{-1} \in (\mathbb {Z}[z^{\pm }])[[q]]. \]
Definition 2.103
#

The \(z\)-dependent product is

\[ \prod _{n{\gt}0}\left((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})\right) \in (\mathbb {Z}[z^{\pm }])[[q]]. \]
Definition 2.104
#

The \(q\)-only product is

\[ \prod _{n{\gt}0}(1-q^{2n}) \in (\mathbb {Z}[z^{\pm }])[[q]]. \]

LHS factorization and product–state connection

Lemma 2.105

The LHS of Jacobi’s identity factors as

\[ \prod _{n{\gt}0}\left((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})(1-q^{2n})\right) = \left(\prod _{n{\gt}0}(1+q^{2n-1}z)(1+q^{2n-1}z^{-1})\right) \cdot \left(\prod _{n{\gt}0}(1-q^{2n})\right). \]
Proof

Each factor in the LHS product is \((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})(1-q^{2n})\), which splits into the product of the first two factors (which form the \(z\)-dependent product) and the third factor (which forms the \(q\)-only product). The infinite product distributes because both sub-products are multipliable.

Lemma 2.106

The partition generating function times the \(q\)-only product equals \(1\):

\[ \prod _{k{\gt}0}(1-q^{2k})^{-1} \cdot \prod _{k{\gt}0}(1-q^{2k}) = 1. \]
Proof

Per-term cancellation: \((1 + q^{2k} + q^{4k} + \cdots )(1 - q^{2k}) = 1\) for each \(k\). The per-term identity and multipliability of both products give the result.

Lemma 2.107

The \(z\)-dependent product admits a binary expansion as a double sum:

\[ \prod _{n{\gt}0}((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})) = \sum _{P,N \text{ finite}} \left(\prod _{n\in P}(q^{2n+1}z)\right)\left(\prod _{n\in N}(q^{2n+1}z^{-1})\right). \]
Proof

The product of \((1+a_n)(1+b_n)\) over \(n\) expands by choosing a subset \(P\) of indices contributing \(a_n\) and a subset \(N\) contributing \(b_n\). This uses the identities \(\prod (1+x_n) = \sum _{S\text{ finite}} \prod _{n\in S} x_n\) for each factor, combined via the product rule for infinite products.

Lemma 2.108

Each term of the binary expansion has the explicit form

\[ \prod _{n\in P}(q^{2n+1}z) \cdot \prod _{n\in N}(q^{2n+1}z^{-1}) = q^{\sum _{n\in P}(2n+1) + \sum _{n\in N}(2n+1)} \cdot z^{|P| - |N|}. \]
theorem AlgebraicCombinatorics.double_sum_term_explicit (P N : Finset ) :
(∏ nP, (jacobiFactorZ n - 1)) * nN, (jacobiFactorZInv n - 1) = PowerSeries.X ^ (nP, (2 * n + 1) + nN, (2 * n + 1)) * jacobiZPow (P.card - N.card)
Proof

The \(q\)-exponents add up, and the \(z\)-powers contribute \(+1\) for each element of \(P\) and \(-1\) for each element of \(N\), giving \(z^{|P|-|N|}\).

Lemma 2.109

For each \(d\in \mathbb {N}\), the \(q^d\)-coefficient of the double sum equals the \(q^d\)-coefficient of the state generating function:

\[ [q^d]\sum _{P,N}\prod _{n\in P}(q^{2n+1}z)\prod _{n\in N}(q^{2n+1}z^{-1}) = [q^d]\sum _{(\ell ,\mu )} q^{\ell ^2+2|\mu |}z^\ell . \]
Proof

By Lemma 2.108, the LHS coefficient is a sum of \(z^{|P|-|N|}\) over pairs with \(\sum (2n+1) = d\). By Lemma 2.99, this equals the sum of \(z^\ell \) over \((\ell ,\mu )\) with \(\ell ^2 + 2|\mu | = d\).

Lemma 2.110

The \(z\)-dependent product equals the state generating function:

\[ \prod _{n{\gt}0}((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})) = \mathcal{S}. \]
Proof

By Lemma 2.107, the LHS equals the double sum. By power series extensionality and Lemma 2.109, coefficients match those of the state generating function.

Proof infrastructure for Jacobi’s triple product identity

Lemma 2.111

The partition generating function \(\prod _{k{\gt}0}(1-q^{2k})^{-1}\in (\mathbb {Z}[z^{\pm }])[[q]]\) is a unit (its constant term is \(1\)).

Proof

The constant coefficient is \(1\), which is a unit.

Lemma 2.112

The state generating function equals the RHS of Jacobi’s identity times the partition generating function:

\[ \sum _{S\text{ state}}q^{\operatorname {energy}S}z^{\operatorname {parnum}S} =\left(\sum _{\ell \in \mathbb {Z}}q^{\ell ^{2}}z^{\ell }\right) \prod _{n{\gt}0}(1-q^{2n})^{-1}. \]
Proof

Using the bijection \(\Phi _{\ell }\) from Theorem 2.92, we rewrite the sum over states as

\[ \sum _{\ell \in \mathbb {Z}}\sum _{\lambda \text{ partition}} q^{\ell ^{2}+2|\lambda |}z^{\ell } =\left(\sum _{\ell \in \mathbb {Z}}q^{\ell ^{2}}z^{\ell }\right) \left(\sum _{\lambda \text{ partition}}q^{2|\lambda |}\right). \]

The second factor is \(\prod _{n{\gt}0}(1-q^{2n})^{-1}\) by the generating function for partitions.

Lemma 2.113

The state generating function equals the LHS of Jacobi’s identity times the partition generating function:

\[ \sum _{S\text{ state}}q^{\operatorname {energy}S}z^{\operatorname {parnum}S} =\prod _{n{\gt}0}\left((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})(1-q^{2n})\right) \cdot \prod _{k{\gt}0}(1-q^{2k})^{-1}. \]
Proof

The proof chains the identities. By Lemma 2.110,

\[ \mathcal{S} = \prod _{n{\gt}0}((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})). \]

By Lemma 2.106, this equals

\[ \prod _{n{\gt}0}((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})) \cdot \left(\prod _{n{\gt}0}(1-q^{2n}) \cdot \prod _{n{\gt}0}(1-q^{2n})^{-1}\right). \]

By Lemma 2.105, this equals

\[ \prod _{n{\gt}0}\left((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})(1-q^{2n})\right) \cdot \prod _{n{\gt}0}(1-q^{2n})^{-1}. \]

Parameterized Jacobi identity infrastructure

Lemma 2.114

For integers \(a{\gt}0\) and rational \(u\), the evaluated partition generating function \(\prod _{k{\gt}0}(1-u^{2k}x^{2ak})^{-1}\in \mathbb {Q}[[x]]\) is a unit (its constant term is \(1\)).

Proof

The constant coefficient is \(1\), which is a unit in \(\mathbb {Q}\).

Lemma 2.115

For \(a {\gt} 0\), the partition generating function times the Euler product (both evaluated at parameter \(a\), \(u\)) equals \(1\):

\[ \prod _{k{\gt}0}\frac{1}{1-u^{2k}x^{2ak}} \cdot \prod _{k{\gt}0}(1-u^{2k}x^{2ak}) = 1. \]
Proof

Per-factor cancellation: each geometric series factor \((1 + u^{2k}x^{2ak} + u^{4k}x^{4ak} + \cdots )\) multiplied by \((1 - u^{2k}x^{2ak})\) gives \(1\). The proof stabilizes the partial products and shows the coefficients eventually agree.

Lemma 2.116

The product of the RHS of Jacobi’s identity (evaluated at \(q=ux^a\), \(z=vx^b\)) with the partition generating function equals the state generating function:

\[ \left(\sum _{\ell \in \mathbb {Z}}q^{\ell ^{2}}z^{\ell }\right) \prod _{n{\gt}0}(1-q^{2n})^{-1} =\sum _{(\ell ,\mu )}u^{\ell ^{2}+2|\mu |}v^{\ell }\, x^{a(\ell ^{2}+2|\mu |)+b\ell }. \]
theorem AlgebraicCombinatorics.jacobiRHS_mul_partitionGenFun (a b : ) (u v : ) (ha : a > 0) (hab : a |b|) (_hv : v 0) :
jacobiRHSEval a b u v * partitionGenFunEval a u = ∑' (pair : × (n : ) × n.Partition), have := pair.1; have n := pair.2.fst; (u ^ (( ^ 2).natAbs + 2 * n) * v ^ ) PowerSeries.X ^ (a * ( ^ 2 + 2 * n) + b * ).toNat
Proof

Follows from the Cauchy product formula for infinite sums.

Lemma 2.117

The product of the LHS of Jacobi’s identity (evaluated at \(q=ux^a\), \(z=vx^b\)) with the partition generating function equals the state generating function.

theorem AlgebraicCombinatorics.jacobiLHS_mul_partitionGenFun (a b : ) (u v : ) (ha : a > 0) (hab : a |b|) (hv : v 0) :
jacobiLHSEval a b u v * partitionGenFunEval a u = ∑' (pair : × (n : ) × n.Partition), have := pair.1; have n := pair.2.fst; (u ^ (( ^ 2).natAbs + 2 * n) * v ^ ) PowerSeries.X ^ (a * ( ^ 2 + 2 * n) + b * ).toNat
Proof

The proof requires: (1) showing that the \((1-q^{2n})\) factors cancel with the partition generating function (via Lemma 2.115), (2) applying binary expansion to the remaining product, (3) reindexing using the state bijection (Theorem 2.92).

Jacobi implies Euler

Lemma 2.118

For any \(\ell \in \mathbb {Z}\),

\[ 3\ell ^{2}+\ell = 2\, w_{-\ell }. \]
Proof

Direct computation: \(3\ell ^{2}+\ell = (3\ell +1)\ell = (3(-\ell )-1)(-\ell ) = 2w_{-\ell }\).

Lemma 2.119

Let \(K\) be a commutative ring. Let \(f\) and \(g\) be two FPSs in \(K[[x]]\). Assume that \(f[x^{2}]=g[x^{2}]\). Then, \(f=g\).

Proof

Write \(f=\sum _{n\in \mathbb {N}}f_{n}x^{n}\) and \(g=\sum _{n\in \mathbb {N}}g_{n}x^{n}\). Then \(f[x^{2}]=\sum _{n\in \mathbb {N}}f_{n}x^{2n}\) and \(g[x^{2}]=\sum _{n\in \mathbb {N}}g_{n}x^{2n}\). Comparing \(x^{2n}\)-coefficients in \(f[x^{2}]=g[x^{2}]\) yields \(f_{n}=g_{n}\) for each \(n\in \mathbb {N}\). Hence \(f=g\).

Lemma 2.120

The LHS of Jacobi’s identity evaluated at \(a=3\), \(b=1\), \(u=1\), \(v=-1\) equals \(\prod _{k{\gt}0}(1-x^{k})[x^{2}]\), i.e. the Euler product with \(x\) replaced by \(x^{2}\):

\[ \prod _{n{\gt}0}\left((1+q^{2n-1}z)(1+q^{2n-1}z^{-1})(1-q^{2n})\right)\Big|_{q=x^3,\, z=-x} = \left(\prod _{k{\gt}0}(1-x^{k})\right)\! \big[x^{2}\big]. \]
Proof

The LHS factors simplify: setting \(q=x^{3}\), \(z=-x\) gives factors \((1-x^{6n-2})(1-x^{6n-4})(1-x^{6n})\) for each \(n{\gt}0\), which is \(\prod _{k{\gt}0}(1-(x^{2})^{k})\).

Lemma 2.121

The RHS of Jacobi’s identity evaluated at \(a=3\), \(b=1\), \(u=1\), \(v=-1\) equals the pentagonal series with \(x\) replaced by \(x^{2}\):

\[ \sum _{\ell \in \mathbb {Z}}q^{\ell ^2}z^{\ell }\Big|_{q=x^3,\, z=-x} = \left(\sum _{k\in \mathbb {Z}}(-1)^k x^{w_k}\right)\! \big[x^{2}\big]. \]
Proof

The RHS sum is \(\sum _{\ell \in \mathbb {Z}}(-1)^{\ell }x^{3\ell ^{2}+\ell }\). By Lemma 2.118, \(3\ell ^{2}+\ell =2w_{-\ell }\), so the exponents are all even and the sum equals \(\sum _{k\in \mathbb {Z}}(-1)^{k}(x^{2})^{w_{k}}\), which is the pentagonal series evaluated at \(x^{2}\).

Lemma 2.122

Euler’s pentagonal number theorem holds over \(\mathbb {Q}\):

\[ \prod _{k=1}^{\infty }(1-x^k) = \sum _{k\in \mathbb {Z}}(-1)^k x^{w_k} \quad \text{in } \mathbb {Q}[[x]]. \]
Proof

Apply Lemma 2.119 to reduce to showing \(f[x^2] = g[x^2]\). By Lemma 2.120 and Lemma 2.121, both sides squared equal the LHS and RHS of Jacobi’s identity evaluated at \(a=3\), \(b=1\), \(u=1\), \(v=-1\), which are equal by Theorem 2.81.

Lemma 2.123

The coefficients of the Euler product are preserved by the ring homomorphism \(\mathbb {Z}\to \mathbb {Q}\):

\[ \iota \left([x^n]\prod _{k{\gt}0}(1-x^k)_{\mathbb {Z}}\right) = [x^n]\prod _{k{\gt}0}(1-x^k)_{\mathbb {Q}}, \]

where \(\iota :\mathbb {Z}\hookrightarrow \mathbb {Q}\) is the inclusion.

Proof

The ring homomorphism \(\mathbb {Z}\to \mathbb {Q}\) sends the \(\mathbb {Z}\)-product to the \(\mathbb {Q}\)-product by continuity of the induced map on power series, and coefficients commute with the map.

Application: A recursion for the sum of divisors

Lemma 2.124

We have \(P\cdot Q = 1\), where \(P=\sum _{n\geq 0}p(n)x^{n}\) is the partition generating function and \(Q=\sum _{k\in \mathbb {Z}}(-1)^{k}x^{w_{k}}\) is the pentagonal series.

Proof

This follows from the partition generating function identity \(P=\prod _{k\geq 1}(1-x^{k})^{-1}\) (Lemma 2.77) and Euler’s pentagonal number theorem \(Q=\prod _{k\geq 1}(1-x^{k})\) (Theorem 2.68). Their product \(PQ = 1\) is established by Lemma 2.78.

Definition 2.125
#

The sum-of-divisors generating function is

\[ S = \sum _{k{\gt}0} \sigma (k)\, x^k \in \mathbb {Z}[[x]], \]

where \(\sigma (k) = \sigma _1(k) = \sum _{d\mid k} d\) is the sum of positive divisors of \(k\).

Lemma 2.126

For each \(n\in \mathbb {N}\),

\[ n\cdot p(n) = \sum _{k=1}^{n} \sigma (k)\cdot p(n-k). \]
Proof

The proof uses a combinatorial double-counting argument: a marked partition \((p, i)\) (a partition \(p\) of \(n\) together with a marked cell \(i\in \{ 1,\ldots ,n\} \)) can equivalently be described by \((d, m, j, \mu )\) where \(d\) is the row length of the marked cell, \(m\) is the number of rows of length \(d\), \(j\) is the column of the cell, and \(\mu \) is the partition obtained by removing all rows of length \(d\). The identity follows by summing \(\sum _{k=1}^n \sigma (k) p(n-k) = \sum _{d\mid k} d \cdot p(n-k)\) and reindexing.

Lemma 2.127

We have \(xP'=SP\), where \(P\) is the partition generating function and \(S=\sum _{k{\gt}0}\sigma (k)x^{k}\) is the sum-of-divisors generating function.

Proof

Both sides have the same coefficients: the coefficient of \(x^{n}\) on the left is \(n\cdot p(n)\), and on the right is \(\sum _{k=1}^{n}\sigma (k)\cdot p(n-k)\). These are equal by the combinatorial identity (Lemma 2.126).

Lemma 2.128

We have \(xQ'=-QS\), where \(Q\) is the pentagonal series and \(S\) is the sum-of-divisors generating function.

Proof

From \(PQ=1\), differentiate to get \(P'Q+PQ'=0\), so \(PQ'=-P'Q\). Multiply by \(x\): \(xPQ'=-xP'Q=-SPQ=-S\) (using \(xP'=SP\) and \(PQ=1\)). Since \(PQ=1\) is a unit, multiply both sides by \(Q\) to get \(xQ'=-QS\).

Lemma 2.129

The \(n\)-th coefficient of \(xQ'\) is determined by pentagonal numbers:

\[ [x^n](xQ') = \begin{cases} (-1)^{|k|}\cdot n & \text{if } n = w_k \text{ for some } k\in \mathbb {Z}, \\ 0 & \text{otherwise}. \end{cases} \]

This follows from \(xQ' = \sum _{k\in \mathbb {Z}} (-1)^k w_k x^{w_k}\).

Proof

Taking the derivative of \(Q = \sum _n \mathrm{pentagonalCoeff}(n) x^n\) and multiplying by \(x\) gives \([x^n](xQ') = n\cdot \mathrm{pentagonalCoeff}(n)\). The result follows from Lemma 2.72 and Lemma 2.73.

Theorem 2.130

For any positive integer \(n\), let \(\sigma (n)\) denote the sum of all positive divisors of \(n\).

Then, for each positive integer \(n\), we have

\[ \sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , w, _, {, k, }, {\lt}, n]}}\left( -1\right) ^{k}\sigma \left( n-w_{k}\right) = \begin{cases} \left( -1\right) ^{k-1}n, & \text{if }n=w_{k}\text{ for some }k\in \mathbb {Z};\\ 0, & \text{if not.} \end{cases} \]

(Here, \(w_{k}\) is the \(k\)-th pentagonal number, defined in Definition 2.67.)

theorem AlgebraicCombinatorics.euler_sum_divisors_recursive (n : ) (_hn : n > 0) :
∑' (k : { k : // pentagonalNumber k < n }), (-1) ^ (↑k).natAbs * ((ArithmeticFunction.sigma 1) (n - pentagonalNumber k)) = match pentagonalNumberInverse n with | some k => (-1) ^ (k.natAbs + 1) * n | none => 0
Proof

From Lemma 2.128, we have \(xQ'=-QS\), where \(Q=\sum _{k\in \mathbb {Z}}(-1)^{k}x^{w_{k}}\) and \(S=\sum _{k{\gt}0}\sigma (k)x^{k}\).

Taking the derivative:

\[ xQ' = \sum _{k\in \mathbb {Z}}(-1)^{k}w_{k}x^{w_{k}}. \]

On the other hand:

\[ -QS = -\left(\sum _{k\in \mathbb {Z}}(-1)^{k}x^{w_{k}}\right) \left(\sum _{i{\gt}0}\sigma (i)x^{i}\right) = \sum _{m{\gt}0}\sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , m, {\gt}, w, _, {, k, }]}} (-1)^{k-1}\sigma (m-w_{k})x^{m}. \]

Comparing the coefficient of \(x^{n}\) on both sides:

  • On the left, the coefficient is \((-1)^{k}w_{k}\) if \(n=w_{k}\) for some \(k\), and \(0\) otherwise (Lemma 2.129);

  • On the right, the coefficient is \(\sum _{\substack{[k, \in , \mathbb , {, Z, }, ;, \\ , w, _, {, k, }, {\lt}, n]}}(-1)^{k-1}\sigma (n-w_{k})\).

Rearranging gives the result.

Alternative proof via evaluation homomorphism

Definition 2.131
#

The evaluation map from \((\mathbb {Z}[z^{\pm }])[[q]]\) to \(\mathbb {Q}[[x]]\) is defined by sending a power series \(f = \sum _e c_e q^e\) (where \(c_e \in \mathbb {Z}[z^{\pm }]\)) to

\[ \operatorname {eval}_{a,b,u,v}(f) = \sum _{e\geq 0} u^e \cdot \widehat{c_e}(a,b,v,e), \]

where \(\widehat{c_e}(a,b,v,e)\) denotes the shifted evaluation that replaces each \(z^\ell \) in \(c_e\) by \(v^\ell x^{ae+b\ell }\).

Lemma 2.132

Evaluating the RHS of Jacobi’s identity gives the parameterized RHS:

\[ \operatorname {eval}_{a,b,u,v}\! \left(\sum _{\ell \in \mathbb {Z}}q^{\ell ^2}z^\ell \right) = \sum _{\ell \in \mathbb {Z}} u^{\ell ^2} v^\ell \, x^{a\ell ^2+b\ell }. \]
theorem AlgebraicCombinatorics.evalJacobiCorrect_jacobiRHS' (a b : ) (u v : ) (ha : a > 0) (hab : a |b|) (_hv : v 0) :
Proof

Each sum term \(q^{\ell ^2}z^\ell \) is evaluated to \(u^{\ell ^2} v^\ell x^{a\ell ^2+b\ell }\). The evaluation distributes over the infinite sum by summability and continuity.

Theorem 2.133

The parameterized Jacobi triple product identity (Theorem 2.81) can also be derived from Theorem 2.80 by applying the evaluation map \(\operatorname {eval}_{a,b,u,v}\).

theorem AlgebraicCombinatorics.jacobi_triple_product_via_evalCorrect (a b : ) (ha : a > 0) (hab : a |b|) (u v : ) (hv : v 0) :
jacobiLHSEval a b u v = jacobiRHSEval a b u v
Proof

Apply \(\operatorname {eval}_{a,b,u,v}\) to both sides of the identity from Theorem 2.80 (i.e., the LHS \(=\) RHS in \((\mathbb {Z}[z^{\pm }])[[q]]\)). By Lemma 2.132, the RHS evaluates to the parameterized RHS. The LHS evaluates to the parameterized LHS by a corresponding evaluation lemma.