/-- Prove that the limit of a sum is the sum of the limits, from the ε–N definition.
Hint: ask for `ε / 2` from each hypothesis, take `N = max N₁ N₂`, and finish with `abs_add_le`. -/
theorem convergesTo_add {a b : ℕ → ℝ} {A B : ℝ} (ha : ConvergesTo a A) (hb : ConvergesTo b B) :
ConvergesTo (fun n => a n + b n) (A + B) := by
sorryShow the compiled solution
/-- **The limit of a sum is the sum of the limits.** If `aₙ → A` and `bₙ → B` then
`aₙ + bₙ → A + B`: take `N` large enough that both are within `ε/2`, and use the triangle
inequality. (Solution to the Lean exercise.) -/
theorem convergesTo_add {a b : ℕ → ℝ} {A B : ℝ} (ha : ConvergesTo a A) (hb : ConvergesTo b B) :
ConvergesTo (fun n => a n + b n) (A + B) := by
intro ε hε
obtain ⟨N₁, hN₁⟩ := ha (ε / 2) (by linarith)
obtain ⟨N₂, hN₂⟩ := hb (ε / 2) (by linarith)
refine ⟨max N₁ N₂, fun n hn => ?_⟩
have h1 := hN₁ n (le_trans (le_max_left _ _) hn)
have h2 := hN₂ n (le_trans (le_max_right _ _) hn)
calc |a n + b n - (A + B)| = |(a n - A) + (b n - B)| := by ring_nf
_ ≤ |a n - A| + |b n - B| := abs_add_le _ _
_ < ε / 2 + ε / 2 := add_lt_add h1 h2
_ = ε := by ringAxioms used: propext, Classical.choice, Quot.soundformal/Lumenary/RealAnalysis.leanTry it in the Lean web editor