Skip to content

Commit f2871ac

Browse files
committed
chore: splitting up metric spaces files (#15790)
1 parent 925a304 commit f2871ac

30 files changed

+1581
-1371
lines changed

Mathlib.lean

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4436,6 +4436,8 @@ import Mathlib.Topology.DerivedSet
44364436
import Mathlib.Topology.DiscreteQuotient
44374437
import Mathlib.Topology.DiscreteSubset
44384438
import Mathlib.Topology.EMetricSpace.Basic
4439+
import Mathlib.Topology.EMetricSpace.Defs
4440+
import Mathlib.Topology.EMetricSpace.Diam
44394441
import Mathlib.Topology.EMetricSpace.Lipschitz
44404442
import Mathlib.Topology.EMetricSpace.Paracompact
44414443
import Mathlib.Topology.ExtendFrom
@@ -4501,6 +4503,7 @@ import Mathlib.Topology.MetricSpace.Cauchy
45014503
import Mathlib.Topology.MetricSpace.Closeds
45024504
import Mathlib.Topology.MetricSpace.Completion
45034505
import Mathlib.Topology.MetricSpace.Contracting
4506+
import Mathlib.Topology.MetricSpace.Defs
45044507
import Mathlib.Topology.MetricSpace.Dilation
45054508
import Mathlib.Topology.MetricSpace.DilationEquiv
45064509
import Mathlib.Topology.MetricSpace.Equicontinuity
@@ -4522,9 +4525,12 @@ import Mathlib.Topology.MetricSpace.PiNat
45224525
import Mathlib.Topology.MetricSpace.Polish
45234526
import Mathlib.Topology.MetricSpace.ProperSpace
45244527
import Mathlib.Topology.MetricSpace.ProperSpace.Lemmas
4528+
import Mathlib.Topology.MetricSpace.Pseudo.Basic
45254529
import Mathlib.Topology.MetricSpace.Pseudo.Constructions
45264530
import Mathlib.Topology.MetricSpace.Pseudo.Defs
45274531
import Mathlib.Topology.MetricSpace.Pseudo.Lemmas
4532+
import Mathlib.Topology.MetricSpace.Pseudo.Pi
4533+
import Mathlib.Topology.MetricSpace.Pseudo.Real
45284534
import Mathlib.Topology.MetricSpace.Sequences
45294535
import Mathlib.Topology.MetricSpace.ShrinkingLemma
45304536
import Mathlib.Topology.MetricSpace.ThickenedIndicator

Mathlib/Analysis/BoxIntegral/Box/Basic.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Mathlib.Order.Interval.Set.Monotone
88
import Mathlib.Topology.MetricSpace.Basic
99
import Mathlib.Topology.MetricSpace.Bounded
1010
import Mathlib.Topology.Order.MonotoneConvergence
11-
import Mathlib.Topology.MetricSpace.Pseudo.Lemmas
11+
import Mathlib.Topology.MetricSpace.Pseudo.Real
1212
/-!
1313
# Rectangular boxes in `ℝⁿ`
1414

Mathlib/Analysis/Convex/Extrema.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Authors: Frédéric Dupuis
55
-/
66
import Mathlib.Analysis.Convex.Function
77
import Mathlib.Topology.Algebra.Affine
8-
import Mathlib.Topology.MetricSpace.Pseudo.Lemmas
98
import Mathlib.Topology.Order.LocalExtr
9+
import Mathlib.Topology.MetricSpace.Pseudo.Lemmas
1010

1111
/-!
1212
# Minima and maxima of convex functions

Mathlib/Analysis/Oscillation.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Copyright (c) 2024 James Sundstrom. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: James Sundstrom
55
-/
6-
import Mathlib.Topology.EMetricSpace.Basic
6+
import Mathlib.Topology.EMetricSpace.Diam
77
import Mathlib.Order.WellFoundedSet
88

99
/-!

Mathlib/InformationTheory/Hamming.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Wrenna Robson
55
-/
66
import Mathlib.Analysis.Normed.Group.Basic
7-
import Mathlib.Topology.Instances.Discrete
87

98
/-!
109
# Hamming spaces

Mathlib/Topology/EMetricSpace/Basic.lean

Lines changed: 3 additions & 775 deletions
Large diffs are not rendered by default.

Mathlib/Topology/EMetricSpace/Defs.lean

Lines changed: 694 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
/-
2+
Copyright (c) 2015, 2017 Jeremy Avigad. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Jeremy Avigad, Robert Y. Lewis, Johannes Hölzl, Mario Carneiro, Sébastien Gouëzel
5+
-/
6+
import Mathlib.Topology.EMetricSpace.Basic
7+
import Mathlib.Data.ENNReal.Real
8+
9+
/-!
10+
# Diameters of sets in extended metric spaces
11+
12+
-/
13+
14+
15+
open Set Filter Classical
16+
17+
open scoped Uniformity Topology Filter NNReal ENNReal Pointwise
18+
19+
universe u v w
20+
21+
variable {α β : Type*} {s : Set α} {x y z : α}
22+
23+
namespace EMetric
24+
25+
section
26+
variable [PseudoEMetricSpace α]
27+
28+
/-- The diameter of a set in a pseudoemetric space, named `EMetric.diam` -/
29+
noncomputable def diam (s : Set α) :=
30+
⨆ (x ∈ s) (y ∈ s), edist x y
31+
32+
theorem diam_eq_sSup (s : Set α) : diam s = sSup (image2 edist s s) := sSup_image2.symm
33+
34+
theorem diam_le_iff {d : ℝ≥0∞} : diam s ≤ d ↔ ∀ x ∈ s, ∀ y ∈ s, edist x y ≤ d := by
35+
simp only [diam, iSup_le_iff]
36+
37+
theorem diam_image_le_iff {d : ℝ≥0∞} {f : β → α} {s : Set β} :
38+
diam (f '' s) ≤ d ↔ ∀ x ∈ s, ∀ y ∈ s, edist (f x) (f y) ≤ d := by
39+
simp only [diam_le_iff, forall_mem_image]
40+
41+
theorem edist_le_of_diam_le {d} (hx : x ∈ s) (hy : y ∈ s) (hd : diam s ≤ d) : edist x y ≤ d :=
42+
diam_le_iff.1 hd x hx y hy
43+
44+
/-- If two points belong to some set, their edistance is bounded by the diameter of the set -/
45+
theorem edist_le_diam_of_mem (hx : x ∈ s) (hy : y ∈ s) : edist x y ≤ diam s :=
46+
edist_le_of_diam_le hx hy le_rfl
47+
48+
/-- If the distance between any two points in a set is bounded by some constant, this constant
49+
bounds the diameter. -/
50+
theorem diam_le {d : ℝ≥0∞} (h : ∀ x ∈ s, ∀ y ∈ s, edist x y ≤ d) : diam s ≤ d :=
51+
diam_le_iff.2 h
52+
53+
/-- The diameter of a subsingleton vanishes. -/
54+
theorem diam_subsingleton (hs : s.Subsingleton) : diam s = 0 :=
55+
nonpos_iff_eq_zero.1 <| diam_le fun _x hx y hy => (hs hx hy).symm ▸ edist_self y ▸ le_rfl
56+
57+
/-- The diameter of the empty set vanishes -/
58+
@[simp]
59+
theorem diam_empty : diam (∅ : Set α) = 0 :=
60+
diam_subsingleton subsingleton_empty
61+
62+
/-- The diameter of a singleton vanishes -/
63+
@[simp]
64+
theorem diam_singleton : diam ({x} : Set α) = 0 :=
65+
diam_subsingleton subsingleton_singleton
66+
67+
@[to_additive (attr := simp)]
68+
theorem diam_one [One α] : diam (1 : Set α) = 0 :=
69+
diam_singleton
70+
71+
theorem diam_iUnion_mem_option {ι : Type*} (o : Option ι) (s : ι → Set α) :
72+
diam (⋃ i ∈ o, s i) = ⨆ i ∈ o, diam (s i) := by cases o <;> simp
73+
74+
theorem diam_insert : diam (insert x s) = max (⨆ y ∈ s, edist x y) (diam s) :=
75+
eq_of_forall_ge_iff fun d => by
76+
simp only [diam_le_iff, forall_mem_insert, edist_self, edist_comm x, max_le_iff, iSup_le_iff,
77+
zero_le, true_and_iff, forall_and, and_self_iff, ← and_assoc]
78+
79+
theorem diam_pair : diam ({x, y} : Set α) = edist x y := by
80+
simp only [iSup_singleton, diam_insert, diam_singleton, ENNReal.max_zero_right]
81+
82+
theorem diam_triple : diam ({x, y, z} : Set α) = max (max (edist x y) (edist x z)) (edist y z) := by
83+
simp only [diam_insert, iSup_insert, iSup_singleton, diam_singleton, ENNReal.max_zero_right,
84+
ENNReal.sup_eq_max]
85+
86+
/-- The diameter is monotonous with respect to inclusion -/
87+
@[gcongr]
88+
theorem diam_mono {s t : Set α} (h : s ⊆ t) : diam s ≤ diam t :=
89+
diam_le fun _x hx _y hy => edist_le_diam_of_mem (h hx) (h hy)
90+
91+
/-- The diameter of a union is controlled by the diameter of the sets, and the edistance
92+
between two points in the sets. -/
93+
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
94+
diam (s ∪ t) ≤ diam s + edist x y + diam t := by
95+
have A : ∀ a ∈ s, ∀ b ∈ t, edist a b ≤ diam s + edist x y + diam t := fun a ha b hb =>
96+
calc
97+
edist a b ≤ edist a x + edist x y + edist y b := edist_triangle4 _ _ _ _
98+
_ ≤ diam s + edist x y + diam t :=
99+
add_le_add (add_le_add (edist_le_diam_of_mem ha xs) le_rfl) (edist_le_diam_of_mem yt hb)
100+
refine diam_le fun a ha b hb => ?_
101+
cases' (mem_union _ _ _).1 ha with h'a h'a <;> cases' (mem_union _ _ _).1 hb with h'b h'b
102+
· calc
103+
edist a b ≤ diam s := edist_le_diam_of_mem h'a h'b
104+
_ ≤ diam s + (edist x y + diam t) := le_self_add
105+
_ = diam s + edist x y + diam t := (add_assoc _ _ _).symm
106+
· exact A a h'a b h'b
107+
· have Z := A b h'b a h'a
108+
rwa [edist_comm] at Z
109+
· calc
110+
edist a b ≤ diam t := edist_le_diam_of_mem h'a h'b
111+
_ ≤ diam s + edist x y + diam t := le_add_self
112+
113+
theorem diam_union' {t : Set α} (h : (s ∩ t).Nonempty) : diam (s ∪ t) ≤ diam s + diam t := by
114+
let ⟨x, ⟨xs, xt⟩⟩ := h
115+
simpa using diam_union xs xt
116+
117+
theorem diam_closedBall {r : ℝ≥0∞} : diam (closedBall x r) ≤ 2 * r :=
118+
diam_le fun a ha b hb =>
119+
calc
120+
edist a b ≤ edist a x + edist b x := edist_triangle_right _ _ _
121+
_ ≤ r + r := add_le_add ha hb
122+
_ = 2 * r := (two_mul r).symm
123+
124+
theorem diam_ball {r : ℝ≥0∞} : diam (ball x r) ≤ 2 * r :=
125+
le_trans (diam_mono ball_subset_closedBall) diam_closedBall
126+
127+
theorem diam_pi_le_of_le {π : β → Type*} [Fintype β] [∀ b, PseudoEMetricSpace (π b)]
128+
{s : ∀ b : β, Set (π b)} {c : ℝ≥0∞} (h : ∀ b, diam (s b) ≤ c) : diam (Set.pi univ s) ≤ c := by
129+
refine diam_le fun x hx y hy => edist_pi_le_iff.mpr ?_
130+
rw [mem_univ_pi] at hx hy
131+
exact fun b => diam_le_iff.1 (h b) (x b) (hx b) (y b) (hy b)
132+
133+
end
134+
135+
section
136+
variable [EMetricSpace β] {s : Set β}
137+
138+
theorem diam_eq_zero_iff : diam s = 0 ↔ s.Subsingleton :=
139+
fun h _x hx _y hy => edist_le_zero.1 <| h ▸ edist_le_diam_of_mem hx hy, diam_subsingleton⟩
140+
141+
theorem diam_pos_iff : 0 < diam s ↔ s.Nontrivial := by
142+
simp only [pos_iff_ne_zero, Ne, diam_eq_zero_iff, Set.not_subsingleton_iff]
143+
144+
theorem diam_pos_iff' : 0 < diam s ↔ ∃ x ∈ s, ∃ y ∈ s, x ≠ y := by
145+
simp only [diam_pos_iff, Set.Nontrivial, exists_prop]
146+
147+
end
148+
149+
end EMetric

Mathlib/Topology/EMetricSpace/Lipschitz.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
44
Authors: Rohan Mitta, Kevin Buzzard, Alistair Tucker, Johannes Hölzl, Yury Kudryashov
55
-/
66
import Mathlib.Logic.Function.Iterate
7-
import Mathlib.Topology.EMetricSpace.Basic
7+
import Mathlib.Topology.EMetricSpace.Diam
88
import Mathlib.Tactic.GCongr
99

1010
/-!

Mathlib/Topology/EMetricSpace/Paracompact.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Authors: Yury Kudryashov
55
-/
66
import Mathlib.SetTheory.Ordinal.Basic
77
import Mathlib.Tactic.GCongr
8-
import Mathlib.Topology.EMetricSpace.Basic
98
import Mathlib.Topology.Compactness.Paracompact
9+
import Mathlib.Topology.EMetricSpace.Basic
1010

1111
/-!
1212
# (Extended) metric spaces are paracompact

0 commit comments

Comments
 (0)