InformationTheory

InformationTheory.Shannon.CondKLIntegral

source

Conditional Kullback-Leibler divergence, integral form #

This file fills the explicit Mathlib TODO of Mathlib/InformationTheory/KullbackLeibler/ChainRule.lean:

Add a version of the chain rule for the integral form of the conditional KL divergence, i.e. μ[fun x ↦ klDiv (κ x) (η x)].

The main theorem klDiv_compProd_toReal_integral states that, when the two joint measures μ ⊗ₘ κ and μ ⊗ₘ η share the same first marginal μ, the toReal Kullback-Leibler divergence between them equals the μ-average of the fibrewise divergences:

(klDiv (μ ⊗ₘ κ) (μ ⊗ₘ η)).toReal = ∫ z, (klDiv (κ z) (η z)).toReal ∂μ.

The Mathlib chain rule klDiv_compProd_eq_add keeps the conditional KL term in the composition-product form klDiv (μ ⊗ₘ κ) (μ ⊗ₘ η) precisely to avoid the measurability of z ↦ klDiv (κ z) (η z). Here we resolve that measurability and the integral identity.

Main statements #

Proof strategy #

The slice identity is the linchpin. We use Measure.compProd_withDensity (μ ⊗ₘ (η.withDensity f) = (μ ⊗ₘ η).withDensity (fun p ↦ f p.1 p.2)) together with the kernel Radon-Nikodym facts Kernel.withDensity_rnDeriv_eq (η.withDensity (κ.rnDeriv η) a = κ a when κ a ≪ η a) and Measure.absolutelyContinuous_compProd_right_iff (μ ⊗ₘ κ ≪ μ ⊗ₘ η ↔ ∀ᵐ a ∂μ, κ a ≪ η a) to rewrite μ ⊗ₘ κ as (μ ⊗ₘ η).withDensity (fun p ↦ Kernel.rnDeriv κ η p.1 p.2), whence Measure.rnDeriv_withDensity reads off the joint Radon-Nikodym derivative.

For the integral, toReal_klDiv_eq_integral_klFun expresses both sides through klFun integrated against the dominating measure (μ ⊗ₘ η on the left, η z per fibre), and Measure.integral_compProd opens the joint klFun integral into the outer μ-integral.

theorem

InformationTheory.rnDeriv_compProd_eq_kernel_rnDeriv

source
{𝓧 : Type u_1} {𝓨 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} {m𝓨 : MeasurableSpace 𝓨} {μ : MeasureTheory.Measure 𝓧} {κ η : ProbabilityTheory.Kernel 𝓧 𝓨} [MeasureTheory.IsFiniteMeasure μ] [ProbabilityTheory.IsFiniteKernel κ] [ProbabilityTheory.IsFiniteKernel η] [MeasurableSpace.CountableOrCountablyGenerated 𝓧 𝓨] (h_ac : (μ.compProd κ).AbsolutelyContinuous (μ.compProd η)) :
(μ.compProd κ).rnDeriv (μ.compProd η) =ᵐ[μ.compProd η] fun (p : 𝓧 × 𝓨) => κ.rnDeriv η p.1 p.2

The slice identity for the Radon-Nikodym derivative of a composition product. When the two joint measures share the first marginal μ, the joint Radon-Nikodym derivative agrees almost everywhere with the pointwise kernel Radon-Nikodym derivative. This is the statement the RadonNikodym.lean TODO left open. @audit:ok

Used by
    theorem

    InformationTheory.klDiv_compProd_toReal_integral

    source
    {𝓧 : Type u_1} {𝓨 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} {m𝓨 : MeasurableSpace 𝓨} {μ : MeasureTheory.Measure 𝓧} {κ η : ProbabilityTheory.Kernel 𝓧 𝓨} [MeasureTheory.IsFiniteMeasure μ] [ProbabilityTheory.IsMarkovKernel κ] [ProbabilityTheory.IsMarkovKernel η] [MeasurableSpace.CountableOrCountablyGenerated 𝓧 𝓨] (h_ac : (μ.compProd κ).AbsolutelyContinuous (μ.compProd η)) (h_int : MeasureTheory.Integrable (MeasureTheory.llr (μ.compProd κ) (μ.compProd η)) (μ.compProd κ)) :
    (klDiv (μ.compProd κ) (μ.compProd η)).toReal = (z : 𝓧), (klDiv (κ z) (η z)).toReal μ

    The conditional Kullback-Leibler divergence, integral form (Mathlib ChainRule.lean TODO). When the two joint measures μ ⊗ₘ κ and μ ⊗ₘ η share the first marginal μ, the toReal Kullback-Leibler divergence decomposes as the μ-average of the fibrewise divergences. @audit:ok

    Used by
      theorem

      InformationTheory.klDiv_compProd_lintegral

      source
      {𝓧 : Type u_1} {𝓨 : Type u_2} {m𝓧 : MeasurableSpace 𝓧} {m𝓨 : MeasurableSpace 𝓨} {μ : MeasureTheory.Measure 𝓧} {κ η : ProbabilityTheory.Kernel 𝓧 𝓨} [MeasureTheory.IsFiniteMeasure μ] [ProbabilityTheory.IsMarkovKernel κ] [ProbabilityTheory.IsMarkovKernel η] [MeasurableSpace.CountableOrCountablyGenerated 𝓧 𝓨] (h_ac : (μ.compProd κ).AbsolutelyContinuous (μ.compProd η)) :
      klDiv (μ.compProd κ) (μ.compProd η) = ∫⁻ (z : 𝓧), klDiv (κ z) (η z) μ

      The conditional KL divergence, lintegral form (Mathlib ChainRule.lean TODO, ℝ≥0∞ form). ℝ≥0∞ mirror of klDiv_compProd_toReal_integral: when the two joint measures share the first marginal μ, the (ℝ≥0∞-valued) KL divergence equals the μ-average of the fibrewise divergences, with no integrability hypothesis (ℝ≥0∞ Tonelli lintegral_compProd is unconditional).

      Used by
        theorem

        InformationTheory.klDiv_compProd_const_toReal_integral

        source

        The conditional KL divergence, integral form against a constant kernel. Specialization of klDiv_compProd_toReal_integral to η := Kernel.const 𝓧 ν, the form used by the EPI G2 conditional differential-entropy bridge. @audit:ok

        Used by