Аналіз I, Глава 6.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:

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

Визначення 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

Визначення 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 := fun a a.seq

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

instance Sequence.instCoe : Coe ( ) Sequence where coe := fun a { m := 0 seq := fun n if n 0 then a n.toNat else 0 vanish := a: n < 0, (if n 0 then a n.toNat else 0) = 0 a: n:hn:n < 0(if n 0 then a n.toNat else 0) = 0 All goals completed! 🐙 }
abbrev Sequence.mk' (m:) (a: { n // n m } ) : Sequence where m := m seq := fun 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 m:a:{ n // n m } n:hn: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: { m := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.seq n = a n All goals completed! 🐙

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

abbrev Sequence.from (a:Sequence) (m₁:) : Sequence := mk' (max a.m m₁) (fun n a (n:))
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₁h:n < a.m0 = a.seq n All goals completed! 🐙end Chapter6

Визначення 6.1.3 (ε-steady)

abbrev Real.steady (ε: ) (a: Chapter6.Sequence) : Prop := n a.m, m a.m, ε.close (a n) (a m)

Визначення 6.1.3 (ε-steady)

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! 🐙

Визначення 6.1.3 (Eventually ε-steady)

abbrev Real.eventuallySteady (ε: ) (a: Chapter6.Sequence) : Prop := N a.m, ε.steady (a.from N)

Визначення 6.1.3 (Eventually ε-steady)

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! 🐙
theorem declaration uses 'sorry'Real.steady_mono {a: Chapter6.Sequence} {ε₁ ε₂: } (: ε₁ ε₂) (hsteady: ε₁.steady a) : ε₂.steady a := a:Chapter6.Sequenceε₁:ε₂::ε₁ ε₂hsteady:ε₁.steady aε₂.steady a All goals completed! 🐙theorem declaration uses 'sorry'Real.eventuallySteady_mono {a: Chapter6.Sequence} {ε₁ ε₂: } (: ε₁ ε₂) (hsteady: ε₁.eventuallySteady a) : ε₂.eventuallySteady a := a:Chapter6.Sequenceε₁:ε₂::ε₁ ε₂hsteady:ε₁.eventuallySteady aε₂.eventuallySteady a All goals completed! 🐙namespace Chapter6

Визначення 6.1.3 (Cauchy sequence)

abbrev Sequence.isCauchy (a:Sequence) : Prop := ε > (0:), ε.eventuallySteady a

