Theorem: EMetric.eventually_nhds_zero_forall_closedBall_subset
File: Mathlib/Topology/MetricSpace/PartitionOfUnity.lean

tactic: suffices ∀ i, x ∈ K i → ∀ᶠ p : ℝ≥0∞ × X in 𝓝 0 ×ˢ 𝓝 x, closedBall p.2 p.1 ⊆ U i by
  apply mp_mem ((eventually_all_finite (hfin.point_finite x)).2 this)
    (mp_mem (@tendsto_snd ℝ≥0∞ _ (𝓝 0) _ _ (hfin.iInter_compl_mem_nhds hK x)) _)
  apply univ_mem'
  rintro ⟨r, y⟩ hxy hyU i hi
  simp only [mem_iInter, mem_compl_iff, not_imp_not, mem_preimage] at hxy
  exact hyU _ (hxy _ hi)
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
⊢ ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, ∀ (i : ι), p.snd ∈ K i → closedBall p.snd p.fst ⊆ U i

tactic: intro i hi
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
⊢ ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i

tactic: rcases nhds_basis_closed_eball.mem_iff.1 ((hU i).mem_nhds <| hKU i hi) with ⟨R, hR₀, hR⟩
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
⊢ ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i

tactic: rcases ENNReal.lt_iff_exists_nnreal_btwn.mp hR₀ with ⟨r, hr₀, hrR⟩
state_before: case intro.intro
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
R : ℝ≥0∞
hR₀ : 0 < R
hR : closedBall x R ⊆ U i
⊢ ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i

tactic: filter_upwards [prod_mem_prod (eventually_lt_nhds hr₀)
    (closedBall_mem_nhds x (tsub_pos_iff_lt.2 hrR))] with p hp z hz
state_before: case intro.intro.intro.intro
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
R : ℝ≥0∞
hR₀ : 0 < R
hR : closedBall x R ⊆ U i
r : ℝ≥0
hr₀ : 0 < ↑r
hrR : ↑r < R
⊢ ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i

tactic: apply hR
state_before: case h
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
R : ℝ≥0∞
hR₀ : 0 < R
hR : closedBall x R ⊆ U i
r : ℝ≥0
hr₀ : 0 < ↑r
hrR : ↑r < R
p : ℝ≥0∞ × X
hp : p ∈ {x | x < ↑r} ×ˢ closedBall x (R - ↑r)
z : X
hz : z ∈ closedBall p.snd p.fst
⊢ z ∈ U i

tactic: calc
  edist z x ≤ edist z p.2 + edist p.2 x := edist_triangle _ _ _
  _ ≤ p.1 + (R - p.1) := (add_le_add hz <| le_trans hp.2 <| tsub_le_tsub_left hp.1.out.le _)
  _ = R := add_tsub_cancel_of_le (lt_trans (by exact hp.1) hrR).le
state_before: case h.a
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
R : ℝ≥0∞
hR₀ : 0 < R
hR : closedBall x R ⊆ U i
r : ℝ≥0
hr₀ : 0 < ↑r
hrR : ↑r < R
p : ℝ≥0∞ × X
hp : p ∈ {x | x < ↑r} ×ˢ closedBall x (R - ↑r)
z : X
hz : z ∈ closedBall p.snd p.fst
⊢ z ∈ closedBall x R

tactic: apply mp_mem ((eventually_all_finite (hfin.point_finite x)).2 this)
  (mp_mem (@tendsto_snd ℝ≥0∞ _ (𝓝 0) _ _ (hfin.iInter_compl_mem_nhds hK x)) _)
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
this : ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i
⊢ ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, ∀ (i : ι), p.snd ∈ K i → closedBall p.snd p.fst ⊆ U i

tactic: apply univ_mem'
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
this : ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i
⊢ {x_1 |
      (x_1 ∈ Prod.snd ⁻¹' ⋂ (i : ι) (_ : ¬x ∈ K i), K iᶜ) →
        x_1 ∈
          {x_2 |
            x_2 ∈ {x_3 | (fun x_4 => ∀ (i : ι), i ∈ {b | x ∈ K b} → closedBall x_4.snd x_4.fst ⊆ U i) x_3} →
              x_2 ∈ {x | (fun p => ∀ (i : ι), p.snd ∈ K i → closedBall p.snd p.fst ⊆ U i) x}}} ∈
    𝓝 0 ×ˢ 𝓝 x

tactic: rintro ⟨r, y⟩ hxy hyU i hi
state_before: case h
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
this : ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i
⊢ ∀ (a : ℝ≥0∞ × X),
    a ∈
      {x_1 |
        (x_1 ∈ Prod.snd ⁻¹' ⋂ (i : ι) (_ : ¬x ∈ K i), K iᶜ) →
          x_1 ∈
            {x_2 |
              x_2 ∈ {x_3 | (fun x_4 => ∀ (i : ι), i ∈ {b | x ∈ K b} → closedBall x_4.snd x_4.fst ⊆ U i) x_3} →
                x_2 ∈ {x | (fun p => ∀ (i : ι), p.snd ∈ K i → closedBall p.snd p.fst ⊆ U i) x}}}

tactic: simp only [mem_iInter, mem_compl_iff, not_imp_not, mem_preimage] at hxy
state_before: case h.mk
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
this : ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i
r : ℝ≥0∞
y : X
hxy : (r, y) ∈ Prod.snd ⁻¹' ⋂ (i : ι) (_ : ¬x ∈ K i), K iᶜ
hyU : (r, y) ∈ {x_1 | (fun x_2 => ∀ (i : ι), i ∈ {b | x ∈ K b} → closedBall x_2.snd x_2.fst ⊆ U i) x_1}
i : ι
hi : (r, y).snd ∈ K i
⊢ closedBall (r, y).snd (r, y).fst ⊆ U i

tactic: exact hyU _ (hxy _ hi)
state_before: case h.mk
ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
this : ∀ (i : ι), x ∈ K i → ∀ᶠ (p : ℝ≥0∞ × X) in 𝓝 0 ×ˢ 𝓝 x, closedBall p.snd p.fst ⊆ U i
r : ℝ≥0∞
y : X
hyU : (r, y) ∈ {x_1 | (fun x_2 => ∀ (i : ι), i ∈ {b | x ∈ K b} → closedBall x_2.snd x_2.fst ⊆ U i) x_1}
i : ι
hi : (r, y).snd ∈ K i
hxy : ∀ (i : ι), y ∈ K i → x ∈ K i
⊢ closedBall (r, y).snd (r, y).fst ⊆ U i

tactic: exact hp.1
state_before: ι : Type u_2
X : Type u_1
inst✝ : EMetricSpace X
K U : ι → Set X
hK : ∀ (i : ι), IsClosed (K i)
hU : ∀ (i : ι), IsOpen (U i)
hKU : ∀ (i : ι), K i ⊆ U i
hfin : LocallyFinite K
x : X
i : ι
hi : x ∈ K i
R : ℝ≥0∞
hR₀ : 0 < R
hR : closedBall x R ⊆ U i
r : ℝ≥0
hr₀ : 0 < ↑r
hrR : ↑r < R
p : ℝ≥0∞ × X
hp : p ∈ {x | x < ↑r} ×ˢ closedBall x (R - ↑r)
z : X
hz : z ∈ closedBall p.snd p.fst
⊢ p.fst < ↑r