I would like to generalize by dyadic discretization some theorem I have seen in finite time setting.
Here is the theorem
Let $(X_t)_t$ be a continuous martingale and $\tau$ a bounded stopping time ($\tau\leq M$ a.s). We have
$$ \mathbb{E}(X_{M} | \mathcal{F}_{\tau}) = X_{\tau} $$
Moreover, if $\sigma\geq\tau$ is another bounded stopping time we have
$$ \mathbb{E}(X_{\sigma} | \mathcal{F}_{\tau}) = X_{\tau} $$
Here is my attempt : I consider the interval $[0,M]$ and approximates $\tau$ by the following sequence of stopping time
$$ \tau_n(\omega) = 01_{\tau(\omega) = 0} + \sum_{k=0}^{2^n-1}\frac{(k+1)M}{2^n}1_{\{\frac{kM}{2^n}<\tau(\omega)\leq\frac{(k+1)M}{2^n}\}} $$
We have that $\tau_n$ converges almost surely to $\tau$. By continuity of $(X_t)_t$ we also have that $X_{\tau_n}$ converges almost surely to $X_{\tau}$.
By applying the result for finite stopping time we get
$$ \mathbb{E}(X_M | \mathcal{F}_{\tau_n}) = X_{\tau_n} $$
Since $X_M$ is in $L^1$ we have that $(X_{\tau_n})_n$ is uniformly integrable, it follows that $X_{\tau_n}$ converges in $L^1$ to $ X_{\tau}$.
Now we want to prove that for all $Z\in L^{\infty}(\mathcal{F}_{\tau})$ we have (by definition of the conditional expectation)
$$ \mathbb{E}(X_{M}Z)=\mathbb{E}(X_{\tau}Z) $$
Take $Z\in L^{\infty}(\mathcal{F}_{\tau})$. Since $\tau_n\geq\tau$ we have that for all $n$, $Z\in L^{\infty}(\mathcal{F}_{\tau_n})$ and
$$ \mathbb{E}(X_{M}Z)=\mathbb{E}(X_{\tau_n}Z) $$
Then, we know there exists $K>0$ such that $\lvert Z\rvert\leq K$. It follows
$$ 0\leq\lvert\mathbb{E}(X_{\tau_n}Z) - \mathbb{E}(X_{\tau}Z)\rvert\leq\mathbb{E}(\lvert Z\rvert\lvert X_{\tau_n}-X_{\tau}\rvert)\leq Z\mathbb{E}(\lvert X_{\tau_n}-X_{\tau}\rvert)\to_{n\to\infty} 0 $$
By taking the limit as $n$ goes to $\infty$ gives us
$$ \forall Z\in L^{\infty}(\mathcal{F}_{\tau})\quad\mathbb{E}(X_{M}Z)=\mathbb{E}(X_{\tau}Z) $$
Finally, if $\sigma\geq\tau$ is another bounded stopping time we have
$$ X_{\tau} = \mathbb{E}(X_{M} | \mathcal{F}_{\tau}) = \mathbb{E}[\mathbb{E}(X_M | \mathcal{F}_{\sigma})| \mathcal{F}_{\tau}] = \mathbb{E}(X_{\sigma} | \mathcal{F}_{\tau}) $$
I would like to know if it is correct please, and if some argument can be made shorter or more precise.
Thank you !