Cslib.Probability.PMF.bind_pair_apply
theoremverifiedformalizationimported Lean
Evaluating the "pairing" bind (do let a ← p; return (a, ← f a)) at (a, b) gives the product p a * f a b.
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.bind_pair_apply (p : PMF α) (f : α → PMF β) (a : α) (b : β) : (p.bind fun a' => (f a').bind fun b' => PMF.pure (a', b')) (a, b) = p a * f a b
- Formalizes
- CSLib, `Cslib.Probability.PMF.bind_pair_apply`
- 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.bind_pair_apply← Cslib.Probability.PMF.bind_pair_apply (Cslib/Probability/PMF.lean:49): verbatim
- Verified
- 08 Oct 2026
- Axioms
Classical.choiceQuot.soundpropext- Used by 4
- pmf_output_indist_of_posterior_eq_priorLet α and β be types, p a PMF on α, and f : α → PMF β a channel. Suppose that for every output b in the support of the marginal…
- Cslib.Probability.PMF.posteriorDist_eq_prior_of_outputIndistIf the output distribution of a channel does not depend on the input, then conditioning on any output with positive probability leaves the…
- Cslib.Crypto.Protocols.PerfectSecrecy.jointDist_eqThe joint distribution at
(m, c)equalsmsgDist m * ciphertextDist m c. - Cslib.Probability.PMF.bind_pair_tsum_fstSumming the pairing bind over the first component gives the marginal.
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/-- Evaluating the "pairing" bind `(do let a ← p; return (a, ← f a))` at `(a, b)` gives the product `p a * f a b`. -/theorem Cslib.Probability.PMF.bind_pair_apply (p : PMF α) (f : α → PMF β) (a : α) (b : β) : (p.bind fun a' => (f a').bind fun b' => PMF.pure (a', b')) (a, b) = p a * f a b := by rw [PMF.bind_apply, tsum_eq_single a] · rw [PMF.bind_apply]; congr 1; rw [tsum_eq_single b] · simp [PMF.pure_apply] · intro b' hb'; simp [PMF.pure_apply, hb'.symm] · intro a' ha'; rw [PMF.bind_apply]; simp [PMF.pure_apply, ha'.symm]