The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V13. General topology

Mathlib.Topology.MetricSpace.Pseudo.Defs

257 declarations and 24 deprecated aliases. Mathlib docs · Source

Pseudo-metric spaces

This file defines pseudo-metric spaces: these differ from metric spaces by not imposing the condition dist x y = 0 → x = y. Many definitions and theorems expected on (pseudo-)metric spaces are already introduced on uniform spaces and topological spaces. For example: open and closed sets, compactness, completeness, continuity and uniform continuity.

Main definitions

  • Dist α: Endows a space α with a function dist a b.
  • PseudoMetricSpace α: A space endowed with a distance function, which can be zero even if the two elements are non-equal.
  • PseudoMetricSpace.ofDistTopology: Construct a pseudometric space from a compatible topology and distance.
  • Metric.ball x ε: The set of all points y with dist y x < ε.
  • Metric.closedBall x ε: The set of all points y with dist y x ≤ ε.
  • Metric.sphere x ε: The set of all points y with dist y x = ε.
  • nnDist a b: dist as a function to the non-negative reals.
  • Metric.Bounded s: Whether a subset of a PseudoMetricSpace is bounded.
  • PseudoMetricSpace.replaceUniformity, PseudoMetricSpace.replaceTopology, PseudoMetricSpace.replaceBornology: Tools to construct a pseudometric space on a type with a pre-existing uniformity, topology, or bornology in such a way that the definitional equalities for these structures are preserved; these are essential to avoid type class synthesis issues.
  • Real.pseudoMetricSpace: The pseudometric space structure on ℝ with dist x y = |x - y|.
  • MetricSpace α: A PseudoMetricSpace with the guarantee dist x y = 0 → x = y.

Main results

  • PseudoMetricSpace.ext: extensionality for pseudometric space structures.
  • dist_triangle, dist_nonneg, nnDist_triangle: core distance inequalities.
  • Metric.mk_uniformity_basis, Metric.mk_uniformity_basis_le: tools for constructing bases for the uniformity, with Metric.nhds_basis_ball and Metric.nhds_basis_closedBall as basic neighborhood-basis corollaries.
  • Metric.tendsto_nhds_nhds, Metric.continuous_iff: epsilon-delta characterizations of convergence and continuity.
  • Metric.mem_closure_iff, Metric.dense_iff: characterizations of closure and dense sets.

Tags

pseudometric space, dist

Instantiate a pseudometric space as a pseudoemetric space. Before we can state the instance, we need to show that the uniform structure coming from the edistance and the distance coincide.

def NNDist.ctorIdx E1 #

{α : Type u_3} → NNDist α → ℕ

def Dist.ctorIdx E1 #

{α : Type u_3} → Dist α → ℕ

def PseudoMetricSpace.ctorIdx E1 #

{α : Type u} → PseudoMetricSpace α → ℕ

theorem UniformSpace.ofDist_aux E0 #

∀ (ε : ℝ), 0 < ε → ∃ δ > 0, ∀ x < δ, ∀ y < δ, x + y < ε

def UniformSpace.ofDist E1 #

{α : Type u} →
  (dist : α → α → ℝ) →
    (∀ (x : α), dist x x = 0) →
      (∀ (x y : α), dist x y = dist y x) → (∀ (x y z : α), dist x z ≤ dist x y + dist y z) → UniformSpace α

Construct a uniform structure from a distance function and metric space axioms

abbrev Bornology.ofDist E1 #

{α : Type u_3} →
  (dist : α → α → ℝ) →
    (∀ (x y : α), dist x y = dist y x) → (∀ (x y z : α), dist x z ≤ dist x y + dist y z) → Bornology α

Construct a bornology from a distance function and metric space axioms.

class Dist E1 #

Type u_3 → Type u_3

The distance function (given an ambient metric space on α), which returns a real number dist x y given x y : α. This type class does not enforce non-negativity.

theorem Dist.ext E1 #

∀ {α : Type u_3} {x y : Dist α}, dist = dist → x = y

theorem Dist.ext_iff E0 #

∀ {α : Type u_3} {x y : Dist α}, x = y ↔ dist = dist

ctor Dist.mk E0 #

{α : Type u_3} → (α → α → ℝ) → Dist α

abbrev Dist.dist E1 #

{α : Type u_3} → [self : Dist α] → α → α → ℝ

Distance between two points

class PseudoMetricSpace E3 #

Type u → Type u

A pseudometric space is a type endowed with a ℝ-valued distance dist satisfying reflexivity dist x x = 0, commutativity dist x y = dist y x, and the triangle inequality dist x z ≤ dist x y + dist y z.

Note that we do not require dist x y = 0 → x = y. See metric spaces (MetricSpace) for the similar class with that stronger assumption.

Any pseudometric space is a topological space and a uniform space (see TopologicalSpace, UniformSpace), where the topology and uniformity come from the metric. Note that a T1 pseudometric space is just a metric space.

We make the uniformity/topology part of the data instead of deriving it from the metric. This e.g. ensures that we do not get a diamond when doing [PseudoMetricSpace α] [PseudoMetricSpace β] : TopologicalSpace (α × β): The product metric and product topology agree, but not definitionally so. See Note [forgetful inheritance].

ctor PseudoMetricSpace.mk E0 #

{α : Type u} →
  [toDist : Dist α] →
    (∀ (x : α), dist x x = 0) →
      (∀ (x y : α), dist x y = dist y x) →
        (∀ (x y z : α), dist x z ≤ dist x y + dist y z) →
          (edist : α → α → ENNReal) →
            autoParam (∀ (x y : α), edist x y = ENNReal.ofReal (dist x y)) PseudoMetricSpace.edist_dist._autoParam →
              (toUniformSpace : UniformSpace α) →
                autoParam (uniformity α = ⨅ ε, ⨅ (_ : ε > 0), Filter.principal {p | dist p.1 p.2 < ε})
                    PseudoMetricSpace.uniformity_dist._autoParam →
                  (toBornology : Bornology α) →
                    autoParam ((Bornology.cobounded α).sets = {s | ∃ C, ∀ x ∈ sᶜ, ∀ y ∈ sᶜ, dist x y ≤ C})
                        PseudoMetricSpace.cobounded_sets._autoParam →
                      PseudoMetricSpace α

instance PseudoMetricSpace.toDist E0 #

{α : Type u} → [self : PseudoMetricSpace α] → Dist α

theorem PseudoMetricSpace.dist_self E1 #

∀ {α : Type u} [self : PseudoMetricSpace α] (x : α), dist x x = 0

theorem PseudoMetricSpace.dist_comm E1 #

∀ {α : Type u} [self : PseudoMetricSpace α] (x y : α), dist x y = dist y x

theorem PseudoMetricSpace.dist_triangle E3 #

