# Formal power series (in one variable) #

This file defines (univariate) formal power series and develops the basic properties of these objects.

A formal power series is to a polynomial like an infinite sum is to a finite sum.

Formal power series in one variable are defined from multivariate power series as PowerSeries R := MvPowerSeries Unit R.

The file sets up the (semi)ring structure on univariate power series.

We provide the natural inclusion from polynomials to formal power series.

Additional results can be found in:

• Mathlib.RingTheory.PowerSeries.Trunc, truncation of power series;
• Mathlib.RingTheory.PowerSeries.Inverse, about inverses of power series, and the fact that power series over a local ring form a local ring;
• Mathlib.RingTheory.PowerSeries.Order, the order of a power series at 0, and application to the fact that power series over an integral domain form an integral domain.

## Implementation notes #

Because of its definition, PowerSeries R := MvPowerSeries Unit R. a lot of proofs and properties from the multivariate case can be ported to the single variable case. However, it means that formal power series are indexed by Unit →₀ ℕ, which is of course canonically isomorphic to ℕ. We then build some glue to treat formal power series as if they were indexed by ℕ. Occasionally this leads to proofs that are uglier than expected.

def PowerSeries (R : Type u_1) :
Type u_1

Formal power series over a coefficient type R

Equations
Instances For

R⟦X⟧ is notation for PowerSeries R, the semiring of formal power series in one variable over a semiring R.

Equations
Instances For
instance PowerSeries.instInhabited {R : Type u_1} [] :
Equations
• PowerSeries.instInhabited = id inferInstance
instance PowerSeries.instZero {R : Type u_1} [Zero R] :
Zero ()
Equations
• PowerSeries.instZero = id inferInstance
instance PowerSeries.instAddMonoid {R : Type u_1} [] :
Equations
instance PowerSeries.instAddGroup {R : Type u_1} [] :
Equations
instance PowerSeries.instAddCommMonoid {R : Type u_1} [] :
Equations
instance PowerSeries.instAddCommGroup {R : Type u_1} [] :
Equations
instance PowerSeries.instSemiring {R : Type u_1} [] :
Equations
• PowerSeries.instSemiring = id inferInstance
instance PowerSeries.instCommSemiring {R : Type u_1} [] :
Equations
• PowerSeries.instCommSemiring = id inferInstance
instance PowerSeries.instRing {R : Type u_1} [Ring R] :
Ring ()
Equations
• PowerSeries.instRing = id inferInstance
instance PowerSeries.instCommRing {R : Type u_1} [] :
Equations
• PowerSeries.instCommRing = id inferInstance
instance PowerSeries.instNontrivial {R : Type u_1} [] :
Equations
• =
instance PowerSeries.instModule {R : Type u_1} {A : Type u_2} [] [] [Module R A] :
Module R ()
Equations
• PowerSeries.instModule = id inferInstance
instance PowerSeries.instIsScalarTower {R : Type u_1} {A : Type u_2} {S : Type u_3} [] [] [] [Module R A] [Module S A] [SMul R S] [] :
Equations
• =
instance PowerSeries.instAlgebra {R : Type u_1} {A : Type u_2} [] [] [Algebra R A] :
Algebra R ()
Equations
• PowerSeries.instAlgebra = id inferInstance
def PowerSeries.coeff (R : Type u_1) [] (n : ) :

The nth coefficient of a formal power series.

Equations
Instances For
def PowerSeries.monomial (R : Type u_1) [] (n : ) :

The nth monomial with coefficient a as formal power series.

Equations
Instances For
theorem PowerSeries.coeff_def {R : Type u_1} [] {s : } {n : } (h : s () = n) :
theorem PowerSeries.ext {R : Type u_1} [] {φ : } {ψ : } (h : ∀ (n : ), () φ = () ψ) :
φ = ψ

Two formal power series are equal if all their coefficients are equal.

theorem PowerSeries.ext_iff {R : Type u_1} [] {φ : } {ψ : } :
φ = ψ ∀ (n : ), () φ = () ψ

Two formal power series are equal if all their coefficients are equal.

instance PowerSeries.instSubsingleton {R : Type u_1} [] [] :
Equations
• =
def PowerSeries.mk {R : Type u_2} (f : R) :

Constructor for formal power series.

