I'm trying to understand a proof for the Kunita-Watanabe identity.
Theorem (Kunita-Watanabe identity): Let $X,Y$ be local martingales that starts in $0$ and $H$ $X$- and $\langle X,Y\rangle$- integrable. One has $$ \langle H\cdot X, Y\rangle = H\cdot \langle X,Y\rangle.$$
I came across the following proof:
We will show that $$ ((H\cdot X)_t Y_t - (H\cdot \langle X, Y\rangle)_t)_{t\geq 0}$$ is a martingale which entails the formula.
This makes sense to me, because we proved before that the quadratic covaration is the unique process in the space of adapted right-continuous $\mathbb{R}$-valued processes of locally bounded variation that starts in $0$ such that $XY - \langle X, Y\rangle$ is a local martingale.
We will prove that $$ \mathbb{E}[(H\cdot X)_{\infty} Y_{\infty}] = \mathbb[(H\cdot \langle X, Y\rangle)_{\infty}].$$ This then entails the the martingale property since we may apply for every stopping time $T$ the latter formula for $1_{(0,T]}H, X^T$ and $Y^T$ in place of $H, X$ and $Y$ and get that $$ \mathbb{E}[(H\cdot X)_{T} Y_{T}] = \mathbb[(H\cdot \langle X, Y\rangle)_{T}].$$
My question is why it is sufficient to have the last equality for the difference of the two to be a martingale. Does this come from the optional stopping theorem?
We know that $\mathbb{E}[X_T] = \mathbb{E}[X_0]$ holds if $X$ is a martingale. Furthermore, we know that $(H\cdot X)_0 Y_0 - (H\cdot \langle X, Y\rangle)_0 = 0$ and therefore $\mathbb{E}[(H\cdot X)_{T} Y_{T}- (H\cdot \langle X, Y\rangle)_{T}] = 0$ must hold. Now we have given the reverse direction, so to speak. Can we therefore conclude that $X$ is a martingale? Or is optional stopping not applicable at all in that case.