Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 2: error bound for the marginal + likelihood estimate

Proved
VariationalBOED.ml_error_bound

by Xeroth · Nov 24, 2026 · Mathlib 0df444a (Lean v4.33.1)

bayesian-experimental-designexpected-information-gainkl-divergencemonte-carlovariational-bounds

Let p(θ)p(y∣θ,d)p(\theta)p(y\mid\theta,d)p(θ)p(y∣θ,d) be a model. Let qm(y∣d)q_m(y\mid d)qm​(y∣d) be a probability density with the same support as p(y∣d)p(y\mid d)p(y∣d), and qℓ(y∣θ,d)q_\ell(y\mid\theta,d)qℓ​(y∣θ,d) a conditional density with the same support as p(y∣θ,d)p(y\mid\theta,d)p(y∣θ,d). Suppose the expectations Ep(y,θ∣d)[log⁡p(y∣θ,d)]\mathbb E_{p(y,\theta\mid d)}[\log p(y\mid\theta,d)]Ep(y,θ∣d)​[logp(y∣θ,d)], Ep(y,θ∣d)[log⁡p(y∣d)]\mathbb E_{p(y,\theta\mid d)}[\log p(y\mid d)]Ep(y,θ∣d)​[logp(y∣d)], Ep(y,θ∣d)[log⁡qm(y∣d)]\mathbb E_{p(y,\theta\mid d)}[\log q_m(y\mid d)]Ep(y,θ∣d)​[logqm​(y∣d)] and Ep(y,θ∣d)[log⁡qℓ(y∣θ,d)]\mathbb E_{p(y,\theta\mid d)}[\log q_\ell(y\mid\theta,d)]Ep(y,θ∣d)​[logqℓ​(y∣θ,d)] are finite. Then

∣Im+ℓ(d)−EIG(d)∣≤−Ep(y,θ∣d)[log⁡qm(y∣d)+log⁡qℓ(y∣θ,d)]+C,\big|\mathcal I_{m+\ell}(d)-\mathrm{EIG}(d)\big|\le-\mathbb E_{p(y,\theta\mid d)}\big[\log q_m(y\mid d)+\log q_\ell(y\mid\theta,d)\big]+C,​Im+ℓ​(d)−EIG(d)​≤−Ep(y,θ∣d)​[logqm​(y∣d)+logqℓ​(y∣θ,d)]+C,

where C=−H[p(y∣d)]−Ep(θ)[H(p(y∣θ,d))]C=-H[p(y\mid d)]-\mathbb E_{p(\theta)}\big[H(p(y\mid\theta,d))\big]C=−H[p(y∣d)]−Ep(θ)​[H(p(y∣θ,d))] does not depend on qmq_mqm​ or qℓq_\ellqℓ​. Further, the right-hand side is 000 if and only if qm(y∣d)=p(y∣d)q_m(y\mid d)=p(y\mid d)qm​(y∣d)=p(y∣d) for νY\nu_{\mathcal Y}νY​-almost all yyy and qℓ(y∣θ,d)=p(y∣θ,d)q_\ell(y\mid\theta,d)=p(y\mid\theta,d)qℓ​(y∣θ,d)=p(y∣θ,d) for almost all (θ,y)(\theta,y)(θ,y) with respect to p(θ) dνΘ⊗νYp(\theta)\,d\nu_\Theta\otimes\nu_{\mathcal Y}p(θ)dνΘ​⊗νY​.

This justifies training qmq_mqm​ and qℓq_\ellqℓ​ by maximizing E[log⁡qm(y∣d)+log⁡qℓ(y∣θ,d)]\mathbb E[\log q_m(y\mid d)+\log q_\ell(y\mid\theta,d)]E[logqm​(y∣d)+logqℓ​(y∣θ,d)] for implicit-likelihood models.

Formalization Note The finiteness hypotheses make CCC and every expectation in (13) a real number, as the paper's statement presupposes. The paper's "for almost all y,θy,\thetay,θ" is read with respect to p(y∣d)p(y\mid d)p(y∣d) (equivalently νY\nu_{\mathcal Y}νY​, by the support condition) for qmq_mqm​ and with respect to p(θ) dνΘ⊗νYp(\theta)\,d\nu_\Theta\otimes\nu_{\mathcal Y}p(θ)dνΘ​⊗νY​ for qℓq_\ellqℓ​.

Preamble
import Mathlib
import Definitions.Def_VariationalBOED_Basic

open MeasureTheory ProbabilityTheory InformationTheory Filter Topology
open scoped ENNReal
Formal statement
namespace VariationalBOED

