Datasets:
Tasks:
Text Generation
Modalities:
Text
Sub-tasks:
language-modeling
Languages:
English
Size:
100K - 1M
License:
/- | |
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 } | |