Mathlib.InformationTheory.KlDensityTiltExpansion
KL density-tilt expansion helpers: tilted measures, score moments, and second-order divergence expansions for local alternatives.
Basic 2 core · 3 supporting For a probability measure μ on a measurable space Z and a bounded, mean-zero "score" s : Z → ℝ, the linear density tilt at strength h : ℝ is the measure tiltMeasure μ s h := μ.withDensity (fun y => ENNReal.ofReal (1 + h ★ tiltMeasure★ isProbabilityMeasure_tiltMeasure
The linear density tilt and its probability-measure property
For a probability measure μ on a measurable space Z and a bounded, mean-zero
"score" s : Z → ℝ, the linear density tilt at strength h : ℝ is the
measure
tiltMeasure μ s h := μ.withDensity (fun y => ENNReal.ofReal (1 + h · s y)).
This file sets up that construction and proves the elementary facts needed for
the second-order Kullback–Leibler expansion in KLExpansion.lean:
* tiltMeasure_absolutelyContinuous — the tilt is absolutely continuous wrt μ;
* tiltDensity_nonneg — for |h| · C ≤ 1 the density 1 + h · s is ≥ 0
everywhere (bounded score |s| ≤ C);
* MeasureTheory.Integrable.of_bound supplies the bounded-score integrability
fact used below;
* integral_tiltDensity — the density integrates to 1 (mean-zero score);
* isProbabilityMeasure_tiltMeasure — hence for small |h| the tilt is a
probability measure.
Reference: van der Vaart, Asymptotic Statistics, Ch. 5 (differentiability in quadratic mean / local asymptotic normality).
The linear density tilt of μ by the score s at strength h: tiltMeasure μ s h = μ.withDensity (y ↦ ENNReal.ofReal (1 + h · s y)). When 1 + h · s ≥ 0 a.e. and s is mean-zero this is again a probability measure (see isProbabilityMeasure_tiltMeasure).
The linear tilt is a probability measure for small |h|. For a probability measure μ and a measurable score function s that is bounded by a constant C (|s y| ≤ C for every y) and has mean zero under μ, if the tilt strength satisfies |h| · C ≤ 1, then the linearly tilted measure tiltMeasure μ s h is again a probability measure.
Formal statement
Proof (Lean source)
3 supporting declarations (lemmas, instances)
-
tiltMeasure_absolutelyContinuouslemma — The tilt is absolutely continuous with respect to the base measure μ (any withDensity measure is).Proof (Lean source)
lemma tiltMeasure_absolutelyContinuous (μ : Measure Z) (s : Z → ℝ) (h : ℝ) : tiltMeasure μ s h ≪ μ := withDensity_absolutelyContinuous _ _ -
tiltDensity_nonneglemma — For a bounded score |s y| ≤ C and tilt strength with |h| · C ≤ 1, the tilt density 1 + h · s y is nonnegative: |h · s y| ≤ |h| · C ≤ 1.hypothesess :Z → ℝC h :ℝhsC :∀ y, |s y| ≤ Chh :|h| * C ≤ 1y :Zconclusion0 ≤ 1 + h * s yProof (Lean source)
lemma tiltDensity_nonneg {s : Z → ℝ} {C h : ℝ} (hsC : ∀ y, |s y| ≤ C) (hh : |h| * C ≤ 1) (y : Z) : 0 ≤ 1 + h * s y := by have h_abs : |h * s y| ≤ |h| * C := by rw [abs_mul] exact mul_le_mul_of_nonneg_left (hsC y) (abs_nonneg h) have h_lower : -1 ≤ h * s y := by have h_bound : -(|h| * C) ≤ h * s y := by have h_neg : -(|h| * C) ≤ -|h * s y| := by rw [neg_le_neg_iff] exact h_abs exact le_trans h_neg (neg_abs_le _) linarith linarith -
integral_tiltDensitylemma — The tilt density integrates to 1: ∫ (1 + h · s) dμ = 1 + h · ∫ s = 1 for a probability measure μ and a mean-zero score s.hypothesesconclusion∫ y, (1 + h * s y) ∂μ = 1Proof (Lean source)
lemma integral_tiltDensity {μ : Measure Z} [IsProbabilityMeasure μ] {s : Z → ℝ} {h : ℝ} (hs_int : Integrable s μ) (hs_mean : ∫ y, s y ∂μ = 0) : ∫ y, (1 + h * s y) ∂μ = 1 := by calc ∫ y, (1 + h * s y) ∂μ = ∫ y, (1 : ℝ) + h * s y ∂μ := rfl _ = ∫ y, (1 : ℝ) ∂μ + ∫ y, h * s y ∂μ := by rw [integral_add (integrable_const 1) (hs_int.const_mul h)] _ = 1 + h * ∫ y, s y ∂μ := by rw [integral_const, probReal_univ, one_smul, integral_const_mul] _ = 1 := by simp [hs_mean]
CubicRemainder 1 core · 0 supporting The analytic core of the KL density-tilt expansion. ★ abs_tiltRemainder_le
Cubic Taylor remainder of (1 + x) · log (1 + x)
The analytic core of the KL density-tilt expansion. The function
f x = (1 + x) · log (1 + x) has the second-order Taylor expansion
f x = x + x² / 2 + O(x³) at 0, and on the band |x| ≤ 1/2 the remainder is
controlled by |x|³.
Indeed f 0 = 0, f' x = log (1 + x) + 1 so f' 0 = 1, f'' x = 1 / (1 + x)
so f'' 0 = 1, and f''' x = -1 / (1 + x)² with |f''' x| ≤ 1 / (1/2)² = 4 for
x ≥ -1/2. The Lagrange form of Taylor's theorem then gives
|f x - (x + x²/2)| ≤ (4 / 3!) · |x|³ = (2/3) · |x|³ ≤ |x|³.
This pointwise bound, applied with x = h · s y, yields the dominated o(h²)
remainder in KLExpansion.lean.
Cubic remainder bound for (1 + x) · log (1 + x). For a real number x with |x| ≤ 1/2, the second-order Taylor remainder of (1 + x) · log (1 + x) at 0 is bounded by |x|³:
Formal statement
Proof (Lean source)
KLExpansion 3 core · 0 supporting For a probability measure μ and a bounded mean-zero score s : Z → ℝ (|s| ≤ C, ∫ s = 0), the linear tilt tiltMeasure μ s h (see Basic.lean) satisfies the local asymptotic normality / Fisher-information expansion KL(tiltMe ★ klDiv_tiltMeasure_toReal_eq★ abs_klRemainder_le★ klDiv_tilt_expansion
Second-order Kullback–Leibler expansion of the linear density tilt
For a probability measure μ and a bounded mean-zero score s : Z → ℝ
(|s| ≤ C, ∫ s = 0), the linear tilt tiltMeasure μ s h (see Basic.lean)
satisfies the local asymptotic normality / Fisher-information expansion
KL(tiltMeasure μ s h ‖ μ) = (h² / 2) · ∫ s² dμ + o(h²) as h → 0.
Main results
* klDiv_tiltMeasure_toReal_eq — the KL divergence is the μ-integral of the
x log x density functional:
(klDiv (tiltMeasure μ s h) μ).toReal = ∫ (1 + h·s) · log (1 + h·s) dμ.
* abs_klRemainder_le — the dominated cubic remainder bound: for |h|·C ≤ 1/2,
|KL.toReal - (h²/2)·∫ s²| ≤ C³ · |h|³.
* klDiv_tilt_expansion — the headline o(h²) expansion, as an
Asymptotics.IsLittleO statement.
Proof outline
1. klDiv_tiltMeasure_toReal_eq: tiltMeasure μ s h ≪ μ and both are probability
measures, so toReal_klDiv_of_measure_eq gives KL.toReal = ∫ llr (tilt) μ ∂(tilt).
The log-likelihood ratio llr (tilt) μ =ᵐ log (rnDeriv) =ᵐ log (1 + h·s)
(rnDeriv_withDensity), and change of measure
(integral_withDensity_eq_integral_toReal_smul) rewrites the tilt-integral of
log (1 + h·s) as the μ-integral of (1 + h·s) · log (1 + h·s).
2. abs_klRemainder_le: write the integrand as
(1 + h·s)·log(1 + h·s) = h·s + (h·s)²/2 + R(h·s) with
R(x) = (1+x)log(1+x) - x - x²/2. Integrating, ∫ h·s = 0 and
∫ (h·s)²/2 = (h²/2)∫ s², so the difference equals ∫ R(h·s) dμ, bounded
pointwise by abs_tiltRemainder_le (valid since |h·s| ≤ |h|·C ≤ 1/2):
|∫ R(h·s)| ≤ ∫ |h·s|³ ≤ |h|³·C³ (probability measure, |s| ≤ C).
3. klDiv_tilt_expansion: from abs_klRemainder_le, `|remainder h| ≤ C³·|h|³
= (C³·|h|)·h² eventually, and C³·|h| → 0, so Asymptotics.isLittleO_iff`
closes it.
KL of the linear tilt as an x log x density integral. For a probability measure μ and a measurable score function s that is bounded by a constant C and has mean zero under μ, if the tilt strength satisfies |h| · C ≤ 1, then the Kullback–Leibler divergence of the linearly tilted measure tiltMeasure μ s h from μ, as a real number, equals the μ-integral of (1 + h·s)·log(1 + h·s):
Formal statement
Proof (Lean source)
Dominated cubic remainder bound. For a probability measure μ and a measurable score function s that is bounded by a constant C and has mean zero under μ, if the tilt strength satisfies |h| · C ≤ 1, then the Kullback–Leibler divergence of the linearly tilted measure tiltMeasure μ s h from μ deviates from its second-order Taylor approximation (h²/2) · ∫ s² dμ by at most C³ · |h|³:
Formal statement
Proof (Lean source)
Second-order KL expansion of the linear density tilt (headline result). For a probability measure μ and a measurable score function s that is bounded by a constant C and has mean zero under μ, the Kullback–Leibler divergence of the linearly tilted measure tiltMeasure μ s h from μ, as a function of the tilt strength h, agrees with the quadratic approximation (h²/2) · ∫ s² dμ up to an error that is little-o of h² as h → 0: