I'm learning about importance sampling from p139 of this book
which has the following derviation:
What I am confused about is the second step in the derivation, though the rest makes sense to me. I understand that you apply Bayes rule and that derive the bottom fraction by conditioning. What I am stuck on is why the initial integral doesn't go over the entire thing? i.e why dont we have
$$ \int \normalsize{\frac{g(x)p(y_{1:T}|x)p(x)}{\int p(y_{1:T}|x)p(x) dx}} dx$$
My only guess is that you can, because $p(y)$ is independent of $x$, do this: \begin{align*} \int \normalsize{\frac{g(x)p(y_{1:T}|x)p(x)}{p(y_{1:T})}} dx &\stackrel{?}{=} \frac{1}{p(y_{1:T})} \int \normalsize{g(x)p(y_{1:T}|x)p(x)} dx \\ &= \normalsize{\frac{\int g(x)p(y_{1:T}|x)p(x) dx}{\int p(y_{1:T}|x)p(x) dx}} \end{align*}
is this true? If so, it could seem that the follow is true, in general
$$ \int \frac{f(x,y)}{\int g(y|x)p(x) dx} dx = \frac{\int f(x,y) dx}{\int g(y|x)p(x) dx} $$
But its not obvious to me that this is the case. Is there something am I missing or is the final statement true?