Skip to content

Commit 3a427de

Browse files
committed
refactor(UniformSpace): change the definition (#10901)
- replace `isOpen_uniformity` with `nhds_eq_comap_uniformity` as I suggested in #2028 - don't extend `UniformSpace.Core` so that we can drop `refl`, as it follows from `nhds_eq_comap_uniformity`; - drop `UniformSpace.mk'` - can't be a `match_pattern` anymore; - deprecate `UniformSpace.ofNhdsEqComap`.
1 parent 75dad16 commit 3a427de

File tree

5 files changed

+170
-177
lines changed

5 files changed

+170
-177
lines changed

Mathlib/Topology/Algebra/UniformGroup.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,6 @@ commutative additive groups (see `comm_topologicalAddGroup_is_uniform`) and for
558558
additive groups (see `topologicalAddGroup_is_uniform_of_compactSpace`)."]
559559
def TopologicalGroup.toUniformSpace : UniformSpace G where
560560
uniformity := comap (fun p : G × G => p.2 / p.1) (𝓝 1)
561-
refl := (Tendsto.mono_right (by simp) (pure_le_nhds _)).le_comap
562561
symm :=
563562
have : Tendsto (fun p : G × G ↦ (p.2 / p.1)⁻¹) (comap (fun p : G × G ↦ p.2 / p.1) (𝓝 1))
564563
(𝓝 1⁻¹) := tendsto_id.inv.comp tendsto_comap
@@ -568,8 +567,7 @@ def TopologicalGroup.toUniformSpace : UniformSpace G where
568567
refine mem_map.2 (mem_of_superset (mem_lift' <| preimage_mem_comap V_nhds) ?_)
569568
rintro ⟨x, y⟩ ⟨z, hz₁, hz₂⟩
570569
simpa using V_mul _ hz₂ _ hz₁
571-
isOpen_uniformity S := by
572-
simp only [isOpen_iff_mem_nhds, ← mem_comap_prod_mk, comap_comap, (· ∘ ·), nhds_translation_div]
570+
nhds_eq_comap_uniformity _ := by simp only [comap_comap, (· ∘ ·), nhds_translation_div]
573571
#align topological_group.to_uniform_space TopologicalGroup.toUniformSpace
574572
#align topological_add_group.to_uniform_space TopologicalAddGroup.toUniformSpace
575573

Mathlib/Topology/MetricSpace/PseudoMetric.lean

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ universe u v w
4646

4747
variable {α : Type u} {β : Type v} {X ι : Type*}
4848

49+
theorem UniformSpace.ofDist_aux (ε : ℝ) (hε : 0 < ε) : ∃ δ > (0 : ℝ), ∀ x < δ, ∀ y < δ, x + y < ε :=
50+
⟨ε / 2, half_pos hε, fun _x hx _y hy => add_halves ε ▸ add_lt_add hx hy⟩
51+
4952
/-- Construct a uniform structure from a distance function and metric space axioms -/
5053
def UniformSpace.ofDist (dist : α → α → ℝ) (dist_self : ∀ x : α, dist x x = 0)
5154
(dist_comm : ∀ x y : α, dist x y = dist y x)
5255
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : UniformSpace α :=
53-
.ofFun dist dist_self dist_comm dist_triangle fun ε ε0 =>
54-
⟨ε / 2, half_pos ε0, fun _x hx _y hy => add_halves ε ▸ add_lt_add hx hy⟩
56+
.ofFun dist dist_self dist_comm dist_triangle ofDist_aux
5557
#align uniform_space_of_dist UniformSpace.ofDist
5658

5759
-- Porting note: dropped the `dist_self` argument
@@ -162,10 +164,10 @@ def PseudoMetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist :
162164
dist_triangle := dist_triangle
163165
edist_dist := fun x y => by exact ENNReal.coe_nnreal_eq _
164166
toUniformSpace :=
165-
{ toCore := (UniformSpace.ofDist dist dist_self dist_comm dist_triangle).toCore
166-
isOpen_uniformity := fun s => (H s).trans <| forall₂_congr fun x _ =>
167-
((UniformSpace.hasBasis_ofFun (exists_gt (0 : ℝ)) dist _ _ _ _).comap
168-
(Prod.mk x)).mem_iff.symm.trans mem_comap_prod_mk }
167+
(UniformSpace.ofDist dist dist_self dist_comm dist_triangle).replaceTopology <|
168+
TopologicalSpace.ext_iff.2 fun s (H s).trans <| forall₂_congr fun x _
169+
((UniformSpace.hasBasis_ofFun (exists_gt (0 : ℝ)) dist dist_self dist_comm dist_triangle
170+
UniformSpace.ofDist_aux).comap (Prod.mk x)).mem_iff.symm
169171
uniformity_dist := rfl
170172
toBornology := Bornology.ofDist dist dist_comm dist_triangle
171173
cobounded_sets := rfl }

0 commit comments

Comments
 (0)