File: Mathlib/Algebra/Polynomial/Div.lean

full_name: Polynomial.X_dvd_iff
code: theorem X_dvd_iff {f : R[X]} : X ∣ f ↔ f.coeff 0 = 0 
goal: Polynomial.X ∣ f ↔ f.coeff 0 = 0

full_name: Polynomial.X_pow_dvd_iff
code: theorem X_pow_dvd_iff {f : R[X]} {n : ℕ} : X ^ n ∣ f ↔ ∀ d < n, f.coeff d = 0 
goal: Polynomial.X ^ n ∣ f ↔ ∀ d < n, f.coeff d = 0

full_name: Polynomial.multiplicity_finite_of_degree_pos_of_monic
code: theorem multiplicity_finite_of_degree_pos_of_monic (hp : (0 : WithBot ℕ) < degree p) (hmp : Monic p)
    (hq : q ≠ 0) : multiplicity.Finite p q 
goal: multiplicity.Finite p q

full_name: Polynomial.div_wf_lemma
code: theorem div_wf_lemma (h : degree q ≤ degree p ∧ p ≠ 0) (hq : Monic q) :
    degree (p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) < degree p 
goal: (p - q * (Polynomial.C p.leadingCoeff * Polynomial.X ^ (p.natDegree - q.natDegree))).degree < p.degree

full_name: Polynomial.divModByMonicAux
code: /-- See `divByMonic`. -/
noncomputable def divModByMonicAux : ∀ (_p : R[X]) {q : R[X]}, Monic q → R[X] × R[X]
  
goal: q.Monic → R[X] × R[X]

full_name: Polynomial.divByMonic
code: /-- `divByMonic` gives the quotient of `p` by a monic polynomial `q`. -/
def divByMonic (p q : R[X]) : R[X] 
goal: R[X]

full_name: Polynomial.modByMonic
code: /-- `modByMonic` gives the remainder of `p` by a monic polynomial `q`. -/
def modByMonic (p q : R[X]) : R[X] 
goal: R[X]

full_name: Polynomial._aux_Mathlib_Algebra_Polynomial_Div___unexpand_Polynomial_divByMonic_1
code: @[inherit_doc]
infixl:70 " /ₘ " => divByMonic
goal: Lean.PrettyPrinter.Unexpander

full_name: Polynomial.«_aux_Mathlib_Algebra_Polynomial_Div___macroRules_Polynomial_term_/ₘ__1»
code: @[inherit_doc]
infixl:70 " /ₘ " => divByMonic
goal: Lean.Macro

full_name: Polynomial.«_aux_Mathlib_Algebra_Polynomial_Div___macroRules_Polynomial_term_%ₘ__1»
code: @[inherit_doc]
infixl:70 " %ₘ " => modByMonic
goal: Lean.Macro

full_name: Polynomial._aux_Mathlib_Algebra_Polynomial_Div___unexpand_Polynomial_modByMonic_1
code: @[inherit_doc]
infixl:70 " %ₘ " => modByMonic
goal: Lean.PrettyPrinter.Unexpander

full_name: Polynomial.degree_modByMonic_lt
code: theorem degree_modByMonic_lt [Nontrivial R] :
    ∀ (p : R[X]) {q : R[X]} (_hq : Monic q), degree (p %ₘ q) < degree q
  
goal: (p %ₘ q).degree < q.degree

full_name: Polynomial.natDegree_modByMonic_lt
code: theorem natDegree_modByMonic_lt (p : R[X]) {q : R[X]} (hmq : Monic q) (hq : q ≠ 1) :
    natDegree (p %ₘ q) < q.natDegree 
goal: (p %ₘ q).natDegree < q.natDegree

full_name: Polynomial.zero_modByMonic
code: @[simp]
theorem zero_modByMonic (p : R[X]) : 0 %ₘ p = 0 
goal: 0 %ₘ p = 0

full_name: Polynomial.zero_divByMonic
code: @[simp]
theorem zero_divByMonic (p : R[X]) : 0 /ₘ p = 0 
goal: 0 /ₘ p = 0

full_name: Polynomial.modByMonic_zero
code: @[simp]
theorem modByMonic_zero (p : R[X]) : p %ₘ 0 = p 
goal: p %ₘ 0 = p

full_name: Polynomial.divByMonic_zero
code: @[simp]
theorem divByMonic_zero (p : R[X]) : p /ₘ 0 = 0 
goal: p /ₘ 0 = 0

