# mathlibdocumentation

data.polynomial.eval

# Theory of univariate polynomials #

The main defs here are eval₂, eval, and map. We give several lemmas about their interaction with each other and with module operations.

@[irreducible]
def polynomial.eval₂ {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) (p : polynomial R) :
S

Evaluate a polynomial p given a ring hom f from the scalar ring to the target and a value x for the variable in the target

Equations
theorem polynomial.eval₂_eq_sum {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] {f : R →+* S} {x : S} :
p = p.sum (λ (e : ) (a : R), f a * x ^ e)
theorem polynomial.eval₂_congr {R : Type u_1} {S : Type u_2} [semiring R] [semiring S] {f g : R →+* S} {s t : S} {φ ψ : polynomial R} :
f = gs = tφ = ψ φ = ψ
@[simp]
theorem polynomial.eval₂_at_zero {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) :
p = f (p.coeff 0)
@[simp]
theorem polynomial.eval₂_zero {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) :
0 = 0
@[simp]
theorem polynomial.eval₂_C {R : Type u} {S : Type v} {a : R} [semiring R] [semiring S] (f : R →+* S) (x : S) :
= f a
@[simp]
theorem polynomial.eval₂_X {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) :
@[simp]
theorem polynomial.eval₂_monomial {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) {n : } {r : R} :
( r) = f r * x ^ n
@[simp]
theorem polynomial.eval₂_X_pow {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) {n : } :
= x ^ n
@[simp]
theorem polynomial.eval₂_add {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} [semiring S] (f : R →+* S) (x : S) :
(p + q) = p + q
@[simp]
theorem polynomial.eval₂_one {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) :
1 = 1
@[simp]
theorem polynomial.eval₂_bit0 {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
(bit0 p) = bit0 x p)
@[simp]
theorem polynomial.eval₂_bit1 {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
(bit1 p) = bit1 x p)
@[simp]
theorem polynomial.eval₂_smul {R : Type u} {S : Type v} [semiring R] [semiring S] (g : R →+* S) (p : polynomial R) (x : S) {s : R} :
(s p) = g s * p
@[simp]
theorem polynomial.eval₂_C_X {R : Type u} [semiring R] {p : polynomial R} :
def polynomial.eval₂_add_monoid_hom {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) :
→+ S

eval₂_add_monoid_hom (f : R →+* S) (x : S) is the add_monoid_hom from polynomial R to S obtained by evaluating the pushforward of p along f at x.

