[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
h : x ≠ y
⊢ x (firstDiff x y) ≠ y (firstDiff x y)
[PROOFSTEP]
rw [firstDiff_def, dif_pos h]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
h : x ≠ y
⊢ x (Nat.find (_ : ∃ a, x a ≠ y a)) ≠ y (Nat.find (_ : ∃ a, x a ≠ y a))
[PROOFSTEP]
exact Nat.find_spec (ne_iff.1 h)
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hn : n < firstDiff x y
⊢ x n = y n
[PROOFSTEP]
rw [firstDiff_def] at hn
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hn : n < if h : x ≠ y then Nat.find (_ : ∃ a, x a ≠ y a) else 0
⊢ x n = y n
[PROOFSTEP]
split_ifs at hn  with h
[GOAL]
case pos
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : x ≠ y
hn : n < Nat.find (_ : ∃ a, x a ≠ y a)
⊢ x n = y n
[PROOFSTEP]
convert Nat.find_min (ne_iff.1 h) hn
[GOAL]
case a
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : x ≠ y
hn : n < Nat.find (_ : ∃ a, x a ≠ y a)
⊢ x n = y n ↔ ¬x n ≠ y n
[PROOFSTEP]
simp
[GOAL]
case neg
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : ¬x ≠ y
hn : n < 0
⊢ x n = y n
[PROOFSTEP]
exact (not_lt_zero' hn).elim
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
⊢ firstDiff x y = firstDiff y x
[PROOFSTEP]
simp only [firstDiff_def, ne_comm]
[GOAL]
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
h : x ≠ z
⊢ min (firstDiff x y) (firstDiff y z) ≤ firstDiff x z
[PROOFSTEP]
by_contra' H
[GOAL]
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
h : x ≠ z
H : firstDiff x z < min (firstDiff x y) (firstDiff y z)
⊢ False
[PROOFSTEP]
rw [lt_min_iff] at H
[GOAL]
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
h : x ≠ z
H : firstDiff x z < firstDiff x y ∧ firstDiff x z < firstDiff y z
⊢ False
[PROOFSTEP]
refine apply_firstDiff_ne h ?_
[GOAL]
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
h : x ≠ z
H : firstDiff x z < firstDiff x y ∧ firstDiff x z < firstDiff y z
⊢ x (firstDiff x z) = z (firstDiff x z)
[PROOFSTEP]
calc
  x (firstDiff x z) = y (firstDiff x z) := apply_eq_of_lt_firstDiff H.1
  _ = z (firstDiff x z) := apply_eq_of_lt_firstDiff H.2
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
⊢ cylinder x n = Set.pi ↑(Finset.range n) fun i => {x i}
[PROOFSTEP]
ext y
[GOAL]
case h
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
⊢ y ∈ cylinder x n ↔ y ∈ Set.pi ↑(Finset.range n) fun i => {x i}
[PROOFSTEP]
simp [cylinder]
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
⊢ cylinder x 0 = univ
[PROOFSTEP]
simp [cylinder_eq_pi]
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
⊢ x ∈ cylinder x n
[PROOFSTEP]
simp
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
⊢ y ∈ cylinder x n ↔ cylinder y n = cylinder x n
[PROOFSTEP]
constructor
[GOAL]
case mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
⊢ y ∈ cylinder x n → cylinder y n = cylinder x n
[PROOFSTEP]
intro hy
[GOAL]
case mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
⊢ cylinder y n = cylinder x n
[PROOFSTEP]
apply Subset.antisymm
[GOAL]
case mp.h₁
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
⊢ cylinder y n ⊆ cylinder x n
[PROOFSTEP]
intro z hz i hi
[GOAL]
case mp.h₁
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
z : (n : ℕ) → E n
hz : z ∈ cylinder y n
i : ℕ
hi : i < n
⊢ z i = x i
[PROOFSTEP]
rw [← hy i hi]
[GOAL]
case mp.h₁
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
z : (n : ℕ) → E n
hz : z ∈ cylinder y n
i : ℕ
hi : i < n
⊢ z i = y i
[PROOFSTEP]
exact hz i hi
[GOAL]
case mp.h₂
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
⊢ cylinder x n ⊆ cylinder y n
[PROOFSTEP]
intro z hz i hi
[GOAL]
case mp.h₂
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
z : (n : ℕ) → E n
hz : z ∈ cylinder x n
i : ℕ
hi : i < n
⊢ z i = y i
[PROOFSTEP]
rw [hy i hi]
[GOAL]
case mp.h₂
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hy : y ∈ cylinder x n
z : (n : ℕ) → E n
hz : z ∈ cylinder x n
i : ℕ
hi : i < n
⊢ z i = x i
[PROOFSTEP]
exact hz i hi
[GOAL]
case mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
⊢ cylinder y n = cylinder x n → y ∈ cylinder x n
[PROOFSTEP]
intro h
[GOAL]
case mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : cylinder y n = cylinder x n
⊢ y ∈ cylinder x n
[PROOFSTEP]
rw [← h]
[GOAL]
case mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : cylinder y n = cylinder x n
⊢ y ∈ cylinder y n
[PROOFSTEP]
exact self_mem_cylinder _ _
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
⊢ y ∈ cylinder x n ↔ x ∈ cylinder y n
[PROOFSTEP]
simp [mem_cylinder_iff_eq, eq_comm]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
⊢ x ∈ cylinder y i ↔ i ≤ firstDiff x y
[PROOFSTEP]
constructor
[GOAL]
case mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
⊢ x ∈ cylinder y i → i ≤ firstDiff x y
[PROOFSTEP]
intro h
[GOAL]
case mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
h : x ∈ cylinder y i
⊢ i ≤ firstDiff x y
[PROOFSTEP]
by_contra'
[GOAL]
case mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
h : x ∈ cylinder y i
this : firstDiff x y < i
⊢ False
[PROOFSTEP]
exact apply_firstDiff_ne hne (h _ this)
[GOAL]
case mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
⊢ i ≤ firstDiff x y → x ∈ cylinder y i
[PROOFSTEP]
intro hi j hj
[GOAL]
case mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hne : x ≠ y
i : ℕ
hi : i ≤ firstDiff x y
j : ℕ
hj : j < i
⊢ x j = y j
[PROOFSTEP]
exact apply_eq_of_lt_firstDiff (hj.trans_le hi)
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hn : n ≤ firstDiff x y
⊢ cylinder x n = cylinder y n
[PROOFSTEP]
rw [← mem_cylinder_iff_eq]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hn : n ≤ firstDiff x y
⊢ x ∈ cylinder y n
[PROOFSTEP]
intro i hi
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hn : n ≤ firstDiff x y
i : ℕ
hi : i < n
⊢ x i = y i
[PROOFSTEP]
exact apply_eq_of_lt_firstDiff (hi.trans_le hn)
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
⊢ ⋃ (k : E n), cylinder (update x n k) (n + 1) = cylinder x n
[PROOFSTEP]
ext y
[GOAL]
case h
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
⊢ y ∈ ⋃ (k : E n), cylinder (update x n k) (n + 1) ↔ y ∈ cylinder x n
[PROOFSTEP]
simp only [mem_cylinder_iff, mem_iUnion]
[GOAL]
case h
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
⊢ (∃ i, ∀ (i_1 : ℕ), i_1 < n + 1 → y i_1 = update x n i i_1) ↔ ∀ (i : ℕ), i < n → y i = x i
[PROOFSTEP]
constructor
[GOAL]
case h.mp
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
⊢ (∃ i, ∀ (i_1 : ℕ), i_1 < n + 1 → y i_1 = update x n i i_1) → ∀ (i : ℕ), i < n → y i = x i
[PROOFSTEP]
rintro ⟨k, hk⟩ i hi
[GOAL]
case h.mp.intro
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
k : E n
hk : ∀ (i : ℕ), i < n + 1 → y i = update x n k i
i : ℕ
hi : i < n
⊢ y i = x i
[PROOFSTEP]
simpa [hi.ne] using hk i (Nat.lt_succ_of_lt hi)
[GOAL]
case h.mpr
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
⊢ (∀ (i : ℕ), i < n → y i = x i) → ∃ i, ∀ (i_1 : ℕ), i_1 < n + 1 → y i_1 = update x n i i_1
[PROOFSTEP]
intro H
[GOAL]
case h.mpr
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
H : ∀ (i : ℕ), i < n → y i = x i
⊢ ∃ i, ∀ (i_1 : ℕ), i_1 < n + 1 → y i_1 = update x n i i_1
[PROOFSTEP]
refine' ⟨y n, fun i hi => _⟩
[GOAL]
case h.mpr
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
H : ∀ (i : ℕ), i < n → y i = x i
i : ℕ
hi : i < n + 1
⊢ y i = update x n (y n) i
[PROOFSTEP]
rcases Nat.lt_succ_iff_lt_or_eq.1 hi with (h'i | rfl)
[GOAL]
case h.mpr.inl
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : (n : ℕ) → E n
H : ∀ (i : ℕ), i < n → y i = x i
i : ℕ
hi : i < n + 1
h'i : i < n
⊢ y i = update x n (y n) i
[PROOFSTEP]
simp [H i h'i, h'i.ne]
[GOAL]
case h.mpr.inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
i : ℕ
H : ∀ (i_1 : ℕ), i_1 < i → y i_1 = x i_1
hi : i < i + 1
⊢ y i = update x i (y i) i
[PROOFSTEP]
simp
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
n : ℕ
y : E n
i : ℕ
hi : i < n
⊢ update x n y i = x i
[PROOFSTEP]
simp [hi.ne]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
n : ℕ
⊢ length (res x n) = n
[PROOFSTEP]
induction n
[GOAL]
case zero
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
⊢ length (res x Nat.zero) = Nat.zero
[PROOFSTEP]
simp [*]
[GOAL]
case succ
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
n✝ : ℕ
n_ih✝ : length (res x n✝) = n✝
⊢ length (res x (Nat.succ n✝)) = Nat.succ n✝
[PROOFSTEP]
simp [*]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
⊢ res x n = res y n ↔ ∀ ⦃m : ℕ⦄, m < n → x m = y m
[PROOFSTEP]
constructor
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
⊢ res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
[PROOFSTEP]
intro h
[GOAL]
case mpr
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
⊢ (∀ ⦃m : ℕ⦄, m < n → x m = y m) → res x n = res y n
[PROOFSTEP]
intro h
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
h : res x n = res y n
⊢ ∀ ⦃m : ℕ⦄, m < n → x m = y m
[PROOFSTEP]
induction' n with n ih
[GOAL]
case mpr
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
h : ∀ ⦃m : ℕ⦄, m < n → x m = y m
⊢ res x n = res y n
[PROOFSTEP]
induction' n with n ih
[GOAL]
case mp.zero
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
h✝ : res x n = res y n
h : res x Nat.zero = res y Nat.zero
⊢ ∀ ⦃m : ℕ⦄, m < Nat.zero → x m = y m
[PROOFSTEP]
simp
[GOAL]
case mp.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
h : res x (Nat.succ n) = res y (Nat.succ n)
⊢ ∀ ⦃m : ℕ⦄, m < Nat.succ n → x m = y m
[PROOFSTEP]
intro m hm
[GOAL]
case mp.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
h : res x (Nat.succ n) = res y (Nat.succ n)
m : ℕ
hm : m < Nat.succ n
⊢ x m = y m
[PROOFSTEP]
rw [Nat.lt_succ_iff_lt_or_eq] at hm
[GOAL]
case mp.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
h : res x (Nat.succ n) = res y (Nat.succ n)
m : ℕ
hm : m < n ∨ m = n
⊢ x m = y m
[PROOFSTEP]
simp only [res_succ, cons.injEq] at h
[GOAL]
case mp.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
m : ℕ
hm : m < n ∨ m = n
h : x n = y n ∧ res x n = res y n
⊢ x m = y m
[PROOFSTEP]
cases' hm with hm hm
[GOAL]
case mp.succ.inl
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
m : ℕ
h : x n = y n ∧ res x n = res y n
hm : m < n
⊢ x m = y m
[PROOFSTEP]
exact ih h.2 hm
[GOAL]
case mp.succ.inr
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
m : ℕ
h : x n = y n ∧ res x n = res y n
hm : m = n
⊢ x m = y m
[PROOFSTEP]
rw [hm]
[GOAL]
case mp.succ.inr
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : res x n✝ = res y n✝
n : ℕ
ih : res x n = res y n → ∀ ⦃m : ℕ⦄, m < n → x m = y m
m : ℕ
h : x n = y n ∧ res x n = res y n
hm : m = n
⊢ x n = y n
[PROOFSTEP]
exact h.1
[GOAL]
case mpr.zero
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n : ℕ
h✝ : ∀ ⦃m : ℕ⦄, m < n → x m = y m
h : ∀ ⦃m : ℕ⦄, m < Nat.zero → x m = y m
⊢ res x Nat.zero = res y Nat.zero
[PROOFSTEP]
simp
[GOAL]
case mpr.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : ∀ ⦃m : ℕ⦄, m < n✝ → x m = y m
n : ℕ
ih : (∀ ⦃m : ℕ⦄, m < n → x m = y m) → res x n = res y n
h : ∀ ⦃m : ℕ⦄, m < Nat.succ n → x m = y m
⊢ res x (Nat.succ n) = res y (Nat.succ n)
[PROOFSTEP]
simp only [res_succ, cons.injEq]
[GOAL]
case mpr.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : ∀ ⦃m : ℕ⦄, m < n✝ → x m = y m
n : ℕ
ih : (∀ ⦃m : ℕ⦄, m < n → x m = y m) → res x n = res y n
h : ∀ ⦃m : ℕ⦄, m < Nat.succ n → x m = y m
⊢ x n = y n ∧ res x n = res y n
[PROOFSTEP]
refine' ⟨h (Nat.lt_succ_self _), ih fun m hm => _⟩
[GOAL]
case mpr.succ
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
n✝ : ℕ
h✝ : ∀ ⦃m : ℕ⦄, m < n✝ → x m = y m
n : ℕ
ih : (∀ ⦃m : ℕ⦄, m < n → x m = y m) → res x n = res y n
h : ∀ ⦃m : ℕ⦄, m < Nat.succ n → x m = y m
m : ℕ
hm : m < n
⊢ x m = y m
[PROOFSTEP]
exact h (hm.trans (Nat.lt_succ_self _))
[GOAL]
E : ℕ → Type u_1
α : Type u_2
⊢ Injective res
[PROOFSTEP]
intro x y h
[GOAL]
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
h : res x = res y
⊢ x = y
[PROOFSTEP]
ext n
[GOAL]
case h
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
h : res x = res y
n : ℕ
⊢ x n = y n
[PROOFSTEP]
apply res_eq_res.mp _ (Nat.lt_succ_self _)
[GOAL]
E : ℕ → Type u_1
α : Type u_2
x y : ℕ → α
h : res x = res y
n : ℕ
⊢ res x (Nat.succ n) = res (fun n => y n) (Nat.succ n)
[PROOFSTEP]
rw [h]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
n : ℕ
⊢ cylinder x n = {y | res y n = res x n}
[PROOFSTEP]
ext y
[GOAL]
case h
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
n : ℕ
y : ℕ → α
⊢ y ∈ cylinder x n ↔ y ∈ {y | res y n = res x n}
[PROOFSTEP]
dsimp [cylinder]
[GOAL]
case h
E : ℕ → Type u_1
α : Type u_2
x : ℕ → α
n : ℕ
y : ℕ → α
⊢ (∀ (i : ℕ), i < n → y i = x i) ↔ res y n = res x n
[PROOFSTEP]
rw [res_eq_res]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
h : x ≠ y
⊢ dist x y = (1 / 2) ^ firstDiff x y
[PROOFSTEP]
simp [dist, h]
[GOAL]
E : ℕ → Type u_1
x : (n : ℕ) → E n
⊢ dist x x = 0
[PROOFSTEP]
simp [dist]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
⊢ dist x y = dist y x
[PROOFSTEP]
simp [dist, @eq_comm _ x y, firstDiff_comm]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
⊢ 0 ≤ dist x y
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | h)
[GOAL]
case inl
E : ℕ → Type u_1
x : (n : ℕ) → E n
⊢ 0 ≤ dist x x
[PROOFSTEP]
simp [dist]
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
h : x ≠ y
⊢ 0 ≤ dist x y
[PROOFSTEP]
simp [dist, h, zero_le_two]
[GOAL]
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
⊢ dist x z ≤ max (dist x y) (dist y z)
[PROOFSTEP]
rcases eq_or_ne x z with (rfl | hxz)
[GOAL]
case inl
E : ℕ → Type u_1
x y : (n : ℕ) → E n
⊢ dist x x ≤ max (dist x y) (dist y x)
[PROOFSTEP]
simp [PiNat.dist_self x, PiNat.dist_nonneg]
[GOAL]
case inr
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
hxz : x ≠ z
⊢ dist x z ≤ max (dist x y) (dist y z)
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | hxy)
[GOAL]
case inr.inl
E : ℕ → Type u_1
x z : (n : ℕ) → E n
hxz : x ≠ z
⊢ dist x z ≤ max (dist x x) (dist x z)
[PROOFSTEP]
simp
[GOAL]
case inr.inr
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
hxz : x ≠ z
hxy : x ≠ y
⊢ dist x z ≤ max (dist x y) (dist y z)
[PROOFSTEP]
rcases eq_or_ne y z with (rfl | hyz)
[GOAL]
case inr.inr.inl
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hxy hxz : x ≠ y
⊢ dist x y ≤ max (dist x y) (dist y y)
[PROOFSTEP]
simp
[GOAL]
case inr.inr.inr
E : ℕ → Type u_1
x y z : (n : ℕ) → E n
hxz : x ≠ z
hxy : x ≠ y
hyz : y ≠ z
⊢ dist x z ≤ max (dist x y) (dist y z)
[PROOFSTEP]
simp only [dist_eq_of_ne, hxz, hxy, hyz, inv_le_inv, one_div, inv_pow, zero_lt_two, Ne.def, not_false_iff, le_max_iff,
  pow_le_pow_iff, one_lt_two, pow_pos, min_le_iff.1 (min_firstDiff_le x y z hxz)]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hxy : dist x y = 0
⊢ x = y
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | h)
[GOAL]
case inl
E : ℕ → Type u_1
x : (n : ℕ) → E n
hxy : dist x x = 0
⊢ x = x
[PROOFSTEP]
rfl
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
hxy : dist x y = 0
h : x ≠ y
⊢ x = y
[PROOFSTEP]
simp [dist_eq_of_ne h] at hxy
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
h : x ≠ y
hxy : 2 ^ firstDiff x y = 0
⊢ x = y
[PROOFSTEP]
exact (two_ne_zero (pow_eq_zero hxy)).elim
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
⊢ y ∈ cylinder x n ↔ dist y x ≤ (1 / 2) ^ n
[PROOFSTEP]
rcases eq_or_ne y x with (rfl | hne)
[GOAL]
case inl
E : ℕ → Type u_1
y : (n : ℕ) → E n
n : ℕ
⊢ y ∈ cylinder y n ↔ dist y y ≤ (1 / 2) ^ n
[PROOFSTEP]
simp [PiNat.dist_self]
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
⊢ y ∈ cylinder x n ↔ dist y x ≤ (1 / 2) ^ n
[PROOFSTEP]
suffices (∀ i : ℕ, i < n → y i = x i) ↔ n ≤ firstDiff y x by simpa [dist_eq_of_ne hne]
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
this : (∀ (i : ℕ), i < n → y i = x i) ↔ n ≤ firstDiff y x
⊢ y ∈ cylinder x n ↔ dist y x ≤ (1 / 2) ^ n
[PROOFSTEP]
simpa [dist_eq_of_ne hne]
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
⊢ (∀ (i : ℕ), i < n → y i = x i) ↔ n ≤ firstDiff y x
[PROOFSTEP]
constructor
[GOAL]
case inr.mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
⊢ (∀ (i : ℕ), i < n → y i = x i) → n ≤ firstDiff y x
[PROOFSTEP]
intro hy
[GOAL]
case inr.mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
hy : ∀ (i : ℕ), i < n → y i = x i
⊢ n ≤ firstDiff y x
[PROOFSTEP]
by_contra' H
[GOAL]
case inr.mp
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
hy : ∀ (i : ℕ), i < n → y i = x i
H : firstDiff y x < n
⊢ False
[PROOFSTEP]
exact apply_firstDiff_ne hne (hy _ H)
[GOAL]
case inr.mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
⊢ n ≤ firstDiff y x → ∀ (i : ℕ), i < n → y i = x i
[PROOFSTEP]
intro h i hi
[GOAL]
case inr.mpr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
hne : y ≠ x
h : n ≤ firstDiff y x
i : ℕ
hi : i < n
⊢ y i = x i
[PROOFSTEP]
exact apply_eq_of_lt_firstDiff (hi.trans_le h)
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : dist x y < (1 / 2) ^ n
i : ℕ
hi : i ≤ n
⊢ x i = y i
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | hne)
[GOAL]
case inl
E : ℕ → Type u_1
x : (n : ℕ) → E n
n i : ℕ
hi : i ≤ n
h : dist x x < (1 / 2) ^ n
⊢ x i = x i
[PROOFSTEP]
rfl
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : dist x y < (1 / 2) ^ n
i : ℕ
hi : i ≤ n
hne : x ≠ y
⊢ x i = y i
[PROOFSTEP]
have : n < firstDiff x y := by simpa [dist_eq_of_ne hne, inv_lt_inv, pow_lt_pow_iff, one_lt_two] using h
[GOAL]
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : dist x y < (1 / 2) ^ n
i : ℕ
hi : i ≤ n
hne : x ≠ y
⊢ n < firstDiff x y
[PROOFSTEP]
simpa [dist_eq_of_ne hne, inv_lt_inv, pow_lt_pow_iff, one_lt_two] using h
[GOAL]
case inr
E : ℕ → Type u_1
x y : (n : ℕ) → E n
n : ℕ
h : dist x y < (1 / 2) ^ n
i : ℕ
hi : i ≤ n
hne : x ≠ y
this : n < firstDiff x y
⊢ x i = y i
[PROOFSTEP]
exact apply_eq_of_lt_firstDiff (hi.trans_lt this)
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
⊢ (∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y) ↔
    ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