full_name: Polynomial.divByMonic_eq_of_not_monic
code: theorem divByMonic_eq_of_not_monic (p : R[X]) (hq : ¬Monic q) : p /ₘ q = 0 
goal: p /ₘ q = 0

full_name: Polynomial.modByMonic_eq_of_not_monic
code: theorem modByMonic_eq_of_not_monic (p : R[X]) (hq : ¬Monic q) : p %ₘ q = p 
goal: p %ₘ q = p

full_name: Polynomial.modByMonic_eq_self_iff
code: theorem modByMonic_eq_self_iff [Nontrivial R] (hq : Monic q) : p %ₘ q = p ↔ degree p < degree q 
goal: p %ₘ q = p ↔ p.degree < q.degree

full_name: Polynomial.degree_modByMonic_le
code: theorem degree_modByMonic_le (p : R[X]) {q : R[X]} (hq : Monic q) : degree (p %ₘ q) ≤ degree q 
goal: (p %ₘ q).degree ≤ q.degree

full_name: Polynomial.natDegree_modByMonic_le
code: theorem natDegree_modByMonic_le (p : Polynomial R) {g : Polynomial R} (hg : g.Monic) :
    natDegree (p %ₘ g) ≤ g.natDegree 
goal: (p %ₘ g).natDegree ≤ g.natDegree

full_name: Polynomial.X_dvd_sub_C
code: theorem X_dvd_sub_C : X ∣ p - C (p.coeff 0) 
goal: Polynomial.X ∣ p - Polynomial.C (p.coeff 0)

full_name: Polynomial.modByMonic_eq_sub_mul_div
code: theorem modByMonic_eq_sub_mul_div :
    ∀ (p : R[X]) {q : R[X]} (_hq : Monic q), p %ₘ q = p - q * (p /ₘ q)
  
goal: p %ₘ q = p - q * (p /ₘ q)

full_name: Polynomial.modByMonic_add_div
code: theorem modByMonic_add_div (p : R[X]) {q : R[X]} (hq : Monic q) : p %ₘ q + q * (p /ₘ q) = p 
goal: p %ₘ q + q * (p /ₘ q) = p

full_name: Polynomial.divByMonic_eq_zero_iff
code: theorem divByMonic_eq_zero_iff [Nontrivial R] (hq : Monic q) : p /ₘ q = 0 ↔ degree p < degree q 
goal: p /ₘ q = 0 ↔ p.degree < q.degree

full_name: Polynomial.degree_add_divByMonic
code: theorem degree_add_divByMonic (hq : Monic q) (h : degree q ≤ degree p) :
    degree q + degree (p /ₘ q) = degree p 
goal: q.degree + (p /ₘ q).degree = p.degree

full_name: Polynomial.degree_divByMonic_le
code: theorem degree_divByMonic_le (p q : R[X]) : degree (p /ₘ q) ≤ degree p 
goal: (p /ₘ q).degree ≤ p.degree

full_name: Polynomial.degree_divByMonic_lt
code: theorem degree_divByMonic_lt (p : R[X]) {q : R[X]} (hq : Monic q) (hp0 : p ≠ 0)
    (h0q : 0 < degree q) : degree (p /ₘ q) < degree p 
goal: (p /ₘ q).degree < p.degree

full_name: Polynomial.natDegree_divByMonic
code: theorem natDegree_divByMonic (f : R[X]) {g : R[X]} (hg : g.Monic) :
    natDegree (f /ₘ g) = natDegree f - natDegree g 
goal: (f /ₘ g).natDegree = f.natDegree - g.natDegree

full_name: Polynomial.div_modByMonic_unique
code: theorem div_modByMonic_unique {f g} (q r : R[X]) (hg : Monic g)
    (h : r + g * q = f ∧ degree r < degree g) : f /ₘ g = q ∧ f %ₘ g = r 
goal: f /ₘ g = q ∧ f %ₘ g = r

full_name: Polynomial.map_mod_divByMonic
code: theorem map_mod_divByMonic [Ring S] (f : R →+* S) (hq : Monic q) :
    (p /ₘ q).map f = p.map f /ₘ q.map f ∧ (p %ₘ q).map f = p.map f %ₘ q.map f 
goal: Polynomial.map f (p /ₘ q) = Polynomial.map f p /ₘ Polynomial.map f q ∧
  Polynomial.map f (p %ₘ q) = Polynomial.map f p %ₘ Polynomial.map f q

full_name: Polynomial.map_divByMonic
code: theorem map_divByMonic [Ring S] (f : R →+* S) (hq : Monic q) :
    (p /ₘ q).map f = p.map f /ₘ q.map f 
