Skip to content

Commit

Permalink
chore: use _root_.map_sum more consistently (#7189)
Browse files Browse the repository at this point in the history
Also `_root_.map_smul` when in the neighbourhood.
  • Loading branch information
Ruben-VandeVelde committed Sep 16, 2023
1 parent e10f5f8 commit 1fa13fb
Show file tree
Hide file tree
Showing 40 changed files with 65 additions and 67 deletions.
2 changes: 1 addition & 1 deletion Mathlib/Algebra/DirectLimit.lean
Expand Up @@ -203,7 +203,7 @@ theorem toModule_totalize_of_le {x : DirectSum ι G} {i j : ι} (hij : i ≤ j)
f i j hij (DirectSum.toModule R ι (G i) (fun k => totalize G f k i) x) := by
rw [← @DFinsupp.sum_single ι G _ _ _ x]
unfold DFinsupp.sum
simp only [LinearMap.map_sum]
simp only [map_sum]
refine' Finset.sum_congr rfl fun k hk => _
rw [DirectSum.single_eq_lof R k (x k), DirectSum.toModule_lof, DirectSum.toModule_lof,
totalize_of_le (hx k hk), totalize_of_le (le_trans (hx k hk) hij), DirectedSystem.map_map]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Module/Zlattice.lean
Expand Up @@ -105,14 +105,14 @@ def ceil (m : E) : span ℤ (Set.range b) := ∑ i, ⌈b.repr m i⌉ • b.restr
theorem repr_floor_apply (m : E) (i : ι) : b.repr (floor b m) i = ⌊b.repr m i⌋ := by
classical simp only [floor, zsmul_eq_smul_cast K, b.repr.map_smul, Finsupp.single_apply,
Finset.sum_apply', Basis.repr_self, Finsupp.smul_single', mul_one, Finset.sum_ite_eq', coe_sum,
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, LinearEquiv.map_sum]
Finset.mem_univ, if_true, coe_smul_of_tower, Basis.restrictScalars_apply, map_sum]
#align zspan.repr_floor_apply Zspan.repr_floor_apply

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