Equations
@[simp]
theorem polynomial.eval₂_add_monoid_hom_apply {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) (p : polynomial R) :
= p
@[simp]
theorem polynomial.eval₂_nat_cast {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) (n : ) :
n = n
theorem polynomial.eval₂_sum {R : Type u} {S : Type v} {T : Type w} [semiring R] [semiring S] (f : R →+* S) [semiring T] (p : polynomial T) (g : T → ) (x : S) :
(p.sum g) = p.sum (λ (n : ) (a : T), (g n a))
theorem polynomial.eval₂_list_sum {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (l : list (polynomial R)) (x : S) :
l.sum = (list.map x) l).sum
theorem polynomial.eval₂_multiset_sum {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (s : multiset (polynomial R)) (x : S) :
s.sum = (multiset.map x) s).sum
theorem polynomial.eval₂_finset_sum {R : Type u} {S : Type v} {ι : Type y} [semiring R] [semiring S] (f : R →+* S) (s : finset ι) (g : ι → ) (x : S) :
(s.sum (λ (i : ι), g i)) = s.sum (λ (i : ι), (g i))
theorem polynomial.eval₂_of_finsupp {R : Type u} {S : Type v} [semiring R] [semiring S] {f : R →+* S} {x : S} {p : } :
{to_finsupp := p} = ((powers_hom S) x)) p
theorem polynomial.eval₂_mul_noncomm {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} [semiring S] (f : R →+* S) (x : S) (hf : ∀ (k : ), commute (f (q.coeff k)) x) :
(p * q) = p * q
@[simp]
theorem polynomial.eval₂_mul_X {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
= p * x
@[simp]
theorem polynomial.eval₂_X_mul {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
= p * x
theorem polynomial.eval₂_mul_C' {R : Type u} {S : Type v} {a : R} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) (h : commute (f a) x) :
(p * = p * f a
theorem polynomial.eval₂_list_prod_noncomm {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) (ps : list (polynomial R)) (hf : ∀ (p : , p ps∀ (k : ), commute (f (p.coeff k)) x) :
ps.prod = (list.map x) ps).prod
def polynomial.eval₂_ring_hom' {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (x : S) (hf : ∀ (a : R), commute (f a) x) :

eval₂ as a ring_hom for noncommutative rings

Equations

We next prove that eval₂ is multiplicative as long as target ring is commutative (even if the source ring is not).

theorem polynomial.eval₂_eq_sum_range {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
p = (finset.range (p.nat_degree + 1)).sum (λ (i : ), f (p.coeff i) * x ^ i)
theorem polynomial.eval₂_eq_sum_range' {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) {p : polynomial R} {n : } (hn : p.nat_degree < n) (x : S) :
p = (finset.range n).sum (λ (i : ), f (p.coeff i) * x ^ i)
@[simp]
theorem polynomial.eval₂_mul {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} (f : R →+* S) (x : S) :
(p * q) = p * q
theorem polynomial.eval₂_mul_eq_zero_of_left {R : Type u} {S : Type v} [semiring R] {p : polynomial R} (f : R →+* S) (x : S) (q : polynomial R) (hp : p = 0) :
(p * q) = 0
theorem polynomial.eval₂_mul_eq_zero_of_right {R : Type u} {S : Type v} [semiring R] {q : polynomial R} (f : R →+* S) (x : S) (p : polynomial R) (hq : q = 0) :
(p * q) = 0
noncomputable def polynomial.eval₂_ring_hom {R : Type u} {S : Type v} [semiring R] (f : R →+* S) (x : S) :

eval₂ as a ring_hom

Equations
@[simp]
theorem polynomial.coe_eval₂_ring_hom {R : Type u} {S : Type v} [semiring R] (f : R →+* S) (x : S) :
theorem polynomial.eval₂_pow {R : Type u} {S : Type v} [semiring R] {p : polynomial R} (f : R →+* S) (x : S) (n : ) :
(p ^ n) = p ^ n
theorem polynomial.eval₂_dvd {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} (f : R →+* S) (x : S) :
p q p q
theorem polynomial.eval₂_eq_zero_of_dvd_of_eval₂_eq_zero {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} (f : R →+* S) (x : S) (h : p q) (h0 : p = 0) :
q = 0
theorem polynomial.eval₂_list_prod {R : Type u} {S : Type v} [semiring R] (f : R →+* S) (l : list (polynomial R)) (x : S) :
l.prod = (list.map x) l).prod
def polynomial.eval {R : Type u} [semiring R] :
R → → R

eval x p is the evaluation of the polynomial p at x

Equations
theorem polynomial.eval_eq_sum {R : Type u} [semiring R] {p : polynomial R} {x : R} :
= p.sum (λ (e : ) (a : R), a * x ^ e)
theorem polynomial.eval_eq_sum_range {R : Type u} [semiring R] {p : polynomial R} (x : R) :
= (finset.range (p.nat_degree + 1)).sum (λ (i : ), p.coeff i * x ^ i)
theorem polynomial.eval_eq_sum_range' {R : Type u} [semiring R] {p : polynomial R} {n : } (hn : p.nat_degree < n) (x : R) :
= (finset.range n).sum (λ (i : ), p.coeff i * x ^ i)
@[simp]
theorem polynomial.eval₂_at_apply {R : Type u} [semiring R] {p : polynomial R} {S : Type u_1} [semiring S] (f : R →+* S) (r : R) :
(f r) p = f p)
@[simp]
theorem polynomial.eval₂_at_one {R : Type u} [semiring R] {p : polynomial R} {S : Type u_1} [semiring S] (f : R →+* S) :
p = f p)
@[simp]
theorem polynomial.eval₂_at_nat_cast {R : Type u} [semiring R] {p : polynomial R} {S : Type u_1} [semiring S] (f : R →+* S) (n : ) :
p = f p)
@[simp]
theorem polynomial.eval_C {R : Type u} {a : R} [semiring R] {x : R} :
= a
@[simp]
theorem polynomial.eval_nat_cast {R : Type u} [semiring R] {x : R} {n : } :
= n
@[simp]
theorem polynomial.eval_X {R : Type u} [semiring R] {x : R} :
@[simp]
theorem polynomial.eval_monomial {R : Type u} [semiring R] {x : R} {n : } {a : R} :
( a) = a * x ^ n
@[simp]
theorem polynomial.eval_zero {R : Type u} [semiring R] {x : R} :
= 0
@[simp]
theorem polynomial.eval_add {R : Type u} [semiring R] {p q : polynomial R} {x : R} :
(p + q) = +
@[simp]
theorem polynomial.eval_one {R : Type u} [semiring R] {x : R} :
= 1
@[simp]
theorem polynomial.eval_bit0 {R : Type u} [semiring R] {p : polynomial R} {x : R} :
(bit0 p) = bit0 p)
@[simp]
theorem polynomial.eval_bit1 {R : Type u} [semiring R] {p : polynomial R} {x : R} :
(bit1 p) = bit1 p)
@[simp]
theorem polynomial.eval_smul {R : Type u} {S : Type v} [semiring R] [monoid S] [ R] [ R] (s : S) (p : polynomial R) (x : R) :
(s p) = s
@[simp]
theorem polynomial.eval_C_mul {R : Type u} {a : R} [semiring R] {p : polynomial R} {x : R} :
* p) = a *
theorem polynomial.eval_monomial_one_add_sub {S : Type v} [comm_ring S] (d : ) (y : S) :
polynomial.eval (1 + y) ( (d + 1)) - ( (d + 1)) = (finset.range (d + 1)).sum (λ (x_1 : ), ((d + 1).choose x_1) * (x_1 * y ^ (x_1 - 1)))