goal: Polynomial.map f (p /ₘ q) = Polynomial.map f p /ₘ Polynomial.map f q

full_name: Polynomial.map_modByMonic
code: theorem map_modByMonic [Ring S] (f : R →+* S) (hq : Monic q) :
    (p %ₘ q).map f = p.map f %ₘ q.map f 
goal: Polynomial.map f (p %ₘ q) = Polynomial.map f p %ₘ Polynomial.map f q

full_name: Polynomial.modByMonic_eq_zero_iff_dvd
code: theorem modByMonic_eq_zero_iff_dvd (hq : Monic q) : p %ₘ q = 0 ↔ q ∣ p 
goal: p %ₘ q = 0 ↔ q ∣ p

full_name: Polynomial.self_mul_modByMonic
code: /-- See `Polynomial.mul_left_modByMonic` for the other multiplication order. That version, unlike
this one, requires commutativity. -/
@[simp]
lemma self_mul_modByMonic (hq : q.Monic) : (q * p) %ₘ q = 0 
goal: q * p %ₘ q = 0

full_name: Polynomial.map_dvd_map
code: theorem map_dvd_map [Ring S] (f : R →+* S) (hf : Function.Injective f) {x y : R[X]}
    (hx : x.Monic) : x.map f ∣ y.map f ↔ x ∣ y 
goal: Polynomial.map f x ∣ Polynomial.map f y ↔ x ∣ y

full_name: Polynomial.modByMonic_one
code: @[simp]
theorem modByMonic_one (p : R[X]) : p %ₘ 1 = 0 
goal: p %ₘ 1 = 0

full_name: Polynomial.divByMonic_one
code: @[simp]
theorem divByMonic_one (p : R[X]) : p /ₘ 1 = p 
goal: p /ₘ 1 = p

full_name: Polynomial.sum_modByMonic_coeff
code: theorem sum_modByMonic_coeff (hq : q.Monic) {n : ℕ} (hn : q.degree ≤ n) :
    (∑ i : Fin n, monomial i ((p %ₘ q).coeff i)) = p %ₘ q 
goal: ∑ i : Fin n, (Polynomial.monomial ↑i) ((p %ₘ q).coeff ↑i) = p %ₘ q

full_name: Polynomial.mul_divByMonic_cancel_left
code: theorem mul_divByMonic_cancel_left (p : R[X]) {q : R[X]} (hmo : q.Monic) :
    q * p /ₘ q = p 
goal: q * p /ₘ q = p

full_name: Polynomial.coeff_divByMonic_X_sub_C_rec
code: lemma coeff_divByMonic_X_sub_C_rec (p : R[X]) (a : R) (n : ℕ) :
    (p /ₘ (X - C a)).coeff n = coeff p (n + 1) + a * (p /ₘ (X - C a)).coeff (n + 1) 
goal: (p /ₘ (Polynomial.X - Polynomial.C a)).coeff n =
  p.coeff (n + 1) + a * (p /ₘ (Polynomial.X - Polynomial.C a)).coeff (n + 1)

full_name: Polynomial.coeff_divByMonic_X_sub_C
code: theorem coeff_divByMonic_X_sub_C (p : R[X]) (a : R) (n : ℕ) :
    (p /ₘ (X - C a)).coeff n = ∑ i ∈ Icc (n + 1) p.natDegree, a ^ (i - (n + 1)) * p.coeff i 
goal: (p /ₘ (Polynomial.X - Polynomial.C a)).coeff n = ∑ i ∈ Finset.Icc (n + 1) p.natDegree, a ^ (i - (n + 1)) * p.coeff i

full_name: Polynomial.not_isField
code: theorem not_isField : ¬IsField R[X] 
goal: ¬IsField R[X]

full_name: Polynomial.decidableDvdMonic
code: /-- An algorithm for deciding polynomial divisibility.
The algorithm is "compute `p %ₘ q` and compare to `0`".
See `polynomial.modByMonic` for the algorithm that computes `%ₘ`.
-/
def decidableDvdMonic [DecidableEq R] (p : R[X]) (hq : Monic q) : Decidable (q ∣ p) 
goal: Decidable (q ∣ p)

full_name: Polynomial.multiplicity_X_sub_C_finite
code: theorem multiplicity_X_sub_C_finite (a : R) (h0 : p ≠ 0) : multiplicity.Finite (X - C a) p 
goal: multiplicity.Finite (Polynomial.X - Polynomial.C a) p

