I am studying the following problem:
Consider $X = (X^{(1)}, \ldots, X^{(n)})$ a random variable drawn from a distribution with density $p_{\theta}$ for some $\theta \in \Theta$, where $\theta$ is itself a random variable. Assume that the joint distribution of $(X, \theta)$ has the density $p(x, \theta) = p(x\mid\theta)p(\theta)$. The statistic $T(X)$ is said to be a sufficient statistic if there exists functions $f$ and $h$ such that for any $x$
$$ p(x\mid\theta) = h(x, T(x))f(T(x), \theta) $$
Show that $T$ is a sufficient statistic if and only if $\theta$ and $X$ are conditionally independent given $T$.
I have found a few proofs online, and they usually suppose that either all variables are discrete or all of them are continuous. I was thinking about proving a similar result in a more general case, in order to take into account all the possibilities (for example, $X$ and $T(X)$ continuous and $\theta$ discrete, or $X$ and $\theta$ continuous and $T(X)$ discrete). For that, I reformulated the problem using conditional expectations:
Prove that there exists measurable functions $g$ and $h$ such that, for all measurable $f$: $$ E[f(X)\mid\theta] = h(X, T(X))g(T(X), \theta) $$
if and only if
$$ E[\phi(X)\psi(\theta)\mid T(X)] = E[\phi(X)\mid T(X)] E[\psi(\theta)\mid T(X)] $$
for all measurable $\psi$, $\phi$.
I would like to know if it is true (and how to prove it, if it is), as I couldn't prove it myself. Thank you for your help!