Imports
import Mathlib.Tactic import Analysis.Section_5_1 import Analysis.Section_5_3 import Analysis.Section_5_epilogue

Analysis I, Section 6.1: Convergence and limit laws

I have attempted to make the translation as faithful a paraphrasing as possible of the original text. When there is a choice between a more idiomatic Lean solution and a more faithful translation, I have generally chosen the latter. In particular, there will be places where the Lean code could be "golfed" to be more elegant and idiomatic, but I have consciously avoided doing so.

Main constructions and results of this section:

  • Definition of ε-closeness, ε-steadiness, and their eventual counterparts.

  • Notion of a Cauchy sequence, convergent sequence, and bounded sequence of reals.

/- Definition 6.1.1 (Distance). Here we use the Mathlib distance. -/ Real.dist_eq (x y : ℝ) : dist x y = |x - y|#check Real.dist_eqabbrev Real.Close (ε x y : ℝ) : Prop := dist x y ≤ ε

Definition 6.1.2 (ε-close). This is similar to the previous notion of ε-closeness, but where all quantities are real instead of rational.

theorem Real.close_def (ε x y : ℝ) : ε.Close x y ↔ dist x y ≤ ε := ε:ℝx:ℝy:ℝ⊢ ε.Close x y ↔ dist x y ≤ ε All goals completed! 🐙
namespace Chapter6

Definition 6.1.3 (Sequence). This is similar to the Chapter 5 sequence, except that now the sequence is real-valued. As with Chapter 5, we start sequences from 0 by default.

@[ext] structure Sequence where m : ℤ seq : ℤ → ℝ vanish : ∀ n < m, seq n = 0

Sequences can be thought of as functions from ℤ to ℝ.

instance Sequence.instCoeFun : CoeFun Sequence (fun _ ↦ ℤ → ℝ) where coe a := a.seq
@[coe] abbrev Sequence.ofNatFun (a:ℕ → ℝ) : Sequence := { m := 0 seq n := if n ≥ 0 then a n.toNat else 0 vanish := a:ℕ → ℝ⊢ ∀ n < 0, (if n ≥ 0 then a n.toNat else 0) = 0 All goals completed! 🐙 }

Functions from ℕ to ℝ can be thought of as sequences.

