Skip to content

Commit b306241

Browse files
committed
chore: strip trailing spaces in Data.Polynomial.RingDivision (#3126)
This was introduced in #3029, due to a combination of `mathport` emitting trailing spaces, and the PR author not using an editor that strips them automatically (unlike vscode which does).
1 parent 5121293 commit b306241

File tree

1 file changed

+19
-20
lines changed

1 file changed

+19
-20
lines changed

Mathlib/Data/Polynomial/RingDivision.lean

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ theorem modByMonic_eq_of_dvd_sub (hq : q.Monic) {p₁ p₂ : R[X]} (h : q ∣ p
7676
theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q + p₂ %ₘ q := by
7777
by_cases hq : q.Monic
7878
· cases' subsingleton_or_nontrivial R with hR hR
79-
· simp only [eq_iff_true_of_subsingleton]
79+
· simp only [eq_iff_true_of_subsingleton]
8080
· exact
8181
(div_modByMonic_unique (p₁ /ₘ q + p₂ /ₘ q) _ hq
8282
by
@@ -90,7 +90,7 @@ theorem add_modByMonic (p₁ p₂ : R[X]) : (p₁ + p₂) %ₘ q = p₁ %ₘ q +
9090
theorem smul_modByMonic (c : R) (p : R[X]) : c • p %ₘ q = c • (p %ₘ q) := by
9191
by_cases hq : q.Monic
9292
· cases' subsingleton_or_nontrivial R with hR hR
93-
· simp only [eq_iff_true_of_subsingleton]
93+
· simp only [eq_iff_true_of_subsingleton]
9494
· exact
9595
(div_modByMonic_unique (c • (p /ₘ q)) (c • (p %ₘ q)) hq
9696
by rw [mul_smul_comm, ← smul_add, modByMonic_add_div p hq],
@@ -127,16 +127,16 @@ section NoZeroDivisors
127127

128128
variable [Semiring R] [NoZeroDivisors R] {p q : R[X]}
129129

130-
instance : NoZeroDivisors R[X] where
130+
instance : NoZeroDivisors R[X] where
131131
eq_zero_or_eq_zero_of_mul_eq_zero h := by
132132
rw [← leadingCoeff_eq_zero, ← leadingCoeff_eq_zero]
133133
refine' eq_zero_or_eq_zero_of_mul_eq_zero _
134134
rw [← leadingCoeff_zero, ← leadingCoeff_mul, h]
135135

136136
theorem natDegree_mul (hp : p ≠ 0) (hq : q ≠ 0) : (p*q).natDegree = p.natDegree + q.natDegree :=
137137
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,
140140
← degree_eq_natDegree hq, degree_mul]
141141
#align polynomial.nat_degree_mul Polynomial.natDegree_mul
142142

@@ -320,7 +320,7 @@ theorem Monic.not_irreducible_iff_exists_add_mul_eq_coeff (hm : p.Monic) (hnd :
320320
rw [hm.irreducible_iff_natDegree', and_iff_right, hnd]
321321
push_neg; constructor
322322
· 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,
324324
Nat.Ioc_succ_singleton, zero_add, mem_singleton] at hdb
325325
have hda := hnd
326326
rw [ha.natDegree_mul hb, hdb] at hda
@@ -361,8 +361,8 @@ section CommRing
361361

362362
variable [CommRing R]
363363

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
366366
`Mathlib.Data.Polynomial.Div` After some discussion on [Zulip]
367367
(https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/decidability.20leakage)
368368
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 : ℕ} :
376376
refine ⟨fun h => ?_, fun h m hm => (pow_dvd_pow _ hm).trans h⟩
377377
cases' n with n;
378378
· rw [pow_zero]
379-
apply one_dvd;
379+
apply one_dvd;
380380
· exact h n n.lt_succ_self
381381
#align polynomial.le_root_multiplicity_iff Polynomial.le_rootMultiplicity_iff
382382

@@ -481,7 +481,7 @@ set_option linter.uppercaseLean3 false in
481481
#align polynomial.root_multiplicity_X_sub_C_pow Polynomial.rootMultiplicity_X_sub_C_pow
482482

483483
theorem exists_multiset_roots :
484-
∀ {p : R[X]} (_ : p ≠ 0), ∃ s : Multiset R,
484+
∀ {p : R[X]} (_ : p ≠ 0), ∃ s : Multiset R,
485485
(Multiset.card s : WithBot ℕ) ≤ degree p ∧ ∀ a, s.count a = rootMultiplicity a p
486486
| p, hp =>
487487
haveI := Classical.propDecidable (∃ x, IsRoot p x)
@@ -502,7 +502,7 @@ theorem exists_multiset_roots :
502502
mt (divByMonic_eq_zero_iff (monic_X_sub_C x)).1 <| not_lt.2 hdeg
503503
⟨x ::ₘ t,
504504
calc
505-
(card (x ::ₘ t) : WithBot ℕ) = Multiset.card t + 1 := by
505+
(card (x ::ₘ t) : WithBot ℕ) = Multiset.card t + 1 := by
506506
congr
507507
exact_mod_cast Multiset.card_cons _ _
508508
_ ≤ degree p := by
@@ -524,8 +524,8 @@ theorem exists_multiset_roots :
524524
intro a
525525
rw [count_zero, rootMultiplicity_eq_zero (not_exists.mp h a)]⟩
526526
termination_by _ p _ => natDegree p
527-
decreasing_by {
528-
simp_wf
527+
decreasing_by {
528+
simp_wf
529529
apply WithBot.coe_lt_coe.mp
530530
simp only [degree_eq_natDegree hp, degree_eq_natDegree hd0, ←Nat.cast_withBot] at wf;
531531
assumption}
@@ -716,7 +716,7 @@ theorem roots_pow (p : R[X]) (n : ℕ) : (p ^ n).roots = n • p.roots := by
716716
add_smul, one_smul]
717717
#align polynomial.roots_pow Polynomial.roots_pow
718718

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
720720
rw [roots_pow, roots_X]
721721
set_option linter.uppercaseLean3 false in
722722
#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 :=
800800
rw [hn, pow_zero, ← C_1, ← RingHom.map_sub]
801801
exact degree_C_le))
802802
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]
805805
rw [← degree_X_pow_sub_C (Nat.pos_of_ne_zero hn) a]
806806
exact card_roots (X_pow_sub_C_ne_zero (Nat.pos_of_ne_zero hn) a)
807807
#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
11661166
rw [le_rootMultiplicity_iff hmap, ← Multiset.prod_replicate, ←
11671167
Multiset.map_replicate fun a => X - C a]
11681168
rw [← Multiset.filter_eq]
1169-
refine
1169+
refine
11701170
(Multiset.prod_dvd_prod_of_le <| Multiset.map_le_map <| Multiset.filter_le (Eq b) _).trans ?_
11711171
convert Polynomial.map_dvd f p.prod_multiset_X_sub_C_dvd
11721172
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 :
12101210
exact card_roots_le_map ((Polynomial.map_ne_zero_iff hf).mpr hp0)
12111211
#align polynomial.card_roots_le_map_of_injective Polynomial.card_roots_le_map_of_injective
12121212

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
12141214
This also works
12151215
`attribute [-instance] Ring.toNonAssocRing`
12161216
-/
@@ -1264,7 +1264,7 @@ theorem Monic.irreducible_of_irreducible_map (f : R[X]) (h_mon : Monic f)
12641264
dsimp [Monic] at h_mon
12651265
have q := (leadingCoeff_mul a b).symm
12661266
rw [← h, h_mon] at q
1267-
refine' (h_irr.isUnit_or_isUnit <|
1267+
refine' (h_irr.isUnit_or_isUnit <|
12681268
(congr_arg (Polynomial.map φ) h).trans (Polynomial.map_mul φ)).imp _ _ <;>
12691269
apply isUnit_of_isUnit_leadingCoeff_of_isUnit_map <;>
12701270
apply isUnit_of_mul_eq_one
@@ -1276,4 +1276,3 @@ theorem Monic.irreducible_of_irreducible_map (f : R[X]) (h_mon : Monic f)
12761276
end
12771277

12781278
end Polynomial
1279-

0 commit comments

Comments
 (0)