Skip to content

Commit fef4677

Browse files
feat(Analysis/InnerProductSpace/Basic): add a simp lemma (#30793)
Add a simp lemma (for benchmarking purposes - to see if it doesn't have a bad performance impact). Co-authored-by: Jovan Gerbscheid <jovan.gerbscheid@gmail.com>
1 parent 2b519a3 commit fef4677

File tree

19 files changed

+45
-36
lines changed

19 files changed

+45
-36
lines changed

Mathlib/Analysis/Convex/Cone/InnerDual.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def innerDual (s : Set E) : ProperCone ℝ E := .dual (innerₗ E) s
6060
/-- Dual cone of the total space is the convex cone `{0}`. -/
6161
@[simp]
6262
lemma innerDual_univ : innerDual (univ : Set E) = ⊥ :=
63-
le_antisymm (fun x hx ↦ by simpa [← real_inner_self_nonpos] using hx (mem_univ (-x))) (by simp)
63+
le_antisymm (fun x hx ↦ by simpa using hx (mem_univ (-x))) (by simp)
6464

6565
@[gcongr] lemma innerDual_le_innerDual (h : t ⊆ s) : innerDual s ≤ innerDual t :=
6666
fun _y hy _x hx ↦ hy (h hx)
@@ -179,7 +179,7 @@ theorem innerDualCone_univ : (univ : Set H).innerDualCone = 0 := by
179179
suffices ∀ x : H, x ∈ (univ : Set H).innerDualCone → x = 0 by
180180
apply SetLike.coe_injective
181181
exact eq_singleton_iff_unique_mem.mpr ⟨fun x _ => (inner_zero_right _).ge, this⟩
182-
exact fun x hx => by simpa [← real_inner_self_nonpos] using hx (-x) (mem_univ _)
182+
exact fun x hx => by simpa using hx (-x) (mem_univ _)
183183

184184
variable {s t} in
185185
set_option linter.deprecated false in

Mathlib/Analysis/Fourier/FiniteAbelian/Orthogonality.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ section RCLike
4242
variable [RCLike R] [Fintype G]
4343

4444
lemma wInner_cWeight_self (ψ : AddChar G R) : ⟪(ψ : G → R), ψ⟫ₙ_[R] = 1 := by
45-
simp [wInner_cWeight_eq_expect, ψ.norm_apply, RCLike.mul_conj]
45+
simp [wInner_cWeight_eq_expect, ψ.norm_apply]
4646

4747
end RCLike
4848
end AddGroup

Mathlib/Analysis/InnerProductSpace/Basic.lean

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ theorem inner_eq_zero_symm {x y : E} : ⟪x, y⟫ = 0 ↔ ⟪y, x⟫ = 0 := by
6161
instance {ι : Sort*} (v : ι → E) : IsSymm ι fun i j => ⟪v i, v j⟫ = 0 where
6262
symm _ _ := inner_eq_zero_symm.1
6363

64-
@[simp]
65-
theorem inner_self_im (x : E) : im ⟪x, x⟫ = 0 := by rw [← @ofReal_inj 𝕜, im_eq_conj_sub]; simp
64+
theorem inner_self_im (x : E) : im ⟪x, x⟫ = 0 := by
65+
rw [← @ofReal_inj 𝕜, im_eq_conj_sub]; simp
6666

6767
theorem inner_add_left (x y z : E) : ⟪x + y, z⟫ = ⟪x, z⟫ + ⟪y, z⟫ :=
6868
InnerProductSpace.add_left _ _ _
@@ -183,10 +183,10 @@ theorem inner_self_nonneg {x : E} : 0 ≤ re ⟪x, x⟫ :=
183183
theorem real_inner_self_nonneg {x : F} : 0 ≤ ⟪x, x⟫_ℝ :=
184184
@inner_self_nonneg ℝ F _ _ _ x
185185

186-
@[simp]
187186
theorem inner_self_ofReal_re (x : E) : (re ⟪x, x⟫ : 𝕜) = ⟪x, x⟫ :=
188187
((RCLike.is_real_TFAE (⟪x, x⟫ : 𝕜)).out 2 3).2 (inner_self_im (𝕜 := 𝕜) x)
189188

189+
@[simp]
190190
theorem inner_self_eq_norm_sq_to_K (x : E) : ⟪x, x⟫ = (‖x‖ : 𝕜) ^ 2 := by
191191
rw [← inner_self_ofReal_re, ← norm_sq_eq_re_inner, ofReal_pow]
192192

@@ -290,7 +290,6 @@ local notation "⟪" x ", " y "⟫" => inner 𝕜 x y
290290

291291
export InnerProductSpace (norm_sq_eq_re_inner)
292292

293-
@[simp]
294293
theorem inner_self_eq_zero {x : E} : ⟪x, x⟫ = 0 ↔ x = 0 := by
295294
rw [inner_self_eq_norm_sq_to_K, sq_eq_zero_iff, ofReal_eq_zero, norm_eq_zero]
296295

@@ -313,13 +312,11 @@ theorem ext_iff_inner_right {x y : E} : x = y ↔ ∀ v, ⟪x, v⟫ = ⟪y, v⟫
313312

314313
variable {𝕜}
315314

316-
@[simp]
317315
theorem re_inner_self_nonpos {x : E} : re ⟪x, x⟫ ≤ 0 ↔ x = 0 := by
318-
rw [← norm_sq_eq_re_inner, (sq_nonneg _).ge_iff_eq', sq_eq_zero_iff, norm_eq_zero]
316+
simp
319317

320-
@[simp]
321318
lemma re_inner_self_pos {x : E} : 0 < re ⟪x, x⟫ ↔ x ≠ 0 := by
322-
simpa [-re_inner_self_nonpos] using re_inner_self_nonpos (𝕜 := 𝕜) (x := x).not
319+
simp [sq_pos_iff]
323320

324321
@[deprecated (since := "2025-04-22")] alias inner_self_nonpos := re_inner_self_nonpos
325322
@[deprecated (since := "2025-04-22")] alias inner_self_pos := re_inner_self_pos
@@ -744,7 +741,7 @@ theorem inner_eq_norm_mul_iff_div {x y : E} (h₀ : x ≠ 0) :
744741
· have : x = 0 ∨ y = (⟪x, y⟫ / ⟪x, x⟫ : 𝕜) • x :=
745742
((norm_inner_eq_norm_tfae 𝕜 x y).out 0 1).1 (by simp [h])
746743
rw [this.resolve_left h₀, h]
747-
simp [norm_smul, inner_self_ofReal_norm, mul_div_cancel_right₀ _ h₀']
744+
simp [norm_smul, mul_div_cancel_right₀ _ h₀']
748745
· conv_lhs => rw [← h, inner_smul_right, inner_self_eq_norm_sq_to_K]
749746
field
750747

@@ -796,6 +793,9 @@ theorem inner_eq_one_iff_of_norm_one {x y : E} (hx : ‖x‖ = 1) (hy : ‖y‖
796793
⟪x, y⟫ = 1 ↔ x = y := by
797794
convert inner_eq_norm_mul_iff (𝕜 := 𝕜) (E := E) using 2 <;> simp [hx, hy]
798795

796+
theorem inner_self_eq_one_of_norm_one {x : E} (hx : ‖x‖ = 1) : ⟪x, x⟫_𝕜 = 1 :=
797+
(inner_eq_one_iff_of_norm_one hx hx).mpr rfl
798+
799799
theorem inner_lt_norm_mul_iff_real {x y : F} : ⟪x, y⟫_ℝ < ‖x‖ * ‖y‖ ↔ ‖y‖ • x ≠ ‖x‖ • y :=
800800
calc
801801
⟪x, y⟫_ℝ < ‖x‖ * ‖y‖ ↔ ⟪x, y⟫_ℝ ≠ ‖x‖ * ‖y‖ :=
@@ -813,7 +813,8 @@ theorem eq_of_norm_le_re_inner_eq_norm_sq {x y : E} (hle : ‖x‖ ≤ ‖y‖)
813813
suffices H : re ⟪x - y, x - y⟫ ≤ 0 by rwa [re_inner_self_nonpos, sub_eq_zero] at H
814814
have H₁ : ‖x‖ ^ 2 ≤ ‖y‖ ^ 2 := by gcongr
815815
have H₂ : re ⟪y, x⟫ = ‖y‖ ^ 2 := by rwa [← inner_conj_symm, conj_re]
816-
simpa [inner_sub_left, inner_sub_right, ← norm_sq_eq_re_inner, h, H₂] using H₁
816+
simp only [inner_sub_left, inner_sub_right]
817+
simpa [h, H₂] using H₁
817818

818819
/-- Equality is achieved in the triangle inequality iff the two vectors are collinear. -/
819820
theorem norm_add_eq_iff_real {x y : F} : ‖x + y‖ = ‖x‖ + ‖y‖ ↔ ‖y‖ • x = ‖x‖ • y := by

Mathlib/Analysis/InnerProductSpace/Dual.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def toDual : E ≃ₗᵢ⋆[𝕜] StrongDual 𝕜 E :=
163163
⟪(ℓ z† / ⟪z, z⟫) • z, x⟫ = ℓ z / ⟪z, z⟫ * ⟪z, x⟫ := by simp [inner_smul_left]
164164
_ = ℓ z * ⟪z, x⟫ / ⟪z, z⟫ := by rw [← div_mul_eq_mul_div]
165165
_ = ℓ x * ⟪z, z⟫ / ⟪z, z⟫ := by rw [h₂]
166-
_ = ℓ x := by field [inner_self_ne_zero.2])
166+
_ = ℓ x := by have : ⟪z, z⟫ ≠ 0 := inner_self_ne_zero.mpr z_ne_0; field)
167167

168168
variable {𝕜} {E}
169169

Mathlib/Analysis/InnerProductSpace/GramMatrix.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ theorem posSemidef_gram (v : n → E) :
7878
PosSemidef (gram 𝕜 v) := by
7979
refine ⟨isHermitian_gram _ _, fun x ↦ ?_⟩
8080
rw [star_dotProduct_gram_mulVec, le_iff_re_im]
81-
simp [inner_self_nonneg]
81+
simp
8282

8383
/-- In a normed space, positive definiteness of `gram 𝕜 v` implies linear independence of `v`. -/
8484
theorem linearIndependent_of_posDef_gram {v : n → E} (h_gram : PosDef (gram 𝕜 v)) :

Mathlib/Analysis/InnerProductSpace/MeanErgodic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ theorem ContinuousLinearMap.tendsto_birkhoffAverage_orthogonalProjection (f : E
100100
· simpa using f.le_of_opNorm_le hf x
101101
· have : ∀ y, ⟪f y, x⟫ = ⟪y, x⟫ := by
102102
simpa [Submodule.mem_orthogonal, inner_sub_left, sub_eq_zero] using hx
103-
simp [this, ← norm_sq_eq_re_inner]
103+
simp [this]

Mathlib/Analysis/InnerProductSpace/Orthonormal.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ theorem orthonormal_iff_ite [DecidableEq ι] {v : ι → E} :
8484
· intro h
8585
constructor
8686
· intro i
87-
have h' : ‖v i‖ ^ 2 = 1 ^ 2 := by simp [@norm_sq_eq_re_inner 𝕜, h i i]
87+
have h' : ‖v i‖ ^ 2 = 1 ^ 2 := by
88+
rw [@norm_sq_eq_re_inner 𝕜, h i i]; simp
8889
have h₁ : 0 ≤ ‖v i‖ := norm_nonneg _
8990
have h₂ : (0 : ℝ) ≤ 1 := zero_le_one
9091
rwa [sq_eq_sq₀ h₁ h₂] at h'

Mathlib/Analysis/InnerProductSpace/PiL2.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -422,9 +422,8 @@ lemma enorm_eq_one (b : OrthonormalBasis ι 𝕜 E) (i : ι) :
422422
lemma inner_eq_zero (b : OrthonormalBasis ι 𝕜 E) {i j : ι} (hij : i ≠ j) :
423423
⟪b i, b j⟫ = 0 := b.orthonormal.inner_eq_zero hij
424424

425-
@[simp]
426425
lemma inner_eq_one (b : OrthonormalBasis ι 𝕜 E) (i : ι) : ⟪b i, b i⟫ = 1 := by
427-
simp [inner_self_eq_norm_sq_to_K]
426+
simp
428427

429428
lemma inner_eq_ite [DecidableEq ι] (b : OrthonormalBasis ι 𝕜 E) (i j : ι) :
430429
⟪b i, b j⟫ = if i = j then 1 else 0 := by

Mathlib/Analysis/InnerProductSpace/ProdL2.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ noncomputable instance instProdInnerProductSpace :
2929
InnerProductSpace 𝕜 (WithLp 2 (E × F)) where
3030
inner x y := ⟪x.fst, y.fst⟫_𝕜 + ⟪x.snd, y.snd⟫_𝕜
3131
norm_sq_eq_re_inner x := by
32-
simp [prod_norm_sq_eq_of_L2, ← norm_sq_eq_re_inner]
32+
simp [prod_norm_sq_eq_of_L2]
3333
conj_inner_symm x y := by
3434
simp
3535
add_left x y z := by

Mathlib/Analysis/InnerProductSpace/Rayleigh.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ theorem eq_smul_self_of_isLocalExtrOn_real (hT : IsSelfAdjoint T) {x₀ : F}
144144
set c : ℝ := -b⁻¹ * a
145145
convert hc
146146
have := congr_arg (fun x => ⟪x, x₀⟫_ℝ) hc
147-
simp [field, inner_smul_left, real_inner_self_eq_norm_mul_norm, mul_comm a] at this ⊢
147+
simp [field, inner_smul_left, mul_comm a] at this ⊢
148148
exact this
149149

150150
end Real

0 commit comments

Comments
 (0)