Cslib.Probability.PMF.posterior_hasSum
theoremverifiedformalizationimported Lean
Posterior probabilities joint(a, b) / marginal(b) sum to 1 when b is in the support of the marginal.
Statement
set_option autoImplicit true in set_option relaxedAutoImplicit true in open ENNReal in universe u v in variable {α : Type u} {β : Type v} in theorem Cslib.Probability.PMF.posterior_hasSum (p : PMF α) (f : α → PMF β) (b : β) (hb : b ∈ (p.bind f).support) : HasSum (fun a => (p.bind fun a' => (f a').bind fun b' => PMF.pure (a', b')) (a, b) / (p.bind f) b) 1
- Formalizes
- CSLib, `Cslib.Probability.PMF.posterior_hasSum`
- Lean proof
- By Samuel Schlesinger, from github.com/leanprover/cslib at
3951377e5a3f(Copyright (c) 2026 Samuel Schlesinger. All rights reserved, Apache-2.0). Compiled here against leanprover/lean4:v4.33.1, Mathlib v4.33.1; written for leanprover/lean4:v4.33.0.Cslib.Probability.PMF.posterior_hasSum← Cslib.Probability.PMF.posterior_hasSum (Cslib/Probability/PMF.lean:83): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Built on 1
- Cslib.Probability.PMF.bind_pair_tsum_fstSumming the pairing bind over the first component gives the marginal.
- Used by 1
- Cslib.Probability.PMF.posteriorDistThe posterior distribution
Pr[A = a | B = b]as aPMF, givena ← p,b ← f a, and thatbhas positive marginal probability.
- Cslib.Probability.PMF.posteriorDistThe posterior distribution
Lean source view module on GitHub
Choose a tactic — a marked line — to see the goals Lean had before and after it, as in Lean’s infoview. Step with ← → or j k.
set_option autoImplicit true inset_option relaxedAutoImplicit true inopen ENNReal inuniverse u v invariable {α : Type u} {β : Type v} in/-- Posterior probabilities `joint(a, b) / marginal(b)` sum to 1 when `b` is in the support of the marginal. -/theorem Cslib.Probability.PMF.posterior_hasSum (p : PMF α) (f : α → PMF β) (b : β) (hb : b ∈ (p.bind f).support) : HasSum (fun a => (p.bind fun a' => (f a').bind fun b' => PMF.pure (a', b')) (a, b) / (p.bind f) b) 1 := by have hne := (PMF.mem_support_iff _ _).mp hb have hne_top := ne_top_of_le_ne_top one_ne_top (PMF.coe_le_one (p.bind f) b) have : ∑' a, (p.bind fun a' => (f a').bind fun b' => PMF.pure (a', b')) (a, b) / (p.bind f) b = 1 := by simp only [div_eq_mul_inv] rw [ENNReal.tsum_mul_right, bind_pair_tsum_fst] exact ENNReal.mul_inv_cancel hne hne_top exact this ▸ ENNReal.summable.hasSum