Murphy, in his Machine Learning: A Probabilistic Perspective, defines two conditionally independent random variables essentially as follows: $X$ and $Y$ are conditionally independent given $Z$, i.e., $X \perp Y \mid Z$, if and only if $$p(X, Y \mid Z) = p(X \mid Z)p(Y \mid Z)\text{.}$$ where $p$ denotes the (conditional) pmfs/pdfs. (I'm not a fan of the notation, but let's put that aside for now.)
One theorem in here is:
$X \perp Y \mid Z$ iff there exist functions $g$ and $h$ such that $$p(x, y \mid z) = g(x, z)h(y,z)$$ for all $x, y, z$ such that $p(z) > 0$.
"$\Longrightarrow$" is easy to see from the definition.
The difficulty with "$\Longleftarrow$" is that it's hard to show that $g$ and $h$ are unique, and $g(x,z) = p(X \mid Z)$ and $h(y, z) = p(Y \mid Z)$. At least, I think this is what I need to show.
I've tried using $$p(X, Y \mid Z) = \dfrac{p(X, Y, Z)}{p(Z)}$$ but this does not lend itself to clean factoring, as desired in the theorem.