Skip to content

Commit 7a9e177

Browse files
committed
refactor: make ContinuousLinearMap.id protected (leanprover-community#30362)
As it is for many other kinds of homomorphisms.
1 parent 3c90d00 commit 7a9e177

File tree

10 files changed

+40
-38
lines changed

10 files changed

+40
-38
lines changed

Mathlib/Analysis/Calculus/Conformal/NormedSpace.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def ConformalAt (f : X → Y) (x : X) :=
5555
∃ f' : X →L[ℝ] Y, HasFDerivAt f f' x ∧ IsConformalMap f'
5656

5757
theorem conformalAt_id (x : X) : ConformalAt _root_.id x :=
58-
⟨id ℝ X, hasFDerivAt_id _, isConformalMap_id⟩
58+
.id ℝ X, hasFDerivAt_id _, isConformalMap_id⟩
5959

6060
theorem conformalAt_const_smul {c : ℝ} (h : c ≠ 0) (x : X) : ConformalAt (fun x' : X => c • x') x :=
6161
⟨c • ContinuousLinearMap.id ℝ X, (hasFDerivAt_id x).const_smul c, isConformalMap_const_smul h⟩

Mathlib/Analysis/Calculus/FDeriv/Add.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,11 +944,11 @@ theorem hasFDerivAt_sub_const_iff (c : F) : HasFDerivAt (f · - c) f' x ↔ HasF
944944
alias ⟨_, HasFDerivAt.sub_const⟩ := hasFDerivAt_sub_const_iff
945945

946946
@[fun_prop]
947-
theorem hasStrictFDerivAt_sub_const {x : F} (c : F) : HasStrictFDerivAt (· - c) (id 𝕜 F) x :=
947+
theorem hasStrictFDerivAt_sub_const {x : F} (c : F) : HasStrictFDerivAt (· - c) (.id 𝕜 F) x :=
948948
(hasStrictFDerivAt_id x).sub_const c
949949

950950
@[fun_prop]
951-
theorem hasFDerivAt_sub_const {x : F} (c : F) : HasFDerivAt (· - c) (id 𝕜 F) x :=
951+
theorem hasFDerivAt_sub_const {x : F} (c : F) : HasFDerivAt (· - c) (.id 𝕜 F) x :=
952952
(hasFDerivAt_id x).sub_const c
953953

954954
@[fun_prop]

Mathlib/Analysis/Calculus/FDeriv/Basic.lean

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -713,18 +713,18 @@ section id
713713
/-! ### Derivative of the identity -/
714714

715715
@[fun_prop]
716-
theorem hasStrictFDerivAt_id (x : E) : HasStrictFDerivAt id (id 𝕜 E) x :=
716+
theorem hasStrictFDerivAt_id (x : E) : HasStrictFDerivAt id (.id 𝕜 E) x :=
717717
.of_isLittleOTVS <| (IsLittleOTVS.zero _ _).congr_left <| by simp
718718

719-
theorem hasFDerivAtFilter_id (x : E) (L : Filter E) : HasFDerivAtFilter id (id 𝕜 E) x L :=
719+
theorem hasFDerivAtFilter_id (x : E) (L : Filter E) : HasFDerivAtFilter id (.id 𝕜 E) x L :=
720720
.of_isLittleOTVS <| (IsLittleOTVS.zero _ _).congr_left <| by simp
721721

722722
@[fun_prop]
723-
theorem hasFDerivWithinAt_id (x : E) (s : Set E) : HasFDerivWithinAt id (id 𝕜 E) s x :=
723+
theorem hasFDerivWithinAt_id (x : E) (s : Set E) : HasFDerivWithinAt id (.id 𝕜 E) s x :=
724724
hasFDerivAtFilter_id _ _
725725

726726
@[fun_prop]
727-
theorem hasFDerivAt_id (x : E) : HasFDerivAt id (id 𝕜 E) x :=
727+
theorem hasFDerivAt_id (x : E) : HasFDerivAt id (.id 𝕜 E) x :=
728728
hasFDerivAtFilter_id _ _
729729

730730
@[simp, fun_prop]
@@ -761,14 +761,14 @@ theorem differentiableOn_id : DifferentiableOn 𝕜 id s :=
761761
differentiable_id.differentiableOn
762762

763763
@[simp]
764-
theorem fderiv_id : fderiv 𝕜 id x = id 𝕜 E :=
764+
theorem fderiv_id : fderiv 𝕜 id x = .id 𝕜 E :=
765765
HasFDerivAt.fderiv (hasFDerivAt_id x)
766766

767767
@[simp]
768768
theorem fderiv_id' : fderiv 𝕜 (fun x : E => x) x = ContinuousLinearMap.id 𝕜 E :=
769769
fderiv_id
770770

771-
theorem fderivWithin_id (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 id s x = id 𝕜 E := by
771+
theorem fderivWithin_id (hxs : UniqueDiffWithinAt 𝕜 s x) : fderivWithin 𝕜 id s x = .id 𝕜 E := by
772772
rw [DifferentiableAt.fderivWithin differentiableAt_id hxs]
773773
exact fderiv_id
774774

Mathlib/Analysis/Normed/Operator/Basic.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ theorem opNorm_zero : ‖(0 : E →SL[σ₁₂] F)‖ = 0 :=
189189

190190
/-- The norm of the identity is at most `1`. It is in fact `1`, except when the space is trivial
191191
where it is `0`. It means that one cannot do better than an inequality in general. -/
192-
theorem norm_id_le : ‖id 𝕜 E‖ ≤ 1 :=
192+
theorem norm_id_le : ‖ContinuousLinearMap.id 𝕜 E‖ ≤ 1 :=
193193
opNorm_le_bound _ zero_le_one fun x => by simp
194194

195195
section
@@ -279,10 +279,10 @@ theorem opNorm_add_le : ‖f + g‖ ≤ ‖f‖ + ‖g‖ :=
279279

280280
/-- If there is an element with norm different from `0`, then the norm of the identity equals `1`.
281281
(Since we are working with seminorms supposing that the space is non-trivial is not enough.) -/
282-
theorem norm_id_of_nontrivial_seminorm (h : ∃ x : E, ‖x‖ ≠ 0) : ‖id 𝕜 E‖ = 1 :=
282+
theorem norm_id_of_nontrivial_seminorm (h : ∃ x : E, ‖x‖ ≠ 0) : ‖ContinuousLinearMap.id 𝕜 E‖ = 1 :=
283283
le_antisymm norm_id_le <| by
284284
let ⟨x, hx⟩ := h
285-
have := (id 𝕜 E).ratio_le_opNorm x
285+
have := (ContinuousLinearMap.id 𝕜 E).ratio_le_opNorm x
286286
rwa [id_apply, div_self hx] at this
287287

288288
theorem opNorm_smul_le {𝕜' : Type*} [NormedField 𝕜'] [NormedSpace 𝕜' F] [SMulCommClass 𝕜₂ 𝕜' F]

Mathlib/Analysis/Normed/Operator/Bilinear.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ vector.
228228
229229
This is the continuous version of `LinearMap.applyₗ`. -/
230230
def apply' : E →SL[σ₁₂] (E →SL[σ₁₂] F) →L[𝕜₂] F :=
231-
flip (id 𝕜₂ (E →SL[σ₁₂] F))
231+
flip (.id 𝕜₂ (E →SL[σ₁₂] F))
232232

233233
variable {F σ₁₂}
234234

@@ -243,7 +243,7 @@ vector.
243243
244244
This is the continuous version of `LinearMap.applyₗ`. -/
245245
def apply : E →L[𝕜] (E →L[𝕜] Fₗ) →L[𝕜] Fₗ :=
246-
flip (id 𝕜 (E →L[𝕜] Fₗ))
246+
flip (.id 𝕜 (E →L[𝕜] Fₗ))
247247

248248
variable {𝕜 Fₗ}
249249

Mathlib/Analysis/Normed/Operator/Conformal.lean

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ noncomputable section
4242

4343
open Function LinearIsometry ContinuousLinearMap
4444

45-
4645
/-- A continuous linear map `f'` is said to be conformal if it's
4746
a nonzero multiple of a linear isometry. -/
4847
def IsConformalMap {R : Type*} {X Y : Type*} [NormedField R] [SeminormedAddCommGroup X]
@@ -53,15 +52,15 @@ variable {R M N G M' : Type*} [NormedField R] [SeminormedAddCommGroup M] [Semino
5352
[SeminormedAddCommGroup G] [NormedSpace R M] [NormedSpace R N] [NormedSpace R G]
5453
[NormedAddCommGroup M'] [NormedSpace R M'] {f : M →L[R] N} {g : N →L[R] G} {c : R}
5554

56-
theorem isConformalMap_id : IsConformalMap (id R M) :=
55+
theorem isConformalMap_id : IsConformalMap (.id R M) :=
5756
1, one_ne_zero, id, by simp⟩
5857

5958
theorem IsConformalMap.smul (hf : IsConformalMap f) {c : R} (hc : c ≠ 0) :
6059
IsConformalMap (c • f) := by
6160
rcases hf with ⟨c', hc', li, rfl⟩
6261
exact ⟨c * c', mul_ne_zero hc hc', li, smul_smul _ _ _⟩
6362

64-
theorem isConformalMap_const_smul (hc : c ≠ 0) : IsConformalMap (c • id R M) :=
63+
theorem isConformalMap_const_smul (hc : c ≠ 0) : IsConformalMap (c • .id R M) :=
6564
isConformalMap_id.smul hc
6665

6766
protected theorem LinearIsometry.isConformalMap (f' : M →ₗᵢ[R] N) :

Mathlib/Analysis/Normed/Operator/NormedSpace.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ theorem opNorm_zero_iff [RingHomIsometric σ₁₂] : ‖f‖ = 0 ↔ f = 0 :=
105105

106106
/-- If a normed space is non-trivial, then the norm of the identity equals `1`. -/
107107
@[simp]
108-
theorem norm_id [Nontrivial E] : ‖id 𝕜 E‖ = 1 := by
108+
theorem norm_id [Nontrivial E] : ‖ContinuousLinearMap.id 𝕜 E‖ = 1 := by
109109
refine norm_id_of_nontrivial_seminorm ?_
110110
obtain ⟨x, hx⟩ := exists_ne (0 : E)
111111
exact ⟨x, ne_of_gt (norm_pos_iff.2 hx)⟩
112112

113113
@[simp]
114-
lemma nnnorm_id [Nontrivial E] : ‖id 𝕜 E‖₊ = 1 := NNReal.eq norm_id
114+
lemma nnnorm_id [Nontrivial E] : ‖ContinuousLinearMap.id 𝕜 E‖₊ = 1 := NNReal.eq norm_id
115115

116116
instance normOneClass [Nontrivial E] : NormOneClass (E →L[𝕜] E) :=
117117
⟨norm_id⟩

Mathlib/Topology/Algebra/Module/Equiv.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,11 +1095,12 @@ lemma IsInvertible.comp {g : M₂ →L[R] M₃} {f : M →L[R] M₂}
10951095
exact ⟨M.trans N, rfl⟩
10961096

10971097
lemma IsInvertible.of_inverse {f : M →L[R] M₂} {g : M₂ →L[R] M}
1098-
(hf : f ∘L g = id R M₂) (hg : g ∘L f = id R M) :
1098+
(hf : f ∘L g = .id R M₂) (hg : g ∘L f = .id R M) :
10991099
f.IsInvertible :=
11001100
⟨ContinuousLinearEquiv.equivOfInverse' _ _ hf hg, rfl⟩
11011101

1102-
lemma inverse_eq {f : M →L[R] M₂} {g : M₂ →L[R] M} (hf : f ∘L g = id R M₂) (hg : g ∘L f = id R M) :
1102+
lemma inverse_eq {f : M →L[R] M₂} {g : M₂ →L[R] M}
1103+
(hf : f ∘L g = .id R M₂) (hg : g ∘L f = .id R M) :
11031104
f.inverse = g := by
11041105
have : f = ContinuousLinearEquiv.equivOfInverse' f g hf hg := rfl
11051106
rw [this, inverse_equiv]
@@ -1202,7 +1203,7 @@ theorem ringInverse_eq_inverse : Ring.inverse = inverse (R := R) (M := M) := by
12021203
@[deprecated (since := "2025-04-22")]
12031204
alias ring_inverse_eq_map_inverse := ringInverse_eq_inverse
12041205

1205-
@[simp] theorem inverse_id : (id R M).inverse = id R M := by
1206+
@[simp] theorem inverse_id : (ContinuousLinearMap.id R M).inverse = .id R M := by
12061207
rw [← ringInverse_eq_inverse]
12071208
exact Ring.inverse_one _
12081209

Mathlib/Topology/Algebra/Module/LinearMap.lean

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -313,34 +313,34 @@ section
313313
variable (R₁ M₁)
314314

315315
/-- the identity map as a continuous linear map. -/
316-
def id : M₁ →L[R₁] M₁ :=
316+
protected def id : M₁ →L[R₁] M₁ :=
317317
⟨LinearMap.id, continuous_id⟩
318318

319319
end
320320

321321
instance one : One (M₁ →L[R₁] M₁) :=
322-
⟨id R₁ M₁⟩
322+
.id R₁ M₁⟩
323323

324-
theorem one_def : (1 : M₁ →L[R₁] M₁) = id R₁ M₁ :=
324+
theorem one_def : (1 : M₁ →L[R₁] M₁) = .id R₁ M₁ :=
325325
rfl
326326

327-
theorem id_apply (x : M₁) : id R₁ M₁ x = x :=
327+
theorem id_apply (x : M₁) : ContinuousLinearMap.id R₁ M₁ x = x :=
328328
rfl
329329

330330
@[simp, norm_cast]
331-
theorem coe_id : (id R₁ M₁ : M₁ →ₗ[R₁] M₁) = LinearMap.id :=
331+
theorem coe_id : (ContinuousLinearMap.id R₁ M₁ : M₁ →ₗ[R₁] M₁) = LinearMap.id :=
332332
rfl
333333

334334
@[simp, norm_cast]
335-
theorem coe_id' : ⇑(id R₁ M₁) = _root_.id :=
335+
theorem coe_id' : ⇑(ContinuousLinearMap.id R₁ M₁) = id :=
336336
rfl
337337

338338
@[simp, norm_cast]
339339
theorem toContinuousAddMonoidHom_id :
340-
(id R₁ M₁ : ContinuousAddMonoidHom M₁ M₁) = .id _ := rfl
340+
(ContinuousLinearMap.id R₁ M₁ : ContinuousAddMonoidHom M₁ M₁) = .id _ := rfl
341341

342342
@[simp, norm_cast]
343-
theorem coe_eq_id {f : M₁ →L[R₁] M₁} : (f : M₁ →ₗ[R₁] M₁) = LinearMap.id ↔ f = id _ _ := by
343+
theorem coe_eq_id {f : M₁ →L[R₁] M₁} : (f : M₁ →ₗ[R₁] M₁) = LinearMap.id ↔ f = .id _ _ := by
344344
rw [← coe_id, coe_inj]
345345

346346
@[simp]
@@ -441,11 +441,11 @@ theorem comp_apply (g : M₂ →SL[σ₂₃] M₃) (f : M₁ →SL[σ₁₂] M
441441
rfl
442442

443443
@[simp]
444-
theorem comp_id (f : M₁ →SL[σ₁₂] M₂) : f.comp (id R₁ M₁) = f :=
444+
theorem comp_id (f : M₁ →SL[σ₁₂] M₂) : f.comp (.id R₁ M₁) = f :=
445445
ext fun _x => rfl
446446

447447
@[simp]
448-
theorem id_comp (f : M₁ →SL[σ₁₂] M₂) : (id R₂ M₂).comp f = f :=
448+
theorem id_comp (f : M₁ →SL[σ₁₂] M₂) : (ContinuousLinearMap.id R₂ M₂).comp f = f :=
449449
ext fun _x => rfl
450450

451451
section
@@ -887,7 +887,7 @@ variable {σ₂₁ : R₂ →+* R} [RingHomInvPair σ₁₂ σ₂₁]
887887
`LinearMap.range f₂`. -/
888888
def projKerOfRightInverse [IsTopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂) (f₂ : M₂ →SL[σ₂₁] M)
889889
(h : Function.RightInverse f₂ f₁) : M →L[R] LinearMap.ker f₁ :=
890-
(id R M - f₂.comp f₁).codRestrict (LinearMap.ker f₁) fun x => by simp [h (f₁ x)]
890+
(.id R M - f₂.comp f₁).codRestrict (LinearMap.ker f₁) fun x => by simp [h (f₁ x)]
891891

892892
@[simp]
893893
theorem coe_projKerOfRightInverse_apply [IsTopologicalAddGroup M] (f₁ : M →SL[σ₁₂] M₂)
@@ -1141,7 +1141,8 @@ theorem ClosedComplemented.exists_isClosed_isCompl {p : Submodule R M} [T1Space
11411141
protected theorem ClosedComplemented.isClosed [IsTopologicalAddGroup M] [T1Space M]
11421142
{p : Submodule R M} (h : ClosedComplemented p) : IsClosed (p : Set M) := by
11431143
rcases h with ⟨f, hf⟩
1144-
have : ker (id R M - p.subtypeL.comp f) = p := LinearMap.ker_id_sub_eq_of_proj hf
1144+
have : ker (ContinuousLinearMap.id R M - p.subtypeL.comp f) = p :=
1145+
LinearMap.ker_id_sub_eq_of_proj hf
11451146
exact this ▸ isClosed_ker _
11461147

11471148
@[simp]
@@ -1150,7 +1151,8 @@ theorem closedComplemented_bot : ClosedComplemented (⊥ : Submodule R M) :=
11501151

11511152
@[simp]
11521153
theorem closedComplemented_top : ClosedComplemented (⊤ : Submodule R M) :=
1153-
⟨(id R M).codRestrict ⊤ fun _x => trivial, fun x => Subtype.ext_iff.2 <| by simp⟩
1154+
⟨(ContinuousLinearMap.id R M).codRestrict ⊤ fun _x => trivial,
1155+
fun x => Subtype.ext_iff.2 <| by simp⟩
11541156

11551157
end Submodule
11561158

Mathlib/Topology/Algebra/Module/LinearMapPiProd.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@ variable (R M₁ M₂)
5353

5454
/-- The left injection into a product is a continuous linear map. -/
5555
def inl : M₁ →L[R] M₁ × M₂ :=
56-
(id R M₁).prod 0
56+
(ContinuousLinearMap.id R M₁).prod 0
5757

5858
/-- The right injection into a product is a continuous linear map. -/
5959
def inr : M₂ →L[R] M₁ × M₂ :=
60-
(0 : M₂ →L[R] M₁).prod (id R M₂)
60+
(0 : M₂ →L[R] M₁).prod (.id R M₂)
6161

6262
end
6363

@@ -116,7 +116,7 @@ theorem coe_snd' : ⇑(snd R M₁ M₂) = Prod.snd :=
116116
rfl
117117

118118
@[simp]
119-
theorem fst_prod_snd : (fst R M₁ M₂).prod (snd R M₁ M₂) = id R (M₁ × M₂) :=
119+
theorem fst_prod_snd : (fst R M₁ M₂).prod (snd R M₁ M₂) = .id R (M₁ × M₂) :=
120120
ext fun ⟨_x, _y⟩ => rfl
121121

122122
@[simp]

0 commit comments

Comments
 (0)