I have a bit of trouble proving a statement expressing the expectation of a function of random variables as the conditional expectation, namely:
$$\mathbb{E}g(X,Y) = \int_{\mathbb{R}^n} \int_{\mathbb{R}^m} g(x,y) f(y|x) \, dy \cdot f_X(x) \, dx = \mathbb{E}(\mathbb{E}[g(X,Y)|X])$$
with $X,Y$ appropriately dimensioned real-valued random variables, $f(y|x) := \frac{f_{X,Y}(x,y)}{f_X(x)}$ being the conditional density of $f_{X,Y}$ with respect to $(X,Y)$ and $f_{X}$ to $X$.
There is a statement leading up to this claim in my notes:
$$\forall A \in \mathcal{B}^n, B \in \mathcal{B}^m: \mathbb{P}(X \in A, Y \in B) = \int_{A}\int_{B} f(y|x) \, dy f_{X}(x) \, dx$$
I have already seen and proven a similar statement for a single random variable, but how does it work out in the multivariate case? Can it also be done using the fact that $\mathcal{B}^i$ is generated by half open box sets? I played around with the idea and using the integral representation of the densities cdf's, but the fact that there are multiple variables to be considered leaves me stumped.
As a bonus: How do any of the equalities in the first paragraph make any sense?? They are stated as is in my notes without any further exposition. I know all of the listed quantities and a couple of identities for the conditional expectation.
Thank you for reading!