Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions analysis/Analysis/Section_7_2.lean
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ theorem Series.diverges_of_nodecay {s:Series} (h: ¬ Filter.atTop.Tendsto s.seq
sorry

/-- Example 7.2.7 -/
theorem Series.example_7_2_7 : ((fun n:ℕ ↦ (1:ℝ)):Series).diverges := by
theorem Series.example_7_2_7 : ((fun _:ℕ ↦ (1:ℝ)):Series).diverges := by
apply diverges_of_nodecay
sorry

Expand All @@ -134,7 +134,7 @@ abbrev Series.absConverges (s:Series) : Prop := s.abs.converges

abbrev Series.condConverges (s:Series) : Prop := s.converges ∧ ¬ s.absConverges

/-- Proposition 7.2.9 (Absolute convergence test) / Example 7.2.4 -/
/-- Proposition 7.2.9 (Absolute convergence test) / Exercise 7.2.4 -/
theorem Series.converges_of_absConverges {s:Series} (h : s.absConverges) : s.converges := by
sorry

Expand Down Expand Up @@ -196,14 +196,15 @@ theorem Series.example_7_2_13c : example_7_2_13.condConverges := by

instance Series.inst_add : Add Series where
add a b := {
m := max a.m b.m
seq n := if n ≥ max a.m b.m then a.seq n + b.seq n else 0
vanish n hn := by rw [lt_iff_not_ge] at hn; simp [hn]
m := min a.m b.m
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note this matches the change we made in ff59747.

Also with max - Series.convergesTo.add is not even true. Consider, a = 2,0,0,0,0,0,... (a.m=0) and b = 0,1,0,0,0,0,0 (b.m = 1), with max (a+b).m = 1, so (a+b).sum = 1, while a.sum = 2 and b.sum = 1

seq n := a.seq n + b.seq n
vanish n hn := by simp [a.vanish n (by omega), b.vanish n (by omega)]
}

theorem Series.add_coe (a b: ℕ → ℝ) : (a:Series) + (b:Series) = (fun n ↦ a n + b n) := by
ext n; rfl
by_cases h:n ≥ 0 <;> simp [h, HAdd.hAdd, Add.add]
change (a:Series).seq n + (b:Series).seq n = _
by_cases h:n ≥ 0 <;> simp [h]

/-- Proposition 7.2.14 (a) (Series laws) / Exercise 7.2.5. The `convergesTo` form can be more convenient for applications. -/
theorem Series.convergesTo.add {s t:Series} {L M: ℝ} (hs: s.convergesTo L) (ht: t.convergesTo M) :
Expand Down Expand Up @@ -235,14 +236,15 @@ theorem Series.smul {c:ℝ} {s:Series} (hs: s.converges) :
/-- The corresponding API for subtraction was not in the textbook, but is useful in later sections, so is included here. -/
instance Series.inst_sub : Sub Series where
sub a b := {
m := max a.m b.m
seq n := if n ≥ max a.m b.m then a.seq n - b.seq n else 0
vanish := by grind
m := min a.m b.m
seq n := a.seq n - b.seq n
vanish n hn := by simp [a.vanish n (by omega), b.vanish n (by omega)]
}

theorem Series.sub_coe (a b: ℕ → ℝ) : (a:Series) - (b:Series) = (fun n ↦ a n - b n) := by
ext n; rfl
by_cases h:n ≥ 0 <;> simp [h, HSub.hSub, Sub.sub]
change (a:Series).seq n - (b:Series).seq n = _
by_cases h:n ≥ 0 <;> simp [h]

theorem Series.convergesTo.sub {s t:Series} {L M: ℝ} (hs: s.convergesTo L) (ht: t.convergesTo M) :
(s - t).convergesTo (L - M) := by
Expand All @@ -268,7 +270,7 @@ theorem Series.shift {s:Series} {x:ℝ} (h: s.convergesTo x) (L:ℤ) :

/-- Lemma 7.2.15 (telescoping series) / Exercise 7.2.6 -/
theorem Series.telescope {a:ℕ → ℝ} (ha: Filter.atTop.Tendsto a (nhds 0)) :
((fun n:ℕ ↦ a (n+1) - a n):Series).convergesTo (a 0) := by
((fun n:ℕ ↦ a n - a (n+1)):Series).convergesTo (a 0) := by
sorry

/- Exercise 7.2.1 -/
Expand Down