mathlib documentation

topology.metric_space.hausdorff_distance

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 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 files introduces:

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

def emetric.inf_edist {α : Type u} [emetric_space α] :
α → set αennreal

The minimal edistance of a point to a set

Equations
@[simp]
theorem emetric.inf_edist_empty {α : Type u} [emetric_space α] {x : α} :

@[simp]
theorem emetric.inf_edist_union {α : Type u} [emetric_space α] {x : α} {s t : set α} :

The edist to a union is the minimum of the edists

@[simp]
theorem emetric.inf_edist_singleton {α : Type u} [emetric_space α] {x y : α} :

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

theorem emetric.inf_edist_le_edist_of_mem {α : Type u} [emetric_space α] {x y : α} {s : set α} :
y semetric.inf_edist x s edist x y

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

theorem emetric.inf_edist_zero_of_mem {α : Type u} [emetric_space α] {x : α} {s : set α} :
x semetric.inf_edist x s = 0

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

theorem emetric.inf_edist_le_inf_edist_of_subset {α : Type u} [emetric_space α] {x : α} {s t : set α} :

The edist is monotonous with respect to inclusion

theorem emetric.exists_edist_lt_of_inf_edist_lt {α : Type u} [emetric_space α] {x : α} {s : set α} {r : ennreal} :
emetric.inf_edist x s < r(∃ (y : α) (H : y s), edist x y < r)

If the edist to a set is < r, there exists a point in the set at edistance < r

theorem emetric.inf_edist_le_inf_edist_add_edist {α : Type u} [emetric_space α] {x y : α} {s : set α} :

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 emetric.continuous_inf_edist {α : Type u} [emetric_space α] {s : set α} :
continuous (λ (x : α), emetric.inf_edist x s)

The edist to a set depends continuously on the point

theorem emetric.inf_edist_closure {α : Type u} [emetric_space α] {x : α} {s : set α} :

The edist to a set and to its closure coincide

theorem emetric.mem_closure_iff_inf_edist_zero {α : Type u} [emetric_space α] {x : α} {s : set α} :

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

theorem emetric.mem_iff_ind_edist_zero_of_closed {α : Type u} [emetric_space α] {x : α} {s : set α} :
is_closed s(x s emetric.inf_edist x s = 0)

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

theorem emetric.inf_edist_image {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] {x : α} {t : set α} {Φ : α → β} :

The infimum edistance is invariant under isometries

The Hausdorff distance as a function into ennreal.

def emetric.Hausdorff_edist {α : Type u} [emetric_space α] :
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

Equations
theorem emetric.Hausdorff_edist_def {α : Type u} [emetric_space α] (s t : set α) :
emetric.Hausdorff_edist s t = Sup ((λ (x : α), emetric.inf_edist x t) '' s) Sup ((λ (x : α), emetric.inf_edist x s) '' t)

@[simp]
theorem emetric.Hausdorff_edist_self {α : Type u} [emetric_space α] {s : set α} :

The Hausdorff edistance of a set to itself vanishes

The Haudorff edistances of s to t and of t to s coincide

theorem emetric.Hausdorff_edist_le_of_inf_edist {α : Type u} [emetric_space α] {s t : set α} {r : ennreal} :
(∀ (x : α), x semetric.inf_edist x t r)(∀ (x : α), x temetric.inf_edist x s r)emetric.Hausdorff_edist s t r

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

theorem emetric.Hausdorff_edist_le_of_mem_edist {α : Type u} [emetric_space α] {s t : set α} {r : ennreal} :
(∀ (x : α), x s(∃ (y : α) (H : y t), edist x y r))(∀ (x : α), x t(∃ (y : α) (H : y s), edist x y r))emetric.Hausdorff_edist 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 emetric.inf_edist_le_Hausdorff_edist_of_mem {α : Type u} [emetric_space α] {x : α} {s t : set α} :

The distance to a set is controlled by the Hausdorff distance

