Skip to content

Commit f23db5a

Browse files
committed
feat: add some simple results regarding polynomials (#10572)
- `Polynomial.map_contract`: `Polynomial.map` and `Polynomial.contract` commutes - `Irreducible.natDegree_pos`: an irreducible polynomial over a field must have positive degree (not true if it's not a field) - `Polynomial.Monic.nextCoeff_pow`: corollary of `Polynomial.Monic.nextCoeff_mul` - `Polynomial.exists_monic_irreducible_factor`: a polynomial over a field which is not a unit must have a monic irreducible factor (not true if it's not a field)
1 parent 51f0486 commit f23db5a

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

Mathlib/Data/Polynomial/Expand.lean

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,10 @@ theorem coeff_contract {p : ℕ} (hp : p ≠ 0) (f : R[X]) (n : ℕ) :
221221
_ ≤ n * p := mul_le_mul_of_nonneg_left (show 1 ≤ p from hp.bot_lt) (zero_le n)
222222
#align polynomial.coeff_contract Polynomial.coeff_contract
223223

224+
theorem map_contract {p : ℕ} (hp : p ≠ 0) {f : R →+* S} {q : R[X]} :
225+
(q.contract p).map f = (q.map f).contract p := ext fun n ↦ by
226+
simp only [coeff_map, coeff_contract hp]
227+
224228
theorem contract_expand {f : R[X]} (hp : p ≠ 0) : contract p (expand R p f) = f := by
225229
ext
226230
simp [coeff_contract hp, coeff_expand hp.bot_lt, Nat.mul_div_cancel _ hp.bot_lt]

Mathlib/Data/Polynomial/FieldDivision.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,3 +676,11 @@ theorem irreducible_iff_lt_natDegree_lt {p : R[X]} (hp0 : p ≠ 0) (hpu : ¬ IsU
676676
end Field
677677

678678
end Polynomial
679+
680+
/-- An irreducible polynomial over a field must have positive degree. -/
681+
theorem Irreducible.natDegree_pos {F : Type*} [Field F] {f : F[X]} (h : Irreducible f) :
682+
0 < f.natDegree := Nat.pos_of_ne_zero fun H ↦ by
683+
obtain ⟨x, hf⟩ := natDegree_eq_zero.1 H
684+
by_cases hx : x = 0
685+
· rw [← hf, hx, map_zero] at h; exact not_irreducible_zero h
686+
exact h.1 (hf ▸ isUnit_C.2 (Ne.isUnit hx))

Mathlib/Data/Polynomial/Monic.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,11 @@ theorem nextCoeff_mul (hp : Monic p) (hq : Monic q) :
215215
show Nat.succ 0 = 1 from rfl]
216216
#align polynomial.monic.next_coeff_mul Polynomial.Monic.nextCoeff_mul
217217

218+
theorem nextCoeff_pow (hp : p.Monic) (n : ℕ) : (p ^ n).nextCoeff = n • p.nextCoeff := by
219+
induction n with
220+
| zero => rw [pow_zero, Nat.zero_eq, zero_smul, ← map_one (f := C), nextCoeff_C_eq_zero]
221+
| succ n ih => rw [pow_succ, hp.nextCoeff_mul (hp.pow n), ih, succ_nsmul]
222+
218223
theorem eq_one_of_map_eq_one {S : Type*} [Semiring S] [Nontrivial S] (f : R →+* S) (hp : p.Monic)
219224
(map_eq : p.map f = 1) : p = 1 := by
220225
nontriviality R

Mathlib/RingTheory/Polynomial/Basic.lean

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,3 +1339,14 @@ instance (priority := 100) uniqueFactorizationMonoid :
13391339
end MvPolynomial
13401340

13411341
end UniqueFactorizationDomain
1342+
1343+
/-- A polynomial over a field which is not a unit must have a monic irreducible factor.
1344+
See also `WfDvdMonoid.exists_irreducible_factor`. -/
1345+
theorem Polynomial.exists_monic_irreducible_factor {F : Type*} [Field F] (f : F[X])
1346+
(hu : ¬IsUnit f) : ∃ g : F[X], g.Monic ∧ Irreducible g ∧ g ∣ f := by
1347+
by_cases hf : f = 0
1348+
· exact ⟨X, monic_X, irreducible_X, hf ▸ dvd_zero X⟩
1349+
obtain ⟨g, hi, hf⟩ := WfDvdMonoid.exists_irreducible_factor hu hf
1350+
have ha : Associated g (g * C g.leadingCoeff⁻¹) := associated_mul_unit_right _ _ <|
1351+
isUnit_C.2 (leadingCoeff_ne_zero.2 hi.ne_zero).isUnit.inv
1352+
exact ⟨_, monic_mul_leadingCoeff_inv hi.ne_zero, ha.irreducible hi, ha.dvd_iff_dvd_left.1 hf⟩

0 commit comments

Comments
 (0)