full_name: Polynomial.rootMultiplicity
code: /-- The largest power of `X - C a` which divides `p`.
This *could be* computable via the divisibility algorithm `Polynomial.decidableDvdMonic`,
as shown by `Polynomial.rootMultiplicity_eq_nat_find_of_nonzero` which has a computable RHS. -/
def rootMultiplicity (a : R) (p : R[X]) : ℕ 
goal: ℕ

full_name: Polynomial.rootMultiplicity_eq_nat_find_of_nonzero
code: theorem rootMultiplicity_eq_nat_find_of_nonzero [DecidableEq R] {p : R[X]} (p0 : p ≠ 0) {a : R} :
    letI : DecidablePred fun n : ℕ => ¬(X - C a) ^ (n + 1) ∣ p := fun n =>
      @Not.decidable _ (decidableDvdMonic p ((monic_X_sub_C a).pow (n + 1)))
    rootMultiplicity a p = Nat.find (multiplicity_X_sub_C_finite a p0) 
goal: Polynomial.rootMultiplicity a p = Nat.find ⋯

full_name: Polynomial.rootMultiplicity_eq_multiplicity
code: theorem rootMultiplicity_eq_multiplicity [DecidableEq R] [@DecidableRel R[X] (· ∣ ·)]
    (p : R[X]) (a : R) :
    rootMultiplicity a p =
      if h0 : p = 0 then 0 else (multiplicity (X - C a) p).get (multiplicity_X_sub_C_finite a h0) 
goal: Polynomial.rootMultiplicity a p = if h0 : p = 0 then 0 else (multiplicity (Polynomial.X - Polynomial.C a) p).get ⋯

full_name: Polynomial.rootMultiplicity_zero
code: @[simp]
theorem rootMultiplicity_zero {x : R} : rootMultiplicity x 0 = 0 
goal: Polynomial.rootMultiplicity x 0 = 0

full_name: Polynomial.rootMultiplicity_C
code: @[simp]
theorem rootMultiplicity_C (r a : R) : rootMultiplicity a (C r) = 0 
goal: Polynomial.rootMultiplicity a (Polynomial.C r) = 0

full_name: Polynomial.pow_rootMultiplicity_dvd
code: theorem pow_rootMultiplicity_dvd (p : R[X]) (a : R) : (X - C a) ^ rootMultiplicity a p ∣ p 
goal: (Polynomial.X - Polynomial.C a) ^ Polynomial.rootMultiplicity a p ∣ p

full_name: Polynomial.pow_mul_divByMonic_rootMultiplicity_eq
code: theorem pow_mul_divByMonic_rootMultiplicity_eq (p : R[X]) (a : R) :
    (X - C a) ^ rootMultiplicity a p * (p /ₘ (X - C a) ^ rootMultiplicity a p) = p 
goal: (Polynomial.X - Polynomial.C a) ^ Polynomial.rootMultiplicity a p *
    (p /ₘ (Polynomial.X - Polynomial.C a) ^ Polynomial.rootMultiplicity a p) =
  p

full_name: Polynomial.exists_eq_pow_rootMultiplicity_mul_and_not_dvd
code: theorem exists_eq_pow_rootMultiplicity_mul_and_not_dvd (p : R[X]) (hp : p ≠ 0) (a : R) :
    ∃ q : R[X], p = (X - C a) ^ p.rootMultiplicity a * q ∧ ¬ (X - C a) ∣ q 
goal: ∃ q, p = (Polynomial.X - Polynomial.C a) ^ Polynomial.rootMultiplicity a p * q ∧ ¬Polynomial.X - Polynomial.C a ∣ q

full_name: Polynomial.modByMonic_X_sub_C_eq_C_eval
code: @[simp]
theorem modByMonic_X_sub_C_eq_C_eval (p : R[X]) (a : R) : p %ₘ (X - C a) = C (p.eval a) 
goal: p %ₘ (Polynomial.X - Polynomial.C a) = Polynomial.C (Polynomial.eval a p)

full_name: Polynomial.mul_divByMonic_eq_iff_isRoot
code: theorem mul_divByMonic_eq_iff_isRoot : (X - C a) * (p /ₘ (X - C a)) = p ↔ IsRoot p a 
goal: (Polynomial.X - Polynomial.C a) * (p /ₘ (Polynomial.X - Polynomial.C a)) = p ↔ p.IsRoot a

