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.HausdorffDistance

118 declarations. Mathlib docs · Source

Hausdorff distance

The Hausdorff distance on subsets of a metric (or emetric) space.

Given two subsets s and t of a metric space, their Hausdorff distance is the smallest d such that any point of s is within d of a point in t, and conversely. This quantity is often infinite (think of s bounded and t unbounded), and therefore better expressed in the setting of emetric spaces.

Main definitions

This file introduces:

  • Metric.infEDist x s, the infimum edistance of a point x to a set s in an emetric space
  • Metric.hausdorffEDist s t, the Hausdorff edistance of two sets in an emetric space
  • Versions of these notions on metric spaces, called respectively Metric.infDist and Metric.hausdorffDist

Main results

  • infEDist_closure: the edistance to a set and its closure coincide

  • Metric.mem_closure_iff_infEDist_zero: a point x belongs to the closure of s iff infEDist x s = 0

  • IsCompact.exists_infEDist_eq_edist: if s is compact and non-empty, there exists a point y which attains this edistance

  • IsOpen.exists_iUnion_isClosed: every open set U can be written as the increasing union of countably many closed subsets of U

  • hausdorffEDist_closure: replacing a set by its closure does not change the Hausdorff edistance

  • hausdorffEDist_zero_iff_closure_eq_closure: two sets have Hausdorff edistance zero iff their closures coincide

  • the Hausdorff edistance is symmetric and satisfies the triangle inequality

  • in particular, closed sets in an emetric space are an emetric space (this is shown in EMetricSpace.Closeds.emetricSpace)

  • versions of these notions on metric spaces

  • hausdorffEDist_ne_top_of_nonempty_of_bounded: if two sets in a metric space are nonempty and bounded in a metric space, they are at finite Hausdorff edistance.

Tags

metric space, Hausdorff distance

Distance of a point to a set as a function into ℝ≥0∞.

The Hausdorff distance as a function into ℝ≥0∞.

Now, we turn to the same notions in metric spaces. To avoid the difficulties related to sInf and sSup on ℝ (which is only conditionally complete), we use the notions in ℝ≥0∞ formulated in terms of the edistance, and coerce them to ℝ. Then their properties follow readily from the corresponding properties in ℝ≥0∞, modulo some tedious rewriting of inequalities from one to the other.

Distance of a point to a set as a function into ℝ.

Distance of a point to a set as a function into ℝ≥0.

The Hausdorff distance as a function into ℝ.

def Metric.infEDist E1 #

{α : Type u} → [PseudoEMetricSpace α] → α → Set α → ENNReal

The minimal edistance of a point to a set

theorem Metric.infEDist_empty E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α}, Metric.infEDist x ∅ = ⊤

theorem Metric.le_infEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α} {d : ENNReal},
  d ≤ Metric.infEDist x s ↔ ∀ y ∈ s, d ≤ edist x y

theorem Metric.infEDist_union E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s t : Set α},
  Metric.infEDist x (s ∪ t) = min (Metric.infEDist x s) (Metric.infEDist x t)

The edist to a union is the minimum of the edists

theorem Metric.infEDist_iUnion E0 #

∀ {ι : Sort u_1} {α : Type u} [inst : PseudoEMetricSpace α] (f : ι → Set α) (x : α),
  Metric.infEDist x (⋃ i, f i) = ⨅ i, Metric.infEDist x (f i)

theorem Metric.infEDist_biUnion E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {ι : Type u_2} (f : ι → Set α) (I : Set ι) (x : α),
  Metric.infEDist x (⋃ i ∈ I, f i) = ⨅ i ∈ I, Metric.infEDist x (f i)

theorem Metric.infEDist_singleton E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α}, Metric.infEDist x {y} = edist x y

The edist to a singleton is the edistance to the single point of this singleton

theorem Metric.infEDist_le_edist_of_mem E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α} {s : Set α}, y ∈ s → Metric.infEDist x s ≤ edist x y

The edist to a set is bounded above by the edist to any of its points

theorem Metric.infEDist_zero_of_mem E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α}, x ∈ s → Metric.infEDist x s = 0

If a point x belongs to s, then its edist to s vanishes

