Skip to content

Commit 4055c8b

Browse files
committed
feat: change definition for p = 0 in piLp (#8290)
The current definition of the distance in `piLp` uses the distance for `p > 0`, but avoids it for `p = 0`. We change the definition for `p = 0` to also have it in terms of the distance, to make sure it is reasonable even when one uses non-Hausdorff spaces.This matches what has been done for `prodLp` in #6136.
1 parent 7901bf4 commit 4055c8b

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

Mathlib/Analysis/NormedSpace/LpEquiv.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ theorem coe_equiv_lpPiLp_symm (f : PiLp p E) : (Equiv.lpPiLp.symm f : ∀ i, E i
7474

7575
theorem equiv_lpPiLp_norm (f : lp E p) : ‖Equiv.lpPiLp f‖ = ‖f‖ := by
7676
rcases p.trichotomy with (rfl | rfl | h)
77-
· rw [PiLp.norm_eq_card, lp.norm_eq_card_dsupport]
77+
· simp [Equiv.lpPiLp, PiLp.norm_eq_card, lp.norm_eq_card_dsupport]
7878
· rw [PiLp.norm_eq_ciSup, lp.norm_eq_ciSup]; rfl
7979
· rw [PiLp.norm_eq_sum h, lp.norm_eq_tsum_rpow h, tsum_fintype]; rfl
8080
#align equiv_lp_pi_Lp_norm equiv_lpPiLp_norm

Mathlib/Analysis/NormedSpace/PiLp.lean

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ is given by
1919
$$
2020
d(x, y) = \left(\sum d(x_i, y_i)^p\right)^{1/p}.
2121
$$,
22-
whereas for `p = 0` it is the cardinality of the set ${ i | x_i ≠ y_i}$. For `p = ∞` the distance
23-
is the supremum of the distances.
22+
whereas for `p = 0` it is the cardinality of the set ${i | d (x_i, y_i) ≠ 0}$. For `p = ∞` the
23+
distance is the supremum of the distances.
2424
2525
We give instances of this construction for emetric spaces, metric spaces, normed groups and normed
2626
spaces.
@@ -129,13 +129,14 @@ satisfying a relaxed triangle inequality. The terminology for this varies throug
129129
literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/
130130
instance : EDist (PiLp p β) where
131131
edist f g :=
132-
if p = 0 then { i | f ig i }.toFinite.toFinset.card
132+
if p = 0 then {i | edist (f i) (g i) ≠ 0}.toFinite.toFinset.card
133133
else
134134
if p = ∞ then ⨆ i, edist (f i) (g i) else (∑ i, edist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal)
135135

136136
variable {β}
137137

138-
theorem edist_eq_card (f g : PiLp 0 β) : edist f g = { i | f i ≠ g i }.toFinite.toFinset.card :=
138+
theorem edist_eq_card (f g : PiLp 0 β) :
139+
edist f g = {i | edist (f i) (g i) ≠ 0}.toFinite.toFinset.card :=
139140
if_pos rfl
140141
#align pi_Lp.edist_eq_card PiLp.edist_eq_card
141142

@@ -170,7 +171,7 @@ protected theorem edist_self (f : PiLp p β) : edist f f = 0 := by
170171
from `pi_Lp.pseudo_emetric_space` so it can be used also for `p < 1`. -/
171172
protected theorem edist_comm (f g : PiLp p β) : edist f g = edist g f := by
172173
rcases p.trichotomy with (rfl | rfl | h)
173-
· simp only [edist_eq_card, eq_comm, Ne.def]
174+
· simp only [edist_eq_card, edist_comm]
174175
· simp only [edist_eq_iSup, edist_comm]
175176
· simp only [edist_eq_sum h, edist_comm]
176177
#align pi_Lp.edist_comm PiLp.edist_comm
@@ -190,13 +191,14 @@ satisfying a relaxed triangle inequality. The terminology for this varies throug
190191
literature, but it is sometimes called a *quasi-metric* or *semi-metric*. -/
191192
instance : Dist (PiLp p α) where
192193
dist f g :=
193-
if _hp : p = 0 then { i | f ig i }.toFinite.toFinset.card
194+
if p = 0 then {i | dist (f i) (g i) ≠ 0}.toFinite.toFinset.card
194195
else
195196
if p = ∞ then ⨆ i, dist (f i) (g i) else (∑ i, dist (f i) (g i) ^ p.toReal) ^ (1 / p.toReal)
196197

197198
variable {α}
198199

199-
theorem dist_eq_card (f g : PiLp 0 α) : dist f g = { i | f i ≠ g i }.toFinite.toFinset.card :=
200+
theorem dist_eq_card (f g : PiLp 0 α) :
201+
dist f g = {i | dist (f i) (g i) ≠ 0}.toFinite.toFinset.card :=
200202
if_pos rfl
201203
#align pi_Lp.dist_eq_card PiLp.dist_eq_card
202204

@@ -215,7 +217,7 @@ end Dist
215217

216218
section Norm
217219

218-
variable [∀ i, Norm (β i)] [∀ i, Zero (β i)]
220+
variable [∀ i, Norm (β i)]
219221

220222
/-- Endowing the space `PiLp p β` with the `L^p` norm. We register this instance
221223
separate from `PiLp.seminormedAddCommGroup` since the latter requires the type class hypothesis
@@ -225,13 +227,13 @@ Registering this separately allows for a future norm-like structure on `PiLp p
225227
satisfying a relaxed triangle inequality. These are called *quasi-norms*. -/
226228
instance hasNorm : Norm (PiLp p β) where
227229
norm f :=
228-
if _hp : p = 0 then { i | f i ≠ 0 }.toFinite.toFinset.card
230+
if p = 0 then {i | f i0}.toFinite.toFinset.card
229231
else if p = ∞ then ⨆ i, ‖f i‖ else (∑ i, ‖f i‖ ^ p.toReal) ^ (1 / p.toReal)
230232
#align pi_Lp.has_norm PiLp.hasNorm
231233

232234
variable {p β}
233235

234-
theorem norm_eq_card (f : PiLp 0 β) : ‖f‖ = { i | f i ≠ 0 }.toFinite.toFinset.card :=
236+
theorem norm_eq_card (f : PiLp 0 β) : ‖f‖ = {i | f i0}.toFinite.toFinset.card :=
235237
if_pos rfl
236238
#align pi_Lp.norm_eq_card PiLp.norm_eq_card
237239

0 commit comments

Comments
 (0)