l3lab/ntp-mathlib huggingface dataset:
/-- If a function is continuous at every point of a compact set `k`, then it is bounded on
some open neighborhood of `k`. -/
theorem exists_isOpen_isBounded_image_of_isCompact_of_forall_continuousAt [TopologicalSpace β]
    {k : Set β} {f : β → α} (hk : IsCompact k) (hf : ∀ x ∈ k, ContinuousAt f x) :
    ∃ t, k ⊆ t ∧ IsOpen t ∧ IsBounded (f '' t) := by
  simp_rw [← continuousWithinAt_univ] at hf
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
x : α
s t : Set α
r : ℝ
inst✝ : TopologicalSpace β
k : Set β
f : β → α
hk : IsCompact k
hf : ∀ x ∈ k, ContinuousWithinAt f univ x
⊢ ∃ t, k ⊆ t ∧ IsOpen t ∧ IsBounded (f '' t)

Next tactic:
simpa only [inter_univ] using
    exists_isOpen_isBounded_image_inter_of_isCompact_of_forall_continuousWithinAt hk hf
/-- The **Heine–Borel theorem**: In a proper space, a closed bounded set is compact. -/
theorem isCompact_of_isClosed_isBounded [ProperSpace α] (hc : IsClosed s) (hb : IsBounded s) :
    IsCompact s := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
x : α
s t : Set α
r : ℝ
inst✝ : ProperSpace α
hc : IsClosed s
hb : IsBounded s
⊢ IsCompact s

Next tactic:
rcases eq_empty_or_nonempty s with (rfl | ⟨x, -⟩)
/-- The **Heine–Borel theorem**: In a proper space, a closed bounded set is compact. -/
theorem isCompact_of_isClosed_isBounded [ProperSpace α] (hc : IsClosed s) (hb : IsBounded s) :
    IsCompact s := by
  rcases eq_empty_or_nonempty s with (rfl | ⟨x, -⟩)
  · 

Proof state:
case inl
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
x : α
t : Set α
r : ℝ
inst✝ : ProperSpace α
hc : IsClosed ∅
hb : IsBounded ∅
⊢ IsCompact ∅

Next tactic:
exact isCompact_empty
/-- The **Heine–Borel theorem**: In a proper space, a closed bounded set is compact. -/
theorem isCompact_of_isClosed_isBounded [ProperSpace α] (hc : IsClosed s) (hb : IsBounded s) :
    IsCompact s := by
  rcases eq_empty_or_nonempty s with (rfl | ⟨x, -⟩)
  · exact isCompact_empty
  · 

Proof state:
case inr.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
x✝ : α
s t : Set α
r : ℝ
inst✝ : ProperSpace α
hc : IsClosed s
hb : IsBounded s
x : α
⊢ IsCompact s

Next tactic:
rcases hb.subset_closedBall x with ⟨r, hr⟩
/-- The **Heine–Borel theorem**: In a proper space, a closed bounded set is compact. -/
theorem isCompact_of_isClosed_isBounded [ProperSpace α] (hc : IsClosed s) (hb : IsBounded s) :
    IsCompact s := by
  rcases eq_empty_or_nonempty s with (rfl | ⟨x, -⟩)
  · exact isCompact_empty
  · rcases hb.subset_closedBall x with ⟨r, hr⟩
    

Proof state:
case inr.intro.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
x✝ : α
s t : Set α
r✝ : ℝ
inst✝ : ProperSpace α
hc : IsClosed s
hb : IsBounded s
x : α
r : ℝ
hr : s ⊆ closedBall x r
⊢ IsCompact s

Next tactic:
exact (isCompact_closedBall x r).of_isClosed_subset hc hr
theorem diam_subsingleton (hs : s.Subsingleton) : diam s = 0 := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
hs : Set.Subsingleton s
⊢ diam s = 0

Next tactic:
simp only [diam, EMetric.diam_subsingleton hs, ENNReal.zero_toReal]
theorem diam_pair : diam ({x, y} : Set α) = dist x y := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ diam {x, y} = dist x y

Next tactic:
simp only [diam, EMetric.diam_pair, dist_edist]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ diam {x, y, z} = max (max (dist x y) (dist x z)) (dist y z)

