cfahlgren1/math / lean /OAI /Probability /SKValue /Evolution /SmoothEvolution.lean
cfahlgren1's picture
download
raw
9.21 kB
import Mathlib
import OAI.Probability.SKValue.Evolution.LogHeatJets
namespace OAI
section
open MeasureTheory ProbabilityTheory Set Filter
open scoped Topology NNReal ENNReal BigOperators ContDiff
namespace SKValue
lemma coleHopf_gradient_pde {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c h : ℝ} (hc : 0≤c) (hh : 0<h) (x : ℝ) :
HasDerivAt (fun r ↦ deriv (coleHopf c r ψ) x)
((1/2 : ℝ)*deriv (deriv (deriv (coleHopf c h ψ))) x+
c*(deriv (coleHopf c h ψ) x*deriv (deriv (coleHopf c h ψ)) x)) h := by
rcases hc.eq_or_lt with rfl | hc
· simpa only [coleHopf_zero_coeff,zero_mul,add_zero,show (3 : ℕ)=1+1+1 from rfl,
iteratedDeriv_succ,iteratedDeriv_one,iteratedDeriv_zero] using heat_jet_time hψ.smooth hψ.growth 1 x hh
· let F := fun r ↦ heat r (fun y ↦ Real.exp (c*ψ y))
have hes : ContDiff ℝ ∞ (fun x ↦ Real.exp (c*ψ x)) := (contDiff_const.mul hψ.smooth).exp
have hg := exp_iteratedDeriv_growth hψ.lipschitz hψ.smooth hψ.jets hc.le
have hp : ∀ r x, F r x≠0 := fun r x ↦ (lipschitz_exp_integral_pos hψ.lipschitz hc.le x (Real.sqrt r)).ne'
have hd := (heat_normalizedJet_time hes hg hp 1 x hh).const_mul c⁻¹
have hj0 := congrFun (coleHopf_gradient_jet_expr hψ hc 0 h) x
have hj1 := congrFun (coleHopf_gradient_jet_expr hψ hc 1 h) x
have hj2 := congrFun (coleHopf_gradient_jet_expr hψ hc 2 h) x
simp only [iteratedDeriv_zero,show (2 : ℕ)=1+1 from rfl,
iteratedDeriv_succ,JetExpr.logGradientJet,JetExpr.D,JetExpr.σx,JetExpr.eval] at hj0 hj1 hj2
convert! hd using 1
· funext r
rw [coleHopf_deriv_eq_normalizedJet hψ.lipschitz hψ.smooth hψ.jets hc r]
· rw [hj0,hj1,hj2]
field_simp [hc.ne']
ring
lemma integral_from_deriv_on_strip {T : ℝ} {f g : ℝ → ℝ}
(hf : ContinuousOn f (Icc (0 : ℝ) T)) (hg : ContinuousOn g (Icc (0 : ℝ) T))
(hd : ∀ r∈Ioo (0 : ℝ) T, HasDerivAt f (g r) r)
{s t : ℝ} (hs : s∈Icc (0 : ℝ) T) (ht : t∈Icc (0 : ℝ) T) :
f s-f t=∫ r in t..s, g r := by
have hi {a b : ℝ} (ha : a∈Icc (0 : ℝ) T) (hb : b∈Icc (0 : ℝ) T) :
IntervalIntegrable g volume a b :=
(hg.mono (by
intro r hr
rcases mem_uIcc.mp hr with hr | hr
· exact ⟨ha.1.trans hr.1,hr.2.trans hb.2⟩
· exact ⟨hb.1.trans hr.1,hr.2.trans ha.2⟩)).intervalIntegrable
have he {a : ℝ} (ha : a∈Icc (0 : ℝ) T) : ∫ r in (0 : ℝ)..a, g r=f a-f 0 :=
intervalIntegral.integral_eq_sub_of_hasDerivAt_of_le ha.1
(hf.mono (Icc_subset_Icc le_rfl ha.2))
(fun r hr ↦ hd r ⟨hr.1,hr.2.trans_le ha.2⟩) (hi ⟨le_rfl,ha.1.trans ha.2⟩ ha)
have hadd := intervalIntegral.integral_add_adjacent_intervals (hi ⟨le_rfl,ht.1.trans ht.2⟩ ht) (hi ht hs)
rw [he hs,he ht] at hadd
linarith
structure SmoothEvolution (T : ℝ) (γ : ℝ → ℝ) (V : ℝ → ℝ → ℝ) : Prop where
slices : ∀ t∈Icc (0 : ℝ) T, SmoothTerminal (V t)
continuous_value : ∀ x, ContinuousOn (fun t ↦ V t x) (Icc (0 : ℝ) T)
continuous_jet : ∀ n x, ContinuousOn (fun t ↦ iteratedDeriv n (deriv (V t)) x) (Icc (0 : ℝ) T)
bound : ∀ n, ∃ C : ℝ, 0≤C ∧ ∀ t∈Icc (0 : ℝ) T, ∀ x,
|iteratedDeriv n (deriv (V t)) x|≤C
temporal : ∀ n, ∃ L : ℝ, 0≤L ∧ ∀ s∈Icc (0 : ℝ) T, ∀ t∈Icc (0 : ℝ) T, ∀ x,
|iteratedDeriv n (deriv (V s)) x-iteratedDeriv n (deriv (V t)) x|≤L* |s-t|
value_pde : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x,
V s x-V t x=-(∫ r in t..s, (1/2 : ℝ)*deriv (deriv (V r)) x+γ r*((1/2 : ℝ)*(deriv (V r) x)^2))
gradient_pde : ∀ t∈Icc (0 : ℝ) T, ∀ s∈Icc (0 : ℝ) T, ∀ x,
deriv (V s) x-deriv (V t) x=-(∫ r in t..s, (1/2 : ℝ)*deriv (deriv (deriv (V r))) x+
γ r*(deriv (V r) x*deriv (deriv (V r)) x))
lemma SmoothTerminal.backward_jet_continuous {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T : ℝ) (n : ℕ) (x : ℝ) :
Continuous (fun t ↦ iteratedDeriv n (deriv (coleHopf c (T-t) ψ)) x) := by
have hmap : Continuous (fun t : ℝ ↦ (T-t,x)) :=
(continuous_const.sub continuous_id).prodMk continuous_const
have hj : Continuous (fun p : ℝ×ℝ ↦ iteratedDeriv n (deriv (coleHopf c p.1 ψ)) p.2) :=
hψ.coleHopf_joint_jets hc n
convert hj.comp hmap using 1
rfl
lemma SmoothTerminal.backward_gradient_continuous {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T x : ℝ) :
Continuous (fun t ↦ deriv (coleHopf c (T-t) ψ) x) := by
simpa only [iteratedDeriv_zero] using hψ.backward_jet_continuous hc T 0 x
lemma SmoothTerminal.backward_curvature_continuous {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T x : ℝ) :
Continuous (fun t ↦ deriv (deriv (coleHopf c (T-t) ψ)) x) := by
simpa only [iteratedDeriv_one] using hψ.backward_jet_continuous hc T 1 x
lemma SmoothTerminal.backward_third_continuous {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T x : ℝ) :
Continuous (fun t ↦ deriv (deriv (deriv (coleHopf c (T-t) ψ))) x) := by
simpa only [show (2 : ℕ)=1+1 from rfl,iteratedDeriv_succ,iteratedDeriv_one,iteratedDeriv_zero]
using hψ.backward_jet_continuous hc T 2 x
lemma SmoothTerminal.backward_value_continuous {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T x : ℝ) :
Continuous (fun t ↦ coleHopf c (T-t) ψ x) :=
(coleHopf_continuous hψ.lipschitz hc).comp ((continuous_const.sub continuous_id).prodMk continuous_const)
lemma SmoothTerminal.backward_value_pde {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T : ℝ) {s t : ℝ}
(ht : t∈Icc (0 : ℝ) T) (hs : s∈Icc (0 : ℝ) T) (x : ℝ) :
coleHopf c (T-s) ψ x-coleHopf c (T-t) ψ x =
-(∫ r in t..s, (1/2 : ℝ)*deriv (deriv (coleHopf c (T-r) ψ)) x+
c*((1/2 : ℝ)*(deriv (coleHopf c (T-r) ψ) x)^2)) := by
let g := fun r ↦ (1/2 : ℝ)*deriv (deriv (coleHopf c (T-r) ψ)) x+
c*((1/2 : ℝ)*(deriv (coleHopf c (T-r) ψ) x)^2)
have hgc : Continuous g := by
exact (continuous_const.mul (hψ.backward_curvature_continuous hc T x)).add
(continuous_const.mul (continuous_const.mul ((hψ.backward_gradient_continuous hc T x).pow 2)))
have hd (r : ℝ) (hr : r∈Ioo (0 : ℝ) T) :
HasDerivAt (fun r ↦ coleHopf c (T-r) ψ x) (-g r) r := by
obtain ⟨K,hK,hb⟩ := hψ.jets.deriv.bound_zero
have hd := coleHopf_backward_pde hψ.lipschitz
(hψ.smooth.of_le (ENat.natCast_le_of_coe_top_le_withTop le_rfl 2)) hK hb hc hr.2 x
convert! hd using 1
dsimp only [g]
ring
have he := integral_from_deriv_on_strip
(hψ.backward_value_continuous hc T x).continuousOn hgc.neg.continuousOn hd hs ht
change _ = ∫ r in t..s, -(g r) at he
rw [intervalIntegral.integral_neg] at he
exact he
lemma SmoothTerminal.backward_gradient_pde {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T : ℝ) {s t : ℝ}
(ht : t∈Icc (0 : ℝ) T) (hs : s∈Icc (0 : ℝ) T) (x : ℝ) :
deriv (coleHopf c (T-s) ψ) x-deriv (coleHopf c (T-t) ψ) x =
-(∫ r in t..s, (1/2 : ℝ)*deriv (deriv (deriv (coleHopf c (T-r) ψ))) x+
c*(deriv (coleHopf c (T-r) ψ) x*deriv (deriv (coleHopf c (T-r) ψ)) x)) := by
let g := fun r ↦ (1/2 : ℝ)*deriv (deriv (deriv (coleHopf c (T-r) ψ))) x+
c*(deriv (coleHopf c (T-r) ψ) x*deriv (deriv (coleHopf c (T-r) ψ)) x)
have hgc : Continuous g := by
exact (continuous_const.mul (hψ.backward_third_continuous hc T x)).add
(continuous_const.mul ((hψ.backward_gradient_continuous hc T x).mul (hψ.backward_curvature_continuous hc T x)))
have hd (r : ℝ) (hr : r∈Ioo (0 : ℝ) T) :
HasDerivAt (fun r ↦ deriv (coleHopf c (T-r) ψ) x) (-g r) r := by
have hd := (coleHopf_gradient_pde hψ hc (sub_pos.mpr hr.2) x).comp r
((hasDerivAt_const r T).sub (hasDerivAt_id r))
convert! hd using 1
dsimp only [g]
ring
have he := integral_from_deriv_on_strip (hψ.backward_gradient_continuous hc T x).continuousOn hgc.neg.continuousOn hd hs ht
change _ = ∫ r in t..s, -(g r) at he
rw [intervalIntegral.integral_neg] at he
exact he
lemma SmoothTerminal.constant_evolution {ψ : ℝ → ℝ} (hψ : SmoothTerminal ψ)
{c : ℝ} (hc : 0≤c) (T : ℝ) :
SmoothEvolution T (fun _ ↦ c) (fun t ↦ coleHopf c (T-t) ψ) := by
refine ⟨fun _ _ ↦ hψ.evolve hc _,fun x ↦ (hψ.backward_value_continuous hc T x).continuousOn,
fun n x ↦ (hψ.backward_jet_continuous hc T n x).continuousOn,?_,?_,?_,?_⟩
· intro n
obtain ⟨C,hC,hb⟩ := hψ.coleHopf_uniform_jets hc n
exact ⟨C,hC,fun t _ x ↦ hb (T-t) x⟩
· intro n
obtain ⟨L,hL,hb⟩ := hψ.coleHopf_jets_time_lipschitz hc n
refine ⟨L,hL,?_⟩
intro s hs t ht x
have he : |(T-s)-(T-t)|=|s-t| := by rw [sub_sub_sub_cancel_left,abs_sub_comm]
simpa only [he] using hb (T-s) (T-t) x (sub_nonneg.mpr hs.2) (sub_nonneg.mpr ht.2)
· intro t ht s hs x
exact hψ.backward_value_pde hc T ht hs x
· intro t ht s hs x
exact hψ.backward_gradient_pde hc T ht hs x
end SKValue
end
end OAI

Xet Storage Details

Size:
9.21 kB
·
Xet hash:
663c2e374785291cab3c133d4659f7df7051e8d0a45ae44fd1b94af11d2ed8c1

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