Skip to content

Commit 39f43d5

Browse files
Ruben-VandeVeldekodyvajjha
authored andcommitted
chore: use _root_.map_sum more consistently (#7189)
Also `_root_.map_smul` when in the neighbourhood.
1 parent e400e3a commit 39f43d5

40 files changed

Lines changed: 65 additions & 67 deletions

File tree

Mathlib/Algebra/DirectLimit.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
203203
f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
204204
rw [← @DFinsupp.sum_single ι G _ _ _ x]
205205
unfold DFinsupp.sum
206-
simp only [LinearMap.map_sum]
206+
simp only [map_sum]
207207
refine' Finset.sum_congr rfl fun k hk => _
208208
rw [DirectSum.single_eq_lof R k (x k), DirectSum.toModule_lof, DirectSum.toModule_lof,
209209
totalize_of_le (hx k hk), totalize_of_le (le_trans (hx k hk) hij), DirectedSystem.map_map]

Mathlib/Algebra/Module/Zlattice.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@ def ceil (m : E) : span ℤ (Set.range b) := ∑ i, ⌈b.repr m i⌉ • b.restr
105105
theorem repr_floor_apply (m : E) (i : ι) : b.repr (floor b m) i = ⌊b.repr m i⌋ := by
106106
classical simp only [floor, zsmul_eq_smul_cast K, b.repr.map_smul, Finsupp.single_apply,
107107
Finset.sum_apply', Basis.repr_self, Finsupp.smul_single', mul_one, Finset.sum_ite_eq', coe_sum,
108-
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, LinearEquiv.map_sum]
108+
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, map_sum]
109109
#align zspan.repr_floor_apply Zspan.repr_floor_apply
110110

111111
@[simp]
112112
theorem repr_ceil_apply (m : E) (i : ι) : b.repr (ceil b m) i = ⌈b.repr m i⌉ := by
113113
classical simp only [ceil, zsmul_eq_smul_cast K, b.repr.map_smul, Finsupp.single_apply,
114114
Finset.sum_apply', Basis.repr_self, Finsupp.smul_single', mul_one, Finset.sum_ite_eq', coe_sum,
115-
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, LinearEquiv.map_sum]
115+
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, map_sum]
116116
#align zspan.repr_ceil_apply Zspan.repr_ceil_apply
117117

118118
@[simp]

