Solution (source code)

= Solution
{c}

<Itô's formula> identifies the <infinitesimal generator> on twice continuously differentiable functions:
$$
\boxed{(Lf)(z)=rzf'(z)+\tfrac12\sigma^2z^2f''(z).}
$$
Subtract the <drift coefficient> integral from that formula to obtain
$$
M_t^f=\int_0^t\sigma X_s f'(X_s)\,dB_s.
$$
Stopping when $|X|$ leaves a bounded interval makes the integrand bounded on each finite time interval. Therefore $M^f$ is a continuous <local martingale>. In fact $f'\in L^\infty$ and the <lognormal distribution> solution has finite second moments on finite intervals, so here it is square integrable on each such interval as well.

The <quadratic covariation> of two <stochastic integrals> against the same <Brownian motion> is the integral of the product of their integrands. Consequently
$$
\boxed{\langle M^f,M^g\rangle_t
=\sigma^2\int_0^tX_s^2 f'(X_s)g'(X_s)\,ds.}
$$
This is the <quadratic covariation>, which agrees with the pathwise <quadratic covariation> for these continuous <local martingales>.