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

tactic: by_cases hx : x ∈ s
state_before: E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
⊢ Set.Nonempty (s ∩ cylinder x (longestPrefix x s))

tactic: have A := exists_disjoint_cylinder hs hx
state_before: case neg
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
⊢ Set.Nonempty (s ∩ cylinder x (longestPrefix x s))

tactic: have B : longestPrefix x s < shortestPrefixDiff x s :=
  Nat.pred_lt (shortestPrefixDiff_pos hs hne hx).ne'
state_before: case neg
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
⊢ Set.Nonempty (s ∩ cylinder x (longestPrefix x s))

tactic: rw [longestPrefix, shortestPrefixDiff, dif_pos A] at B ⊢
state_before: case neg
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : longestPrefix x s < shortestPrefixDiff x s
⊢ Set.Nonempty (s ∩ cylinder x (longestPrefix x s))

tactic: obtain ⟨y, ys, hy⟩ : ∃ y : ∀ n : ℕ, E n, y ∈ s ∧ x ∈ cylinder y (Nat.find A - 1) := by
  simpa only [not_disjoint_iff, mem_cylinder_comm] using Nat.find_min A B
state_before: case neg
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A - 1 < Nat.find A
⊢ Set.Nonempty (s ∩ cylinder x (Nat.find A - 1))

tactic: refine' ⟨y, ys, _⟩
state_before: case neg.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A - 1 < Nat.find A
y : (n : ℕ) → E n
ys : y ∈ s
hy : x ∈ cylinder y (Nat.find A - 1)
⊢ Set.Nonempty (s ∩ cylinder x (Nat.find A - 1))

tactic: rw [mem_cylinder_iff_eq] at hy ⊢
state_before: case neg.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A - 1 < Nat.find A
y : (n : ℕ) → E n
ys : y ∈ s
hy : x ∈ cylinder y (Nat.find A - 1)
⊢ y ∈ cylinder x (Nat.find A - 1)

tactic: rw [hy]
state_before: case neg.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A - 1 < Nat.find A
y : (n : ℕ) → E n
ys : y ∈ s
hy : cylinder x (Nat.find A - 1) = cylinder y (Nat.find A - 1)
⊢ cylinder y (Nat.find A - 1) = cylinder x (Nat.find A - 1)

tactic: exact ⟨x, hx, self_mem_cylinder _ _⟩
state_before: case pos
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : x ∈ s
⊢ Set.Nonempty (s ∩ cylinder x (longestPrefix x s))

tactic: simpa only [not_disjoint_iff, mem_cylinder_comm] using Nat.find_min A B
state_before: E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
x : (n : ℕ) → E n
hx : ¬x ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A - 1 < Nat.find A
⊢ ∃ y, y ∈ s ∧ x ∈ cylinder y (Nat.find A - 1)