l3lab/ntp-mathlib huggingface dataset:
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
⊢ ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U

Next tactic:
intro k
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
k : ↑K
⊢ W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U

Next tactic:
obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    

Proof state:
case intro.intro
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
k : ↑K
h₁ : Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U) ∈ 𝓤 α
h₂ : IsOpen (Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U))
h₃ : UniformSpace.ball (↑k) (Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)) ⊆ U
⊢ W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U

Next tactic:
exact ⟨h₁, h₂, h₃⟩
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
⊢ K ⊆ ⋃ i, c i

Next tactic:
intro k hk
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
k : α
hk : k ∈ K
⊢ k ∈ ⋃ i, c i

Next tactic:
simp only [mem_iUnion, SetCoe.exists]
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
k : α
hk : k ∈ K
⊢ ∃ x,
    ∃ (h : x ∈ K),
      k ∈
        UniformSpace.ball x
          (Classical.choose
            (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑{ val := x, property := (_ : x ∈ K) }) V ⊆ U))

Next tactic:
exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
hc₃ : ∀ (k : ↑K), c k ⊆ U
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hc₂
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
  obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hc₂
  

Proof state:
case intro.intro
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
hc₃ : ∀ (k : ↑K), c k ⊆ U
V : Set (α × α)
hV : V ∈ 𝓤 α
hV' : ∀ x ∈ K, ∃ i, {y | (x, y) ∈ V} ⊆ c i
⊢ ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U

Next tactic:
refine' ⟨interior V, interior_mem_uniformity hV, isOpen_interior, _⟩
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
  obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hc₂
  refine' ⟨interior V, interior_mem_uniformity hV, isOpen_interior, _⟩
  

Proof state:
case intro.intro
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
hc₃ : ∀ (k : ↑K), c k ⊆ U
V : Set (α × α)
hV : V ∈ 𝓤 α
hV' : ∀ x ∈ K, ∃ i, {y | (x, y) ∈ V} ⊆ c i
⊢ ∀ x ∈ K, UniformSpace.ball x (interior V) ⊆ U

Next tactic:
intro k hk
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
  obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hc₂
  refine' ⟨interior V, interior_mem_uniformity hV, isOpen_interior, _⟩
  intro k hk
  

Proof state:
case intro.intro
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
hc₃ : ∀ (k : ↑K), c k ⊆ U
V : Set (α × α)
hV : V ∈ 𝓤 α
hV' : ∀ x ∈ K, ∃ i, {y | (x, y) ∈ V} ⊆ c i
k : α
hk : k ∈ K
⊢ UniformSpace.ball k (interior V) ⊆ U

Next tactic:
obtain ⟨k', hk'⟩ := hV' k hk
/-- A useful consequence of the Lebesgue number lemma: given any compact set `K` contained in an
open set `U`, we can find an (open) entourage `V` such that the ball of size `V` about any point of
`K` is contained in `U`. -/
theorem lebesgue_number_of_compact_open [UniformSpace α] {K U : Set α} (hK : IsCompact K)
    (hU : IsOpen U) (hKU : K ⊆ U) : ∃ V ∈ 𝓤 α, IsOpen V ∧ ∀ x ∈ K, UniformSpace.ball x V ⊆ U := by
  let W : K → Set (α × α) := fun k =>
    Classical.choose <| isOpen_iff_open_ball_subset.mp hU k.1 <| hKU k.2
  have hW : ∀ k, W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball k.1 (W k) ⊆ U := by
    intro k
    obtain ⟨h₁, h₂, h₃⟩ := Classical.choose_spec (isOpen_iff_open_ball_subset.mp hU k.1 (hKU k.2))
    exact ⟨h₁, h₂, h₃⟩
  let c : K → Set α := fun k => UniformSpace.ball k.1 (W k)
  have hc₁ : ∀ k, IsOpen (c k) := fun k => UniformSpace.isOpen_ball k.1 (hW k).2.1
  have hc₂ : K ⊆ ⋃ i, c i := by
    intro k hk
    simp only [mem_iUnion, SetCoe.exists]
    exact ⟨k, hk, UniformSpace.mem_ball_self k (hW ⟨k, hk⟩).1⟩
  have hc₃ : ∀ k, c k ⊆ U := fun k => (hW k).2.2
  obtain ⟨V, hV, hV'⟩ := lebesgue_number_lemma hK hc₁ hc₂
  refine' ⟨interior V, interior_mem_uniformity hV, isOpen_interior, _⟩
  intro k hk
  obtain ⟨k', hk'⟩ := hV' k hk
  

Proof state:
case intro.intro.intro
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
K U : Set α
hK : IsCompact K
hU : IsOpen U
hKU : K ⊆ U
W : ↑K → Set (α × α) := fun k => Classical.choose (_ : ∃ V ∈ 𝓤 α, IsOpen V ∧ UniformSpace.ball (↑k) V ⊆ U)
hW : ∀ (k : ↑K), W k ∈ 𝓤 α ∧ IsOpen (W k) ∧ UniformSpace.ball (↑k) (W k) ⊆ U
c : ↑K → Set α := fun k => UniformSpace.ball (↑k) (W k)
hc₁ : ∀ (k : ↑K), IsOpen (c k)
hc₂ : K ⊆ ⋃ i, c i
hc₃ : ∀ (k : ↑K), c k ⊆ U
V : Set (α × α)
hV : V ∈ 𝓤 α
hV' : ∀ x ∈ K, ∃ i, {y | (x, y) ∈ V} ⊆ c i
k : α
hk : k ∈ K
k' : ↑K
hk' : {y | (k, y) ∈ V} ⊆ c k'
⊢ UniformSpace.ball k (interior V) ⊆ U

Next tactic:
exact ((ball_mono interior_subset k).trans hk').trans (hc₃ k')
theorem tendsto_nhds_right {f : Filter β} {u : β → α} {a : α} :
    Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (a, u x)) f (𝓤 α) := by
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
f : Filter β
u : β → α
a : α
⊢ Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (a, u x)) f (𝓤 α)

Next tactic:
rw [nhds_eq_comap_uniformity, tendsto_comap_iff]
theorem tendsto_nhds_right {f : Filter β} {u : β → α} {a : α} :
    Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (a, u x)) f (𝓤 α) := by
  rw [nhds_eq_comap_uniformity, tendsto_comap_iff]; 

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
f : Filter β
u : β → α
a : α
⊢ Tendsto (Prod.mk a ∘ u) f (𝓤 α) ↔ Tendsto (fun x => (a, u x)) f (𝓤 α)

Next tactic:
rfl
theorem tendsto_nhds_left {f : Filter β} {u : β → α} {a : α} :
    Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (u x, a)) f (𝓤 α) := by
  

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
f : Filter β
u : β → α
a : α
⊢ Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (u x, a)) f (𝓤 α)

Next tactic:
rw [nhds_eq_comap_uniformity', tendsto_comap_iff]
theorem tendsto_nhds_left {f : Filter β} {u : β → α} {a : α} :
    Tendsto u f (𝓝 a) ↔ Tendsto (fun x => (u x, a)) f (𝓤 α) := by
  rw [nhds_eq_comap_uniformity', tendsto_comap_iff]; 

Proof state:
α : Type ua
β : Type ub
γ : Type uc
δ : Type ud
ι : Sort u_1
inst✝ : UniformSpace α
f : Filter β
u : β → α
a : α
⊢ Tendsto ((fun y => (y, a)) ∘ u) f (𝓤 α) ↔ Tendsto (fun x => (u x, a)) f (𝓤 α)

Next tactic:
rfl