Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 7b4680f

Browse files
committed
feat(analysis/inner_product_space/pi_L2): Distance formula in the euclidean space (#14642)
A few missing results about `pi_Lp 2` and `euclidean_space`.
1 parent ac0ce64 commit 7b4680f

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

src/analysis/inner_product_space/pi_L2.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,18 @@ lemma euclidean_space.nnnorm_eq {𝕜 : Type*} [is_R_or_C 𝕜] {n : Type*} [fin
9898
(x : euclidean_space 𝕜 n) : ∥x∥₊ = nnreal.sqrt (∑ i, ∥x i∥₊ ^ 2) :=
9999
pi_Lp.nnnorm_eq_of_L2 x
100100

101+
lemma euclidean_space.dist_eq {𝕜 : Type*} [is_R_or_C 𝕜] {n : Type*} [fintype n]
102+
(x y : euclidean_space 𝕜 n) : dist x y = (∑ i, dist (x i) (y i) ^ 2).sqrt :=
103+
(pi_Lp.dist_eq_of_L2 x y : _)
104+
105+
lemma euclidean_space.nndist_eq {𝕜 : Type*} [is_R_or_C 𝕜] {n : Type*} [fintype n]
106+
(x y : euclidean_space 𝕜 n) : nndist x y = (∑ i, nndist (x i) (y i) ^ 2).sqrt :=
107+
(pi_Lp.nndist_eq_of_L2 x y : _)
108+
109+
lemma euclidean_space.edist_eq {𝕜 : Type*} [is_R_or_C 𝕜] {n : Type*} [fintype n]
110+
(x y : euclidean_space 𝕜 n) : edist x y = (∑ i, edist (x i) (y i) ^ 2) ^ (1 / 2 : ℝ) :=
111+
(pi_Lp.edist_eq_of_L2 x y : _)
112+
101113
variables [fintype ι]
102114

103115
section

src/analysis/normed_space/pi_Lp.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,18 @@ lemma nnnorm_eq_of_L2 {β : ι → Type*} [Π i, semi_normed_group (β i)] (x :
312312
∥x∥₊ = nnreal.sqrt (∑ (i : ι), ∥x i∥₊ ^ 2) :=
313313
subtype.ext $ by { push_cast, exact norm_eq_of_L2 x }
314314

315+
lemma dist_eq_of_L2 {β : ι → Type*} [Π i, semi_normed_group (β i)] (x y : pi_Lp 2 β) :
316+
dist x y = (∑ i, dist (x i) (y i) ^ 2).sqrt :=
317+
by simp_rw [dist_eq_norm, norm_eq_of_L2, pi.sub_apply]
318+
319+
lemma nndist_eq_of_L2 {β : ι → Type*} [Π i, semi_normed_group (β i)] (x y : pi_Lp 2 β) :
320+
nndist x y = (∑ i, nndist (x i) (y i) ^ 2).sqrt :=
321+
subtype.ext $ by { push_cast, exact dist_eq_of_L2 _ _ }
322+
323+
lemma edist_eq_of_L2 {β : ι → Type*} [Π i, semi_normed_group (β i)] (x y : pi_Lp 2 β) :
324+
edist x y = (∑ i, edist (x i) (y i) ^ 2) ^ (1 / 2 : ℝ) :=
325+
by simp_rw [pi_Lp.edist_eq, ennreal.rpow_two]
326+
315327
include fact_one_le_p
316328

317329
variables [normed_field 𝕜]

0 commit comments

Comments
 (0)