The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V09. Commutative algebra I: ideals, polynomials, factorization

Mathlib.Algebra.Polynomial.Degree.Lemmas

66 declarations. Mathlib docs · Source

Theory of degrees of polynomials

Some of the main results include

  • natDegree_comp_le : The degree of the composition is at most the product of degrees

Useful lemmas for the "monicization" of a nonzero polynomial p.

theorem Polynomial.natDegree_comp_le E1 #

∀ {R : Type u} [inst : Semiring R] {p q : Polynomial R}, (p.comp q).natDegree ≤ p.natDegree * q.natDegree

theorem Polynomial.natDegree_comp_eq_of_mul_ne_zero E1 #

∀ {R : Type u} [inst : Semiring R] {p q : Polynomial R},
  p.leadingCoeff * q.leadingCoeff ^ p.natDegree ≠ 0 → (p.comp q).natDegree = p.natDegree * q.natDegree

theorem Polynomial.degree_pos_of_root E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R}, p ≠ 0 → p.IsRoot a → 0 < p.degree

theorem Polynomial.natDegree_le_iff_coeff_eq_zero E1 #

∀ {R : Type u} {n : ℕ} [inst : Semiring R] {p : Polynomial R}, p.natDegree ≤ n ↔ ∀ (N : ℕ), n < N → p.coeff N = 0

theorem Polynomial.natDegree_add_le_iff_left E1 #

∀ {R : Type u} [inst : Semiring R] {n : ℕ} (p q : Polynomial R),
  q.natDegree ≤ n → ((p + q).natDegree ≤ n ↔ p.natDegree ≤ n)

theorem Polynomial.natDegree_add_le_iff_right E1 #

∀ {R : Type u} [inst : Semiring R] {n : ℕ} (p q : Polynomial R),
  p.natDegree ≤ n → ((p + q).natDegree ≤ n ↔ q.natDegree ≤ n)

theorem Polynomial.natDegree_C_mul_le E1 #

∀ {R : Type u} [inst : Semiring R] (a : R) (f : Polynomial R), (Polynomial.C a * f).natDegree ≤ f.natDegree

theorem Polynomial.natDegree_mul_C_le E1 #

∀ {R : Type u} [inst : Semiring R] (f : Polynomial R) (a : R), (f * Polynomial.C a).natDegree ≤ f.natDegree

theorem Polynomial.natDegree_C_mul_eq_of_mul_eq_one E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R} {ai : R},
  ai * a = 1 → (Polynomial.C a * p).natDegree = p.natDegree

theorem Polynomial.natDegree_mul_C_eq_of_mul_eq_one E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R} {ai : R},
  a * ai = 1 → (p * Polynomial.C a).natDegree = p.natDegree

theorem Polynomial.natDegree_mul_C_eq_of_mul_ne_zero E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R},
  p.leadingCoeff * a ≠ 0 → (p * Polynomial.C a).natDegree = p.natDegree

Although not explicitly stated, the assumptions of lemma natDegree_mul_C_eq_of_mul_ne_zero force the polynomial p to be non-zero, via p.leadingCoeff ≠ 0.

theorem Polynomial.natDegree_C_mul_of_mul_ne_zero E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R},
  a * p.leadingCoeff ≠ 0 → (Polynomial.C a * p).natDegree = p.natDegree

Although not explicitly stated, the assumptions of lemma natDegree_C_mul_of_mul_ne_zero force the polynomial p to be non-zero, via p.leadingCoeff ≠ 0.

theorem Polynomial.degree_C_mul_of_mul_ne_zero E1 #

∀ {R : Type u} {a : R} [inst : Semiring R] {p : Polynomial R},
  a * p.leadingCoeff ≠ 0 → (Polynomial.C a * p).degree = p.degree

theorem Polynomial.natDegree_add_coeff_mul E1 #

∀ {R : Type u} [inst : Semiring R] (f g : Polynomial R),
  (f * g).coeff (f.natDegree + g.natDegree) = f.coeff f.natDegree * g.coeff g.natDegree

theorem Polynomial.natDegree_lt_coeff_mul E1 #

