Lean library · module TopologyByExample.Theorems.BoundedClosedHausdorff

Hausdorff metric on nonempty bounded closed subsets

Source file

This file was written by Codex (OpenAI's AI model) working under the direction of David R. MacIver, who reviews it and is responsible for it.

Imports
variable (X : Type*) [MetricSpace X]

definition Space

TopologyByExample.BoundedClosedHausdorff.Space

All nonempty bounded closed subsets, without a compactness assumption.

def Space
:= {s : Closeds X // (s : Set X).Nonempty ∧ IsBounded (s : Set X)}
variable {X}

definition carrier

TopologyByExample.BoundedClosedHausdorff.carrier

The underlying subset.

def carrier (s : Space X) : Set X
:= s.val

theorem finite_distance

TopologyByExample.BoundedClosedHausdorff.finite_distance

Hausdorff extended distance is finite on this carrier.

theorem finite_distance (s t : Space X) : hausdorffEDist (carrier s) (carrier t) ≠ ⊤
Proof
:=
  hausdorffEDist_ne_top_of_nonempty_of_bounded s.property.1 t.property.1
    s.property.2 t.property.2

instance

The restriction of the Hausdorff extended metric to the exact source carrier.

instance : EMetricSpace (Space X)
Proof
:= inferInstanceAs (EMetricSpace
  {s : Closeds X // (s : Set X).Nonempty ∧ IsBounded (s : Set X)})

instance

Finiteness makes the restricted extended metric a metric.

instance : MetricSpace (Space X)
Proof
:= EMetricSpace.toMetricSpace finite_distance

theorem dist_eq

TopologyByExample.BoundedClosedHausdorff.dist_eq

Its distance is the Hausdorff distance between the underlying sets.

theorem dist_eq (s t : Space X) : dist s t = hausdorffDist (carrier s) (carrier t)
Proof
:= rfl

definition directed

TopologyByExample.BoundedClosedHausdorff.directed

The directed distance between two nonempty bounded closed sets.

def directed (s t : Space X) : ℝ
:= sSup ((fun x ↦ infDist x (carrier t)) '' carrier s)

theorem directed_bddAbove

TopologyByExample.BoundedClosedHausdorff.directed_bddAbove

The directed-distance supremum is over a bounded set.

theorem directed_bddAbove (s t : Space X) :
    BddAbove ((fun x ↦ infDist x (carrier t)) '' carrier s)
Proof
:= by
  refine ⟨hausdorffDist (carrier s) (carrier t), ?_⟩
  rintro _ ⟨x, hx, rfl⟩
  exact infDist_le_hausdorffDist_of_mem hx (finite_distance s t)

theorem infDist_le_directed

TopologyByExample.BoundedClosedHausdorff.infDist_le_directed

Each point-to-set distance is bounded by the directed distance.

theorem infDist_le_directed (s t : Space X) {x : X} (hx : x ∈ carrier s) :
    infDist x (carrier t) ≤ directed s t
Proof
:=
  le_csSup (directed_bddAbove s t) ⟨x, hx, rfl⟩

theorem directed_nonneg

TopologyByExample.BoundedClosedHausdorff.directed_nonneg

The directed distance is nonnegative.

theorem directed_nonneg (s t : Space X) : 0 ≤ directed s t
Proof
:= by
  obtain ⟨x, hx⟩ := s.property.1
  exact infDist_nonneg.trans (infDist_le_directed s t hx)

theorem directed_le_distance

TopologyByExample.BoundedClosedHausdorff.directed_le_distance

Each directed distance is bounded by Hausdorff distance.

theorem directed_le_distance (s t : Space X) : directed s t ≤ dist s t
Proof
:= by
  apply csSup_le (s.property.1.image _)
  rintro _ ⟨x, hx, rfl⟩
  exact infDist_le_hausdorffDist_of_mem hx (finite_distance s t)

theorem dist_eq_max

TopologyByExample.BoundedClosedHausdorff.dist_eq_max

The metric is exactly the maximum of the two directed distances.

theorem dist_eq_max (s t : Space X) : dist s t = max (directed s t) (directed t s)
Proof
:= by
  apply le_antisymm
  · apply hausdorffDist_le_of_infDist ((directed_nonneg s t).trans (le_max_left _ _))
    · intro x hx
      exact (infDist_le_directed s t hx).trans (le_max_left _ _)
    · intro x hx
      exact (infDist_le_directed t s hx).trans (le_max_right _ _)
  · exact max_le (directed_le_distance s t)
      (by simpa only [dist_comm] using directed_le_distance t s)

theorem infDist_formula

TopologyByExample.BoundedClosedHausdorff.infDist_formula

Point-to-set distance has the exact infimum formula.

theorem infDist_formula (x : X) (s : Space X) :
    infDist x (carrier s) = ⨅ y : carrier s, dist x y
Proof
:= infDist_eq_iInf

theorem dist_formula

TopologyByExample.BoundedClosedHausdorff.dist_formula

The complete supremum-of-infima formula for the source metric.

theorem dist_formula (s t : Space X) :
    dist s t = max
      (sSup ((fun x : X ↦ ⨅ y : carrier t, dist x (y : X)) '' carrier s))
      (sSup ((fun y : X ↦ ⨅ x : carrier s, dist y (x : X)) '' carrier t))
Proof
:= by
  simp only [dist_eq_max, directed, infDist_eq_iInf]

On this site: Theorem: Nonempty bounded closed subsets carry the Hausdorff metric

instance

An empty ambient space has an empty hyperspace.

instance [IsEmpty X] : IsEmpty (Space X)
Proof
:= ⟨fun s ↦ by
  obtain ⟨x, _⟩ := s.property.1
  exact isEmptyElim x⟩