File: Mathlib/Algebra/Polynomial/Coeff.lean

full_name: Polynomial.coeff_add
code: @[simp]
theorem coeff_add (p q : R[X]) (n : ℕ) : coeff (p + q) n = coeff p n + coeff q n 
goal: (p + q).coeff n = p.coeff n + q.coeff n

full_name: Polynomial.coeff_smul
code: @[simp]
theorem coeff_smul [SMulZeroClass S R] (r : S) (p : R[X]) (n : ℕ) :
    coeff (r • p) n = r • coeff p n 
goal: (r • p).coeff n = r • p.coeff n

full_name: Polynomial.support_smul
code: theorem support_smul [SMulZeroClass S R] (r : S) (p : R[X]) :
    support (r • p) ⊆ support p 
goal: (r • p).support ⊆ p.support

full_name: Polynomial.card_support_mul_le
code: theorem card_support_mul_le : (p * q).support.card ≤ p.support.card * q.support.card 
goal: (p * q).support.card ≤ p.support.card * q.support.card

full_name: Polynomial.lsum_apply
code: /-- `Polynomial.sum` as a linear map. -/
@[simps]
def lsum {R A M : Type*} [Semiring R] [Semiring A] [AddCommMonoid M] [Module R A] [Module R M]
    (f : ℕ → A →ₗ[R] M) : A[X] →ₗ[R] M 
goal: (Polynomial.lsum f) p = p.sum fun x x_1 => (f x) x_1

full_name: Polynomial.lsum
code: /-- `Polynomial.sum` as a linear map. -/
@[simps]
def lsum {R A M : Type*} [Semiring R] [Semiring A] [AddCommMonoid M] [Module R A] [Module R M]
    (f : ℕ → A →ₗ[R] M) : A[X] →ₗ[R] M 
goal: A[X] →ₗ[R] M

full_name: Polynomial.lcoeff
code: /-- The nth coefficient, as a linear map. -/
def lcoeff (n : ℕ) : R[X] →ₗ[R] R 
goal: R[X] →ₗ[R] R

full_name: Polynomial.lcoeff_apply
code: @[simp]
theorem lcoeff_apply (n : ℕ) (f : R[X]) : lcoeff R n f = coeff f n 
goal: (Polynomial.lcoeff R n) f = f.coeff n

full_name: Polynomial.finset_sum_coeff
code: @[simp]
theorem finset_sum_coeff {ι : Type*} (s : Finset ι) (f : ι → R[X]) (n : ℕ) :
    coeff (∑ b ∈ s, f b) n = ∑ b ∈ s, coeff (f b) n 
goal: (∑ b ∈ s, f b).coeff n = ∑ b ∈ s, (f b).coeff n

full_name: Polynomial.coeff_list_sum
code: lemma coeff_list_sum (l : List R[X]) (n : ℕ) :
    l.sum.coeff n = (l.map (lcoeff R n)).sum 
goal: l.sum.coeff n = (List.map (⇑(Polynomial.lcoeff R n)) l).sum

full_name: Polynomial.coeff_list_sum_map
code: lemma coeff_list_sum_map {ι : Type*} (l : List ι) (f : ι → R[X]) (n : ℕ) :
    (l.map f).sum.coeff n = (l.map (fun a => (f a).coeff n)).sum 
goal: (List.map f l).sum.coeff n = (List.map (fun a => (f a).coeff n) l).sum

full_name: Polynomial.coeff_sum
code: theorem coeff_sum [Semiring S] (n : ℕ) (f : ℕ → R → S[X]) :
    coeff (p.sum f) n = p.sum fun a b => coeff (f a b) n 
goal: (p.sum f).coeff n = p.sum fun a b => (f a b).coeff n

full_name: Polynomial.coeff_mul
code: /-- Decomposes the coefficient of the product `p * q` as a sum
over `antidiagonal`. A version which sums over `range (n + 1)` can be obtained
by using `Finset.Nat.sum_antidiagonal_eq_sum_range_succ`. -/
theorem coeff_mul (p q : R[X]) (n : ℕ) :
    coeff (p * q) n = ∑ x ∈ antidiagonal n, coeff p x.1 * coeff q x.2 
goal: (p * q).coeff n = ∑ x ∈ Finset.antidiagonal n, p.coeff x.1 * q.coeff x.2

full_name: Polynomial.mul_coeff_zero
code: @[simp]
theorem mul_coeff_zero (p q : R[X]) : coeff (p * q) 0 = coeff p 0 * coeff q 0 
goal: (p * q).coeff 0 = p.coeff 0 * q.coeff 0

