Datasets:

Modalities:
Text
Languages:
English
Libraries:
Datasets
License:
File size: 14,472 Bytes
4365a98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
/-
Copyright (c) 2020 SΓ©bastien GouΓ«zel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: SΓ©bastien GouΓ«zel
-/
import analysis.calculus.deriv
import analysis.calculus.cont_diff

/-!
# One-dimensional iterated derivatives

We define the `n`-th derivative of a function `f : π•œ β†’ F` as a function
`iterated_deriv n f : π•œ β†’ F`, as well as a version on domains `iterated_deriv_within n f s : π•œ β†’ F`,
and prove their basic properties.

## Main definitions and results

Let `π•œ` be a nontrivially normed field, and `F` a normed vector space over `π•œ`. Let `f : π•œ β†’ F`.

* `iterated_deriv n f` is the `n`-th derivative of `f`, seen as a function from `π•œ` to `F`.
  It is defined as the `n`-th FrΓ©chet derivative (which is a multilinear map) applied to the
  vector `(1, ..., 1)`, to take advantage of all the existing framework, but we show that it
  coincides with the naive iterative definition.
* `iterated_deriv_eq_iterate` states that the `n`-th derivative of `f` is obtained by starting
  from `f` and differentiating it `n` times.
* `iterated_deriv_within n f s` is the `n`-th derivative of `f` within the domain `s`. It only
  behaves well when `s` has the unique derivative property.
* `iterated_deriv_within_eq_iterate` states that the `n`-th derivative of `f` in the domain `s` is
  obtained by starting from `f` and differentiating it `n` times within `s`. This only holds when
  `s` has the unique derivative property.

## Implementation details

The results are deduced from the corresponding results for the more general (multilinear) iterated
FrΓ©chet derivative. For this, we write `iterated_deriv n f` as the composition of
`iterated_fderiv π•œ n f` and a continuous linear equiv. As continuous linear equivs respect
differentiability and commute with differentiation, this makes it possible to prove readily that
the derivative of the `n`-th derivative is the `n+1`-th derivative in `iterated_deriv_within_succ`,
by translating the corresponding result `iterated_fderiv_within_succ_apply_left` for the
iterated FrΓ©chet derivative.
-/

noncomputable theory
open_locale classical topological_space big_operators
open filter asymptotics set


variables {π•œ : Type*} [nontrivially_normed_field π•œ]
variables {F : Type*} [normed_add_comm_group F] [normed_space π•œ F]
variables {E : Type*} [normed_add_comm_group E] [normed_space π•œ E]

/-- The `n`-th iterated derivative of a function from `π•œ` to `F`, as a function from `π•œ` to `F`. -/
def iterated_deriv (n : β„•) (f : π•œ β†’ F) (x : π•œ) : F :=
(iterated_fderiv π•œ n f x : ((fin n) β†’ π•œ) β†’ F) (Ξ»(i : fin n), 1)

/-- The `n`-th iterated derivative of a function from `π•œ` to `F` within a set `s`, as a function
from `π•œ` to `F`. -/
def iterated_deriv_within (n : β„•) (f : π•œ β†’ F) (s : set π•œ) (x : π•œ) : F :=
(iterated_fderiv_within π•œ n f s x : ((fin n) β†’ π•œ) β†’ F) (Ξ»(i : fin n), 1)

variables {n : β„•} {f : π•œ β†’ F} {s : set π•œ} {x : π•œ}

lemma iterated_deriv_within_univ :
  iterated_deriv_within n f univ = iterated_deriv n f :=
by { ext x, rw [iterated_deriv_within, iterated_deriv, iterated_fderiv_within_univ] }

/-! ### Properties of the iterated derivative within a set -/

lemma iterated_deriv_within_eq_iterated_fderiv_within :
  iterated_deriv_within n f s x
  = (iterated_fderiv_within π•œ n f s x : ((fin n) β†’ π•œ) β†’ F) (Ξ»(i : fin n), 1) := rfl

/-- Write the iterated derivative as the composition of a continuous linear equiv and the iterated
FrΓ©chet derivative -/
lemma iterated_deriv_within_eq_equiv_comp :
  iterated_deriv_within n f s
  = (continuous_multilinear_map.pi_field_equiv π•œ (fin n) F).symm ∘
    (iterated_fderiv_within π•œ n f s) :=
by { ext x, refl }

