@@ -76,7 +76,7 @@ theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ p₂ : R[X]} (h : q ∣ p
76
76
theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by
77
77
by_cases hq : q.Monic
78
78
· cases' subsingleton_or_nontrivial R with hR hR
79
- · simp only [eq_iff_true_of_subsingleton]
79
+ · simp only [eq_iff_true_of_subsingleton]
80
80
· exact
81
81
(div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq
82
82
⟨by
@@ -90,7 +90,7 @@ theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q +
90
90
theorem smul_modByMonic (c : R) (p : R[X]) : c • p %ₘ q = c • (p %ₘ q) := by
91
91
by_cases hq : q.Monic
92
92
· cases' subsingleton_or_nontrivial R with hR hR
93
- · simp only [eq_iff_true_of_subsingleton]
93
+ · simp only [eq_iff_true_of_subsingleton]
94
94
· exact
95
95
(div_modByMonic_unique (c • (p /ₘ q)) (c • (p %ₘ q)) hq
96
96
⟨by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq],
@@ -127,16 +127,16 @@ section NoZeroDivisors
127
127
128
128
variable [Semiring R] [NoZeroDivisors R] {p q : R[X]}
129
129
130
- instance : NoZeroDivisors R[X] where
130
+ instance : NoZeroDivisors R[X] where
131
131
eq_zero_or_eq_zero_of_mul_eq_zero h := by
132
132
rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero]
133
133
refine' eq_zero_or_eq_zero_of_mul_eq_zero _
134
134
rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
135
135
136
136
theorem natDegree_mul (hp : p ≠ 0 ) (hq : q ≠ 0 ) : (p*q).natDegree = p.natDegree + q.natDegree :=
137
137
by
138
- rw [← WithBot.coe_eq_coe, ← Nat.cast_withBot, ←degree_eq_natDegree (mul_ne_zero hp hq),
139
- WithBot.coe_add, ← Nat.cast_withBot, ←degree_eq_natDegree hp, ← Nat.cast_withBot,
138
+ rw [← WithBot.coe_eq_coe, ← Nat.cast_withBot, ←degree_eq_natDegree (mul_ne_zero hp hq),
139
+ WithBot.coe_add, ← Nat.cast_withBot, ←degree_eq_natDegree hp, ← Nat.cast_withBot,
140
140
← degree_eq_natDegree hq, degree_mul]
141
141
#align polynomial.nat_degree_mul Polynomial.natDegree_mul
142
142
@@ -320,7 +320,7 @@ theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd :
320
320
rw [hm.irreducible_iff_natDegree', and_iff_right, hnd]
321
321
push_neg; constructor
322
322
· rintro ⟨a, b, ha, hb, rfl, hdb⟩
323
- simp only [zero_lt_two, Nat.div_self, ge_iff_le,
323
+ simp only [zero_lt_two, Nat.div_self, ge_iff_le,
324
324
Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb
325
325
have hda := hnd
326
326
rw [ha.natDegree_mul hb, hdb] at hda
@@ -361,8 +361,8 @@ section CommRing
361
361
362
362
variable [CommRing R]
363
363
364
- /- Porting note: the ML3 proof no longer worked because of a conflict in the
365
- inferred type and synthesized type for `DecidableRel` when using `Nat.le_find_iff` from
364
+ /- Porting note: the ML3 proof no longer worked because of a conflict in the
365
+ inferred type and synthesized type for `DecidableRel` when using `Nat.le_find_iff` from
366
366
`Mathlib.Data.Polynomial.Div` After some discussion on [ Zulip ]
367
367
(https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/decidability.20leakage)
368
368
introduced `Polynomial.rootMultipulicity_eq_nat_find_of_nonzero` to contain the issue
@@ -376,7 +376,7 @@ theorem le_rootMultiplicity_iff {p : R[X]} (p0 : p ≠ 0) {a : R} {n : ℕ} :
376
376
refine ⟨fun h => ?_, fun h m hm => (pow_dvd_pow _ hm).trans h⟩
377
377
cases' n with n;
378
378
· rw [pow_zero]
379
- apply one_dvd;
379
+ apply one_dvd;
380
380
· exact h n n.lt_succ_self
381
381
#align polynomial.le_root_multiplicity_iff Polynomial.le_rootMultiplicity_iff
382
382
@@ -481,7 +481,7 @@ set_option linter.uppercaseLean3 false in
481
481
#align polynomial.root_multiplicity_X_sub_C_pow Polynomial.rootMultiplicity_X_sub_C_pow
482
482
483
483
theorem exists_multiset_roots :
484
- ∀ {p : R[X]} (_ : p ≠ 0 ), ∃ s : Multiset R,
484
+ ∀ {p : R[X]} (_ : p ≠ 0 ), ∃ s : Multiset R,
485
485
(Multiset.card s : WithBot ℕ) ≤ degree p ∧ ∀ a, s.count a = rootMultiplicity a p
486
486
| p, hp =>
487
487
haveI := Classical.propDecidable (∃ x, IsRoot p x)
@@ -502,7 +502,7 @@ theorem exists_multiset_roots :
502
502
mt (divByMonic_eq_zero_iff (monic_X_sub_C x)).1 <| not_lt.2 hdeg
503
503
⟨x ::ₘ t,
504
504
calc
505
- (card (x ::ₘ t) : WithBot ℕ) = Multiset.card t + 1 := by
505
+ (card (x ::ₘ t) : WithBot ℕ) = Multiset.card t + 1 := by
506
506
congr
507
507
exact_mod_cast Multiset.card_cons _ _
508
508
_ ≤ degree p := by
@@ -524,8 +524,8 @@ theorem exists_multiset_roots :
524
524
intro a
525
525
rw [count_zero, rootMultiplicity_eq_zero (not_exists.mp h a)]⟩
526
526
termination_by _ p _ => natDegree p
527
- decreasing_by {
528
- simp_wf
527
+ decreasing_by {
528
+ simp_wf
529
529
apply WithBot.coe_lt_coe.mp
530
530
simp only [degree_eq_natDegree hp, degree_eq_natDegree hd0, ←Nat.cast_withBot] at wf;
531
531
assumption}
@@ -716,7 +716,7 @@ theorem roots_pow (p : R[X]) (n : ℕ) : (p ^ n).roots = n • p.roots := by
716
716
add_smul, one_smul]
717
717
#align polynomial.roots_pow Polynomial.roots_pow
718
718
719
- theorem roots_X_pow (n : ℕ) : (X ^ n : R[X]).roots = n • ({0 } : Multiset R) := by
719
+ theorem roots_X_pow (n : ℕ) : (X ^ n : R[X]).roots = n • ({0 } : Multiset R) := by
720
720
rw [roots_pow, roots_X]
721
721
set_option linter.uppercaseLean3 false in
722
722
#align polynomial.roots_X_pow Polynomial.roots_X_pow
@@ -800,8 +800,8 @@ theorem card_nthRoots (n : ℕ) (a : R) : Multiset.card (nthRoots n a) ≤ n :=
800
800
rw [hn, pow_zero, ← C_1, ← RingHom.map_sub]
801
801
exact degree_C_le))
802
802
else by
803
- rw [← WithBot.coe_le_coe]
804
- simp only [← Nat.cast_withBot]
803
+ rw [← WithBot.coe_le_coe]
804
+ simp only [← Nat.cast_withBot]
805
805
rw [← degree_X_pow_sub_C (Nat.pos_of_ne_zero hn) a]
806
806
exact card_roots (X_pow_sub_C_ne_zero (Nat.pos_of_ne_zero hn) a)
807
807
#align polynomial.card_nth_roots Polynomial.card_nthRoots
@@ -1166,7 +1166,7 @@ theorem count_map_roots [IsDomain A] {p : A[X]} {f : A →+* B} (hmap : map f p
1166
1166
rw [le_rootMultiplicity_iff hmap, ← Multiset.prod_replicate, ←
1167
1167
Multiset.map_replicate fun a => X - C a]
1168
1168
rw [← Multiset.filter_eq]
1169
- refine
1169
+ refine
1170
1170
(Multiset.prod_dvd_prod_of_le <| Multiset.map_le_map <| Multiset.filter_le (Eq b) _).trans ?_
1171
1171
convert Polynomial.map_dvd f p.prod_multiset_X_sub_C_dvd
1172
1172
simp only [Polynomial.map_multiset_prod, Multiset.map_map]
@@ -1210,7 +1210,7 @@ theorem card_roots_le_map_of_injective [IsDomain A] [IsDomain B] {p : A[X]} {f :
1210
1210
exact card_roots_le_map ((Polynomial.map_ne_zero_iff hf).mpr hp0)
1211
1211
#align polynomial.card_roots_le_map_of_injective Polynomial.card_roots_le_map_of_injective
1212
1212
1213
- /- Porting note: resolving a diamond from Ring to NonAssocSemiRing in RingHom TC search
1213
+ /- Porting note: resolving a diamond from Ring to NonAssocSemiRing in RingHom TC search
1214
1214
This also works
1215
1215
`attribute [-instance] Ring.toNonAssocRing`
1216
1216
-/
@@ -1264,7 +1264,7 @@ theorem Monic.irreducible_of_irreducible_map (f : R[X]) (h_mon : Monic f)
1264
1264
dsimp [Monic] at h_mon
1265
1265
have q := (leadingCoeff_mul a b).symm
1266
1266
rw [← h, h_mon] at q
1267
- refine' (h_irr.isUnit_or_isUnit <|
1267
+ refine' (h_irr.isUnit_or_isUnit <|
1268
1268
(congr_arg (Polynomial.map φ) h).trans (Polynomial.map_mul φ)).imp _ _ <;>
1269
1269
apply isUnit_of_isUnit_leadingCoeff_of_isUnit_map <;>
1270
1270
apply isUnit_of_mul_eq_one
@@ -1276,4 +1276,3 @@ theorem Monic.irreducible_of_irreducible_map (f : R[X]) (h_mon : Monic f)
1276
1276
end
1277
1277
1278
1278
end Polynomial
1279
-
0 commit comments