q-Binomial Formulas #
This file formalizes the q-binomial formulas from the Algebraic Combinatorics text, including:
- The first q-binomial theorem
- The second q-binomial theorem (Potter's binomial theorem)
- Counting subspaces of finite-dimensional vector spaces over finite fields
- Limits of q-binomial coefficients
Main Definitions (in namespace AlgebraicCombinatorics.QBinomialRec) #
qBinomial: The q-binomial coefficient[n choose k]_q, defined via q-Pascal recurrenceqFactorial: The q-factorial[n]_q!qNat: The q-analog of natural number[n]_q
Namespace structure: All definitions in this file are in the sub-namespace
AlgebraicCombinatorics.QBinomialRec to avoid conflicts with the canonical definitions
in QBinomialBasic.lean. The canonical definitions use the monotone function sum formula,
while this file uses the q-Pascal recurrence. Both are equivalent (see qBinomial_eq_sum_monotone).
To use definitions from this file:
- Use full path:
AlgebraicCombinatorics.QBinomialRec.qBinomial - Or open the namespace:
open AlgebraicCombinatorics.QBinomialRec
Main Results #
qBinomial_eq_sum_monotone: Equivalence to the monotone function sum definitionqBinomial_eq_sum_subsets: Equivalence to the subset sum formulaqBinomial_first_theorem: The first q-binomial theoremqBinomial_second_theorem: The second q-binomial theorem (Potter's binomial theorem)qBinomial_subspace_count: The q-binomial coefficient counts k-dimensional subspacesqBinomial_limit: The limit of q-binomial coefficients as n → ∞
References #
- Section on q-binomial formulas from Algebraic Combinatorics lecture notes
- See also
QBinomialBasic.leanfor the canonical definition and basic properties
Sub-namespace for Recursive q-Binomial Definitions #
The definitions qNat, qFactorial, qBinomial, and related theorems in this file
use the q-Pascal recurrence, which is different from the monotone function sum
definition in QBinomialBasic.lean. To avoid namespace conflicts when both files
are imported together, these definitions are placed in the QBinomialRec sub-namespace.
The equivalence between the two definitions is proven in qBinomial_eq_sum_monotone.
To use these definitions, either:
- Open the namespace:
open AlgebraicCombinatorics.QBinomialRec - Use the full path:
AlgebraicCombinatorics.QBinomialRec.qBinomial
Definition def.pars.qbinom.qint: q-integers and q-factorials #
This section formalizes the q-analogs of integers and factorials from Definition 2.3.2.
Part (a): The q-integer [n]_q = q^0 + q^1 + ... + q^{n-1} ∈ ℤ[q]
Part (b): The q-factorial [n]_q! = [1]_q · [2]_q · ... · [n]_q ∈ ℤ[q]
Part (c): For any element a of a ring A, [n]_a and [n]_a! denote the results
of substituting a for q in [n]_q and [n]_q!, respectively.
Remark rmk.pars.qbinom.qint.frac #
For any n ∈ ℕ:
[n]_q = (1 - q^n)/(1 - q)(in ℤ⟦q⟧ or in the field of rational functions)[n]_1 = n[n]_1! = n!
Definition def.pars.qbinom.qint (a): The q-integer [n]_q.
The q-analog of a natural number is defined as the sum:
[n]_q = q^0 + q^1 + q^2 + ... + q^{n-1}
This equals (1 - q^n)/(1 - q) in appropriate rings (see qNat_eq_geom_sum).
When evaluated at q = 1, this equals n (see qNat_at_one).
Equations
- AlgebraicCombinatorics.QBinomialRec.qNat q n = ∑ i ∈ Finset.range n, q ^ i
Instances For
Definition def.pars.qbinom.qint (b): The q-factorial [n]_q!.
The q-factorial is defined as the product:
[n]_q! = [1]_q · [2]_q · ... · [n]_q
When evaluated at q = 1, this equals n! (see qFactorial_at_one).
Equations
- AlgebraicCombinatorics.QBinomialRec.qFactorial q n = ∏ i ∈ Finset.range n, AlgebraicCombinatorics.QBinomialRec.qNat q (i + 1)
Instances For
The q-binomial coefficient (Gaussian binomial coefficient)
[n choose k]_q = [n]_q! / ([k]_q! · [n-k]_q!).
This is defined as a polynomial in q with integer coefficients. It counts partitions that fit in a k × (n-k) box, weighted by q^|λ|.
We use the recurrence relation (q-Pascal's identity): [n choose k]_q = [n-1 choose k-1]_q + q^k · [n-1 choose k]_q
This avoids division and works over any commutative ring.
This definition is equivalent to AlgebraicCombinatorics.qBinomial in QBinomialBasic.lean,
which uses the monotone function sum definition. The equivalence is proven in
qBinomial_eq_sum_monotone. The argument order here is (q : R) (n k : ℕ) vs
(n k : ℕ) (q : R) in QBinomialBasic.lean.
Equations
- AlgebraicCombinatorics.QBinomialRec.qBinomial q x✝ 0 = 1
- AlgebraicCombinatorics.QBinomialRec.qBinomial q 0 n.succ = 0
- AlgebraicCombinatorics.QBinomialRec.qBinomial q n.succ k.succ = AlgebraicCombinatorics.QBinomialRec.qBinomial q n k + q ^ (k + 1) * AlgebraicCombinatorics.QBinomialRec.qBinomial q n (k + 1)
Instances For
Remark rmk.pars.qbinom.qint.frac: Properties of q-integers and q-factorials #
The following lemmas formalize the key properties from Remark 2.3.3:
- The geometric series formula:
[n]_q = (1 - q^n)/(1 - q) - Evaluation at 1:
[n]_1 = nand[n]_1! = n!
Remark rmk.pars.qbinom.qint.frac (part 1): The q-integer equals the geometric series formula.
[n]_q · (1 - q) = 1 - q^n
This is the "cleared denominator" form of [n]_q = (1 - q^n)/(1 - q).
The equality holds in any commutative ring.
Remark rmk.pars.qbinom.qint.frac (part 3): [n]_1! = n!.
When we substitute q = 1 into the q-factorial, we get the ordinary factorial.
This follows from [1]_1 · [2]_1 · ... · [n]_1 = 1 · 2 · ... · n = n!.
Proposition prop.pars.qbinom.0: If k > n, then [n choose k]_q = 0.
This generalizes Proposition prop.binom.0 (that C(n,k) = 0 when k > n) to q-binomial coefficients.
The proof uses the partition-theoretic interpretation: [n choose k]_q is a sum over partitions with largest part ≤ n-k and length ≤ k. When k > n, we have n-k < 0, so no such partition exists, and the sum is empty (equals 0).
Alternatively, the proof proceeds by induction using the q-Pascal recurrence.
Alias for qBinomial_gt with the hypothesis stated as n < k.
This is the form used in Proposition prop.pars.qbinom.0.
Proposition prop.pars.qbinom.n0: We have [n choose 0]_q = [n choose n]_q = 1 for each n ∈ ℕ.
This is a fundamental boundary condition for q-binomial coefficients, analogous to the classical binomial coefficient identities C(n,0) = C(n,n) = 1.
Proposition prop.pars.qbinom.alt-defs: Alternative definitions of q-binomial coefficients #
This section formalizes the three equivalent characterizations of q-binomial coefficients from Proposition 11.2.4 (prop.pars.qbinom.alt-defs) of the textbook.
Part (a): Sum over weakly increasing tuples
[n choose k]_q = ∑_{0 ≤ i₁ ≤ i₂ ≤ ... ≤ i_k ≤ n-k} q^{i₁ + i₂ + ... + i_k}
Part (b): Sum over k-element subsets
[n choose k]_q = ∑_{S ⊆ {1,...,n}, |S| = k} q^{sum(S) - (1 + 2 + ... + k)}
Part (c): Evaluation at q = 1 gives ordinary binomial coefficient
[n choose k]_1 = C(n, k)
Part (c) is already proved as qBinomial_at_one above.
The triangular number T(k) = 1 + 2 + ... + k = k(k+1)/2.
Equations
- AlgebraicCombinatorics.QBinomialRec.triangular k = k * (k + 1) / 2
Instances For
The triangular number equals the sum of the first k positive integers.
The set of monotone (weakly increasing) functions from Fin k to Fin (m + 1). This represents k-tuples (i₁, ..., i_k) with 0 ≤ i₁ ≤ i₂ ≤ ... ≤ i_k ≤ m.
This is definitionally equal to AlgebraicCombinatorics.monotoneFunctions.
Equations
Instances For
The local monotoneFunctions is definitionally equal to the canonical version.
The sum of values of a function from Fin k to Fin (m + 1).
Equations
- AlgebraicCombinatorics.QBinomialRec.sumValues k m f = ∑ i : Fin k, ↑(f i)
Instances For
The set of k-element subsets of {1, 2, ..., n}.
Equations
- AlgebraicCombinatorics.QBinomialRec.kSubsetsOfIcc n k = {S ∈ (Finset.Icc 1 n).powerset | S.card = k}
Instances For
The sum of elements in a finite set of natural numbers.
Note: This is named finsetSumNat to distinguish from AlgebraicCombinatorics.CauchyBinet.finsetSumFin,
which computes the sum of elements in a Finset (Fin n) by extracting their .val.
Both compute "the sum of elements" but for different element types.
Equations
Instances For
The q-binomial coefficient satisfies the product formula over a field: [n choose k]q = ∏{i=0}^{k-1} [n-i]_q / [i+1]_q
This is equivalent to the recursive definition when q is not a root of unity.
Combinatorial Definition of q-Binomial Coefficients (Definition def.pars.qbinom.qbinom) #
This section formalizes Definition 4.3.2 from the textbook, which defines the q-binomial coefficient (Gaussian binomial coefficient) as a sum over partitions:
(a) The q-binomial coefficient [n choose k]_q is the polynomial
∑_{λ} q^|λ|
where λ ranges over all partitions with largest part ≤ n-k and length ≤ k.
(b) For any ring element a, the evaluation [n choose k]_a is obtained by
substituting a for q in the polynomial [n choose k]_q.
Key Properties #
- When k > n, the q-binomial is 0 (empty sum since n - k < 0).
[n choose 0]_q = [n choose n]_q = 1(only the empty partition qualifies).- When a = 1, we recover the ordinary binomial coefficient:
[n choose k]_1 = C(n,k).
A partition has largest part ≤ m if all parts are ≤ m. This is used in the combinatorial definition of q-binomial coefficients.
Equations
- AlgebraicCombinatorics.QBinomialRec.partitionLargestPartLeq p m = ∀ i ∈ p.parts, i ≤ m
Instances For
A partition has length ≤ k if it has at most k parts. This is used in the combinatorial definition of q-binomial coefficients.
Equations
Instances For
Equations
The set of partitions of a given size that fit in a k × m box (i.e., have length ≤ k and largest part ≤ m).
For the q-binomial [n choose k]_q, we use m = n - k.
Argument order: (size k m : ℕ) where:
sizeis the partition sizekis the maximum number of parts (length ≤ k)mis the maximum part size (largest part ≤ m)
This matches the convention in AlgebraicCombinatorics.partitionsInBox from QBinomialBasic.lean.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The count of partitions of a given size that fit in a k × m box.
Equations
Instances For
Partitions with exactly k parts (not just at most k parts), fitting in a box with largest part ≤ m. Used in the q-Pascal identity proof to split partitions by exact number of parts.
Equations
- AlgebraicCombinatorics.QBinomialRec.partitionsInBoxExact size k m = {p : size.Partition | p.parts.card = k ∧ AlgebraicCombinatorics.QBinomialRec.partitionLargestPartLeq p m}
Instances For
Equations
- AlgebraicCombinatorics.QBinomialRec.instDecidablePartitionsInBoxExact p = inferInstanceAs (Decidable (p.parts.card = k ∧ ∀ i ∈ p.parts, i ≤ m))
Key cardinality equality: partitions with exactly k+1 parts in (k+1) × m box biject with partitions with at most k+1 parts in (k+1) × (m-1) box, via the "subtract 1 from each part" bijection. This is the combinatorial heart of the q-Pascal identity.
The bijection:
- Forward: subtract 1 from each part, filter zeros (using
ofSums) - Inverse: add 1 to each part, pad with 1s to get exactly k+1 parts
The q-binomial coefficient as a polynomial in ℤ[q]. (Definition def.pars.qbinom.qbinom (a))
[n choose k]_q = ∑_{λ} q^|λ|
where λ ranges over all partitions with largest part ≤ n-k and length ≤ k.
This is a polynomial (not just a formal power series) because there are finitely many such partitions - they all fit in a k × (n-k) box, so their size is at most k · (n-k).
When k > n, this is 0 (the empty sum, since n - k < 0 means no partitions qualify).
Equations
- One or more equations did not get rendered due to their size.
Instances For
When k > n, the combinatorial q-binomial coefficient is 0.
[n choose 0]_q = 1 for all n.
[n choose n]_q = 1 for all n.
The q-binomial coefficient evaluated at a ring element. (Definition def.pars.qbinom.qbinom (b))
[n choose k]_a = ∑_{λ} a^|λ|
where λ ranges over all partitions with largest part ≤ n-k and length ≤ k.
This is the result of substituting a for q in the polynomial [n choose k]_q.
Equations
Instances For
Alternative definition: directly sum over partitions.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The two definitions of qBinomialEval agree.
When k > n, the evaluated q-binomial is 0.
[n choose 0]_a = 1 for all n and a.
[n choose n]_a = 1 for all n and a.
The q-Pascal identity for qBinomialPolyDef (polynomial version). This is the combinatorial heart of the proof connecting the two definitions.
The identity states:
[n+1 choose k+1]_q = [n choose k]_q + q^{k+1} · [n choose k+1]_q
Combinatorially, partitions in a (k+1) × (n-k) box split into two types:
- Those with length ≤ k (same as partitions in k × (n-k) box)
- Those with length = k+1, which biject with partitions in (k+1) × (n-k-1) box via "removing a column" (subtracting 1 from each of the k+1 parts), with size decreased by k+1 (hence the factor q^{k+1}).
The combinatorial definition agrees with the recursive definition.
This connects Definition def.pars.qbinom.qbinom with the recurrence-based qBinomial.
The proof shows that both definitions satisfy the same recurrence relation (q-Pascal's identity) and boundary conditions.
Lemma lem.prodrule.sum-ai-plus-bi: Product expansion rule. When expanding ∏ᵢ (aᵢ + bᵢ), we get a sum over all subsets S of [n], where each term is (∏{i ∈ S} aᵢ) · (∏{i ∉ S} bᵢ).
This is a fundamental identity used in proofs of the q-binomial theorems and determinant formulas.
A rigorous proof can be found in [detnotes, Exercise 6.1 (a)].
Key algebraic identity for the induction step of qBinomial_sum_subsets.
This identity holds because qBinomial satisfies specific algebraic relations. The proof uses induction on n, showing that the identity follows from the recurrence relation for qBinomial.
Specifically, we need: q^k * qBinomial q n (k+1) + q^n * qBinomial q n k = q^k * qBinomial q n k + q^(2k+1) * qBinomial q n (k+1)
This is equivalent to: (q^n - q^k) * qBinomial q n k = q^k * (q^(k+1) - 1) * qBinomial q n (k+1)
The proof proceeds by induction on n, using the specific structure of qBinomial coefficients. The identity follows from the fact that qBinomial can be expressed as a geometric sum.
Key lemma: The sum over k-element subsets of {0, 1, ..., n-1} of q^{sum(S)} equals q^{k(k-1)/2} * [n choose k]_q.
This is the combinatorial interpretation of q-binomial coefficients from Proposition prop.pars.qbinom.alt-defs part (b) in the textbook.
The formula arises because:
- [n choose k]_q counts k-element subsets weighted by q^{sum(S) - (1+2+...+k)}
- In 0-indexed form, this becomes q^{sum(S)} = q^{k(k-1)/2} * [n choose k]_q
The proof proceeds by induction on n, using the q-Pascal recurrence.
Theorem thm.pars.qbinom.binom1: First q-binomial theorem. For a, b ∈ K and n ∈ ℕ, in the polynomial ring K[q], we have: (aq⁰ + b)(aq¹ + b)···(aqⁿ⁻¹ + b) = ∑_{k=0}^{n} q^{k(k-1)/2} · [n choose k]_q · aᵏ · bⁿ⁻ᵏ
Setting q = 1 recovers the classical binomial formula (a + b)ⁿ.
The proof uses the product expansion lemma (lem.prodrule.sum-ai-plus-bi):
- Expand the product as a sum over subsets S ⊆ {0, 1, ..., n-1}
- For each S, the contribution is a^|S| * q^{∑_{i ∈ S} i} * b^{n - |S|}
- Group by cardinality k = |S|
- Use qBinomial_sum_subsets to evaluate the sum over k-element subsets
The first q-binomial theorem specializes to the binomial formula when q = 1.
Theorem thm.pars.qbinom.binom2: Second q-binomial theorem (Potter's binomial theorem). Let A be a noncommutative L-algebra, and let a, b ∈ A satisfy ba = ω·ab for some ω ∈ L. Then (a + b)ⁿ = ∑_{k=0}^{n} [n choose k]_ω · aᵏ · bⁿ⁻ᵏ.
This generalizes the binomial formula to the noncommutative setting with a "twisted" commutativity relation.
Lemma lem.linalg.lin-ind-via-span: A k-tuple (v₁, v₂, ..., vₖ) is linearly independent if and only if each vᵢ ∉ span{v₁, ..., vᵢ₋₁}.
This is the inductive characterization of linear independence.
Lemma lem.pars.qbinom.lin-ind-count: The number of linearly independent k-tuples of vectors in an n-dimensional F-vector space V is ∏_{i=0}^{k-1} (|F|ⁿ - |F|ⁱ).
The proof proceeds by induction on k:
- Base case (k = 0): There is exactly one 0-tuple, which is vacuously linearly independent.
- Inductive step: A linearly independent (k+1)-tuple (v₁, ..., v_{k+1}) corresponds to a linearly independent k-tuple (v₂, ..., v_{k+1}) together with a choice of v₁ outside the span of {v₂, ..., v_{k+1}}. The span has |F|^k elements, so there are |F|^n - |F|^k choices for v₁.
This uses card_linearIndependent from Mathlib which proves this via the equivalence
equiv_linearIndependent.
Lemma lem.count.multijection: Multijection principle. If f : A → B is a map such that each b ∈ B has exactly m preimages, then |A| = m · |B|.
This is a fundamental counting principle used throughout combinatorics. A map f satisfying this assumption is called an m-to-1 map.
The proof uses the fiber decomposition: |A| = Σ_{b ∈ B} |fiber(b)|, where each fiber has cardinality m by assumption.
The span map sends a linearly independent k-tuple to its span (a k-dimensional subspace).
Equations
- AlgebraicCombinatorics.QBinomialRec.spanMap k ⟨v, hv⟩ = ⟨Submodule.span F (Set.range v), ⋯⟩
Instances For
Key lemma for thm.pars.qbinom.subsp-count: Each k-dimensional subspace W has exactly ∏_{i=0}^{k-1} (q^k - q^i) preimages under the span map.
This is because the preimages are exactly the ordered bases of W:
- A linearly independent k-tuple v with span(v) = W must lie entirely in W
- Since W is k-dimensional and v has k linearly independent vectors, v spans W automatically
- Thus the preimages are exactly the linearly independent k-tuples in W
- By card_linearIndependent, the count is ∏_{i=0}^{k-1} (q^k - q^i)
This is the key step in the proof of qBinomial_subspace_count.
Theorem thm.pars.qbinom.subsp-count: The q-binomial coefficient at |F| counts k-dimensional subspaces. If V is an n-dimensional vector space over a finite field F, then [n choose k]_{|F|} = (# of k-dimensional subspaces of V).
This is the "linear analogue" of the fact that C(n,k) counts k-element subsets of an n-element set.
Proof outline #
The proof uses the multijection principle (Lemma lem.count.multijection):
Define the span map f : (linearly independent k-tuples in V) → (k-dim subspaces of V) that sends a tuple v to its span span(v).
By
card_linearIndependent_tuples: |linearly independent k-tuples in V| = ∏_{i=0}^{k-1} (q^n - q^i)By
spanMap_fiber_card, each k-dimensional subspace W has exactly ∏_{i=0}^{k-1} (q^k - q^i) preimages under f (the number of ordered bases of W).By the multijection principle: ∏{i=0}^{k-1} (q^n - q^i) = (∏{i=0}^{k-1} (q^k - q^i)) × (# of k-dim subspaces)
Therefore: (# of k-dim subspaces) = ∏{i=0}^{k-1} (q^n - q^i) / ∏{i=0}^{k-1} (q^k - q^i) = [n choose k]_q
Proposition prop.pars.qbinom.lim1: Limit of q-binomial coefficients. As n → ∞, the q-binomial coefficient [n choose k]q converges coefficientwise to ∑{n ∈ ℕ} (p₀(n) + p₁(n) + ... + pₖ(n)) qⁿ = ∏_{i=1}^{k} 1/(1 - qⁱ)
where pᵢ(n) is the number of partitions of n with exactly i parts.
This is stated for power series over a field where inverses exist.
The limit of q-binomial coefficients equals the generating function for partitions with at most k parts.
This is the second equality in Proposition prop.pars.qbinom.lim1: ∑{n ∈ ℕ} (p₀(n) + p₁(n) + ... + pₖ(n)) qⁿ = ∏{i=1}^{k} 1/(1 - qⁱ)
Combined with Theorem thm.pars.main-gf-0n from the partition generating functions section.