/-- Write the iterated FrΓ©chet derivative as the composition of a continuous linear equiv and the
iterated derivative. -/
lemma iterated_fderiv_within_eq_equiv_comp :
  iterated_fderiv_within π•œ n f s
  = (continuous_multilinear_map.pi_field_equiv π•œ (fin n) F) ∘ (iterated_deriv_within n f s) :=
by rw [iterated_deriv_within_eq_equiv_comp, ← function.comp.assoc,
  linear_isometry_equiv.self_comp_symm, function.left_id]

/-- The `n`-th FrΓ©chet derivative applied to a vector `(m 0, ..., m (n-1))` is the derivative
multiplied by the product of the `m i`s. -/
lemma iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod {m : (fin n) β†’ π•œ} :
  (iterated_fderiv_within π•œ n f s x : ((fin n) β†’ π•œ) β†’ F) m
  = (∏ i, m i) β€’ iterated_deriv_within n f s x :=
begin
  rw [iterated_deriv_within_eq_iterated_fderiv_within, ← continuous_multilinear_map.map_smul_univ],
  simp
end

@[simp] lemma iterated_deriv_within_zero :
  iterated_deriv_within 0 f s = f :=
by { ext x, simp [iterated_deriv_within] }

@[simp] lemma iterated_deriv_within_one (hs : unique_diff_on π•œ s) {x : π•œ} (hx : x ∈ s):
  iterated_deriv_within 1 f s x = deriv_within f s x :=
by { simp [iterated_deriv_within, iterated_fderiv_within_one_apply hs hx], refl }

/-- If the first `n` derivatives within a set of a function are continuous, and its first `n-1`
derivatives are differentiable, then the function is `C^n`. This is not an equivalence in general,
but this is an equivalence when the set has unique derivatives, see
`cont_diff_on_iff_continuous_on_differentiable_on_deriv`. -/
lemma cont_diff_on_of_continuous_on_differentiable_on_deriv {n : with_top β„•}
  (Hcont : βˆ€ (m : β„•), (m : with_top β„•) ≀ n β†’
    continuous_on (Ξ» x, iterated_deriv_within m f s x) s)
  (Hdiff : βˆ€ (m : β„•), (m : with_top β„•) < n β†’
    differentiable_on π•œ (Ξ» x, iterated_deriv_within m f s x) s) :
  cont_diff_on π•œ n f s :=
begin
  apply cont_diff_on_of_continuous_on_differentiable_on,
  { simpa [iterated_fderiv_within_eq_equiv_comp, linear_isometry_equiv.comp_continuous_on_iff] },
  { simpa [iterated_fderiv_within_eq_equiv_comp, linear_isometry_equiv.comp_differentiable_on_iff] }
end

/-- To check that a function is `n` times continuously differentiable, it suffices to check that its
first `n` derivatives are differentiable. This is slightly too strong as the condition we
require on the `n`-th derivative is differentiability instead of continuity, but it has the
advantage of avoiding the discussion of continuity in the proof (and for `n = ∞` this is optimal).
-/
lemma cont_diff_on_of_differentiable_on_deriv {n : with_top β„•}
  (h : βˆ€(m : β„•), (m : with_top β„•) ≀ n β†’ differentiable_on π•œ (iterated_deriv_within m f s) s) :
  cont_diff_on π•œ n f s :=
begin
  apply cont_diff_on_of_differentiable_on,
  simpa only [iterated_fderiv_within_eq_equiv_comp,
    linear_isometry_equiv.comp_differentiable_on_iff]
end

/-- On a set with unique derivatives, a `C^n` function has derivatives up to `n` which are
continuous. -/
lemma cont_diff_on.continuous_on_iterated_deriv_within {n : with_top β„•} {m : β„•}
  (h : cont_diff_on π•œ n f s) (hmn : (m : with_top β„•) ≀ n) (hs : unique_diff_on π•œ s) :
  continuous_on (iterated_deriv_within m f s) s :=
by simpa only [iterated_deriv_within_eq_equiv_comp, linear_isometry_equiv.comp_continuous_on_iff]
  using h.continuous_on_iterated_fderiv_within hmn hs

/-- On a set with unique derivatives, a `C^n` function has derivatives less than `n` which are
differentiable. -/
lemma cont_diff_on.differentiable_on_iterated_deriv_within {n : with_top β„•} {m : β„•}
  (h : cont_diff_on π•œ n f s) (hmn : (m : with_top β„•) < n) (hs : unique_diff_on π•œ s) :
  differentiable_on π•œ (iterated_deriv_within m f s) s :=