theorem ml_error_bound {Th Y : Type*} [MeasurableSpace Th] [MeasurableSpace Y]
    (nuT : Measure Th) (nuY : Measure Y) [SigmaFinite nuT] [SigmaFinite nuY]
    (p : Th → ℝ) (lik : Th → Y → ℝ) (hM : IsModel nuT nuY p lik)
    (qm : Y → ℝ) (hqm : IsValidMarginalApprox nuT nuY p lik qm)
    (ql : Th → Y → ℝ) (hql : IsValidLikelihoodApprox nuY lik ql)
    (hlik : Integrable (fun z : Th × Y => Real.log (lik z.1 z.2)) (jointLaw nuT nuY p lik))
    (hmarg : Integrable (fun z : Th × Y => Real.log (marginal nuT p lik z.2))
      (jointLaw nuT nuY p lik))
    (hqmi : Integrable (fun z : Th × Y => Real.log (qm z.2)) (jointLaw nuT nuY p lik))
    (hqli : Integrable (fun z : Th × Y => Real.log (ql z.1 z.2)) (jointLaw nuT nuY p lik)) :
    |mlEstimate nuT nuY p lik qm ql - eig nuT nuY p lik| ≤
      -(∫ z, (Real.log (qm z.2) + Real.log (ql z.1 z.2)) ∂jointLaw nuT nuY p lik) +
        (-diffEntropy nuY (marginal nuT p lik) -
          ∫ θ, diffEntropy nuY (lik θ) ∂densMeasure nuT p) ∧
    (-(∫ z, (Real.log (qm z.2) + Real.log (ql z.1 z.2)) ∂jointLaw nuT nuY p lik) +
        (-diffEntropy nuY (marginal nuT p lik) -
          ∫ θ, diffEntropy nuY (lik θ) ∂densMeasure nuT p) = 0 ↔
      qm =ᵐ[nuY] marginal nuT p lik ∧
        ∀ᵐ z ∂(densMeasure nuT p).prod nuY, ql z.1 z.2 = lik z.1 z.2) := by sorry

end VariationalBOED
Source
Foster, Jankowiak, Bingham, Horsfall, Teh, Rainforth and Goodman, Variational Bayesian Optimal Experimental Design, arXiv:1903.05480v3 (NeurIPS 2019), Section 3, Lemma 2, eqs. (12)-(13), p. 5; proof in Appendix A.4, eqs. (45)-(56), p. 15
Read-back

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

Setting. Let Θ\ThetaΘ and YYY be measurable spaces carrying σ-finite reference measures νΘ\nu_\ThetaνΘ​ on Θ\ThetaΘ and νY\nu_YνY​ on YYY. Let p:Θ→Rp:\Theta\to\mathbb Rp:Θ→R be a function (the "prior") and ℓ:Θ×Y→R\ell:\Theta\times Y\to\mathbb Rℓ:Θ×Y→R a function (the "likelihood", ℓ(θ,y)\ell(\theta,y)ℓ(θ,y)). All integrals below are Lebesgue/Bochner integrals with the convention that a non-integrable function has integral 000. Also log⁡0=0\log 0 = 0log0=0, log⁡x=log⁡∣x∣\log x = \log|x|logx=log∣x∣ for x<0x<0x<0, and x/0=0x/0 = 0x/0=0.

Derived objects.

  • Marginal. The marginal is
m(y)=∫Θp(θ) ℓ(θ,y) dνΘ(θ).m(y) = \int_\Theta p(\theta)\,\ell(\theta,y)\,d\nu_\Theta(\theta).m(y)=∫Θ​p(θ)ℓ(θ,y)dνΘ​(θ).
  • Joint law. PPP is the measure on Θ×Y\Theta\times YΘ×Y with density max⁡{p(θ)ℓ(θ,y),0}\max\{p(\theta)\ell(\theta,y),0\}max{p(θ)ℓ(θ,y),0} with respect to νΘ⊗νY\nu_\Theta\otimes\nu_YνΘ​⊗νY​.
  • Prior law. π\piπ is the measure on Θ\ThetaΘ with density max⁡{p,0}\max\{p,0\}max{p,0} with respect to νΘ\nu_\ThetaνΘ​.
  • Differential entropy. For a function fff and measure ν\nuν,
Hν[f]=−∫flog⁡f dν.H_\nu[f] = -\int f\log f\,d\nu.Hν​[f]=−∫flogfdν.