A reformulation of the expansion of (1 + y)^d: $$(d + 1) (1 + y)^d - (d + 1)y^d = \sum_{i = 0}^d {d + 1 \choose i} \cdot i \cdot y^{i - 1}.$$

@[simp]
theorem polynomial.leval_apply {R : Type u_1} [semiring R] (r : R) (f : polynomial R) :
f =
def polynomial.leval {R : Type u_1} [semiring R] (r : R) :

polynomial.eval as linear map

Equations
@[simp]
theorem polynomial.eval_nat_cast_mul {R : Type u} [semiring R] {p : polynomial R} {x : R} {n : } :
(n * p) = n *
@[simp]
theorem polynomial.eval_mul_X {R : Type u} [semiring R] {p : polynomial R} {x : R} :
= * x
@[simp]
theorem polynomial.eval_mul_X_pow {R : Type u} [semiring R] {p : polynomial R} {x : R} {k : } :
(p * = * x ^ k
theorem polynomial.eval_sum {R : Type u} [semiring R] (p : polynomial R) (f : R → ) (x : R) :
(p.sum f) = p.sum (λ (n : ) (a : R), (f n a))
theorem polynomial.eval_finset_sum {R : Type u} {ι : Type y} [semiring R] (s : finset ι) (g : ι → ) (x : R) :
(s.sum (λ (i : ι), g i)) = s.sum (λ (i : ι), (g i))
def polynomial.is_root {R : Type u} [semiring R] (p : polynomial R) (a : R) :
Prop

is_root p x implies x is a root of p. The evaluation of p at x is zero

Equations
Instances for polynomial.is_root
@[protected, instance]
def polynomial.is_root.decidable {R : Type u} {a : R} [semiring R] {p : polynomial R} [decidable_eq R] :
Equations
@[simp]
theorem polynomial.is_root.def {R : Type u} {a : R} [semiring R] {p : polynomial R} :
p.is_root a = 0
theorem polynomial.is_root.eq_zero {R : Type u} [semiring R] {p : polynomial R} {x : R} (h : p.is_root x) :
= 0
theorem polynomial.coeff_zero_eq_eval_zero {R : Type u} [semiring R] (p : polynomial R) :
p.coeff 0 =
theorem polynomial.zero_is_root_of_coeff_zero_eq_zero {R : Type u} [semiring R] {p : polynomial R} (hp : p.coeff 0 = 0) :
theorem polynomial.is_root.dvd {R : Type u_1} {p q : polynomial R} {x : R} (h : p.is_root x) (hpq : p q) :
theorem polynomial.not_is_root_C {R : Type u} [semiring R] (r a : R) (hr : r 0) :
noncomputable def polynomial.comp {R : Type u} [semiring R] (p q : polynomial R) :

The composition of polynomials as a polynomial.

Equations
theorem polynomial.comp_eq_sum_left {R : Type u} [semiring R] {p q : polynomial R} :
p.comp q = p.sum (λ (e : ) (a : R), * q ^ e)
@[simp]
theorem polynomial.comp_X {R : Type u} [semiring R] {p : polynomial R} :
@[simp]
theorem polynomial.X_comp {R : Type u} [semiring R] {p : polynomial R} :
@[simp]
theorem polynomial.comp_C {R : Type u} {a : R} [semiring R] {p : polynomial R} :
p.comp =
@[simp]
theorem polynomial.C_comp {R : Type u} {a : R} [semiring R] {p : polynomial R} :
.comp p =
@[simp]
theorem polynomial.nat_cast_comp {R : Type u} [semiring R] {p : polynomial R} {n : } :
@[simp]
theorem polynomial.comp_zero {R : Type u} [semiring R] {p : polynomial R} :
p.comp 0 =
@[simp]
theorem polynomial.zero_comp {R : Type u} [semiring R] {p : polynomial R} :
0.comp p = 0
@[simp]
theorem polynomial.comp_one {R : Type u} [semiring R] {p : polynomial R} :
p.comp 1 =
@[simp]
theorem polynomial.one_comp {R : Type u} [semiring R] {p : polynomial R} :
1.comp p = 1
@[simp]
theorem polynomial.add_comp {R : Type u} [semiring R] {p q r : polynomial R} :
(p + q).comp r = p.comp r + q.comp r
@[simp]
theorem polynomial.monomial_comp {R : Type u} {a : R} [semiring R] {p : polynomial R} (n : ) :
( a).comp p = * p ^ n
@[simp]
theorem polynomial.mul_X_comp {R : Type u} [semiring R] {p r : polynomial R} :
.comp r = p.comp r * r
@[simp]
theorem polynomial.X_pow_comp {R : Type u} [semiring R] {p : polynomial R} {k : } :
.comp p = p ^ k
@[simp]
theorem polynomial.mul_X_pow_comp {R : Type u} [semiring R] {p r : polynomial R} {k : } :
(p * .comp r = p.comp r * r ^ k
@[simp]
theorem polynomial.C_mul_comp {R : Type u} {a : R} [semiring R] {p r : polynomial R} :
* p).comp r = * p.comp r
@[simp]
theorem polynomial.nat_cast_mul_comp {R : Type u} [semiring R] {p r : polynomial R} {n : } :
(n * p).comp r = n * p.comp r
@[simp]
theorem polynomial.mul_comp {R : Type u_1} (p q r : polynomial R) :
(p * q).comp r = p.comp r * q.comp r
@[simp]
theorem polynomial.pow_comp {R : Type u_1} (p q : polynomial R) (n : ) :
(p ^ n).comp q = p.comp q ^ n
@[simp]
theorem polynomial.bit0_comp {R : Type u} [semiring R] {p q : polynomial R} :
(bit0 p).comp q = bit0 (p.comp q)
@[simp]
theorem polynomial.bit1_comp {R : Type u} [semiring R] {p q : polynomial R} :
(bit1 p).comp q = bit1 (p.comp q)
@[simp]
theorem polynomial.smul_comp {R : Type u} {S : Type v} [semiring R] [monoid S] [ R] [ R] (s : S) (p q : polynomial R) :
(s p).comp q = s p.comp q
theorem polynomial.comp_assoc {R : Type u_1} (φ ψ χ : polynomial R) :
(φ.comp ψ).comp χ = φ.comp (ψ.comp χ)
theorem polynomial.coeff_comp_degree_mul_degree {R : Type u} [semiring R] {p q : polynomial R} (hqd0 : q.nat_degree 0) :
noncomputable def polynomial.map {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :

map f p maps a polynomial p across a ring hom f

Equations
Instances for polynomial.map
@[simp]
theorem polynomial.map_C {R : Type u} {S : Type v} {a : R} [semiring R] [semiring S] (f : R →+* S) :
@[simp]
theorem polynomial.map_X {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :
@[simp]
theorem polynomial.map_monomial {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) {n : } {a : R} :
( a) = (f a)
@[protected, simp]
theorem polynomial.map_zero {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :
= 0
@[protected, simp]
theorem polynomial.map_add {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} [semiring S] (f : R →+* S) :
(p + q) = +
@[protected, simp]
theorem polynomial.map_one {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :
= 1
@[protected, simp]
theorem polynomial.map_mul {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} [semiring S] (f : R →+* S) :
(p * q) = *
@[simp]
theorem polynomial.map_smul {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (r : R) :
(r p) = f r
noncomputable def polynomial.map_ring_hom {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :

polynomial.map as a ring_hom.

Equations
@[simp]
theorem polynomial.coe_map_ring_hom {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) :
@[protected, simp]
theorem polynomial.map_nat_cast {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (n : ) :
= n
@[simp]
theorem polynomial.coeff_map {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (n : ) :
p).coeff n = f (p.coeff n)
noncomputable def polynomial.map_equiv {R : Type u} {S : Type v} [semiring R] [semiring S] (e : R ≃+* S) :

If R and S are isomorphic, then so are their polynomial rings.

Equations
@[simp]
theorem polynomial.map_equiv_apply {R : Type u} {S : Type v} [semiring R] [semiring S] (e : R ≃+* S) (a : polynomial R) :
=
@[simp]
theorem polynomial.map_equiv_symm_apply {R : Type u} {S : Type v} [semiring R] [semiring S] (e : R ≃+* S) (a : polynomial S) :
.symm) a = a
theorem polynomial.map_map {R : Type u} {S : Type v} {T : Type w} [semiring R] [semiring S] (f : R →+* S) [semiring T] (g : S →+* T) (p : polynomial R) :
p) = polynomial.map (g.comp f) p
@[simp]
theorem polynomial.map_id {R : Type u} [semiring R] {p : polynomial R} :
= p
theorem polynomial.eval₂_eq_eval_map {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) {x : S} :
p = p)
theorem polynomial.map_injective {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (hf : function.injective f) :
theorem polynomial.map_surjective {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (hf : function.surjective f) :
theorem polynomial.degree_map_le {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) :
theorem polynomial.nat_degree_map_le {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) :
theorem polynomial.map_monic_eq_zero_iff {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] {f : R →+* S} (hp : p.monic) :
= 0 ∀ (x : R), f x = 0
theorem polynomial.map_monic_ne_zero {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] {f : R →+* S} (hp : p.monic) [nontrivial S] :
0
theorem polynomial.degree_map_eq_of_leading_coeff_ne_zero {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (hf : f p.leading_coeff 0) :
theorem polynomial.nat_degree_map_of_leading_coeff_ne_zero {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (hf : f p.leading_coeff 0) :
theorem polynomial.leading_coeff_map_of_leading_coeff_ne_zero {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (hf : f p.leading_coeff 0) :
@[simp]
theorem polynomial.map_ring_hom_id {R : Type u} [semiring R] :
@[simp]
theorem polynomial.map_ring_hom_comp {R : Type u} {S : Type v} {T : Type w} [semiring R] [semiring S] [semiring T] (f : S →+* T) (g : R →+* S) :
@[protected]
theorem polynomial.map_list_prod {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (L : list (polynomial R)) :
= L).prod
@[protected, simp]
theorem polynomial.map_pow {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (n : ) :
(p ^ n) = ^ n
theorem polynomial.mem_map_srange {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) {p : polynomial S} :
∀ (n : ), p.coeff n f.srange
theorem polynomial.mem_map_range {R : Type u_1} {S : Type u_2} [ring R] [ring S] (f : R →+* S) {p : polynomial S} :
∀ (n : ), p.coeff n f.range
theorem polynomial.eval₂_map {R : Type u} {S : Type v} {T : Type w} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) [semiring T] (g : S →+* T) (x : T) :
p) = polynomial.eval₂ (g.comp f) x p
theorem polynomial.eval_map {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : S) :
p) = p
@[protected]
theorem polynomial.map_sum {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) {ι : Type u_1} (g : ι → ) (s : finset ι) :
(s.sum (λ (i : ι), g i)) = s.sum (λ (i : ι), (g i))
theorem polynomial.map_comp {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p q : polynomial R) :
(p.comp q) = p).comp q)
@[simp]
theorem polynomial.eval_zero_map {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) :
p) = f p)
@[simp]
theorem polynomial.eval_one_map {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) :
p) = f p)
@[simp]
theorem polynomial.eval_nat_cast_map {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) (n : ) :
p) = f p)
@[simp]
theorem polynomial.eval_int_cast_map {R : Type u_1} {S : Type u_2} [ring R] [ring S] (f : R →+* S) (p : polynomial R) (i : ) :
p) = f p)