∀ {R : Type u} {m n : ℕ} [inst : Semiring R] {p q : Polynomial R},
  p.natDegree + q.natDegree < m + n → (p * q).coeff (m + n) = 0

theorem Polynomial.coeff_pow_of_natDegree_le E1 #

∀ {R : Type u} {m n : ℕ} [inst : Semiring R] {p : Polynomial R}, p.natDegree ≤ n → (p ^ m).coeff (m * n) = p.coeff n ^ m

theorem Polynomial.coeff_pow_eq_ite_of_natDegree_le_of_le E1 #

∀ {R : Type u} {m n : ℕ} [inst : Semiring R] {p : Polynomial R} {o : ℕ},
  p.natDegree ≤ n → m * n ≤ o → (p ^ m).coeff o = if o = m * n then p.coeff n ^ m else 0

theorem Polynomial.coeff_add_eq_left_of_lt E1 #

∀ {R : Type u} {n : ℕ} [inst : Semiring R] {p q : Polynomial R}, q.natDegree < n → (p + q).coeff n = p.coeff n

theorem Polynomial.coeff_add_eq_right_of_lt E1 #

∀ {R : Type u} {n : ℕ} [inst : Semiring R] {p q : Polynomial R}, p.natDegree < n → (p + q).coeff n = q.coeff n

theorem Polynomial.degree_sum_eq_of_disjoint E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] (f : S → Polynomial R) (s : Finset S),
  {i | i ∈ s ∧ f i ≠ 0}.Pairwise (Function.onFun Ne (Polynomial.degree ∘ f)) →
    (s.sum f).degree = s.sup fun i ↦ (f i).degree

theorem Polynomial.natDegree_sum_eq_of_disjoint E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] (f : S → Polynomial R) (s : Finset S),
  {i | i ∈ s ∧ f i ≠ 0}.Pairwise (Function.onFun Ne (Polynomial.natDegree ∘ f)) →
    (s.sum f).natDegree = s.sup fun i ↦ (f i).natDegree

theorem Polynomial.natDegree_pos_of_eval₂_root E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {p : Polynomial R},
  p ≠ 0 → ∀ (f : R →+* S) {z : S}, Polynomial.eval₂ f z p = 0 → (∀ (x : R), f x = 0 → x = 0) → 0 < p.natDegree

theorem Polynomial.degree_pos_of_eval₂_root E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {p : Polynomial R},
  p ≠ 0 → ∀ (f : R →+* S) {z : S}, Polynomial.eval₂ f z p = 0 → (∀ (x : R), f x = 0 → x = 0) → 0 < p.degree

theorem Polynomial.coe_lt_degree E0 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {n : ℕ}, ↑n < p.degree ↔ n < p.natDegree

theorem Polynomial.degree_map_eq_iff E0 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S} {p : Polynomial R},
  (Polynomial.map f p).degree = p.degree ↔ f p.leadingCoeff ≠ 0 ∨ p = 0

theorem Polynomial.natDegree_map_eq_iff E0 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S} {p : Polynomial R},
  (Polynomial.map f p).natDegree = p.natDegree ↔ f p.leadingCoeff ≠ 0 ∨ p.natDegree = 0

theorem Polynomial.degree_map_eq_of_isUnit_leadingCoeff E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] {p : Polynomial R} [inst_1 : Semiring S] [Nontrivial S] (f : R →+* S),
  IsUnit p.leadingCoeff → (Polynomial.map f p).degree = p.degree

theorem Polynomial.natDegree_map_eq_of_isUnit_leadingCoeff E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] {p : Polynomial R} [inst_1 : Semiring S] [Nontrivial S] (f : R →+* S),
  IsUnit p.leadingCoeff → (Polynomial.map f p).natDegree = p.natDegree

theorem Polynomial.leadingCoeff_map_eq_of_isUnit_leadingCoeff E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] {p : Polynomial R} [inst_1 : Semiring S] [Nontrivial S] (f : R →+* S),
  IsUnit p.leadingCoeff → (Polynomial.map f p).leadingCoeff = f p.leadingCoeff

