|
| 1 | +/- |
| 2 | +Copyright (c) 2020 Sébastien Gouëzel. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Sébastien Gouëzel |
| 5 | +-/ |
| 6 | + |
| 7 | +import analysis.calculus.extend_deriv analysis.calculus.iterated_deriv analysis.complex.exponential |
| 8 | + |
| 9 | +/-! |
| 10 | +# Smoothness of specific functions |
| 11 | +
|
| 12 | +The real function `exp_neg_inv_glue` given by `x ↦ exp (-1/x)` for `x > 0` and `0` |
| 13 | +for `x ≤ 0` is a basic building block to construct smooth partitions of unity. We prove that it |
| 14 | +is `C^∞` in `exp_neg_inv_glue.smooth`. |
| 15 | +-/ |
| 16 | + |
| 17 | +noncomputable theory |
| 18 | +open_locale classical topological_space |
| 19 | + |
| 20 | +open polynomial real filter set |
| 21 | + |
| 22 | +/-- `exp_neg_inv_glue` is the real function given by `x ↦ exp (-1/x)` for `x > 0` and `0` |
| 23 | +for `x ≤ 0`. is a basic building block to construct smooth partitions of unity. Its main property |
| 24 | +is that it vanishes for `x ≤ 0`, it is positive for `x > 0`, and the junction between the two |
| 25 | +behaviors is flat enough to retain smoothness. The fact that this function is `C^∞` is proved in |
| 26 | +`exp_neg_inv_glue.smooth`. -/ |
| 27 | +def exp_neg_inv_glue (x : ℝ) : ℝ := if x ≤ 0 then 0 else exp (-x⁻¹) |
| 28 | + |
| 29 | +namespace exp_neg_inv_glue |
| 30 | + |
| 31 | +/-- Our goal is to prove that `exp_neg_inv_glue` is `C^∞`. For this, we compute its successive |
| 32 | +derivatives for `x > 0`. The `n`-th derivative is of the form `P_aux n (x) exp(-1/x) / x^(2 n)`, |
| 33 | +where `P_aux n` is computed inductively. -/ |
| 34 | +noncomputable def P_aux : ℕ → polynomial ℝ |
| 35 | +| 0 := 1 |
| 36 | +| (n+1) := X^2 * (P_aux n).derivative + (1 - C (2 * n) * X) * (P_aux n) |
| 37 | + |
| 38 | +/-- Formula for the `n`-th derivative of `exp_neg_inv_glue`, as an auxiliary function `f_aux`. -/ |
| 39 | +def f_aux (n : ℕ) (x : ℝ) : ℝ := |
| 40 | +if x ≤ 0 then 0 else (P_aux n).eval x * exp (-x⁻¹) / x^(2 * n) |
| 41 | + |
| 42 | +/-- The `0`-th auxiliary function `f_aux 0` coincides with `exp_neg_inv_glue`, by definition. -/ |
| 43 | +lemma f_aux_zero_eq : f_aux 0 = exp_neg_inv_glue := |
| 44 | +begin |
| 45 | + ext x, |
| 46 | + by_cases h : x ≤ 0, |
| 47 | + { simp [exp_neg_inv_glue, f_aux, h] }, |
| 48 | + { simp [h, exp_neg_inv_glue, f_aux, ne_of_gt (not_le.1 h), P_aux] } |
| 49 | +end |
| 50 | + |
| 51 | +/-- For positive values, the derivative of the `n`-th auxiliary function `f_aux n` |
| 52 | +(given in this statement in unfolded form) is the `n+1`-th auxiliary function, since |
| 53 | +the polynomial `P_aux (n+1)` was chosen precisely to ensure this. -/ |
| 54 | +lemma f_aux_deriv (n : ℕ) (x : ℝ) (hx : x ≠ 0) : |
| 55 | + has_deriv_at (λx, (P_aux n).eval x * exp (-x⁻¹) / x^(2 * n)) |
| 56 | + ((P_aux (n+1)).eval x * exp (-x⁻¹) / x^(2 * (n + 1))) x := |
| 57 | +begin |
| 58 | + have A : ∀k:ℕ, 2 * (k + 1) - 1 = 2 * k + 1, by omega, |
| 59 | + convert (((P_aux n).has_deriv_at x).mul |
| 60 | + (((has_deriv_at_exp _).comp x (has_deriv_at_inv hx).neg))).div |
| 61 | + (has_deriv_at_pow (2 * n) x) (pow_ne_zero _ hx) using 1, |
| 62 | + field_simp [hx, P_aux], |
| 63 | + cases n; simp [nat.succ_eq_add_one, A]; ring_exp |
| 64 | +end |
| 65 | + |
| 66 | +/-- For positive values, the derivative of the `n`-th auxiliary function `f_aux n` |
| 67 | +is the `n+1`-th auxiliary function. -/ |
| 68 | +lemma f_aux_deriv_pos (n : ℕ) (x : ℝ) (hx : 0 < x) : |
| 69 | + has_deriv_at (f_aux n) ((P_aux (n+1)).eval x * exp (-x⁻¹) / x^(2 * (n + 1))) x := |
| 70 | +begin |
| 71 | + apply (f_aux_deriv n x (ne_of_gt hx)).congr_of_mem_nhds, |
| 72 | + have : Ioi (0 : ℝ) ∈ 𝓝 x := lt_mem_nhds hx, |
| 73 | + filter_upwards [this], |
| 74 | + assume y hy, |
| 75 | + have : ¬(y ≤ 0), by simpa using hy, |
| 76 | + simp [f_aux, this] |
| 77 | +end |
| 78 | + |
| 79 | +/-- To get differentiability at `0` of the auxiliary functions, we need to know that their limit |
| 80 | +is `0`, to be able to apply general differentiability extension theorems. This limit is checked in |
| 81 | +this lemma. -/ |
| 82 | +lemma f_aux_limit (n : ℕ) : |
| 83 | + tendsto (λx, (P_aux n).eval x * exp (-x⁻¹) / x^(2 * n)) (nhds_within 0 (Ioi 0)) (𝓝 0) := |
| 84 | +begin |
| 85 | + have A : tendsto (λx, (P_aux n).eval x) (nhds_within 0 (Ioi 0)) (𝓝 ((P_aux n).eval 0)) := |
| 86 | + (P_aux n).continuous_within_at, |
| 87 | + have B : tendsto (λx, exp (-x⁻¹) / x^(2 * n)) (nhds_within 0 (Ioi 0)) (𝓝 0), |
| 88 | + { convert (tendsto_pow_mul_exp_neg_at_top_nhds_0 (2 * n)).comp tendsto_inv_zero_at_top, |
| 89 | + ext x, |
| 90 | + field_simp }, |
| 91 | + convert A.mul B; |
| 92 | + simp [mul_div_assoc] |
| 93 | +end |
| 94 | + |
| 95 | +/-- Deduce from the limiting behavior at `0` of its derivative and general differentiability |
| 96 | +extension theorems that the auxiliary function `f_aux n` is differentiable at `0`, |
| 97 | +with derivative `0`. -/ |
| 98 | +lemma f_aux_deriv_zero (n : ℕ) : has_deriv_at (f_aux n) 0 0 := |
| 99 | +begin |
| 100 | + -- we check separately differentiability on the left and on the right |
| 101 | + have A : has_deriv_within_at (f_aux n) (0 : ℝ) (Iic 0) 0, |
| 102 | + { apply (has_deriv_at_const (0 : ℝ) (0 : ℝ)).has_deriv_within_at.congr, |
| 103 | + { assume y hy, |
| 104 | + simp at hy, |
| 105 | + simp [f_aux, hy] }, |
| 106 | + { simp [f_aux, le_refl] } }, |
| 107 | + have B : has_deriv_within_at (f_aux n) (0 : ℝ) (Ici 0) 0, |
| 108 | + { have diff : differentiable_on ℝ (f_aux n) (Ioi 0) := |
| 109 | + λx hx, (f_aux_deriv_pos n x hx).differentiable_at.differentiable_within_at, |
| 110 | + -- next line is the nontrivial bit of this proof, appealing to differentiability |
| 111 | + -- extension results. |
| 112 | + apply has_deriv_at_interval_left_endpoint_of_tendsto_deriv diff _ self_mem_nhds_within, |
| 113 | + { refine (f_aux_limit (n+1)).congr' _, |
| 114 | + apply mem_sets_of_superset self_mem_nhds_within (λx hx, _), |
| 115 | + simp [(f_aux_deriv_pos n x hx).deriv] }, |
| 116 | + { have : f_aux n 0 = 0, by simp [f_aux, le_refl], |
| 117 | + simp only [continuous_within_at, this], |
| 118 | + refine (f_aux_limit n).congr' _, |
| 119 | + apply mem_sets_of_superset self_mem_nhds_within (λx hx, _), |
| 120 | + have : ¬(x ≤ 0), by simpa using hx, |
| 121 | + simp [f_aux, this] } }, |
| 122 | + simpa using A.union B, |
| 123 | +end |
| 124 | + |
| 125 | +/-- At every point, the auxiliary function `f_aux n` has a derivative which is |
| 126 | +equal to `f_aux (n+1)`. -/ |
| 127 | +lemma f_aux_has_deriv_at (n : ℕ) (x : ℝ) : has_deriv_at (f_aux n) (f_aux (n+1) x) x := |
| 128 | +begin |
| 129 | + -- check separately the result for `x < 0`, where it is trivial, for `x > 0`, where it is done |
| 130 | + -- in `f_aux_deriv_pos`, and for `x = 0`, done in |
| 131 | + -- `f_aux_deriv_zero`. |
| 132 | + rcases lt_trichotomy x 0 with hx|hx|hx, |
| 133 | + { have : f_aux (n+1) x = 0, by simp [f_aux, le_of_lt hx], |
| 134 | + rw this, |
| 135 | + apply (has_deriv_at_const x (0 : ℝ)).congr_of_mem_nhds, |
| 136 | + have : Iio (0 : ℝ) ∈ 𝓝 x := gt_mem_nhds hx, |
| 137 | + filter_upwards [this], |
| 138 | + assume y hy, |
| 139 | + simp [f_aux, le_of_lt hy] }, |
| 140 | + { have : f_aux (n + 1) 0 = 0, by simp [f_aux, le_refl], |
| 141 | + rw [hx, this], |
| 142 | + exact f_aux_deriv_zero n }, |
| 143 | + { have : f_aux (n+1) x = (P_aux (n+1)).eval x * exp (-x⁻¹) / x^(2 * (n+1)), |
| 144 | + by simp [f_aux, not_le_of_gt hx], |
| 145 | + rw this, |
| 146 | + exact f_aux_deriv_pos n x hx }, |
| 147 | +end |
| 148 | + |
| 149 | +/-- The successive derivatives of the auxiliary function `f_aux 0` are the |
| 150 | +functions `f_aux n`, by induction. -/ |
| 151 | +lemma f_aux_iterated_deriv (n : ℕ) : iterated_deriv n (f_aux 0) = f_aux n := |
| 152 | +begin |
| 153 | + induction n with n IH, |
| 154 | + { simp }, |
| 155 | + { simp [iterated_deriv_succ, IH], |
| 156 | + ext x, |
| 157 | + exact (f_aux_has_deriv_at n x).deriv } |
| 158 | +end |
| 159 | + |
| 160 | +/-- The function `exp_neg_inv_glue` is smooth. -/ |
| 161 | +theorem smooth : times_cont_diff ℝ ⊤ (exp_neg_inv_glue) := |
| 162 | +begin |
| 163 | + rw ← f_aux_zero_eq, |
| 164 | + apply times_cont_diff_of_differentiable_iterated_deriv (λ m hm, _), |
| 165 | + rw f_aux_iterated_deriv m, |
| 166 | + exact λ x, (f_aux_has_deriv_at m x).differentiable_at |
| 167 | +end |
| 168 | + |
| 169 | +/-- The function `exp_neg_inv_glue` vanishes on `(-∞, 0]`. -/ |
| 170 | +lemma zero_of_nonpos {x : ℝ} (hx : x ≤ 0) : exp_neg_inv_glue x = 0 := |
| 171 | +by simp [exp_neg_inv_glue, hx] |
| 172 | + |
| 173 | +/-- The function `exp_neg_inv_glue` is positive on `(0, +∞)`. -/ |
| 174 | +lemma pos_of_pos {x : ℝ} (hx : 0 < x) : 0 < exp_neg_inv_glue x := |
| 175 | +by simp [exp_neg_inv_glue, not_le.2 hx, exp_pos] |
| 176 | + |
| 177 | +/-- The function exp_neg_inv_glue` is nonnegative. -/ |
| 178 | +lemma nonneg (x : ℝ) : 0 ≤ exp_neg_inv_glue x := |
| 179 | +begin |
| 180 | + cases le_or_gt x 0, |
| 181 | + { exact ge_of_eq (zero_of_nonpos h) }, |
| 182 | + { exact le_of_lt (pos_of_pos h) } |
| 183 | +end |
| 184 | + |
| 185 | +end exp_neg_inv_glue |
0 commit comments