∀ {α : Type u} [self : PseudoMetricSpace α] (x y z : α), dist x z ≤ dist x y + dist y z

abbrev PseudoMetricSpace.edist E1 #

{α : Type u} → [self : PseudoMetricSpace α] → α → α → ENNReal

Extended distance between two points

theorem PseudoMetricSpace.edist_dist E1 #

∀ {α : Type u} [self : PseudoMetricSpace α] (x y : α), PseudoMetricSpace.edist x y = ENNReal.ofReal (dist x y)

instance PseudoMetricSpace.toUniformSpace E0 #

{α : Type u} → [self : PseudoMetricSpace α] → UniformSpace α

theorem PseudoMetricSpace.uniformity_dist E1 #

∀ {α : Type u} [self : PseudoMetricSpace α], uniformity α = ⨅ ε, ⨅ (_ : ε > 0), Filter.principal {p | dist p.1 p.2 < ε}

instance PseudoMetricSpace.toBornology E0 #

{α : Type u} → [self : PseudoMetricSpace α] → Bornology α

theorem PseudoMetricSpace.cobounded_sets E1 #

∀ {α : Type u} [self : PseudoMetricSpace α], (Bornology.cobounded α).sets = {s | ∃ C, ∀ x ∈ sᶜ, ∀ y ∈ sᶜ, dist x y ≤ C}

theorem PseudoMetricSpace.ext E3 #

∀ {α : Type u_3} {m m' : PseudoMetricSpace α}, m.toDist = m'.toDist → m = m'

Two pseudometric space structures with the same distance function coincide.

theorem PseudoMetricSpace.ext_iff E0 #

∀ {α : Type u_3} {m m' : PseudoMetricSpace α}, m = m' ↔ m.toDist = m'.toDist

instance PseudoMetricSpace.toEDist E0 #

{α : Type u} → [PseudoMetricSpace α] → EDist α

def PseudoMetricSpace.ofDistTopology E3 #

{α : Type u} →
  [inst : TopologicalSpace α] →
    (dist : α → α → ℝ) →
      (∀ (x : α), dist x x = 0) →
        (∀ (x y : α), dist x y = dist y x) →
          (∀ (x y z : α), dist x z ≤ dist x y + dist y z) →
            (∀ (s : Set α), IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ (y : α), dist x y < ε → y ∈ s) → PseudoMetricSpace α

Construct a pseudo-metric space structure whose underlying topological space structure (definitionally) agrees which a pre-existing topology which is compatible with a given distance function.

theorem dist_self E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), dist x x = 0

theorem dist_comm E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), dist x y = dist y x

theorem edist_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), edist x y = ENNReal.ofReal (dist x y)

theorem dist_triangle E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), dist x z ≤ dist x y + dist y z

theorem dist_triangle_left E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), dist x y ≤ dist z x + dist z y

theorem dist_triangle_right E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), dist x y ≤ dist x z + dist y z

theorem dist_triangle4 E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z w : α), dist x w ≤ dist x y + dist y z + dist z w

theorem dist_triangle4_left E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x₁ y₁ x₂ y₂ : α), dist x₂ y₂ ≤ dist x₁ y₁ + (dist x₁ x₂ + dist y₁ y₂)

theorem dist_triangle4_right E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x₁ y₁ x₂ y₂ : α), dist x₁ y₁ ≤ dist x₁ x₂ + dist y₁ y₂ + dist x₂ y₂

theorem dist_triangle8 E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (a b c d e f g h : α),
  dist a h ≤ dist a b + dist b c + dist c d + dist d e + dist e f + dist f g + dist g h

theorem swap_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], Function.swap dist = dist

theorem abs_dist_sub_le E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), |dist x z - dist y z| ≤ dist x y

theorem dist_nonneg E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α}, 0 ≤ dist x y

def Mathlib.Meta.Positivity.evalDist E1 #

Mathlib.Meta.Positivity.PositivityExt

Extension for the positivity tactic: distances are nonnegative.

theorem abs_dist E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {a b : α}, |dist a b| = dist a b

class NNDist E1 #

Type u_3 → Type u_3

A version of Dist that takes value in ℝ≥0.

ctor NNDist.mk E0 #

{α : Type u_3} → (α → α → NNReal) → NNDist α

abbrev NNDist.nnDist E1 #

{α : Type u_3} → [self : NNDist α] → α → α → NNReal

Nonnegative distance between two points

instance PseudoMetricSpace.toNNDist E0 #

{α : Type u} → [PseudoMetricSpace α] → NNDist α

Distance as a nonnegative real number.

theorem dist_nnDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), dist x y = ↑(nnDist x y)

Express dist in terms of nnDist

theorem coe_nnDist E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), ↑(nnDist x y) = dist x y

theorem eDist_nnDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), edist x y = ↑(nnDist x y)

Express edist in terms of nnDist

theorem nnDist_edist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), nnDist x y = (edist x y).toNNReal

Express nnDist in terms of edist

theorem coe_nnreal_ennreal_nnDist E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), ↑(nnDist x y) = edist x y

theorem edist_lt_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {c : NNReal}, edist x y < ↑c ↔ nnDist x y < c

theorem edist_le_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {c : NNReal}, edist x y ≤ ↑c ↔ nnDist x y ≤ c

theorem edist_lt_top E1 #

∀ {α : Type u_3} [inst : PseudoMetricSpace α] (x y : α), edist x y < ⊤

In a pseudometric space, the extended distance is always finite

theorem edist_ne_top E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), edist x y ≠ ⊤

In a pseudometric space, the extended distance is always finite

theorem nnDist_self E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (a : α), nnDist a a = 0

nnDist x x vanishes

theorem dist_lt_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {c : NNReal}, dist x y < ↑c ↔ nnDist x y < c

theorem dist_le_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {c : NNReal}, dist x y ≤ ↑c ↔ nnDist x y ≤ c

theorem edist_lt_ofReal E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {r : ℝ}, edist x y < ENNReal.ofReal r ↔ dist x y < r

theorem edist_le_ofReal E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {r : ℝ}, 0 ≤ r → (edist x y ≤ ENNReal.ofReal r ↔ dist x y ≤ r)

theorem nnDist_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), nnDist x y = (dist x y).toNNReal

Express nnDist in terms of dist

theorem nnDist_comm E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), nnDist x y = nnDist y x

theorem nnDist_triangle E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), nnDist x z ≤ nnDist x y + nnDist y z

Triangle inequality for the nonnegative distance

theorem nnDist_triangle_left E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), nnDist x y ≤ nnDist z x + nnDist z y

theorem nnDist_triangle_right E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), nnDist x y ≤ nnDist x z + nnDist y z

theorem dist_edist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y : α), dist x y = (edist x y).toReal

Express dist in terms of edist

def Metric.ball E3 #

