feat(Probability/Posterior): Posterior PMFs and Various Lemmas#37938
feat(Probability/Posterior): Posterior PMFs and Various Lemmas#37938SamuelSchlesinger wants to merge 5 commits intoleanprover-community:masterfrom
Conversation
Welcome new contributor!Thank you for contributing to Mathlib! If you haven't done so already, please review our contribution guidelines, as well as the style guide and naming conventions. In particular, we kindly remind contributors that we have guidelines regarding the use of AI when making pull requests. We use a review queue to manage reviews. If your PR does not appear there, it is probably because it is not successfully building (i.e., it doesn't have a green checkmark), has the If you haven't already done so, please come to https://leanprover.zulipchat.com/, introduce yourself, and mention your new PR. Thank you again for joining our community. |
PR summary c27c098f0dImport changes for modified filesNo significant changes to the import graph Import changes for all files
|
Define `PMF.joint p f` as the joint distribution on `α × β` induced by a prior `p : PMF α` and a family of distributions `f : α → PMF β`. Prove `PMF.joint_apply`: evaluating the joint at `(a, b)` gives `p a * f a b`.
Prove `PMF.tsum_joint_fst`: summing the joint distribution over the first component recovers the marginal `(p.bind f) b`.
Define `PMF.posterior p f b hb` as the posterior distribution `Pr[A = a | B = b]` given a prior `p`, a family of distributions `f`, and that `b` is in the support of the marginal `p.bind f`. Prove `PMF.posterior_hasSum` (posterior probabilities sum to 1) and `PMF.posterior_apply` (simp lemma for evaluation).
Shorten `joint_apply` by inlining `tsum_eq_single` side conditions. Shorten `posterior_hasSum` by using `ENNReal.summable.hasSum_iff.2` instead of intermediate `have` bindings.
Add support lemmas, second marginalization, use `map` in `joint` definition, expand `posterior_apply` to show the Bayes formula directly, and document relationship to `Kernel.Posterior`.
dd19b7e to
c27c098
Compare
|
Accidentally closed. I believe the previous CI fail wasn't related to this PR, but I've rebased on master so we'll see :) |
|
There is ongoing work to deprecate |
|
This is very helpful context! I will go back to the drawing board for the cslib work we just merged using it. Thank you. |
|
There's a lot of discussion going on in the Zulip, planning to leave this open while we discuss: #CSLib > PMF monad and discrete probability. Let me know if I should just close it. |
Upstreaming the probability lemmas needed in leanprover/cslib#464.