Equations
Instances For
@[simp]
theorem PowerSeries.coeff_mk {R : Type u_1} [] (n : ) (f : R) :
() () = f n
theorem PowerSeries.coeff_monomial {R : Type u_1} [] (m : ) (n : ) (a : R) :
() (() a) = if m = n then a else 0
theorem PowerSeries.monomial_eq_mk {R : Type u_1} [] (n : ) (a : R) :
() a = PowerSeries.mk fun (m : ) => if m = n then a else 0
@[simp]
theorem PowerSeries.coeff_monomial_same {R : Type u_1} [] (n : ) (a : R) :
() (() a) = a
@[simp]
theorem PowerSeries.coeff_comp_monomial {R : Type u_1} [] (n : ) :
∘ₗ = LinearMap.id
def PowerSeries.constantCoeff (R : Type u_1) [] :

The constant coefficient of a formal power series.

Equations
Instances For
def PowerSeries.C (R : Type u_1) [] :

The constant formal power series.

Equations
Instances For
def PowerSeries.X {R : Type u_1} [] :

The variable of the formal power series ring.

Equations
• PowerSeries.X =
Instances For
theorem PowerSeries.commute_X {R : Type u_1} [] (φ : ) :
Commute φ PowerSeries.X
@[simp]
theorem PowerSeries.coeff_zero_eq_constantCoeff {R : Type u_1} [] :
() =
theorem PowerSeries.coeff_zero_eq_constantCoeff_apply {R : Type u_1} [] (φ : ) :
() φ =
@[simp]
theorem PowerSeries.monomial_zero_eq_C {R : Type u_1} [] :
() = ()
theorem PowerSeries.monomial_zero_eq_C_apply {R : Type u_1} [] (a : R) :
() a = () a
theorem PowerSeries.coeff_C {R : Type u_1} [] (n : ) (a : R) :
() (() a) = if n = 0 then a else 0
@[simp]
theorem PowerSeries.coeff_zero_C {R : Type u_1} [] (a : R) :
() (() a) = a
theorem PowerSeries.coeff_ne_zero_C {R : Type u_1} [] {a : R} {n : } (h : n 0) :
() (() a) = 0
@[simp]
theorem PowerSeries.coeff_succ_C {R : Type u_1} [] {a : R} {n : } :
(PowerSeries.coeff R (n + 1)) (() a) = 0
theorem PowerSeries.C_injective {R : Type u_1} [] :
theorem PowerSeries.X_eq {R : Type u_1} [] :
PowerSeries.X = () 1
theorem PowerSeries.coeff_X {R : Type u_1} [] (n : ) :
() PowerSeries.X = if n = 1 then 1 else 0
@[simp]
theorem PowerSeries.coeff_zero_X {R : Type u_1} [] :
() PowerSeries.X = 0
@[simp]
theorem PowerSeries.coeff_one_X {R : Type u_1} [] :
() PowerSeries.X = 1
@[simp]
theorem PowerSeries.X_ne_zero {R : Type u_1} [] [] :
PowerSeries.X 0
theorem PowerSeries.X_pow_eq {R : Type u_1} [] (n : ) :
PowerSeries.X ^ n = () 1
theorem PowerSeries.coeff_X_pow {R : Type u_1} [] (m : ) (n : ) :
() (PowerSeries.X ^ n) = if m = n then 1 else 0
@[simp]
theorem PowerSeries.coeff_X_pow_self {R : Type u_1} [] (n : ) :
() (PowerSeries.X ^ n) = 1
@[simp]
theorem PowerSeries.coeff_one {R : Type u_1} [] (n : ) :
() 1 = if n = 0 then 1 else 0
theorem PowerSeries.coeff_zero_one {R : Type u_1} [] :
() 1 = 1
theorem PowerSeries.coeff_mul {R : Type u_1} [] (n : ) (φ : ) (ψ : ) :
() (φ * ψ) = p, () φ * () ψ
@[simp]
theorem PowerSeries.coeff_mul_C {R : Type u_1} [] (n : ) (φ : ) (a : R) :
() (φ * () a) = () φ * a
@[simp]
theorem PowerSeries.coeff_C_mul {R : Type u_1} [] (n : ) (φ : ) (a : R) :
() (() a * φ) = a * () φ
@[simp]
theorem PowerSeries.coeff_smul {R : Type u_1} [] {S : Type u_2} [] [Module R S] (n : ) (φ : ) (a : R) :
() (a φ) = a () φ
@[simp]
theorem PowerSeries.constantCoeff_smul {R : Type u_1} [] {S : Type u_2} [] [Module R S] (φ : ) (a : R) :
(a φ) = a
theorem PowerSeries.smul_eq_C_mul {R : Type u_1} [] (f : ) (a : R) :
a f = () a * f
@[simp]
theorem PowerSeries.coeff_succ_mul_X {R : Type u_1} [] (n : ) (φ : ) :
(PowerSeries.coeff R (n + 1)) (φ * PowerSeries.X) = () φ
@[simp]
theorem PowerSeries.coeff_succ_X_mul {R : Type u_1} [] (n : ) (φ : ) :
(PowerSeries.coeff R (n + 1)) (PowerSeries.X * φ) = () φ
@[simp]
theorem PowerSeries.constantCoeff_C {R : Type u_1} [] (a : R) :
(() a) = a
@[simp]
theorem PowerSeries.constantCoeff_comp_C {R : Type u_1} [] :
.comp () =
theorem PowerSeries.constantCoeff_one {R : Type u_1} [] :
= 1
@[simp]
theorem PowerSeries.constantCoeff_X {R : Type u_1} [] :
PowerSeries.X = 0
@[simp]
theorem PowerSeries.constantCoeff_mk {R : Type u_1} [] {f : R} :
= f 0
theorem PowerSeries.coeff_zero_mul_X {R : Type u_1} [] (φ : ) :
() (φ * PowerSeries.X) = 0
theorem PowerSeries.coeff_zero_X_mul {R : Type u_1} [] (φ : ) :
() (PowerSeries.X * φ) = 0
theorem PowerSeries.coeff_C_mul_X_pow {R : Type u_1} [] (x : R) (k : ) (n : ) :
() (() x * PowerSeries.X ^ k) = if n = k then x else 0
@[simp]
theorem PowerSeries.coeff_mul_X_pow {R : Type u_1} [] (p : ) (n : ) (d : ) :
(PowerSeries.coeff R (d + n)) (p * PowerSeries.X ^ n) = () p
@[simp]
theorem PowerSeries.coeff_X_pow_mul {R : Type u_1} [] (p : ) (n : ) (d : ) :
(PowerSeries.coeff R (d + n)) (PowerSeries.X ^ n * p) = () p
theorem PowerSeries.coeff_mul_X_pow' {R : Type u_1} [] (p : ) (n : ) (d : ) :
() (p * PowerSeries.X ^ n) = if n d then (PowerSeries.coeff R (d - n)) p else 0
theorem PowerSeries.coeff_X_pow_mul' {R : Type u_1} [] (p : ) (n : ) (d : ) :
() (PowerSeries.X ^ n * p) = if n d then (PowerSeries.coeff R (d - n)) p else 0
theorem PowerSeries.isUnit_constantCoeff {R : Type u_1} [] (φ : ) (h : ) :

