Skip to content

Commit f7ae959

Browse files
feat(Topology): generalize basic files to Weak(Pseudo)EMetricSpace (#42688)
Similar to #42662 Co-authored-by: Batixx <s59fpern@uni-bonn.de>
1 parent 6d2679b commit f7ae959

6 files changed

Lines changed: 77 additions & 70 deletions

File tree

Mathlib/Topology/EMetricSpace/Basic.lean

Lines changed: 61 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ open Set Filter
2626

2727
universe u v w
2828

29-
variable {α : Type u} {β : Type v} {X : Type*}
29+
variableγ : Type u} {β : Type v} {X : Type*}
3030

3131
open scoped Uniformity Topology NNReal ENNReal Pointwise
3232

33-
variable [PseudoEMetricSpace α]
33+
variable [TopologicalSpace α] [WeakPseudoEMetricSpace α] [PseudoEMetricSpace γ]
3434

3535
/-- The triangle (polygon) inequality for sequences of points; `Finset.Ico` version. -/
3636
theorem edist_le_Ico_sum_edist (f : ℕ → α) {m n} (h : m ≤ n) :
@@ -66,36 +66,36 @@ theorem edist_le_range_sum_of_edist_le {f : ℕ → α} (n : ℕ) {d : ℕ →
6666

6767
namespace EMetric
6868

69-
theorem isUniformInducing_iff [PseudoEMetricSpace β] {f : α → β} :
69+
theorem isUniformInducing_iff [PseudoEMetricSpace β] {f : γ → β} :
7070
IsUniformInducing f ↔ UniformContinuous f ∧
71-
∀ δ > 0, ∃ ε > 0, ∀ {a b : α}, edist (f a) (f b) < ε → edist a b < δ :=
71+
∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, edist (f a) (f b) < ε → edist a b < δ :=
7272
isUniformInducing_iff'.trans <| Iff.rfl.and <|
7373
((uniformity_basis_edist.comap _).le_basis_iff uniformity_basis_edist).trans <| by
7474
simp only [subset_def, Prod.forall]; rfl
7575

7676
/-- ε-δ characterization of uniform embeddings on pseudoemetric spaces -/
77-
nonrec theorem isUniformEmbedding_iff [PseudoEMetricSpace β] {f : α → β} :
77+
nonrec theorem isUniformEmbedding_iff [PseudoEMetricSpace β] {f : γ → β} :
7878
IsUniformEmbedding f ↔ Function.Injective f ∧ UniformContinuous f ∧
79-
∀ δ > 0, ∃ ε > 0, ∀ {a b : α}, edist (f a) (f b) < ε → edist a b < δ :=
79+
∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, edist (f a) (f b) < ε → edist a b < δ :=
8080
(isUniformEmbedding_iff _).trans <| and_comm.trans <| Iff.rfl.and isUniformInducing_iff
8181

8282
/-- If a map between pseudoemetric spaces is a uniform inducing map then the edistance between `f x`
8383
and `f y` is controlled in terms of the distance between `x` and `y`. -/
84-
theorem controlled_of_isUniformInducing [PseudoEMetricSpace β] {f : α → β}
84+
theorem controlled_of_isUniformInducing [PseudoEMetricSpace β] {f : γ → β}
8585
(h : IsUniformInducing f) :
86-
(∀ ε > 0, ∃ δ > 0, ∀ {a b : α}, edist a b < δ → edist (f a) (f b) < ε) ∧
87-
∀ δ > 0, ∃ ε > 0, ∀ {a b : α}, edist (f a) (f b) < ε → edist a b < δ :=
86+
(∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, edist a b < δ → edist (f a) (f b) < ε) ∧
87+
∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, edist (f a) (f b) < ε → edist a b < δ :=
8888
⟨uniformContinuous_iff.1 h.uniformContinuous, (isUniformInducing_iff.1 h).2
8989

9090
@[deprecated controlled_of_isUniformInducing (since := "2026-04-01")]
91-
theorem controlled_of_isUniformEmbedding [PseudoEMetricSpace β] {f : α → β}
91+
theorem controlled_of_isUniformEmbedding [PseudoEMetricSpace β] {f : γ → β}
9292
(h : IsUniformEmbedding f) :
93-
(∀ ε > 0, ∃ δ > 0, ∀ {a b : α}, edist a b < δ → edist (f a) (f b) < ε) ∧
94-
∀ δ > 0, ∃ ε > 0, ∀ {a b : α}, edist (f a) (f b) < ε → edist a b < δ :=
93+
(∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, edist a b < δ → edist (f a) (f b) < ε) ∧
94+
∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, edist (f a) (f b) < ε → edist a b < δ :=
9595
controlled_of_isUniformInducing h.toIsUniformInducing
9696

9797
/-- ε-δ characterization of Cauchy sequences on pseudoemetric spaces -/
98-
protected theorem cauchy_iff {f : Filter α} :
98+
protected theorem cauchy_iff {f : Filter γ} :
9999
Cauchy f ↔ f ≠ ⊥ ∧ ∀ ε > 0, ∃ t ∈ f, ∀ x, x ∈ t → ∀ y, y ∈ t → edist x y < ε := by
100100
rw [← neBot_iff]; exact uniformity_basis_edist.cauchy_iff
101101

@@ -105,19 +105,19 @@ converging. This is often applied for `B N = 2^{-N}`, i.e., with a very fast con
105105
`0`, which makes it possible to use arguments of converging series, while this is impossible
106106
to do in general for arbitrary Cauchy sequences. -/
107107
theorem complete_of_convergent_controlled_sequences (B : ℕ → ℝ≥0∞) (hB : ∀ n, 0 < B n)
108-
(H : ∀ u : ℕ → α, (∀ N n m : ℕ, N ≤ n → N ≤ m → edist (u n) (u m) < B N) →
108+
(H : ∀ u : ℕ → γ, (∀ N n m : ℕ, N ≤ n → N ≤ m → edist (u n) (u m) < B N) →
109109
∃ x, Tendsto u atTop (𝓝 x)) :
110-
CompleteSpace α :=
110+
CompleteSpace γ :=
111111
UniformSpace.complete_of_convergent_controlled_sequences
112-
(fun n => { p : α × α | edist p.1 p.2 < B n }) (fun n => edist_mem_uniformity <| hB n) H
112+
(fun n => { p : γ × γ | edist p.1 p.2 < B n }) (fun n => edist_mem_uniformity <| hB n) H
113113

114114
/-- A sequentially complete pseudoemetric space is complete. -/
115115
theorem complete_of_cauchySeq_tendsto :
116-
(∀ u : ℕ → α, CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)) → CompleteSpace α :=
116+
(∀ u : ℕ → γ, CauchySeq u → ∃ a, Tendsto u atTop (𝓝 a)) → CompleteSpace γ :=
117117
UniformSpace.complete_of_cauchySeq_tendsto
118118

119119
/-- Expressing locally uniform convergence on a set using `edist`. -/
120-
theorem tendstoLocallyUniformlyOn_iff {ι : Type*} [TopologicalSpace β] {F : ι → β → α} {f : β → α}
120+
theorem tendstoLocallyUniformlyOn_iff {ι : Type*} [TopologicalSpace β] {F : ι → β → γ} {f : β → γ}
121121
{p : Filter ι} {s : Set β} :
122122
TendstoLocallyUniformlyOn F f p s ↔
123123
∀ ε > 0, ∀ x ∈ s, ∃ t ∈ 𝓝[s] x, ∀ᶠ n in p, ∀ y ∈ t, edist (f y) (F n y) < ε := by
@@ -127,22 +127,22 @@ theorem tendstoLocallyUniformlyOn_iff {ι : Type*} [TopologicalSpace β] {F : ι
127127
exact ⟨t, ht, Ht.mono fun n hs x hx => hε (hs x hx)⟩
128128

129129
/-- Expressing uniform convergence on a set using `edist`. -/
130-
theorem tendstoUniformlyOn_iff {ι : Type*} {F : ι → β → α} {f : β → α} {p : Filter ι} {s : Set β} :
130+
theorem tendstoUniformlyOn_iff {ι : Type*} {F : ι → β → γ} {f : β → γ} {p : Filter ι} {s : Set β} :
131131
TendstoUniformlyOn F f p s ↔ ∀ ε > 0, ∀ᶠ n in p, ∀ x ∈ s, edist (f x) (F n x) < ε := by
132132
refine ⟨fun H ε hε => H _ (edist_mem_uniformity hε), fun H u hu => ?_⟩
133133
rcases mem_uniformity_edist.1 hu with ⟨ε, εpos, hε⟩
134134
exact (H ε εpos).mono fun n hs x hx => hε (hs x hx)
135135

136136
/-- Expressing locally uniform convergence using `edist`. -/
137-
theorem tendstoLocallyUniformly_iff {ι : Type*} [TopologicalSpace β] {F : ι → β → α} {f : β → α}
137+
theorem tendstoLocallyUniformly_iff {ι : Type*} [TopologicalSpace β] {F : ι → β → γ} {f : β → γ}
138138
{p : Filter ι} :
139139
TendstoLocallyUniformly F f p ↔
140140
∀ ε > 0, ∀ x : β, ∃ t ∈ 𝓝 x, ∀ᶠ n in p, ∀ y ∈ t, edist (f y) (F n y) < ε := by
141141
simp only [← tendstoLocallyUniformlyOn_univ, tendstoLocallyUniformlyOn_iff, mem_univ,
142142
forall_const, nhdsWithin_univ]
143143

144144
/-- Expressing uniform convergence using `edist`. -/
145-
theorem tendstoUniformly_iff {ι : Type*} {F : ι → β → α} {f : β → α} {p : Filter ι} :
145+
theorem tendstoUniformly_iff {ι : Type*} {F : ι → β → γ} {f : β → γ} {p : Filter ι} :
146146
TendstoUniformly F f p ↔ ∀ ε > 0, ∀ᶠ n in p, ∀ x, edist (f x) (F n x) < ε := by
147147
simp only [← tendstoUniformlyOn_univ, tendstoUniformlyOn_iff, mem_univ, forall_const]
148148

@@ -154,7 +154,7 @@ namespace EMetric
154154

155155
variable {x y z : α} {ε ε₁ ε₂ : ℝ≥0∞} {s t : Set α}
156156

157-
theorem inseparable_iff : Inseparable x y ↔ edist x y = 0 := by
157+
theorem inseparable_iff {x y : γ} : Inseparable x y ↔ edist x y = 0 := by
158158
simp [inseparable_iff_mem_closure, mem_closure_iff, edist_comm, forall_gt_iff_le]
159159

160160
alias ⟨_root_.Inseparable.edist_eq_zero, _⟩ := EMetric.inseparable_iff
@@ -174,29 +174,29 @@ instance (priority := 100) {α} [EMetricSpace α] [Nontrivial α] : NontrivialTo
174174

175175
/-- In a pseudoemetric space, Cauchy sequences are characterized by the fact that, eventually,
176176
the pseudoedistance between its elements is arbitrarily small -/
177-
theorem cauchySeq_iff [Nonempty β] [SemilatticeSup β] {u : β → α} :
177+
theorem cauchySeq_iff [Nonempty β] [SemilatticeSup β] {u : β → γ} :
178178
CauchySeq u ↔ ∀ ε > 0, ∃ N, ∀ m, N ≤ m → ∀ n, N ≤ n → edist (u m) (u n) < ε :=
179179
uniformity_basis_edist.cauchySeq_iff
180180

181181
/-- A variation around the emetric characterization of Cauchy sequences -/
182-
theorem cauchySeq_iff' [Nonempty β] [SemilatticeSup β] {u : β → α} :
182+
theorem cauchySeq_iff' [Nonempty β] [SemilatticeSup β] {u : β → γ} :
183183
CauchySeq u ↔ ∀ ε > (0 : ℝ≥0∞), ∃ N, ∀ n ≥ N, edist (u n) (u N) < ε :=
184184
uniformity_basis_edist.cauchySeq_iff'
185185

186186
/-- A variation of the emetric characterization of Cauchy sequences that deals with
187187
`ℝ≥0` upper bounds. -/
188-
theorem cauchySeq_iff_NNReal [Nonempty β] [SemilatticeSup β] {u : β → α} :
188+
theorem cauchySeq_iff_NNReal [Nonempty β] [SemilatticeSup β] {u : β → γ} :
189189
CauchySeq u ↔ ∀ ε : ℝ≥0, 0 < ε → ∃ N, ∀ n, N ≤ n → edist (u n) (u N) < ε :=
190190
uniformity_basis_edist_nnreal.cauchySeq_iff'
191191

192-
theorem totallyBounded_iff {s : Set α} :
193-
TotallyBounded s ↔ ∀ ε > 0, ∃ t : Set α, t.Finite ∧ s ⊆ ⋃ y ∈ t, eball y ε :=
192+
theorem totallyBounded_iff {s : Set γ} :
193+
TotallyBounded s ↔ ∀ ε > 0, ∃ t : Set γ, t.Finite ∧ s ⊆ ⋃ y ∈ t, eball y ε :=
194194
fun H _ε ε0 => H _ (edist_mem_uniformity ε0), fun H _r ru =>
195195
let ⟨ε, ε0, hε⟩ := mem_uniformity_edist.1 ru
196196
let ⟨t, ft, h⟩ := H ε ε0
197197
⟨t, ft, h.trans <| iUnion₂_mono fun _ _ _ => hε⟩⟩
198198

199-
theorem totallyBounded_iff' {s : Set α} :
199+
theorem totallyBounded_iff' {s : Set γ} :
200200
TotallyBounded s ↔ ∀ ε > 0, ∃ t, t ⊆ s ∧ Set.Finite t ∧ s ⊆ ⋃ y ∈ t, eball y ε :=
201201
fun H _ε ε0 => (totallyBounded_iff_subset.1 H) _ (edist_mem_uniformity ε0), fun H _r ru =>
202202
let ⟨ε, ε0, hε⟩ := mem_uniformity_edist.1 ru
@@ -205,22 +205,28 @@ theorem totallyBounded_iff' {s : Set α} :
205205

206206
section Compact
207207

208-
/-- For a set `s` in a pseudo emetric space, if for every `ε > 0` there exists a countable
208+
/-- For a set `s` in a weak pseudo emetric space, if for every `ε > 0` there exists a countable
209209
set that is `ε`-dense in `s`, then there exists a countable subset `t ⊆ s` that is dense in `s`. -/
210210
theorem subset_countable_closure_of_almost_dense_set (s : Set α)
211211
(hs : ∀ ε > 0, ∃ t : Set α, t.Countable ∧ s ⊆ ⋃ x ∈ t, Metric.closedEBall x ε) :
212-
∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ closure t := by
213-
apply UniformSpace.subset_countable_closure_of_almost_dense_set
214-
intro U hU
215-
obtain ⟨ε, hε, hεU⟩ := uniformity_basis_edist_le.mem_iff.1 hU
216-
obtain ⟨t, tC, ht⟩ := hs ε hε
217-
refine ⟨t, tC, ht.trans (iUnion₂_mono fun x hx y hy => UniformSpace.ball_mono hεU x ?_)⟩
218-
rwa [mem_closedEBall, edist_comm] at hy
212+
∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ closure t :=
213+
let m : PseudoEMetricSpace α :=
214+
PseudoEMetricSpace.ofEDist edist edist_self edist_comm edist_triangle
215+
have hmetric :
216+
∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ @closure α m.toUniformSpace.toTopologicalSpace t := by
217+
apply UniformSpace.subset_countable_closure_of_almost_dense_set
218+
intro U hU
219+
obtain ⟨ε, hε, hεU⟩ := uniformity_basis_edist_le.mem_iff.1 hU
220+
obtain ⟨t, tC, ht⟩ := hs ε hε
221+
refine ⟨t, tC, ht.trans (iUnion₂_mono fun x hx y hy => UniformSpace.ball_mono hεU x ?_)⟩
222+
rwa [mem_closedEBall, edist_comm] at hy
223+
let ⟨t, hts, htc, hst⟩ := hmetric
224+
⟨t, hts, htc, hst.trans <| closure.mono WeakPseudoEMetricSpace.topology_le⟩
219225

220226
-- TODO: generalize to metrizable spaces
221227
/-- A compact set in a pseudo emetric space is separable, i.e., it is a subset of the closure of a
222228
countable set. -/
223-
theorem subset_countable_closure_of_compact {s : Set α} (hs : IsCompact s) :
229+
theorem subset_countable_closure_of_compact {s : Set γ} (hs : IsCompact s) :
224230
∃ t, t ⊆ s ∧ t.Countable ∧ s ⊆ closure t := by
225231
refine subset_countable_closure_of_almost_dense_set s fun ε hε => ?_
226232
rcases totallyBounded_iff'.1 hs.totallyBounded ε hε with ⟨t, -, htf, hst⟩
@@ -232,24 +238,24 @@ section SecondCountable
232238

233239
open TopologicalSpace
234240

235-
variable (α) in
241+
variable (γ) in
236242
/-- A sigma compact pseudo emetric space has second countable topology. -/
237-
instance (priority := 90) secondCountable_of_sigmaCompact [SigmaCompactSpace α] :
238-
SecondCountableTopology α := by
239-
suffices SeparableSpace α by exact UniformSpace.secondCountable_of_separable α
243+
instance (priority := 90) secondCountable_of_sigmaCompact [SigmaCompactSpace γ] :
244+
SecondCountableTopology γ := by
245+
suffices SeparableSpace γ by exact UniformSpace.secondCountable_of_separable γ
240246
choose T _ hTc hsubT using fun n =>
241-
subset_countable_closure_of_compact (isCompact_compactCovering α n)
247+
subset_countable_closure_of_compact (isCompact_compactCovering γ n)
242248
refine ⟨⟨⋃ n, T n, countable_iUnion hTc, fun x => ?_⟩⟩
243-
rcases iUnion_eq_univ_iff.1 (iUnion_compactCovering α) x with ⟨n, hn⟩
249+
rcases iUnion_eq_univ_iff.1 (iUnion_compactCovering γ) x with ⟨n, hn⟩
244250
exact closure_mono (subset_iUnion _ n) (hsubT _ hn)
245251

246252
theorem secondCountable_of_almost_dense_set
247-
(hs : ∀ ε > 0, ∃ t : Set α, t.Countable ∧ ⋃ x ∈ t, closedEBall x ε = univ) :
248-
SecondCountableTopology α := by
249-
suffices SeparableSpace α from UniformSpace.secondCountable_of_separable α
250-
have : ∀ ε > 0, ∃ t : Set α, Set.Countable t ∧ univ ⊆ ⋃ x ∈ t, closedEBall x ε := by
253+
(hs : ∀ ε > 0, ∃ t : Set γ, t.Countable ∧ ⋃ x ∈ t, closedEBall x ε = univ) :
254+
SecondCountableTopology γ := by
255+
suffices SeparableSpace γ from UniformSpace.secondCountable_of_separable γ
256+
have : ∀ ε > 0, ∃ t : Set γ, Set.Countable t ∧ univ ⊆ ⋃ x ∈ t, closedEBall x ε := by
251257
simpa only [univ_subset_iff] using hs
252-
rcases subset_countable_closure_of_almost_dense_set (univ : Set α) this with ⟨t, -, htc, ht⟩
258+
rcases subset_countable_closure_of_almost_dense_set (univ : Set γ) this with ⟨t, -, htc, ht⟩
253259
exact ⟨⟨t, htc, fun x => ht (mem_univ x)⟩⟩
254260

255261
end SecondCountable
@@ -318,35 +324,35 @@ instance [PseudoEMetricSpace X] : EMetricSpace (SeparationQuotient X) :=
318324

319325
section LebesgueNumberLemma
320326

321-
variable {s : Set α}
327+
variable {s : Set γ}
322328

323-
theorem lebesgue_number_lemma_of_emetric {ι : Sort*} {c : ι → Set α} (hs : IsCompact s)
329+
theorem lebesgue_number_lemma_of_emetric {ι : Sort*} {c : ι → Set γ} (hs : IsCompact s)
324330
(hc₁ : ∀ i, IsOpen (c i)) (hc₂ : s ⊆ ⋃ i, c i) : ∃ δ > 0, ∀ x ∈ s, ∃ i, eball x δ ⊆ c i := by
325331
simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm]
326332
using uniformity_basis_edist.lebesgue_number_lemma hs hc₁ hc₂
327333

328-
theorem lebesgue_number_lemma_of_emetric_nhds' {c : (x : α) → x ∈ s → Set α} (hs : IsCompact s)
334+
theorem lebesgue_number_lemma_of_emetric_nhds' {c : (x : γ) → x ∈ s → Set γ} (hs : IsCompact s)
329335
(hc : ∀ x hx, c x hx ∈ 𝓝 x) : ∃ δ > 0, ∀ x ∈ s, ∃ y : s, eball x δ ⊆ c y y.2 := by
330336
simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm]
331337
using uniformity_basis_edist.lebesgue_number_lemma_nhds' hs hc
332338

