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

1.3 Formal power series: definition and basic properties

1.3.1 Convention

Fix a commutative ring \(K\). (For example, \(K\) can be \(\mathbb {Z}\) or \(\mathbb {Q}\) or \(\mathbb {C}\).)

1.3.2 The definition of formal power series

Definition 1.73
#

A formal power series (or, short, FPS) in \(1\) indeterminate over \(K\) means a sequence \(\left(a_{0},a_{1},a_{2},\ldots \right) = \left(a_{n}\right)_{n\in \mathbb {N}} \in K^{\mathbb {N}}\) of elements of \(K\).

noncomputable def AlgebraicCombinatorics.FPS.fpsEquivSeq {R : Type u_1} [CommRing R] :
PowerSeries R (R)
Definition 1.74
#

(a) The sum of two FPSs \(\mathbf{a}=\left( a_{0},a_{1},a_{2},\ldots \right)\) and \(\mathbf{b}=\left(b_{0},b_{1},b_{2},\ldots \right)\) is defined to be the FPS

\[ \left(a_{0}+b_{0},\ \ a_{1}+b_{1},\ \ a_{2}+b_{2},\ \ \ldots \right). \]

It is denoted by \(\mathbf{a}+\mathbf{b}\).

(b) The difference of two FPSs \(\mathbf{a}=\left(a_{0},a_{1},a_{2},\ldots \right)\) and \(\mathbf{b}=\left(b_{0},b_{1},b_{2},\ldots \right)\) is defined to be the FPS

\[ \left(a_{0}-b_{0},\ \ a_{1}-b_{1},\ \ a_{2}-b_{2},\ \ \ldots \right). \]

It is denoted by \(\mathbf{a}-\mathbf{b}\).

(c) If \(\lambda \in K\) and if \(\mathbf{a}=\left(a_{0},a_{1},a_{2},\ldots \right)\) is an FPS, then we define an FPS

\[ \lambda \mathbf{a}:=\left(\lambda a_{0},\lambda a_{1},\lambda a_{2},\ldots \right). \]

(d) The product of two FPSs \(\mathbf{a}=\left(a_{0},a_{1},a_{2},\ldots \right)\) and \(\mathbf{b}=\left(b_{0},b_{1},b_{2},\ldots \right)\) is defined to be the FPS \(\left(c_{0},c_{1},c_{2},\ldots \right)\), where

\begin{align*} c_{n} & =\sum _{i=0}^{n}a_{i}b_{n-i}=\sum _{\substack{[\left , (, i, ,, j, \right , ), , \in , \mathbb , {, N, }, ^, {, 2, }, ;, \\ , i, +, j, =, n]}}a_{i}b_{j}\\ & =a_{0}b_{n}+a_{1}b_{n-1}+a_{2}b_{n-2}+\cdots +a_{n}b_{0}\ \ \ \ \ \ \ \ \ \ \text{for each }n\in \mathbb {N}. \end{align*}

This product is denoted by \(\mathbf{a}\cdot \mathbf{b}\) or just by \(\mathbf{ab}\).

(e) For each \(a\in K\), we define \(\underline{a}\) to be the FPS \(\left(a,0,0,0,\ldots \right)\). An FPS of the form \(\underline{a}\) for some \(a\in K\) (that is, an FPS \(\left(a_{0},a_{1},a_{2},\ldots \right)\) satisfying \(a_{1}=a_{2}=a_{3}=\cdots =0\)) is said to be constant.

(f) The set of all FPSs (in \(1\) indeterminate over \(K\)) is denoted \(K\left[\left[x\right]\right]\).

Definition 1.75
#

If \(n\in \mathbb {N}\), and if \(\mathbf{a}=\left( a_{0},a_{1},a_{2},\ldots \right) \in K\left[\left[x\right]\right]\) is an FPS, then we define an element \(\left[x^{n}\right]\mathbf{a}\in K\) by

\[ \left[x^{n}\right]\mathbf{a}:=a_{n}. \]

This is called the coefficient of \(x^{n}\) in \(\mathbf{a}\), or the \(n\)-th coefficient of \(\mathbf{a}\), or the \(x^{n}\)-coefficient of \(\mathbf{a}\).

Theorem 1.76

