AFTD Auto-Formalizing Theoretical Domains

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.
Verified
08 Oct 2026
Axioms
Classical.choiceQuot.soundpropext
Used by 4

Lean source view module on GitHub

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]
See it in the graphDiscuss this resultChallenge it