Skip to content

Commit

Permalink
feat(topology/metric/basic): construct a bornology from metric axioms…
Browse files Browse the repository at this point in the history
… and add it to the pseudo metric structure (#12078)

Every metric structure naturally gives rise to a bornology where the bounded sets are precisely the metric bounded sets. The eventual goal will be to replace the existing `metric.bounded` with one defined in terms of the bornology, so we need to construct the bornology first, as we do here.



Co-authored-by: YaelDillies <yael.dillies@gmail.com>
  • Loading branch information
j-loreaux and YaelDillies committed Apr 7, 2022
1 parent 2d2d09c commit 9d786ce
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/analysis/normed_space/finite_dimension.lean
Expand Up @@ -251,7 +251,7 @@ begin
by_cases h : ∃ (s : finset E), nonempty (basis ↥s 𝕜 E),
{ rcases h with ⟨s, ⟨b⟩⟩,
haveI : finite_dimensional 𝕜 E := finite_dimensional.of_finset_basis b,
letI : normed_group (matrix s s 𝕜) := matrix.normed_group,
letI : semi_normed_group (matrix s s 𝕜) := matrix.semi_normed_group,
letI : normed_space 𝕜 (matrix s s 𝕜) := matrix.normed_space,
simp_rw linear_map.det_eq_det_to_matrix_of_finset b,
have A : continuous (λ (f : E →L[𝕜] E), linear_map.to_matrix b b f),
Expand Down
13 changes: 11 additions & 2 deletions src/number_theory/modular.lean
Expand Up @@ -218,9 +218,18 @@ begin
convert hf₂.tendsto_cocompact.comp (hf₁.comp subtype.coe_injective.tendsto_cofinite) using 1,
ext ⟨g, rfl⟩ i j : 3,
fin_cases i; [fin_cases j, skip],
{ simp [mB, f₁, mul_vec, dot_product, fin.sum_univ_two] },
-- the following are proved by `simp`, but it is replaced by `simp only` to avoid timeouts.
{ simp only [mB, mul_vec, dot_product, fin.sum_univ_two, _root_.coe_coe, coe_matrix_coe,
int.coe_cast_ring_hom, lc_row0_apply, function.comp_app, cons_val_zero, lc_row0_extend_apply,
linear_map.general_linear_group.coe_fn_general_linear_equiv,
general_linear_group.to_linear_apply, coe_plane_conformal_matrix, neg_neg, mul_vec_lin_apply,
cons_val_one, head_cons] },
{ convert congr_arg (λ n : ℤ, (-n:ℝ)) g.det_coe.symm using 1,
simp [f₁, mul_vec, dot_product, mB, fin.sum_univ_two, matrix.det_fin_two],
simp only [f₁, mul_vec, dot_product, fin.sum_univ_two, matrix.det_fin_two, function.comp_app,
subtype.coe_mk, lc_row0_extend_apply, cons_val_zero,
linear_map.general_linear_group.coe_fn_general_linear_equiv,
general_linear_group.to_linear_apply, coe_plane_conformal_matrix, mul_vec_lin_apply,
cons_val_one, head_cons, map_apply, neg_mul, int.cast_sub, int.cast_mul, neg_sub],
ring },
{ refl }
end
Expand Down
53 changes: 51 additions & 2 deletions src/topology/metric_space/basic.lean
Expand Up @@ -7,6 +7,7 @@ Authors: Jeremy Avigad, Robert Y. Lewis, Johannes Hölzl, Mario Carneiro, Sébas
import data.int.interval
import topology.algebra.order.compact
import topology.metric_space.emetric_space
import topology.bornology.basic
import topology.uniform_space.complete_separated

/-!
Expand Down Expand Up @@ -84,6 +85,45 @@ def uniform_space_of_dist
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) : uniform_space α :=
uniform_space.of_core (uniform_space.core_of_dist dist dist_self dist_comm dist_triangle)

/-- This is an internal lemma used to construct a bornology from a metric in `bornology.of_dist`. -/
private lemma bounded_iff_aux {α : Type*} (dist : α → α → ℝ)
(dist_comm : ∀ x y : α, dist x y = dist y x)
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
(s : set α) (a : α) :
(∃ c, ∀ ⦃x y⦄, x ∈ s → y ∈ s → dist x y ≤ c) ↔ (∃ r, ∀ ⦃x⦄, x ∈ s → dist x a ≤ r) :=
begin
split; rintro ⟨C, hC⟩,
{ rcases s.eq_empty_or_nonempty with rfl | ⟨x, hx⟩,
{ exact ⟨0, by simp⟩ },
{ exact ⟨C + dist x a, λ y hy,
(dist_triangle y x a).trans (add_le_add_right (hC hy hx) _)⟩ } },
{ exact ⟨C + C, λ x y hx hy,
(dist_triangle x a y).trans (add_le_add (hC hx) (by {rw dist_comm, exact hC hy}))⟩ }
end

/-- Construct a bornology from a distance function and metric space axioms. -/
def bornology.of_dist {α : Type*} (dist : α → α → ℝ)
(dist_self : ∀ x : α, dist x x = 0)
(dist_comm : ∀ x y : α, dist x y = dist y x)
(dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z) :
bornology α :=
bornology.of_bounded
{ s : set α | ∃ C, ∀ ⦃x y⦄, x ∈ s → y ∈ s → dist x y ≤ C }
0, λ x y hx, hx.elim⟩
(λ s ⟨c, hc⟩ t h, ⟨c, λ x y hx hy, hc (h hx) (h hy)⟩)
(λ s hs t ht,
begin
rcases s.eq_empty_or_nonempty with rfl | ⟨z, hz⟩,
{ exact (empty_union t).symm ▸ ht },
{ simp only [λ u, bounded_iff_aux dist dist_comm dist_triangle u z] at hs ht ⊢,
rcases ⟨hs, ht⟩ with ⟨⟨r₁, hr₁⟩, ⟨r₂, hr₂⟩⟩,
exact ⟨max r₁ r₂, λ x hx, or.elim hx
(λ hx', (hr₁ hx').trans (le_max_left _ _))
(λ hx', (hr₂ hx').trans (le_max_right _ _))⟩ }
end)
(λ z, ⟨0, λ x y hx hy,
by { rw [eq_of_mem_singleton hx, eq_of_mem_singleton hy], exact (dist_self z).le }⟩)