333-
theorem lebesgue_number_lemma_of_emetric_nhds {c : α → Set α} (hs : IsCompact s)
339+
theorem lebesgue_number_lemma_of_emetric_nhds {c : γ → Set γ} (hs : IsCompact s)
334340
(hc : ∀ x ∈ s, c x ∈ 𝓝 x) : ∃ δ > 0, ∀ x ∈ s, ∃ y, eball x δ ⊆ c y := by
335341
simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm]
336342
using uniformity_basis_edist.lebesgue_number_lemma_nhds hs hc
337343

338-
theorem lebesgue_number_lemma_of_emetric_nhdsWithin' {c : (x : α) → x ∈ s → Set α}
344+
theorem lebesgue_number_lemma_of_emetric_nhdsWithin' {c : (x : γ) → x ∈ s → Set γ}
339345
(hs : IsCompact s) (hc : ∀ x hx, c x hx ∈ 𝓝[s] x) :
340346
∃ δ > 0, ∀ x ∈ s, ∃ y : s, eball x δ ∩ s ⊆ c y y.2 := by
341347
simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm]
342348
using uniformity_basis_edist.lebesgue_number_lemma_nhdsWithin' hs hc
343349

344-
theorem lebesgue_number_lemma_of_emetric_nhdsWithin {c : α → Set α} (hs : IsCompact s)
350+
theorem lebesgue_number_lemma_of_emetric_nhdsWithin {c : γ → Set γ} (hs : IsCompact s)
345351
(hc : ∀ x ∈ s, c x ∈ 𝓝[s] x) : ∃ δ > 0, ∀ x ∈ s, ∃ y, eball x δ ∩ s ⊆ c y := by
346352
simpa only [eball, UniformSpace.ball, preimage_ofPred_eq, edist_comm]
347353
using uniformity_basis_edist.lebesgue_number_lemma_nhdsWithin hs hc
348354

