Skip to content

Commit f7670fa

Browse files
mcdollReemMelamed
authored andcommitted
feat(Topology/Algebra): use Is*Apply for ContinuousLinearMap (leanprover-community#39637)
This is the first in many PRs that use the new `Is*Apply` classes instead of structure specific `foo_apply` lemmas. The main bulk of the PR is in Mathlib/Topology/Algebra/Module/ContinuousLinearMap/Basic.lean, everything else is just fixing errors. For each `foo` in `zero`, `one`, `add`, `sub`, `neg`, smul` we do the following: - add an instance `IsFooApply` - rename `coe_foo` to `toLinearMap_foo` - depreprecate `coe_foo`, `coe_foo'`, and `foo_apply` We are rather conservative when it comes to the instances, in future PRs this will be used more. For consistency, the same renaming has been applied to the `comp` variants. This resulted in a test being changed.
1 parent bdebf53 commit f7670fa

109 files changed

Lines changed: 386 additions & 405 deletions

File tree

Some content is hidden

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

Archive/Sensitivity.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ using only the addition of `V`. -/
285285
set_option backward.isDefEq.respectTransparency false in
286286
theorem f_squared (v : V n) : (f n) (f n v) = (n : ℝ) • v := by
287287
induction n with
288-
| zero => simp only [Nat.cast_zero, zero_smul, f_zero, zero_apply]
288+
| zero => simp only [Nat.cast_zero, zero_smul, f_zero, LinearMap.zero_apply]
289289
| succ n IH =>
290290
cases v; rw [f_succ_apply, f_succ_apply]; simp [IH, add_smul (n : ℝ) 1, add_assoc]; abel
291291

Mathlib/Algebra/Category/ModuleCat/Topology/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ section
143143
variable {M₁ M₂ : TopModuleCat R}
144144

145145
@[simp] lemma hom_zero : (0 : M₁ ⟶ M₂).hom = 0 := rfl
146-
@[simp] lemma hom_zero_apply (m : M₁) : (0 : M₁ ⟶ M₂).hom m = 0 := rfl
146+
lemma hom_zero_apply (m : M₁) : (0 : M₁ ⟶ M₂).hom m = 0 := rfl
147147
@[simp] lemma hom_add (φ₁ φ₂ : M₁ ⟶ M₂) : (φ₁ + φ₂).hom = φ₁.hom + φ₂.hom := rfl
148148
@[simp] lemma hom_neg (φ : M₁ ⟶ M₂) : (-φ).hom = -φ.hom := rfl
149149
@[simp] lemma hom_sub (φ₁ φ₂ : M₁ ⟶ M₂) : (φ₁ - φ₂).hom = φ₁.hom - φ₂.hom := rfl

Mathlib/Algebra/Category/ModuleCat/Topology/Homology.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def isColimitCoker : IsColimit (CokernelCofork.ofπ (cokerπ φ) (comp_cokerπ
8585
(fun s ↦ ofHom <|
8686
{ toLinearMap := φ.hom.range.liftQ s.π.hom.toLinearMap
8787
(LinearMap.range_le_ker_iff.mpr <| show (φ ≫ s.π).hom.toLinearMap = 0 by
88-
rw [s.condition, hom_zero, ContinuousLinearMap.coe_zero])
88+
rw [s.condition, hom_zero, ContinuousLinearMap.toLinearMap_zero])
8989
cont := Continuous.quotient_lift s.π.hom.2 _ })
9090
(fun s ↦ rfl)
9191
(fun s m h ↦ by dsimp at h ⊢; rw [← cancel_epi (cokerπ φ), h]; rfl)
@@ -113,7 +113,7 @@ instance : CategoryWithHomology (TopModuleCat R) := by
113113
(Submodule.isOpenQuotientMap_mkQ _).isQuotientMap
114114
(Submodule.isOpenQuotientMap_mkQ _)
115115
(Subtype.val_injective.comp hF.1) ?_
116-
· rw [← ContinuousLinearMap.coe_comp', ← ContinuousLinearMap.coe_comp',
116+
· rw [← ContinuousLinearMap.coe_comp, ← ContinuousLinearMap.coe_comp,
117117
← hom_comp, ← hom_comp, ShortComplex.π_leftRightHomologyComparison'_ι]
118118
· suffices ∀ x y, S.g y = 0 → D₂.p y = D₂.p x → S.g x = 0 by
119119
simpa [Set.subset_def, D₁, kerι_apply S.g] using this

Mathlib/Analysis/Analytic/Binomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ theorem one_div_sub_pow_hasFPowerSeriesOnBall_zero (a : ℕ) {z : ℂ} (hz : z
183183
rw [← map_zero (z⁻¹ • 1 : ℂ →L[ℂ] ℂ)] at this
184184
have := this.compContinuousLinearMap
185185
have H : 1 / ‖(z⁻¹ • 1 : ℂ →L[ℂ] ℂ)‖ₑ = ‖z‖ₑ := by simp [enorm_smul, enorm_inv, hz]
186-
simp only [one_div, ContinuousLinearMap.coe_smul', H, Function.comp_def] at this
186+
simp only [one_div, FunLike.coe_smul, H, Function.comp_def] at this
187187
convert! (this.const_smul (c := (z ^ (a + 1))⁻¹)).congr ?_ using 2
188188
· ext n
189189
simp only [FormalMultilinearSeries.smul_apply, ContinuousMultilinearMap.smul_apply,

Mathlib/Analysis/Analytic/IteratedFDeriv.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ lemma FormalMultilinearSeries.iteratedFDerivSeries_eq_zero {k n : ℕ}
100100
ContinuousLinearMap.compContinuousMultilinearMap_coe, ContinuousLinearEquiv.coe_coe,
101101
LinearIsometryEquiv.coe_toContinuousLinearEquiv, Function.comp_apply,
102102
continuousMultilinearCurryLeftEquiv_symm_apply, ContinuousMultilinearMap.zero_apply,
103-
ContinuousLinearMap.zero_apply,
103+
_root_.zero_apply,
104104
derivSeries_eq_zero _ (ih (p.congr_zero (Nat.succ_add_eq_add_succ _ _).symm h))]
105105

106106
/-- If the `n`-th term in a power series is zero, then the `n`-th derivative of the corresponding

Mathlib/Analysis/CStarAlgebra/CStarMatrix.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,13 +485,13 @@ noncomputable def toCLM : CStarMatrix m n A →ₗ[ℂ] C⋆ᵐᵒᵈ(A, m → A
485485
ext
486486
simp only [ContinuousLinearMap.coe_mk', LinearMap.coe_mk, AddHom.coe_mk, Function.comp_apply,
487487
WithCStarModule.equivL_apply, WithCStarModule.equivL_symm_apply,
488-
WithCStarModule.equiv_symm_pi_apply, ContinuousLinearMap.add_apply, WithCStarModule.add_apply]
488+
WithCStarModule.equiv_symm_pi_apply, _root_.add_apply, WithCStarModule.add_apply]
489489
rw [Matrix.vecMul_add, Pi.add_apply]
490490
map_smul' c M := by
491491
ext x i
492492
simp only [ContinuousLinearMap.coe_mk', LinearMap.coe_mk, AddHom.coe_mk, Function.comp_apply,
493493
WithCStarModule.equivL_apply, WithCStarModule.equivL_symm_apply,
494-
WithCStarModule.equiv_symm_pi_apply, ContinuousLinearMap.smul_apply,
494+
WithCStarModule.equiv_symm_pi_apply, _root_.smul_apply,
495495
WithCStarModule.smul_apply, RingHom.id_apply]
496496
rw [Matrix.vecMul_smul, Pi.smul_apply]
497497

Mathlib/Analysis/CStarAlgebra/Multiplier.lean

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ instance instAdd : Add 𝓜(𝕜, A) where
113113
{ toProd := a.toProd + b.toProd
114114
central := fun x y =>
115115
show (a.snd + b.snd) x * y = x * (a.fst + b.fst) y by
116-
simp only [ContinuousLinearMap.add_apply, mul_add, add_mul, central] }
116+
simp only [add_apply, mul_add, add_mul, central] }
117117

118118
instance instZero : Zero 𝓜(𝕜, A) where
119119
zero :=
@@ -132,7 +132,7 @@ instance instSub : Sub 𝓜(𝕜, A) where
132132
{ toProd := a.toProd - b.toProd
133133
central := fun x y =>
134134
show (a.snd - b.snd) x * y = x * (a.fst - b.fst) y by
135-
simp only [ContinuousLinearMap.sub_apply, _root_.sub_mul, _root_.mul_sub, central] }
135+
simp only [sub_apply, _root_.sub_mul, _root_.mul_sub, central] }
136136

137137
section Scalars
138138

@@ -144,7 +144,7 @@ instance instSMul : SMul S 𝓜(𝕜, A) where
144144
{ toProd := s • a.toProd
145145
central := fun x y =>
146146
show (s • a.snd) x * y = x * (s • a.fst) y by
147-
simp only [ContinuousLinearMap.smul_apply, mul_smul_comm, smul_mul_assoc, central] }
147+
simp only [smul_apply, mul_smul_comm, smul_mul_assoc, central] }
148148

149149
@[simp]
150150
theorem smul_toProd (s : S) (a : 𝓜(𝕜, A)) : (s • a).toProd = s • a.toProd :=
@@ -184,13 +184,15 @@ instance instNatCast : NatCast 𝓜(𝕜, A) where
184184
natCast n :=
185185
⟨n, fun x y => by
186186
rw [Prod.snd_natCast, Prod.fst_natCast]
187-
simp only [← Nat.smul_one_eq_cast, smul_apply, one_apply, mul_smul_comm, smul_mul_assoc]⟩
187+
simp only [← Nat.smul_one_eq_cast, smul_apply, one_apply_eq_self, mul_smul_comm,
188+
smul_mul_assoc]⟩
188189

189190
instance instIntCast : IntCast 𝓜(𝕜, A) where
190191
intCast n :=
191192
⟨n, fun x y => by
192193
rw [Prod.snd_intCast, Prod.fst_intCast]
193-
simp only [← Int.smul_one_eq_cast, smul_apply, one_apply, mul_smul_comm, smul_mul_assoc]⟩
194+
simp only [← Int.smul_one_eq_cast, smul_apply, one_apply_eq_self, mul_smul_comm,
195+
smul_mul_assoc]⟩
194196

195197
instance instPow : Pow 𝓜(𝕜, A) ℕ where
196198
pow a n :=
@@ -199,7 +201,7 @@ instance instPow : Pow 𝓜(𝕜, A) ℕ where
199201
| zero => rfl
200202
| succ k hk =>
201203
rw [Prod.pow_snd, Prod.pow_fst] at hk ⊢
202-
rw [pow_succ' a.snd, mul_apply, a.central, hk, pow_succ a.fst, mul_apply]⟩
204+
rw [pow_succ' a.snd, mul_apply_eq_comp, a.central, hk, pow_succ a.fst, mul_apply_eq_comp]⟩
203205

204206
instance instInhabited : Inhabited 𝓜(𝕜, A) :=
205207
0
@@ -347,8 +349,8 @@ instance instAlgebra : Algebra 𝕜 𝓜(𝕜, A) where
347349
{ toFun k :=
348350
{ toProd := algebraMap 𝕜 ((A →L[𝕜] A) × (A →L[𝕜] A)) k
349351
central := fun x y => by
350-
simp_rw [Prod.algebraMap_apply, Algebra.algebraMap_eq_smul_one, smul_apply, one_apply,
351-
mul_smul_comm, smul_mul_assoc] }
352+
simp_rw [Prod.algebraMap_apply, Algebra.algebraMap_eq_smul_one, smul_apply,
353+
one_apply_eq_self, mul_smul_comm, smul_mul_assoc] }
352354
map_one' := ext (𝕜 := 𝕜) (A := A) _ _ <| map_one <| algebraMap 𝕜 ((A →L[𝕜] A) × (A →L[𝕜] A))
353355
map_mul' _ _ :=
354356
ext (𝕜 := 𝕜) (A := A) _ _ <|
@@ -611,7 +613,7 @@ instance instCStarRing : CStarRing 𝓜(𝕜, A) where
611613
(a.fst.le_opNorm_of_le hy))
612614
_ ≤ ‖a‖₊ * ‖a‖₊ := by simp only [mul_one, nnnorm_fst, le_rfl]
613615
rw [← nnnorm_snd]
614-
simp only [mul_snd, ← sSup_unitClosedBall_eq_nnnorm, star_snd, mul_apply]
616+
simp only [mul_snd, ← sSup_unitClosedBall_eq_nnnorm, star_snd, mul_apply_eq_comp]
615617
simp only [← @opNNNorm_mul_apply 𝕜 _ A]
616618
simp only [← sSup_unitClosedBall_eq_nnnorm, mul_apply']
617619
refine csSup_eq_of_forall_le_of_forall_lt_exists_gt (hball.image _) ?_ fun r hr => ?_

Mathlib/Analysis/CStarAlgebra/Unitization.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ theorem Unitization.norm_splitMul_snd_sq (x : Unitization 𝕜 E) :
9898
simp only
9999
-- rewrite to a more convenient form; this is where we use the C⋆-property
100100
rw [← Real.sqrt_sq (norm_nonneg _), Real.sqrt_le_sqrt_iff (norm_nonneg _), sq,
101-
← CStarRing.norm_star_mul_self, ContinuousLinearMap.add_apply, star_add, mul_apply',
102-
Algebra.algebraMap_eq_smul_one, ContinuousLinearMap.smul_apply,
103-
ContinuousLinearMap.one_apply, star_mul, star_smul, add_mul, smul_mul_assoc, ← mul_smul_comm,
101+
← CStarRing.norm_star_mul_self, add_apply, star_add, mul_apply',
102+
Algebra.algebraMap_eq_smul_one, smul_apply,
103+
one_apply_eq_self, star_mul, star_smul, add_mul, smul_mul_assoc, ← mul_smul_comm,
104104
mul_assoc, ← mul_add, ← sSup_unitClosedBall_eq_norm]
105105
refine (norm_mul_le _ _).trans ?_
106106
calc
@@ -119,9 +119,9 @@ theorem Unitization.norm_splitMul_snd_sq (x : Unitization 𝕜 E) :
119119
simpa only [mul_one] using!
120120
mul_le_mul_of_nonneg_left (mem_closedBall_zero_iff.1 hy) (norm_nonneg (star x * x).fst)
121121
· exact (unit_le_opNorm _ y <| mem_closedBall_zero_iff.1 hy).trans (opNorm_mul_apply_le _ _ _)
122-
· simp only [ContinuousLinearMap.add_apply, mul_apply', Unitization.snd_star, Unitization.snd_mul,
122+
· simp only [add_apply, mul_apply', Unitization.snd_star, Unitization.snd_mul,
123123
Unitization.fst_mul, Unitization.fst_star, Algebra.algebraMap_eq_smul_one, smul_apply,
124-
one_apply, smul_add, mul_add, add_mul]
124+
one_apply_eq_self, smul_add, mul_add, add_mul]
125125
simp only [smul_smul, smul_mul_assoc, ← add_assoc, ← mul_assoc, mul_smul_comm]
126126

127127
variable {𝕜}

Mathlib/Analysis/Calculus/AbsolutelyMonotone.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ theorem smul {c : ℝ} (hf : AbsolutelyMonotoneOn f s) (hc : 0 ≤ c) :
116116
have hcomp : (T ∘ f) = c • f := by ext x; simp [hT, smul_eq_mul]
117117
refine ⟨_, hcomp ▸ hp.continuousLinearMap_comp T, fun n x hx => ?_⟩
118118
simp only [ContinuousLinearMap.compContinuousMultilinearMap_coe, Function.comp_apply, hT,
119-
ContinuousLinearMap.smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul]
119+
smul_apply, ContinuousLinearMap.id_apply, smul_eq_mul]
120120
exact mul_nonneg hc (hp_nn n hx)
121121

122122
end AbsolutelyMonotoneOn

Mathlib/Analysis/Calculus/ContDiff/Basic.lean

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,10 +277,7 @@ theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_left (g : F ≃L[𝕜] G
277277
fderivWithin_congr' (@IH) hx
278278
simp_rw [Z]
279279
rw [(g.continuousMultilinearMapCongrRight fun _ : Fin i => E).comp_fderivWithin (hs x hx)]
280-
simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_apply,
281-
ContinuousLinearEquiv.continuousMultilinearMapCongrRight_apply,
282-
ContinuousLinearMap.compContinuousMultilinearMap_coe, EmbeddingLike.apply_eq_iff_eq]
283-
rw [iteratedFDerivWithin_succ_apply_left]
280+
simp [iteratedFDerivWithin_succ_apply_left]
284281

285282
/-- Iterated derivatives commute with left composition by continuous linear equivalences. -/
286283
theorem ContinuousLinearEquiv.iteratedFDeriv_comp_left {f : E → F} {x : E} (g : F ≃L[𝕜] G) {i : ℕ} :
@@ -452,11 +449,11 @@ theorem ContinuousLinearEquiv.iteratedFDerivWithin_comp_right (g : G ≃L[𝕜]
452449
(iteratedFDerivWithin 𝕜 i f s ∘ g)) (g ⁻¹' s) x :=
453450
fderivWithin_congr' (@IH) hx
454451
rw [this, ContinuousLinearEquiv.comp_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx)]
455-
simp only [ContinuousLinearMap.coe_comp', ContinuousLinearEquiv.coe_coe, comp_apply,
452+
simp only [ContinuousLinearMap.comp_apply, ContinuousLinearEquiv.coe_coe,
456453
ContinuousLinearEquiv.continuousMultilinearMapCongrLeft_apply,
457454
ContinuousMultilinearMap.compContinuousLinearMap_apply]
458455
rw [ContinuousLinearEquiv.comp_right_fderivWithin _ (g.uniqueDiffOn_preimage_iff.2 hs x hx),
459-
ContinuousLinearMap.coe_comp', coe_coe, comp_apply, tail_def, tail_def]
456+
ContinuousLinearMap.comp_apply, coe_coe, tail_def, tail_def]
460457

461458
/-- The iterated derivative of the composition with a linear map on the right is
462459
obtained by composing the iterated derivative with the linear map. -/

0 commit comments

Comments
 (0)