instance Sequence.instCoe : Coe (ℕ → ℝ) Sequence where coe := ofNatFun
abbrev Sequence.mk' (m:ℤ) (a: { n // n ≥ m } → ℝ) : Sequence where m := m seq n := if h : n ≥ m then a ⟨n, h⟩ else 0 vanish := m:ℤa:{ n // n ≥ m } → ℝ⊢ ∀ n < m, (if h : n ≥ m then a ⟨n, h⟩ else 0) = 0 All goals completed! 🐙lemma Sequence.eval_mk {n m:ℤ} (a: { n // n ≥ m } → ℝ) (h: n ≥ m) : (Sequence.mk' m a) n = a ⟨ n, h ⟩ := n:ℤm:ℤa:{ n // n ≥ m } → ℝh:n ≥ m⊢ (mk' m a).seq n = a ⟨n, h⟩ All goals completed! 🐙@[simp] lemma Sequence.eval_coe (n:ℕ) (a: ℕ → ℝ) : (a:Sequence) n = a n := n:ℕa:ℕ → ℝ⊢ (↑a).seq ↑n = a n All goals completed! 🐙

a.from n₁ starts a : Sequence from n₁. It is intended for use when n₁ ≥ n₀, but returns the "junk" value of the original sequence a otherwise.

abbrev Sequence.from (a:Sequence) (m₁:ℤ) : Sequence := mk' (max a.m m₁) (a ↑·)
lemma Sequence.from_eval (a:Sequence) {m₁ n:ℤ} (hn: n ≥ m₁) : (a.from m₁) n = a n := a:Sequencem₁:ℤn:ℤhn:n ≥ m₁⊢ (a.from m₁).seq n = a.seq n a:Sequencem₁:ℤn:ℤhn:n ≥ m₁⊢ n < a.m → 0 = a.seq n; a:Sequencem₁:ℤn:ℤhn:n ≥ m₁a✝:n < a.m⊢ 0 = a.seq n; a:Sequencem₁:ℤn:ℤhn:n ≥ m₁a✝:n < a.m⊢ a.seq n = 0; All goals completed! 🐙end Chapter6

Definition 6.1.3 (ε-steady)

abbrev Real.Steady (ε: ℝ) (a: Chapter6.Sequence) : Prop := ∀ n ≥ a.m, ∀ m ≥ a.m, ε.Close (a n) (a m)

Definition 6.1.3 (ε-steady, def)

lemma Real.steady_def (ε: ℝ) (a: Chapter6.Sequence) : ε.Steady a ↔ ∀ n ≥ a.m, ∀ m ≥ a.m, ε.Close (a n) (a m) := ε:ℝa:Chapter6.Sequence⊢ ε.Steady a ↔ ∀ n ≥ a.m, ∀ m ≥ a.m, ε.Close (a.seq n) (a.seq m) All goals completed! 🐙

Definition 6.1.3 (Eventually ε-steady)

abbrev Real.EventuallySteady (ε: ℝ) (a: Chapter6.Sequence) : Prop := ∃ N ≥ a.m, ε.Steady (a.from N)

Definition 6.1.3 (Eventually ε-steady, def)

lemma Real.eventuallySteady_def (ε: ℝ) (a: Chapter6.Sequence) : ε.EventuallySteady a ↔ ∃ N, (N ≥ a.m) ∧ ε.Steady (a.from N) := ε:ℝa:Chapter6.Sequence⊢ ε.EventuallySteady a ↔ ∃ N ≥ a.m, ε.Steady (a.from N) All goals completed! 🐙

For fixed a, the function ε ↦ ε.Steady s is monotone

theorem Real.Steady.mono {a: Chapter6.Sequence} {ε₁ ε₂: ℝ} (hε: ε₁ ≤ ε₂) (hsteady: ε₁.Steady a) : ε₂.Steady a := a:Chapter6.Sequenceε₁:ℝε₂:ℝhε:ε₁ ≤ ε₂hsteady:ε₁.Steady a⊢ ε₂.Steady a All goals completed! 🐙

For fixed a, the function ε ↦ ε.EventuallySteady s is monotone

theorem Real.EventuallySteady.mono {a: Chapter6.Sequence} {ε₁ ε₂: ℝ} (hε: ε₁ ≤ ε₂) (hsteady: ε₁.EventuallySteady a) : ε₂.EventuallySteady a := a:Chapter6.Sequenceε₁:ℝε₂:ℝhε:ε₁ ≤ ε₂hsteady:ε₁.EventuallySteady a⊢ ε₂.EventuallySteady a a:Chapter6.Sequenceε₁:ℝε₂:ℝhε:ε₁ ≤ ε₂hsteady:ε₁.EventuallySteady aN✝:ℤp✝:N✝ ≥ a.mthis:ε₁.Steady (a.from N✝)⊢ ε₂.Steady (a.from N✝); All goals completed! 🐙
namespace Chapter6

Definition 6.1.3 (Cauchy sequence)

abbrev Sequence.IsCauchy (a:Sequence) : Prop := ∀ ε > (0:ℝ), ε.EventuallySteady a

Definition 6.1.3 (Cauchy sequence, def)

lemma Sequence.isCauchy_def (a:Sequence) : a.IsCauchy ↔ ∀ ε > (0:ℝ), ε.EventuallySteady a := a:Sequence⊢ a.IsCauchy ↔ ∀ ε > 0, ε.EventuallySteady a All goals completed! 🐙

This is almost the same as Chapter5.­Sequence.­IsCauchy.­coe

lemma Sequence.IsCauchy.coe (a:ℕ → ℝ) : (a:Sequence).IsCauchy ↔ ∀ ε > 0, ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε := a:ℕ → ℝ⊢ (↑a).IsCauchy ↔ ∀ ε > 0, ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady ↑a ↔ ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady ↑a → ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εa:ℕ → ℝε:ℝhε:ε > 0⊢ (∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε) → ε.EventuallySteady ↑a a:ℕ → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady ↑a → ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ (↑a).mh':ε.Steady ((↑a).from N)⊢ ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':ε.Steady ((↑a).from ↑N)⊢ ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε; a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':ε.Steady ((↑a).from ↑N)⊢ ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε intro j a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':ε.Steady ((↑a).from ↑N)j:ℕhj:j ≥ N⊢ ∀ k ≥ N, dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':ε.Steady ((↑a).from ↑N)j:ℕhj:j ≥ Nk:ℕ⊢ k ≥ N → dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':ε.Steady ((↑a).from ↑N)j:ℕhj:j ≥ Nk:ℕhk:k ≥ N⊢ dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':∀ (n : ℤ), ↑N ≤ n → ∀ (m : ℤ), ↑N ≤ m → dist (if ↑N ≤ n then if 0 ≤ n then a n.toNat else 0 else 0) (if ↑N ≤ m then if 0 ≤ m then a m.toNat else 0 else 0) ≤ ε⊢ dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':∀ (n : ℤ), ↑N ≤ n → ∀ (m : ℤ), ↑N ≤ m → dist (if ↑N ≤ n then if 0 ≤ n then a n.toNat else 0 else 0) (if ↑N ≤ m then if 0 ≤ m then a m.toNat else 0 else 0) ≤ ε⊢ ↑N ≤ ↑ja:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':∀ (n : ℤ), ↑N ≤ n → ∀ (m : ℤ), ↑N ≤ m → dist (if ↑N ≤ n then if 0 ≤ n then a n.toNat else 0 else 0) (if ↑N ≤ m then if 0 ≤ m then a m.toNat else 0 else 0) ≤ ε⊢ ↑N ≤ ↑ka:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':dist (if ↑N ≤ ↑j then if 0 ≤ ↑j then a (↑j).toNat else 0 else 0) (if ↑N ≤ ↑k then if 0 ≤ ↑k then a (↑k).toNat else 0 else 0) ≤ ε⊢ dist (a j) (a k) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':∀ (n : ℤ), ↑N ≤ n → ∀ (m : ℤ), ↑N ≤ m → dist (if ↑N ≤ n then if 0 ≤ n then a n.toNat else 0 else 0) (if ↑N ≤ m then if 0 ≤ m then a m.toNat else 0 else 0) ≤ ε⊢ ↑N ≤ ↑ja:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':∀ (n : ℤ), ↑N ≤ n → ∀ (m : ℤ), ↑N ≤ m → dist (if ↑N ≤ n then if 0 ≤ n then a n.toNat else 0 else 0) (if ↑N ≤ m then if 0 ≤ m then a m.toNat else 0 else 0) ≤ ε⊢ ↑N ≤ ↑ka:ℕ → ℝε:ℝhε:ε > 0N:ℕj:ℕhj:j ≥ Nk:ℕhk:k ≥ Nh':dist (if ↑N ≤ ↑j then if 0 ≤ ↑j then a (↑j).toNat else 0 else 0) (if ↑N ≤ ↑k then if 0 ≤ ↑k then a (↑k).toNat else 0 else 0) ≤ ε⊢ dist (a j) (a k) ≤ ε try All goals completed! 🐙 All goals completed! 🐙 a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε⊢ ε.EventuallySteady ↑a; refine ⟨ max N 0, a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε⊢ max (↑N) 0 ≥ (↑a).m All goals completed! 🐙, ?_ ⟩ intro n a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℤhn:n ≥ ((↑a).from (max (↑N) 0)).m⊢ ∀ m ≥ ((↑a).from (max (↑N) 0)).m, ε.Close (((↑a).from (max (↑N) 0)).seq n) (((↑a).from (max (↑N) 0)).seq m) a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℤhn:n ≥ ((↑a).from (max (↑N) 0)).mm:ℤ⊢ m ≥ ((↑a).from (max (↑N) 0)).m → ε.Close (((↑a).from (max (↑N) 0)).seq n) (((↑a).from (max (↑N) 0)).seq m) a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℤhn:n ≥ ((↑a).from (max (↑N) 0)).mm:ℤhm:m ≥ ((↑a).from (max (↑N) 0)).m⊢ ε.Close (((↑a).from (max (↑N) 0)).seq n) (((↑a).from (max (↑N) 0)).seq m); a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℤm:ℤhn:↑N ≤ nhm:↑N ≤ m⊢ ε.Close (((↑a).from (max (↑N) 0)).seq n) (((↑a).from (max (↑N) 0)).seq m) have npos : 0 ≤ n := a:ℕ → ℝ⊢ (↑a).IsCauchy ↔ ∀ ε > 0, ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε All goals completed! 🐙 have mpos : 0 ≤ m := a:ℕ → ℝ⊢ (↑a).IsCauchy ↔ ∀ ε > 0, ∃ N, ∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ ε All goals completed! 🐙 a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℤm:ℤhn:↑N ≤ nhm:↑N ≤ mnpos:0 ≤ nmpos:0 ≤ m⊢ dist (a n.toNat) (a m.toNat) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εm:ℤhm:↑N ≤ mmpos:0 ≤ mn:ℕhn:↑N ≤ ↑n⊢ dist (a (↑n).toNat) (a m.toNat) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑m⊢ dist (a (↑n).toNat) (a (↑m).toNat) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑m⊢ n ≥ Na:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑m⊢ m ≥ Na:ℕ → ℝε:ℝhε:ε > 0N:ℕn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑mh':dist (a n) (a m) ≤ ε⊢ dist (a (↑n).toNat) (a (↑m).toNat) ≤ ε a:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑m⊢ n ≥ Na:ℕ → ℝε:ℝhε:ε > 0N:ℕh':∀ j ≥ N, ∀ k ≥ N, dist (a j) (a k) ≤ εn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑m⊢ m ≥ Na:ℕ → ℝε:ℝhε:ε > 0N:ℕn:ℕhn:↑N ≤ ↑nm:ℕhm:↑N ≤ ↑mh':dist (a n) (a m) ≤ ε⊢ dist (a (↑n).toNat) (a (↑m).toNat) ≤ ε try All goals completed! 🐙
lemma Sequence.IsCauchy.mk {n₀:ℤ} (a: {n // n ≥ n₀} → ℝ) : (mk' n₀ a).IsCauchy ↔ ∀ ε > 0, ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist (mk' n₀ a j) (mk' n₀ a k) ≤ ε := n₀:ℤa:{ n // n ≥ n₀ } → ℝ⊢ (mk' n₀ a).IsCauchy ↔ ∀ ε > 0, ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady (mk' n₀ a) ↔ ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady (mk' n₀ a) → ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ εn₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0⊢ (∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε) → ε.EventuallySteady (mk' n₀ a) n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0⊢ ε.EventuallySteady (mk' n₀ a) → ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ (mk' n₀ a).mh':ε.Steady ((mk' n₀ a).from N)⊢ ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε; n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ (mk' n₀ a).mh':ε.Steady ((mk' n₀ a).from N)⊢ ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀h':ε.Steady ((mk' n₀ a).from N)⊢ ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε intro j n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀h':ε.Steady ((mk' n₀ a).from N)j:ℤhj:j ≥ N⊢ ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀h':ε.Steady ((mk' n₀ a).from N)j:ℤhj:j ≥ Nk:ℤ⊢ k ≥ N → dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀h':ε.Steady ((mk' n₀ a).from N)j:ℤhj:j ≥ Nk:ℤhk:k ≥ N⊢ dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':∀ n ≥ N, ∀ m ≥ N, ε.Close (if h : n ≥ N then if h_1 : n ≥ n₀ then a ⟨n, ⋯⟩ else 0 else 0) (if h : m ≥ N then if h_1 : m ≥ n₀ then a ⟨m, ⋯⟩ else 0 else 0)⊢ dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':∀ n ≥ N, ∀ m ≥ N, ε.Close (if h : n ≥ N then if h_1 : n ≥ n₀ then a ⟨n, ⋯⟩ else 0 else 0) (if h : m ≥ N then if h_1 : m ≥ n₀ then a ⟨m, ⋯⟩ else 0 else 0)⊢ j ≥ Nn₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':∀ n ≥ N, ∀ m ≥ N, ε.Close (if h : n ≥ N then if h_1 : n ≥ n₀ then a ⟨n, ⋯⟩ else 0 else 0) (if h : m ≥ N then if h_1 : m ≥ n₀ then a ⟨m, ⋯⟩ else 0 else 0)⊢ k ≥ Nn₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':ε.Close (if h : j ≥ N then if h_1 : j ≥ n₀ then a ⟨j, ⋯⟩ else 0 else 0) (if h : k ≥ N then if h_1 : k ≥ n₀ then a ⟨k, ⋯⟩ else 0 else 0)⊢ dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':∀ n ≥ N, ∀ m ≥ N, ε.Close (if h : n ≥ N then if h_1 : n ≥ n₀ then a ⟨n, ⋯⟩ else 0 else 0) (if h : m ≥ N then if h_1 : m ≥ n₀ then a ⟨m, ⋯⟩ else 0 else 0)⊢ j ≥ Nn₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':∀ n ≥ N, ∀ m ≥ N, ε.Close (if h : n ≥ N then if h_1 : n ≥ n₀ then a ⟨n, ⋯⟩ else 0 else 0) (if h : m ≥ N then if h_1 : m ≥ n₀ then a ⟨m, ⋯⟩ else 0 else 0)⊢ k ≥ Nn₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤhN:N ≥ n₀j:ℤhj:j ≥ Nk:ℤhk:k ≥ Nh':ε.Close (if h : j ≥ N then if h_1 : j ≥ n₀ then a ⟨j, ⋯⟩ else 0 else 0) (if h : k ≥ N then if h_1 : k ≥ n₀ then a ⟨k, ⋯⟩ else 0 else 0)⊢ dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε try All goals completed! 🐙 simp_all [show n₀ ≤ j n₀:ℤa:{ n // n ≥ n₀ } → ℝ⊢ (mk' n₀ a).IsCauchy ↔ ∀ ε > 0, ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε All goals completed! 🐙, show n₀ ≤ k n₀:ℤa:{ n // n ≥ n₀ } → ℝ⊢ (mk' n₀ a).IsCauchy ↔ ∀ ε > 0, ∃ N ≥ n₀, ∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε All goals completed! 🐙] n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤleft✝:N ≥ n₀right✝:∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε⊢ ε.EventuallySteady (mk' n₀ a); n₀:ℤa:{ n // n ≥ n₀ } → ℝε:ℝhε:ε > 0N:ℤleft✝:N ≥ n₀right✝:∀ j ≥ N, ∀ k ≥ N, dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k) ≤ ε⊢ max n₀ N ≥ (mk' n₀ a).m ∧ ε.Steady ((mk' n₀ a).from (max n₀ N)); All goals completed! 🐙@[coe] abbrev Sequence.ofChapter5Sequence (a: Chapter5.Sequence) : Sequence := { m := a.n₀ seq n := a n vanish n hn := a:Chapter5.Sequencen:ℤhn:n < a.n₀⊢ ↑(a.seq n) = 0 All goals completed! 🐙 }instance Chapter5.Sequence.inst_coe_sequence : Coe Chapter5.Sequence Sequence where coe := Sequence.ofChapter5Sequence@[simp] theorem Chapter5.coe_sequence_eval (a: Chapter5.Sequence) (n:ℤ) : (a:Sequence) n = (a n:ℝ) := rfltheorem declaration uses `sorry`Sequence.is_steady_of_rat (ε:ℚ) (a: Chapter5.Sequence) : ε.Steady a ↔ (ε:ℝ).Steady (a:Sequence) := ε:ℚa:Chapter5.Sequence⊢ ε.Steady a ↔ (↑ε).Steady ↑a All goals completed! 🐙theorem declaration uses `sorry`Sequence.is_eventuallySteady_of_rat (ε:ℚ) (a: Chapter5.Sequence) : ε.EventuallySteady a ↔ (ε:ℝ).EventuallySteady (a:Sequence) := ε:ℚa:Chapter5.Sequence⊢ ε.EventuallySteady a ↔ (↑ε).EventuallySteady ↑a All goals completed! 🐙

Proposition 6.1.4

theorem Sequence.isCauchy_of_rat (a: Chapter5.Sequence) : a.IsCauchy ↔ (a:Sequence).IsCauchy := a:Chapter5.Sequence⊢ a.IsCauchy ↔ (↑a).IsCauchy -- This proof is written to follow the structure of the original text. a:Chapter5.Sequence⊢ a.IsCauchy → (↑a).IsCauchya:Chapter5.Sequence⊢ (↑a).IsCauchy → a.IsCauchy a:Chapter5.Sequence⊢ (↑a).IsCauchy → a.IsCauchya:Chapter5.Sequence⊢ a.IsCauchy → (↑a).IsCauchy a:Chapter5.Sequence⊢ (↑a).IsCauchy → a.IsCauchy a:Chapter5.Sequenceh:(↑a).IsCauchy⊢ a.IsCauchy; a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady ↑a⊢ a.IsCauchy a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady ↑a⊢ ∀ ε > 0, ε.EventuallySteady a intro ε a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady ↑aε:ℚhε:ε > 0⊢ ε.EventuallySteady a specialize h ε (a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady ↑aε:ℚhε:ε > 0⊢ ↑ε > 0 All goals completed! 🐙) rwa [is_eventuallySteady_of_rata:Chapter5.Sequenceε:ℚhε:ε > 0h:(↑ε).EventuallySteady ↑a⊢ (↑ε).EventuallySteady ↑a a:Chapter5.Sequenceh:a.IsCauchy⊢ (↑a).IsCauchy a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady a⊢ (↑a).IsCauchy a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady a⊢ ∀ ε > 0, ε.EventuallySteady ↑a intro ε a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady aε:ℝhε:ε > 0⊢ ε.EventuallySteady ↑a a:Chapter5.Sequenceh:∀ ε > 0, ε.EventuallySteady aε:ℝhε:ε > 0ε':ℚhε':0 < ε'hlt:↑ε' < ε⊢ ε.EventuallySteady ↑a a:Chapter5.Sequenceε:ℝhε:ε > 0ε':ℚhε':0 < ε'hlt:↑ε' < εh:ε'.EventuallySteady a⊢ ε.EventuallySteady ↑a a:Chapter5.Sequenceε:ℝhε:ε > 0ε':ℚhε':0 < ε'hlt:↑ε' < εh:(↑ε').EventuallySteady ↑a⊢ ε.EventuallySteady ↑a All goals completed! 🐙
end Chapter6

Definition 6.1.5 (CloseSeq)

abbrev Real.CloseSeq (ε: ℝ) (a: Chapter6.Sequence) (L:ℝ) : Prop := ∀ n ≥ a.m, ε.Close (a n) L

Definition 6.1.5 (CloseSeq, def)

theorem Real.closeSeq_def (ε: ℝ) (a: Chapter6.Sequence) (L:ℝ) : ε.CloseSeq a L ↔ ∀ n ≥ a.m, dist (a n) L ≤ ε := ε:ℝa:Chapter6.SequenceL:ℝ⊢ ε.CloseSeq a L ↔ ∀ n ≥ a.m, dist (a.seq n) L ≤ ε All goals completed! 🐙

Definition 6.1.5 (EventuallyClose)

abbrev Real.EventuallyClose (ε: ℝ) (a: Chapter6.Sequence) (L:ℝ) : Prop := ∃ N ≥ a.m, ε.CloseSeq (a.from N) L

Definition 6.1.5 (EventuallyClose, def)

theorem Real.eventuallyClose_def (ε: ℝ) (a: Chapter6.Sequence) (L:ℝ) : ε.EventuallyClose a L ↔ ∃ N, (N ≥ a.m) ∧ ε.CloseSeq (a.from N) L := ε:ℝa:Chapter6.SequenceL:ℝ⊢ ε.EventuallyClose a L ↔ ∃ N ≥ a.m, ε.CloseSeq (a.from N) L All goals completed! 🐙
theorem Real.CloseSeq.coe (ε : ℝ) (a : ℕ → ℝ) (L : ℝ): (ε.CloseSeq a L) ↔ ∀ n, dist (a n) L ≤ ε := ε:ℝa:ℕ → ℝL:ℝ⊢ ε.CloseSeq (↑a) L ↔ ∀ (n : ℕ), dist (a n) L ≤ ε ε:ℝa:ℕ → ℝL:ℝ⊢ ε.CloseSeq (↑a) L → ∀ (n : ℕ), dist (a n) L ≤ εε:ℝa:ℕ → ℝL:ℝ⊢ (∀ (n : ℕ), dist (a n) L ≤ ε) → ε.CloseSeq (↑a) L ε:ℝa:ℕ → ℝL:ℝ⊢ ε.CloseSeq (↑a) L → ∀ (n : ℕ), dist (a n) L ≤ ε intro h ε:ℝa:ℕ → ℝL:ℝh:ε.CloseSeq (↑a) Ln:ℕ⊢ dist (a n) L ≤ ε; ε:ℝa:ℕ → ℝL:ℝn:ℕh:↑n ≥ (↑a).m → ε.Close ((↑a).seq ↑n) L⊢ dist (a n) L ≤ ε; All goals completed! 🐙 ε:ℝa:ℕ → ℝL:ℝ⊢ (∀ (n : ℕ), dist (a n) L ≤ ε) → ε.CloseSeq (↑a) L intro h ε:ℝa:ℕ → ℝL:ℝh:∀ (n : ℕ), dist (a n) L ≤ εn:ℤ⊢ n ≥ (↑a).m → ε.Close ((↑a).seq n) L ε:ℝa:ℕ → ℝL:ℝh:∀ (n : ℕ), dist (a n) L ≤ εn:ℤhn:n ≥ (↑a).m⊢ ε.Close ((↑a).seq n) L; lift n to ℕ using (ε:ℝa:ℕ → ℝL:ℝh:∀ (n : ℕ), dist (a n) L ≤ εn:ℕhn:↑n ≥ (↑a).m⊢ ?m.48 All goals completed! 🐙); ε:ℝa:ℕ → ℝL:ℝn:ℕh:dist (a n) L ≤ ε⊢ ε.Close ((↑a).seq ↑n) L; All goals completed! 🐙theorem Real.CloseSeq.mono {a: Chapter6.Sequence} {ε₁ ε₂ L: ℝ} (hε: ε₁ ≤ ε₂) (hclose: ε₁.CloseSeq a L) : ε₂.CloseSeq a L := a:Chapter6.Sequenceε₁:ℝε₂:ℝL:ℝhε:ε₁ ≤ ε₂hclose:ε₁.CloseSeq a L⊢ ε₂.CloseSeq a L a:Chapter6.Sequenceε₁:ℝε₂:ℝL:ℝhε:ε₁ ≤ ε₂hclose:ε₁.CloseSeq a Ln✝:ℤa✝:n✝ ≥ a.mthis:ε₁.Close (a.seq n✝) L⊢ ε₂.Close (a.seq n✝) L; a:Chapter6.Sequenceε₁:ℝε₂:ℝL:ℝhε:ε₁ ≤ ε₂hclose:ε₁.CloseSeq a Ln✝:ℤa✝:n✝ ≥ a.mthis:|a.seq n✝ - L| ≤ ε₁⊢ |a.seq n✝ - L| ≤ ε₂; All goals completed! 🐙theorem Real.EventuallyClose.mono {a: Chapter6.Sequence} {ε₁ ε₂ L: ℝ} (hε: ε₁ ≤ ε₂) (hclose: ε₁.EventuallyClose a L) : ε₂.EventuallyClose a L := a:Chapter6.Sequenceε₁:ℝε₂:ℝL:ℝhε:ε₁ ≤ ε₂hclose:ε₁.EventuallyClose a L⊢ ε₂.EventuallyClose a L a:Chapter6.Sequenceε₁:ℝε₂:ℝL:ℝhε:ε₁ ≤ ε₂hclose:ε₁.EventuallyClose a LN✝:ℤp✝:N✝ ≥ a.mthis:ε₁.CloseSeq (a.from N✝) L⊢ ε₂.CloseSeq (a.from N✝) L; All goals completed! 🐙namespace Chapter6abbrev Sequence.TendsTo (a:Sequence) (L:ℝ) : Prop := ∀ ε > (0:ℝ), ε.EventuallyClose a Ltheorem Sequence.tendsTo_def (a:Sequence) (L:ℝ) : a.TendsTo L ↔ ∀ ε > (0:ℝ), ε.EventuallyClose a L := a:SequenceL:ℝ⊢ a.TendsTo L ↔ ∀ ε > 0, ε.EventuallyClose a L All goals completed! 🐙

Exercise 6.1.2

theorem declaration uses `sorry`Sequence.tendsTo_iff (a:Sequence) (L:ℝ) : a.TendsTo L ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, |a n - L| ≤ ε := a:SequenceL:ℝ⊢ a.TendsTo L ↔ ∀ ε > 0, ∃ N, ∀ n ≥ N, |a.seq n - L| ≤ ε All goals completed! 🐙
noncomputable def seq_6_1_6 : Sequence := (fun (n:ℕ) ↦ 1-(10:ℝ)^(-(n:ℤ)-1):Sequence)/-- Examples 6.1.6 (0.1 close) -/ example : (0.1:ℝ).CloseSeq seq_6_1_6 1 := ⊢ Real.CloseSeq 0.1 seq_6_1_6 1 ⊢ ∀ (n : ℕ), dist (1 - 10 ^ (-↑n - 1)) 1 ≤ 0.1 n:ℕ⊢ dist (1 - 10 ^ (-↑n - 1)) 1 ≤ 0.1 n:ℕ⊢ 10 ^ (-↑n - 1) ≤ 10 ^ (-1) n:ℕ⊢ 1 ≤ 10n:ℕ⊢ -↑n - 1 ≤ -1 n:ℕ⊢ 1 ≤ 10n:ℕ⊢ -↑n - 1 ≤ -1 All goals completed! 🐙/-- Examples 6.1.6 (0.01 not close) -/ example : ¬ (0.01:ℝ).CloseSeq seq_6_1_6 1 := ⊢ ¬Real.CloseSeq 1e-2 seq_6_1_6 1 h:Real.CloseSeq 1e-2 seq_6_1_6 1⊢ False; specialize h 0 (h:Real.CloseSeq 1e-2 seq_6_1_6 1⊢ 0 ≥ seq_6_1_6.m All goals completed! 🐙); h:10⁻¹ ≤ 1e-2⊢ False; All goals completed! 🐙/-- Examples 6.1.6 (0.01 eventually close) -/ declaration uses `sorry`example : (0.01:ℝ).EventuallyClose seq_6_1_6 1 := ⊢ Real.EventuallyClose 1e-2 seq_6_1_6 1 All goals completed! 🐙/-- Examples 6.1.6 (tends to 1) -/ declaration uses `sorry`example : seq_6_1_6.TendsTo 1 := ⊢ seq_6_1_6.TendsTo 1 All goals completed! 🐙

Proposition 6.1.7 (Uniqueness of limits)

theorem Sequence.tendsTo_unique (a:Sequence) {L L':ℝ} (h:L ≠ L') : ¬ (a.TendsTo L ∧ a.TendsTo L') := a:SequenceL:ℝL':ℝh:L ≠ L'⊢ ¬(a.TendsTo L ∧ a.TendsTo L') -- This proof is written to follow the structure of the original text. a:SequenceL:ℝL':ℝh:L ≠ L'this:a.TendsTo L ∧ a.TendsTo L'⊢ False a:SequenceL:ℝL':ℝh:L ≠ L'hL:a.TendsTo LhL':a.TendsTo L'⊢ False replace h : L - L' ≠ 0 := a:SequenceL:ℝL':ℝh:L ≠ L'⊢ ¬(a.TendsTo L ∧ a.TendsTo L') All goals completed! 🐙 replace h : |L-L'| > 0 := a:SequenceL:ℝL':ℝh:L ≠ L'⊢ ¬(a.TendsTo L ∧ a.TendsTo L') All goals completed! 🐙 a:SequenceL:ℝL':ℝhL:a.TendsTo LhL':a.TendsTo L'h:|L - L'| > 0ε:ℝ := |L - L'| / 3⊢ False have hε : ε > 0 := a:SequenceL:ℝL':ℝh:L ≠ L'⊢ ¬(a.TendsTo L ∧ a.TendsTo L') All goals completed! 🐙 a:SequenceL:ℝL':ℝhL:∀ ε > 0, ∃ N, ∀ n ≥ N, |a.seq n - L| ≤ εhL':∀ ε > 0, ∃ N, ∀ n ≥ N, |a.seq n - L'| ≤ εh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0⊢ False a:SequenceL:ℝL':ℝhL':∀ ε > 0, ∃ N, ∀ n ≥ N, |a.seq n - L'| ≤ εh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0hL:∃ N, ∀ n ≥ N, |a.seq n - L| ≤ ε⊢ False; a:SequenceL:ℝL':ℝhL':∀ ε > 0, ∃ N, ∀ n ≥ N, |a.seq n - L'| ≤ εh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤhN:∀ n ≥ N, |a.seq n - L| ≤ ε⊢ False a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤhN:∀ n ≥ N, |a.seq n - L| ≤ εhL':∃ N, ∀ n ≥ N, |a.seq n - L'| ≤ ε⊢ False; a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤhN:∀ n ≥ N, |a.seq n - L| ≤ εM:ℤhM:∀ n ≥ M, |a.seq n - L'| ≤ ε⊢ False a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤhN:∀ n ≥ N, |a.seq n - L| ≤ εM:ℤhM:∀ n ≥ M, |a.seq n - L'| ≤ εn:ℤ := max N M⊢ False specialize hN n (a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤhN:∀ n ≥ N, |a.seq n - L| ≤ εM:ℤhM:∀ n ≥ M, |a.seq n - L'| ≤ εn:ℤ := max N M⊢ n ≥ N All goals completed! 🐙) specialize hM n (a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤhM:∀ n ≥ M, |a.seq n - L'| ≤ εn:ℤ := max N MhN:|a.seq n - L| ≤ ε⊢ n ≥ M All goals completed! 🐙) have : |L-L'| ≤ 2 * |L-L'|/3 := calc _ = dist L L' := a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤn:ℤ := max N MhN:|a.seq n - L| ≤ εhM:|a.seq n - L'| ≤ ε⊢ |L - L'| = dist L L' All goals completed! 🐙 _ ≤ dist L (a.seq n) + dist (a.seq n) L' := dist_triangle _ _ _ _ ≤ ε + ε := a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤn:ℤ := max N MhN:|a.seq n - L| ≤ εhM:|a.seq n - L'| ≤ ε⊢ dist L (a.seq n) + dist (a.seq n) L' ≤ ε + ε a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤn:ℤ := max N MhN:dist (a.seq n) L ≤ εhM:dist (a.seq n) L' ≤ ε⊢ dist L (a.seq n) + dist (a.seq n) L' ≤ ε + ε; a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤn:ℤ := max N MhN:dist L (a.seq n) ≤ εhM:dist (a.seq n) L' ≤ ε⊢ dist L (a.seq n) + dist (a.seq n) L' ≤ ε + ε; All goals completed! 🐙 _ = 2 * |L-L'|/3 := a:SequenceL:ℝL':ℝh:|L - L'| > 0ε:ℝ := |L - L'| / 3hε:ε > 0N:ℤM:ℤn:ℤ := max N MhN:|a.seq n - L| ≤ εhM:|a.seq n - L'| ≤ ε⊢ ε + ε = 2 * |L - L'| / 3 All goals completed! 🐙 All goals completed! 🐙

Definition 6.1.8 (Convergent)

abbrev Sequence.Convergent (a:Sequence) : Prop := ∃ L, a.TendsTo L

Definition 6.1.8 (Convergent, def)

theorem Sequence.convergent_def (a:Sequence) : a.Convergent ↔ ∃ L, a.TendsTo L := a:Sequence⊢ a.Convergent ↔ ∃ L, a.TendsTo L All goals completed! 🐙

Definition 6.1.8 (Divergent)

abbrev Sequence.Divergent (a:Sequence) : Prop := ¬ a.Convergent

Definition 6.1.8 (Divergent, def)

theorem Sequence.divergent_def (a:Sequence) : a.Divergent ↔ ¬ a.Convergent := a:Sequence⊢ a.Divergent ↔ ¬a.Convergent All goals completed! 🐙

Definition 6.1.8. We give the limit of a sequence the junk value of 0 if it is not convergent.

open Classical innoncomputable abbrev lim (a:Sequence) : ℝ := if h: a.Convergent then h.choose else 0

Definition 6.1.8 (lim, def)

theorem Sequence.lim_def {a:Sequence} (h: a.Convergent) : a.TendsTo (lim a) := a:Sequenceh:a.Convergent⊢ a.TendsTo (lim a) a:Sequenceh:a.Convergent⊢ a.TendsTo (Exists.choose ⋯); All goals completed! 🐙

Definition 6.1.8 (lim, characterization)

theorem Sequence.lim_eq {a:Sequence} {L:ℝ} : a.TendsTo L ↔ a.Convergent ∧ lim a = L := a:SequenceL:ℝ⊢ a.TendsTo L ↔ a.Convergent ∧ lim a = L a:SequenceL:ℝ⊢ a.TendsTo L → a.Convergent ∧ lim a = La:SequenceL:ℝ⊢ a.Convergent ∧ lim a = L → a.TendsTo L a:SequenceL:ℝ⊢ a.TendsTo L → a.Convergent ∧ lim a = L a:SequenceL:ℝh:a.TendsTo L⊢ a.Convergent ∧ lim a = L; a:SequenceL:ℝh:a.TendsTo Leq:a.Convergent → lim a ≠ L⊢ False have : a.Convergent := a:SequenceL:ℝ⊢ a.TendsTo L ↔ a.Convergent ∧ lim a = L a:SequenceL:ℝh:a.TendsTo Leq:a.Convergent → lim a ≠ L⊢ ∃ L, a.TendsTo L; All goals completed! 🐙 a:SequenceL:ℝh:a.TendsTo Lthis:a.Convergenteq:¬(a.TendsTo (lim a) ∧ a.TendsTo L)⊢ False a:SequenceL:ℝh:a.TendsTo Leq:¬(a.TendsTo (lim a) ∧ a.TendsTo L)this:a.TendsTo (lim a)⊢ False; All goals completed! 🐙 a:SequenceL:ℝh:a.Convergent⊢ a.TendsTo (lim a); All goals completed! 🐙

Proposition 6.1.11

theorem Sequence.lim_harmonic : ((fun (n:ℕ) ↦ (n+1:ℝ)⁻¹):Sequence).Convergent ∧ lim ((fun (n:ℕ) ↦ (n+1:ℝ)⁻¹):Sequence) = 0 := ⊢ (↑fun n ↦ (↑n + 1)⁻¹).Convergent ∧ (lim ↑fun n ↦ (↑n + 1)⁻¹) = 0 -- This proof is written to follow the structure of the original text. ⊢ ∀ ε > 0, ∃ N, ∀ n ≥ N, |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε intro ε ε:ℝhε:ε > 0⊢ ∃ N, ∀ n ≥ N, |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑N⊢ ∃ N, ∀ n ≥ N, |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε; ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑N⊢ ∀ n ≥ N, |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε; intro n ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ N⊢ |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε have hNpos : (N:ℝ) > 0 := ⊢ (↑fun n ↦ (↑n + 1)⁻¹).Convergent ∧ (lim ↑fun n ↦ (↑n + 1)⁻¹) = 0 ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ N⊢ 0 < 1 / ε; All goals completed! 🐙 ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < N⊢ |(↑fun n ↦ (↑n + 1)⁻¹).seq n - 0| ≤ ε have hnpos : n ≥ 0 := ⊢ (↑fun n ↦ (↑n + 1)⁻¹).Convergent ∧ (lim ↑fun n ↦ (↑n + 1)⁻¹) = 0 All goals completed! 🐙 ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ |↑n.toNat + 1|⁻¹ ≤ ε calc _ ≤ (N:ℝ)⁻¹ := ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ |↑n.toNat + 1|⁻¹ ≤ (↑N)⁻¹ ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ↑N ≤ |↑n.toNat + 1|ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < |↑n.toNat + 1|ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ↑N ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ↑N ≤ |↑n.toNat + 1|ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < |↑n.toNat + 1|ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ↑N try All goals completed! 🐙 calc _ ≤ (n:ℝ) := ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ↑N ≤ ↑n All goals completed! 🐙 _ = (n.toNat:ℤ) := ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ↑n = ↑↑n.toNat All goals completed! 🐙 _ = n.toNat := rfl _ ≤ (n.toNat:ℝ) + 1 := ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ↑n.toNat ≤ ↑n.toNat + 1 All goals completed! 🐙 _ ≤ _ := le_abs_self _ _ ≤ ε := ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ (↑N)⁻¹ ≤ ε ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ε⁻¹ ≤ ↑Nε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ↑Nε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ε ε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ε⁻¹ ≤ ↑Nε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ↑Nε:ℝhε:ε > 0N:ℤhN:1 / ε < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ 0 < ε try All goals completed! 🐙 ε:ℝhε:ε > 0N:ℤhN:ε⁻¹ < ↑Nn:ℤhn:n ≥ NhNpos:0 < Nhnpos:n ≥ 0⊢ ε⁻¹ ≤ ↑N; All goals completed! 🐙

Proposition 6.1.12 / Exercise 6.1.5

theorem declaration uses `sorry`Sequence.IsCauchy.convergent {a:Sequence} (h:a.Convergent) : a.IsCauchy := a:Sequenceh:a.Convergent⊢ a.IsCauchy All goals completed! 🐙
/-- Example 6.1.13 (not eventually steady) -/ declaration uses `sorry`example : ¬ (0.1:ℝ).EventuallySteady ((fun n ↦ (-1:ℝ)^n):Sequence) := ⊢ ¬Real.EventuallySteady 0.1 ↑fun n ↦ (-1) ^ n All goals completed! 🐙/-- Example 6.1.13 (not Cauchy) -/ declaration uses `sorry`example : ¬ ((fun n ↦ (-1:ℝ)^n):Sequence).IsCauchy := ⊢ ¬(↑fun n ↦ (-1) ^ n).IsCauchy All goals completed! 🐙/-- Example 6.1.13 (not convergent) -/ declaration uses `sorry`example : ¬ ((fun n ↦ (-1:ℝ)^n):Sequence).Convergent := ⊢ ¬(↑fun n ↦ (-1) ^ n).Convergent All goals completed! 🐙

Proposition 6.1.15 / Exercise 6.1.6 (Formal limits are genuine limits)

theorem declaration uses `sorry`Sequence.lim_eq_LIM {a:ℕ → ℚ} (h: (a:Chapter5.Sequence).IsCauchy) : ((a:Chapter5.Sequence):Sequence).TendsTo (Chapter5.Real.equivR (Chapter5.LIM a)) := a:ℕ → ℚh:(↑a).IsCauchy⊢ (↑↑a).TendsTo (Chapter5.Real.equivR (Chapter5.LIM a)) All goals completed! 🐙

Definition 6.1.16 (BoundedBy)

abbrev Sequence.BoundedBy (a:Sequence) (M:ℝ) : Prop := ∀ n, |a n| ≤ M

Definition 6.1.16 (BoundedBy, def)

lemma Sequence.boundedBy_def (a:Sequence) (M:ℝ) : a.BoundedBy M ↔ ∀ n, |a n| ≤ M := a:SequenceM:ℝ⊢ a.BoundedBy M ↔ ∀ (n : ℤ), |a.seq n| ≤ M All goals completed! 🐙

Definition 6.1.16 (IsBounded)

abbrev Sequence.IsBounded (a:Sequence) : Prop := ∃ M ≥ 0, a.BoundedBy M

Definition 6.1.16 (IsBounded, def)

lemma Sequence.isBounded_def (a:Sequence) : a.IsBounded ↔ ∃ M ≥ 0, a.BoundedBy M := a:Sequence⊢ a.IsBounded ↔ ∃ M ≥ 0, a.BoundedBy M All goals completed! 🐙
theorem declaration uses `sorry`Sequence.bounded_of_cauchy {a:Sequence} (h: a.IsCauchy) : a.IsBounded := a:Sequenceh:a.IsCauchy⊢ a.IsBounded All goals completed! 🐙

Corollary 6.1.17

theorem declaration uses `sorry`Sequence.bounded_of_convergent {a:Sequence} (h: a.Convergent) : a.IsBounded := a:Sequenceh:a.Convergent⊢ a.IsBounded All goals completed! 🐙
/-- Example 6.1.18 (not bounded) -/ declaration uses `sorry`example : ¬ ((fun (n:ℕ) ↦ (n+1:ℝ)):Sequence).IsBounded := ⊢ ¬(↑fun n ↦ ↑n + 1).IsBounded All goals completed! 🐙/-- Example 6.1.18 (not convergent) -/ declaration uses `sorry`example : ¬ ((fun (n:ℕ) ↦ (n+1:ℝ)):Sequence).Convergent := ⊢ ¬(↑fun n ↦ ↑n + 1).Convergent All goals completed! 🐙instance Sequence.inst_add : Add Sequence where add a b := { m := min a.m b.m seq n := a n + b n vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ a.seq n + b.seq n = 0 All goals completed! 🐙 }@[simp] theorem Sequence.add_eval {a b: Sequence} (n:ℤ) : (a + b) n = a n + b n := rfltheorem Sequence.add_coe (a b: ℕ → ℝ) : (a:Sequence) + (b:Sequence) = (fun n ↦ a n + b n) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a + ↑b = ↑fun n ↦ a n + b n a:ℕ → ℝb:ℕ → ℝ⊢ (↑a + ↑b).m = (↑fun n ↦ a n + b n).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a + ↑b).seq n = (↑fun n ↦ a n + b n).seq n All goals completed! 🐙

Theorem 6.1.19(a) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_add {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) : (a+b).TendsTo (L+M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo M⊢ (a + b).TendsTo (L + M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_add {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) : (a + b).Convergent ∧ lim (a + b) = lim a + lim b := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergent⊢ (a + b).Convergent ∧ lim (a + b) = lim a + lim b All goals completed! 🐙instance Sequence.inst_mul : Mul Sequence where mul a b := { m := min a.m b.m seq n := a n * b n vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ a.seq n * b.seq n = 0 All goals completed! 🐙 }@[simp] theorem Sequence.mul_eval {a b: Sequence} (n:ℤ) : (a * b) n = a n * b n := rfltheorem Sequence.mul_coe (a b: ℕ → ℝ) : (a:Sequence) * (b:Sequence) = (fun n ↦ a n * b n) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a * ↑b = ↑fun n ↦ a n * b n a:ℕ → ℝb:ℕ → ℝ⊢ (↑a * ↑b).m = (↑fun n ↦ a n * b n).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a * ↑b).seq n = (↑fun n ↦ a n * b n).seq n All goals completed! 🐙

Theorem 6.1.19(b) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_mul {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) : (a * b).TendsTo (L * M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo M⊢ (a * b).TendsTo (L * M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_mul {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) : (a * b).Convergent ∧ lim (a * b) = lim a * lim b := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergent⊢ (a * b).Convergent ∧ lim (a * b) = lim a * lim b All goals completed! 🐙instance Sequence.inst_smul : SMul ℝ Sequence where smul c a := { m := a.m seq n := c * a n vanish n hn := c:ℝa:Sequencen:ℤhn:n < a.m⊢ c * a.seq n = 0 All goals completed! 🐙 }@[simp] theorem Sequence.smul_eval {a: Sequence} (c: ℝ) (n:ℤ) : (c • a) n = c * a n := rfltheorem Sequence.smul_coe (c:ℝ) (a:ℕ → ℝ) : (c • (a:Sequence)) = (fun n ↦ c * a n) := c:ℝa:ℕ → ℝ⊢ c • ↑a = ↑fun n ↦ c * a n c:ℝa:ℕ → ℝ⊢ (c • ↑a).m = (↑fun n ↦ c * a n).mc:ℝa:ℕ → ℝn:ℤ⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq n; c:ℝa:ℕ → ℝn:ℤ⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq n c:ℝa:ℕ → ℝn:ℤh:n ≥ 0⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq nc:ℝa:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq n c:ℝa:ℕ → ℝn:ℤh:n ≥ 0⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq nc:ℝa:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (c • ↑a).seq n = (↑fun n ↦ c * a n).seq n All goals completed! 🐙

Theorem 6.1.19(c) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_smul (c:ℝ) {a:Sequence} {L:ℝ} (ha: a.TendsTo L) : (c • a).TendsTo (c * L) := c:ℝa:SequenceL:ℝha:a.TendsTo L⊢ (c • a).TendsTo (c * L) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_smul (c:ℝ) {a:Sequence} (ha: a.Convergent) : (c • a).Convergent ∧ lim (c • a) = c * lim a := c:ℝa:Sequenceha:a.Convergent⊢ (c • a).Convergent ∧ lim (c • a) = c * lim a All goals completed! 🐙instance Sequence.inst_sub : Sub Sequence where sub a b := { m := min a.m b.m seq n := a n - b n vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ a.seq n - b.seq n = 0 All goals completed! 🐙 }@[simp] theorem Sequence.sub_eval {a b: Sequence} (n:ℤ) : (a - b) n = a n - b n := rfltheorem Sequence.sub_coe (a b: ℕ → ℝ) : (a:Sequence) - (b:Sequence) = (fun n ↦ a n - b n) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a - ↑b = ↑fun n ↦ a n - b n a:ℕ → ℝb:ℕ → ℝ⊢ (↑a - ↑b).m = (↑fun n ↦ a n - b n).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a - ↑b).seq n = (↑fun n ↦ a n - b n).seq n All goals completed! 🐙

Theorem 6.1.19(d) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_sub {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) : (a - b).TendsTo (L - M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo M⊢ (a - b).TendsTo (L - M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.LIM_sub {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) : (a - b).Convergent ∧ lim (a - b) = lim a - lim b := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergent⊢ (a - b).Convergent ∧ lim (a - b) = lim a - lim b All goals completed! 🐙noncomputable instance Sequence.inst_inv : Inv Sequence where inv a := { m := a.m seq n := (a n)⁻¹ vanish n hn := a:Sequencen:ℤhn:n < a.m⊢ (a.seq n)⁻¹ = 0 All goals completed! 🐙 }@[simp] theorem Sequence.inv_eval {a: Sequence} (n:ℤ) : (a⁻¹) n = (a n)⁻¹ := rfltheorem Sequence.inv_coe (a: ℕ → ℝ) : (a:Sequence)⁻¹ = (fun n ↦ (a n)⁻¹) := a:ℕ → ℝ⊢ (↑a)⁻¹ = ↑fun n ↦ (a n)⁻¹ a:ℕ → ℝ⊢ (↑a)⁻¹.m = (↑fun n ↦ (a n)⁻¹).ma:ℕ → ℝn:ℤ⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq n; a:ℕ → ℝn:ℤ⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq n a:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq na:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq n a:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq na:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a)⁻¹.seq n = (↑fun n ↦ (a n)⁻¹).seq n All goals completed! 🐙

Theorem 6.1.19(e) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_inv {a:Sequence} {L:ℝ} (ha: a.TendsTo L) (hnon: L ≠ 0) : (a⁻¹).TendsTo (L⁻¹) := a:SequenceL:ℝha:a.TendsTo Lhnon:L ≠ 0⊢ a⁻¹.TendsTo L⁻¹ All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_inv {a:Sequence} (ha: a.Convergent) (hnon: lim a ≠ 0) : (a⁻¹).Convergent ∧ lim (a⁻¹) = (lim a)⁻¹ := a:Sequenceha:a.Convergenthnon:lim a ≠ 0⊢ a⁻¹.Convergent ∧ lim a⁻¹ = (lim a)⁻¹ All goals completed! 🐙noncomputable instance Sequence.inst_div : Div Sequence where div a b := { m := min a.m b.m seq n := a n / b n vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ a.seq n / b.seq n = 0 All goals completed! 🐙 }@[simp] theorem Sequence.div_eval {a b: Sequence} (n:ℤ) : (a / b) n = a n / b n := rfltheorem Sequence.div_coe (a b: ℕ → ℝ) : (a:Sequence) / (b:Sequence) = (fun n ↦ a n / b n) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a / ↑b = ↑fun n ↦ a n / b n a:ℕ → ℝb:ℕ → ℝ⊢ (↑a / ↑b).m = (↑fun n ↦ a n / b n).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a / ↑b).seq n = (↑fun n ↦ a n / b n).seq n All goals completed! 🐙

Theorem 6.1.19(f) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_div {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) (hnon: M ≠ 0) : (a / b).TendsTo (L / M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo Mhnon:M ≠ 0⊢ (a / b).TendsTo (L / M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_div {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) (hnon: lim b ≠ 0) : (a / b).Convergent ∧ lim (a / b) = lim a / lim b := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergenthnon:lim b ≠ 0⊢ (a / b).Convergent ∧ lim (a / b) = lim a / lim b All goals completed! 🐙instance Sequence.inst_max : Max Sequence where max a b := { m := min a.m b.m seq n := max (a n) (b n) vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ max (a.seq n) (b.seq n) = 0 All goals completed! 🐙 }@[simp] theorem Sequence.max_eval {a b: Sequence} (n:ℤ) : (a ⊔ b) n = (a n) ⊔ (b n) := rfltheorem Sequence.max_coe (a b: ℕ → ℝ) : (a:Sequence) ⊔ (b:Sequence) = (fun n ↦ max (a n) (b n)) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a ⊔ ↑b = ↑fun n ↦ max (a n) (b n) a:ℕ → ℝb:ℕ → ℝ⊢ (↑a ⊔ ↑b).m = (↑fun n ↦ max (a n) (b n)).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a ⊔ ↑b).seq n = (↑fun n ↦ max (a n) (b n)).seq n All goals completed! 🐙

Theorem 6.1.19(g) (limit laws). The Sequence.­TendsTo version is more usable than the lim version in applications.

theorem declaration uses `sorry`Sequence.tendsTo_max {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) : (max a b).TendsTo (max L M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo M⊢ (a ⊔ b).TendsTo (max L M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_max {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) : (max a b).Convergent ∧ lim (max a b) = max (lim a) (lim b) := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergent⊢ (a ⊔ b).Convergent ∧ lim (a ⊔ b) = max (lim a) (lim b) All goals completed! 🐙instance Sequence.inst_min : Min Sequence where min a b := { m := min a.m b.m seq n := min (a n) (b n) vanish n hn := a:Sequenceb:Sequencen:ℤhn:n < min a.m b.m⊢ min (a.seq n) (b.seq n) = 0 All goals completed! 🐙 }@[simp] theorem Sequence.min_eval {a b: Sequence} (n:ℤ) : (a ⊓ b) n = (a n) ⊓ (b n) := rfltheorem Sequence.min_coe (a b: ℕ → ℝ) : (a:Sequence) ⊓ (b:Sequence) = (fun n ↦ min (a n) (b n)) := a:ℕ → ℝb:ℕ → ℝ⊢ ↑a ⊓ ↑b = ↑fun n ↦ min (a n) (b n) a:ℕ → ℝb:ℕ → ℝ⊢ (↑a ⊓ ↑b).m = (↑fun n ↦ min (a n) (b n)).ma:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq n; a:ℕ → ℝb:ℕ → ℝn:ℤ⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq n a:ℕ → ℝb:ℕ → ℝn:ℤh:n ≥ 0⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq na:ℕ → ℝb:ℕ → ℝn:ℤh:¬n ≥ 0⊢ (↑a ⊓ ↑b).seq n = (↑fun n ↦ min (a n) (b n)).seq n All goals completed! 🐙

Theorem 6.1.19(h) (limit laws)

theorem declaration uses `sorry`Sequence.tendsTo_min {a b:Sequence} {L M:ℝ} (ha: a.TendsTo L) (hb: b.TendsTo M) : (min a b).TendsTo (min L M) := a:Sequenceb:SequenceL:ℝM:ℝha:a.TendsTo Lhb:b.TendsTo M⊢ (a ⊓ b).TendsTo (min L M) All goals completed! 🐙
theorem declaration uses `sorry`Sequence.lim_min {a b:Sequence} (ha: a.Convergent) (hb: b.Convergent) : (min a b).Convergent ∧ lim (min a b) = min (lim a) (lim b) := a:Sequenceb:Sequenceha:a.Convergenthb:b.Convergent⊢ (a ⊓ b).Convergent ∧ lim (a ⊓ b) = min (lim a) (lim b) All goals completed! 🐙

Exercise 6.1.1

theorem declaration uses `sorry`Sequence.mono_if {a: ℕ → ℝ} (ha: ∀ n, a (n+1) > a n) {n m:ℕ} (hnm: m > n) : a m > a n := a:ℕ → ℝha:∀ (n : ℕ), a (n + 1) > a nn:ℕm:ℕhnm:m > n⊢ a m > a n All goals completed! 🐙

Exercise 6.1.3

theorem declaration uses `sorry`Sequence.tendsTo_of_from {a: Sequence} {c:ℝ} (m:ℤ) : a.TendsTo c ↔ (a.from m).TendsTo c := a:Sequencec:ℝm:ℤ⊢ a.TendsTo c ↔ (a.from m).TendsTo c All goals completed! 🐙

Exercise 6.1.4

theorem declaration uses `sorry`Sequence.tendsTo_of_shift {a: Sequence} {c:ℝ} (k:ℕ) : a.TendsTo c ↔ (Sequence.mk' a.m (fun n : {n // n ≥ a.m} ↦ a (n+k))).TendsTo c := a:Sequencec:ℝk:ℕ⊢ a.TendsTo c ↔ (mk' a.m fun n ↦ a.seq (↑n + ↑k)).TendsTo c All goals completed! 🐙

Exercise 6.1.7

theorem declaration uses `sorry`Sequence.isBounded_of_rat (a: Chapter5.Sequence) : a.IsBounded ↔ (a:Sequence).IsBounded := a:Chapter5.Sequence⊢ a.IsBounded ↔ (↑a).IsBounded All goals completed! 🐙

Exercise 6.1.9

theorem declaration uses `sorry`Sequence.lim_div_fail : ∃ a b, a.Convergent ∧ b.Convergent ∧ lim b = 0 ∧ ¬ ((a / b).Convergent ∧ lim (a / b) = lim a / lim b) := ⊢ ∃ a b, a.Convergent ∧ b.Convergent ∧ lim b = 0 ∧ ¬((a / b).Convergent ∧ lim (a / b) = lim a / lim b) All goals completed! 🐙
theorem declaration uses `sorry`Chapter5.Sequence.IsCauchy_iff (a:Chapter5.Sequence) : a.IsCauchy ↔ ∀ ε > (0:ℝ), ∃ N ≥ a.n₀, ∀ n ≥ N, ∀ m ≥ N, |a n - a m| ≤ ε := a:Chapter5.Sequence⊢ a.IsCauchy ↔ ∀ ε > 0, ∃ N ≥ a.n₀, ∀ n ≥ N, ∀ m ≥ N, ↑|a.seq n - a.seq m| ≤ ε All goals completed! 🐙end Chapter6-- additional definitions for exercise 6.1.10 abbrev Real.SeqCloseSeq (ε: ℝ) (a b: Chapter5.Sequence) : Prop := ∀ n, n ≥ a.n₀ → n ≥ b.n₀ → ε.Close (a n) (b n)abbrev Real.SeqEventuallyClose (ε: ℝ) (a b: Chapter5.Sequence): Prop := ∃ N, ε.SeqCloseSeq (a.from N) (b.from N)-- extended definition of rational sequences equivalence but with positive real ε abbrev Chapter5.Sequence.RatEquiv (a b: ℕ → ℚ) : Prop := ∀ (ε:ℝ), ε > 0 → ε.SeqEventuallyClose (a:Chapter5.Sequence) (b:Chapter5.Sequence)namespace Chapter6

Exercise 6.1.10

theorem declaration uses `sorry`Chapter5.Sequence.equiv_rat (a b: ℕ → ℚ) : Chapter5.Sequence.Equiv a b ↔ Chapter5.Sequence.RatEquiv a b := a:ℕ → ℚb:ℕ → ℚ⊢ Chapter5.Sequence.Equiv a b ↔ Chapter5.Sequence.RatEquiv a b All goals completed! 🐙
end Chapter6