{α : Type u} → [PseudoMetricSpace α] → α → ℝ → Set α

ball x ε is the set of all points y with dist y x < ε

theorem Metric.mem_ball E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.ball x ε ↔ dist y x < ε

theorem Metric.mem_ball' E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.ball x ε ↔ dist x y < ε

theorem Metric.pos_of_mem_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.ball x ε → 0 < ε

theorem Metric.mem_ball_self E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, 0 < ε → x ∈ Metric.ball x ε

theorem Metric.nonempty_ball E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, (Metric.ball x ε).Nonempty ↔ 0 < ε

theorem Metric.ball_eq_empty E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.ball x ε = ∅ ↔ ε ≤ 0

theorem Metric.ball_zero E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α}, Metric.ball x 0 = ∅

theorem Metric.exists_lt_mem_ball_of_mem_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, x ∈ Metric.ball y ε → ∃ ε' < ε, x ∈ Metric.ball y ε'

If a point belongs to an open ball, then there is a strictly smaller radius whose ball also contains it.

See also exists_lt_subset_ball.

theorem Metric.ball_eq_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (ε : ℝ) (x : α), SetRel.ball {p | dist p.2 p.1 < ε} x = Metric.ball x ε

theorem Metric.ball_eq_ball' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (ε : ℝ) (x : α), SetRel.ball {p | dist p.1 p.2 < ε} x = Metric.ball x ε

theorem Metric.iUnion_ball_nat E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), ⋃ n, Metric.ball x ↑n = Set.univ

theorem Metric.iUnion_ball_nat_succ E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), ⋃ n, Metric.ball x (↑n + 1) = Set.univ

def Metric.closedBall E1 #

{α : Type u} → [PseudoMetricSpace α] → α → ℝ → Set α

closedBall x ε is the set of all points y with dist y x ≤ ε

theorem Metric.mem_closedBall E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.closedBall x ε ↔ dist y x ≤ ε

theorem Metric.mem_closedBall' E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.closedBall x ε ↔ dist x y ≤ ε

theorem Metric.nonneg_of_mem_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.closedBall x ε → 0 ≤ ε

def Metric.sphere E1 #

{α : Type u} → [PseudoMetricSpace α] → α → ℝ → Set α

sphere x ε is the set of all points y with dist y x = ε

theorem Metric.mem_sphere E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.sphere x ε ↔ dist y x = ε

theorem Metric.mem_sphere' E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.sphere x ε ↔ dist x y = ε

theorem Metric.ne_of_mem_sphere E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.sphere x ε → ε ≠ 0 → y ≠ x

theorem Metric.nonneg_of_mem_sphere E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, y ∈ Metric.sphere x ε → 0 ≤ ε

theorem Metric.sphere_eq_empty_of_neg E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, ε < 0 → Metric.sphere x ε = ∅

theorem Metric.sphere_eq_empty_of_subsingleton E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ} [Subsingleton α], ε ≠ 0 → Metric.sphere x ε = ∅

instance Metric.sphere_isEmpty_of_subsingleton E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ} [Subsingleton α] [NeZero ε], IsEmpty ↑(Metric.sphere x ε)

theorem Metric.closedBall_eq_singleton_of_subsingleton E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ} [Subsingleton α], 0 ≤ ε → Metric.closedBall x ε = {x}

theorem Metric.ball_eq_singleton_of_subsingleton E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ} [Subsingleton α], 0 < ε → Metric.ball x ε = {x}

theorem Metric.mem_closedBall_self E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, 0 ≤ ε → x ∈ Metric.closedBall x ε

theorem Metric.nonempty_closedBall E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, (Metric.closedBall x ε).Nonempty ↔ 0 ≤ ε

theorem Metric.closedBall_eq_empty E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.closedBall x ε = ∅ ↔ ε < 0

theorem Metric.closedBall_of_neg E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, ε < 0 → Metric.closedBall x ε = ∅

Alias of the reverse direction of Metric.closedBall_eq_empty.

theorem Metric.closedBall_eq_sphere_of_nonpos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, ε ≤ 0 → Metric.closedBall x ε = Metric.sphere x ε

Closed balls and spheres coincide when the radius is non-positive

theorem Metric.ball_subset_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.ball x ε ⊆ Metric.closedBall x ε

theorem Metric.sphere_subset_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.sphere x ε ⊆ Metric.closedBall x ε

theorem Metric.sphere_subset_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {r R : ℝ}, r < R → Metric.sphere x r ⊆ Metric.ball x R

theorem Metric.closedBall_disjoint_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {δ ε : ℝ},
  δ + ε ≤ dist x y → Disjoint (Metric.closedBall x δ) (Metric.ball y ε)

theorem Metric.ball_disjoint_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {δ ε : ℝ},
  δ + ε ≤ dist x y → Disjoint (Metric.ball x δ) (Metric.closedBall y ε)

theorem Metric.ball_disjoint_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {δ ε : ℝ},
  δ + ε ≤ dist x y → Disjoint (Metric.ball x δ) (Metric.ball y ε)

theorem Metric.closedBall_disjoint_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {δ ε : ℝ},
  δ + ε < dist x y → Disjoint (Metric.closedBall x δ) (Metric.closedBall y ε)

theorem Metric.sphere_disjoint_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Disjoint (Metric.sphere x ε) (Metric.ball x ε)

theorem Metric.ball_union_sphere E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.ball x ε ∪ Metric.sphere x ε = Metric.closedBall x ε

theorem Metric.sphere_union_ball E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.sphere x ε ∪ Metric.ball x ε = Metric.closedBall x ε

theorem Metric.closedBall_sdiff_sphere E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.closedBall x ε \ Metric.sphere x ε = Metric.ball x ε

theorem Metric.closedBall_sdiff_ball E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.closedBall x ε \ Metric.ball x ε = Metric.sphere x ε

theorem Metric.mem_ball_comm E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, x ∈ Metric.ball y ε ↔ y ∈ Metric.ball x ε

theorem Metric.mem_closedBall_comm E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, x ∈ Metric.closedBall y ε ↔ y ∈ Metric.closedBall x ε

theorem Metric.mem_sphere_comm E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ}, x ∈ Metric.sphere y ε ↔ y ∈ Metric.sphere x ε

theorem Metric.ball_subset_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε₁ ε₂ : ℝ}, ε₁ ≤ ε₂ → Metric.ball x ε₁ ⊆ Metric.ball x ε₂

theorem Metric.closedBall_eq_bInter_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.closedBall x ε = ⋂ δ, ⋂ (_ : δ > ε), Metric.ball x δ

theorem Metric.ball_subset_ball' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  ε₁ + dist x y ≤ ε₂ → Metric.ball x ε₁ ⊆ Metric.ball y ε₂