After having set up the basic theory of eval₂, eval, comp, and map, we make eval₂ irreducible.

Perhaps we can make the others irreducible too?

theorem polynomial.hom_eval₂ {R : Type u} {S : Type v} {T : Type w} [semiring R] (p : polynomial R) [semiring S] [semiring T] (f : R →+* S) (g : S →+* T) (x : S) :
g x p) = polynomial.eval₂ (g.comp f) (g x) p
theorem polynomial.eval₂_hom {R : Type u} {S : Type v} [semiring R] {p : polynomial R} [semiring S] (f : R →+* S) (x : R) :
(f x) p = f p)
theorem polynomial.eval₂_comp {R : Type u} {S : Type v} [semiring R] {p q : polynomial R} (f : R →+* S) {x : S} :
(p.comp q) = x q) p
@[simp]
theorem polynomial.eval_mul {R : Type u} {p q : polynomial R} {x : R} :
(p * q) = *
noncomputable def polynomial.eval_ring_hom {R : Type u}  :
R →

eval r, regarded as a ring homomorphism from polynomial R to R.

Equations
@[simp]
theorem polynomial.coe_eval_ring_hom {R : Type u} (r : R) :
@[simp]
theorem polynomial.eval_pow {R : Type u} {p : polynomial R} {x : R} (n : ) :
(p ^ n) = ^ n
@[simp]
theorem polynomial.eval_comp {R : Type u} {p q : polynomial R} {x : R} :
(p.comp q) = p
noncomputable def polynomial.comp_ring_hom {R : Type u}  :

