Equation 16.9 from Deep Learning Book I recently came across the following equation 
$$\log p(v) = \mathop{\mathbb{E}}\sideset{_{h\sim p(h\mid v)}}{}{}\left [ \log p(h,v) - \log p(h|v) \right ] = \mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{}\left [\log\frac{p(h,v)}{p(h|v)}\right ]$$
I was trying to prove this myself, so:
$$
  \begin{align*}
    \log p(v) &= \log \sum_h p(h,v) \\
    &= \log \sum_h p(v)p(h|v) \\
    &= \log\mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{} p(v)&& \\
    &= \log\mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{}\left [\frac{p(v)p(h|v)}{p(h|v)}\right ] \\ 
    &= \log\mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{}\left [\frac{p(h,v)}{p(h|v)}\right ] \\
    &\geq \mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{}\left [\log\frac{p(h,v)}{p(h|v)}\right ]
  \end{align*}
$$
where the last step uses the fact that $\mathop{\mathbb{E}}\log()⩽\log\mathop{\mathbb{E}}$
Am I missing something that collapses this inequality to an equality? Or is the last step just wrong? Can't quite wrap my head around this.
Source: Page 580 of Deep Learning Book
 A: Generally this is not true and you are correct. But with probabilistic latent variable models, this works out by construction. 
The ability to make Jensen's inequality tight (i.e. turning $\leq$ into  $=$ )is the reason the EM algorithm works. I think you will find the explanation you are looking for in here:
http://cs229.stanford.edu/notes/cs229-notes8.pdf
A: It is not true. Without loss of generality, assume we're dealing with continuous random variables. Then
\begin{align*}
\log p(v) &= \log \int p(v, h) dh \\
&= \log \int \frac{p(v, h)}{p(h|v)}p(h|v) dh \tag{*} \\
&\ge  \int \log\frac{p(v, h)}{p(h|v)}p(h|v) dh \\
&= \mathop{\mathbb{E}}\sideset{_{h\sim p(h|v)}}{}{}\left [\log\frac{p(h,v)}{p(h|v)}\right ].
\end{align*}
The left hand side is greater than or equal to the right by Jensen's inequality.
However, 
$$
\log p(v) = \mathop{\mathbb{E}}\sideset{_{h\sim p(h|v')}}{}{}[ \log p(v)] = \mathop{\mathbb{E}}\sideset{_{h\sim p(h|v')}}{}{}\left[ \log\frac{p(h,v)}{p(h|v)}\right].
$$
It depends on whether or not the $v$s are the same.