[PROOFSTEP]
constructor
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
⊢ (∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y) →
    ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
[PROOFSTEP]
intro H x y n hxy
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y
x y : (n : ℕ) → E n
n : ℕ
hxy : y ∈ cylinder x n
⊢ dist (f x) (f y) ≤ (1 / 2) ^ n
[PROOFSTEP]
apply (H x y).trans
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y
x y : (n : ℕ) → E n
n : ℕ
hxy : y ∈ cylinder x n
⊢ dist x y ≤ (1 / 2) ^ n
[PROOFSTEP]
rw [PiNat.dist_comm]
[GOAL]
case mp
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y
x y : (n : ℕ) → E n
n : ℕ
hxy : y ∈ cylinder x n
⊢ dist y x ≤ (1 / 2) ^ n
[PROOFSTEP]
exact mem_cylinder_iff_dist_le.1 hxy
[GOAL]
case mpr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
⊢ (∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n) →
    ∀ (x y : (n : ℕ) → E n), dist (f x) (f y) ≤ dist x y
[PROOFSTEP]
intro H x y
[GOAL]
case mpr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x y : (n : ℕ) → E n
⊢ dist (f x) (f y) ≤ dist x y
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | hne)
[GOAL]
case mpr.inl
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x : (n : ℕ) → E n
⊢ dist (f x) (f x) ≤ dist x x
[PROOFSTEP]
simp [PiNat.dist_nonneg]
[GOAL]
case mpr.inr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x y : (n : ℕ) → E n
hne : x ≠ y
⊢ dist (f x) (f y) ≤ dist x y
[PROOFSTEP]
rw [dist_eq_of_ne hne]
[GOAL]
case mpr.inr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x y : (n : ℕ) → E n
hne : x ≠ y
⊢ dist (f x) (f y) ≤ (1 / 2) ^ firstDiff x y
[PROOFSTEP]
apply H x y (firstDiff x y)
[GOAL]
case mpr.inr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x y : (n : ℕ) → E n
hne : x ≠ y
⊢ y ∈ cylinder x (firstDiff x y)
[PROOFSTEP]
rw [firstDiff_comm]
[GOAL]
case mpr.inr
E : ℕ → Type u_1
α : Type u_2
inst✝ : PseudoMetricSpace α
f : ((n : ℕ) → E n) → α
H : ∀ (x y : (n : ℕ) → E n) (n : ℕ), y ∈ cylinder x n → dist (f x) (f y) ≤ (1 / 2) ^ n
x y : (n : ℕ) → E n
hne : x ≠ y
⊢ y ∈ cylinder x (firstDiff y x)
[PROOFSTEP]
exact mem_cylinder_firstDiff _ _
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
n : ℕ
⊢ IsOpen (cylinder x n)
[PROOFSTEP]
rw [PiNat.cylinder_eq_pi]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
n : ℕ
⊢ IsOpen (Set.pi ↑(Finset.range n) fun i => {x i})
[PROOFSTEP]
exact isOpen_set_pi (Finset.range n).finite_toSet fun a _ => isOpen_discrete _
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ IsTopologicalBasis {s | ∃ x n, s = cylinder x n}
[PROOFSTEP]
apply isTopologicalBasis_of_open_of_nhds
[GOAL]
case h_open
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (u : Set ((n : ℕ) → E n)), u ∈ {s | ∃ x n, s = cylinder x n} → IsOpen u
[PROOFSTEP]
rintro u ⟨x, n, rfl⟩
[GOAL]
case h_open.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
n : ℕ
⊢ IsOpen (cylinder x n)
[PROOFSTEP]
apply isOpen_cylinder
[GOAL]
case h_nhds
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (a : (n : ℕ) → E n) (u : Set ((n : ℕ) → E n)),
    a ∈ u → IsOpen u → ∃ v, v ∈ {s | ∃ x n, s = cylinder x n} ∧ a ∈ v ∧ v ⊆ u