by simpa only [iterated_deriv_within_eq_equiv_comp,
  linear_isometry_equiv.comp_differentiable_on_iff]
  using h.differentiable_on_iterated_fderiv_within hmn hs

/-- The property of being `C^n`, initially defined in terms of the FrΓ©chet derivative, can be
reformulated in terms of the one-dimensional derivative on sets with unique derivatives. -/
lemma cont_diff_on_iff_continuous_on_differentiable_on_deriv {n : with_top β„•}
  (hs : unique_diff_on π•œ s) :
  cont_diff_on π•œ n f s ↔
  (βˆ€m:β„•, (m : with_top β„•) ≀ n β†’ continuous_on (iterated_deriv_within m f s) s)
  ∧ (βˆ€m:β„•, (m : with_top β„•) < n β†’ differentiable_on π•œ (iterated_deriv_within m f s) s) :=
by simp only [cont_diff_on_iff_continuous_on_differentiable_on hs,
  iterated_fderiv_within_eq_equiv_comp, linear_isometry_equiv.comp_continuous_on_iff,
  linear_isometry_equiv.comp_differentiable_on_iff]

/-- The `n+1`-th iterated derivative within a set with unique derivatives can be obtained by
differentiating the `n`-th iterated derivative. -/
lemma iterated_deriv_within_succ {x : π•œ} (hxs : unique_diff_within_at π•œ s x) :
  iterated_deriv_within (n + 1) f s x = deriv_within (iterated_deriv_within n f s) s x :=
begin
  rw [iterated_deriv_within_eq_iterated_fderiv_within, iterated_fderiv_within_succ_apply_left,
      iterated_fderiv_within_eq_equiv_comp, linear_isometry_equiv.comp_fderiv_within _ hxs,
      deriv_within],
  change ((continuous_multilinear_map.mk_pi_field π•œ (fin n)
    ((fderiv_within π•œ (iterated_deriv_within n f s) s x : π•œ β†’ F) 1)) : (fin n β†’ π•œ ) β†’ F)
    (Ξ» (i : fin n), 1)
    = (fderiv_within π•œ (iterated_deriv_within n f s) s x : π•œ β†’ F) 1,
  simp
end

/-- The `n`-th iterated derivative within a set with unique derivatives can be obtained by
iterating `n` times the differentiation operation. -/
lemma iterated_deriv_within_eq_iterate {x : π•œ} (hs : unique_diff_on π•œ s) (hx : x ∈ s) :
  iterated_deriv_within n f s x = ((Ξ» (g : π•œ β†’ F), deriv_within g s)^[n]) f x :=
