Solution (source code)

= Solution

The bounded local martingale $\pi$ is a true martingale. Its terminal condition is $\pi_T=U(T,v_T,S_T)=g(S_T)$, so
$$
\pi_0=\mathbb E[\pi_T]=\mathbb E[g(S_T)].
$$
This is also the <Feynman-Kac formula> for the displayed backward equation.