349-
theorem lebesgue_number_lemma_of_emetric_sUnion {c : Set (Set α)} (hs : IsCompact s)
355+
theorem lebesgue_number_lemma_of_emetric_sUnion {c : Set (Set γ)} (hs : IsCompact s)
350356
(hc₁ : ∀ t ∈ c, IsOpen t) (hc₂ : s ⊆ ⋃₀ c) : ∃ δ > 0, ∀ x ∈ s, ∃ t ∈ c, eball x δ ⊆ t := by
351357
rw [sUnion_eq_iUnion] at hc₂; simpa using lebesgue_number_lemma_of_emetric hs (by simpa) hc₂
352358

Mathlib/Topology/EMetricSpace/Diam.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ variable {α X : Type*} {s t : Set X} {x y z : X}
2424

2525
namespace Metric
2626

27-
section PseudoEMetricSpace
28-
29-
variable [PseudoEMetricSpace X]
27+
section WeakPseudoEMetricSpace
3028

3129
/-- The diameter of a set in a pseudoemetric space as an extended nonnegative real number. -/
32-
noncomputable def ediam (s : Set X) :=
30+
noncomputable def ediam [EDist X] (s : Set X) :=
3331
⨆ (x ∈ s) (y ∈ s), edist x y
3432

33+
variable [TopologicalSpace X] [WeakPseudoEMetricSpace X]
34+
3535
theorem ediam_eq_sSup (s : Set X) : ediam s = sSup (image2 edist s s) := sSup_image2.symm
3636

