roseking's picture
Add lean source and binary files (part 11)
110f4f3 verified
Raw History Blame Contribute Delete
5.6 kB
import Mathlib
import OAI.Analysis.BiholderTransport.Calculus.TaylorBound
namespace OAI
noncomputable section
open Set Filter Asymptotics
open scoped Topology ContDiff
namespace WeakMTWTransport
variable {E F G : Type*} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F]
[NormedAddCommGroup G] [NormedSpace ℝ G]
def HasSecondTaylor (f : E → ℝ) (l : E →L[ℝ] ℝ)
(B : E →L[ℝ] E →L[ℝ] ℝ) : Prop :=
(fun h => f h-f 0-l h-B h h/2) =o[𝓝 0] (fun h : E => ‖h‖^2)
lemma HasSecondTaylor.eventually {f : E → ℝ} {l : E →L[ℝ] ℝ}
{B : E →L[ℝ] E →L[ℝ] ℝ} (hf : HasSecondTaylor f l B) {ε : ℝ} (hε : 0<ε) :
∀ᶠ h in 𝓝 (0:E), |f h-f 0-l h-B h h/2|≤ε*‖h‖^2 := by
simpa only [Real.norm_eq_abs,abs_pow,abs_norm] using hf.def hε
lemma hasSecondTaylor_of_contDiffAt {f : E → ℝ} (hf : ContDiffAt ℝ 2 f 0) :
HasSecondTaylor f (fderiv ℝ f 0) (fderiv ℝ (fderiv ℝ f) 0) := by
apply Asymptotics.IsLittleO.of_bound
intro ε hε
have hn := hf.eventually (by norm_num)
have hD := ((hf.fderiv_right (m := 1) (by norm_num)).fderiv_right
(m := 0) (by norm_num)).continuousAt
have he : ∀ᶠ z : E in 𝓝 0,
‖fderiv ℝ (fderiv ℝ f) z-fderiv ℝ (fderiv ℝ f) 0‖<ε := by
exact Metric.tendsto_nhds.mp hD ε hε |>.mono (fun _ h => by simpa only [dist_eq_norm] using h)
obtain ⟨r,hr,hball⟩ := Metric.eventually_nhds_iff.mp (hn.and he)
filter_upwards [Metric.ball_mem_nhds (0:E) hr] with h hh
have H := second_order_remainder_bound_on_ball hr hε.le
(fun z hz => (hball hz).1) (fun z hz => (hball hz).2.le) hh
simpa only [Real.norm_eq_abs,abs_pow,abs_norm] using H
lemma bilinear_isBigO_norm_mul {α : Type*} (L : Filter α)
(B : E →L[ℝ] F →L[ℝ] G) (u : α → E) (v : α → F) :
(fun x => B (u x) (v x)) =O[L] (fun x => ‖u x‖*‖v x‖) := by
apply Asymptotics.IsBigO.of_bound ‖B‖
exact Filter.Eventually.of_forall (fun x => by
simpa only [Real.norm_eq_abs,abs_of_nonneg (mul_nonneg (norm_nonneg _) (norm_nonneg _)),
mul_assoc] using B.le_opNorm₂ (u x) (v x))
lemma bilinear_remainder_of_hasFDerivAt {a : E → F} {A : E →L[ℝ] F}
(ha : HasFDerivAt a A 0) (ha0 : a 0=0) (B : F →L[ℝ] F →L[ℝ] ℝ) :
(fun h => B (a h) (a h)-B (A h) (A h)) =o[𝓝 0] (fun h : E => ‖h‖^2) := by
have hR : (fun h => a h-A h) =o[𝓝 0] (fun h : E => h) := by
simpa only [zero_add,ha0,sub_zero] using hasFDerivAt_iff_isLittleO_nhds_zero.mp ha
have hO : a =O[𝓝 0] (fun h : E => h) := by
simpa only [ha0,sub_zero] using ha.isBigO_sub
have hA : (fun h : E => A h) =O[𝓝 0] (fun h => h) := A.isBigO_id _
have h1 := (bilinear_isBigO_norm_mul (𝓝 (0:E)) B (fun h => a h-A h) a).trans_isLittleO
(hR.norm_left.norm_right.mul_isBigO hO.norm_left.norm_right)
have h2 := (bilinear_isBigO_norm_mul (𝓝 (0:E)) B (fun h => A h) (fun h => a h-A h)).trans_isLittleO
(hA.norm_left.norm_right.mul_isLittleO hR.norm_left.norm_right)
have he : (fun h => B (a h) (a h)-B (A h) (A h)) =
(fun h => B (a h-A h) (a h)+B (A h) (a h-A h)) := by
funext h
simp only [map_sub,_root_.sub_apply]
ring
rw [he]
simpa only [pow_two] using h1.add h2
lemma HasSecondTaylor.comp_stationary {f : F → ℝ}
{B : F →L[ℝ] F →L[ℝ] ℝ} (hf : HasSecondTaylor f 0 B)
{a : E → F} {A : E →L[ℝ] F} (ha : HasFDerivAt a A 0) (ha0 : a 0=0) :
HasSecondTaylor (fun h => f (a h)) 0
(((ContinuousLinearMap.compL ℝ E F ℝ).flip A).comp (B.comp A)) := by
have hO : (fun h : E => ‖a h‖) =O[𝓝 0] (fun h => ‖h‖) := by
simpa only [ha0,sub_zero] using ha.isBigO_sub.norm_left.norm_right
have ht : Tendsto a (𝓝 0) (𝓝 0) := ha0 ▸ ha.continuousAt
have h1 := (hf.comp_tendsto ht).trans_isBigO (hO.pow 2)
have h2 : (fun h => (B (a h) (a h)-B (A h) (A h))/2) =o[𝓝 0]
(fun h : E => ‖h‖^2) := by
simpa only [div_eq_mul_inv,mul_comm] using
(bilinear_remainder_of_hasFDerivAt ha ha0 B).const_mul_left (2:ℝ)⁻¹
unfold HasSecondTaylor
have he : (fun h => f (a h)-f (a 0)-(0 : E →L[ℝ] ℝ) h-
(((ContinuousLinearMap.compL ℝ E F ℝ).flip A).comp (B.comp A)) h h/2) =
(fun h => (f (a h)-f 0-(0 : F →L[ℝ] ℝ) (a h)-B (a h) (a h)/2)+
(B (a h) (a h)-B (A h) (A h))/2) := by
funext h
simp only [ha0,_root_.zero_apply,sub_zero,ContinuousLinearMap.comp_apply,
ContinuousLinearMap.compL_apply,ContinuousLinearMap.flip_apply]
ring
rw [he]
exact h1.add h2
lemma HasSecondTaylor.sub {f g : E → ℝ} {l k : E →L[ℝ] ℝ}
{B C : E →L[ℝ] E →L[ℝ] ℝ} (hf : HasSecondTaylor f l B)
(hg : HasSecondTaylor g k C) : HasSecondTaylor (fun h => f h-g h) (l-k) (B-C) := by
unfold HasSecondTaylor at *
have he : (fun h => (f h-g h)-(f 0-g 0)-(l-k) h-(B-C) h h/2) =
(fun h => (f h-f 0-l h-B h h/2)-(g h-g 0-k h-C h h/2)) := by
funext h
simp only [_root_.sub_apply]
ring
rw [he]
exact Asymptotics.IsLittleO.sub hf hg
lemma HasSecondTaylor.add {f g : E → ℝ} {l k : E →L[ℝ] ℝ}
{B C : E →L[ℝ] E →L[ℝ] ℝ} (hf : HasSecondTaylor f l B)
(hg : HasSecondTaylor g k C) : HasSecondTaylor (fun h => f h+g h) (l+k) (B+C) := by
unfold HasSecondTaylor at *
have he : (fun h => (f h+g h)-(f 0+g 0)-(l+k) h-(B+C) h h/2) =
(fun h => (f h-f 0-l h-B h h/2)+(g h-g 0-k h-C h h/2)) := by
funext h
simp only [_root_.add_apply]
ring
rw [he]
exact Asymptotics.IsLittleO.add hf hg
end WeakMTWTransport
end
end OAI