theorem Metric.closedBall_subset_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε₁ ε₂ : ℝ},
  ε₁ ≤ ε₂ → Metric.closedBall x ε₁ ⊆ Metric.closedBall x ε₂

theorem Metric.closedBall_subset_closedBall' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  ε₁ + dist x y ≤ ε₂ → Metric.closedBall x ε₁ ⊆ Metric.closedBall y ε₂

theorem Metric.closedBall_subset_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε₁ ε₂ : ℝ}, ε₁ < ε₂ → Metric.closedBall x ε₁ ⊆ Metric.ball x ε₂

theorem Metric.closedBall_subset_ball' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  ε₁ + dist x y < ε₂ → Metric.closedBall x ε₁ ⊆ Metric.ball y ε₂

theorem Metric.dist_le_add_of_nonempty_closedBall_inter_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  (Metric.closedBall x ε₁ ∩ Metric.closedBall y ε₂).Nonempty → dist x y ≤ ε₁ + ε₂

theorem Metric.dist_lt_add_of_nonempty_closedBall_inter_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  (Metric.closedBall x ε₁ ∩ Metric.ball y ε₂).Nonempty → dist x y < ε₁ + ε₂

theorem Metric.dist_lt_add_of_nonempty_ball_inter_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  (Metric.ball x ε₁ ∩ Metric.closedBall y ε₂).Nonempty → dist x y < ε₁ + ε₂

theorem Metric.dist_lt_add_of_nonempty_ball_inter_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  (Metric.ball x ε₁ ∩ Metric.ball y ε₂).Nonempty → dist x y < ε₁ + ε₂

theorem Metric.iUnion_closedBall_nat E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), ⋃ n, Metric.closedBall x ↑n = Set.univ

theorem Metric.iUnion_inter_closedBall_nat E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α) (x : α), ⋃ n, s ∩ Metric.closedBall x ↑n = s

theorem Metric.ball_subset E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε₁ ε₂ : ℝ},
  dist x y ≤ ε₂ - ε₁ → Metric.ball x ε₁ ⊆ Metric.ball y ε₂

theorem Metric.ball_half_subset E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ},
  ∀ y ∈ Metric.ball x (ε / 2), Metric.ball y (ε / 2) ⊆ Metric.ball x ε

theorem Metric.exists_ball_subset_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α} {ε : ℝ},
  y ∈ Metric.ball x ε → ∃ ε' > 0, Metric.ball y ε' ⊆ Metric.ball x ε

theorem Metric.forall_of_forall_mem_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (p : α → Prop) (x : α),
  (∃ᶠ (R : ℝ) in Filter.atTop, ∀ y ∈ Metric.closedBall x R, p y) → ∀ (y : α), p y

If a property holds for all points in closed balls of arbitrarily large radii, then it holds for all points.

theorem Metric.forall_of_forall_mem_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (p : α → Prop) (x : α),
  (∃ᶠ (R : ℝ) in Filter.atTop, ∀ y ∈ Metric.ball x R, p y) → ∀ (y : α), p y

If a property holds for all points in balls of arbitrarily large radii, then it holds for all points.

theorem Metric.isBounded_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α},
  Bornology.IsBounded s ↔ ∃ C, ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ s → dist x y ≤ C

theorem Metric.boundedSpace_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α], BoundedSpace α ↔ ∃ C, ∀ (a b : α), dist a b ≤ C

theorem Metric.isBounded_iff_eventually E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α},
  Bornology.IsBounded s ↔ ∀ᶠ (C : ℝ) in Filter.atTop, ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ s → dist x y ≤ C

theorem Metric.isBounded_iff_exists_ge E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} (c : ℝ),
  Bornology.IsBounded s ↔ ∃ C, c ≤ C ∧ ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ s → dist x y ≤ C

theorem Metric.isBounded_iff_nnDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α},
  Bornology.IsBounded s ↔ ∃ C, ∀ ⦃x : α⦄, x ∈ s → ∀ ⦃y : α⦄, y ∈ s → nnDist x y ≤ C

theorem Metric.boundedSpace_iff_nnDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], BoundedSpace α ↔ ∃ C, ∀ (a b : α), nnDist a b ≤ C

theorem Metric.boundedSpace_iff_edist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], BoundedSpace α ↔ ∃ C, ∀ (a b : α), edist a b ≤ ↑C

theorem Metric.toUniformSpace_eq E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α], PseudoMetricSpace.toUniformSpace = UniformSpace.ofDist dist ⋯ ⋯ ⋯

theorem Metric.uniformity_basis_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], (uniformity α).HasBasis (fun ε ↦ 0 < ε) fun ε ↦ {p | dist p.1 p.2 < ε}

theorem Metric.mk_uniformity_basis E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {β : Type u_3} {p : β → Prop} {f : β → ℝ},
  (∀ (i : β), p i → 0 < f i) →
    (∀ ⦃ε : ℝ⦄, 0 < ε → ∃ i, p i ∧ f i ≤ ε) → (uniformity α).HasBasis p fun i ↦ {p | dist p.1 p.2 < f i}

Given f : β → ℝ, if f sends {i | p i} to a set of positive numbers accumulating to zero, then f i-neighborhoods of the diagonal form a basis of 𝓤 α.

For specific bases see uniformity_basis_dist, uniformity_basis_dist_inv_nat_succ, and uniformity_basis_dist_inv_nat_pos.

theorem Metric.uniformity_basis_dist_rat E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], (uniformity α).HasBasis (fun r ↦ 0 < r) fun r ↦ {p | dist p.1 p.2 < ↑r}

theorem Metric.uniformity_basis_dist_inv_nat_succ E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α],
  (uniformity α).HasBasis (fun x ↦ True) fun n ↦ {p | dist p.1 p.2 < 1 / (↑n + 1)}

theorem Metric.uniformity_basis_dist_inv_nat_pos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], (uniformity α).HasBasis (fun n ↦ 0 < n) fun n ↦ {p | dist p.1 p.2 < 1 / ↑n}

theorem Metric.uniformity_basis_dist_pow E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {r : ℝ},
  0 < r → r < 1 → (uniformity α).HasBasis (fun x ↦ True) fun n ↦ {p | dist p.1 p.2 < r ^ n}

theorem Metric.uniformity_basis_dist_lt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {R : ℝ},
  0 < R → (uniformity α).HasBasis (fun r ↦ 0 < r ∧ r < R) fun r ↦ {p | dist p.1 p.2 < r}

theorem Metric.mk_uniformity_basis_le E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {β : Type u_3} {p : β → Prop} {f : β → ℝ},
  (∀ (x : β), p x → 0 < f x) →
    (∀ (ε : ℝ), 0 < ε → ∃ x, p x ∧ f x ≤ ε) → (uniformity α).HasBasis p fun x ↦ {p | dist p.1 p.2 ≤ f x}