comp p, regarded as a ring homomorphism from polynomial R to itself.

Equations
@[simp]
theorem polynomial.coe_comp_ring_hom {R : Type u} (q : polynomial R) :
(q.comp_ring_hom) = λ (p : , p.comp q
theorem polynomial.coe_comp_ring_hom_apply {R : Type u} (p q : polynomial R) :
theorem polynomial.root_mul_left_of_is_root {R : Type u} {a : R} (p : polynomial R) {q : polynomial R} :
q.is_root a(p * q).is_root a
theorem polynomial.root_mul_right_of_is_root {R : Type u} {a : R} {p : polynomial R} (q : polynomial R) :
p.is_root a(p * q).is_root a
theorem polynomial.eval₂_multiset_prod {R : Type u} {S : Type v} (f : R →+* S) (s : multiset (polynomial R)) (x : S) :
theorem polynomial.eval₂_finset_prod {R : Type u} {S : Type v} {ι : Type y} (f : R →+* S) (s : finset ι) (g : ι → ) (x : S) :
(s.prod (λ (i : ι), g i)) = s.prod (λ (i : ι), (g i))
theorem polynomial.eval_list_prod {R : Type u} (l : list (polynomial R)) (x : R) :
= l).prod

Polynomial evaluation commutes with list.prod