theorem emetric.exists_edist_lt_of_Hausdorff_edist_lt {α : Type u} [emetric_space α] {x : α} {s t : set α} {r : ennreal} :
x semetric.Hausdorff_edist s t < r(∃ (y : α) (H : 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

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

theorem emetric.Hausdorff_edist_image {α : Type u} {β : Type v} [emetric_space α] [emetric_space β] {s t : set α} {Φ : α → β} :

The Hausdorff edistance is invariant under eisometries

theorem emetric.Hausdorff_edist_le_ediam {α : Type u} [emetric_space α] {s t : set α} :

The Hausdorff distance is controlled by the diameter of the union

The Hausdorff distance satisfies the triangular inequality

@[simp]

The Hausdorff edistance between a set and its closure vanishes

@[simp]

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

@[simp]

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

@[simp]

The Hausdorff edistance between sets or their closures is the same

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

theorem emetric.Hausdorff_edist_zero_iff_eq_of_closed {α : Type u} [emetric_space α] {s t : set α} :

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

theorem emetric.Hausdorff_edist_empty {α : Type u} [emetric_space α] {s : set α} :

The Haudorff edistance to the empty set is infinite

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

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

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

def metric.inf_dist {α : Type u} [metric_space α] :
α → set α

The minimal distance of a point to a set

Equations
theorem metric.inf_dist_nonneg {α : Type u} [metric_space α] {s : set α} {x : α} :

the minimal distance is always nonnegative

@[simp]
theorem metric.inf_dist_empty {α : Type u} [metric_space α] {x : α} :

the minimal distance to the empty set is 0 (if you want to have the more reasonable value ∞ instead, use inf_edist, which takes values in ennreal)

theorem metric.inf_edist_ne_top {α : Type u} [metric_space α] {s : set α} {x : α} :

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

theorem metric.inf_dist_zero_of_mem {α : Type u} [metric_space α] {s : set α} {x : α} :
x smetric.inf_dist x s = 0

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

@[simp]
theorem metric.inf_dist_singleton {α : Type u} [metric_space α] {x y : α} :

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

theorem metric.inf_dist_le_dist_of_mem {α : Type u} [metric_space α] {s : set α} {x y : α} :
y smetric.inf_dist x s dist x y

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

theorem metric.inf_dist_le_inf_dist_of_subset {α : Type u} [metric_space α] {s t : set α} {x : α} :

The minimal distance is monotonous with respect to inclusion

theorem metric.exists_dist_lt_of_inf_dist_lt {α : Type u} [metric_space α] {s : set α} {x : α} {r : } :
metric.inf_dist x s < rs.nonempty(∃ (y : α) (H : y s), dist x y < r)

If the minimal distance to a set is <r, there exists a point in this set at distance <r

theorem metric.inf_dist_le_inf_dist_add_dist {α : Type u} [metric_space α] {s : set α} {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.lipschitz_inf_dist_pt {α : Type u} [metric_space α] (s : set α) :
lipschitz_with 1 (λ (x : α), metric.inf_dist x s)

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

theorem metric.uniform_continuous_inf_dist_pt {α : Type u} [metric_space α] (s : set α) :

The minimal distance to a set is uniformly continuous in point

theorem metric.continuous_inf_dist_pt {α : Type u} [metric_space α] (s : set α) :
continuous (λ (x : α), metric.inf_dist x s)

The minimal distance to a set is continuous in point

theorem metric.inf_dist_eq_closure {α : Type u} [metric_space α] {s : set α} {x : α} :

The minimal distance to a set and its closure coincide

theorem metric.mem_closure_iff_inf_dist_zero {α : Type u} [metric_space α] {s : set α} {x : α} :

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

theorem metric.mem_iff_inf_dist_zero_of_closed {α : Type u} [metric_space α] {s : set α} {x : α} :
is_closed ss.nonempty(x s metric.inf_dist x s = 0)

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

theorem metric.inf_dist_image {α : Type u} {β : Type v} [metric_space α] [metric_space β] {t : set α} {x : α} {Φ : α → β} :
isometry Φmetric.inf_dist (Φ x) '' t) = metric.inf_dist x t

The infimum distance is invariant under isometries

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

def metric.inf_nndist {α : Type u} [metric_space α] :
α → set αℝ≥0

The minimal distance of a point to a set as a nnreal

Equations
@[simp]
theorem metric.coe_inf_nndist {α : Type u} [metric_space α] {s : set α} {x : α} :

theorem metric.lipschitz_inf_nndist_pt {α : Type u} [metric_space α] (s : set α) :
lipschitz_with 1 (λ (x : α), metric.inf_nndist x s)

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

theorem metric.uniform_continuous_inf_nndist_pt {α : Type u} [metric_space α] (s : set α) :

The minimal distance to a set (as nnreal) is uniformly continuous in point

theorem metric.continuous_inf_nndist_pt {α : Type u} [metric_space α] (s : set α) :
continuous (λ (x : α), metric.inf_nndist x s)

The minimal distance to a set (as nnreal) is continuous in point

The Hausdorff distance as a function into .

def metric.Hausdorff_dist {α : Type u} [metric_space α] :
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

Equations
theorem metric.Hausdorff_dist_nonneg {α : Type u} [metric_space α] {s t : set α} :

The Hausdorff distance is nonnegative

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

@[simp]
theorem metric.Hausdorff_dist_self_zero {α : Type u} [metric_space α] {s : set α} :

The Hausdorff distance between a set and itself is zero

theorem metric.Hausdorff_dist_comm {α : Type u} [metric_space α] {s t : set α} :

The Hausdorff distance from s to t and from t to s coincide

@[simp]
theorem metric.Hausdorff_dist_empty {α : Type u} [metric_space α] {s : set α} :

The Hausdorff distance to the empty set vanishes (if you want to have the more reasonable value ∞ instead, use Hausdorff_edist, which takes values in ennreal)

@[simp]
theorem metric.Hausdorff_dist_empty' {α : Type u} [metric_space α] {s : set α} :

The Hausdorff distance to the empty set vanishes (if you want to have the more reasonable value ∞ instead, use Hausdorff_edist, which takes values in ennreal)

theorem metric.Hausdorff_dist_le_of_inf_dist {α : Type u} [metric_space α] {s t : set α} {r : } :
0 r(∀ (x : α), x smetric.inf_dist x t r)(∀ (x : α), x tmetric.inf_dist x s r)metric.Hausdorff_dist s t r

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

theorem metric.Hausdorff_dist_le_of_mem_dist {α : Type u} [metric_space α] {s t : set α} {r : } :
0 r(∀ (x : α), x s(∃ (y : α) (H : y t), dist x y r))(∀ (x : α), x t(∃ (y : α) (H : y s), dist x y r))metric.Hausdorff_dist 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.Hausdorff_dist_le_diam {α : Type u} [metric_space α] {s t : set α} :

The Hausdorff distance is controlled by the diameter of the union

theorem metric.inf_dist_le_Hausdorff_dist_of_mem {α : Type u} [metric_space α] {s t : set α} {x : α} :

The distance to a set is controlled by the Hausdorff distance

theorem metric.exists_dist_lt_of_Hausdorff_dist_lt {α : Type u} [metric_space α] {s t : set α} {x : α} {r : } :
x smetric.Hausdorff_dist s t < remetric.Hausdorff_edist s t (∃ (y : α) (H : y t), dist x y < r)

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

theorem metric.exists_dist_lt_of_Hausdorff_dist_lt' {α : Type u} [metric_space α] {s t : set α} {y : α} {r : } :
y tmetric.Hausdorff_dist s t < remetric.Hausdorff_edist s t (∃ (x : α) (H : x s), dist x y < r)

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

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

theorem metric.Hausdorff_dist_image {α : Type u} {β : Type v} [metric_space α] [metric_space β] {s t : set α} {Φ : α → β} :

The Hausdorff distance is invariant under isometries

The Hausdorff distance satisfies the triangular inequality

The Hausdorff distance satisfies the triangular inequality

@[simp]
theorem metric.Hausdorff_dist_self_closure {α : Type u} [metric_space α] {s : set α} :

The Hausdorff distance between a set and its closure vanish

@[simp]

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

@[simp]

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

@[simp]

The Hausdorff distance between two sets and their closures coincide

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

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