Part A: Probability of Sets and Conditional Probability #
Part B: Bayesian Inversion #
noncomputable def
CatCrypt.Prob.bayesInv
{α : Type u_1}
{β : Type u_2}
(π : PMF α)
(f : α → PMF β)
(b : β)
(hmarg : π.marginalβ f b ≠ 0)
:
PMF α
Bayesian inversion: posterior distribution P(a | b).
Uses PMF.normalize on the un-normalized posterior a ↦ π(a) · f(a)(b).
Equations
- CatCrypt.Prob.bayesInv π f b hmarg = PMF.normalize (fun (a : α) => π a * (f a) b) ⋯ ⋯
Instances For
Part C: Uniform Conditioning #
theorem
CatCrypt.Prob.prob_uniform_eq
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
(A : Finset α)
:
For uniform distribution, Pr[A] = |A| / |α|.
theorem
CatCrypt.Prob.condProb_uniform_eq
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
(A B : Finset α)
:
For uniform distribution on a finite type, conditional probability is
Pr[A | B] = |A ∩ B| / |B|.
theorem
CatCrypt.Prob.condProb_uniform_singleton
{α : Type u_1}
[Fintype α]
[Nonempty α]
[DecidableEq α]
(a : α)
(B : Finset α)
(ha : a ∈ B)
:
For uniform distribution, probability of a single element given membership
in B is 1 / |B|.