(a) The set \(K\left[\left[x\right]\right]\) is a commutative ring (with its operations \(+\), \(-\) and \(\cdot \) defined in Definition 1.74). Its zero and its unity are the FPSs \(\underline{0}=\left(0,0,0,\ldots \right)\) and \(\underline{1}=\left( 1,0,0,0,\ldots \right)\). This means, concretely, that the following facts hold:

  1. Commutativity of addition: We have \(\mathbf{a}+\mathbf{b}=\mathbf{b}+\mathbf{a}\) for all \(\mathbf{a},\mathbf{b}\in K\left[\left[ x\right]\right]\).

  2. Associativity of addition: We have \(\mathbf{a}+\left( \mathbf{b}+\mathbf{c}\right) =\left(\mathbf{a}+\mathbf{b}\right) +\mathbf{c}\) for all \(\mathbf{a},\mathbf{b},\mathbf{c}\in K\left[\left[ x\right]\right]\).

  3. Neutrality of zero: We have \(\mathbf{a}+\underline{0}=\underline{0}+\mathbf{a}=\mathbf{a}\) for all \(\mathbf{a}\in K\left[\left[ x\right]\right]\).

  4. Subtraction undoes addition: Let \(\mathbf{a},\mathbf{b},\mathbf{c}\in K\left[\left[x\right]\right]\). We have \(\mathbf{a}+\mathbf{b}=\mathbf{c}\) if and only if \(\mathbf{a}=\mathbf{c}-\mathbf{b}\).

  5. Commutativity of multiplication: We have \(\mathbf{ab}=\mathbf{ba}\) for all \(\mathbf{a},\mathbf{b}\in K\left[\left[x\right] \right]\).

  6. Associativity of multiplication: We have \(\mathbf{a}\left( \mathbf{bc}\right) =\left(\mathbf{ab}\right)\mathbf{c}\) for all \(\mathbf{a},\mathbf{b},\mathbf{c}\in K\left[\left[x\right]\right]\).

  7. Distributivity: We have

    \[ \mathbf{a}\left(\mathbf{b}+\mathbf{c}\right) =\mathbf{ab}+\mathbf{ac}\ \ \ \ \ \ \ \ \ \ \text{and}\ \ \ \ \ \ \ \ \ \ \left(\mathbf{a}+\mathbf{b}\right)\mathbf{c}=\mathbf{ac}+\mathbf{bc} \]

    for all \(\mathbf{a},\mathbf{b},\mathbf{c}\in K\left[\left[x\right] \right]\).

  8. Neutrality of one: We have \(\mathbf{a}\cdot \underline{1}=\underline{1}\cdot \mathbf{a}=\mathbf{a}\) for all \(\mathbf{a}\in K\left[ \left[x\right]\right]\).

  9. Annihilation: We have \(\mathbf{a}\cdot \underline{0}=\underline{0}\cdot \mathbf{a}=\underline{0}\) for all \(\mathbf{a}\in K\left[ \left[x\right]\right]\).

(b) Furthermore, \(K\left[\left[x\right]\right]\) is a \(K\)-module (with its scaling being the map that sends each \(\left( \lambda ,\mathbf{a}\right) \in K\times K\left[\left[x\right]\right]\) to the FPS \(\lambda \mathbf{a}\) defined in Definition 1.74 (c)). Its zero vector is \(\underline{0}\). Concretely, this means that:

  1. Associativity of scaling: We have \(\lambda \left( \mu \mathbf{a}\right) =\left( \lambda \mu \right) \mathbf{a}\) for all \(\lambda ,\mu \in K\) and \(\mathbf{a}\in K\left[\left[x\right]\right]\).

  2. Left distributivity: We have \(\lambda \left( \mathbf{a}+\mathbf{b}\right) =\lambda \mathbf{a}+\lambda \mathbf{b}\) for all \(\lambda \in K\) and \(\mathbf{a},\mathbf{b}\in K\left[\left[x\right]\right]\).

  3. Right distributivity: We have \(\left( \lambda +\mu \right) \mathbf{a}=\lambda \mathbf{a}+\mu \mathbf{a}\) for all \(\lambda ,\mu \in K\) and \(\mathbf{a}\in K\left[\left[x\right]\right]\).

  4. Neutrality of one: We have \(1\mathbf{a}=\mathbf{a}\) for all \(\mathbf{a}\in K\left[\left[x\right]\right]\).

  5. Left annihilation: We have \(0\mathbf{a}=\underline{0}\) for all \(\mathbf{a}\in K\left[\left[x\right]\right]\).

  6. Right annihilation: We have \(\lambda \underline{0}=\underline{0}\) for all \(\lambda \in K\).

(c) We have \(\lambda \left(\mathbf{a}\cdot \mathbf{b}\right) =\left(\lambda \mathbf{a}\right)\cdot \mathbf{b}=\mathbf{a}\cdot \left( \lambda \mathbf{b}\right)\) for all \(\lambda \in K\) and \(\mathbf{a},\mathbf{b}\in K\left[\left[x\right]\right]\).

(d) Finally, we have \(\lambda \mathbf{a}=\underline{\lambda }\cdot \mathbf{a}\) for all \(\lambda \in K\) and \(\mathbf{a}\in K\left[\left[ x\right]\right]\).

theorem AlgebraicCombinatorics.FPS.smul_mul_fps {R : Type u_1} [CommRing R] (c : R) (f g : PowerSeries R) :
c (f * g) = c f * g
Proof

Most parts of Theorem 1.76 are straightforward to verify. Let us check the associativity of multiplication.

