-
Notifications
You must be signed in to change notification settings - Fork 232
Expand file tree
/
Copy pathSection_11_8.lean
More file actions
480 lines (391 loc) · 24.4 KB
/
Section_11_8.lean
File metadata and controls
480 lines (391 loc) · 24.4 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
import Mathlib.Tactic
import Mathlib.Topology.Instances.Irrational
import Analysis.Section_11_6
set_option doc.verso.suggestions false
/-!
# Analysis I, Section 11.8: The Riemann-Stieltjes integral
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 of `α_length`.
- The piecewise constant Riemann-Stieltjes integral.
- The full Riemann-Stieltjes integral.
{open Set}
Technical notes:
- In Lean it is more convenient to make definitions such as `α_length` and the Riemann-Stieltjes
integral totally defined, thus assigning "junk" values to the cases where the definition is
not intended to be applied. For the definition of `α_length`, the definition is intended to be
applied in contexts where left and right limits exist, and the function is extended by
constants to the left and right of its intended domain of definition; for instance, if a
function `x` `f` is defined on {lean}`Icc 0 1`, then it is intended that `f x = f 1` for all `x ≥ 1`
and `f x = f 0` for all `x ≤ 0`; in particular, at a right endpoint, the value of a function
is intended to agree with its right limit, and similarly for the left endpoint, although we
do not enforce this in our definition of `α_length`. (For functions defined on open intervals,
the extension is immaterial.)
- The notion of `α_length` and piecewise constant Riemann-Stieltjes integral is intended for
situations where left and right limits exist, such as for monotone functions or continuous
functions, though technically they make sense without these hypotheses. The full Riemann-Stieltjes
integral is intended for functions that are of bounded variation, though we shall restrict
attention to the special case of monotone increasing functions for the most part.
-/
namespace Chapter11
open BoundedInterval Chapter9
/-- Left and right limits. A junk value is assigned if the limit does not exist. -/
noncomputable abbrev right_lim (f: ℝ → ℝ) (x₀:ℝ) : ℝ := Filter.lim ((nhdsWithin x₀ (.Ioi x₀)).map f)
noncomputable abbrev left_lim (f: ℝ → ℝ) (x₀:ℝ) : ℝ := Filter.lim ((nhdsWithin x₀ (.Iio x₀)).map f)
theorem right_lim_def {f: ℝ → ℝ} {x₀ L:ℝ} (h: Convergesto (.Ioi x₀) f L x₀) :
right_lim f x₀ = L := by
show Filter.lim _ = L
apply lim_eq; rwa [Convergesto.iff, Filter.Tendsto.eq_1] at h
theorem left_lim_def {f: ℝ → ℝ} {x₀ L:ℝ} (h: Convergesto (.Iio x₀) f L x₀) :
left_lim f x₀ = L := by
show Filter.lim _ = L
apply lim_eq; rwa [Convergesto.iff, Filter.Tendsto.eq_1] at h
noncomputable abbrev jump (f: ℝ → ℝ) (x₀:ℝ) : ℝ :=
right_lim f x₀ - left_lim f x₀
/-- Right limits exist for continuous functions -/
theorem right_lim_of_continuous {X:Set ℝ} {f: ℝ → ℝ} {x₀:ℝ}
(h : ∃ ε>0, .Ico x₀ (x₀+ε) ⊆ X) (hf: ContinuousWithinAt f X x₀) :
right_lim f x₀ = f x₀ := by
choose ε hε hX using h
apply right_lim_def
rw [ContinuousWithinAt.eq_1] at hf
replace hf : (nhdsWithin x₀ (.Ioo x₀ (x₀ + ε))).Tendsto f (nhds (f x₀)) :=
tendsto_nhdsWithin_mono_left (Set.Ioo_subset_Ico_self.trans hX) hf
rw [Convergesto.iff]
convert hf using 1
have h1 : .Ioo x₀ (x₀ + ε) ∈ nhdsWithin x₀ (.Ioi x₀) := by
convert inter_mem_nhdsWithin (t := .Ioo (x₀-ε) (x₀+ε)) _ _
. grind
apply Ioo_mem_nhds <;> linarith
rw [←nhdsWithin_inter_of_mem h1]; congr 1; simp [Set.Ioo_subset_Ioi_self]
/-- Left limits exist for continuous functions -/
theorem left_lim_of_continuous {X:Set ℝ} {f: ℝ → ℝ} {x₀:ℝ}
(h : ∃ ε>0, .Ioc (x₀-ε) x₀ ⊆ X) (hf: ContinuousWithinAt f X x₀) :
left_lim f x₀ = f x₀ := by
choose ε hε hX using h
apply left_lim_def
rw [ContinuousWithinAt.eq_1] at hf
replace hf : (nhdsWithin x₀ (.Ioo (x₀ - ε) x₀)).Tendsto f (nhds (f x₀)) :=
tendsto_nhdsWithin_mono_left (Set.Ioo_subset_Ioc_self.trans hX) hf
rw [Convergesto.iff]
convert hf using 1
have h1 : .Ioo (x₀-ε) x₀ ∈ nhdsWithin x₀ (.Iio x₀) := by
convert inter_mem_nhdsWithin (t := .Ioo (x₀-ε) (x₀+ε)) _ _
. grind
apply Ioo_mem_nhds <;> linarith
rw [←nhdsWithin_inter_of_mem h1]
congr 1; simp [Set.Ioo_subset_Iio_self]
/-- No jump for continuous functions -/
theorem jump_of_continuous {X:Set ℝ} {f: ℝ → ℝ} {x₀:ℝ}
(h : X ∈ nhds x₀) (hf: ContinuousWithinAt f X x₀) :
jump f x₀ = 0 := by
rw [mem_nhds_iff_exists_Ioo_subset] at h
choose l u hx₀ hX using h; simp at hx₀
have hl : ∃ ε>0, .Ioc (x₀-ε) x₀ ⊆ X :=
⟨ x₀-l, by linarith, Set.Subset.trans (by intro x ⟨h1, h2⟩; exact ⟨by linarith, by linarith⟩) hX ⟩
have hu : ∃ ε>0, .Ico x₀ (x₀+ε) ⊆ X :=
⟨ u-x₀, by linarith, Set.Subset.trans (by intro x ⟨h1, h2⟩; exact ⟨by linarith, by linarith⟩) hX ⟩
simp [jump, left_lim_of_continuous hl hf, right_lim_of_continuous hu hf]
/-- Right limits exist for monotone functions -/
theorem right_lim_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) :
Convergesto (.Ioi x₀) f (sInf (f '' .Ioi x₀)) x₀ := by
rw [Convergesto.iff]
apply (hf.monotoneOn _).tendsto_nhdsGT
rw [bddBelow_def]; use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; grind
theorem right_lim_of_monotone' {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) :
right_lim f x₀ = sInf (f '' .Ioi x₀) := right_lim_def (right_lim_of_monotone x₀ hf)
/-- Left limits exist for monotone functions -/
theorem left_lim_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) :
Convergesto (.Iio x₀) f (sSup (f '' .Iio x₀)) x₀ := by
rw [Convergesto.iff]
apply (hf.monotoneOn _).tendsto_nhdsLT
rw [bddAbove_def]; use f x₀; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; grind
theorem left_lim_of_monotone' {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) :
left_lim f x₀ = sSup (f '' .Iio x₀) := left_lim_def (left_lim_of_monotone x₀ hf)
theorem jump_of_monotone {f: ℝ → ℝ} (x₀:ℝ) (hf: Monotone f) :
0 ≤ jump f x₀ := by
simp [jump, left_lim_of_monotone' x₀ hf, right_lim_of_monotone' x₀ hf]
apply csSup_le (by simp); intro a ha
apply le_csInf (by simp); intro b hb; simp at ha hb
obtain ⟨ x, hx, rfl ⟩ := ha; obtain ⟨ y, hy, rfl ⟩ := hb
apply hf; grind
theorem right_lim_le_left_lim_of_monotone {f:ℝ → ℝ} {a b:ℝ} (hab: a < b)
(hf: Monotone f) :
right_lim f a ≤ left_lim f b := by
rw [left_lim_of_monotone' b hf, right_lim_of_monotone' a hf]
calc
_ ≤ f ((a+b)/2) := by
apply csInf_le
. rw [bddBelow_def]; use f a; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; grind
simp; use (a+b)/2; simp; linarith
_ ≤ _ := by
apply le_csSup
. rw [bddAbove_def]; use f b; intro y hy; simp at hy; obtain ⟨ x, hx, rfl ⟩ := hy; apply hf; grind
simp; use (a+b)/2; simp; linarith
/-- Definition 11.8.1 -/
noncomputable abbrev α_length (α: ℝ → ℝ) (I: BoundedInterval) : ℝ := match I with
| Icc a b => if a ≤ b then (right_lim α b) - (left_lim α a) else 0
| Ico a b => if a ≤ b then (left_lim α b) - (left_lim α a) else 0
| Ioc a b => if a ≤ b then (right_lim α b) - (right_lim α a) else 0
| Ioo a b => if a < b then (left_lim α b) - (right_lim α a) else 0
syntax:max term "[" term "]ₗ" : term
macro_rules | `($α[$I]ₗ) => `(α_length $α $I)
theorem α_length_of_empty (α: ℝ → ℝ) {I: BoundedInterval} (hI: (I:Set ℝ) = ∅) : α[I]ₗ = 0 :=
match I with
| Icc _ _ => by simp [Set.Icc_eq_empty_iff] at *; simp [*]
| Ico a b => by simp [Set.Ico_eq_empty_iff] at *; intro h; have := le_antisymm hI h; subst this; simp
| Ioc a b => by simp [Set.Ioc_eq_empty_iff] at *; intro h; have := le_antisymm hI h; subst this; simp
| Ioo _ _ => by simp [Set.Ioo_eq_empty_iff] at *; simp [*]
@[simp]
theorem α_length_of_pt {α: ℝ → ℝ} (a:ℝ) : α[Icc a a]ₗ = jump α a := by simp [α_length, jump]
theorem α_length_of_cts {α:ℝ → ℝ} {I: BoundedInterval} {a b: ℝ}
(haa: a < I.a) (hab: I.a ≤ I.b) (hbb: I.b < b)
(hI : I ⊆ Ioo a b) (hα: ContinuousOn α (Ioo a b)) :
α[I]ₗ = α I.b - α I.a := by
have ha_left : left_lim α I.a = α I.a := by
apply left_lim_of_continuous _ (hα.continuousWithinAt (by simp; grind))
exact ⟨ I.a - a, by grind, by intro _; simp; grind ⟩
have ha_right : right_lim α I.a = α I.a := by
apply right_lim_of_continuous _ (hα.continuousWithinAt (by simp; grind))
exact ⟨ b - I.a, by grind, by intro _; simp; grind ⟩
have hb_left : left_lim α I.b = α I.b := by
apply left_lim_of_continuous _ (hα.continuousWithinAt (by simp; grind))
exact ⟨ I.b - a, by grind, by intro _; simp; grind ⟩
have hb_right : right_lim α I.b = α I.b := by
apply right_lim_of_continuous _ (hα.continuousWithinAt (by simp; grind))
exact ⟨ b - I.b, by grind, by intro _; simp; grind ⟩
cases I with
| Icc _ _ => grind
| Ico _ _ => grind
| Ioc _ _ => grind
| Ioo _ _ => simp [α_length, ha_right, hb_left]; intro h; have := le_antisymm h (by linarith); subst this; simp
/-- Example 11.8.2-/
example : (fun x ↦ x^2)[Icc 2 3]ₗ = 5 := by
sorry
example : (fun x ↦ x^2)[Icc 2 2]ₗ = 0 := by
sorry
example : (fun x ↦ x^2)[Ioo 2 2]ₗ = 0 := by
sorry
/-- Example 11.8.3-/
@[simp]
theorem α_len_of_id (I: BoundedInterval) : (fun x ↦ x)[I]ₗ = |I|ₗ := by
sorry
/-- An improved version of {name}`BoundedInterval.joins` that also controls {name}`α_length`. -/
abbrev BoundedInterval.joins' (K I J: BoundedInterval) : Prop := K.joins I J ∧ ∀ α:ℝ → ℝ, α[K]ₗ = α[I]ₗ + α[J]ₗ
theorem BoundedInterval.join_Icc_Ioc' {a b c:ℝ} (hab: a ≤ b) (hbc: b ≤ c) : (Icc a c).joins' (Icc a b) (Ioc b c) := ⟨ join_Icc_Ioc hab hbc,
by simp [α_length, show a ≤ b by grind, show b ≤ c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Icc_Ioo' {a b c:ℝ} (hab: a ≤ b) (hbc: b < c) : (Ico a c).joins' (Icc a b) (Ioo b c) := ⟨ join_Icc_Ioo hab hbc,
by simp [α_length, show a ≤ b by grind, show b < c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Ioc_Ioc' {a b c:ℝ} (hab: a ≤ b) (hbc: b ≤ c) : (Ioc a c).joins' (Ioc a b) (Ioc b c) := ⟨ join_Ioc_Ioc hab hbc,
by simp [α_length, show a ≤ b by grind, show b ≤ c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Ioc_Ioo' {a b c:ℝ} (hab: a ≤ b) (hbc: b < c) : (Ioo a c).joins' (Ioc a b) (Ioo b c) := ⟨ join_Ioc_Ioo hab hbc,
by simp [α_length, show a ≤ b by grind, show b < c by grind, show a < c by grind] ⟩
theorem BoundedInterval.join_Ico_Icc' {a b c:ℝ} (hab: a ≤ b) (hbc: b ≤ c) : (Icc a c).joins' (Ico a b) (Icc b c) := ⟨ join_Ico_Icc hab hbc,
by simp [α_length, show a ≤ b by grind, show b ≤ c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Ico_Ico' {a b c:ℝ} (hab: a ≤ b) (hbc: b ≤ c) : (Ico a c).joins' (Ico a b) (Ico b c) := ⟨ join_Ico_Ico hab hbc,
by simp [α_length, show a ≤ b by grind, show b ≤ c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Ioo_Icc' {a b c:ℝ} (hab: a < b) (hbc: b ≤ c) : (Ioc a c).joins' (Ioo a b) (Icc b c) := ⟨ join_Ioo_Icc hab hbc,
by simp [α_length, show a < b by grind, show b ≤ c by grind, show a ≤ c by grind] ⟩
theorem BoundedInterval.join_Ioo_Ico' {a b c:ℝ} (hab: a < b) (hbc: b ≤ c) : (Ioo a c).joins' (Ioo a b) (Ico b c) := ⟨ join_Ioo_Ico hab hbc,
by simp [α_length, show a < b by grind, show b ≤ c by grind, show a < c by grind] ⟩
/-- Theorem 11.8.4 / Exercise 11.8.1 -/
theorem Partition.sum_of_α_length {I: BoundedInterval} (P: Partition I) (α: ℝ → ℝ) :
∑ J ∈ P.intervals, α[J]ₗ = α[I]ₗ := by
sorry
/-- Definition 11.8.5 (Piecewise constant RS integral)-/
noncomputable abbrev PiecewiseConstantWith.RS_integ (f:ℝ → ℝ) {I: BoundedInterval} (P: Partition I) (α: ℝ → ℝ) :
ℝ := ∑ J ∈ P.intervals, constant_value_on f (J:Set ℝ) * α[J]ₗ
/-- Example 11.8.6 -/
noncomputable abbrev f_11_8_6 (x:ℝ) : ℝ := if x < 2 then 4 else 2
noncomputable abbrev P_11_8_6 : Partition (Icc 1 3) :=
(⊥: Partition (Ico 1 2)).join (⊥ : Partition (Icc 2 3))
(join_Ico_Icc (by norm_num) (by norm_num) )
theorem f_11_8_6_RS_integ : PiecewiseConstantWith.RS_integ f_11_8_6 P_11_8_6 (fun x ↦ x) = 22 := by
sorry
/-- Example 11.8.7 -/
theorem PiecewiseConstantWith.RS_integ_eq_integ {f:ℝ → ℝ} {I: BoundedInterval} (P: Partition I) :RS_integ f P (fun x ↦ x) = integ f P := by
sorry
/-- Analogue of Proposition 11.2.13 -/
theorem PiecewiseConstantWith.RS_integ_eq {f:ℝ → ℝ} {I: BoundedInterval} {P P': Partition I}
(hP: PiecewiseConstantWith f P) (hP': PiecewiseConstantWith f P') (α:ℝ → ℝ): RS_integ f P α = RS_integ f P' α := by
sorry
open Classical in
noncomputable abbrev PiecewiseConstantOn.RS_integ (f:ℝ → ℝ) (I: BoundedInterval) (α:ℝ → ℝ):
ℝ := if h: PiecewiseConstantOn f I then PiecewiseConstantWith.RS_integ f h.choose α else 0
theorem PiecewiseConstantOn.RS_integ_def {f:ℝ → ℝ} {I: BoundedInterval} {P: Partition I}
(h: PiecewiseConstantWith f P) (α:ℝ → ℝ) : RS_integ f I α = PiecewiseConstantWith.RS_integ f P α := by
have h' : PiecewiseConstantOn f I := by use P
simp [RS_integ, h']; exact PiecewiseConstantWith.RS_integ_eq h'.choose_spec h α
/-- {name}`α_length` non-negative when α monotone -/
theorem α_length_nonneg_of_monotone {α:ℝ → ℝ} (hα: Monotone α) (I: BoundedInterval):
0 ≤ α[I]ₗ := by
sorry
/-- Analogue of Theorem 11.2.16 (a) (Laws of integration) / Exercise 11.8.3 -/
theorem PiecewiseConstantOn.RS_integ_add {f g: ℝ → ℝ} {I: BoundedInterval}
(hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) {α:ℝ → ℝ} (hα: Monotone α):
RS_integ (f + g) I α = RS_integ f I α + RS_integ g I α := by
sorry
/-- Analogue of Theorem 11.2.16 (b) (Laws of integration) / Exercise 11.8.3 -/
theorem PiecewiseConstantOn.RS_integ_smul {f: ℝ → ℝ} {I: BoundedInterval} (c:ℝ)
(hf: PiecewiseConstantOn f I) {α:ℝ → ℝ} (hα: Monotone α) :
RS_integ (c • f) I α = c * RS_integ f I α
:= by
sorry
/-- Theorem 11.8.8 (c) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_sub {f g: ℝ → ℝ} {I: BoundedInterval}
{α:ℝ → ℝ} (hα: Monotone α)
(hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) :
RS_integ (f - g) I α = RS_integ f I α - RS_integ g I α := by
sorry
/-- Theorem 11.8.8 (d) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_of_nonneg {f: ℝ → ℝ} {I: BoundedInterval}
{α:ℝ → ℝ} (hα: Monotone α)
(h: ∀ x ∈ I, 0 ≤ f x) (hf: PiecewiseConstantOn f I) :
0 ≤ RS_integ f I α := by
sorry
/-- Theorem 11.8.8 (e) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_mono {f g: ℝ → ℝ} {I: BoundedInterval}
{α:ℝ → ℝ} (hα: Monotone α)
(h: ∀ x ∈ I, f x ≤ g x) (hf: PiecewiseConstantOn f I) (hg: PiecewiseConstantOn g I) :
RS_integ f I α ≤ RS_integ g I α := by
sorry
/-- Theorem 11.8.8 (f) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_const (c: ℝ) (I: BoundedInterval) {α:ℝ → ℝ} (hα: Monotone α) :
RS_integ (fun _ ↦ c) I α = c * α[I]ₗ := by
sorry
/-- Theorem 11.8.8 (f) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_const' {f:ℝ → ℝ} {I: BoundedInterval}
{α:ℝ → ℝ} (hα: Monotone α) (h: ConstantOn f I) :
RS_integ f I α = (constant_value_on f I) * α[I]ₗ := by
sorry
open Classical in
/-- Theorem 11.8.8 (g) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_of_extend {I J: BoundedInterval} (hIJ: I ⊆ J)
{f: ℝ → ℝ} (h: PiecewiseConstantOn f I) {α:ℝ → ℝ} (hα: Monotone α):
PiecewiseConstantOn (fun x ↦ if x ∈ I then f x else 0) J := by
sorry
open Classical in
/-- Theorem 11.8.8 (g) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_of_extend {I J: BoundedInterval} (hIJ: I ⊆ J)
{f: ℝ → ℝ} (h: PiecewiseConstantOn f I) {α:ℝ → ℝ} (hα: Monotone α):
RS_integ (fun x ↦ if x ∈ I then f x else 0) J α = RS_integ f I α := by
sorry
/-- Theorem 11.8.8 (h) (Laws of RS integration) / Exercise 11.8.8 -/
theorem PiecewiseConstantOn.RS_integ_of_join {I J K: BoundedInterval} (hIJK: K.joins' I J)
{f: ℝ → ℝ} (h: PiecewiseConstantOn f K) {α:ℝ → ℝ} (hα: Monotone α):
RS_integ f K α = RS_integ f I α + RS_integ f J α := by
sorry
/-- Analogue of Definition 11.3.2 (Uppper and lower Riemann integrals )-/
noncomputable abbrev upper_RS_integral (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ): ℝ :=
sInf ((PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I})
noncomputable abbrev lower_RS_integral (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ): ℝ :=
sSup ((PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I})
lemma RS_integral_bound_upper_of_bounded {f:ℝ → ℝ} {M:ℝ} {I: BoundedInterval}
(h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) {α:ℝ → ℝ} (hα:Monotone α)
: M * α[I]ₗ ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I} := by
simp; refine ⟨ fun _ ↦ M, ⟨ ⟨ ?_, ?_ ⟩, PiecewiseConstantOn.RS_integ_const M I hα ⟩ ⟩
. grind [abs_le']
exact (ConstantOn.of_const (c := M) (by simp)).piecewiseConstantOn
lemma RS_integral_bound_lower_of_bounded {f:ℝ → ℝ} {M:ℝ} {I: BoundedInterval} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M) {α:ℝ → ℝ} (hα:Monotone α)
: -M * α[I]ₗ ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I} := by
simp; refine ⟨ fun _ ↦ -M, ⟨ ⟨ ?_, ?_ ⟩, by convert PiecewiseConstantOn.RS_integ_const _ _ hα using 1; simp ⟩ ⟩
. grind [abs_le']
exact (ConstantOn.of_const (c := -M) (by simp)).piecewiseConstantOn
lemma RS_integral_bound_upper_nonempty {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α) :
((PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by
choose M h using h; exact Set.nonempty_of_mem (RS_integral_bound_upper_of_bounded h hα)
lemma RS_integral_bound_lower_nonempty {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α) :
((PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}).Nonempty := by
choose M h using h; exact Set.nonempty_of_mem (RS_integral_bound_lower_of_bounded h hα)
lemma RS_integral_bound_lower_le_upper {f:ℝ → ℝ} {I: BoundedInterval} {a b:ℝ}
{α:ℝ → ℝ} (hα: Monotone α)
(ha: a ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MajorizesOn g f I ∧ PiecewiseConstantOn g I})
(hb: b ∈ (PiecewiseConstantOn.RS_integ · I α) '' {g | MinorizesOn g f I ∧ PiecewiseConstantOn g I})
: b ≤ a:= by
have ⟨ g, ⟨ ⟨ hmaj, hgp⟩, hgi ⟩ ⟩ := ha
have ⟨ h, ⟨ ⟨ hmin, hhp⟩, hhi ⟩ ⟩ := hb
rw [←hgi, ←hhi]; apply hhp.RS_integ_mono hα _ hgp; intro _ hx; linarith [hmin _ hx, hmaj _ hx]
lemma RS_integral_bound_below {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α) :
BddBelow ((PiecewiseConstantOn.RS_integ · I α) ''
{g | MajorizesOn g f I ∧ PiecewiseConstantOn g I}) := by
rw [bddBelow_def]; use (RS_integral_bound_lower_nonempty h hα).some
intro a ha; exact RS_integral_bound_lower_le_upper hα ha (RS_integral_bound_lower_nonempty h hα).some_mem
lemma RS_integral_bound_above {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α):
BddAbove ((PiecewiseConstantOn.RS_integ · I α) ''
{g | MinorizesOn g f I ∧ PiecewiseConstantOn g I}) := by
rw [bddAbove_def]; use (RS_integral_bound_upper_nonempty h hα).some
intro b hb; exact RS_integral_bound_lower_le_upper hα (RS_integral_bound_upper_nonempty h hα).some_mem hb
lemma le_lower_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} {M:ℝ} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M)
{α:ℝ → ℝ} (hα: Monotone α) :
-M * α[I]ₗ ≤ lower_RS_integral f I α :=
le_csSup (RS_integral_bound_above (BddOn.of_bounded h) hα) (RS_integral_bound_lower_of_bounded h hα)
lemma lower_RS_integral_le_upper {f:ℝ → ℝ} {I: BoundedInterval} (h: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α) :
lower_RS_integral f I α ≤ upper_RS_integral f I α := by
apply csSup_le (RS_integral_bound_lower_nonempty h hα)
intros
apply le_csInf (RS_integral_bound_upper_nonempty h hα)
intros; solve_by_elim [RS_integral_bound_lower_le_upper]
lemma RS_upper_integral_le {f:ℝ → ℝ} {I: BoundedInterval} {M:ℝ} (h: ∀ x ∈ (I:Set ℝ), |f x| ≤ M)
{α:ℝ → ℝ} (hα: Monotone α) :
upper_RS_integral f I α ≤ M * α[I]ₗ :=
csInf_le (RS_integral_bound_below (.of_bounded h) hα) (RS_integral_bound_upper_of_bounded h hα)
lemma upper_RS_integral_le_integ {f g:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I)
(hfg: MajorizesOn g f I) (hg: PiecewiseConstantOn g I)
{α:ℝ → ℝ} (hα: Monotone α) :
upper_RS_integral f I α ≤ PiecewiseConstantOn.RS_integ g I α :=
csInf_le (RS_integral_bound_below hf hα) ⟨ g, by simpa [hg] ⟩
lemma integ_le_lower_RS_integral {f h:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I)
(hfh: MinorizesOn h f I) (hg: PiecewiseConstantOn h I)
{α:ℝ → ℝ} (hα: Monotone α) :
PiecewiseConstantOn.RS_integ h I α ≤ lower_RS_integral f I α :=
le_csSup (RS_integral_bound_above hf hα) ⟨ h, by simpa [hg] ⟩
lemma lt_of_gt_upper_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I)
{α: ℝ → ℝ} (hα: Monotone α) {X:ℝ} (hX: upper_RS_integral f I α < X ) :
∃ g, MajorizesOn g f I ∧ PiecewiseConstantOn g I ∧ PiecewiseConstantOn.RS_integ g I α < X := by
have ⟨ Y, hY, hYX ⟩ := exists_lt_of_csInf_lt (RS_integral_bound_upper_nonempty hf hα) hX
simp at hY; have ⟨ g, ⟨ hmaj, hgp ⟩, hgi ⟩ := hY; exact ⟨ g, hmaj, hgp, by rwa [hgi] ⟩
lemma gt_of_lt_lower_RS_integral {f:ℝ → ℝ} {I: BoundedInterval} (hf: BddOn f I)
{α:ℝ → ℝ} (hα: Monotone α) {X:ℝ} (hX: X < lower_RS_integral f I α) :
∃ h, MinorizesOn h f I ∧ PiecewiseConstantOn h I ∧ X < PiecewiseConstantOn.RS_integ h I α := by
have ⟨ Y, hY, hYX ⟩ := exists_lt_of_lt_csSup (RS_integral_bound_lower_nonempty hf hα) hX
simp at hY; have ⟨ h, ⟨ hmin, hhp ⟩, hhi ⟩ := hY; exact ⟨ h, hmin, hhp, by rwa [hhi] ⟩
/-- Analogue of Definition 11.3.4 -/
noncomputable abbrev RS_integ (f:ℝ → ℝ) (I: BoundedInterval) (α:ℝ → ℝ) : ℝ := upper_RS_integral f I α
noncomputable abbrev RS_IntegrableOn (f:ℝ → ℝ) (I: BoundedInterval) (α: ℝ → ℝ) : Prop :=
BddOn f I ∧ lower_RS_integral f I α = upper_RS_integral f I α
/-- Analogue of various components of Lemma 11.3.3 -/
theorem upper_RS_integral_eq_upper_integral (f:ℝ → ℝ) (I: BoundedInterval) :
upper_RS_integral f I (fun x ↦ x) = upper_integral f I := by
sorry
theorem lower_RS_integral_eq_lower_integral (f:ℝ → ℝ) (I: BoundedInterval) :
lower_RS_integral f I (fun x ↦ x) = lower_integral f I := by
sorry
theorem RS_integ_eq_integ (f:ℝ → ℝ) (I: BoundedInterval) :
RS_integ f I (fun x ↦ x) = integ f I := by
sorry
theorem RS_IntegrableOn_iff_IntegrableOn (f:ℝ → ℝ) (I: BoundedInterval) :
RS_IntegrableOn f I (fun x ↦ x) ↔ IntegrableOn f I := by
sorry
/-- Exercise 11.8.4 -/
theorem RS_integ_of_uniform_cts {I: BoundedInterval} {f:ℝ → ℝ} (hf: UniformContinuousOn f I)
{α:ℝ → ℝ} (hα: Monotone α):
RS_IntegrableOn f I α := by
sorry
/-- Exercise 11.8.5 -/
theorem RS_integ_with_sign (f:ℝ → ℝ) (hf: ContinuousOn f (.Icc (-1) 1)) : RS_IntegrableOn f (Icc (-1) 1) Real.sign ∧ RS_integ f (Icc (-1) 1) (fun x ↦ -Real.sign x) = 2 * f 0 := by
sorry
/-- Analogue of Lemma 11.3.7 -/
theorem RS_integ_of_piecewise_const {f:ℝ → ℝ} {I: BoundedInterval} (hf: PiecewiseConstantOn f I)
{α: ℝ → ℝ} (hα: Monotone α):
RS_IntegrableOn f I α ∧ RS_integ f I α = PiecewiseConstantOn.RS_integ f I α := by
sorry
end Chapter11