@@ -100,8 +100,10 @@ theorem ker_eval {s : S} (hs : IsIntegral R s) :
100100/-- If an element `x` is a root of a nonzero polynomial `p`, then the degree of `p` is at least the
101101degree of the minimal polynomial of `x`. See also `minpoly.degree_le_of_ne_zero` which relaxes the
102102assumptions on `S` in exchange for stronger assumptions on `R`. -/
103- theorem IsIntegrallyClosed.degree_le_of_ne_zero {s : S} (hs : IsIntegral R s) {p : R[X]}
103+ theorem IsIntegrallyClosed.degree_le_of_ne_zero {s : S} {p : R[X]}
104104 (hp0 : p ≠ 0 ) (hp : Polynomial.aeval s p = 0 ) : degree (minpoly R s) ≤ degree p := by
105+ by_cases! hs : ¬IsIntegral R s
106+ · simp [minpoly, hs]
105107 rw [degree_eq_natDegree (minpoly.ne_zero hs), degree_eq_natDegree hp0]
106108 norm_cast
107109 exact natDegree_le_of_dvd ((isIntegrallyClosed_dvd_iff hs _).mp hp) hp0
@@ -117,11 +119,38 @@ theorem _root_.IsIntegrallyClosed.minpoly.unique {s : S} {P : R[X]} (hmo : P.Mon
117119 have hs : IsIntegral R s := ⟨P, hmo, hP⟩
118120 symm; apply eq_of_sub_eq_zero
119121 by_contra hnz
120- refine IsIntegrallyClosed.degree_le_of_ne_zero hs hnz (by simp [hP]) |>.not_gt ?_
122+ refine IsIntegrallyClosed.degree_le_of_ne_zero (s := s) hnz (by simp [hP]) |>.not_gt ?_
121123 refine degree_sub_lt ?_ (ne_zero hs) ?_
122124 · exact le_antisymm (min R s hmo hP) (Pmin (minpoly R s) (monic hs) (aeval R s))
123125 · rw [(monic hs).leadingCoeff, hmo.leadingCoeff]
124126
127+ theorem IsIntegrallyClosed.unique_of_degree_le_degree_minpoly {s : S} {p : R[X]} (hmo : p.Monic)
128+ (hp : p.aeval s = 0 ) (pmin : p.degree ≤ (minpoly R s).degree) : p = minpoly R s :=
129+ IsIntegrallyClosed.minpoly.unique hmo hp fun _ qm hq ↦ pmin.trans <| min _ _ qm hq
130+
131+ theorem IsIntegrallyClosed.isIntegral_iff_leadingCoeff_dvd {s : S} {p : R[X]} (hp : p.aeval s = 0 )
132+ (h₀ : p ≠ 0 ) (pmin : ∀ q : R[X], q.Monic → q.aeval s = 0 → p.degree ≤ q.degree) :
133+ IsIntegral R s ↔ C p.leadingCoeff ∣ p := by
134+ refine ⟨fun hInt ↦ ?_, fun ⟨q, hMul⟩ ↦ minpoly.ne_zero_iff.mp ?_⟩
135+ · use minpoly R s
136+ have ⟨q, hMul⟩ := isIntegrallyClosed_dvd hInt hp
137+ suffices q.degree ≤ 0 by simp [degree_le_zero_iff.mp this ▸ hMul, minpoly.monic hInt, mul_comm]
138+ apply WithBot.le_of_add_le_add_left <| Polynomial.degree_ne_bot.mpr <| minpoly.ne_zero hInt
139+ convert pmin _ (minpoly.monic hInt) (minpoly.aeval ..)
140+ · rw [hMul, degree_mul]
141+ · rw [add_zero]
142+ · convert right_ne_zero_of_mul <| hMul ▸ h₀
143+ refine IsIntegrallyClosed.minpoly.unique ?_ ?_ ?_ |>.symm
144+ · have := hMul ▸ leadingCoeff_mul .. |>.symm
145+ simp only [leadingCoeff_C, ne_eq, leadingCoeff_eq_zero, h₀, not_false_eq_true, mul_eq_left₀]
146+ at this
147+ exact this
148+ · have := congrArg (Polynomial.aeval s) hMul
149+ simp only [hp, h₀, map_mul, aeval_C, zero_eq_mul, FaithfulSMul.algebraMap_eq_zero_iff,
150+ leadingCoeff_eq_zero, false_or] at this
151+ exact this
152+ · exact (hMul ▸ degree_C_mul <| by simp [h₀]) ▸ pmin
153+
125154theorem prime_of_isIntegrallyClosed {x : S} (hx : IsIntegral R x) : Prime (minpoly R x) := by
126155 refine
127156 ⟨(minpoly.monic hx).ne_zero,
0 commit comments