Skip to content

Commit ca14452

Browse files
chore: tidy various files (#21872)
1 parent 33db31b commit ca14452

File tree

44 files changed

+83
-107
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+83
-107
lines changed

Mathlib/Algebra/Azumaya/Basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ noncomputable abbrev tensorEquivEnd : R ⊗[R] Rᵐᵒᵖ ≃ₐ[R] Module.End R
4343
Algebra.TensorProduct.lid R Rᵐᵒᵖ|>.trans <|
4444
AlgEquiv.ofRingEquiv (f := Module.moduleEndSelf R) fun r ↦ by ext; simp
4545

46-
lemma coe_tensorEquivEnd: tensorEquivEnd R = AlgHom.mulLeftRight R R := by
46+
lemma coe_tensorEquivEnd : tensorEquivEnd R = AlgHom.mulLeftRight R R := by
4747
ext; simp
4848

4949
instance id : IsAzumaya R R where
@@ -63,7 +63,7 @@ End R A ------------> End R B
6363
e.conj
6464
```
6565
-/
66-
lemma mulLeftRight_comp_congr (e : A ≃ₐ[R] B):
66+
lemma mulLeftRight_comp_congr (e : A ≃ₐ[R] B) :
6767
(AlgHom.mulLeftRight R B).comp (Algebra.TensorProduct.congr e e.op).toAlgHom =
6868
(e.toLinearEquiv.algConj).toAlgHom.comp (AlgHom.mulLeftRight R A) := by
6969
apply AlgHom.ext
@@ -80,7 +80,7 @@ theorem of_AlgEquiv (e : A ≃ₐ[R] B) [IsAzumaya R A] : IsAzumaya R B :=
8080
let _ : Module.Finite R B := .equiv e.toLinearEquiv
8181
⟨Function.Bijective.of_comp_iff (AlgHom.mulLeftRight R B)
8282
(Algebra.TensorProduct.congr e e.op).bijective |>.1 <| by
83-
erw [← AlgHom.coe_comp, mulLeftRight_comp_congr]
83+
rw [← AlgEquiv.coe_algHom, ← AlgHom.coe_comp, mulLeftRight_comp_congr]
8484
simp [AlgHom.mulLeftRight_bij]⟩
8585

8686
end IsAzumaya

Mathlib/Algebra/Azumaya/Matrix.lean

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ abbrev AlgHom.mulLeftRightMatrix_inv :
3535
map_add' f1 f2 := by simp [add_smul, Finset.sum_add_distrib]
3636
map_smul' r f := by simp [MulAction.mul_smul, Finset.smul_sum]
3737

38-
lemma AlgHom.mulLeftRightMatrix.inv_comp:
38+
lemma AlgHom.mulLeftRightMatrix.inv_comp :
3939
(AlgHom.mulLeftRightMatrix_inv R n).comp
4040
(AlgHom.mulLeftRight R (Matrix n n R)).toLinearMap = .id :=
4141
Basis.ext (Basis.tensorProduct (Matrix.stdBasis _ _ _)
@@ -44,13 +44,15 @@ lemma AlgHom.mulLeftRightMatrix.inv_comp:
4444
simp [stdBasis_eq_stdBasisMatrix, ite_and, Fintype.sum_prod_type,
4545
mulLeftRight_apply, stdBasisMatrix, Matrix.mul_apply]
4646

47-
lemma AlgHom.mulLeftRightMatrix.comp_inv:
47+
lemma AlgHom.mulLeftRightMatrix.comp_inv :
4848
(AlgHom.mulLeftRight R (Matrix n n R)).toLinearMap.comp
4949
(AlgHom.mulLeftRightMatrix_inv R n) = .id := by
5050
ext f : 1
5151
apply Basis.ext (Matrix.stdBasis _ _ _)
5252
intro ⟨i, j⟩
53-
simp [AlgHom.mulLeftRight_apply, stdBasis_eq_stdBasisMatrix]
53+
simp only [LinearMap.coe_comp, LinearMap.coe_mk, AddHom.coe_mk, Function.comp_apply, map_sum,
54+
_root_.map_smul, stdBasis_eq_stdBasisMatrix, LinearMap.coeFn_sum, Finset.sum_apply,
55+
LinearMap.smul_apply, LinearMap.id_coe, id_eq]
5456
ext k l
5557
simp [sum_apply, Matrix.mul_apply, Finset.sum_mul, Finset.mul_sum, stdBasisMatrix,
5658
Fintype.sum_prod_type, ite_and]

Mathlib/Algebra/Category/Ring/Adjunctions.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ Authors: Kim Morrison, Johannes Hölzl, Andrew Yang
66
import Mathlib.Algebra.Category.Ring.Colimits
77
import Mathlib.Algebra.MvPolynomial.CommRing
88
import Mathlib.CategoryTheory.Comma.Over.Pullback
9-
-- import Mathlib.Algebra.Category.Mon
109

1110
/-!
1211
# Adjunctions in `CommRingCat`

Mathlib/Algebra/Central/Defs.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ variable (k D : Type*) [Field k] [Ring D] [Algebra k D]
4747
variable [Algebra.IsCentral k D] [IsSimpleRing D]
4848
variable [FiniteDimensional k D]
4949
```
50-
where `FiniteDimensional k D` is almost always assumed in most references, but some results does not
50+
where `FiniteDimensional k D` is almost always assumed in most references, but some results do not
5151
need this assumption.
5252
5353
## Tags

Mathlib/Algebra/GCDMonoid/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,7 @@ variable (G₀ : Type*) [CommGroupWithZero G₀] [DecidableEq G₀]
12171217
instance (priority := 100) : NormalizedGCDMonoid G₀ where
12181218
normUnit x := if h : x = 0 then 1 else (Units.mk0 x h)⁻¹
12191219
normUnit_zero := dif_pos rfl
1220-
normUnit_mul := fun {x y} x0 y0 => Units.eq_iff.1 (by simp [x0, y0, mul_comm])
1220+
normUnit_mul {x y} x0 y0 := Units.eq_iff.1 (by simp [x0, y0, mul_comm])
12211221
normUnit_coe_units u := by simp
12221222
gcd a b := if a = 0 ∧ b = 0 then 0 else 1
12231223
lcm a b := if a = 0 ∨ b = 0 then 0 else 1

Mathlib/Algebra/Group/Subgroup/Finite.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,6 @@ theorem card_le_of_le {H K : Subgroup G} [Finite K] (h : H ≤ K) : Nat.card H
152152
theorem card_map_of_injective {H : Type*} [Group H] {K : Subgroup G} {f : G →* H}
153153
(hf : Function.Injective f) :
154154
Nat.card (map f K) = Nat.card K := by
155-
-- simp only [← SetLike.coe_sort_coe]
156155
apply Nat.card_image_of_injective hf
157156

158157
@[to_additive]

Mathlib/Algebra/Group/Submonoid/Basic.lean

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ submonoid, submonoids
5050

5151
assert_not_exists MonoidWithZero
5252

53-
-- Only needed for notation
54-
-- Only needed for notation
5553
variable {M : Type*} {N : Type*}
5654
variable {A : Type*}
5755

Mathlib/Algebra/Lie/Abelian.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,8 @@ def maxTrivHom (f : M →ₗ⁅R,L⁆ N) : maxTrivSubmodule R L M →ₗ⁅R,L
161161
toFun m := ⟨f m, fun x =>
162162
(LieModuleHom.map_lie _ _ _).symm.trans <|
163163
(congr_arg f (m.property x)).trans (LieModuleHom.map_zero _)⟩
164-
map_add' m n := by ext; simp [Function.comp_apply]
165-
map_smul' t m := by ext; simp [Function.comp_apply]
164+
map_add' m n := by ext; simp
165+
map_smul' t m := by ext; simp
166166
map_lie' {x m} := by simp
167167

168168
@[norm_cast, simp]

Mathlib/Algebra/Polynomial/Degree/TrailingDegree.lean

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -285,16 +285,15 @@ theorem le_trailingDegree_mul : p.trailingDegree + q.trailingDegree ≤ (p * q).
285285
obtain ⟨⟨i, j⟩, hij, hpq⟩ := exists_ne_zero_of_sum_ne_zero hn
286286
refine
287287
(add_le_add (min_le (mem_support_iff.mpr (left_ne_zero_of_mul hpq)))
288-
(min_le (mem_support_iff.mpr (right_ne_zero_of_mul hpq)))).trans
289-
(le_of_eq ?_)
288+
(min_le (mem_support_iff.mpr (right_ne_zero_of_mul hpq)))).trans_eq ?_
290289
rwa [← WithTop.coe_add, WithTop.coe_eq_coe, ← mem_antidiagonal]
291290

