Some version of Itô isometry with conditional expectations Let $B = (B_t)_{t \geq 0}$ be a Brownian motion, $ \mathcal{F}=
 (\mathcal{F}_t)_{t \geq 0}$ the natural filtration associated to $B$, $u \in L^2_{a,T}$ (that is, $u$ is an stochastic process $u = (u_t)_{0 \leq t \leq T}$ adapted to $\mathcal{F}$ so that $\int_0^T E\left[u_t^2\right] dt < \infty$), and define $X = (X_t)_{0 \leq t \leq T}$ as 
$$
X_t = \left(\int_0^t u_s dB_s \right)^2 - \int_0^t u_s^2 ds
$$
I'm trying to prove that $X$ is a martingale. To do so, I'm just going through the definition: if $t < r$, then it must hold that
$$
E\left[X_t - X_r | \mathcal{F}_r \right] = 0
$$
I've been to see, after some computations, that 
$$
E\left[X_t - X_r | \mathcal{F}_r \right] = E\left[\left. \left(\int_r^t u_s dB_s \right)^2  \right| \mathcal{F}_r \right] - E\left[\left. \int_r^t u_s^2 ds  \right| \mathcal{F}_r \right]
$$
So it all reduces to prove that this last expression is zero. I like to think about this as some sort of Itô isometry, since this would trivially equal zero if the expectations were not conditional. 
I've seen that this expression vanishes when we take, for instance, a simple stochastic process like $u_t = \mathbb{1}_{[0,T]}(t)$, and I feel that the proof of the general case must have something to do with the fact that the filtration arrives up to the same time the integrals integrals are taken from (specially after seeing this). Any ideas on how to finish this? 
Thank you very much!
 A: Let $G \in \mathcal{F}_r$. Using that
$$1_G \int_r^t u_s \, dB_s = \int_r^t 1_G u_s \, dB_s \quad \text{a.s.} $$
(see the lemma below) it follows from Itô's isometry that
$$\begin{align*} \int_G \left( \int_r^t u_s \, dB_s \right)^2 \, d\mathbb{P} &= \int \left( \int_r^t u_s 1_G \, dB_s \right)^2 \, d\mathbb{P} \\ &= \mathbb{E} \left( \left| \int_r^t u_s 1_G \, dB_s \right|^2 \right) \\ &= \int_r^t \mathbb{E}(u_s^2 1_G) \, ds \\ &= \int_G \left( \int_r^t u_s^2 \, ds \right) \, d\mathbb{P}. \end{align*}$$
As $G \in \mathcal{F}_r$ is arbitrary, this shows that $$\mathbb{E} \left( \left[ \int_r^t u_s \, dB_s \right]^2 \mid \mathcal{F}_r \right) = \mathbb{E} \left( \int_r^t u_s^2 \, ds \mid \mathcal{F}_r \right).$$

Lemma For any $G \in \mathcal{F}_r$ it holds that $$1_G \int_r^t u_s \, dB_s = \int_r^t 1_G u_s \, dB_s \quad \text{a.s.} \tag{1}$$

Proof: It is straight-forward to check that $(1)$ holds for simple functions $u$, i.e. functions of the form $$u(s) = \sum_{j=1}^n \xi_{j-1} 1_{[t_{j-1},t_j)}(s)$$
where $r \leq t_0 < \ldots < t_n \leq t$ and $\xi_{j-1} \in L^2(\mathcal{F}_{t_{j-1}})$. Now if $u$ is an $\mathcal{F}$-adapted process such that $\int_0^t \mathbb{E}(u_s^2) \, ds < \infty$, then there exists a sequence of simple functions $(u^{(n)})_{n \geq 1}$ such that $\int_0^t \mathbb{E}(|u^{(n)}(s)-u(s)|^2) \, ds \to 0$ as $n \to \infty$ and $\int_r^t u^{(n)}_s \, dB_s \to \int_r^t u_s \, dB_s$ in $L^2$. Then it follows (e.g. from Itô's isometry) that $\int_r^t u^{(n)}_s 1_G \, dB_s \to \int_r^t u_s 1_G \, dB_s$. Using that the assertion holds for each $u^{(n)}$ we obtain $$\begin{align*} 1_G \int_r^t u_s \, dB_s &= L^2-\lim_{n \to \infty} 1_G \int_r^t u^{(n)}_s \, dB_s \\ &= L^2-\lim_{n \to \infty} \int_r^t 1_G u^{(n)}_s \, dB_s \\ &= \int_r^t 1_G u_s\, dB_s. \end{align*}$$