Given f : β → ℝ, if f sends {i | p i} to a set of positive numbers accumulating to zero, then closed neighborhoods of the diagonal of sizes {f i | p i} form a basis of 𝓤 α.

Currently we have only one specific basis uniformity_basis_dist_le based on this constructor. More can be easily added if needed in the future.

theorem Metric.uniformity_basis_dist_le E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], (uniformity α).HasBasis (fun x ↦ 0 < x) fun ε ↦ {p | dist p.1 p.2 ≤ ε}

Constant size closed neighborhoods of the diagonal form a basis of the uniformity filter.

theorem Metric.uniformity_basis_dist_le_inv_nat_succ E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α],
  (uniformity α).HasBasis (fun x ↦ True) fun n ↦ {p | dist p.1 p.2 ≤ 1 / (↑n + 1)}

theorem Metric.uniformity_basis_dist_le_inv_nat_pos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], (uniformity α).HasBasis (fun n ↦ 0 < n) fun n ↦ {p | dist p.1 p.2 ≤ 1 / ↑n}

theorem Metric.uniformity_basis_dist_le_pow E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {r : ℝ},
  0 < r → r < 1 → (uniformity α).HasBasis (fun x ↦ True) fun n ↦ {p | dist p.1 p.2 ≤ r ^ n}

theorem Metric.mem_uniformity_dist E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set (α × α)},
  s ∈ uniformity α ↔ ∃ ε > 0, ∀ ⦃a b : α⦄, dist a b < ε → (a, b) ∈ s

theorem Metric.dist_mem_uniformity E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {ε : ℝ}, 0 < ε → {p | dist p.1 p.2 < ε} ∈ uniformity α

A constant size neighborhood of the diagonal is an entourage.

theorem Metric.uniformContinuous_iff E3 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β},
  UniformContinuous f ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃a b : α⦄, dist a b < δ → dist (f a) (f b) < ε

theorem Metric.uniformContinuousOn_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {s : Set α},
  UniformContinuousOn f s ↔ ∀ ε > 0, ∃ δ > 0, ∀ x ∈ s, ∀ y ∈ s, dist x y < δ → dist (f x) (f y) < ε

theorem Metric.uniformContinuous_iff_le E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β},
  UniformContinuous f ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃a b : α⦄, dist a b ≤ δ → dist (f a) (f b) ≤ ε

theorem Metric.uniformContinuousOn_iff_le E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {s : Set α},
  UniformContinuousOn f s ↔ ∀ ε > 0, ∃ δ > 0, ∀ x ∈ s, ∀ y ∈ s, dist x y ≤ δ → dist (f x) (f y) ≤ ε

theorem Metric.nhds_basis_ball E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α}, (nhds x).HasBasis (fun x ↦ 0 < x) (Metric.ball x)

theorem Metric.mem_nhds_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {s : Set α}, s ∈ nhds x ↔ ∃ ε > 0, Metric.ball x ε ⊆ s

theorem Metric.eventually_nhds_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {p : α → Prop},
  (∀ᶠ (y : α) in nhds x, p y) ↔ ∃ ε > 0, ∀ ⦃y : α⦄, dist y x < ε → p y

theorem Metric.eventually_nhds_iff_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {p : α → Prop},
  (∀ᶠ (y : α) in nhds x, p y) ↔ ∃ ε > 0, ∀ y ∈ Metric.ball x ε, p y

theorem Metric.eventually_nhds_prod_iff E0 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f : Filter ι} {x₀ : α} {p : α × ι → Prop},
  (∀ᶠ (x : α × ι) in nhds x₀ ×ˢ f, p x) ↔
    ∃ ε > 0, ∃ pa, (∀ᶠ (i : ι) in f, pa i) ∧ ∀ ⦃x : α⦄, dist x x₀ < ε → ∀ ⦃i : ι⦄, pa i → p (x, i)

A version of Filter.eventually_prod_iff where the first filter consists of neighborhoods in a pseudo-metric space.

theorem Metric.eventually_prod_nhds_iff E0 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f : Filter ι} {x₀ : α} {p : ι × α → Prop},
  (∀ᶠ (x : ι × α) in f ×ˢ nhds x₀, p x) ↔
    ∃ pa, (∀ᶠ (i : ι) in f, pa i) ∧ ∃ ε > 0, ∀ ⦃i : ι⦄, pa i → ∀ ⦃x : α⦄, dist x x₀ < ε → p (i, x)

A version of Filter.eventually_prod_iff where the second filter consists of neighborhoods in a pseudo-metric space.

theorem Metric.nhds_basis_closedBall E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α}, (nhds x).HasBasis (fun ε ↦ 0 < ε) (Metric.closedBall x)

theorem Metric.nhds_basis_ball_inv_nat_succ E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α},
  (nhds x).HasBasis (fun x ↦ True) fun n ↦ Metric.ball x (1 / (↑n + 1))

theorem Metric.nhds_basis_ball_inv_nat_pos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α}, (nhds x).HasBasis (fun n ↦ 0 < n) fun n ↦ Metric.ball x (1 / ↑n)

theorem Metric.nhds_basis_closedBall_inv_nat_succ E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α},
  (nhds x).HasBasis (fun x ↦ True) fun n ↦ Metric.closedBall x (1 / (↑n + 1))

theorem Metric.nhds_basis_closedBall_inv_nat_pos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α},
  (nhds x).HasBasis (fun n ↦ 0 < n) fun n ↦ Metric.closedBall x (1 / ↑n)

theorem Metric.nhds_basis_ball_pow E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {r : ℝ},
  0 < r → r < 1 → (nhds x).HasBasis (fun x ↦ True) fun n ↦ Metric.ball x (r ^ n)

theorem Metric.nhds_basis_closedBall_pow E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {r : ℝ},
  0 < r → r < 1 → (nhds x).HasBasis (fun x ↦ True) fun n ↦ Metric.closedBall x (r ^ n)

theorem Metric.isOpen_iff E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, Metric.ball x ε ⊆ s

theorem Metric.isOpen_ball E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, IsOpen (Metric.ball x ε)

theorem Metric.ball_mem_nhds E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α) {ε : ℝ}, 0 < ε → Metric.ball x ε ∈ nhds x

theorem Metric.closedBall_mem_nhds E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α) {ε : ℝ}, 0 < ε → Metric.closedBall x ε ∈ nhds x

theorem Metric.closedBall_mem_nhds_of_mem E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x c : α} {ε : ℝ}, x ∈ Metric.ball c ε → Metric.closedBall c ε ∈ nhds x

theorem Metric.nhdsWithin_basis_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {s : Set α},
  (nhdsWithin x s).HasBasis (fun ε ↦ 0 < ε) fun ε ↦ Metric.ball x ε ∩ s