[PROOFSTEP]
intro x u hx u_open
[GOAL]
case h_nhds
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
⊢ ∃ v, v ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ v ∧ v ⊆ u
[PROOFSTEP]
obtain ⟨v, ⟨U, F, -, rfl⟩, xU, Uu⟩ :
  ∃
    v ∈
      {S : Set (∀ i : ℕ, E i) |
        ∃ (U : ∀ i : ℕ, Set (E i)) (F : Finset ℕ),
          (∀ i : ℕ, i ∈ F → U i ∈ {s : Set (E i) | IsOpen s}) ∧ S = (F : Set ℕ).pi U},
    x ∈ v ∧ v ⊆ u :=
  (isTopologicalBasis_pi fun n : ℕ => isTopologicalBasis_opens).exists_subset_of_mem_open hx u_open
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
⊢ ∃ v, v ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ v ∧ v ⊆ u
[PROOFSTEP]
rcases Finset.bddAbove F with ⟨n, hn⟩
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
⊢ ∃ v, v ∈ {s | ∃ x n, s = cylinder x n} ∧ x ∈ v ∧ v ⊆ u
[PROOFSTEP]
refine' ⟨cylinder x (n + 1), ⟨x, n + 1, rfl⟩, self_mem_cylinder _ _, Subset.trans _ Uu⟩
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
⊢ cylinder x (n + 1) ⊆ Set.pi (↑F) U
[PROOFSTEP]
intro y hy
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
⊢ y ∈ Set.pi (↑F) U
[PROOFSTEP]
suffices ∀ i : ℕ, i ∈ F → y i ∈ U i by simpa
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
this : ∀ (i : ℕ), i ∈ F → y i ∈ U i
⊢ y ∈ Set.pi (↑F) U
[PROOFSTEP]
simpa
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
⊢ ∀ (i : ℕ), i ∈ F → y i ∈ U i
[PROOFSTEP]
intro i hi
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
i : ℕ
hi : i ∈ F
⊢ y i ∈ U i
[PROOFSTEP]
have : y i = x i := mem_cylinder_iff.1 hy i ((hn hi).trans_lt (lt_add_one n))
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
i : ℕ
hi : i ∈ F
this : y i = x i
⊢ y i ∈ U i
[PROOFSTEP]
rw [this]
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
xU : x ∈ Set.pi (↑F) U
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
i : ℕ
hi : i ∈ F
this : y i = x i
⊢ x i ∈ U i
[PROOFSTEP]
simp only [Set.mem_pi, Finset.mem_coe] at xU
[GOAL]
case h_nhds.intro.intro.intro.intro.intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
u : Set ((n : ℕ) → E n)
hx : x ∈ u
u_open : IsOpen u
U : (i : ℕ) → Set (E i)
F : Finset ℕ
Uu : Set.pi (↑F) U ⊆ u
n : ℕ
hn : n ∈ upperBounds ↑F
y : (n : ℕ) → E n
hy : y ∈ cylinder x (n + 1)
i : ℕ
hi : i ∈ F
this : y i = x i
xU : ∀ (i : ℕ), i ∈ F → x i ∈ U i
⊢ x i ∈ U i
[PROOFSTEP]
exact xU i hi
[GOAL]
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
[PROOFSTEP]
constructor
[GOAL]
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
[PROOFSTEP]
intro hs x hx
[GOAL]
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
[PROOFSTEP]
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
[GOAL]
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
[PROOFSTEP]
rw [← mem_cylinder_iff_eq.1 h'x] at h's
[GOAL]
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
[PROOFSTEP]
exact ⟨(1 / 2 : ℝ) ^ n, by simp, fun y hy => h's fun i hi => (apply_eq_of_dist_lt hy hi.le).symm⟩
[GOAL]
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
[PROOFSTEP]
simp
[GOAL]
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
[PROOFSTEP]
intro h
[GOAL]
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
[PROOFSTEP]
refine (isTopologicalBasis_cylinders E).isOpen_iff.2 fun x hx => ?_
[GOAL]
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
[PROOFSTEP]
rcases h x hx with ⟨ε, εpos, hε⟩
[GOAL]
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
[PROOFSTEP]
obtain ⟨n, hn⟩ : ∃ n : ℕ, (1 / 2 : ℝ) ^ n < ε := exists_pow_lt_of_lt_one εpos one_half_lt_one
[GOAL]
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
[PROOFSTEP]
refine' ⟨cylinder x n, ⟨x, n, rfl⟩, self_mem_cylinder x n, fun y hy => hε y _⟩
[GOAL]
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 < ε
[PROOFSTEP]
rw [PiNat.dist_comm]
[GOAL]
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 < ε
[PROOFSTEP]
exact (mem_cylinder_iff_dist_le.1 hy).trans_lt hn
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
x✝¹ x✝ : (n : ℕ) → E n
⊢ (fun x y => ↑{ val := dist x y, property := (_ : 0 ≤ dist x y) }) x✝¹ x✝ = ENNReal.ofReal (dist x✝¹ x✝)
[PROOFSTEP]
exact ENNReal.coe_nnreal_eq _
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ uniformity ((n : ℕ) → E n) = ⨅ (ε : ℝ) (_ : ε > 0), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp [Pi.uniformity, comap_iInf, gt_iff_lt, preimage_setOf_eq, comap_principal, PseudoMetricSpace.uniformity_dist, h,
  idRel]
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i} = ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i} ≤ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp only [le_iInf_iff, le_principal_iff]
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (i : ℝ), 0 < i → {p | dist p.fst p.snd < i} ∈ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i}
[PROOFSTEP]
intro ε εpos
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
⊢ {p | dist p.fst p.snd < ε} ∈ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i}
[PROOFSTEP]
obtain ⟨n, hn⟩ : ∃ n, (1 / 2 : ℝ) ^ n < ε := exists_pow_lt_of_lt_one εpos (by norm_num)
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
case a.intro
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
⊢ {p | dist p.fst p.snd < ε} ∈ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i}
[PROOFSTEP]
apply
  @mem_iInf_of_iInter _ _ _ _ _ (Finset.range n).finite_toSet fun i =>
    {p : (∀ n : ℕ, E n) × ∀ n : ℕ, E n | p.fst i = p.snd i}
[GOAL]
case a.intro.hV
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
⊢ ∀ (i : ↑↑(Finset.range n)), {p | Prod.fst p ↑i = Prod.snd p ↑i} ∈ 𝓟 {a | Prod.fst a ↑i = Prod.snd a ↑i}
[PROOFSTEP]
simp only [mem_principal, setOf_subset_setOf, imp_self, imp_true_iff]
[GOAL]
case a.intro.hU
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
⊢ ⋂ (i : ↑↑(Finset.range n)), {p | Prod.fst p ↑i = Prod.snd p ↑i} ⊆ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
rintro ⟨x, y⟩ hxy
[GOAL]
case a.intro.hU.mk
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
x y : (n : ℕ) → E n
hxy : (x, y) ∈ ⋂ (i : ↑↑(Finset.range n)), {p | Prod.fst p ↑i = Prod.snd p ↑i}
⊢ (x, y) ∈ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp only [Finset.mem_coe, Finset.mem_range, iInter_coe_set, mem_iInter, mem_setOf_eq] at hxy
[GOAL]
case a.intro.hU.mk
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
x y : (n : ℕ) → E n
hxy : ∀ (i : ℕ), i < n → x i = y i
⊢ (x, y) ∈ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
apply lt_of_le_of_lt _ hn
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
x y : (n : ℕ) → E n
hxy : ∀ (i : ℕ), i < n → x i = y i
⊢ dist (x, y).fst (x, y).snd ≤ (1 / 2) ^ n
[PROOFSTEP]
rw [← mem_cylinder_iff_dist_le, mem_cylinder_iff]
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
ε : ℝ
εpos : 0 < ε
n : ℕ
hn : (1 / 2) ^ n < ε
x y : (n : ℕ) → E n
hxy : ∀ (i : ℕ), i < n → x i = y i
⊢ ∀ (i : ℕ), i < n → Prod.fst (x, y) i = Prod.snd (x, y) i
[PROOFSTEP]
exact hxy
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε} ≤ ⨅ (i : ℕ), 𝓟 {a | Prod.fst a i = Prod.snd a i}
[PROOFSTEP]
simp only [le_iInf_iff, le_principal_iff]
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (i : ℕ), {a | Prod.fst a i = Prod.snd a i} ∈ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
intro n
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
⊢ {a | Prod.fst a n = Prod.snd a n} ∈ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
refine' mem_iInf_of_mem ((1 / 2) ^ n : ℝ) _
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
⊢ {a | Prod.fst a n = Prod.snd a n} ∈ ⨅ (_ : 0 < (1 / 2) ^ n), 𝓟 {p | dist p.fst p.snd < (1 / 2) ^ n}
[PROOFSTEP]
refine' mem_iInf_of_mem (by positivity) _
[GOAL]
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
⊢ 0 < (1 / 2) ^ n
[PROOFSTEP]
positivity
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
⊢ {a | Prod.fst a n = Prod.snd a n} ∈ 𝓟 {p | dist p.fst p.snd < (1 / 2) ^ n}
[PROOFSTEP]
simp only [mem_principal, setOf_subset_setOf, Prod.forall]
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
⊢ ∀ (a b : (n : ℕ) → E n), dist a b < (1 / 2) ^ n → a n = b n
[PROOFSTEP]
intro x y hxy
[GOAL]
case a
E✝ : ℕ → Type u_1
inst✝² : (n : ℕ) → TopologicalSpace (E✝ n)
inst✝¹ : ∀ (n : ℕ), DiscreteTopology (E✝ n)
E : ℕ → Type u_2
inst✝ : (n : ℕ) → UniformSpace (E n)
h : ∀ (n : ℕ), uniformity (E n) = 𝓟 idRel
this : ∀ (n : ℕ), DiscreteTopology (E n)
n : ℕ
x y : (n : ℕ) → E n
hxy : dist x y < (1 / 2) ^ n
⊢ x n = y n
[PROOFSTEP]
exact apply_eq_of_dist_lt hxy le_rfl
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ CompleteSpace ((n : ℕ) → E n)
[PROOFSTEP]
refine' Metric.complete_of_convergent_controlled_sequences (fun n => (1 / 2) ^ n) (by simp) _
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (n : ℕ), 0 < (fun n => (1 / 2) ^ n) n
[PROOFSTEP]
simp
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
⊢ ∀ (u : ℕ → (n : ℕ) → E n),
    (∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < (fun n => (1 / 2) ^ n) N) → ∃ x, Tendsto u atTop (𝓝 x)