Визначення 6.1.3 (Cauchy sequence)

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 N, k N, dist (a j) (a k) ε := a: { m := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy ε > 0, N, j N, k N, 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₀, 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) ε All goals completed! 🐙instance Chapter5.Sequence.inst_coe_sequence : Coe Chapter5.Sequence Sequence where coe := fun a { m := a.n₀ seq := fun n ((a n):) vanish := a:Chapter5.Sequence n < a.n₀, (a.seq n) = 0 a:Chapter5.Sequencen:hn:n < a.n₀(a.seq n) = 0 a:Chapter5.Sequencen:hn:n < a.n₀this:a.seq n = 0(a.seq n) = 0 All goals completed! 🐙 }@[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 { m := a.n₀, seq := fun n => (a.seq n), vanish := } 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 { m := a.n₀, seq := fun n => (a.seq n), vanish := } All goals completed! 🐙

Твердження 6.1.4

theorem Sequence.isCauchy_of_rat (a: Chapter5.Sequence) : a.isCauchy (a:Sequence).isCauchy := a:Chapter5.Sequencea.isCauchy { m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. a:Chapter5.Sequencea.isCauchy { m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchya:Chapter5.Sequence{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a.isCauchy a:Chapter5.Sequence{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a.isCauchya:Chapter5.Sequencea.isCauchy { m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a:Chapter5.Sequence{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a.isCauchy a:Chapter5.Sequenceh:{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchya.isCauchy a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := }a.isCauchy a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } ε > 0, ε.eventuallySteady a a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := }ε::ε > 0ε.eventuallySteady a specialize h (ε:) (a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := }ε::ε > 0ε > 0 All goals completed! 🐙) rwa [is_eventuallySteady_of_rata:Chapter5.Sequenceε::ε > 0h:(↑ε).eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := }(↑ε).eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceh:a.isCauchy{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady a{ m := a.n₀, seq := fun n => (a.seq n), vanish := }.isCauchy a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady a ε > 0, ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady aε::ε > 0ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady aε::ε > 0this: ε' > 0, ε' < εε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceh: ε > 0, ε.eventuallySteady aε::ε > 0ε':hε':ε' > 0hlt:ε' < εε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceε::ε > 0ε':hε':ε' > 0hlt:ε' < εh:ε'.eventuallySteady aε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } a:Chapter5.Sequenceε::ε > 0ε':hε':ε' > 0hlt:ε' < εh:(↑ε').eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := }ε.eventuallySteady { m := a.n₀, seq := fun n => (a.seq n), vanish := } All goals completed! 🐙
end Chapter6

Визначення 6.1.5

abbrev Real.close_seq (ε: ) (a: Chapter6.Sequence) (L:) : Prop := n a.m, ε.close (a n) L

Визначення 6.1.5

theorem Real.close_seq_def (ε: ) (a: Chapter6.Sequence) (L:) : ε.close_seq a L n a.m, dist (a n) L ε := ε:a:Chapter6.SequenceL:ε.close_seq a L n a.m, dist (a.seq n) L ε All goals completed! 🐙

Визначення 6.1.5

abbrev Real.eventually_close (ε: ) (a: Chapter6.Sequence) (L:) : Prop := N a.m, ε.close_seq (a.from N) L

Визначення 6.1.5

theorem Real.eventually_close_def (ε: ) (a: Chapter6.Sequence) (L:) : ε.eventually_close a L N, (N a.m) ε.close_seq (a.from N) L := ε:a:Chapter6.SequenceL:ε.eventually_close a L N a.m, ε.close_seq (a.from N) L All goals completed! 🐙
theorem declaration uses 'sorry'Real.close_seq_mono {a: Chapter6.Sequence} {ε₁ ε₂: } (: ε₁ ε₂) (hclose: ε₁.close_seq a L) : ε₂.close_seq a L := L:a:Chapter6.Sequenceε₁:ε₂::ε₁ ε₂hclose:ε₁.close_seq a Lε₂.close_seq a L All goals completed! 🐙theorem declaration uses 'sorry'Real.eventually_close_mono {a: Chapter6.Sequence} {ε₁ ε₂: } (: ε₁ ε₂) (hclose: ε₁.eventually_close a L) : ε₂.eventually_close a L := L:a:Chapter6.Sequenceε₁:ε₂::ε₁ ε₂hclose:ε₁.eventually_close a Lε₂.eventually_close a L All goals completed! 🐙namespace Chapter6abbrev Sequence.tendsTo (a:Sequence) (L:) : Prop := ε > (0:), ε.eventually_close a Ltheorem Sequence.tendsTo_def (a:Sequence) (L:) : a.tendsTo L ε > (0:), ε.eventually_close a L := a:SequenceL:a.tendsTo L ε > 0, ε.eventually_close a L All goals completed! 🐙

Вправа 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 abbrev seq_6_1_6 : Sequence := (fun (n:) 1-(10:)^(-(n:)-1):Sequence)

Приклади 6.1.6

declaration uses 'sorry'example : (0.1:).close_seq seq_6_1_6 1 := Real.close_seq 0.1 seq_6_1_6 1 All goals completed! 🐙

Приклади 6.1.6

declaration uses 'sorry'example : ¬ (0.01:).close_seq seq_6_1_6 1 := ¬Real.close_seq 1e-2 seq_6_1_6 1 All goals completed! 🐙

Приклади 6.1.6

declaration uses 'sorry'example : (0.01:).eventually_close seq_6_1_6 1 := Real.eventually_close 1e-2 seq_6_1_6 1 All goals completed! 🐙

Приклади 6.1.6

declaration uses 'sorry'example : seq_6_1_6.tendsTo 1 := seq_6_1_6.tendsTo 1 All goals completed! 🐙

Твердження 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') -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. 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') a:SequenceL:L':hL:a.tendsTo LhL':a.tendsTo L'h:L - L' = 0L = 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'| / 3False have : ε > 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'| / 3:ε > 0False a:SequenceL:L':hL': ε > 0, N, n N, |a.seq n - L'| εh:|L - L'| > 0ε: := |L - L'| / 3:ε > 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'| / 3:ε > 0N:hN: n N, |a.seq n - L| εFalse a:SequenceL:L':h:|L - L'| > 0ε: := |L - L'| / 3:ε > 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'| / 3:ε > 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'| / 3:ε > 0N:hN: n N, |a.seq n - L| εM:hM: n M, |a.seq n - L'| εn: := max N MFalse a:SequenceL:L':h:|L - L'| > 0ε: := |L - L'| / 3:ε > 0N:M:hM: n M, |a.seq n - L'| εn: := max N MhN:|a.seq n - L| εFalse a:SequenceL:L':h:|L - L'| > 0ε: := |L - L'| / 3:ε > 0N:M:n: := max N MhN:|a.seq n - L| εhM:|a.seq n - L'| εFalse have : |L-L'| 2 * |L-L'|/3 := calc _ = dist L L' := a:SequenceL:L':h:|L - L'| > 0ε: := |L - L'| / 3:ε > 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'| / 3:ε > 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'| / 3:ε > 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'| / 3:ε > 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'| / 3:ε > 0N:M:n: := max N MhN:|a.seq n - L| εhM:|a.seq n - L'| εε + ε = 2 * |L - L'| / 3 a:SequenceL:L':h:|L - L'| > 0ε: := |L - L'| / 3:ε > 0N:M:n: := max N MhN:|a.seq n - L| εhM:|a.seq n - L'| ε|L - L'| / 3 + |L - L'| / 3 = 2 * |L - L'| / 3; All goals completed! 🐙 All goals completed! 🐙

Визначення 6.1.8

abbrev Sequence.convergent (a:Sequence) : Prop := L, a.tendsTo L

Визначення 6.1.8

theorem Sequence.convergent_def (a:Sequence) : a.convergent L, a.tendsTo L := a:Sequencea.convergent L, a.tendsTo L All goals completed! 🐙

Визначення 6.1.8

abbrev Sequence.divergent (a:Sequence) : Prop := ¬ a.convergent

Визначення 6.1.8

theorem Sequence.divergent_def (a:Sequence) : a.divergent ¬ a.convergent := a:Sequencea.divergent ¬a.convergent All goals completed! 🐙
open Classical in /-- Визначення 6.1.8. We give the limit of a sequence the junk value of 0 if it is not convergent. -/ noncomputable abbrev lim (a:Sequence) : := if h: a.convergent then h.choose else 0

Визначення 6.1.8

theorem Sequence.lim_def {a:Sequence} (h: a.convergent) : a.tendsTo (lim a) := a:Sequenceh:a.convergenta.tendsTo (lim a) a:Sequenceh:a.convergenta.tendsTo (if h : a.convergent then Exists.choose h else 0) a:Sequenceh:a.convergenta.tendsTo (Exists.choose ) All goals completed! 🐙

Визначення 6.1.8

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 La.convergent lim a = L a:SequenceL:h:a.tendsTo Leq:a.convergent lim a LFalse 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.convergenth':lim a = La.tendsTo L a:SequenceL:h:a.convergenth':lim a = LL = lim a All goals completed! 🐙

Твердження 6.1.11

theorem Sequence.lim_harmonic : ((fun (n:) (n+1:)⁻¹):Sequence).convergent lim ((fun (n:) (n+1:)⁻¹):Sequence) = 0 := { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.convergent lim { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := } = 0 -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. ε > 0, N, n N, |{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε ε::ε > 0 N, n N, |{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε ε::ε > 0this: N, N > 1 / ε N, n N, |{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε ε::ε > 0N:hN:N > 1 / ε N, n N, |{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε ε::ε > 0N:hN:N > 1 / ε n N, |{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε ε::ε > 0N:hN:N > 1 / εn:hn:n N|{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε have hNpos : (N:) > 0 := { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.convergent lim { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := } = 0 ε::ε > 0N:hN:N > 1 / εn:hn:n N0 < 1 / ε; All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < N|{ m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.seq n - 0| ε have hnpos : n 0 := { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := }.convergent lim { m := 0, seq := fun n => if n 0 then (fun n => (n + 1)⁻¹) n.toNat else 0, vanish := } = 0 All goals completed! 🐙 ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0|n.toNat + 1|⁻¹ ε calc _ (N:)⁻¹ := ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0|n.toNat + 1|⁻¹ (↑N)⁻¹ ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0N |n.toNat + 1| calc _ (n:) := ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0N n All goals completed! 🐙 _ = (n.toNat:) := ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0n = n.toNat All goals completed! 🐙 _ = n.toNat := rfl _ (n.toNat:) + 1 := ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0n.toNat n.toNat + 1 All goals completed! 🐙 _ _ := le_abs_self _ _ ε := ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0(↑N)⁻¹ ε ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0ε⁻¹ N ε::ε > 0N:hN:N > 1 / εn:hn:n NhNpos:0 < Nhnpos:n 0ε⁻¹ < N ε::ε > 0N:hN:ε⁻¹ < Nn:hn:n NhNpos:0 < Nhnpos:n 0ε⁻¹ < N All goals completed! 🐙

Твердження 6.1.12 / Вправа 6.1.5

theorem declaration uses 'sorry'Sequence.Cauchy_of_convergent {a:Sequence} (h:a.convergent) : a.isCauchy := a:Sequenceh:a.convergenta.isCauchy All goals completed! 🐙

Приклад 6.1.13

declaration uses 'sorry'example : ¬ (0.1:).eventuallySteady ((fun n (-1:)^n):Sequence) := ¬Real.eventuallySteady 0.1 { m := 0, seq := fun n => if n 0 then (fun n => (-1) ^ n) n.toNat else 0, vanish := } All goals completed! 🐙

Приклад 6.1.13

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

Приклад 6.1.13

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

Твердження 6.1.15 / Вправа 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:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy{ m := { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.n₀, seq := fun n => ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.seq n), vanish := }.tendsTo (Chapter5.Real.equivR (Chapter5.LIM a)) All goals completed! 🐙

Визначення 6.1.16

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

Визначення 6.1.16

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! 🐙

Визначення 6.1.16

abbrev Sequence.isBounded (a:Sequence) : Prop := M 0, a.BoundedBy M

Визначення 6.1.16

lemma Sequence.isBounded_def (a:Sequence) : a.isBounded M 0, a.BoundedBy M := a:Sequencea.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.isCauchya.isBounded All goals completed! 🐙

Наслідок 6.1.17

theorem declaration uses 'sorry'Sequence.bounded_of_convergent {a:Sequence} (h: a.convergent) : a.isBounded := a:Sequenceh:a.convergenta.isBounded All goals completed! 🐙

Приклад 6.1.18

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

Приклад 6.1.18

declaration uses 'sorry'example : ¬ ((fun (n:) (n+1:)):Sequence).convergent := ¬{ m := 0, seq := fun n => if n 0 then (fun n => n + 1) n.toNat else 0, vanish := }.convergent All goals completed! 🐙
instance Sequence.inst_add : Add Sequence where add a b := { m := max a.m b.m seq := fun (n:) if n max a.m b.m then a n + b n else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then a.seq n + b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then a.seq n + b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then a.seq n + b.seq n else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(a) (limit laws)

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 := max a.m b.m seq := fun (n:) if n max a.m b.m then a n * b n else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then a.seq n * b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then a.seq n * b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then a.seq n * b.seq n else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(b) (limit laws)

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 := fun (n:) c * a n vanish := c:a:Sequence n < a.m, c * a.seq n = 0 c:a:Sequencen:hn:n < a.mc * a.seq n = 0 All goals completed! 🐙 }

Теорема 6.1.19(c) (limit laws)

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 := max a.m b.m seq := fun (n:) if n max a.m b.m then a n - b n else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then a.seq n - b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then a.seq n - b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then a.seq n - b.seq n else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(d) (limit laws)

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 := fun (n:) (a n)⁻¹ vanish := a:Sequence n < a.m, (a.seq n)⁻¹ = 0 a:Sequencen:hn:n < a.m(a.seq n)⁻¹ = 0 All goals completed! 🐙 }

Теорема 6.1.19(e) (limit laws)

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 0a⁻¹.convergent lim a⁻¹ = (lim a)⁻¹ All goals completed! 🐙
noncomputable instance Sequence.inst_div : Div Sequence where div a b := { m := max a.m b.m seq := fun (n:) if n max a.m b.m then a n / b n else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then a.seq n / b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then a.seq n / b.seq n else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then a.seq n / b.seq n else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(f) (limit laws)

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 := max a.m b.m seq := fun (n:) if n max a.m b.m then max (a n) (b n) else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then max (a.seq n) (b.seq n) else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then max (a.seq n) (b.seq n) else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then max (a.seq n) (b.seq n) else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(g) (limit laws)

theorem declaration uses 'sorry'Sequence.lim_max {a b:Sequence} (ha: a.convergent) (hb: b.convergent) (hnon: lim b 0) : (max a b).convergent lim (max a b) = max (lim a) (lim b) := a:Sequenceb:Sequenceha:a.convergenthb:b.convergenthnon:lim b 0(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 := max a.m b.m seq := fun (n:) if n max a.m b.m then min (a n) (b n) else 0 vanish := a:Sequenceb:Sequence n < max a.m b.m, (if n max a.m b.m then min (a.seq n) (b.seq n) else 0) = 0 a:Sequenceb:Sequencen:hn:n < max a.m b.m(if n max a.m b.m then min (a.seq n) (b.seq n) else 0) = 0 a:Sequenceb:Sequencen:hn:¬n max a.m b.m(if n max a.m b.m then min (a.seq n) (b.seq n) else 0) = 0 All goals completed! 🐙 }

Теорема 6.1.19(h) (limit laws)

theorem declaration uses 'sorry'Sequence.lim_min {a b:Sequence} (ha: a.convergent) (hb: b.convergent) (hnon: lim b 0) : (min a b).convergent lim (min a b) = min (lim a) (lim b) := a:Sequenceb:Sequenceha:a.convergenthb:b.convergenthnon:lim b 0(a b).convergent lim (a b) = min (lim a) (lim b) All goals completed! 🐙

Вправа 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 > na m > a n All goals completed! 🐙

Вправа 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! 🐙

Вправа 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! 🐙

Вправа 6.1.7

theorem declaration uses 'sorry'Sequence.isBounded_of_rat (a: Chapter5.Sequence) : a.isBounded (a:Sequence).isBounded := a:Chapter5.Sequencea.isBounded { m := a.n₀, seq := fun n => (a.seq n), vanish := }.isBounded All goals completed! 🐙

Вправа 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! 🐙

Вправа 6.1.10

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.Sequencea.isCauchy ε > 0, N a.n₀, n N, m N, |a.seq n - a.seq m| ε All goals completed! 🐙
end Chapter6