Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 1536412

Browse files
committed
refactor(data/polynomial): use monic.ne_zero and nontriviality (#9530)
There is a pattern in `data/polynomial` to have both `(hq : q.monic) (hq0 : q ≠ 0)` as assumptions. I found this less convenient to work with than `[nontrivial R] (hq : q.monic)` and using `monic.ne_zero` to replace `hq0`. The `nontriviality` tactic automates all the cases where previously `nontrivial R` (or similar) was manually derived from the hypotheses.
1 parent fd18953 commit 1536412

File tree

5 files changed

+83
-100
lines changed

5 files changed

+83
-100
lines changed

src/data/polynomial/div.lean

Lines changed: 75 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ infixl ` /ₘ ` : 70 := div_by_monic
106106

107107
infixl ` %ₘ ` : 70 := mod_by_monic
108108

109-
lemma degree_mod_by_monic_lt : ∀ (p : polynomial R) {q : polynomial R} (hq : monic q)
110-
(hq0 : q ≠ 0), degree (p %ₘ q) < degree q
111-
| p := λ q hq hq0,
109+
lemma degree_mod_by_monic_lt [nontrivial R] : ∀ (p : polynomial R) {q : polynomial R}
110+
(hq : monic q), degree (p %ₘ q) < degree q
111+
| p := λ q hq,
112112
if h : degree q ≤ degree p ∧ p ≠ 0 then
113113
have wf : _ := div_wf_lemma ⟨h.1, h.2⟩ hq,
114114
have degree ((p - C (leading_coeff p) * X ^ (nat_degree p - nat_degree q) * q) %ₘ q) < degree q :=
115115
degree_mod_by_monic_lt (p - C (leading_coeff p) * X ^ (nat_degree p - nat_degree q) * q)
116-
hq hq0,
116+
hq,
117117
begin
118118
unfold mod_by_monic at this ⊢,
119119
unfold div_mod_by_monic_aux,
@@ -132,7 +132,7 @@ else
132132
unfold mod_by_monic div_mod_by_monic_aux,
133133
rw [dif_pos hq, if_neg h, not_not.1 hp],
134134
exact lt_of_le_of_ne bot_le
135-
(ne.symm (mt degree_eq_bot.1 hq0)),
135+
(ne.symm (mt degree_eq_bot.1 hq.ne_zero)),
136136
end
137137
using_well_founded {dec_tac := tactic.assumption}
138138

@@ -164,23 +164,17 @@ lemma div_by_monic_eq_of_not_monic (p : polynomial R) (hq : ¬monic q) : p /ₘ
164164

165165
lemma mod_by_monic_eq_of_not_monic (p : polynomial R) (hq : ¬monic q) : p %ₘ q = p := dif_neg hq
166166

167-
lemma mod_by_monic_eq_self_iff (hq : monic q) (hq0 : q ≠ 0) : p %ₘ q = p ↔ degree p < degree q :=
168-
⟨λ h, h ▸ degree_mod_by_monic_lt _ hq hq0,
167+
lemma mod_by_monic_eq_self_iff [nontrivial R] (hq : monic q) : p %ₘ q = p ↔ degree p < degree q :=
168+
⟨λ h, h ▸ degree_mod_by_monic_lt _ hq,
169169
λ h, have ¬ degree q ≤ degree p := not_le_of_gt h,
170170
by unfold mod_by_monic div_mod_by_monic_aux; rw [dif_pos hq, if_neg (mt and.left this)]⟩
171171

172172
theorem degree_mod_by_monic_le (p : polynomial R) {q : polynomial R}
173173
(hq : monic q) : degree (p %ₘ q) ≤ degree q :=
174-
decidable.by_cases
175-
(assume H : q = 0, by rw [monic, H, leading_coeff_zero] at hq;
176-
have : (0:polynomial R) = 1 := (by rw [← C_0, ← C_1, hq]);
177-
exact le_of_eq (congr_arg _ $ eq_of_zero_eq_one this (p %ₘ q) q))
178-
(assume H : q ≠ 0, le_of_lt $ degree_mod_by_monic_lt _ hq H)
174+
by { nontriviality R, exact (degree_mod_by_monic_lt _ hq).le }
179175

180176
end ring
181177

182-
183-
184178
section comm_ring
185179
variables [comm_ring R] {p q : polynomial R}
186180

@@ -209,38 +203,36 @@ using_well_founded {dec_tac := tactic.assumption}
209203
lemma mod_by_monic_add_div (p : polynomial R) {q : polynomial R} (hq : monic q) :
210204
p %ₘ q + q * (p /ₘ q) = p := eq_sub_iff_add_eq.1 (mod_by_monic_eq_sub_mul_div p hq)
211205

212-
lemma div_by_monic_eq_zero_iff (hq : monic q) (hq0 : q ≠ 0) : p /ₘ q = 0 ↔ degree p < degree q :=
206+
lemma div_by_monic_eq_zero_iff [nontrivial R] (hq : monic q) : p /ₘ q = 0 ↔ degree p < degree q :=
213207
⟨λ h, by have := mod_by_monic_add_div p hq;
214-
rwa [h, mul_zero, add_zero, mod_by_monic_eq_self_iff hq hq0] at this,
208+
rwa [h, mul_zero, add_zero, mod_by_monic_eq_self_iff hq] at this,
215209
λ h, have ¬ degree q ≤ degree p := not_le_of_gt h,
216210
by unfold div_by_monic div_mod_by_monic_aux; rw [dif_pos hq, if_neg (mt and.left this)]⟩
217211

218212
lemma degree_add_div_by_monic (hq : monic q) (h : degree q ≤ degree p) :
219213
degree q + degree (p /ₘ q) = degree p :=
220-
if hq0 : q = 0 then
221-
have ∀ (p : polynomial R), p = 0,
222-
from λ p, (@subsingleton_of_monic_zero R _ (hq0 ▸ hq)).1 _ _,
223-
by rw [this (p /ₘ q), this p, this q]; refl
224-
else
225-
have hdiv0 : p /ₘ q ≠ 0 := by rwa [(≠), div_by_monic_eq_zero_iff hq hq0, not_lt],
226-
have hlc : leading_coeff q * leading_coeff (p /ₘ q) ≠ 0 :=
227-
by rwa [monic.def.1 hq, one_mul, (≠), leading_coeff_eq_zero],
228-
have hmod : degree (p %ₘ q) < degree (q * (p /ₘ q)) :=
229-
calc degree (p %ₘ q) < degree q : degree_mod_by_monic_lt _ hq hq0
230-
... ≤ _ : by rw [degree_mul' hlc, degree_eq_nat_degree hq0,
231-
degree_eq_nat_degree hdiv0, ← with_bot.coe_add, with_bot.coe_le_coe];
232-
exact nat.le_add_right _ _,
233-
calc degree q + degree (p /ₘ q) = degree (q * (p /ₘ q)) : eq.symm (degree_mul' hlc)
234-
... = degree (p %ₘ q + q * (p /ₘ q)) : (degree_add_eq_right_of_degree_lt hmod).symm
235-
... = _ : congr_arg _ (mod_by_monic_add_div _ hq)
214+
begin
215+
nontriviality R,
216+
have hdiv0 : p /ₘ q ≠ 0 := by rwa [(≠), div_by_monic_eq_zero_iff hq, not_lt],
217+
have hlc : leading_coeff q * leading_coeff (p /ₘ q) ≠ 0 :=
218+
by rwa [monic.def.1 hq, one_mul, (≠), leading_coeff_eq_zero],
219+
have hmod : degree (p %ₘ q) < degree (q * (p /ₘ q)) :=
220+
calc degree (p %ₘ q) < degree q : degree_mod_by_monic_lt _ hq
221+
... ≤ _ : by rw [degree_mul' hlc, degree_eq_nat_degree hq.ne_zero,
222+
degree_eq_nat_degree hdiv0, ← with_bot.coe_add, with_bot.coe_le_coe];
223+
exact nat.le_add_right _ _,
224+
calc degree q + degree (p /ₘ q) = degree (q * (p /ₘ q)) : eq.symm (degree_mul' hlc)
225+
... = degree (p %ₘ q + q * (p /ₘ q)) : (degree_add_eq_right_of_degree_lt hmod).symm
226+
... = _ : congr_arg _ (mod_by_monic_add_div _ hq)
227+
end
236228

237229
lemma degree_div_by_monic_le (p q : polynomial R) : degree (p /ₘ q) ≤ degree p :=
238230
if hp0 : p = 0 then by simp only [hp0, zero_div_by_monic, le_refl]
239231
else if hq : monic q then
240-
have hq0 : q ≠ 0 := hq.ne_zero_of_polynomial_ne hp0,
241232
if h : degree q ≤ degree p
242-
then by rw [← degree_add_div_by_monic hq h, degree_eq_nat_degree hq0,
243-
degree_eq_nat_degree (mt (div_by_monic_eq_zero_iff hq hq0).1 (not_lt.2 h))];
233+
then by haveI := nontrivial.of_polynomial_ne hp0;
234+
rw [← degree_add_div_by_monic hq h, degree_eq_nat_degree hq.ne_zero,
235+
degree_eq_nat_degree (mt (div_by_monic_eq_zero_iff hq).1 (not_lt.2 h))];
244236
exact with_bot.coe_le_coe.2 (nat.le_add_left _ _)
245237
else
246238
by unfold div_by_monic div_mod_by_monic_aux;
@@ -249,17 +241,18 @@ else (div_by_monic_eq_of_not_monic p hq).symm ▸ bot_le
249241

250242
lemma degree_div_by_monic_lt (p : polynomial R) {q : polynomial R} (hq : monic q)
251243
(hp0 : p ≠ 0) (h0q : 0 < degree q) : degree (p /ₘ q) < degree p :=
252-
have hq0 : q ≠ 0 := hq.ne_zero_of_polynomial_ne hp0,
253244
if hpq : degree p < degree q
254245
then begin
255-
rw [(div_by_monic_eq_zero_iff hq hq0).2 hpq, degree_eq_nat_degree hp0],
246+
haveI := nontrivial.of_polynomial_ne hp0,
247+
rw [(div_by_monic_eq_zero_iff hq).2 hpq, degree_eq_nat_degree hp0],
256248
exact with_bot.bot_lt_coe _
257249
end
258250
else begin
259-
rw [← degree_add_div_by_monic hq (not_lt.1 hpq), degree_eq_nat_degree hq0,
260-
degree_eq_nat_degree (mt (div_by_monic_eq_zero_iff hq hq0).1 hpq)],
251+
haveI := nontrivial.of_polynomial_ne hp0,
252+
rw [← degree_add_div_by_monic hq (not_lt.1 hpq), degree_eq_nat_degree hq.ne_zero,
253+
degree_eq_nat_degree (mt (div_by_monic_eq_zero_iff hq).1 hpq)],
261254
exact with_bot.coe_lt_coe.2 (nat.lt_add_of_pos_left
262-
(with_bot.coe_lt_coe.1 $ (degree_eq_nat_degree hq0) ▸ h0q))
255+
(with_bot.coe_lt_coe.1 $ (degree_eq_nat_degree hq.ne_zero) ▸ h0q))
263256
end
264257

265258
theorem nat_degree_div_by_monic {R : Type u} [comm_ring R] (f : polynomial R) {g : polynomial R}
@@ -271,9 +264,9 @@ begin
271264
nat_degree_zero] },
272265
haveI : nontrivial R := ⟨⟨0, 1, h01⟩⟩,
273266
by_cases hfg : f /ₘ g = 0,
274-
{ rw [hfg, nat_degree_zero], rw div_by_monic_eq_zero_iff hg hg.ne_zero at hfg,
267+
{ rw [hfg, nat_degree_zero], rw div_by_monic_eq_zero_iff hg at hfg,
275268
rw nat.sub_eq_zero_of_le (nat_degree_le_nat_degree $ le_of_lt hfg) },
276-
have hgf := hfg, rw div_by_monic_eq_zero_iff hg hg.ne_zero at hgf, push_neg at hgf,
269+
have hgf := hfg, rw div_by_monic_eq_zero_iff hg at hgf, push_neg at hgf,
277270
have := degree_add_div_by_monic hg hgf,
278271
have hf : f ≠ 0, { intro hf, apply hfg, rw [hf, zero_div_by_monic] },
279272
rw [degree_eq_nat_degree hf, degree_eq_nat_degree hg.ne_zero, degree_eq_nat_degree hfg,
@@ -283,9 +276,8 @@ end
283276

284277
lemma div_mod_by_monic_unique {f g} (q r : polynomial R) (hg : monic g)
285278
(h : r + g * q = f ∧ degree r < degree g) : f /ₘ g = q ∧ f %ₘ g = r :=
286-
if hg0 : g = 0 then by split; exact (subsingleton_of_monic_zero
287-
(hg0 ▸ hg : monic (0 : polynomial R))).1 _ _
288-
else
279+
begin
280+
nontriviality R,
289281
have h₁ : r - f %ₘ g = -g * (q - f /ₘ g),
290282
from eq_of_sub_eq_zero
291283
(by rw [← sub_eq_zero_of_eq (h.1.trans (mod_by_monic_add_div f hg).symm)];
@@ -295,35 +287,34 @@ else
295287
have h₄ : degree (r - f %ₘ g) < degree g,
296288
from calc degree (r - f %ₘ g) ≤ max (degree r) (degree (f %ₘ g)) :
297289
degree_sub_le _ _
298-
... < degree g : max_lt_iff.2 ⟨h.2, degree_mod_by_monic_lt _ hg hg0⟩,
290+
... < degree g : max_lt_iff.2 ⟨h.2, degree_mod_by_monic_lt _ hg⟩,
299291
have h₅ : q - (f /ₘ g) = 0,
300292
from by_contradiction
301293
(λ hqf, not_le_of_gt h₄ $
302294
calc degree g ≤ degree g + degree (q - f /ₘ g) :
303-
by erw [degree_eq_nat_degree hg0, degree_eq_nat_degree hqf,
295+
by erw [degree_eq_nat_degree hg.ne_zero, degree_eq_nat_degree hqf,
304296
with_bot.coe_le_coe];
305297
exact nat.le_add_right _ _
306298
... = degree (r - f %ₘ g) :
307299
by rw [h₂, degree_mul']; simpa [monic.def.1 hg]),
308-
⟨eq.symm $ eq_of_sub_eq_zero h₅,
300+
exact ⟨eq.symm $ eq_of_sub_eq_zero h₅,
309301
eq.symm $ eq_of_sub_eq_zero $ by simpa [h₅] using h₁⟩
302+
end
310303

311304
lemma map_mod_div_by_monic [comm_ring S] (f : R →+* S) (hq : monic q) :
312305
(p /ₘ q).map f = p.map f /ₘ q.map f ∧ (p %ₘ q).map f = p.map f %ₘ q.map f :=
313-
if h01 : (0 : S) = 1 then by haveI := subsingleton_of_zero_eq_one h01;
314-
exact ⟨subsingleton.elim _ _, subsingleton.elim _ _⟩
315-
else
316-
have h01R : (0 : R) ≠ 1, from mt (congr_arg f)
317-
(by rwa [f.map_one, f.map_zero]),
318-
have map f p /ₘ map f q = map f (p /ₘ q) ∧ map f p %ₘ map f q = map f (p %ₘ q),
319-
from (div_mod_by_monic_unique ((p /ₘ q).map f) _ (monic_map f hq)
320-
⟨eq.symm $ by rw [← map_mul, ← map_add, mod_by_monic_add_div _ hq],
321-
calc _ ≤ degree (p %ₘ q) : degree_map_le _ _
322-
... < degree q : degree_mod_by_monic_lt _ hq
323-
$ (hq.ne_zero_of_ne h01R)
324-
... = _ : eq.symm $ degree_map_eq_of_leading_coeff_ne_zero _
325-
(by rw [monic.def.1 hq, f.map_one]; exact ne.symm h01)⟩),
326-
⟨this.1.symm, this.2.symm⟩
306+
begin
307+
nontriviality S,
308+
haveI : nontrivial R := f.domain_nontrivial,
309+
have : map f p /ₘ map f q = map f (p /ₘ q) ∧ map f p %ₘ map f q = map f (p %ₘ q),
310+
{ exact (div_mod_by_monic_unique ((p /ₘ q).map f) _ (monic_map f hq)
311+
⟨eq.symm $ by rw [← map_mul, ← map_add, mod_by_monic_add_div _ hq],
312+
calc _ ≤ degree (p %ₘ q) : degree_map_le _ _
313+
... < degree q : degree_mod_by_monic_lt _ hq
314+
... = _ : eq.symm $ degree_map_eq_of_leading_coeff_ne_zero _
315+
(by rw [monic.def.1 hq, f.map_one]; exact one_ne_zero)⟩) },
316+
exact ⟨this.1.symm, this.2.symm⟩
317+
end
327318

328319
lemma map_div_by_monic [comm_ring S] (f : R →+* S) (hq : monic q) :
329320
(p /ₘ q).map f = p.map f /ₘ q.map f :=
@@ -336,23 +327,23 @@ lemma map_mod_by_monic [comm_ring S] (f : R →+* S) (hq : monic q) :
336327
lemma dvd_iff_mod_by_monic_eq_zero (hq : monic q) : p %ₘ q = 0 ↔ q ∣ p :=
337328
⟨λ h, by rw [← mod_by_monic_add_div p hq, h, zero_add];
338329
exact dvd_mul_right _ _,
339-
λ h, if hq0 : q = 0 then by rw hq0 at hq;
340-
exact (subsingleton_of_monic_zero hq).1 _ _
341-
else
342-
let ⟨r, hr⟩ := exists_eq_mul_right_of_dvd h in
343-
by_contradiction (λ hpq0,
344-
have hmod : p %ₘ q = q * (r - p /ₘ q) :=
345-
by rw [mod_by_monic_eq_sub_mul_div _ hq, mul_sub, ← hr],
346-
have degree (q * (r - p /ₘ q)) < degree q :=
347-
hmod ▸ degree_mod_by_monic_lt _ hq hq0,
330+
λ h, begin
331+
nontriviality R,
332+
obtain ⟨r, hr⟩ := exists_eq_mul_right_of_dvd h,
333+
by_contradiction hpq0,
334+
have hmod : p %ₘ q = q * (r - p /ₘ q),
335+
{ rw [mod_by_monic_eq_sub_mul_div _ hq, mul_sub, ← hr] },
336+
have : degree (q * (r - p /ₘ q)) < degree q :=
337+
hmod ▸ degree_mod_by_monic_lt _ hq,
348338
have hrpq0 : leading_coeff (r - p /ₘ q) ≠ 0 :=
349339
λ h, hpq0 $ leading_coeff_eq_zero.1
350340
(by rw [hmod, leading_coeff_eq_zero.1 h, mul_zero, leading_coeff_zero]),
351341
have hlc : leading_coeff q * leading_coeff (r - p /ₘ q) ≠ 0 :=
352342
by rwa [monic.def.1 hq, one_mul],
353-
by rw [degree_mul' hlc, degree_eq_nat_degree hq0,
354-
degree_eq_nat_degree (mt leading_coeff_eq_zero.2 hrpq0)] at this;
355-
exact not_lt_of_ge (nat.le_add_right _ _) (with_bot.some_lt_some.1 this))⟩
343+
rw [degree_mul' hlc, degree_eq_nat_degree hq.ne_zero,
344+
degree_eq_nat_degree (mt leading_coeff_eq_zero.2 hrpq0)] at this,
345+
exact not_lt_of_ge (nat.le_add_right _ _) (with_bot.some_lt_some.1 this)
346+
end
356347

357348
theorem map_dvd_map [comm_ring S] (f : R →+* S) (hf : function.injective f) {x y : polynomial R}
358349
(hx : x.monic) : x.map f ∣ y.map f ↔ x ∣ y :=
@@ -371,22 +362,17 @@ by conv_rhs { rw [← mod_by_monic_add_div p monic_one] }; simp
371362

372363
@[simp] lemma mod_by_monic_X_sub_C_eq_C_eval (p : polynomial R) (a : R) :
373364
p %ₘ (X - C a) = C (p.eval a) :=
374-
if h0 : (0 : R) = 1 then by letI := subsingleton_of_zero_eq_one h0; exact subsingleton.elim _ _
375-
else
376-
by haveI : nontrivial R := nontrivial_of_ne 0 1 h0; exact
377-
have h : (p %ₘ (X - C a)).eval a = p.eval a :=
378-
by rw [mod_by_monic_eq_sub_mul_div _ (monic_X_sub_C a), eval_sub, eval_mul,
379-
eval_sub, eval_X, eval_C, sub_self, zero_mul, sub_zero],
380-
have degree (p %ₘ (X - C a)) < 1 :=
381-
degree_X_sub_C a ▸ degree_mod_by_monic_lt p (monic_X_sub_C a) ((degree_X_sub_C a).symm ▸
382-
ne_zero_of_monic (monic_X_sub_C _)),
383-
have degree (p %ₘ (X - C a)) ≤ 0 :=
384-
begin
385-
cases (degree (p %ₘ (X - C a))),
386-
{ exact bot_le },
387-
{ exact with_bot.some_le_some.2 (nat.le_of_lt_succ (with_bot.some_lt_some.1 this)) }
388-
end,
389365
begin
366+
nontriviality R,
367+
have h : (p %ₘ (X - C a)).eval a = p.eval a,
368+
{ rw [mod_by_monic_eq_sub_mul_div _ (monic_X_sub_C a), eval_sub, eval_mul,
369+
eval_sub, eval_X, eval_C, sub_self, zero_mul, sub_zero] },
370+
have : degree (p %ₘ (X - C a)) < 1 :=
371+
degree_X_sub_C a ▸ degree_mod_by_monic_lt p (monic_X_sub_C a),
372+
have : degree (p %ₘ (X - C a)) ≤ 0,
373+
{ cases (degree (p %ₘ (X - C a))),
374+
{ exact bot_le },
375+
{ exact with_bot.some_le_some.2 (nat.le_of_lt_succ (with_bot.some_lt_some.1 this)) } },
390376
rw [eq_C_of_degree_le_zero this, eval_C] at h,
391377
rw [eq_C_of_degree_le_zero this, h]
392378
end

src/data/polynomial/field_division.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,6 @@ private lemma remainder_lt_aux (p : polynomial R) (hq : q ≠ 0) :
121121
degree (mod p q) < degree q :=
122122
by rw ← degree_mul_leading_coeff_inv q hq; exact
123123
degree_mod_by_monic_lt p (monic_mul_leading_coeff_inv hq)
124-
(mul_ne_zero hq (mt leading_coeff_eq_zero.2 (by rw leading_coeff_C;
125-
exact inv_ne_zero (mt leading_coeff_eq_zero.1 hq))))
126124

127125
instance : has_div (polynomial R) := ⟨div⟩
128126

@@ -173,7 +171,7 @@ lemma div_eq_zero_iff (hq0 : q ≠ 0) : p / q = 0 ↔ degree p < degree q :=
173171
λ h, have hlt : degree p < degree (q * C (leading_coeff q)⁻¹),
174172
by rwa degree_mul_leading_coeff_inv q hq0,
175173
have hm : monic (q * C (leading_coeff q)⁻¹) := monic_mul_leading_coeff_inv hq0,
176-
by rw [div_def, (div_by_monic_eq_zero_iff hm (ne_zero_of_monic hm)).2 hlt, mul_zero]⟩
174+
by rw [div_def, (div_by_monic_eq_zero_iff hm).2 hlt, mul_zero]⟩
177175

178176
lemma degree_add_div (hq0 : q ≠ 0) (hpq : degree q ≤ degree p) :
179177
degree q + degree (p / q) = degree p :=

src/data/polynomial/ring_division.lean

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ then
253253
rw degree_eq_nat_degree hp at hpd,
254254
exact with_bot.coe_le_coe.2 (with_bot.coe_lt_coe.1 hpd)
255255
end,
256-
have hdiv0 : p /ₘ (X - C x) ≠ 0 := mt (div_by_monic_eq_zero_iff (monic_X_sub_C x)
257-
(ne_zero_of_monic (monic_X_sub_C x))).1 $ not_lt.2 hdeg,
256+
have hdiv0 : p /ₘ (X - C x) ≠ 0 := mt (div_by_monic_eq_zero_iff (monic_X_sub_C x)).1 $
257+
not_lt.2 hdeg,
258258
⟨x ::ₘ t, calc (card (x ::ₘ t) : with_bot ℕ) = t.card + 1 :
259259
by exact_mod_cast card_cons _ _
260260
... ≤ degree p :
@@ -577,10 +577,10 @@ begin
577577
have hp := mod_by_monic_add_div p hmonic,
578578
have hzero : (p /ₘ q) ≠ 0,
579579
{ intro h,
580-
exact not_lt_of_le hdegree ((div_by_monic_eq_zero_iff hmonic (monic.ne_zero hmonic)).1 h) },
580+
exact not_lt_of_le hdegree ((div_by_monic_eq_zero_iff hmonic).1 h) },
581581
have deglt : (p %ₘ q).degree < (q * (p /ₘ q)).degree,
582582
{ rw degree_mul,
583-
refine lt_of_lt_of_le (degree_mod_by_monic_lt p hmonic (monic.ne_zero hmonic)) _,
583+
refine lt_of_lt_of_le (degree_mod_by_monic_lt p hmonic) _,
584584
rw [degree_eq_nat_degree (monic.ne_zero hmonic), degree_eq_nat_degree hzero],
585585
norm_cast,
586586
simp only [zero_le, le_add_iff_nonneg_right] },

src/field_theory/minpoly.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ begin
289289
by_contra hnz,
290290
have := degree_le_of_ne_zero A x hnz _,
291291
{ contrapose! this,
292-
exact degree_mod_by_monic_lt _ (monic hx) (ne_zero hx) },
292+
exact degree_mod_by_monic_lt _ (monic hx) },
293293
{ rw ← mod_by_monic_add_div p (monic hx) at hp,
294294
simpa using hp }
295295
end

src/ring_theory/power_basis.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@ begin
251251
have : (f %ₘ minpoly A pb.gen).nat_degree < pb.dim,
252252
{ rw ← pb.nat_degree_minpoly,
253253
apply nat_degree_lt_nat_degree hf,
254-
exact degree_mod_by_monic_lt _ (minpoly.monic pb.is_integral_gen)
255-
(minpoly.ne_zero pb.is_integral_gen) },
254+
exact degree_mod_by_monic_lt _ (minpoly.monic pb.is_integral_gen) },
256255
rw [aeval_eq_sum_range' this, aeval_eq_sum_range' this, linear_map.map_sum],
257256
refine finset.sum_congr rfl (λ i (hi : i ∈ finset.range pb.dim), _),
258257
rw finset.mem_range at hi,
@@ -435,7 +434,7 @@ begin
435434
apply mem_span_pow'.mpr _,
436435
have := minpoly.monic hx,
437436
refine ⟨f.mod_by_monic (minpoly R x),
438-
lt_of_lt_of_le (degree_mod_by_monic_lt _ this (ne_zero_of_monic this)) degree_le_nat_degree,
437+
lt_of_lt_of_le (degree_mod_by_monic_lt _ this) degree_le_nat_degree,
439438
_⟩,
440439
conv_lhs { rw ← mod_by_monic_add_div f this },
441440
simp only [add_zero, zero_mul, minpoly.aeval, aeval_add, alg_hom.map_mul]

0 commit comments

Comments
 (0)