theorem Metric.mem_nhdsWithin_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {s t : Set α}, s ∈ nhdsWithin x t ↔ ∃ ε > 0, Metric.ball x ε ∩ t ⊆ s

theorem Metric.tendsto_nhdsWithin_nhdsWithin E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {s : Set α} [inst_1 : PseudoMetricSpace β] {t : Set β}
  {f : α → β} {a : α} {b : β},
  Filter.Tendsto f (nhdsWithin a s) (nhdsWithin b t) ↔
    ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : α⦄, x ∈ s → dist x a < δ → f x ∈ t ∧ dist (f x) b < ε

theorem Metric.tendsto_nhdsWithin_nhds E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {s : Set α} [inst_1 : PseudoMetricSpace β] {f : α → β} {a : α}
  {b : β},
  Filter.Tendsto f (nhdsWithin a s) (nhds b) ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : α⦄, x ∈ s → dist x a < δ → dist (f x) b < ε

theorem Metric.tendsto_nhds_nhds E3 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {a : α} {b : β},
  Filter.Tendsto f (nhds a) (nhds b) ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : α⦄, dist x a < δ → dist (f x) b < ε

theorem Metric.continuousAt_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {a : α},
  ContinuousAt f a ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : α⦄, dist x a < δ → dist (f x) (f a) < ε

theorem Metric.continuousWithinAt_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {a : α} {s : Set α},
  ContinuousWithinAt f s a ↔ ∀ ε > 0, ∃ δ > 0, ∀ ⦃x : α⦄, x ∈ s → dist x a < δ → dist (f x) (f a) < ε

theorem Metric.continuousOn_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β} {s : Set α},
  ContinuousOn f s ↔ ∀ b ∈ s, ∀ ε > 0, ∃ δ > 0, ∀ a ∈ s, dist a b < δ → dist (f a) (f b) < ε

theorem Metric.continuous_iff E3 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {f : α → β},
  Continuous f ↔ ∀ (b : α), ∀ ε > 0, ∃ δ > 0, ∀ (a : α), dist a b < δ → dist (f a) (f b) < ε

theorem Metric.tendsto_nhds E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {f : Filter β} {u : β → α} {a : α},
  Filter.Tendsto u f (nhds a) ↔ ∀ ε > 0, ∀ᶠ (x : β) in f, dist (u x) a < ε

theorem Metric.continuousAt_iff' E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : TopologicalSpace β] {f : β → α} {b : β},
  ContinuousAt f b ↔ ∀ ε > 0, ∀ᶠ (x : β) in nhds b, dist (f x) (f b) < ε

theorem Metric.continuousWithinAt_iff' E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : TopologicalSpace β] {f : β → α} {b : β} {s : Set β},
  ContinuousWithinAt f s b ↔ ∀ ε > 0, ∀ᶠ (x : β) in nhdsWithin b s, dist (f x) (f b) < ε

theorem Metric.continuousOn_iff' E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : TopologicalSpace β] {f : β → α} {s : Set β},
  ContinuousOn f s ↔ ∀ b ∈ s, ∀ ε > 0, ∀ᶠ (x : β) in nhdsWithin b s, dist (f x) (f b) < ε

theorem Metric.continuous_iff' E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : TopologicalSpace β] {f : β → α},
  Continuous f ↔ ∀ (a : β), ∀ ε > 0, ∀ᶠ (x : β) in nhds a, dist (f x) (f a) < ε

theorem Metric.tendsto_atTop E3 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [Nonempty β] [inst_2 : SemilatticeSup β] {u : β → α} {a : α},
  Filter.Tendsto u Filter.atTop (nhds a) ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, dist (u n) a < ε

theorem Metric.tendsto_atTop' E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [Nonempty β] [inst_2 : SemilatticeSup β] [NoMaxOrder β]
  {u : β → α} {a : α}, Filter.Tendsto u Filter.atTop (nhds a) ↔ ∀ ε > 0, ∃ N, ∀ n > N, dist (u n) a < ε

A variant of tendsto_atTop that uses ∃ N, ∀ n > N, ... rather than ∃ N, ∀ n ≥ N, ...

theorem Metric.isOpen_singleton_iff E0 #

∀ {α : Type u_3} [inst : PseudoMetricSpace α] {x : α}, IsOpen {x} ↔ ∃ ε > 0, ∀ (y : α), dist y x < ε → y = x

theorem Dense.exists_dist_lt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Dense s → ∀ (x : α) {ε : ℝ}, 0 < ε → ∃ y ∈ s, dist x y < ε

theorem DenseRange.exists_dist_lt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {β : Type u_3} {f : β → α},
  DenseRange f → ∀ (x : α) {ε : ℝ}, 0 < ε → ∃ y, dist x (f y) < ε

theorem Metric.uniformSpace_eq_bot E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α],
  PseudoMetricSpace.toUniformSpace = ⊥ ↔ ∃ r, 0 < r ∧ Pairwise fun x1 x2 ↦ r ≤ dist x1 x2

(Pseudo) metric space has discrete UniformSpace structure iff the distances between distinct points are uniformly bounded away from zero.

theorem DiscreteTopology.of_forall_le_dist E1 #

∀ {α : Type u_3} [inst : PseudoMetricSpace α] {r : ℝ},
  0 < r → (Pairwise fun x1 x2 ↦ r ≤ dist x1 x2) → DiscreteTopology α

If the distances between distinct points in a (pseudo) metric space are uniformly bounded away from zero, then the space has discrete topology.

theorem Metric.uniformity_edist_aux E0 #

∀ {α : Type u_3} (d : α → α → NNReal),
  ⨅ ε, ⨅ (_ : ε > 0), Filter.principal {p | ↑(d p.1 p.2) < ε} =
    ⨅ ε, ⨅ (_ : ε > 0), Filter.principal {p | ↑(d p.1 p.2) < ε}

theorem Metric.uniformity_edist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], uniformity α = ⨅ ε, ⨅ (_ : ε > 0), Filter.principal {p | edist p.1 p.2 < ε}

instance PseudoMetricSpace.toPseudoEMetricSpace E0 #

{α : Type u} → [PseudoMetricSpace α] → PseudoEMetricSpace α

A pseudometric space induces a pseudoemetric space

theorem Metric.eball_top_eq_univ E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), Metric.eball x ⊤ = Set.univ

In a pseudometric space, an open ball of infinite radius is the whole space

theorem Metric.eball_ofReal E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.eball x (ENNReal.ofReal ε) = Metric.ball x ε

Balls defined using the distance or the edistance coincide

theorem Metric.eball_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : NNReal}, Metric.eball x ↑ε = Metric.ball x ↑ε

Balls defined using the distance or the edistance coincide

theorem Metric.closedEBall_ofReal E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ},
  0 ≤ ε → Metric.closedEBall x (ENNReal.ofReal ε) = Metric.closedBall x ε