Next tactic:
simp only [Metric.diam, EMetric.diam_triple, dist_edist]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  simp only [Metric.diam, EMetric.diam_triple, dist_edist]
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ ENNReal.toReal (max (max (edist x y) (edist x z)) (edist y z)) =
    max (max (ENNReal.toReal (edist x y)) (ENNReal.toReal (edist x z))) (ENNReal.toReal (edist y z))

Next tactic:
rw [ENNReal.toReal_max, ENNReal.toReal_max]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  simp only [Metric.diam, EMetric.diam_triple, dist_edist]
  rw [ENNReal.toReal_max, ENNReal.toReal_max] <;> 

Proof state:
case hr
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ edist x y ≠ ⊤

Next tactic:
apply_rules [ne_of_lt, edist_lt_top, max_lt]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  simp only [Metric.diam, EMetric.diam_triple, dist_edist]
  rw [ENNReal.toReal_max, ENNReal.toReal_max] <;> 

Proof state:
case hp
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ edist x z ≠ ⊤

Next tactic:
apply_rules [ne_of_lt, edist_lt_top, max_lt]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  simp only [Metric.diam, EMetric.diam_triple, dist_edist]
  rw [ENNReal.toReal_max, ENNReal.toReal_max] <;> 

Proof state:
case hr
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ max (edist x y) (edist x z) ≠ ⊤

Next tactic:
apply_rules [ne_of_lt, edist_lt_top, max_lt]
theorem diam_triple :
    Metric.diam ({x, y, z} : Set α) = max (max (dist x y) (dist x z)) (dist y z) := by
  simp only [Metric.diam, EMetric.diam_triple, dist_edist]
  rw [ENNReal.toReal_max, ENNReal.toReal_max] <;> 

Proof state:
case hp
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
⊢ edist y z ≠ ⊤

Next tactic:
apply_rules [ne_of_lt, edist_lt_top, max_lt]
/-- The distance between two points in a set is controlled by the diameter of the set. -/
theorem dist_le_diam_of_mem' (h : EMetric.diam s ≠ ⊤) (hx : x ∈ s) (hy : y ∈ s) :
    dist x y ≤ diam s := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
h : EMetric.diam s ≠ ⊤
hx : x ∈ s
hy : y ∈ s
⊢ dist x y ≤ diam s

Next tactic:
rw [diam, dist_edist]
/-- The distance between two points in a set is controlled by the diameter of the set. -/
theorem dist_le_diam_of_mem' (h : EMetric.diam s ≠ ⊤) (hx : x ∈ s) (hy : y ∈ s) :
    dist x y ≤ diam s := by
  rw [diam, dist_edist]
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
h : EMetric.diam s ≠ ⊤
hx : x ∈ s
hy : y ∈ s
⊢ ENNReal.toReal (edist x y) ≤ ENNReal.toReal (EMetric.diam s)

Next tactic:
rw [ENNReal.toReal_le_toReal (edist_ne_top _ _) h]
/-- The distance between two points in a set is controlled by the diameter of the set. -/
theorem dist_le_diam_of_mem' (h : EMetric.diam s ≠ ⊤) (hx : x ∈ s) (hy : y ∈ s) :
    dist x y ≤ diam s := by
  rw [diam, dist_edist]
  rw [ENNReal.toReal_le_toReal (edist_ne_top _ _) h]
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
h : EMetric.diam s ≠ ⊤
hx : x ∈ s
hy : y ∈ s
⊢ edist x y ≤ EMetric.diam s

Next tactic:
exact EMetric.edist_le_diam_of_mem hx hy
theorem ediam_univ_eq_top_iff_noncompact [ProperSpace α] :
    EMetric.diam (univ : Set α) = ∞ ↔ NoncompactSpace α := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝¹ : PseudoMetricSpace α
s : Set α
x y z : α
inst✝ : ProperSpace α
⊢ EMetric.diam univ = ⊤ ↔ NoncompactSpace α

Next tactic:
rw [← not_compactSpace_iff, compactSpace_iff_isBounded_univ, isBounded_iff_ediam_ne_top,
    Classical.not_not]
@[simp]
theorem diam_univ_of_noncompact [ProperSpace α] [NoncompactSpace α] : diam (univ : Set α) = 0 := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝² : PseudoMetricSpace α
s : Set α
x y z : α
inst✝¹ : ProperSpace α
inst✝ : NoncompactSpace α
⊢ diam univ = 0