292291
theorem le_natTrailingDegree_mul (h : p * q ≠ 0) :
293292
p.natTrailingDegree + q.natTrailingDegree ≤ (p * q).natTrailingDegree := by
294293
have hp : p ≠ 0 := fun hp => h (by rw [hp, zero_mul])
295294
have hq : q ≠ 0 := fun hq => h (by rw [hq, mul_zero])
296-
have (p : R[X]) : WithTop.some (natTrailingDegree p) = Nat.cast (natTrailingDegree p) := rfl
297-
rw [← WithTop.coe_le_coe, WithTop.coe_add, this p, this q, this (p * q),
295+
rw [← WithTop.coe_le_coe, WithTop.coe_add, ← Nat.cast_withTop (natTrailingDegree p),
296+
← Nat.cast_withTop (natTrailingDegree q), ← Nat.cast_withTop (natTrailingDegree (p * q)),
298297
← trailingDegree_eq_natTrailingDegree hp, ← trailingDegree_eq_natTrailingDegree hq,
299298
← trailingDegree_eq_natTrailingDegree h]
300299
exact le_trailingDegree_mul
@@ -329,12 +328,10 @@ theorem natTrailingDegree_mul' (h : p.trailingCoeff * q.trailingCoeff ≠ 0) :
329328
(p * q).natTrailingDegree = p.natTrailingDegree + q.natTrailingDegree := by
330329
have hp : p ≠ 0 := fun hp => h (by rw [hp, trailingCoeff_zero, zero_mul])
331330
have hq : q ≠ 0 := fun hq => h (by rw [hq, trailingCoeff_zero, mul_zero])
332-
have aux1 n : Nat.cast n = WithTop.some (n) := rfl
333-
have aux2 (p : R[X]) : WithTop.some (natTrailingDegree p) = Nat.cast (natTrailingDegree p) := rfl
334331
apply natTrailingDegree_eq_of_trailingDegree_eq_some
335-
rw [trailingDegree_mul' h, aux1 (natTrailingDegree p + natTrailingDegree q),
336-
WithTop.coe_add, aux2 p, aux2 q, ← trailingDegree_eq_natTrailingDegree hp, ←
337-
trailingDegree_eq_natTrailingDegree hq]
332+
rw [trailingDegree_mul' h, Nat.cast_withTop (natTrailingDegree p + natTrailingDegree q),
333+
WithTop.coe_add, ← Nat.cast_withTop, ← Nat.cast_withTop,
334+
← trailingDegree_eq_natTrailingDegree hp, ← trailingDegree_eq_natTrailingDegree hq]
338335

339336
theorem natTrailingDegree_mul [NoZeroDivisors R] (hp : p ≠ 0) (hq : q ≠ 0) :
340337
(p * q).natTrailingDegree = p.natTrailingDegree + q.natTrailingDegree :=

Mathlib/Algebra/Polynomial/Expand.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,7 @@ theorem natDegree_expand (p : ℕ) (f : R[X]) : (expand R p f).natDegree = f.nat
133133
by_cases hf : f = 0
134134
· rw [hf, map_zero, natDegree_zero, zero_mul]
135135
have hf1 : expand R p f ≠ 0 := mt (expand_eq_zero hp).1 hf
136-
rw [← WithBot.coe_eq_coe]
137-
convert (degree_eq_natDegree hf1).symm
138-
symm
136+
rw [← Nat.cast_inj (R := WithBot ℕ), ← degree_eq_natDegree hf1]
139137
refine le_antisymm ((degree_le_iff_coeff_zero _ _).2 fun n hn => ?_) ?_
140138
· rw [coeff_expand hp]
141139
split_ifs with hpn

0 commit comments

Comments
 (0)