Аналіз I, Глава 5.3

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

A class of Cauchy sequences that start at zero

@[ext] class CauchySequence extends Sequence where zero : n₀ = 0 cauchy : toSequence.isCauchy
theorem CauchySequence.ext' {a b: CauchySequence} (h: a.seq = b.seq) : a = b := a:CauchySequenceb:CauchySequenceh:toSequence.seq = toSequence.seqa = b a:CauchySequenceb:CauchySequenceh:toSequence.seq = toSequence.seqtoSequence.n₀ = toSequence.n₀a:CauchySequenceb:CauchySequenceh:toSequence.seq = toSequence.seqtoSequence.seq = toSequence.seq a:CauchySequenceb:CauchySequenceh:toSequence.seq = toSequence.seqtoSequence.n₀ = toSequence.n₀ All goals completed! 🐙 All goals completed! 🐙

A sequence starting at zero that is Cauchy, can be viewed as a Cauchy sequence.

abbrev CauchySequence.mk' {a: } (ha: (a:Sequence).isCauchy) : CauchySequence where n₀ := 0 seq := (a:Sequence).seq vanish := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy n < 0, (fun n => if n 0 then a n.toNat else 0) n = 0 a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:n < 0(fun n => if n 0 then a n.toNat else 0) n = 0 All goals completed! 🐙 zero := rfl cauchy := ha
@[simp] theorem CauchySequence.coe_eq {a: } (ha: (a:Sequence).isCauchy) : (mk' ha).toSequence = (a:Sequence) := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchytoSequence = { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := } All goals completed! 🐙instance CauchySequence.instCoeFun : CoeFun CauchySequence (fun _ ) where coe := fun a n a.toSequence (n:)@[simp] theorem CauchySequence.coe_to_sequence (a: CauchySequence) : ((a: ):Sequence) = a.toSequence := a:CauchySequence{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := } = toSequence a:CauchySequence{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.n₀ = toSequence.n₀a:CauchySequence{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.seq = toSequence.seq a:CauchySequence{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.n₀ = toSequence.n₀ All goals completed! 🐙 a:CauchySequencen:{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.seq n = toSequence.seq n a:CauchySequencen:h:n 0{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.seq n = toSequence.seq na:CauchySequencen:h:¬n 0{ n₀ := 0, seq := fun n => if n 0 then (fun n => toSequence.seq n) n.toNat else 0, vanish := }.seq n = toSequence.seq n all_goals a:CauchySequencen:h:¬n 00 = toSequence.seq n a:CauchySequencen:h:¬n 0n < toSequence.n₀ a:CauchySequencen:h:¬n 0n < 0 All goals completed! 🐙@[simp] theorem CauchySequence.coe_coe {a: } (ha: (a:Sequence).isCauchy) : mk' ha = a := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy(fun n => toSequence.seq n) = a All goals completed! 🐙

Твердження 5.3.3 / Вправа 5.3.1

theorem declaration uses 'sorry'Sequence.equiv_trans {a b c: } (hab: Sequence.equiv a b) (hbc: Sequence.equiv b c) : Sequence.equiv a c := a: b: c: hab:equiv a bhbc:equiv b cequiv a c All goals completed! 🐙

Твердження 5.3.3 / Вправа 5.3.1

instance declaration uses 'sorry'CauchySequence.instSetoid : Setoid CauchySequence where r := fun a b Sequence.equiv a b iseqv := { refl := sorry symm := sorry trans := sorry }
theorem CauchySequence.equiv_iff (a b: CauchySequence) : a b Sequence.equiv a b := a:CauchySequenceb:CauchySequencea b Sequence.equiv (fun n => toSequence.seq n) fun n => toSequence.seq n All goals completed! 🐙

Every constant sequence is Cauchy

theorem declaration uses 'sorry'Sequence.isCauchy_of_const (a:) : ((fun n: a):Sequence).isCauchy := a:{ n₀ := 0, seq := fun n => if n 0 then (fun n => a) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙
instance CauchySequence.instZero : Zero CauchySequence where zero := CauchySequence.mk' (a := fun _: 0) (Sequence.isCauchy_of_const (0:))abbrev Real := Quotient CauchySequence.instSetoidopen Classical in /-- It is convenient in Lean to assign the "dummy" value of 0 to `LIM a` when `a` is not Cauchy. This requires Classical logic, because the property of being Cauchy is not computable or decidable. -/ noncomputable abbrev LIM (a: ) : Real := Quotient.mk _ (if h : (a:Sequence).isCauchy then CauchySequence.mk' h else (0:CauchySequence))theorem LIM_def {a: } (ha: (a:Sequence).isCauchy) : LIM a = Quotient.mk _ (CauchySequence.mk' ha) := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyLIM a = CauchySequence.mk' ha All goals completed! 🐙

Визначення 5.3.1 (Real numbers)

theorem Real.eq_lim (x:Real) : (a: ), (a:Sequence).isCauchy x = LIM a := x:Real a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy x = LIM a -- I had a lot of trouble with this proof; perhaps there is a more idiomatic way to proceed x:Real (a : CauchySequence), a_1, { n₀ := 0, seq := fun n => if n 0 then a_1 n.toNat else 0, vanish := }.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a_1; x:Reala:CauchySequence a_1, { n₀ := 0, seq := fun n => if n 0 then a_1 n.toNat else 0, vanish := }.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a_1 x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq n a_1, { n₀ := 0, seq := fun n => if n 0 then a_1 n.toNat else 0, vanish := }.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a_1; x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq n{ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }s.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequences.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequenceCauchySequence.toSequence.isCauchy Quot.mk (⇑CauchySequence.instSetoid) a = LIM a' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequenceQuot.mk (⇑CauchySequence.instSetoid) a = LIM a' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequencea = if h : { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0 x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequencea = CauchySequence.mk' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequenceDecidable CauchySequence.toSequence.isCauchy x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequencea = CauchySequence.mk' x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequenceCauchySequence.toSequence.seq = CauchySequence.toSequence.seq x:Reala:CauchySequencea': := fun n => CauchySequence.toSequence.seq ns:Sequence := { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }this:s = CauchySequence.toSequenceCauchySequence.toSequence.seq = s.seq All goals completed! 🐙 classical All goals completed! 🐙

Визначення 5.3.1 (Real numbers)

theorem Real.LIM_eq_LIM {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : LIM a = LIM b Sequence.equiv a b := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a = LIM b Sequence.equiv a b a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a = LIM b Sequence.equiv a ba: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchySequence.equiv a b LIM a = LIM b a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a = LIM b Sequence.equiv a b a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:LIM a = LIM bSequence.equiv a b a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:(if h : { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0) if h : { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0Sequence.equiv a b rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iffa: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:Sequence.equiv (fun n => CauchySequence.toSequence.seq n) fun n => CauchySequence.toSequence.seq nSequence.equiv a b at h a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:Sequence.equiv a bLIM a = LIM b a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:Sequence.equiv a b(if h : { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0) if h : { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0 rwa [dif_pos ha, dif_pos hb, CauchySequence.equiv_iffa: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyh:Sequence.equiv a bSequence.equiv (fun n => CauchySequence.toSequence.seq n) fun n => CauchySequence.toSequence.seq n

Lemma 5.3.6 (Sum of Cauchy sequences is Cauchy)

theorem Sequence.add_cauchy {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : (a + b:Sequence).isCauchy := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.isCauchy -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. a: b: ha: ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }hb: ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := } ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } a: b: ha: ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }hb: ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }ε::ε > 0ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } have : ε/2 > 0 := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙 a: b: hb: ε > 0, ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }ε::ε > 0this:ε / 2 > 0ha:(ε / 2).eventuallySteady { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } a: b: ε::ε > 0this:ε / 2 > 0ha:(ε / 2).eventuallySteady { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }hb:(ε / 2).eventuallySteady { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }ε.eventuallySteady { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } a: b: ε::ε > 0this:ε / 2 > 0ha: N { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.n₀, (ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N)hb: N { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.n₀, (ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.from N) N { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.n₀, ε.steady ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) a: b: ε::ε > 0this:ε / 2 > 0hb: N { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.n₀, (ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.from N)N:hN:N { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.n₀hha:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N) N { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.n₀, ε.steady ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) a: b: ε::ε > 0this:ε / 2 > 0N:hN:N { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.n₀hha:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N)M:hM:M { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.n₀hhb:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.from M) N { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.n₀, ε.steady ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) a: b: ε::ε > 0this:ε / 2 > 0N:hN:N { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.n₀hha:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N)M:hM:M { n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.n₀hhb:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.from M)max N M { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.n₀ ε.steady ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from (max N M)) a: b: ε::ε > 0this:ε / 2 > 0N:hha:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N)M:hhb:(ε / 2).steady ({ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.from M)hN:0 NhM:0 M(0 N 0 M) ε.steady ({ n₀ := 0, seq := fun n => if 0 n then a n.toNat + b n.toNat else 0, vanish := }.from (max N M)) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mhha: (n : ), N n (m : ), N m (ε / 2).close (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)hhb: (n : ), 0 n M n (m : ), 0 m M m (ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0) (n : ), N n M n (m : ), N m M m ε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mhha: (n : ), N n (m : ), N m (ε / 2).close (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)hhb: (n : ), 0 n M n (m : ), 0 m M m (ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0)n:hnN:N nhnM:M nm:hmN:N mhmM:M mε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mhha: (n : ), N n (m : ), N m (ε / 2).close (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)hhb: (n : ), 0 n M n (m : ), 0 m M m (ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0)n:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mhha: (n : ), N n (m : ), N m (ε / 2).close (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)hhb: (n : ), 0 n M n (m : ), 0 m M m (ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0)n:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nhm:0 mε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mhhb: (n : ), 0 n M n (m : ), 0 m M m (ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0)n:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nhm:0 mhha:(ε / 2).close (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)ε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mn:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nhm:0 mhha:(ε / 2).close (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)hhb:(ε / 2).close (if 0 n M n then if 0 n then b n.toNat else 0 else 0) (if 0 m M m then if 0 m then b m.toNat else 0 else 0)ε.close (if N n M n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if N m M m then if 0 m then a m.toNat + b m.toNat else 0 else 0) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mn:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nhm:0 mhha:(ε / 2).close (a n.toNat) (a m.toNat)hhb:(ε / 2).close (b n.toNat) (b m.toNat)ε.close (a n.toNat + b n.toNat) (a m.toNat + b m.toNat) a: b: ε::ε > 0this:ε / 2 > 0N:M:hN:0 NhM:0 Mn:hnN:N nhnM:M nm:hmN:N mhmM:M mhn:0 nhm:0 mhha:(ε / 2).close (a n.toNat) (a m.toNat)hhb:(ε / 2).close (b n.toNat) (b m.toNat)ε = ε / 2 + ε / 2 All goals completed! 🐙

Lemma 5.3.7 (Sum of equivalent sequences is equivalent)

theorem Sequence.add_equiv_left {a a': } (b: ) (haa': Sequence.equiv a a') : Sequence.equiv (a + b) (a' + b) := a: a': b: haa':equiv a a'equiv (a + b) (a' + b) -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. a: a': b: haa': ε > 0, ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := } ε > 0, ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := } a: a': b: haa': ε > 0, ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }ε::ε > 0ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := } a: a': b: ε::ε > 0haa':ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }ε.eventually_close { n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := } { n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := } a: a': b: ε::ε > 0haa': N, ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.from N) N, ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := }.from N) a: a': b: ε::ε > 0N:haa':ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.from N) N, ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := }.from N) a: a': b: ε::ε > 0N:haa':ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.from N)ε.close_seq ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N) ({ n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := }.from N) a: a': b: ε::ε > 0N:haa': n ({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N).n₀, n ({ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.from N).n₀ ε.close (({ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.from N).seq n) (({ n₀ := 0, seq := fun n => if n 0 then a' n.toNat else 0, vanish := }.from N).seq n) n ({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N).n₀, n ({ n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := }.from N).n₀ ε.close (({ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.from N).seq n) (({ n₀ := 0, seq := fun n => if n 0 then (a' + b) n.toNat else 0, vanish := }.from N).seq n) a: a': b: ε::ε > 0N:haa': (n : ), 0 n N n 0 n N n ε.close (if 0 n N n then if 0 n then a n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat else 0 else 0) (n : ), 0 n N n 0 n N n ε.close (if 0 n N n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat + b n.toNat else 0 else 0) a: a': b: ε::ε > 0N:haa': (n : ), 0 n N n 0 n N n ε.close (if 0 n N n then if 0 n then a n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat else 0 else 0)n:hn:0 nhN:N na✝¹:0 na✝:N nε.close (if 0 n N n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat + b n.toNat else 0 else 0) a: a': b: ε::ε > 0N:n:hn:0 nhN:N na✝¹:0 na✝:N nhaa':ε.close (if 0 n N n then if 0 n then a n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat else 0 else 0)ε.close (if 0 n N n then if 0 n then a n.toNat + b n.toNat else 0 else 0) (if 0 n N n then if 0 n then a' n.toNat + b n.toNat else 0 else 0) a: a': b: ε::ε > 0N:n:hn:0 nhN:N na✝¹:0 na✝:N nhaa':ε.close (a n.toNat) (a' n.toNat)ε.close (a n.toNat + b n.toNat) (a' n.toNat + b n.toNat) a: a': b: ε::ε > 0N:n:hn:0 nhN:N na✝¹:0 na✝:N nhaa':ε.close (a n.toNat) (a' n.toNat)ε = ε + 0 All goals completed! 🐙

Lemma 5.3.7 (Sum of equivalent sequences is equivalent)

theorem Sequence.add_equiv_right {b b': } (a: ) (hbb': Sequence.equiv b b') : Sequence.equiv (a + b) (a + b') := b: b': a: hbb':equiv b b'equiv (a + b) (a + b') b: b': a: hbb':equiv b b'equiv (b + a) (b' + a) All goals completed! 🐙