Let \(\mathbf{a},\mathbf{b},\mathbf{c}\in K\left[\left[x\right]\right]\). We must prove that \(\mathbf{a}\left(\mathbf{bc}\right) = \left( \mathbf{ab}\right)\mathbf{c}\). Let \(n\in \mathbb {N}\). Consider the two equalities

\begin{align*} \left[x^{n}\right]\left(\left(\mathbf{ab}\right)\mathbf{c}\right) & =\sum _{j=0}^{n}\underbrace{\left[x^{n-j}\right]\left(\mathbf{ab}\right)}_{=\sum _{i=0}^{n-j}\left[x^{i}\right]\mathbf{a}\cdot \left[x^{n-j-i}\right]\mathbf{b}}\cdot \left[x^{j}\right]\mathbf{c}\\ & =\sum _{j=0}^{n}\ \ \sum _{i=0}^{n-j}\left[x^{i}\right]\mathbf{a}\cdot \left[x^{n-j-i}\right]\mathbf{b}\cdot \left[x^{j}\right]\mathbf{c}\end{align*}

and

\begin{align*} \left[x^{n}\right]\left(\mathbf{a}\left(\mathbf{bc}\right)\right) & =\sum _{i=0}^{n}\left[x^{i}\right]\mathbf{a}\cdot \underbrace{\left[ x^{n-i}\right]\left(\mathbf{bc}\right)}_{=\sum _{j=0}^{n-i}\left[x^{n-i-j}\right]\mathbf{b}\cdot \left[x^{j}\right] \mathbf{c}}\\ & =\sum _{i=0}^{n}\ \ \sum _{j=0}^{n-i}\left[x^{i}\right]\mathbf{a}\cdot \left[x^{n-i-j}\right]\mathbf{b}\cdot \left[x^{j}\right] \mathbf{c}. \end{align*}

The right hand sides are equal since

\[ \sum _{j=0}^{n}\ \ \sum _{i=0}^{n-j}=\sum _{\substack{[\left , (, i, ,, j, \right , ), , \in , \mathbb , {, N, }, ^, {, 2, }, ;, \\ , i, +, j, \leq , n]}}=\sum _{i=0}^{n}\ \ \sum _{j=0}^{n-i} \]

and \(n-j-i=n-i-j\). Thus \(\left[x^{n}\right]\left(\left(\mathbf{ab}\right)\mathbf{c}\right) =\left[x^{n}\right]\left(\mathbf{a}\left(\mathbf{bc}\right)\right)\) for each \(n\in \mathbb {N}\), which entails \(\left(\mathbf{ab}\right) \mathbf{c}=\mathbf{a}\left(\mathbf{bc}\right)\).

The remaining claims of Theorem 1.76 follow by similar (and easier) coefficient-wise verifications. In the Lean formalization, the commutative ring and module structures are provided by Mathlib’s existing instances on power series.

Lemma 1.77

The product formula can be written as a sum over a range:

\[ \left[x^{n}\right]\left(\mathbf{ab}\right) = \sum _{i=0}^{n}\left[x^{i}\right]\mathbf{a}\cdot \left[x^{n-i}\right]\mathbf{b}. \]
theorem AlgebraicCombinatorics.FPS.coeff_mul_fps' {R : Type u_1} [CommRing R] (n : ) (f g : PowerSeries R) :
(PowerSeries.coeff n) (f * g) = iFinset.range (n + 1), (PowerSeries.coeff i) f * (PowerSeries.coeff (n - i)) g
Proof

This rewrites the antidiagonal sum from Definition 1.74 as a range sum using the bijection \((i, n-i) \leftrightarrow i \in \{ 0, \ldots , n\} \).

1.3.3 Essentially finite sums and summable families

Definition 1.78
#

(a) A family \(\left(a_{i}\right)_{i\in I}\in K^{I}\) of elements of \(K\) is said to be essentially finite if all but finitely many \(i\in I\) satisfy \(a_{i}=0\) (in other words, if the set \(\left\{ i\in I\ \mid \ a_{i}\neq 0\right\} \) is finite).

(b) Let \(\left(a_{i}\right)_{i\in I}\in K^{I}\) be an essentially finite family of elements of \(K\). Then, the infinite sum \(\sum _{i\in I}a_{i}\) is defined to equal the finite sum \(\sum _{\substack{[i, \in , I, ;, \\ , a, _, {, i, }, \neq , 0]}}a_{i}\). Such an infinite sum is said to be essentially finite.

Definition 1.79
#

A (possibly infinite) family \(\left(\mathbf{a}_{i}\right)_{i\in I}\) of FPSs is said to be summable (or entrywise essentially finite) if

\[ \text{for each }n\in \mathbb {N}\text{, all but finitely many }i\in I\text{ satisfy }\left[x^{n}\right]\mathbf{a}_{i}=0. \]

In this case, the sum \(\sum _{i\in I}\mathbf{a}_{i}\) is defined to be the FPS with

