Challenge 21: Subsequences have the same limit as the sequence
A subsequence is obtained by applying an extraction function to the original sequence; that is, a strictly increasing function \(φ : ℕ \to ℕ\). For example, the subsequence \[ u_{0}, u_{2}, u_{4}, u_{6}, \dots \] is obtained with the extraction function \(\varphi\) defined by \(\varphi(n) = 2n\).
The previous definitions are formalized in Lean 4 as:
-- φ is an extraction function. def IsExtraction (φ : ℕ → ℕ) := StrictMono φ -- v is a subsequence of u. def Subseq (v u : ℕ → ℝ) := ∃ φ, IsExtraction φ ∧ v = u ∘ φ -- a is the limit of u. def SeqLim (u : ℕ → ℝ) (a : ℝ) := ∀ ε > 0, ∃ k : ℕ, ∀ n ≥ k, |u n - a| < ε
Prove that every subsequence of a convergent sequence converges to the same limit as the sequence.
To do so, complete the following Lean 4 theory:
import Mathlib.Data.Real.Basic variable {u v : ℕ → ℝ} variable {a : ℝ} def IsExtraction (φ : ℕ → ℕ):= StrictMono φ def Subseq (v u : ℕ → ℝ) := ∃ φ, IsExtraction φ ∧ v = u ∘ φ def SeqLim (u : ℕ → ℝ) (a : ℝ) := ∀ ε > 0, ∃ k : ℕ, ∀ n ≥ k, |u n - a| < ε example (hv : Subseq v u) (ha : SeqLim u a) : SeqLim v a := by sorry