theorem Metric.infEDist_anti E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s t : Set α}, s ⊆ t → Metric.infEDist x t ≤ Metric.infEDist x s

The edist is antitone with respect to inclusion.

theorem Metric.infEDist_lt_iff E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α} {r : ENNReal},
  Metric.infEDist x s < r ↔ ∃ y ∈ s, edist x y < r

The edist to a set is < r iff there exists a point in the set at edistance < r

theorem Metric.infEDist_le_infEDist_add_edist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α} {s : Set α},
  Metric.infEDist x s ≤ Metric.infEDist y s + edist x y

The edist of x to s is bounded by the sum of the edist of y to s and the edist from x to y

theorem Metric.infEDist_le_edist_add_infEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α} {s : Set α},
  Metric.infEDist x s ≤ edist x y + Metric.infEDist y s

theorem Metric.edist_le_infEDist_add_ediam E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α} {s : Set α},
  y ∈ s → edist x y ≤ Metric.infEDist x s + Metric.ediam s

theorem Metric.continuous_infEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s : Set α}, Continuous fun x ↦ Metric.infEDist x s

The edist to a set depends continuously on the point

theorem Metric.infEDist_closure E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α}, Metric.infEDist x (closure s) = Metric.infEDist x s

The edist to a set and to its closure coincide

theorem Metric.mem_closure_iff_infEDist_zero E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α}, x ∈ closure s ↔ Metric.infEDist x s = 0

A point belongs to the closure of s iff its infimum edistance to this set vanishes

theorem Metric.mem_iff_infEDist_zero_of_closed E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α}, IsClosed s → (x ∈ s ↔ Metric.infEDist x s = 0)

Given a closed set s, a point belongs to s iff its infimum edistance to this set vanishes

theorem Metric.infEDist_pos_iff_notMem_closure E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {E : Set α}, 0 < Metric.infEDist x E ↔ x ∉ closure E

The infimum edistance of a point to a set is positive if and only if the point is not in the closure of the set.

theorem Metric.infEDist_closure_pos_iff_notMem_closure E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {E : Set α}, 0 < Metric.infEDist x (closure E) ↔ x ∉ closure E

theorem Metric.exists_real_pos_lt_infEDist_of_notMem_closure E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {E : Set α},
  x ∉ closure E → ∃ ε, 0 < ε ∧ ENNReal.ofReal ε < Metric.infEDist x E

theorem Metric.disjoint_closedEBall_of_lt_infEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s : Set α} {r : ENNReal},
  r < Metric.infEDist x s → Disjoint (Metric.closedEBall x r) s

theorem Metric.infEDist_image E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoEMetricSpace α] [inst_1 : PseudoEMetricSpace β] {x : α} {t : Set α}
  {Φ : α → β}, Isometry Φ → Metric.infEDist (Φ x) (Φ '' t) = Metric.infEDist x t

The infimum edistance is invariant under isometries

theorem Metric.infEDist_vadd E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {M : Type u_2} [inst_1 : VAdd M α] [IsIsometricVAdd M α] (c : M) (x : α)
  (s : Set α), Metric.infEDist (c +ᵥ x) (c +ᵥ s) = Metric.infEDist x s

theorem Metric.infEDist_smul E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {M : Type u_2} [inst_1 : SMul M α] [IsIsometricSMul M α] (c : M) (x : α)
  (s : Set α), Metric.infEDist (c • x) (c • s) = Metric.infEDist x s

theorem IsOpen.exists_iUnion_isClosed E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {U : Set α},
  IsOpen U → ∃ F, (∀ (n : ℕ), IsClosed (F n)) ∧ (∀ (n : ℕ), F n ⊆ U) ∧ ⋃ n, F n = U ∧ Monotone F

theorem IsCompact.exists_infEDist_eq_edist E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s : Set α},
  IsCompact s → s.Nonempty → ∀ (x : α), ∃ y ∈ s, Metric.infEDist x s = edist x y

theorem Metric.exists_pos_forall_lt_edist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  IsCompact s → IsClosed t → Disjoint s t → ∃ r, 0 < r ∧ ∀ x ∈ s, ∀ y ∈ t, ↑r < edist x y

