Theorem: EMetric.NonemptyCompacts.isClosed_in_closeds
File: Mathlib/Topology/MetricSpace/Closeds.lean

tactic: have :
  range NonemptyCompacts.toCloseds =
    { s : Closeds α | (s : Set α).Nonempty ∧ IsCompact (s : Set α) } := by
  ext s
  refine ⟨?_, fun h => ⟨⟨⟨s, h.2⟩, h.1⟩, Closeds.ext rfl⟩⟩
  rintro ⟨s, hs, rfl⟩
  exact ⟨s.nonempty, s.isCompact⟩
state_before: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
⊢ IsClosed (range NonemptyCompacts.toCloseds)
state_after: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsClosed (range NonemptyCompacts.toCloseds)

tactic: rw [this]
state_before: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsClosed (range NonemptyCompacts.toCloseds)
state_after: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsClosed {s | (↑s).Nonempty ∧ IsCompact ↑s}

tactic: refine isClosed_of_closure_subset fun s hs => ⟨?_, ?_⟩
state_before: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsClosed {s | (↑s).Nonempty ∧ IsCompact ↑s}
state_after: case refine_1
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ (↑s).Nonempty

case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsCompact ↑s

tactic: ext s
state_before: α : Type u
inst✝¹ : EMetricSpace α
s : Set α
inst✝ : CompleteSpace α
⊢ range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
state_after: case h
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : Closeds α
⊢ s ∈ range NonemptyCompacts.toCloseds ↔ s ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}

tactic: refine ⟨?_, fun h => ⟨⟨⟨s, h.2⟩, h.1⟩, Closeds.ext rfl⟩⟩
state_before: case h
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : Closeds α
⊢ s ∈ range NonemptyCompacts.toCloseds ↔ s ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
state_after: case h
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : Closeds α
⊢ s ∈ range NonemptyCompacts.toCloseds → s ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}

tactic: rintro ⟨s, hs, rfl⟩
state_before: case h
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : Closeds α
⊢ s ∈ range NonemptyCompacts.toCloseds → s ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
state_after: case h.intro.refl
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : NonemptyCompacts α
⊢ s.toCloseds ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}

tactic: exact ⟨s.nonempty, s.isCompact⟩
state_before: case h.intro.refl
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
s : NonemptyCompacts α
⊢ s.toCloseds ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
state_after: no goals

tactic: rcases mem_closure_iff.1 hs ⊤ ENNReal.coe_lt_top with ⟨t, ht, Dst⟩
state_before: case refine_1
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ (↑s).Nonempty
state_after: case refine_1.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ⊤
⊢ (↑s).Nonempty

tactic: rw [edist_comm] at Dst
state_before: case refine_1.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ⊤
⊢ (↑s).Nonempty
state_after: case refine_1.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist t s < ⊤
⊢ (↑s).Nonempty

tactic: exact nonempty_of_hausdorffEdist_ne_top ht.1 (ne_of_lt Dst)
state_before: case refine_1.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist t s < ⊤
⊢ (↑s).Nonempty
state_after: no goals

tactic: refine isCompact_iff_totallyBounded_isComplete.2 ⟨?_, s.closed.isComplete⟩
state_before: case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ IsCompact ↑s
state_after: case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ TotallyBounded ↑s

tactic: refine totallyBounded_iff.2 fun ε (εpos : 0 < ε) => ?_
state_before: case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
⊢ TotallyBounded ↑s
state_after: case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε

tactic: rcases mem_closure_iff.1 hs (ε / 2) (ENNReal.half_pos εpos.ne') with ⟨t, ht, Dst⟩
state_before: case refine_2
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε
state_after: case refine_2.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε

tactic: rcases totallyBounded_iff.1 (isCompact_iff_totallyBounded_isComplete.1 ht.2).1 (ε / 2)
    (ENNReal.half_pos εpos.ne') with
  ⟨u, fu, ut⟩
state_before: case refine_2.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε
state_after: case refine_2.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε

tactic: refine ⟨u, ⟨fu, fun x hx => ?_⟩⟩
state_before: case refine_2.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
⊢ ∃ t, t.Finite ∧ ↑s ⊆ ⋃ y ∈ t, ball y ε
state_after: case refine_2.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
⊢ x ∈ ⋃ y ∈ u, ball y ε

tactic: rcases exists_edist_lt_of_hausdorffEdist_lt hx Dst with ⟨z, hz, Dxz⟩
state_before: case refine_2.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
⊢ x ∈ ⋃ y ∈ u, ball y ε
state_after: case refine_2.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
⊢ x ∈ ⋃ y ∈ u, ball y ε

tactic: rcases mem_iUnion₂.1 (ut hz) with ⟨y, hy, Dzy⟩
state_before: case refine_2.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
⊢ x ∈ ⋃ y ∈ u, ball y ε
state_after: case refine_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
y : α
hy : y ∈ u
Dzy : z ∈ ball y (ε / 2)
⊢ x ∈ ⋃ y ∈ u, ball y ε

tactic: have : edist x y < ε :=
  calc
    edist x y ≤ edist x z + edist z y := edist_triangle _ _ _
    _ < ε / 2 + ε / 2 := ENNReal.add_lt_add Dxz Dzy
    _ = ε := ENNReal.add_halves _
state_before: case refine_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
y : α
hy : y ∈ u
Dzy : z ∈ ball y (ε / 2)
⊢ x ∈ ⋃ y ∈ u, ball y ε
state_after: case refine_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this✝ : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
y : α
hy : y ∈ u
Dzy : z ∈ ball y (ε / 2)
this : edist x y < ε
⊢ x ∈ ⋃ y ∈ u, ball y ε

tactic: exact mem_biUnion hy this
state_before: case refine_2.intro.intro.intro.intro.intro.intro.intro.intro
α : Type u
inst✝¹ : EMetricSpace α
s✝ : Set α
inst✝ : CompleteSpace α
this✝ : range NonemptyCompacts.toCloseds = {s | (↑s).Nonempty ∧ IsCompact ↑s}
s : Closeds α
hs : s ∈ closure {s | (↑s).Nonempty ∧ IsCompact ↑s}
ε : ℝ≥0∞
εpos : 0 < ε
t : Closeds α
ht : t ∈ {s | (↑s).Nonempty ∧ IsCompact ↑s}
Dst : edist s t < ε / 2
u : Set α
fu : u.Finite
ut : ↑t ⊆ ⋃ y ∈ u, ball y (ε / 2)
x : α
hx : x ∈ ↑s
z : α
hz : z ∈ ↑t
Dxz : edist x z < ε / 2
y : α
hy : y ∈ u
Dzy : z ∈ ball y (ε / 2)
this : edist x y < ε
⊢ x ∈ ⋃ y ∈ u, ball y ε
state_after: no goals