[PROOFSTEP]
intro u hu
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
u : ℕ → (n : ℕ) → E n
hu : ∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < (fun n => (1 / 2) ^ n) N
⊢ ∃ x, Tendsto u atTop (𝓝 x)
[PROOFSTEP]
refine' ⟨fun n => u n n, tendsto_pi_nhds.2 fun i => _⟩
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
u : ℕ → (n : ℕ) → E n
hu : ∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < (fun n => (1 / 2) ^ n) N
i : ℕ
⊢ Tendsto (fun i_1 => u i_1 i) atTop (𝓝 (u i i))
[PROOFSTEP]
refine' tendsto_const_nhds.congr' _
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
u : ℕ → (n : ℕ) → E n
hu : ∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < (fun n => (1 / 2) ^ n) N
i : ℕ
⊢ (fun x => u i i) =ᶠ[atTop] fun i_1 => u i_1 i
[PROOFSTEP]
filter_upwards [Filter.Ici_mem_atTop i] with n hn
[GOAL]
case h
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
u : ℕ → (n : ℕ) → E n
hu : ∀ (N n m : ℕ), N ≤ n → N ≤ m → dist (u n) (u m) < (fun n => (1 / 2) ^ n) N
i n : ℕ
hn : n ∈ Ici i
⊢ u i i = u n i
[PROOFSTEP]
exact apply_eq_of_dist_lt (hu i i n le_rfl hn) le_rfl
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
⊢ ∃ n, Disjoint s (cylinder x n)
[PROOFSTEP]
rcases eq_empty_or_nonempty s with (rfl | hne)
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
hs : IsClosed ∅
hx : ¬x ∈ ∅
⊢ ∃ n, Disjoint ∅ (cylinder x n)
[PROOFSTEP]
exact ⟨0, by simp⟩
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x : (n : ℕ) → E n
hs : IsClosed ∅
hx : ¬x ∈ ∅
⊢ Disjoint ∅ (cylinder x 0)
[PROOFSTEP]
simp
[GOAL]
case inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
⊢ ∃ n, Disjoint s (cylinder x n)
[PROOFSTEP]
have A : 0 < infDist x s := (hs.not_mem_iff_infDist_pos hne).1 hx
[GOAL]
case inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
⊢ ∃ n, Disjoint s (cylinder x n)
[PROOFSTEP]
obtain ⟨n, hn⟩ : ∃ n, (1 / 2 : ℝ) ^ n < infDist x s := exists_pow_lt_of_lt_one A one_half_lt_one
[GOAL]
case inr.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
n : ℕ
hn : (1 / 2) ^ n < infDist x s
⊢ ∃ n, Disjoint s (cylinder x n)
[PROOFSTEP]
refine' ⟨n, disjoint_left.2 fun y ys hy => ?_⟩
[GOAL]
case inr.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
n : ℕ
hn : (1 / 2) ^ n < infDist x s
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ False
[PROOFSTEP]
apply lt_irrefl (infDist x s)
[GOAL]
case inr.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
n : ℕ
hn : (1 / 2) ^ n < infDist x s
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ infDist x s < infDist x s
[PROOFSTEP]
calc
  infDist x s ≤ dist x y := infDist_le_dist_of_mem ys
  _ ≤ (1 / 2) ^ n := by
    rw [mem_cylinder_comm] at hy
    exact mem_cylinder_iff_dist_le.1 hy
  _ < infDist x s := hn
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
n : ℕ
hn : (1 / 2) ^ n < infDist x s
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ dist x y ≤ (1 / 2) ^ n
[PROOFSTEP]
rw [mem_cylinder_comm] at hy
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
hne : Set.Nonempty s
A : 0 < infDist x s
n : ℕ
hn : (1 / 2) ^ n < infDist x s
y : (n : ℕ) → E n
ys : y ∈ s
hy : x ∈ cylinder y n
⊢ dist x y ≤ (1 / 2) ^ n
[PROOFSTEP]
exact mem_cylinder_iff_dist_le.1 hy
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
⊢ firstDiff x y < shortestPrefixDiff x s
[PROOFSTEP]
have A := exists_disjoint_cylinder hs hx
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
⊢ firstDiff x y < shortestPrefixDiff x s
[PROOFSTEP]
rw [shortestPrefixDiff, dif_pos A]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
⊢ firstDiff x y < Nat.find A
[PROOFSTEP]
have B := Nat.find_spec A
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Disjoint s (cylinder x (Nat.find A))
⊢ firstDiff x y < Nat.find A
[PROOFSTEP]
contrapose! B
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A ≤ firstDiff x y
⊢ ¬Disjoint s (cylinder x (Nat.find A))
[PROOFSTEP]
rw [not_disjoint_iff_nonempty_inter]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A ≤ firstDiff x y
⊢ Set.Nonempty (s ∩ cylinder x (Nat.find A))
[PROOFSTEP]
refine' ⟨y, hy, _⟩
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A ≤ firstDiff x y
⊢ y ∈ cylinder x (Nat.find A)
[PROOFSTEP]
rw [mem_cylinder_comm]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
A : ∃ n, Disjoint s (cylinder x n)
B : Nat.find A ≤ firstDiff x y
⊢ x ∈ cylinder y (Nat.find A)
[PROOFSTEP]
exact cylinder_anti y B (mem_cylinder_firstDiff x y)
[GOAL]
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
⊢ 0 < shortestPrefixDiff x s
[PROOFSTEP]
rcases hne with ⟨y, hy⟩
[GOAL]
case intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
y : (n : ℕ) → E n
hy : y ∈ s
⊢ 0 < shortestPrefixDiff x s
[PROOFSTEP]
exact (zero_le _).trans_lt (firstDiff_lt_shortestPrefixDiff hs hx hy)
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
⊢ firstDiff x y ≤ longestPrefix x s
[PROOFSTEP]
rw [longestPrefix, le_tsub_iff_right]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
⊢ firstDiff x y + 1 ≤ shortestPrefixDiff x s
[PROOFSTEP]
exact firstDiff_lt_shortestPrefixDiff hs hx hy
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x y : (n : ℕ) → E n
hx : ¬x ∈ s
hy : y ∈ s
⊢ 1 ≤ shortestPrefixDiff x s
[PROOFSTEP]
exact shortestPrefixDiff_pos hs ⟨y, hy⟩ hx
[GOAL]
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))
[PROOFSTEP]
by_cases hx : x ∈ s
[GOAL]
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))
[PROOFSTEP]
exact ⟨x, hx, self_mem_cylinder _ _⟩
[GOAL]
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))
[PROOFSTEP]
have A := exists_disjoint_cylinder hs hx
[GOAL]
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))
[PROOFSTEP]
have B : longestPrefix x s < shortestPrefixDiff x s := Nat.pred_lt (shortestPrefixDiff_pos hs hne hx).ne'
[GOAL]
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))
[PROOFSTEP]
rw [longestPrefix, shortestPrefixDiff, dif_pos A] at B ⊢
[GOAL]
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))
[PROOFSTEP]
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
[GOAL]
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)
[PROOFSTEP]
simpa only [not_disjoint_iff, mem_cylinder_comm] using Nat.find_min A B
[GOAL]
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))
[PROOFSTEP]
refine' ⟨y, ys, _⟩
[GOAL]
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)
[PROOFSTEP]
rw [mem_cylinder_iff_eq] at hy ⊢
[GOAL]
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)
[PROOFSTEP]
rw [hy]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
n : ℕ
hn : longestPrefix x s < n
⊢ Disjoint s (cylinder x n)
[PROOFSTEP]
contrapose! hn
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
n : ℕ
hn : ¬Disjoint s (cylinder x n)
⊢ n ≤ longestPrefix x s
[PROOFSTEP]
rcases not_disjoint_iff_nonempty_inter.1 hn with ⟨y, ys, hy⟩
[GOAL]
case intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
n : ℕ
hn : ¬Disjoint s (cylinder x n)
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ n ≤ longestPrefix x s
[PROOFSTEP]
apply le_trans _ (firstDiff_le_longestPrefix hs hx ys)
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
n : ℕ
hn : ¬Disjoint s (cylinder x n)
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ n ≤ firstDiff x y
[PROOFSTEP]
apply (mem_cylinder_iff_le_firstDiff (ne_of_mem_of_not_mem ys hx).symm _).1
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
s : Set ((n : ℕ) → E n)
hs : IsClosed s
x : (n : ℕ) → E n
hx : ¬x ∈ s
n : ℕ
hn : ¬Disjoint s (cylinder x n)
y : (n : ℕ) → E n
ys : y ∈ s
hy : y ∈ cylinder x n
⊢ x ∈ cylinder y n
[PROOFSTEP]
rwa [mem_cylinder_comm]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
⊢ cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)
[PROOFSTEP]
have l_eq : longestPrefix y s = longestPrefix x s :=
  by
  rcases lt_trichotomy (longestPrefix y s) (longestPrefix x s) with (L | L | L)
  · have Ax : (s ∩ cylinder x (longestPrefix x s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne x
    have Z := disjoint_cylinder_of_longestPrefix_lt hs ys L
    rw [firstDiff_comm] at H
    rw [cylinder_eq_cylinder_of_le_firstDiff _ _ H.le] at Z
    exact (Ax.not_disjoint Z).elim
  · exact L
  · have Ay : (s ∩ cylinder y (longestPrefix y s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne y
    have A'y : (s ∩ cylinder y (longestPrefix x s).succ).Nonempty :=
      Ay.mono (inter_subset_inter_right s (cylinder_anti _ L))
    have Z := disjoint_cylinder_of_longestPrefix_lt hs xs (Nat.lt_succ_self _)
    rw [cylinder_eq_cylinder_of_le_firstDiff _ _ H] at Z
    exact (A'y.not_disjoint Z).elim
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
rcases lt_trichotomy (longestPrefix y s) (longestPrefix x s) with (L | L | L)
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s < longestPrefix x s
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
have Ax : (s ∩ cylinder x (longestPrefix x s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne x
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s < longestPrefix x s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
have Z := disjoint_cylinder_of_longestPrefix_lt hs ys L
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s < longestPrefix x s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
Z : Disjoint s (cylinder y (longestPrefix x s))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
rw [firstDiff_comm] at H
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff y x
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s < longestPrefix x s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
Z : Disjoint s (cylinder y (longestPrefix x s))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
rw [cylinder_eq_cylinder_of_le_firstDiff _ _ H.le] at Z
[GOAL]
case inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff y x
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s < longestPrefix x s
Ax : Set.Nonempty (s ∩ cylinder x (longestPrefix x s))
Z : Disjoint s (cylinder x (longestPrefix x s))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
exact (Ax.not_disjoint Z).elim
[GOAL]
case inr.inl
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix y s = longestPrefix x s
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
exact L
[GOAL]
case inr.inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix x s < longestPrefix y s
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
have Ay : (s ∩ cylinder y (longestPrefix y s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne y
[GOAL]
case inr.inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix x s < longestPrefix y s
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
have A'y : (s ∩ cylinder y (longestPrefix x s).succ).Nonempty :=
  Ay.mono (inter_subset_inter_right s (cylinder_anti _ L))
[GOAL]
case inr.inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix x s < longestPrefix y s
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
A'y : Set.Nonempty (s ∩ cylinder y (Nat.succ (longestPrefix x s)))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
have Z := disjoint_cylinder_of_longestPrefix_lt hs xs (Nat.lt_succ_self _)
[GOAL]
case inr.inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix x s < longestPrefix y s
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
A'y : Set.Nonempty (s ∩ cylinder y (Nat.succ (longestPrefix x s)))
Z : Disjoint s (cylinder x (Nat.succ (longestPrefix x s)))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
rw [cylinder_eq_cylinder_of_le_firstDiff _ _ H] at Z
[GOAL]
case inr.inr
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
L : longestPrefix x s < longestPrefix y s
Ay : Set.Nonempty (s ∩ cylinder y (longestPrefix y s))
A'y : Set.Nonempty (s ∩ cylinder y (Nat.succ (longestPrefix x s)))
Z : Disjoint s (cylinder y (Nat.succ (longestPrefix x s)))
⊢ longestPrefix y s = longestPrefix x s
[PROOFSTEP]
exact (A'y.not_disjoint Z).elim
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
l_eq : longestPrefix y s = longestPrefix x s
⊢ cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s)
[PROOFSTEP]
rw [l_eq, ← mem_cylinder_iff_eq]
[GOAL]
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
x y : (n : ℕ) → E n
s : Set ((n : ℕ) → E n)
hs : IsClosed s
hne : Set.Nonempty s
H : longestPrefix x s < firstDiff x y
xs : ¬x ∈ s
ys : ¬y ∈ s
l_eq : longestPrefix y s = longestPrefix x s
⊢ x ∈ cylinder y (longestPrefix x s)
[PROOFSTEP]
exact cylinder_anti y H.le (mem_cylinder_firstDiff x y)
[GOAL]
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
[PROOFSTEP]
set f := fun x => if x ∈ s then x else (inter_cylinder_longestPrefix_nonempty hs hne x).some
[GOAL]
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
[PROOFSTEP]
have fs : ∀ x ∈ s, f x = x := fun x xs => by simp [xs]
[GOAL]
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
[PROOFSTEP]
simp [xs]
[GOAL]
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
[PROOFSTEP]
refine'
  ⟨f, fs, _, _⟩
    -- check that the range of `f` is `s`.
[GOAL]
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
[PROOFSTEP]
apply Subset.antisymm
[GOAL]
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
[PROOFSTEP]
rintro x ⟨y, rfl⟩
[GOAL]
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
[PROOFSTEP]
by_cases hy : y ∈ s
[GOAL]
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
[PROOFSTEP]
rwa [fs y hy]
[GOAL]
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
[PROOFSTEP]
simpa [if_neg hy] using (inter_cylinder_longestPrefix_nonempty hs hne y).choose_spec.1
[GOAL]
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
[PROOFSTEP]
intro x hx
[GOAL]
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
[PROOFSTEP]
rw [← fs x hx]
[GOAL]
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
[PROOFSTEP]
exact
  mem_range_self
    _
      -- check that `f` is `1`-Lipschitz, by a case analysis.
[GOAL]
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
[PROOFSTEP]
refine
  LipschitzWith.mk_one fun x y =>
    ?_
      -- exclude the trivial cases where `x = y`, or `f x = f y`.
[GOAL]
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
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | hxy)
[GOAL]
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
[PROOFSTEP]
simp
[GOAL]
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
[PROOFSTEP]
rcases eq_or_ne (f x) (f y) with (h' | hfxfy)
[GOAL]
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
[PROOFSTEP]
simp [h', dist_nonneg]
[GOAL]
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
[PROOFSTEP]
have I2 : cylinder x (firstDiff x y) = cylinder y (firstDiff x y) :=
  by
  rw [← mem_cylinder_iff_eq]
  apply mem_cylinder_firstDiff
[GOAL]
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)
[PROOFSTEP]
rw [← mem_cylinder_iff_eq]
[GOAL]
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)
[PROOFSTEP]
apply mem_cylinder_firstDiff
[GOAL]
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
[PROOFSTEP]
suffices firstDiff x y ≤ firstDiff (f x) (f y) by
  simpa [dist_eq_of_ne hxy, dist_eq_of_ne hfxfy]
    -- case where `x ∈ s`
[GOAL]
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
[PROOFSTEP]
simpa [dist_eq_of_ne hxy, dist_eq_of_ne hfxfy]
  -- case where `x ∈ s`
[GOAL]
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)
[PROOFSTEP]
by_cases xs : x ∈ s
[GOAL]
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)
[PROOFSTEP]
rw [fs x xs] at hfxfy ⊢
  -- case where `y ∈ s`, trivial
[GOAL]
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)
[PROOFSTEP]
by_cases ys : y ∈ s
[GOAL]
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)
[PROOFSTEP]
rw [fs y ys]
  -- case where `y ∉ s`
[GOAL]
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)
[PROOFSTEP]
have A : (s ∩ cylinder y (longestPrefix y s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne y
[GOAL]
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)
[PROOFSTEP]
have fy : f y = A.some := by simp_rw [if_neg ys]
[GOAL]
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
[PROOFSTEP]
simp_rw [if_neg ys]
[GOAL]
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)
[PROOFSTEP]
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
[GOAL]
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)
[PROOFSTEP]
rw [← mem_cylinder_iff_eq, firstDiff_comm]
[GOAL]
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)
[PROOFSTEP]
apply cylinder_anti y _ A.some_mem.2
[GOAL]
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
[PROOFSTEP]
exact firstDiff_le_longestPrefix hs ys xs
[GOAL]
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)
[PROOFSTEP]
rwa [← fy, ← I2, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy.symm, firstDiff_comm _ x] at I
[GOAL]
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)
[PROOFSTEP]
by_cases ys : y ∈ s
[GOAL]
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)
[PROOFSTEP]
have A : (s ∩ cylinder x (longestPrefix x s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne x
[GOAL]
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)
[PROOFSTEP]
have fx : f x = A.some := by simp_rw [if_neg xs]
[GOAL]
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
[PROOFSTEP]
simp_rw [if_neg xs]
[GOAL]
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)
[PROOFSTEP]
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
[GOAL]
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)
[PROOFSTEP]
rw [← mem_cylinder_iff_eq]
[GOAL]
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)
[PROOFSTEP]
apply cylinder_anti x _ A.some_mem.2
[GOAL]
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
[PROOFSTEP]
apply firstDiff_le_longestPrefix hs xs ys
[GOAL]
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)
[PROOFSTEP]
rw [fs y ys] at hfxfy ⊢
[GOAL]
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
[PROOFSTEP]
rwa [← fx, I2, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy] at I
[GOAL]
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)
[PROOFSTEP]
have Ax : (s ∩ cylinder x (longestPrefix x s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne x
[GOAL]
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)
[PROOFSTEP]
have fx : f x = Ax.some := by simp_rw [if_neg xs]
[GOAL]
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
[PROOFSTEP]
simp_rw [if_neg xs]
[GOAL]
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)
[PROOFSTEP]
have Ay : (s ∩ cylinder y (longestPrefix y s)).Nonempty := inter_cylinder_longestPrefix_nonempty hs hne y
[GOAL]
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)
[PROOFSTEP]
have fy : f y = Ay.some := by
  simp_rw [if_neg ys]
    -- case where the common prefix to `x` and `s`, or `y` and `s`, is shorter than the
            -- common part to `x` and `y` -- then `f x = f y`.