theorem polynomial.eval_multiset_prod {R : Type u} (s : multiset (polynomial R)) (x : R) :
= s).prod

Polynomial evaluation commutes with multiset.prod

theorem polynomial.eval_prod {R : Type u} {ι : Type u_1} (s : finset ι) (p : ι → ) (x : R) :
(s.prod (λ (j : ι), p j)) = s.prod (λ (j : ι), (p j))

Polynomial evaluation commutes with finset.prod

theorem polynomial.list_prod_comp {R : Type u} (l : list (polynomial R)) (q : polynomial R) :
l.prod.comp q = (list.map (λ (p : , p.comp q) l).prod
theorem polynomial.multiset_prod_comp {R : Type u} (s : multiset (polynomial R)) (q : polynomial R) :
s.prod.comp q = (multiset.map (λ (p : , p.comp q) s).prod
theorem polynomial.prod_comp {R : Type u} {ι : Type u_1} (s : finset ι) (p : ι → ) (q : polynomial R) :
(s.prod (λ (j : ι), p j)).comp q = s.prod (λ (j : ι), (p j).comp q)
theorem polynomial.is_root_prod {R : Type u_1} [comm_ring R] [is_domain R] {ι : Type u_2} (s : finset ι) (p : ι → ) (x : R) :
(s.prod (λ (j : ι), p j)).is_root x ∃ (i : ι) (H : i s), (p i).is_root x
theorem polynomial.eval_dvd {R : Type u} {p q : polynomial R} {x : R} :
p q
theorem polynomial.eval_eq_zero_of_dvd_of_eval_eq_zero {R : Type u} {p q : polynomial R} {x : R} :
p q = 0 = 0
@[simp]
theorem polynomial.eval_geom_sum {R : Type u_1} {n : } {x : R} :
((finset.range n).sum (λ (i : ), = (finset.range n).sum (λ (i : ), x ^ i)
theorem polynomial.map_dvd {R : Type u_1} {S : Type u_2} [semiring R] (f : R →+* S) {x y : polynomial R} :
x y
theorem polynomial.support_map_subset {R : Type u} {S : Type v} [semiring R] [semiring S] (f : R →+* S) (p : polynomial R) :
theorem polynomial.support_map_of_injective {R : Type u} {S : Type v} [semiring R] [semiring S] (p : polynomial R) {f : R →+* S} (hf : function.injective f) :
@[protected]
theorem polynomial.map_multiset_prod {R : Type u} {S : Type v} (f : R →+* S) (m : multiset (polynomial R)) :
= m).prod
@[protected]
theorem polynomial.map_prod {R : Type u} {S : Type v} (f : R →+* S) {ι : Type u_1} (g : ι → ) (s : finset ι) :
(s.prod (λ (i : ι), g i)) = s.prod (λ (i : ι), (g i))
theorem polynomial.is_root.map {R : Type u} {S : Type v} {f : R →+* S} {x : R} {p : polynomial R} (h : p.is_root x) :
p).is_root (f x)
theorem polynomial.is_root.of_map {S : Type v} {R : Type u_1} [comm_ring R] {f : R →+* S} {x : R} {p : polynomial R} (h : p).is_root (f x)) (hf : function.injective f) :
theorem polynomial.is_root_map_iff {S : Type v} {R : Type u_1} [comm_ring R] {f : R →+* S} {x : R} {p : polynomial R} (hf : function.injective f) :
p).is_root (f x) p.is_root x
theorem polynomial.C_neg {R : Type u} {a : R} [ring R] :
theorem polynomial.C_sub {R : Type u} {a b : R} [ring R] :
@[protected, simp]
theorem polynomial.map_sub {R : Type u} [ring R] {p q : polynomial R} {S : Type u_1} [ring S] (f : R →+* S) :
(p - q) = -
@[protected, simp]
theorem polynomial.map_neg {R : Type u} [ring R] {p : polynomial R} {S : Type u_1} [ring S] (f : R →+* S) :
(-p) = -
@[simp]
theorem polynomial.map_int_cast {R : Type u} [ring R] {S : Type u_1} [ring S] (f : R →+* S) (n : ) :
= n
@[simp]
theorem polynomial.eval_int_cast {R : Type u} [ring R] {n : } {x : R} :
= n
@[simp]
theorem polynomial.eval₂_neg {R : Type u} [ring R] {p : polynomial R} {S : Type u_1} [ring S] (f : R →+* S) {x : S} :
(-p) = - p
@[simp]
theorem polynomial.eval₂_sub {R : Type u} [ring R] {p q : polynomial R} {S : Type u_1} [ring S] (f : R →+* S) {x : S} :
(p - q) = p - q
@[simp]
theorem polynomial.eval_neg {R : Type u} [ring R] (p : polynomial R) (x : R) :
(-p) = -
@[simp]
theorem polynomial.eval_sub {R : Type u} [ring R] (p q : polynomial R) (x : R) :
(p - q) = -
theorem polynomial.root_X_sub_C {R : Type u} {a b : R} [ring R] :
a = b
@[simp]
theorem polynomial.neg_comp {R : Type u} [ring R] {p q : polynomial R} :
(-p).comp q = -p.comp q
@[simp]
theorem polynomial.sub_comp {R : Type u} [ring R] {p q r : polynomial R} :
(p - q).comp r = p.comp r - q.comp r
@[simp]
theorem polynomial.cast_int_comp {R : Type u} [ring R] {p : polynomial R} (i : ) :