Lemma 5.3.7 (Sum of equivalent sequences is equivalent)

theorem Sequence.add_equiv {a b a' b': } (haa': Sequence.equiv a a') (hbb': Sequence.equiv b b') : Sequence.equiv (a + b) (a' + b') := equiv_trans (add_equiv_left b haa') (add_equiv_right a' hbb')

Визначення 5.3.4 (Addition of reals)

noncomputable instance Real.add_inst : Add Real where add := fun x y Quotient.liftOn₂ x y (fun a b LIM (a + b)) (x:Realy:Real (a₁ b₁ a₂ b₂ : CauchySequence), a₁ a₂ b₁ b₂ (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n)) a₁ b₁ = (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n)) a₂ b₂ x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'(fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n)) a b = (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n)) a' b' x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) = LIM ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'Sequence.equiv ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n)x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchyx:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchy x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'Sequence.equiv ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) All goals completed! 🐙 all_goals x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then CauchySequence.toSequence.seq n.toNat else 0, vanish := }.isCauchyx:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then CauchySequence.toSequence.seq n.toNat else 0, vanish := }.isCauchy all_goals x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 All goals completed! 🐙 )

Визначення 5.3.4 (Addition of reals)

theorem Real.add_of_LIM {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : LIM a + LIM b = LIM (a + b) := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a + LIM b = LIM (a + b) a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.isCauchyLIM a + LIM b = LIM (a + b) a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.isCauchyCauchySequence.mk' ha + CauchySequence.mk' hb = CauchySequence.mk' hab a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a + b) n.toNat else 0, vanish := }.isCauchyCauchySequence.mk' hab = if h : { n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) + fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0 All goals completed! 🐙

Твердження 5.3.10 (Product of Cauchy sequences is Cauchy)

theorem declaration uses 'sorry'Sequence.mul_cauchy {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : (a * b:Sequence).isCauchy := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then (a * b) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙

Твердження 5.3.10 (Product of equivalent sequences is equivalent) / Вправа 5.3.2

theorem declaration uses 'sorry'Sequence.mul_equiv_left {a a': } (b: ) (haa': Sequence.equiv a a') : Sequence.equiv (a * b) (a' * b) := a: a': b: haa':equiv a a'equiv (a * b) (a' * b) All goals completed! 🐙

Proposition 5.3.10 (Product of equivalent sequences is equivalent) / Вправа 5.3.2

theorem Sequence.mul_equiv_right {b b': } (a: ) (hbb': Sequence.equiv b b') : Sequence.equiv (a * b) (a * b') := b: b': a: hbb':equiv b b'equiv (a * b) (a * b') b: b': a: hbb':equiv b b'equiv (b * a) (b' * a) All goals completed! 🐙