If a formal power series is invertible, then so is its constant coefficient.

theorem PowerSeries.eq_shift_mul_X_add_const {R : Type u_1} [] (φ : ) :
φ = (PowerSeries.mk fun (p : ) => (PowerSeries.coeff R (p + 1)) φ) * PowerSeries.X + () ()

Split off the constant coefficient.

theorem PowerSeries.eq_X_mul_shift_add_const {R : Type u_1} [] (φ : ) :
φ = (PowerSeries.X * PowerSeries.mk fun (p : ) => (PowerSeries.coeff R (p + 1)) φ) + () ()

Split off the constant coefficient.

def PowerSeries.map {R : Type u_1} [] {S : Type u_2} [] (f : R →+* S) :

The map between formal power series induced by a map on the coefficients.

Equations
Instances For
@[simp]
theorem PowerSeries.map_id {R : Type u_1} [] :
() = id
theorem PowerSeries.map_comp {R : Type u_1} [] {S : Type u_2} {T : Type u_3} [] [] (f : R →+* S) (g : S →+* T) :
PowerSeries.map (g.comp f) = ().comp ()
@[simp]
theorem PowerSeries.coeff_map {R : Type u_1} [] {S : Type u_2} [] (f : R →+* S) (n : ) (φ : ) :
() (() φ) = f (() φ)
@[simp]
theorem PowerSeries.map_C {R : Type u_1} [] {S : Type u_2} [] (f : R →+* S) (r : R) :
() (() r) = () (f r)
@[simp]
theorem PowerSeries.map_X {R : Type u_1} [] {S : Type u_2} [] (f : R →+* S) :
() PowerSeries.X = PowerSeries.X
theorem PowerSeries.X_pow_dvd_iff {R : Type u_1} [] {n : } {φ : } :
PowerSeries.X ^ n φ m < n, () φ = 0
theorem PowerSeries.X_dvd_iff {R : Type u_1} [] {φ : } :
PowerSeries.X φ = 0
noncomputable def PowerSeries.rescale {R : Type u_1} [] (a : R) :