\[ \left[x^{n}\right]\left(\sum _{i\in I}\mathbf{a}_{i}\right) =\underbrace{\sum _{i\in I}\left[x^{n}\right]\mathbf{a}_{i}}_{\substack{[\text , {, a, n, , e, s, s, e, n, t, i, a, l, l, y, }, \\ , \text , {, f, i, n, i, t, e, , s, u, m, }]}} \ \ \ \ \ \ \ \ \ \ \text{for all }n\in \mathbb {N}\text{.} \]
Proposition 1.80

Let \(\left(\mathbf{a}_{i}\right)_{i\in I}\) be a summable family of FPSs. Then, any subfamily of \(\left(\mathbf{a}_{i}\right)_{i\in I}\) is summable as well.

theorem AlgebraicCombinatorics.FPS.summableFPS_subfamily {R : Type u_1} [CommRing R] {ι : Type u_2} {f : ιPowerSeries R} (J : Set ι) (hf : SummableFPS f) :
SummableFPS fun (i : J) => f i
Proof

Let \(J\) be a subset of \(I\). We must prove that the subfamily \(\left(\mathbf{a}_{i}\right)_{i\in J}\) is summable.

Let \(n\in \mathbb {N}\). Then, all but finitely many \(i\in I\) satisfy \(\left[ x^{n}\right]\mathbf{a}_{i}=0\) (since the family \(\left(\mathbf{a}_{i}\right)_{i\in I}\) is summable). Hence, all but finitely many \(i\in J\) satisfy \(\left[x^{n}\right]\mathbf{a}_{i}=0\) (since \(J\) is a subset of \(I\)). Since we have proved this for each \(n\in \mathbb {N}\), we thus conclude that the family \(\left(\mathbf{a}_{i}\right)_{i\in J}\) is summable.

Proposition 1.81

Sums of summable families of FPSs satisfy the usual rules for sums (such as the breaking-apart rule \(\sum _{i\in S}a_{s}=\sum _{i\in X}a_{s}+\sum _{i\in Y}a_{s}\) when a set \(S\) is the union of two disjoint sets \(X\) and \(Y\)). See [ 19s , Proposition 7.2.11 ] for details. Again, the only caveat is about interchange of summation signs: The equality

\[ \sum _{i\in I}\ \ \sum _{j\in J}\mathbf{a}_{i,j}=\sum _{j\in J}\ \ \sum _{i\in I}\mathbf{a}_{i,j} \]

holds when the family \(\left(\mathbf{a}_{i,j}\right)_{\left(i,j\right) \in I\times J}\) is summable (i.e., when for each \(n\in \mathbb {N}\), all but finitely many pairs \(\left(i,j\right) \in I\times J\) satisfy \(\left[x^{n}\right]\mathbf{a}_{i,j}=0\)); it does not generally hold if we merely assume that the sums \(\sum _{i\in I}\ \ \sum _{j\in J}\mathbf{a}_{i,j}\) and \(\sum _{j\in J}\ \ \sum _{i\in I}\mathbf{a}_{i,j}\) are summable.

theorem AlgebraicCombinatorics.FPS.summableFPS_fubini {R : Type u_1} [CommRing R] {ι : Type u_2} {κ : Type u_3} {f : ι × κPowerSeries R} (hf : SummableFPS f) :
(∀ (i : ι), SummableFPS fun (j : κ) => f (i, j)) ∀ (j : κ), SummableFPS fun (i : ι) => f (i, j)
Proof

The proof is tedious (as there are many rules to check), but fairly straightforward (the idea is always to focus on a single coefficient, and then to reduce the infinite sums to finite sums). For example, consider the discrete Fubini rule, which says that

\[ \sum _{i\in I}\ \ \sum _{j\in J}\mathbf{a}_{i,j}=\sum _{\left(i,j\right) \in I\times J}\mathbf{a}_{i,j}=\sum _{j\in J}\ \ \sum _{i\in I}\mathbf{a}_{i,j} \]

whenever \(\left(\mathbf{a}_{i,j}\right)_{\left(i,j\right) \in I\times J}\) is a summable family of FPSs. In order to prove this rule, we fix a summable family \(\left(\mathbf{a}_{i,j}\right)_{\left(i,j\right) \in I\times J}\) of FPSs. It is easy to see that the families \(\left( \mathbf{a}_{i,j}\right)_{j\in J}\) for all \(i\in I\) are summable as well, as are the families \(\left(\mathbf{a}_{i,j}\right)_{i\in I}\) for all \(j\in J\), and the families \(\left(\sum _{j\in J}\mathbf{a}_{i,j}\right)_{i\in I}\) and \(\left(\sum _{i\in I}\mathbf{a}_{i,j}\right)_{j\in J}\).

To verify the Fubini identity, it suffices to check that