theorem Metric.infEDist_prod E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoEMetricSpace α] [inst_1 : PseudoEMetricSpace β] (x : α × β) (s : Set α)
  (t : Set β), Metric.infEDist x (s ×ˢ t) = max (Metric.infEDist x.1 s) (Metric.infEDist x.2 t)

def Metric.hausdorffEDist E3 #

{α : Type u} → [PseudoEMetricSpace α] → Set α → Set α → ENNReal

The Hausdorff edistance between two sets is the smallest r such that each set is contained in the r-neighborhood of the other one

theorem Metric.hausdorffEDist_def E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] (s t : Set α),
  Metric.hausdorffEDist s t = max (⨆ x ∈ s, Metric.infEDist x t) (⨆ y ∈ t, Metric.infEDist y s)

Alias of _private.Mathlib.Topology.MetricSpace.HausdorffDistance.0.Metric.hausdorffEDist.eq_def.

theorem Metric.hausdorffEDist_self E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s : Set α}, Metric.hausdorffEDist s s = 0

The Hausdorff edistance of a set to itself vanishes.

theorem Metric.hausdorffEDist_comm E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α}, Metric.hausdorffEDist s t = Metric.hausdorffEDist t s

The Hausdorff edistances of s to t and of t to s coincide.

theorem Metric.hausdorffEDist_le_of_infEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α} {r : ENNReal},
  (∀ x ∈ s, Metric.infEDist x t ≤ r) → (∀ x ∈ t, Metric.infEDist x s ≤ r) → Metric.hausdorffEDist s t ≤ r

Bounding the Hausdorff edistance by bounding the edistance of any point in each set to the other set

theorem Metric.hausdorffEDist_le_of_mem_edist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α} {r : ENNReal},
  (∀ x ∈ s, ∃ y ∈ t, edist x y ≤ r) → (∀ x ∈ t, ∃ y ∈ s, edist x y ≤ r) → Metric.hausdorffEDist s t ≤ r

Bounding the Hausdorff edistance by exhibiting, for any point in each set, another point in the other set at controlled distance

theorem Metric.infEDist_le_hausdorffEDist_of_mem E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s t : Set α},
  x ∈ s → Metric.infEDist x t ≤ Metric.hausdorffEDist s t

The distance to a set is controlled by the Hausdorff distance.

theorem Metric.exists_edist_lt_of_hausdorffEDist_lt E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s t : Set α} {r : ENNReal},
  x ∈ s → Metric.hausdorffEDist s t < r → ∃ y ∈ t, edist x y < r

If the Hausdorff distance is < r, then any point in one of the sets has a corresponding point at distance < r in the other set.

theorem Metric.infEDist_le_infEDist_add_hausdorffEDist E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x : α} {s t : Set α},
  Metric.infEDist x t ≤ Metric.infEDist x s + Metric.hausdorffEDist s t

The distance from x to s or t is controlled in terms of the Hausdorff distance between s and t.

theorem Metric.hausdorffEDist_image E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoEMetricSpace α] [inst_1 : PseudoEMetricSpace β] {s t : Set α} {Φ : α → β},
  Isometry Φ → Metric.hausdorffEDist (Φ '' s) (Φ '' t) = Metric.hausdorffEDist s t

The Hausdorff edistance is invariant under isometries.

theorem Metric.hausdorffEDist_le_ediam E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  s.Nonempty → t.Nonempty → Metric.hausdorffEDist s t ≤ Metric.ediam (s ∪ t)

The Hausdorff distance is controlled by the diameter of the union.

theorem Metric.hausdorffEDist_triangle E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t u : Set α},
  Metric.hausdorffEDist s u ≤ Metric.hausdorffEDist s t + Metric.hausdorffEDist t u

The Hausdorff distance satisfies the triangle inequality.

theorem Metric.hausdorffEDist_zero_iff_closure_eq_closure E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α}, Metric.hausdorffEDist s t = 0 ↔ closure s = closure t

Two sets are at zero Hausdorff edistance if and only if they have the same closure.

theorem Metric.hausdorffEDist_self_closure E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s : Set α}, Metric.hausdorffEDist s (closure s) = 0