[GOAL]
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
[PROOFSTEP]
simp_rw [if_neg ys]
  -- case where the common prefix to `x` and `s`, or `y` and `s`, is shorter than the
          -- common part to `x` and `y` -- then `f x = f y`.
[GOAL]
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)
[PROOFSTEP]
by_cases H : longestPrefix x s < firstDiff x y ∨ longestPrefix y s < firstDiff x y
[GOAL]
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
⊢ firstDiff x y ≤ firstDiff (f x) (f y)
[PROOFSTEP]
have : cylinder x (longestPrefix x s) = cylinder y (longestPrefix y s) :=
  by
  cases' H with H H
  · exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H xs ys
  · symm
    rw [firstDiff_comm] at H
    exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H ys xs
[GOAL]
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)
[PROOFSTEP]
cases' H with H H
[GOAL]
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)
[PROOFSTEP]
exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H xs ys
[GOAL]
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)
[PROOFSTEP]
symm
[GOAL]
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)
[PROOFSTEP]
rw [firstDiff_comm] at H
[GOAL]
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)
[PROOFSTEP]
exact cylinder_longestPrefix_eq_of_longestPrefix_lt_firstDiff hs hne H ys xs
[GOAL]
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)
[PROOFSTEP]
rw [fx, fy] at hfxfy
[GOAL]
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)
[PROOFSTEP]
apply (hfxfy _).elim
[GOAL]
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
[PROOFSTEP]
congr
  -- case where the common prefix to `x` and `s` is long, as well as the common prefix to
          -- `y` and `s`. Then all points remain in the same cylinders.
[GOAL]
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)
[PROOFSTEP]
push_neg at H
[GOAL]
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)
[PROOFSTEP]
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
[GOAL]
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)
[PROOFSTEP]
rw [← mem_cylinder_iff_eq]
[GOAL]
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)
[PROOFSTEP]
exact cylinder_anti x H.1 Ax.some_mem.2
[GOAL]
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)
[PROOFSTEP]
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
[GOAL]
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)
[PROOFSTEP]
rw [eq_comm, ← mem_cylinder_iff_eq]
[GOAL]
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)
[PROOFSTEP]
exact cylinder_anti y H.2 Ay.some_mem.2
[GOAL]
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)
[PROOFSTEP]
have : cylinder Ax.some (firstDiff x y) = cylinder Ay.some (firstDiff x y) := by rw [I1, I2, I3]
[GOAL]
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)
[PROOFSTEP]
rw [I1, I2, I3]
[GOAL]
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)
[PROOFSTEP]
rw [← fx, ← fy, ← mem_cylinder_iff_eq, mem_cylinder_iff_le_firstDiff hfxfy] at this
[GOAL]
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)
[PROOFSTEP]
exact this
[GOAL]
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 ∧ Continuous f
[PROOFSTEP]
rcases exists_lipschitz_retraction_of_isClosed hs hne with ⟨f, fs, frange, hf⟩
[GOAL]
case intro.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
f : ((n : ℕ) → E n) → (n : ℕ) → E n
fs : ∀ (x : (n : ℕ) → E n), x ∈ s → f x = x
frange : range f = s
hf : LipschitzWith 1 f
⊢ ∃ f, (∀ (x : (n : ℕ) → E n), x ∈ s → f x = x) ∧ range f = s ∧ Continuous f
[PROOFSTEP]
exact ⟨f, fs, frange, hf.continuous⟩
[GOAL]
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 : ↑s), f ↑x = x) ∧ Surjective f ∧ Continuous f
[PROOFSTEP]
obtain ⟨f, fs, rfl, f_cont⟩ : ∃ f : (∀ n, E n) → ∀ n, E n, (∀ x ∈ s, f x = x) ∧ range f = s ∧ Continuous f :=
  exists_retraction_of_isClosed hs hne