theorem Polynomial.nextCoeff_map_eq_of_isUnit_leadingCoeff E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] {p : Polynomial R} [inst_1 : Semiring S] [Nontrivial S] (f : R →+* S),
  IsUnit p.leadingCoeff → (Polynomial.map f p).nextCoeff = f p.nextCoeff

theorem Polynomial.degree_map_eq_of_injective E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S},
  Function.Injective ⇑f → ∀ (p : Polynomial R), (Polynomial.map f p).degree = p.degree

theorem Polynomial.natDegree_map_eq_of_injective E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S},
  Function.Injective ⇑f → ∀ (p : Polynomial R), (Polynomial.map f p).natDegree = p.natDegree

theorem Polynomial.leadingCoeff_map_of_injective E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S},
  Function.Injective ⇑f → ∀ (p : Polynomial R), (Polynomial.map f p).leadingCoeff = f p.leadingCoeff

theorem Polynomial.nextCoeff_map E1 #

∀ {R : Type u} {S : Type v} [inst : Semiring R] [inst_1 : Semiring S] {f : R →+* S},
  Function.Injective ⇑f → ∀ (p : Polynomial R), (Polynomial.map f p).nextCoeff = f p.nextCoeff

theorem Polynomial.natDegree_pos_of_nextCoeff_ne_zero E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R}, p.nextCoeff ≠ 0 → 0 < p.natDegree

theorem Polynomial.natDegree_sub E1 #

∀ {R : Type u} [inst : Ring R] {p q : Polynomial R}, (p - q).natDegree = (q - p).natDegree

theorem Polynomial.natDegree_sub_le_iff_left E1 #

∀ {R : Type u} {n : ℕ} [inst : Ring R] {p q : Polynomial R}, q.natDegree ≤ n → ((p - q).natDegree ≤ n ↔ p.natDegree ≤ n)

theorem Polynomial.natDegree_sub_le_iff_right E1 #

∀ {R : Type u} {n : ℕ} [inst : Ring R] {p q : Polynomial R}, p.natDegree ≤ n → ((p - q).natDegree ≤ n ↔ q.natDegree ≤ n)

theorem Polynomial.coeff_sub_eq_left_of_lt E1 #

∀ {R : Type u} {n : ℕ} [inst : Ring R] {p q : Polynomial R}, q.natDegree < n → (p - q).coeff n = p.coeff n

theorem Polynomial.coeff_sub_eq_neg_right_of_lt E1 #

∀ {R : Type u} {n : ℕ} [inst : Ring R] {p q : Polynomial R}, p.natDegree < n → (p - q).coeff n = -q.coeff n

theorem Polynomial.nextCoeff_C_mul_X_add_C E0 #

∀ {R : Type u} [inst : Semiring R] {a : R},
  a ≠ 0 → ∀ (c : R), (Polynomial.C a * Polynomial.X + Polynomial.C c).nextCoeff = c

theorem Polynomial.natDegree_eq_one E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R},
  p.natDegree = 1 ↔ ∃ a, a ≠ 0 ∧ ∃ b, Polynomial.C a * Polynomial.X + Polynomial.C b = p

theorem Polynomial.subsingleton_isRoot_of_natDegree_eq_one E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} [IsLeftCancelMulZero R],
  p.natDegree = 1 → {x | p.IsRoot x}.Subsingleton

theorem Polynomial.degree_mul_C E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  a ≠ 0 → (p * Polynomial.C a).degree = p.degree

theorem Polynomial.degree_C_mul E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  a ≠ 0 → (Polynomial.C a * p).degree = p.degree

theorem Polynomial.natDegree_mul_C E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  a ≠ 0 → (p * Polynomial.C a).natDegree = p.natDegree

theorem Polynomial.natDegree_C_mul E1 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  a ≠ 0 → (Polynomial.C a * p).natDegree = p.natDegree

theorem Polynomial.natDegree_comp E1 #

∀ {R : Type u} [inst : Semiring R] {p q : Polynomial R} [NoZeroDivisors R],
  (p.comp q).natDegree = p.natDegree * q.natDegree

theorem Polynomial.natDegree_iterate_comp E0 #