Proposition 5.3.10 (Product of equivalent sequences is equivalent) / Вправа 5.3.2

theorem Sequence.mul_equiv {a b a' b': } (haa': Sequence.equiv a a') (hbb': Sequence.equiv b b') : Sequence.equiv (a * b) (a' * b') := equiv_trans (mul_equiv_left b haa') (mul_equiv_right a' hbb')

Визначення 5.3.9 (Product of reals)

noncomputable instance Real.mul_inst : Mul Real where mul := fun x y Quotient.liftOn₂ x y (fun a b LIM (a * b)) (x:Realy:Real (a₁ b₁ a₂ b₂ : CauchySequence), a₁ a₂ b₁ b₂ (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n)) a₁ b₁ = (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n)) a₂ b₂ x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'(fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n)) a b = (fun a b => LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n)) a' b' x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) = LIM ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'Sequence.equiv ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n)x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchyx:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchy x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'Sequence.equiv ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) All goals completed! 🐙 all_goals x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then CauchySequence.toSequence.seq n.toNat else 0, vanish := }.isCauchyx:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'{ n₀ := 0, seq := fun n => if n 0 then CauchySequence.toSequence.seq n.toNat else 0, vanish := }.isCauchy all_goals x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 x:Realy:Reala:CauchySequenceb:CauchySequencea':CauchySequenceb':CauchySequencehaa':a a'hbb':b b'CauchySequence.toSequence.isCauchy All goals completed! 🐙 All goals completed! 🐙 )
theorem Real.mul_of_LIM {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : LIM a * LIM b = LIM (a * b) := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a * LIM b = LIM (a * b) a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a * b) n.toNat else 0, vanish := }.isCauchyLIM a * LIM b = LIM (a * b) a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a * b) n.toNat else 0, vanish := }.isCauchyCauchySequence.mk' ha * CauchySequence.mk' hb = CauchySequence.mk' hab a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhab:{ n₀ := 0, seq := fun n => if n 0 then (a * b) n.toNat else 0, vanish := }.isCauchyCauchySequence.mk' hab = if h : { n₀ := 0, seq := fun n => if n 0 then ((fun n => CauchySequence.toSequence.seq n) * fun n => CauchySequence.toSequence.seq n) n.toNat else 0, vanish := }.isCauchy then CauchySequence.mk' h else 0 All goals completed! 🐙instance Real.instRatCast : RatCast Real where ratCast := fun q Quotient.mk _ (CauchySequence.mk' (a := fun _ q) (Sequence.isCauchy_of_const q))theorem Real.ratCast_def (q:) : (q:Real) = LIM (fun _ q) := q:q = LIM fun x => q q:q = CauchySequence.mk' ?m.297489q:{ n₀ := 0, seq := fun n => if n 0 then q else 0, vanish := }.isCauchy All goals completed! 🐙

