Defining a kind of "projection of a measure" in a precise way Suppose we have a probability measure $$\mu: \mathcal{S} \times \mathbb{R}\rightarrow [0,1],$$where $\mathcal{S}$ is some countable set. In some personal, handwritten lecture notes I'm reading it is then stated that we "take $(A,B)$ such that $(A,B) \sim \mu $  and consider $\mathbb{E}[B]$".
I can't parse this sentence. So far, I've come across the "$\sim$" notation only where one side was a random variable and the other a density function. But in this case that does not seem to apply.
So I'm not sure what $B$ is; it seems to be some kind of projection of $\mu$ onto $\mathbb{R}$. How can I define $B$ precisely/rigorously?
 A: Normally when you have a probability measure $\nu$ on some measure space $(\mathcal{S},\mathcal{F},\nu)$ and you write "let $X$ be a random variable with $X\sim \nu$", then it just means that $X$ is a measurable mapping from some probability space $(\Omega,\mathcal{H},P)$ such that $X(P)=\nu$. In other words $\nu$ is the distribution of $X$.
In your case you are given a probability measure $\mu$ on the product space $\mathcal{S}\times \mathbb{R}$. When we now say that $(A,B) \sim \mu$, we simply mean that $A,B$ are random variables/elements defined on some common probability space $(\Omega,\mathcal{H},P)$ such that the pushforward measure $(A,B)(P)=\mu$, that is $\mu$ is the simultaneous distribution of $A$ and $B$. Here $(A,B)(P)$ is the pushforward measure of $P$ with the bundle map $\omega\mapsto(A(\omega),B(\omega))\in\mathcal{S}\times\mathbb{R}$. Constructing the bundle $(A,B)$ like this, will yield that the marginal distributions are given by $A\sim \pi_1(\mu)$ and $B \sim \pi_2(\mu)$
Similarly we can arrive at the following representation of the expectation of $B$:
\begin{align*}
E(B) &= \int_{\Omega} B(\omega) \, dP(\omega) \\
&=  \int_{\Omega} \pi_2(A(\omega),B(\omega)) \, dP(\omega)\\
&=\int_{\mathcal{S}\times \mathbb{R}} \pi_2(a,b) \, d(A,B)(P)(a,b)\\
&= \int_{\mathcal{S}\times \mathbb{R}} \pi_2(a,b) \, d\mu(a,b) \\
&= \int_{ \mathbb{R}} b \, d \pi_2(\mu)(b)
\end{align*}
where we used the abstract change of variable theorem, and that $\pi_2$ is the coordinate projection onto the second coordinate, that is $\pi_2 :\mathcal{S}\times \mathbb{R}\to \mathbb{R}$ given by $\pi_2(s,x) =x$ for any $(s,x)\in\mathcal{S}\times \mathbb{R}$.
One way to construct $A$ and $B$ rigorously is to let the common probability space be given by $(\mathcal{S}\times \mathbb{R}, \mathcal{B}(\mathcal(S))\otimes \mathcal{B}(\mathbb{R}),\mu)$ and now define the random variables/elements as $A=\pi_1$ and $B=\pi_2$.
A: My guess is that  $\ \mu\ $ is a form of probability mass-distribution function, and "$\ (A,B) \sim \mu\ $" means that $\ A\ $ and $\ B\ $ are random variables jointly distributed according to $\ \mu\ $:
$$ \mathrm{Prob}\left( \left\{A = s\right\}\ \&\ \left\{y<B\le x\right\}\right) = \mu\left(s,x\right) - \mu\left(s,y\right)\ .$$
The distribution function $\ F_B\ $ of $\ B\ $ would then be given by $\ F_B\left(x\right) = \displaystyle{\sum_{s\in\mathcal{S}}}\mu\left(s,x\right) \ $, and $\ \mathbb{E}\left[B\right]\ $ by the Lebesgue-Stieljes integral
$$\mathbb{E}\left[B\right] = \int_{-\infty}^\infty x\ dF_B\left(x\right) .$$
