Skip to content

Commit e9c5d1b

Browse files
committed
chore: remove extra monic hypotheses from divByMonic and modByMonic lemmas (#31817)
1 parent 28ed5e5 commit e9c5d1b

File tree

20 files changed

+85
-88
lines changed

20 files changed

+85
-88
lines changed

Mathlib/Algebra/Polynomial/CoeffMem.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ lemma coeff_divByMonic_mem_pow_natDegree_mul (p q : S[X])
111111
variable [DecidableEq ι] {i j : ι}
112112

113113
open Function Ideal in
114-
lemma idealSpan_range_update_divByMonic (hij : i ≠ j) (v : ι → R[X]) (hi : (v i).Monic) :
114+
lemma idealSpan_range_update_divByMonic (hij : i ≠ j) (v : ι → R[X]) :
115115
span (Set.range (Function.update v j (v j %ₘ v i))) = span (Set.range v) := by
116-
rw [modByMonic_eq_sub_mul_div _ hi, mul_comm, ← smul_eq_mul, Ideal.span, Ideal.span,
116+
rw [modByMonic_eq_sub_mul_div, mul_comm, ← smul_eq_mul, Ideal.span, Ideal.span,
117117
Submodule.span_range_update_sub_smul hij]
118118

119119
end Polynomial

Mathlib/Algebra/Polynomial/Div.lean

Lines changed: 52 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -220,32 +220,33 @@ theorem X_dvd_sub_C : X ∣ p - C (p.coeff 0) := by
220220
simp [X_dvd_iff, coeff_C]
221221

222222
theorem modByMonic_eq_sub_mul_div :
223-
(p : R[X]) {q : R[X]} (_hq : Monic q), p %ₘ q = p - q * (p /ₘ q)
224-
| p, q, hq =>
223+
p q : R[X], p %ₘ q = p - q * (p /ₘ q)
224+
| p, q =>
225225
letI := Classical.decEq R
226-
if h : degree q ≤ degree p ∧ p ≠ 0 then by
227-
have _wf := div_wf_lemma h hq
228-
have ih := modByMonic_eq_sub_mul_div
229-
(p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) hq
230-
unfold modByMonic divByMonic divModByMonicAux
231-
dsimp
232-
rw [dif_pos hq, if_pos h]
233-
rw [modByMonic, dif_pos hq] at ih
234-
refine ih.trans ?_
235-
unfold divByMonic
236-
rw [dif_pos hq, dif_pos hq, if_pos h, mul_add, sub_add_eq_sub_sub]
226+
if hq : q.Monic then
227+
if h : degree q ≤ degree p ∧ p ≠ 0 then by
228+
have _wf := div_wf_lemma h hq
229+
have ih := modByMonic_eq_sub_mul_div
230+
(p - q * (C (leadingCoeff p) * X ^ (natDegree p - natDegree q))) q
231+
unfold modByMonic divByMonic divModByMonicAux
232+
rw [dif_pos hq, dif_pos h]
233+
rw [modByMonic, dif_pos hq] at ih
234+
refine ih.trans ?_
235+
rw [divByMonic, dif_pos hq, dif_pos hq, dif_pos h, mul_add, sub_add_eq_sub_sub]
236+
else by
237+
unfold modByMonic divByMonic divModByMonicAux
238+
dsimp
239+
rw [dif_pos hq, if_neg h, dif_pos hq, if_neg h, mul_zero, sub_zero]
237240
else by
238-
unfold modByMonic divByMonic divModByMonicAux
239-
dsimp
240-
rw [dif_pos hq, if_neg h, dif_pos hq, if_neg h, mul_zero, sub_zero]
241+
rw [modByMonic_eq_of_not_monic _ hq, divByMonic_eq_of_not_monic _ hq, mul_zero, sub_zero]
241242
termination_by p => p
242243

243-
theorem modByMonic_add_div (p : R[X]) {q : R[X]} (hq : Monic q) : p %ₘ q + q * (p /ₘ q) = p :=
244-
eq_sub_iff_add_eq.1 (modByMonic_eq_sub_mul_div p hq)
244+
theorem modByMonic_add_div (p q : R[X]) : p %ₘ q + q * (p /ₘ q) = p :=
245+
eq_sub_iff_add_eq.1 (modByMonic_eq_sub_mul_div p q)
245246

246247
theorem divByMonic_eq_zero_iff [Nontrivial R] (hq : Monic q) : p /ₘ q = 0 ↔ degree p < degree q :=
247248
fun h => by
248-
have := modByMonic_add_div p hq
249+
have := modByMonic_add_div p q
249250
rwa [h, mul_zero, add_zero, modByMonic_eq_self_iff hq] at this,
250251
fun h => by
251252
classical
@@ -268,7 +269,7 @@ theorem degree_add_divByMonic (hq : Monic q) (h : degree q ≤ degree p) :
268269
calc
269270
degree q + degree (p /ₘ q) = degree (q * (p /ₘ q)) := Eq.symm (degree_mul' hlc)
270271
_ = degree (p %ₘ q + q * (p /ₘ q)) := (degree_add_eq_right_of_degree_lt hmod).symm
271-
_ = _ := congr_arg _ (modByMonic_add_div _ hq)
272+
_ = _ := congr_arg _ (modByMonic_add_div _ _)
272273

273274
theorem degree_divByMonic_le (p q : R[X]) : degree (p /ₘ q) ≤ degree p :=
274275
letI := Classical.decEq R
@@ -285,20 +286,24 @@ theorem degree_divByMonic_le (p q : R[X]) : degree (p /ₘ q) ≤ degree p :=
285286
simp [dif_pos hq, h, degree_zero, bot_le]
286287
else (divByMonic_eq_of_not_monic p hq).symm ▸ bot_le
287288

288-
theorem degree_divByMonic_lt (p : R[X]) {q : R[X]} (hq : Monic q) (hp0 : p ≠ 0)
289+
theorem degree_divByMonic_lt (p q : R[X]) (hp0 : p ≠ 0)
289290
(h0q : 0 < degree q) : degree (p /ₘ q) < degree p :=
290-
if hpq : degree p < degree q then by
291-
haveI := Nontrivial.of_polynomial_ne hp0
292-
rw [(divByMonic_eq_zero_iff hq).2 hpq, degree_eq_natDegree hp0]
293-
exact WithBot.bot_lt_coe _
291+
letI := Classical.decEq R
292+
if hq : q.Monic then
293+
if hpq : degree p < degree q then by
294+
haveI := Nontrivial.of_polynomial_ne hp0
295+
rw [(divByMonic_eq_zero_iff hq).2 hpq, degree_eq_natDegree hp0]
296+
exact WithBot.bot_lt_coe _
297+
else by
298+
haveI := Nontrivial.of_polynomial_ne hp0
299+
rw [← degree_add_divByMonic hq (not_lt.1 hpq), degree_eq_natDegree hq.ne_zero,
300+
degree_eq_natDegree (mt (divByMonic_eq_zero_iff hq).1 hpq)]
301+
exact
302+
Nat.cast_lt.2
303+
(Nat.lt_add_of_pos_left (Nat.cast_lt.1 <|
304+
by simpa [degree_eq_natDegree hq.ne_zero] using h0q))
294305
else by
295-
haveI := Nontrivial.of_polynomial_ne hp0
296-
rw [← degree_add_divByMonic hq (not_lt.1 hpq), degree_eq_natDegree hq.ne_zero,
297-
degree_eq_natDegree (mt (divByMonic_eq_zero_iff hq).1 hpq)]
298-
exact
299-
Nat.cast_lt.2
300-
(Nat.lt_add_of_pos_left (Nat.cast_lt.1 <|
301-
by simpa [degree_eq_natDegree hq.ne_zero] using h0q))
306+
rwa [divByMonic_eq_of_not_monic _ hq, degree_zero, bot_lt_iff_ne_bot, degree_ne_bot]
302307

303308
theorem natDegree_divByMonic (f : R[X]) {g : R[X]} (hg : g.Monic) :
304309
natDegree (f /ₘ g) = natDegree f - natDegree g := by
@@ -325,7 +330,7 @@ theorem div_modByMonic_unique {f g} (q r : R[X]) (hg : Monic g)
325330
have h₁ : r - f %ₘ g = -g * (q - f /ₘ g) :=
326331
eq_of_sub_eq_zero
327332
(by
328-
rw [← sub_eq_zero_of_eq (h.1.trans (modByMonic_add_div f hg).symm)]
333+
rw [← sub_eq_zero_of_eq (h.1.trans (modByMonic_add_div f g).symm)]
329334
simp [mul_add, sub_eq_add_neg, add_comm, add_left_comm, add_assoc])
330335
have h₂ : degree (r - f %ₘ g) = degree (g * (q - f /ₘ g)) := by simp [h₁]
331336
have h₄ : degree (r - f %ₘ g) < degree g :=
@@ -349,7 +354,7 @@ theorem map_mod_divByMonic [Ring S] (f : R →+* S) (hq : Monic q) :
349354
haveI : Nontrivial R := f.domain_nontrivial
350355
have : map f p /ₘ map f q = map f (p /ₘ q) ∧ map f p %ₘ map f q = map f (p %ₘ q) :=
351356
div_modByMonic_unique ((p /ₘ q).map f) _ (hq.map f)
352-
⟨Eq.symm <| by rw [← Polynomial.map_mul, ← Polynomial.map_add, modByMonic_add_div _ hq],
357+
⟨Eq.symm <| by rw [← Polynomial.map_mul, ← Polynomial.map_add, modByMonic_add_div],
353358
calc
354359
_ ≤ degree (p %ₘ q) := degree_map_le
355360
_ < degree q := degree_modByMonic_lt _ hq
@@ -368,11 +373,11 @@ theorem map_modByMonic [Ring S] (f : R →+* S) (hq : Monic q) :
368373
(map_mod_divByMonic f hq).2
369374

370375
theorem modByMonic_eq_zero_iff_dvd (hq : Monic q) : p %ₘ q = 0 ↔ q ∣ p :=
371-
fun h => by rw [← modByMonic_add_div p hq, h, zero_add]; exact dvd_mul_right _ _, fun h => by
376+
fun h => by rw [← modByMonic_add_div p q, h, zero_add]; exact dvd_mul_right _ _, fun h => by
372377
nontriviality R
373378
obtain ⟨r, hr⟩ := exists_eq_mul_right_of_dvd h
374379
by_contra hpq0
375-
have hmod : p %ₘ q = q * (r - p /ₘ q) := by rw [modByMonic_eq_sub_mul_div _ hq, mul_sub, ← hr]
380+
have hmod : p %ₘ q = q * (r - p /ₘ q) := by rw [modByMonic_eq_sub_mul_div, mul_sub, ← hr]
376381
have : degree (q * (r - p /ₘ q)) < degree q := hmod ▸ degree_modByMonic_lt _ hq
377382
have hrpq0 : leadingCoeff (r - p /ₘ q) ≠ 0 := fun h =>
378383
hpq0 <|
@@ -405,7 +410,7 @@ theorem modByMonic_one (p : R[X]) : p %ₘ 1 = 0 :=
405410

406411
@[simp]
407412
theorem divByMonic_one (p : R[X]) : p /ₘ 1 = p := by
408-
conv_rhs => rw [← modByMonic_add_div p monic_one]; simp
413+
conv_rhs => rw [← modByMonic_add_div p 1]; simp
409414

410415
theorem sum_modByMonic_coeff (hq : q.Monic) {n : ℕ} (hn : q.degree ≤ n) :
411416
(∑ i : Fin n, monomial i ((p %ₘ q).coeff i)) = p %ₘ q := by
@@ -426,7 +431,7 @@ lemma coeff_divByMonic_X_sub_C_rec (p : R[X]) (a : R) (n : ℕ) :
426431
nontriviality R
427432
have := monic_X_sub_C a
428433
set q := p /ₘ (X - C a)
429-
rw [← p.modByMonic_add_div this]
434+
rw [← p.modByMonic_add_div (X - C a)]
430435
have : degree (p %ₘ (X - C a)) < ↑(n + 1) := degree_X_sub_C a ▸ p.degree_modByMonic_lt this
431436
|>.trans_le <| WithBot.coe_le_coe.mpr le_add_self
432437
simp [q, sub_mul, add_sub, coeff_eq_zero_of_degree_lt this]
@@ -536,8 +541,7 @@ theorem pow_mul_divByMonic_rootMultiplicity_eq (p : R[X]) (a : R) :
536541
(X - C a) ^ rootMultiplicity a p * (p /ₘ (X - C a) ^ rootMultiplicity a p) = p := by
537542
have : Monic ((X - C a) ^ rootMultiplicity a p) := (monic_X_sub_C _).pow _
538543
conv_rhs =>
539-
rw [← modByMonic_add_div p this,
540-
(modByMonic_eq_zero_iff_dvd this).2 (pow_rootMultiplicity_dvd _ _)]
544+
rw [← modByMonic_add_div p, (modByMonic_eq_zero_iff_dvd this).2 (pow_rootMultiplicity_dvd _ _)]
541545
simp
542546

543547
theorem exists_eq_pow_rootMultiplicity_mul_and_not_dvd (p : R[X]) (hp : p ≠ 0) (a : R) :
@@ -558,7 +562,7 @@ variable [CommRing R] {p p₁ p₂ q : R[X]}
558562
theorem modByMonic_X_sub_C_eq_C_eval (p : R[X]) (a : R) : p %ₘ (X - C a) = C (p.eval a) := by
559563
nontriviality R
560564
have h : (p %ₘ (X - C a)).eval a = p.eval a := by
561-
rw [modByMonic_eq_sub_mul_div _ (monic_X_sub_C a), eval_sub, eval_mul, eval_sub, eval_X,
565+
rw [modByMonic_eq_sub_mul_div, eval_sub, eval_mul, eval_sub, eval_X,
562566
eval_C, sub_self, zero_mul, sub_zero]
563567
have : degree (p %ₘ (X - C a)) < 1 :=
564568
degree_X_sub_C a ▸ degree_modByMonic_lt p (monic_X_sub_C a)
@@ -574,9 +578,7 @@ theorem mul_divByMonic_eq_iff_isRoot : (X - C a) * (p /ₘ (X - C a)) = p ↔ Is
574578
.trans
575579
fun h => by rw [← h, eval_mul, eval_sub, eval_X, eval_C, sub_self, zero_mul],
576580
fun h => by
577-
conv_rhs =>
578-
rw [← modByMonic_add_div p (monic_X_sub_C a)]
579-
rw [modByMonic_X_sub_C_eq_C_eval, h, C_0, zero_add]⟩
581+
conv_rhs => rw [← modByMonic_add_div p, modByMonic_X_sub_C_eq_C_eval, h, C_0, zero_add]⟩
580582
IsRoot.def.symm
581583

582584
theorem dvd_iff_isRoot : X - C a ∣ p ↔ IsRoot p a :=
@@ -592,9 +594,9 @@ theorem X_sub_C_dvd_sub_C_eval : X - C a ∣ p - C (p.eval a) := by
592594
theorem modByMonic_X (p : R[X]) : p %ₘ X = C (p.eval 0) := by
593595
rw [← modByMonic_X_sub_C_eq_C_eval, C_0, sub_zero]
594596

595-
theorem eval₂_modByMonic_eq_self_of_root [CommRing S] {f : R →+* S} {p q : R[X]} (hq : q.Monic)
597+
theorem eval₂_modByMonic_eq_self_of_root [CommRing S] {f : R →+* S} {p q : R[X]}
596598
{x : S} (hx : q.eval₂ f x = 0) : (p %ₘ q).eval₂ f x = p.eval₂ f x := by
597-
rw [modByMonic_eq_sub_mul_div p hq, eval₂_sub, eval₂_mul, hx, zero_mul, sub_zero]
599+
rw [modByMonic_eq_sub_mul_div, eval₂_sub, eval₂_mul, hx, zero_mul, sub_zero]
598600

599601
theorem sub_dvd_eval_sub (a b : R) (p : R[X]) : a - b ∣ p.eval a - p.eval b := by
600602
suffices X - C b ∣ p - C (p.eval b) by
@@ -646,7 +648,7 @@ lemma modByMonic_eq_of_dvd_sub (hq : q.Monic) (h : q ∣ p₁ - p₂) : p₁ %
646648
nontriviality R
647649
obtain ⟨f, sub_eq⟩ := h
648650
refine (div_modByMonic_unique (p₂ /ₘ q + f) _ hq ⟨?_, degree_modByMonic_lt _ hq⟩).2
649-
rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div _ hq, add_comm]
651+
rw [sub_eq_iff_eq_add.mp sub_eq, mul_add, ← add_assoc, modByMonic_add_div, add_comm]
650652

651653
lemma add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by
652654
by_cases hq : q.Monic
@@ -655,8 +657,8 @@ lemma add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p
655657
· exact
656658
(div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq
657659
by
658-
rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div _ hq, ← add_assoc,
659-
add_comm (q * _), modByMonic_add_div _ hq],
660+
rw [mul_add, add_left_comm, add_assoc, modByMonic_add_div, ← add_assoc,
661+
add_comm (q * _), modByMonic_add_div],
660662
(degree_add_le _ _).trans_lt
661663
(max_lt (degree_modByMonic_lt _ hq) (degree_modByMonic_lt _ hq))⟩).2
662664
· simp_rw [modByMonic_eq_of_not_monic _ hq]
@@ -745,7 +747,7 @@ lemma leadingCoeff_divByMonic_of_monic (hmonic : q.Monic)
745747
have h : q.leadingCoeff * (p /ₘ q).leadingCoeff ≠ 0 := by
746748
simpa [divByMonic_eq_zero_iff hmonic, hmonic.leadingCoeff,
747749
Nat.WithBot.one_le_iff_zero_lt] using hdegree
748-
nth_rw 2 [← modByMonic_add_div p hmonic]
750+
nth_rw 2 [← modByMonic_add_div p q]
749751
rw [leadingCoeff_add_of_degree_lt, leadingCoeff_monic_mul hmonic]
750752
rw [degree_mul' h, degree_add_divByMonic hmonic hdegree]
751753
exact (degree_modByMonic_lt p hmonic).trans_le hdegree

Mathlib/Algebra/Polynomial/FieldDivision.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private theorem quotient_mul_add_remainder_eq_aux (p q : R[X]) : q * div p q + m
313313
· simp only [h, zero_mul, mod, modByMonic_zero, zero_add]
314314
· conv =>
315315
rhs
316-
rw [← modByMonic_add_div p (monic_mul_leadingCoeff_inv h)]
316+
rw [← modByMonic_add_div p (q * C q.leadingCoeff⁻¹)]
317317
rw [div, mod, add_comm, mul_assoc]
318318

319319
private theorem remainder_lt_aux (p : R[X]) (hq : q ≠ 0) : degree (mod p q) < degree q := by
@@ -396,7 +396,7 @@ theorem degree_div_le (p q : R[X]) : degree (p / q) ≤ degree p := by
396396
theorem degree_div_lt (hp : p ≠ 0) (hq : 0 < degree q) : degree (p / q) < degree p := by
397397
have hq0 : q ≠ 0 := fun hq0 => by simp [hq0] at hq
398398
rw [div_def, mul_comm, degree_mul_leadingCoeff_inv _ hq0]
399-
exact degree_divByMonic_lt _ (monic_mul_leadingCoeff_inv hq0) hp
399+
exact degree_divByMonic_lt _ (q * C q.leadingCoeff⁻¹) hp
400400
(by rw [degree_mul_leadingCoeff_inv _ hq0]; exact hq)
401401

402402
theorem isUnit_map [Field k] (f : R →+* k) : IsUnit (p.map f) ↔ IsUnit p := by
@@ -625,7 +625,6 @@ theorem degree_pos_of_irreducible (hp : Irreducible p) : 0 < p.degree :=
625625
theorem X_sub_C_mul_divByMonic_eq_sub_modByMonic {K : Type*} [Ring K] (f : K[X]) (a : K) :
626626
(X - C a) * (f /ₘ (X - C a)) = f - f %ₘ (X - C a) := by
627627
rw [eq_sub_iff_add_eq, ← eq_sub_iff_add_eq', modByMonic_eq_sub_mul_div]
628-
exact monic_X_sub_C a
629628

630629
theorem divByMonic_add_X_sub_C_mul_derivative_divByMonic_eq_derivative
631630
{K : Type*} [CommRing K] (f : K[X]) (a : K) :

Mathlib/Algebra/Polynomial/PartialFractions.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,8 @@ theorem div_eq_quo_add_rem_div_add_rem_div (f : R[X]) {g₁ g₂ : R[X]} (hg₁
7474
have hg₂' : (↑g₂ : K) ≠ 0 := by
7575
norm_cast
7676
exact hg₂.ne_zero
77-
have hfc := modByMonic_add_div (f * c) hg
78-
have hfd := modByMonic_add_div (f * d) hg
77+
have hfc := modByMonic_add_div (f * c) g
78+
have hfd := modByMonic_add_div (f * d) g
7979
field_simp
8080
norm_cast
8181
linear_combination -1 * f * hcd + -1 * g₁ * hfc + -1 * g₂ * hfd

Mathlib/Algebra/Polynomial/RingDivision.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ theorem smul_modByMonic (c : R) (p : R[X]) : c • p %ₘ q = c • (p %ₘ q) :
5656
· simp only [eq_iff_true_of_subsingleton]
5757
· exact
5858
(div_modByMonic_unique (c • (p /ₘ q)) (c • (p %ₘ q)) hq
59-
by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq],
59+
by rw [mul_smul_comm, ← smul_add, modByMonic_add_div],
6060
(degree_smul_le _ _).trans_lt (degree_modByMonic_lt _ hq)⟩).2
6161
· simp_rw [modByMonic_eq_of_not_monic _ hq]
6262

@@ -75,11 +75,10 @@ section
7575

7676
variable [Ring S]
7777

78-
theorem aeval_modByMonic_eq_self_of_root [Algebra R S] {p q : R[X]} (hq : q.Monic) {x : S}
78+
theorem aeval_modByMonic_eq_self_of_root [Algebra R S] {p q : R[X]} {x : S}
7979
(hx : aeval x q = 0) : aeval x (p %ₘ q) = aeval x p := by
80-
--`eval₂_modByMonic_eq_self_of_root` doesn't work here as it needs commutativity
81-
rw [modByMonic_eq_sub_mul_div p hq, map_sub, map_mul, hx, zero_mul,
82-
sub_zero]
80+
--`eval₂_modByMonic_eq_self_of_root` doesn't work here as it needs commutativity
81+
rw [modByMonic_eq_sub_mul_div, map_sub, map_mul, hx, zero_mul, sub_zero]
8382

8483
end
8584

@@ -262,7 +261,7 @@ theorem exists_multiset_roots [DecidableEq R] :
262261
have hd0 : p /ₘ (X - C x) ≠ 0 := fun h => by
263262
rw [← mul_divByMonic_eq_iff_isRoot.2 hx, h, mul_zero] at hp; exact hp rfl
264263
have wf : degree (p /ₘ (X - C x)) < degree p :=
265-
degree_divByMonic_lt _ (monic_X_sub_C x) hp ((degree_X_sub_C x).symm ▸ by decide)
264+
degree_divByMonic_lt _ _ hp ((degree_X_sub_C x).symm ▸ by decide)
266265
let ⟨t, htd, htr⟩ := @exists_multiset_roots _ (p /ₘ (X - C x)) hd0
267266
have hdeg : degree (X - C x) ≤ degree p := by
268267
rw [degree_X_sub_C, degree_eq_natDegree hp]

Mathlib/FieldTheory/Minpoly/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ theorem unique' {p : A[X]} (hm : p.Monic) (hp : Polynomial.aeval x p = 0)
143143
have hx : IsIntegral A x := ⟨p, hm, hp⟩
144144
obtain h | h := hl _ ((minpoly A x).degree_modByMonic_lt hm)
145145
swap
146-
· exact (h <| (aeval_modByMonic_eq_self_of_root hm hp).trans <| aeval A x).elim
146+
· exact (h <| (aeval_modByMonic_eq_self_of_root hp).trans <| aeval A x).elim
147147
obtain ⟨r, hr⟩ := (modByMonic_eq_zero_iff_dvd hm).1 h
148148
rw [hr]
149149
have hlead := congr_arg leadingCoeff hr

Mathlib/FieldTheory/Minpoly/Field.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ theorem dvd {p : A[X]} (hp : Polynomial.aeval x p = 0) : minpoly A x ∣ p := by
7676
rw [← modByMonic_eq_zero_iff_dvd (monic hx)]
7777
by_contra hnz
7878
apply degree_le_of_ne_zero A x hnz
79-
((aeval_modByMonic_eq_self_of_root (monic hx) (aeval _ _)).trans hp) |>.not_gt
79+
((aeval_modByMonic_eq_self_of_root (aeval _ _)).trans hp) |>.not_gt
8080
exact degree_modByMonic_lt _ (monic hx)
8181

8282
variable {A x} in

Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,11 @@ theorem isIntegrallyClosed_dvd {s : S} (hs : IsIntegral R s) {p : R[X]}
7676
let _ : Algebra K L := FractionRing.liftAlgebra R L
7777
have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by
7878
rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div]
79-
· refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_
80-
· rw [← map_aeval_eq_aeval_map, hp, map_zero]
81-
rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
82-
apply dvd_mul_of_dvd_left
83-
rw [isIntegrallyClosed_eq_field_fractions K L hs]
84-
exact Monic.map _ (minpoly.monic hs)
79+
refine dvd_sub (minpoly.dvd K (algebraMap S L s) ?_) ?_
80+
· rw [← map_aeval_eq_aeval_map, hp, map_zero]
81+
rw [← IsScalarTower.algebraMap_eq, ← IsScalarTower.algebraMap_eq]
82+
apply dvd_mul_of_dvd_left
83+
rw [isIntegrallyClosed_eq_field_fractions K L hs]
8584
rw [isIntegrallyClosed_eq_field_fractions _ _ hs,
8685
map_dvd_map (algebraMap R K) (IsFractionRing.injective R K) (minpoly.monic hs)] at this
8786
rw [← modByMonic_eq_zero_iff_dvd (minpoly.monic hs)]

Mathlib/LinearAlgebra/Charpoly/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ theorem minpoly_dvd_charpoly {K : Type u} {M : Type v} [Field K] [AddCommGroup M
103103
/-- Any endomorphism polynomial `p` is equivalent under evaluation to `p %ₘ f.charpoly`; that is,
104104
`p` is equivalent to a polynomial with degree less than the dimension of the module. -/
105105
theorem aeval_eq_aeval_mod_charpoly (p : R[X]) : aeval f p = aeval f (p %ₘ f.charpoly) :=
106-
(aeval_modByMonic_eq_self_of_root f.charpoly_monic f.aeval_self_charpoly).symm
106+
(aeval_modByMonic_eq_self_of_root f.aeval_self_charpoly).symm
107107

108108
/-- Any endomorphism power can be computed as the sum of endomorphism powers less than the
109109
dimension of the module. -/

Mathlib/LinearAlgebra/Matrix/Charpoly/Coeff.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ namespace Matrix
247247
is equivalent to a polynomial with degree less than the dimension of the matrix. -/
248248
theorem aeval_eq_aeval_mod_charpoly (M : Matrix n n R) (p : R[X]) :
249249
aeval M p = aeval M (p %ₘ M.charpoly) :=
250-
(aeval_modByMonic_eq_self_of_root M.charpoly_monic M.aeval_self_charpoly).symm
250+
(aeval_modByMonic_eq_self_of_root M.aeval_self_charpoly).symm
251251

252252
/-- Any matrix power can be computed as the sum of matrix powers less than `Fintype.card n`.
253253
@@ -359,7 +359,7 @@ lemma isNilpotent_charpoly_sub_pow_of_isNilpotent (hM : IsNilpotent M) :
359359
nontriviality R
360360
let p : R[X] := M.charpolyRev
361361
have hp : p - 1 = X * (p /ₘ X) := by
362-
conv_lhs => rw [← modByMonic_add_div p monic_X]
362+
conv_lhs => rw [← modByMonic_add_div p X]
363363
simp [p, modByMonic_X]
364364
have : IsNilpotent (p /ₘ X) :=
365365
(Polynomial.isUnit_iff'.mp (isUnit_charpolyRev_of_isNilpotent hM)).2

0 commit comments

Comments
 (0)