$$
\begin{array}{l} \operatorname {K L} \left(q \left(\boldsymbol {z} _ {\mathcal {P} _ {l}}, \mathcal {P} _ {l} \mid \boldsymbol {x}\right) \| p \left(\boldsymbol {z} _ {\mathcal {P} _ {l}}, \mathcal {P} _ {l}\right)\right) (21) \\ = \operatorname {K L} \left(q \left(\boldsymbol {z} _ {0} \mid \boldsymbol {x}\right) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right)\right. (22) \\ \left. \left\| p (\boldsymbol {z} _ {0}) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} p \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {z} _ {p a (i)}\right) p \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right)\right) \\ = \sum_ {l \in \mathbb {L}} \int_ {\boldsymbol {z} _ {\mathcal {P} _ {l}}} q (\boldsymbol {z} _ {0} \mid \boldsymbol {x}) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right) \\ \times \log \left(\frac {q \left(\boldsymbol {z} _ {0} \mid \boldsymbol {x}\right) \prod_ {j \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (j) \rightarrow j} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {j} \mid \boldsymbol {z} _ {p a (j)}\right)}{p \left(\boldsymbol {z} _ {0}\right) \prod_ {k \in \mathcal {P} _ {l} \backslash \{0 \}} p \left(c _ {p a (k) \rightarrow k} \mid \boldsymbol {z} _ {p a (k)}\right) p \left(\boldsymbol {z} _ {k} \mid \boldsymbol {z} _ {p a (k)}\right)}\right) (23) \\ = \sum_ {l \in \mathbb {L}} \int_ {\boldsymbol {z} _ {\mathcal {P} _ {l}}} q \left(\boldsymbol {z} _ {0} \mid \boldsymbol {x}\right) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right) \log \left(\frac {q \left(\boldsymbol {z} _ {0} \mid \boldsymbol {x}\right)}{p \left(\boldsymbol {z} _ {0}\right)}\right) (24) \\ + \sum_ {l \in \mathbb {L}} \int_ {\boldsymbol {z} _ {\mathcal {P} _ {l}}} q (\boldsymbol {z} _ {0} \mid \boldsymbol {x}) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right) \log \left(\frac {\prod_ {j \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (j) \rightarrow j} \mid \boldsymbol {x}\right)}{\prod_ {k \in \mathcal {P} _ {l} \backslash \{0 \}} p \left(c _ {p a (k) \rightarrow k} \mid \boldsymbol {z} _ {p a (k)}\right)}\right) (25) \\ + \sum_ {l \in \mathbb {L}} \int_ {\boldsymbol {z} _ {\mathcal {P} _ {l}}} q (\boldsymbol {z} _ {0} \mid \boldsymbol {x}) \prod_ {i \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(c _ {p a (i) \rightarrow i} \mid \boldsymbol {x}\right) q \left(\boldsymbol {z} _ {i} \mid \boldsymbol {z} _ {p a (i)}\right) \log \left(\frac {\prod_ {j \in \mathcal {P} _ {l} \backslash \{0 \}} q \left(\boldsymbol {z} _ {j} \mid \boldsymbol {z} _ {p a (j)}\right)}{\prod_ {k \in \mathcal {P} _ {l} \backslash \{0 \}} p \left(\boldsymbol {z} _ {k} \mid \boldsymbol {z} _ {p a (k)}\right)}\right). (26) \\ \end{array}
$$