3737
theorem ediam_le_iff {d : ℝ≥0∞} : ediam s ≤ d ↔ ∀ x ∈ s, ∀ y ∈ s, edist x y ≤ d := by
@@ -135,11 +135,11 @@ theorem ediam_pi_le_of_le {ι : Type*} {X : ι → Type*} [Fintype ι] [∀ i, P
135135
rw [mem_univ_pi] at hx hy
136136
exact fun b => ediam_le_iff.1 (h b) (x b) (hx b) (y b) (hy b)
137137

138-
end PseudoEMetricSpace
138+
end WeakPseudoEMetricSpace
139139

140-
section EMetricSpace
140+
section WeakEMetricSpace
141141

142-
variable [EMetricSpace X]
142+
variable [TopologicalSpace X] [WeakEMetricSpace X]
143143

144144
theorem ediam_eq_zero_iff : ediam s = 0 ↔ s.Subsingleton :=
145145
fun h _x hx _y hy => edist_le_zero.1 <| h ▸ edist_le_ediam_of_mem hx hy, ediam_subsingleton⟩
@@ -150,6 +150,6 @@ theorem ediam_pos_iff : 0 < ediam s ↔ s.Nontrivial := by
150150
theorem ediam_pos_iff' : 0 < ediam s ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y := by
151151
simp only [ediam_pos_iff, Set.Nontrivial]
152152

153-
end EMetricSpace
153+
end WeakEMetricSpace
154154

155155
end Metric

Mathlib/Topology/EMetricSpace/MulOpposite.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public import Mathlib.Topology.EMetricSpace.Defs
1111
/-!
1212
# Extended metric spaces on multiplicative opposites
1313
14-
This file proves that if `α` is some (weak) pseudo extended metric space, so it `αᵐᵒᵖ`.
14+
This file proves that if `α` is some (weak) pseudo extended metric space, so is `αᵐᵒᵖ`.
1515
We do this in this file instead of `Mathlib/Topology/EMetricSpace/Defs.lean` to avoid imports.
1616
-/
1717

Mathlib/Topology/EMetricSpace/PairReduction.lean

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,8 @@ taking supremums completes the proof (see `iSup_edist_pairSet`).
105105

106106
open scoped ENNReal NNReal Finset
107107

108-
variable {T : Type*} [PseudoEMetricSpace T] {a c : ℝ≥0∞} {n : ℕ} {V J : Finset T} {t : T}
108+
variable {T : Type*} [TopologicalSpace T] [WeakPseudoEMetricSpace T]
109+
{a c : ℝ≥0∞} {n : ℕ} {V J : Finset T} {t : T}
109110

110111
namespace PairReduction
111112

@@ -392,7 +393,8 @@ lemma edist_le_of_mem_pairSet (ha : 1 < a) (hJ_card : #J ≤ a ^ n) {s t : T}
392393
obtain ⟨⟨ht, hdist⟩, rfl⟩ := h'
393394
grw [hdist, radius_logSizeBallSeq_le hJ ha hn hJ_card i]
394395

395-
lemma iSup_edist_pairSet {E : Type*} [PseudoEMetricSpace E] (ha : 1 < a) (f : T → E) :
396+
lemma iSup_edist_pairSet {E : Type*} [TopologicalSpace E] [WeakPseudoEMetricSpace E] (ha : 1 < a)
397+
(f : T → E) :
396398
⨆ (s : J) (t : { t : J // edist s t ≤ c}), edist (f s) (f t)
397399
2 * ⨆ p : pairSet J a c, edist (f p.1.1) (f p.1.2) := by
398400
rw [iSup_le_iff]; rintro ⟨s, hs⟩
@@ -473,8 +475,8 @@ set `K ⊆ J²` such that for any function `f : T → E`:
473475
2. `∀ (s, t) ∈ K, d(s, t) ≤ cn`
474476
3. `sup_{s, t ∈ J : d(s, t) ≤ c} d(f(s), f(t)) ≤ 2 sup_{(s, t) ∈ K} d(f(s), f(t))`
475477
-/
476-
theorem EMetric.pair_reduction
477-
(hJ_card : #J ≤ a ^ n) (c : ℝ≥0∞) (E : Type*) [PseudoEMetricSpace E] :
478+
theorem EMetric.pair_reduction (hJ_card : #J ≤ a ^ n) (c : ℝ≥0∞) (E : Type*) [TopologicalSpace E]
479+
[WeakPseudoEMetricSpace E] :
478480
∃ K : Finset (T × T), K ⊆ J ×ˢ J
479481
∧ #K ≤ a * #J
480482
∧ (∀ s t, (s, t) ∈ K → edist s t ≤ n * c)

0 commit comments

Comments
 (0)