The Hausdorff edistance between a set and its closure vanishes.

theorem Metric.hausdorffEDist_closure_left E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  Metric.hausdorffEDist (closure s) t = Metric.hausdorffEDist s t

Replacing a set by its closure does not change the Hausdorff edistance.

theorem Metric.hausdorffEDist_closure_right E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  Metric.hausdorffEDist s (closure t) = Metric.hausdorffEDist s t

Replacing a set by its closure does not change the Hausdorff edistance.

theorem Metric.hausdorffEDist_closure E3 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  Metric.hausdorffEDist (closure s) (closure t) = Metric.hausdorffEDist s t

The Hausdorff edistance between sets or their closures is the same.

theorem IsClosed.hausdorffEDist_zero_iff E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  IsClosed s → IsClosed t → (Metric.hausdorffEDist s t = 0 ↔ s = t)

Two closed sets are at zero Hausdorff edistance if and only if they coincide.

theorem Metric.hausdorffEDist_empty E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s : Set α}, s.Nonempty → Metric.hausdorffEDist s ∅ = ⊤

The Hausdorff edistance to the empty set is infinite.

theorem Metric.nonempty_of_hausdorffEDist_ne_top E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α}, s.Nonempty → Metric.hausdorffEDist s t ≠ ⊤ → t.Nonempty

If a set is at finite Hausdorff edistance of a nonempty set, it is nonempty.

theorem Metric.empty_or_nonempty_of_hausdorffEDist_ne_top E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s t : Set α},
  Metric.hausdorffEDist s t ≠ ⊤ → s = ∅ ∧ t = ∅ ∨ s.Nonempty ∧ t.Nonempty

theorem Metric.hausdorffEDist_singleton E0 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {x y : α}, Metric.hausdorffEDist {x} {y} = edist x y

theorem Metric.hausdorffEDist_iUnion_le E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {ι : Sort u_2} {s t : ι → Set α},
  Metric.hausdorffEDist (⋃ i, s i) (⋃ i, t i) ≤ ⨆ i, Metric.hausdorffEDist (s i) (t i)

theorem Metric.hausdorffEDist_union_le E1 #

∀ {α : Type u} [inst : PseudoEMetricSpace α] {s₁ s₂ t₁ t₂ : Set α},
  Metric.hausdorffEDist (s₁ ∪ s₂) (t₁ ∪ t₂) ≤ max (Metric.hausdorffEDist s₁ t₁) (Metric.hausdorffEDist s₂ t₂)

theorem Metric.hausdorffEDist_prod_le E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoEMetricSpace α] [inst_1 : PseudoEMetricSpace β] {s₁ t₁ : Set α}
  {s₂ t₂ : Set β},
  Metric.hausdorffEDist (s₁ ×ˢ s₂) (t₁ ×ˢ t₂) ≤ max (Metric.hausdorffEDist s₁ t₁) (Metric.hausdorffEDist s₂ t₂)

def Metric.infDist E3 #

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

The minimal distance of a point to a set

theorem Metric.infDist_eq_iInf E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Metric.infDist x s = ⨅ y, dist x ↑y

theorem Metric.infDist_nonneg E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, 0 ≤ Metric.infDist x s

The minimal distance is always nonnegative

theorem Metric.infDist_empty E0 #

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

The minimal distance to the empty set is 0 (if you want to have the more reasonable value ∞ instead, use Metric.infEDist, which takes values in ℝ≥0∞)

theorem Metric.isGLB_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α},
  s.Nonempty → IsGLB ((fun x_1 ↦ dist x x_1) '' s) (Metric.infDist x s)

theorem Metric.infEDist_ne_top E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, s.Nonempty → Metric.infEDist x s ≠ ⊤

In a metric space, the minimal edistance to a nonempty set is finite.

theorem Metric.infEDist_eq_top_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Metric.infEDist x s = ⊤ ↔ s = ∅

theorem Metric.infDist_zero_of_mem E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, x ∈ s → Metric.infDist x s = 0

The minimal distance of a point to a set containing it vanishes.

theorem Metric.infDist_singleton E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α}, Metric.infDist x {y} = dist x y

