Skip to content

Commit

Permalink
chore(Order/Filter): protect Filter.map_smul (#8935)
Browse files Browse the repository at this point in the history
We use `SMulHomClass.map_smul` much more often, even when the `Filter` namespace is opened.
  • Loading branch information
urkud committed Dec 9, 2023
1 parent a4d7dad commit 0629511
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
4 changes: 2 additions & 2 deletions Mathlib/Algebra/Category/ModuleCat/Free.lean
Expand Up @@ -112,14 +112,14 @@ theorem span_exact (he : Exact f g) (huv : u ∘ Sum.inl = f ∘ v)
· rw [(exact_iff _ _).mp he]
simp only [LinearMap.mem_ker, map_sub, sub_eq_zero]
rw [← hm, map_finsupp_sum]
simp only [Function.comp_apply, SMulHomClass.map_smul]
simp only [Function.comp_apply, map_smul]
obtain ⟨n, hnm⟩ := hsub
have hn : n ∈ span R (range v) := hv mem_top
rw [Finsupp.mem_span_range_iff_exists_finsupp] at hn
obtain ⟨cn, hn⟩ := hn
rw [← hn, map_finsupp_sum] at hnm
rw [← sub_add_cancel m m', ← hnm,]
simp only [SMulHomClass.map_smul]
simp only [map_smul]
have hn' : (Finsupp.sum cn fun a b ↦ b • f (v a)) =
(Finsupp.sum cn fun a b ↦ b • u (Sum.inl a)) := by
congr with a b
Expand Down
2 changes: 1 addition & 1 deletion Mathlib/Algebra/Module/Submodule/Bilinear.lean
Expand Up @@ -71,7 +71,7 @@ theorem map₂_span_span (f : M →ₗ[R] N →ₗ[R] P) (s : Set M) (t : Set N)
exact subset_span ⟨_, _, ‹_›, ‹_›, rfl⟩
all_goals intros; simp only [*, add_mem, smul_mem, zero_mem, _root_.map_zero, map_add,
LinearMap.zero_apply, LinearMap.add_apply, LinearMap.smul_apply,
SMulHomClass.map_smul]
map_smul]
· rw [span_le]
rintro _ ⟨a, b, ha, hb, rfl⟩
exact apply_mem_map₂ _ (subset_span ha) (subset_span hb)
Expand Down
4 changes: 2 additions & 2 deletions Mathlib/Analysis/InnerProductSpace/PiL2.lean
Expand Up @@ -369,7 +369,7 @@ instance instFunLike : FunLike (OrthonormalBasis ι 𝕜 E) ι fun _ => E where
have : k = k • (1 : 𝕜) := by rw [smul_eq_mul, mul_one]
rw [this, Pi.single_smul]
replace h := congr_fun h i
simp only [LinearEquiv.comp_coe, SMulHomClass.map_smul, LinearEquiv.coe_coe,
simp only [LinearEquiv.comp_coe, map_smul, LinearEquiv.coe_coe,
LinearEquiv.trans_apply, WithLp.linearEquiv_symm_apply, WithLp.equiv_symm_single,
LinearIsometryEquiv.coe_toLinearEquiv] at h ⊢
rw [h]
Expand Down Expand Up @@ -457,7 +457,7 @@ protected theorem sum_inner_mul_inner (b : OrthonormalBasis ι 𝕜 E) (x y : E)
have := congr_arg (innerSL 𝕜 x) (b.sum_repr y)
rw [map_sum] at this
convert this
rw [SMulHomClass.map_smul, b.repr_apply_apply, mul_comm]
rw [map_smul, b.repr_apply_apply, mul_comm]
simp only [innerSL_apply, smul_eq_mul] -- Porting note: was `rfl`
#align orthonormal_basis.sum_inner_mul_inner OrthonormalBasis.sum_inner_mul_inner

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/LinearAlgebra/Basis.lean
Expand Up @@ -1257,7 +1257,7 @@ theorem coord_unitsSMul (e : Basis ι R₂ M) (w : ι → R₂ˣ) (i : ι) :
· congr
simp [Basis.unitsSMul, ← mul_smul]
simp only [Basis.coord_apply, LinearMap.smul_apply, Basis.repr_self, Units.smul_def,
SMulHomClass.map_smul, Finsupp.single_apply]
map_smul, Finsupp.single_apply]
split_ifs with h <;> simp [h]
#align basis.coord_units_smul Basis.coord_unitsSMul

Expand Down
2 changes: 1 addition & 1 deletion Mathlib/MeasureTheory/Function/LpSpace.lean
Expand Up @@ -1179,7 +1179,7 @@ def compLpₗ (L : E →L[𝕜] F) : Lp E p μ →ₗ[𝕜] Lp F p μ where
ext1
filter_upwards [Lp.coeFn_smul c f, coeFn_compLp L (c • f), Lp.coeFn_smul c (L.compLp f),
coeFn_compLp L f] with _ ha1 ha2 ha3 ha4
simp only [ha1, ha2, ha3, ha4, SMulHomClass.map_smul, Pi.smul_apply]
simp only [ha1, ha2, ha3, ha4, map_smul, Pi.smul_apply]
#align continuous_linear_map.comp_Lpₗ ContinuousLinearMap.compLpₗ

/-- Composing `f : Lp E p μ` with `L : E →L[𝕜] F`, seen as a continuous `𝕜`-linear map on
Expand Down
11 changes: 5 additions & 6 deletions Mathlib/Order/Filter/Pointwise.lean
Expand Up @@ -1180,14 +1180,13 @@ protected def instSMulFilter : SMul α (Filter β) :=
scoped[Pointwise] attribute [instance] Filter.instSMulFilter Filter.instVAddFilter

@[to_additive (attr := simp)]
theorem map_smul : map (fun b => a • b) f = a • f :=
protected theorem map_smul : map (fun b => a • b) f = a • f :=
rfl
#align filter.map_smul Filter.map_smul
#align filter.map_vadd Filter.map_vadd

@[to_additive]
theorem mem_smul_filter : s ∈ a • f ↔ (a • ·) ⁻¹' s ∈ f :=
Iff.rfl
theorem mem_smul_filter : s ∈ a • f ↔ (a • ·) ⁻¹' s ∈ f := Iff.rfl
#align filter.mem_smul_filter Filter.mem_smul_filter
#align filter.mem_vadd_filter Filter.mem_vadd_filter

Expand Down Expand Up @@ -1274,7 +1273,7 @@ instance smulCommClass [SMul α γ] [SMul β γ] [SMulCommClass α β γ] :
@[to_additive vaddAssocClass]
instance isScalarTower [SMul α β] [SMul α γ] [SMul β γ] [IsScalarTower α β γ] :
IsScalarTower α β (Filter γ) :=
fun a b f => by simp only [← map_smul, map_map, smul_assoc]; rfl⟩
fun a b f => by simp only [← Filter.map_smul, map_map, smul_assoc]; rfl⟩
#align filter.is_scalar_tower Filter.isScalarTower
#align filter.vadd_assoc_class Filter.vaddAssocClass

Expand Down Expand Up @@ -1316,8 +1315,8 @@ protected def mulAction [Monoid α] [MulAction α β] : MulAction (Filter α) (F
@[to_additive "An additive action of an additive monoid on a type `β` gives an additive action on
`Filter β`."]
protected def mulActionFilter [Monoid α] [MulAction α β] : MulAction α (Filter β) where
mul_smul a b f := by simp only [← map_smul, map_map, Function.comp, ← mul_smul]
one_smul f := by simp only [← map_smul, one_smul, map_id']
mul_smul a b f := by simp only [← Filter.map_smul, map_map, Function.comp, ← mul_smul]
one_smul f := by simp only [← Filter.map_smul, one_smul, map_id']
#align filter.mul_action_filter Filter.mulActionFilter
#align filter.add_action_filter Filter.addActionFilter

Expand Down
6 changes: 3 additions & 3 deletions Mathlib/Topology/Algebra/UniformConvergence.lean
Expand Up @@ -237,13 +237,13 @@ theorem UniformOnFun.continuousSMul_induced_of_image_bounded (h𝔖₁ : 𝔖.No
refine' ⟨U, hU, ⟨S, W⟩, ⟨hS, hW⟩, _⟩
rw [Set.smul_subset_iff]
intro a ha u hu x hx
rw [SMulHomClass.map_smul]
rw [map_smul]
exact hUW (⟨ha, hu x hx⟩ : (a, φ u x) ∈ U ×ˢ W)
· rintro a ⟨S, V⟩ ⟨hS, hV⟩
have : Tendsto (fun x : E => a • x) (𝓝 0) (𝓝 <| a • (0 : E)) := tendsto_id.const_smul a
rw [smul_zero] at this
refine' ⟨⟨S, (a • ·) ⁻¹' V⟩, ⟨hS, this hV⟩, fun f hf x hx => _⟩
rw [SMulHomClass.map_smul]
rw [map_smul]
exact hf x hx
· rintro u ⟨S, V⟩ ⟨hS, hV⟩
rcases h u S hS hV with ⟨r, hrpos, hr⟩
Expand All @@ -253,7 +253,7 @@ theorem UniformOnFun.continuousSMul_induced_of_image_bounded (h𝔖₁ : 𝔖.No
· rw [ha0]
simpa using mem_of_mem_nhds hV
· rw [mem_ball_zero_iff] at ha
rw [SMulHomClass.map_smul, Pi.smul_apply]
rw [map_smul, Pi.smul_apply]
have : φ u x ∈ a⁻¹ • V := by
have ha0 : 0 < ‖a‖ := norm_pos_iff.mpr ha0
refine' (hr a⁻¹ _) (Set.mem_image_of_mem (φ u) hx)
Expand Down

0 comments on commit 0629511

Please sign in to comment.