Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit e003014

Browse files
feat(analysis/calculus/iterated_deriv): iterated derivative of a function defined on the base field (#2067)
* iterated deriv * cleanup * fix docstring * add iterated_deriv_within_succ' * remove n.succ * n+1 -> n + 1 Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 262a39e commit e003014

File tree

2 files changed

+337
-39
lines changed

2 files changed

+337
-39
lines changed
Lines changed: 296 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,296 @@
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+
import analysis.calculus.deriv analysis.calculus.times_cont_diff
7+
8+
/-!
9+
# One-dimensional iterated derivatives
10+
11+
We define the `n`-th derivative of a function `f : 𝕜 → F` as a function
12+
`iterated_deriv n f : 𝕜 → F`, as well as a version on domains `iterated_deriv_within n f s : 𝕜 → F`,
13+
and prove their basic properties.
14+
15+
## Main definitions and results
16+
17+
Let `𝕜` be a nondiscrete normed field, and `F` a normed vector space over `𝕜`. Let `f : 𝕜 → F`.
18+
19+
* `iterated_deriv n f` is the `n`-th derivative of `f`, seen as a function from `𝕜` to `F`.
20+
It is defined as the `n`-th Fréchet derivative (which is a multilinear map) applied to the
21+
vector `(1, ..., 1)`, to take advantage of all the existing framework, but we show that it
22+
coincides with the naive iterative definition.
23+
* `iterated_deriv_eq_iterate` states that the `n`-th derivative of `f` is obtained by starting
24+
from `f` and differentiating it `n` times.
25+
* `iterated_deriv_within n f s` is the `n`-th derivative of `f` within the domain `s`. It only
26+
behaves well when `s` has the unique derivative property.
27+
* `iterated_deriv_within_eq_iterate` states that the `n`-th derivative of `f` in the domain `s` is
28+
obtained by starting from `f` and differentiating it `n` times within `s`. This only holds when
29+
`s` has the unique derivative property.
30+
31+
## Implementation details
32+
33+
The results are deduced from the corresponding results for the more general (multilinear) iterated
34+
Fréchet derivative. For this, we write `iterated_deriv n f` as the composition of
35+
`iterated_fderiv 𝕜 n f` and a continuous linear equiv. As continuous linear equivs respect
36+
differentiability and commute with differentiation, this makes it possible to prove readily that
37+
the derivative of the `n`-th derivative is the `n+1`-th derivative in `iterated_deriv_within_succ`,
38+
by translating the corresponding result `iterated_fderiv_within_succ_apply_left` for the
39+
iterated Fréchet derivative.
40+
-/
41+
42+
noncomputable theory
43+
open_locale classical topological_space
44+
open filter asymptotics set
45+
46+
set_option class.instance_max_depth 110
47+
48+
variables {𝕜 : Type*} [nondiscrete_normed_field 𝕜]
49+
variables {F : Type*} [normed_group F] [normed_space 𝕜 F]
50+
variables {E : Type*} [normed_group E] [normed_space 𝕜 E]
51+
52+
/-- The `n`-th iterated derivative of a function from `𝕜` to `F`, as a function from `𝕜` to `F`. -/
53+
def iterated_deriv (n : ℕ) (f : 𝕜 → F) (x : 𝕜) : F :=
54+
(iterated_fderiv 𝕜 n f x : ((fin n) → 𝕜) → F) (λ(i : fin n), 1)
55+
56+
/-- The `n`-th iterated derivative of a function from `𝕜` to `F` within a set `s`, as a function
57+
from `𝕜` to `F`. -/
58+
def iterated_deriv_within (n : ℕ) (f : 𝕜 → F) (s : set 𝕜) (x : 𝕜) : F :=
59+
(iterated_fderiv_within 𝕜 n f s x : ((fin n) → 𝕜) → F) (λ(i : fin n), 1)
60+
61+
variables {n : ℕ} {f : 𝕜 → F} {s : set 𝕜} {x : 𝕜}
62+
63+
lemma iterated_deriv_within_univ :
64+
iterated_deriv_within n f univ = iterated_deriv n f :=
65+
by { ext x, rw [iterated_deriv_within, iterated_deriv, iterated_fderiv_within_univ] }
66+
67+
/-! ### Properties of the iterated derivative within a set -/
68+
69+
lemma iterated_deriv_within_eq_iterated_fderiv_within :
70+
iterated_deriv_within n f s x
71+
= (iterated_fderiv_within 𝕜 n f s x : ((fin n) → 𝕜) → F) (λ(i : fin n), 1) := rfl
72+
73+
/-- Write the iterated derivative as the composition of a continuous linear equiv and the iterated
74+
Fréchet derivative -/
75+
lemma iterated_deriv_within_eq_equiv_comp :
76+
iterated_deriv_within n f s
77+
= (continuous_multilinear_map.pi_field_equiv 𝕜 (fin n) F).symm ∘ (iterated_fderiv_within 𝕜 n f s) :=
78+
by { ext x, refl }
79+
80+
/-- Write the iterated Fréchet derivative as the composition of a continuous linear equiv and the
81+
iterated derivative. -/
82+
lemma iterated_fderiv_within_eq_equiv_comp :
83+
iterated_fderiv_within 𝕜 n f s
84+
= (continuous_multilinear_map.pi_field_equiv 𝕜 (fin n) F) ∘ (iterated_deriv_within n f s) :=
85+
begin
86+
rw [iterated_deriv_within_eq_equiv_comp, ← function.comp.assoc,
87+
continuous_linear_equiv.self_comp_symm],
88+
refl
89+
end
90+
91+
/-- The `n`-th Fréchet derivative applied to a vector `(m 0, ..., m (n-1))` is the derivative
92+
multiplied by the product of the `m i`s. -/
93+
lemma iterated_fderiv_within_apply_eq_iterated_deriv_within_mul_prod {m : (fin n) → 𝕜} :
94+
(iterated_fderiv_within 𝕜 n f s x : ((fin n) → 𝕜) → F) m
95+
= finset.univ.prod m • iterated_deriv_within n f s x :=
96+
begin
97+
rw [iterated_deriv_within_eq_iterated_fderiv_within, ← continuous_multilinear_map.map_smul_univ],
98+
simp
99+
end
100+
101+
@[simp] lemma iterated_deriv_within_zero :
102+
iterated_deriv_within 0 f s = f :=
103+
by { ext x, simp [iterated_deriv_within] }
104+
105+
@[simp] lemma iterated_deriv_within_one (hs : unique_diff_on 𝕜 s) {x : 𝕜} (hx : x ∈ s):
106+
iterated_deriv_within 1 f s x = deriv_within f s x :=
107+
by { simp [iterated_deriv_within, iterated_fderiv_within_one_apply hs hx], refl }
108+
109+
/-- If the first `n` derivatives within a set of a function are continuous, and its first `n-1`
110+
derivatives are differentiable, then the function is `C^n`. This is not an equivalence in general,
111+
but this is an equivalence when the set has unique derivatives, see
112+
`times_cont_diff_on_iff_continuous_on_differentiable_on_deriv`. -/
113+
lemma times_cont_diff_on_of_continuous_on_differentiable_on_deriv {n : with_top ℕ}
114+
(Hcont : ∀ (m : ℕ), (m : with_top ℕ) ≤ n →
115+
continuous_on (λ x, iterated_deriv_within m f s x) s)
116+
(Hdiff : ∀ (m : ℕ), (m : with_top ℕ) < n →
117+
differentiable_on 𝕜 (λ x, iterated_deriv_within m f s x) s) :
118+
times_cont_diff_on 𝕜 n f s :=
119+
begin
120+
apply times_cont_diff_on_of_continuous_on_differentiable_on,
121+
{ simpa [iterated_fderiv_within_eq_equiv_comp, continuous_linear_equiv.comp_continuous_on_iff] },
122+
{ simpa [iterated_fderiv_within_eq_equiv_comp, continuous_linear_equiv.comp_differentiable_on_iff] }
123+
end
124+
125+
/-- To check that a function is `n` times continuously differentiable, it suffices to check that its
126+
first `n` derivatives are differentiable. This is slightly too strong as the condition we
127+
require on the `n`-th derivative is differentiability instead of continuity, but it has the
128+
advantage of avoiding the discussion of continuity in the proof (and for `n = ∞` this is optimal).
129+
-/
130+
lemma times_cont_diff_on_of_differentiable_on_deriv {n : with_top ℕ}
131+
(h : ∀(m : ℕ), (m : with_top ℕ) ≤ n → differentiable_on 𝕜 (iterated_deriv_within m f s) s) :
132+
times_cont_diff_on 𝕜 n f s :=
133+
begin
134+
apply times_cont_diff_on_of_differentiable_on,
135+
simpa [iterated_fderiv_within_eq_equiv_comp,
136+
continuous_linear_equiv.comp_differentiable_on_iff, -coe_fn_coe_base],
137+
end
138+
139+
/-- On a set with unique derivatives, a `C^n` function has derivatives up to `n` which are
140+
continuous. -/
141+
lemma times_cont_diff_on.continuous_on_iterated_deriv_within {n : with_top ℕ} {m : ℕ}
142+
(h : times_cont_diff_on 𝕜 n f s) (hmn : (m : with_top ℕ) ≤ n) (hs : unique_diff_on 𝕜 s) :
143+
continuous_on (iterated_deriv_within m f s) s :=
144+
begin
145+
simp [iterated_deriv_within_eq_equiv_comp, continuous_linear_equiv.comp_continuous_on_iff,
146+
-coe_fn_coe_base],
147+
exact h.continuous_on_iterated_fderiv_within hmn hs
148+
end
149+
150+
/-- On a set with unique derivatives, a `C^n` function has derivatives less than `n` which are
151+
differentiable. -/
152+
lemma times_cont_diff_on.differentiable_on_iterated_deriv_within {n : with_top ℕ} {m : ℕ}
153+
(h : times_cont_diff_on 𝕜 n f s) (hmn : (m : with_top ℕ) < n) (hs : unique_diff_on 𝕜 s) :
154+
differentiable_on 𝕜 (iterated_deriv_within m f s) s :=
155+
begin
156+
simp [iterated_deriv_within_eq_equiv_comp, continuous_linear_equiv.comp_differentiable_on_iff,
157+
-coe_fn_coe_base],
158+
exact h.differentiable_on_iterated_fderiv_within hmn hs
159+
end
160+
161+
/-- The property of being `C^n`, initially defined in terms of the Fréchet derivative, can be
162+
reformulated in terms of the one-dimensional derivative on sets with unique derivatives. -/
163+
lemma times_cont_diff_on_iff_continuous_on_differentiable_on_deriv {n : with_top ℕ}
164+
(hs : unique_diff_on 𝕜 s) :
165+
times_cont_diff_on 𝕜 n f s ↔
166+
(∀m:ℕ, (m : with_top ℕ) ≤ n → continuous_on (iterated_deriv_within m f s) s)
167+
∧ (∀m:ℕ, (m : with_top ℕ) < n → differentiable_on 𝕜 (iterated_deriv_within m f s) s) :=
168+
by simp only [times_cont_diff_on_iff_continuous_on_differentiable_on hs,
169+
iterated_fderiv_within_eq_equiv_comp, continuous_linear_equiv.comp_continuous_on_iff,
170+
continuous_linear_equiv.comp_differentiable_on_iff]
171+
172+
/-- The `n+1`-th iterated derivative within a set with unique derivatives can be obtained by
173+
differentiating the `n`-th iterated derivative. -/
174+
lemma iterated_deriv_within_succ {x : 𝕜} (hxs : unique_diff_within_at 𝕜 s x) :
175+
iterated_deriv_within (n + 1) f s x = deriv_within (iterated_deriv_within n f s) s x :=
176+
begin
177+
rw [iterated_deriv_within_eq_iterated_fderiv_within, iterated_fderiv_within_succ_apply_left,
178+
iterated_fderiv_within_eq_equiv_comp, continuous_linear_equiv.comp_fderiv_within _ hxs,
179+
deriv_within],
180+
change ((continuous_multilinear_map.mk_pi_field 𝕜 (fin n)
181+
((fderiv_within 𝕜 (iterated_deriv_within n f s) s x : 𝕜 → F) 1)) : (fin n → 𝕜 ) → F)
182+
(λ (i : fin n), 1)
183+
= (fderiv_within 𝕜 (iterated_deriv_within n f s) s x : 𝕜 → F) 1,
184+
simp
185+
end
186+
187+
/-- The `n`-th iterated derivative within a set with unique derivatives can be obtained by
188+
iterating `n` times the differentiation operation. -/
189+
lemma iterated_deriv_within_eq_iterate {x : 𝕜} (hs : unique_diff_on 𝕜 s) (hx : x ∈ s) :
190+
iterated_deriv_within n f s x = nat.iterate (λ (g : 𝕜 → F), deriv_within g s) n f x :=
191+
begin
192+
induction n with n IH generalizing x,
193+
{ simp },
194+
{ rw [iterated_deriv_within_succ (hs x hx), nat.iterate_succ'],
195+
exact deriv_within_congr (hs x hx) (λ y hy, IH hy) (IH hx) }
196+
end
197+
198+
/-- The `n+1`-th iterated derivative within a set with unique derivatives can be obtained by
199+
taking the `n`-th derivative of the derivative. -/
200+
lemma iterated_deriv_within_succ' {x : 𝕜} (hxs : unique_diff_on 𝕜 s) (hx : x ∈ s) :
201+
iterated_deriv_within (n + 1) f s x = (iterated_deriv_within n (deriv_within f s) s) x :=
202+
by { rw [iterated_deriv_within_eq_iterate hxs hx, iterated_deriv_within_eq_iterate hxs hx], refl }
203+
204+
205+
/-! ### Properties of the iterated derivative on the whole space -/
206+
207+
lemma iterated_deriv_eq_iterated_fderiv :
208+
iterated_deriv n f x
209+
= (iterated_fderiv 𝕜 n f x : ((fin n) → 𝕜) → F) (λ(i : fin n), 1) := rfl
210+
211+
/-- Write the iterated derivative as the composition of a continuous linear equiv and the iterated
212+
Fréchet derivative -/
213+
lemma iterated_deriv_eq_equiv_comp :
214+
iterated_deriv n f
215+
= (continuous_multilinear_map.pi_field_equiv 𝕜 (fin n) F).symm ∘ (iterated_fderiv 𝕜 n f) :=
216+
by { ext x, refl }
217+
218+
/-- Write the iterated Fréchet derivative as the composition of a continuous linear equiv and the
219+
iterated derivative. -/
220+
lemma iterated_fderiv_eq_equiv_comp :
221+
iterated_fderiv 𝕜 n f
222+
= (continuous_multilinear_map.pi_field_equiv 𝕜 (fin n) F) ∘ (iterated_deriv n f) :=
223+
begin
224+
rw [iterated_deriv_eq_equiv_comp, ← function.comp.assoc,
225+
continuous_linear_equiv.self_comp_symm],
226+
refl
227+
end
228+
229+
/-- The `n`-th Fréchet derivative applied to a vector `(m 0, ..., m (n-1))` is the derivative
230+
multiplied by the product of the `m i`s. -/
231+
lemma iterated_fderiv_apply_eq_iterated_deriv_mul_prod {m : (fin n) → 𝕜} :
232+
(iterated_fderiv 𝕜 n f x : ((fin n) → 𝕜) → F) m = finset.univ.prod m • iterated_deriv n f x :=
233+
by { rw [iterated_deriv_eq_iterated_fderiv, ← continuous_multilinear_map.map_smul_univ], simp }
234+
235+
@[simp] lemma iterated_deriv_zero :
236+
iterated_deriv 0 f = f :=
237+
by { ext x, simp [iterated_deriv] }
238+
239+
@[simp] lemma iterated_deriv_one :
240+
iterated_deriv 1 f = deriv f :=
241+
by { ext x, simp [iterated_deriv], refl }
242+
243+
/-- The property of being `C^n`, initially defined in terms of the Fréchet derivative, can be
244+
reformulated in terms of the one-dimensional derivative. -/
245+
lemma times_cont_diff_iff_iterated_deriv {n : with_top ℕ} :
246+
times_cont_diff 𝕜 n f ↔
247+
(∀m:ℕ, (m : with_top ℕ) ≤ n → continuous (iterated_deriv m f))
248+
∧ (∀m:ℕ, (m : with_top ℕ) < n → differentiable 𝕜 (iterated_deriv m f)) :=
249+
by simp only [times_cont_diff_iff_continuous_differentiable, iterated_fderiv_eq_equiv_comp,
250+
continuous_linear_equiv.comp_continuous_iff,
251+
continuous_linear_equiv.comp_differentiable_iff]
252+
253+
/-- To check that a function is `n` times continuously differentiable, it suffices to check that its
254+
first `n` derivatives are differentiable. This is slightly too strong as the condition we
255+
require on the `n`-th derivative is differentiability instead of continuity, but it has the
256+
advantage of avoiding the discussion of continuity in the proof (and for `n = ∞` this is optimal).
257+
-/
258+
lemma times_cont_diff_of_differentiable_iterated_deriv {n : with_top ℕ}
259+
(h : ∀(m : ℕ), (m : with_top ℕ) ≤ n → differentiable 𝕜 (iterated_deriv m f)) :
260+
times_cont_diff 𝕜 n f :=
261+
times_cont_diff_iff_iterated_deriv.2
262+
⟨λ m hm, (h m hm).continuous, λ m hm, (h m (le_of_lt hm))⟩
263+
264+
lemma times_cont_diff.continuous_iterated_deriv {n : with_top ℕ} (m : ℕ)
265+
(h : times_cont_diff 𝕜 n f) (hmn : (m : with_top ℕ) ≤ n) :
266+
continuous (iterated_deriv m f) :=
267+
(times_cont_diff_iff_iterated_deriv.1 h).1 m hmn
268+
269+
lemma times_cont_diff.differentiable_iterated_deriv {n : with_top ℕ} (m : ℕ)
270+
(h : times_cont_diff 𝕜 n f) (hmn : (m : with_top ℕ) < n) :
271+
differentiable 𝕜 (iterated_deriv m f) :=
272+
(times_cont_diff_iff_iterated_deriv.1 h).2 m hmn
273+
274+
/-- The `n+1`-th iterated derivative can be obtained by differentiating the `n`-th
275+
iterated derivative. -/
276+
lemma iterated_deriv_succ : iterated_deriv (n + 1) f = deriv (iterated_deriv n f) :=
277+
begin
278+
ext x,
279+
rw [← iterated_deriv_within_univ, ← iterated_deriv_within_univ, ← deriv_within_univ],
280+
exact iterated_deriv_within_succ unique_diff_within_at_univ,
281+
end
282+
283+
/-- The `n`-th iterated derivative can be obtained by iterating `n` times the
284+
differentiation operation. -/
285+
lemma iterated_deriv_eq_iterate : iterated_deriv n f = nat.iterate deriv n f :=
286+
begin
287+
ext x,
288+
rw [← iterated_deriv_within_univ],
289+
convert iterated_deriv_within_eq_iterate unique_diff_on_univ (mem_univ x),
290+
simp [deriv_within_univ]
291+
end
292+
293+
/-- The `n+1`-th iterated derivative can be obtained by taking the `n`-th derivative of the
294+
derivative. -/
295+
lemma iterated_deriv_succ' : iterated_deriv (n + 1) f = iterated_deriv n (deriv f) :=
296+
by { rw [iterated_deriv_eq_iterate, iterated_deriv_eq_iterate], refl }

0 commit comments

Comments
 (0)