\[ \left[x^{n}\right]\left(\sum _{i\in I}\ \ \sum _{j\in J}\mathbf{a}_{i,j}\right) = \left[x^{n}\right]\left(\sum _{\left(i,j\right) \in I\times J}\mathbf{a}_{i,j}\right) = \left[x^{n}\right]\left(\sum _{j\in J}\ \ \sum _{i\in I}\mathbf{a}_{i,j}\right) \]

for each \(n\in \mathbb {N}\). Fix \(n\in \mathbb {N}\); then, we have \(\left[ x^{n}\right]\left(\mathbf{a}_{i,j}\right) =0\) for all but finitely many \(\left(i,j\right) \in I\times J\) (since the family \(\left(\mathbf{a}_{i,j}\right)_{\left(i,j\right) \in I\times J}\) is summable). That is, the set of all pairs \(\left(i,j\right) \in I\times J\) satisfying \(\left[ x^{n}\right]\left(\mathbf{a}_{i,j}\right) \neq 0\) is finite. Hence, the set \(I^{\prime }\) of the first entries and the set \(J^{\prime }\) of the second entries of all these pairs are also finite. The three sums reduce to finite sums over \(I^{\prime }\times J^{\prime }\), which are equal by the usual Fubini rule for finite sums. See [ 19s , proof of Proposition 7.2.11 ] for more details.

1.3.4 The indeterminate \(x\) and powers

Definition 1.82
#

Let \(x\) denote the FPS \(\left(0,1,0,0,0,\ldots \right)\). In other words, let \(x\) denote the FPS with \(\left[x^{1}\right]x=1\) and \(\left[x^{i}\right]x=0\) for all \(i\neq 1\).

Lemma 1.83

Let \(\mathbf{a}=\left(a_{0},a_{1},a_{2},\ldots \right)\) be an FPS. Then, \(x\cdot \mathbf{a}=\left(0,a_{0},a_{1},a_{2},\ldots \right)\).

Proof

If \(n\) is a positive integer, then

\begin{align*} \left[x^{n}\right]\left(x\cdot \mathbf{a}\right) & =\sum _{i=0}^{n}\left[x^{i}\right]x\cdot a_{n-i}\\ & =\underbrace{\left[x^{0}\right]x}_{=0}\cdot \, a_{n-0}+\underbrace{\left[x^{1}\right]x}_{=1}\cdot \, a_{n-1}+\sum _{i=2}^{n}\underbrace{\left[x^{i}\right] x}_{\substack{[=, 0, \\ , \text , {, (, s, i, n, c, e, , }, i, \geq , 2, {\gt}, 1, \text , {, ), }]}}\cdot \, a_{n-i}\\ & =a_{n-1}. \end{align*}

A similar argument for \(n=0\) yields \(\left[x^{0}\right]\left(x\cdot \mathbf{a}\right)=0\). Thus, for each \(n\in \mathbb {N}\),

\[ \left[x^{n}\right]\left(x\cdot \mathbf{a}\right) = \begin{cases} a_{n-1}, & \text{if }n{\gt}0;\\ 0, & \text{if }n=0. \end{cases} \]

In other words, \(x\cdot \mathbf{a}=\left(0,a_{0},a_{1},a_{2},\ldots \right)\).

Proposition 1.84

We have

\[ x^{k}=\left(\underbrace{0,0,\ldots ,0}_{k\text{ times}},1,0,0,0,\ldots \right) \ \ \ \ \ \ \ \ \ \ \text{for each }k\in \mathbb {N}. \]
Proof

We induct on \(k\).

Induction base: We have \(x^{0}=\underline{1}=\left(1,0,0,0,0,\ldots \right) = \left(\underbrace{0,0,\ldots ,0}_{0\text{ times}},1,0,0,0,\ldots \right)\).

Induction step: Let \(m\in \mathbb {N}\). Assume that Proposition 1.84 holds for \(k=m\). We have \(x^{m}=\left(\underbrace{0,0,\ldots ,0}_{m\text{ times}},1,0,0,0,\ldots \right)\). Thus, Lemma 1.83 (applied to \(\mathbf{a}=x^{m}\)) yields

\[ x\cdot x^{m}=\left(0,\underbrace{0,0,\ldots ,0}_{m\text{ times}},1,0,0,0,\ldots \right) = \left(\underbrace{0,0,\ldots ,0}_{m+1\text{ times}},1,0,0,0,\ldots \right). \]

Since \(x\cdot x^{m}=x^{m+1}\), this completes the induction step.

Corollary 1.85

Any FPS \(\left(a_{0},a_{1},a_{2},\ldots \right) \in K\left[\left[x\right]\right]\) satisfies

\[ \left(a_{0},a_{1},a_{2},\ldots \right) = a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots = \sum _{n\in \mathbb {N}}a_{n}x^{n}. \]

In particular, the right hand side here is well-defined, i.e., the family \(\left(a_{n}x^{n}\right)_{n\in \mathbb {N}}\) is summable.

