Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Proof of Lemma A.13, p. 73 — chain rule D_KL(Q ∥ P) = E_Q[Σᵢ D_KL(Q⁽ⁱ⁾(· | X₁:ᵢ₋₁) ∥ P⁽ⁱ⁾(· | X₁:ᵢ₋₁))] for sequential laws

Proved
StatComplexityDM.HellingerChain.kl_chain_rule

by mikedeng1 · Oct 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

chain-ruleinformation-theorykl-divergencep2o-batch-pfp2ap2o-gran-per-chapterp2o-plan-bookp2o-v1sequential-laws

Let X1,…,Xn\mathcal X_1, \dots, \mathcal X_nX1​,…,Xn​ be finite sets and let P=(P(i))P = (P^{(i)})P=(P(i)) and Q=(Q(i))Q = (Q^{(i)})Q=(Q(i)) be families of sequential kernels, P(i)(⋅∣x1:i−1)P^{(i)}(\cdot \mid x_{1:i-1})P(i)(⋅∣x1:i−1​) a probability distribution on Xi\mathcal X_iXi​ depending only on the prefix x1:i−1x_{1:i-1}x1:i−1​. Let P\mathbb PP and Q\mathbb QQ be the laws of X1,…,XnX_1, \dots, X_nX1​,…,Xn​ under Xi∼P(i)(⋅∣X1:i−1)X_i \sim P^{(i)}(\cdot \mid X_{1:i-1})Xi​∼P(i)(⋅∣X1:i−1​) and Xi∼Q(i)(⋅∣X1:i−1)X_i \sim Q^{(i)}(\cdot \mid X_{1:i-1})Xi​∼Q(i)(⋅∣X1:i−1​). Then, with DKLD_{\mathrm{KL}}DKL​ taking values in [0,+∞][0, +\infty][0,+∞],

DKL(Q ∥ P)=EQ[∑i=1nDKL(Q(i)(⋅∣X1:i−1) ∥ P(i)(⋅∣X1:i−1))].D_{\mathrm{KL}}(\mathbb Q \,\|\, \mathbb P) = \mathbb E_{\mathbb Q}\Big[\sum_{i=1}^n D_{\mathrm{KL}}\big(Q^{(i)}(\cdot \mid X_{1:i-1}) \,\|\, P^{(i)}(\cdot \mid X_{1:i-1})\big)\Big].DKL​(Q∥P)=EQ​[i=1∑n​DKL​(Q(i)(⋅∣X1:i−1​)∥P(i)(⋅∣X1:i−1​))].

Here DKL(p ∥ q)=∑ap(a)log⁡p(a)q(a)D_{\mathrm{KL}}(p\,\|\,q) = \sum_a p(a)\log\frac{p(a)}{q(a)}DKL​(p∥q)=∑a​p(a)logq(a)p(a)​ if ppp is absolutely continuous with respect to qqq, and +∞+\infty+∞ otherwise.

The proof of Lemma A.13 uses this identity in both of its parts: for Term I of (97) with the mixture kernels PλP_\lambdaPλ​ in place of PPP, and for (98) with the roles of PPP and QQQ exchanged.

Formalization Note Finite alphabets. The expectation is the sum over full sequences xxx of Q(x)\mathbb Q(x)Q(x) times the inner sum, computed in [0,+∞][0, +\infty][0,+∞] with 0⋅∞=00 \cdot \infty = 00⋅∞=0, so a sequence of Q\mathbb QQ-probability zero contributes nothing even if a conditional divergence along it is infinite. The platform's measure-theoretic chain rule for KL divergence uses Markov kernels on measurable spaces, a different representation; this is the finite sequential form.

Preamble
import Mathlib
import Definitions.Def_FoundationsRL_GeneralDM_Divergences
import Definitions.Def_StatComplexityDM_HellingerChain_SeqLaw
Formal statement
namespace StatComplexityDM.HellingerChain

open FoundationsRL.GeneralDM

/-- The chain rule for KL divergence used in the proof of Lemma A.13 (arXiv:2112.13487v3,
App. A.2, p. 73, Term I; p. 75), finite alphabets: for sequential laws,
`D_KL(Q ∥ P) = E_Q[Σ_{i=1}^n D_KL(Q^{(i)}(· | X_{1:i−1}) ∥ P^{(i)}(· | X_{1:i−1}))]`,
both sides in `[0, ∞]`. The expectation weights each sequence by `Q(x)` as an extended
nonnegative real, so a sequence of `Q`-probability zero contributes `0` even when a
conditional divergence along it is `+∞`. -/
theorem kl_chain_rule {n : ℕ} {X : Fin n → Type*} [∀ i, Fintype (X i)]
    [∀ i, DecidableEq (X i)]
    (P Q : (i : Fin n) → ((j : Fin n) → X j) → X i → ℝ)
    (hP : IsSeqKernel P) (hQ : IsSeqKernel Q) :
    klDivDiscrete (seqLaw Q) (seqLaw P) =
      ∑ x : (j : Fin n) → X j,
        ENNReal.ofReal (seqLaw Q x) * ∑ i, klDivDiscrete (Q i x) (P i x) := by sorry

end StatComplexityDM.HellingerChain
Source
arXiv:2112.13487v3, App. A.2, proof of Lemma A.13, Term I, p. 73 ("follows from the chain rule for KL divergence"); p. 75
Human review
  • Endorsed by Shuze Chen · Oct 9, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Oct 9, 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