Comparing the Cont & Dist monads: My operational interpretation of a continuation-passing-style value ∀R.(X→R)→R is “for any result type R, if you tell me how to compute one from an X, I’ll give you one,” and the only way to return an R is to obtain one from the continuation…
…because there are no other operations that return this arbitrary type R. Meanwhile Dist(X) is more like ∀(R:Convex).(X→R)→R. Now I can give the continuation a bunch of values in X and weighted-average the return values. So a Dist(X) is a bunch of X’s associated with weights.
This algebraic approach, where I equip R with a “convex combination” operator, only works for finitely supported distributions. To get to fully general measures, we swap our synthetic “R:Convex” for the analytic reals ℝ, but impose severe conditions on the function (X→ℝ)→ℝ…
In particular, we require:
- continuity
- linearity
- λx.1 ↦ 1
These are the essential analytic conditions that characterize “weighted-average-ness,” but now the set of weights can be uncountable.
Oh, and one more condition on E, namely positivity: if f(x)≥0, then E(f)≥0
Share this Scrolly Tale with your friends.
A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.
