# Deriving the posterior distribution given arbitrary measures

I am given the following facts:

$$\forall A \in \mathcal{B}: \; \mu(A) = \int_{A} f(x) \alpha(\text{d} x), \quad \text{ and } \quad \nu_x(A) = \int_{A} g_x(y) \beta(\text{d} y), \; \forall x \in \mathbb{R}$$ where $\alpha, \beta$ are $\sigma$-finite measures on $(\mathbb{R}, \mathcal{B})$. Let $$p_y(x) = \frac{f(x) g_x(y)}{ \int_{\mathbb{R}} f(z)g_z(y)\alpha(\text{d}z)}$$ and asked to prove that $p_y$ is the density of a version of the conditinal distribution of $X$ given $Y$, with respect to $\alpha$. Previously, I have proven that

$$\pi(S) = \int_{\mathbb{R}} \nu_x(S_x) \mu(\text{d} x) = \int_S f(x) g_x(y) \text{d}(\alpha \times \beta), \; S \in \mathcal{B} \times \mathcal{B}$$ is a probability measure on $(\mathbb{R}^2, \mathcal{B} \times \mathcal{B})$, where $S_x$ is defined as

$$S_x = \left\{y \in \mathbb{R} \ \middle|\ (x, y) \in S\right\}$$

My attempt: By the definition of the Radon-Nikodym derivative, we have $f = \frac{\text{d} \mu}{\text{d} \alpha}, g_x = \frac{\text{d} \nu}{\text{d} \beta}$. If we replace the former in $p_y$, we obtain $$p_y(x) = \frac{f(x) g_x(y)}{ \int_{\mathbb{R}} g_z(y)\mu(\text{d}z)}$$

In order for $p_y(x)$ to be the density of the conditional distribution $\mathbb{P}(X \ |\ Y)$, we need to show that

$$\int_A p_y(x) \alpha(\text{d} x) = \frac{\int_{A} g_z(y) \mu(\text{d} z)}{\int_{\mathbb{R}} g_z(y) \mu(\text{d} z)}$$

is a version of the conditional probability $\mathbb{P}(X \in A \ |\ Y)$, which in turn should satisfy the integral criterion:

$$\int_{B} \left[ \frac{\int_{A} g_z(y) \mu(\text{d} z)}{\int_{\mathbb{R}} g_z(y) \mu(\text{d} z)} \right] \beta(\text{d} y) = \mathbb{P}([X \in A] \cap [Y \in B]) = \pi(A \times B)$$

However, I'm having trouble simplifying the double integral. My only approach has been to try and substitute $g_x = \frac{\text{d} \nu_x}{\text{d} \beta}$ which doesn't give me any useful form to work with, and I'm stuck at this point. Any hints?

Edit: I was also able to show that, since

$$\int_{B} \int_{\mathbb{R}} f(z) g_z(y) \alpha(\text{d} z) \beta(\text{d} y) = \pi(\mathbb{R} \times B)$$

we can write

$$\int_{\mathbb{R}} f(z) g_z(y) \alpha(\text{d} z) = \frac{\text{d} \pi(\mathbb{R} \times \cdot)}{\text{d} \beta}$$

but still can't figure out if I can use that somehow.