full_name: Polynomial.constantCoeff_apply
code: /-- `constantCoeff p` returns the constant term of the polynomial `p`,
  defined as `coeff p 0`. This is a ring homomorphism. -/
@[simps]
def constantCoeff : R[X] →+* R 
goal: Polynomial.constantCoeff p = p.coeff 0

full_name: Polynomial.constantCoeff
code: /-- `constantCoeff p` returns the constant term of the polynomial `p`,
  defined as `coeff p 0`. This is a ring homomorphism. -/
@[simps]
def constantCoeff : R[X] →+* R 
goal: R[X] →+* R

full_name: Polynomial.isUnit_C
code: theorem isUnit_C {x : R} : IsUnit (C x) ↔ IsUnit x 
goal: IsUnit (Polynomial.C x) ↔ IsUnit x

full_name: Polynomial.coeff_mul_X_zero
code: theorem coeff_mul_X_zero (p : R[X]) : coeff (p * X) 0 = 0 
goal: (p * Polynomial.X).coeff 0 = 0

full_name: Polynomial.coeff_X_mul_zero
code: theorem coeff_X_mul_zero (p : R[X]) : coeff (X * p) 0 = 0 
goal: (Polynomial.X * p).coeff 0 = 0

full_name: Polynomial.coeff_C_mul_X_pow
code: theorem coeff_C_mul_X_pow (x : R) (k n : ℕ) :
    coeff (C x * X ^ k : R[X]) n = if n = k then x else 0 
goal: (Polynomial.C x * Polynomial.X ^ k).coeff n = if n = k then x else 0

full_name: Polynomial.coeff_C_mul_X
code: theorem coeff_C_mul_X (x : R) (n : ℕ) : coeff (C x * X : R[X]) n = if n = 1 then x else 0 
goal: (Polynomial.C x * Polynomial.X).coeff n = if n = 1 then x else 0

full_name: Polynomial.coeff_C_mul
code: @[simp]
theorem coeff_C_mul (p : R[X]) : coeff (C a * p) n = a * coeff p n 
goal: (Polynomial.C a * p).coeff n = a * p.coeff n

full_name: Polynomial.C_mul'
code: theorem C_mul' (a : R) (f : R[X]) : C a * f = a • f 
goal: Polynomial.C a * f = a • f

full_name: Polynomial.coeff_mul_C
code: @[simp]
theorem coeff_mul_C (p : R[X]) (n : ℕ) (a : R) : coeff (p * C a) n = coeff p n * a 
goal: (p * Polynomial.C a).coeff n = p.coeff n * a

full_name: Polynomial.coeff_mul_natCast
code: @[simp] lemma coeff_mul_natCast {a k : ℕ} :
  coeff (p * (a : R[X])) k = coeff p k * (↑a : R) 
goal: (p * ↑a).coeff k = p.coeff k * ↑a

full_name: Polynomial.coeff_natCast_mul
code: @[simp] lemma coeff_natCast_mul {a k : ℕ} :
  coeff ((a : R[X]) * p) k = a * coeff p k 
goal: (↑a * p).coeff k = ↑a * p.coeff k

full_name: Polynomial.coeff_mul_ofNat
code: @[simp] lemma coeff_mul_ofNat {a k : ℕ} [Nat.AtLeastTwo a] :
  coeff (p * (no_index (OfNat.ofNat a) : R[X])) k = coeff p k * OfNat.ofNat a 
goal: (p * OfNat.ofNat a).coeff k = p.coeff k * OfNat.ofNat a

full_name: Polynomial.coeff_ofNat_mul
code: @[simp] lemma coeff_ofNat_mul {a k : ℕ} [Nat.AtLeastTwo a] :
  coeff ((no_index (OfNat.ofNat a) : R[X]) * p) k = OfNat.ofNat a * coeff p k 
goal: (OfNat.ofNat a * p).coeff k = OfNat.ofNat a * p.coeff k

full_name: Polynomial.coeff_mul_intCast
code: @[simp] lemma coeff_mul_intCast [Ring S] {p : S[X]} {a : ℤ} {k : ℕ} :
  coeff (p * (a : S[X])) k = coeff p k * (↑a : S) 
goal: (p * ↑a).coeff k = p.coeff k * ↑a

full_name: Polynomial.coeff_intCast_mul
code: @[simp] lemma coeff_intCast_mul [Ring S] {p : S[X]} {a : ℤ} {k : ℕ} :
  coeff ((a : S[X]) * p) k = a * coeff p k 
goal: (↑a * p).coeff k = ↑a * p.coeff k

