Documentation

Mathlib.Topology.EMetricSpace.Defs

Extended metric spaces #

This file is devoted to the definition and study of EMetricSpaces, i.e., metric spaces in which the distance is allowed to take the value ∞. This extended distance is called edist, and takes values in ℝ≥0∞.

Many definitions and theorems expected on emetric spaces are already introduced on uniform spaces and topological spaces. For example: open and closed sets, compactness, completeness, continuity and uniform continuity.

The class EMetricSpace therefore extends UniformSpace (and TopologicalSpace).

Since a lot of elementary properties don't require eq_of_edist_eq_zero we start setting up the theory of PseudoEMetricSpace, where we don't require edist x y = 0 → x = y and we specialize to EMetricSpace at the end.

theorem uniformity_dist_of_mem_uniformity {α : Type u} {β : Type v} [LT β] {U : Filter (α × α)} (z : β) (D : ααβ) (H : ∀ (s : Set (α × α)), s U ε > z, ∀ {a b : α}, D a b < ε(a, b) s) :
U = ⨅ (ε : β), ⨅ (_ : ε > z), Filter.principal {p : α × α | D p.1 p.2 < ε}

Characterizing uniformities associated to a (generalized) distance function D in terms of the elements of the uniformity.

class EDist (α : Type u_2) :
Type u_2

EDist α means that α is equipped with an extended distance.

  • edist : ααENNReal

    Extended distance between two points