The minimal distance to a singleton is the distance to the unique point in this singleton.

theorem Metric.infDist_le_dist_of_mem E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x y : α}, y ∈ s → Metric.infDist x s ≤ dist x y

The minimal distance to a set is bounded by the distance to any point in this set.

theorem Metric.infDist_le_infDist_of_subset E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {x : α},
  s ⊆ t → s.Nonempty → Metric.infDist x t ≤ Metric.infDist x s

The minimal distance is monotone with respect to inclusion.

theorem Metric.le_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α} {r : ℝ},
  s.Nonempty → (r ≤ Metric.infDist x s ↔ ∀ ⦃y : α⦄, y ∈ s → r ≤ dist x y)

theorem Metric.infDist_lt_iff E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α} {r : ℝ},
  s.Nonempty → (Metric.infDist x s < r ↔ ∃ y ∈ s, dist x y < r)

The minimal distance to a set s is < r iff there exists a point in s at distance < r.

theorem Metric.infDist_le_infDist_add_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x y : α}, Metric.infDist x s ≤ Metric.infDist y s + dist x y

The minimal distance from x to s is bounded by the distance from y to s, modulo the distance between x and y.

theorem Metric.notMem_of_dist_lt_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x y : α}, dist x y < Metric.infDist x s → y ∉ s

theorem Metric.disjoint_ball_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Disjoint (Metric.ball x (Metric.infDist x s)) s

theorem Metric.ball_infDist_subset_compl E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Metric.ball x (Metric.infDist x s) ⊆ sᶜ

theorem Metric.ball_infDist_compl_subset E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Metric.ball x (Metric.infDist x sᶜ) ⊆ s

theorem Metric.disjoint_closedBall_of_lt_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α} {r : ℝ},
  r < Metric.infDist x s → Disjoint (Metric.closedBall x r) s

theorem Metric.dist_le_infDist_add_diam E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x y : α},
  Bornology.IsBounded s → y ∈ s → dist x y ≤ Metric.infDist x s + Metric.diam s

theorem Metric.lipschitz_infDist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), LipschitzWith 1 fun x ↦ Metric.infDist x s

The minimal distance to a set is Lipschitz in point with constant 1

theorem Metric.uniformContinuous_infDist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), UniformContinuous fun x ↦ Metric.infDist x s

The minimal distance to a set is uniformly continuous in point

theorem Metric.continuous_infDist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), Continuous fun x ↦ Metric.infDist x s

The minimal distance to a set is continuous in point

theorem Metric.infDist_closure E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, Metric.infDist x (closure s) = Metric.infDist x s

The minimal distances to a set and its closure coincide.

theorem Metric.infDist_zero_of_mem_closure E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, x ∈ closure s → Metric.infDist x s = 0

If a point belongs to the closure of s, then its infimum distance to s equals zero. The converse is true provided that s is nonempty, see Metric.mem_closure_iff_infDist_zero.

theorem Metric.mem_closure_iff_infDist_zero E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, s.Nonempty → (x ∈ closure s ↔ Metric.infDist x s = 0)

A point belongs to the closure of s iff its infimum distance to this set vanishes.

theorem Metric.infDist_pos_iff_notMem_closure E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, s.Nonempty → (x ∉ closure s ↔ 0 < Metric.infDist x s)

theorem IsClosed.mem_iff_infDist_zero E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α},
  IsClosed s → s.Nonempty → (x ∈ s ↔ Metric.infDist x s = 0)

Given a closed set s, a point belongs to s iff its infimum distance to this set vanishes

theorem IsClosed.notMem_iff_infDist_pos E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α},
  IsClosed s → s.Nonempty → (x ∉ s ↔ 0 < Metric.infDist x s)

Given a closed set s, a point belongs to s iff its infimum distance to this set vanishes.

theorem Metric.continuousAt_inv_infDist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α},
  x ∉ closure s → ContinuousAt (fun x ↦ (Metric.infDist x s)⁻¹) x

theorem Metric.infDist_image E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {t : Set α} {x : α} {Φ : α → β},
  Isometry Φ → Metric.infDist (Φ x) (Φ '' t) = Metric.infDist x t

