import Euler.MeanHarmonicSmallBall import Mathlib.Analysis.Calculus.BumpFunction.Convolution import Mathlib.Analysis.Calculus.ContDiff.Convolution import Mathlib.MeasureTheory.Measure.Haar.NormedSpace /-! A fixed shrinking compact mollifier and distributional scalar harmonicity. -/ /-! ## From `Euler/MeanScalarMollification.lean` The text of `Euler/MeanScalarMollification.lean`, folded into this file, which was its only importer. -/ section /-! Actual compact mollification on R³ is smooth and contractive on scalar L². -/ noncomputable section namespace EulerMeanHarmonic open MeasureTheory InnerProductSpace EulerSmoothLimit open scoped ContDiff Convolution def scalarMollification (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) : Space → ℝ := φ.normed volume ⋆[ContinuousLinearMap.lsmul ℝ ℝ, volume] f theorem scalarMollification_smooth (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) (hf : MemLp f 2 volume) : ContDiff ℝ ∞ (scalarMollification φ f) := φ.hasCompactSupport_normed.contDiff_convolution_left (ContinuousLinearMap.lsmul ℝ ℝ) φ.contDiff_normed (hf.locallyIntegrable (by norm_num)) /-- The elementary variance inequality for the actual normalized convolution. -/ theorem scalarMollification_sq_le (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) (hf : MemLp f 2 volume) (x : Space) : scalarMollification φ f x ^ 2 ≤ scalarMollification φ (fun y => f y ^ 2) x := by let m := scalarMollification φ f x have hi : Integrable (fun y => φ.normed volume y * f (x-y)) volume := φ.hasCompactSupport_normed.convolutionExists_left (ContinuousLinearMap.lsmul ℝ ℝ) (φ.contDiff_normed (n := (⊤ : ℕ∞))).continuous (hf.locallyIntegrable (by norm_num)) x have hf2 : Integrable (fun y => f y ^ 2) volume := (memLp_two_iff_integrable_sq hf.aestronglyMeasurable).1 hf have hi2 : Integrable (fun y => φ.normed volume y * f (x-y)^2) volume := φ.hasCompactSupport_normed.convolutionExists_left (ContinuousLinearMap.lsmul ℝ ℝ) (φ.contDiff_normed (n := (⊤ : ℕ∞))).continuous hf2.locallyIntegrable x have hi0 := φ.integrable_normed (μ := (volume : Measure Space)) have H : (∫ y, (2*m) * (φ.normed volume y * f (x-y)) - m^2 * φ.normed volume y) ≤ ∫ y, φ.normed volume y * f (x-y)^2 := by apply integral_mono ((hi.const_mul (2*m)).sub (hi0.const_mul (m^2))) hi2 intro y change (2*m) * (φ.normed volume y * f (x-y)) - m^2 * φ.normed volume y ≤ φ.normed volume y * f (x-y)^2 have h := mul_nonneg (φ.nonneg_normed (μ := (volume : Measure Space)) y) (sq_nonneg (f (x-y)-m)) linarith rw [integral_sub (hi.const_mul (2*m)) (hi0.const_mul (m^2)), integral_const_mul, integral_const_mul, φ.integral_normed] at H have hm : (∫ y, φ.normed volume y * f (x-y)) = m := rfl rw [hm] at H change m^2 ≤ ∫ y, φ.normed volume y * f (x-y)^2 linarith theorem scalarMollification_sq_integrable (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) (hf : MemLp f 2 volume) : Integrable (fun x => scalarMollification φ f x ^ 2) volume := by have hf2 : Integrable (fun y => f y ^ 2) volume := (memLp_two_iff_integrable_sq hf.aestronglyMeasurable).1 hf have hc : Integrable (scalarMollification φ (fun y => f y ^ 2)) volume := φ.integrable_normed.integrable_convolution (ContinuousLinearMap.lsmul ℝ ℝ) hf2 apply hc.mono' ((scalarMollification_smooth φ f hf).continuous.pow 2).aestronglyMeasurable filter_upwards [] with x change ‖scalarMollification φ f x ^ 2‖ ≤ _ simpa only [Real.norm_eq_abs, abs_of_nonneg (sq_nonneg (scalarMollification φ f x))] using scalarMollification_sq_le φ f hf x theorem scalarMollification_memLp (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) (hf : MemLp f 2 volume) : MemLp (scalarMollification φ f) 2 volume := (memLp_two_iff_integrable_sq (scalarMollification_smooth φ f hf).continuous.aestronglyMeasurable).2 (scalarMollification_sq_integrable φ f hf) theorem scalarMollification_energy_le (φ : ContDiffBump (0 : Space)) (f : Space → ℝ) (hf : MemLp f 2 volume) : lpNorm (scalarMollification φ f) 2 volume ^ 2 ≤ lpNorm f 2 volume ^ 2 := by rw [lpNorm_sq_eq_integral_sq _ (scalarMollification_memLp φ f hf), lpNorm_sq_eq_integral_sq _ hf] have hf2 : Integrable (fun y => f y ^ 2) volume := (memLp_two_iff_integrable_sq hf.aestronglyMeasurable).1 hf calc _ ≤ ∫ x, scalarMollification φ (fun y => f y ^ 2) x := integral_mono (scalarMollification_sq_integrable φ f hf) (φ.integrable_normed.integrable_convolution (ContinuousLinearMap.lsmul ℝ ℝ) hf2) (scalarMollification_sq_le φ f hf) _ = _ := by rw [scalarMollification, integral_convolution (ContinuousLinearMap.lsmul ℝ ℝ) φ.integrable_normed hf2, φ.integral_normed] simp only [ContinuousLinearMap.lsmul_apply, one_smul] end EulerMeanHarmonic end end /-! ## From `Euler/MeanHarmonicScaling.lean` The text of `Euler/MeanHarmonicScaling.lean`, folded into this file, which was its only importer. -/ section /-! Scaling the actual Laplacian and harmonic interior estimates on R³. -/ noncomputable section namespace EulerMeanHarmonic open MeasureTheory InnerProductSpace Laplacian EulerSmoothLimit open scoped ContDiff theorem laplacian_comp_const_smul (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) (a : ℝ) (x : Space) : Δ (fun y => f (a • y)) x = a^2 * Δ f (a • x) := by rw [laplacian_eq_iteratedFDeriv_orthonormalBasis _ (EuclideanSpace.basisFun (Fin 3) ℝ), laplacian_eq_iteratedFDeriv_orthonormalBasis _ (EuclideanSpace.basisFun (Fin 3) ℝ)] rw [iteratedFDeriv_comp_const_smul a (hf.of_le (by simp))] simp only [smul_apply, smul_eq_mul, Finset.mul_sum] def halfScale (f : Space → ℝ) : Space → ℝ := fun x => f ((1/2 : ℝ) • x) theorem halfScale_smooth (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) : ContDiff ℝ ∞ (halfScale f) := hf.comp (contDiff_id.const_smul (1/2 : ℝ)) theorem halfScale_memLp (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) (hLp : MemLp f 2 volume) : MemLp (halfScale f) 2 volume := by apply (memLp_two_iff_integrable_sq (halfScale_smooth f hf).continuous.aestronglyMeasurable).2 exact ((memLp_two_iff_integrable_sq hLp.aestronglyMeasurable).1 hLp).comp_smul (R := (1/2 : ℝ)) (by norm_num) theorem halfScale_energy (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) (hLp : MemLp f 2 volume) : lpNorm (halfScale f) 2 volume ^ 2 = 8 * lpNorm f 2 volume ^ 2 := by rw [lpNorm_sq_eq_integral_sq _ (halfScale_memLp f hf hLp), lpNorm_sq_eq_integral_sq _ hLp] change (∫ x, f ((1/2 : ℝ) • x) ^ 2) = _ rw [Measure.integral_comp_smul volume (fun x => f x ^ 2) (1/2 : ℝ)] norm_num [Space, smul_eq_mul] theorem halfScale_harmonic (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) (hharmonic : ∀ x ∈ Metric.ball 0 (1/2 : ℝ), Δ f x = 0) : ∀ x ∈ Metric.ball 0 (1 : ℝ), Δ (halfScale f) x = 0 := by intro x hx change Δ (fun y => f ((1/2 : ℝ) • y)) x = 0 rw [laplacian_comp_const_smul f hf] have hx' : (1/2 : ℝ) • x ∈ Metric.ball (0 : Space) (1/2 : ℝ) := by simp only [Metric.mem_ball, dist_zero_right] at hx ⊢ rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by norm_num : 0 < (1/2 : ℝ))] linarith rw [hharmonic _ hx', mul_zero] def harmonicQuarterBallConstant : ℝ := 8 * harmonicInteriorConstant ^ 2 theorem harmonicQuarterBallConstant_nonneg : 0 ≤ harmonicQuarterBallConstant := by unfold harmonicQuarterBallConstant positivity /-- A squared pointwise bound with room for a compact mollifier near the boundary. -/ theorem harmonic_pointwise_quarterBall_sq (f : Space → ℝ) (hf : ContDiff ℝ ∞ f) (hLp : MemLp f 2 volume) (hharmonic : ∀ x ∈ Metric.ball 0 (1/2 : ℝ), Δ f x = 0) (x : Space) (hx : x ∈ Metric.closedBall 0 (1/4 : ℝ)) : f x ^ 2 ≤ harmonicQuarterBallConstant * lpNorm f 2 volume ^ 2 := by have hx' : (2 : ℝ) • x ∈ Metric.closedBall (0 : Space) (1/2 : ℝ) := by simp only [Metric.mem_closedBall, dist_zero_right] at hx ⊢ rw [norm_smul, Real.norm_eq_abs, abs_of_pos (by norm_num : 0 < (2 : ℝ))] linarith have H := harmonic_pointwise_halfBall (halfScale f) (halfScale_smooth f hf) (halfScale_memLp f hf hLp) (halfScale_harmonic f hf hharmonic) ((2 : ℝ) • x) hx' have heval : halfScale f ((2 : ℝ) • x) = f x := by simp [halfScale, smul_smul] rw [heval] at H have H2 := pow_le_pow_left₀ (abs_nonneg (f x)) H 2 rw [sq_abs, mul_pow, halfScale_energy f hf hLp] at H2 unfold harmonicQuarterBallConstant linarith end EulerMeanHarmonic end end noncomputable section namespace EulerMeanHarmonic open MeasureTheory InnerProductSpace Laplacian EulerSmoothLimit EulerNoncompactTransport open scoped ContDiff Convolution Topology /-- Harmonicity tested against genuine smooth compactly supported scalar functions. -/ def ScalarWeakHarmonicOn (U : Set Space) (f : Space → ℝ) : Prop := ∀ φ : Space → ℝ, HasCompactSupport φ → ContDiff ℝ ∞ φ → tsupport φ ⊆ U → (∫ x, f x * Δ φ x) = 0 def interiorMollifier (n : ℕ) : ContDiffBump (0 : Space) where rIn := (1/16 : ℝ) * cutoffScale n rOut := (1/8 : ℝ) * cutoffScale n rIn_pos := mul_pos (by norm_num) (cutoffScale_pos n) rIn_lt_rOut := by have hc := cutoffScale_pos n nlinarith theorem interiorMollifier_rOut_le (n : ℕ) : (interiorMollifier n).rOut ≤ 1/4 := by change (1/8 : ℝ) * cutoffScale n ≤ 1/4 have hc := cutoffScale_le_one n linarith theorem interiorMollifier_rOut_tendsto : Filter.Tendsto (fun n => (interiorMollifier n).rOut) Filter.atTop (𝓝 (0 : ℝ)) := by simpa only [interiorMollifier, mul_zero] using cutoffScale_tendsto.const_mul (1/8 : ℝ) theorem interiorMollifier_shape (n : ℕ) : (interiorMollifier n).rOut ≤ 2 * (interiorMollifier n).rIn := by change (1/8 : ℝ) * cutoffScale n ≤ 2 * ((1/16 : ℝ) * cutoffScale n) ring_nf exact le_rfl /-- The classical smooth convolutions recover every scalar L² function almost everywhere. -/ theorem scalarMollification_ae_tendsto (f : Space → ℝ) (hf : MemLp f 2 volume) : ∀ᵐ x ∂volume, Filter.Tendsto (fun n => scalarMollification (interiorMollifier n) f x) Filter.atTop (𝓝 (f x)) := ContDiffBump.ae_convolution_tendsto_right_of_locallyIntegrable interiorMollifier_rOut_tendsto (Filter.Eventually.of_forall interiorMollifier_shape) (hf.locallyIntegrable (by norm_num)) /-- A uniform squared pointwise bound passes from these genuine mollifiers to f. -/ theorem ae_bound_of_scalarMollification_bound (f : Space → ℝ) (hf : MemLp f 2 volume) (U : Set Space) (C : ℝ) (hbound : ∀ n x, x ∈ U → scalarMollification (interiorMollifier n) f x ^ 2 ≤ C) : ∀ᵐ x ∂volume, x ∈ U → f x ^ 2 ≤ C := by filter_upwards [scalarMollification_ae_tendsto f hf] with x hx intro hxU exact le_of_tendsto (hx.pow 2) (Filter.Eventually.of_forall fun n => hbound n x hxU) end EulerMeanHarmonic