Martingale with $E[X_0]=0$

We have given a square integrable martingale $(M_n)_{n\in \mathbb{N}}$ with $M_0=0$. Then one derives using Jensen's inequality that $(M_n^2)_{n\in \mathbb{N}}$ is a submartingale, of which we assume the Doob decomposition to be $M_n^2 = X_n + A_n$, where $(X_n)_{n\in \mathbb{N}}$ is again a martingale and $(A_n)_{n\in \mathbb{N}}$ a non-decreasing, predictable process with $A_0 = 0$. Furthermore the stopping time $\tau_a = \inf\{n\geq0; A_{n+1}>a^2\}$ was defined.

Now I find in my notes the assertion that, for an $N\in\mathbb{N}$ $$E\left[M_{\min\{N,\tau_a\}}^2\right] = E\left[A_{\min\{N,\tau_a\}}\right]$$ which isn't clear to me. In the text it is justified by the argument that $M_{\min\{n,\tau_a\}}^2-A_{\min\{n,\tau_a\}}$ is a martingale (namely $X_{min\{n,\tau_a\}}$ by the optional stopping theorem and Doob's decomposition) with $M_{\min\{0,\tau_a\}}^2-A_{\min\{0,\tau_a\}}=0$. But I don't see how this implies the statement. I'm probably just missing an easy fact here, but can someone shed light on this?

-
The second statement, $E[Y_n]=E[Y_0]$ for all $n$ is not obvious to me. –  alexlo Dec 29 '12 at 21:27
That's almost immediate from tower property of conditional expectation. You probably covered that one - however your book/class calls it? –  gnometorule Dec 29 '12 at 21:34

Let $\{Y_n\}$ a martingale, say with respect to the filtration $\{\mathcal F_n\}$. We have that $$E[X_n]=E[E[X_n\mid\mathcal F_{n-1}]]=E[X_{n-1}],$$ where the first equality is an application of the definition of conditional expectation (using the fact that $\Omega\in\mathcal F_{n-1}$) and the second one is the definition of a martingale.