Closed balls defined using the distance or the edistance coincide

theorem Metric.closedEBall_coe E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : NNReal}, Metric.closedEBall x ↑ε = Metric.closedBall x ↑ε

Closed balls defined using the distance or the edistance coincide

theorem Metric.closedBall_subset_closedEBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {r : ℝ},
  Metric.closedBall x r ⊆ Metric.closedEBall x (ENNReal.ofReal r)

Metric ball of radius r is a subset of the extended metric ball of radius ENNReal.ofReal r.

For r ≥ 0, this inclusion is an equality, see Metric.closedEBall_ofReal.

theorem Metric.eball_top E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α), Metric.eball x ⊤ = Set.univ

abbrev PseudoMetricSpace.replaceUniformity E3 #

{α : Type u_3} → [U : UniformSpace α] → (m : PseudoMetricSpace α) → uniformity α = uniformity α → PseudoMetricSpace α

Build a new pseudometric space from an old one where the bundled uniform structure is provably (but typically non-definitionally) equal to some given uniform structure. See Note [forgetful inheritance]. See Note [reducible non-instances].

theorem PseudoMetricSpace.replaceUniformity_eq E0 #

∀ {α : Type u_3} [U : UniformSpace α] (m : PseudoMetricSpace α) (H : uniformity α = uniformity α),
  m.replaceUniformity H = m

abbrev PseudoMetricSpace.replaceTopology E3 #

{γ : Type u_3} →
  [U : TopologicalSpace γ] →
    (m : PseudoMetricSpace γ) → U = PseudoMetricSpace.toUniformSpace.toTopologicalSpace → PseudoMetricSpace γ

Build a new pseudometric space from an old one where the bundled topological structure is provably (but typically non-definitionally) equal to some given topological structure. See Note [forgetful inheritance]. See Note [reducible non-instances].

theorem PseudoMetricSpace.replaceTopology_eq E0 #

∀ {γ : Type u_3} [U : TopologicalSpace γ] (m : PseudoMetricSpace γ)
  (H : U = PseudoMetricSpace.toUniformSpace.toTopologicalSpace), m.replaceTopology H = m

abbrev PseudoEMetricSpace.toPseudoMetricSpaceOfDist E1 #

{X : Type u_3} →
  [e : PseudoEMetricSpace X] →
    (dist : X → X → ℝ) →
      (∀ (x y : X), 0 ≤ dist x y) → (∀ (x y : X), edist x y = ENNReal.ofReal (dist x y)) → PseudoMetricSpace X

One gets a pseudometric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the pseudometric space and the pseudoemetric space. In this definition, the distance is given separately, to be able to prescribe some expression which is not defeq to the push-forward of the edistance to reals. See note [reducible non-instances].

abbrev PseudoEMetricSpace.toPseudoMetricSpace E1 #

{α : Type u} → [inst : PseudoEMetricSpace α] → (∀ (x y : α), edist x y ≠ ⊤) → PseudoMetricSpace α

One gets a pseudometric space from an emetric space if the edistance is everywhere finite, by pushing the edistance to reals. We set it up so that the edist and the uniformity are defeq in the pseudometric space and the emetric space.

abbrev boundedComponent.pseudoMetricSpace E1 #

{X : Type u_3} → [inst : PseudoEMetricSpace X] → (a : X) → PseudoMetricSpace ↑(Metric.boundedComponent a)

The bounded component of an element forms a pseudometric space.

abbrev PseudoMetricSpace.replaceBornology E3 #

{α : Type u_3} →
  [B : Bornology α] →
    (m : PseudoMetricSpace α) → (∀ (s : Set α), Bornology.IsBounded s ↔ Bornology.IsBounded s) → PseudoMetricSpace α

Build a new pseudometric space from an old one where the bundled bornology structure is provably (but typically non-definitionally) equal to some given bornology structure. See Note [forgetful inheritance]. See Note [reducible non-instances].

theorem PseudoMetricSpace.replaceBornology_eq E0 #

∀ {α : Type u_3} [m : PseudoMetricSpace α] [B : Bornology α]
  (H : ∀ (s : Set α), Bornology.IsBounded s ↔ Bornology.IsBounded s), m.replaceBornology H = m

instance Real.pseudoMetricSpace E3 #

PseudoMetricSpace ℝ

Instantiate the reals as a pseudometric space.

theorem Real.dist_eq E0 #

∀ (x y : ℝ), dist x y = |x - y|

theorem Real.nnDist_eq E0 #

∀ (x y : ℝ), nnDist x y = Real.nnabs (x - y)

theorem Real.nnDist_eq' E1 #

∀ (x y : ℝ), nnDist x y = Real.nnabs (y - x)

theorem Real.dist_0_eq_abs E1 #

∀ (x : ℝ), dist x 0 = |x|

theorem Real.sub_le_dist E1 #

∀ (x y : ℝ), x - y ≤ dist x y

theorem Real.ball_eq_Ioo E1 #

∀ (x r : ℝ), Metric.ball x r = Set.Ioo (x - r) (x + r)

theorem Real.ball_zero_eq_Ioo E1 #

∀ (r : ℝ), Metric.ball 0 r = Set.Ioo (-r) r

theorem Real.closedBall_eq_Icc E1 #

∀ {x r : ℝ}, Metric.closedBall x r = Set.Icc (x - r) (x + r)

theorem Real.closedBall_zero_eq_Icc E1 #

∀ (r : ℝ), Metric.closedBall 0 r = Set.Icc (-r) r

theorem Real.Ioo_eq_ball E1 #

∀ (x y : ℝ), Set.Ioo x y = Metric.ball ((x + y) / 2) ((y - x) / 2)

theorem Real.Icc_eq_closedBall E1 #

∀ (x y : ℝ), Set.Icc x y = Metric.closedBall ((x + y) / 2) ((y - x) / 2)

theorem Real.sphere_eq_pair E1 #

∀ (x : ℝ) {r : ℝ}, 0 ≤ r → Metric.sphere x r = {x - r, x + r}

theorem Metric.uniformity_eq_comap_nhds_zero E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α], uniformity α = Filter.comap (fun p ↦ dist p.1 p.2) (nhds 0)

theorem tendsto_uniformity_iff_dist_tendsto_zero E1 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f : ι → α × α} {p : Filter ι},
  Filter.Tendsto f p (uniformity α) ↔ Filter.Tendsto (fun x ↦ dist (f x).1 (f x).2) p (nhds 0)

theorem Filter.Tendsto.congr_dist E1 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f₁ f₂ : ι → α} {p : Filter ι} {a : α},
  Filter.Tendsto f₁ p (nhds a) → Filter.Tendsto (fun x ↦ dist (f₁ x) (f₂ x)) p (nhds 0) → Filter.Tendsto f₂ p (nhds a)