The infimum distance is invariant under isometries.

theorem Metric.infDist_inter_closedBall_of_mem E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x y : α},
  y ∈ s → Metric.infDist x (s ∩ Metric.closedBall x (dist y x)) = Metric.infDist x s

theorem IsCompact.exists_infDist_eq_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α},
  IsCompact s → s.Nonempty → ∀ (x : α), ∃ y ∈ s, Metric.infDist x s = dist x y

theorem IsClosed.exists_infDist_eq_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} [ProperSpace α],
  IsClosed s → s.Nonempty → ∀ (x : α), ∃ y ∈ s, Metric.infDist x s = dist x y

theorem Metric.exists_mem_closure_infDist_eq_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} [ProperSpace α],
  s.Nonempty → ∀ (x : α), ∃ y ∈ closure s, Metric.infDist x s = dist x y

def Metric.infNndist E1 #

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

The minimal distance of a point to a set as a ℝ≥0

theorem Metric.coe_infNndist E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α} {x : α}, ↑(Metric.infNndist x s) = Metric.infDist x s

theorem Metric.lipschitz_infNndist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), LipschitzWith 1 fun x ↦ Metric.infNndist x s

The minimal distance to a set (as ℝ≥0) is Lipschitz in point with constant 1

theorem Metric.uniformContinuous_infNndist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), UniformContinuous fun x ↦ Metric.infNndist x s

The minimal distance to a set (as ℝ≥0) is uniformly continuous in point

theorem Metric.continuous_infNndist_pt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] (s : Set α), Continuous fun x ↦ Metric.infNndist x s

The minimal distance to a set (as ℝ≥0) is continuous in point

def Metric.hausdorffDist E3 #

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

The Hausdorff distance between two sets is the smallest nonnegative r such that each set is included in the r-neighborhood of the other. If there is no such r, it is defined to be 0, arbitrarily.

theorem Metric.hausdorffDist_nonneg E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α}, 0 ≤ Metric.hausdorffDist s t

The Hausdorff distance is nonnegative.

theorem Metric.hausdorffEDist_ne_top_of_nonempty_of_bounded E3 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α},
  s.Nonempty → t.Nonempty → Bornology.IsBounded s → Bornology.IsBounded t → Metric.hausdorffEDist s t ≠ ⊤

If two sets are nonempty and bounded in a metric space, they are at finite Hausdorff edistance.

theorem Metric.hausdorffDist_self_zero E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Metric.hausdorffDist s s = 0

The Hausdorff distance between a set and itself is zero.

theorem Metric.hausdorffDist_comm E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α}, Metric.hausdorffDist s t = Metric.hausdorffDist t s

The Hausdorff distances from s to t and from t to s coincide.

theorem Metric.hausdorffDist_empty E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Metric.hausdorffDist s ∅ = 0

The Hausdorff distance to the empty set vanishes (if you want to have the more reasonable value ∞ instead, use Metric.hausdorffEDist, which takes values in ℝ≥0∞).

theorem Metric.hausdorffDist_empty' E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Metric.hausdorffDist ∅ s = 0

The Hausdorff distance to the empty set vanishes (if you want to have the more reasonable value ∞ instead, use Metric.hausdorffEDist, which takes values in ℝ≥0∞).

theorem Metric.hausdorffDist_le_of_infDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {r : ℝ},
  0 ≤ r → (∀ x ∈ s, Metric.infDist x t ≤ r) → (∀ x ∈ t, Metric.infDist x s ≤ r) → Metric.hausdorffDist s t ≤ r

Bounding the Hausdorff distance by bounding the distance of any point in each set to the other set

theorem Metric.hausdorffDist_le_of_mem_dist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {r : ℝ},
  0 ≤ r → (∀ x ∈ s, ∃ y ∈ t, dist x y ≤ r) → (∀ x ∈ t, ∃ y ∈ s, dist x y ≤ r) → Metric.hausdorffDist s t ≤ r

Bounding the Hausdorff distance by exhibiting, for any point in each set, another point in the other set at controlled distance

theorem Metric.hausdorffDist_le_diam E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α},
  s.Nonempty →
    Bornology.IsBounded s → t.Nonempty → Bornology.IsBounded t → Metric.hausdorffDist s t ≤ Metric.diam (s ∪ t)

