cfahlgren1's picture
download
raw
13.5 kB
import OAI.Analysis.HenonEmden.LineCoordinates
namespace OAI
universe uE uE2
section WeakForm
open Set Filter Topology MeasureTheory
open scoped ContDiff
namespace HenonLaneEmden.WeakPDE
variable {E : Type uE} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E]
[MeasurableSpace E] [BorelSpace E]
lemma integrable_mul_compact {f g : E → ℝ} (hg : HasCompactSupport g)
(hf : ContinuousOn f (tsupport g)) (hgc : ContinuousOn g (tsupport g)) :
Integrable (fun x => f x*g x) := by
apply (integrableOn_iff_integrable_of_support_subset ?_).mp
((hf.mul hgc).integrableOn_compact hg)
intro x hx
apply subset_tsupport g
exact (mul_ne_zero_iff.mp hx).2
noncomputable def dir (f : E → ℝ) (e : E) : E → ℝ := fun x => fderiv ℝ f x e
omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in
lemma tsupport_dir_subset (f : E → ℝ) (e : E) : tsupport (dir f e) ⊆ tsupport f :=
tsupport_fderiv_apply_subset ℝ e
omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in
lemma compactSupport_dir {f : E → ℝ} (hf : HasCompactSupport f) (e : E) :
HasCompactSupport (dir f e) := hf.fderiv_apply ℝ e
omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in
lemma contDiffOn_dir {f : E → ℝ} {s : Set E} {k : ℕ∞ω}
(hf : ContDiffOn ℝ (k+1) f s) (hs : IsOpen s) (e : E) :
ContDiffOn ℝ k (dir f e) s :=
(hf.fderiv_of_isOpen hs le_rfl).clm_apply contDiffOn_const
omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in
lemma differentiableAt_dir {f : E → ℝ} {s : Set E}
(hf : ContDiffOn ℝ 2 f s) (hs : IsOpen s) {x : E} (hx : x ∈ s) (e : E) :
DifferentiableAt ℝ (dir f e) x := by
have hc : ContDiffOn ℝ 1 (dir f e) s := contDiffOn_dir hf hs e
exact (hc.contDiffAt (hs.mem_nhds hx)).differentiableAt (by norm_num)
omit [FiniteDimensional ℝ E] [MeasurableSpace E] [BorelSpace E] in
lemma dir_dir {f : E → ℝ} {s : Set E} (hf : ContDiffOn ℝ 2 f s)
(hs : IsOpen s) {x : E} (hx : x ∈ s) (e : E) :
dir (dir f e) e x = iteratedFDeriv ℝ 2 f x ![e,e] := by
have hd : DifferentiableAt ℝ (fderiv ℝ f) x :=
((hf.fderiv_of_isOpen hs (m := 1) (by norm_num)).contDiffAt
(hs.mem_nhds hx)).differentiableAt (by norm_num)
rw [← bilinearIteratedFDerivTwo_eq_iteratedFDeriv]
change (fderiv ℝ (fun y => (fderiv ℝ f y) e) x) e = ((fderiv ℝ (fderiv ℝ f) x) e) e
rw [fderiv_clm_apply hd (differentiableAt_const e)]
simp
lemma integral_laplacian_test {u φ : E → ℝ} {s : Set E} (hs : IsOpen s)
(hu : ContDiffOn ℝ 2 u s) (hφ : ContDiff ℝ 2 φ) (hφc : HasCompactSupport φ)
(hφs : tsupport φ ⊆ s) :
(∫ x, u x * Laplacian.laplacian φ x) = ∫ x, Laplacian.laplacian u x * φ x := by
have hφon : ContDiffOn ℝ 2 φ univ := hφ.contDiffOn
have hφ1 (e : E) : ContDiff ℝ 1 (dir φ e) := by
exact contDiffOn_univ.mp (contDiffOn_dir hφon isOpen_univ e)
have hu1 (e : E) : ContDiffOn ℝ 1 (dir u e) s := contDiffOn_dir hu hs e
have hi1 (e : E) : Integrable (fun x => dir u e x * φ x) :=
integrable_mul_compact hφc ((hu1 e).continuousOn.mono hφs) hφ.continuous.continuousOn
have hi2 (e : E) : Integrable (fun x => dir u e x * dir φ e x) :=
integrable_mul_compact (compactSupport_dir hφc e)
((hu1 e).continuousOn.mono ((tsupport_dir_subset φ e).trans hφs))
(hφ1 e).continuous.continuousOn
have hi3 (e : E) : Integrable (fun x => dir (dir u e) e x * φ x) := by
have hc : ContinuousOn (dir (dir u e) e) s :=
(contDiffOn_dir (k := 0) (by simpa using hu1 e) hs e).continuousOn
exact integrable_mul_compact hφc (hc.mono hφs) hφ.continuous.continuousOn
have hi4 (e : E) : Integrable (fun x => u x * dir φ e x) :=
integrable_mul_compact (compactSupport_dir hφc e)
(hu.continuousOn.mono ((tsupport_dir_subset φ e).trans hφs))
(hφ1 e).continuous.continuousOn
have hi5 (e : E) : Integrable (fun x => u x * dir (dir φ e) e x) := by
have hc : Continuous (dir (dir φ e) e) := by
exact (show ContDiff ℝ 0 (dir (dir φ e) e) from
contDiffOn_univ.mp (contDiffOn_dir (hφ1 e).contDiffOn isOpen_univ e)).continuous
exact integrable_mul_compact (compactSupport_dir (compactSupport_dir hφc e) e)
(hu.continuousOn.mono (((tsupport_dir_subset (dir φ e) e).trans
(tsupport_dir_subset φ e)).trans hφs)) hc.continuousOn
have hidentity (e : E) : (∫ x, u x * dir (dir φ e) e x) =
∫ x, dir (dir u e) e x * φ x := by
have hA := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable (μ := volume)
(f := u) (g := dir φ e) (v := e) (hi2 e) (hi5 e) (hi4 e)
(fun x hx => (hu.contDiffAt (hs.mem_nhds (hφs (tsupport_dir_subset φ e hx)))).differentiableAt
(by norm_num))
(fun x _ => (hφ1 e).differentiable (by norm_num) x)
have hB := integral_mul_fderiv_eq_neg_fderiv_mul_of_integrable (μ := volume)
(f := dir u e) (g := φ) (v := e) (hi3 e) (hi2 e) (hi1 e)
(fun x hx => differentiableAt_dir hu hs (hφs hx) e)
(fun x _ => hφ.differentiable (by norm_num) x)
change (∫ x, u x * dir (dir φ e) e x) = -(∫ x, dir u e x * dir φ e x) at hA
change (∫ x, dir u e x * dir φ e x) = -(∫ x, dir (dir u e) e x * φ x) at hB
rw [hA,hB,neg_neg]
have hleft (x : E) : u x * Laplacian.laplacian φ x =
∑ i, u x * dir (dir φ (stdOrthonormalBasis ℝ E i)) (stdOrthonormalBasis ℝ E i) x := by
rw [InnerProductSpace.laplacian_eq_iteratedFDeriv_stdOrthonormalBasis]
simp only [Finset.mul_sum]
apply Finset.sum_congr rfl
intro i _
rw [dir_dir hφon isOpen_univ (mem_univ x)]
have hright (x : E) : Laplacian.laplacian u x * φ x =
∑ i, dir (dir u (stdOrthonormalBasis ℝ E i)) (stdOrthonormalBasis ℝ E i) x * φ x := by
by_cases hx : x ∈ tsupport φ
· rw [InnerProductSpace.laplacian_eq_iteratedFDeriv_stdOrthonormalBasis]
simp only [Finset.sum_mul]
apply Finset.sum_congr rfl
intro i _
rw [dir_dir hu hs (hφs hx)]
· simp [image_eq_zero_of_notMem_tsupport hx]
simp_rw [hleft,hright]
rw [integral_finsetSum _ (fun i _ => hi5 _), integral_finsetSum _ (fun i _ => hi3 _)]
exact Finset.sum_congr rfl fun i _ => hidentity _
end HenonLaneEmden.WeakPDE
namespace HenonLaneEmden.WeakPDE
lemma ibp_compact_on {f f' φ : ℝ → ℝ} {s : Set ℝ}
(hf : ContinuousOn f s) (hf' : ContinuousOn f' s)
(hd : ∀ x ∈ s, HasDerivAt f (f' x) x)
(hφ : ContDiff ℝ 1 φ) (hc : HasCompactSupport φ) (hs : tsupport φ ⊆ s) :
(∫ x, f x * deriv φ x) = -(∫ x, f' x * φ x) := by
have hdc : Continuous (deriv φ) := hφ.continuous_deriv le_rfl
exact integral_mul_deriv_eq_deriv_mul_of_integrable
(fun x hx => hd x (hs hx)) (fun x _ => (hφ.differentiable one_ne_zero x).hasDerivAt)
(integrable_mul_compact hc.deriv (hf.mono ((tsupport_deriv_subset (f := φ)).trans hs))
hdc.continuousOn)
(integrable_mul_compact hc (hf'.mono hs) hφ.continuous.continuousOn)
(integrable_mul_compact hc (hf.mono hs) hφ.continuous.continuousOn)
lemma weighted_second_ibp {u u' u'' φ : ℝ → ℝ} {s : Set ℝ} (k : ℕ)
(hu : ContinuousOn u s) (hu' : ContinuousOn u' s) (hu'' : ContinuousOn u'' s)
(hdu : ∀ x ∈ s, HasDerivAt u (u' x) x)
(hdu' : ∀ x ∈ s, HasDerivAt u' (u'' x) x)
(hφ : ContDiff ℝ 2 φ) (hc : HasCompactSupport φ) (hs : tsupport φ ⊆ s) :
(∫ r, u r * (r^k * deriv (deriv φ) r + (k:ℝ)*r^(k-1)*deriv φ r)) =
∫ r, (r^k * u'' r + (k:ℝ)*r^(k-1)*u' r)*φ r := by
have hφ' : ContDiff ℝ 1 (deriv φ) := hφ.deriv'
have hA : ContinuousOn (fun r : ℝ => r^k * u r) s := continuousOn_id.pow k |>.mul hu
have hA' : ContinuousOn (fun r : ℝ => r^k*u' r+(k:ℝ)*r^(k-1)*u r) s := by
fun_prop
have hAd : ∀ r ∈ s, HasDerivAt (fun x : ℝ => x^k*u x)
(r^k*u' r+(k:ℝ)*r^(k-1)*u r) r := by
intro r hr
convert! ((hasDerivAt_id r).pow k).mul (hdu r hr) using 1
simp only [Pi.pow_apply, id_eq, mul_one]
ring
have hB : ContinuousOn (fun r : ℝ => r^k*u' r) s := continuousOn_id.pow k |>.mul hu'
have hB' : ContinuousOn (fun r : ℝ => r^k*u'' r+(k:ℝ)*r^(k-1)*u' r) s := by
fun_prop
have hBd : ∀ r ∈ s, HasDerivAt (fun x : ℝ => x^k*u' x)
(r^k*u'' r+(k:ℝ)*r^(k-1)*u' r) r := by
intro r hr
convert! ((hasDerivAt_id r).pow k).mul (hdu' r hr) using 1
simp only [Pi.pow_apply, id_eq, mul_one]
ring
have h1 := ibp_compact_on hA hA' hAd hφ' hc.deriv ((tsupport_deriv_subset (f := φ)).trans hs)
have h2 := ibp_compact_on hB hB' hBd (hφ.of_le (by norm_num)) hc hs
have hiA := integrable_mul_compact hc.deriv.deriv
(hA.mono (((tsupport_deriv_subset (f := deriv φ)).trans (tsupport_deriv_subset (f := φ))).trans hs))
(hφ'.continuous_deriv le_rfl).continuousOn
have hiC : Integrable (fun r : ℝ => ((k:ℝ)*r^(k-1)*u r)*deriv φ r) := by
apply integrable_mul_compact hc.deriv _ hφ'.continuous.continuousOn
exact ((continuousOn_const.mul (continuousOn_id.pow (k-1))).mul hu).mono
((tsupport_deriv_subset (f := φ)).trans hs)
have hiB := integrable_mul_compact hc.deriv
(hB.mono ((tsupport_deriv_subset (f := φ)).trans hs)) hφ'.continuous.continuousOn
calc
_ = (∫ r, (r^k*u r)*deriv (deriv φ) r) +
∫ r, ((k:ℝ)*r^(k-1)*u r)*deriv φ r := by
rw [← integral_add hiA hiC]
congr 1; funext r; ring
_ = -(∫ r, (r^k*u' r+(k:ℝ)*r^(k-1)*u r)*deriv φ r) +
∫ r, ((k:ℝ)*r^(k-1)*u r)*deriv φ r := by rw [h1]
_ = -(∫ r, (r^k*u' r)*deriv φ r) := by
simp_rw [add_mul]
rw [integral_add hiB hiC]
ring
_ = _ := by rw [h2,neg_neg]
end HenonLaneEmden.WeakPDE
namespace HenonLaneEmden.WeakPDE
lemma radial_ode_of_weak {u u' u'' w : ℝ → ℝ} (k : ℕ)
(hu : ContinuousOn u (Ioi 0)) (hu' : ContinuousOn u' (Ioi 0))
(hu'' : ContinuousOn u'' (Ioi 0)) (hw : ContinuousOn w (Ioi 0))
(hdu : ∀ r > 0, HasDerivAt u (u' r) r)
(hdu' : ∀ r > 0, HasDerivAt u' (u'' r) r)
(hweak : ∀ φ : ℝ → ℝ, ContDiff ℝ ∞ φ → HasCompactSupport φ → tsupport φ ⊆ Ioi 0 →
(∫ r, u r * (r^k*deriv (deriv φ) r+(k:ℝ)*r^(k-1)*deriv φ r)) =
∫ r, r^k*w r*φ r) :
∀ r > 0, r^k*u'' r+(k:ℝ)*r^(k-1)*u' r = r^k*w r := by
let F : ℝ → ℝ := fun r => r^k*u'' r+(k:ℝ)*r^(k-1)*u' r-r^k*w r
have hFc : ContinuousOn F (Ioi 0) := by unfold F; fun_prop
have hae : ∀ᵐ r, r ∈ Ioi (0:ℝ) → F r = 0 := by
apply isOpen_Ioi.ae_eq_zero_of_integral_contDiff_smul_eq_zero
(hFc.locallyIntegrableOn measurableSet_Ioi)
intro φ hφ hc hs
have htest := weighted_second_ibp k hu hu' hu'' hdu hdu' (hφ.of_le (by exact WithTop.coe_le_coe.mpr le_top)) hc hs
have hi1 : Integrable (fun r => (r^k*u'' r+(k:ℝ)*r^(k-1)*u' r)*φ r) := by
apply integrable_mul_compact hc _ hφ.continuous.continuousOn
have hp : ContinuousOn (fun r : ℝ => r^k*u'' r+(k:ℝ)*r^(k-1)*u' r) (Ioi 0) := by fun_prop
exact hp.mono hs
have hi2 : Integrable (fun r => r^k*w r*φ r) :=
integrable_mul_compact hc (((continuousOn_id.pow k).mul hw).mono hs) hφ.continuous.continuousOn
calc
(∫ r, φ r • F r) = (∫ r, (r^k*u'' r+(k:ℝ)*r^(k-1)*u' r)*φ r) -
∫ r, r^k*w r*φ r := by
rw [← integral_sub hi1 hi2]
congr 1; funext r; simp only [smul_eq_mul,F]; ring
_ = 0 := by rw [← htest, hweak φ hφ hc hs,sub_self]
have hae' : F =ᵐ[volume.restrict (Ioi (0:ℝ))] (fun _ => 0) := by
exact (ae_restrict_iff' measurableSet_Ioi).mpr hae
have heq := Measure.eqOn_open_of_ae_eq hae' isOpen_Ioi hFc continuousOn_const
intro r hr
exact sub_eq_zero.mp (heq hr)
end HenonLaneEmden.WeakPDE
namespace HenonLaneEmden.WeakPDE
variable {E : Type uE2} [NormedAddCommGroup E] [InnerProductSpace ℝ E] [FiniteDimensional ℝ E]
lemma continuousOn_laplacian {u : E → ℝ} {s : Set E} (hs : IsOpen s)
(hu : ContDiffOn ℝ 2 u s) : ContinuousOn (Laplacian.laplacian u) s := by
have hsum : ContinuousOn (fun x => ∑ i, dir (dir u (stdOrthonormalBasis ℝ E i))
(stdOrthonormalBasis ℝ E i) x) s := by
apply continuousOn_finsetSum
intro i _
exact (contDiffOn_dir (k := 0) (contDiffOn_dir hu hs _) hs _).continuousOn
apply hsum.congr
intro x hx
rw [InnerProductSpace.laplacian_eq_iteratedFDeriv_stdOrthonormalBasis]
apply Finset.sum_congr rfl
intro i _
exact (dir_dir hu hs hx _).symm
lemma laplacian_zero_of_notMem_tsupport {u : E → ℝ} {x : E} (hx : x ∉ tsupport u) :
Laplacian.laplacian u x = 0 := by
rw [(InnerProductSpace.laplacian_congr_nhds (notMem_tsupport_iff_eventuallyEq.mp hx)).self_of_nhds,
InnerProductSpace.laplacian_eq_iteratedFDeriv_stdOrthonormalBasis]
simp
lemma tsupport_laplacian_subset (u : E → ℝ) : tsupport (Laplacian.laplacian u) ⊆ tsupport u := by
apply closure_minimal _ (isClosed_tsupport u)
intro x hx
by_contra hn
exact hx (laplacian_zero_of_notMem_tsupport hn)
lemma compactSupport_laplacian {u : E → ℝ} (hu : HasCompactSupport u) :
HasCompactSupport (Laplacian.laplacian u) :=
hu.of_isClosed_subset (isClosed_tsupport _) (tsupport_laplacian_subset _)
lemma continuous_laplacian {u : E → ℝ} (hu : ContDiff ℝ 2 u) :
Continuous (Laplacian.laplacian u) := by
rw [← continuousOn_univ]
exact continuousOn_laplacian isOpen_univ hu.contDiffOn
end HenonLaneEmden.WeakPDE
end WeakForm
end OAI

Xet Storage Details

Size:
13.5 kB
·
Xet hash:
539863b9c65282d33eed5194aae5f98e20b112307133f57609ba64fe90a22b2e

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