full_name: Polynomial.coeff_X_pow
code: @[simp]
theorem coeff_X_pow (k n : ℕ) : coeff (X ^ k : R[X]) n = if n = k then 1 else 0 
goal: (Polynomial.X ^ k).coeff n = if n = k then 1 else 0

full_name: Polynomial.coeff_X_pow_self
code: theorem coeff_X_pow_self (n : ℕ) : coeff (X ^ n : R[X]) n = 1 
goal: (Polynomial.X ^ n).coeff n = 1

full_name: Polynomial.support_binomial
code: theorem support_binomial {k m : ℕ} (hkm : k ≠ m) {x y : R} (hx : x ≠ 0) (hy : y ≠ 0) :
    support (C x * X ^ k + C y * X ^ m) = {k, m} 
goal: (Polynomial.C x * Polynomial.X ^ k + Polynomial.C y * Polynomial.X ^ m).support = {k, m}

full_name: Polynomial.support_trinomial
code: theorem support_trinomial {k m n : ℕ} (hkm : k < m) (hmn : m < n) {x y z : R} (hx : x ≠ 0)
    (hy : y ≠ 0) (hz : z ≠ 0) :
    support (C x * X ^ k + C y * X ^ m + C z * X ^ n) = {k, m, n} 
goal: (Polynomial.C x * Polynomial.X ^ k + Polynomial.C y * Polynomial.X ^ m + Polynomial.C z * Polynomial.X ^ n).support =
  {k, m, n}

full_name: Polynomial.card_support_binomial
code: theorem card_support_binomial {k m : ℕ} (h : k ≠ m) {x y : R} (hx : x ≠ 0) (hy : y ≠ 0) :
    card (support (C x * X ^ k + C y * X ^ m)) = 2 
goal: (Polynomial.C x * Polynomial.X ^ k + Polynomial.C y * Polynomial.X ^ m).support.card = 2

full_name: Polynomial.card_support_trinomial
code: theorem card_support_trinomial {k m n : ℕ} (hkm : k < m) (hmn : m < n) {x y z : R} (hx : x ≠ 0)
    (hy : y ≠ 0) (hz : z ≠ 0) : card (support (C x * X ^ k + C y * X ^ m + C z * X ^ n)) = 3 
goal: (Polynomial.C x * Polynomial.X ^ k + Polynomial.C y * Polynomial.X ^ m +
        Polynomial.C z * Polynomial.X ^ n).support.card =
  3

full_name: Polynomial.coeff_mul_X_pow
code: @[simp]
theorem coeff_mul_X_pow (p : R[X]) (n d : ℕ) :
    coeff (p * Polynomial.X ^ n) (d + n) = coeff p d 
goal: (p * Polynomial.X ^ n).coeff (d + n) = p.coeff d

full_name: Polynomial.coeff_X_pow_mul
code: @[simp]
theorem coeff_X_pow_mul (p : R[X]) (n d : ℕ) :
    coeff (Polynomial.X ^ n * p) (d + n) = coeff p d 
goal: (Polynomial.X ^ n * p).coeff (d + n) = p.coeff d

full_name: Polynomial.coeff_mul_X_pow'
code: theorem coeff_mul_X_pow' (p : R[X]) (n d : ℕ) :
    (p * X ^ n).coeff d = ite (n ≤ d) (p.coeff (d - n)) 0 
goal: (p * Polynomial.X ^ n).coeff d = if n ≤ d then p.coeff (d - n) else 0

full_name: Polynomial.coeff_X_pow_mul'
code: theorem coeff_X_pow_mul' (p : R[X]) (n d : ℕ) :
    (X ^ n * p).coeff d = ite (n ≤ d) (p.coeff (d - n)) 0 
goal: (Polynomial.X ^ n * p).coeff d = if n ≤ d then p.coeff (d - n) else 0

full_name: Polynomial.coeff_mul_X
code: @[simp]
theorem coeff_mul_X (p : R[X]) (n : ℕ) : coeff (p * X) (n + 1) = coeff p n 
goal: (p * Polynomial.X).coeff (n + 1) = p.coeff n

full_name: Polynomial.coeff_X_mul
code: @[simp]
theorem coeff_X_mul (p : R[X]) (n : ℕ) : coeff (X * p) (n + 1) = coeff p n 
goal: (Polynomial.X * p).coeff (n + 1) = p.coeff n

full_name: Polynomial.coeff_mul_monomial
code: theorem coeff_mul_monomial (p : R[X]) (n d : ℕ) (r : R) :
    coeff (p * monomial n r) (d + n) = coeff p d * r 
goal: (p * (Polynomial.monomial n) r).coeff (d + n) = p.coeff d * r

