I am reading this and am puzzled by equation 8. I don't understand the last bit: why can we move the gradient out of the expectation? $$E_Q[\nabla_\phi\log Q_\phi(h|x)] = E_Q[\frac{\nabla_\phi Q_\phi(h|x)}{Q_\phi(h|x)}]=\nabla_\phi E_Q[1]=0.$$
$$E_Q\left[\frac{\nabla_\phi Q_\phi(h|x)}{Q_\phi(h|x)}\right] = \int\frac{\nabla_\phi Q_\phi(h|x)}{Q_\phi(h|x)} Q_\phi(h|x) = \int{\nabla_\phi Q_\phi(h|x)}$$
$$= \nabla_\phi\int{ Q_\phi(h|x)} = \nabla_\phi E_Q[1] = \nabla_\phi 1 =0$$
Since the distribution $Q$ is chosen by the user, you can say that this result is satisfied by those $Q$ that allow exchanging the integral and the gradient.