[GOAL]
case intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
f : ((n : ℕ) → E n) → (n : ℕ) → E n
f_cont : Continuous f
hs : IsClosed (range f)
hne : Set.Nonempty (range f)
fs : ∀ (x : (n : ℕ) → E n), x ∈ range f → f x = x
⊢ ∃ f_1, (∀ (x : ↑(range f)), f_1 ↑x = x) ∧ Surjective f_1 ∧ Continuous f_1
[PROOFSTEP]
have A : ∀ x : range f, rangeFactorization f x = x := fun x ↦ Subtype.eq <| fs x x.2
[GOAL]
case intro.intro.intro
E : ℕ → Type u_1
inst✝¹ : (n : ℕ) → TopologicalSpace (E n)
inst✝ : ∀ (n : ℕ), DiscreteTopology (E n)
f : ((n : ℕ) → E n) → (n : ℕ) → E n
f_cont : Continuous f
hs : IsClosed (range f)
hne : Set.Nonempty (range f)
fs : ∀ (x : (n : ℕ) → E n), x ∈ range f → f x = x
A : ∀ (x : ↑(range f)), rangeFactorization f ↑x = x
⊢ ∃ f_1, (∀ (x : ↑(range f)), f_1 ↑x = x) ∧ Surjective f_1 ∧ Continuous f_1
[PROOFSTEP]
exact ⟨rangeFactorization f, A, fun x => ⟨x, A x⟩, f_cont.subtype_mk _⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
letI : MetricSpace (ℕ → ℕ) := PiNat.metricSpaceNatNat
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have I0 : (0 : ℝ) < 1 / 2 := by norm_num
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
⊢ 0 < 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have I1 : (1 / 2 : ℝ) < 1 := by norm_num
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
⊢ 1 / 2 < 1
[PROOFSTEP]
norm_num
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
rcases exists_dense_seq α with ⟨u, hu⟩
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
let s : Set (ℕ → ℕ) := {x | (⋂ n : ℕ, closedBall (u (x n)) ((1 / 2) ^ n)).Nonempty}
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
let g : s → α := fun x => x.2.some
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have A : ∀ (x : s) (n : ℕ), dist (g x) (u ((x : ℕ → ℕ) n)) ≤ (1 / 2) ^ n := fun x n => (mem_iInter.1 x.2.some_mem n : _)
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have g_cont : Continuous g := by
  refine continuous_iff_continuousAt.2 fun y => ?_
  refine continuousAt_of_locally_lipschitz zero_lt_one 4 fun x hxy => ?_
  rcases eq_or_ne x y with (rfl | hne)
  · simp
  have hne' : x.1 ≠ y.1 := Subtype.coe_injective.ne hne
  have dist' : dist x y = dist x.1 y.1 := rfl
  let n := firstDiff x.1 y.1 - 1
  have diff_pos : 0 < firstDiff x.1 y.1 := by
    by_contra' h
    apply apply_firstDiff_ne hne'
    rw [le_zero_iff.1 h]
    apply apply_eq_of_dist_lt _ le_rfl
    rw [pow_zero]
    exact hxy
  have hn : firstDiff x.1 y.1 = n + 1 := (Nat.succ_pred_eq_of_pos diff_pos).symm
  rw [dist', dist_eq_of_ne hne', hn]
  have B : x.1 n = y.1 n := mem_cylinder_firstDiff x.1 y.1 n (Nat.pred_lt diff_pos.ne')
  calc
    dist (g x) (g y) ≤ dist (g x) (u (x.1 n)) + dist (g y) (u (x.1 n)) := dist_triangle_right _ _ _
    _ = dist (g x) (u (x.1 n)) + dist (g y) (u (y.1 n)) := by rw [← B]
    _ ≤ (1 / 2) ^ n + (1 / 2) ^ n := (add_le_add (A x n) (A y n))
    _ = 4 * (1 / 2) ^ (n + 1) := by ring
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
⊢ Continuous g
[PROOFSTEP]
refine continuous_iff_continuousAt.2 fun y => ?_
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y : ↑s
⊢ ContinuousAt g y
[PROOFSTEP]
refine continuousAt_of_locally_lipschitz zero_lt_one 4 fun x hxy => ?_
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
rcases eq_or_ne x y with (rfl | hne)
[GOAL]
case inl
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
x : ↑s
hxy : dist x x < 1
⊢ dist (g x) (g x) ≤ 4 * dist x x
[PROOFSTEP]
simp
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
have hne' : x.1 ≠ y.1 := Subtype.coe_injective.ne hne
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
have dist' : dist x y = dist x.1 y.1 := rfl
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
let n := firstDiff x.1 y.1 - 1
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
have diff_pos : 0 < firstDiff x.1 y.1 := by
  by_contra' h
  apply apply_firstDiff_ne hne'
  rw [le_zero_iff.1 h]
  apply apply_eq_of_dist_lt _ le_rfl
  rw [pow_zero]
  exact hxy
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
⊢ 0 < firstDiff ↑x ↑y
[PROOFSTEP]
by_contra' h
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
h : firstDiff ↑x ↑y ≤ 0
⊢ False
[PROOFSTEP]
apply apply_firstDiff_ne hne'
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
h : firstDiff ↑x ↑y ≤ 0
⊢ ↑x (firstDiff ↑x ↑y) = ↑y (firstDiff ↑x ↑y)
[PROOFSTEP]
rw [le_zero_iff.1 h]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
h : firstDiff ↑x ↑y ≤ 0
⊢ ↑x 0 = ↑y 0
[PROOFSTEP]
apply apply_eq_of_dist_lt _ le_rfl
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
h : firstDiff ↑x ↑y ≤ 0
⊢ dist ↑x ↑y < (1 / 2) ^ 0
[PROOFSTEP]
rw [pow_zero]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
h : firstDiff ↑x ↑y ≤ 0
⊢ dist ↑x ↑y < 1
[PROOFSTEP]
exact hxy
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
have hn : firstDiff x.1 y.1 = n + 1 := (Nat.succ_pred_eq_of_pos diff_pos).symm
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
hn : firstDiff ↑x ↑y = n + 1
⊢ dist (g x) (g y) ≤ 4 * dist x y
[PROOFSTEP]
rw [dist', dist_eq_of_ne hne', hn]
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
hn : firstDiff ↑x ↑y = n + 1
⊢ dist (g x) (g y) ≤ 4 * (1 / 2) ^ (n + 1)
[PROOFSTEP]
have B : x.1 n = y.1 n := mem_cylinder_firstDiff x.1 y.1 n (Nat.pred_lt diff_pos.ne')
[GOAL]
case inr
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
hn : firstDiff ↑x ↑y = n + 1
B : ↑x n = ↑y n
⊢ dist (g x) (g y) ≤ 4 * (1 / 2) ^ (n + 1)
[PROOFSTEP]
calc
  dist (g x) (g y) ≤ dist (g x) (u (x.1 n)) + dist (g y) (u (x.1 n)) := dist_triangle_right _ _ _
  _ = dist (g x) (u (x.1 n)) + dist (g y) (u (y.1 n)) := by rw [← B]
  _ ≤ (1 / 2) ^ n + (1 / 2) ^ n := (add_le_add (A x n) (A y n))
  _ = 4 * (1 / 2) ^ (n + 1) := by ring
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
hn : firstDiff ↑x ↑y = n + 1
B : ↑x n = ↑y n
⊢ dist (g x) (u (↑x n)) + dist (g y) (u (↑x n)) = dist (g x) (u (↑x n)) + dist (g y) (u (↑y n))
[PROOFSTEP]
rw [← B]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
y x : ↑s
hxy : dist x y < 1
hne : x ≠ y
hne' : ↑x ≠ ↑y
dist' : dist x y = dist ↑x ↑y
n : ℕ := firstDiff ↑x ↑y - 1
diff_pos : 0 < firstDiff ↑x ↑y
hn : firstDiff ↑x ↑y = n + 1
B : ↑x n = ↑y n
⊢ (1 / 2) ^ n + (1 / 2) ^ n = 4 * (1 / 2) ^ (n + 1)
[PROOFSTEP]
ring
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have g_surj : Surjective g := fun y ↦
  by
  have : ∀ n : ℕ, ∃ j, y ∈ closedBall (u j) ((1 / 2) ^ n) := fun n ↦
    by
    rcases hu.exists_dist_lt y (by simp : (0 : ℝ) < (1 / 2) ^ n) with ⟨j, hj⟩
    exact ⟨j, hj.le⟩
  choose x hx using this
  have I : (⋂ n : ℕ, closedBall (u (x n)) ((1 / 2) ^ n)).Nonempty := ⟨y, mem_iInter.2 hx⟩
  refine' ⟨⟨x, I⟩, _⟩
  refine' dist_le_zero.1 _
  have J : ∀ n : ℕ, dist (g ⟨x, I⟩) y ≤ (1 / 2) ^ n + (1 / 2) ^ n := fun n =>
    calc
      dist (g ⟨x, I⟩) y ≤ dist (g ⟨x, I⟩) (u (x n)) + dist y (u (x n)) := dist_triangle_right _ _ _
      _ ≤ (1 / 2) ^ n + (1 / 2) ^ n := add_le_add (A ⟨x, I⟩ n) (hx n)
  have L : Tendsto (fun n : ℕ => (1 / 2 : ℝ) ^ n + (1 / 2) ^ n) atTop (𝓝 (0 + 0)) :=
    (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1).add (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1)
  rw [add_zero] at L
  exact ge_of_tendsto' L J
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
⊢ ∃ a, g a = y
[PROOFSTEP]
have : ∀ n : ℕ, ∃ j, y ∈ closedBall (u j) ((1 / 2) ^ n) := fun n ↦
  by
  rcases hu.exists_dist_lt y (by simp : (0 : ℝ) < (1 / 2) ^ n) with ⟨j, hj⟩
  exact ⟨j, hj.le⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
n : ℕ
⊢ ∃ j, y ∈ closedBall (u j) ((1 / 2) ^ n)
[PROOFSTEP]
rcases hu.exists_dist_lt y (by simp : (0 : ℝ) < (1 / 2) ^ n) with ⟨j, hj⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
n : ℕ
⊢ 0 < (1 / 2) ^ n
[PROOFSTEP]
simp
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
n j : ℕ
hj : dist y (u j) < (1 / 2) ^ n
⊢ ∃ j, y ∈ closedBall (u j) ((1 / 2) ^ n)
[PROOFSTEP]
exact ⟨j, hj.le⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this✝ : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
this : ∀ (n : ℕ), ∃ j, y ∈ closedBall (u j) ((1 / 2) ^ n)
⊢ ∃ a, g a = y
[PROOFSTEP]
choose x hx using this
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
⊢ ∃ a, g a = y
[PROOFSTEP]
have I : (⋂ n : ℕ, closedBall (u (x n)) ((1 / 2) ^ n)).Nonempty := ⟨y, mem_iInter.2 hx⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
⊢ ∃ a, g a = y
[PROOFSTEP]
refine' ⟨⟨x, I⟩, _⟩
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
⊢ g { val := x, property := I } = y
[PROOFSTEP]
refine' dist_le_zero.1 _
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
⊢ dist (g { val := x, property := I }) y ≤ 0
[PROOFSTEP]
have J : ∀ n : ℕ, dist (g ⟨x, I⟩) y ≤ (1 / 2) ^ n + (1 / 2) ^ n := fun n =>
  calc
    dist (g ⟨x, I⟩) y ≤ dist (g ⟨x, I⟩) (u (x n)) + dist y (u (x n)) := dist_triangle_right _ _ _
    _ ≤ (1 / 2) ^ n + (1 / 2) ^ n := add_le_add (A ⟨x, I⟩ n) (hx n)
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
J : ∀ (n : ℕ), dist (g { val := x, property := I }) y ≤ (1 / 2) ^ n + (1 / 2) ^ n
⊢ dist (g { val := x, property := I }) y ≤ 0
[PROOFSTEP]
have L : Tendsto (fun n : ℕ => (1 / 2 : ℝ) ^ n + (1 / 2) ^ n) atTop (𝓝 (0 + 0)) :=
  (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1).add (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1)
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
J : ∀ (n : ℕ), dist (g { val := x, property := I }) y ≤ (1 / 2) ^ n + (1 / 2) ^ n
L : Tendsto (fun n => (1 / 2) ^ n + (1 / 2) ^ n) atTop (𝓝 (0 + 0))
⊢ dist (g { val := x, property := I }) y ≤ 0
[PROOFSTEP]
rw [add_zero] at L
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
y : α
x : ℕ → ℕ
hx : ∀ (n : ℕ), y ∈ closedBall (u (x n)) ((1 / 2) ^ n)
I : Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))
J : ∀ (n : ℕ), dist (g { val := x, property := I }) y ≤ (1 / 2) ^ n + (1 / 2) ^ n
L : Tendsto (fun n => (1 / 2) ^ n + (1 / 2) ^ n) atTop (𝓝 0)
⊢ dist (g { val := x, property := I }) y ≤ 0
[PROOFSTEP]
exact ge_of_tendsto' L J
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
have s_closed : IsClosed s := by
  refine isClosed_iff_clusterPt.mpr fun x hx ↦ ?_
  have L : Tendsto (fun n : ℕ => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0) :=
    by
    have : Tendsto (fun n : ℕ => (2 : ℝ) * (1 / 2) ^ n) atTop (𝓝 (2 * 0)) :=
      (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1).const_mul _
    rw [mul_zero] at this
    exact squeeze_zero (fun n => diam_nonneg) (fun n => diam_closedBall (pow_nonneg I0.le _)) this
  refine nonempty_iInter_of_nonempty_biInter (fun n => isClosed_ball) (fun n => bounded_closedBall) (fun N ↦ ?_) L
  obtain ⟨y, hxy, ys⟩ : ∃ y, y ∈ ball x ((1 / 2) ^ N) ∩ s :=
    clusterPt_principal_iff.1 hx _ (ball_mem_nhds x (pow_pos I0 N))
  have E :
    ⋂ (n : ℕ) (H : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) =
      ⋂ (n : ℕ) (H : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n) :=
    by
    refine iInter_congr fun n ↦ iInter_congr fun hn ↦ ?_
    have : x n = y n := apply_eq_of_dist_lt (mem_ball'.1 hxy) hn
    rw [this]
  rw [E]
  apply Nonempty.mono _ ys
  apply iInter_subset_iInter₂
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
⊢ IsClosed s
[PROOFSTEP]
refine isClosed_iff_clusterPt.mpr fun x hx ↦ ?_
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
⊢ x ∈ s
[PROOFSTEP]
have L : Tendsto (fun n : ℕ => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0) :=
  by
  have : Tendsto (fun n : ℕ => (2 : ℝ) * (1 / 2) ^ n) atTop (𝓝 (2 * 0)) :=
    (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1).const_mul _
  rw [mul_zero] at this
  exact squeeze_zero (fun n => diam_nonneg) (fun n => diam_closedBall (pow_nonneg I0.le _)) this
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
⊢ Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
[PROOFSTEP]
have : Tendsto (fun n : ℕ => (2 : ℝ) * (1 / 2) ^ n) atTop (𝓝 (2 * 0)) :=
  (tendsto_pow_atTop_nhds_0_of_lt_1 I0.le I1).const_mul _
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this✝ : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
this : Tendsto (fun n => 2 * (1 / 2) ^ n) atTop (𝓝 (2 * 0))
⊢ Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
[PROOFSTEP]
rw [mul_zero] at this
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this✝ : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
this : Tendsto (fun n => 2 * (1 / 2) ^ n) atTop (𝓝 0)
⊢ Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
[PROOFSTEP]
exact squeeze_zero (fun n => diam_nonneg) (fun n => diam_closedBall (pow_nonneg I0.le _)) this
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
⊢ x ∈ s
[PROOFSTEP]
refine nonempty_iInter_of_nonempty_biInter (fun n => isClosed_ball) (fun n => bounded_closedBall) (fun N ↦ ?_) L
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
⊢ Set.Nonempty (⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n))
[PROOFSTEP]
obtain ⟨y, hxy, ys⟩ : ∃ y, y ∈ ball x ((1 / 2) ^ N) ∩ s :=
  clusterPt_principal_iff.1 hx _ (ball_mem_nhds x (pow_pos I0 N))