The ring homomorphism taking a power series f(X) to f(aX).

Equations
• = { toFun := fun (f : ) => PowerSeries.mk fun (n : ) => a ^ n * () f, map_one' := , map_mul' := , map_zero' := , map_add' := }
Instances For
@[simp]
theorem PowerSeries.coeff_rescale {R : Type u_1} [] (f : ) (a : R) (n : ) :
() ( f) = a ^ n * () f
@[simp]
theorem PowerSeries.rescale_zero {R : Type u_1} [] :
= ().comp
theorem PowerSeries.rescale_zero_apply {R : Type u_1} [] :
PowerSeries.X = () ( PowerSeries.X)
@[simp]
theorem PowerSeries.rescale_one {R : Type u_1} [] :
theorem PowerSeries.rescale_mk {R : Type u_1} [] (f : R) (a : R) :
= PowerSeries.mk fun (n : ) => a ^ n * f n
theorem PowerSeries.rescale_rescale {R : Type u_1} [] (f : ) (a : R) (b : R) :
( f) = (PowerSeries.rescale (a * b)) f
theorem PowerSeries.rescale_mul {R : Type u_1} [] (a : R) (b : R) :
PowerSeries.rescale (a * b) = .comp
theorem PowerSeries.coeff_prod {R : Type u_2} [] {ι : Type u_3} [] (f : ι) (d : ) (s : ) :
() (js, f j) = ls.finsuppAntidiag d, is, (PowerSeries.coeff R (l i)) (f i)

Coefficients of a product of power series

theorem PowerSeries.coeff_pow {R : Type u_2} [] (k : ) (n : ) (φ : ) :
() (φ ^ k) = l().finsuppAntidiag n, i, (PowerSeries.coeff R (l i)) φ

The n-th coefficient of the k-th power of a power series.

theorem PowerSeries.coeff_one_mul {R : Type u_2} [] (φ : ) (ψ : ) :
() (φ * ψ) = () φ * + () ψ *

First coefficient of the product of two power series.

theorem PowerSeries.coeff_one_pow {R : Type u_2} [] (n : ) (φ : ) (hC : = 1) :
() (φ ^ n) = n * () φ

First coefficient of the n-th power of a power series with constant coefficient 1.

theorem PowerSeries.not_isField {A : Type u_2} [] :
@[simp]
theorem PowerSeries.rescale_X {A : Type u_2} [] (a : A) :
PowerSeries.X = () a * PowerSeries.X
theorem PowerSeries.rescale_neg_one_X {A : Type u_2} [] :
() PowerSeries.X = -PowerSeries.X
noncomputable def PowerSeries.evalNegHom {A : Type u_2} [] :

The ring homomorphism taking a power series f(X) to f(-X).

Equations
• PowerSeries.evalNegHom =
Instances For
@[simp]
theorem PowerSeries.evalNegHom_X {A : Type u_2} [] :
PowerSeries.evalNegHom PowerSeries.X = -PowerSeries.X
theorem PowerSeries.eq_zero_or_eq_zero_of_mul_eq_zero {R : Type u_1} [Ring R] [] (φ : ) (ψ : ) (h : φ * ψ = 0) :
φ = 0 ψ = 0
instance PowerSeries.instNoZeroDivisors {R : Type u_1} [Ring R] [] :
Equations
• =
instance PowerSeries.instIsDomain {R : Type u_1} [Ring R] [] :
Equations
• =
theorem PowerSeries.span_X_isPrime {R : Type u_1} [] [] :
(Ideal.span {PowerSeries.X}).IsPrime

The ideal spanned by the variable in the power series ring over an integral domain is a prime ideal.

theorem PowerSeries.X_prime {R : Type u_1} [] [] :
Prime PowerSeries.X

The variable of the power series ring over an integral domain is prime.

theorem PowerSeries.X_irreducible {R : Type u_1} [] [] :
Irreducible PowerSeries.X

The variable of the power series ring over an integral domain is irreducible.

theorem PowerSeries.rescale_injective {R : Type u_1} [] [] {a : R} (ha : a 0) :
theorem PowerSeries.C_eq_algebraMap {R : Type u_1} [] {r : R} :
() r = () r
theorem PowerSeries.algebraMap_apply {R : Type u_1} {A : Type u_2} [] [] [Algebra R A] {r : R} :
() r = () (() r)
Equations
• =
def Polynomial.ToPowerSeries {R : Type u_2} [] :

