Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

BanditAlgorithm.gaussian_relative_entropy_formula

Proved

by Shuze Chen · 1 vote · Jul 18, 2026 · Mathlib c5ea003 (Lean v4.30.0)

gaussianinformation-theory

(Gaussian KL formula) For means μ1,μ2∈R\mu_1,\mu_2 \in \mathbb{R}μ1​,μ2​∈R and common variance v≠0v \ne 0v=0 (Mathlib's gaussianReal takes the VARIANCE v:R≥0v : \mathbb{R}_{\ge 0}v:R≥0​, not the standard deviation):

D(N(μ1,v),N(μ2,v))=(μ1−μ2)22v,D(\mathcal{N}(\mu_1,v), \mathcal{N}(\mu_2,v)) = \frac{(\mu_1-\mu_2)^2}{2v},D(N(μ1​,v),N(μ2​,v))=2v(μ1​−μ2​)2​,

stated with InformationTheory.klDiv valued in [0,∞][0,\infty][0,∞]. The hypothesis v≠0v \ne 0v=0 is required: Mathlib defines gaussianReal μ 0 = dirac μ, so at v=0v=0v=0 the true KL is 000 if μ1=μ2\mu_1=\mu_2μ1​=μ2​ and ∞\infty∞ otherwise, while the formula's right-hand side would be the junk value ofReal(x/0) = 0.

Preamble
import Mathlib.InformationTheory.KullbackLeibler.Basic
import Mathlib.Probability.Distributions.Gaussian.Real


open MeasureTheory ProbabilityTheory InformationTheory NNReal
Formal statement
theorem BanditAlgorithm.gaussian_relative_entropy_formula (μ₁ μ₂ : ℝ) {v : ℝ≥0} (hv : v ≠ 0) :
    klDiv (gaussianReal μ₁ v) (gaussianReal μ₂ v) =
      ENNReal.ofReal ((μ₁ - μ₂) ^ 2 / (2 * (v : ℝ))) := by
  sorry
Source
L&S Ch 14.2 (specialization of Theorem 14.1), p.190
Read-back

What the Lean code literally says, in plain math · claude-fable-5

Setup and notation. Write γμ,v\gamma_{\mu,v}γμ,v​ for the library's Gaussian probability measure on R\mathbb{R}R with mean μ∈R\mu \in \mathbb{R}μ∈R and variance vvv (the second parameter is the variance, not the standard deviation; it ranges over the nonnegative reals, and at v=0v = 0v=0 the measure would degenerate to the point mass at μ\muμ). Here D(P ∥ Q)∈[0,∞]D(P\,\|\,Q) \in [0,\infty]D(P∥Q)∈[0,∞] denotes the library's Kullback–Leibler divergence: when PPP is absolutely continuous with respect to QQQ and the log-likelihood ratio ω↦log⁡dPdQ(ω)\omega \mapsto \log\frac{dP}{dQ}(\omega)ω↦logdQdP​(ω) is PPP-integrable, D(P∥Q)D(P\|Q)D(P∥Q) is the image in [0,∞][0,\infty][0,∞] of the real integral ∫log⁡dPdQ dP\int \log\frac{dP}{dQ}\,dP∫logdQdP​dP (a negative value — impossible for probability measures — would be truncated to 000); in every other case D(P∥Q)=∞D(P\|Q) = \inftyD(P∥Q)=∞.

Assertion. For every pair of real means μ1,μ2\mu_1, \mu_2μ1​,μ2​ and every nonnegative real vvv with v≠0v \neq 0v=0:

D(γμ1,v ∥ γμ2,v)  =  (μ1−μ2)22v,D\big(\gamma_{\mu_1,v}\,\big\|\,\gamma_{\mu_2,v}\big) \;=\; \frac{(\mu_1-\mu_2)^2}{2v},D(γμ1​,v​​γμ2​,v​)=2v(μ1​−μ2​)2​,

an equality in [0,∞][0,\infty][0,∞], the right-hand side being the embedding of that real number into [0,∞][0,\infty][0,∞].

Hypotheses:

  • μ1,μ2\mu_1, \mu_2μ1​,μ2​ are arbitrary reals (in particular they may be equal, giving divergence 000).
  • vvv is a nonnegative real with v≠0v \neq 0v=0, hence v>0v > 0v>0; the two Gaussians share this one variance — nothing is asserted about unequal variances.

Edge cases and caveats:

  • The right-hand side (μ1−μ2)2/(2v)(\mu_1-\mu_2)^2/(2v)(μ1​−μ2​)2/(2v) is a genuine nonnegative real (no division by zero since v>0v > 0v>0, and no truncation when embedding into [0,∞][0,\infty][0,∞]), so the equality in particular asserts that the divergence is finite.
  • The excluded case v=0v = 0v=0 (two Dirac masses) is not covered by the statement.
Human review
  • Endorsed by Community (Bot) · Jul 18, 2026

  • Endorsed by Shuze Chen · Jul 18, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me