-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathSection_9_5.lean
More file actions
123 lines (97 loc) · 5.7 KB
/
Section_9_5.lean
File metadata and controls
123 lines (97 loc) · 5.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
import Mathlib.Tactic
import Mathlib.Data.Real.Sign
import Analysis.Section_9_3
import Analysis.Section_9_4
/-!
# Analysis I, Section 9.5: Left and right limits
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:
- Left and right limits.
-/
namespace Chapter9
/-- Definition 9.5.1. We give left and right limits the "junk" value of 0 if the limit does not exist. -/
abbrev RightLimitExists (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : Prop := ∃ L, (nhdsWithin x₀ (X ∩ .Ioi x₀)).Tendsto f (nhds L)
open Classical in
noncomputable abbrev right_limit (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : ℝ := if h : RightLimitExists X f x₀ then h.choose else 0
abbrev LeftLimitExists (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : Prop := ∃ L, (nhdsWithin x₀ (X ∩ .Iio x₀)).Tendsto f (nhds L)
open Classical in
noncomputable abbrev left_limit (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : ℝ := if h: LeftLimitExists X f x₀ then h.choose else 0
theorem right_limit.eq {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} {L:ℝ} (had: AdherentPt x₀ (X ∩ .Ioi x₀))
(h: (nhdsWithin x₀ (X ∩ .Ioi x₀)).Tendsto f (nhds L)) : RightLimitExists X f x₀ ∧ right_limit X f x₀ = L := by
have h' : RightLimitExists X f x₀ := by use L
simp [right_limit, h']
have hne : (nhdsWithin x₀ (X ∩ .Ioi x₀)).NeBot := by
rwa [←mem_closure_iff_nhdsWithin_neBot, closure_def']
exact tendsto_nhds_unique h'.choose_spec h
theorem left_limit.eq {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} {L:ℝ} (had: AdherentPt x₀ (X ∩ .Iio x₀))
(h: (nhdsWithin x₀ (X ∩ .Iio x₀)).Tendsto f (nhds L)) : LeftLimitExists X f x₀ ∧ left_limit X f x₀ = L := by
have h' : LeftLimitExists X f x₀ := by use L
simp [left_limit, h']
have hne : (nhdsWithin x₀ (X ∩ .Iio x₀)).NeBot := by
rwa [←mem_closure_iff_nhdsWithin_neBot, closure_def']
exact tendsto_nhds_unique h'.choose_spec h
theorem right_limit.eq' {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} (h: RightLimitExists X f x₀) :
(nhdsWithin x₀ (X ∩ .Ioi x₀)).Tendsto f (nhds (right_limit X f x₀)) := by
simp [right_limit, h]; exact h.choose_spec
theorem left_limit.eq' {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} (h: LeftLimitExists X f x₀) :
(nhdsWithin x₀ (X ∩ .Iio x₀)).Tendsto f (nhds (left_limit X f x₀)) := by
simp [left_limit, h]; exact h.choose_spec
/-- Example 9.5.2. The second part of this example is no longer operative as we assign "junk" values to our functions instead of leaving them undefined. -/
example : right_limit .univ Real.sign 0 = 1 := by sorry
example : left_limit .univ Real.sign 0 = -1 := by sorry
theorem right_limit.conv {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} (had: AdherentPt x₀ (X ∩ .Ioi x₀))
(h: RightLimitExists X f x₀)
(a:ℕ → ℝ) (ha: ∀ n, a n ∈ X ∩ .Ioi x₀)
(hconv: Filter.atTop.Tendsto a (nhds x₀)) :
Filter.atTop.Tendsto (fun n ↦ f (a n)) (nhds (right_limit X f x₀)) := by
choose L hL using h
apply Convergesto.comp _ ha hconv
rwa [Convergesto.iff, (eq had hL).2]
theorem left_limit.conv {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} (had: AdherentPt x₀ (X ∩ .Iio x₀))
(h: LeftLimitExists X f x₀)
(a:ℕ → ℝ) (ha: ∀ n, a n ∈ X ∩ .Iio x₀)
(hconv: Filter.atTop.Tendsto a (nhds x₀)) :
Filter.atTop.Tendsto (fun n ↦ f (a n)) (nhds (left_limit X f x₀)) := by
choose L hL using h
apply Convergesto.comp _ ha hconv
rwa [Convergesto.iff, (eq had hL).2]
/-- Proposition 9.5.3 -/
theorem ContinuousAt.iff_eq_left_right_limit {X: Set ℝ} {f: ℝ → ℝ} {x₀:ℝ} (h: x₀ ∈ X)
(had_left: AdherentPt x₀ (X ∩ .Iio x₀)) (had_right: AdherentPt x₀ (X ∩ .Ioi x₀)) :
ContinuousWithinAt f X x₀ ↔ (RightLimitExists X f x₀ ∧ right_limit X f x₀ = f x₀) ∧ (LeftLimitExists X f x₀ ∧ left_limit X f x₀ = f x₀) := by
-- This proof is written to follow the structure of the original text.
constructor
. sorry
intro ⟨ ⟨ hre, hright⟩, ⟨ hle, lheft ⟩ ⟩
set L := f x₀
have := (ContinuousWithinAt.tfae X f x₀).out 0 2
rw [this]
intro ε hε
apply right_limit.eq' at hre
apply left_limit.eq' at hle
rw [hright, ←Convergesto.iff] at hre
rw [lheft, ←Convergesto.iff] at hle
simp [Convergesto, Real.CloseNear, Real.CloseFn] at hre hle
choose δ_plus hδ_plus hre using hre ε hε
choose δ_minus hδ_minus hle using hle ε hε
use min δ_plus δ_minus, (by positivity)
intro x hx hxx₀
obtain hlt | rfl | hgt := lt_trichotomy x x₀
. sorry
. sorry
sorry
abbrev HasJumpDiscontinuity (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : Prop :=
RightLimitExists X f x₀ ∧ LeftLimitExists X f x₀ ∧ right_limit X f x₀ ≠ left_limit X f x₀
example : HasJumpDiscontinuity .univ Real.sign 0 := by sorry
abbrev HasRemovableDiscontinuity (X: Set ℝ) (f: ℝ → ℝ) (x₀:ℝ) : Prop :=
RightLimitExists X f x₀ ∧ LeftLimitExists X f x₀ ∧ right_limit X f x₀ = left_limit X f x₀
∧ right_limit X f x₀ ≠ f x₀
example : HasRemovableDiscontinuity .univ f_9_3_17 0 := by sorry
example : ¬ HasRemovableDiscontinuity .univ (fun x ↦ 1/x) 0 := by sorry
example : ¬ HasJumpDiscontinuity .univ (fun x ↦ 1/x) 0 := by sorry
/- Exercise 9.5.1: Write down a definition of what it would mean for a limit of a function to be `+∞` or `-∞`, apply to `fun x ↦ 1/x`, and state and prove a version of Proposition 9.3.9. -/
end Chapter9