File: Mathlib/Topology/MetricSpace/Basic.lean

full_name: MetricSpace
code: /-- We now define `MetricSpace`, extending `PseudoMetricSpace`. -/
class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where
  eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y
goal: Type u

full_name: MetricSpace.eq_of_dist_eq_zero
code: /-- We now define `MetricSpace`, extending `PseudoMetricSpace`. -/
class MetricSpace (α : Type u) extends PseudoMetricSpace α : Type u where
  eq_of_dist_eq_zero : ∀ {x y : α}, dist x y = 0 → x = y
goal: dist x y = 0 → x = y

full_name: MetricSpace.ext
code: /-- Two metric space structures with the same distance coincide. -/
@[ext]
theorem MetricSpace.ext {α : Type*} {m m' : MetricSpace α} (h : m.toDist = m'.toDist) :
    m = m' 
goal: m = m'

full_name: MetricSpace.ofDistTopology
code: /-- Construct a metric space structure whose underlying topological space structure
(definitionally) agrees which a pre-existing topology which is compatible with a given distance
function. -/
def MetricSpace.ofDistTopology {α : Type u} [TopologicalSpace α] (dist : α → α → ℝ)
    (dist_self : ∀ x : α, dist x x = 0) (dist_comm : ∀ x y : α, dist x y = dist y x)
    (dist_triangle : ∀ x y z : α, dist x z ≤ dist x y + dist y z)
    (H : ∀ s : Set α, IsOpen s ↔ ∀ x ∈ s, ∃ ε > 0, ∀ y, dist x y < ε → y ∈ s)
    (eq_of_dist_eq_zero : ∀ x y : α, dist x y = 0 → x = y) : MetricSpace α 
goal: MetricSpace α

full_name: eq_of_dist_eq_zero
code: theorem eq_of_dist_eq_zero {x y : γ} : dist x y = 0 → x = y 
goal: dist x y = 0 → x = y

full_name: dist_eq_zero
code: @[simp]
theorem dist_eq_zero {x y : γ} : dist x y = 0 ↔ x = y 
goal: dist x y = 0 ↔ x = y

full_name: zero_eq_dist
code: @[simp]
theorem zero_eq_dist {x y : γ} : 0 = dist x y ↔ x = y 
goal: 0 = dist x y ↔ x = y

full_name: dist_ne_zero
code: theorem dist_ne_zero {x y : γ} : dist x y ≠ 0 ↔ x ≠ y 
goal: dist x y ≠ 0 ↔ x ≠ y

full_name: dist_le_zero
code: @[simp]
theorem dist_le_zero {x y : γ} : dist x y ≤ 0 ↔ x = y 
goal: dist x y ≤ 0 ↔ x = y

full_name: dist_pos
code: @[simp]
theorem dist_pos {x y : γ} : 0 < dist x y ↔ x ≠ y 
goal: 0 < dist x y ↔ x ≠ y

full_name: eq_of_forall_dist_le
code: theorem eq_of_forall_dist_le {x y : γ} (h : ∀ ε > 0, dist x y ≤ ε) : x = y 
goal: x = y

full_name: eq_of_nndist_eq_zero
code: /-- Deduce the equality of points from the vanishing of the nonnegative distance-/
theorem eq_of_nndist_eq_zero {x y : γ} : nndist x y = 0 → x = y 
goal: nndist x y = 0 → x = y

full_name: nndist_eq_zero
code: /-- Characterize the equality of points as the vanishing of the nonnegative distance-/
@[simp]
theorem nndist_eq_zero {x y : γ} : nndist x y = 0 ↔ x = y 
goal: nndist x y = 0 ↔ x = y

full_name: zero_eq_nndist
code: @[simp]
theorem zero_eq_nndist {x y : γ} : 0 = nndist x y ↔ x = y 
goal: 0 = nndist x y ↔ x = y

full_name: Metric.closedBall_zero
code: @[simp] theorem closedBall_zero : closedBall x 0 = {x} 
goal: Metric.closedBall x 0 = {x}