Proof

By Proposition 1.84, we have

\begin{align*} & a_{0}+a_{1}x+a_{2}x^{2}+a_{3}x^{3}+\cdots \\ & =\ \ \ \ a_{0}\left(1,0,0,0,\ldots \right) \\ & \ \ \ \ +a_{1}\left(0,1,0,0,\ldots \right) \\ & \ \ \ \ +a_{2}\left(0,0,1,0,\ldots \right) \\ & \ \ \ \ +a_{3}\left(0,0,0,1,\ldots \right) \\ & \ \ \ \ +\cdots \\ & =\ \ \ \ \left(a_{0},0,0,0,\ldots \right) \\ & \ \ \ \ +\left(0,a_{1},0,0,\ldots \right) \\ & \ \ \ \ +\left(0,0,a_{2},0,\ldots \right) \\ & \ \ \ \ +\left(0,0,0,a_{3},\ldots \right) \\ & \ \ \ \ +\cdots \\ & =\left(a_{0},a_{1},a_{2},a_{3},\ldots \right). \end{align*}

1.3.5 Helper lemmas from the formalization

Lemma 1.86

Two FPSs \(f\) and \(g\) are equal if and only if \(\left[x^{n}\right]f = \left[x^{n}\right]g\) for all \(n\in \mathbb {N}\).

Proof

Immediate from the definition of FPS as a sequence.

Lemma 1.87

For any \(\mathbf{a},\mathbf{b}\in K\left[\left[x\right]\right]\), we have \(\left[x^{0}\right]\left(\mathbf{ab}\right) = \left[x^{0}\right] \mathbf{a}\cdot \left[x^{0}\right]\mathbf{b}\). That is, the constant term of a product is the product of the constant terms.

Proof

Follows from the product formula with \(n=0\): \(\left[x^{0}\right](\mathbf{ab}) = \sum _{i=0}^{0} \left[x^{i}\right]\mathbf{a}\cdot \left[x^{0-i}\right]\mathbf{b} = \left[x^{0}\right]\mathbf{a}\cdot \left[x^{0}\right]\mathbf{b}\).

Lemma 1.88

For any \(k\in \mathbb {N}\) and any FPS \(\mathbf{a}\),

\[ \left[x^{n}\right]\left(x^{k}\cdot \mathbf{a}\right) = \begin{cases} 0, & \text{if }n{\lt}k;\\ \left[x^{n-k}\right]\mathbf{a}, & \text{if }n\geq k. \end{cases} \]

That is, multiplication by \(x^{k}\) shifts coefficients by \(k\) positions.

Proof

By induction on \(k\), using Lemma 1.83 for the induction step.

Lemma 1.89

If \(\left(\mathbf{a}_{i}\right)_{i\in I}\) and \(\left(\mathbf{b}_{i}\right)_{i\in I}\) are summable families of FPSs, then so is \(\left(\mathbf{a}_{i}+\mathbf{b}_{i}\right)_{i\in I}\).

theorem AlgebraicCombinatorics.FPS.summableFPS_add {R : Type u_1} [CommRing R] {ι : Type u_2} {f g : ιPowerSeries R} (hf : SummableFPS f) (hg : SummableFPS g) :
SummableFPS fun (i : ι) => f i + g i
Proof

For each \(n\in \mathbb {N}\), \(\{ i \mid \left[x^{n}\right](\mathbf{a}_{i}+\mathbf{b}_{i})\neq 0\} \subseteq \{ i \mid \left[x^{n}\right]\mathbf{a}_{i}\neq 0\} \cup \{ i \mid \left[x^{n}\right]\mathbf{b}_{i}\neq 0\} \), and the union of two finite sets is finite.

Lemma 1.90

If \(\left(\mathbf{a}_{i}\right)_{i\in I}\) is a summable family of FPSs, then so is \(\left(-\mathbf{a}_{i}\right)_{i\in I}\).

theorem AlgebraicCombinatorics.FPS.summableFPS_neg {R : Type u_1} [CommRing R] {ι : Type u_2} {f : ιPowerSeries R} (hf : SummableFPS f) :
SummableFPS fun (i : ι) => -f i
Proof

For each \(n\), \(\left[x^{n}\right](-\mathbf{a}_{i})=-\left[x^{n}\right]\mathbf{a}_{i}\), so \(\{ i \mid \left[x^{n}\right](-\mathbf{a}_{i})\neq 0\} = \{ i \mid \left[x^{n}\right]\mathbf{a}_{i}\neq 0\} \).

Lemma 1.91

The sum of two essentially finite families is essentially finite.

theorem AlgebraicCombinatorics.FPS.essentiallyFinite_add {R : Type u_1} [CommRing R] {ι : Type u_2} {f g : ιR} (hf : EssentiallyFinite f) (hg : EssentiallyFinite g) :
EssentiallyFinite fun (i : ι) => f i + g i
Proof

