Download data/lean/OAI/Probability/MemoryPrecision/JointL1.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 8.87 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/JointL1.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Probability/MemoryPrecision/JointL1.lean
-
curl -L -o JointL1.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Probability/MemoryPrecision/JointL1.lean
8.87 kB
| import Mathlib | |
| import OAI.Probability.GaussianRegression.Main | |
| import OAI.Probability.MemoryPrecision.FiniteDensity | |
| import OAI.Probability.MemoryPrecision.KernelModel | |
| import OAI.Probability.MemoryPrecision.LabelTranslations | |
| namespace OAI | |
| open MeasureTheory ProbabilityTheory Set Filter EuclideanGeometry | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise | |
| noncomputable section | |
| universe u v | |
| open MeasureTheory ProbabilityTheory Set Filter | |
| open scoped ENNReal NNReal RealInnerProductSpace Topology Pointwise | |
| namespace MemoryPrecision | |
| open NoiselessRegression | |
| def UniformSphere (d : β) : @Measure (Space d) | |
| (WithLp.measurableSpace | |
| (@OfNat.ofNat ββ₯0β 2 | |
| (@instOfNatAtLeastTwo ββ₯0β 2 ENNReal.instAddCommMonoidWithOne.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d β β)) := | |
| let euclideanMeasurable := WithLp.measurableSpace | |
| (@OfNat.ofNat ββ₯0β 2 | |
| (@instOfNatAtLeastTwo ββ₯0β 2 ENNReal.instAddCommMonoidWithOne.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d β β) | |
| @Measure.map (Kernel.Sphere d) (Space d) | |
| (MeasurableSpace.comap Subtype.val euclideanMeasurable) euclideanMeasurable | |
| Subtype.val (Kernel.UniformSphere d) | |
| def GaussianRegularization {d : β} | |
| (ΞΌ : @Measure (Space d) | |
| (WithLp.measurableSpace | |
| (@OfNat.ofNat ββ₯0β 2 | |
| (@instOfNatAtLeastTwo ββ₯0β 2 ENNReal.instAddCommMonoidWithOne.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0)))) (Fin d β β))) | |
| (m : β) (Ξ΄ : β) | |
| (Ay : (Fin m β Space d) Γ (Fin m β β)) : β := | |
| let exponent : ββ₯0β := @OfNat.ofNat ββ₯0β 2 | |
| (@instOfNatAtLeastTwo ββ₯0β 2 ENNReal.instAddCommMonoidWithOne.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) | |
| letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d β β) | |
| β« signal, β index, gaussianPDFReal 0 β¨Ξ΄^2, sq_nonneg Ξ΄β© | |
| (Ay.2 index - @inner β (Space d) | |
| (@InnerProductSpace.toInner β (Space d) _ | |
| (PiLp.seminormedAddCommGroup exponent (fun _ : Fin d => β)) | |
| (PiLp.innerProductSpace (π := β) (fun _ : Fin d => β))) | |
| signal (Ay.1 index)) βΞΌ | |
| lemma gaussianPDF_zero_sub_comm (v : ββ₯0) (a b : β) : | |
| gaussianPDF 0 v (a-b) = gaussianPDF 0 v (b-a) := by | |
| simp only [gaussianPDF, gaussianPDFReal, sub_zero] | |
| congr 4 | |
| ring | |
| lemma GaussianRegularization_eq_toReal {d : β} (ΞΌ : Measure (Space d)) | |
| [IsFiniteMeasure ΞΌ] (m : β) (Ξ΄ : β) | |
| (x : (Fin m β Space d) Γ (Fin m β β)) : | |
| GaussianRegularization ΞΌ m Ξ΄ x = | |
| (projectionSmoothing ΞΌ (gaussianPDF 0 β¨Ξ΄^2,sq_nonneg Ξ΄β©) m x).toReal := by | |
| let v : ββ₯0 := β¨Ξ΄^2,sq_nonneg Ξ΄β© | |
| change (β« s, β j, gaussianPDFReal 0 v (x.2 j - βͺs,x.1 jβ«) βΞΌ) = _ | |
| have hn : β s : Space d, 0 β€ β j, gaussianPDFReal 0 v (x.2 j - βͺs,x.1 jβ«) := | |
| fun s => Finset.prod_nonneg (fun _ _ => gaussianPDFReal_nonneg _ _ _) | |
| have hm : Measurable (fun s : Space d => β j, gaussianPDFReal 0 v (x.2 j - βͺs,x.1 jβ«)) := by | |
| fun_prop | |
| rw [integral_eq_lintegral_of_nonneg_ae (Eventually.of_forall hn) hm.aestronglyMeasurable] | |
| unfold projectionSmoothing | |
| congr 1 | |
| apply lintegral_congr | |
| intro s | |
| rw [ENNReal.ofReal_prod_of_nonneg (fun _ _ => gaussianPDFReal_nonneg _ _ _)] | |
| rfl | |
| lemma GaussianRegularization_ae_eq_average {d : β} (ΞΌ : Measure (Space d)) | |
| [IsFiniteMeasure ΞΌ] (m : β) | |
| (F : ((Fin m β Space d) Γ (Fin m β β)) β β) | |
| (hF : Measurable F) (hF0 : β x, 0 β€ F x) | |
| (hden : (MatrixLabelReference d m).withDensity (fun x => ENNReal.ofReal (F x)) = | |
| ProjectionLaw ΞΌ m) (Ξ΄ : β) (hΞ΄ : Ξ΄ β 0) : | |
| GaussianRegularization ΞΌ m Ξ΄ =α΅[MatrixLabelReference d m] | |
| averageTranslate (Measure.pi (fun _ : Fin m => gaussianReal 0 1)) Ξ΄ F := by | |
| have he := projectionSmoothing_ae_eq_fiberSmoothing ΞΌ m | |
| (fun x => ENNReal.ofReal (F x)) hF.ennreal_ofReal hden | |
| (gaussianPDF 0 β¨Ξ΄^2,sq_nonneg Ξ΄β©) (measurable_gaussianPDF _ _) | |
| filter_upwards [he] with x hx | |
| rw [GaussianRegularization_eq_toReal, hx] | |
| unfold averageTranslate | |
| rw [integral_eq_lintegral_of_nonneg_ae (Eventually.of_forall (fun u => hF0 _)) | |
| ((hF.comp (by fun_prop)).aestronglyMeasurable)] | |
| congr 1 | |
| change fiberSmoothing volume (fun x => ENNReal.ofReal (F x)) | |
| (fun y : Fin m β β => β j, gaussianPDF 0 _ (y j)) x = | |
| β«β» u : Fin m β β, ENNReal.ofReal (F (x.1,fun j => x.2 j + Ξ΄ * u j)) | |
| βMeasure.pi (fun _ => gaussianReal 0 1) | |
| rw [lintegral_gaussian_shift_scale m Ξ΄ hΞ΄ x.2 (fun y => ENNReal.ofReal (F (x.1,y))) | |
| (by fun_prop)] | |
| apply lintegral_congr | |
| intro y | |
| congr 1 | |
| apply Finset.prod_congr rfl | |
| intro j _ | |
| exact gaussianPDF_zero_sub_comm _ _ _ | |
| lemma memLp_density_of_finite {X : Type*} [MeasurableSpace X] | |
| (Ξ½β Ξ· : Measure X) [IsFiniteMeasure Ξ·] {F : X β β} | |
| (hFm : Measurable F) (hF0 : β x, 0 β€ F x) | |
| (hden : Ξ½β.withDensity (fun x => ENNReal.ofReal (F x)) = Ξ·) : | |
| MemLp F 1 Ξ½β := by | |
| rw [memLp_iff, eLpNorm_one_eq_lintegral_enorm hFm.aestronglyMeasurable] | |
| have he : (fun x => βF xββ) = (fun x => ENNReal.ofReal (F x)) := by | |
| funext x | |
| exact Real.enorm_eq_ofReal (hF0 x) | |
| rw [he] | |
| have he2 := congrArg (fun Ξ½ : Measure X => Ξ½ Set.univ) hden | |
| rw [withDensity_apply _ MeasurableSet.univ, Measure.restrict_univ] at he2 | |
| rw [he2] | |
| exact measure_lt_top _ _ | |
| lemma density_ae_unique_real {X : Type*} [MeasurableSpace X] | |
| (Ξ½β : Measure X) [SigmaFinite Ξ½β] {F G : X β β} | |
| (hFm : Measurable F) (hF0 : β x, 0 β€ F x) | |
| (hGm : Measurable G) (hG0 : β x, 0 β€ G x) | |
| (hden : Ξ½β.withDensity (fun x => ENNReal.ofReal (F x)) = | |
| Ξ½β.withDensity (fun x => ENNReal.ofReal (G x))) : F =α΅[Ξ½β] G := by | |
| have he := (withDensity_eq_iff_of_sigmaFinite hFm.ennreal_ofReal.aemeasurable | |
| hGm.ennreal_ofReal.aemeasurable).mp hden | |
| filter_upwards [he] with x hx | |
| exact (ENNReal.ofReal_eq_ofReal_iff (hF0 x) (hG0 x)).mp hx | |
| def JointL1Statement : Prop := | |
| let two : β := @OfNat.ofNat β 2 (@instOfNatAtLeastTwo β 2 Real.commRing.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) | |
| let exponent : ββ₯0β := @OfNat.ofNat ββ₯0β 2 | |
| (@instOfNatAtLeastTwo ββ₯0β 2 ENNReal.instAddCommMonoidWithOne.toNatCast | |
| (Mathlib.Meta.NormNum.instAtLeastTwo (nat_lit 0))) | |
| β d m p : β, | |
| letI : MeasurableSpace (Space d) := WithLp.measurableSpace exponent (Fin d β β) | |
| 2 β€ d β 1 β€ m β m < d β 2 β€ p β | |
| β Ξ² H R : β, (m : β)+(p : β)-two < Ξ² β 0 < H β 0 < R β | |
| β z : Space d, β ΞΌ : Measure (Space d), IsFiniteMeasure ΞΌ β | |
| @Measure.support (Space d) | |
| (PiLp.topologicalSpace (p := exponent) (Ξ² := fun _ : Fin d => β)) | |
| (WithLp.measurableSpace exponent (Fin d β β)) ΞΌ β | |
| @Metric.closedBall (Space d) | |
| (PiLp.instPseudoMetricSpace (p := exponent) (Ξ² := fun _ : Fin d => β)) z R β | |
| AmbientBallBound ΞΌ H Ξ² β | |
| ΞΌ βͺ UniformSphere d β | |
| β F : ((Fin m β Space d) Γ (Fin m β β)) β β, | |
| Measurable F β (β x, 0 β€ F x) β | |
| (MatrixLabelReference d m).withDensity (fun x => ENNReal.ofReal (F x)) = | |
| ProjectionLaw ΞΌ m β | |
| Tendsto (fun Ξ΄ => eLpNorm (fun Ay => GaussianRegularization ΞΌ m Ξ΄ Ay - F Ay) | |
| 1 (MatrixLabelReference d m)) (π[Set.Ioi 0] 0) (π 0) β§ | |
| eLpNorm F (p : ββ₯0β) (MatrixLabelReference d m) β€ | |
| ENNReal.ofReal (ProjectionNormScale m p H Ξ² R) | |
| theorem joint_l1 : JointL1Statement := by | |
| intro d m p hd hm hmd hp Ξ² H R hgap hH hR z ΞΌ hΞΌ hs hb hac F hFm hF0 hden | |
| have : IsFiniteMeasure ΞΌ := hΞΌ | |
| have : IsFiniteMeasure (ProjectionLaw ΞΌ m) := by unfold ProjectionLaw; infer_instance | |
| have : SigmaFinite (MatrixLabelReference d m) := by unfold MatrixLabelReference; infer_instance | |
| have hF := memLp_density_of_finite (MatrixLabelReference d m) (ProjectionLaw ΞΌ m) hFm hF0 hden | |
| constructor | |
| Β· have ht := tendsto_eLpNorm_averageTranslate_sub | |
| (Measure.pi (fun _ : Fin m => stdGaussian (Space d))) | |
| (volume : Measure (Fin m β β)) | |
| (Measure.pi (fun _ : Fin m => gaussianReal 0 1)) hFm hF | |
| apply (ht.mono_left nhdsWithin_le_nhds).congr' | |
| filter_upwards [self_mem_nhdsWithin] with Ξ΄ hΞ΄ | |
| apply eLpNorm_congr_ae | |
| filter_upwards [GaussianRegularization_ae_eq_average ΞΌ m F hFm hF0 hden Ξ΄ | |
| (ne_of_gt hΞ΄)] with x hx | |
| exact congrArg (fun t => t - F x) hx.symm | |
| Β· obtain β¨G,hGm,hG0,hGden,hGs,hGnormβ© := | |
| exact_finite_density d m p hp hm Ξ² H R hgap hH hR z ΞΌ hs hb | |
| have he := density_ae_unique_real (MatrixLabelReference d m) hFm hF0 hGm hG0 | |
| (hden.trans hGden.symm) | |
| exact (eLpNorm_congr_ae he).symm βΈ hGnorm | |
| end MemoryPrecision | |
| end | |
| end OAI | |