[step:Regroup the ancestral density into two factors sharing only $C$]
Define [measurable functions](/page/Measurable%20Functions) $\Phi_U:E_U\times E_C\to[0,\infty]$ and $\Phi_W:E_W\times E_C\to[0,\infty]$ by
\begin{align*}
\Phi_U(x_U,x_C)=\prod_{j\in U}p_j(x_j\mid x_{\operatorname{pa}(j)})
\end{align*}
and
\begin{align*}
\Phi_W(x_W,x_C)=\prod_{j\in W}p_j(x_j\mid x_{\operatorname{pa}(j)}).
\end{align*}
These functions have the stated domains because parents in $S\setminus C$ do not cross between $U$ and $W$.
Define subsets of $C$ by
\begin{align*}
C_U=\{j\in C:\operatorname{pa}(j)\cap U\neq\varnothing\},\qquad C_W=\{j\in C:\operatorname{pa}(j)\cap W\neq\varnothing\}
\end{align*}
and $C_0=C\setminus(C_U\cup C_W)$. The sets $C_U$ and $C_W$ are disjoint. If $j\in C_U\cap C_W$, then some $u\in U$ and $w\in W$ are distinct parents of the common child $j\in S$, so moralization adds an edge between $u$ and $w$ in $H$, contradicting the absence of edges between $U$ and $W$.
Define $\Phi_{C,U}:E_U\times E_C\to[0,\infty]$, $\Phi_{C,W}:E_W\times E_C\to[0,\infty]$, and $\Phi_{C,0}:E_C\to[0,\infty]$ by
\begin{align*}
\Phi_{C,U}(x_U,x_C)=\prod_{j\in C_U}p_j(x_j\mid x_{\operatorname{pa}(j)}),\qquad \Phi_{C,W}(x_W,x_C)=\prod_{j\in C_W}p_j(x_j\mid x_{\operatorname{pa}(j)})
\end{align*}
and
\begin{align*}
\Phi_{C,0}(x_C)=\prod_{j\in C_0}p_j(x_j\mid x_{\operatorname{pa}(j)}).
\end{align*}
Empty products are interpreted as $1$. Set $r_U:E_U\times E_C\to[0,\infty]$ and $r_W:E_W\times E_C\to[0,\infty]$ by
\begin{align*}
r_U(x_U,x_C)=\Phi_U(x_U,x_C)\Phi_{C,U}(x_U,x_C)\Phi_{C,0}(x_C)
\end{align*}
and
\begin{align*}
r_W(x_W,x_C)=\Phi_W(x_W,x_C)\Phi_{C,W}(x_W,x_C).
\end{align*}
Combining the factors in the formula for $p_S$ gives
\begin{align*}
p_S(x_S)=r_U(x_U,x_C)r_W(x_W,x_C)
\end{align*}
for $\mu_S$-almost every $x_S\in E_S$.
[/step]