The Hausdorff distance is controlled by the diameter of the union.

theorem Metric.infDist_le_hausdorffDist_of_mem E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {x : α},
  x ∈ s → Metric.hausdorffEDist s t ≠ ⊤ → Metric.infDist x t ≤ Metric.hausdorffDist s t

The distance to a set is controlled by the Hausdorff distance.

theorem Metric.exists_dist_lt_of_hausdorffDist_lt E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {x : α} {r : ℝ},
  x ∈ s → Metric.hausdorffDist s t < r → Metric.hausdorffEDist s t ≠ ⊤ → ∃ y ∈ t, dist x y < r

If the Hausdorff distance is < r, any point in one of the sets is at distance < r of a point in the other set.

theorem Metric.exists_dist_lt_of_hausdorffDist_lt' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {y : α} {r : ℝ},
  y ∈ t → Metric.hausdorffDist s t < r → Metric.hausdorffEDist s t ≠ ⊤ → ∃ x ∈ s, dist x y < r

If the Hausdorff distance is < r, any point in one of the sets is at distance < r of a point in the other set.

theorem Metric.infDist_le_infDist_add_hausdorffDist E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α} {x : α},
  Metric.hausdorffEDist s t ≠ ⊤ → Metric.infDist x t ≤ Metric.infDist x s + Metric.hausdorffDist s t

The infimum distance to s and t are the same, up to the Hausdorff distance between s and t

theorem Metric.hausdorffDist_image E1 #

∀ {α : Type u} {β : Type v} [inst : PseudoMetricSpace α] [inst_1 : PseudoMetricSpace β] {s t : Set α} {Φ : α → β},
  Isometry Φ → Metric.hausdorffDist (Φ '' s) (Φ '' t) = Metric.hausdorffDist s t

The Hausdorff distance is invariant under isometries.

theorem Metric.hausdorffDist_triangle E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t u : Set α},
  Metric.hausdorffEDist s t ≠ ⊤ → Metric.hausdorffDist s u ≤ Metric.hausdorffDist s t + Metric.hausdorffDist t u

The Hausdorff distance satisfies the triangle inequality.

theorem Metric.hausdorffDist_triangle' E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t u : Set α},
  Metric.hausdorffEDist t u ≠ ⊤ → Metric.hausdorffDist s u ≤ Metric.hausdorffDist s t + Metric.hausdorffDist t u

The Hausdorff distance satisfies the triangle inequality.

theorem Metric.hausdorffDist_self_closure E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s : Set α}, Metric.hausdorffDist s (closure s) = 0

The Hausdorff distance between a set and its closure vanishes.

theorem Metric.hausdorffDist_closure₁ E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α}, Metric.hausdorffDist (closure s) t = Metric.hausdorffDist s t

Replacing a set by its closure does not change the Hausdorff distance.

theorem Metric.hausdorffDist_closure₂ E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α}, Metric.hausdorffDist s (closure t) = Metric.hausdorffDist s t

Replacing a set by its closure does not change the Hausdorff distance.

theorem Metric.hausdorffDist_closure E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α},
  Metric.hausdorffDist (closure s) (closure t) = Metric.hausdorffDist s t

The Hausdorff distances between two sets and their closures coincide.

theorem Metric.hausdorffDist_zero_iff_closure_eq_closure E1 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α},
  Metric.hausdorffEDist s t ≠ ⊤ → (Metric.hausdorffDist s t = 0 ↔ closure s = closure t)

Two sets are at zero Hausdorff distance if and only if they have the same closures.

theorem IsClosed.hausdorffDist_zero_iff_eq E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {s t : Set α},
  IsClosed s → IsClosed t → Metric.hausdorffEDist s t ≠ ⊤ → (Metric.hausdorffDist s t = 0 ↔ s = t)

Two closed sets are at zero Hausdorff distance if and only if they coincide.

theorem Metric.hausdorffDist_singleton E0 #

∀ {α : Type u} [inst : PseudoMetricSpace α] {x y : α}, Metric.hausdorffDist {x} {y} = dist x y