Вправа 5.3.3

@[simp] theorem declaration uses 'sorry'Real.ratCast_inj (q r:) : (q:Real) = (r:Real) q = r := q:r:q = r q = r All goals completed! 🐙
instance Real.instOfNat {n:} : OfNat Real n where ofNat := ((n:):Real)instance Real.instNatCast : NatCast Real where natCast n := ((n:):Real)@[simp] theorem Real.LIM_zero : LIM (fun _ (0:)) = 0 := (LIM fun x => 0) = 0 0 = 0 All goals completed! 🐙instance Real.instIntCast : IntCast Real where intCast n := ((n:):Real)theorem declaration uses 'sorry'Real.add_of_ratCast (a b:) : (a:Real) + (b:Real) = (a+b:) := a:b:a + b = (a + b) All goals completed! 🐙theorem declaration uses 'sorry'Real.mul_of_ratCast (a b:) : (a:Real) * (b:Real) = (a*b:) := a:b:a * b = (a * b) All goals completed! 🐙noncomputable instance Real.instNeg : Neg Real where neg := fun x ((-1:):Real) * xtheorem declaration uses 'sorry'Real.neg_of_ratCast (a:) : -(a:Real) = (-a:) := a:-a = (-a) All goals completed! 🐙

It may be possible to omit the Cauchy sequence hypothesis here.

