Solution (source code)

= Solution

By definition of the concave conjugate, $u(x)\leq\widehat u(y)+xy$ for all $x,y>0$. Put $x=H\cdot P_1$ and $y=Y_1$, take expectations, and use the deflator identity:
$$
\mathbb E[u(H\cdot P_1)]
\leq\mathbb E[\widehat u(Y_1)]
+\mathbb E[Y_1H\cdot P_1]
=\mathbb E[\widehat u(Y_1)]+X_0Y_0.
$$
The maximizing condition in the definition of $\widehat u$ is $u'(x)=y$, so equality holds when $u'(H\cdot P_1)=Y_1$ almost surely. This is <utility duality with martingale deflators>.