Mathlib/Algebra/TrivSqZeroExt.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ theorem inl_smul [Monoid S] [AddMonoid M] [SMul S R] [DistribMulAction S M] (s :
335335

336336
theorem inl_sum {ι} [AddCommMonoid R] [AddCommMonoid M] (s : Finset ι) (f : ι → R) :
337337
(inl (∑ i in s, f i) : tsze R M) = ∑ i in s, inl (f i) :=
338-
(LinearMap.inl ℕ _ _).map_sum
338+
map_sum (LinearMap.inl ℕ _ _) _ _
339339
#align triv_sq_zero_ext.inl_sum TrivSqZeroExt.inl_sum
340340

341341
end
@@ -374,7 +374,7 @@ theorem inr_smul [Zero R] [Zero S] [SMulWithZero S R] [SMul S M] (r : S) (m : M)
374374

375375
theorem inr_sum {ι} [AddCommMonoid R] [AddCommMonoid M] (s : Finset ι) (f : ι → M) :
376376
(inr (∑ i in s, f i) : tsze R M) = ∑ i in s, inr (f i) :=
377-
(LinearMap.inr ℕ _ _).map_sum
377+
map_sum (LinearMap.inr ℕ _ _) _ _
378378
#align triv_sq_zero_ext.inr_sum TrivSqZeroExt.inr_sum
379379

380380
end

Mathlib/Analysis/InnerProductSpace/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,7 @@ theorem sum_inner {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) :
522522
/-- An inner product with a sum on the right. -/
523523
theorem inner_sum {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) :
524524
⟪x, ∑ i in s, f i⟫ = ∑ i in s, ⟪x, f i⟫ :=
525-
(LinearMap.flip sesqFormOfInner x).map_sum
525+
map_sum (LinearMap.flip sesqFormOfInner x) _ _
526526
#align inner_sum inner_sum
527527

528528
/-- An inner product with a sum on the left, `Finsupp` version. -/

Mathlib/Analysis/InnerProductSpace/Spectrum.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,7 @@ theorem eigenvectorBasis_apply_self_apply (v : E) (i : Fin n) :
262262
congr_arg (fun v => (hT.eigenvectorBasis hn).repr v i)
263263
(this ((hT.eigenvectorBasis hn).repr v))
264264
intro w
265-
simp_rw [← OrthonormalBasis.sum_repr_symm, LinearMap.map_sum, LinearMap.map_smul,
266-
apply_eigenvectorBasis]
265+
simp_rw [← OrthonormalBasis.sum_repr_symm, map_sum, map_smul, apply_eigenvectorBasis]
267266
apply Fintype.sum_congr
268267
intro a
269268
rw [smul_smul, mul_comm]

Mathlib/Data/Matrix/Kronecker.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ theorem kroneckerMapBilinear_mul_mul [CommSemiring R] [Fintype m] [Fintype m']
216216
ext ⟨i, i'⟩ ⟨j, j'⟩
217217
simp only [kroneckerMapBilinear_apply_apply, mul_apply, ← Finset.univ_product_univ,
218218
Finset.sum_product, kroneckerMap_apply]
219-
simp_rw [f.map_sum, LinearMap.sum_apply, LinearMap.map_sum, h_comm]
219+
simp_rw [map_sum f, LinearMap.sum_apply, map_sum, h_comm]
220220
#align matrix.kronecker_map_bilinear_mul_mul Matrix.kroneckerMapBilinear_mul_mul
221221

222222
/-- `trace` distributes over `Matrix.kroneckerMapBilinear`.

Mathlib/Data/Matrix/Rank.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ theorem rank_eq_finrank_range_toLin [DecidableEq n] {M₁ M₂ : Type*} [AddComm
163163
rw [toLin_eq_toLin', toLin'_apply'] at aux₁
164164
rw [Pi.basisFun_apply, LinearMap.coe_stdBasis] at aux₁ aux₂
165165
simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, Equiv.refl_apply, aux₁, aux₂,
166-
LinearMap.coe_single, toLin_self, LinearEquiv.map_sum, LinearEquiv.map_smul, Basis.equiv_apply]
166+
LinearMap.coe_single, toLin_self, map_sum, LinearEquiv.map_smul, Basis.equiv_apply]
167167
#align matrix.rank_eq_finrank_range_to_lin Matrix.rank_eq_finrank_range_toLin
168168

169169
theorem rank_le_card_height [StrongRankCondition R] (A : Matrix m n R) :

Mathlib/Data/Polynomial/AlgebraMap.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ end Ring
510510
theorem aeval_endomorphism {M : Type*} [CommRing R] [AddCommGroup M] [Module R M] (f : M →ₗ[R] M)
511511
(v : M) (p : R[X]) : aeval f p v = p.sum fun n b => b • (f ^ n) v := by
512512
rw [aeval_def, eval₂_eq_sum]
513-
exact (LinearMap.applyₗ v).map_sum
513+
exact map_sum (LinearMap.applyₗ v) _ _
514514
#align polynomial.aeval_endomorphism Polynomial.aeval_endomorphism
515515

516516
end Polynomial

Mathlib/Data/Polynomial/Coeff.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ theorem lcoeff_apply (n : ℕ) (f : R[X]) : lcoeff R n f = coeff f n :=
100100
@[simp]
101101
theorem finset_sum_coeff {ι : Type*} (s : Finset ι) (f : ι → R[X]) (n : ℕ) :
102102
coeff (∑ b in s, f b) n = ∑ b in s, coeff (f b) n :=
103-
(lcoeff R n).map_sum
103+
map_sum (lcoeff R n) _ _
104104
#align polynomial.finset_sum_coeff Polynomial.finset_sum_coeff
105105

106106
theorem coeff_sum [Semiring S] (n : ℕ) (f : ℕ → R → S[X]) :
@@ -302,7 +302,7 @@ theorem isRegular_X_pow (n : ℕ) : IsRegular (X ^ n : R[X]) := isRegular_X.pow
302302

303303
theorem coeff_X_add_C_pow (r : R) (n k : ℕ) :
304304
((X + C r) ^ n).coeff k = r ^ (n - k) * (n.choose k : R) := by
305-
rw [(commute_X (C r : R[X])).add_pow, ← lcoeff_apply, LinearMap.map_sum]
305+
rw [(commute_X (C r : R[X])).add_pow, ← lcoeff_apply, map_sum]
306306
simp only [one_pow, mul_one, lcoeff_apply, ← C_eq_nat_cast, ← C_pow, coeff_mul_C, Nat.cast_id]
307307
rw [Finset.sum_eq_single k, coeff_X_pow_self, one_mul]
308308
· intro _ _ h

Mathlib/Data/Polynomial/Derivative.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ set_option linter.uppercaseLean3 false in
163163
--Porting note: removed `simp`: `simp` can prove it.
164164
theorem derivative_sum {s : Finset ι} {f : ι → R[X]} :
165165
derivative (∑ b in s, f b) = ∑ b in s, derivative (f b) :=
166-
derivative.map_sum
166+
map_sum ..
167167
#align polynomial.derivative_sum Polynomial.derivative_sum
168168

169169
--Porting note: removed `simp`: `simp` can prove it.

0 commit comments

Comments
 (0)