theorem tendsto_of_tendsto_of_dist E1 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f₁ f₂ : ι → α} {p : Filter ι} {a : α},
  Filter.Tendsto f₁ p (nhds a) → Filter.Tendsto (fun x ↦ dist (f₁ x) (f₂ x)) p (nhds 0) → Filter.Tendsto f₂ p (nhds a)

Alias of Filter.Tendsto.congr_dist.

theorem tendsto_iff_of_dist E1 #

∀ {α : Type u} {ι : Type u_2} [inst : PseudoMetricSpace α] {f₁ f₂ : ι → α} {p : Filter ι} {a : α},
  Filter.Tendsto (fun x ↦ dist (f₁ x) (f₂ x)) p (nhds 0) → (Filter.Tendsto f₁ p (nhds a) ↔ Filter.Tendsto f₂ p (nhds a))

theorem PseudoMetricSpace.dist_eq_of_dist_zero E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x : α) {y z : α}, dist y z = 0 → dist x y = dist x z

theorem dist_dist_dist_le_left E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), dist (dist x z) (dist y z) ≤ dist x y

theorem dist_dist_dist_le_right E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y z : α), dist (dist x y) (dist x z) ≤ dist y z

theorem dist_dist_dist_le E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (x y x' y' : α), dist (dist x y) (dist x' y') ≤ dist x x' + dist y y'

theorem nhds_comap_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (a : α), Filter.comap (fun x ↦ dist x a) (nhds 0) = nhds a

theorem tendsto_iff_dist_tendsto_zero E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {f : β → α} {x : Filter β} {a : α},
  Filter.Tendsto f x (nhds a) ↔ Filter.Tendsto (fun b ↦ dist (f b) a) x (nhds 0)

theorem Metric.mk_uniformity_basis_of_tendsto E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {β : Type u_3} {p : β → Prop} {f : β → ℝ} {l : Filter β} [l.NeBot],
  (∀ (i : β), p i → 0 < f i) →
    (∀ᶠ (i : β) in l, p i) → Filter.Tendsto f l (nhds 0) → (uniformity α).HasBasis p fun i ↦ {x | dist x.1 x.2 < f i}

If f is a positive radius tending to zero, then the sets of pairs with distance less than f i form a basis of the uniformity.

theorem Metric.ball_subset_interior_closedBall E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x : α} {ε : ℝ}, Metric.ball x ε ⊆ interior (Metric.closedBall x ε)

theorem Metric.mem_closure_iff E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {a : α}, a ∈ closure s ↔ ∀ ε > 0, ∃ b ∈ s, dist a b < ε

ε-characterization of the closure in pseudometric spaces

theorem Metric.mem_closure_range_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {e : β → α} {a : α},
  a ∈ closure (Set.range e) ↔ ∀ ε > 0, ∃ k, dist a (e k) < ε

theorem Metric.mem_closure_range_iff_nat E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {e : β → α} {a : α},
  a ∈ closure (Set.range e) ↔ ∀ (n : ℕ), ∃ k, dist a (e k) < 1 / (↑n + 1)

theorem Metric.mem_of_closed' E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, IsClosed s → ∀ {a : α}, a ∈ s ↔ ∀ ε > 0, ∃ b ∈ s, dist a b < ε

theorem Metric.dense_iff E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Dense s ↔ ∀ (x : α), ∀ r > 0, (Metric.ball x r ∩ s).Nonempty

theorem Metric.dense_iff_iUnion_ball E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), Dense s ↔ ∀ r > 0, ⋃ c ∈ s, Metric.ball c r = Set.univ

theorem Metric.denseRange_iff E0 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] {f : β → α},
  DenseRange f ↔ ∀ (x : α), ∀ r > 0, ∃ y, dist x (f y) < r

instance instPseudoMetricSpaceAdditive E0 #

{α : Type u} → [PseudoMetricSpace α] → PseudoMetricSpace (Additive α)

instance instPseudoMetricSpaceMultiplicative E0 #

{α : Type u} → [PseudoMetricSpace α] → PseudoMetricSpace (Multiplicative α)

theorem nnDist_ofMul E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : X), nnDist (Additive.ofMul a) (Additive.ofMul b) = nnDist a b

theorem nnDist_ofAdd E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : X),
  nnDist (Multiplicative.ofAdd a) (Multiplicative.ofAdd b) = nnDist a b

theorem nnDist_toMul E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : Additive X),
  nnDist (Additive.toMul a) (Additive.toMul b) = nnDist a b

theorem nnDist_toAdd E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : Multiplicative X),
  nnDist (Multiplicative.toAdd a) (Multiplicative.toAdd b) = nnDist a b

instance instPseudoMetricSpaceOrderDual E0 #

{α : Type u} → [PseudoMetricSpace α] → PseudoMetricSpace αᵒᵈ

theorem nnDist_toDual E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : X), nnDist (OrderDual.toDual a) (OrderDual.toDual b) = nnDist a b

theorem nnDist_ofDual E0 #

∀ {X : Type u_1} [inst : PseudoMetricSpace X] (a b : Xᵒᵈ), nnDist (OrderDual.ofDual a) (OrderDual.ofDual b) = nnDist a b

Deprecated aliases

NameNew nameSince
Metric.boundedSpace_iff_nndistMetric.boundedSpace_iff_nnDist2026-11-07
Metric.closedBall_diff_ballMetric.closedBall_sdiff_ball2026-06-03
Metric.closedBall_diff_sphereMetric.closedBall_sdiff_sphere2026-06-03
Metric.isBounded_iff_nndistMetric.isBounded_iff_nnDist2026-11-07
NNDist.nndistNNDist.nnDist2026-11-07
Real.nndist_eqReal.nnDist_eq2026-11-07
Real.nndist_eq'Real.nnDist_eq'2026-11-07
coe_nndistcoe_nnDist2026-11-07
coe_nnreal_ennreal_nndistcoe_nnreal_ennreal_nnDist2026-11-07
dist_nndistdist_nnDist2026-11-07
edist_nndisteDist_nnDist2026-11-07
nndist_commnnDist_comm2026-11-07
nndist_distnnDist_dist2026-11-07
nndist_edistnnDist_edist2026-11-07
nndist_ofAddnnDist_ofAdd2026-11-07
nndist_ofDualnnDist_ofDual2026-11-07
nndist_ofMulnnDist_ofMul2026-11-07
nndist_selfnnDist_self2026-11-07
nndist_toAddnnDist_toAdd2026-11-07
nndist_toDualnnDist_toDual2026-11-07
nndist_toMulnnDist_toMul2026-11-07
nndist_trianglennDist_triangle2026-11-07
nndist_triangle_leftnnDist_triangle_left2026-11-07
nndist_triangle_rightnnDist_triangle_right2026-11-07