import Mathlib import OAI.MeasureTheory.Falconer.Fourier.DistanceSincSpectralIdentity import OAI.MeasureTheory.Falconer.Model import OAI.MeasureTheory.FalconerCompletion.Fourier.MinimalMask namespace OAI /-! Dyadic shells and prefix decompositions. -/ open _root_.OAI.PlanarFalconer section section open Set MeasureTheory open scoped ComplexConjugate RealInnerProductSpace namespace GraphLiteralSupport namespace CurrentFalconer.TreeND open Set MeasureTheory PlanarFalconer _root_.OAI.GraphLiteralSupport.Attempt4FullFar open scoped ENNReal variable {n : ℕ} namespace PositiveDistanceState variable (e : PositiveDistanceState (n+1)) lemma weightedDistance_collision_lower [IsFiniteMeasure e.ρ] {K : ℝ} (hK : 32*(n+2:ℝ)≤K) (hX : e.X.length=e.a) (hY : e.Y.length=e.a) (hs : farSeparatedGridND e.a K (fun j => (pathIndex e.X j:ℤ)) (fun j => (pathIndex e.Y j:ℤ))) (S : Set (ℝ × ℝ)) (hS : MeasurableSet S) : (e.levelMass^(-2:ℤ)*(8*K)^(-(n:ℝ)/2))^2 * (e.distance.prod e.distance).real S ≤ (e.weightedDistance.prod e.weightedDistance).real S := by let := e.weightedDistance_isFinite hK hX hY hs have hKp : 0 (pathIndex e.X j:ℤ)) (fun j => (pathIndex e.Y j:ℤ)) → e.coincidence.toReal ≤ H*(2:ℝ)^(-(e.a:ℝ))* ∫ r in Icc (-((2:ℝ)^e.t)) ((2:ℝ)^e.t), ‖charFun e.weightedDistance r‖^2 := by obtain ⟨C,hC,hfourier⟩ := finite_measure_distance_collision_fourier_wide have hKp : 0 (pathIndex e.X j:ℤ)) (fun j => (pathIndex e.Y j:ℤ))) : e.weightedDistance.real univ≤e.levelMass^(-2:ℤ)*e.cellPair.real univ := by have h := Measure.le_iff.mp (e.weightedPair_le hK hX hY hs) univ MeasurableSet.univ have ht : (ENNReal.ofReal (e.levelMass^(-2:ℤ)) • e.cellPair) univ≠⊤ := by rw [Measure.smul_apply,smul_eq_mul] exact ENNReal.mul_ne_top ENNReal.ofReal_ne_top (measure_ne_top _ _) have h' := ENNReal.toReal_mono ht h rw [Measure.smul_apply,smul_eq_mul,ENNReal.toReal_mul, ENNReal.toReal_ofReal (by positivity : 0≤e.levelMass^(-2:ℤ))] at h' simpa only [weightedDistance,measureReal_def,Measure.map_apply (continuous_fst.dist continuous_snd).measurable MeasurableSet.univ,preimage_univ] using h' lemma weightedDistance_profile_mass {K : ℝ} (hK : 32*(n+2:ℝ)≤K) {B : ℕ} {s lam : ℝ} (hd : RegularizedProfileData e.ρ e.N B s lam e.mass) (ha : e.a≤e.N) (hX : e.X.length=e.a) (hY : e.Y.length=e.a) (hs : farSeparatedGridND e.a K (fun j => (pathIndex e.X j:ℤ)) (fun j => (pathIndex e.Y j:ℤ))) : e.weightedDistance.real univ≤((2:ℝ)^e.N)^(2*(n+2:ℝ)*lam) := by let := hd.probability apply (e.weightedDistance_mass_le hK hX hY hs).trans simpa only [Nat.cast_add,Nat.cast_one,add_assoc,one_add_one_eq_two] using e.normalized_cellPair_profile_mass hd ha hX hY lemma prefix_low_frequency_stopping {K : ℝ} (hK : 32*(n+2:ℝ)≤K) {B : ℕ} {s lam : ℝ} (hd : RegularizedProfileData e.ρ e.N B s lam e.mass) (ha : e.a≤e.N) (hX : e.X.length=e.a) (hY : e.Y.length=e.a) (hs : farSeparatedGridND e.a K (fun j => (pathIndex e.X j:ℤ)) (fun j => (pathIndex e.Y j:ℤ))) : (2:ℝ)^(-(e.a:ℝ))*(∫ r in Icc (-((2:ℝ)^e.a)) ((2:ℝ)^e.a), ‖charFun e.weightedDistance r‖^2) ≤ 2*((2:ℝ)^e.N)^(4*(n+2:ℝ)*lam) := by let := hd.probability let := e.weightedDistance_isFinite hK hX hY hs have hm := e.weightedDistance_profile_mass hK hd ha hX hY hs have hr : (((2:ℝ)^e.N)^(2*(n+2:ℝ)*lam))^2=((2:ℝ)^e.N)^(4*(n+2:ℝ)*lam) := by rw [← Real.rpow_mul_natCast (by positivity : 0≤(2:ℝ)^e.N)] congr 1 norm_num ring have hb (r : ℝ) : ‖charFun e.weightedDistance r‖^2≤((2:ℝ)^e.N)^(4*(n+2:ℝ)*lam) := by rw [← hr] exact pow_le_pow_left₀ (norm_nonneg _) ((norm_charFun_le r).trans hm) 2 have hi : Integrable (fun r => ‖charFun e.weightedDistance r‖^2) (volume.restrict (Icc (-((2:ℝ)^e.a)) ((2:ℝ)^e.a))) := by simpa only [one_mul] using charFun_sq_integrable_finite e.weightedDistance (volume.restrict (Icc (-((2:ℝ)^e.a)) ((2:ℝ)^e.a))) 1 have h := integral_mono_ae hi (integrable_const (((2:ℝ)^e.N)^(4*(n+2:ℝ)*lam))) (Filter.Eventually.of_forall hb) apply (mul_le_mul_of_nonneg_left h (by positivity : 0≤(2:ℝ)^(-(e.a:ℝ)))).trans_eq have hwidth : 0≤(2:ℝ)^e.a - -((2:ℝ)^e.a) := by have hp : 0<(2:ℝ)^e.a := by positivity linarith rw [integral_const,Measure.real,Measure.restrict_apply_univ,Real.volume_Icc, ENNReal.toReal_ofReal hwidth,smul_eq_mul, Real.rpow_neg (by norm_num : (0:ℝ)≤2),Real.rpow_natCast] field_simp ring end PositiveDistanceState end CurrentFalconer.TreeND end GraphLiteralSupport end end end OAI