import OAI.MeasureTheory.Falconer.Recursion.CriticalPotential import Mathlib.MeasureTheory.Integral.Lebesgue.Map namespace OAI /-! # Critical dyadic inverse potentials of a nonnegative statistic -/ namespace Falconer open Set Metric MeasureTheory open scoped ENNReal variable {X : Type*} [MeasurableSpace X] theorem regularized_scalar_potential_critical (μ : Measure X) (a : X → ℝ) (ha : Measurable a) (ha0 : ∀ x, 0 ≤ a x) {K q : ℝ} (hq : 0 ≤ q) (g k : ℕ) (hsmall : ∀ j : ℕ, j ≤ g+k → μ {x | a x < 1/(2:ℝ)^j} ≤ ENNReal.ofReal (K*(1/(2:ℝ)^j)^q)) : (∫⁻ x in {x | a x < 1/(2:ℝ)^g}, ENNReal.ofReal ((1/(a x+1/(2:ℝ)^(g+k)))^q) ∂μ) ≤ ENNReal.ofReal K+(k:ℝ≥0∞)*ENNReal.ofReal (K*(2:ℝ)^q) := by have hpre (j : ℕ) : a ⁻¹' ball (0:ℝ) (1/(2:ℝ)^j) = {x | a x < 1/(2:ℝ)^j} := by ext x simp only [mem_preimage,mem_ball,Real.dist_eq,sub_zero,abs_of_nonneg (ha0 x),mem_ofPred_eq] have hball (j : ℕ) (hj : j ≤ g+k) : (Measure.map a μ) (ball (0:ℝ) (1/(2:ℝ)^j)) ≤ ENNReal.ofReal (K*(1/(2:ℝ)^j)^q) := by rw [Measure.map_apply ha measurableSet_ball,hpre] exact hsmall j hj have hh := regularized_potential_critical (Measure.map a μ) (0:ℝ) hq g k hball have hf : Measurable (fun z : ℝ => ENNReal.ofReal ((1/(dist 0 z+1/(2:ℝ)^(g+k)))^q)) := by fun_prop have he : (∫⁻ z in ball (0:ℝ) (1/(2:ℝ)^g), ENNReal.ofReal ((1/(dist 0 z+1/(2:ℝ)^(g+k)))^q) ∂Measure.map a μ) = ∫⁻ x in {x | a x < 1/(2:ℝ)^g}, ENNReal.ofReal ((1/(a x+1/(2:ℝ)^(g+k)))^q) ∂μ := by rw [← lintegral_indicator measurableSet_ball,lintegral_map (hf.indicator measurableSet_ball) ha, ← lintegral_indicator (measurableSet_lt ha measurable_const)] apply lintegral_congr intro x by_cases hx : a x < 1/(2:ℝ)^g · have hz : a x ∈ ball (0:ℝ) (1/(2:ℝ)^g) := by change x ∈ a ⁻¹' ball (0:ℝ) (1/(2:ℝ)^g) rw [hpre] exact hx rw [indicator_of_mem hz,indicator_of_mem (show x ∈ {x | a x < 1/(2:ℝ)^g} from hx)] simp only [Real.dist_eq,zero_sub,abs_neg,abs_of_nonneg (ha0 x)] · have hz : a x ∉ ball (0:ℝ) (1/(2:ℝ)^g) := by change x ∉ a ⁻¹' ball (0:ℝ) (1/(2:ℝ)^g) rw [hpre] exact hx rw [indicator_of_notMem hz,indicator_of_notMem (show x ∉ {x | a x < 1/(2:ℝ)^g} from hx)] rw [he] at hh exact hh end Falconer end OAI