full_name: Polynomial.coeff_monomial_mul
code: theorem coeff_monomial_mul (p : R[X]) (n d : ℕ) (r : R) :
    coeff (monomial n r * p) (d + n) = r * coeff p d 
goal: ((Polynomial.monomial n) r * p).coeff (d + n) = r * p.coeff d

full_name: Polynomial.coeff_mul_monomial_zero
code: theorem coeff_mul_monomial_zero (p : R[X]) (d : ℕ) (r : R) :
    coeff (p * monomial 0 r) d = coeff p d * r 
goal: (p * (Polynomial.monomial 0) r).coeff d = p.coeff d * r

full_name: Polynomial.coeff_monomial_zero_mul
code: theorem coeff_monomial_zero_mul (p : R[X]) (d : ℕ) (r : R) :
    coeff (monomial 0 r * p) d = r * coeff p d 
goal: ((Polynomial.monomial 0) r * p).coeff d = r * p.coeff d

full_name: Polynomial.mul_X_pow_eq_zero
code: theorem mul_X_pow_eq_zero {p : R[X]} {n : ℕ} (H : p * X ^ n = 0) : p = 0 
goal: p = 0

full_name: Polynomial.isRegular_X_pow
code: theorem isRegular_X_pow (n : ℕ) : IsRegular (X ^ n : R[X]) 
goal: IsRegular (Polynomial.X ^ n)

full_name: Polynomial.isRegular_X
code: @[simp] theorem isRegular_X : IsRegular (X : R[X]) 
goal: IsRegular Polynomial.X

full_name: Polynomial.coeff_X_add_C_pow
code: theorem coeff_X_add_C_pow (r : R) (n k : ℕ) :
    ((X + C r) ^ n).coeff k = r ^ (n - k) * (n.choose k : R) 
goal: ((Polynomial.X + Polynomial.C r) ^ n).coeff k = r ^ (n - k) * ↑(n.choose k)

full_name: Polynomial.coeff_X_add_one_pow
code: theorem coeff_X_add_one_pow (R : Type*) [Semiring R] (n k : ℕ) :
    ((X + 1) ^ n).coeff k = (n.choose k : R) 
goal: ((Polynomial.X + 1) ^ n).coeff k = ↑(n.choose k)

full_name: Polynomial.coeff_one_add_X_pow
code: theorem coeff_one_add_X_pow (R : Type*) [Semiring R] (n k : ℕ) :
    ((1 + X) ^ n).coeff k = (n.choose k : R) 
goal: ((1 + Polynomial.X) ^ n).coeff k = ↑(n.choose k)

full_name: Polynomial.C_dvd_iff_dvd_coeff
code: theorem C_dvd_iff_dvd_coeff (r : R) (φ : R[X]) : C r ∣ φ ↔ ∀ i, r ∣ φ.coeff i 
goal: Polynomial.C r ∣ φ ↔ ∀ (i : ℕ), r ∣ φ.coeff i

full_name: Polynomial.smul_eq_C_mul
code: theorem smul_eq_C_mul (a : R) : a • p = C a * p 
goal: a • p = Polynomial.C a * p

full_name: Polynomial.update_eq_add_sub_coeff
code: theorem update_eq_add_sub_coeff {R : Type*} [Ring R] (p : R[X]) (n : ℕ) (a : R) :
    p.update n a = p + Polynomial.C (a - p.coeff n) * Polynomial.X ^ n 
goal: p.update n a = p + Polynomial.C (a - p.coeff n) * Polynomial.X ^ n

full_name: Polynomial.natCast_coeff_zero
code: theorem natCast_coeff_zero {n : ℕ} {R : Type*} [Semiring R] : (n : R[X]).coeff 0 = n 
goal: (↑n).coeff 0 = ↑n

full_name: Polynomial.natCast_inj
code: @[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem natCast_inj {m n : ℕ} {R : Type*} [Semiring R] [CharZero R] :
    (↑m : R[X]) = ↑n ↔ m = n 
goal: ↑m = ↑n ↔ m = n

full_name: Polynomial.intCast_coeff_zero
code: @[simp]
theorem intCast_coeff_zero {i : ℤ} {R : Type*} [Ring R] : (i : R[X]).coeff 0 = i 
goal: (↑i).coeff 0 = ↑i

full_name: Polynomial.intCast_inj
code: @[norm_cast] -- @[simp] -- Porting note (#10618): simp can prove this
theorem intCast_inj {m n : ℤ} {R : Type*} [Ring R] [CharZero R] : (↑m : R[X]) = ↑n ↔ m = n 
goal: ↑m = ↑n ↔ m = n

full_name: Polynomial.charZero
code: instance charZero [CharZero R] : CharZero R[X] 
goal: CharZero R[X]