# mathlibdocumentation

data.polynomial.basic

# Theory of univariate polynomials

Polynomials are represented as add_monoid_algebra R ℕ, where R is a commutative semiring. In this file, we define polynomial, provide basic instances, and prove an ext lemma.

def polynomial (R : Type u_1) [semiring R] :
Type u_1

polynomial R is the type of univariate polynomials over R.

Polynomials should be seen as (semi-)rings with the additional constructor X. The embedding from R is called C.

Equations
@[instance]
def polynomial.inhabited {R : Type u} [semiring R] :

Equations
@[instance]
def polynomial.semiring {R : Type u} [semiring R] :

Equations
@[instance]
def polynomial.semimodule {R : Type u} [semiring R] {S : Type u_1} [semiring S] [ R] :

Equations
@[instance]
def polynomial.unique {R : Type u} [semiring R] [subsingleton R] :

Equations
@[simp]
theorem polynomial.support_zero {R : Type u} [semiring R] :

def polynomial.monomial {R : Type u} [semiring R] :
(R →ₗ[R]

monomial s a is the monomial a * X^s

Equations
theorem polynomial.monomial_zero_right {R : Type u} [semiring R] (n : ) :
0 = 0

theorem polynomial.monomial_def {R : Type u} [semiring R] (n : ) (a : R) :
a =

theorem polynomial.monomial_add {R : Type u} [semiring R] (n : ) (r s : R) :
(r + s) = r + s

theorem polynomial.monomial_mul_monomial {R : Type u} [semiring R] (n m : ) (r s : R) :
( r) * s = (polynomial.monomial (n + m)) (r * s)

theorem polynomial.smul_monomial {R : Type u} [semiring R] {S : Type u_1} [semiring S] [ R] (a : S) (n : ) (b : R) :
a b = (a b)

def polynomial.X {R : Type u} [semiring R] :

X is the polynomial variable (aka indeterminant).

Equations
theorem polynomial.X_mul {R : Type u} [semiring R] {p : polynomial R} :

X commutes with everything, even when the coefficients are noncommutative.

theorem polynomial.X_pow_mul {R : Type u} [semiring R] {p : polynomial R} {n : } :
* p = p *

theorem polynomial.X_pow_mul_assoc {R : Type u} [semiring R] {p q : polynomial R} {n : } :
(p * * q = (p * q) *

theorem polynomial.commute_X {R : Type u} [semiring R] (p : polynomial R) :

def polynomial.coeff {R : Type u} [semiring R] :
→ R

coeff p n is the coefficient of X^n in p

Equations
@[simp]
theorem polynomial.coeff_mk {R : Type u} [semiring R] (s : finset ) (f : → R) (h : ∀ (a : ), a s f a 0) :

theorem polynomial.coeff_monomial {R : Type u} {a : R} {m n : } [semiring R] :
( a).coeff m = ite (n = m) a 0

@[simp]
theorem polynomial.coeff_zero {R : Type u} [semiring R] (n : ) :
0.coeff n = 0

@[simp]
theorem polynomial.coeff_one_zero {R : Type u} [semiring R] :
1.coeff 0 = 1

@[simp]
theorem polynomial.coeff_X_one {R : Type u} [semiring R] :

@[simp]
theorem polynomial.coeff_X_zero {R : Type u} [semiring R] :

theorem polynomial.coeff_X {R : Type u} {n : } [semiring R] :
= ite (1 = n) 1 0

theorem polynomial.ext_iff {R : Type u} [semiring R] {p q : polynomial R} :
p = q ∀ (n : ), p.coeff n = q.coeff n

@[ext]
theorem polynomial.ext {R : Type u} [semiring R] {p q : polynomial R} :
(∀ (n : ), p.coeff n = q.coeff n)p = q

theorem polynomial.eq_zero_of_eq_zero {R : Type u} [semiring R] (h : 0 = 1) (p : polynomial R) :
p = 0

theorem polynomial.support_monomial {R : Type u} [semiring R] (n : ) (a : R) :
a 0( a).support = {n}

theorem polynomial.support_monomial' {R : Type u} [semiring R] (n : ) (a : R) :
( a).support {n}

theorem polynomial.X_pow_eq_monomial {R : Type u} [semiring R] (n : ) :
= 1

theorem polynomial.support_X_pow {R : Type u} [semiring R] (H : ¬1 = 0) (n : ) :
.support = {n}

theorem polynomial.support_X_empty {R : Type u} [semiring R] :
1 = 0

theorem polynomial.support_X {R : Type u} [semiring R] :
¬1 = 0

@[instance]
def polynomial.comm_semiring {R : Type u}  :

Equations
@[instance]
def polynomial.ring {R : Type u} [ring R] :

Equations
@[simp]
theorem polynomial.coeff_neg {R : Type u} [ring R] (p : polynomial R) (n : ) :
(-p).coeff n = -p.coeff n

@[simp]
theorem polynomial.coeff_sub {R : Type u} [ring R] (p q : polynomial R) (n : ) :
(p - q).coeff n = p.coeff n - q.coeff n

@[instance]
def polynomial.comm_ring {R : Type u} [comm_ring R] :

Equations
@[instance]
def polynomial.nontrivial {R : Type u} [semiring R] [nontrivial R] :

theorem polynomial.X_ne_zero {R : Type u} [semiring R] [nontrivial R] :

@[instance]
def polynomial.has_repr {R : Type u} [semiring R] [has_repr R] :

Equations