Higher differentiability #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
A function is C^1
on a domain if it is differentiable there, and its derivative is continuous.
By induction, it is C^n
if it is C^{n-1}
and its (n-1)-th derivative is C^1
there or,
equivalently, if it is C^1
and its derivative is C^{n-1}
.
Finally, it is C^∞
if it is C^n
for all n.
We formalize these notions by defining iteratively the n+1
-th derivative of a function as the
derivative of the n
-th derivative. It is called iterated_fderiv 𝕜 n f x
where 𝕜
is the
field, n
is the number of iterations, f
is the function and x
is the point, and it is given
as an n
-multilinear map. We also define a version iterated_fderiv_within
relative to a domain,
as well as predicates cont_diff_within_at
, cont_diff_at
, cont_diff_on
and
cont_diff
saying that the function is C^n
within a set at a point, at a point, on a set
and on the whole space respectively.
To avoid the issue of choice when choosing a derivative in sets where the derivative is not
necessarily unique, cont_diff_on
is not defined directly in terms of the
regularity of the specific choice iterated_fderiv_within 𝕜 n f s
inside s
, but in terms of the
existence of a nice sequence of derivatives, expressed with a predicate
has_ftaylor_series_up_to_on
.
We prove basic properties of these notions.
Main definitions and results #
Let f : E → F
be a map between normed vector spaces over a nontrivially normed field 𝕜
.
has_ftaylor_series_up_to n f p
: expresses that the formal multilinear seriesp
is a sequence of iterated derivatives off
, up to then
-th term (wheren
is a natural number or∞
).has_ftaylor_series_up_to_on n f p s
: same thing, but inside a sets
. The notion of derivative is now taken insides
. In particular, derivatives don't have to be unique.cont_diff 𝕜 n f
: expresses thatf
isC^n
, i.e., it admits a Taylor series up to rankn
.cont_diff_on 𝕜 n f s
: expresses thatf
isC^n
ins
.cont_diff_at 𝕜 n f x
: expresses thatf
isC^n
aroundx
.cont_diff_within_at 𝕜 n f s x
: expresses thatf
isC^n
aroundx
within the sets
.iterated_fderiv_within 𝕜 n f s x
is ann
-th derivative off
over the field𝕜
on the sets
at the pointx
. It is a continuous multilinear map fromE^n
toF
, defined as a derivative withins
ofiterated_fderiv_within 𝕜 (n-1) f s
if one exists, and0
otherwise.iterated_fderiv 𝕜 n f x
is then
-th derivative off
over the field𝕜
at the pointx
. It is a continuous multilinear map fromE^n
toF
, defined as a derivative ofiterated_fderiv 𝕜 (n-1) f
if one exists, and0
otherwise.
In sets of unique differentiability, cont_diff_on 𝕜 n f s
can be expressed in terms of the
properties of iterated_fderiv_within 𝕜 m f s
for m ≤ n
. In the whole space,
cont_diff 𝕜 n f
can be expressed in terms of the properties of iterated_fderiv 𝕜 m f
for m ≤ n
.
Implementation notes #
The definitions in this file are designed to work on any field 𝕜
. They are sometimes slightly more
complicated than the naive definitions one would guess from the intuition over the real or complex
numbers, but they are designed to circumvent the lack of gluing properties and partitions of unity
in general. In the usual situations, they coincide with the usual definitions.
Definition of C^n
functions in domains #
One could define C^n
functions in a domain s
by fixing an arbitrary choice of derivatives (this
is what we do with iterated_fderiv_within
) and requiring that all these derivatives up to n
are
continuous. If the derivative is not unique, this could lead to strange behavior like two C^n
functions f
and g
on s
whose sum is not C^n
. A better definition is thus to say that a
function is C^n
inside s
if it admits a sequence of derivatives up to n
inside s
.
This definition still has the problem that a function which is locally C^n
would not need to
be C^n
, as different choices of sequences of derivatives around different points might possibly
not be glued together to give a globally defined sequence of derivatives. (Note that this issue
can not happen over reals, thanks to partition of unity, but the behavior over a general field is
not so clear, and we want a definition for general fields). Also, there are locality
problems for the order parameter: one could image a function which, for each n
, has a nice
sequence of derivatives up to order n
, but they do not coincide for varying n
and can therefore
not be glued to give rise to an infinite sequence of derivatives. This would give a function
which is C^n
for all n
, but not C^∞
. We solve this issue by putting locality conditions
in space and order in our definition of cont_diff_within_at
and cont_diff_on
.
The resulting definition is slightly more complicated to work with (in fact not so much), but it
gives rise to completely satisfactory theorems.
For instance, with this definition, a real function which is C^m
(but not better) on (-1/m, 1/m)
for each natural m
is by definition C^∞
at 0
.
There is another issue with the definition of cont_diff_within_at 𝕜 n f s x
. We can
require the existence and good behavior of derivatives up to order n
on a neighborhood of x
within s
. However, this does not imply continuity or differentiability within s
of the function
at x
when x
does not belong to s
. Therefore, we require such existence and good behavior on
a neighborhood of x
within s ∪ {x}
(which appears as insert x s
in this file).
Side of the composition, and universe issues #
With a naïve direct definition, the n
-th derivative of a function belongs to the space
E →L[𝕜] (E →L[𝕜] (E ... F)...)))
where there are n iterations of E →L[𝕜]
. This space
may also be seen as the space of continuous multilinear functions on n
copies of E
with
values in F
, by uncurrying. This is the point of view that is usually adopted in textbooks,
and that we also use. This means that the definition and the first proofs are slightly involved,
as one has to keep track of the uncurrying operation. The uncurrying can be done from the
left or from the right, amounting to defining the n+1
-th derivative either as the derivative of
the n
-th derivative, or as the n
-th derivative of the derivative.
For proofs, it would be more convenient to use the latter approach (from the right),
as it means to prove things at the n+1
-th step we only need to understand well enough the
derivative in E →L[𝕜] F
(contrary to the approach from the left, where one would need to know
enough on the n
-th derivative to deduce things on the n+1
-th derivative).
However, the definition from the right leads to a universe polymorphism problem: if we define
iterated_fderiv 𝕜 (n + 1) f x = iterated_fderiv 𝕜 n (fderiv 𝕜 f) x
by induction, we need to
generalize over all spaces (as f
and fderiv 𝕜 f
don't take values in the same space). It is
only possible to generalize over all spaces in some fixed universe in an inductive definition.
For f : E → F
, then fderiv 𝕜 f
is a map E → (E →L[𝕜] F)
. Therefore, the definition will only
work if F
and E →L[𝕜] F
are in the same universe.
This issue does not appear with the definition from the left, where one does not need to generalize
over all spaces. Therefore, we use the definition from the left. This means some proofs later on
become a little bit more complicated: to prove that a function is C^n
, the most efficient approach
is to exhibit a formula for its n
-th derivative and prove it is continuous (contrary to the
inductive approach where one would prove smoothness statements without giving a formula for the
derivative). In the end, this approach is still satisfactory as it is good to have formulas for the
iterated derivatives in various constructions.
One point where we depart from this explicit approach is in the proof of smoothness of a
composition: there is a formula for the n
-th derivative of a composition (Faà di Bruno's formula),
but it is very complicated and barely usable, while the inductive proof is very simple. Thus, we
give the inductive proof. As explained above, it works by generalizing over the target space, hence
it only works well if all spaces belong to the same universe. To get the general version, we lift
things to a common universe using a trick.
Variables management #
The textbook definitions and proofs use various identifications and abuse of notations, for instance
when saying that the natural space in which the derivative lives, i.e.,
E →L[𝕜] (E →L[𝕜] ( ... →L[𝕜] F))
, is the same as a space of multilinear maps. When doing things
formally, we need to provide explicit maps for these identifications, and chase some diagrams to see
everything is compatible with the identifications. In particular, one needs to check that taking the
derivative and then doing the identification, or first doing the identification and then taking the
derivative, gives the same result. The key point for this is that taking the derivative commutes
with continuous linear equivalences. Therefore, we need to implement all our identifications with
continuous linear equivs.
Notations #
We use the notation E [×n]→L[𝕜] F
for the space of continuous multilinear maps on E^n
with
values in F
. This is the space in which the n
-th derivative of a function from E
to F
lives.
In this file, we denote ⊤ : ℕ∞
with ∞
.
Tags #
derivative, differentiability, higher derivative, C^n
, multilinear, Taylor series, formal series
Functions with a Taylor series on a domain #
- zero_eq : ∀ (x : E), x ∈ s → (p x 0).uncurry0 = f x
- fderiv_within : ∀ (m : ℕ), ↑m < n → ∀ (x : E), x ∈ s → has_fderiv_within_at (λ (y : E), p y m) (p x m.succ).curry_left s x
- cont : ∀ (m : ℕ), ↑m ≤ n → continuous_on (λ (x : E), p x m) s
has_ftaylor_series_up_to_on n f p s
registers the fact that p 0 = f
and p (m+1)
is a
derivative of p m
for m < n
, and is continuous for m ≤ n
. This is a predicate analogous to
has_fderiv_within_at
but for higher order derivatives.
If two functions coincide on a set s
, then a Taylor series for the first one is as well a
Taylor series for the second one.
In the case that n = ∞
we don't need the continuity assumption in
has_ftaylor_series_up_to_on
.
If a function has a Taylor series at order at least 1
, then the term of order 1
of this
series is a derivative of f
.
If a function has a Taylor series at order at least 1
on a neighborhood of x
, then the term
of order 1
of this series is a derivative of f
at x
.
If a function has a Taylor series at order at least 1
on a neighborhood of x
, then
in a neighborhood of x
, the term of order 1
of this series is a derivative of f
.
If a function has a Taylor series at order at least 1
on a neighborhood of x
, then
it is differentiable at x
.
p
is a Taylor series of f
up to n+1
if and only if p
is a Taylor series up to n
, and
p (n + 1)
is a derivative of p n
.
p
is a Taylor series of f
up to n+1
if and only if p.shift
is a Taylor series up to n
for p 1
, which is a derivative of f
.
Smooth functions within a set around a point #
A function is continuously differentiable up to order n
within a set s
at a point x
if
it admits continuous derivatives up to order n
in a neighborhood of x
in s ∪ {x}
.
For n = ∞
, we only require that this holds up to any finite order (where the neighborhood may
depend on the finite order we consider).
For instance, a real function which is C^m
on (-1/m, 1/m)
for each natural m
, but not
better, is C^∞
at 0
within univ
.
Equations
- cont_diff_within_at 𝕜 n f s x = ∀ (m : ℕ), ↑m ≤ n → (∃ (u : set E) (H : u ∈ nhds_within x (has_insert.insert x s)) (p : E → formal_multilinear_series 𝕜 E F), has_ftaylor_series_up_to_on ↑m f p u)
Alias of the forward direction of cont_diff_within_at_insert
.
Alias of the reverse direction of cont_diff_within_at_insert
.
If a function is C^n
within a set at a point, with n ≥ 1
, then it is differentiable
within this set at this point.
A function is C^(n + 1)
on a domain iff locally, it has a derivative which is C^n
.
A version of cont_diff_within_at_succ_iff_has_fderiv_within_at
where all derivatives
are taken within the same set.
Smooth functions within a set #
A function is continuously differentiable up to n
on s
if, for any point x
in s
, it
admits continuous derivatives up to order n
on a neighborhood of x
in s
.
For n = ∞
, we only require that this holds up to any finite order (where the neighborhood may
depend on the finite order we consider).
Equations
- cont_diff_on 𝕜 n f s = ∀ (x : E), x ∈ s → cont_diff_within_at 𝕜 n f s x
If a function is C^n
on a set with n ≥ 1
, then it is differentiable there.
If a function is C^n
around each point in a set, then it is C^n
on the set.
A function is C^(n + 1)
on a domain iff locally, it has a derivative which is C^n
.
Iterated derivative within a set #
The n
-th derivative of a function along a set, defined inductively by saying that the n+1
-th
derivative of f
is the derivative of the n
-th derivative of f
along this set, together with
an uncurrying step to see it as a multilinear map in n+1
variables..
Equations
- iterated_fderiv_within 𝕜 n f s = n.rec_on (λ (x : E), continuous_multilinear_map.curry0 𝕜 E (f x)) (λ (n : ℕ) (rec : E → continuous_multilinear_map 𝕜 (λ (i : fin n), E) F) (x : E), (fderiv_within 𝕜 rec s x).uncurry_left)
Formal Taylor series associated to a function within a set.
Equations
- ftaylor_series_within 𝕜 f s x = λ (n : ℕ), iterated_fderiv_within 𝕜 n f s x
Writing explicitly the n+1
-th derivative as the composition of a currying linear equiv,
and the derivative of the n
-th derivative.
Writing explicitly the n+1
-th derivative as the composition of a currying linear equiv,
and the n
-th derivative of the derivative.
If two functions coincide in a neighborhood of x
within a set s
and at x
, then their
iterated differentials within this set at x
coincide.
If two functions coincide on a set s
, then their iterated differentials within this set
coincide. See also filter.eventually_eq.iterated_fderiv_within_eq
and
filter.eventually_eq.iterated_fderiv_within
.
If two functions coincide on a set s
, then their iterated differentials within this set
coincide. See also filter.eventually_eq.iterated_fderiv_within_eq
and
filter.eventually_eq.iterated_fderiv_within
.
The iterated differential within a set s
at a point x
is not modified if one intersects
s
with a neighborhood of x
within s
.
The iterated differential within a set s
at a point x
is not modified if one intersects
s
with a neighborhood of x
.
The iterated differential within a set s
at a point x
is not modified if one intersects
s
with an open set containing x
.
On a set with unique differentiability, any choice of iterated differential has to coincide
with the one we have chosen in iterated_fderiv_within 𝕜 m f s
.
When a function is C^n
in a set s
of unique differentiability, it admits
ftaylor_series_within 𝕜 f s
as a Taylor series up to order n
in s
.
A function is C^(n + 1)
on a domain with unique derivatives if and only if it is
differentiable there, and its derivative (expressed with fderiv_within
) is C^n
.
A function is C^(n + 1)
on an open domain if and only if it is
differentiable there, and its derivative (expressed with fderiv
) is C^n
.
A function is C^∞
on a domain with unique derivatives if and only if it is differentiable
there, and its derivative (expressed with fderiv_within
) is C^∞
.
A function is C^∞
on an open domain if and only if it is differentiable there, and its
derivative (expressed with fderiv
) is C^∞
.
Functions with a Taylor series on the whole space #
- zero_eq : ∀ (x : E), (p x 0).uncurry0 = f x
- fderiv : ∀ (m : ℕ), ↑m < n → ∀ (x : E), has_fderiv_at (λ (y : E), p y m) (p x m.succ).curry_left x
- cont : ∀ (m : ℕ), ↑m ≤ n → continuous (λ (x : E), p x m)
has_ftaylor_series_up_to n f p
registers the fact that p 0 = f
and p (m+1)
is a
derivative of p m
for m < n
, and is continuous for m ≤ n
. This is a predicate analogous to
has_fderiv_at
but for higher order derivatives.
In the case that n = ∞
we don't need the continuity assumption in
has_ftaylor_series_up_to
.
If a function has a Taylor series at order at least 1
, then the term of order 1
of this
series is a derivative of f
.
p
is a Taylor series of f
up to n+1
if and only if p.shift
is a Taylor series up to n
for p 1
, which is a derivative of f
.
Smooth functions at a point #
A function is continuously differentiable up to n
at a point x
if, for any integer k ≤ n
,
there is a neighborhood of x
where f
admits derivatives up to order n
, which are continuous.
Equations
- cont_diff_at 𝕜 n f x = cont_diff_within_at 𝕜 n f set.univ x
If a function is C^n
with n ≥ 1
at a point, then it is differentiable there.
A function is C^(n + 1)
at a point iff locally, it has a derivative which is C^n
.
Smooth functions #
A function is continuously differentiable up to n
if it admits derivatives up to
order n
, which are continuous. Contrary to the case of definitions in domains (where derivatives
might not be unique) we do not need to localize the definition in space or time.
Equations
- cont_diff 𝕜 n f = ∃ (p : E → formal_multilinear_series 𝕜 E F), has_ftaylor_series_up_to n f p
If f
has a Taylor series up to n
, then it is C^n
.
If a function is C^n
with n ≥ 1
, then it is differentiable.
A function is C^(n+1)
iff it has a C^n
derivative.
Iterated derivative #
The n
-th derivative of a function, as a multilinear map, defined inductively.
Equations
- iterated_fderiv 𝕜 n f = n.rec_on (λ (x : E), continuous_multilinear_map.curry0 𝕜 E (f x)) (λ (n : ℕ) (rec : E → continuous_multilinear_map 𝕜 (λ (i : fin n), E) F) (x : E), (fderiv 𝕜 rec x).uncurry_left)
Formal Taylor series associated to a function within a set.
Equations
- ftaylor_series 𝕜 f x = λ (n : ℕ), iterated_fderiv 𝕜 n f x
Writing explicitly the n+1
-th derivative as the composition of a currying linear equiv,
and the derivative of the n
-th derivative.
Writing explicitly the derivative of the n
-th derivative as the composition of a currying
linear equiv, and the n + 1
-th derivative.
In an open set, the iterated derivative within this set coincides with the global iterated derivative.
Writing explicitly the n+1
-th derivative as the composition of a currying linear equiv,
and the n
-th derivative of the derivative.
When a function is C^n
in a set s
of unique differentiability, it admits
ftaylor_series_within 𝕜 f s
as a Taylor series up to order n
in s
.
If f
is C^n
then its m
-times iterated derivative is continuous for m ≤ n
.
If f
is C^n
then its m
-times iterated derivative is differentiable for m < n
.
A function is C^(n + 1)
if and only if it is differentiable,
and its derivative (formulated in terms of fderiv
) is C^n
.
A function is C^∞
if and only if it is differentiable,
and its derivative (formulated in terms of fderiv
) is C^∞
.
If a function is at least C^1
, its bundled derivative (mapping (x, v)
to Df(x) v
) is
continuous.