Download data/lean/OAI/Analysis/Calculus/Current/Kernel.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 3.31 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Calculus/Current/Kernel.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/Calculus/Current/Kernel.lean
-
curl -L -o Kernel.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Calculus/Current/Kernel.lean
3.31 kB
| import OAI.Analysis.Calculus.Current.RegularizedSmooth | |
| import Mathlib.Analysis.SpecialFunctions.JapaneseBracket | |
| /-! The normalized Japanese-bracket kernel used for spatial regularization. -/ | |
| noncomputable section | |
| namespace OAI.Analysis.Calculus.Current | |
| open _root_.MeasureTheory | |
| open scoped ContDiff | |
| abbrev SpatialSpace (d : β) := EuclideanSpace β (Option (Fin d)) | |
| def kernelProfile (d : β) (x : SpatialSpace d) : β := | |
| (1 + βxβ ^ 2) ^ (-(2 * ((d : β) + 1) + 4) / 2) | |
| theorem kernelProfile_pos (d : β) (x : SpatialSpace d) : 0 < kernelProfile d x := by | |
| apply Real.rpow_pos_of_pos | |
| positivity | |
| theorem continuous_kernelProfile (d : β) : Continuous (kernelProfile d) := by | |
| unfold kernelProfile | |
| have hc : Continuous (fun x : SpatialSpace d => (1 : β) + βxβ ^ 2) := by fun_prop | |
| exact hc.rpow_const (fun x => Or.inl (ne_of_gt (by positivity))) | |
| theorem integrable_kernelProfile (d : β) : Integrable (kernelProfile d) := by | |
| apply integrable_rpow_neg_one_add_norm_sq | |
| simp only [SpatialSpace, finrank_euclideanSpace, Fintype.card_option, Fintype.card_fin, | |
| Nat.cast_add, Nat.cast_one] | |
| have hd : (0 : β) β€ d := Nat.cast_nonneg d | |
| linarith | |
| theorem integral_kernelProfile_pos (d : β) : 0 < β« x, kernelProfile d x := | |
| integral_pos_of_integrable_nonneg_nonzero (continuous_kernelProfile d) | |
| (integrable_kernelProfile d) (fun x => (kernelProfile_pos d x).le) | |
| (ne_of_gt (kernelProfile_pos d 0)) | |
| def kernelConstant (d : β) : β := (β« x, kernelProfile d x)β»ΒΉ | |
| theorem kernelConstant_pos (d : β) : 0 < kernelConstant d := | |
| inv_pos.mpr (integral_kernelProfile_pos d) | |
| /-- `C_n hβ»βΏ β¨x/hβ©β»Β²βΏβ»β΄`, with `n=d+1`. -/ | |
| def smoothingKernel (d : β) (h : β) (x : SpatialSpace d) : β := | |
| kernelConstant d * (h ^ (d + 1))β»ΒΉ * kernelProfile d (hβ»ΒΉ β’ x) | |
| theorem smoothingKernel_pos (d : β) (h : β) (hh : 0 < h) (x : SpatialSpace d) : | |
| 0 < smoothingKernel d h x := by | |
| exact mul_pos (mul_pos (kernelConstant_pos d) (inv_pos.mpr (pow_pos hh _))) | |
| (kernelProfile_pos d _) | |
| theorem integrable_smoothingKernel (d : β) (h : β) (hh : h β 0) : | |
| Integrable (smoothingKernel d h) := | |
| ((integrable_kernelProfile d).comp_smul (inv_ne_zero hh)).const_mul _ | |
| theorem integral_smoothingKernel (d : β) (h : β) (hh : 0 < h) : | |
| β« x, smoothingKernel d h x = 1 := by | |
| simp only [smoothingKernel, integral_const_mul] | |
| rw [Measure.integral_comp_inv_smul_of_nonneg volume (kernelProfile d) hh.le] | |
| simp only [SpatialSpace, finrank_euclideanSpace, Fintype.card_option, Fintype.card_fin, | |
| smul_eq_mul, kernelConstant] | |
| field_simp [ne_of_gt hh, ne_of_gt (integral_kernelProfile_pos d)] | |
| def sourceKernelMeasure (d : β) (h : β) : Measure (SpatialSpace d) := | |
| volume.withDensity (fun x => ENNReal.ofReal (smoothingKernel d h x)) | |
| theorem sourceKernelMeasure_isProbability (d : β) (h : β) (hh : 0 < h) : | |
| IsProbabilityMeasure (sourceKernelMeasure d h) := by | |
| constructor | |
| rw [sourceKernelMeasure, withDensity_apply _ MeasurableSet.univ, | |
| Measure.restrict_univ] | |
| rw [β ofReal_integral_eq_lintegral_ofReal (integrable_smoothingKernel d h hh.ne') | |
| (Filter.Eventually.of_forall fun x => (smoothingKernel_pos d h hh x).le)] | |
| rw [integral_smoothingKernel d h hh] | |
| simp | |
| end OAI.Analysis.Calculus.Current | |