Solution (source code)

= Solution

The <previsible sigma-algebra> $\mathcal P$ on $\Omega\times[0,\infty)$ is generated by $E\times\{0\}$ with $E\in\mathcal F_0$ and by $E\times(s,t]$ with $E\in\mathcal F_s$, $0\leq s<t$. Equivalently it is the smallest sigma-algebra making every left-continuous <adapted process> measurable. A <previsible process> is a process measurable for $\mathcal P$.

A bounded <simple predictable process> has finitely many time intervals and bounded coefficients known at their left endpoints. One may use deterministic endpoints, or the customary more general <elementary predictable process with stopping-time intervals>:
$$
H_s=\sum_{j=0}^{m-1}h_j\mathbf1_{(T_j,T_{j+1}]}(s),\qquad0=T_0\leq\cdots\leq T_m=\infty,\qquad h_j\in L^\infty(\mathcal F_{T_j}).
$$
A bounded $\mathcal F_0$-measurable value at time zero may be added; it does not affect integration against a <continuous martingale>. A process with finite support is included by adding a zero coefficient on its terminal interval. Both versions of simple processes satisfy the arguments below. The elementary <stochastic integral> is
$$
\boxed{(H\cdot M)_t=\sum_{j=0}^{m-1}h_j\bigl(M_{t\wedge T_{j+1}}-M_{t\wedge T_j}\bigr).}
$$
When a <stopping time> is infinite, use the terminal value $M_\infty$, which exists in $L^2$ and almost surely for an <L2-bounded continuous martingale>. Refining intervals leaves this definition unchanged.

For a <continuous local martingale> $M$, its <quadratic variation> $[M]$ is the unique continuous adapted nondecreasing process starting at zero such that $(M_t-M_0)^2-[M]_t$ is a <local martingale>. It is predictable because it is continuous and adapted. To recover it from the path, use refining deterministic grids, for example $t_k^{(n)}=k2^{-n}$, and form
$$
Q_t^{(n)}=\sum_{k\geq0}\bigl(M_{t\wedge t_{k+1}^{(n)}}-M_{t\wedge t_k^{(n)}}\bigr)^2.
$$
Only finitely many increments are nonzero on a compact time interval. Then
$$
\boxed{Q^{(n)}\longrightarrow[M]\text{ uniformly on compacts in probability}.}
$$
In particular each fixed-time sum converges in probability, and a suitable subsequence converges uniformly on compact intervals almost surely. The partial last grid interval is included in this path approximation.