\(\{ i \mid a_{i}+b_{i}\neq 0\} \subseteq \{ i \mid a_{i}\neq 0\} \cup \{ i \mid b_{i}\neq 0\} \), and the union of two finite sets is finite.

Lemma 1.92

The negation of an essentially finite family is essentially finite.

theorem AlgebraicCombinatorics.FPS.essentiallyFinite_neg {R : Type u_1} [CommRing R] {ι : Type u_2} {f : ιR} (hf : EssentiallyFinite f) :
EssentiallyFinite fun (i : ι) => -f i
Proof

\(\{ i \mid -a_{i}\neq 0\} =\{ i \mid a_{i}\neq 0\} \).

Lemma 1.93

The difference of two essentially finite families is essentially finite.

theorem AlgebraicCombinatorics.FPS.essentiallyFinite_sub {R : Type u_1} [CommRing R] {ι : Type u_2} {f g : ιR} (hf : EssentiallyFinite f) (hg : EssentiallyFinite g) :
EssentiallyFinite fun (i : ι) => f i - g i
Proof

Write \(a_i - b_i = a_i + (-b_i)\) and apply Lemma 1.91 and Lemma 1.92.

Definition 1.94
#

For an essentially finite family \((a_i)_{i\in I}\), the essentially finite sum \(\sum _{i\in I} a_i\) is defined as \(\sum _{i\in S} a_i\) where \(S = \{ i\in I \mid a_i \neq 0\} \).

noncomputable def AlgebraicCombinatorics.FPS.essFinSum {R : Type u_1} [CommRing R] {ι : Type u_2} (f : ιR) (hf : EssentiallyFinite f) :
R
Lemma 1.95

The essentially finite sum distributes over addition: if \((a_i)_{i\in I}\) and \((b_i)_{i\in I}\) are essentially finite families, then \(\sum _{i\in I}(a_i + b_i) = \sum _{i\in I} a_i + \sum _{i\in I} b_i\).

theorem AlgebraicCombinatorics.FPS.essFinSum_add {R : Type u_1} [CommRing R] {ι : Type u_2} [DecidableEq ι] {f g : ιR} (hf : EssentiallyFinite f) (hg : EssentiallyFinite g) (hfg : EssentiallyFinite fun (i : ι) => f i + g i) :
essFinSum (fun (i : ι) => f i + g i) hfg = essFinSum f hf + essFinSum g hg
Proof

All three sums can be computed over the finite set \(S = \{ i \mid a_i\neq 0\} \cup \{ i \mid b_i\neq 0\} \), so this reduces to the finite sum identity \(\sum _{i\in S}(a_i+b_i)=\sum _{i\in S}a_i+\sum _{i\in S}b_i\).

Lemma 1.96

For a scalar \(c\in K\) and an essentially finite family \((a_i)_{i\in I}\), \(\sum _{i\in I} c\, a_i = c\cdot \sum _{i\in I} a_i\).

theorem AlgebraicCombinatorics.FPS.essFinSum_smul {R : Type u_1} [CommRing R] {ι : Type u_2} {f : ιR} (c : R) (hf : EssentiallyFinite f) (hcf : EssentiallyFinite fun (i : ι) => c * f i) :
essFinSum (fun (i : ι) => c * f i) hcf = c * essFinSum f hf
Proof

The support of \((c\, a_i)\) is contained in the support of \((a_i)\), so this reduces to the finite identity \(\sum _{i\in S}c\, a_i = c\sum _{i\in S}a_i\).

Lemma 1.97

If \(\left(\mathbf{a}_{i}\right)_{i\in I}\) and \(\left(\mathbf{b}_{i}\right)_{i\in I}\) are summable families of FPSs, then so is \(\left(\mathbf{a}_{i}-\mathbf{b}_{i}\right)_{i\in I}\).

theorem AlgebraicCombinatorics.FPS.summableFPS_sub {R : Type u_1} [CommRing R] {ι : Type u_2} {f g : ιPowerSeries R} (hf : SummableFPS f) (hg : SummableFPS g) :
SummableFPS fun (i : ι) => f i - g i
Proof

Write \(\mathbf{a}_i - \mathbf{b}_i = \mathbf{a}_i + (-\mathbf{b}_i)\) and apply Lemma 1.89 and Lemma 1.90.

Lemma 1.98

If \((\mathbf{a}_i)_{i\in I}\) is a family of FPSs such that \(\{ i \mid \mathbf{a}_i \neq 0\} \) is finite, then the family is summable.

theorem AlgebraicCombinatorics.FPS.summableFPS_of_essentiallyFinite {R : Type u_1} [CommRing R] {ι : Type u_2} (f : ιPowerSeries R) (hf : {i : ι | f i 0}.Finite) :
Proof

For each \(n\), \(\{ i \mid [x^n]\mathbf{a}_i \neq 0\} \subseteq \{ i \mid \mathbf{a}_i \neq 0\} \), which is finite by hypothesis.

