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

tactic: set f := fun x => if x ∈ s then x else (inter_cylinder_longestPrefix_nonempty hs hne x).some
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
⊢ ∃ f, (∀ (x : (n : ℕ) → E n), x ∈ s → f x = x) ∧ range f = s ∧ LipschitzWith 1 f

tactic: have fs : ∀ x ∈ s, f x = x := fun x xs => by simp [xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
⊢ ∃ f, (∀ (x : (n : ℕ) → E n), x ∈ s → f x = x) ∧ range f = s ∧ LipschitzWith 1 f

tactic: refine' ⟨f, fs, _, _⟩
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
⊢ ∃ f, (∀ (x : (n : ℕ) → E n), x ∈ s → f x = x) ∧ range f = s ∧ LipschitzWith 1 f

tactic: simp [xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
x : (n : ℕ) → E n
xs : x ∈ s
⊢ f x = x

tactic: apply Subset.antisymm
state_before: case refine'_1
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
⊢ range f = s

tactic: rintro x ⟨y, rfl⟩
state_before: case refine'_1.h₁
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
⊢ range f ⊆ s

tactic: by_cases hy : y ∈ s
state_before: case refine'_1.h₁.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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
y : (n : ℕ) → E n
⊢ f y ∈ s

tactic: simpa [if_neg hy] using (inter_cylinder_longestPrefix_nonempty hs hne y).choose_spec.1
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
y : (n : ℕ) → E n
hy : ¬y ∈ s
⊢ f y ∈ s

tactic: rwa [fs y hy]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
y : (n : ℕ) → E n
hy : y ∈ s
⊢ f y ∈ s

tactic: intro x hx
state_before: case refine'_1.h₂
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
⊢ s ⊆ range f

tactic: rw [← fs x hx]
state_before: case refine'_1.h₂
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x : (n : ℕ) → E n
hx : x ∈ s
⊢ x ∈ range f

tactic: exact mem_range_self _
state_before: case refine'_1.h₂
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x : (n : ℕ) → E n
hx : x ∈ s
⊢ f x ∈ range f

tactic: refine LipschitzWith.mk_one fun x y => ?_
state_before: case refine'_2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
⊢ LipschitzWith 1 f

tactic: rcases eq_or_ne x y with (rfl | hxy)
state_before: case refine'_2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
⊢ dist (f x) (f y) ≤ dist x y

tactic: rcases eq_or_ne (f x) (f y) with (h' | hfxfy)
state_before: case refine'_2.inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
⊢ dist (f x) (f y) ≤ dist x y

tactic: have I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y) := by
  rw [← mem_cylinder_iff_eq]
  apply mem_cylinder_firstDiff
state_before: case refine'_2.inr.inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
⊢ dist (f x) (f y) ≤ dist x y

tactic: suffices firstDiff x y ≤ firstDiff (f x) (f y) by
  simpa [dist_eq_of_ne hxy, dist_eq_of_ne hfxfy]
state_before: case refine'_2.inr.inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
⊢ dist (f x) (f y) ≤ dist x y

tactic: by_cases xs : x ∈ s
state_before: case refine'_2.inr.inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: simp
state_before: case refine'_2.inl
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x : (n : ℕ) → E n
⊢ dist (f x) (f x) ≤ dist x x

tactic: simp [h', dist_nonneg]
state_before: case refine'_2.inr.inl
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
h' : f x = f y
⊢ dist (f x) (f y) ≤ dist x y

tactic: rw [← mem_cylinder_iff_eq]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
⊢ cylinder x (firstDiff x y) = cylinder y (firstDiff x y)

tactic: apply mem_cylinder_firstDiff
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
⊢ x ∈ cylinder y (firstDiff x y)

tactic: simpa [dist_eq_of_ne hxy, dist_eq_of_ne hfxfy]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
this : firstDiff x y ≤ firstDiff (f x) (f y)
⊢ dist (f x) (f y) ≤ dist x y

tactic: rw [fs x xs] at hfxfy ⊢
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: by_cases ys : y ∈ s
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: have A : (s ∩ cylinder y (longestPrefix y s)).Nonempty :=
  inter_cylinder_longestPrefix_nonempty hs hne y
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: have fy : f y = A.some := by simp_rw [if_neg ys]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: have I : cylinder A.some (firstDiff x y) = cylinder y (firstDiff x y) := by
  rw [← mem_cylinder_iff_eq, firstDiff_comm]
  apply cylinder_anti y _ A.some_mem.2
  exact firstDiff_le_longestPrefix hs ys xs
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some A
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: rwa [← fy, ← I2, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy.symm,
  firstDiff_comm _ x] at I
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some A
I : cylinder (Set.Nonempty.some A) (firstDiff x y) = cylinder y (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: rw [fs y ys]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : y ∈ s
⊢ firstDiff x y ≤ firstDiff x (f y)

tactic: simp_rw [if_neg ys]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
⊢ f y = Set.Nonempty.some A

tactic: rw [← mem_cylinder_iff_eq, firstDiff_comm]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some A
⊢ cylinder (Set.Nonempty.some A) (firstDiff x y) = cylinder y (firstDiff x y)

tactic: apply cylinder_anti y _ A.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some A
⊢ Set.Nonempty.some A ∈ cylinder y (firstDiff y x)

tactic: exact firstDiff_le_longestPrefix hs ys xs
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : x ∈ s
ys : ¬y ∈ s
A : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some A
⊢ firstDiff y x ≤ longestPrefix y s

tactic: by_cases ys : y ∈ s
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have A : (s ∩ cylinder x (longestPrefix x s)).Nonempty :=
  inter_cylinder_longestPrefix_nonempty hs hne x
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have fx : f x = A.some := by simp_rw [if_neg xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have I : cylinder A.some (firstDiff x y) = cylinder x (firstDiff x y) := by
  rw [← mem_cylinder_iff_eq]
  apply cylinder_anti x _ A.some_mem.2
  apply firstDiff_le_longestPrefix hs xs ys
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: rw [fs y ys] at hfxfy⊢
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
I : cylinder (Set.Nonempty.some A) (firstDiff x y) = cylinder x (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: rwa [← fx, I2, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy] at I
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
I : cylinder (Set.Nonempty.some A) (firstDiff x y) = cylinder x (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) y

tactic: simp_rw [if_neg xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
⊢ f x = Set.Nonempty.some A

tactic: rw [← mem_cylinder_iff_eq]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
⊢ cylinder (Set.Nonempty.some A) (firstDiff x y) = cylinder x (firstDiff x y)

tactic: apply cylinder_anti x _ A.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
⊢ Set.Nonempty.some A ∈ cylinder x (firstDiff x y)

tactic: apply firstDiff_le_longestPrefix hs xs ys
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : y ∈ s
A : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some A
⊢ firstDiff x y ≤ longestPrefix x s

tactic: have Ax : (s ∩ cylinder x (longestPrefix x s)).Nonempty :=
  inter_cylinder_longestPrefix_nonempty hs hne x
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have fx : f x = Ax.some := by simp_rw [if_neg xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have Ay : (s ∩ cylinder y (longestPrefix y s)).Nonempty :=
  inter_cylinder_longestPrefix_nonempty hs hne y
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have fy : f y = Ay.some := by simp_rw [if_neg ys]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: by_cases H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: simp_rw [if_neg xs]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
⊢ f x = Set.Nonempty.some Ax

tactic: simp_rw [if_neg ys]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
⊢ f y = Set.Nonempty.some Ay

tactic: rw [fx, fy] at hfxfy
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
this : cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: apply (hfxfy _).elim
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
hfxfy : Set.Nonempty.some Ax ≠ Set.Nonempty.some Ay
fy : f y = Set.Nonempty.some Ay
H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
this : cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: congr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
hfxfy : Set.Nonempty.some Ax ≠ Set.Nonempty.some Ay
fy : f y = Set.Nonempty.some Ay
H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
this : cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)
⊢ Set.Nonempty.some Ax = Set.Nonempty.some Ay

tactic: cases' H with H H
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
⊢ cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)

tactic: exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H xs ys
state_before: case inl
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix x s < firstDiff x y
⊢ cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)

tactic: symm
state_before: case inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix y s < firstDiff x y
⊢ cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)

tactic: rw [firstDiff_comm] at H
state_before: case inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix y s < firstDiff x y
⊢ cylinder y (longestPrefix y s) = cylinder x (longestPrefix x s)

tactic: exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H ys xs
state_before: case inr
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : longestPrefix y s < firstDiff y x
⊢ cylinder y (longestPrefix y s) = cylinder x (longestPrefix x s)

tactic: push_neg  at H
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : ¬(longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have I1 : cylinder Ax.some (firstDiff x y) = cylinder x (firstDiff x y) := by
  rw [← mem_cylinder_iff_eq]
  exact cylinder_anti x H.1 Ax.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have I3 : cylinder y (firstDiff x y) = cylinder Ay.some (firstDiff x y) := by
  rw [eq_comm, ← mem_cylinder_iff_eq]
  exact cylinder_anti y H.2 Ay.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: have : cylinder Ax.some (firstDiff x y) = cylinder Ay.some (firstDiff x y) := by
  rw [I1, I2, I3]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
I3 : cylinder y (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: rw [← fx, ← fy, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy] at this
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
I3 : cylinder y (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)
this : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: exact this
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
I3 : cylinder y (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)
this : firstDiff x y ≤ firstDiff (f x) (f y)
⊢ firstDiff x y ≤ firstDiff (f x) (f y)

tactic: rw [← mem_cylinder_iff_eq]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
⊢ cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)

tactic: exact cylinder_anti x H.1 Ax.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
⊢ Set.Nonempty.some Ax ∈ cylinder x (firstDiff x y)

tactic: rw [eq_comm, ← mem_cylinder_iff_eq]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
⊢ cylinder y (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)

tactic: exact cylinder_anti y H.2 Ay.some_mem.2
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
⊢ Set.Nonempty.some Ay ∈ cylinder y (firstDiff x y)

tactic: rw [I1, I2, I3]
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
f : ((n : ℕ) → E n) → (n : ℕ) → E n :=
  fun x => if x ∈ s then x else Set.Nonempty.some (_ : Set.Nonempty (s ∩ cylinder x (longestPrefix x s)))
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
x y : (n : ℕ) → E n
hxy : x ≠ y
hfxfy : f x ≠ f y
I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y)
xs : ¬x ∈ s
ys : ¬y ∈ s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
fx : f x = Set.Nonempty.some Ax
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
fy : f y = Set.Nonempty.some Ay
H : firstDiff x y ≤ longestPrefix x s ∧ firstDiff x y ≤ longestPrefix y s
I1 : cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder x (firstDiff x y)
I3 : cylinder y (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)
⊢ cylinder (Set.Nonempty.some Ax) (firstDiff x y) = cylinder (Set.Nonempty.some Ay) (firstDiff x y)