full_name: Metric.sphere_zero
code: @[simp] theorem sphere_zero : sphere x 0 = {x} 
goal: Metric.sphere x 0 = {x}

full_name: Metric.subsingleton_closedBall
code: theorem subsingleton_closedBall (x : γ) {r : ℝ} (hr : r ≤ 0) : (closedBall x r).Subsingleton 
goal: (Metric.closedBall x r).Subsingleton

full_name: Metric.subsingleton_sphere
code: theorem subsingleton_sphere (x : γ) {r : ℝ} (hr : r ≤ 0) : (sphere x r).Subsingleton 
goal: (Metric.sphere x r).Subsingleton

full_name: MetricSpace.instT0Space
code: instance (priority := 100) _root_.MetricSpace.instT0Space : T0Space γ 
goal: T0Space γ

full_name: Metric.uniformEmbedding_iff'
code: /-- A map between metric spaces is a uniform embedding if and only if the distance between `f x`
and `f y` is controlled in terms of the distance between `x` and `y` and conversely. -/
theorem uniformEmbedding_iff' [MetricSpace β] {f : γ → β} :
    UniformEmbedding f ↔
      (∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, dist a b < δ → dist (f a) (f b) < ε) ∧
        ∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, dist (f a) (f b) < ε → dist a b < δ 
goal: UniformEmbedding f ↔
  (∀ ε > 0, ∃ δ > 0, ∀ {a b : γ}, dist a b < δ → dist (f a) (f b) < ε) ∧
    ∀ δ > 0, ∃ ε > 0, ∀ {a b : γ}, dist (f a) (f b) < ε → dist a b < δ

full_name: MetricSpace.ofT0PseudoMetricSpace
code: /-- If a `PseudoMetricSpace` is a T₀ space, then it is a `MetricSpace`. -/
abbrev _root_.MetricSpace.ofT0PseudoMetricSpace (α : Type*) [PseudoMetricSpace α] [T0Space α] :
    MetricSpace α 
goal: MetricSpace α

full_name: MetricSpace.toEMetricSpace
code: /-- A metric space induces an emetric space -/
instance (priority := 100) _root_.MetricSpace.toEMetricSpace : EMetricSpace γ 
goal: EMetricSpace γ

full_name: Metric.isClosed_of_pairwise_le_dist
code: theorem isClosed_of_pairwise_le_dist {s : Set γ} {ε : ℝ} (hε : 0 < ε)
    (hs : s.Pairwise fun x y => ε ≤ dist x y) : IsClosed s 
goal: IsClosed s

full_name: Metric.closedEmbedding_of_pairwise_le_dist
code: theorem closedEmbedding_of_pairwise_le_dist {α : Type*} [TopologicalSpace α] [DiscreteTopology α]
    {ε : ℝ} (hε : 0 < ε) {f : α → γ} (hf : Pairwise fun x y => ε ≤ dist (f x) (f y)) :
    ClosedEmbedding f 
goal: ClosedEmbedding f

full_name: Metric.uniformEmbedding_bot_of_pairwise_le_dist
code: /-- If `f : β → α` sends any two distinct points to points at distance at least `ε > 0`, then
`f` is a uniform embedding with respect to the discrete uniformity on `β`. -/
theorem uniformEmbedding_bot_of_pairwise_le_dist {β : Type*} {ε : ℝ} (hε : 0 < ε) {f : β → α}
    (hf : Pairwise fun x y => ε ≤ dist (f x) (f y)) :
    @UniformEmbedding _ _ ⊥ (by infer_instance) f 
goal: UniformEmbedding f

full_name: MetricSpace.replaceUniformity
code: /-- Build a new metric space from an old one where the bundled uniform structure is provably
(but typically non-definitionaly) equal to some given uniform structure.
See Note [forgetful inheritance].
-/
def MetricSpace.replaceUniformity {γ} [U : UniformSpace γ] (m : MetricSpace γ)
    (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace]) : MetricSpace γ 
