Analysis I, Section 5.1

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:

namespace Chapter5

Definition 5.1.1 (Sequence). To avoid some technicalities involving dependent types, we extend sequences by zero to the left of the starting point n₀.

@[ext] structure Sequence where n₀ : seq : vanish : n, n < n₀ seq n = 0

Sequence can be thought of as functions from ℤ to ℚ.

instance Sequence.instCoeFun : CoeFun Sequence (fun _ ) where coe := fun a a.seq

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

instance Sequence.instCoe : Coe ( ) Sequence where coe := fun a { n₀ := 0 seq := fun n if n 0 then a n.toNat else 0 vanish := a:n < 0, (if n0 then a n.toNat else 0) = 0 a:n:hn:n < 0(if n0 then a n.toNat else 0) = 0 All goals completed! 🐙 }abbrev Sequence.mk' (n₀:) (a: { n // n n₀ } ) : Sequence where n₀ := n₀ seq := fun n if h : n n₀ then a n, h else 0 vanish := n₀:a:{ n // nn₀ }n < n₀, (if h : nn₀ then an, helse 0) = 0 n₀:a:{ n // nn₀ }n:hn:n < n₀(if h : nn₀ then an, helse 0) = 0 All goals completed! 🐙lemma Sequence.eval_mk {n n₀:} (a: { n // n n₀ } ) (h: n n₀) : (Sequence.mk' n₀ a) n = a n, h := n:n₀:a:{ n // nn₀ }h:nn₀(mk' n₀ a).seq n = an, h All goals completed! 🐙@[simp] lemma Sequence.eval_coe (n:) (a: ) : (a:Sequence) n = a n := n:a:{ n₀ := 0, seq := fun n => if n0 then a n.toNat else 0, vanish := ⋯ }.seqn = a n All goals completed! 🐙

Example 5.1.2

abbrev Sequence.squares : Sequence := ((fun n: (n^2:)):Sequence)

Example 5.1.2

example (n:) : Sequence.squares n = n^2 := Sequence.eval_coe _ _

Example 5.1.2

abbrev Sequence.three : Sequence := ((fun (_:) (3:)):Sequence)

Example 5.1.2

example (n:) : Sequence.three n = 3 := Sequence.eval_coe _ (fun (_:) (3:))

Example 5.1.2

abbrev Sequence.squares_from_three : Sequence := mk' 3 (fun n n^2)

Example 5.1.2

example (n:) (hn: n 3) : Sequence.squares_from_three n = n^2 := Sequence.eval_mk _ hn-- need to temporarily leave the `Chapter5` namespace to introduce the following notation end Chapter5abbrev Rat.steady (ε: ) (a: Chapter5.Sequence) : Prop := n m, ε.close (a n) (a m)namespace Chapter5lemma Rat.steady_def (ε: ) (a: Sequence) : ε.steady a n m, ε.close (a n) (a m) := ε:a:Sequenceε.steady a∀ (n m : ), ε.close (a.seq n) (a.seq m) All goals completed! 🐙lemma declaration uses 'sorry'Rat.steady_def' (ε: ) (a: Sequence) : ε.steady a n m, n a.n₀ m a.n₀ ε.close (a n) (a m) := ε:a:Sequenceε.steady a∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m) ε:a:Sequence(∀ (n m : ), ε.close (a.seq n) (a.seq m))∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m) ε:a:Sequence(∀ (n m : ), ε.close (a.seq n) (a.seq m)) → ∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m)ε:a:Sequence(∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m)) → ∀ (n m : ), ε.close (a.seq n) (a.seq m) ε:a:Sequence(∀ (n m : ), ε.close (a.seq n) (a.seq m)) → ∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m) ε:a:Sequenceh:∀ (n m : ), ε.close (a.seq n) (a.seq m)n:m:hn:na.n₀hm:ma.n₀ε.close (a.seq n) (a.seq m) All goals completed! 🐙 ε:a:Sequenceh:∀ (n m : ), na.n₀ma.n₀ε.close (a.seq n) (a.seq m)n:m:ε.close (a.seq n) (a.seq m) All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example : (1:).steady ((fun n: if Even n then (1:) else (0:)):Sequence) := Rat.steady 1 { n₀ := 0, seq := fun n => if n0 then (fun n => if Even n then 1 else 0) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example : ¬ (0.5:).steady ((fun n: if Even n then (1:) else (0:)):Sequence) := ¬Rat.steady 0.5 { n₀ := 0, seq := fun n => if n0 then (fun n => if Even n then 1 else 0) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example : (0.1:).steady ((fun n: (10:) ^ (-(n:)-1) ):Sequence) := Rat.steady 0.1 { n₀ := 0, seq := fun n => if n0 then (fun n => 10 ^ (-n - 1)) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example : ¬(0.01:).steady ((fun n: (10:) ^ (-(n:)-1) ):Sequence) := ¬Rat.steady 1e-2 { n₀ := 0, seq := fun n => if n0 then (fun n => 10 ^ (-n - 1)) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example (ε:) : ¬ ε.steady ((fun n: (2 ^ (n+1):) ):Sequence) := ε:¬ε.steady { n₀ := 0, seq := fun n => if n0 then (fun n => 2 ^ (n + 1)) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙

Example 5.1.5

declaration uses 'sorry'example (ε:) (: ε>0) : ε.steady ((fun _: (2:) ):Sequence) := ε::ε > 0ε.steady { n₀ := 0, seq := fun n => if n0 then (fun x => 2) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙declaration uses 'sorry'example : (10:).steady ((fun n: if n = 0 then (10:) else (0:)):Sequence) := Rat.steady 10 { n₀ := 0, seq := fun n => if n0 then (fun n => if n = 0 then 10 else 0) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙declaration uses 'sorry'example (ε:) (:ε<10): ¬ ε.steady ((fun n: if n = 0 then (10:) else (0:)):Sequence) := ε::ε < 10¬ε.steady { n₀ := 0, seq := fun n => if n0 then (fun n => if n = 0 then 10 else 0) n.toNat else 0, vanish := ⋯ } 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) (n₁:) : Sequence := mk' (max a.n₀ n₁) (fun n a (n:))lemma Sequence.from_eval (a:Sequence) {n₁ n:} (hn: n n₁) : (a.from n₁) n = a n := a:Sequencen₁:n:hn:nn₁(a.from n₁).seq n = a.seq n a:Sequencen₁:n:hn:nn₁n < a.n₀ → 0 = a.seq n a:Sequencen₁:n:hn:nn₁h:n < a.n₀0 = a.seq n All goals completed! 🐙end Chapter5

Definition 5.1.6 (Eventually ε-steady)

abbrev Rat.eventuallySteady (ε: ) (a: Chapter5.Sequence) : Prop := N, (N a.n₀) ε.steady (a.from N)namespace Chapter5lemma Rat.eventuallySteady_def (ε: ) (a: Sequence) : ε.eventuallySteady a N, (N a.n₀) ε.steady (a.from N) := ε:a:Sequenceε.eventuallySteady aNa.n₀, ε.steady (a.from N) All goals completed! 🐙/-- Example 5.1.7 -/ lemma declaration uses 'sorry'Sequence.ex_5_1_7_a : ¬ (0.1:).steady ((fun n: (n+1:)⁻¹ ):Sequence) := ¬Rat.steady 0.1 { n₀ := 0, seq := fun n => if n0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙lemma declaration uses 'sorry'Sequence.ex_5_1_7_b : (0.1:).steady (((fun n: (n+1:)⁻¹ ):Sequence).from 10) := Rat.steady 0.1 ({ n₀ := 0, seq := fun n => if n0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := ⋯ }.from 10) All goals completed! 🐙lemma declaration uses 'sorry'Sequence.ex_5_1_7_c : (0.1:).eventuallySteady ((fun n: (n+1:)⁻¹ ):Sequence) := Rat.eventuallySteady 0.1 { n₀ := 0, seq := fun n => if n0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙lemma declaration uses 'sorry'Sequence.ex_5_1_7_d {ε:} (:ε>0) : ε.eventuallySteady ((fun n: if n=0 then (10:) else (0:) ):Sequence) := ε::ε > 0ε.eventuallySteady { n₀ := 0, seq := fun n => if n0 then (fun n => if n = 0 then 10 else 0) n.toNat else 0, vanish := ⋯ } All goals completed! 🐙abbrev Sequence.isCauchy (a:Sequence) : Prop := (ε:), (ε > 0 (ε.eventuallySteady a))lemma Sequence.isCauchy_def (a:Sequence) : a.isCauchy (ε:), (ε > 0 ε.eventuallySteady a) := a:Sequencea.isCauchyε > 0, ε.eventuallySteady a All goals completed! 🐙lemma declaration uses 'sorry'Sequence.isCauchy_of_coe (a: ) : (a:Sequence).isCauchy (ε:), ε > 0 N, j k, j N k N Section_4_3.dist (a j) (a k) ε := a:{ n₀ := 0, seq := fun n => if n0 then a n.toNat else 0, vanish := ⋯ }.isCauchyε > 0, ∃ N, ∀ (j k : ), jNkNSection_4_3.dist (a j) (a k)ε All goals completed! 🐙lemma declaration uses 'sorry'Sequence.isCauchy_of_mk {n₀:} (a: {n // n n₀} ) : (mk' n₀ a).isCauchy (ε:), ε > 0 N, N n₀ j k, j N k N Section_4_3.dist (mk' n₀ a j) (mk' n₀ a k) ε := n₀:a:{ n // nn₀ }(mk' n₀ a).isCauchyε > 0, ∃ Nn₀, ∀ (j k : ), jNkNSection_4_3.dist ((mk' n₀ a).seq j) ((mk' n₀ a).seq k)ε All goals completed! 🐙noncomputable def Sequence.sqrt_two : Sequence := (fun n: (( (Real.sqrt 2)*10^n / 10^n):))

Example 5.1.10. (This requires extensive familiarity with Mathlib's API for the real numbers. )

theorem declaration uses 'sorry'Sequence.ex_5_1_10_a : (1:).steady sqrt_two := Rat.steady 1 sqrt_two All goals completed! 🐙

Example 5.1.10. (This requires extensive familiarity with Mathlib's API for the real numbers. )

theorem declaration uses 'sorry'Sequence.ex_5_1_10_b : (0.1:).steady (sqrt_two.from 1) := Rat.steady 0.1 (sqrt_two.from 1) All goals completed! 🐙theorem declaration uses 'sorry'Sequence.ex_5_1_10_c : (0.1:).eventuallySteady sqrt_two := Rat.eventuallySteady 0.1 sqrt_two All goals completed! 🐙

Proposition 5.1.11

theorem Sequence.harmonic_steady : (mk' 1 (fun n (1:)/n)).isCauchy := (mk' 1 fun n => 1 / ↑↑n).isCauchy -- This is proof is probably longer than it needs to be; there should be a shorter proof that is still in the spirit of the proof in the book. ε > 0, ∃ N ≥ 1, ∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε ε::ε > 0N ≥ 1, ∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε ε::ε > 0this:N, ↑N > 1 / εN ≥ 1, ∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε ε::ε > 0N:hN:N > 1 / εN ≥ 1, ∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε ε::ε > 0N:hN:N > 1 / εN1∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε have hN' : (N:) > 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy have : (1/ε) > 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy All goals completed! 🐙 ε::ε > 0N:this:1 / ε > 0hN:0 < NN > 0 ε::ε > 0N:this:1 / ε > 0hN:0 < N0 < N; All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0N1ε::ε > 0N:hN:N > 1 / εhN':N > 0∀ (j k : ), jNkNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε ε::ε > 0N:hN:N > 1 / εhN':N > 0N1 ε::ε > 0N:hN:N > 1 / εhN':0 < N1N; All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNSection_4_3.dist ((mk' 1 fun n => 1 / ↑↑n).seq j) ((mk' 1 fun n => 1 / ↑↑n).seq k)ε have hj' : (j:) 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kN0j; All goals completed! 🐙 have hj'' : (1:)/j (1:)/N := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j00 < Nε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0Nj ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j00 < N ε::ε > 0N:hN:N > 1 / εj:k:hj:jNhk:kNhj':j0hN':0 < N0 < N; All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0Nj ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hk:kNhj':j0hj:NjNj; ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hk:kNhj':j0hj:NjNj; All goals completed! 🐙 have hj''' : (1:)/j 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy All goals completed! 🐙 have hj'''' : j 1 := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj'':1 / j1 / Nhj''':1 / j0hj':0jj1; All goals completed! 🐙 have hk' : (k:) 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j10k; All goals completed! 🐙 have hk'' : (1:)/k (1:)/N := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k00 < Nε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0Nk ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k00 < N ε::ε > 0N:hN:N > 1 / εj:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hN':0 < N0 < N; All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0Nk ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk:NkNk; ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk:NkNk; All goals completed! 🐙 have hk''' : (1:)/k 0 := (mk' 1 fun n => 1 / ↑↑n).isCauchy All goals completed! 🐙 have hk'''' : k 1 := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk'':1 / k1 / Nhk''':1 / k0hk':0kk1; All goals completed! 🐙 have hdist : Section_4_3.dist ((1:)/j) ((1:)/k) (1:)/N := (mk' 1 fun n => 1 / ↑↑n).isCauchy ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k11 / j - 1 / k1 / N-(1 / j - 1 / k)1 / N ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k11 / j - 1 / k1 / Nε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1-(1 / j - 1 / k)1 / N ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k11 / j - 1 / k1 / Nε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1-(1 / j - 1 / k)1 / N All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / NSection_4_3.dist (↑j)⁻¹ (↑k)⁻¹ε ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N(↑j)⁻¹ = 1 / jε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N(↑k)⁻¹ = 1 / kε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N1 / Nε ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N(↑j)⁻¹ = 1 / j All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N(↑k)⁻¹ = 1 / k All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N1 / εNε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N0 < N ε::ε > 0N:hN:N > 1 / εhN':N > 0j:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / N1 / εN All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εj:k:hj:jNhk:kNhj':j0hj'':1 / j1 / Nhj''':1 / j0hj'''':j1hk':k0hk'':1 / k1 / Nhk''':1 / k0hk'''':k1hdist:Section_4_3.dist (1 / j) (1 / k)1 / NhN':0 < N0 < N; All goals completed! 🐙abbrev BoundedBy {n:} (a: Fin n ) (M:) : Prop := i, |a i| M/-- Definition 5.1.12 (bounded sequences). Here we start sequences from 0 rather than 1 to align better with Mathlib conventions. -/ lemma BoundedBy_def {n:} (a: Fin n ) (M:) : BoundedBy a M i, |a i| M := n:a:Fin nM:BoundedBy a M∀ (i : Fin n), |a i|M All goals completed! 🐙abbrev Sequence.BoundedBy (a:Sequence) (M:) : Prop := n, |a n| M/-- Definition 5.1.12 (bounded sequences) -/ 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! 🐙abbrev Sequence.isBounded (a:Sequence) : Prop := M, M 0 a.BoundedBy M/-- Definition 5.1.12 (bounded sequences) -/ lemma Sequence.isBounded_def (a:Sequence) : a.isBounded M, M 0 a.BoundedBy M := a:Sequencea.isBoundedM ≥ 0, a.BoundedBy M All goals completed! 🐙

Example 5.1.13

declaration uses 'sorry'example : BoundedBy ![1,-2,3,-4] 4 := BoundedBy ![1, -2, 3, -4] 4 All goals completed! 🐙

Example 5.1.13

declaration uses 'sorry'example : ¬ ((fun n: (-1)^n * (n+1:)):Sequence).isBounded := ¬{ n₀ := 0, seq := fun n => if n0 then (fun n => (-1) ^ n * (n + 1)) n.toNat else 0, vanish := ⋯ }.isBounded All goals completed! 🐙

Example 5.1.13

declaration uses 'sorry'example : ((fun n: (-1:)^n):Sequence).isBounded := { n₀ := 0, seq := fun n => if n0 then (fun n => (-1) ^ n) n.toNat else 0, vanish := ⋯ }.isBounded All goals completed! 🐙

Example 5.1.13

declaration uses 'sorry'example : ¬ ((fun n: (-1:)^n):Sequence).isCauchy := ¬{ n₀ := 0, seq := fun n => if n0 then (fun n => (-1) ^ n) n.toNat else 0, vanish := ⋯ }.isCauchy All goals completed! 🐙/-- Lemma 5.1.14 -/ lemma bounded_of_finite {n:} (a: Fin n ) : M, M 0 BoundedBy a M := n:a:Fin nM ≥ 0, BoundedBy a M -- this proof is written to follow the structure of the original text. a:Fin 0 → M ≥ 0, BoundedBy a Mn:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)M ≥ 0, BoundedBy a M a:Fin 0 → M ≥ 0, BoundedBy a M a:Fin 0 → 00BoundedBy a 0 All goals completed! 🐙 n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM ≥ 0, BoundedBy a M n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' MM ≥ 0, BoundedBy a M have h1 : BoundedBy a' (M + |a n|) := n:a:Fin nM ≥ 0, BoundedBy a M n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mm:Fin n|a' m|M + |an| n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mm:Fin nMM + |an| All goals completed! 🐙 have h2 : |a n| M + |a n| := n:a:Fin nM ≥ 0, BoundedBy a M All goals completed! 🐙 n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|M + |an|0BoundedBy a (M + |an|) n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|M + |an|0n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|BoundedBy a (M + |an|) n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|M + |an|0 All goals completed! 🐙 n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)|a m|M + |an| n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)hm:j, m = j.castSucc|a m|M + |an|n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)hm:m = Fin.last n|a m|M + |an| n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)hm:j, m = j.castSucc|a m|M + |an| n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)j:Fin nhj:m = j.castSucc|a m|M + |an| n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)j:Fin nhj:m = j.castSuccm = ↑↑j All goals completed! 🐙 n:hn:∀ (a : Fin n), ∃ M ≥ 0, BoundedBy a Ma:Fin (n + 1)a':Fin n := fun m => a ↑↑mM:hpos:M0hM:BoundedBy a' Mh1:BoundedBy a' (M + |an|)h2:|an|M + |an|m:Fin (n + 1)hm:m = Fin.last nm = n All goals completed! 🐙/-- Lemma 5.1.15 (Cauchy sequences are bounded) / Exercise 5.1.1 -/ lemma declaration uses 'sorry'Sequence.isBounded_of_isCauchy (a:Sequence) (h: a.isCauchy) : a.isBounded := a:Sequenceh:a.isCauchya.isBounded All goals completed! 🐙end Chapter5