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

Commit e1a7bde

Browse files
committed
refactor(topology/*): add uniform_space.of_fun, use it (#18495)
* Fix `simps` config for `absolute_value`. * Define `uniform_space.of_fun` and use it for `absolute_value.uniform_space`, `pseudo_emetric_space`, and `pseudo_metric_space`. * Add `filter.tendsto_infi_infi` and `filter.tendsto_supr_supr`. * Rename `pseudo_metric_space.of_metrizable` and `metric_space.of_metrizable` to `*.of_dist_topology`. * Add `metric.to_uniform_space_eq` and `metric.uniformity_basis_dist_rat`. * Migrate `topology.uniform_space.absolute_value` to bundled `absolute_value`.
1 parent 23a3e7d commit e1a7bde

File tree

9 files changed

+96
-168
lines changed

9 files changed

+96
-168
lines changed

src/algebra/order/absolute_value.lean

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ namespace absolute_value
3939

4040
attribute [nolint doc_blame] absolute_value.to_mul_hom
4141

42-
initialize_simps_projections absolute_value (to_mul_hom_to_fun → apply)
43-
4442
section ordered_semiring
4543

4644
section semiring
@@ -68,6 +66,11 @@ instance subadditive_hom_class : subadditive_hom_class (absolute_value R S) R S
6866

6967
@[ext] lemma ext ⦃f g : absolute_value R S⦄ : (∀ x, f x = g x) → f = g := fun_like.ext _ _
7068

69+
/-- See Note [custom simps projection]. -/
70+
def simps.apply (f : absolute_value R S) : R → S := f
71+
72+
initialize_simps_projections absolute_value (to_mul_hom_to_fun → apply)
73+
7174
/-- Helper instance for when there's too many metavariables to apply `fun_like.has_coe_to_fun`
7275
directly. -/
7376
instance : has_coe_to_fun (absolute_value R S) (λ f, R → S) := fun_like.has_coe_to_fun

src/order/filter/basic.lean

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2531,6 +2531,10 @@ lemma tendsto_infi' {f : α → β} {x : ι → filter α} {y : filter β} (i :
25312531
tendsto f (⨅ i, x i) y :=
25322532
hi.mono_left $ infi_le _ _
25332533

2534+
theorem tendsto_infi_infi {f : α → β} {x : ι → filter α} {y : ι → filter β}
2535+
(h : ∀ i, tendsto f (x i) (y i)) : tendsto f (infi x) (infi y) :=
2536+
tendsto_infi.2 $ λ i, tendsto_infi' i (h i)
2537+
25342538
@[simp] lemma tendsto_sup {f : α → β} {x₁ x₂ : filter α} {y : filter β} :
25352539
tendsto f (x₁ ⊔ x₂) y ↔ tendsto f x₁ y ∧ tendsto f x₂ y :=
25362540
by simp only [tendsto, map_sup, sup_le_iff]
@@ -2543,6 +2547,10 @@ lemma tendsto.sup {f : α → β} {x₁ x₂ : filter α} {y : filter β} :
25432547
tendsto f (⨆ i, x i) y ↔ ∀ i, tendsto f (x i) y :=
25442548
by simp only [tendsto, map_supr, supr_le_iff]
25452549

2550+
theorem tendsto_supr_supr {f : α → β} {x : ι → filter α} {y : ι → filter β}
2551+
(h : ∀ i, tendsto f (x i) (y i)) : tendsto f (supr x) (supr y) :=
2552+
tendsto_supr.2 $ λ i, (h i).mono_right $ le_supr _ _
2553+
25462554
@[simp] lemma tendsto_principal {f : α → β} {l : filter α} {s : set β} :
25472555
tendsto f l (𝓟 s) ↔ ∀ᶠ a in l, f a ∈ s :=
25482556
by simp only [tendsto, le_principal_iff, mem_map', filter.eventually]

src/topology/metric_space/basic.lean

Lines changed: 22 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -54,35 +54,14 @@ open_locale uniformity topology big_operators filter nnreal ennreal
5454
universes u v w
5555
variables {α : Type u} {β : Type v} {X ι : Type*}
5656

57-
/-- Construct a uniform structure core from a distance function and metric space axioms.
58-
This is a technical construction that can be immediately used to construct a uniform structure
59-
from a distance function and metric space axioms but is also useful when discussing
60-
metrizable topologies, see `pseudo_metric_space.of_metrizable`. -/
61-
def uniform_space.core_of_dist {α : Type*} (dist : α → α → ℝ)
62-
(dist_self : ∀ x : α, dist x x = 0)
63-
(dist_comm : ∀ x y : α, dist x y = dist y x)
64-
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space.core α :=
65-
{ uniformity := (⨅ ε>0, 𝓟 {p:α×α | dist p.1 p.2 < ε}),
66-
refl := le_infi $ assume ε, le_infi $
67-
by simp [set.subset_def, id_rel, dist_self, (>)] {contextual := tt},
68-
comp := le_infi $ assume ε, le_infi $ assume h, lift'_le
69-
(mem_infi_of_mem (ε / 2) $ mem_infi_of_mem (div_pos h zero_lt_two) (subset.refl _)) $
70-
have ∀ (a b c : α), dist a c < ε / 2 → dist c b < ε / 2 → dist a b < ε,
71-
from assume a b c hac hcb,
72-
calc dist a b ≤ dist a c + dist c b : dist_triangle _ _ _
73-
... < ε / 2 + ε / 2 : add_lt_add hac hcb
74-
... = ε : by rw [div_add_div_same, add_self_div_two],
75-
by simpa [comp_rel],
76-
symm := tendsto_infi.2 $ assume ε, tendsto_infi.2 $ assume h,
77-
tendsto_infi' ε $ tendsto_infi' h $ tendsto_principal_principal.2 $ by simp [dist_comm] }
78-
7957
/-- Construct a uniform structure from a distance function and metric space axioms -/
8058
def uniform_space_of_dist
8159
(dist : α → α → ℝ)
8260
(dist_self : ∀ x : α, dist x x = 0)
8361
(dist_comm : ∀ x y : α, dist x y = dist y x)
8462
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space α :=
85-
uniform_space.of_core (uniform_space.core_of_dist dist dist_self dist_comm dist_triangle)
63+
uniform_space.of_fun dist dist_self dist_comm dist_triangle $ λ ε ε0,
64+
⟨ε / 2, half_pos ε0, λ x hx y hy, add_halves ε ▸ add_lt_add hx hy⟩
8665

8766
/-- This is an internal lemma used to construct a bornology from a metric in `bornology.of_dist`. -/
8867
private lemma bounded_iff_aux {α : Type*} (dist : α → α → ℝ)
@@ -202,7 +181,7 @@ instance pseudo_metric_space.to_has_edist : has_edist α := ⟨pseudo_metric_spa
202181
/-- Construct a pseudo-metric space structure whose underlying topological space structure
203182
(definitionally) agrees which a pre-existing topology which is compatible with a given distance
204183
function. -/
205-
def pseudo_metric_space.of_metrizable {α : Type*} [topological_space α] (dist : α → α → ℝ)
184+
def pseudo_metric_space.of_dist_topology {α : Type u} [topological_space α] (dist : α → α → ℝ)
206185
(dist_self : ∀ x : α, dist x x = 0)
207186
(dist_comm : ∀ x y : α, dist x y = dist y x)
208187
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
@@ -212,26 +191,11 @@ def pseudo_metric_space.of_metrizable {α : Type*} [topological_space α] (dist
212191
dist_self := dist_self,
213192
dist_comm := dist_comm,
214193
dist_triangle := dist_triangle,
215-
to_uniform_space := { is_open_uniformity := begin
216-
dsimp only [uniform_space.core_of_dist],
217-
intros s,
218-
change is_open s ↔ _,
219-
rw H s,
220-
refine forall₂_congr (λ x x_in, _),
221-
erw (has_basis_binfi_principal _ nonempty_Ioi).mem_iff,
222-
{ refine exists₂_congr (λ ε ε_pos, _),
223-
simp only [prod.forall, set_of_subset_set_of],
224-
split,
225-
{ rintros h _ y H rfl,
226-
exact h y H },
227-
{ intros h y hxy,
228-
exact h _ _ hxy rfl } },
229-
{ exact λ r (hr : 0 < r) p (hp : 0 < p), ⟨min r p, lt_min hr hp,
230-
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_left r p),
231-
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_right r p)⟩ },
232-
{ apply_instance }
233-
end,
234-
..uniform_space.core_of_dist dist dist_self dist_comm dist_triangle },
194+
to_uniform_space :=
195+
{ is_open_uniformity := λ s, (H s).trans $ forall₂_congr $ λ x _,
196+
((uniform_space.has_basis_of_fun (exists_gt (0 : ℝ))
197+
dist _ _ _ _).comap (prod.mk x)).mem_iff.symm.trans mem_comap_prod_mk,
198+
to_core := (uniform_space_of_dist dist dist_self dist_comm dist_triangle).to_core },
235199
uniformity_dist := rfl,
236200
to_bornology := bornology.of_dist dist dist_self dist_comm dist_triangle,
237201
cobounded_sets := rfl }
@@ -653,14 +617,15 @@ theorem is_bounded_iff_nndist {s : set α} :
653617
by simp only [is_bounded_iff_exists_ge 0, nnreal.exists, ← nnreal.coe_le_coe, ← dist_nndist,
654618
nnreal.coe_mk, exists_prop]
655619

620+
theorem to_uniform_space_eq : ‹pseudo_metric_space α›.to_uniform_space =
621+
uniform_space_of_dist dist dist_self dist_comm dist_triangle :=
622+
uniform_space_eq pseudo_metric_space.uniformity_dist
623+
656624
theorem uniformity_basis_dist :
657625
(𝓤 α).has_basis (λ ε : ℝ, 0 < ε) (λ ε, {p:α×α | dist p.1 p.2 < ε}) :=
658626
begin
659-
rw ← pseudo_metric_space.uniformity_dist.symm,
660-
refine has_basis_binfi_principal _ nonempty_Ioi,
661-
exact λ r (hr : 0 < r) p (hp : 0 < p), ⟨min r p, lt_min hr hp,
662-
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_left r p),
663-
λ x (hx : dist _ _ < _), lt_of_lt_of_le hx (min_le_right r p)⟩
627+
rw [to_uniform_space_eq],
628+
exact uniform_space.has_basis_of_fun (exists_gt _) _ _ _ _ _
664629
end
665630

666631
/-- Given `f : β → ℝ`, if `f` sends `{i | p i}` to a set of positive numbers
@@ -680,6 +645,11 @@ begin
680645
{ exact λ ⟨i, hi, H⟩, ⟨f i, hf₀ i hi, H⟩ }
681646
end
682647

648+
theorem uniformity_basis_dist_rat :
649+
(𝓤 α).has_basis (λ r : ℚ, 0 < r) (λ r, {p : α × α | dist p.1 p.2 < r}) :=
650+
metric.mk_uniformity_basis (λ _, rat.cast_pos.2) $ λ ε hε,
651+
let ⟨r, hr0, hrε⟩ := exists_rat_btwn hε in ⟨r, rat.cast_pos.1 hr0, hrε.le⟩
652+
683653
theorem uniformity_basis_dist_inv_nat_succ :
684654
(𝓤 α).has_basis (λ _, true) (λ n:ℕ, {p:α×α | dist p.1 p.2 < 1 / (↑n+1) }) :=
685655
metric.mk_uniformity_basis (λ n _, div_pos zero_lt_one $ nat.cast_add_one_pos n)
@@ -1476,11 +1446,7 @@ def pseudo_metric_space.induced {α β} (f : α → β)
14761446
edist := λ x y, edist (f x) (f y),
14771447
edist_dist := λ x y, edist_dist _ _,
14781448
to_uniform_space := uniform_space.comap f m.to_uniform_space,
1479-
uniformity_dist := begin
1480-
apply @uniformity_dist_of_mem_uniformity _ _ _ _ _ (λ x y, dist (f x) (f y)),
1481-
refine compl_surjective.forall.2 (λ s, compl_mem_comap.trans $ mem_uniformity_dist.trans _),
1482-
simp only [mem_compl_iff, @imp_not_comm _ (_ ∈ _), ← prod.forall', prod.mk.eta, ball_image_iff]
1483-
end,
1449+
uniformity_dist := (uniformity_basis_dist.comap _).eq_binfi,
14841450
to_bornology := bornology.induced f,
14851451
cobounded_sets := set.ext $ compl_surjective.forall.2 $ λ s,
14861452
by simp only [compl_mem_comap, filter.mem_sets, ← is_bounded_def, mem_set_of_eq, compl_compl,
@@ -2643,14 +2609,14 @@ end
26432609
/-- Construct a metric space structure whose underlying topological space structure
26442610
(definitionally) agrees which a pre-existing topology which is compatible with a given distance
26452611
function. -/
2646-
def metric_space.of_metrizable {α : Type*} [topological_space α] (dist : α → α → ℝ)
2612+
def metric_space.of_dist_topology {α : Type u} [topological_space α] (dist : α → α → ℝ)
26472613
(dist_self : ∀ x : α, dist x x = 0)
26482614
(dist_comm : ∀ x y : α, dist x y = dist y x)
26492615
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
26502616
(H : ∀ s : set α, is_open s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s)
26512617
(eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : metric_space α :=
26522618
{ eq_of_dist_eq_zero := eq_of_dist_eq_zero,
2653-
..pseudo_metric_space.of_metrizable dist dist_self dist_comm dist_triangle H }
2619+
..pseudo_metric_space.of_dist_topology dist dist_self dist_comm dist_triangle H }
26542620

26552621
variables {γ : Type w} [metric_space γ]
26562622

src/topology/metric_space/emetric_space.lean

Lines changed: 14 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -38,41 +38,20 @@ variables {α : Type u} {β : Type v} {X : Type*}
3838
in terms of the elements of the uniformity. -/
3939
theorem uniformity_dist_of_mem_uniformity [linear_order β] {U : filter (α × α)} (z : β)
4040
(D : α → α → β) (H : ∀ s, s ∈ U ↔ ∃ε>z, ∀{a b:α}, D a b < ε → (a, b) ∈ s) :
41-
U = ⨅ ε>z, 𝓟 {p:α×α | D p.1 p.2 < ε} :=
42-
le_antisymm
43-
(le_infi $ λ ε, le_infi $ λ ε0, le_principal_iff.2 $ (H _).2 ⟨ε, ε0, λ a b, id⟩)
44-
(λ r ur, let ⟨ε, ε0, h⟩ := (H _).1 ur in
45-
mem_infi_of_mem ε $ mem_infi_of_mem ε0 $ mem_principal.2 $ λ ⟨a, b⟩, h)
41+
U = ⨅ ε > z, 𝓟 {p:α×α | D p.1 p.2 < ε} :=
42+
has_basis.eq_binfi ⟨λ s, by simp only [H, subset_def, prod.forall, mem_set_of]⟩
4643

4744
/-- `has_edist α` means that `α` is equipped with an extended distance. -/
4845
class has_edist (α : Type*) := (edist : α → α → ℝ≥0∞)
4946
export has_edist (edist)
5047

5148
/-- Creating a uniform space from an extended distance. -/
52-
def uniform_space_of_edist
53-
(edist : α → α → ℝ≥0∞)
54-
(edist_self : ∀ x : α, edist x x = 0)
55-
(edist_comm : ∀ x y : α, edist x y = edist y x)
49+
noncomputable def uniform_space_of_edist (edist : α → α → ℝ≥0∞)
50+
(edist_self : ∀ x : α, edist x x = 0) (edist_comm : ∀ x y : α, edist x y = edist y x)
5651
(edist_triangle : ∀ x y z : α, edist x z ≤ edist x y + edist y z) : uniform_space α :=
57-
uniform_space.of_core
58-
{ uniformity := (⨅ ε>0, 𝓟 {p:α×α | edist p.1 p.2 < ε}),
59-
refl := le_infi $ assume ε, le_infi $
60-
by simp [set.subset_def, id_rel, edist_self, (>)] {contextual := tt},
61-
comp :=
62-
le_infi $ assume ε, le_infi $ assume h,
63-
have (2 : ℝ≥0∞) = (2 : ℕ) := by simp,
64-
have A : 0 < ε / 2 := ennreal.div_pos_iff.2
65-
⟨ne_of_gt h, by { convert ennreal.nat_ne_top 2 }⟩,
66-
lift'_le
67-
(mem_infi_of_mem (ε / 2) $ mem_infi_of_mem A (subset.refl _)) $
68-
have ∀ (a b c : α), edist a c < ε / 2 → edist c b < ε / 2 → edist a b < ε,
69-
from assume a b c hac hcb,
70-
calc edist a b ≤ edist a c + edist c b : edist_triangle _ _ _
71-
... < ε / 2 + ε / 2 : ennreal.add_lt_add hac hcb
72-
... = ε : by rw [ennreal.add_halves],
73-
by simpa [comp_rel],
74-
symm := tendsto_infi.2 $ assume ε, tendsto_infi.2 $ assume h,
75-
tendsto_infi' ε $ tendsto_infi' h $ tendsto_principal_principal.2 $ by simp [edist_comm] }
52+
uniform_space.of_fun edist edist_self edist_comm edist_triangle $
53+
λ ε ε0, ⟨ε / 2, ennreal.half_pos ε0.lt.ne', λ _ h₁ _ h₂,
54+
(ennreal.add_lt_add h₁ h₂).trans_eq (ennreal.add_halves _)⟩
7655

7756
-- the uniform structure is embedded in the emetric space structure
7857
-- to avoid instance diamond issues. See Note [forgetful inheritance].
@@ -175,13 +154,13 @@ theorem uniformity_pseudoedist :
175154
𝓤 α = ⨅ ε>0, 𝓟 {p:α×α | edist p.1 p.2 < ε} :=
176155
pseudo_emetric_space.uniformity_edist
177156

157+
theorem uniform_space_edist : ‹pseudo_emetric_space α›.to_uniform_space =
158+
uniform_space_of_edist edist edist_self edist_comm edist_triangle :=
159+
uniform_space_eq uniformity_pseudoedist
160+
178161
theorem uniformity_basis_edist :
179162
(𝓤 α).has_basis (λ ε : ℝ≥0∞, 0 < ε) (λ ε, {p:α×α | edist p.1 p.2 < ε}) :=
180-
(@uniformity_pseudoedist α _).symm ▸ has_basis_binfi_principal
181-
(λ r hr p hp, ⟨min r p, lt_min hr hp,
182-
λ x hx, lt_of_lt_of_le hx (min_le_left _ _),
183-
λ x hx, lt_of_lt_of_le hx (min_le_right _ _)⟩)
184-
1, zero_lt_one⟩
163+
(@uniform_space_edist α _).symm ▸ uniform_space.has_basis_of_fun ⟨1, one_pos⟩ _ _ _ _ _
185164

186165
/-- Characterization of the elements of the uniformity in terms of the extended distance -/
187166
theorem mem_uniformity_edist {s : set (α×α)} :
@@ -394,16 +373,7 @@ def pseudo_emetric_space.induced {α β} (f : α → β)
394373
edist_comm := λ x y, edist_comm _ _,
395374
edist_triangle := λ x y z, edist_triangle _ _ _,
396375
to_uniform_space := uniform_space.comap f m.to_uniform_space,
397-
uniformity_edist := begin
398-
apply @uniformity_dist_of_mem_uniformity _ _ _ _ _ (λ x y, edist (f x) (f y)),
399-
refine λ s, mem_comap.trans _,
400-
split; intro H,
401-
{ rcases H with ⟨r, ru, rs⟩,
402-
rcases mem_uniformity_edist.1 ru with ⟨ε, ε0, hε⟩,
403-
refine ⟨ε, ε0, λ a b h, rs (hε _)⟩, exact h },
404-
{ rcases H with ⟨ε, ε0, hε⟩,
405-
exact ⟨_, edist_mem_uniformity ε0, λ ⟨a, b⟩, hε⟩ }
406-
end }
376+
uniformity_edist := (uniformity_basis_edist.comap _).eq_binfi }
407377

408378
/-- Pseudoemetric space instance on subsets of pseudoemetric spaces -/
409379
instance {α : Type*} {p : α → Prop} [pseudo_emetric_space α] : pseudo_emetric_space (subtype p) :=
@@ -978,16 +948,7 @@ def emetric_space.induced {γ β} (f : γ → β) (hf : function.injective f)
978948
edist_comm := λ x y, edist_comm _ _,
979949
edist_triangle := λ x y z, edist_triangle _ _ _,
980950
to_uniform_space := uniform_space.comap f m.to_uniform_space,
981-
uniformity_edist := begin
982-
apply @uniformity_dist_of_mem_uniformity _ _ _ _ _ (λ x y, edist (f x) (f y)),
983-
refine λ s, mem_comap.trans _,
984-
split; intro H,
985-
{ rcases H with ⟨r, ru, rs⟩,
986-
rcases mem_uniformity_edist.1 ru with ⟨ε, ε0, hε⟩,
987-
refine ⟨ε, ε0, λ a b h, rs (hε _)⟩, exact h },
988-
{ rcases H with ⟨ε, ε0, hε⟩,
989-
exact ⟨_, edist_mem_uniformity ε0, λ ⟨a, b⟩, hε⟩ }
990-
end }
951+
uniformity_edist := (uniformity_basis_edist.comap _).eq_binfi }
991952

992953
/-- Emetric space instance on subsets of emetric spaces -/
993954
instance {α : Type*} {p : α → Prop} [emetric_space α] : emetric_space (subtype p) :=

src/topology/metric_space/gluing.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ their respective basepoints, plus the distance 1 between the basepoints.
464464
Since there is an arbitrary choice in this construction, it is not an instance by default. -/
465465
protected def metric_space : metric_space (Σ i, E i) :=
466466
begin
467-
refine metric_space.of_metrizable sigma.dist _ _ sigma.dist_triangle
467+
refine metric_space.of_dist_topology sigma.dist _ _ sigma.dist_triangle
468468
sigma.is_open_iff _,
469469
{ rintros ⟨i, x⟩, simp [sigma.dist] },
470470
{ rintros ⟨i, x⟩ ⟨j, y⟩,

src/topology/metric_space/pi_nat.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ but it does not take care of a possible uniformity. If the `E n` have a uniform
357357
there will be two non-defeq uniform structures on `Π n, E n`, the product one and the one coming
358358
from the metric structure. In this case, use `metric_space_of_discrete_uniformity` instead. -/
359359
protected def metric_space : metric_space (Π n, E n) :=
360-
metric_space.of_metrizable dist pi_nat.dist_self pi_nat.dist_comm pi_nat.dist_triangle
360+
metric_space.of_dist_topology dist pi_nat.dist_self pi_nat.dist_comm pi_nat.dist_triangle
361361
is_open_iff_dist pi_nat.eq_of_dist_eq_zero
362362

363363
/-- Metric space structure on `Π (n : ℕ), E n` when the spaces `E n` have the discrete uniformity,

src/topology/uniform_space/absolute_value.lean

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,46 +33,21 @@ absolute value, uniform spaces
3333
-/
3434

3535
open set function filter uniform_space
36-
open_locale filter
36+
open_locale filter topology
3737

38-
namespace is_absolute_value
39-
variables {𝕜 : Type*} [linear_ordered_field 𝕜]
40-
variables {R : Type*} [comm_ring R] (abv : R → 𝕜) [is_absolute_value abv]
38+
namespace absolute_value
4139

42-
/-- The uniformity coming from an absolute value. -/
43-
def uniform_space_core : uniform_space.core R :=
44-
{ uniformity := (⨅ ε>0, 𝓟 {p:R×R | abv (p.2 - p.1) < ε}),
45-
refl := le_infi $ assume ε, le_infi $ assume ε_pos, principal_mono.2
46-
(λ ⟨x, y⟩ h, by simpa [show x = y, from h, abv_zero abv]),
47-
symm := tendsto_infi.2 $ assume ε, tendsto_infi.2 $ assume h,
48-
tendsto_infi' ε $ tendsto_infi' h $ tendsto_principal_principal.2 $ λ ⟨x, y⟩ h,
49-
have h : abv (y - x) < ε, by simpa [-sub_eq_add_neg] using h,
50-
by rwa abv_sub abv at h,
51-
comp := le_infi $ assume ε, le_infi $ assume h, lift'_le
52-
(mem_infi_of_mem (ε / 2) $ mem_infi_of_mem (div_pos h zero_lt_two) (subset.refl _)) $
53-
have ∀ (a b c : R), abv (c-a) < ε / 2 → abv (b-c) < ε / 2 → abv (b-a) < ε,
54-
from assume a b c hac hcb,
55-
calc abv (b - a) ≤ _ : abv_sub_le abv b c a
56-
... = abv (c - a) + abv (b - c) : add_comm _ _
57-
... < ε / 2 + ε / 2 : add_lt_add hac hcb
58-
... = ε : by rw [div_add_div_same, add_self_div_two],
59-
by simpa [comp_rel] }
40+
variables {𝕜 : Type*} [linear_ordered_field 𝕜]
41+
variables {R : Type*} [comm_ring R] (abv : absolute_value R 𝕜)
6042

61-
/-- The uniform structure coming from an absolute value. -/
62-
def uniform_space : uniform_space R :=
63-
uniform_space.of_core (uniform_space_core abv)
43+
/-- The uniform space structure coming from an absolute value. -/
44+
protected def uniform_space : uniform_space R :=
45+
uniform_space.of_fun (λ x y, abv (y - x)) (by simp) (λ x y, abv.map_sub y x)
46+
(λ x y z, (abv.sub_le _ _ _).trans_eq (add_comm _ _)) $
47+
λ ε ε0, ⟨ε / 2, half_pos ε0, λ _ h₁ _ h₂, (add_lt_add h₁ h₂).trans_eq (add_halves ε)⟩
6448

65-
theorem mem_uniformity {s : set (R×R)} :
66-
s ∈ (uniform_space_core abv).uniformity ↔
67-
(∃ε>0, ∀{a b:R}, abv (b - a) < ε → (a, b) ∈ s) :=
68-
begin
69-
suffices : s ∈ (⨅ ε: {ε : 𝕜 // ε > 0}, 𝓟 {p:R×R | abv (p.2 - p.1) < ε.val}) ↔ _,
70-
{ rw infi_subtype at this,
71-
exact this },
72-
rw mem_infi_of_directed,
73-
{ simp [subset_def] },
74-
{ rintros ⟨r, hr⟩ ⟨p, hp⟩,
75-
exact ⟨⟨min r p, lt_min hr hp⟩, by simp [lt_min_iff, (≥)] {contextual := tt}⟩, },
76-
end
49+
theorem has_basis_uniformity :
50+
𝓤[abv.uniform_space].has_basis (λ ε : 𝕜, 0 < ε) (λ ε, {p : R × R | abv (p.2 - p.1) < ε}) :=
51+
uniform_space.has_basis_of_fun (exists_gt _) _ _ _ _ _
7752

78-
end is_absolute_value
53+
end absolute_value

0 commit comments

Comments
 (0)