goal: MetricSpace γ

full_name: MetricSpace.replaceUniformity_eq
code: theorem MetricSpace.replaceUniformity_eq {γ} [U : UniformSpace γ] (m : MetricSpace γ)
    (H : 𝓤[U] = 𝓤[PseudoEMetricSpace.toUniformSpace]) : m.replaceUniformity H = m 
goal: m.replaceUniformity H = m

full_name: MetricSpace.replaceTopology
code: /-- Build a new metric space from an old one where the bundled topological structure is provably
(but typically non-definitionaly) equal to some given topological structure.
See Note [forgetful inheritance].
-/
abbrev MetricSpace.replaceTopology {γ} [U : TopologicalSpace γ] (m : MetricSpace γ)
    (H : U = m.toPseudoMetricSpace.toUniformSpace.toTopologicalSpace) : MetricSpace γ 
goal: MetricSpace γ

full_name: MetricSpace.replaceTopology_eq
code: theorem MetricSpace.replaceTopology_eq {γ} [U : TopologicalSpace γ] (m : MetricSpace γ)
    (H : U = m.toPseudoMetricSpace.toUniformSpace.toTopologicalSpace) :
    m.replaceTopology H = m 
goal: m.replaceTopology H = m

full_name: EMetricSpace.toMetricSpaceOfDist
code: /-- One gets a metric 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 metric space and the emetric 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. -/
abbrev EMetricSpace.toMetricSpaceOfDist {α : Type u} [EMetricSpace α] (dist : α → α → ℝ)
    (edist_ne_top : ∀ x y : α, edist x y ≠ ⊤) (h : ∀ x y, dist x y = ENNReal.toReal (edist x y)) :
    MetricSpace α 
goal: MetricSpace α

full_name: EMetricSpace.toMetricSpace
code: /-- One gets a metric 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 metric space and the emetric space. -/
def EMetricSpace.toMetricSpace {α : Type u} [EMetricSpace α] (h : ∀ x y : α, edist x y ≠ ⊤) :
    MetricSpace α 
goal: MetricSpace α

full_name: MetricSpace.replaceBornology
code: /-- Build a new metric space from an old one where the bundled bornology structure is provably
(but typically non-definitionaly) equal to some given bornology structure.
See Note [forgetful inheritance].
-/
def MetricSpace.replaceBornology {α} [B : Bornology α] (m : MetricSpace α)
    (H : ∀ s, @IsBounded _ B s ↔ @IsBounded _ PseudoMetricSpace.toBornology s) : MetricSpace α 
goal: MetricSpace α

full_name: MetricSpace.replaceBornology_eq
code: theorem MetricSpace.replaceBornology_eq {α} [m : MetricSpace α] [B : Bornology α]
    (H : ∀ s, @IsBounded _ B s ↔ @IsBounded _ PseudoMetricSpace.toBornology s) :
    MetricSpace.replaceBornology _ H = m 
goal: m.replaceBornology H = m

full_name: MetricSpace.induced
code: /-- Metric space structure pulled back by an injective function. Injectivity is necessary to
ensure that `dist x y = 0` only if `x = y`. -/
abbrev MetricSpace.induced {γ β} (f : γ → β) (hf : Function.Injective f) (m : MetricSpace β) :
    MetricSpace γ 
goal: MetricSpace γ

full_name: UniformEmbedding.comapMetricSpace
code: /-- Pull back a metric space structure by a uniform embedding. This is a version of
`MetricSpace.induced` useful in case if the domain already has a `UniformSpace` structure. -/
abbrev UniformEmbedding.comapMetricSpace {α β} [UniformSpace α] [m : MetricSpace β] (f : α → β)
    (h : UniformEmbedding f) : MetricSpace α 
goal: MetricSpace α

full_name: Embedding.comapMetricSpace
code: /-- Pull back a metric space structure by an embedding. This is a version of
`MetricSpace.induced` useful in case if the domain already has a `TopologicalSpace` structure. -/
abbrev Embedding.comapMetricSpace {α β} [TopologicalSpace α] [m : MetricSpace β] (f : α → β)
    (h : Embedding f) : MetricSpace α 