[GOAL]
case intro.intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
⊢ Set.Nonempty (⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n))
[PROOFSTEP]
have E :
  ⋂ (n : ℕ) (H : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) =
    ⋂ (n : ℕ) (H : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n) :=
  by
  refine iInter_congr fun n ↦ iInter_congr fun hn ↦ ?_
  have : x n = y n := apply_eq_of_dist_lt (mem_ball'.1 hxy) hn
  rw [this]
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
⊢ ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) = ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n)
[PROOFSTEP]
refine iInter_congr fun n ↦ iInter_congr fun hn ↦ ?_
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
n : ℕ
hn : n ≤ N
⊢ closedBall (u (x n)) ((1 / 2) ^ n) = closedBall (u (y n)) ((1 / 2) ^ n)
[PROOFSTEP]
have : x n = y n := apply_eq_of_dist_lt (mem_ball'.1 hxy) hn
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this✝ : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
n : ℕ
hn : n ≤ N
this : x n = y n
⊢ closedBall (u (x n)) ((1 / 2) ^ n) = closedBall (u (y n)) ((1 / 2) ^ n)
[PROOFSTEP]
rw [this]
[GOAL]
case intro.intro
E✝ : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
E :
  ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) = ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n)
⊢ Set.Nonempty (⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n))
[PROOFSTEP]
rw [E]
[GOAL]
case intro.intro
E✝ : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
E :
  ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) = ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n)
⊢ Set.Nonempty (⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n))
[PROOFSTEP]
apply Nonempty.mono _ ys
[GOAL]
E✝ : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
x : ℕ → ℕ
hx : ClusterPt x (𝓟 s)
L : Tendsto (fun n => diam (closedBall (u (x n)) ((1 / 2) ^ n))) atTop (𝓝 0)
N : ℕ
y : ℕ → ℕ
hxy : y ∈ ball x ((1 / 2) ^ N)
ys : y ∈ s
E :
  ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (x n)) ((1 / 2) ^ n) = ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n)
⊢ ⋂ (n : ℕ), closedBall (u (y n)) ((1 / 2) ^ n) ⊆ ⋂ (n : ℕ) (_ : n ≤ N), closedBall (u (y n)) ((1 / 2) ^ n)
[PROOFSTEP]
apply iInter_subset_iInter₂
[GOAL]
case intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
s_closed : IsClosed s
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
obtain ⟨f, -, f_surj, f_cont⟩ : ∃ f : (ℕ → ℕ) → s, (∀ x : s, f x = x) ∧ Surjective f ∧ Continuous f :=
  by
  apply exists_retraction_subtype_of_isClosed s_closed
  simpa only [nonempty_coe_sort] using g_surj.nonempty
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
s_closed : IsClosed s
⊢ ∃ f, (∀ (x : ↑s), f ↑x = x) ∧ Surjective f ∧ Continuous f
[PROOFSTEP]
apply exists_retraction_subtype_of_isClosed s_closed
[GOAL]
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
s_closed : IsClosed s
⊢ Set.Nonempty s
[PROOFSTEP]
simpa only [nonempty_coe_sort] using g_surj.nonempty
[GOAL]
case intro.intro.intro.intro
E : ℕ → Type u_1
α : Type u_2
inst✝³ : MetricSpace α
inst✝² : CompleteSpace α
inst✝¹ : SecondCountableTopology α
inst✝ : Nonempty α
this : MetricSpace (ℕ → ℕ) := metricSpaceNatNat
I0 : 0 < 1 / 2
I1 : 1 / 2 < 1
u : ℕ → α
hu : DenseRange u
s : Set (ℕ → ℕ) := {x | Set.Nonempty (⋂ (n : ℕ), closedBall (u (x n)) ((1 / 2) ^ n))}
g : ↑s → α := fun x => Set.Nonempty.some (_ : ↑x ∈ s)
A : ∀ (x : ↑s) (n : ℕ), dist (g x) (u (↑x n)) ≤ (1 / 2) ^ n
g_cont : Continuous g
g_surj : Surjective g
s_closed : IsClosed s
f : (ℕ → ℕ) → ↑s
f_surj : Surjective f
f_cont : Continuous f
⊢ ∃ f, Continuous f ∧ Surjective f
[PROOFSTEP]
exact ⟨g ∘ f, g_cont.comp f_cont, g_surj.comp f_surj⟩
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
⊢ Summable fun i => min ((1 / 2) ^ encode i) (dist (x i) (y i))
[PROOFSTEP]
refine summable_of_nonneg_of_le (fun i => ?_) (fun i => min_le_left _ _) summable_geometric_two_encode
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
i : ι
⊢ 0 ≤ min ((1 / 2) ^ encode i) (dist (x i) (y i))
[PROOFSTEP]
exact le_min (pow_nonneg (by norm_num) _) dist_nonneg
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
i : ι
⊢ 0 ≤ 1 / 2
[PROOFSTEP]
norm_num
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
i j : ι
x✝ : j ≠ i
⊢ 0 ≤ (1 / 2) ^ encode j
[PROOFSTEP]
simp
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
i : ι
h : dist x y < (1 / 2) ^ encode i
⊢ dist (x i) (y i) ≤ dist x y
[PROOFSTEP]
simpa only [not_le.2 h, false_or_iff] using min_le_iff.1 (min_dist_le_dist_pi x y i)
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x : (i : ι) → F i
⊢ dist x x = 0
[PROOFSTEP]
simp [dist_eq_tsum]
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y : (i : ι) → F i
⊢ dist x y = dist y x
[PROOFSTEP]
simp [dist_eq_tsum, dist_comm]
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x y z : (i : ι) → F i
i : ι
⊢ min ((1 / 2) ^ encode i) (dist (x i) (y i) + dist (y i) (z i)) =
    min ((1 / 2) ^ encode i) (min ((1 / 2) ^ encode i) (dist (x i) (y i)) + min ((1 / 2) ^ encode i) (dist (y i) (z i)))
[PROOFSTEP]
convert congr_arg ((↑) : ℝ≥0 → ℝ) (min_add_distrib ((1 / 2 : ℝ≥0) ^ encode i) (nndist (x i) (y i)) (nndist (y i) (z i)))
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝¹ x✝ : (i : ι) → F i
⊢ (fun x y => ↑{ val := dist x y, property := (_ : 0 ≤ dist x y) }) x✝¹ x✝ = ENNReal.ofReal (dist x✝¹ x✝)
[PROOFSTEP]
exact ENNReal.coe_nnreal_eq _
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ uniformity ((i : ι) → F i) = ⨅ (ε : ℝ) (_ : ε > 0), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp only [Pi.uniformity, comap_iInf, gt_iff_lt, preimage_setOf_eq, comap_principal, PseudoMetricSpace.uniformity_dist]
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1} =
    ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
apply le_antisymm
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1} ≤
    ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp only [le_iInf_iff, le_principal_iff]
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ ∀ (i : ℝ),
    0 < i →
      {p | dist p.fst p.snd < i} ∈ ⨅ (i : ι) (i_2 : ℝ) (_ : 0 < i_2), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_2}