theorem declaration uses 'sorry'Real.neg_of_LIM (a: ) (ha: (a:Sequence).isCauchy) : -LIM a = LIM (-a) := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy-LIM a = LIM (-a) All goals completed! 🐙
theorem declaration uses 'sorry'Real.neg_of_cauchy (a: ) (ha: (a:Sequence).isCauchy) : ((-a: ):Sequence).isCauchy := a: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then (-a) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙

Твердження 5.3.11

noncomputable instance declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'Real.addGroup_inst : AddGroup Real := AddGroup.ofLeftAxioms ( (a b c : Real), a + b + c = a + (b + c) All goals completed! 🐙) ( (a : Real), 0 + a = a All goals completed! 🐙) ( (a : Real), -a + a = 0 All goals completed! 🐙)
theorem Real.sub_eq_add_neg (x y:Real) : x - y = x + (-y) := rfltheorem declaration uses 'sorry'Real.sub_of_cauchy {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : ((a-b: ):Sequence).isCauchy := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then (a - b) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙theorem declaration uses 'sorry'Real.sub_of_LIM {a b: } (ha: (a:Sequence).isCauchy) (hb: (b:Sequence).isCauchy) : LIM a - LIM b = LIM (a - b) := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyLIM a - LIM b = LIM (a - b) All goals completed! 🐙theorem declaration uses 'sorry'Real.sub_of_ratCast (a b:) : (a:Real) - (b:Real) = (a-b:) := a:b:a - b = (a - b) All goals completed! 🐙

Твердження 5.3.12 (laws of algebra)

noncomputable instance declaration uses 'sorry'Real.instAddCommGroup : AddCommGroup Real where add_comm := (a b : Real), a + b = b + a All goals completed! 🐙

Твердження 5.3.12 (laws of algebra)

noncomputable instance declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'Real.instCommMonoid : CommMonoid Real where mul_comm := (a b : Real), a * b = b * a All goals completed! 🐙 mul_assoc := (a b c : Real), a * b * c = a * (b * c) All goals completed! 🐙 one_mul := (a : Real), 1 * a = a All goals completed! 🐙 mul_one := (a : Real), a * 1 = a All goals completed! 🐙

Твердження 5.3.12 (laws of algebra)

noncomputable instance declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'Real.instCommRing : CommRing Real where left_distrib := (a b c : Real), a * (b + c) = a * b + a * c All goals completed! 🐙 right_distrib := (a b c : Real), (a + b) * c = a * c + b * c All goals completed! 🐙 zero_mul := (a : Real), 0 * a = 0 All goals completed! 🐙 mul_zero := (a : Real), a * 0 = 0 All goals completed! 🐙 mul_assoc := (a b c : Real), a * b * c = a * (b * c) All goals completed! 🐙 natCast_succ := (n : ), (n + 1) = n + 1 All goals completed! 🐙 intCast_negSucc := (n : ), IntCast.intCast (Int.negSucc n) = -(n + 1) All goals completed! 🐙
abbrev declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'Real.ratCast_hom : →+* Real where toFun := RatCast.ratCast map_zero' := RatCast.ratCast 0 = 0 All goals completed! 🐙 map_one' := RatCast.ratCast 1 = 1 All goals completed! 🐙 map_add' := (x y : ), RatCast.ratCast (x + y) = RatCast.ratCast x + RatCast.ratCast y All goals completed! 🐙 map_mul' := (x y : ), RatCast.ratCast (x * y) = RatCast.ratCast x * RatCast.ratCast y All goals completed! 🐙

Визначення 5.3.12 (sequences bounded away from zero). Sequences are indexed to start from zero as this is more convenient for Mathlib purposes.

abbrev bounded_away_zero (a: ) : Prop := (c:), c > 0 n, |a n| c
theorem bounded_away_zero_def (a: ) : bounded_away_zero a (c:), c > 0 n, |a n| c := a: bounded_away_zero a c > 0, (n : ), |a n| c All goals completed! 🐙

Приклади 5.3.13

declaration uses 'sorry'example : bounded_away_zero (fun n (-1)^n) := bounded_away_zero fun n => (-1) ^ n All goals completed! 🐙

Приклади 5.3.13

declaration uses 'sorry'example : ¬ bounded_away_zero (fun n 10^(-(n:)-1)) := ¬bounded_away_zero fun n => 10 ^ (-n - 1) All goals completed! 🐙

Приклади 5.3.13

declaration uses 'sorry'example : ¬ bounded_away_zero (fun n 1 - 10^(-(n:))) := ¬bounded_away_zero fun n => 1 - 10 ^ (-n) All goals completed! 🐙

Приклади 5.3.13

declaration uses 'sorry'example : bounded_away_zero (fun n 10^(n+1)) := bounded_away_zero fun n => 10 ^ (n + 1) All goals completed! 🐙

Приклади 5.3.13

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

Лема 5.3.14

theorem declaration uses 'sorry'Real.bounded_away_zero_of_nonzero {x:Real} (hx: x 0) : a: , (a:Sequence).isCauchy bounded_away_zero a x = LIM a := x:Realhx:x 0 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a x = LIM a -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhx:LIM b 0 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhx:¬LIM b = LIM fun x => 0 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhx:¬ ε > 0, N, n N, |b n - 0| ε a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhx: x, 0 < x (x_1 : ), x_2, x_1 x_2 x < |b x_2| a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx: (x : ), x_1, x x_1 ε < |b x_1| a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx: (x : ), x_1, x x_1 ε < |b x_1|hb': N, j N, k N, Section_4_3.dist (b j) (b k) ε / 2 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀| a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a have how : j N, |b j| ε/2 := x:Realhx:x 0 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a x = LIM a All goals completed! 🐙 b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b n a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a have not_hard : Sequence.equiv a b := x:Realhx:x 0 a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a x = LIM a All goals completed! 🐙 b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a LIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchybounded_away_zero ab: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyLIM b = LIM a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchybounded_away_zero a b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy c > 0, (n : ), |a n| c b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy (n : ), |a n| ε / 2 b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:|a n| ε / 2 b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:n < n₀|a n| ε / 2b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:¬n < n₀|a n| ε / 2 all_goals b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:¬n < n₀ε / 2 |b n| b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:n < n₀ε / 2 |ε / 2| All goals completed! 🐙 b: hb:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyε::0 < εhx✝: (x : ), x_1, x x_1 ε < |b x_1|N:hb': j N, k N, Section_4_3.dist (b j) (b k) ε / 2n₀:hn₀:N n₀hx:ε < |b n₀|how: j N, |b j| ε / 2a: := fun n => if n < n₀ then ε / 2 else b nnot_hard:Sequence.equiv a bha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyn:hn:¬n < n₀n N All goals completed! 🐙 All goals completed! 🐙

This result was not explicitly stated in the text, but is needed in the theory. It's a good exercise, so I'm setting it as such.

theorem declaration uses 'sorry'Real.lim_of_bounded_away_zero {a: } (ha: bounded_away_zero a) (ha_cauchy: (a:Sequence).isCauchy) : LIM a 0 := a: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyLIM a 0 All goals completed! 🐙
theorem Real.bounded_away_zero_nonzero {a: } (ha: bounded_away_zero a) (n: ) : a n 0 := a: ha:bounded_away_zero an:a n 0 a: n:c:hc:c > 0ha: (n : ), |a n| ca n 0 a: n:c:hc:c > 0ha:|a n| ca n 0; a: n:c:hc:c > 0ha:a n = 0|a n| < c; All goals completed! 🐙

Лема 5.3.15

theorem Real.inv_of_bounded_away_zero_cauchy {a: } (ha: bounded_away_zero a) (ha_cauchy: (a:Sequence).isCauchy) : ((a⁻¹: ):Sequence).isCauchy := a: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchy -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. a: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyha': (n : ), a n 0{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchy a: ha: c > 0, (n : ), |a n| cha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyha': (n : ), a n 0{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchy a: ha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| c{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchy a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cha_cauchy: ε > 0, N, j N, k N, |a j - a k| ε ε > 0, N, j N, k N, |a⁻¹ j - a⁻¹ k| ε a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cha_cauchy: ε > 0, N, j N, k N, |a j - a k| εε::ε > 0 N, j N, k N, |a⁻¹ j - a⁻¹ k| ε specialize ha_cauchy (c^2 * ε) (a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cha_cauchy: ε > 0, N, j N, k N, |a j - a k| εε::ε > 0c ^ 2 * ε > 0 All goals completed! 🐙) a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:ha_cauchy: j N, k N, |a j - a k| c ^ 2 * ε N, j N, k N, |a⁻¹ j - a⁻¹ k| ε a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:ha_cauchy: j N, k N, |a j - a k| c ^ 2 * ε j N, k N, |a⁻¹ j - a⁻¹ k| ε a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:ha_cauchy: j N, k N, |a j - a k| c ^ 2 * εn:hn:n Nm:hm:m N|a⁻¹ n - a⁻¹ m| ε a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|a⁻¹ n - a⁻¹ m| ε calc _ = |(a m - a n) / (a m * a n)| := a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|a⁻¹ n - a⁻¹ m| = |(a m - a n) / (a m * a n)| a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εa⁻¹ n - a⁻¹ m = (a m - a n) / (a m * a n) a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εa m * a n = a n * a m a m - a n = 0 All goals completed! 🐙 _ |a m - a n| / c^2 := a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|(a m - a n) / (a m * a n)| |a m - a n| / c ^ 2 a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|a m - a n| / (|a m| * |a n|) |a m - a n| / (c * c) a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εc |a m|a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εc |a n| a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εc |a m| All goals completed! 🐙 All goals completed! 🐙 _ = |a n - a m| / c^2 := a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|a m - a n| / c ^ 2 = |a n - a m| / c ^ 2 All goals completed! 🐙 _ (c^2 * ε) / c^2 := a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * ε|a n - a m| / c ^ 2 c ^ 2 * ε / c ^ 2 All goals completed! 🐙 _ = ε := a: ha': (n : ), a n 0c:hc:c > 0ha: (n : ), |a n| cε::ε > 0N:n:hn:n Nm:hm:m Nha_cauchy:|a n - a m| c ^ 2 * εc ^ 2 * ε / c ^ 2 = ε All goals completed! 🐙

Лема 5.3.17 (Reciprocation is well-defined)

theorem Real.inv_of_equiv {a b: } (ha: bounded_away_zero a) (ha_cauchy: (a:Sequence).isCauchy) (hb: bounded_away_zero b) (hb_cauchy: (b:Sequence).isCauchy) (hlim: LIM a = LIM b) : LIM a⁻¹ = LIM b⁻¹ := a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bLIM a⁻¹ = LIM b⁻¹ -- цей доказ написан так, щоб співпадати із структурою орігінального тексту. a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹LIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0LIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0LIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyLIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyLIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyLIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyLIM a⁻¹ = LIM b⁻¹ have claim1 : P = LIM b⁻¹ := a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bLIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyLIM a⁻¹ * LIM a * LIM b⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyLIM (a⁻¹ * a * b⁻¹) = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyn:(a⁻¹ * a * b⁻¹) n = b⁻¹ n All goals completed! 🐙 have claim2 : P = LIM a⁻¹ := a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bLIM a⁻¹ = LIM b⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyclaim1:P = LIM b⁻¹LIM a⁻¹ * LIM a * LIM b⁻¹ = LIM a⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyclaim1:P = LIM b⁻¹LIM (a⁻¹ * b * b⁻¹) = LIM a⁻¹ a: b: ha:bounded_away_zero aha_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyhb:bounded_away_zero bhb_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isCauchyhlim:LIM a = LIM bP:Real := LIM a⁻¹ * LIM a * LIM b⁻¹ha': (n : ), a n 0hb': (n : ), b n 0hainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then a⁻¹ n.toNat else 0, vanish := }.isCauchyhbinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then b⁻¹ n.toNat else 0, vanish := }.isCauchyhaainv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * a) n.toNat else 0, vanish := }.isCauchyhabinv_cauchy:{ n₀ := 0, seq := fun n => if n 0 then (a⁻¹ * b) n.toNat else 0, vanish := }.isCauchyclaim1:P = LIM b⁻¹n:(a⁻¹ * b * b⁻¹) n = a⁻¹ n All goals completed! 🐙 All goals completed! 🐙
open Classical in /-- Визначення 5.3.16 (Reciprocation of real numbers). Requires classical logic because we need to assign a "junk" value to the inverse of 0. -/ noncomputable instance Real.instInv : Inv Real where inv x := if h: x 0 then LIM (bounded_away_zero_of_nonzero h).choose⁻¹ else 0theorem Real.inv_def {a: } (h: bounded_away_zero a) (hc: (a:Sequence).isCauchy) : (LIM a)⁻¹ = LIM a⁻¹ := a: h:bounded_away_zero ahc:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy(LIM a)⁻¹ = LIM a⁻¹ a: h:bounded_away_zero ahc:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyx:Real := LIM ax⁻¹ = LIM a⁻¹ a: h:bounded_away_zero ahc:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyx:Real := LIM ahx:x 0x⁻¹ = LIM a⁻¹ a: h:bounded_away_zero ahc:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyx:Real := LIM ahx:x 0hb: a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a x = LIM a := bounded_away_zero_of_nonzero hxx⁻¹ = LIM a⁻¹ a: h:bounded_away_zero ahc:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchyx:Real := LIM ahx:x 0hb: a, { n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isCauchy bounded_away_zero a x = LIM a := bounded_away_zero_of_nonzero hxLIM .choose⁻¹ = LIM a⁻¹ All goals completed! 🐙@[simp] theorem Real.inv_zero : (0:Real)⁻¹ = 0 := 0⁻¹ = 0 All goals completed! 🐙theorem declaration uses 'sorry'Real.self_mul_inv {x:Real} (hx: x 0) : x * x⁻¹ = 1 := x:Realhx:x 0x * x⁻¹ = 1 All goals completed! 🐙theorem declaration uses 'sorry'Real.inv_mul_self {x:Real} (hx: x 0) : x * x⁻¹ = 1 := x:Realhx:x 0x * x⁻¹ = 1 All goals completed! 🐙theorem declaration uses 'sorry'Real.inv_of_ratCast (q:) : (q:Real)⁻¹ = (q⁻¹:) := q:(↑q)⁻¹ = q⁻¹ All goals completed! 🐙

Default definition of division

noncomputable instance Real.instDivInvMonoid : DivInvMonoid Real where
theorem Real.div_eq (x y:Real) : x/y = x * y⁻¹ := x:Realy:Realx / y = x * y⁻¹ All goals completed! 🐙noncomputable instance declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'declaration uses 'sorry'Real.instField : Field Real where exists_pair_ne := x y, x y All goals completed! 🐙 mul_inv_cancel := (a : Real), a 0 a * a⁻¹ = 1 All goals completed! 🐙 inv_zero := 0⁻¹ = 0 All goals completed! 🐙 ratCast_def := (q : ), q = q.num / q.den All goals completed! 🐙 qsmul := _ nnqsmul := _theorem declaration uses 'sorry'Real.mul_right_cancel₀ {x y z:Real} (hz: z 0) (h: x * z = y * z) : x = y := x:Realy:Realz:Realhz:z 0h:x * z = y * zx = y All goals completed! 🐙theorem declaration uses 'sorry'Real.mul_right_nocancel : ¬ (x y z:Real), (hz: z = 0) (x * z = y * z) x = y := ¬ (x y z : Real), z = 0 x * z = y * z x = y All goals completed! 🐙

Вправа 5.3.4

theorem declaration uses 'sorry'Real.equiv_of_bounded {a b: } (ha: (a:Sequence).isBounded) (hab: Sequence.equiv a b) : (b:Sequence).isBounded := a: b: ha:{ n₀ := 0, seq := fun n => if n 0 then a n.toNat else 0, vanish := }.isBoundedhab:Sequence.equiv a b{ n₀ := 0, seq := fun n => if n 0 then b n.toNat else 0, vanish := }.isBounded All goals completed! 🐙

Вправа 5.3.5

theorem declaration uses 'sorry'Real.Cauchy_of_harmonic : ((fun n 1/((n:)+1): ):Sequence).isCauchy := { n₀ := 0, seq := fun n => if n 0 then (fun n => 1 / (n + 1)) n.toNat else 0, vanish := }.isCauchy All goals completed! 🐙

Вправа 5.3.5

theorem declaration uses 'sorry'Real.LIM_of_harmonic : LIM (fun n 1/((n:)+1)) = 0 := (LIM fun n => 1 / (n + 1)) = 0 All goals completed! 🐙
end Chapter5