goal: MetricSpace α

full_name: Subtype.metricSpace
code: instance Subtype.metricSpace {α : Type*} {p : α → Prop} [MetricSpace α] :
    MetricSpace (Subtype p) 
goal: MetricSpace (Subtype p)

full_name: instMetricSpaceMulOpposite
code: @[to_additive]
instance {α : Type*} [MetricSpace α] : MetricSpace αᵐᵒᵖ 
goal: MetricSpace αᵐᵒᵖ

full_name: instMetricSpaceAddOpposite
code: @[to_additive]
instance {α : Type*} [MetricSpace α] : MetricSpace αᵐᵒᵖ 
goal: MetricSpace αᵃᵒᵖ

full_name: instMetricSpaceEmpty
code: instance : MetricSpace Empty 
goal: MetricSpace Empty

full_name: instMetricSpacePUnit
code: instance : MetricSpace PUnit.{u + 1} 
goal: MetricSpace PUnit.{u + 1}

full_name: Real.metricSpace
code: /-- Instantiate the reals as a metric space. -/
instance Real.metricSpace : MetricSpace ℝ 
goal: MetricSpace ℝ

full_name: instMetricSpaceNNReal
code: instance : MetricSpace ℝ≥0 
goal: MetricSpace ℝ≥0

full_name: instMetricSpaceULift
code: instance [MetricSpace β] : MetricSpace (ULift β) 
goal: MetricSpace (ULift.{u_3, v} β)

full_name: Prod.metricSpaceMax
code: instance Prod.metricSpaceMax [MetricSpace β] : MetricSpace (γ × β) 
goal: MetricSpace (γ × β)

full_name: metricSpacePi
code: /-- A finite product of metric spaces is a metric space, with the sup distance. -/
instance metricSpacePi : MetricSpace (∀ b, π b) 
goal: MetricSpace ((b : β) → π b)

full_name: Metric.secondCountable_of_countable_discretization
code: /-- A metric space is second countable if one can reconstruct up to any `ε>0` any element of the
space from countably many data. -/
theorem secondCountable_of_countable_discretization {α : Type u} [MetricSpace α]
    (H : ∀ ε > (0 : ℝ), ∃ (β : Type*) (_ : Encodable β) (F : α → β),
      ∀ x y, F x = F y → dist x y ≤ ε) :
    SecondCountableTopology α 
goal: SecondCountableTopology α

full_name: SeparationQuotient.instDist
code: instance SeparationQuotient.instDist {α : Type u} [PseudoMetricSpace α] :
    Dist (SeparationQuotient α) 
goal: Dist (SeparationQuotient α)

full_name: SeparationQuotient.dist_mk
code: theorem SeparationQuotient.dist_mk {α : Type u} [PseudoMetricSpace α] (p q : α) :
    dist (mk p) (mk q) = dist p q 
goal: dist (SeparationQuotient.mk p) (SeparationQuotient.mk q) = dist p q

full_name: SeparationQuotient.instMetricSpace
code: instance SeparationQuotient.instMetricSpace {α : Type u} [PseudoMetricSpace α] :
    MetricSpace (SeparationQuotient α) 
goal: MetricSpace (SeparationQuotient α)

full_name: instDistAdditive
code: instance : Dist (Additive X) 
goal: Dist (Additive X)

full_name: instDistMultiplicative
code: instance : Dist (Multiplicative X) 
goal: Dist (Multiplicative X)

full_name: dist_ofMul
code: @[simp] theorem dist_ofMul (a b : X) : dist (ofMul a) (ofMul b) = dist a b 
goal: dist (Additive.ofMul a) (Additive.ofMul b) = dist a b

full_name: dist_ofAdd
code: @[simp] theorem dist_ofAdd (a b : X) : dist (ofAdd a) (ofAdd b) = dist a b 
goal: dist (Multiplicative.ofAdd a) (Multiplicative.ofAdd b) = dist a b

