Lean4
/-- Given that `α` is a countable, measurable space with all singleton sets measurable,
we can convert any probability measure into a `PMF`, where the mass of a point
is the measure of the singleton set under the original measure. -/
def toPMF [Countable α] [MeasurableSpace α] [MeasurableSingletonClass α] (μ : Measure α) [h : IsProbabilityMeasure μ] :
PMF α :=
⟨fun x => μ ({ x } : Set α),
ENNReal.summable.hasSum_iff.2
(_root_.trans
(symm <|
(tsum_indicator_apply_singleton μ Set.univ MeasurableSet.univ).symm.trans
(tsum_congr fun x => congr_fun (Set.indicator_univ _) x))
h.measure_univ)⟩