Hypotheses.

  1. Model. ppp is measurable, p≥0p\ge 0p≥0 everywhere, and ∫p dνΘ=1\int p\,d\nu_\Theta=1∫pdνΘ​=1. The function ℓ\ellℓ is jointly measurable, ℓ≥0\ell\ge0ℓ≥0 everywhere, and ∫Yℓ(θ,y) dνY(y)=1\int_Y \ell(\theta,y)\,d\nu_Y(y)=1∫Y​ℓ(θ,y)dνY​(y)=1 for every θ∈Θ\theta\in\Thetaθ∈Θ. These conditions force Θ\ThetaΘ, and hence YYY, to be nonempty.
  2. Marginal approximation. qm:Y→Rq_m:Y\to\mathbb Rqm​:Y→R is measurable, qm≥0q_m\ge0qm​≥0 everywhere, and ∫qm dνY=1\int q_m\,d\nu_Y=1∫qm​dνY​=1. For every y∈Yy\in Yy∈Y, qm(y)>0  ⟺  m(y)>0q_m(y)>0 \iff m(y)>0qm​(y)>0⟺m(y)>0.
  3. Likelihood approximation. qℓ:Θ×Y→Rq_\ell:\Theta\times Y\to\mathbb Rqℓ​:Θ×Y→R is jointly measurable, qℓ≥0q_\ell\ge 0qℓ​≥0 everywhere, and ∫Yqℓ(θ,y) dνY(y)=1\int_Y q_\ell(\theta,y)\,d\nu_Y(y)=1∫Y​qℓ​(θ,y)dνY​(y)=1 for every θ\thetaθ. For every θ\thetaθ and yyy, qℓ(θ,y)>0  ⟺  ℓ(θ,y)>0q_\ell(\theta,y)>0\iff \ell(\theta,y)>0qℓ​(θ,y)>0⟺ℓ(θ,y)>0.
  4. Integrability. Each of the four functions
(θ,y)↦log⁡ℓ(θ,y),log⁡m(y),log⁡qm(y),log⁡qℓ(θ,y)(\theta,y)\mapsto\log\ell(\theta,y),\quad\log m(y),\quad\log q_m(y),\quad\log q_\ell(\theta,y)(θ,y)↦logℓ(θ,y),logm(y),logqm​(y),logqℓ​(θ,y)

is integrable with respect to PPP.

No integrability is assumed for the entropy terms below. In particular, if θ↦HνY[ℓ(θ,⋅)]\theta\mapsto H_{\nu_Y}[\ell(\theta,\cdot)]θ↦HνY​​[ℓ(θ,⋅)] is not π\piπ-integrable, its integral is taken to be 000.

Quantities compared. The estimate is

Im+ℓ=∫log⁡qℓ(θ,y)qm(y) dP(θ,y),I_{m+\ell}=\int \log\frac{q_\ell(\theta,y)}{q_m(y)}\,dP(\theta,y),Im+ℓ​=∫logqm​(y)qℓ​(θ,y)​dP(θ,y),

and the expected information gain is

EIG=∫log⁡ℓ(θ,y)m(y) dP(θ,y).\mathrm{EIG}=\int \log\frac{\ell(\theta,y)}{m(y)}\,dP(\theta,y).EIG=∫logm(y)ℓ(θ,y)​dP(θ,y).

The bound is

R  =  −∫(log⁡qm(y)+log⁡qℓ(θ,y)) dP(θ,y)  −  HνY[m]  −  ∫ΘHνY[ℓ(θ,⋅)] dπ(θ).R \;=\; -\int\big(\log q_m(y)+\log q_\ell(\theta,y)\big)\,dP(\theta,y)\;-\;H_{\nu_Y}[m]\;-\;\int_\Theta H_{\nu_Y}[\ell(\theta,\cdot)]\,d\pi(\theta).R=−∫(logqm​(y)+logqℓ​(θ,y))dP(θ,y)−HνY​​[m]−∫Θ​HνY​​[ℓ(θ,⋅)]dπ(θ).

Conclusion. The theorem asserts both of the following:

  1. The error is bounded by RRR:
∣ Im+ℓ−EIG ∣  ≤  R.\big|\,I_{m+\ell}-\mathrm{EIG}\,\big|\;\le\;R.​Im+ℓ​−EIG​≤R.
  1. R=0R=0R=0 holds if and only if both of these hold:
    • qm=mq_m=mqm​=m for νY\nu_YνY​-almost every yyy;
    • qℓ(θ,y)=ℓ(θ,y)q_\ell(\theta,y)=\ell(\theta,y)qℓ​(θ,y)=ℓ(θ,y) for almost every (θ,y)(\theta,y)(θ,y) with respect to the product measure π⊗νY\pi\otimes\nu_Yπ⊗νY​. Note that this is the prior law times the reference measure on YYY, not the joint law PPP.
Human review
  • Endorsed by Shuze Chen · Nov 25, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Xeroth · Nov 25, 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