[proofplan]
We prove that $\mathcal{E}$ is dense in $L^2(M)$ by showing that its orthogonal complement is trivial. Suppose $K \in L^2(M)$ satisfies $(K, H)_{L^2(M)} = 0$ for all $H \in \mathcal{E}$. We construct the finite variation process $X_t = \int_0^t K_s \, d\langle M \rangle_s$ and show that the orthogonality condition forces $X$ to be a continuous martingale starting at zero. Since $X$ is simultaneously of finite variation and a continuous martingale, the [Continuous Finite Variation Local Martingale is Identically Zero](/theorems/2081) theorem implies $X \equiv 0$. From the vanishing of $X$, we deduce $K = 0$ in $L^2(M)$.
[/proofplan]
[step:Set up the orthogonality assumption and define the finite variation process $X$]
Since $L^2(M)$ is a Hilbert space (it inherits completeness from $L^2(\Omega \times [0,\infty), \mathcal{P}, d\mathbb{P} \otimes d\langle M \rangle)$), density of $\mathcal{E}$ in $L^2(M)$ is equivalent to $\mathcal{E}^\perp = \{0\}$. Suppose $K \in L^2(M)$ satisfies
\begin{align*}
(K, H)_{L^2(M)} := \mathbb{E}\!\left[\int_0^\infty K_s H_s \, d\langle M \rangle_s\right] = 0 \quad \text{for all } H \in \mathcal{E}.
\end{align*}
We must show $K = 0$ in $L^2(M)$, i.e., $\|K\|_{L^2(M)}^2 = \mathbb{E}[\int_0^\infty K_s^2 \, d\langle M \rangle_s] = 0$.
Define the process
\begin{align*}
X : [0, \infty) \times \Omega &\to \mathbb{R} \\
t &\mapsto \int_0^t K_s \, d\langle M \rangle_s,
\end{align*}
where the integral is a Lebesgue--Stieltjes integral with respect to the increasing process $t \mapsto \langle M \rangle_t$ (pathwise). Since $K \in L^2(M) \subset L^1(\Omega \times [0,\infty), d\mathbb{P} \otimes d\langle M \rangle)$ (by the Cauchy--Schwarz inequality, $\mathbb{E}[\int_0^t |K_s| \, d\langle M \rangle_s] \leq \|K\|_{L^2(M)} \cdot \mathbb{E}[\langle M \rangle_t]^{1/2} < \infty$ since $M \in \mathcal{M}^2_c$), the process $X$ is well-defined, continuous (since $\langle M \rangle$ is continuous), adapted (since $K$ is previsible and $\langle M \rangle$ is adapted), and of finite variation (with total variation bounded by $\int_0^t |K_s| \, d\langle M \rangle_s$). Moreover, $X_0 = 0$.
[guided]
The strategy is a standard Hilbert space argument: in a Hilbert space $\mathcal{H}$, a subspace $S$ is dense if and only if $S^\perp = \{0\}$. This is because $\mathcal{H} = \overline{S} \oplus S^\perp$ (orthogonal decomposition for closed subspaces), and $S$ is dense iff $\overline{S} = \mathcal{H}$, iff $S^\perp = \{0\}$.
We apply this with $\mathcal{H} = L^2(M)$ and $S = \mathcal{E}$. The inner product on $L^2(M)$ is
\begin{align*}
(K, H)_{L^2(M)} = \mathbb{E}\!\left[\int_0^\infty K_s H_s \, d\langle M \rangle_s\right].
\end{align*}
The measure $d\mathbb{P} \otimes d\langle M \rangle$ on $\Omega \times [0,\infty)$ (restricted to the previsible $\sigma$-algebra $\mathcal{P}$) is a positive measure, and $L^2(M) = L^2(\Omega \times [0,\infty), \mathcal{P}, d\mathbb{P} \otimes d\langle M \rangle)$ is a standard $L^2$ space, hence a Hilbert space.
Why define $X_t = \int_0^t K_s \, d\langle M \rangle_s$? Because the orthogonality condition $(K, H)_{L^2(M)} = 0$ can be rewritten as $\mathbb{E}[\int_0^\infty H_s \, dX_s] = 0$ for all $H \in \mathcal{E}$, and by choosing specific simple processes $H$, we will extract the martingale property of $X$.
[/guided]
[/step]
[step:Use the orthogonality condition with specific simple processes to show $X$ is a martingale]
For any $0 \leq s < t$ and any bounded $\mathcal{F}_s$-measurable random variable $F$, the process
\begin{align*}
H_u := F \cdot \mathbb{1}_{(s, t]}(u)
\end{align*}
belongs to $\mathcal{E}$ (it is a simple previsible process with one term: the coefficient $F$ is bounded and $\mathcal{F}_s$-measurable, and the indicator is of the form $\mathbb{1}_{(s, t]}$). By the orthogonality assumption,
\begin{align*}
0 = (K, H)_{L^2(M)} = \mathbb{E}\!\left[\int_0^\infty K_u \cdot F \cdot \mathbb{1}_{(s, t]}(u) \, d\langle M \rangle_u\right] = \mathbb{E}\!\left[F \int_s^t K_u \, d\langle M \rangle_u\right] = \mathbb{E}\!\left[F (X_t - X_s)\right].
\end{align*}
The exchange of $F$ and the integral is justified because $F$ is $\mathcal{F}_s$-measurable (hence does not depend on $u$) and bounded. Since $\mathbb{E}[F(X_t - X_s)] = 0$ for every bounded $\mathcal{F}_s$-measurable $F$, the definition of conditional expectation gives
\begin{align*}
\mathbb{E}[X_t - X_s \mid \mathcal{F}_s] = 0,
\end{align*}
or equivalently $\mathbb{E}[X_t \mid \mathcal{F}_s] = X_s$. This holds for all $0 \leq s < t$, so $X$ is a martingale.
[guided]
The choice of $H = F \cdot \mathbb{1}_{(s, t]}$ is the key step. Why this particular $H$? We want to show $\mathbb{E}[X_t \mid \mathcal{F}_s] = X_s$, which by definition means $\mathbb{E}[F(X_t - X_s)] = 0$ for all bounded $\mathcal{F}_s$-measurable $F$. The orthogonality condition gives us $(K, H)_{L^2(M)} = 0$ for all $H \in \mathcal{E}$, and the simple process $H = F \cdot \mathbb{1}_{(s,t]}$ is precisely the one that produces the integral $\mathbb{E}[F \int_s^t K_u \, d\langle M \rangle_u] = \mathbb{E}[F(X_t - X_s)]$.
The fact that $H = F \cdot \mathbb{1}_{(s,t]} \in \mathcal{E}$ requires verification: $F$ must be bounded and $\mathcal{F}_s$-measurable (both given), and the indicator must be of the form $\mathbb{1}_{(s,t]}$ (which is a generating element of the previsible $\sigma$-algebra). This is exactly the definition of a simple previsible process with a single term.
Note that we have not used any deep properties of the stochastic integral here -- only the Lebesgue--Stieltjes integral against $d\langle M \rangle$ and the definition of conditional expectation.
[/guided]
[/step]
[step:Conclude $X \equiv 0$ since a continuous finite variation martingale starting at zero vanishes]
The process $X$ is simultaneously:
- A continuous martingale (established in the previous step),
- Of finite variation (established in the first step, since $X_t = \int_0^t K_s \, d\langle M \rangle_s$ is a Lebesgue--Stieltjes integral against an increasing process),
- Starting at $X_0 = 0$.
By the [Continuous Finite Variation Local Martingale is Identically Zero](/theorems/2081) theorem (whose hypotheses are met: $X$ is a continuous local martingale with $X_0 = 0$ and $X$ has finite variation), we conclude
\begin{align*}
X_t = 0 \quad \text{for all } t \geq 0, \quad \text{a.s.}
\end{align*}
[guided]
This is the crucial rigidity result in continuous martingale theory: a continuous process cannot simultaneously be a martingale and have finite variation (unless it is constant). The [Continuous Finite Variation Local Martingale is Identically Zero](/theorems/2081) theorem proves this by showing that the $L^2$ norm of such a process is bounded by the product of the maximum oscillation (which tends to zero by uniform continuity) and the total variation (which is finite), forcing the $L^2$ norm to be zero.
In our case, $X$ is a genuine martingale (not just a local martingale), so the theorem applies directly. The conclusion $X_t = 0$ a.s. for all $t$ means $\int_0^t K_s \, d\langle M \rangle_s = 0$ a.s. for all $t$.
[/guided]
[/step]
[step:Deduce $K = 0$ in $L^2(M)$ from the vanishing of $X$]
Since $X_t = \int_0^t K_s \, d\langle M \rangle_s = 0$ for all $t \geq 0$ almost surely, the signed measure $K \, d\langle M \rangle$ is the zero measure on $[0, \infty)$ for almost every $\omega$. Since $d\langle M \rangle$ is a positive measure (as $\langle M \rangle$ is increasing), this implies $K_s = 0$ for $d\langle M \rangle$-almost every $s$, for almost every $\omega$.
In terms of the product measure $d\mathbb{P} \otimes d\langle M \rangle$ on $\Omega \times [0, \infty)$:
\begin{align*}
K = 0 \quad d\mathbb{P} \otimes d\langle M \rangle\text{-a.e.}
\end{align*}
Therefore $\|K\|_{L^2(M)}^2 = \mathbb{E}[\int_0^\infty K_s^2 \, d\langle M \rangle_s] = 0$, which means $K = 0$ in $L^2(M)$. Since $\mathcal{E}^\perp = \{0\}$, the subspace $\mathcal{E}$ is dense in $L^2(M)$.
[guided]
The passage from "$\int_0^t K_s \, d\langle M \rangle_s = 0$ for all $t$" to "$K = 0$ $d\langle M \rangle$-a.e." is a standard measure theory fact: if $\int_A f \, d\mu = 0$ for all measurable sets $A$, then $f = 0$ $\mu$-a.e. Here, the sets $A = [0, t]$ generate the Borel $\sigma$-algebra on $[0, \infty)$, and the derivative of the integral function $t \mapsto \int_0^t K_s \, d\langle M \rangle_s$ being identically zero implies the integrand vanishes $d\langle M \rangle$-a.e.
More precisely, let $\nu$ be the signed measure on $([0,\infty), \mathcal{B}([0,\infty)))$ defined by $\nu(B) = \int_B K_s \, d\langle M \rangle_s$. If $\nu([0,t]) = 0$ for all $t$, then $\nu((s,t]) = 0$ for all $s < t$, so $\nu$ vanishes on all half-open intervals, hence on the $\sigma$-algebra they generate, hence $\nu = 0$. Since $\nu \ll d\langle M \rangle$ with density $K$, we get $K = 0$ $d\langle M \rangle$-a.e.
This holds for each fixed $\omega$ (on a set of full $\mathbb{P}$-measure), and integrating over $\Omega$ gives $K = 0$ in $L^2(M)$.
[/guided]
[/step]