/-- The distance function (given an ambient metric space on `α`), which returns
a nonnegative real number `dist x y` given `x y : α`. -/
@[ext] class has_dist (α : Type*) := (dist : α → α → ℝ)
Expand Down Expand Up @@ -126,6 +166,9 @@ class pseudo_metric_space (α : Type u) extends has_dist α : Type u :=
edist x y = ennreal.of_real (dist x y) . pseudo_metric_space.edist_dist_tac)
(to_uniform_space : uniform_space α := uniform_space_of_dist dist dist_self dist_comm dist_triangle)
(uniformity_dist : 𝓤 α = ⨅ ε>0, 𝓟 {p:α×α | dist p.1 p.2 < ε} . control_laws_tac)
(to_bornology : bornology α := bornology.of_dist dist dist_self dist_comm dist_triangle)
(cobounded_sets : (bornology.cobounded α).sets =
{ s | ∃ C, ∀ ⦃x y⦄, x ∈ sᶜ → y ∈ sᶜ → dist x y ≤ C } . control_laws_tac)

/-- Two pseudo metric space structures with the same distance function coincide. -/
@[ext] lemma pseudo_metric_space.ext {α : Type*} {m m' : pseudo_metric_space α}
Expand All @@ -140,7 +183,11 @@ begin
simp [m_edist_dist, m'_edist_dist] },
{ dsimp at m_uniformity_dist m'_uniformity_dist,
rw ← m'_uniformity_dist at m_uniformity_dist,
exact uniform_space_eq m_uniformity_dist }
exact uniform_space_eq m_uniformity_dist },
{ ext1,
dsimp at m_cobounded_sets m'_cobounded_sets,
rw ← m'_cobounded_sets at m_cobounded_sets,
exact filter_eq m_cobounded_sets }
end

variables [pseudo_metric_space α]
Expand Down Expand Up @@ -185,7 +232,9 @@ pseudo_metric_space α :=
{ apply_instance }
end,
..uniform_space.core_of_dist dist dist_self dist_comm dist_triangle },
uniformity_dist := rfl }
uniformity_dist := rfl,
to_bornology := bornology.of_dist dist dist_self dist_comm dist_triangle,
cobounded_sets := rfl }

@[simp] theorem dist_self (x : α) : dist x x = 0 := pseudo_metric_space.dist_self x

Expand Down

0 comments on commit 9d786ce

Please sign in to comment.