@@ -55,7 +55,7 @@ For consequences in infinite dimension (Hilbert bases, etc.), see the file
55
55
56
56
57
57
open Real Set Filter RCLike Submodule Function Uniformity Topology NNReal ENNReal
58
- ComplexConjugate DirectSum
58
+ ComplexConjugate DirectSum WithLp
59
59
60
60
noncomputable section
61
61
@@ -109,27 +109,24 @@ open Lean Meta Elab Term Macro TSyntax PrettyPrinter.Delaborator SubExpr
109
109
open Mathlib.Tactic (subscriptTerm)
110
110
111
111
/-- Notation for vectors in Lp space. `!₂[x, y, ...]` is a shorthand for
112
- `( WithLp.equiv 2 _).symm ![x, y, ...]`, of type `EuclideanSpace _ (Fin _)`.
112
+ `WithLp.toLp 2 ![x, y, ...]`, of type `EuclideanSpace _ (Fin _)`.
113
113
114
114
This also works for other subscripts. -/
115
115
syntax (name := PiLp.vecNotation) "!" noWs subscriptTerm noWs "[" term,* "]" : term
116
116
macro_rules | `(!$p:subscript[$e:term,*]) => do
117
117
-- override the `Fin n.succ` to a literal
118
118
let n := e.getElems.size
119
- `(( WithLp.equiv $p <| ∀ _ : Fin $(quote n), _).symm ![$e,*])
119
+ `(WithLp.toLp $p (V := ∀ _ : Fin $(quote n), _) ![$e,*])
120
120
121
121
/-- Unexpander for the `!₂[x, y, ...]` notation. -/
122
- @[app_delab DFunLike.coe ]
122
+ @[app_delab WithLp.toLp ]
123
123
def EuclideanSpace.delabVecNotation : Delab :=
124
- whenNotPPOption getPPExplicit <| whenPPOption getPPNotation <| withOverApp 6 do
125
- -- check that the `(WithLp.equiv _ _).symm` is present
126
- let p : Term ← withAppFn <| withAppArg do
127
- let_expr Equiv.symm _ _ e := ← getExpr | failure
128
- let_expr WithLp.equiv _ _ := e | failure
129
- withNaryArg 2 <| withNaryArg 0 <| delab
124
+ whenNotPPOption getPPExplicit <| whenPPOption getPPNotation <| withOverApp 3 do
125
+ -- check that the `WithLp.toLp _` is present
126
+ let p : Term ← withNaryArg 0 <| delab
130
127
-- to be conservative, only allow subscripts which are numerals
131
128
guard <| p matches `($_:num)
132
- let `(![$elems,*]) := ← withAppArg delab | failure
129
+ let `(![$elems,*]) := ← withNaryArg 2 delab | failure
133
130
`(!$p[$elems,*])
134
131
135
132
end Notation
@@ -185,9 +182,12 @@ theorem finrank_euclideanSpace_fin {n : ℕ} :
185
182
Module.finrank 𝕜 (EuclideanSpace 𝕜 (Fin n)) = n := by simp
186
183
187
184
theorem EuclideanSpace.inner_eq_star_dotProduct (x y : EuclideanSpace 𝕜 ι) :
188
- ⟪x, y⟫ = WithLp.equiv _ _ y ⬝ᵥ star (WithLp.equiv _ _ x) :=
189
- rfl
185
+ ⟪x, y⟫ = ofLp y ⬝ᵥ star (ofLp x) := rfl
186
+
187
+ lemma EuclideanSpace.inner_toLp_toLp (x y : ι → 𝕜) :
188
+ ⟪toLp 2 x, toLp 2 y⟫ = dotProduct y (star x) := rfl
190
189
190
+ @[deprecated EuclideanSpace.inner_toLp_toLp (since := "2024-04-27")]
191
191
theorem EuclideanSpace.inner_piLp_equiv_symm (x y : ι → 𝕜) :
192
192
⟪(WithLp.equiv 2 _).symm x, (WithLp.equiv 2 _).symm y⟫ = y ⬝ᵥ star x :=
193
193
rfl
@@ -247,22 +247,27 @@ variable [DecidableEq ι]
247
247
/-- The vector given in euclidean space by being `a : 𝕜` at coordinate `i : ι` and `0 : 𝕜` at
248
248
all other coordinates. -/
249
249
def EuclideanSpace.single (i : ι) (a : 𝕜) : EuclideanSpace 𝕜 ι :=
250
- (WithLp.equiv _ _).symm (Pi.single i a)
250
+ toLp _ (Pi.single i a)
251
251
252
- @[simp]
252
+ @[simp] lemma EuclideanSpace.ofLp_single (i : ι) (a : 𝕜) : ofLp (single i a) = Pi.single i a := rfl
253
+
254
+ @[deprecated EuclideanSpace.ofLp_single (since := "2024-04-27")]
253
255
theorem WithLp.equiv_single (i : ι) (a : 𝕜) :
254
256
WithLp.equiv _ _ (EuclideanSpace.single i a) = Pi.single i a :=
255
257
rfl
256
258
257
259
@[simp]
260
+ lemma EuclideanSpace.toLp_single (i : ι) (a : 𝕜) : toLp _ (Pi.single i a) = single i a := rfl
261
+
262
+ @[deprecated EuclideanSpace.toLp_single (since := "2024-04-27")]
258
263
theorem WithLp.equiv_symm_single (i : ι) (a : 𝕜) :
259
264
(WithLp.equiv _ _).symm (Pi.single i a) = EuclideanSpace.single i a :=
260
265
rfl
261
266
262
267
@[simp]
263
268
theorem EuclideanSpace.single_apply (i : ι) (a : 𝕜) (j : ι) :
264
269
(EuclideanSpace.single i a) j = ite (j = i) a 0 := by
265
- rw [EuclideanSpace.single, WithLp.equiv_symm_pi_apply , ← Pi.single_apply i a j]
270
+ rw [EuclideanSpace.single, PiLp.toLp_apply , ← Pi.single_apply i a j]
266
271
267
272
@[simp]
268
273
theorem EuclideanSpace.single_eq_zero_iff {i : ι} {a : 𝕜} :
@@ -279,27 +284,27 @@ theorem EuclideanSpace.inner_single_right (i : ι) (a : 𝕜) (v : EuclideanSpac
279
284
@[simp]
280
285
theorem EuclideanSpace.norm_single (i : ι) (a : 𝕜) :
281
286
‖EuclideanSpace.single i (a : 𝕜)‖ = ‖a‖ :=
282
- PiLp.norm_equiv_symm_single 2 (fun _ => 𝕜) i a
287
+ PiLp.norm_toLp_single 2 (fun _ => 𝕜) i a
283
288
284
289
@[simp]
285
290
theorem EuclideanSpace.nnnorm_single (i : ι) (a : 𝕜) :
286
291
‖EuclideanSpace.single i (a : 𝕜)‖₊ = ‖a‖₊ :=
287
- PiLp.nnnorm_equiv_symm_single 2 (fun _ => 𝕜) i a
292
+ PiLp.nnnorm_toLp_single 2 (fun _ => 𝕜) i a
288
293
289
294
@[simp]
290
295
theorem EuclideanSpace.dist_single_same (i : ι) (a b : 𝕜) :
291
296
dist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = dist a b :=
292
- PiLp.dist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b
297
+ PiLp.dist_toLp_single_same 2 (fun _ => 𝕜) i a b
293
298
294
299
@[simp]
295
300
theorem EuclideanSpace.nndist_single_same (i : ι) (a b : 𝕜) :
296
301
nndist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = nndist a b :=
297
- PiLp.nndist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b
302
+ PiLp.nndist_toLp_single_same 2 (fun _ => 𝕜) i a b
298
303
299
304
@[simp]
300
305
theorem EuclideanSpace.edist_single_same (i : ι) (a b : 𝕜) :
301
306
edist (EuclideanSpace.single i (a : 𝕜)) (EuclideanSpace.single i (b : 𝕜)) = edist a b :=
302
- PiLp.edist_equiv_symm_single_same 2 (fun _ => 𝕜) i a b
307
+ PiLp.edist_toLp_single_same 2 (fun _ => 𝕜) i a b
303
308
304
309
/-- `EuclideanSpace.single` forms an orthonormal family. -/
305
310
theorem EuclideanSpace.orthonormal_single :
@@ -370,7 +375,7 @@ instance instFunLike : FunLike (OrthonormalBasis ι 𝕜 E) ι E where
370
375
rw [this, Pi.single_smul]
371
376
replace h := congr_fun h i
372
377
simp only [LinearEquiv.comp_coe, map_smul, LinearEquiv.coe_coe,
373
- LinearEquiv.trans_apply, WithLp.linearEquiv_symm_apply, WithLp.equiv_symm_single ,
378
+ LinearEquiv.trans_apply, WithLp.linearEquiv_symm_apply, EuclideanSpace.toLp_single ,
374
379
LinearIsometryEquiv.coe_symm_toLinearEquiv] at h ⊢
375
380
rw [h]
376
381
@@ -593,18 +598,18 @@ theorem _root_.Pi.orthonormalBasis_apply {η : Type*} [Fintype η] [DecidableEq
593
598
[∀ i, Fintype (ι i)] {𝕜 : Type *} [RCLike 𝕜] {E : η → Type *} [∀ i, NormedAddCommGroup (E i)]
594
599
[∀ i, InnerProductSpace 𝕜 (E i)] (B : ∀ i, OrthonormalBasis (ι i) 𝕜 (E i))
595
600
(j : (i : η) × (ι i)) :
596
- Pi.orthonormalBasis B j = (WithLp.equiv _ _).symm (Pi.single _ (B j.fst j.snd)) := by
601
+ Pi.orthonormalBasis B j = toLp _ (Pi.single _ (B j.fst j.snd)) := by
597
602
classical
598
603
ext k
599
604
obtain ⟨i, j⟩ := j
600
605
simp only [Pi.orthonormalBasis, coe_ofRepr, LinearIsometryEquiv.symm_trans,
601
606
LinearIsometryEquiv.symm_symm, LinearIsometryEquiv.piLpCongrRight_symm,
602
607
LinearIsometryEquiv.trans_apply, LinearIsometryEquiv.piLpCongrRight_apply,
603
- LinearIsometryEquiv.piLpCurry_apply, WithLp.equiv_single, WithLp.equiv_symm_pi_apply ,
608
+ LinearIsometryEquiv.piLpCurry_apply, EuclideanSpace.ofLp_single, PiLp.toLp_apply ,
604
609
Sigma.curry_single (γ := fun _ _ => 𝕜)]
605
610
obtain rfl | hi := Decidable.eq_or_ne i k
606
- · simp only [Pi.single_eq_same, WithLp.equiv_symm_single , OrthonormalBasis.repr_symm_single]
607
- · simp only [Pi.single_eq_of_ne' hi, WithLp.equiv_symm_zero , map_zero]
611
+ · simp only [Pi.single_eq_same, EuclideanSpace.toLp_single , OrthonormalBasis.repr_symm_single]
612
+ · simp only [Pi.single_eq_of_ne' hi, toLp_zero , map_zero]
608
613
609
614
@[simp]
610
615
theorem _root_.Pi.orthonormalBasis_repr {η : Type *} [Fintype η] {ι : η → Type *}
@@ -1079,26 +1084,44 @@ def toEuclideanLin : Matrix m n 𝕜 ≃ₗ[𝕜] EuclideanSpace 𝕜 n →ₗ[
1079
1084
(WithLp.linearEquiv _ 𝕜 (m → 𝕜)).symm
1080
1085
1081
1086
@[simp]
1087
+ lemma toEuclideanLin_toLp (A : Matrix m n 𝕜) (x : n → 𝕜) :
1088
+ Matrix.toEuclideanLin A (toLp _ x) = toLp _ (Matrix.toLin' A x) := rfl
1089
+
1090
+ @[deprecated toEuclideanLin_toLp (since := "2024-04-27")]
1082
1091
theorem toEuclideanLin_piLp_equiv_symm (A : Matrix m n 𝕜) (x : n → 𝕜) :
1083
1092
Matrix.toEuclideanLin A ((WithLp.equiv _ _).symm x) =
1084
1093
(WithLp.equiv _ _).symm (A *ᵥ x) :=
1085
1094
rfl
1086
1095
1087
1096
@[simp]
1097
+ theorem piLp_ofLp_toEuclideanLin (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
1098
+ ofLp (Matrix.toEuclideanLin A x) = Matrix.toLin' A (ofLp x) :=
1099
+ rfl
1100
+
1101
+ @[deprecated piLp_ofLp_toEuclideanLin (since := "2024-04-27")]
1088
1102
theorem piLp_equiv_toEuclideanLin (A : Matrix m n 𝕜) (x : EuclideanSpace 𝕜 n) :
1089
1103
WithLp.equiv _ _ (Matrix.toEuclideanLin A x) = A *ᵥ (WithLp.equiv _ _ x) :=
1090
1104
rfl
1091
1105
1092
1106
theorem toEuclideanLin_apply (M : Matrix m n 𝕜) (v : EuclideanSpace 𝕜 n) :
1093
- toEuclideanLin M v = (WithLp.equiv 2 (m → 𝕜)).symm (M *ᵥ (WithLp.equiv 2 (n → 𝕜)) v) :=
1094
- rfl
1107
+ toEuclideanLin M v = toLp _ (M *ᵥ ofLp v) := rfl
1095
1108
1096
1109
@[simp]
1110
+ theorem ofLp_toEuclideanLin_apply (M : Matrix m n 𝕜) (v : EuclideanSpace 𝕜 n) :
1111
+ ofLp (toEuclideanLin M v) = M *ᵥ ofLp v :=
1112
+ rfl
1113
+
1114
+ @[deprecated ofLp_toEuclideanLin_apply (since := "2024-04-27")]
1097
1115
theorem piLp_equiv_toEuclideanLin_apply (M : Matrix m n 𝕜) (v : EuclideanSpace 𝕜 n) :
1098
1116
WithLp.equiv 2 (m → 𝕜) (toEuclideanLin M v) = M *ᵥ WithLp.equiv 2 (n → 𝕜) v :=
1099
1117
rfl
1100
1118
1101
1119
@[simp]
1120
+ theorem toEuclideanLin_apply_piLp_toLp (M : Matrix m n 𝕜) (v : n → 𝕜) :
1121
+ toEuclideanLin M (toLp _ v) = toLp _ (M *ᵥ v) :=
1122
+ rfl
1123
+
1124
+ @[deprecated toEuclideanLin_apply_piLp_toLp (since := "2024-04-27")]
1102
1125
theorem toEuclideanLin_apply_piLp_equiv_symm (M : Matrix m n 𝕜) (v : n → 𝕜) :
1103
1126
toEuclideanLin M ((WithLp.equiv 2 (n→ 𝕜)).symm v) = (WithLp.equiv 2 (m → 𝕜)).symm (M *ᵥ v) :=
1104
1127
rfl
@@ -1116,8 +1139,7 @@ lemma toEuclideanLin_eq_toLin_orthonormal [Fintype m] :
1116
1139
1117
1140
end Matrix
1118
1141
1119
- local notation "⟪" x ", " y "⟫ₑ" =>
1120
- inner 𝕜 (Equiv.symm (WithLp.equiv 2 _) x) (Equiv.symm (WithLp.equiv 2 _) y)
1142
+ local notation "⟪" x ", " y "⟫ₑ" => inner 𝕜 (toLp 2 x) (toLp 2 y)
1121
1143
1122
1144
/-- The inner product of a row of `A` and a row of `B` is an entry of `B * Aᴴ`. -/
1123
1145
theorem inner_matrix_row_row [Fintype n] (A B : Matrix m n 𝕜) (i j : m) :
@@ -1127,7 +1149,7 @@ theorem inner_matrix_row_row [Fintype n] (A B : Matrix m n 𝕜) (i j : m) :
1127
1149
/-- The inner product of a column of `A` and a column of `B` is an entry of `Aᴴ * B`. -/
1128
1150
theorem inner_matrix_col_col [Fintype m] (A B : Matrix m n 𝕜) (i j : n) :
1129
1151
⟪Aᵀ i, Bᵀ j⟫ₑ = (Aᴴ * B) i j := by
1130
- simp_rw [EuclideanSpace.inner_piLp_equiv_symm , Matrix.mul_apply',
1152
+ simp_rw [EuclideanSpace.inner_toLp_toLp , Matrix.mul_apply',
1131
1153
Matrix.conjTranspose_apply, dotProduct_comm, Pi.star_def]
1132
1154
rfl
1133
1155
0 commit comments