Documentation

Mathlib.InformationTheory.KullbackLeibler.KLFun

The real function fun x ↦ x * log x + 1 - x #

We define klFun x = x * log x + 1 - x. That function is notable because the Kullback-Leibler divergence is an f-divergence for klFun. That is, the Kullback-Leibler divergence is an integral of klFun composed with a Radon-Nikodym derivative.

For probability measures, any function f that differs from klFun by an affine function of the form x ↦ a * (x - 1) would give the same value for the integral ∫ x, f (μ.rnDeriv ν x).toReal ∂ν. However, klFun is the particular choice among those that satisfies klFun 1 = 0 and deriv klFun 1 = 0, which ensures that desirable properties of the Kullback-Leibler divergence extend to other finite measures: it is nonnegative and zero iff the two measures are equal.

Main definitions #

This is a continuous nonnegative, strictly convex function on [0,∞), with minimum value 0 at 1.

Main statements #

noncomputable def InformationTheory.klFun (x : ) :

The function x : ℝ ↦ x * log x + 1 - x. The Kullback-Leibler divergence is an f-divergence for this function.

Equations
    Instances For

      klFun is convex on (0,∞). This is an often useful consequence of convexOn_klFun, which states convexity on [0, ∞).

      The derivative of klFun at x ≠ 0 is log x.

      @[simp]

      The derivative of klFun is log x. This also holds at x = 0 although klFun is not differentiable there since the default value of deriv in that case is 0.

      @[simp]

      The right derivative of klFun is log x. This also holds at x = 0 although klFun is not differentiable there since the default value of derivWithin in that case is 0.

      @[simp]

      The left derivative of klFun is log x. This also holds at x = 0 although klFun is not differentiable there since the default value of derivWithin in that case is 0.

      theorem InformationTheory.klFun_nonneg {x : } (hx : 0 x) :

      The function klFun is nonnegative on [0,∞).

      theorem InformationTheory.klFun_eq_zero_iff {x : } (hx : 0 x) :
      klFun x = 0 x = 1

      For two finite measures μ ≪ ν, the function x ↦ klFun (μ.rnDeriv ν x).toReal is integrable with respect to ν iff llr μ ν is integrable with respect to μ.