full_name: Polynomial.dvd_iff_isRoot
code: theorem dvd_iff_isRoot : X - C a ∣ p ↔ IsRoot p a 
goal: Polynomial.X - Polynomial.C a ∣ p ↔ p.IsRoot a

full_name: Polynomial.X_sub_C_dvd_sub_C_eval
code: theorem X_sub_C_dvd_sub_C_eval : X - C a ∣ p - C (p.eval a) 
goal: Polynomial.X - Polynomial.C a ∣ p - Polynomial.C (Polynomial.eval a p)

full_name: Polynomial.mem_span_C_X_sub_C_X_sub_C_iff_eval_eval_eq_zero
code: theorem mem_span_C_X_sub_C_X_sub_C_iff_eval_eval_eq_zero {b : R[X]} {P : R[X][X]} :
    P ∈ Ideal.span {C (X - C a), X - C b} ↔ (P.eval b).eval a = 0 
goal: P ∈ Ideal.span {Polynomial.C (Polynomial.X - Polynomial.C a), Polynomial.X - Polynomial.C b} ↔
  Polynomial.eval a (Polynomial.eval b P) = 0

full_name: Polynomial.modByMonic_X
code: theorem modByMonic_X (p : R[X]) : p %ₘ X = C (p.eval 0) 
goal: p %ₘ Polynomial.X = Polynomial.C (Polynomial.eval 0 p)

full_name: Polynomial.eval₂_modByMonic_eq_self_of_root
code: theorem eval₂_modByMonic_eq_self_of_root [CommRing S] {f : R →+* S} {p q : R[X]} (hq : q.Monic)
    {x : S} (hx : q.eval₂ f x = 0) : (p %ₘ q).eval₂ f x = p.eval₂ f x 
goal: Polynomial.eval₂ f x (p %ₘ q) = Polynomial.eval₂ f x p

full_name: Polynomial.sub_dvd_eval_sub
code: theorem sub_dvd_eval_sub (a b : R) (p : R[X]) : a - b ∣ p.eval a - p.eval b 
goal: a - b ∣ Polynomial.eval a p - Polynomial.eval b p

full_name: Polynomial.ker_evalRingHom
code: theorem ker_evalRingHom (x : R) : RingHom.ker (evalRingHom x) = Ideal.span {X - C x} 
goal: RingHom.ker (Polynomial.evalRingHom x) = Ideal.span {Polynomial.X - Polynomial.C x}

full_name: Polynomial.rootMultiplicity_eq_zero_iff
code: @[simp]
theorem rootMultiplicity_eq_zero_iff {p : R[X]} {x : R} :
    rootMultiplicity x p = 0 ↔ IsRoot p x → p = 0 
goal: Polynomial.rootMultiplicity x p = 0 ↔ p.IsRoot x → p = 0

full_name: Polynomial.rootMultiplicity_eq_zero
code: theorem rootMultiplicity_eq_zero {p : R[X]} {x : R} (h : ¬IsRoot p x) : rootMultiplicity x p = 0 
goal: Polynomial.rootMultiplicity x p = 0

full_name: Polynomial.rootMultiplicity_pos'
code: @[simp]
theorem rootMultiplicity_pos' {p : R[X]} {x : R} :
    0 < rootMultiplicity x p ↔ p ≠ 0 ∧ IsRoot p x 
goal: 0 < Polynomial.rootMultiplicity x p ↔ p ≠ 0 ∧ p.IsRoot x

full_name: Polynomial.rootMultiplicity_pos
code: theorem rootMultiplicity_pos {p : R[X]} (hp : p ≠ 0) {x : R} :
    0 < rootMultiplicity x p ↔ IsRoot p x 
goal: 0 < Polynomial.rootMultiplicity x p ↔ p.IsRoot x

full_name: Polynomial.eval_divByMonic_pow_rootMultiplicity_ne_zero
code: theorem eval_divByMonic_pow_rootMultiplicity_ne_zero {p : R[X]} (a : R) (hp : p ≠ 0) :
    eval a (p /ₘ (X - C a) ^ rootMultiplicity a p) ≠ 0 
goal: Polynomial.eval a (p /ₘ (Polynomial.X - Polynomial.C a) ^ Polynomial.rootMultiplicity a p) ≠ 0

full_name: Polynomial.mul_self_modByMonic
code: /-- See `Polynomial.mul_right_modByMonic` for the other multiplication order. This version, unlike
that one, requires commutativity. -/
@[simp]
lemma mul_self_modByMonic (hq : q.Monic) : (p * q) %ₘ q = 0 
goal: p * q %ₘ q = 0