Instances
    theorem EDist.ext_iff {α : Type u_2} {x y : EDist α} :
    theorem EDist.ext {α : Type u_2} {x y : EDist α} (edist : edist = edist) :
    x = y
    def Metric.eball {α : Type u} [EDist α] (x : α) (ε : ENNReal) :
    Set α

    EMetric.ball x ε is the set of all points y with edist y x < ε

    Equations
    Instances For
      @[simp]
      theorem Metric.mem_eball {α : Type u} [EDist α] {x y : α} {ε : ENNReal} :
      y eball x ε edist y x < ε
      @[reducible]
      noncomputable def uniformSpaceOfEDist {α : Type u} (edist : ααENNReal) (edist_self : ∀ (x : α), edist x x = 0) (edist_comm : ∀ (x y : α), edist x y = edist y x) (edist_triangle : ∀ (x y z : α), edist x z edist x y + edist y z) :

      Creating a uniform space from an extended distance.

      Equations
      Instances For
        @[reducible]
        noncomputable def uniformSpaceOfEDistOfHasBasis {α : Type u} [TopologicalSpace α] (edist : ααENNReal) (edist_self : ∀ (x : α), edist x x = 0) (edist_comm : ∀ (x y : α), edist x y = edist y x) (edist_triangle : ∀ (x y z : α), edist x z edist x y + edist y z) (basis : ∀ (x : α), (nhds x).HasBasis (fun (c : ENNReal) => 0 < c) fun (c : ENNReal) => {y : α | edist x y < c}) :

        Creating a uniform space from an extended distance. We assume that there is a preexisting topology, for which the neighborhoods can be expressed using the distance, and we make sure that the uniform space structure we construct has a topology which is defeq to the original one.

        Equations
        Instances For
          class PseudoEMetricSpace (α : Type u) extends EDist α :

          A pseudo extended metric space is a type endowed with a ℝ≥0∞-valued distance edist satisfying reflexivity edist x x = 0, commutativity edist x y = edist y x, and the triangle inequality edist x z ≤ edist x y + edist y z.

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

          Any pseudo extended metric 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 pseudo extended metric space is just an extended 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 [PseudoEMetricSpace α] [PseudoEMetricSpace β] : TopologicalSpace (α × β): The product metric and product topology agree, but not definitionally so. See Note [forgetful inheritance].

          Instances
            theorem PseudoEMetricSpace.ext {α : Type u_2} {m m' : PseudoEMetricSpace α} (h : m.toEDist = m'.toEDist) :
            m = m'

            Two pseudo emetric space structures with the same edistance function coincide.

            theorem PseudoEMetricSpace.ext_iff {α : Type u_2} {m m' : PseudoEMetricSpace α} :
            m = m' m.toEDist = m'.toEDist
            theorem edist_triangle_left {α : Type u} [PseudoEMetricSpace α] (x y z : α) :
            edist x y edist z x + edist z y

            Triangle inequality for the extended distance

            theorem edist_triangle_right {α : Type u} [PseudoEMetricSpace α] (x y z : α) :
            edist x y edist x z + edist y z
            theorem edist_congr_right {α : Type u} [PseudoEMetricSpace α] {x y z : α} (h : edist x y = 0) :
            edist x z = edist y z
            theorem edist_congr_left {α : Type u} [PseudoEMetricSpace α] {x y z : α} (h : edist x y = 0) :
            edist z x = edist z y
            theorem edist_congr {α : Type u} [PseudoEMetricSpace α] {w x y z : α} (hl : edist w x = 0) (hr : edist y z = 0) :
            edist w y = edist x z
            theorem edist_triangle4 {α : Type u} [PseudoEMetricSpace α] (x y z t : α) :
            edist x t edist x y + edist y z + edist z t
            theorem uniformity_pseudoedist {α : Type u} [PseudoEMetricSpace α] :
            uniformity α = ⨅ (ε : ENNReal), ⨅ (_ : ε > 0), Filter.principal {p : α × α | edist p.1 p.2 < ε}

            Reformulation of the uniform structure in terms of the extended distance

            theorem uniformity_basis_edist {α : Type u} [PseudoEMetricSpace α] :
            (uniformity α).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => {p : α × α | edist p.1 p.2 < ε}
            theorem mem_uniformity_edist {α : Type u} [PseudoEMetricSpace α] {s : Set (α × α)} :
            s uniformity α ε > 0, ∀ {a b : α}, edist a b < ε(a, b) s

            Characterization of the elements of the uniformity in terms of the extended distance

            @[reducible, inline]
            noncomputable abbrev PseudoEMetricSpace.ofEDist {α : Type u} (edist : ααENNReal) (edist_self : ∀ (x : α), edist x x = 0) (edist_comm : ∀ (x y : α), edist x y = edist y x) (edist_triangle : ∀ (x y z : α), edist x z edist x y + edist y z) :

            Make a PseudoEMetricSpace from a metric. Warning: the uniformity and topology included herein are the ones generated by the metric. If the type has a pre-existing topology or uniformity, PseudoEMetricSpace.ofEDistOfTopology should be used instead.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem EMetric.toUniformSpace_ofEDist {α : Type u} [EDist α] (edist_self : ∀ (x : α), edist x x = 0) (edist_comm : ∀ (x y : α), edist x y = edist y x) (edist_triangle : ∀ (x y z : α), edist x z edist x y + edist y z) :
              PseudoEMetricSpace.toUniformSpace = uniformSpaceOfEDist edist edist_self edist_comm edist_triangle
              theorem EMetric.mk_uniformity_basis {α : Type u} [PseudoEMetricSpace α] {β : Type u_2} {p : βProp} {f : βENNReal} (hf₀ : ∀ (x : β), p x0 < f x) (hf : ∀ (ε : ENNReal), 0 < ε∃ (x : β), p x f x ε) :
              (uniformity α).HasBasis p fun (x : β) => {p : α × α | edist p.1 p.2 < f x}

              Given f : β → ℝ≥0∞, 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_edist, uniformity_basis_edist', uniformity_basis_edist_nnreal, and uniformity_basis_edist_inv_nat.

              theorem EMetric.mk_uniformity_basis_le {α : Type u} [PseudoEMetricSpace α] {β : Type u_2} {p : βProp} {f : βENNReal} (hf₀ : ∀ (x : β), p x0 < f x) (hf : ∀ (ε : ENNReal), 0 < ε∃ (x : β), p x f x ε) :
              (uniformity α).HasBasis p fun (x : β) => {p : α × α | edist p.1 p.2 f x}

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

              For specific bases see uniformity_basis_edist_le and uniformity_basis_edist_le'.

              theorem uniformity_basis_edist_le {α : Type u} [PseudoEMetricSpace α] :
              (uniformity α).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => {p : α × α | edist p.1 p.2 ε}
              theorem uniformity_basis_edist' {α : Type u} [PseudoEMetricSpace α] (ε' : ENNReal) (hε' : 0 < ε') :
              (uniformity α).HasBasis (fun (ε : ENNReal) => ε Set.Ioo 0 ε') fun (ε : ENNReal) => {p : α × α | edist p.1 p.2 < ε}
              theorem uniformity_basis_edist_le' {α : Type u} [PseudoEMetricSpace α] (ε' : ENNReal) (hε' : 0 < ε') :
              (uniformity α).HasBasis (fun (ε : ENNReal) => ε Set.Ioo 0 ε') fun (ε : ENNReal) => {p : α × α | edist p.1 p.2 ε}
              theorem uniformity_basis_edist_nnreal {α : Type u} [PseudoEMetricSpace α] :
              (uniformity α).HasBasis (fun (ε : NNReal) => 0 < ε) fun (ε : NNReal) => {p : α × α | edist p.1 p.2 < ε}
              theorem uniformity_basis_edist_nnreal_le {α : Type u} [PseudoEMetricSpace α] :
              (uniformity α).HasBasis (fun (ε : NNReal) => 0 < ε) fun (ε : NNReal) => {p : α × α | edist p.1 p.2 ε}
              theorem uniformity_basis_edist_inv_nat {α : Type u} [PseudoEMetricSpace α] :
              (uniformity α).HasBasis (fun (x : ) => True) fun (n : ) => {p : α × α | edist p.1 p.2 < (↑n)⁻¹}
              theorem uniformity_basis_edist_inv_two_pow {α : Type u} [PseudoEMetricSpace α] :
              (uniformity α).HasBasis (fun (x : ) => True) fun (n : ) => {p : α × α | edist p.1 p.2 < 2⁻¹ ^ n}
              theorem edist_mem_uniformity {α : Type u} [PseudoEMetricSpace α] {ε : ENNReal} (ε0 : 0 < ε) :
              {p : α × α | edist p.1 p.2 < ε} uniformity α

              Fixed size neighborhoods of the diagonal belong to the uniform structure

              theorem EMetric.uniformContinuousOn_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} {s : Set α} :
              UniformContinuousOn f s ε > 0, δ > 0, ∀ {a : α}, a s∀ {b : α}, b sedist a b < δedist (f a) (f b) < ε

              ε-δ characterization of uniform continuity on a set for pseudoemetric spaces

              theorem EMetric.uniformContinuous_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} :
              UniformContinuous f ε > 0, δ > 0, ∀ {a b : α}, edist a b < δedist (f a) (f b) < ε

              ε-δ characterization of uniform continuity on pseudoemetric spaces

              @[reducible, inline]

              Auxiliary function to replace the uniformity on a pseudoemetric space with a uniformity which is equal to the original one, but maybe not defeq. This is useful if one wants to construct a pseudoemetric space with a specified uniformity. See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important. See note [reducible non-instances].

              Equations
              • m.replaceUniformity H = { toEDist := m.toEDist, edist_self := , edist_comm := , edist_triangle := , toUniformSpace := U, uniformity_edist := }
              Instances For
                @[reducible, inline]
                abbrev PseudoEMetricSpace.induced {α : Type u_2} {β : Type u_3} (f : αβ) (m : PseudoEMetricSpace β) :

                The extended pseudometric induced by a function taking values in a pseudoemetric space. See note [reducible non-instances].

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  @[implicit_reducible]

                  Pseudoemetric space instance on subsets of pseudoemetric spaces

                  Equations
                  theorem Subtype.edist_eq {α : Type u} [PseudoEMetricSpace α] {p : αProp} (x y : Subtype p) :
                  edist x y = edist x y

                  The extended pseudodistance on a subset of a pseudoemetric space is the restriction of the original pseudodistance, by definition.

                  @[simp]
                  theorem Subtype.edist_mk_mk {α : Type u} [PseudoEMetricSpace α] {p : αProp} {x y : α} (hx : p x) (hy : p y) :
                  edist x, hx y, hy = edist x y

                  The extended pseudodistance on a subtype of a pseudoemetric space is the restriction of the original pseudodistance, by definition.

                  @[reducible]
                  noncomputable def PseudoEMetricSpace.ofEDistOfTopology {α : Type u_2} [TopologicalSpace α] (d : ααENNReal) (h_self : ∀ (x : α), d x x = 0) (h_comm : ∀ (x y : α), d x y = d y x) (h_triangle : ∀ (x y z : α), d x z d x y + d y z) (h_basis : ∀ (x : α), (nhds x).HasBasis (fun (c : ENNReal) => 0 < c) fun (c : ENNReal) => {y : α | d x y < c}) :

                  Consider an extended distance on a topological space, for which the neighborhoods can be expressed in terms of the distance. Then we define the emetric space structure associated to this distance, with a topology defeq to the initial one.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    @[deprecated PseudoEMetricSpace.ofEDistOfTopology (since := "2026-01-08")]
                    def PseudoEmetricSpace.ofEdistOfTopology {α : Type u_2} [TopologicalSpace α] (d : ααENNReal) (h_self : ∀ (x : α), d x x = 0) (h_comm : ∀ (x y : α), d x y = d y x) (h_triangle : ∀ (x y z : α), d x z d x y + d y z) (h_basis : ∀ (x : α), (nhds x).HasBasis (fun (c : ENNReal) => 0 < c) fun (c : ENNReal) => {y : α | d x y < c}) :

                    Alias of PseudoEMetricSpace.ofEDistOfTopology.


                    Consider an extended distance on a topological space, for which the neighborhoods can be expressed in terms of the distance. Then we define the emetric space structure associated to this distance, with a topology defeq to the initial one.

                    Equations
                    Instances For
                      @[implicit_reducible]

                      Pseudoemetric space instance on the multiplicative opposite of a pseudoemetric space.

                      Equations
                      @[implicit_reducible]

                      Pseudoemetric space instance on the additive opposite of a pseudoemetric space.

                      Equations
                      theorem MulOpposite.edist_unop {α : Type u} [PseudoEMetricSpace α] (x y : αᵐᵒᵖ) :
                      edist (unop x) (unop y) = edist x y
                      theorem AddOpposite.edist_unop {α : Type u} [PseudoEMetricSpace α] (x y : αᵃᵒᵖ) :
                      edist (unop x) (unop y) = edist x y
                      theorem MulOpposite.edist_op {α : Type u} [PseudoEMetricSpace α] (x y : α) :
                      edist (op x) (op y) = edist x y
                      theorem AddOpposite.edist_op {α : Type u} [PseudoEMetricSpace α] (x y : α) :
                      edist (op x) (op y) = edist x y
                      theorem ULift.edist_eq {α : Type u} [PseudoEMetricSpace α] (x y : ULift.{u_2, u} α) :
                      @[simp]
                      theorem ULift.edist_up_up {α : Type u} [PseudoEMetricSpace α] (x y : α) :
                      edist { down := x } { down := y } = edist x y
                      @[implicit_reducible]

                      The product of two pseudoemetric spaces, with the max distance, is an extended pseudometric spaces. We make sure that the uniform structure thus constructed is the one corresponding to the product of uniform spaces, to avoid diamond problems.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      theorem Prod.edist_eq {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x y : α × β) :
                      edist x y = max (edist x.1 y.1) (edist x.2 y.2)
                      theorem Metric.mem_eball' {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                      y eball x ε edist x y < ε
                      def Metric.closedEBall {α : Type u} [PseudoEMetricSpace α] (x : α) (ε : ENNReal) :
                      Set α

                      Metric.closedEBall x ε is the set of all points y with edist y x ≤ ε

                      Equations
                      Instances For
                        @[simp]
                        theorem Metric.mem_closedEBall {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                        y closedEBall x ε edist y x ε
                        theorem Metric.mem_closedEBall' {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                        y closedEBall x ε edist x y ε
                        theorem Metric.pos_of_mem_eball {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} (hy : y eball x ε) :
                        0 < ε
                        theorem Metric.mem_eball_self {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} (h : 0 < ε) :
                        x eball x ε
                        theorem Metric.mem_closedEBall_self {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} :
                        theorem Metric.mem_eball_comm {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                        x eball y ε y eball x ε
                        theorem Metric.mem_closedEBall_comm {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                        theorem Metric.eball_subset_eball {α : Type u} [PseudoEMetricSpace α] {x : α} {ε₁ ε₂ : ENNReal} (h : ε₁ ε₂) :
                        eball x ε₁ eball x ε₂
                        theorem Metric.closedEBall_subset_closedEBall {α : Type u} [PseudoEMetricSpace α] {x : α} {ε₁ ε₂ : ENNReal} (h : ε₁ ε₂) :
                        closedEBall x ε₁ closedEBall x ε₂
                        theorem Metric.eball_disjoint {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε₁ ε₂ : ENNReal} (h : ε₁ + ε₂ edist x y) :
                        Disjoint (eball x ε₁) (eball y ε₂)
                        theorem Metric.eball_subset {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε₁ ε₂ : ENNReal} (h : edist x y + ε₁ ε₂) (h' : edist x y ) :
                        eball x ε₁ eball y ε₂
                        theorem Metric.exists_eball_subset_eball {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} (h : y eball x ε) :
                        ε' > 0, eball y ε' eball x ε
                        theorem Metric.eball_eq_empty_iff {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} :
                        eball x ε = ε = 0
                        @[implicit_reducible]

                        Relation “two points are at a finite edistance” is an equivalence relation.

                        Equations
                        Instances For
                          @[simp]
                          theorem Metric.eball_zero {α : Type u} [PseudoEMetricSpace α] {x : α} :
                          eball x 0 =
                          theorem Metric.nhds_basis_eball {α : Type u} [PseudoEMetricSpace α] {x : α} :
                          (nhds x).HasBasis (fun (ε : ENNReal) => 0 < ε) (eball x)
                          theorem Metric.nhdsWithin_basis_eball {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                          (nhdsWithin x s).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => eball x ε s
                          theorem Metric.nhds_basis_closedEBall {α : Type u} [PseudoEMetricSpace α] {x : α} :
                          (nhds x).HasBasis (fun (ε : ENNReal) => 0 < ε) (closedEBall x)
                          theorem Metric.nhdsWithin_basis_closedEBall {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                          (nhdsWithin x s).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => closedEBall x ε s
                          theorem EMetric.nhds_eq {α : Type u} [PseudoEMetricSpace α] {x : α} :
                          nhds x = ⨅ (ε : ENNReal), ⨅ (_ : ε > 0), Filter.principal (Metric.eball x ε)
                          theorem EMetric.mem_nhds_iff {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                          s nhds x ε > 0, Metric.eball x ε s
                          theorem EMetric.mem_nhdsWithin_iff {α : Type u} [PseudoEMetricSpace α] {x : α} {s t : Set α} :
                          s nhdsWithin x t ε > 0, Metric.eball x ε t s
                          theorem EMetric.isOpen_iff {α : Type u} [PseudoEMetricSpace α] {s : Set α} :
                          IsOpen s xs, ε > 0, Metric.eball x ε s
                          theorem EMetric.mem_closure_iff {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                          x closure s ε > 0, ys, edist x y < ε

                          ε-characterization of the closure in pseudoemetric spaces

                          theorem EMetric.dense_iff {α : Type u} [PseudoEMetricSpace α] {s : Set α} :
                          Dense s ∀ (x : α), r > 0, (Metric.eball x r s).Nonempty
                          theorem EMetric.tendsto_nhds {α : Type u} {β : Type v} [PseudoEMetricSpace α] {f : Filter β} {u : βα} {a : α} :
                          Filter.Tendsto u f (nhds a) ε > 0, ∀ᶠ (x : β) in f, edist (u x) a < ε
                          theorem EMetric.tendsto_atTop {α : Type u} {β : Type v} [PseudoEMetricSpace α] [Nonempty β] [SemilatticeSup β] {u : βα} {a : α} :
                          Filter.Tendsto u Filter.atTop (nhds a) ε > 0, ∃ (N : β), nN, edist (u n) a < ε
                          theorem EMetric.tendsto_nhdsWithin_nhdsWithin {α : Type u} {β : Type v} [PseudoEMetricSpace α] {s : Set α} [PseudoEMetricSpace β] {f : αβ} {t : Set β} {a : α} {b : β} :
                          Filter.Tendsto f (nhdsWithin a s) (nhdsWithin b t) ε > 0, δ > 0, ∀ ⦃x : α⦄, x sedist x a < δf x t edist (f x) b < ε
                          theorem EMetric.tendsto_nhdsWithin_nhds {α : Type u} {β : Type v} [PseudoEMetricSpace α] {s : Set α} [PseudoEMetricSpace β] {f : αβ} {a : α} {b : β} :
                          Filter.Tendsto f (nhdsWithin a s) (nhds b) ε > 0, δ > 0, ∀ {x : α}, x sedist x a < δedist (f x) b < ε
                          theorem EMetric.tendsto_nhds_nhds {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} {a : α} {b : β} :
                          Filter.Tendsto f (nhds a) (nhds b) ε > 0, δ > 0, ∀ ⦃x : α⦄, edist x a < δedist (f x) b < ε
                          theorem EMetric.continuousAt_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} {a : α} :
                          ContinuousAt f a ε > 0, δ > 0, ∀ ⦃x : α⦄, edist x a < δedist (f x) (f a) < ε
                          theorem EMetric.continuousWithinAt_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} {a : α} {s : Set α} :
                          ContinuousWithinAt f s a ε > 0, δ > 0, ∀ ⦃x : α⦄, x sedist x a < δedist (f x) (f a) < ε
                          theorem EMetric.continuousOn_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} {s : Set α} :
                          ContinuousOn f s bs, ε > 0, δ > 0, as, edist a b < δedist (f a) (f b) < ε
                          theorem EMetric.continuous_iff {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] {f : αβ} :
                          Continuous f ∀ (b : α), ε > 0, δ > 0, ∀ (a : α), edist a b < δedist (f a) (f b) < ε
                          theorem EMetric.continuousAt_iff' {α : Type u} {β : Type v} [PseudoEMetricSpace α] [TopologicalSpace β] {f : βα} {b : β} :
                          ContinuousAt f b ε > 0, ∀ᶠ (x : β) in nhds b, edist (f x) (f b) < ε
                          theorem EMetric.continuousWithinAt_iff' {α : Type u} {β : Type v} [PseudoEMetricSpace α] [TopologicalSpace β] {f : βα} {b : β} {s : Set β} :
                          ContinuousWithinAt f s b ε > 0, ∀ᶠ (x : β) in nhdsWithin b s, edist (f x) (f b) < ε
                          theorem EMetric.continuousOn_iff' {α : Type u} {β : Type v} [PseudoEMetricSpace α] [TopologicalSpace β] {f : βα} {s : Set β} :
                          ContinuousOn f s bs, ε > 0, ∀ᶠ (x : β) in nhdsWithin b s, edist (f x) (f b) < ε
                          theorem EMetric.continuous_iff' {α : Type u} {β : Type v} [PseudoEMetricSpace α] [TopologicalSpace β] {f : βα} :
                          Continuous f ∀ (a : β), ε > 0, ∀ᶠ (x : β) in nhds a, edist (f x) (f a) < ε
                          @[simp]
                          theorem Metric.isOpen_eball {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} :
                          IsOpen (eball x ε)
                          theorem Metric.eball_mem_nhds {α : Type u} [PseudoEMetricSpace α] (x : α) {ε : ENNReal} (ε0 : 0 < ε) :
                          eball x ε nhds x
                          theorem Metric.closedEBall_mem_nhds {α : Type u} [PseudoEMetricSpace α] (x : α) {ε : ENNReal} (ε0 : 0 < ε) :
                          theorem Metric.eball_prod_same {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x : α) (y : β) (r : ENNReal) :
                          eball x r ×ˢ eball y r = eball (x, y) r
                          theorem Metric.closedEBall_prod_same {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x : α) (y : β) (r : ENNReal) :
                          @[deprecated Metric.eball (since := "2026-01-24")]
                          def EMetric.ball {α : Type u} [EDist α] (x : α) (ε : ENNReal) :
                          Set α

                          Alias of Metric.eball.


                          EMetric.ball x ε is the set of all points y with edist y x < ε

                          Equations
                          Instances For
                            @[deprecated Metric.mem_eball (since := "2026-01-24")]
                            theorem EMetric.mem_ball {α : Type u} [EDist α] {x y : α} {ε : ENNReal} :
                            y Metric.eball x ε edist y x < ε

                            Alias of Metric.mem_eball.

                            @[deprecated Metric.mem_eball' (since := "2026-01-24")]
                            theorem EMetric.mem_ball' {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :
                            y Metric.eball x ε edist x y < ε

                            Alias of Metric.mem_eball'.

                            @[deprecated Metric.closedEBall (since := "2026-01-24")]
                            def EMetric.closedBall {α : Type u} [PseudoEMetricSpace α] (x : α) (ε : ENNReal) :
                            Set α

                            Alias of Metric.closedEBall.


                            Metric.closedEBall x ε is the set of all points y with edist y x ≤ ε

                            Equations
                            Instances For
                              @[deprecated Metric.mem_closedEBall (since := "2026-01-24")]
                              theorem EMetric.mem_closedBall {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :

                              Alias of Metric.mem_closedEBall.

                              @[deprecated Metric.mem_closedEBall' (since := "2026-01-24")]
                              theorem EMetric.mem_closedBall' {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :

                              Alias of Metric.mem_closedEBall'.

                              @[deprecated Metric.closedEBall_top (since := "2026-01-24")]

                              Alias of Metric.closedEBall_top.

                              @[deprecated Metric.eball_subset_closedEBall (since := "2026-01-24")]

                              Alias of Metric.eball_subset_closedEBall.

                              @[deprecated Metric.pos_of_mem_eball (since := "2026-01-24")]
                              theorem EMetric.pos_of_mem_ball {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} (hy : y Metric.eball x ε) :
                              0 < ε

                              Alias of Metric.pos_of_mem_eball.

                              @[deprecated Metric.mem_eball_self (since := "2026-01-24")]
                              theorem EMetric.mem_ball_self {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} (h : 0 < ε) :

                              Alias of Metric.mem_eball_self.

                              @[deprecated Metric.mem_closedEBall_self (since := "2026-01-24")]

                              Alias of Metric.mem_closedEBall_self.

                              @[deprecated Metric.mem_eball_comm (since := "2026-01-24")]
                              theorem EMetric.mem_ball_comm {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} :

                              Alias of Metric.mem_eball_comm.

                              @[deprecated Metric.mem_closedEBall_comm (since := "2026-01-24")]

                              Alias of Metric.mem_closedEBall_comm.

                              @[deprecated Metric.eball_subset_eball (since := "2026-01-24")]
                              theorem EMetric.ball_subset_ball {α : Type u} [PseudoEMetricSpace α] {x : α} {ε₁ ε₂ : ENNReal} (h : ε₁ ε₂) :
                              Metric.eball x ε₁ Metric.eball x ε₂

                              Alias of Metric.eball_subset_eball.

                              @[deprecated Metric.closedEBall_subset_closedEBall (since := "2026-01-24")]
                              theorem EMetric.closedBall_subset_closedBall {α : Type u} [PseudoEMetricSpace α] {x : α} {ε₁ ε₂ : ENNReal} (h : ε₁ ε₂) :

                              Alias of Metric.closedEBall_subset_closedEBall.

                              @[deprecated Metric.eball_disjoint (since := "2026-01-24")]
                              theorem EMetric.ball_disjoint {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε₁ ε₂ : ENNReal} (h : ε₁ + ε₂ edist x y) :
                              Disjoint (Metric.eball x ε₁) (Metric.eball y ε₂)

                              Alias of Metric.eball_disjoint.

                              @[deprecated Metric.eball_subset (since := "2026-01-24")]
                              theorem EMetric.ball_subset {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε₁ ε₂ : ENNReal} (h : edist x y + ε₁ ε₂) (h' : edist x y ) :
                              Metric.eball x ε₁ Metric.eball y ε₂

                              Alias of Metric.eball_subset.

                              @[deprecated Metric.exists_eball_subset_eball (since := "2026-01-24")]
                              theorem EMetric.exists_ball_subset_ball {α : Type u} [PseudoEMetricSpace α] {x y : α} {ε : ENNReal} (h : y Metric.eball x ε) :
                              ε' > 0, Metric.eball y ε' Metric.eball x ε

                              Alias of Metric.exists_eball_subset_eball.

                              @[deprecated Metric.eball_eq_empty_iff (since := "2026-01-24")]
                              theorem EMetric.ball_eq_empty_iff {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} :
                              Metric.eball x ε = ε = 0

                              Alias of Metric.eball_eq_empty_iff.

                              @[deprecated Metric.ordConnected_setOf_closedEBall_subset (since := "2026-01-24")]

                              Alias of Metric.ordConnected_setOf_closedEBall_subset.

                              @[deprecated Metric.ordConnected_setOf_eball_subset (since := "2026-01-24")]

                              Alias of Metric.ordConnected_setOf_eball_subset.

                              @[deprecated Metric.edistLtTopSetoid (since := "2026-01-24")]

                              Alias of Metric.edistLtTopSetoid.


                              Relation “two points are at a finite edistance” is an equivalence relation.

                              Equations
                              Instances For
                                @[deprecated Metric.eball_zero (since := "2026-01-24")]
                                theorem EMetric.ball_zero {α : Type u} [PseudoEMetricSpace α] {x : α} :

                                Alias of Metric.eball_zero.

                                @[deprecated Metric.nhds_basis_eball (since := "2026-01-24")]
                                theorem EMetric.nhds_basis_eball {α : Type u} [PseudoEMetricSpace α] {x : α} :
                                (nhds x).HasBasis (fun (ε : ENNReal) => 0 < ε) (Metric.eball x)

                                Alias of Metric.nhds_basis_eball.

                                @[deprecated Metric.nhdsWithin_basis_eball (since := "2026-01-24")]
                                theorem EMetric.nhdsWithin_basis_eball {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                                (nhdsWithin x s).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => Metric.eball x ε s

                                Alias of Metric.nhdsWithin_basis_eball.

                                @[deprecated Metric.nhds_basis_closedEBall (since := "2026-01-24")]
                                theorem EMetric.nhds_basis_closed_eball {α : Type u} [PseudoEMetricSpace α] {x : α} :
                                (nhds x).HasBasis (fun (ε : ENNReal) => 0 < ε) (Metric.closedEBall x)

                                Alias of Metric.nhds_basis_closedEBall.

                                @[deprecated Metric.nhdsWithin_basis_closedEBall (since := "2026-01-24")]
                                theorem EMetric.nhdsWithin_basis_closed_eball {α : Type u} [PseudoEMetricSpace α] {x : α} {s : Set α} :
                                (nhdsWithin x s).HasBasis (fun (ε : ENNReal) => 0 < ε) fun (ε : ENNReal) => Metric.closedEBall x ε s

                                Alias of Metric.nhdsWithin_basis_closedEBall.

                                @[deprecated Metric.isOpen_eball (since := "2026-01-24")]
                                theorem EMetric.isOpen_ball {α : Type u} [PseudoEMetricSpace α] {x : α} {ε : ENNReal} :

                                Alias of Metric.isOpen_eball.

                                @[deprecated Metric.isClosed_eball_top (since := "2026-01-24")]

                                Alias of Metric.isClosed_eball_top.

                                @[deprecated Metric.eball_mem_nhds (since := "2026-01-24")]
                                theorem EMetric.ball_mem_nhds {α : Type u} [PseudoEMetricSpace α] (x : α) {ε : ENNReal} (ε0 : 0 < ε) :

                                Alias of Metric.eball_mem_nhds.

                                @[deprecated Metric.closedEBall_mem_nhds (since := "2026-01-24")]
                                theorem EMetric.closedBall_mem_nhds {α : Type u} [PseudoEMetricSpace α] (x : α) {ε : ENNReal} (ε0 : 0 < ε) :

                                Alias of Metric.closedEBall_mem_nhds.

                                @[deprecated Metric.eball_prod_same (since := "2026-01-24")]
                                theorem EMetric.ball_prod_same {α : Type u} {β : Type v} [PseudoEMetricSpace α] [PseudoEMetricSpace β] (x : α) (y : β) (r : ENNReal) :

                                Alias of Metric.eball_prod_same.

                                @[deprecated Metric.closedEBall_prod_same (since := "2026-01-24")]

                                Alias of Metric.closedEBall_prod_same.

                                @[simp]
                                theorem Subtype.preimage_eball {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :
                                @[deprecated Subtype.preimage_eball (since := "2026-01-24")]
                                theorem Subtype.preimage_emetricBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :

                                Alias of Subtype.preimage_eball.

                                @[simp]
                                theorem Subtype.preimage_closedEBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :
                                @[deprecated Subtype.preimage_closedEBall (since := "2026-01-24")]
                                theorem Subtype.preimage_emetricClosedBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :

                                Alias of Subtype.preimage_closedEBall.

                                @[simp]
                                theorem Subtype.image_eball {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :
                                val '' Metric.eball a r = Metric.eball (↑a) r {a : α | p a}
                                @[deprecated Subtype.image_eball (since := "2026-01-24")]
                                theorem Subtype.image_emetricBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :
                                val '' Metric.eball a r = Metric.eball (↑a) r {a : α | p a}

                                Alias of Subtype.image_eball.

                                @[simp]
                                theorem Subtype.image_closedEBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :
                                @[deprecated Subtype.image_closedEBall (since := "2026-01-24")]
                                theorem Subtype.image_emetricClosedBall {α : Type u} [PseudoEMetricSpace α] {p : αProp} (a : { a : α // p a }) (r : ENNReal) :

                                Alias of Subtype.image_closedEBall.

                                class EMetricSpace (α : Type u) extends PseudoEMetricSpace α :

                                An extended metric space is a type endowed with a ℝ≥0∞-valued distance edist satisfying edist x y = 0 ↔ x = y, commutativity edist x y = edist y x, and the triangle inequality edist x z ≤ edist x y + edist y z.

                                See pseudo extended metric spaces (PseudoEMetricSpace) for the similar class with the edist x y = 0 ↔ x = y assumption weakened to edist x x = 0.

                                Any extended metric space is a T1 topological space and a uniform space (see TopologicalSpace, T1Space, UniformSpace), where the topology and uniformity come from the metric.

                                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 [EMetricSpace α] [EMetricSpace β] : TopologicalSpace (α × β): The product metric and product topology agree, but not definitionally so. See Note [forgetful inheritance].

                                Instances
                                  theorem EMetricSpace.ext {α : Type u_2} {m m' : EMetricSpace α} (h : m.toEDist = m'.toEDist) :
                                  m = m'
                                  theorem EMetricSpace.ext_iff {α : Type u_2} {m m' : EMetricSpace α} :
                                  m = m' m.toEDist = m'.toEDist
                                  @[simp]
                                  theorem edist_eq_zero {γ : Type w} [EMetricSpace γ] {x y : γ} :
                                  edist x y = 0 x = y

                                  Characterize the equality of points by the vanishing of their extended distance

                                  @[simp]
                                  theorem zero_eq_edist {γ : Type w} [EMetricSpace γ] {x y : γ} :
                                  0 = edist x y x = y
                                  theorem edist_le_zero {γ : Type w} [EMetricSpace γ] {x y : γ} :
                                  edist x y 0 x = y
                                  @[simp]
                                  theorem edist_pos {γ : Type w} [EMetricSpace γ] {x y : γ} :
                                  0 < edist x y x y
                                  @[simp]
                                  theorem Metric.closedEBall_zero {γ : Type w} [EMetricSpace γ] (x : γ) :
                                  @[deprecated Metric.closedEBall_zero (since := "2026-01-24")]
                                  theorem EMetric.closedBall_zero {γ : Type w} [EMetricSpace γ] (x : γ) :

                                  Alias of Metric.closedEBall_zero.

                                  theorem eq_of_forall_edist_le {γ : Type w} [EMetricSpace γ] {x y : γ} (h : ε > 0, edist x y ε) :
                                  x = y

                                  Two points coincide if their distance is < ε for all positive ε

                                  @[reducible, inline]

                                  Auxiliary function to replace the uniformity on an emetric space with a uniformity which is equal to the original one, but maybe not defeq. This is useful if one wants to construct an emetric space with a specified uniformity. See Note [forgetful inheritance] explaining why having definitionally the right uniformity is often important. See note [reducible non-instances].

                                  Equations
                                  • m.replaceUniformity H = { toEDist := m.toEDist, edist_self := , edist_comm := , edist_triangle := , toUniformSpace := U, uniformity_edist := , eq_of_edist_eq_zero := }
                                  Instances For
                                    @[reducible, inline]

                                    Auxiliary function to replace the topology on an emetric space with a topology which is equal to the original one, but maybe not defeq. This is useful if one wants to construct an emetric space with a specified topology. See Note [forgetful inheritance] explaining why having definitionally the right topology is often important. See note [reducible non-instances].

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      @[reducible, inline]
                                      abbrev EMetricSpace.induced {γ : Type u_2} {β : Type u_3} (f : γβ) (hf : Function.Injective f) (m : EMetricSpace β) :

                                      The extended metric induced by an injective function taking values in an emetric space. See Note [reducible non-instances].

                                      Equations
                                      Instances For
                                        @[implicit_reducible]
                                        instance instEMetricSpaceSubtype {α : Type u_2} {p : αProp} [EMetricSpace α] :

                                        EMetric space instance on subsets of emetric spaces

                                        Equations
                                        @[implicit_reducible]

                                        EMetric space instance on the multiplicative opposite of an emetric space.

                                        Equations
                                        @[implicit_reducible]

                                        EMetric space instance on the additive opposite of an emetric space.

                                        Equations
                                        theorem uniformity_edist {γ : Type w} [EMetricSpace γ] :
                                        uniformity γ = ⨅ (ε : ENNReal), ⨅ (_ : ε > 0), Filter.principal {p : γ × γ | edist p.1 p.2 < ε}

                                        Reformulation of the uniform structure in terms of the extended distance

                                        Additive, Multiplicative #

                                        The distance on those type synonyms is inherited without change.

                                        @[implicit_reducible]
                                        instance instEDistAdditive {X : Type u_1} [EDist X] :
                                        Equations
                                        @[implicit_reducible]
                                        Equations
                                        @[simp]
                                        theorem edist_ofMul {X : Type u_1} [EDist X] (a b : X) :
                                        @[simp]
                                        theorem edist_ofAdd {X : Type u_1} [EDist X] (a b : X) :
                                        @[simp]
                                        theorem edist_toMul {X : Type u_1} [EDist X] (a b : Additive X) :
                                        @[simp]
                                        @[implicit_reducible]
                                        Equations

                                        Order dual #

                                        The distance on this type synonym is inherited without change.

                                        @[implicit_reducible]
                                        instance instEDistOrderDual {X : Type u_1} [EDist X] :
                                        Equations
                                        @[simp]
                                        theorem edist_toDual {X : Type u_1} [EDist X] (a b : X) :
                                        @[simp]
                                        theorem edist_ofDual {X : Type u_1} [EDist X] (a b : Xᵒᵈ) :
                                        class WeakPseudoEMetricSpace (α : Type u) [τ : TopologicalSpace α] extends EDist α :

                                        A WeakPseudoEMetricSpace is a topological space endowed with a ℝ≥0∞-value distance edist which is almost an extended pseudometric space: the edist is reflexive, commutative and satisfies the triangle inequality, but the topology on α need not equal the topology induced by the edist. (It must be at least as fine, and agree with it on eballs of finite radius.)

                                        This generalises both pseudo extended metric spaces and ℝ≥0∞ (which have an extended distance, which does not induce the order topology there).

                                        Instances
                                          theorem WeakPseudoEMetricSpace.ext {α : Type u_2} [TopologicalSpace α] {m m' : WeakPseudoEMetricSpace α} (h : m.toEDist = m'.toEDist) :
                                          m = m'
                                          @[implicit_reducible]

                                          Every PseudoEMetricSpace has a WeakPseudoEMetricSpace structure by using the topology induced by edist.

                                          Equations
                                          @[reducible, inline]
                                          abbrev WeakPseudoEMetricSpace.IsInducing {α : Type u_2} {β : Type u_3} [e : TopologicalSpace α] [n : TopologicalSpace β] {f : αβ} (hf : Topology.IsInducing f) (m : WeakPseudoEMetricSpace β) :

                                          WeakPseudoEMetricSpace can be induced backwards.

                                          Equations
                                          Instances For
                                            @[implicit_reducible]

                                            Weak pseudo-emetric space instance on subsets of weak pseudo-emetric spaces

                                            Equations

                                            A weak extended metric space extends a WeakPseudoEMetricSpace with the condition edist x y = 0 ↔ x = y.

                                            Instances
                                              theorem WeakEMetricSpace.ext {α : Type u_2} [TopologicalSpace α] {m m' : WeakEMetricSpace α} (h : m.toEDist = m'.toEDist) :
                                              m = m'
                                              @[implicit_reducible]

                                              Every EMetricSpace has a WeakEMetricSpace structure by using the topology induced by edist.

                                              Equations
                                              @[reducible, inline]
                                              abbrev WeakEMetricSpace.induced {α : Type u_2} {β : Type u_3} [n : TopologicalSpace β] {f : αβ} (hf : Function.Injective f) (m : WeakEMetricSpace β) :

                                              The WeakEMetric space induced by pulling back a topology along an injective function.

                                              Equations
                                              Instances For
                                                @[implicit_reducible]

                                                WeakEMetricSpace instance on subsets of emetric spaces

                                                Equations
                                                @[implicit_reducible]
                                                Equations