∀ {R : Type u} [inst : Semiring R] {p q : Polynomial R} [NoZeroDivisors R] (k : ℕ),
  (p.comp^[k] q).natDegree = p.natDegree ^ k * q.natDegree

theorem Polynomial.leadingCoeff_comp E1 #

∀ {R : Type u} [inst : Semiring R] {p q : Polynomial R} [NoZeroDivisors R],
  q.natDegree ≠ 0 → (p.comp q).leadingCoeff = p.leadingCoeff * q.leadingCoeff ^ p.natDegree

theorem Polynomial.nextCoeff_C_mul E0 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  (Polynomial.C a * p).nextCoeff = a * p.nextCoeff

theorem Polynomial.nextCoeff_mul_C E0 #

∀ {R : Type u} [inst : Semiring R] {p : Polynomial R} {a : R} [NoZeroDivisors R],
  (p * Polynomial.C a).nextCoeff = p.nextCoeff * a

theorem Polynomial.comp_neg_X_leadingCoeff_eq E0 #

∀ {R : Type u} [inst : Ring R] (p : Polynomial R),
  (p.comp (-Polynomial.X)).leadingCoeff = (-1) ^ p.natDegree * p.leadingCoeff

theorem Polynomial.comp_neg_X_eq_zero_iff E0 #

∀ {R : Type u} [inst : Ring R] {p : Polynomial R}, p.comp (-Polynomial.X) = 0 ↔ p = 0

theorem Polynomial.comp_eq_zero_iff E0 #

∀ {R : Type u} [inst : Semiring R] [NoZeroDivisors R] {p q : Polynomial R},
  p.comp q = 0 ↔ p = 0 ∨ Polynomial.eval (q.coeff 0) p = 0 ∧ q = Polynomial.C (q.coeff 0)

theorem Polynomial.degree_comp E1 #

∀ {R : Type u} [inst : Semiring R] [NoZeroDivisors R] {p q : Polynomial R},
  0 < q.degree → (p.comp q).degree = p.degree * q.degree

theorem Polynomial.degree_comp_neg_X E0 #

∀ {R : Type u} [inst : Ring R] {p : Polynomial R}, (p.comp (-Polynomial.X)).degree = p.degree

theorem Polynomial.irreducible_mul_leadingCoeff_inv E0 #

∀ {K : Type u_1} [inst : DivisionRing K] {p : Polynomial K},
  Irreducible (p * Polynomial.C p.leadingCoeff⁻¹) ↔ Irreducible p

theorem Polynomial.dvd_mul_leadingCoeff_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] {p q : Polynomial K}, p ≠ 0 → (q ∣ p * Polynomial.C p.leadingCoeff⁻¹ ↔ q ∣ p)

theorem Polynomial.monic_mul_leadingCoeff_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] {p : Polynomial K}, p ≠ 0 → (p * Polynomial.C p.leadingCoeff⁻¹).Monic

theorem Polynomial.degree_leadingCoeff_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] {p : Polynomial K}, p ≠ 0 → (Polynomial.C p.leadingCoeff⁻¹).degree = 0

theorem Polynomial.degree_mul_leadingCoeff_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] (p : Polynomial K) {q : Polynomial K},
  q ≠ 0 → (p * Polynomial.C q.leadingCoeff⁻¹).degree = p.degree

theorem Polynomial.natDegree_mul_leadingCoeff_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] (p : Polynomial K) {q : Polynomial K},
  q ≠ 0 → (p * Polynomial.C q.leadingCoeff⁻¹).natDegree = p.natDegree

theorem Polynomial.degree_mul_leadingCoeff_self_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] (p : Polynomial K), (p * Polynomial.C p.leadingCoeff⁻¹).degree = p.degree

theorem Polynomial.natDegree_mul_leadingCoeff_self_inv E1 #

∀ {K : Type u_1} [inst : DivisionRing K] (p : Polynomial K), (p * Polynomial.C p.leadingCoeff⁻¹).natDegree = p.natDegree

theorem Polynomial.degree_add_degree_leadingCoeff_inv E0 #

∀ {K : Type u_1} [inst : DivisionRing K] (p : Polynomial K),
  p.degree + (Polynomial.C p.leadingCoeff⁻¹).degree = p.degree