BanditAlgorithm.gaussian_relative_entropy_formula
Proved(Gaussian KL formula) For means and common variance (Mathlib's gaussianReal takes the VARIANCE , not the standard deviation):
stated with InformationTheory.klDiv valued in . The hypothesis is required: Mathlib defines gaussianReal μ 0 = dirac μ, so at the true KL is if and otherwise, while the formula's right-hand side would be the junk value ofReal(x/0) = 0.
import Mathlib.InformationTheory.KullbackLeibler.Basic import Mathlib.Probability.Distributions.Gaussian.Real open MeasureTheory ProbabilityTheory InformationTheory NNReal
theorem BanditAlgorithm.gaussian_relative_entropy_formula (μ₁ μ₂ : ℝ) {v : ℝ≥0} (hv : v ≠ 0) :
klDiv (gaussianReal μ₁ v) (gaussianReal μ₂ v) =
ENNReal.ofReal ((μ₁ - μ₂) ^ 2 / (2 * (v : ℝ))) := by
sorry
Read-back
What the Lean code literally says, in plain math · claude-fable-5
Setup and notation. Write for the library's Gaussian probability measure on with mean and variance (the second parameter is the variance, not the standard deviation; it ranges over the nonnegative reals, and at the measure would degenerate to the point mass at ). Here denotes the library's Kullback–Leibler divergence: when is absolutely continuous with respect to and the log-likelihood ratio is -integrable, is the image in of the real integral (a negative value — impossible for probability measures — would be truncated to ); in every other case .
Assertion. For every pair of real means and every nonnegative real with :
an equality in , the right-hand side being the embedding of that real number into .
Hypotheses:
- are arbitrary reals (in particular they may be equal, giving divergence ).
- is a nonnegative real with , hence ; the two Gaussians share this one variance — nothing is asserted about unequal variances.
Edge cases and caveats:
- The right-hand side is a genuine nonnegative real (no division by zero since , and no truncation when embedding into ), so the equality in particular asserts that the divergence is finite.
- The excluded case (two Dirac masses) is not covered by the statement.
Confirmed by the mission captain (proposal self-audit).