Dyadic time averages for mark-dependent integrands
DefinitionKLSModular_LevyStochCalc_Poisson_CompensatedDensityDyadicVendored from the LevyStochCalc library (https://github.com/cgarryZA/LevyStochCalc), commit 984dbf0b790031eac05d56fe5a84b65e15e1e932. dyadicPartition T n is the partition of , and dyadicAvg is the normalized volume average of on the -th interval. dyadicAvg_shifted uses the preceding interval and is zero at the first index. The bundle proves interval lengths, index membership for , measurability and boundedness of these averages, and identifies an average with a closed-ball average under Lebesgue measure.
Original module imports
import LevyStochCalc.Poisson.CompensatedDensityTruncation
Original declaration excerpt
Shown in the original module context.
noncomputable def dyadicPartition (T : ℝ) (n : ℕ) : Fin (2 ^ n + 1) → ℝ :=
fun i => (i : ℝ) * T / (2 ^ n : ℕ)
Module navigation
Direct project imports: LevyStochCalc/Poisson/CompensatedDensityTruncation.
Project result: The KLS conjecture.
Original module · LevyStochCalc.Poisson.CompensatedDensityDyadic · Frozen source 408915f.
import Definitions.Def_KLSModular_LevyStochCalc_Poisson_CompensatedDensityTruncation
/-
Copyright (c) 2026 Christian Garry. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Christian Garry
-/
-- Vendored from https://github.com/cgarryZA/LevyStochCalc at commit 984dbf0b790031eac05d56fe5a84b65e15e1e932 (upstream path LevyStochCalc/Poisson/CompensatedDensityDyadic.lean; Apache-2.0; provenance in formalization/vendor/vendor-lock.json of the KLS repository)
open MeasureTheory ProbabilityTheory
open scoped NNReal ENNReal
namespace LevyStochCalc
namespace Poisson
namespace Compensated
universe u v
variable {Ω : Type u} [MeasurableSpace Ω]
variable {E : Type v} [MeasurableSpace E]
/-- Dyadic partition of `[0, T]` at level `n`: `tᵢ = i·T/2ⁿ`. -/
noncomputable def dyadicPartition (T : ℝ) (n : ℕ) : Fin (2 ^ n + 1) → ℝ :=
fun i => (i : ℝ) * T / (2 ^ n : ℕ)
lemma dyadicPartition_strictMono {T : ℝ} (hT : 0 < T) (n : ℕ) :
StrictMono (dyadicPartition T n) := by
intro i j hij
unfold dyadicPartition
have h_pos : (0 : ℝ) < (2 ^ n : ℕ) := by positivity
rw [div_lt_div_iff_of_pos_right h_pos]
exact mul_lt_mul_of_pos_right (by exact_mod_cast hij) hT
/-- Dyadic mark-time average: the average of `φ(ω, ·, e)` over the `i`-th dyadic
interval, as a function of `(ω, e)`. -/
noncomputable def dyadicAvg
(T : ℝ) (φ : Ω → ℝ → E → ℝ) (n : ℕ) (i : Fin (2 ^ n)) (ω : Ω) (e : E) : ℝ :=
((2 ^ n : ℕ) / T) *
∫ s in Set.Ioc (dyadicPartition T n i.castSucc) (dyadicPartition T n i.succ), φ ω s e
/-- Left-shifted dyadic average (value from the *previous* interval; `0` on the
first), the adapted coefficient of the dyadic approximation. -/
noncomputable def dyadicAvg_shifted
(T : ℝ) (φ : Ω → ℝ → E → ℝ) (n : ℕ) (i : Fin (2 ^ n)) (ω : Ω) (e : E) : ℝ :=
if h : i.val = 0 then 0
else dyadicAvg T φ n ⟨i.val - 1, by omega⟩ ω e
/-- Joint `(ω, e)`-measurability of the dyadic average (Fubini: the Bochner integral
in `s` of a jointly measurable integrand is measurable in the remaining variables). -/
lemma dyadicAvg_measurable
(T : ℝ) (φ : Ω → ℝ → E → ℝ)
(h_meas : Measurable (fun p : Ω × ℝ × E => φ p.1 p.2.1 p.2.2))
(n : ℕ) (i : Fin (2 ^ n)) :
Measurable (fun q : Ω × E => dyadicAvg T φ n i q.1 q.2) := by
unfold dyadicAvg
refine Measurable.const_mul ?_ _
have h_reassoc : Measurable
(fun p : (Ω × E) × ℝ => φ p.1.1 p.2 p.1.2) :=
h_meas.comp (by fun_prop :
Measurable fun p : (Ω × E) × ℝ => ((p.1.1, p.2, p.1.2) : Ω × ℝ × E))
exact MeasureTheory.StronglyMeasurable.integral_prod_right'
(f := fun p : (Ω × E) × ℝ => φ p.1.1 p.2 p.1.2) h_reassoc.stronglyMeasurable |>.measurable
lemma dyadicAvg_shifted_measurable
(T : ℝ) (φ : Ω → ℝ → E → ℝ)
(h_meas : Measurable (fun p : Ω × ℝ × E => φ p.1 p.2.1 p.2.2))
(n : ℕ) (i : Fin (2 ^ n)) :
Measurable (fun q : Ω × E => dyadicAvg_shifted T φ n i q.1 q.2) := by
unfold dyadicAvg_shifted
by_cases h : i.val = 0
· simp only [h, ↓reduceDIte]; exact measurable_const
· simp only [h, ↓reduceDIte]; exact dyadicAvg_measurable T φ h_meas n _
omit [MeasurableSpace Ω] [MeasurableSpace E] in
/-- The dyadic average inherits the integrand's uniform bound: `|dyadicAvg| ≤ M`
(the average of values bounded by `M` over an interval of length `T/2ⁿ`). -/
lemma dyadicAvg_bounded {T : ℝ} (hT : 0 < T) (φ : Ω → ℝ → E → ℝ)
{M : ℝ} (hM : ∀ ω s e, |φ ω s e| ≤ M) (n : ℕ) (i : Fin (2 ^ n)) (ω : Ω) (e : E) :
|dyadicAvg T φ n i ω e| ≤ M := by
unfold dyadicAvg
set a := dyadicPartition T n i.castSucc with ha
set b := dyadicPartition T n i.succ with hb
have hab : a ≤ b := (dyadicPartition_strictMono hT n).monotone Fin.castSucc_lt_succ.le
have hlen : b - a = T / (2 ^ n : ℕ) := by
simp only [ha, hb, dyadicPartition, Fin.val_succ, Fin.val_castSucc]; push_cast; ring
rw [abs_mul, abs_of_nonneg (by positivity : (0 : ℝ) ≤ (2 ^ n : ℕ) / T)]
have hint : |∫ s in Set.Ioc a b, φ ω s e| ≤ M * (b - a) := by
rw [← Real.norm_eq_abs]
have h := MeasureTheory.norm_setIntegral_le_of_norm_le_const (μ := volume)
(s := Set.Ioc a b) (f := fun s => φ ω s e) (C := M)
(by rw [Real.volume_Ioc]; exact ENNReal.ofReal_lt_top)
(fun x _ => by rw [Real.norm_eq_abs]; exact hM ω x e)
rw [Real.volume_real_Ioc_of_le hab] at h
exact h
calc (2 ^ n : ℕ) / T * |∫ s in Set.Ioc a b, φ ω s e|
≤ (2 ^ n : ℕ) / T * (M * (b - a)) := mul_le_mul_of_nonneg_left hint (by positivity)
_ = M := by
rw [hlen]
have h2 : ((2 : ℝ) ^ n) ≠ 0 := by positivity
have hT' : T ≠ 0 := hT.ne'
push_cast; field_simp
omit [MeasurableSpace Ω] [MeasurableSpace E] in
/-- The left-shifted dyadic average is bounded by `max M 0` (covering the `i = 0`
case, which is the constant `0`). -/
lemma dyadicAvg_shifted_bounded {T : ℝ} (hT : 0 < T) (φ : Ω → ℝ → E → ℝ)
{M : ℝ} (hM : ∀ ω s e, |φ ω s e| ≤ M) (n : ℕ) (i : Fin (2 ^ n)) (ω : Ω) (e : E) :
|dyadicAvg_shifted T φ n i ω e| ≤ max M 0 := by
unfold dyadicAvg_shifted
by_cases h : i.val = 0
· simp only [h, ↓reduceDIte, abs_zero]; exact le_max_right _ _
· simp only [h, ↓reduceDIte]
exact (dyadicAvg_bounded hT φ hM n _ ω e).trans (le_max_left _ _)
/-- The dyadic interval length is `T/2ⁿ`. -/
lemma dyadicPartition_diff {T : ℝ} (n : ℕ) (i : Fin (2 ^ n)) :
dyadicPartition T n i.succ - dyadicPartition T n i.castSucc = T / (2 ^ n : ℕ) := by
unfold dyadicPartition
have hi_succ : ((i.succ : Fin (2 ^ n + 1)) : ℝ) = (i : ℝ) + 1 := by simp [Fin.val_succ]
have hi_castSucc : ((i.castSucc : Fin (2 ^ n + 1)) : ℝ) = (i : ℝ) := by simp [Fin.val_castSucc]
rw [hi_succ, hi_castSucc]; ring
/-- **Dyadic index:** for `s ∈ (0, T]`, the index `i ∈ Fin (2ⁿ)` with
`s ∈ (i·T/2ⁿ, (i+1)·T/2ⁿ]`, via the ceiling function. (Deterministic — no `Ω`/`E`.) -/
noncomputable def dyadicIndex (n : ℕ) (T : ℝ) (hT : 0 < T) (s : ℝ)
(hs : 0 < s ∧ s ≤ T) : Fin (2 ^ n) :=
⟨⌈s * (2 ^ n : ℕ) / T⌉₊ - 1, by
have h_pos : (0 : ℝ) < s * (2 ^ n : ℕ) / T :=
div_pos (mul_pos hs.1 (by positivity)) hT
have h_le : s * (2 ^ n : ℕ) / T ≤ (2 ^ n : ℕ) := by
rw [div_le_iff₀ hT]
have : s * (2 ^ n : ℕ) ≤ T * (2 ^ n : ℕ) :=
mul_le_mul_of_nonneg_right hs.2 (by positivity)
linarith
have h_ceil_le : ⌈s * (2 ^ n : ℕ) / T⌉₊ ≤ 2 ^ n := by
rw [Nat.ceil_le]; exact_mod_cast h_le
have h_ceil_pos : 0 < ⌈s * (2 ^ n : ℕ) / T⌉₊ := Nat.ceil_pos.mpr h_pos
omega⟩
/-- **Dyadic index membership:** `s ∈ (tᵢ, tᵢ₊₁]` with `tᵢ = i·T/2ⁿ`. -/
lemma dyadicIndex_mem (n : ℕ) (T : ℝ) (hT : 0 < T) (s : ℝ) (hs : 0 < s ∧ s ≤ T) :
((dyadicIndex n T hT s hs : ℕ) : ℝ) * T / (2 ^ n : ℕ) < s ∧
s ≤ (((dyadicIndex n T hT s hs : ℕ) + 1) : ℝ) * T / (2 ^ n : ℕ) := by
simp only [dyadicIndex]
set k := ⌈s * (2 ^ n : ℕ) / T⌉₊ with hk_def
have h_pos : (0 : ℝ) < s * (2 ^ n : ℕ) / T :=
div_pos (mul_pos hs.1 (by positivity)) hT
have hk_pos : 0 < k := Nat.ceil_pos.mpr h_pos
have hk_ge : (s * (2 ^ n : ℕ) / T : ℝ) ≤ k := Nat.le_ceil _
have hk_lt : (k : ℝ) - 1 < s * (2 ^ n : ℕ) / T := by
have := Nat.ceil_lt_add_one (le_of_lt h_pos); linarith
have h_pow : (0 : ℝ) < (2 ^ n : ℕ) := by positivity
have h_sub : ((k - 1 : ℕ) : ℝ) = (k : ℝ) - 1 := by
rw [Nat.cast_sub hk_pos]; push_cast; ring
refine ⟨?_, ?_⟩
· rw [h_sub, div_lt_iff₀ h_pow]
rw [lt_div_iff₀ hT] at hk_lt; linarith
· rw [show ((((k : ℕ) - 1 : ℕ) : ℝ) + 1) = (k : ℝ) by rw [h_sub]; ring]
rw [le_div_iff₀ h_pow]
rw [div_le_iff₀ hT] at hk_ge; linarith
/-- `closedBall ((a+b)/2) ((b-a)/2) = Icc a b`. -/
lemma closedBall_eq_Icc (a b : ℝ) :
Metric.closedBall ((a + b) / 2) ((b - a) / 2) = Set.Icc a b := by
ext x
simp only [Metric.mem_closedBall, Real.dist_eq, Set.mem_Icc]
constructor
· intro h
have := abs_le.mp (show |x - (a + b) / 2| ≤ (b - a) / 2 from h)
exact ⟨by linarith [this.1], by linarith [this.2]⟩
· intro ⟨h1, h2⟩; rw [abs_le]; exact ⟨by linarith, by linarith⟩
omit [MeasurableSpace Ω] [MeasurableSpace E] in
/-- **Closed-ball ↔ dyadic-interval bridge:** the dyadic average equals the
Mathlib closed-ball set-average of `φ(ω, ·, e)`, connecting to the Lebesgue
differentiation theorem (`IsUnifLocDoublingMeasure.ae_tendsto_average`). -/
lemma dyadicAvg_eq_average_closedBall
{T : ℝ} (hT : 0 < T) (φ : Ω → ℝ → E → ℝ) (n : ℕ) (i : Fin (2 ^ n)) (ω : Ω) (e : E) :
dyadicAvg T φ n i ω e =
⨍ y in Metric.closedBall
((dyadicPartition T n i.castSucc + dyadicPartition T n i.succ) / 2)
((dyadicPartition T n i.succ - dyadicPartition T n i.castSucc) / 2),
φ ω y e ∂volume := by
set t_i := dyadicPartition T n i.castSucc with ht_i
set t_succ := dyadicPartition T n i.succ with ht_succ
have h_lt : t_i < t_succ := dyadicPartition_strictMono hT n Fin.castSucc_lt_succ
have h_diff : t_succ - t_i = T / (2 ^ n : ℕ) := dyadicPartition_diff n i
have h_pow_pos : (0 : ℝ) < (2 ^ n : ℕ) := by positivity
rw [LevyStochCalc.Poisson.Compensated.closedBall_eq_Icc t_i t_succ,
show (volume.restrict (Set.Icc t_i t_succ) : Measure ℝ)
= volume.restrict (Set.Ioc t_i t_succ)
from MeasureTheory.Measure.restrict_congr_set MeasureTheory.Ioc_ae_eq_Icc.symm,
MeasureTheory.average_eq]
unfold dyadicAvg
rw [show ((volume.restrict (Set.Ioc t_i t_succ) : Measure ℝ).real Set.univ) = t_succ - t_i from by
unfold MeasureTheory.Measure.real
rw [MeasureTheory.Measure.restrict_apply MeasurableSet.univ, Set.univ_inter,
Real.volume_Ioc, ENNReal.toReal_ofReal (by linarith)],
h_diff]
have h_T_ne : T ≠ 0 := ne_of_gt hT
have h_pow_ne : ((2 ^ n : ℕ) : ℝ) ≠ 0 := ne_of_gt h_pow_pos
rw [smul_eq_mul]; field_simp; ring
/-- A bounded measurable real function is locally integrable. -/
lemma bounded_locallyIntegrable (g : ℝ → ℝ) (h_meas : Measurable g)
(M : ℝ) (h_bound : ∀ s, |g s| ≤ M) : MeasureTheory.LocallyIntegrable g volume := by
intro x
refine ⟨Set.Ioo (x - 1) (x + 1), isOpen_Ioo.mem_nhds (by simp), ?_⟩
refine ⟨h_meas.aestronglyMeasurable, ?_⟩
refine MeasureTheory.HasFiniteIntegral.restrict_of_bounded_enorm
(C := ENNReal.ofReal M) ?_ ?_ ?_
· simp
· rw [Real.volume_Ioo]; exact ENNReal.ofReal_ne_top
· refine Filter.Eventually.of_forall (fun s => ?_)
rw [show ‖g s‖ₑ = ENNReal.ofReal ‖g s‖ from (ofReal_norm _).symm]
exact ENNReal.ofReal_le_ofReal (by rw [Real.norm_eq_abs]; exact h_bound s)
end Compensated
end Poisson
end LevyStochCalc