Download data/lean/OAI/Analysis/AllenCahn/BernsteinGradient.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.92 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/AllenCahn/BernsteinGradient.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/AllenCahn/BernsteinGradient.lean
-
curl -L -o BernsteinGradient.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/AllenCahn/BernsteinGradient.lean
9.92 kB
| import OAI.Analysis.AllenCahn.Cutoffs | |
| namespace OAI | |
| noncomputable section | |
| namespace DeGiorgi | |
| open Filter Set Topology | |
| open scoped NNReal | |
| open scoped SchwartzMap Laplacian ContDiff | |
| open FourierTransform | |
| open scoped ContDiff | |
| open Filter Topology | |
| lemma unbounded_bernstein_bound {n : β} {w : Space n β β} | |
| (hw : ContDiff β 2 w) (hw0 : β x, 0 β€ w x) (b : Space n β Space n) | |
| {L p B C : β} (hL : 0 β€ L) (hp : 0 β€ p) (hB : 0 β€ B) (hC : 0 β€ C) | |
| (hb : β x, βb xβ β€ B + C * Real.sqrt (w x)) | |
| (heq : β x, w x ^ 2 β€ L * (1 + w x) + | |
| p * (Laplacian.laplacian w x - fderiv β w x (b x))) : | |
| β z, w z β€ 2 * (L + p * (24 + 4 * n + 4 * B)) + (4 * p * C) ^ 2 + 2 * L + 1 := by | |
| intro z | |
| let r := unitCutoff z | |
| let F := fun x => r x ^ 2 * w x | |
| have hr : ContDiff β 2 r := smooth_C2 (unitCutoff_smooth z) | |
| have hF : ContDiff β 2 F := (hr.pow 2).mul hw | |
| have hz : z β Metric.closedBall z (1 : β) := by simp | |
| obtain β¨x, hx, hmaxβ© := (isCompact_closedBall z (1 : β)).exists_isMaxOn | |
| β¨z, hzβ© hF.continuous.continuousOn | |
| have hwx := hw0 x | |
| have hval : w z β€ F x := by | |
| have H := hmax hz | |
| simpa [F,r,unitCutoff] using H | |
| by_cases hpz : w z β€ 0 | |
| Β· have hbound : 0 β€ 2 * (L + p * (24 + 4 * n + 4 * B)) + | |
| (4 * p * C) ^ 2 + 2 * L + 1 := by positivity | |
| exact hpz.trans hbound | |
| have hpF : 0 < F x := lt_of_lt_of_le (lt_of_not_ge hpz) hval | |
| have hxn : βx - zβ β€ 1 := by simpa only [Metric.mem_closedBall, dist_eq_norm] using hx | |
| have hr0 : 0 β€ r x := by dsimp [r,unitCutoff]; nlinarith [norm_nonneg (x-z)] | |
| have hrx : 0 < r x := by | |
| have hn : r x β 0 := by | |
| intro hzero | |
| have : F x = 0 := by simp [F,hzero] | |
| linarith | |
| exact lt_of_le_of_ne hr0 (Ne.symm hn) | |
| have hr1 : r x β€ 1 := by dsimp [r,unitCutoff]; nlinarith [sq_nonneg βx-zβ] | |
| have hxi : x β Metric.ball z (1 : β) := by | |
| simp only [Metric.mem_ball, dist_eq_norm] | |
| dsimp [r,unitCutoff] at hrx | |
| nlinarith [norm_nonneg (x-z)] | |
| have hlocal : IsLocalMax F x := hmax.isLocalMax | |
| (Filter.mem_of_superset (Metric.isOpen_ball.mem_nhds hxi) Metric.ball_subset_closedBall) | |
| have HC := cutoff_max_calculus hw hr hrx hlocal | |
| have hgn : βgradient r xβ β€ 2 := by | |
| change βgradient (unitCutoff z) xβ β€ 2 | |
| rw [gradient_unitCutoff, norm_smul, Real.norm_eq_abs] | |
| norm_num | |
| linarith | |
| have hgn2 : βgradient r xβ ^ 2 β€ 4 := by nlinarith [norm_nonneg (gradient r x)] | |
| have hLap : r x ^ 2 * Laplacian.laplacian w x β€ (24 + 4 * n) * w x := by | |
| apply HC.1.trans | |
| apply mul_le_mul_of_nonneg_right _ (hw0 x) | |
| change 6 * βgradient r xβ ^ 2 - 2 * r x * Laplacian.laplacian (unitCutoff z) x β€ _ | |
| rw [laplacian_unitCutoff] | |
| have H := mul_le_mul_of_nonneg_left hr1 (show (0 : β) β€ 4 * n by positivity) | |
| nlinarith | |
| have hDer : -(r x ^ 2) * fderiv β w x (b x) β€ | |
| 4 * r x * w x * (B + C * Real.sqrt (w x)) := by | |
| rw [HC.2] | |
| have hd : fderiv β r x (b x) β€ 2 * (B + C * Real.sqrt (w x)) := by | |
| rw [β inner_gradient_left] | |
| exact (le_abs_self _).trans ((abs_real_inner_le_norm _ _).trans | |
| (mul_le_mul hgn (hb x) (norm_nonneg _) (by norm_num))) | |
| have H := mul_le_mul_of_nonneg_left hd (show 0 β€ 2 * r x * w x by positivity) | |
| nlinarith | |
| exact hval.trans (cutoff_bernstein_algebra hrx hr1 (hw0 x) hL hp | |
| (by positivity) hB hC (heq x) hLap hDer) | |
| def linearLogGradientBound (n : β) (R : β) : β := | |
| let N : β := n + 1 | |
| let L := 2 * R ^ 2 + N * R * n + 3 * N * R | |
| 2 * (L + N * (24 + 4 * n)) + (8 * N) ^ 2 + 2 * L + 1 | |
| lemma log_gradient_bound_no_growth {n : β} {h r : Space n β β} | |
| (hh : ContDiff β β h) (hr : ContDiff β β r) {R : β} (hR : 0 β€ R) | |
| (heq : β x, Laplacian.laplacian h x = r x - βgradient h xβ ^ 2) | |
| (hrb : β x, |r x| β€ R) (hrd : β i x, |coordDeriv r i x| β€ R) : | |
| β x, βgradient h xβ ^ 2 β€ linearLogGradientBound n R := by | |
| let N : β := n + 1 | |
| let L := 2 * R ^ 2 + N * R * n + 3 * N * R | |
| let w := fun x => βgradient h xβ ^ 2 | |
| let b := fun x => -(2 : β) β’ gradient h x | |
| have hN : 0 β€ N := by dsimp [N]; positivity | |
| have hL : 0 β€ L := by dsimp [L,N]; positivity | |
| have hw : ContDiff β 2 w := smooth_C2 (gradient_norm_sq_smooth hh) | |
| have hb : β x, βb xβ β€ 0 + 2 * Real.sqrt (w x) := by | |
| intro x | |
| simp [b,w, norm_smul, Real.sqrt_sq (norm_nonneg (gradient h x))] | |
| have hP (x : Space n) : w x ^ 2 β€ L * (1 + w x) + | |
| N * (Laplacian.laplacian w x - fderiv β w x (b x)) := by | |
| let H := β i : Fin n, βgradient (coordDeriv h i) xβ ^ 2 | |
| have hH : 0 β€ H := Finset.sum_nonneg (fun _ _ => sq_nonneg _) | |
| have htr := laplacian_sq_le_hessian hh x | |
| change Laplacian.laplacian h x ^ 2 β€ n * H at htr | |
| have hr2 : r x ^ 2 β€ R ^ 2 := by | |
| simpa only [sq_abs] using pow_le_pow_leftβ (abs_nonneg (r x)) (hrb x) 2 | |
| have he := heq x | |
| change Laplacian.laplacian h x = r x - w x at he | |
| have hsq : w x ^ 2 β€ 2 * R ^ 2 + 2 * N * H := by | |
| have hbasic : w x ^ 2 β€ 2 * r x ^ 2 + 2 * Laplacian.laplacian h x ^ 2 := by | |
| rw [he] | |
| nlinarith [sq_nonneg (2 * r x - w x)] | |
| dsimp [N] | |
| nlinarith | |
| have hbo := log_bochner_lower (v := fun _ : Space n => 0) | |
| contDiff_const (fun _ => by constructor <;> norm_num) hh hr hR (le_refl (0 : β)) | |
| (fun y => by simpa [diffuseDrift] using heq y) | |
| (fun i y => (hrd i y).trans (by nlinarith [mul_nonneg hR (abs_nonneg (coordDeriv h i y))])) | |
| (fun i k y => by | |
| have hz : driftCoeff (fun _ : Space n => (0 : β)) k = fun _ => 0 := by | |
| funext t; simp [driftCoeff] | |
| rw [hz] | |
| simp [coordDeriv]) x | |
| have hbo' : 2 * H β€ Laplacian.laplacian w x - fderiv β w x (b x) + R * n + 3 * R * w x := by | |
| have H' : 2 * H - R * n - 3 * R * w x β€ | |
| Laplacian.laplacian w x - fderiv β w x (b x) := by | |
| simpa [H,w,b,diffuseDrift] using hbo | |
| linarith | |
| have hmul := mul_le_mul_of_nonneg_left hbo' hN | |
| have hlin : 2 * R ^ 2 + N * R * n + 3 * N * R * w x β€ L * (1 + w x) := by | |
| have hw0 : 0 β€ w x := sq_nonneg _ | |
| have ha : 0 β€ (2 * R ^ 2 + N * R * n) * w x := by positivity | |
| have hc : 0 β€ 3 * N * R := by positivity | |
| dsimp [L] | |
| nlinarith | |
| nlinarith | |
| have HB := unbounded_bernstein_bound hw (fun x => sq_nonneg _) b hL hN | |
| (le_refl (0 : β)) (by norm_num : (0 : β) β€ 2) hb hP | |
| intro x | |
| convert HB x using 1 | |
| dsimp [linearLogGradientBound,L,N,w] | |
| ring | |
| lemma linearLogGradientBound_nonneg (n : β) {R : β} (hR : 0 β€ R) : | |
| 0 β€ linearLogGradientBound n R := by | |
| dsimp [linearLogGradientBound] | |
| positivity | |
| lemma positive_linear_log_gradient {n : β} {f P : Space n β β} | |
| (hf : ContDiff β β f) (hP : ContDiff β β P) (hp : β x, 0 < f x) | |
| {R : β} (hR : 0 β€ R) (hPb : β x, |P x| β€ R) | |
| (hPd : β i x, |coordDeriv P i x| β€ R) | |
| (heq : β x, Laplacian.laplacian f x = P x * f x) : | |
| β x, βgradient (fun y => Real.log (f y)) xβ β€ | |
| Real.sqrt (linearLogGradientBound n R) := by | |
| have hh : ContDiff β β (fun y => Real.log (f y)) := hf.log (fun x => (hp x).ne') | |
| have hlog (x : Space n) : Laplacian.laplacian (fun y => Real.log (f y)) x = | |
| P x - βgradient (fun y => Real.log (f y)) xβ ^ 2 := by | |
| have H := drift_log (smooth_C2 hf) (fun y => (hp y).ne') (fun _ => 0) x | |
| simpa [heq x, (hp x).ne'] using H | |
| have H := log_gradient_bound_no_growth hh hP hR hlog hPb hPd | |
| intro x | |
| exact (Real.le_sqrt (norm_nonneg _) (linearLogGradientBound_nonneg n hR)).mpr (H x) | |
| lemma positive_linear_log_lipschitz {n : β} {f P : Space n β β} | |
| (hf : ContDiff β β f) (hP : ContDiff β β P) (hp : β x, 0 < f x) | |
| {R : β} (hR : 0 β€ R) (hPb : β x, |P x| β€ R) | |
| (hPd : β i x, |coordDeriv P i x| β€ R) | |
| (heq : β x, Laplacian.laplacian f x = P x * f x) (x y : Space n) : | |
| |Real.log (f y) - Real.log (f x)| β€ | |
| Real.sqrt (linearLogGradientBound n R) * βy - xβ := by | |
| have hh : ContDiff β β (fun y => Real.log (f y)) := hf.log (fun x => (hp x).ne') | |
| have H := Convex.norm_image_sub_le_of_norm_fderiv_le | |
| (s := Set.univ) (fun z _ => hh.differentiable (by simp) z) | |
| (fun z _ => show βfderiv β (fun y => Real.log (f y)) zβ β€ | |
| Real.sqrt (linearLogGradientBound n R) by | |
| simpa only [gradient, LinearIsometryEquiv.norm_map] using | |
| positive_linear_log_gradient hf hP hp hR hPb hPd heq z) | |
| convex_univ (Set.mem_univ x) (Set.mem_univ y) | |
| exact H | |
| lemma positive_linear_harnack {n : β} {f P : Space n β β} | |
| (hf : ContDiff β β f) (hP : ContDiff β β P) (hp : β x, 0 < f x) | |
| {R : β} (hR : 0 β€ R) (hPb : β x, |P x| β€ R) | |
| (hPd : β i x, |coordDeriv P i x| β€ R) | |
| (heq : β x, Laplacian.laplacian f x = P x * f x) (x y : Space n) : | |
| f y β€ Real.exp (Real.sqrt (linearLogGradientBound n R) * βy - xβ) * f x := by | |
| have H := (abs_le.mp (positive_linear_log_lipschitz hf hP hp hR hPb hPd heq x y)).2 | |
| have HH := Real.exp_le_exp.mpr H | |
| rw [Real.exp_sub, Real.exp_log (hp y), Real.exp_log (hp x)] at HH | |
| exact (div_le_iffβ (hp x)).mp HH | |
| lemma positive_linear_relative_gradient {n : β} {f P : Space n β β} | |
| (hf : ContDiff β β f) (hP : ContDiff β β P) (hp : β x, 0 < f x) | |
| {R : β} (hR : 0 β€ R) (hPb : β x, |P x| β€ R) | |
| (hPd : β i x, |coordDeriv P i x| β€ R) | |
| (heq : β x, Laplacian.laplacian f x = P x * f x) (x : Space n) : | |
| βgradient f xβ β€ Real.sqrt (linearLogGradientBound n R) * f x := by | |
| have H := positive_linear_log_gradient hf hP hp hR hPb hPd heq x | |
| rw [gradient_log (hf.differentiable (by simp) x) (hp x).ne', norm_smul, | |
| Real.norm_eq_abs, abs_inv, abs_of_pos (hp x)] at H | |
| have HH := mul_le_mul_of_nonneg_left H (hp x).le | |
| simpa [mul_assoc, (hp x).ne', mul_comm] using HH | |
| end DeGiorgi | |
| end | |
| end OAI | |