Polynomials #
This file formalizes the relationship between polynomials and formal power series (FPS), following the treatment in the Algebraic Combinatorics book.
Main Content #
The key insight is that polynomials can be viewed as FPSs with only finitely many nonzero coefficients. In Mathlib:
PowerSeries R(notation:R⟦X⟧) is the type of formal power seriesPolynomial R(notation:R[X]) is the type of univariate polynomialsPolynomial.toPowerSeriesembeds polynomials into power series
Main Definitions #
FPS.IsPolynomial- A predicate characterizing when a power series is a polynomial (i.e., has only finitely many nonzero coefficients)FPS.polynomialSubalgebra- The K-subalgebra of polynomial power series (Theorem 7.5.2)FPS.polynomialSubring- The subring of polynomial power series (Theorem 7.5.2)FPS.polynomialSubmodule- The K-submodule of polynomial power series (Theorem 7.5.2)FPS.polyEval- Polynomial evaluation at an element of a K-algebra (Definition 7.5.6)- Notation
f⦃a⦄for polynomial evaluation (corresponds to book notationf[a])
Main Results #
FPS.isPolynomial_iff_finite_support- A power series is a polynomial iff it has finite supportFPS.isPolynomial_add- The sum of polynomials is a polynomialFPS.isPolynomial_mul- The product of polynomials is a polynomialFPS.isPolynomial_neg- The negation of a polynomial is a polynomialFPS.isPolynomial_sub- The difference of polynomials is a polynomial
Evaluation/Substitution (def.pol.subs) #
The evaluation of a polynomial f at an element a of a K-algebra A is denoted
polyEval f a or f⦃a⦄. This corresponds to Definition 7.5.6 (def.pol.subs) in the source:
f[a] := Σ_{n ∈ ℕ} f_n · a^n
Key properties (Theorem 7.5.7, thm.pol.eval.a+b):
(f + g)⦃a⦄ = f⦃a⦄ + g⦃a⦄:eval_add'(f * g)⦃a⦄ = f⦃a⦄ * g⦃a⦄:eval_mul'(c • f)⦃a⦄ = c • f⦃a⦄:eval_smul'C(c)⦃a⦄ = algebraMap K A c:eval_C'X⦃a⦄ = a:eval_X'X^i⦃a⦄ = a^i:eval_X_pow'f⦃g⦃a⦄⦄ = (f.comp g)⦃a⦄:eval_comp'
Special cases:
f⦃x⦄ = f:eval_X_eq_selff⦃0⦄ = f₀:eval_zero_eq_coeff_zerof⦃1⦄ = sum of coefficients:eval_one_eq_sum_coeffs
References #
- Definition 7.5.1 (def.fps.pol) - Definition of polynomial as FPS with finite support ✓
- Theorem 7.5.2 (thm.fps.pol.ring) - K[x] is a subring of K[[x]] ✓
- Definition 7.5.3 (def.alg.ring) - Definition of (noncommutative) ring
- Definition 7.5.5 (def.alg.Kalg) - Definition of K-algebra
- Definition 7.5.6 (def.pol.subs) - Evaluation/substitution into polynomials ✓
- Theorem 7.5.7 (thm.pol.eval.a+b) - Properties of polynomial evaluation ✓
Definition of Polynomial as FPS with Finite Support #
Definition 7.5.1 (def.fps.pol): An FPS a ∈ K⟦X⟧ is a polynomial if all but finitely many
coefficients are zero.
A power series is a polynomial if it has finite support, i.e., only finitely many nonzero coefficients. This corresponds to Definition 7.5.1 (def.fps.pol) in the source.
Equations
- FPS.IsPolynomial f = {n : ℕ | (PowerSeries.coeff n) f ≠ 0}.Finite
Instances For
A power series is a polynomial iff its support (set of indices with nonzero coefficients) is finite.
The image of a polynomial under toPowerSeries is a polynomial (in the FPS sense).
For a polynomial power series, there exists a degree bound such that all coefficients beyond this bound are zero. This is an equivalent characterization of polynomials.
A power series is a polynomial iff it equals the coercion of some polynomial.
This provides the key equivalence between IsPolynomial and Mathlib's Polynomial type.
Convert a polynomial power series to its corresponding polynomial. This requires a proof that the power series is a polynomial.
Equations
- FPS.toPolynomial f hf = (fun (N : ℕ) => (PowerSeries.trunc N) f) ⋯.choose
Instances For
The polynomial corresponding to a polynomial power series coerces back to the original.
This shows that toPolynomial is a left inverse of the coercion from polynomials.
Converting a polynomial to a power series and back gives the original polynomial.
Polynomials Form a Subring of Power Series #
Theorem 7.5.2 (thm.fps.pol.ring): The set K[x] is a subring of K[[x]].
The zero power series is a polynomial.
The constant power series 1 is a polynomial.
The sum of two polynomial power series is a polynomial. This is part of Theorem 7.5.2 (thm.fps.pol.ring).
The negation of a polynomial power series is a polynomial. This is part of Theorem 7.5.2 (thm.fps.pol.ring).
The difference of two polynomial power series is a polynomial. This is part of Theorem 7.5.2 (thm.fps.pol.ring).
The product of two polynomial power series is a polynomial. This is the main content of Theorem 7.5.2 (thm.fps.pol.ring).
Scalar multiplication of a polynomial power series is a polynomial. This is part of Theorem 7.5.2 (thm.fps.pol.ring).
K[x] as a Subalgebra of K[[x]] #
Theorem 7.5.2 (thm.fps.pol.ring): The set K[x] is a subring of K[[x]] (closed under addition, subtraction, and multiplication, and contains 0 and 1) and a K-submodule of K[[x]] (closed under addition and scalar multiplication).
These two properties together mean that K[x] forms a K-subalgebra of K[[x]].
The set of polynomial power series forms a K-subalgebra of K[[x]]. This is Theorem 7.5.2 (thm.fps.pol.ring) in the source: K[x] is a subring of K[[x]] (closed under +, -, *, contains 0 and 1) and a K-submodule (closed under + and scalar multiplication).
Equations
- FPS.polynomialSubalgebra = { carrier := {f : PowerSeries K | FPS.IsPolynomial f}, mul_mem' := ⋯, one_mem' := ⋯, add_mem' := ⋯, zero_mem' := ⋯, algebraMap_mem' := ⋯ }
Instances For
The underlying subring of the polynomial subalgebra. This is the "subring" part of Theorem 7.5.2 (thm.fps.pol.ring): K[x] is closed under +, -, *, and contains 0 and 1.
Instances For
The underlying K-submodule of the polynomial subalgebra. This is the "K-submodule" part of Theorem 7.5.2 (thm.fps.pol.ring): K[x] is closed under + and scalar multiplication by elements of K.
Instances For
Membership in the polynomial subalgebra is equivalent to being a polynomial. This is the characterization of K[x] from Theorem 7.5.2 (thm.fps.pol.ring).
Membership in the polynomial subring is equivalent to being a polynomial. This is the "subring" characterization from Theorem 7.5.2 (thm.fps.pol.ring).
Membership in the polynomial submodule is equivalent to being a polynomial. This is the "K-submodule" characterization from Theorem 7.5.2 (thm.fps.pol.ring).
Rings (Noncommutative Rings) #
Definition 7.5.3 (def.alg.ring): A ring (also known as a noncommutative ring) is defined in the same way as a commutative ring, except that the commutativity of multiplication axiom is removed.
In Mathlib, this is captured by the Ring typeclass. Note that "noncommutative ring"
does not imply that the ring is not commutative; it merely means that commutativity
is not required. Thus, any commutative ring is a noncommutative ring.
Examples of noncommutative rings:
- Matrix rings
Matrix n n Rfor any ring R and n > 1 - The quaternions
ℍ[R](Mathlib:Quaternion) - Endomorphism rings
Module.End R Mfor any R-module M
Examples of Noncommutative Rings #
The source lists several examples of noncommutative rings:
- Matrix rings
R^{n×n}for any ring R (commutative if n ≤ 1, noncommutative if n > 1) - The quaternions ℍ
- Endomorphism rings of abelian groups/modules
K-Algebras #
Definition 7.5.5 (def.alg.Kalg): K-Algebras #
The source defines a K-algebra as a set A equipped with four maps:
⊕ : A × A → A(addition)⊖ : A × A → A(subtraction)⊙ : A × A → A(multiplication)⇀ : K × A → A(scalar multiplication)
and two elements 0⃗ ∈ A (zero) and 1⃗ ∈ A (one), satisfying three properties:
A is a (noncommutative) ring: The set A with ⊕, ⊖, ⊙, 0⃗, 1⃗ satisfies the ring axioms (same as commutative ring but without commutativity of multiplication).
A is a K-module: The set A with ⊕, ⊖, ⇀, 0⃗ satisfies the module axioms.
Compatibility property (equation 7.5.2):
λ ⇀ (a ⊙ b) = (λ ⇀ a) ⊙ b = a ⊙ (λ ⇀ b)for allλ ∈ Kanda, b ∈ A.
In Mathlib, this is captured by the Algebra typeclass, which requires:
[Semiring A](or[Ring A]for rings with subtraction)[Algebra K A]which provides scalar multiplication and the compatibility property
The key property λ(ab) = (λa)b = a(λb) is expressed via:
Algebra.smul_mul_assoc:r • x * y = r • (x * y)Algebra.mul_smul_comm:x * r • y = r • (x * y)
Property 1: A is a Ring #
A K-algebra A is automatically a ring. The ring axioms are satisfied.
Note: The source allows noncommutative rings; in Mathlib, Ring A captures this.
For commutative algebras, we use CommRing A.
Property 2: A is a K-Module #
A K-algebra A is automatically a K-module. The module axioms are satisfied.
Property 3: Compatibility (Equation 7.5.2) #
The key compatibility property: λ(ab) = (λa)b = a(λb) for all λ ∈ K and a, b ∈ A.
This says that scaling a product in A by a scalar λ ∈ K is equivalent to scaling either of its two factors by λ.
Examples of K-Algebras #
The source lists several examples of K-algebras:
- The ring K itself
- The ring K⟦X⟧ of formal power series
- The polynomial ring K[X] (as a subring of K⟦X⟧)
- The matrix ring K^{n×n} for each n ∈ ℕ
- Any quotient ring K/I where I is an ideal
- Any commutative ring containing K as a subring
The algebraMap #
In Mathlib, a K-algebra A comes with a ring homomorphism algebraMap K A : K →+* A
that embeds K into the center of A. This allows us to view elements of K as elements of A.
Scalar multiplication is related to algebraMap:
r • x = algebraMap K A r * x.
Evaluation of Polynomials #
Definition 7.5.6 (def.pol.subs): For a polynomial f ∈ K[x] and an element a of a K-algebra A, we define f[a] := Σ_{n ∈ ℕ} f_n * a^n.
In Mathlib, this is Polynomial.aeval a f for evaluation in a K-algebra A.
Implementation Notes #
The book uses notation f[a] for polynomial evaluation. In Mathlib:
Polynomial.aeval a fevaluates polynomialfat elementaof a K-algebraPolynomial.eval₂ φ a fis more general, using a ring homomorphismφPolynomial.eval a fevaluates in the base ring K itself
We provide polyEval as a wrapper matching the book's presentation.
Evaluation of a polynomial at an element of a K-algebra. This is Definition 7.5.6 (def.pol.subs).
Given a polynomial f ∈ K[X] and an element a of a K-algebra A, we define f[a] := Σ_{n ∈ ℕ} f_n · a^n.
The sum is essentially finite since f is a polynomial (only finitely many coefficients are nonzero).
In Mathlib, this is implemented as Polynomial.aeval a f.
Equations
- FPS.polyEval f a = (Polynomial.aeval a) f
Instances For
Notation for polynomial evaluation: f⦃a⦄ means the value of f at a.
This corresponds to the book's notation f[a].
Equations
- One or more equations did not get rendered due to their size.
Instances For
Evaluation of a polynomial at an element of a K-algebra equals the sum Σ f_n · a^n. This is the explicit formula from Definition 7.5.6 (def.pol.subs).
The evaluation f[a] can be written as a finite sum over the support of f. This makes explicit that the sum in Definition 7.5.6 is essentially finite.
Alternative formulation: f[a] = Σ_{n=0}^{deg f} f_n · a^n. This shows that the sum can be taken up to the degree.
Properties of Polynomial Evaluation #
Theorem 7.5.7 (thm.pol.eval.a+b): Basic properties of evaluation.
Examples and Special Cases #
The polynomial X is a polynomial (in the FPS sense).
Any constant is a polynomial (in the FPS sense).
Special Evaluation Results #
f[x] = f, i.e., evaluating at the indeterminate gives back the polynomial. This is noted after Definition 7.5.6 in the source.
f[0] = f₀, i.e., evaluating at 0 gives the constant term. This is noted after Definition 7.5.6 in the source.
f[1] = sum of all coefficients of f. This is noted after Definition 7.5.6 in the source.