Download data/lean/OAI/Probability/GaussianPropeller/HeatMaximum.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 24.2 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GaussianPropeller/HeatMaximum.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/GaussianPropeller/HeatMaximum.lean
-
curl -L -o HeatMaximum.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/GaussianPropeller/HeatMaximum.lean
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 | |