Lemma 1.99

For \(a\in K\) and \(k,n\in \mathbb {N}\), \([x^n](\underline{a}\cdot x^k) = \begin{cases} a & \text{if } n = k, \\ 0 & \text{otherwise.}\end{cases}\)

Proof

Follows from \([x^n]x^k = \delta _{n,k}\) (Proposition 1.84) and \([x^n](\underline{a}\cdot f) = a\cdot [x^n]f\).

Lemma 1.100

Multiplying on the right by \(x\) also shifts coefficients: \([x^{n+1}](\mathbf{a}\cdot x) = [x^n]\mathbf{a}\).

Proof

By commutativity of multiplication, \(\mathbf{a}\cdot x = x\cdot \mathbf{a}\), so this follows from Lemma 1.83.

Lemma 1.101

For any \(k\in \mathbb {N}\) and any FPS \(\mathbf{a}\), \([x^n](\mathbf{a}\cdot x^k) = \begin{cases} 0 & \text{if }n{\lt}k, \\[x^{n-k}]\mathbf{a} & \text{if }n\geq k.\end{cases}\)

Proof

By commutativity: \(\mathbf{a}\cdot x^k = x^k\cdot \mathbf{a}\), so this follows from Lemma 1.88.

1.3.6 Generating functions

Definition 1.102
#

The (ordinary) generating function of a sequence \((a_0, a_1, a_2, \ldots )\) is the FPS \((a_0, a_1, a_2, \ldots ) = \sum _{n\geq 0} a_n x^n\).

Lemma 1.103

The \(n\)-th coefficient of the generating function of a sequence \((a_n)\) is \(a_n\).

Proof

Immediate from the definitions.

1.3.7 The Chu–Vandermonde identity

Proposition 1.104

Let \(a,b\in \mathbb {N}\), and let \(n\in \mathbb {N}\). Then,

\[ \binom {a+b}{n}=\sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k}. \]
theorem AlgebraicCombinatorics.FPS.vandermonde_nat (a b n : ) :
(a + b).choose n = ijFinset.antidiagonal n, a.choose ij.1 * b.choose ij.2
Proof

Multiply out the identity \(\left(1+x\right)^{a+b}=\left(1+x\right)^{a}\left(1+x\right)^{b}\) using the binomial formula and compare the coefficient of \(x^{n}\) on both sides. The left side gives \(\binom {a+b}{n}\), and the right side gives \(\sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k}\) by the product formula for FPSs.

Lemma 1.105

The Vandermonde identity in range-sum form: for \(a, b, n \in \mathbb {N}\), \(\binom {a+b}{n} = \sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k}\).

theorem AlgebraicCombinatorics.FPS.vandermonde_nat' (a b n : ) :
(a + b).choose n = kFinset.range (n + 1), a.choose k * b.choose (n - k)
Proof

Rewrites the antidiagonal sum from Proposition 1.104 as a range sum.

Theorem 1.106 Vandermonde convolution identity, aka Chu–Vandermonde identity

Let \(a,b\in \mathbb {C}\), and let \(n\in \mathbb {N}\). Then,

\[ \binom {a+b}{n}=\sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k}. \]
theorem AlgebraicCombinatorics.FPS.chuVandermonde {S : Type u_2} [CommRing S] [BinomialRing S] (a b : S) (n : ) :
Ring.choose (a + b) n = ijFinset.antidiagonal n, Ring.choose a ij.1 * Ring.choose b ij.2
Proof

Fix \(n\in \mathbb {N}\) and \(b\in \mathbb {N}\). By Proposition 1.104, the equality

\[ \binom {a+b}{n}=\sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k} \]

holds for each \(a\in \mathbb {N}\). However, both sides are polynomials in \(a\):

\begin{align*} \binom {a+b}{n} & =\frac{\left(a+b\right)\left(a+b-1\right)\cdots \left(a+b-n+1\right)}{n!},\\ \sum _{k=0}^{n}\binom {a}{k}\binom {b}{n-k} & =\sum _{k=0}^{n}\frac{a\left( a-1\right)\cdots \left(a-k+1\right)}{k!}\binom {b}{n-k}. \end{align*}

Two univariate polynomials that agree on all of \(\mathbb {N}\) (infinitely many points) must be identical. Hence the equality holds for all \(a\in \mathbb {C}\).

Now fix \(a\in \mathbb {C}\) and repeat the argument with \(b\) as the variable: both sides are polynomials in \(b\) that agree on \(\mathbb {N}\), hence they agree on \(\mathbb {C}\). (See [ 20f , proofs of Lemma 7.5.8 and Theorem 7.5.3 ] or [ 19s , § 2.17.3 ] for this proof in more detail. Alternatively, see [ Grinbe15 , § 3.3.2 and § 3.3.3 ] for two other proofs.)