The natural inclusion from polynomials into formal power series.

Equations
Instances For
instance Polynomial.coeToPowerSeries {R : Type u_2} [] :
Coe () ()

The natural inclusion from polynomials into formal power series.

Equations
• Polynomial.coeToPowerSeries = { coe := Polynomial.ToPowerSeries }
theorem Polynomial.coe_def {R : Type u_2} [] (φ : ) :
φ = PowerSeries.mk φ.coeff
@[simp]
theorem Polynomial.coeff_coe {R : Type u_2} [] (φ : ) (n : ) :
() φ = φ.coeff n
@[simp]
theorem Polynomial.coe_monomial {R : Type u_2} [] (n : ) (a : R) :
( a) = () a
@[simp]
theorem Polynomial.coe_zero {R : Type u_2} [] :
0 = 0
@[simp]
theorem Polynomial.coe_one {R : Type u_2} [] :
1 = 1
@[simp]
theorem Polynomial.coe_add {R : Type u_2} [] (φ : ) (ψ : ) :
(φ + ψ) = φ + ψ
@[simp]
theorem Polynomial.coe_mul {R : Type u_2} [] (φ : ) (ψ : ) :
(φ * ψ) = φ * ψ
@[simp]
theorem Polynomial.coe_C {R : Type u_2} [] (a : R) :
(Polynomial.C a) = () a
@[simp]
theorem Polynomial.coe_X {R : Type u_2} [] :
Polynomial.X = PowerSeries.X
@[simp]
theorem Polynomial.constantCoeff_coe {R : Type u_2} [] (φ : ) :
= φ.coeff 0
@[simp]
theorem Polynomial.coe_inj {R : Type u_2} [] {φ : } {ψ : } :
φ = ψ φ = ψ
@[simp]
theorem Polynomial.coe_eq_zero_iff {R : Type u_2} [] {φ : } :
φ = 0 φ = 0
@[simp]
theorem Polynomial.coe_eq_one_iff {R : Type u_2} [] {φ : } :
φ = 1 φ = 1

The coercion from polynomials to power series as a ring homomorphism.

Equations
• Polynomial.coeToPowerSeries.ringHom = { toFun := Coe.coe, map_one' := , map_mul' := , map_zero' := , map_add' := }
Instances For
@[simp]
theorem Polynomial.coeToPowerSeries.ringHom_apply {R : Type u_2} [] (φ : ) :
Polynomial.coeToPowerSeries.ringHom φ = φ
@[simp]
theorem Polynomial.coe_pow {R : Type u_2} [] (φ : ) (n : ) :
(φ ^ n) = φ ^ n
theorem Polynomial.eval₂_C_X_eq_coe {R : Type u_2} [] (φ : ) :
Polynomial.eval₂ () PowerSeries.X φ = φ
def Polynomial.coeToPowerSeries.algHom {R : Type u_2} [] (A : Type u_3) [] [Algebra R A] :

The coercion from polynomials to power series as an algebra homomorphism.

Equations
• = let __src := ().comp Polynomial.coeToPowerSeries.ringHom; { toRingHom := __src, commutes' := }
Instances For
@[simp]
theorem Polynomial.coeToPowerSeries.algHom_apply {R : Type u_2} [] (φ : ) (A : Type u_3) [] [Algebra R A] :
= () φ
instance PowerSeries.algebraPolynomial {R : Type u_1} {A : Type u_2} [] [] [Algebra R A] :
Algebra () ()
Equations
• PowerSeries.algebraPolynomial = .toAlgebra
instance PowerSeries.algebraPowerSeries {R : Type u_1} {A : Type u_2} [] [] [Algebra R A] :
Algebra () ()
Equations
• PowerSeries.algebraPowerSeries = ().toAlgebra
@[instance 100]
instance PowerSeries.algebraPolynomial' {R : Type u_1} [] {A : Type u_3} [] [Algebra R ()] :
Algebra R ()
Equations
• PowerSeries.algebraPolynomial' = (Polynomial.coeToPowerSeries.ringHom.comp (algebraMap R ())).toAlgebra
theorem PowerSeries.algebraMap_apply' {R : Type u_1} (A : Type u_2) [] [] [Algebra R A] (p : ) :
(algebraMap () ()) p = () p
theorem PowerSeries.algebraMap_apply'' {R : Type u_1} (A : Type u_2) [] [] [Algebra R A] (f : ) :
(algebraMap () ()) f = () f