|
| 1 | +/- |
| 2 | +Copyright (c) 2021 Yury G. Kudryashov. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Author: Yury G. Kudryashov |
| 5 | +-/ |
| 6 | +import data.real.sqrt |
| 7 | +import analysis.calculus.inverse |
| 8 | +import measure_theory.borel_space |
| 9 | + |
| 10 | +/-! |
| 11 | +# Smoothness of `real.sqrt` |
| 12 | +
|
| 13 | +In this file we prove that `real.sqrt` is infinitely smooth at all points `x ≠ 0` and provide some |
| 14 | +dot-notation lemmas. |
| 15 | +
|
| 16 | +## Tags |
| 17 | +
|
| 18 | +sqrt, differentiable |
| 19 | +-/ |
| 20 | + |
| 21 | +open set |
| 22 | +open_locale topological_space |
| 23 | + |
| 24 | +namespace real |
| 25 | + |
| 26 | +/-- Local homeomorph between `(0, +∞)` and `(0, +∞)` with `to_fun = λ x, x ^ 2` and |
| 27 | +`inv_fun = sqrt`. -/ |
| 28 | +noncomputable def sq_local_homeomorph : local_homeomorph ℝ ℝ := |
| 29 | +{ to_fun := λ x, x ^ 2, |
| 30 | + inv_fun := sqrt, |
| 31 | + source := Ioi 0, |
| 32 | + target := Ioi 0, |
| 33 | + map_source' := λ x hx, mem_Ioi.2 (pow_pos hx _), |
| 34 | + map_target' := λ x hx, mem_Ioi.2 (sqrt_pos.2 hx), |
| 35 | + left_inv' := λ x hx, sqrt_sqr (le_of_lt hx), |
| 36 | + right_inv' := λ x hx, sqr_sqrt (le_of_lt hx), |
| 37 | + open_source := is_open_Ioi, |
| 38 | + open_target := is_open_Ioi, |
| 39 | + continuous_to_fun := (continuous_pow 2).continuous_on, |
| 40 | + continuous_inv_fun := continuous_on_id.sqrt } |
| 41 | + |
| 42 | +lemma deriv_sqrt_aux {x : ℝ} (hx : x ≠ 0) : |
| 43 | + has_strict_deriv_at sqrt (1 / (2 * sqrt x)) x ∧ ∀ n, times_cont_diff_at ℝ n sqrt x := |
| 44 | +begin |
| 45 | + cases hx.lt_or_lt with hx hx, |
| 46 | + { rw [sqrt_eq_zero_of_nonpos hx.le, mul_zero, div_zero], |
| 47 | + have : sqrt =ᶠ[𝓝 x] (λ _, 0) := (gt_mem_nhds hx).mono (λ x hx, sqrt_eq_zero_of_nonpos hx.le), |
| 48 | + exact ⟨(has_strict_deriv_at_const x (0 : ℝ)).congr_of_eventually_eq this.symm, |
| 49 | + λ n, times_cont_diff_at_const.congr_of_eventually_eq this⟩ }, |
| 50 | + { have : ↑2 * sqrt x ^ (2 - 1) ≠ 0, by simp [(sqrt_pos.2 hx).ne', @two_ne_zero ℝ], |
| 51 | + split, |
| 52 | + { simpa using sq_local_homeomorph.has_strict_deriv_at_symm hx this |
| 53 | + (has_strict_deriv_at_pow 2 _) }, |
| 54 | + { exact λ n, sq_local_homeomorph.times_cont_diff_at_symm_deriv this hx |
| 55 | + (has_deriv_at_pow 2 (sqrt x)) (times_cont_diff_at_id.pow 2) } } |
| 56 | +end |
| 57 | + |
| 58 | +lemma has_strict_deriv_at_sqrt {x : ℝ} (hx : x ≠ 0) : |
| 59 | + has_strict_deriv_at sqrt (1 / (2 * sqrt x)) x := |
| 60 | +(deriv_sqrt_aux hx).1 |
| 61 | + |
| 62 | +lemma times_cont_diff_at_sqrt {x : ℝ} {n : with_top ℕ} (hx : x ≠ 0) : |
| 63 | + times_cont_diff_at ℝ n sqrt x := |
| 64 | +(deriv_sqrt_aux hx).2 n |
| 65 | + |
| 66 | +lemma has_deriv_at_sqrt {x : ℝ} (hx : x ≠ 0) : has_deriv_at sqrt (1 / (2 * sqrt x)) x := |
| 67 | +(has_strict_deriv_at_sqrt hx).has_deriv_at |
| 68 | + |
| 69 | +end real |
| 70 | + |
| 71 | +open real |
| 72 | + |
| 73 | +lemma measurable.sqrt {α : Type*} [measurable_space α] {f : α → ℝ} (hf : measurable f) : |
| 74 | + measurable (λ x, sqrt (f x)) := |
| 75 | +continuous_sqrt.measurable.comp hf |
| 76 | + |
| 77 | +section deriv |
| 78 | + |
| 79 | +variables {f : ℝ → ℝ} {s : set ℝ} {f' x : ℝ} |
| 80 | + |
| 81 | +lemma has_deriv_within_at.sqrt (hf : has_deriv_within_at f f' s x) (hx : f x ≠ 0) : |
| 82 | + has_deriv_within_at (λ y, sqrt (f y)) (f' / (2 * sqrt (f x))) s x := |
| 83 | +by simpa only [(∘), div_eq_inv_mul, mul_one] |
| 84 | + using (has_deriv_at_sqrt hx).comp_has_deriv_within_at x hf |
| 85 | + |
| 86 | +lemma has_deriv_at.sqrt (hf : has_deriv_at f f' x) (hx : f x ≠ 0) : |
| 87 | + has_deriv_at (λ y, sqrt (f y)) (f' / (2 * sqrt(f x))) x := |
| 88 | +by simpa only [(∘), div_eq_inv_mul, mul_one] using (has_deriv_at_sqrt hx).comp x hf |
| 89 | + |
| 90 | +lemma has_strict_deriv_at.sqrt (hf : has_strict_deriv_at f f' x) (hx : f x ≠ 0) : |
| 91 | + has_strict_deriv_at (λ t, sqrt (f t)) (f' / (2 * sqrt (f x))) x := |
| 92 | +by simpa only [(∘), div_eq_inv_mul, mul_one] using (has_strict_deriv_at_sqrt hx).comp x hf |
| 93 | + |
| 94 | +lemma deriv_within_sqrt (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0) |
| 95 | + (hxs : unique_diff_within_at ℝ s x) : |
| 96 | + deriv_within (λx, sqrt (f x)) s x = (deriv_within f s x) / (2 * sqrt (f x)) := |
| 97 | +(hf.has_deriv_within_at.sqrt hx).deriv_within hxs |
| 98 | + |
| 99 | +@[simp] lemma deriv_sqrt (hf : differentiable_at ℝ f x) (hx : f x ≠ 0) : |
| 100 | + deriv (λx, sqrt (f x)) x = (deriv f x) / (2 * sqrt (f x)) := |
| 101 | +(hf.has_deriv_at.sqrt hx).deriv |
| 102 | + |
| 103 | +end deriv |
| 104 | + |
| 105 | +section fderiv |
| 106 | + |
| 107 | +variables {E : Type*} [normed_group E] [normed_space ℝ E] {f : E → ℝ} {n : with_top ℕ} |
| 108 | + {s : set E} {x : E} {f' : E →L[ℝ] ℝ} |
| 109 | + |
| 110 | +lemma has_fderiv_at.sqrt (hf : has_fderiv_at f f' x) (hx : f x ≠ 0) : |
| 111 | + has_fderiv_at (λ y, sqrt (f y)) ((1 / (2 * sqrt (f x))) • f') x := |
| 112 | +(has_deriv_at_sqrt hx).comp_has_fderiv_at x hf |
| 113 | + |
| 114 | +lemma has_strict_fderiv_at.sqrt (hf : has_strict_fderiv_at f f' x) (hx : f x ≠ 0) : |
| 115 | + has_strict_fderiv_at (λ y, sqrt (f y)) ((1 / (2 * sqrt (f x))) • f') x := |
| 116 | +(has_strict_deriv_at_sqrt hx).comp_has_strict_fderiv_at x hf |
| 117 | + |
| 118 | +lemma has_fderiv_within_at.sqrt (hf : has_fderiv_within_at f f' s x) (hx : f x ≠ 0) : |
| 119 | + has_fderiv_within_at (λ y, sqrt (f y)) ((1 / (2 * sqrt (f x))) • f') s x := |
| 120 | +(has_deriv_at_sqrt hx).comp_has_fderiv_within_at x hf |
| 121 | + |
| 122 | +lemma differentiable_within_at.sqrt (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0) : |
| 123 | + differentiable_within_at ℝ (λ y, sqrt (f y)) s x := |
| 124 | +(hf.has_fderiv_within_at.sqrt hx).differentiable_within_at |
| 125 | + |
| 126 | +lemma differentiable_at.sqrt (hf : differentiable_at ℝ f x) (hx : f x ≠ 0) : |
| 127 | + differentiable_at ℝ (λ y, sqrt (f y)) x := |
| 128 | +(hf.has_fderiv_at.sqrt hx).differentiable_at |
| 129 | + |
| 130 | +lemma differentiable_on.sqrt (hf : differentiable_on ℝ f s) (hs : ∀ x ∈ s, f x ≠ 0) : |
| 131 | + differentiable_on ℝ (λ y, sqrt (f y)) s := |
| 132 | +λ x hx, (hf x hx).sqrt (hs x hx) |
| 133 | + |
| 134 | +lemma differentiable.sqrt (hf : differentiable ℝ f) (hs : ∀ x, f x ≠ 0) : |
| 135 | + differentiable ℝ (λ y, sqrt (f y)) := |
| 136 | +λ x, (hf x).sqrt (hs x) |
| 137 | + |
| 138 | +lemma fderiv_within_sqrt (hf : differentiable_within_at ℝ f s x) (hx : f x ≠ 0) |
| 139 | + (hxs : unique_diff_within_at ℝ s x) : |
| 140 | + fderiv_within ℝ (λx, sqrt (f x)) s x = (1 / (2 * sqrt (f x))) • fderiv_within ℝ f s x := |
| 141 | +(hf.has_fderiv_within_at.sqrt hx).fderiv_within hxs |
| 142 | + |
| 143 | +@[simp] lemma fderiv_sqrt (hf : differentiable_at ℝ f x) (hx : f x ≠ 0) : |
| 144 | + fderiv ℝ (λx, sqrt (f x)) x = (1 / (2 * sqrt (f x))) • fderiv ℝ f x := |
| 145 | +(hf.has_fderiv_at.sqrt hx).fderiv |
| 146 | + |
| 147 | +lemma times_cont_diff_at.sqrt (hf : times_cont_diff_at ℝ n f x) (hx : f x ≠ 0) : |
| 148 | + times_cont_diff_at ℝ n (λ y, sqrt (f y)) x := |
| 149 | +(times_cont_diff_at_sqrt hx).comp x hf |
| 150 | + |
| 151 | +lemma times_cont_diff_within_at.sqrt (hf : times_cont_diff_within_at ℝ n f s x) (hx : f x ≠ 0) : |
| 152 | + times_cont_diff_within_at ℝ n (λ y, sqrt (f y)) s x := |
| 153 | +(times_cont_diff_at_sqrt hx).comp_times_cont_diff_within_at x hf |
| 154 | + |
| 155 | +lemma times_cont_diff_on.sqrt (hf : times_cont_diff_on ℝ n f s) (hs : ∀ x ∈ s, f x ≠ 0) : |
| 156 | + times_cont_diff_on ℝ n (λ y, sqrt (f y)) s := |
| 157 | +λ x hx, (hf x hx).sqrt (hs x hx) |
| 158 | + |
| 159 | +lemma times_cont_diff.sqrt (hf : times_cont_diff ℝ n f) (h : ∀ x, f x ≠ 0) : |
| 160 | + times_cont_diff ℝ n (λ y, sqrt (f y)) := |
| 161 | +times_cont_diff_iff_times_cont_diff_at.2 $ λ x, (hf.times_cont_diff_at.sqrt (h x)) |
| 162 | + |
| 163 | +end fderiv |
0 commit comments