[PROOFSTEP]
intro ε εpos
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
⊢ {p | dist p.fst p.snd < ε} ∈ ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1}
[PROOFSTEP]
obtain ⟨K, hK⟩ : ∃ K : Finset ι, (∑' i : { j // j ∉ K }, (1 / 2 : ℝ) ^ encode (i : ι)) < ε / 2 :=
  ((tendsto_order.1 (tendsto_tsum_compl_atTop_zero fun i : ι => (1 / 2 : ℝ) ^ encode i)).2 _ (half_pos εpos)).exists
[GOAL]
case a.intro
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
⊢ {p | dist p.fst p.snd < ε} ∈ ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1}
[PROOFSTEP]
obtain ⟨δ, δpos, hδ⟩ : ∃ δ : ℝ, 0 < δ ∧ (K.card : ℝ) * δ < ε / 2 := exists_pos_mul_lt (half_pos εpos) _
[GOAL]
case a.intro.intro.intro
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
⊢ {p | dist p.fst p.snd < ε} ∈ ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1}
[PROOFSTEP]
apply
  @mem_iInf_of_iInter _ _ _ _ _ K.finite_toSet fun i =>
    {p : (∀ i : ι, F i) × ∀ i : ι, F i | dist (p.fst i) (p.snd i) < δ}
[GOAL]
case a.intro.intro.intro.hV
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
⊢ ∀ (i : ↑↑K),
    {p | dist (Prod.fst p ↑i) (Prod.snd p ↑i) < δ} ∈
      ⨅ (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a ↑i) (Prod.snd a ↑i) < i_1}
[PROOFSTEP]
rintro ⟨i, hi⟩
[GOAL]
case a.intro.intro.intro.hV.mk
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
i : ι
hi : i ∈ ↑K
⊢ {p | dist (Prod.fst p ↑{ val := i, property := hi }) (Prod.snd p ↑{ val := i, property := hi }) < δ} ∈
    ⨅ (i_1 : ℝ) (_ : 0 < i_1),
      𝓟 {a | dist (Prod.fst a ↑{ val := i, property := hi }) (Prod.snd a ↑{ val := i, property := hi }) < i_1}
[PROOFSTEP]
refine' mem_iInf_of_mem δ (mem_iInf_of_mem δpos _)
[GOAL]
case a.intro.intro.intro.hV.mk
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
i : ι
hi : i ∈ ↑K
⊢ {p | dist (Prod.fst p ↑{ val := i, property := hi }) (Prod.snd p ↑{ val := i, property := hi }) < δ} ∈
    𝓟 {a | dist (Prod.fst a ↑{ val := i, property := hi }) (Prod.snd a ↑{ val := i, property := hi }) < δ}
[PROOFSTEP]
simp only [Prod.forall, imp_self, mem_principal, Subset.rfl]
[GOAL]
case a.intro.intro.intro.hU
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
⊢ ⋂ (i : ↑↑K), {p | dist (Prod.fst p ↑i) (Prod.snd p ↑i) < δ} ⊆ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
rintro ⟨x, y⟩ hxy
[GOAL]
case a.intro.intro.intro.hU.mk
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : (x, y) ∈ ⋂ (i : ↑↑K), {p | dist (Prod.fst p ↑i) (Prod.snd p ↑i) < δ}
⊢ (x, y) ∈ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
simp only [mem_iInter, mem_setOf_eq, SetCoe.forall, Finset.mem_range, Finset.mem_coe] at hxy
[GOAL]
case a.intro.intro.intro.hU.mk
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ (x, y) ∈ {p | dist p.fst p.snd < ε}
[PROOFSTEP]
calc
  dist x y = ∑' i : ι, min ((1 / 2) ^ encode i : ℝ) (dist (x i) (y i)) := rfl
  _ =
      (∑ i in K, min ((1 / 2) ^ encode i : ℝ) (dist (x i) (y i))) +
        ∑' i : ↑(K : Set ι)ᶜ, min ((1 / 2) ^ encode (i : ι) : ℝ) (dist (x i) (y i)) :=
    (sum_add_tsum_compl (dist_summable _ _)).symm
  _ ≤ (∑ i in K, dist (x i) (y i)) + ∑' i : ↑(K : Set ι)ᶜ, ((1 / 2) ^ encode (i : ι) : ℝ) :=
    by
    refine' add_le_add (Finset.sum_le_sum fun i _ => min_le_right _ _) _
    refine' tsum_le_tsum (fun i => min_le_left _ _) _ _
    · apply Summable.subtype (dist_summable x y) (↑K : Set ι)ᶜ
    · apply Summable.subtype summable_geometric_two_encode (↑K : Set ι)ᶜ
  _ < (∑ _i in K, δ) + ε / 2 := by
    apply add_lt_add_of_le_of_lt _ hK
    refine Finset.sum_le_sum fun i hi => (hxy i ?_).le
    simpa using hi
  _ ≤ ε / 2 + ε / 2 := (add_le_add_right (by simpa only [Finset.sum_const, nsmul_eq_mul] using hδ.le) _)
  _ = ε := add_halves _
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ ∑ i in K, min ((1 / 2) ^ encode i) (dist (x i) (y i)) +
      ∑' (i : ↑(↑K)ᶜ), min ((1 / 2) ^ encode ↑i) (dist (x ↑i) (y ↑i)) ≤
    ∑ i in K, dist (x i) (y i) + ∑' (i : ↑(↑K)ᶜ), (1 / 2) ^ encode ↑i
[PROOFSTEP]
refine' add_le_add (Finset.sum_le_sum fun i _ => min_le_right _ _) _
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ ∑' (i : ↑(↑K)ᶜ), min ((1 / 2) ^ encode ↑i) (dist (x ↑i) (y ↑i)) ≤ ∑' (i : ↑(↑K)ᶜ), (1 / 2) ^ encode ↑i
[PROOFSTEP]
refine' tsum_le_tsum (fun i => min_le_left _ _) _ _
[GOAL]
case refine'_1
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ Summable fun i => min ((1 / 2) ^ encode ↑i) (dist (x ↑i) (y ↑i))
[PROOFSTEP]
apply Summable.subtype (dist_summable x y) (↑K : Set ι)ᶜ
[GOAL]
case refine'_2
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ Summable fun i => (1 / 2) ^ encode ↑i
[PROOFSTEP]
apply Summable.subtype summable_geometric_two_encode (↑K : Set ι)ᶜ
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ ∑ i in K, dist (x i) (y i) + ∑' (i : ↑(↑K)ᶜ), (1 / 2) ^ encode ↑i < ∑ _i in K, δ + ε / 2
[PROOFSTEP]
apply add_lt_add_of_le_of_lt _ hK
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ ∑ i in K, dist (x i) (y i) ≤ ∑ _i in K, δ
[PROOFSTEP]
refine Finset.sum_le_sum fun i hi => (hxy i ?_).le
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
i : ι
hi : i ∈ K
⊢ i ∈ K
[PROOFSTEP]
simpa using hi
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
ε : ℝ
εpos : 0 < ε
K : Finset ι
hK : ∑' (i : { j // ¬j ∈ K }), (1 / 2) ^ encode ↑i < ε / 2
δ : ℝ
δpos : 0 < δ
hδ : ↑(Finset.card K) * δ < ε / 2
x y : (i : ι) → F i
hxy : ∀ (x_1 : ι), x_1 ∈ K → dist (x x_1) (y x_1) < δ
⊢ ∑ _i in K, δ ≤ ε / 2
[PROOFSTEP]
simpa only [Finset.sum_const, nsmul_eq_mul] using hδ.le
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε} ≤
    ⨅ (i : ι) (i_1 : ℝ) (_ : 0 < i_1), 𝓟 {a | dist (Prod.fst a i) (Prod.snd a i) < i_1}
[PROOFSTEP]
simp only [le_iInf_iff, le_principal_iff]
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
⊢ ∀ (i : ι) (i_1 : ℝ),
    0 < i_1 → {a | dist (Prod.fst a i) (Prod.snd a i) < i_1} ∈ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
intro i ε εpos
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
⊢ {a | dist (Prod.fst a i) (Prod.snd a i) < ε} ∈ ⨅ (ε : ℝ) (_ : 0 < ε), 𝓟 {p | dist p.fst p.snd < ε}
[PROOFSTEP]
refine' mem_iInf_of_mem (min ((1 / 2) ^ encode i : ℝ) ε) _
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
⊢ {a | dist (Prod.fst a i) (Prod.snd a i) < ε} ∈
    ⨅ (_ : 0 < min ((1 / 2) ^ encode i) ε), 𝓟 {p | dist p.fst p.snd < min ((1 / 2) ^ encode i) ε}
[PROOFSTEP]
have : 0 < min ((1 / 2) ^ encode i : ℝ) ε := lt_min (by simp) εpos
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
⊢ 0 < (1 / 2) ^ encode i
[PROOFSTEP]
simp
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
this : 0 < min ((1 / 2) ^ encode i) ε
⊢ {a | dist (Prod.fst a i) (Prod.snd a i) < ε} ∈
    ⨅ (_ : 0 < min ((1 / 2) ^ encode i) ε), 𝓟 {p | dist p.fst p.snd < min ((1 / 2) ^ encode i) ε}
[PROOFSTEP]
refine' mem_iInf_of_mem this _
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
this : 0 < min ((1 / 2) ^ encode i) ε
⊢ {a | dist (Prod.fst a i) (Prod.snd a i) < ε} ∈ 𝓟 {p | dist p.fst p.snd < min ((1 / 2) ^ encode i) ε}
[PROOFSTEP]
simp only [and_imp, Prod.forall, setOf_subset_setOf, lt_min_iff, mem_principal]
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
this : 0 < min ((1 / 2) ^ encode i) ε
⊢ ∀ (a b : (i : ι) → F i), dist a b < (1 / 2) ^ encode i → dist a b < ε → dist (a i) (b i) < ε
[PROOFSTEP]
intro x y hn hε
[GOAL]
case a
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
i : ι
ε : ℝ
εpos : 0 < ε
this : 0 < min ((1 / 2) ^ encode i) ε
x y : (i : ι) → F i
hn : dist x y < (1 / 2) ^ encode i
hε : dist x y < ε
⊢ dist (x i) (y i) < ε
[PROOFSTEP]
calc
  dist (x i) (y i) ≤ dist x y := dist_le_dist_pi_of_dist_lt hn
  _ < ε := hε
[GOAL]
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝ y✝ : (i : ι) → F i
hxy : dist x✝ y✝ = 0
⊢ x✝ = y✝
[PROOFSTEP]
ext1 n
[GOAL]
case h
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝ y✝ : (i : ι) → F i
hxy : dist x✝ y✝ = 0
n : ι
⊢ x✝ n = y✝ n
[PROOFSTEP]
rw [← dist_le_zero, ← hxy]
[GOAL]
case h
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝ y✝ : (i : ι) → F i
hxy : dist x✝ y✝ = 0
n : ι
⊢ dist (x✝ n) (y✝ n) ≤ dist x✝ y✝
[PROOFSTEP]
apply dist_le_dist_pi_of_dist_lt
[GOAL]
case h.h
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝ y✝ : (i : ι) → F i
hxy : dist x✝ y✝ = 0
n : ι
⊢ (dist x✝ fun n => y✝ n) < (1 / 2) ^ encode n
[PROOFSTEP]
rw [hxy]
[GOAL]
case h.h
E : ℕ → Type u_1
ι : Type u_2
inst✝¹ : Encodable ι
F : ι → Type u_3
inst✝ : (i : ι) → MetricSpace (F i)
x✝ y✝ : (i : ι) → F i
hxy : dist x✝ y✝ = 0
n : ι
⊢ 0 < (1 / 2) ^ encode n
[PROOFSTEP]
simp