lemmasecond_derivative_linear_sandwich {f : F→G} {a : E}
(L : E→L[ℝ] F) (K : G→L[ℝ] H) (hf : ContDiffAtℝ2 f (L a)) (u v : E) :
fderiv ℝ (fderiv ℝ (fun x =>K (f (L x)))) a u v =
K (fderiv ℝ (fderiv ℝ f) (L a) (L u) (L v)) :=by
proof · 11
lines
haveheq : fderiv ℝ (fun x =>K (f (L x))) =ᶠ[𝓝 a]
fun x =>K.comp ((fderiv ℝ f (L x)).comp L) :=by
filter_upwards [L.continuous.continuousAt.eventually (hf.eventually (by norm_num))] with x hx
exact (K.hasFDerivAt.comp x ((hx.differentiableAt (by norm_num)).hasFDerivAt.comp x
L.hasFDerivAt)).fderiv
have hdd := (hf.fderiv_right (m :=1) (by norm_num)).differentiableAt (by norm_num)
have hD := (hasFDerivAt_const K a).clm_comp
((hdd.hasFDerivAt.comp a L.hasFDerivAt).clm_comp (hasFDerivAt_const L a))
have h := congrArg (funA : E→L[ℝ] E→L[ℝ] H=>A u v)
((hD.congr_of_eventuallyEq heq).fderiv)
simpa only [comp_apply,compL_apply,flip_apply,add_apply,zero_apply,map_zero,zero_add,add_zero] using h
lemmasecond_derivative_half_norm_sq {g : E→F} {a v : E}
(hg : ContDiffAtℝ2 g a) :
fderiv ℝ (fderiv ℝ (fun x => ‖g x‖^2/2)) a v v =
‖fderiv ℝ g a v‖^2 + inner ℝ (g a) (fderiv ℝ (fderiv ℝ g) a v v) :=by
proof · 21
lines
letG : E→E→L[ℝ] ℝ:=fun x => (innerSL ℝ (g x)).comp (fderiv ℝ g x)
have hdg := hg.differentiableAt (by norm_num)
have hddg := (hg.fderiv_right (m :=1) (by norm_num)).differentiableAt (by norm_num)
have hG := ((innerSL ℝ).hasFDerivAt.comp a hdg.hasFDerivAt).clm_comp hddg.hasFDerivAt
haveheq : fderiv ℝ (fun x => ‖g x‖^2/2) =ᶠ[𝓝 a] G:=by
filter_upwards [hg.eventually (bynorm_num : (2:ℕ∞ω)≠∞)] with x hx
have hd0 := ((hx.differentiableAt (by norm_num)).hasFDerivAt.norm_sq).const_smul (1/2:ℝ)
have hd := hd0.fderiv
havehfun : (fun z => ‖g z‖^2/2)=(fun z => (1/2:ℝ) • ‖g z‖^2) :=by
funext z; simp only [smul_eq_mul]; ring
rw [hfun]
change fderiv ℝ ((1/2:ℝ) • fun z => ‖g z‖^2) x=G x
rw [hd]
ext w
simp only [G,comp_apply,smul_apply,innerSL_apply_apply,smul_eq_mul]
ring
have hD := (hG.congr_of_eventuallyEq heq).fderiv
rw [hD]
simp only [comp_apply,compL_apply,add_apply,flip_apply]
change inner ℝ (g a) (fderiv ℝ (fderiv ℝ g) a v v)+inner ℝ (fderiv ℝ g a v) (fderiv ℝ g a v)=_
rw [real_inner_self_eq_norm_sq,add_comm]
lemmathird_derivative_swap_outer {f : E→ℝ} {a u v w : E}
(hf : ContDiffAtℝ3 f a) :
fderiv ℝ (fderiv ℝ (fderiv ℝ f)) a u v w =
fderiv ℝ (fderiv ℝ (fderiv ℝ f)) a v u w :=by
lemmathird_derivative_swap_inner {f : E→ℝ} {a u v w : E}
(hf : ContDiffAtℝ3 f a) :
fderiv ℝ (fderiv ℝ (fderiv ℝ f)) a u v w =
fderiv ℝ (fderiv ℝ (fderiv ℝ f)) a u w v :=by
proof · 13
lines
letH:= fderiv ℝ (fderiv ℝ f)
have hH := ((hf.fderiv_right (m :=2) (by norm_num)).fderiv_right
(m :=1) (by norm_num)).differentiableAt (by norm_num)
have hvw := (hH.hasFDerivAt.clm_apply (hasFDerivAt_const v a)).clm_apply
(hasFDerivAt_const w a)
have hwv := (hH.hasFDerivAt.clm_apply (hasFDerivAt_const w a)).clm_apply
(hasFDerivAt_const v a)
haveheq : (fun x =>H x v w)=ᶠ[𝓝 a] (fun x =>H x w v) :=by
filter_upwards [hf.eventually (bynorm_num : (3:ℕ∞ω)≠∞)] with x hx
exact hx.isSymmSndFDerivAt (by norm_num) |>.eq v w
have hh := congrArg (funL : E→L[ℝ] ℝ=>L u)
((hvw.congr_of_eventuallyEq heq.symm).unique hwv)
simpa only [comp_apply,flip_apply,add_apply,zero_apply,map_zero,zero_add,add_zero] using hh