Download data/lean/OAI/Analysis/Fourier/WavePackets/Localization.lean from introvoyz045/math: direct link, hf CLI and curl.
- Browser
- Download file 9.45 kB
-
https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Fourier/WavePackets/Localization.lean
- Command line
-
hf download hf://datasets/introvoyz045/math/data/lean/OAI/Analysis/Fourier/WavePackets/Localization.lean
-
curl -L -o Localization.lean https://huggingface.co/datasets/introvoyz045/math/resolve/main/data/lean/OAI/Analysis/Fourier/WavePackets/Localization.lean
9.45 kB
| import OAI.Analysis.Fourier.WavePackets.ConvolutionIdentity | |
| namespace OAI.Analysis.Fourier.WavePackets | |
| open _root_.MeasureTheory | |
| open scoped ENNReal ContDiff RealInnerProductSpace | |
| noncomputable local instance : MeasureSpace UnitAddCircle := β¨AddCircle.haarAddCircleβ© | |
| local instance : Measure.IsAddHaarMeasure (volume : Measure UnitAddCircle) := | |
| inferInstanceAs (Measure.IsAddHaarMeasure AddCircle.haarAddCircle) | |
| local instance : IsProbabilityMeasure (volume : Measure UnitAddCircle) := | |
| inferInstanceAs (IsProbabilityMeasure AddCircle.haarAddCircle) | |
| /-- Representatives in the centered unit cube, scaled to the physical side-100 torus. -/ | |
| noncomputable def torusInput {n : β} {F : Type*} (f : EuclideanSpace β (Fin n) β F) | |
| (x : UnitAddTorus (Fin n)) : F := | |
| f ((100 : β) β’ WithLp.toLp 2 | |
| ((UnitAddTorus.measurableEquivPiIoc (fun _ : Fin n => -(1/2 : β))) x).val) | |
| theorem torusInput_coe {n : β} {F : Type*} (f : EuclideanSpace β (Fin n) β F) (x : Fin n β β) | |
| (hx : β i, x i β Set.Ioc (-(1/2 : β)) (-(1/2 : β) + 1)) : | |
| torusInput f (fun i => (x i : UnitAddCircle)) = f ((100 : β) β’ WithLp.toLp 2 x) := by | |
| have he : (fun i => (x i : UnitAddCircle)) = | |
| (UnitAddTorus.measurableEquivPiIoc (fun _ : Fin n => -(1/2 : β))).symm β¨x, hxβ© := rfl | |
| unfold torusInput | |
| rw [he, MeasurableEquiv.apply_symm_apply] | |
| theorem measurable_torusInput {n : β} {f : EuclideanSpace β (Fin n) β β} (hf : Measurable f) : | |
| Measurable (torusInput f) := by | |
| have hc : Continuous (fun x : Fin n β β => (100 : β) β’ WithLp.toLp 2 x) := by fun_prop | |
| exact hf.comp (hc.measurable.comp (measurable_subtype_coe.comp | |
| (UnitAddTorus.measurableEquivPiIoc (fun _ : Fin n => -(1/2 : β))).measurable)) | |
| /-- Pairings on the large torus are physical pairings multiplied by its inverse volume. -/ | |
| theorem integral_torusInput_pairing {n : β} (f : EuclideanSpace β (Fin n) β β) | |
| (hs : Function.support f β coordinateCube n 5) (g : UnitAddTorus (Fin n) β β) : | |
| (β« x, g x * torusInput f x) = ((100 : β) ^ n)β»ΒΉ * | |
| β« Y, g (torusProjection ((1 / 100 : β) β’ Y)) * f Y := by | |
| rw [UnitAddTorus.integral_preimage _ (fun _ : Fin n => -(1/2 : β))] | |
| have hp : (fun x : Fin n β β => g (fun i => (x i : UnitAddCircle)) * | |
| torusInput f (fun i => (x i : UnitAddCircle))) =α΅[ | |
| volume.restrict {x : Fin n β β | β i, x i β Set.Ioc (-(1/2 : β)) (-(1/2 : β) + 1)}] | |
| (fun x => g (fun i => (x i : UnitAddCircle)) * f ((100 : β) β’ WithLp.toLp 2 x)) := by | |
| apply ae_restrict_of_forall_mem (by measurability) | |
| intro x hx | |
| dsimp only | |
| rw [torusInput_coe f x hx] | |
| rw [integral_congr_ae hp] | |
| have hsupport : Function.support (fun x : Fin n β β => | |
| g (fun i => (x i : UnitAddCircle)) * f ((100 : β) β’ WithLp.toLp 2 x)) β | |
| {x : Fin n β β | β i, x i β Set.Ioc (-(1/2 : β)) (-(1/2 : β) + 1)} := by | |
| intro x hx i | |
| have hf : f ((100 : β) β’ WithLp.toLp 2 x) β 0 := (mul_ne_zero_iff.mp hx).2 | |
| have hi := hs hf i | |
| change |100 * x i| β€ 5 at hi | |
| constructor <;> nlinarith [abs_le.mp hi] | |
| rw [setIntegral_eq_integral_of_forall_compl_eq_zero (fun x hx => by | |
| by_contra hfx | |
| exact hx (hsupport hfx))] | |
| have hchange := (PiLp.volume_preserving_ofLp (Fin n)).integral_comp | |
| (PiLp.homeomorph 2 (fun _ : Fin n => β)).measurableEmbedding | |
| (fun x : Fin n β β => g (fun i => (x i : UnitAddCircle)) * f ((100 : β) β’ WithLp.toLp 2 x)) | |
| rw [β hchange] | |
| have hpoint (x : EuclideanSpace β (Fin n)) : | |
| g (fun i => (x i : UnitAddCircle)) * f ((100 : β) β’ x) = | |
| (fun Y => g (torusProjection ((1 / 100 : β) β’ Y)) * f Y) ((100 : β) β’ x) := by | |
| have he : (1 / 100 : β) β’ ((100 : β) β’ x) = x := by module | |
| dsimp only | |
| rw [he] | |
| rfl | |
| simp_rw [hpoint] | |
| have hi := Measure.integral_comp_smul_of_nonneg volume | |
| (fun Y : EuclideanSpace β (Fin n) => g (torusProjection ((1 / 100 : β) β’ Y)) * f Y) | |
| (100 : β) (hR := by norm_num) | |
| simpa only [finrank_euclideanSpace, Fintype.card_fin, Complex.real_smul, | |
| Complex.ofReal_inv, Complex.ofReal_pow, Complex.ofReal_ofNat] using hi | |
| theorem lintegral_torusInput {n : β} (f : EuclideanSpace β (Fin n) β ββ₯0β) | |
| (hs : Function.support f β coordinateCube n 5) : | |
| (β«β» x, torusInput f x) = ((100 : ββ₯0β) ^ n)β»ΒΉ * β«β» Y, f Y := by | |
| rw [UnitAddTorus.lintegral_preimage _ (fun _ : Fin n => -(1/2 : β))] | |
| have hp : (fun x : Fin n β β => torusInput f (fun i => (x i : UnitAddCircle))) =α΅[ | |
| volume.restrict {x : Fin n β β | β i, x i β Set.Ioc (-(1/2 : β)) (-(1/2 : β) + 1)}] | |
| (fun x => f ((100 : β) β’ WithLp.toLp 2 x)) := by | |
| apply ae_restrict_of_forall_mem (by measurability) | |
| intro x hx | |
| exact torusInput_coe f x hx | |
| rw [lintegral_congr_ae hp] | |
| have hsupport : Function.support (fun x : Fin n β β => f ((100 : β) β’ WithLp.toLp 2 x)) β | |
| {x : Fin n β β | β i, x i β Set.Ioc (-(1/2 : β)) (-(1/2 : β) + 1)} := by | |
| intro x hx i | |
| have hi := hs hx i | |
| change |100 * x i| β€ 5 at hi | |
| constructor <;> nlinarith [abs_le.mp hi] | |
| rw [setLIntegral_eq_of_support_subset hsupport] | |
| have hchange := (PiLp.volume_preserving_ofLp (Fin n)).lintegral_comp_emb | |
| (PiLp.homeomorph 2 (fun _ : Fin n => β)).measurableEmbedding | |
| (fun x : Fin n β β => f ((100 : β) β’ WithLp.toLp 2 x)) | |
| rw [β hchange] | |
| have hi := lintegral_map_equiv (ΞΌ := (volume : Measure (EuclideanSpace β (Fin n)))) f | |
| (Homeomorph.smulOfNeZero (100 : β) (by norm_num)).toMeasurableEquiv | |
| change (β«β» x, f x βMeasure.map (fun x => (100 : β) β’ x) volume) = | |
| (β«β» x, f ((100 : β) β’ x)) at hi | |
| change (β«β» x, f ((100 : β) β’ x)) = _ | |
| rw [β hi] | |
| rw [Measure.map_addHaar_smul volume (by norm_num), lintegral_smul_measure] | |
| simp [finrank_euclideanSpace, ENNReal.ofReal_pow, ENNReal.ofReal_inv_of_pos] | |
| theorem eLpNorm_torusInput {n : β} (f : EuclideanSpace β (Fin n) β β) | |
| (hm : Measurable f) (hs : Function.support f β coordinateCube n 5) | |
| {p : ββ₯0β} (hp : p β 0) (hptop : p β β€) : | |
| eLpNorm (torusInput f) p volume = | |
| (((100 : ββ₯0β) ^ n)β»ΒΉ) ^ (1 / p.toReal) * eLpNorm f p volume := by | |
| rw [eLpNorm_eq_lintegral_rpow_enorm_toReal hp hptop | |
| (measurable_torusInput hm).aestronglyMeasurable, | |
| eLpNorm_eq_lintegral_rpow_enorm_toReal hp hptop hm.aestronglyMeasurable] | |
| have hsp : Function.support (fun x => βf xββ ^ p.toReal) β coordinateCube n 5 := by | |
| intro x hx | |
| apply hs | |
| intro hf | |
| apply hx | |
| simp [hf, ENNReal.toReal_pos hp hptop] | |
| have he : (fun x => βtorusInput f xββ ^ p.toReal) = | |
| torusInput (fun x => βf xββ ^ p.toReal) := rfl | |
| rw [he, lintegral_torusInput _ hsp, ENNReal.mul_rpow_of_nonneg _ _ (by positivity)] | |
| theorem integrable_torusInput {n : β} {f : EuclideanSpace β (Fin n) β β} | |
| (hm : Measurable f) (hf : Integrable f) | |
| (hs : Function.support f β coordinateCube n 5) : Integrable (torusInput f) := by | |
| apply memLp_one_iff_integrable.mp | |
| change eLpNorm (torusInput f) 1 volume < β€ | |
| rw [eLpNorm_torusInput f hm hs one_ne_zero ENNReal.one_ne_top] | |
| apply ENNReal.mul_lt_top | |
| Β· norm_num; positivity | |
| Β· exact (memLp_one_iff_integrable.mpr hf).eLpNorm_lt_top | |
| theorem torusProjection_sub {n : β} (X Y : EuclideanSpace β (Fin n)) : | |
| torusProjection X - torusProjection Y = torusProjection (X - Y) := by | |
| ext i | |
| simp [torusProjection] | |
| /-- The actual periodic and Euclidean half-waves differ on the observation | |
| cube by precisely the already estimated periodization error. -/ | |
| theorem periodicHalfWave_local_comparison {n : β} | |
| {Ο : EuclideanSpace β (Fin n) β β} (hΟ : ContDiff β β Ο) | |
| (hs : HasCompactSupport Ο) (hzero : (0 : EuclideanSpace β (Fin n)) β tsupport Ο) | |
| {f : EuclideanSpace β (Fin n) β β} (hm : Measurable f) (hf : Integrable f) | |
| (hsf : Function.support f β coordinateCube n 5) | |
| {h T : β} (hh : 0 < h) (hhβ : h β€ 1) (hTβ : 0 β€ T) (hTβ : T β€ 2) | |
| {X : EuclideanSpace β (Fin n)} (hX : X β coordinateCube n (1 / 2)) : | |
| periodicHalfWave Ο h T (torusInput f) (torusProjection ((1 / 100 : β) β’ X)) = | |
| OAI.Analysis.Fourier.LocalSmoothing.frequencyHalfWave Ο h T f X + | |
| (((2 * Real.pi : β) : β) ^ n)β»ΒΉ * periodizationError volume Ο f h T X := by | |
| obtain β¨C, hC, hbβ© := periodizationError_bound (ΞΌ := volume) hΟ hzero hs 0 | |
| have hR := (hb f hf (Filter.Eventually.of_forall fun Y hY => hsf hY) | |
| X T h hX hTβ hTβ hh hhβ).1 | |
| have hK := (frequencyHalfWave_eq_integral_kernel hΟ.continuous hs hh T hf X).1 | |
| rw [periodicHalfWave_eq_kernel_integral hs hh T (integrable_torusInput hm hf hsf), | |
| integral_torusInput_pairing f hsf] | |
| rw [β mul_assoc, mul_inv_cancelβ (pow_ne_zero n (by norm_num)), one_mul] | |
| have hq (Y : EuclideanSpace β (Fin n)) : | |
| torusProjection ((1 / 100 : β) β’ X) - torusProjection ((1 / 100 : β) β’ Y) = | |
| torusProjection ((1 / 100 : β) β’ (X - Y)) := by | |
| rw [torusProjection_sub, smul_sub] | |
| simp_rw [hq, periodicKernel_eq_kernel_add_remainder hs hΟ hzero hh, mul_assoc, | |
| add_mul] | |
| rw [integral_const_mul, integral_add hK hR, | |
| (frequencyHalfWave_eq_integral_kernel hΟ.continuous hs hh T hf X).2] | |
| unfold periodizationError | |
| ring | |
| end OAI.Analysis.Fourier.WavePackets | |