cfahlgren1/math / lean /OAI /Analysis /LienardCycles /PartialCalculus.lean
cfahlgren1's picture
download
raw
6.57 kB
import OAI.Analysis.LienardCycles.GlobalODE
namespace OAI
universe uE uF
open Set Filter MeasureTheory
open scoped Topology ContDiff
open Set Filter Metric
open scoped Topology NNReal ContDiff Manifold
open Filter Set
open scoped Topology ContDiff
namespace QuinticLienard.PartialCalculus
variable {E : Type uE} {F : Type uF} [NormedAddCommGroup E] [NormedSpace ℝ E]
[NormedAddCommGroup F] [NormedSpace ℝ F]
noncomputable def direction (v : E) (f : E → F) (x : E) : F := fderiv ℝ f x v
lemma direction_contDiffAt {f : E → F} {x : E} (hf : ContDiffAt ℝ ω f x) (v : E) :
ContDiffAt ℝ ω (direction v f) x :=
(hf.fderiv_right (by simp)).clm_apply contDiffAt_const
lemma direction_hasFDerivAt {f : E → F} {x : E} (hf : ContDiffAt ℝ ω f x) (v : E) :
HasFDerivAt (direction v f) ((fderiv ℝ (fderiv ℝ f) x).flip v) x := by
have hd : HasFDerivAt (fderiv ℝ f) (fderiv ℝ (fderiv ℝ f) x) x :=
((hf.fderiv_right (m := ω) (by simp)).differentiableAt (by simp)).hasFDerivAt
change HasFDerivAt (fun y => fderiv ℝ f y v) _ x
convert hd.clm_apply (hasFDerivAt_const v x) using 1
ext y
simp
lemma direction_direction {f : E → F} {x : E} (hf : ContDiffAt ℝ ω f x) (v w : E) :
direction v (direction w f) x = (fderiv ℝ (fderiv ℝ f) x v) w := by
rw [direction,(direction_hasFDerivAt hf w).fderiv]
rfl
lemma direction_comm {f : E → F} {x : E} (hf : ContDiffAt ℝ ω f x) (v w : E) :
direction v (direction w f) x = direction w (direction v f) x := by
rw [direction_direction hf,direction_direction hf]
exact hf.isSymmSndFDerivAt_of_omega.eq v w
noncomputable def first (f : ℝ × ℝ → F) : ℝ × ℝ → F := direction (1,0) f
noncomputable def second (f : ℝ × ℝ → F) : ℝ × ℝ → F := direction (0,1) f
lemma first_contDiffAt {f : ℝ × ℝ → F} {p : ℝ × ℝ} (hf : ContDiffAt ℝ ω f p) :
ContDiffAt ℝ ω (first f) p := direction_contDiffAt hf _
lemma second_contDiffAt {f : ℝ × ℝ → F} {p : ℝ × ℝ} (hf : ContDiffAt ℝ ω f p) :
ContDiffAt ℝ ω (second f) p := direction_contDiffAt hf _
lemma first_hasDerivAt {f : ℝ × ℝ → F} {x y : ℝ}
(hf : DifferentiableAt ℝ f (x,y)) :
HasDerivAt (fun s => f (s,y)) (first f (x,y)) x := by
simpa [first,direction,Function.comp_def] using
hf.hasFDerivAt.comp_hasDerivAt x ((hasDerivAt_id x).prodMk (hasDerivAt_const x y))
lemma second_hasDerivAt {f : ℝ × ℝ → F} {x y : ℝ}
(hf : DifferentiableAt ℝ f (x,y)) :
HasDerivAt (fun s => f (x,s)) (second f (x,y)) y := by
simpa [second,direction,Function.comp_def] using
hf.hasFDerivAt.comp_hasDerivAt y ((hasDerivAt_const y x).prodMk (hasDerivAt_id y))
lemma mixed_comm {f : ℝ × ℝ → F} {p : ℝ × ℝ} (hf : ContDiffAt ℝ ω f p) :
first (second f) p = second (first f) p := direction_comm hf _ _
lemma fderiv_pair (f : ℝ × ℝ → ℝ) (p : ℝ × ℝ) (a b : ℝ) :
fderiv ℝ f p (a,b) = a * first f p + b * second f p := by
have he : (a,b) = a • (1,0) + b • (0,1) := by ext <;> simp
rw [he,map_add,map_smul,map_smul]
rfl
theorem scalar_ode_variation {u Φ : ℝ × ℝ → ℝ} {θ y : ℝ}
(hu : ContDiffAt ℝ ω u (θ,y)) (hΦ : DifferentiableAt ℝ Φ (θ,u (θ,y)))
(he : ∀ᶠ p in 𝓝 (θ,y), HasDerivAt (fun s => u (p.1,s))
(Φ (p.1,u p)-p.2) p.2) :
HasDerivAt (fun s => first u (θ,s))
(first Φ (θ,u (θ,y)) + second Φ (θ,u (θ,y))*first u (θ,y)) y := by
have huN : ∀ᶠ p in 𝓝 (θ,y), ContDiffAt ℝ ω u p := hu.eventually (by simp)
have heq : ∀ᶠ p in 𝓝 (θ,y), second u p = Φ (p.1,u p)-p.2 := by
filter_upwards [he,huN] with p hp hpu
exact (second_hasDerivAt (hpu.differentiableAt (by simp))).unique hp
have hslice : (fun s => second u (s,y)) =ᶠ[𝓝 θ] (fun s => Φ (s,u (s,y))-y) :=
(continuousAt_id.prodMk continuousAt_const).eventually heq
have hcomp := hΦ.hasFDerivAt.comp_hasDerivAt θ
((hasDerivAt_id θ).prodMk (first_hasDerivAt (hu.differentiableAt (by simp))))
have hcoeff : HasDerivAt (fun s => Φ (s,u (s,y))-y)
(first Φ (θ,u (θ,y))+second Φ (θ,u (θ,y))*first u (θ,y)) θ := by
have hc : HasDerivAt (fun s => Φ (s,u (s,y))-y)
(fderiv ℝ Φ (θ,u (θ,y)) (1,first u (θ,y))) θ := hcomp.sub_const y
convert hc using 1
rw [fderiv_pair]
ring
have hd1 := first_hasDerivAt ((second_contDiffAt hu).differentiableAt (by simp))
have hecoeff := hd1.unique (hcoeff.congr_of_eventuallyEq hslice)
have hd2 := second_hasDerivAt ((first_contDiffAt hu).differentiableAt (by simp))
rw [←mixed_comm hu,hecoeff] at hd2
exact hd2
theorem transverse_hit [CompleteSpace E] {f : E × ℝ → ℝ} {p : E} {y a : ℝ}
(hf : ContDiffAt ℝ ω f (p,y)) (hd : HasDerivAt (fun s => f (p,s)) a y)
(ha : a ≠ 0) :
∃ Y : E → ℝ, ContDiffAt ℝ ω Y p ∧ Y p = y ∧
(∀ᶠ q in 𝓝 p, f (q,Y q) = f (p,y)) ∧
∀ᶠ q in 𝓝 (p,y), f q = f (p,y) ↔ Y q.1 = q.2 := by
have hpartial : fderiv ℝ f (p,y) ∘L ContinuousLinearMap.inr ℝ E ℝ =
ContinuousLinearMap.toSpanSingleton ℝ a := by
have hc := (hf.differentiableAt (by simp)).hasFDerivAt.comp y
((hasFDerivAt_const p y).prodMk (hasFDerivAt_id y))
exact hc.unique hd.hasFDerivAt
have hi : (fderiv ℝ f (p,y) ∘L ContinuousLinearMap.inr ℝ E ℝ).IsInvertible := by
rw [hpartial]
refine ⟨(LinearEquiv.smulOfNeZero ℝ ℝ a ha).toContinuousLinearEquiv, ?_⟩
apply ContinuousLinearMap.ext
intro z
change a*z=z*a
ring
exact ⟨hf.implicitFunction (by simp) hi,
hf.contDiffAt_implicitFunction (by simp) hi,
hf.implicitFunction_apply_self (by simp) hi,
hf.eventually_apply_implicitFunction (by simp) hi,
hf.eventually_apply_eq_iff_implicitFunction (by simp) hi⟩
lemma eq_of_hasDerivAt_eq_on_Icc {f g : ℝ → F} {a b c : ℝ}
(hf : ContinuousOn f (Icc a b)) (hg : ContinuousOn g (Icc a b))
{d : ℝ → F}
(hdf : ∀ y ∈ Icc a b, HasDerivAt f (d y) y)
(hdg : ∀ y ∈ Icc a b, HasDerivAt g (d y) y)
(hc : c ∈ Icc a b) (he : f c = g c) : EqOn f g (Icc a b) := by
have hconst := constant_of_has_deriv_right_zero (hf.sub hg)
(fun y hy => (by simpa only [sub_self] using
((hdf y (Ico_subset_Icc_self hy)).sub
(hdg y (Ico_subset_Icc_self hy))).hasDerivWithinAt))
intro y hy
have hh := (hconst y hy).trans (hconst c hc).symm
change f y-g y=f c-g c at hh
simpa only [he, sub_self, sub_eq_zero] using hh
end QuinticLienard.PartialCalculus
end OAI

Xet Storage Details

Size:
6.57 kB
·
Xet hash:
b93d551ee156000b497a6903118a3c50a047e870d46fbe5c84f25f8b5c1d5d5c

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.