-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathIteratedFDeriv.lean
More file actions
293 lines (262 loc) Β· 15.4 KB
/
IteratedFDeriv.lean
File metadata and controls
293 lines (262 loc) Β· 15.4 KB
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
287
288
289
290
291
292
293
/-
Copyright (c) 2024 SΓ©bastien GouΓ«zel. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: SΓ©bastien GouΓ«zel
-/
module
public import Mathlib.Analysis.Calculus.ContDiff.Operations
public import Mathlib.Analysis.Calculus.ContDiff.CPolynomial
public import Mathlib.Data.Fintype.Perm
/-!
# The iterated derivative of an analytic function
If a function is analytic, written as `f (x + y) = β pβ (y, ..., y)` then its `n`-th iterated
derivative at `x` is given by `(vβ, ..., vβ) β¦ β pβ (v_{Ο (1)}, ..., v_{Ο (n)})` where the sum
is over all permutations of `{1, ..., n}`. In particular, it is symmetric.
This generalizes the result of `HasFPowerSeriesOnBall.factorial_smul` giving
`D^n f (v, ..., v) = n! * pβ (v, ..., v)`.
## Main result
* `HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum` shows that
`iteratedFDeriv π n f x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i))`,
when `f` has `p` as power series within the set `s` on the ball `B (x, r)`.
* `ContDiffAt.iteratedFDeriv_comp_perm` proves the symmetry of the iterated derivative of an
analytic function, in the form `iteratedFDeriv π n f x (v β Ο) = iteratedFDeriv π n f x v`
for any permutation `Ο` of `Fin n`.
Versions within sets are also given.
## Implementation
To prove the formula for the iterated derivative, we decompose an analytic function as
the sum of `fun y β¦ pβ (y, ..., y)` and the rest. For the former, its iterated derivative follows
from the formula for iterated derivatives of multilinear maps
(see `ContinuousMultilinearMap.iteratedFDeriv_comp_diagonal`). For the latter, we show by
induction on `n` that if the `n`-th term in a power series is zero, then the `n`-th iterated
derivative vanishes (see `HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_zero`).
All these results are proved assuming additionally that the function is analytic on the relevant
set (which does not follow from the fact that the function has a power series, if the target space
is not complete). This makes it possible to avoid all completeness assumptions in the final
statements. When needed, we give versions of some statements assuming completeness and dropping
analyticity, for ease of use.
-/
@[expose] public section
open scoped ENNReal Topology ContDiff
open Equiv Set
variable {π : Type*} [NontriviallyNormedField π]
{E : Type*} [NormedAddCommGroup E] [NormedSpace π E]
{F : Type*} [NormedAddCommGroup F] [NormedSpace π F]
{f : E β F} {p : FormalMultilinearSeries π E F} {s : Set E} {x : E} {r : ββ₯0β}
/-- Formal multilinear series associated to the iterated derivative, defined by iterating
`p β¦ p.derivSeries` and currying suitably. It is defined so that, if a function has `p` as a power
series, then its iterated derivative of order `k` has `p.iteratedFDerivSeries k` as a power
series. -/
noncomputable def FormalMultilinearSeries.iteratedFDerivSeries
(p : FormalMultilinearSeries π E F) (k : β) :
FormalMultilinearSeries π E (E [Γk]βL[π] F) :=
match k with
| 0 => (continuousMultilinearCurryFin0 π E F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.compFormalMultilinearSeries p
| (k + 1) => (continuousMultilinearCurryLeftEquiv π (fun _ : Fin (k + 1) β¦ E) F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.compFormalMultilinearSeries
(p.iteratedFDerivSeries k).derivSeries
/-- If a function has a power series on a ball, then so do its iterated derivatives. -/
protected theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn π f s)
(k : β) (hs : UniqueDiffOn π s) (hx : x β s) :
HasFPowerSeriesWithinOnBall (iteratedFDerivWithin π k f s)
(p.iteratedFDerivSeries k) s x r := by
induction k with
| zero =>
exact (continuousMultilinearCurryFin0 π E F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall h
| succ k ih =>
rw [iteratedFDerivWithin_succ_eq_comp_left]
apply (continuousMultilinearCurryLeftEquiv π (fun _ : Fin (k + 1) β¦ E) F).symm
|>.toContinuousLinearEquiv.toContinuousLinearMap.comp_hasFPowerSeriesWithinOnBall
(ih.fderivWithin_of_mem_of_analyticOn (h'.iteratedFDerivWithin hs _) hs hx)
lemma FormalMultilinearSeries.iteratedFDerivSeries_eq_zero {k n : β}
(h : p (n + k) = 0) : p.iteratedFDerivSeries k n = 0 := by
induction k generalizing n with
| zero =>
ext
have : p n = 0 := p.congr_zero rfl h
simp [FormalMultilinearSeries.iteratedFDerivSeries, this]
| succ k ih =>
ext
simp only [iteratedFDerivSeries, Nat.succ_eq_add_one,
ContinuousLinearMap.compFormalMultilinearSeries_apply,
ContinuousLinearMap.compContinuousMultilinearMap_coe, ContinuousLinearEquiv.coe_coe,
LinearIsometryEquiv.coe_toContinuousLinearEquiv, Function.comp_apply,
continuousMultilinearCurryLeftEquiv_symm_apply, ContinuousMultilinearMap.zero_apply,
ContinuousLinearMap.zero_apply,
derivSeries_eq_zero _ (ih (p.congr_zero (Nat.succ_add_eq_add_succ _ _).symm h))]
/-- If the `n`-th term in a power series is zero, then the `n`-th derivative of the corresponding
function vanishes. -/
lemma HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_zero
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn π f s)
(hu : UniqueDiffOn π s) (hx : x β s) {n : β} (hn : p n = 0) :
iteratedFDerivWithin π n f s x = 0 := by
have : iteratedFDerivWithin π n f s x = p.iteratedFDerivSeries n 0 (fun _ β¦ 0) :=
((h.iteratedFDerivWithin h' n hu hx).coeff_zero _).symm
rw [this, p.iteratedFDerivSeries_eq_zero (p.congr_zero (Nat.zero_add n).symm hn),
ContinuousMultilinearMap.zero_apply]
lemma ContinuousMultilinearMap.iteratedFDeriv_comp_diagonal
{n : β} (f : E [Γn]βL[π] F) (x : E) (v : Fin n β E) :
iteratedFDeriv π n (fun x β¦ f (fun _ β¦ x)) x v = β Ο : Perm (Fin n), f (fun i β¦ v (Ο i)) := by
rw [β sum_comp (Equiv.inv (Perm (Fin n)))]
let g : E βL[π] (Fin n β E) := ContinuousLinearMap.pi (fun i β¦ ContinuousLinearMap.id π E)
change iteratedFDeriv π n (f β g) x v = _
rw [ContinuousLinearMap.iteratedFDeriv_comp_right _ f.contDiff _ le_rfl, f.iteratedFDeriv_eq]
simp only [ContinuousMultilinearMap.iteratedFDeriv,
ContinuousMultilinearMap.compContinuousLinearMap_apply, ContinuousMultilinearMap.sum_apply,
ContinuousMultilinearMap.iteratedFDerivComponent_apply, Set.mem_range, Pi.compRightL_apply]
rw [β sum_comp (Equiv.embeddingEquivOfFinite (Fin n))]
congr with Ο
congr with i
obtain β¨y, rflβ© := Ο.equivOfFiniteSelfEmbedding.surjective i
simp [inv_apply, Perm.inv_def,
ofBijective_symm_apply_apply, Function.Embedding.equivOfFiniteSelfEmbedding, g]
private lemma HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn π f s)
(hs : UniqueDiffOn π s) (hx : x β s)
{n : β} (v : Fin n β E) (h's : s β Metric.eball x r) :
iteratedFDerivWithin π n f s x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i)) := by
have I : insert x s β© Metric.eball x r = s := by
rw [Set.insert_eq_of_mem hx]
exact Set.inter_eq_left.2 h's
have fcont : ContDiffOn π (βn) f s := by
apply AnalyticOn.contDiffOn _ hs
simpa [I] using h'
let g : E β F := fun z β¦ p n (fun _ β¦ z - x)
have gcont : ContDiff π Ο g := by
apply (p n).contDiff.comp
exact contDiff_pi.2 (fun i β¦ contDiff_id.sub contDiff_const)
let q : FormalMultilinearSeries π E F := fun k β¦ if h : n = k then (h βΈ p n) else 0
have A : HasFiniteFPowerSeriesOnBall g q x (n + 1) r := by
apply HasFiniteFPowerSeriesOnBall.mk' _ h.r_pos
Β· intro y hy
rw [Finset.sum_eq_single_of_mem n]
Β· simp [q, g]
Β· simp
Β· intro i hi h'i
simp [q, h'i.symm]
Β· intro m hm
have : n β m := by lia
simp [q, this]
have B : HasFPowerSeriesWithinOnBall g q s x r :=
A.toHasFPowerSeriesOnBall.hasFPowerSeriesWithinOnBall
have J1 : iteratedFDerivWithin π n f s x =
iteratedFDerivWithin π n g s x + iteratedFDerivWithin π n (f - g) s x := by
have : f = g + (f - g) := by abel
nth_rewrite 1 [this]
rw [iteratedFDerivWithin_add_apply (gcont.of_le le_top).contDiffWithinAt
(by exact (fcont _ hx).sub (gcont.of_le le_top).contDiffWithinAt) hs hx]
have J2 : iteratedFDerivWithin π n (f - g) s x = 0 := by
apply (h.sub B).iteratedFDerivWithin_eq_zero (h'.sub ?_) hs hx
Β· simp [q]
Β· apply gcont.contDiffOn.analyticOn
have J3 : iteratedFDerivWithin π n g s x = iteratedFDeriv π n g x :=
iteratedFDerivWithin_eq_iteratedFDeriv hs (gcont.of_le le_top).contDiffAt hx
simp only [J1, J3, J2, add_zero]
let g' : E β F := fun z β¦ p n (fun _ β¦ z)
have : g = fun z β¦ g' (z - x) := rfl
rw [this, iteratedFDeriv_comp_sub]
exact (p n).iteratedFDeriv_comp_diagonal _ v
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(vβ, ..., vβ) β¦ β pβ (v_{Ο (1)}, ..., v_{Ο (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum
(h : HasFPowerSeriesWithinOnBall f p s x r) (h' : AnalyticOn π f s)
(hs : UniqueDiffOn π s) (hx : x β s) {n : β} (v : Fin n β E) :
iteratedFDerivWithin π n f s x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i)) := by
have : iteratedFDerivWithin π n f s x
= iteratedFDerivWithin π n f (s β© Metric.eball x r) x :=
(iteratedFDerivWithin_inter_open Metric.isOpen_eball (Metric.mem_eball_self h.r_pos)).symm
rw [this]
apply HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
Β· exact h.mono inter_subset_left
Β· exact h'.mono inter_subset_left
Β· exact hs.inter Metric.isOpen_eball
Β· exact β¨hx, Metric.mem_eball_self h.r_posβ©
Β· exact inter_subset_right
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(vβ, ..., vβ) β¦ β pβ (v_{Ο (1)}, ..., v_{Ο (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum
(h : HasFPowerSeriesOnBall f p x r) (h' : AnalyticOn π f univ) {n : β} (v : Fin n β E) :
iteratedFDeriv π n f x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i)) := by
simp only [β iteratedFDerivWithin_univ, β hasFPowerSeriesWithinOnBall_univ] at h β’
exact h.iteratedFDerivWithin_eq_sum h' uniqueDiffOn_univ (mem_univ x) v
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(vβ, ..., vβ) β¦ β pβ (v_{Ο (1)}, ..., v_{Ο (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_completeSpace [CompleteSpace F]
(h : HasFPowerSeriesWithinOnBall f p s x r)
(hs : UniqueDiffOn π s) (hx : x β s) {n : β} (v : Fin n β E) :
iteratedFDerivWithin π n f s x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i)) := by
have : iteratedFDerivWithin π n f s x
= iteratedFDerivWithin π n f (s β© Metric.eball x r) x :=
(iteratedFDerivWithin_inter_open Metric.isOpen_eball (Metric.mem_eball_self h.r_pos)).symm
rw [this]
apply HasFPowerSeriesWithinOnBall.iteratedFDerivWithin_eq_sum_of_subset
Β· exact h.mono inter_subset_left
Β· apply h.analyticOn.mono
rw [insert_eq_of_mem hx]
Β· exact hs.inter Metric.isOpen_eball
Β· exact β¨hx, Metric.mem_eball_self h.r_posβ©
Β· exact inter_subset_right
/-- If a function has a power series in a ball, then its `n`-th iterated derivative is given by
`(vβ, ..., vβ) β¦ β pβ (v_{Ο (1)}, ..., v_{Ο (n)})` where the sum is over all
permutations of `{1, ..., n}`. -/
theorem HasFPowerSeriesOnBall.iteratedFDeriv_eq_sum_of_completeSpace [CompleteSpace F]
(h : HasFPowerSeriesOnBall f p x r) {n : β} (v : Fin n β E) :
iteratedFDeriv π n f x v = β Ο : Perm (Fin n), p n (fun i β¦ v (Ο i)) := by
simp only [β iteratedFDerivWithin_univ, β hasFPowerSeriesWithinOnBall_univ] at h β’
exact h.iteratedFDerivWithin_eq_sum_of_completeSpace uniqueDiffOn_univ (mem_univ _) v
/-- The `n`-th iterated derivative of an analytic function on a set is symmetric. -/
theorem AnalyticOn.iteratedFDerivWithin_comp_perm
(h : AnalyticOn π f s) (hs : UniqueDiffOn π s) (hx : x β s) {n : β} (v : Fin n β E)
(Ο : Perm (Fin n)) :
iteratedFDerivWithin π n f s x (v β Ο) = iteratedFDerivWithin π n f s x v := by
rcases h x hx with β¨p, r, hpβ©
rw [hp.iteratedFDerivWithin_eq_sum h hs hx, hp.iteratedFDerivWithin_eq_sum h hs hx]
conv_rhs => rw [β Equiv.sum_comp (Equiv.mulLeft Ο)]
simp only [coe_mulLeft, Perm.coe_mul, Function.comp_apply]
theorem AnalyticOn.domDomCongr_iteratedFDerivWithin
(h : AnalyticOn π f s) (hs : UniqueDiffOn π s) (hx : x β s) {n : β} (Ο : Perm (Fin n)) :
(iteratedFDerivWithin π n f s x).domDomCongr Ο = iteratedFDerivWithin π n f s x := by
ext
exact h.iteratedFDerivWithin_comp_perm hs hx _ _
/-- The `n`-th iterated derivative of an analytic function on a set is symmetric. -/
theorem ContDiffWithinAt.iteratedFDerivWithin_comp_perm
(h : ContDiffWithinAt π Ο f s x) (hs : UniqueDiffOn π s) (hx : x β s) {n : β} (v : Fin n β E)
(Ο : Perm (Fin n)) :
iteratedFDerivWithin π n f s x (v β Ο) = iteratedFDerivWithin π n f s x v := by
rcases h.contDiffOn' le_rfl (by simp) with β¨u, u_open, xu, huβ©
rw [insert_eq_of_mem hx] at hu
have : iteratedFDerivWithin π n f (s β© u) x = iteratedFDerivWithin π n f s x :=
iteratedFDerivWithin_inter_open u_open xu
rw [β this]
exact AnalyticOn.iteratedFDerivWithin_comp_perm hu.analyticOn (hs.inter u_open) β¨hx, xuβ© _ _
theorem ContDiffWithinAt.domDomCongr_iteratedFDerivWithin
(h : ContDiffWithinAt π Ο f s x) (hs : UniqueDiffOn π s) (hx : x β s) {n : β}
(Ο : Perm (Fin n)) :
(iteratedFDerivWithin π n f s x).domDomCongr Ο = iteratedFDerivWithin π n f s x := by
ext
exact h.iteratedFDerivWithin_comp_perm hs hx _ _
/-- The `n`-th iterated derivative of an analytic function is symmetric. -/
theorem AnalyticOn.iteratedFDeriv_comp_perm
(h : AnalyticOn π f univ) {n : β} (v : Fin n β E) (Ο : Perm (Fin n)) :
iteratedFDeriv π n f x (v β Ο) = iteratedFDeriv π n f x v := by
rw [β iteratedFDerivWithin_univ]
exact h.iteratedFDerivWithin_comp_perm uniqueDiffOn_univ (mem_univ x) _ _
theorem AnalyticOn.domDomCongr_iteratedFDeriv (h : AnalyticOn π f univ) {n : β} (Ο : Perm (Fin n)) :
(iteratedFDeriv π n f x).domDomCongr Ο = iteratedFDeriv π n f x := by
rw [β iteratedFDerivWithin_univ]
exact h.domDomCongr_iteratedFDerivWithin uniqueDiffOn_univ (mem_univ x) _
/-- The `n`-th iterated derivative of an analytic function is symmetric. -/
theorem ContDiffAt.iteratedFDeriv_comp_perm
(h : ContDiffAt π Ο f x) {n : β} (v : Fin n β E) (Ο : Perm (Fin n)) :
iteratedFDeriv π n f x (v β Ο) = iteratedFDeriv π n f x v := by
rw [β iteratedFDerivWithin_univ]
exact h.iteratedFDerivWithin_comp_perm uniqueDiffOn_univ (mem_univ x) _ _
theorem ContDiffAt.domDomCongr_iteratedFDeriv (h : ContDiffAt π Ο f x) {n : β} (Ο : Perm (Fin n)) :
(iteratedFDeriv π n f x).domDomCongr Ο = iteratedFDeriv π n f x := by
rw [β iteratedFDerivWithin_univ]
exact h.domDomCongr_iteratedFDerivWithin uniqueDiffOn_univ (mem_univ x) _