full_name: dist_toMul
code: @[simp] theorem dist_toMul (a b : Additive X) : dist (toMul a) (toMul b) = dist a b 
goal: dist (Additive.toMul a) (Additive.toMul b) = dist a b

full_name: dist_toAdd
code: @[simp] theorem dist_toAdd (a b : Multiplicative X) : dist (toAdd a) (toAdd b) = dist a b 
goal: dist (Multiplicative.toAdd a) (Multiplicative.toAdd b) = dist a b

full_name: instPseudoMetricSpaceAdditive_1
code: instance : PseudoMetricSpace (Additive X) 
goal: PseudoMetricSpace (Additive X)

full_name: instPseudoMetricSpaceMultiplicative_1
code: instance : PseudoMetricSpace (Multiplicative X) 
goal: PseudoMetricSpace (Multiplicative X)

full_name: nndist_ofMul
code: @[simp] theorem nndist_ofMul (a b : X) : nndist (ofMul a) (ofMul b) = nndist a b 
goal: nndist (Additive.ofMul a) (Additive.ofMul b) = nndist a b

full_name: nndist_ofAdd
code: @[simp] theorem nndist_ofAdd (a b : X) : nndist (ofAdd a) (ofAdd b) = nndist a b 
goal: nndist (Multiplicative.ofAdd a) (Multiplicative.ofAdd b) = nndist a b

full_name: nndist_toMul
code: @[simp] theorem nndist_toMul (a b : Additive X) : nndist (toMul a) (toMul b) = nndist a b 
goal: nndist (Additive.toMul a) (Additive.toMul b) = nndist a b

full_name: nndist_toAdd
code: @[simp]
theorem nndist_toAdd (a b : Multiplicative X) : nndist (toAdd a) (toAdd b) = nndist a b 
goal: nndist (Multiplicative.toAdd a) (Multiplicative.toAdd b) = nndist a b

full_name: instMetricSpaceAdditive
code: instance [MetricSpace X] : MetricSpace (Additive X) 
goal: MetricSpace (Additive X)

full_name: instMetricSpaceMultiplicative
code: instance [MetricSpace X] : MetricSpace (Multiplicative X) 
goal: MetricSpace (Multiplicative X)

full_name: MulOpposite.instMetricSpace
code: instance MulOpposite.instMetricSpace [MetricSpace X] : MetricSpace Xᵐᵒᵖ 
goal: MetricSpace Xᵐᵒᵖ

full_name: instDistOrderDual
code: instance : Dist Xᵒᵈ 
goal: Dist Xᵒᵈ

full_name: dist_toDual
code: @[simp] theorem dist_toDual (a b : X) : dist (toDual a) (toDual b) = dist a b 
goal: dist (OrderDual.toDual a) (OrderDual.toDual b) = dist a b

full_name: dist_ofDual
code: @[simp] theorem dist_ofDual (a b : Xᵒᵈ) : dist (ofDual a) (ofDual b) = dist a b 
goal: dist (OrderDual.ofDual a) (OrderDual.ofDual b) = dist a b

full_name: instPseudoMetricSpaceOrderDual_1
code: instance : PseudoMetricSpace Xᵒᵈ 
goal: PseudoMetricSpace Xᵒᵈ

full_name: nndist_toDual
code: @[simp] theorem nndist_toDual (a b : X) : nndist (toDual a) (toDual b) = nndist a b 
goal: nndist (OrderDual.toDual a) (OrderDual.toDual b) = nndist a b

full_name: nndist_ofDual
code: @[simp] theorem nndist_ofDual (a b : Xᵒᵈ) : nndist (ofDual a) (ofDual b) = nndist a b 
goal: nndist (OrderDual.ofDual a) (OrderDual.ofDual b) = nndist a b

full_name: instMetricSpaceOrderDual
code: instance [MetricSpace X] : MetricSpace Xᵒᵈ 
goal: MetricSpace Xᵒᵈ