Theorem: PiNat.isOpen_iff_dist
File: Mathlib/Topology/MetricSpace/PiNat.lean

tactic: constructor
state_before: E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
⊢ IsOpen s ↔ ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s

tactic: intro hs x hx
state_before: case mp
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
⊢ IsOpen s → ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s

tactic: obtain ⟨v, ⟨y, n, rfl⟩, h'x, h's⟩ :
    ∃ v ∈ { s | ∃ (x : ∀ n : ℕ, E n) (n : ℕ), s = cylinder x n }, x ∈ v ∧ v ⊆ s :=
  (isTopologicalBasis_cylinders E).exists_subset_of_mem_open hx hs
state_before: case mp
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsOpen s
x : (n : ℕ) → E n
hx : x ∈ s
⊢ ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s

tactic: rw [← mem_cylinder_iff_eq.1 h'x] at h's
state_before: case mp.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsOpen s
x : (n : ℕ) → E n
hx : x ∈ s
y : (n : ℕ) → E n
n : ℕ
h'x : x ∈ cylinder y n
h's : cylinder y n ⊆ s
⊢ ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s

tactic: exact
  ⟨(1 / 2 : ℝ) ^ n, by simp, fun y hy => h's fun i hi => (apply_eq_of_dist_lt hy hi.le).symm⟩
state_before: case mp.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsOpen s
x : (n : ℕ) → E n
hx : x ∈ s
y : (n : ℕ) → E n
n : ℕ
h'x : x ∈ cylinder y n
h's : cylinder x n ⊆ s
⊢ ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s

tactic: simp
state_before: E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsOpen s
x : (n : ℕ) → E n
hx : x ∈ s
y : (n : ℕ) → E n
n : ℕ
h'x : x ∈ cylinder y n
h's : cylinder x n ⊆ s
⊢ (1 / 2) ^ n > 0

tactic: intro h
state_before: case mpr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
⊢ (∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s) → IsOpen s

tactic: refine (isTopologicalBasis_cylinders E).isOpen_iff.2 fun x hx => ?_
state_before: case mpr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
⊢ IsOpen s

tactic: rcases h x hx with ⟨ε, εpos, hε⟩
state_before: case mpr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
x : (n : ℕ) → E n
hx : x ∈ s
⊢ ∃ t, t ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ t ∧ t ⊆ s

tactic: obtain ⟨n, hn⟩ : ∃ n : ℕ, (1 / 2 : ℝ) ^ n < ε := exists_pow_lt_of_lt_one εpos one_half_lt_one
state_before: case mpr.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
x : (n : ℕ) → E n
hx : x ∈ s
ε : ℝ
εpos : ε > 0
hε : ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
⊢ ∃ t, t ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ t ∧ t ⊆ s

tactic: refine' ⟨cylinder x n, ⟨x, n, rfl⟩, self_mem_cylinder x n, fun y hy => hε y _⟩
state_before: case mpr.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
x : (n : ℕ) → E n
hx : x ∈ s
ε : ℝ
εpos : ε > 0
hε : ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
n : ℕ
hn : (1 / 2) ^ n < ε
⊢ ∃ t, t ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ t ∧ t ⊆ s

tactic: rw [PiNat.dist_comm]
state_before: case mpr.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
x : (n : ℕ) → E n
hx : x ∈ s
ε : ℝ
εpos : ε > 0
hε : ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
n : ℕ
hn : (1 / 2) ^ n < ε
y : (n : ℕ) → E n
hy : y ∈ cylinder x n
⊢ dist x y < ε

tactic: exact (mem_cylinder_iff_dist_le.1 hy).trans_lt hn
state_before: case mpr.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
h : ∀ (x : (n : ℕ) → E n), x ∈ s → ∃ ε, ε > 0 ∧ ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
x : (n : ℕ) → E n
hx : x ∈ s
ε : ℝ
εpos : ε > 0
hε : ∀ (y : (n : ℕ) → E n), dist x y < ε → y ∈ s
n : ℕ
hn : (1 / 2) ^ n < ε
y : (n : ℕ) → E n
hy : y ∈ cylinder x n
⊢ dist y x < ε