Solution (source code)

= Solution

If $T\le s$, then $\phi(W_T)K$ is $\mathcal F_s$-measurable. Independence and centring of the future <Brownian increment> make the desired left side zero; the time multiplier on the right is zero as well.

Suppose $T>s$. Conditional on $\mathcal F_s$, write $W_T=W_s+U$ and $W_t-W_s=V$. The pair $(U,V)$ is jointly normal and independent of $\mathcal F_s$, with
$$
\mathbb E V=0,\qquad\operatorname{Cov}(U,V)=\min(T-s,t-s)=T\wedge t-T\wedge s.
$$
Apply the supplied <Gaussian integration by parts> formula to $z\mapsto\phi(W_s+z)$, treating the known $W_s$ as its parameter. This gives
$$
\mathbb E[\phi(W_T)(W_t-W_s)\mid\mathcal F_s]=(T\wedge t-T\wedge s)\mathbb E[\phi'(W_T)\mid\mathcal F_s].
$$
Multiply by the bounded $\mathcal F_s$-measurable $K$ and use the defining property of <conditional expectation>. Thus \b[the required expectation identity holds for every $s<t$, including intervals crossing or lying after $T$].