Theorem - Double Expectation

Proof

One can see the conditional expectation $E[Y|X]$ as a Borel function $H_Y(X)$, where $Y$ and how to condition it (and expect, but that is always the same) is encoded into it. $H_Y$ takes a random variable (r.v.) $X$ (prior) and returns the expectation of $Y$ conditioned on $X$ which is also a random variable.

The signature for $H_Y$ can most easily be seen by considering: A r.v. by definition is $X : \Omega_X \rightarrow C_X$ where $C_X$ stands for the codomain of $X$.

So for the Borel function we should have the signature

Which holds since

is both valid and always true.

To relate to functional programming: it’s an “higher order”-function.