math / data /lean /OAI /Probability /GaussianPropeller /HeatMaximum.lean
introvoyz045's picture
Migrated from GitHub
4a56cd6 verified
Raw History Blame Contribute Delete
24.2 kB
import OAI.Probability.GaussianPropeller.QuantileCalculus
namespace OAI
universe uE uΞΉ
open MeasureTheory ProbabilityTheory
open scoped ENNReal
open scoped RealInnerProductSpace
open scoped RealInnerProductSpace
open MeasureTheory ProbabilityTheory Set
open scoped ENNReal RealInnerProductSpace
open Filter
open scoped Topology
open MeasureTheory ProbabilityTheory Set Filter
open scoped Topology
open scoped RealInnerProductSpace
open Set Filter
open scoped Topology RealInnerProductSpace
namespace GaussianPropeller.HeatMaximum
lemma second_deriv_nonneg_of_localMin {f g : ℝ β†’ ℝ} {d : ℝ}
(hf : βˆ€ s, HasDerivAt f (g s) s) (hg : HasDerivAt g d 0)
(hm : IsLocalMin f 0) : 0 ≀ d := by
by_contra hd
have hd0 : d < 0 := lt_of_not_ge hd
have hg0 : g 0 = 0 := hm.hasDerivAt_eq_zero (hf 0)
have ht := hg.tendsto_slope.eventually (Iio_mem_nhds hd0)
have hne : βˆ€αΆ  s in 𝓝[>] (0:ℝ), g s < 0 := by
have ht' := ht.filter_mono (nhdsWithin_mono (0:ℝ) (by
intro x hx; exact ne_of_gt hx))
filter_upwards [ht', self_mem_nhdsWithin] with s hs hs0
rw [slope_def_field, hg0, sub_zero, sub_zero] at hs
simpa only [zero_mul] using (div_lt_iffβ‚€ (show 0 < s from hs0)).mp hs
obtain ⟨a, ha, hsub⟩ := Metric.mem_nhdsWithin_iff.mp hne
obtain ⟨b, hb, hmin⟩ := Metric.mem_nhds_iff.mp hm
let c := min a b / 2
have hc : 0 < c := by dsimp [c]; positivity
have hca : c < a := by dsimp [c]; have := min_le_left a b; linarith
have hcb : c < b := by dsimp [c]; have := min_le_right a b; linarith
have hant : StrictAntiOn f (Icc 0 c) := strictAntiOn_of_deriv_neg (convex_Icc 0 c)
(fun x _ => (hf x).continuousAt.continuousWithinAt)
(fun x hx => by
rw [interior_Icc] at hx
rw [(hf x).deriv]
apply hsub
exact ⟨by simpa only [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos hx.1] using hx.2.trans hca,
hx.1⟩)
have hlt : f c < f 0 := hant (by simp [hc.le]) (by simp [hc.le]) hc
have hge : f 0 ≀ f c := by
apply hmin
simpa only [Metric.mem_ball, Real.dist_eq, sub_zero, abs_of_pos hc] using hcb
exact (not_lt_of_ge hge) hlt
lemma deriv_nonpos_of_min_on_left {f : ℝ β†’ ℝ} {a t d : ℝ} (hat : a < t)
(hm : βˆ€ s ∈ Icc a t, f t ≀ f s) (hd : HasDerivAt f d t) : d ≀ 0 := by
have ht := hd.tendsto_slope.mono_left (nhdsWithin_mono t (by
intro s hs; exact ne_of_lt hs : Iio t βŠ† {t}ᢜ))
apply le_of_tendsto ht
filter_upwards [mem_nhdsWithin_of_mem_nhds (Ioi_mem_nhds (a := a) hat), self_mem_nhdsWithin] with s ha hs
rw [slope_def_field]
exact div_nonpos_of_nonneg_of_nonpos (sub_nonneg.mpr (hm s ⟨ha.le,hs.le⟩))
(sub_nonpos.mpr hs.le)
lemma square_norm_difference_bound {E : Type uE} [NormedAddCommGroup E]
{p q : E} {L b r : ℝ} (_hL : 0 ≀ L) (hb : 0 ≀ b) (hr : 0 ≀ r)
(hp : β€–pβ€– ≀ L) (hq : β€–qβ€– ≀ L) (hpq : β€–p-qβ€– ≀ 2*b*r) :
|β€–pβ€–^2-β€–qβ€–^2| ≀ 4*L*b*r := by
have hn := abs_norm_sub_norm_le p q
have heq : β€–pβ€–^2-β€–qβ€–^2 = (β€–pβ€–-β€–qβ€–)*(β€–pβ€–+β€–qβ€–) := by ring
rw [heq, abs_mul, abs_of_nonneg (by positivity : 0 ≀ β€–pβ€–+β€–qβ€–)]
calc
_ ≀ (2*b*r)*(2*L) := mul_le_mul (hn.trans hpq) (by linarith) (by positivity) (by positivity)
_ = _ := by ring
lemma weighted_linear_le_quadratic {a b r s : ℝ} (ha : 0 ≀ a) (hb : 0 ≀ b)
(hab : a+b=1) : a*r+b*s ≀ 1+a*r^2+b*s^2 := by
have hr : r ≀ 1+r^2 := by nlinarith only [sq_nonneg (r-1/2)]
have hs : s ≀ 1+s^2 := by nlinarith only [sq_nonneg (s-1/2)]
nlinarith only [mul_le_mul_of_nonneg_left hr ha, mul_le_mul_of_nonneg_left hs hb, hab]
lemma reaction_bound {E : Type uE} [NormedAddCommGroup E]
{pβ‚€ p₁ pβ‚‚ : E} {a b Οƒ L M r s vβ‚€ v₁ vβ‚‚ : ℝ}
(ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a+b=1) (hΟƒ : 0 ≀ Οƒ)
(hL : 0 ≀ L) (hM : 0 ≀ M) (hr : 0 ≀ r) (hs : 0 ≀ s)
(hpβ‚€ : β€–pβ‚€β€– ≀ L) (hp₁ : β€–p₁‖ ≀ L) (hpβ‚‚ : β€–pβ‚‚β€– ≀ L)
(hv₁ : |v₁| ≀ M+L*r) (hvβ‚‚ : |vβ‚‚| ≀ M+L*s)
(hp₁₀ : β€–pβ‚€-p₁‖ ≀ 2*Οƒ*r) (hpβ‚‚β‚€ : β€–pβ‚€-pβ‚‚β€– ≀ 2*Οƒ*s)
(hdef : vβ‚€-a*v₁-b*vβ‚‚+Οƒ*(1+a*r^2+b*s^2) ≀ 0) :
vβ‚€*β€–pβ‚€β€–^2-a*v₁*β€–p₁‖^2-b*vβ‚‚*β€–pβ‚‚β€–^2 ≀
4*L*Οƒ*(M+L)*(1+a*r^2+b*s^2) := by
have h1 := square_norm_difference_bound hL hΟƒ hr hpβ‚€ hp₁ hp₁₀
have h2 := square_norm_difference_bound hL hσ hs hp₀ hp₂ hp₂₀
have hv : vβ‚€-a*v₁-b*vβ‚‚ ≀ 0 := by
have : 0 ≀ Οƒ*(1+a*r^2+b*s^2) := by positivity
linarith only [hdef,this]
have hh1 : v₁*(β€–pβ‚€β€–^2-β€–p₁‖^2) ≀ (M+L*r)*(4*L*Οƒ*r) := by
calc
_ ≀ |v₁*(β€–pβ‚€β€–^2-β€–p₁‖^2)| := le_abs_self _
_ = |v₁| * |β€–pβ‚€β€–^2-β€–p₁‖^2| := abs_mul _ _
_ ≀ _ := mul_le_mul hv₁ h1 (abs_nonneg _) (by positivity)
have hh2 : vβ‚‚*(β€–pβ‚€β€–^2-β€–pβ‚‚β€–^2) ≀ (M+L*s)*(4*L*Οƒ*s) := by
calc
_ ≀ |vβ‚‚*(β€–pβ‚€β€–^2-β€–pβ‚‚β€–^2)| := le_abs_self _
_ = |vβ‚‚| * |β€–pβ‚€β€–^2-β€–pβ‚‚β€–^2| := abs_mul _ _
_ ≀ _ := mul_le_mul hvβ‚‚ h2 (abs_nonneg _) (by positivity)
have hb1 := mul_le_mul_of_nonneg_left hh1 ha
have hb2 := mul_le_mul_of_nonneg_left hh2 hb
have hb0 := mul_nonpos_of_nonpos_of_nonneg hv (sq_nonneg β€–pβ‚€β€–)
have hc := weighted_linear_le_quadratic ha hb hab (r := r) (s := s)
have hc' : M*(a*r+b*s)+L*(a*r^2+b*s^2) ≀ (M+L)*(1+a*r^2+b*s^2) := by
nlinarith only [mul_le_mul_of_nonneg_left hc hM,hL]
have hc'' := mul_le_mul_of_nonneg_left hc' (by positivity : 0 ≀ 4*L*Οƒ)
nlinarith only [hb0,hb1,hb2,hc'']
section Spatial
variable {E : Type uE} [NormedAddCommGroup E] [InnerProductSpace ℝ E]
noncomputable def deficit (v : E β†’ ℝ) (a b Οƒ : ℝ) (x y : E) : ℝ :=
v (a β€’ x+b β€’ y)-a*v x-b*v y+Οƒ*(1+a*β€–xβ€–^2+b*β€–yβ€–^2)
lemma hasDerivAt_line {v : E β†’ ℝ} {p : E β†’ E}
(hp : βˆ€ x, HasFDerivAt v (innerSL ℝ (p x)) x) (x e : E) (s : ℝ) :
HasDerivAt (fun s : ℝ => v (x+s β€’ e)) (βŸͺp (x+s β€’ e),e⟫) s := by
convert (hp (x+s β€’ e)).comp_hasDerivAt s
(((hasDerivAt_id s).smul_const e).const_add x) using 1 <;> first | rfl | simp
lemma min_gradient_left {v : E β†’ ℝ} {p : E β†’ E} {a b Οƒ : ℝ} {x y : E}
(hp : βˆ€ x, HasFDerivAt v (innerSL ℝ (p x)) x) (ha : 0 < a)
(hm : βˆ€ x' y', deficit v a b Οƒ x y ≀ deficit v a b Οƒ x' y') :
p (a β€’ x+b β€’ y)-p x = -(2*Οƒ) β€’ x := by
let e := p (a β€’ x+b β€’ y)-p x+(2*Οƒ) β€’ x
have hm' : IsLocalMin (fun s : ℝ => deficit v a b Οƒ (x+s β€’ e) y) 0 := by
apply Filter.Eventually.of_forall
intro s
simpa only [zero_smul, add_zero] using hm (x+s β€’ e) y
have hz : HasDerivAt (fun s : ℝ => v (a β€’ (x+s β€’ e)+b β€’ y))
(a*βŸͺp (a β€’ x+b β€’ y),e⟫) 0 := by
have hpath : HasDerivAt (fun s : ℝ => a β€’ (x+s β€’ e)+b β€’ y) (a β€’ e) 0 := by
convert ((((hasDerivAt_id (0:ℝ)).smul_const e).const_add x).const_smul a).add_const (b β€’ y) using 1 <;> simp
convert (hp (a β€’ (x+(0:ℝ) β€’ e)+b β€’ y)).comp_hasDerivAt 0 hpath using 1 <;>
first | rfl | simp [innerSL_apply_apply]
have hx := hasDerivAt_line hp x e 0
have hn := (((hasDerivAt_id (0:ℝ)).smul_const e).const_add x).norm_sq
have hd := ((hz.sub (hx.const_mul a)).sub_const (b*v y)).add
(((hn.const_mul a).const_add 1 |>.add_const (b*β€–yβ€–^2)).const_mul Οƒ)
have hzero := hm'.hasDerivAt_eq_zero hd
have hei : βŸͺe,e⟫ = βŸͺp (a β€’ x+b β€’ y),e⟫-βŸͺp x,e⟫+(2*Οƒ)*βŸͺx,e⟫ := by
change βŸͺp (a β€’ x+b β€’ y)-p x+(2*Οƒ) β€’ x,e⟫ = _
simp only [inner_add_left, inner_sub_left, real_inner_smul_left]
rw [real_inner_self_eq_norm_sq] at hei
have he : a*β€–eβ€–^2 = 0 := by
simp only [zero_smul, add_zero, id_eq, one_smul] at hzero
rw [hei]
nlinarith only [hzero]
have he0 : e = 0 := norm_eq_zero.mp (sq_eq_zero_iff.mp ((mul_eq_zero.mp he).resolve_left ha.ne'))
dsimp only [e] at he0
simpa only [neg_smul] using eq_neg_iff_add_eq_zero.mpr he0
lemma min_gradient_right {v : E β†’ ℝ} {p : E β†’ E} {a b Οƒ : ℝ} {x y : E}
(hp : βˆ€ x, HasFDerivAt v (innerSL ℝ (p x)) x) (hb : 0 < b)
(hm : βˆ€ x' y', deficit v a b Οƒ x y ≀ deficit v a b Οƒ x' y') :
p (a β€’ x+b β€’ y)-p y = -(2*Οƒ) β€’ y := by
have hs (x y : E) : deficit v b a Οƒ y x = deficit v a b Οƒ x y := by
unfold deficit
rw [add_comm (b β€’ y) (a β€’ x)]
ring
have hh := min_gradient_left hp hb (x := y) (y := x) (a := b) (b := a)
(fun y' x' => by rw [hs,hs]; exact hm x' y')
simpa only [add_comm (b β€’ y) (a β€’ x)] using hh
lemma min_hessian_diagonal {v : E β†’ ℝ} {p : E β†’ E} {H : E β†’ E β†’ ℝ}
{a b Οƒ : ℝ} {x y : E} (hab : a+b=1)
(hp : βˆ€ x, HasFDerivAt v (innerSL ℝ (p x)) x)
(hH : βˆ€ x e, HasDerivAt (fun s : ℝ => βŸͺp (x+s β€’ e),e⟫) (H x e) 0)
(hm : βˆ€ x' y', deficit v a b Οƒ x y ≀ deficit v a b Οƒ x' y') (e : E) :
0 ≀ H (a β€’ x+b β€’ y) e-a*H x e-b*H y e+2*Οƒ*β€–eβ€–^2 := by
let z := a β€’ x+b β€’ y
have hz (s : ℝ) : a β€’ (x+s β€’ e)+b β€’ (y+s β€’ e) = z+s β€’ e := by
dsimp only [z]
simp only [smul_add, smul_smul]
rw [add_add_add_comm, ← add_smul, ← add_mul, hab, one_mul]
let F (s : ℝ) := v (z+s β€’ e)-a*v (x+s β€’ e)-b*v (y+s β€’ e)+
Οƒ*(1+a*β€–x+s β€’ eβ€–^2+b*β€–y+s β€’ eβ€–^2)
let G (s : ℝ) := βŸͺp (z+s β€’ e),e⟫-a*βŸͺp (x+s β€’ e),e⟫-b*βŸͺp (y+s β€’ e),e⟫+
Οƒ*(a*(2*βŸͺx+s β€’ e,e⟫)+b*(2*βŸͺy+s β€’ e,e⟫))
have hf (s : ℝ) : HasDerivAt F (G s) s := by
have hx := (((hasDerivAt_id s).smul_const e).const_add x).norm_sq
have hy := (((hasDerivAt_id s).smul_const e).const_add y).norm_sq
convert (((hasDerivAt_line hp z e s).sub ((hasDerivAt_line hp x e s).const_mul a)).sub
((hasDerivAt_line hp y e s).const_mul b)).add
((((hx.const_mul a).const_add 1).add (hy.const_mul b)).const_mul Οƒ) using 1 <;>
first | rfl | simp [G]
have hi (x : E) : HasDerivAt (fun s : ℝ => βŸͺx+s β€’ e,e⟫) (β€–eβ€–^2) 0 := by
convert ((((hasDerivAt_id (0:ℝ)).smul_const e).const_add x).inner (π•œ := ℝ)
(hasDerivAt_const (0:ℝ) e)) using 1 <;> first | rfl | simp
have hg : HasDerivAt G (H z e-a*H x e-b*H y e+2*Οƒ*β€–eβ€–^2) 0 := by
convert (((hH z e).sub ((hH x e).const_mul a)).sub ((hH y e).const_mul b)).add
((((hi x).const_mul 2 |>.const_mul a).add ((hi y).const_mul 2 |>.const_mul b)).const_mul Οƒ) using 1
all_goals first | rfl | (have hh := congrArg (fun u : ℝ => 2*Οƒ*β€–eβ€–^2*u) hab; nlinarith only [hh])
have hmin : IsLocalMin F 0 := by
apply Filter.Eventually.of_forall
intro s
simpa only [deficit,hz,zero_smul,add_zero,F,z] using hm (x+s β€’ e) (y+s β€’ e)
exact second_deriv_nonneg_of_localMin hf hg hmin
lemma min_laplacian_bound {ΞΉ : Type uΞΉ} [Fintype ΞΉ] (basis : ΞΉ β†’ E)
(hbasis : βˆ€ i, β€–basis iβ€– = 1)
{v : E β†’ ℝ} {p : E β†’ E} {H : E β†’ E β†’ ℝ}
{a b Οƒ : ℝ} {x y : E} (hab : a+b=1)
(hp : βˆ€ x, HasFDerivAt v (innerSL ℝ (p x)) x)
(hH : βˆ€ x e, HasDerivAt (fun s : ℝ => βŸͺp (x+s β€’ e),e⟫) (H x e) 0)
(hm : βˆ€ x' y', deficit v a b Οƒ x y ≀ deficit v a b Οƒ x' y') :
-2*Οƒ*(Fintype.card ΞΉ : ℝ) ≀
(βˆ‘ i, H (a β€’ x+b β€’ y) (basis i))-a*(βˆ‘ i, H x (basis i))-b*(βˆ‘ i, H y (basis i)) := by
have hh := Finset.sum_nonneg (fun (i : ι) (_ : i ∈ Finset.univ) =>
min_hessian_diagonal hab hp hH hm (basis i))
simp only [hbasis,one_pow,mul_one,Finset.sum_add_distrib,Finset.sum_sub_distrib,
← Finset.mul_sum, Finset.sum_const, Finset.card_univ, nsmul_eq_mul] at hh
linarith only [hh]
lemma no_forbidden_minimum {ΞΉ : Type uΞΉ} [Fintype ΞΉ] (basis : ΞΉ β†’ E)
(hbasis : βˆ€ i, β€–basis iβ€– = 1)
{v : ℝ β†’ E β†’ ℝ} {p : E β†’ E} {H : E β†’ E β†’ ℝ} {Οƒf : ℝ β†’ ℝ}
{a b L M t : ℝ} {x y : E} (ha : 0 < a) (hb : 0 < b) (hab : a+b=1)
(hL : 0 ≀ L) (hM : 0 ≀ M) (ht : 0 < t) (hΟƒ : 0 < Οƒf t)
(hp : βˆ€ x, HasFDerivAt (v t) (innerSL ℝ (p x)) x)
(hH : βˆ€ x e, HasDerivAt (fun s : ℝ => βŸͺp (x+s β€’ e),e⟫) (H x e) 0)
(hvt : βˆ€ x, HasDerivAt (fun s => v s x)
(((βˆ‘ i, H x (basis i))-v t x*β€–p xβ€–^2)/2) t)
(hΟƒt : HasDerivAt Οƒf (((Fintype.card ΞΉ : ℝ)+2*L*(M+L)+1)*Οƒf t) t)
(hpbound : βˆ€ x, β€–p xβ€– ≀ L) (hvbound : βˆ€ x, |v t x| ≀ M+L*β€–xβ€–)
(hm : βˆ€ x' y', deficit (v t) a b (Οƒf t) x y ≀ deficit (v t) a b (Οƒf t) x' y')
(hmTime : βˆ€ s ∈ Icc 0 t, deficit (v t) a b (Οƒf t) x y ≀ deficit (v s) a b (Οƒf s) x y)
(hneg : deficit (v t) a b (Οƒf t) x y ≀ 0) : False := by
let z := a β€’ x+b β€’ y
have hx := min_gradient_left hp ha hm
have hy := min_gradient_right hp hb hm
have hxnorm : β€–p z-p xβ€– ≀ 2*(Οƒf t)*β€–xβ€– := by
rw [hx,norm_smul,Real.norm_eq_abs,abs_neg,abs_of_pos (by positivity)]
have hynorm : β€–p z-p yβ€– ≀ 2*(Οƒf t)*β€–yβ€– := by
rw [hy,norm_smul,Real.norm_eq_abs,abs_neg,abs_of_pos (by positivity)]
have hr := reaction_bound ha.le hb.le hab hσ.le hL hM (norm_nonneg x) (norm_nonneg y)
(hpbound z) (hpbound x) (hpbound y) (hvbound x) (hvbound y) hxnorm hynorm hneg
have hl := min_laplacian_bound basis hbasis hab hp hH hm
have hd : HasDerivAt (fun s => deficit (v s) a b (Οƒf s) x y)
((((βˆ‘ i, H z (basis i))-v t z*β€–p zβ€–^2)/2) -
a*(((βˆ‘ i, H x (basis i))-v t x*β€–p xβ€–^2)/2) -
b*(((βˆ‘ i, H y (basis i))-v t y*β€–p yβ€–^2)/2) +
(((Fintype.card ΞΉ : ℝ)+2*L*(M+L)+1)*Οƒf t)*(1+a*β€–xβ€–^2+b*β€–yβ€–^2)) t := by
exact (((hvt z).sub ((hvt x).const_mul a)).sub ((hvt y).const_mul b)).add
(hσt.mul_const _)
have hnonpos := deriv_nonpos_of_min_on_left ht hmTime hd
have hQ : 0 ≀ a*β€–xβ€–^2+b*β€–yβ€–^2 := by positivity
have hcard : 0 ≀ (Fintype.card ΞΉ : ℝ) := Nat.cast_nonneg _
have hΟƒQ : 0 ≀ Οƒf t*(a*β€–xβ€–^2+b*β€–yβ€–^2) := mul_nonneg hΟƒ.le hQ
have hcardQ : 0 ≀ (Fintype.card ΞΉ : ℝ)*(Οƒf t*(a*β€–xβ€–^2+b*β€–yβ€–^2)) :=
mul_nonneg hcard hσQ
change -2*(Οƒf t)*(Fintype.card ΞΉ : ℝ) ≀
(βˆ‘ i, H z (basis i))-a*(βˆ‘ i, H x (basis i))-b*(βˆ‘ i, H y (basis i)) at hl
nlinarith only [hr,hl,hnonpos,hσ,hσQ,hcardQ]
lemma deficit_lower {v : E β†’ ℝ} {a b Οƒ L M Ξ΅ : ℝ}
(ha : 0 ≀ a) (hb : 0 ≀ b) (hab : a+b=1) (hL : 0 ≀ L)
(hΞ΅ : 0 < Ξ΅) (hσΡ : Ξ΅ ≀ Οƒ) (hv : βˆ€ x, |v x| ≀ M+L*β€–xβ€–) (x y : E) :
Ξ΅/2*(a*β€–xβ€–^2+b*β€–yβ€–^2)-2*M-2*L^2/Ξ΅ ≀ deficit v a b Οƒ x y := by
have hnz : β€–a β€’ x+b β€’ yβ€– ≀ a*β€–xβ€–+b*β€–yβ€– := by
simpa only [norm_smul,Real.norm_eq_abs,abs_of_nonneg ha,abs_of_nonneg hb] using norm_add_le (a β€’ x) (b β€’ y)
have hvz := (abs_le.mp (hv (a β€’ x+b β€’ y))).1
have hvx := (abs_le.mp (hv x)).2
have hvy := (abs_le.mp (hv y)).2
have hvz' : -(M+L*(a*β€–xβ€–+b*β€–yβ€–)) ≀ v (a β€’ x+b β€’ y) := by
nlinarith only [hvz,mul_le_mul_of_nonneg_left hnz hL]
have hQ : 0 ≀ a*β€–xβ€–^2+b*β€–yβ€–^2 := by positivity
have hbarr := mul_le_mul_of_nonneg_right hσΡ (by positivity : 0 ≀ 1+a*β€–xβ€–^2+b*β€–yβ€–^2)
have hYoung (r : ℝ) : 2*L*r ≀ Ξ΅/2*r^2+2*L^2/Ξ΅ := by
have hid : Ξ΅/2*r^2+2*L^2/Ξ΅-2*L*r = (Ξ΅*r-2*L)^2/(2*Ξ΅) := by
field_simp
ring
have hh := div_nonneg (sq_nonneg (Ξ΅*r-2*L)) (by positivity : 0 ≀ 2*Ξ΅)
rw [← hid] at hh
linarith only [hh]
have hx := mul_le_mul_of_nonneg_left (hYoung β€–xβ€–) ha
have hy := mul_le_mul_of_nonneg_left (hYoung β€–yβ€–) hb
have hi : (a+b)*(2*L^2/Ξ΅) = 2*L^2/Ξ΅ := by rw [hab,one_mul]
have hMab := congrArg (fun u : ℝ => M*u) hab
unfold deficit
nlinarith only [hMab,hvz',mul_le_mul_of_nonneg_left hvx ha,mul_le_mul_of_nonneg_left hvy hb,
hbarr,hx,hy,hi,hΞ΅]
omit [InnerProductSpace ℝ E] in
lemma exists_negative_minimum [InnerProductSpace ℝ E] [ProperSpace E]
{F : ℝ β†’ E β†’ E β†’ ℝ} {T R : ℝ} {xβ‚€ yβ‚€ : E}
(hF : Continuous (fun q : ℝ Γ— E Γ— E => F q.1 q.2.1 q.2.2))
(hT : 0 ≀ T) (hnegative : F T xβ‚€ yβ‚€ < 0)
(hinitial : βˆ€ x y, 0 ≀ F 0 x y)
(hcoercive : βˆ€ t ∈ Icc 0 T, βˆ€ x y,
R ≀ β€–xβ€– ∨ R ≀ β€–yβ€– β†’ 0 ≀ F t x y) :
βˆƒ t ∈ Ioc 0 T, βˆƒ x y, F t x y < 0 ∧
(βˆ€ x' y', F t x y ≀ F t x' y') ∧
(βˆ€ s ∈ Icc 0 t, F t x y ≀ F s x y) := by
let K := Icc 0 T Γ—Λ’ (Metric.closedBall (0:E) R Γ—Λ’ Metric.closedBall (0:E) R)
have hxβ‚€ : β€–xβ‚€β€– ≀ R := by
by_contra hh
exact (not_lt_of_ge (hcoercive T ⟨hT,le_rfl⟩ xβ‚€ yβ‚€ (Or.inl (le_of_not_ge hh)))) hnegative
have hyβ‚€ : β€–yβ‚€β€– ≀ R := by
by_contra hh
exact (not_lt_of_ge (hcoercive T ⟨hT,le_rfl⟩ xβ‚€ yβ‚€ (Or.inr (le_of_not_ge hh)))) hnegative
have hmem : (T,xβ‚€,yβ‚€) ∈ K := by
exact ⟨⟨hT,le_rfl⟩, by simpa using hxβ‚€, by simpa using hyβ‚€βŸ©
have hK : IsCompact K := isCompact_Icc.prod ((isCompact_closedBall (0:E) R).prod (isCompact_closedBall (0:E) R))
obtain ⟨w, hw, hmin⟩ := hK.exists_isMinOn ⟨_,hmem⟩ hF.continuousOn
have hn : F w.1 w.2.1 w.2.2 < 0 := (hmin hmem).trans_lt hnegative
have ht0 : 0 < w.1 := by
have ht : 0 ≀ w.1 := hw.1.1
rcases ht.eq_or_lt with ht' | ht'
Β· have hh := hinitial w.2.1 w.2.2
rw [← ht'] at hn
exact (not_lt_of_ge hh hn).elim
Β· exact ht'
refine ⟨w.1,⟨ht0,hw.1.2⟩,w.2.1,w.2.2,hn,?_,?_⟩
Β· intro x y
by_cases hx : β€–xβ€– ≀ R
Β· by_cases hy : β€–yβ€– ≀ R
Β· apply hmin (a := (w.1,x,y))
exact ⟨hw.1,by simpa using hx,by simpa using hy⟩
Β· exact hn.le.trans (hcoercive w.1 hw.1 x y (Or.inr (le_of_not_ge hy)))
Β· exact hn.le.trans (hcoercive w.1 hw.1 x y (Or.inl (le_of_not_ge hx)))
Β· intro s hs
apply hmin (a := (s,w.2.1,w.2.2))
exact ⟨⟨hs.1,hs.2.trans hw.1.2⟩,hw.2⟩
lemma deficit_coercive_radius {a b Ξ΅ L M : ℝ} (ha : 0 < a) (hb : 0 < b)
(hab : a+b=1) (hΞ΅ : 0 < Ξ΅) (hL : 0 ≀ L) (hM : 0 ≀ M) :
βˆƒ R : ℝ, βˆ€ (v : E β†’ ℝ) (Οƒ : ℝ), Ξ΅ ≀ Οƒ β†’
(βˆ€ x, |v x| ≀ M+L*β€–xβ€–) β†’ βˆ€ x y,
R ≀ β€–xβ€– ∨ R ≀ β€–yβ€– β†’ 0 ≀ deficit v a b Οƒ x y := by
let Ξ΄ := min a b
have hΞ΄ : 0 < Ξ΄ := lt_min ha hb
let C := 2*M+2*L^2/Ξ΅+1
have hC : 0 < C := by dsimp only [C]; positivity
let R := Real.sqrt (2*C/(Ξ΅*Ξ΄))
have hR : 0 ≀ R := Real.sqrt_nonneg _
have hR2 : R^2 = 2*C/(Ξ΅*Ξ΄) := Real.sq_sqrt (by positivity)
have hid : Ξ΅/2*Ξ΄*R^2-2*M-2*L^2/Ξ΅ = 1 := by
rw [hR2]
dsimp only [C]
field_simp
ring
refine ⟨R,?_⟩
intro v Οƒ hσΡ hv x y hout
have hQ : Ξ΄*R^2 ≀ a*β€–xβ€–^2+b*β€–yβ€–^2 := by
rcases hout with hx | hy
Β· have hsq : R^2 ≀ β€–xβ€–^2 := sq_le_sqβ‚€ hR (norm_nonneg x) |>.mpr hx
nlinarith only [mul_le_mul_of_nonneg_left hsq hΞ΄.le,
mul_le_mul_of_nonneg_right (min_le_left a b) (sq_nonneg β€–xβ€–),
mul_nonneg hb.le (sq_nonneg β€–yβ€–)]
Β· have hsq : R^2 ≀ β€–yβ€–^2 := sq_le_sqβ‚€ hR (norm_nonneg y) |>.mpr hy
nlinarith only [mul_le_mul_of_nonneg_left hsq hΞ΄.le,
mul_le_mul_of_nonneg_right (min_le_right a b) (sq_nonneg β€–yβ€–),
mul_nonneg ha.le (sq_nonneg β€–xβ€–)]
have hh := deficit_lower ha.le hb.le hab hL hΞ΅ hσΡ hv x y
have hh' := mul_le_mul_of_nonneg_left hQ (by positivity : 0 ≀ Ξ΅/2)
nlinarith only [hh,hh',hid]
lemma heat_deficit_nonneg [ProperSpace E] {ΞΉ : Type uΞΉ} [Fintype ΞΉ] (basis : ΞΉ β†’ E)
(hbasis : βˆ€ i, β€–basis iβ€– = 1)
{v : ℝ β†’ E β†’ ℝ} {p : ℝ β†’ E β†’ E} {H : ℝ β†’ E β†’ E β†’ ℝ}
{T a b Ξ΅ L M : ℝ} (hT : 0 ≀ T) (ha : 0 < a) (hb : 0 < b) (hab : a+b=1)
(hΞ΅ : 0 < Ξ΅) (hL : 0 ≀ L) (hM : 0 ≀ M)
(hv : Continuous (fun q : ℝ Γ— E => v q.1 q.2))
(hinitial : ConcaveOn ℝ univ (v 0))
(hp : βˆ€ t ∈ Ioc 0 T, βˆ€ x, HasFDerivAt (v t) (innerSL ℝ (p t x)) x)
(hH : βˆ€ t ∈ Ioc 0 T, βˆ€ x e, HasDerivAt (fun s : ℝ => βŸͺp t (x+s β€’ e),e⟫) (H t x e) 0)
(hvt : βˆ€ t ∈ Ioc 0 T, βˆ€ x, HasDerivAt (fun s => v s x)
(((βˆ‘ i, H t x (basis i))-v t x*β€–p t xβ€–^2)/2) t)
(hpbound : βˆ€ t ∈ Ioc 0 T, βˆ€ x, β€–p t xβ€– ≀ L)
(hvbound : βˆ€ t ∈ Icc 0 T, βˆ€ x, |v t x| ≀ M+L*β€–xβ€–) (x y : E) :
0 ≀ deficit (v T) a b (Ξ΅*Real.exp (((Fintype.card ΞΉ : ℝ)+2*L*(M+L)+1)*T)) x y := by
let A := (Fintype.card ΞΉ : ℝ)+2*L*(M+L)+1
have hA : 0 ≀ A := by dsimp [A]; positivity
let Οƒf (t : ℝ) := Ξ΅*Real.exp (A*t)
have hσcont : Continuous σf := by dsimp [σf]; fun_prop
have hΟƒpos (t : ℝ) : 0 < Οƒf t := by dsimp [Οƒf]; positivity
have hΟƒlower {t : ℝ} (ht : 0 ≀ t) : Ξ΅ ≀ Οƒf t := by
have hh := Real.one_le_exp_iff.mpr (mul_nonneg hA ht)
simpa only [mul_one] using mul_le_mul_of_nonneg_left hh hΞ΅.le
have hΟƒt (t : ℝ) : HasDerivAt Οƒf (A*Οƒf t) t := by
convert ((((hasDerivAt_id t).const_mul A).exp).const_mul Ξ΅) using 1 <;>
first | rfl | (dsimp [Οƒf]; ring)
obtain ⟨R,hR⟩ := deficit_coercive_radius (E := E) ha hb hab hΡ hL hM
let F (t : ℝ) (x y : E) := deficit (v t) a b (Οƒf t) x y
have hF : Continuous (fun q : ℝ Γ— E Γ— E => F q.1 q.2.1 q.2.2) := by
have hz : Continuous (fun q : ℝ Γ— E Γ— E => v q.1 (a β€’ q.2.1+b β€’ q.2.2)) :=
hv.comp (show Continuous (fun q : ℝ Γ— E Γ— E => (q.1,a β€’ q.2.1+b β€’ q.2.2)) from by fun_prop)
have hx : Continuous (fun q : ℝ Γ— E Γ— E => v q.1 q.2.1) := hv.comp (show Continuous (fun q : ℝ Γ— E Γ— E => (q.1,q.2.1)) from by fun_prop)
have hy : Continuous (fun q : ℝ Γ— E Γ— E => v q.1 q.2.2) := hv.comp (show Continuous (fun q : ℝ Γ— E Γ— E => (q.1,q.2.2)) from by fun_prop)
dsimp only [F,deficit]
fun_prop
have hi (x y : E) : 0 ≀ F 0 x y := by
have hh := hinitial.2 (mem_univ x) (mem_univ y) ha.le hb.le hab
simp only [smul_eq_mul] at hh
have hh' : 0 ≀ Οƒf 0*(1+a*β€–xβ€–^2+b*β€–yβ€–^2) := by positivity
dsimp only [F,deficit]
linarith only [hh,hh']
have hc (t : ℝ) (ht : t ∈ Icc 0 T) (x y : E) (hout : R ≀ β€–xβ€– ∨ R ≀ β€–yβ€–) :
0 ≀ F t x y := hR (v t) (Οƒf t) (hΟƒlower ht.1) (hvbound t ht) x y hout
by_contra hneg
obtain ⟨t,ht,x',y',hn,hm,hmt⟩ := exists_negative_minimum hF hT (lt_of_not_ge hneg) hi hc
exact no_forbidden_minimum basis hbasis ha hb hab hL hM ht.1 (hσpos t)
(hp t ht) (hH t ht) (hvt t ht) (hΟƒt t) (hpbound t ht) (hvbound t ⟨ht.1.le,ht.2⟩)
hm hmt hn.le
lemma heat_concave [ProperSpace E] {ΞΉ : Type uΞΉ} [Fintype ΞΉ] (basis : ΞΉ β†’ E)
(hbasis : βˆ€ i, β€–basis iβ€– = 1)
{v : ℝ β†’ E β†’ ℝ} {p : ℝ β†’ E β†’ E} {H : ℝ β†’ E β†’ E β†’ ℝ}
{T L M : ℝ} (hT : 0 ≀ T) (hL : 0 ≀ L) (hM : 0 ≀ M)
(hv : Continuous (fun q : ℝ Γ— E => v q.1 q.2))
(hinitial : ConcaveOn ℝ univ (v 0))
(hp : βˆ€ t ∈ Ioc 0 T, βˆ€ x, HasFDerivAt (v t) (innerSL ℝ (p t x)) x)
(hH : βˆ€ t ∈ Ioc 0 T, βˆ€ x e, HasDerivAt (fun s : ℝ => βŸͺp t (x+s β€’ e),e⟫) (H t x e) 0)
(hvt : βˆ€ t ∈ Ioc 0 T, βˆ€ x, HasDerivAt (fun s => v s x)
(((βˆ‘ i, H t x (basis i))-v t x*β€–p t xβ€–^2)/2) t)
(hpbound : βˆ€ t ∈ Ioc 0 T, βˆ€ x, β€–p t xβ€– ≀ L)
(hvbound : βˆ€ t ∈ Icc 0 T, βˆ€ x, |v t x| ≀ M+L*β€–xβ€–) :
ConcaveOn ℝ univ (v T) := by
refine ⟨convex_univ,?_⟩
intro x _ y _ a b ha hb hab
simp only [smul_eq_mul]
rcases ha.eq_or_lt with rfl | ha
Β· have hb1 : b=1 := by linarith only [hab]
simp [hb1]
rcases hb.eq_or_lt with rfl | hb
Β· have ha1 : a=1 := by linarith only [hab]
simp [ha1]
by_contra hbad
have hbad' : 0 < a*v T x+b*v T y-v T (a β€’ x+b β€’ y) := by linarith only [lt_of_not_ge hbad]
let c := Real.exp (((Fintype.card ΞΉ : ℝ)+2*L*(M+L)+1)*T)*(1+a*β€–xβ€–^2+b*β€–yβ€–^2)
have hc : 0 < c := by dsimp only [c]; positivity
let Ξ΅ := (a*v T x+b*v T y-v T (a β€’ x+b β€’ y))/(2*c)
have hΞ΅ : 0 < Ξ΅ := div_pos hbad' (by positivity)
have hh := heat_deficit_nonneg basis hbasis hT ha hb hab hΞ΅ hL hM hv hinitial hp hH hvt hpbound hvbound x y
have heq : Ξ΅*c = (a*v T x+b*v T y-v T (a β€’ x+b β€’ y))/2 := by
dsimp only [Ξ΅]
field_simp
dsimp only [deficit] at hh
dsimp only [c] at heq
nlinarith only [hh,heq,hbad']
end Spatial
end GaussianPropeller.HeatMaximum
end OAI