@@ -22,6 +22,19 @@ In this file we prove the following facts:
22
22
Cauchy's Mean Value Theorem.
23
23
24
24
* `exists_has_deriv_at_eq_slope` and `exists_deriv_eq_slope` : Lagrange's Mean Value Theorem.
25
+
26
+ * `convex.image_sub_lt_mul_sub_of_deriv_lt`, `convex.mul_sub_lt_image_sub_of_lt_deriv`,
27
+ `convex.image_sub_le_mul_sub_of_deriv_le`, `convex.mul_sub_le_image_sub_of_le_deriv`,
28
+ if `∀ x, C (</≤/>/≥) (f' x)`, then `C * (y - x) (</≤/>/≥) (f y - f x)` whenever `x < y`.
29
+
30
+ * `convex.mono_of_deriv_nonneg`, `convex.antimono_of_deriv_nonpos`,
31
+ `convex.strict_mono_of_deriv_pos`, `convex.strict_antimono_of_deriv_neg` :
32
+ if the derivative of a function is non-negative/non-positive/positive/negative, then
33
+ the function is monotone/monotonically decreasing/strictly monotone/strictly monotonically
34
+ decreasing.
35
+
36
+ * `convex_on_of_deriv_mono`, `convex_on_of_deriv2_nonneg` : if the derivative of a function
37
+ is increasing or its second derivative is nonnegative, then the original function is convex.
25
38
-/
26
39
27
40
set_option class.instance_max_depth 120
@@ -162,6 +175,12 @@ have bound : ∀ x ∈ s, ∥fderiv_within ℝ f s x∥ ≤ 0,
162
175
by simpa only [(dist_eq_norm _ _).symm, zero_mul, dist_le_zero, eq_comm]
163
176
using hs.norm_image_sub_le_of_norm_deriv_le hf bound hx hy
164
177
178
+ theorem is_const_of_fderiv_eq_zero {f : E → F} (hf : differentiable ℝ f)
179
+ (hf' : ∀ x, fderiv ℝ f x = 0 ) (x y : E) :
180
+ f x = f y :=
181
+ convex_univ.is_const_of_fderiv_within_eq_zero hf.differentiable_on
182
+ (λ x _, by rw fderiv_within_univ; exact hf' x) trivial trivial
183
+
165
184
/-! ### Functions `[a, b] → ℝ`. -/
166
185
167
186
section interval
@@ -221,3 +240,229 @@ exists_has_deriv_at_eq_slope f (deriv f) hab hfc
221
240
(λ x hx, ((hfd x hx).differentiable_at $ mem_nhds_sets is_open_Ioo hx).has_deriv_at)
222
241
223
242
end interval
243
+
244
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
245
+ of the real line. If `f` is differentiable on the interior of `D` and `C < f'`, then
246
+ `f` grows faster than `C * x` on `D`, i.e., `C * (y - x) < f y - f x` whenever `x, y ∈ D`,
247
+ `x < y`. -/
248
+ theorem convex.mul_sub_lt_image_sub_of_lt_deriv {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
249
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
250
+ {C} (hf'_gt : ∀ x ∈ interior D, C < deriv f x) :
251
+ ∀ x y ∈ D, x < y → C * (y - x) < f y - f x :=
252
+ begin
253
+ assume x y hx hy hxy,
254
+ have hxyD : Icc x y ⊆ D, from convex_real_iff.1 hD hx hy,
255
+ have hxyD' : Ioo x y ⊆ interior D,
256
+ from subset_sUnion_of_mem ⟨is_open_Ioo, subset.trans Ioo_subset_Icc_self hxyD⟩,
257
+ obtain ⟨a, a_mem, ha⟩ : ∃ a ∈ Ioo x y, deriv f a = (f y - f x) / (y - x),
258
+ from exists_deriv_eq_slope f hxy (hf.mono hxyD) (hf'.mono hxyD'),
259
+ have : C < (f y - f x) / (y - x), by { rw [← ha], exact hf'_gt _ (hxyD' a_mem) },
260
+ exact (lt_div_iff (sub_pos.2 hxy)).1 this
261
+ end
262
+
263
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `C < f'`, then `f` grows faster than
264
+ `C * x`, i.e., `C * (y - x) < f y - f x` whenever `x < y`. -/
265
+ theorem mul_sub_lt_image_sub_of_lt_deriv {f : ℝ → ℝ} (hf : differentiable ℝ f)
266
+ {C} (hf'_gt : ∀ x, C < deriv f x) ⦃x y⦄ (hxy : x < y) :
267
+ C * (y - x) < f y - f x :=
268
+ convex_univ.mul_sub_lt_image_sub_of_lt_deriv hf.continuous.continuous_on hf.differentiable_on
269
+ (λ x _, hf'_gt x) x y trivial trivial hxy
270
+
271
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
272
+ of the real line. If `f` is differentiable on the interior of `D` and `C ≤ f'`, then
273
+ `f` grows at least as fast as `C * x` on `D`, i.e., `C * (y - x) ≤ f y - f x` whenever `x, y ∈ D`,
274
+ `x ≤ y`. -/
275
+ theorem convex.mul_sub_le_image_sub_of_le_deriv {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
276
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
277
+ {C} (hf'_ge : ∀ x ∈ interior D, C ≤ deriv f x) :
278
+ ∀ x y ∈ D, x ≤ y → C * (y - x) ≤ f y - f x :=
279
+ begin
280
+ assume x y hx hy hxy,
281
+ cases eq_or_lt_of_le hxy with hxy' hxy', by rw [hxy', sub_self, sub_self, mul_zero],
282
+ have hxyD : Icc x y ⊆ D, from convex_real_iff.1 hD hx hy,
283
+ have hxyD' : Ioo x y ⊆ interior D,
284
+ from subset_sUnion_of_mem ⟨is_open_Ioo, subset.trans Ioo_subset_Icc_self hxyD⟩,
285
+ obtain ⟨a, a_mem, ha⟩ : ∃ a ∈ Ioo x y, deriv f a = (f y - f x) / (y - x),
286
+ from exists_deriv_eq_slope f hxy' (hf.mono hxyD) (hf'.mono hxyD'),
287
+ have : C ≤ (f y - f x) / (y - x), by { rw [← ha], exact hf'_ge _ (hxyD' a_mem) },
288
+ exact (le_div_iff (sub_pos.2 hxy')).1 this
289
+ end
290
+
291
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `C ≤ f'`, then `f` grows at least as fast
292
+ as `C * x`, i.e., `C * (y - x) ≤ f y - f x` whenever `x ≤ y`. -/
293
+ theorem mul_sub_le_image_sub_of_le_deriv {f : ℝ → ℝ} (hf : differentiable ℝ f)
294
+ {C} (hf'_ge : ∀ x, C ≤ deriv f x) ⦃x y⦄ (hxy : x ≤ y) :
295
+ C * (y - x) ≤ f y - f x :=
296
+ convex_univ.mul_sub_le_image_sub_of_le_deriv hf.continuous.continuous_on hf.differentiable_on
297
+ (λ x _, hf'_ge x) x y trivial trivial hxy
298
+
299
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
300
+ of the real line. If `f` is differentiable on the interior of `D` and `f' < C`, then
301
+ `f` grows slower than `C * x` on `D`, i.e., `f y - f x < C * (y - x)` whenever `x, y ∈ D`,
302
+ `x < y`. -/
303
+ theorem convex.image_sub_lt_mul_sub_of_deriv_lt {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
304
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
305
+ {C} (lt_hf' : ∀ x ∈ interior D, deriv f x < C) :
306
+ ∀ x y ∈ D, x < y → f y - f x < C * (y - x) :=
307
+ begin
308
+ assume x y hx hy hxy,
309
+ have hf'_gt : ∀ x ∈ interior D, -C < deriv (λ y, -f y) x,
310
+ { assume x hx,
311
+ rw [deriv_neg, neg_lt_neg_iff],
312
+ exact lt_hf' x hx },
313
+ simpa [-neg_lt_neg_iff]
314
+ using neg_lt_neg (hD.mul_sub_lt_image_sub_of_lt_deriv hf.neg hf'.neg hf'_gt x y hx hy hxy)
315
+ end
316
+
317
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f' < C`, then `f` grows slower than
318
+ `C * x` on `D`, i.e., `f y - f x < C * (y - x)` whenever `x < y`. -/
319
+ theorem image_sub_lt_mul_sub_of_deriv_lt {f : ℝ → ℝ} (hf : differentiable ℝ f)
320
+ {C} (lt_hf' : ∀ x, deriv f x < C) ⦃x y⦄ (hxy : x < y) :
321
+ f y - f x < C * (y - x) :=
322
+ convex_univ.image_sub_lt_mul_sub_of_deriv_lt hf.continuous.continuous_on hf.differentiable_on
323
+ (λ x _, lt_hf' x) x y trivial trivial hxy
324
+
325
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
326
+ of the real line. If `f` is differentiable on the interior of `D` and `f' ≤ C`, then
327
+ `f` grows at most as fast as `C * x` on `D`, i.e., `f y - f x ≤ C * (y - x)` whenever `x, y ∈ D`,
328
+ `x ≤ y`. -/
329
+ theorem convex.image_sub_le_mul_sub_of_deriv_le {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
330
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
331
+ {C} (le_hf' : ∀ x ∈ interior D, deriv f x ≤ C) :
332
+ ∀ x y ∈ D, x ≤ y → f y - f x ≤ C * (y - x) :=
333
+ begin
334
+ assume x y hx hy hxy,
335
+ have hf'_ge : ∀ x ∈ interior D, -C ≤ deriv (λ y, -f y) x,
336
+ { assume x hx,
337
+ rw [deriv_neg, neg_le_neg_iff],
338
+ exact le_hf' x hx },
339
+ simpa [-neg_le_neg_iff]
340
+ using neg_le_neg (hD.mul_sub_le_image_sub_of_le_deriv hf.neg hf'.neg hf'_ge x y hx hy hxy)
341
+ end
342
+
343
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f' ≤ C`, then `f` grows at most as fast
344
+ as `C * x`, i.e., `f y - f x ≤ C * (y - x)` whenever `x ≤ y`. -/
345
+ theorem image_sub_le_mul_sub_of_deriv_le {f : ℝ → ℝ} (hf : differentiable ℝ f)
346
+ {C} (le_hf' : ∀ x, deriv f x ≤ C) ⦃x y⦄ (hxy : x ≤ y) :
347
+ f y - f x ≤ C * (y - x) :=
348
+ convex_univ.image_sub_le_mul_sub_of_deriv_le hf.continuous.continuous_on hf.differentiable_on
349
+ (λ x _, le_hf' x) x y trivial trivial hxy
350
+
351
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
352
+ of the real line. If `f` is differentiable on the interior of `D` and `f'` is positive, then
353
+ `f` is a strictly monotonically increasing function on `D`. -/
354
+ theorem convex.strict_mono_of_deriv_pos {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
355
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
356
+ (hf'_pos : ∀ x ∈ interior D, 0 < deriv f x) :
357
+ ∀ x y ∈ D, x < y → f x < f y :=
358
+ by simpa only [zero_mul, sub_pos] using hD.mul_sub_lt_image_sub_of_lt_deriv hf hf' hf'_pos
359
+
360
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f'` is positive, then
361
+ `f` is a strictly monotonically increasing function. -/
362
+ theorem strict_mono_of_deriv_pos {f : ℝ → ℝ} (hf : differentiable ℝ f)
363
+ (hf'_pos : ∀ x, 0 < deriv f x) :
364
+ strict_mono f :=
365
+ λ x y hxy, convex_univ.strict_mono_of_deriv_pos hf.continuous.continuous_on hf.differentiable_on
366
+ (λ x _, hf'_pos x) x y trivial trivial hxy
367
+
368
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
369
+ of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonnegative, then
370
+ `f` is a monotonically increasing function on `D`. -/
371
+ theorem convex.mono_of_deriv_nonneg {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
372
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
373
+ (hf'_nonneg : ∀ x ∈ interior D, 0 ≤ deriv f x) :
374
+ ∀ x y ∈ D, x ≤ y → f x ≤ f y :=
375
+ by simpa only [zero_mul, sub_nonneg] using hD.mul_sub_le_image_sub_of_le_deriv hf hf' hf'_nonneg
376
+
377
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f'` is nonnegative, then
378
+ `f` is a monotonically increasing function. -/
379
+ theorem mono_of_deriv_nonneg {f : ℝ → ℝ} (hf : differentiable ℝ f) (hf' : ∀ x, 0 ≤ deriv f x) :
380
+ monotone f :=
381
+ λ x y hxy, convex_univ.mono_of_deriv_nonneg hf.continuous.continuous_on hf.differentiable_on
382
+ (λ x _, hf' x) x y trivial trivial hxy
383
+
384
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
385
+ of the real line. If `f` is differentiable on the interior of `D` and `f'` is negative, then
386
+ `f` is a strictly monotonically decreasing function on `D`. -/
387
+ theorem convex.strict_antimono_of_deriv_neg {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
388
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
389
+ (hf'_neg : ∀ x ∈ interior D, deriv f x < 0 ) :
390
+ ∀ x y ∈ D, x < y → f y < f x :=
391
+ by simpa only [zero_mul, sub_lt_zero] using hD.image_sub_lt_mul_sub_of_deriv_lt hf hf' hf'_neg
392
+
393
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f'` is negative, then
394
+ `f` is a strictly monotonically decreasing function. -/
395
+ theorem strict_antimono_of_deriv_neg {f : ℝ → ℝ} (hf : differentiable ℝ f)
396
+ (hf' : ∀ x, deriv f x < 0 ) :
397
+ ∀ ⦃x y⦄, x < y → f y < f x :=
398
+ λ x y hxy, convex_univ.strict_antimono_of_deriv_neg hf.continuous.continuous_on hf.differentiable_on
399
+ (λ x _, hf' x) x y trivial trivial hxy
400
+
401
+ /-- Let `f` be a function continuous on a convex (or, equivalently, connected) subset `D`
402
+ of the real line. If `f` is differentiable on the interior of `D` and `f'` is nonpositive, then
403
+ `f` is a monotonically decreasing function on `D`. -/
404
+ theorem convex.antimono_of_deriv_nonpos {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
405
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
406
+ (hf'_nonpos : ∀ x ∈ interior D, deriv f x ≤ 0 ) :
407
+ ∀ x y ∈ D, x ≤ y → f y ≤ f x :=
408
+ by simpa only [zero_mul, sub_nonpos] using hD.image_sub_le_mul_sub_of_deriv_le hf hf' hf'_nonpos
409
+
410
+ /-- Let `f : ℝ → ℝ` be a differentiable function. If `f'` is nonpositive, then
411
+ `f` is a monotonically decreasing function. -/
412
+ theorem antimono_of_deriv_nonpos {f : ℝ → ℝ} (hf : differentiable ℝ f) (hf' : ∀ x, deriv f x ≤ 0 ) :
413
+ ∀ ⦃x y⦄, x ≤ y → f y ≤ f x :=
414
+ λ x y hxy, convex_univ.antimono_of_deriv_nonpos hf.continuous.continuous_on hf.differentiable_on
415
+ (λ x _, hf' x) x y trivial trivial hxy
416
+
417
+ /-- If a function `f` is continuous on a convex set `D ⊆ ℝ`, is differentiable on its interior,
418
+ and `f'` is monotone on the interior, then `f` is convex on `D`. -/
419
+ theorem convex_on_of_deriv_mono {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
420
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
421
+ (hf'_mono : ∀ x y ∈ interior D, x ≤ y → deriv f x ≤ deriv f y) :
422
+ convex_on D f :=
423
+ convex_on_real_of_slope_mono_adjacent hD
424
+ begin
425
+ intros x y z hx hz hxy hyz,
426
+ -- First we prove some trivial inclusions
427
+ have hxzD : Icc x z ⊆ D, from convex_real_iff.1 hD hx hz,
428
+ have hxyD : Icc x y ⊆ D, from subset.trans (Icc_subset_Icc_right $ le_of_lt hyz) hxzD,
429
+ have hxyD' : Ioo x y ⊆ interior D,
430
+ from subset_sUnion_of_mem ⟨is_open_Ioo, subset.trans Ioo_subset_Icc_self hxyD⟩,
431
+ have hyzD : Icc y z ⊆ D, from subset.trans (Icc_subset_Icc_left $ le_of_lt hxy) hxzD,
432
+ have hyzD' : Ioo y z ⊆ interior D,
433
+ from subset_sUnion_of_mem ⟨is_open_Ioo, subset.trans Ioo_subset_Icc_self hyzD⟩,
434
+ -- Then we apply MVT to both `[x, y]` and `[y, z]`
435
+ obtain ⟨a, ⟨hxa, hay⟩, ha⟩ : ∃ a ∈ Ioo x y, deriv f a = (f y - f x) / (y - x),
436
+ from exists_deriv_eq_slope f hxy (hf.mono hxyD) (hf'.mono hxyD'),
437
+ obtain ⟨b, ⟨hyb, hbz⟩, hb⟩ : ∃ b ∈ Ioo y z, deriv f b = (f z - f y) / (z - y),
438
+ from exists_deriv_eq_slope f hyz (hf.mono hyzD) (hf'.mono hyzD'),
439
+ rw [← ha, ← hb],
440
+ exact hf'_mono a b (hxyD' ⟨hxa, hay⟩) (hyzD' ⟨hyb, hbz⟩) (le_of_lt $ lt_trans hay hyb)
441
+ end
442
+
443
+ /-- If a function `f` is continuous on a convex set `D ⊆ ℝ`, is differentiable on its interior,
444
+ and `f'` is monotone on the interior, then `f` is convex on `ℝ`. -/
445
+ theorem convex_on_univ_of_deriv_mono {f : ℝ → ℝ} (hf : differentiable ℝ f)
446
+ (hf'_mono : monotone (deriv f)) : convex_on univ f :=
447
+ convex_on_of_deriv_mono convex_univ hf.continuous.continuous_on hf.differentiable_on
448
+ (λ x y _ _ h, hf'_mono h)
449
+
450
+ /-- If a function `f` is continuous on a convex set `D ⊆ ℝ`, is twice differentiable on its interior,
451
+ and `f''` is nonnegative on the interior, then `f` is convex on `D`. -/
452
+ theorem convex_on_of_deriv2_nonneg {D : set ℝ} (hD : convex D) {f : ℝ → ℝ}
453
+ (hf : continuous_on f D) (hf' : differentiable_on ℝ f (interior D))
454
+ (hf'' : differentiable_on ℝ (deriv f) (interior D))
455
+ (hf''_nonneg : ∀ x ∈ interior D, 0 ≤ (deriv^[2 ] f x)) :
456
+ convex_on D f :=
457
+ convex_on_of_deriv_mono hD hf hf' $
458
+ assume x y hx hy hxy,
459
+ hD.interior.mono_of_deriv_nonneg hf''.continuous_on (by rwa [interior_interior])
460
+ (by rwa [interior_interior]) _ _ hx hy hxy
461
+
462
+ /-- If a function `f` is twice differentiable on `ℝ`, and `f''` is nonnegative on `ℝ`,
463
+ then `f` is convex on `ℝ`. -/
464
+ theorem convex_on_univ_of_deriv2_nonneg {f : ℝ → ℝ} (hf' : differentiable ℝ f)
465
+ (hf'' : differentiable ℝ (deriv f)) (hf''_nonneg : ∀ x, 0 ≤ (deriv^[2 ] f x)) :
466
+ convex_on univ f :=
467
+ convex_on_of_deriv2_nonneg convex_univ hf'.continuous.continuous_on hf'.differentiable_on
468
+ hf''.differentiable_on (λ x _, hf''_nonneg x)
0 commit comments