Next tactic:
simp [diam]
/-- An unbounded set has zero diameter. If you would prefer to get the value ∞, use `EMetric.diam`.
This lemma makes it possible to avoid side conditions in some situations -/
theorem diam_eq_zero_of_unbounded (h : ¬IsBounded s) : diam s = 0 := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
h : ¬IsBounded s
⊢ diam s = 0

Next tactic:
rw [diam, ediam_of_unbounded h, ENNReal.top_toReal]
/-- The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if `s ∪ t` is unbounded. -/
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
    diam (s ∪ t) ≤ diam s + dist x y + diam t := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
xs : x ∈ s
yt : y ∈ t
⊢ diam (s ∪ t) ≤ diam s + dist x y + diam t

Next tactic:
simp only [diam, dist_edist]
/-- The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if `s ∪ t` is unbounded. -/
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
    diam (s ∪ t) ≤ diam s + dist x y + diam t := by
  simp only [diam, dist_edist]
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
xs : x ∈ s
yt : y ∈ t
⊢ ENNReal.toReal (EMetric.diam (s ∪ t)) ≤
    ENNReal.toReal (EMetric.diam s) + ENNReal.toReal (edist x y) + ENNReal.toReal (EMetric.diam t)

Next tactic:
refine (ENNReal.toReal_le_add' (EMetric.diam_union xs yt) ?_ ?_).trans
    (add_le_add_right ENNReal.toReal_add_le _)
/-- The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if `s ∪ t` is unbounded. -/
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
    diam (s ∪ t) ≤ diam s + dist x y + diam t := by
  simp only [diam, dist_edist]
  refine (ENNReal.toReal_le_add' (EMetric.diam_union xs yt) ?_ ?_).trans
    (add_le_add_right ENNReal.toReal_add_le _)
  · 

Proof state:
case refine_1
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
xs : x ∈ s
yt : y ∈ t
⊢ EMetric.diam s + edist x y = ⊤ → EMetric.diam (s ∪ t) = ⊤

Next tactic:
simp only [ENNReal.add_eq_top, edist_ne_top, or_false]
/-- The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if `s ∪ t` is unbounded. -/
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
    diam (s ∪ t) ≤ diam s + dist x y + diam t := by
  simp only [diam, dist_edist]
  refine (ENNReal.toReal_le_add' (EMetric.diam_union xs yt) ?_ ?_).trans
    (add_le_add_right ENNReal.toReal_add_le _)
  · simp only [ENNReal.add_eq_top, edist_ne_top, or_false]
    

Proof state:
case refine_1
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
xs : x ∈ s
yt : y ∈ t
⊢ EMetric.diam s = ⊤ → EMetric.diam (s ∪ t) = ⊤

Next tactic:
exact fun h ↦ top_unique <| h ▸ EMetric.diam_mono (subset_union_left _ _)
/-- The diameter of a union is controlled by the sum of the diameters, and the distance between
any two points in each of the sets. This lemma is true without any side condition, since it is
obviously true if `s ∪ t` is unbounded. -/
theorem diam_union {t : Set α} (xs : x ∈ s) (yt : y ∈ t) :
    diam (s ∪ t) ≤ diam s + dist x y + diam t := by
  simp only [diam, dist_edist]
  refine (ENNReal.toReal_le_add' (EMetric.diam_union xs yt) ?_ ?_).trans
    (add_le_add_right ENNReal.toReal_add_le _)
  · simp only [ENNReal.add_eq_top, edist_ne_top, or_false]
    exact fun h ↦ top_unique <| h ▸ EMetric.diam_mono (subset_union_left _ _)
  · 

Proof state:
case refine_2
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
xs : x ∈ s
yt : y ∈ t
⊢ EMetric.diam t = ⊤ → EMetric.diam (s ∪ t) = ⊤

Next tactic:
exact fun h ↦ top_unique <| h ▸ EMetric.diam_mono (subset_union_right _ _)
/-- If two sets intersect, the diameter of the union is bounded by the sum of the diameters. -/
theorem diam_union' {t : Set α} (h : (s ∩ t).Nonempty) : diam (s ∪ t) ≤ diam s + diam t := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
t : Set α
h : Set.Nonempty (s ∩ t)
⊢ diam (s ∪ t) ≤ diam s + diam t

Next tactic:
rcases h with ⟨x, ⟨xs, xt⟩⟩
/-- If two sets intersect, the diameter of the union is bounded by the sum of the diameters. -/
theorem diam_union' {t : Set α} (h : (s ∩ t).Nonempty) : diam (s ∪ t) ≤ diam s + diam t := by
  rcases h with ⟨x, ⟨xs, xt⟩⟩
  

Proof state:
case intro.intro
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x✝ y z : α
t : Set α
x : α
xs : x ∈ s
xt : x ∈ t
⊢ diam (s ∪ t) ≤ diam s + diam t

Next tactic:
simpa using diam_union xs xt
theorem diam_le_of_subset_closedBall {r : ℝ} (hr : 0 ≤ r) (h : s ⊆ closedBall x r) :
    diam s ≤ 2 * r :=
  diam_le_of_forall_dist_le (mul_nonneg zero_le_two hr) fun a ha b hb =>
    calc
      dist a b ≤ dist a x + dist b x := dist_triangle_right _ _ _
      _ ≤ r + r := (add_le_add (h ha) (h hb))
      _ = 2 * r := by 

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s : Set α
x y z : α
r : ℝ
hr : 0 ≤ r
h : s ⊆ closedBall x r
a : α
ha : a ∈ s
b : α
hb : b ∈ s
⊢ r + r = 2 * r

Next tactic:
simp [mul_two, mul_comm]
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
⊢ Set.Nonempty (⋂ n, s n)

Next tactic:
let u N := (h N).some
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
⊢ Set.Nonempty (⋂ n, s n)

Next tactic:
have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
⊢ ∀ (n N : ℕ), n ≤ N → u N ∈ s n

Next tactic:
intro n N hn
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
n N : ℕ
hn : n ≤ N
⊢ u N ∈ s n

Next tactic:
apply mem_of_subset_of_mem _ (h N).choose_spec
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
n N : ℕ
hn : n ≤ N
⊢ ⋂ n, ⋂ (_ : n ≤ N), s n ⊆ s n

Next tactic:
intro x hx
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
n N : ℕ
hn : n ≤ N
x : α
hx : x ∈ ⋂ n, ⋂ (_ : n ≤ N), s n
⊢ x ∈ s n

Next tactic:
simp only [mem_iInter] at hx
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x✝ y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
n N : ℕ
hn : n ≤ N
x : α
hx : ∀ i ≤ N, x ∈ s i
⊢ x ∈ s n

Next tactic:
exact hx n hn
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
⊢ Set.Nonempty (⋂ n, s n)

Next tactic:
have : CauchySeq u := by
    apply cauchySeq_of_le_tendsto_0 _ _ h'
    intro m n N hm hn
    exact dist_le_diam_of_mem (h's N) (I _ _ hm) (I _ _ hn)
/-- If a family of complete sets with diameter tending to `0` is such that each finite intersection
is nonempty, then the total intersection is also nonempty. -/
theorem _root_.IsComplete.nonempty_iInter_of_nonempty_biInter {s : ℕ → Set α}
    (h0 : IsComplete (s 0)) (hs : ∀ n, IsClosed (s n)) (h's : ∀ n, IsBounded (s n))
    (h : ∀ N, (⋂ n ≤ N, s n).Nonempty) (h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)) :
    (⋂ n, s n).Nonempty := by
  let u N := (h N).some
  have I : ∀ n N, n ≤ N → u N ∈ s n := by
    intro n N hn
    apply mem_of_subset_of_mem _ (h N).choose_spec
    intro x hx
    simp only [mem_iInter] at hx
    exact hx n hn
  have : CauchySeq u := by
    

Proof state:
α : Type u
β : Type v
X : Type u_1
ι : Type u_2
inst✝ : PseudoMetricSpace α
s✝ : Set α
x y z : α
s : ℕ → Set α
h0 : IsComplete (s 0)
hs : ∀ (n : ℕ), IsClosed (s n)
h's : ∀ (n : ℕ), IsBounded (s n)
h : ∀ (N : ℕ), Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n)
h' : Tendsto (fun n => diam (s n)) atTop (𝓝 0)
u : ℕ → α := fun N => Set.Nonempty.some (_ : Set.Nonempty (⋂ n, ⋂ (_ : n ≤ N), s n))
I : ∀ (n N : ℕ), n ≤ N → u N ∈ s n
⊢ CauchySeq u

Next tactic:
apply cauchySeq_of_le_tendsto_0 _ _ h'