@[simp]
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Algebra/TrivSqZeroExt.lean
Expand Up @@ -335,7 +335,7 @@ theorem inl_smul [Monoid S] [AddMonoid M] [SMul S R] [DistribMulAction S M] (s :

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

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

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

end
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Analysis/InnerProductSpace/Basic.lean
Expand Up @@ -522,7 +522,7 @@ theorem sum_inner {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) :
/-- An inner product with a sum on the right. -/
theorem inner_sum {ι : Type*} (s : Finset ι) (f : ι → E) (x : E) :
⟪x, ∑ i in s, f i⟫ = ∑ i in s, ⟪x, f i⟫ :=
(LinearMap.flip sesqFormOfInner x).map_sum
map_sum (LinearMap.flip sesqFormOfInner x) _ _
#align inner_sum inner_sum

/-- An inner product with a sum on the left, `Finsupp` version. -/
Expand Down
3 changes: 1 addition & 2 deletions Mathlib/Analysis/InnerProductSpace/Spectrum.lean
Expand Up @@ -262,8 +262,7 @@ theorem eigenvectorBasis_apply_self_apply (v : E) (i : Fin n) :
congr_arg (fun v => (hT.eigenvectorBasis hn).repr v i)
(this ((hT.eigenvectorBasis hn).repr v))
intro w
simp_rw [← OrthonormalBasis.sum_repr_symm, LinearMap.map_sum, LinearMap.map_smul,
apply_eigenvectorBasis]
simp_rw [← OrthonormalBasis.sum_repr_symm, map_sum, map_smul, apply_eigenvectorBasis]
apply Fintype.sum_congr
intro a
rw [smul_smul, mul_comm]
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Matrix/Kronecker.lean
Expand Up @@ -216,7 +216,7 @@ theorem kroneckerMapBilinear_mul_mul [CommSemiring R] [Fintype m] [Fintype m']
ext ⟨i, i'⟩ ⟨j, j'⟩
simp only [kroneckerMapBilinear_apply_apply, mul_apply, ← Finset.univ_product_univ,
Finset.sum_product, kroneckerMap_apply]
simp_rw [f.map_sum, LinearMap.sum_apply, LinearMap.map_sum, h_comm]
simp_rw [map_sum f, LinearMap.sum_apply, map_sum, h_comm]
#align matrix.kronecker_map_bilinear_mul_mul Matrix.kroneckerMapBilinear_mul_mul

/-- `trace` distributes over `Matrix.kroneckerMapBilinear`.
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Matrix/Rank.lean
Expand Up @@ -163,7 +163,7 @@ theorem rank_eq_finrank_range_toLin [DecidableEq n] {M₁ M₂ : Type*} [AddComm
rw [toLin_eq_toLin', toLin'_apply'] at aux₁
rw [Pi.basisFun_apply, LinearMap.coe_stdBasis] at aux₁ aux₂
simp only [LinearMap.comp_apply, LinearEquiv.coe_coe, Equiv.refl_apply, aux₁, aux₂,
LinearMap.coe_single, toLin_self, LinearEquiv.map_sum, LinearEquiv.map_smul, Basis.equiv_apply]
LinearMap.coe_single, toLin_self, map_sum, LinearEquiv.map_smul, Basis.equiv_apply]
#align matrix.rank_eq_finrank_range_to_lin Matrix.rank_eq_finrank_range_toLin

theorem rank_le_card_height [StrongRankCondition R] (A : Matrix m n R) :
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Polynomial/AlgebraMap.lean
Expand Up @@ -510,7 +510,7 @@ end Ring
theorem aeval_endomorphism {M : Type*} [CommRing R] [AddCommGroup M] [Module R M] (f : M →ₗ[R] M)
(v : M) (p : R[X]) : aeval f p v = p.sum fun n b => b • (f ^ n) v := by
rw [aeval_def, eval₂_eq_sum]
exact (LinearMap.applyₗ v).map_sum
exact map_sum (LinearMap.applyₗ v) _ _
#align polynomial.aeval_endomorphism Polynomial.aeval_endomorphism

end Polynomial
4 changes: 2 additions & 2 deletions Mathlib/Data/Polynomial/Coeff.lean
Expand Up @@ -100,7 +100,7 @@ theorem lcoeff_apply (n : ℕ) (f : R[X]) : lcoeff R n f = coeff f n :=
@[simp]
theorem finset_sum_coeff {ι : Type*} (s : Finset ι) (f : ι → R[X]) (n : ℕ) :
coeff (∑ b in s, f b) n = ∑ b in s, coeff (f b) n :=
(lcoeff R n).map_sum
map_sum (lcoeff R n) _ _
#align polynomial.finset_sum_coeff Polynomial.finset_sum_coeff

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

theorem coeff_X_add_C_pow (r : R) (n k : ℕ) :
((X + C r) ^ n).coeff k = r ^ (n - k) * (n.choose k : R) := by
rw [(commute_X (C r : R[X])).add_pow, ← lcoeff_apply, LinearMap.map_sum]
rw [(commute_X (C r : R[X])).add_pow, ← lcoeff_apply, map_sum]
simp only [one_pow, mul_one, lcoeff_apply, ← C_eq_nat_cast, ← C_pow, coeff_mul_C, Nat.cast_id]
rw [Finset.sum_eq_single k, coeff_X_pow_self, one_mul]
· intro _ _ h
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Polynomial/Derivative.lean
Expand Up @@ -163,7 +163,7 @@ set_option linter.uppercaseLean3 false in
--Porting note: removed `simp`: `simp` can prove it.
theorem derivative_sum {s : Finset ι} {f : ι → R[X]} :
derivative (∑ b in s, f b) = ∑ b in s, derivative (f b) :=
derivative.map_sum
map_sum ..
#align polynomial.derivative_sum Polynomial.derivative_sum

--Porting note: removed `simp`: `simp` can prove it.
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Polynomial/HasseDeriv.lean
Expand Up @@ -259,7 +259,7 @@ theorem hasseDeriv_mul (f g : R[X]) :
rw [tsub_add_eq_add_tsub hm, ← add_tsub_assoc_of_le hn, ← tsub_add_eq_tsub_tsub,
add_comm x.2 x.1, mul_assoc, ← mul_assoc r, ← (Nat.cast_commute _ r).eq, mul_assoc, mul_assoc]
rw [Finset.sum_congr rfl aux]
rw [← LinearMap.map_sum, ← Finset.sum_mul]
rw [← map_sum, ← Finset.sum_mul]
congr
rw_mod_cast [←Nat.add_choose_eq]
#align polynomial.hasse_deriv_mul Polynomial.hasseDeriv_mul
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Data/Polynomial/Taylor.lean
Expand Up @@ -77,7 +77,7 @@ theorem taylor_coeff (n : ℕ) : (taylor r f).coeff n = (hasseDeriv n f).eval r
congr 1; clear! f; ext i
simp only [leval_apply, mul_one, one_mul, eval_monomial, LinearMap.comp_apply, coeff_C_mul,
hasseDeriv_monomial, taylor_apply, monomial_comp, C_1, (commute_X (C r)).add_pow i,
LinearMap.map_sum]
map_sum]
simp only [lcoeff_apply, ← C_eq_nat_cast, mul_assoc, ← C_pow, ← C_mul, coeff_mul_C,
(Nat.cast_commute _ _).eq, coeff_X_pow, boole_mul, Finset.sum_ite_eq, Finset.mem_range]
split_ifs with h; · rfl
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/FieldTheory/Finite/Polynomial.lean
Expand Up @@ -142,8 +142,8 @@ theorem map_restrict_dom_evalₗ : (restrictDegree σ K (Fintype.card K - 1)).ma
refine' ⟨∑ n : σ → K, e n • indicator n, _, _⟩
· exact sum_mem fun c _ => smul_mem _ _ (indicator_mem_restrictDegree _)
· ext n
simp only [LinearMap.map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
LinearMap.map_smul]
simp only [_root_.map_sum, @Finset.sum_apply (σ → K) (fun _ => K) _ _ _ _ _, Pi.smul_apply,
map_smul]
simp only [evalₗ_apply]
trans
refine' Finset.sum_eq_single n (fun b _ h => _) _
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/AffineSpace/Combination.lean
Expand Up @@ -639,7 +639,7 @@ theorem map_affineCombination {V₂ P₂ : Type*} [AddCommGroup V₂] [Module k
s.affineCombination_eq_weightedVSubOfPoint_vadd_of_sum_eq_one w (f ∘ p) hw b₂, ←
s.weightedVSubOfPoint_vadd_eq_of_sum_eq_one w (f ∘ p) hw (f b) b₂]
simp only [weightedVSubOfPoint_apply, RingHom.id_apply, AffineMap.map_vadd,
LinearMap.map_smulₛₗ, AffineMap.linearMap_vsub, LinearMap.map_sum, Function.comp_apply]
LinearMap.map_smulₛₗ, AffineMap.linearMap_vsub, map_sum, Function.comp_apply]
#align finset.map_affine_combination Finset.map_affineCombination

variable (k)
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/LinearAlgebra/Alternating.lean
Expand Up @@ -1174,8 +1174,8 @@ theorem MultilinearMap.domCoprod_alternization_coe [DecidableEq ιa] [DecidableE
Equiv.Perm.sign σa • Equiv.Perm.sign σb •
MultilinearMap.domCoprod (a.domDomCongr σa) (b.domDomCongr σb) := by
simp_rw [← MultilinearMap.domCoprod'_apply, MultilinearMap.alternatization_coe]
simp_rw [TensorProduct.sum_tmul, TensorProduct.tmul_sum, LinearMap.map_sum,
TensorProduct.smul_tmul', TensorProduct.tmul_smul]
simp_rw [TensorProduct.sum_tmul, TensorProduct.tmul_sum, _root_.map_sum,
TensorProduct.smul_tmul', TensorProduct.tmul_smul]
rfl
#align multilinear_map.dom_coprod_alternization_coe MultilinearMap.domCoprod_alternization_coe

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/Basic.lean
Expand Up @@ -408,7 +408,7 @@ end
of the canonical basis. -/
theorem pi_apply_eq_sum_univ [Fintype ι] [DecidableEq ι] (f : (ι → R) →ₗ[R] M) (x : ι → R) :
f x = ∑ i, x i • f fun j => if i = j then 1 else 0 := by
conv_lhs => rw [pi_eq_sum_univ x, f.map_sum]
conv_lhs => rw [pi_eq_sum_univ x, map_sum]
refine Finset.sum_congr rfl (fun _ _ => ?_)
rw [map_smul]
#align linear_map.pi_apply_eq_sum_univ LinearMap.pi_apply_eq_sum_univ
Expand Down
6 changes: 3 additions & 3 deletions Mathlib/LinearAlgebra/Basis.lean
Expand Up @@ -276,14 +276,14 @@ variable {M₁ : Type*} [AddCommMonoid M₁] [Module R₁ M₁]
theorem ext {f₁ f₂ : M →ₛₗ[σ] M₁} (h : ∀ i, f₁ (b i) = f₂ (b i)) : f₁ = f₂ := by
ext x
rw [← b.total_repr x, Finsupp.total_apply, Finsupp.sum]
simp only [LinearMap.map_sum, LinearMap.map_smulₛₗ, h]
simp only [map_sum, LinearMap.map_smulₛₗ, h]
#align basis.ext Basis.ext

/-- Two linear equivs are equal if they are equal on basis vectors. -/
theorem ext' {f₁ f₂ : M ≃ₛₗ[σ] M₁} (h : ∀ i, f₁ (b i) = f₂ (b i)) : f₁ = f₂ := by
ext x
rw [← b.total_repr x, Finsupp.total_apply, Finsupp.sum]
simp only [LinearEquiv.map_sum, LinearEquiv.map_smulₛₗ, h]
simp only [map_sum, LinearEquiv.map_smulₛₗ, h]
#align basis.ext' Basis.ext'

/-- Two elements are equal iff their coordinates are equal. -/
Expand Down Expand Up @@ -1065,7 +1065,7 @@ theorem equiv'_symm_apply (f : M → M') (g : M' → M) (hf hg hgf hfg) (i : ι'
theorem sum_repr_mul_repr {ι'} [Fintype ι'] (b' : Basis ι' R M) (x : M) (i : ι) :
(∑ j : ι', b.repr (b' j) i * b'.repr x j) = b.repr x i := by
conv_rhs => rw [← b'.sum_repr x]
simp_rw [LinearEquiv.map_sum, LinearEquiv.map_smul, Finset.sum_apply']
simp_rw [map_sum, map_smul, Finset.sum_apply']
refine' Finset.sum_congr rfl fun j _ => _
rw [Finsupp.smul_apply, smul_eq_mul, mul_comm]
#align basis.sum_repr_mul_repr Basis.sum_repr_mul_repr
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/BilinearForm.lean
Expand Up @@ -443,7 +443,7 @@ theorem sum_left {α} (t : Finset α) (g : α → M) (w : M) :
@[simp]
theorem sum_right {α} (t : Finset α) (w : M) (g : α → M) :
B w (∑ i in t, g i) = ∑ i in t, B w (g i) :=
(BilinForm.toLin' B w).map_sum
map_sum (BilinForm.toLin' B w) _ _
#align bilin_form.sum_right BilinForm.sum_right

variable (R₂)
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/BilinearMap.lean
Expand Up @@ -178,7 +178,7 @@ theorem map_smulₛₗ₂ (f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P) (r

theorem map_sum₂ {ι : Type*} (f : M →ₛₗ[ρ₁₂] N →ₛₗ[σ₁₂] P) (t : Finset ι) (x : ι → M) (y) :
f (∑ i in t, x i) y = ∑ i in t, f (x i) y :=
(flip f y).map_sum
_root_.map_sum (flip f y) _ _
#align linear_map.map_sum₂ LinearMap.map_sum₂

/-- Restricting a bilinear map in the second entry -/
Expand Down
8 changes: 4 additions & 4 deletions Mathlib/LinearAlgebra/Coevaluation.lean
Expand Up @@ -71,8 +71,8 @@ theorem contractLeft_assoc_coevaluation :
simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap]
rw [rid_tmul, one_smul, lid_symm_apply]
simp only [LinearEquiv.coe_toLinearMap, LinearMap.lTensor_tmul, coevaluation_apply_one]
rw [TensorProduct.tmul_sum, LinearEquiv.map_sum]; simp only [assoc_symm_tmul]
rw [LinearMap.map_sum]; simp only [LinearMap.rTensor_tmul, contractLeft_apply]
rw [TensorProduct.tmul_sum, map_sum]; simp only [assoc_symm_tmul]
rw [map_sum]; simp only [LinearMap.rTensor_tmul, contractLeft_apply]
simp only [Basis.coe_dualBasis, Basis.coord_apply, Basis.repr_self_apply, TensorProduct.ite_tmul]
rw [Finset.sum_ite_eq']; simp only [Finset.mem_univ, if_true]
#align contract_left_assoc_coevaluation contractLeft_assoc_coevaluation
Expand All @@ -90,8 +90,8 @@ theorem contractLeft_assoc_coevaluation' :
simp only [LinearMap.coe_comp, Function.comp_apply, LinearEquiv.coe_toLinearMap]
rw [lid_tmul, one_smul, rid_symm_apply]
simp only [LinearEquiv.coe_toLinearMap, LinearMap.rTensor_tmul, coevaluation_apply_one]
rw [TensorProduct.sum_tmul, LinearEquiv.map_sum]; simp only [assoc_tmul]
rw [LinearMap.map_sum]; simp only [LinearMap.lTensor_tmul, contractLeft_apply]
rw [TensorProduct.sum_tmul, map_sum]; simp only [assoc_tmul]
rw [map_sum]; simp only [LinearMap.lTensor_tmul, contractLeft_apply]
simp only [Basis.coord_apply, Basis.repr_self_apply, TensorProduct.tmul_ite]
rw [Finset.sum_ite_eq]; simp only [Finset.mem_univ, if_true]
#align contract_left_assoc_coevaluation' contractLeft_assoc_coevaluation'
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/Contraction.lean
Expand Up @@ -165,7 +165,7 @@ noncomputable def dualTensorHomEquivOfBasis : Module.Dual R M ⊗[R] N ≃ₗ[R]
ext f m
simp only [applyₗ_apply_apply, coeFn_sum, dualTensorHom_apply, mk_apply, id_coe, id.def,
Fintype.sum_apply, Function.comp_apply, Basis.coe_dualBasis, coe_comp, Basis.coord_apply, ←
f.map_smul, (dualTensorHom R M N).map_sum, ← f.map_sum, b.sum_repr])
f.map_smul, _root_.map_sum (dualTensorHom R M N), ← _root_.map_sum f, b.sum_repr])
(by
ext f m
simp only [applyₗ_apply_apply, coeFn_sum, dualTensorHom_apply, mk_apply, id_coe, id.def,
Expand Down
10 changes: 5 additions & 5 deletions Mathlib/LinearAlgebra/Dual.lean
Expand Up @@ -299,7 +299,7 @@ theorem toDual_apply (i j : ι) : b.toDual (b i) (b j) = if i = j then 1 else 0
@[simp]
theorem toDual_total_left (f : ι →₀ R) (i : ι) :
b.toDual (Finsupp.total ι M R b f) (b i) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, LinearMap.map_sum, LinearMap.sum_apply]
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum, LinearMap.sum_apply]
simp_rw [LinearMap.map_smul, LinearMap.smul_apply, toDual_apply, smul_eq_mul, mul_boole,
Finset.sum_ite_eq']
split_ifs with h
Expand All @@ -310,7 +310,7 @@ theorem toDual_total_left (f : ι →₀ R) (i : ι) :
@[simp]
theorem toDual_total_right (f : ι →₀ R) (i : ι) :
b.toDual (b i) (Finsupp.total ι M R b f) = f i := by
rw [Finsupp.total_apply, Finsupp.sum, LinearMap.map_sum]
rw [Finsupp.total_apply, Finsupp.sum, _root_.map_sum]
simp_rw [LinearMap.map_smul, toDual_apply, smul_eq_mul, mul_boole, Finset.sum_ite_eq]
split_ifs with h
· rfl
Expand Down Expand Up @@ -384,7 +384,7 @@ theorem sum_dual_apply_smul_coord (f : Module.Dual R M) :
(∑ x, f (b x) • b.coord x) = f := by
ext m
simp_rw [LinearMap.sum_apply, LinearMap.smul_apply, smul_eq_mul, mul_comm (f _), ← smul_eq_mul, ←
f.map_smul, ← f.map_sum, Basis.coord_apply, Basis.sum_repr]
f.map_smul, ← _root_.map_sum, Basis.coord_apply, Basis.sum_repr]
#align basis.sum_dual_apply_smul_coord Basis.sum_dual_apply_smul_coord

end
Expand Down Expand Up @@ -737,7 +737,7 @@ open Module
variable [DecidableEq ι] (h : DualBases e ε)

theorem dual_lc (l : ι →₀ R) (i : ι) : ε i (DualBases.lc e l) = l i := by
erw [LinearMap.map_sum]
erw [_root_.map_sum]
-- Porting note: cannot get at •
-- simp only [h.eval, map_smul, smul_eq_mul]
rw [Finset.sum_eq_single i]
Expand Down Expand Up @@ -1656,7 +1656,7 @@ theorem dualDistrib_dualDistribInvOfBasis_left_inverse (b : Basis ι R M) (c : B
rintro ⟨i', j'⟩
simp only [dualDistrib, Basis.coe_dualBasis, coe_comp, Function.comp_apply,
dualDistribInvOfBasis_apply, Basis.coord_apply, Basis.tensorProduct_repr_tmul_apply,
Basis.repr_self, ne_eq, LinearMap.map_sum, map_smul, homTensorHomMap_apply, compRight_apply,
Basis.repr_self, ne_eq, _root_.map_sum, map_smul, homTensorHomMap_apply, compRight_apply,
Basis.tensorProduct_apply, coeFn_sum, Finset.sum_apply, smul_apply, LinearEquiv.coe_coe,
map_tmul, lid_tmul, smul_eq_mul, id_coe, id_eq]
rw [Finset.sum_eq_single i, Finset.sum_eq_single j]; simp
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/Finsupp.lean
Expand Up @@ -1161,7 +1161,7 @@ protected theorem Submodule.finsupp_sum_mem {ι β : Type*} [Zero β] (S : Submo
theorem LinearMap.map_finsupp_total (f : M →ₗ[R] N) {ι : Type*} {g : ι → M} (l : ι →₀ R) :
f (Finsupp.total ι M R g l) = Finsupp.total ι N R (f ∘ g) l := by
-- Porting note: `(· ∘ ·)` is required.
simp only [Finsupp.total_apply, Finsupp.total_apply, Finsupp.sum, f.map_sum, f.map_smul, (· ∘ ·)]
simp only [Finsupp.total_apply, Finsupp.total_apply, Finsupp.sum, map_sum, map_smul, (· ∘ ·)]
#align linear_map.map_finsupp_total LinearMap.map_finsupp_total

theorem Submodule.exists_finset_of_mem_iSup {ι : Sort _} (p : ι → Submodule R M) {m : M}
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/FreeModule/PID.lean
Expand Up @@ -210,7 +210,7 @@ theorem Submodule.basis_of_pid_aux [Finite ι] {O : Type*} [AddCommGroup O] [Mod
have mk_y' : (⟨y', y'M⟩ : M) = ∑ i, c i • b'M i :=
Subtype.ext
(show y' = M.subtype _ by
simp only [LinearMap.map_sum, LinearMap.map_smul]
simp only [map_sum, map_smul]
rfl)
have a_smul_y' : a • y' = y := by
refine Subtype.mk_eq_mk.mp (show (a • ⟨y', y'M⟩ : M) = ⟨y, N_le_M yN⟩ from ?_)
Expand Down
10 changes: 4 additions & 6 deletions Mathlib/LinearAlgebra/LinearIndependent.lean
Expand Up @@ -113,7 +113,7 @@ theorem linearIndependent_iff' :
fun hf s g hg i his =>
have h :=
hf (∑ i in s, Finsupp.single i (g i)) <| by
simpa only [LinearMap.map_sum, Finsupp.total_single] using hg
simpa only [map_sum, Finsupp.total_single] using hg
calc
g i = (Finsupp.lapply i : (ι →₀ R) →ₗ[R] R) (Finsupp.single i (g i)) := by
{ rw [Finsupp.lapply_apply, Finsupp.single_eq_same] }
Expand All @@ -122,10 +122,8 @@ theorem linearIndependent_iff' :
Finset.sum_eq_single i
(fun j _hjs hji => by rw [Finsupp.lapply_apply, Finsupp.single_eq_of_ne hji])
fun hnis => hnis.elim his
_ = (∑ j in s, Finsupp.single j (g j)) i :=
(Finsupp.lapply i : (ι →₀ R) →ₗ[R] R).map_sum.symm
_ = 0 := FunLike.ext_iff.1 h i
,
_ = (∑ j in s, Finsupp.single j (g j)) i := (map_sum ..).symm
_ = 0 := FunLike.ext_iff.1 h i,
fun hf l hl =>
Finsupp.ext fun i =>
_root_.by_contradiction fun hni => hni <| hf _ _ hl _ <| Finsupp.mem_support_iff.2 hni⟩
Expand Down Expand Up @@ -262,7 +260,7 @@ theorem LinearIndependent.of_comp (f : M →ₗ[R] M') (hfv : LinearIndependent
LinearIndependent R v :=
linearIndependent_iff'.2 fun s g hg i his =>
have : (∑ i : ι in s, g i • f (v i)) = 0 := by
simp_rw [← f.map_smul, ← f.map_sum, hg, f.map_zero]
simp_rw [← map_smul, ← map_sum, hg, f.map_zero]
linearIndependent_iff'.1 hfv s g this i his
#align linear_independent.of_comp LinearIndependent.of_comp

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/Matrix/Adjugate.lean
Expand Up @@ -154,7 +154,7 @@ theorem cramer_zero [Nontrivial n] : cramer (0 : Matrix n n α) = 0 := by
/-- Use linearity of `cramer` to take it out of a summation. -/
theorem sum_cramer {β} (s : Finset β) (f : β → n → α) :
(∑ x in s, cramer A (f x)) = cramer A (∑ x in s, f x) :=
(LinearMap.map_sum (cramer A)).symm
(map_sum (cramer A) ..).symm
#align matrix.sum_cramer Matrix.sum_cramer

/-- Use linearity of `cramer` and vector evaluation to take `cramer A _ i` out of a summation. -/
Expand Down

0 comments on commit 1fa13fb

Please sign in to comment.