begin
  induction n with n IH generalizing x,
  { simp },
  { rw [iterated_deriv_within_succ (hs x hx), function.iterate_succ'],
    exact deriv_within_congr (hs x hx) (Ξ» y hy, IH hy) (IH hx) }
end

/-- The `n+1`-th iterated derivative within a set with unique derivatives can be obtained by
taking the `n`-th derivative of the derivative. -/
lemma iterated_deriv_within_succ' {x : π•œ} (hxs : unique_diff_on π•œ s) (hx : x ∈ s) :
  iterated_deriv_within (n + 1) f s x = (iterated_deriv_within n (deriv_within f s) s) x :=
by { rw [iterated_deriv_within_eq_iterate hxs hx, iterated_deriv_within_eq_iterate hxs hx], refl }


/-! ### Properties of the iterated derivative on the whole space -/

lemma iterated_deriv_eq_iterated_fderiv :
  iterated_deriv n f x
  = (iterated_fderiv π•œ n f x : ((fin n) β†’ π•œ) β†’ F) (Ξ»(i : fin n), 1) := rfl

/-- Write the iterated derivative as the composition of a continuous linear equiv and the iterated
FrΓ©chet derivative -/
lemma iterated_deriv_eq_equiv_comp :
  iterated_deriv n f
  = (continuous_multilinear_map.pi_field_equiv π•œ (fin n) F).symm ∘ (iterated_fderiv π•œ n f) :=
by { ext x, refl }

/-- Write the iterated FrΓ©chet derivative as the composition of a continuous linear equiv and the
iterated derivative. -/
lemma iterated_fderiv_eq_equiv_comp :
  iterated_fderiv π•œ n f
  = (continuous_multilinear_map.pi_field_equiv π•œ (fin n) F) ∘ (iterated_deriv n f) :=
by rw [iterated_deriv_eq_equiv_comp, ← function.comp.assoc, linear_isometry_equiv.self_comp_symm,
  function.left_id]

/-- The `n`-th FrΓ©chet derivative applied to a vector `(m 0, ..., m (n-1))` is the derivative
multiplied by the product of the `m i`s. -/
lemma iterated_fderiv_apply_eq_iterated_deriv_mul_prod {m : (fin n) β†’ π•œ} :
  (iterated_fderiv π•œ n f x : ((fin n) β†’ π•œ) β†’ F) m = (∏ i, m i) β€’ iterated_deriv n f x :=
by { rw [iterated_deriv_eq_iterated_fderiv, ← continuous_multilinear_map.map_smul_univ], simp }

@[simp] lemma iterated_deriv_zero :
  iterated_deriv 0 f = f :=
by { ext x, simp [iterated_deriv] }

@[simp] lemma iterated_deriv_one :
  iterated_deriv 1 f = deriv f :=
by { ext x, simp [iterated_deriv], refl }

/-- The property of being `C^n`, initially defined in terms of the FrΓ©chet derivative, can be
reformulated in terms of the one-dimensional derivative. -/
lemma cont_diff_iff_iterated_deriv {n : with_top β„•} :
  cont_diff π•œ n f ↔
(βˆ€m:β„•, (m : with_top β„•) ≀ n β†’ continuous (iterated_deriv m f))
∧ (βˆ€m:β„•, (m : with_top β„•) < n β†’ differentiable π•œ (iterated_deriv m f)) :=
by simp only [cont_diff_iff_continuous_differentiable, iterated_fderiv_eq_equiv_comp,
  linear_isometry_equiv.comp_continuous_iff, linear_isometry_equiv.comp_differentiable_iff]

/-- To check that a function is `n` times continuously differentiable, it suffices to check that its
first `n` derivatives are differentiable. This is slightly too strong as the condition we
require on the `n`-th derivative is differentiability instead of continuity, but it has the
advantage of avoiding the discussion of continuity in the proof (and for `n = ∞` this is optimal).
-/
lemma cont_diff_of_differentiable_iterated_deriv {n : with_top β„•}
  (h : βˆ€(m : β„•), (m : with_top β„•) ≀ n β†’ differentiable π•œ (iterated_deriv m f)) :
  cont_diff π•œ n f :=
cont_diff_iff_iterated_deriv.2
  ⟨λ m hm, (h m hm).continuous, λ m hm, (h m (le_of_lt hm))⟩

lemma cont_diff.continuous_iterated_deriv {n : with_top β„•} (m : β„•)
  (h : cont_diff π•œ n f) (hmn : (m : with_top β„•) ≀ n) :
  continuous (iterated_deriv m f) :=
(cont_diff_iff_iterated_deriv.1 h).1 m hmn

lemma cont_diff.differentiable_iterated_deriv {n : with_top β„•} (m : β„•)
  (h : cont_diff π•œ n f) (hmn : (m : with_top β„•) < n) :
  differentiable π•œ (iterated_deriv m f) :=
(cont_diff_iff_iterated_deriv.1 h).2 m hmn

/-- The `n+1`-th iterated derivative can be obtained by differentiating the `n`-th
iterated derivative. -/
lemma iterated_deriv_succ : iterated_deriv (n + 1) f = deriv (iterated_deriv n f) :=
begin
  ext x,
  rw [← iterated_deriv_within_univ, ← iterated_deriv_within_univ, ← deriv_within_univ],
  exact iterated_deriv_within_succ unique_diff_within_at_univ,
end

/-- The `n`-th iterated derivative can be obtained by iterating `n` times the
differentiation operation. -/
lemma iterated_deriv_eq_iterate : iterated_deriv n f = (deriv^[n]) f :=
begin
  ext x,
  rw [← iterated_deriv_within_univ],
  convert iterated_deriv_within_eq_iterate unique_diff_on_univ (mem_univ x),
  simp [deriv_within_univ]
end

/-- The `n+1`-th iterated derivative can be obtained by taking the `n`-th derivative of the
derivative. -/
lemma iterated_deriv_succ' : iterated_deriv (n + 1) f = iterated_deriv n (deriv f) :=
by { rw [iterated_deriv_eq_iterate, iterated_deriv_eq_iterate], refl }