l3lab/ntp-mathlib huggingface dataset:
theorem infDist_eq_iInf : infDist x s = ⨅ y : s, dist x y := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infDist x s = ⨅ y, dist x ↑y

Next tactic:
rw [infDist, infEdist, iInf_subtype', ENNReal.toReal_iInf]
theorem infDist_eq_iInf : infDist x s = ⨅ y : s, dist x y := by
  rw [infDist, infEdist, iInf_subtype', ENNReal.toReal_iInf]
  · 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ ⨅ i, ENNReal.toReal (edist x ↑i) = ⨅ y, dist x ↑y

Next tactic:
simp only [dist_edist]
theorem infDist_eq_iInf : infDist x s = ⨅ y : s, dist x y := by
  rw [infDist, infEdist, iInf_subtype', ENNReal.toReal_iInf]
  · simp only [dist_edist]
  · 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ ∀ (i : { y // y ∈ s }), edist x ↑i ≠ ⊤

Next tactic:
exact fun _ ↦ edist_ne_top _ _
/-- The minimal distance to the empty set is 0 (if you want to have the more reasonable
value `∞` instead, use `EMetric.infEdist`, which takes values in `ℝ≥0∞`) -/
@[simp]
theorem infDist_empty : infDist x ∅ = 0 := by 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infDist x ∅ = 0

Next tactic:
simp [infDist]
/-- In a metric space, the minimal edistance to a nonempty set is finite. -/
theorem infEdist_ne_top (h : s.Nonempty) : infEdist x s ≠ ⊤ := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : Set.Nonempty s
⊢ infEdist x s ≠ ⊤

Next tactic:
rcases h with ⟨y, hy⟩
/-- In a metric space, the minimal edistance to a nonempty set is finite. -/
theorem infEdist_ne_top (h : s.Nonempty) : infEdist x s ≠ ⊤ := by
  rcases h with ⟨y, hy⟩
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y✝ : α
Φ : α → β
y : α
hy : y ∈ s
⊢ infEdist x s ≠ ⊤

Next tactic:
exact ne_top_of_le_ne_top (edist_ne_top _ _) (infEdist_le_edist_of_mem hy)
theorem infEdist_eq_top_iff : infEdist x s = ∞ ↔ s = ∅ := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infEdist x s = ⊤ ↔ s = ∅

Next tactic:
rcases s.eq_empty_or_nonempty with rfl | hs
theorem infEdist_eq_top_iff : infEdist x s = ∞ ↔ s = ∅ := by
  rcases s.eq_empty_or_nonempty with rfl | hs <;> 

Proof state:
case inl
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
t u : Set α
x y : α
Φ : α → β
⊢ infEdist x ∅ = ⊤ ↔ ∅ = ∅

Next tactic:
simp [*, Nonempty.ne_empty, infEdist_ne_top]
theorem infEdist_eq_top_iff : infEdist x s = ∞ ↔ s = ∅ := by
  rcases s.eq_empty_or_nonempty with rfl | hs <;> 

Proof state:
case inr
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hs : Set.Nonempty s
⊢ infEdist x s = ⊤ ↔ s = ∅

Next tactic:
simp [*, Nonempty.ne_empty, infEdist_ne_top]
/-- The minimal distance of a point to a set containing it vanishes -/
theorem infDist_zero_of_mem (h : x ∈ s) : infDist x s = 0 := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : x ∈ s
⊢ infDist x s = 0

Next tactic:
simp [infEdist_zero_of_mem h, infDist]
/-- The minimal distance to a singleton is the distance to the unique point in this singleton -/
@[simp]
theorem infDist_singleton : infDist x {y} = dist x y := by 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infDist x {y} = dist x y

Next tactic:
simp [infDist, dist_edist]
/-- The minimal distance to a set is bounded by the distance to any point in this set -/
theorem infDist_le_dist_of_mem (h : y ∈ s) : infDist x s ≤ dist x y := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s
⊢ infDist x s ≤ dist x y

Next tactic:
rw [dist_edist, infDist]
/-- The minimal distance to a set is bounded by the distance to any point in this set -/
theorem infDist_le_dist_of_mem (h : y ∈ s) : infDist x s ≤ dist x y := by
  rw [dist_edist, infDist]
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s
⊢ ENNReal.toReal (infEdist x s) ≤ ENNReal.toReal (edist x y)

Next tactic:
exact ENNReal.toReal_mono (edist_ne_top _ _) (infEdist_le_edist_of_mem h)
/-- The minimal distance to a set is `< r` iff there exists a point in this set at distance `< r` -/
theorem infDist_lt_iff {r : ℝ} (hs : s.Nonempty) : infDist x s < r ↔ ∃ y ∈ s, dist x y < r := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
r : ℝ
hs : Set.Nonempty s
⊢ infDist x s < r ↔ ∃ y ∈ s, dist x y < r

Next tactic:
simp_rw [infDist, ← ENNReal.lt_ofReal_iff_toReal_lt (infEdist_ne_top hs), infEdist_lt_iff,
    ENNReal.lt_ofReal_iff_toReal_lt (edist_ne_top _ _), ← dist_edist]
/-- The minimal distance from `x` to `s` is bounded by the distance from `y` to `s`, modulo
the distance between `x` and `y` -/
theorem infDist_le_infDist_add_dist : infDist x s ≤ infDist y s + dist x y := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infDist x s ≤ infDist y s + dist x y

Next tactic:
rw [infDist, infDist, dist_edist]
/-- The minimal distance from `x` to `s` is bounded by the distance from `y` to `s`, modulo
the distance between `x` and `y` -/
theorem infDist_le_infDist_add_dist : infDist x s ≤ infDist y s + dist x y := by
  rw [infDist, infDist, dist_edist]
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ ENNReal.toReal (infEdist x s) ≤ ENNReal.toReal (infEdist y s) + ENNReal.toReal (edist x y)

Next tactic:
refine ENNReal.toReal_le_add' infEdist_le_infEdist_add_edist ?_ (flip absurd (edist_ne_top _ _))
/-- The minimal distance from `x` to `s` is bounded by the distance from `y` to `s`, modulo
the distance between `x` and `y` -/
theorem infDist_le_infDist_add_dist : infDist x s ≤ infDist y s + dist x y := by
  rw [infDist, infDist, dist_edist]
  refine ENNReal.toReal_le_add' infEdist_le_infEdist_add_edist ?_ (flip absurd (edist_ne_top _ _))
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infEdist y s = ⊤ → infEdist x s = ⊤

Next tactic:
simp only [infEdist_eq_top_iff, imp_self]
theorem dist_le_infDist_add_diam (hs : IsBounded s) (hy : y ∈ s) :
    dist x y ≤ infDist x s + diam s := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hs : Bornology.IsBounded s
hy : y ∈ s
⊢ dist x y ≤ infDist x s + diam s

Next tactic:
rw [infDist, diam, dist_edist]
theorem dist_le_infDist_add_diam (hs : IsBounded s) (hy : y ∈ s) :
    dist x y ≤ infDist x s + diam s := by
  rw [infDist, diam, dist_edist]
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hs : Bornology.IsBounded s
hy : y ∈ s
⊢ ENNReal.toReal (edist x y) ≤ ENNReal.toReal (infEdist x s) + ENNReal.toReal (EMetric.diam s)

Next tactic:
exact toReal_le_add (edist_le_infEdist_add_ediam hy) (infEdist_ne_top ⟨y, hy⟩) hs.ediam_ne_top
/-- The minimal distance to a set and its closure coincide -/
theorem infDist_closure : infDist x (closure s) = infDist x s := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ infDist x (closure s) = infDist x s

Next tactic:
simp [infDist, infEdist_closure]
/-- 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 infDist_zero_of_mem_closure (hx : x ∈ closure s) : infDist x s = 0 := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hx : x ∈ closure s
⊢ infDist x s = 0

Next tactic:
rw [← infDist_closure]
/-- 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 infDist_zero_of_mem_closure (hx : x ∈ closure s) : infDist x s = 0 := by
  rw [← infDist_closure]
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hx : x ∈ closure s
⊢ infDist x (closure s) = 0

Next tactic:
exact infDist_zero_of_mem hx
/-- A point belongs to the closure of `s` iff its infimum distance to this set vanishes -/
theorem mem_closure_iff_infDist_zero (h : s.Nonempty) : x ∈ closure s ↔ infDist x s = 0 := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : Set.Nonempty s
⊢ x ∈ closure s ↔ infDist x s = 0

Next tactic:
simp [mem_closure_iff_infEdist_zero, infDist, ENNReal.toReal_eq_zero_iff, infEdist_ne_top h]
/-- Given a closed set `s`, a point belongs to `s` iff its infimum distance to this set vanishes -/
theorem _root_.IsClosed.mem_iff_infDist_zero (h : IsClosed s) (hs : s.Nonempty) :
    x ∈ s ↔ infDist x s = 0 := by 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : IsClosed s
hs : Set.Nonempty s
⊢ x ∈ s ↔ infDist x s = 0

Next tactic:
rw [← mem_closure_iff_infDist_zero hs, h.closure_eq]
/-- Given a closed set `s`, a point belongs to `s` iff its infimum distance to this set vanishes -/
theorem _root_.IsClosed.not_mem_iff_infDist_pos (h : IsClosed s) (hs : s.Nonempty) :
    x ∉ s ↔ 0 < infDist x s := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : IsClosed s
hs : Set.Nonempty s
⊢ x ∉ s ↔ 0 < infDist x s

Next tactic:
simp [h.mem_iff_infDist_zero hs, infDist_nonneg.gt_iff_ne]
theorem continuousAt_inv_infDist_pt (h : x ∉ closure s) :
    ContinuousAt (fun x ↦ (infDist x s)⁻¹) x := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : x ∉ closure s
⊢ ContinuousAt (fun x => (infDist x s)⁻¹) x

Next tactic:
rcases s.eq_empty_or_nonempty with (rfl | hs)
theorem continuousAt_inv_infDist_pt (h : x ∉ closure s) :
    ContinuousAt (fun x ↦ (infDist x s)⁻¹) x := by
  rcases s.eq_empty_or_nonempty with (rfl | hs)
  · 

Proof state:
case inl
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
t u : Set α
x y : α
Φ : α → β
h : x ∉ closure ∅
⊢ ContinuousAt (fun x => (infDist x ∅)⁻¹) x

Next tactic:
simp only [infDist_empty, continuousAt_const]
theorem continuousAt_inv_infDist_pt (h : x ∉ closure s) :
    ContinuousAt (fun x ↦ (infDist x s)⁻¹) x := by
  rcases s.eq_empty_or_nonempty with (rfl | hs)
  · simp only [infDist_empty, continuousAt_const]
  · 

Proof state:
case inr
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : x ∉ closure s
hs : Set.Nonempty s
⊢ ContinuousAt (fun x => (infDist x s)⁻¹) x

Next tactic:
refine (continuous_infDist_pt s).continuousAt.inv₀ ?_
theorem continuousAt_inv_infDist_pt (h : x ∉ closure s) :
    ContinuousAt (fun x ↦ (infDist x s)⁻¹) x := by
  rcases s.eq_empty_or_nonempty with (rfl | hs)
  · simp only [infDist_empty, continuousAt_const]
  · refine (continuous_infDist_pt s).continuousAt.inv₀ ?_
    

Proof state:
case inr
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : x ∉ closure s
hs : Set.Nonempty s
⊢ infDist x s ≠ 0

Next tactic:
rwa [Ne.def, ← mem_closure_iff_infDist_zero hs]
/-- The infimum distance is invariant under isometries -/
theorem infDist_image (hΦ : Isometry Φ) : infDist (Φ x) (Φ '' t) = infDist x t := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
hΦ : Isometry Φ
⊢ infDist (Φ x) (Φ '' t) = infDist x t

Next tactic:
simp [infDist, infEdist_image hΦ]
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s
⊢ infDist x (s ∩ closedBall x (dist y x)) = infDist x s

Next tactic:
replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
⊢ infDist x (s ∩ closedBall x (dist y x)) = infDist x s

Next tactic:
refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
⊢ infDist x (s ∩ closedBall x (dist y x)) ≤ infDist x s

Next tactic:
refine' not_lt.1 fun hlt => _
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  refine' not_lt.1 fun hlt => _
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
hlt : infDist x s < infDist x (s ∩ closedBall x (dist y x))
⊢ False

Next tactic:
rcases (infDist_lt_iff ⟨y, h.1⟩).mp hlt with ⟨z, hzs, hz⟩
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  refine' not_lt.1 fun hlt => _
  rcases (infDist_lt_iff ⟨y, h.1⟩).mp hlt with ⟨z, hzs, hz⟩
  

Proof state:
case intro.intro
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
hlt : infDist x s < infDist x (s ∩ closedBall x (dist y x))
z : α
hzs : z ∈ s
hz : dist x z < infDist x (s ∩ closedBall x (dist y x))
⊢ False

Next tactic:
rcases le_or_lt (dist z x) (dist y x) with hle | hlt
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  refine' not_lt.1 fun hlt => _
  rcases (infDist_lt_iff ⟨y, h.1⟩).mp hlt with ⟨z, hzs, hz⟩
  rcases le_or_lt (dist z x) (dist y x) with hle | hlt
  · 

Proof state:
case intro.intro.inl
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
hlt : infDist x s < infDist x (s ∩ closedBall x (dist y x))
z : α
hzs : z ∈ s
hz : dist x z < infDist x (s ∩ closedBall x (dist y x))
hle : dist z x ≤ dist y x
⊢ False

Next tactic:
exact hz.not_le (infDist_le_dist_of_mem ⟨hzs, hle⟩)
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  refine' not_lt.1 fun hlt => _
  rcases (infDist_lt_iff ⟨y, h.1⟩).mp hlt with ⟨z, hzs, hz⟩
  rcases le_or_lt (dist z x) (dist y x) with hle | hlt
  · exact hz.not_le (infDist_le_dist_of_mem ⟨hzs, hle⟩)
  · 

Proof state:
case intro.intro.inr
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
hlt✝ : infDist x s < infDist x (s ∩ closedBall x (dist y x))
z : α
hzs : z ∈ s
hz : dist x z < infDist x (s ∩ closedBall x (dist y x))
hlt : dist y x < dist z x
⊢ False

Next tactic:
rw [dist_comm z, dist_comm y] at hlt
theorem infDist_inter_closedBall_of_mem (h : y ∈ s) :
    infDist x (s ∩ closedBall x (dist y x)) = infDist x s := by
  replace h : y ∈ s ∩ closedBall x (dist y x) := ⟨h, mem_closedBall.2 le_rfl⟩
  refine le_antisymm ?_ (infDist_le_infDist_of_subset (inter_subset_left _ _) ⟨y, h⟩)
  refine' not_lt.1 fun hlt => _
  rcases (infDist_lt_iff ⟨y, h.1⟩).mp hlt with ⟨z, hzs, hz⟩
  rcases le_or_lt (dist z x) (dist y x) with hle | hlt
  · exact hz.not_le (infDist_le_dist_of_mem ⟨hzs, hle⟩)
  · rw [dist_comm z, dist_comm y] at hlt
    

Proof state:
case intro.intro.inr
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
h : y ∈ s ∩ closedBall x (dist y x)
hlt✝ : infDist x s < infDist x (s ∩ closedBall x (dist y x))
z : α
hzs : z ∈ s
hz : dist x z < infDist x (s ∩ closedBall x (dist y x))
hlt : dist x y < dist x z
⊢ False

Next tactic:
exact (hlt.trans hz).not_le (infDist_le_dist_of_mem h)
theorem _root_.IsCompact.exists_infDist_eq_dist (h : IsCompact s) (hne : s.Nonempty) (x : α) :
    ∃ y ∈ s, infDist x s = dist x y :=
  let ⟨y, hys, hy⟩ := h.exists_infEdist_eq_edist hne x
  ⟨y, hys, by 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x✝ y✝ : α
Φ : α → β
h : IsCompact s
hne : Set.Nonempty s
x y : α
hys : y ∈ s
hy : infEdist x s = edist x y
⊢ infDist x s = dist x y

Next tactic:
rw [infDist, dist_edist, hy]
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
hne : Set.Nonempty s
x : α
⊢ ∃ y ∈ s, infDist x s = dist x y

Next tactic:
rcases hne with ⟨z, hz⟩
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
⊢ ∃ y ∈ s, infDist x s = dist x y

Next tactic:
rw [← infDist_inter_closedBall_of_mem hz]
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  rw [← infDist_inter_closedBall_of_mem hz]
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
⊢ ∃ y ∈ s, infDist x (s ∩ closedBall x (dist z x)) = dist x y

Next tactic:
set t := s ∩ closedBall x (dist z x)
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  rw [← infDist_inter_closedBall_of_mem hz]
  set t := s ∩ closedBall x (dist z x)
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t✝ u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
t : Set α := s ∩ closedBall x (dist z x)
⊢ ∃ y ∈ s, infDist x t = dist x y

Next tactic:
have htc : IsCompact t := (isCompact_closedBall x (dist z x)).inter_left h
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  rw [← infDist_inter_closedBall_of_mem hz]
  set t := s ∩ closedBall x (dist z x)
  have htc : IsCompact t := (isCompact_closedBall x (dist z x)).inter_left h
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t✝ u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
t : Set α := s ∩ closedBall x (dist z x)
htc : IsCompact t
⊢ ∃ y ∈ s, infDist x t = dist x y

Next tactic:
have htne : t.Nonempty := ⟨z, hz, mem_closedBall.2 le_rfl⟩
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  rw [← infDist_inter_closedBall_of_mem hz]
  set t := s ∩ closedBall x (dist z x)
  have htc : IsCompact t := (isCompact_closedBall x (dist z x)).inter_left h
  have htne : t.Nonempty := ⟨z, hz, mem_closedBall.2 le_rfl⟩
  

Proof state:
case intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t✝ u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
t : Set α := s ∩ closedBall x (dist z x)
htc : IsCompact t
htne : Set.Nonempty t
⊢ ∃ y ∈ s, infDist x t = dist x y

Next tactic:
obtain ⟨y, ⟨hys, -⟩, hyd⟩ : ∃ y ∈ t, infDist x t = dist x y := htc.exists_infDist_eq_dist htne x
theorem _root_.IsClosed.exists_infDist_eq_dist [ProperSpace α] (h : IsClosed s) (hne : s.Nonempty)
    (x : α) : ∃ y ∈ s, infDist x s = dist x y := by
  rcases hne with ⟨z, hz⟩
  rw [← infDist_inter_closedBall_of_mem hz]
  set t := s ∩ closedBall x (dist z x)
  have htc : IsCompact t := (isCompact_closedBall x (dist z x)).inter_left h
  have htne : t.Nonempty := ⟨z, hz, mem_closedBall.2 le_rfl⟩
  obtain ⟨y, ⟨hys, -⟩, hyd⟩ : ∃ y ∈ t, infDist x t = dist x y := htc.exists_infDist_eq_dist htne x
  

Proof state:
case intro.intro.intro.intro
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t✝ u : Set α
x✝ y✝ : α
Φ : α → β
inst✝ : ProperSpace α
h : IsClosed s
x z : α
hz : z ∈ s
t : Set α := s ∩ closedBall x (dist z x)
htc : IsCompact t
htne : Set.Nonempty t
y : α
hyd : infDist x t = dist x y
hys : y ∈ s
⊢ ∃ y ∈ s, infDist x t = dist x y

Next tactic:
exact ⟨y, hys, hyd⟩
theorem exists_mem_closure_infDist_eq_dist [ProperSpace α] (hne : s.Nonempty) (x : α) :
    ∃ y ∈ closure s, infDist x s = dist x y := by
  

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝² : PseudoMetricSpace α
inst✝¹ : PseudoMetricSpace β
s t u : Set α
x✝ y : α
Φ : α → β
inst✝ : ProperSpace α
hne : Set.Nonempty s
x : α
⊢ ∃ y ∈ closure s, infDist x s = dist x y

Next tactic:
simpa only [infDist_closure] using isClosed_closure.exists_infDist_eq_dist hne.closure x
/-- The Hausdorff distance is nonnegative -/
theorem hausdorffDist_nonneg : 0 ≤ hausdorffDist s t := by 

Proof state:
ι : Sort u_1
α : Type u
β : Type v
inst✝¹ : PseudoMetricSpace α
inst✝ : PseudoMetricSpace β
s t u : Set α
x y : α
Φ : α → β
⊢ 0 ≤ hausdorffDist s t

Next tactic:
simp [hausdorffDist]