@@ -4,6 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
4
4
Authors: Chris Hughes, Abhimanyu Pallavi Sudhir, Jean Lo, Calle Sönne, Sébastien Gouëzel
5
5
-/
6
6
import analysis.special_functions.trigonometric
7
+ import analysis.calculus.extend_deriv
7
8
8
9
/-!
9
10
# Power function on `ℂ`, `ℝ` and `ℝ⁺`
68
69
lemma cpow_neg (x y : ℂ) : x ^ -y = (x ^ y)⁻¹ :=
69
70
by simp [cpow_def]; split_ifs; simp [exp_neg]
70
71
72
+ lemma cpow_neg_one (x : ℂ) : x ^ (-1 : ℂ) = x⁻¹ :=
73
+ by simpa using cpow_neg x 1
74
+
71
75
@[simp] lemma cpow_nat_cast (x : ℂ) : ∀ (n : ℕ), x ^ (n : ℂ) = x ^ n
72
76
| 0 := by simp
73
77
| (n + 1 ) := if hx : x = 0 then by simp only [hx, pow_succ,
@@ -217,13 +221,46 @@ by simp [rpow_def, *]
217
221
218
222
@[simp] lemma one_rpow (x : ℝ) : (1 : ℝ) ^ x = 1 := by simp [rpow_def]
219
223
224
+ lemma zero_rpow_le_one (x : ℝ) : (0 : ℝ) ^ x ≤ 1 :=
225
+ by { by_cases h : x = 0 ; simp [h, zero_le_one] }
226
+
227
+ lemma zero_rpow_nonneg (x : ℝ) : 0 ≤ (0 : ℝ) ^ x :=
228
+ by { by_cases h : x = 0 ; simp [h, zero_le_one] }
229
+
220
230
lemma rpow_nonneg_of_nonneg {x : ℝ} (hx : 0 ≤ x) (y : ℝ) : 0 ≤ x ^ y :=
221
231
by rw [rpow_def_of_nonneg hx];
222
232
split_ifs; simp only [zero_le_one, le_refl, le_of_lt (exp_pos _)]
223
233
224
- lemma rpow_add {x : ℝ} (y z : ℝ) ( hx : 0 < x) : x ^ (y + z) = x ^ y * x ^ z :=
234
+ lemma rpow_add {x : ℝ} (hx : 0 < x) (y z : ℝ ) : x ^ (y + z) = x ^ y * x ^ z :=
225
235
by simp only [rpow_def_of_pos hx, mul_add, exp_add]
226
236
237
+ lemma rpow_add' {x : ℝ} (hx : 0 ≤ x) {y z : ℝ} (h : y + z ≠ 0 ) : x ^ (y + z) = x ^ y * x ^ z :=
238
+ begin
239
+ rcases le_iff_eq_or_lt.1 hx with H|pos,
240
+ { simp only [← H, h, rpow_eq_zero_iff_of_nonneg, true_and, zero_rpow, eq_self_iff_true, ne.def,
241
+ not_false_iff, zero_eq_mul],
242
+ by_contradiction F,
243
+ push_neg at F,
244
+ apply h,
245
+ simp [F] },
246
+ { exact rpow_add pos _ _ }
247
+ end
248
+
249
+ /-- For `0 ≤ x`, the only problematic case in the equality `x ^ y * x ^ z = x ^ (y + z)` is for
250
+ `x = 0` and `y + z = 0`, where the right hand side is `1` while the left hand side can vanish.
251
+ The inequality is always true, though, and given in this lemma. -/
252
+ lemma le_rpow_add {x : ℝ} (hx : 0 ≤ x) (y z : ℝ) : x ^ y * x ^ z ≤ x ^ (y + z) :=
253
+ begin
254
+ rcases le_iff_eq_or_lt.1 hx with H|pos,
255
+ { by_cases h : y + z = 0 ,
256
+ { simp only [H.symm, h, rpow_zero],
257
+ calc (0 : ℝ) ^ y * 0 ^ z ≤ 1 * 1 :
258
+ mul_le_mul (zero_rpow_le_one y) (zero_rpow_le_one z) (zero_rpow_nonneg z) zero_le_one
259
+ ... = 1 : by simp },
260
+ { simp [rpow_add', ← H, h] } },
261
+ { simp [rpow_add pos] }
262
+ end
263
+
227
264
lemma rpow_mul {x : ℝ} (hx : 0 ≤ x) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z :=
228
265
by rw [← complex.of_real_inj, complex.of_real_cpow (rpow_nonneg_of_nonneg hx _),
229
266
complex.of_real_cpow hx, complex.of_real_mul, complex.cpow_mul, complex.of_real_cpow hx];
@@ -241,6 +278,12 @@ by simp only [rpow_def, (complex.of_real_pow _ _).symm, complex.cpow_nat_cast,
241
278
by simp only [rpow_def, (complex.of_real_fpow _ _).symm, complex.cpow_int_cast,
242
279
complex.of_real_int_cast, complex.of_real_re]
243
280
281
+ lemma rpow_neg_one (x : ℝ) : x ^ (-1 : ℝ) = x⁻¹ :=
282
+ begin
283
+ suffices H : x ^ ((-1 : ℤ) : ℝ) = x⁻¹, by exact_mod_cast H,
284
+ simp only [rpow_int_cast, fpow_one, fpow_neg],
285
+ end
286
+
244
287
lemma mul_rpow {x y z : ℝ} (h : 0 ≤ x) (h₁ : 0 ≤ y) : (x*y)^z = x^z * y^z :=
245
288
begin
246
289
iterate 3 { rw real.rpow_def_of_nonneg }, split_ifs; simp * at *,
@@ -437,6 +480,64 @@ lemma continuous_rpow_of_pos (h : ∀a, 0 < g a) (hf : continuous f) (hg : conti
437
480
438
481
end prove_rpow_is_continuous
439
482
483
+ section prove_rpow_is_differentiable
484
+
485
+ lemma has_deriv_at_rpow_of_pos {x : ℝ} (h : 0 < x) (p : ℝ) :
486
+ has_deriv_at (λ x, x^p) (p * x^(p-1 )) x :=
487
+ begin
488
+ have : has_deriv_at (λ x, exp (log x * p)) (p * x^(p-1 )) x,
489
+ { convert (has_deriv_at_exp _).comp x ((has_deriv_at_log (ne_of_gt h)).mul_const p) using 1 ,
490
+ field_simp [rpow_def_of_pos h, mul_sub, exp_sub, exp_log h, ne_of_gt h],
491
+ ring },
492
+ apply this.congr_of_mem_nhds,
493
+ have : set.Ioi (0 : ℝ) ∈ 𝓝 x := mem_nhds_sets is_open_Ioi h,
494
+ exact filter.eventually_of_mem this (λ y hy, rpow_def_of_pos hy _)
495
+ end
496
+
497
+ lemma has_deriv_at_rpow_of_neg {x : ℝ} (h : x < 0 ) (p : ℝ) :
498
+ has_deriv_at (λ x, x^p) (p * x^(p-1 )) x :=
499
+ begin
500
+ have : has_deriv_at (λ x, exp (log x * p) * cos (p * π)) (p * x^(p-1 )) x,
501
+ { convert ((has_deriv_at_exp _).comp x ((has_deriv_at_log (ne_of_lt h)).mul_const p)).mul_const _
502
+ using 1 ,
503
+ field_simp [rpow_def_of_neg h, mul_sub, exp_sub, sub_mul, cos_sub, exp_log_of_neg h, ne_of_lt h],
504
+ ring },
505
+ apply this.congr_of_mem_nhds,
506
+ have : set.Iio (0 : ℝ) ∈ 𝓝 x := mem_nhds_sets is_open_Iio h,
507
+ exact filter.eventually_of_mem this (λ y hy, rpow_def_of_neg hy _)
508
+ end
509
+
510
+ lemma has_deriv_at_rpow {x : ℝ} (h : x ≠ 0 ) (p : ℝ) :
511
+ has_deriv_at (λ x, x^p) (p * x^(p-1 )) x :=
512
+ begin
513
+ rcases lt_trichotomy x 0 with H|H|H,
514
+ { exact has_deriv_at_rpow_of_neg H p },
515
+ { exact (h H).elim },
516
+ { exact has_deriv_at_rpow_of_pos H p },
517
+ end
518
+
519
+ lemma has_deriv_at_rpow_zero_of_one_le {p : ℝ} (h : 1 ≤ p) :
520
+ has_deriv_at (λ x, x^p) (p * (0 : ℝ)^(p-1 )) 0 :=
521
+ begin
522
+ apply has_deriv_at_of_has_deriv_at_of_ne (λ x hx, has_deriv_at_rpow hx p),
523
+ { exact (continuous_rpow_of_pos (λ _, (lt_of_lt_of_le zero_lt_one h))
524
+ continuous_id continuous_const).continuous_at },
525
+ { rcases le_iff_eq_or_lt.1 h with rfl|h,
526
+ { simp [continuous_const.continuous_at] },
527
+ { exact (continuous_const.mul (continuous_rpow_of_pos (λ _, sub_pos_of_lt h)
528
+ continuous_id continuous_const)).continuous_at } }
529
+ end
530
+
531
+ lemma has_deriv_at_rpow_of_one_le (x : ℝ) {p : ℝ} (h : 1 ≤ p) :
532
+ has_deriv_at (λ x, x^p) (p * x^(p-1 )) x :=
533
+ begin
534
+ by_cases hx : x = 0 ,
535
+ { rw hx, exact has_deriv_at_rpow_zero_of_one_le h },
536
+ { exact has_deriv_at_rpow hx p }
537
+ end
538
+
539
+ end prove_rpow_is_differentiable
540
+
440
541
section sqrt
441
542
442
543
lemma sqrt_eq_rpow : sqrt = λx:ℝ, x ^ (1 /(2 :ℝ)) :=
@@ -456,6 +557,163 @@ end sqrt
456
557
457
558
end real
458
559
560
+ section differentiability
561
+ open real
562
+
563
+ variables {f : ℝ → ℝ} {x f' : ℝ} {s : set ℝ} (p : ℝ)
564
+ /- Differentiability statements for the power of a function, when the function does not vanish
565
+ and the exponent is arbitrary-/
566
+
567
+ lemma has_deriv_within_at.rpow (hf : has_deriv_within_at f f' s x) (hx : f x ≠ 0 ) :
568
+ has_deriv_within_at (λ y, (f y)^p) (f' * p * (f x)^(p-1 )) s x :=
569
+ begin
570
+ convert (has_deriv_at_rpow hx p).comp_has_deriv_within_at x hf using 1 ,
571
+ ring
572
+ end
573
+
574
+ lemma has_deriv_at.rpow (hf : has_deriv_at f f' x) (hx : f x ≠ 0 ) :
575
+ has_deriv_at (λ y, (f y)^p) (f' * p * (f x)^(p-1 )) x :=
576
+ begin
577
+ rw ← has_deriv_within_at_univ at *,
578
+ exact hf.rpow p hx
579
+ end
580
+
581
+ lemma differentiable_within_at.rpow (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0 ) :
582
+ differentiable_within_at ℝ (λx, (f x)^p) s x :=
583
+ (hf.has_deriv_within_at.rpow p hx).differentiable_within_at
584
+
585
+ @[simp] lemma differentiable_at.rpow (hf : differentiable_at ℝ f x) (hx : f x ≠ 0 ) :
586
+ differentiable_at ℝ (λx, (f x)^p) x :=
587
+ (hf.has_deriv_at.rpow p hx).differentiable_at
588
+
589
+ lemma differentiable_on.rpow (hf : differentiable_on ℝ f s) (hx : ∀ x ∈ s, f x ≠ 0 ) :
590
+ differentiable_on ℝ (λx, (f x)^p) s :=
591
+ λx h, (hf x h).rpow p (hx x h)
592
+
593
+ @[simp] lemma differentiable.rpow (hf : differentiable ℝ f) (hx : ∀ x, f x ≠ 0 ) :
594
+ differentiable ℝ (λx, (f x)^p) :=
595
+ λx, (hf x).rpow p (hx x)
596
+
597
+ lemma deriv_within_rpow (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0 )
598
+ (hxs : unique_diff_within_at ℝ s x) :
599
+ deriv_within (λx, (f x)^p) s x = (deriv_within f s x) * p * (f x)^(p-1 ) :=
600
+ (hf.has_deriv_within_at.rpow p hx).deriv_within hxs
601
+
602
+ @[simp] lemma deriv_rpow (hf : differentiable_at ℝ f x) (hx : f x ≠ 0 ) :
603
+ deriv (λx, (f x)^p) x = (deriv f x) * p * (f x)^(p-1 ) :=
604
+ (hf.has_deriv_at.rpow p hx).deriv
605
+
606
+ /- Differentiability statements for the power of a function, when the function may vanish
607
+ but the exponent is at least one. -/
608
+
609
+ variable {p}
610
+
611
+ lemma has_deriv_within_at.rpow_of_one_le (hf : has_deriv_within_at f f' s x) (hp : 1 ≤ p) :
612
+ has_deriv_within_at (λ y, (f y)^p) (f' * p * (f x)^(p-1 )) s x :=
613
+ begin
614
+ convert (has_deriv_at_rpow_of_one_le (f x) hp).comp_has_deriv_within_at x hf using 1 ,
615
+ ring
616
+ end
617
+
618
+ lemma has_deriv_at.rpow_of_one_le (hf : has_deriv_at f f' x) (hp : 1 ≤ p) :
619
+ has_deriv_at (λ y, (f y)^p) (f' * p * (f x)^(p-1 )) x :=
620
+ begin
621
+ rw ← has_deriv_within_at_univ at *,
622
+ exact hf.rpow_of_one_le hp
623
+ end
624
+
625
+ lemma differentiable_within_at.rpow_of_one_le (hf : differentiable_within_at ℝ f s x) (hp : 1 ≤ p) :
626
+ differentiable_within_at ℝ (λx, (f x)^p) s x :=
627
+ (hf.has_deriv_within_at.rpow_of_one_le hp).differentiable_within_at
628
+
629
+ @[simp] lemma differentiable_at.rpow_of_one_le (hf : differentiable_at ℝ f x) (hp : 1 ≤ p) :
630
+ differentiable_at ℝ (λx, (f x)^p) x :=
631
+ (hf.has_deriv_at.rpow_of_one_le hp).differentiable_at
632
+
633
+ lemma differentiable_on.rpow_of_one_le (hf : differentiable_on ℝ f s) (hp : 1 ≤ p) :
634
+ differentiable_on ℝ (λx, (f x)^p) s :=
635
+ λx h, (hf x h).rpow_of_one_le hp
636
+
637
+ @[simp] lemma differentiable.rpow_of_one_le (hf : differentiable ℝ f) (hp : 1 ≤ p) :
638
+ differentiable ℝ (λx, (f x)^p) :=
639
+ λx, (hf x).rpow_of_one_le hp
640
+
641
+ lemma deriv_within_rpow_of_one_le (hf : differentiable_within_at ℝ f s x) (hp : 1 ≤ p)
642
+ (hxs : unique_diff_within_at ℝ s x) :
643
+ deriv_within (λx, (f x)^p) s x = (deriv_within f s x) * p * (f x)^(p-1 ) :=
644
+ (hf.has_deriv_within_at.rpow_of_one_le hp).deriv_within hxs
645
+
646
+ @[simp] lemma deriv_rpow_of_one_le (hf : differentiable_at ℝ f x) (hp : 1 ≤ p) :
647
+ deriv (λx, (f x)^p) x = (deriv f x) * p * (f x)^(p-1 ) :=
648
+ (hf.has_deriv_at.rpow_of_one_le hp).deriv
649
+
650
+ /- Differentiability statements for the square root of a function, when the function does not
651
+ vanish -/
652
+
653
+ lemma has_deriv_within_at.sqrt (hf : has_deriv_within_at f f' s x) (hx : f x ≠ 0 ) :
654
+ has_deriv_within_at (λ y, sqrt (f y)) (f' / (2 * sqrt (f x))) s x :=
655
+ begin
656
+ simp only [sqrt_eq_rpow],
657
+ convert hf.rpow (1 /2 ) hx,
658
+ rcases lt_trichotomy (f x) 0 with H|H|H,
659
+ { have A : (f x)^((1 :ℝ)/2 ) = 0 ,
660
+ { rw rpow_def_of_neg H,
661
+ have : cos (1 /2 * π) = 0 , by { convert cos_pi_div_two using 2 , ring },
662
+ rw [this ],
663
+ simp },
664
+ have B : f x ^ ((1 :ℝ) / 2 - 1 ) = 0 ,
665
+ { rw rpow_def_of_neg H,
666
+ have : cos (π/2 - π) = 0 , by simp [cos_sub],
667
+ have : cos (((1 :ℝ)/2 - 1 ) * π) = 0 , by { convert this using 2 , ring },
668
+ rw this ,
669
+ simp },
670
+ rw [A, B],
671
+ simp },
672
+ { exact (hx H).elim },
673
+ { have A : 0 < (f x)^((1 :ℝ)/2 ) := rpow_pos_of_pos H _,
674
+ have B : (f x) ^ (-(1 :ℝ)) = (f x)^(-((1 :ℝ)/2 )) * (f x)^(-((1 :ℝ)/2 )),
675
+ { rw [← rpow_add H],
676
+ congr,
677
+ norm_num },
678
+ rw [sub_eq_add_neg, rpow_add H, B, rpow_neg (le_of_lt H)],
679
+ field_simp [hx, ne_of_gt A],
680
+ ring }
681
+ end
682
+
683
+ lemma has_deriv_at.sqrt (hf : has_deriv_at f f' x) (hx : f x ≠ 0 ) :
684
+ has_deriv_at (λ y, sqrt (f y)) (f' / (2 * sqrt(f x))) x :=
685
+ begin
686
+ rw ← has_deriv_within_at_univ at *,
687
+ exact hf.sqrt hx
688
+ end
689
+
690
+ lemma differentiable_within_at.sqrt (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0 ) :
691
+ differentiable_within_at ℝ (λx, sqrt (f x)) s x :=
692
+ (hf.has_deriv_within_at.sqrt hx).differentiable_within_at
693
+
694
+ @[simp] lemma differentiable_at.sqrt (hf : differentiable_at ℝ f x) (hx : f x ≠ 0 ) :
695
+ differentiable_at ℝ (λx, sqrt (f x)) x :=
696
+ (hf.has_deriv_at.sqrt hx).differentiable_at
697
+
698
+ lemma differentiable_on.sqrt (hf : differentiable_on ℝ f s) (hx : ∀ x ∈ s, f x ≠ 0 ) :
699
+ differentiable_on ℝ (λx, sqrt (f x)) s :=
700
+ λx h, (hf x h).sqrt (hx x h)
701
+
702
+ @[simp] lemma differentiable.sqrt (hf : differentiable ℝ f) (hx : ∀ x, f x ≠ 0 ) :
703
+ differentiable ℝ (λx, sqrt (f x)) :=
704
+ λx, (hf x).sqrt (hx x)
705
+
706
+ lemma deriv_within_sqrt (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0 )
707
+ (hxs : unique_diff_within_at ℝ s x) :
708
+ deriv_within (λx, sqrt (f x)) s x = (deriv_within f s x) / (2 * sqrt (f x)) :=
709
+ (hf.has_deriv_within_at.sqrt hx).deriv_within hxs
710
+
711
+ @[simp] lemma deriv_sqrt (hf : differentiable_at ℝ f x) (hx : f x ≠ 0 ) :
712
+ deriv (λx, sqrt (f x)) x = (deriv f x) / (2 * sqrt (f x)) :=
713
+ (hf.has_deriv_at.sqrt hx).deriv
714
+
715
+ end differentiability
716
+
459
717
namespace nnreal
460
718
461
719
/-- The nonnegative real power function `x^y`, defined for `x : nnreal` and `y : ℝ ` as the
@@ -489,7 +747,7 @@ by { rw ← nnreal.coe_eq, exact real.rpow_one _ }
489
747
by { rw ← nnreal.coe_eq, exact real.one_rpow _ }
490
748
491
749
lemma rpow_add {x : nnreal} (hx : 0 < x) (y z : ℝ) : x ^ (y + z) = x ^ y * x ^ z :=
492
- by { rw ← nnreal.coe_eq, exact real.rpow_add _ _ hx }
750
+ by { rw ← nnreal.coe_eq, exact real.rpow_add hx _ _ }
493
751
494
752
lemma rpow_mul (x : nnreal) (y z : ℝ) : x ^ (y * z) = (x ^ y) ^ z :=
495
753
by { rw ← nnreal.coe_eq, exact real.rpow_mul x.2 y z }
0 commit comments