Solution (source code)

= Solution

The <instantaneous forward rate> is defined by $f(t,T)=-\partial_T\log P(t,T)$, with $P(t,t)=1$. Integrating in maturity gives the <zero-coupon bond> price and its diagonal <short rate>:
$$
\boxed{P(t,T)=\exp\left(-\int_t^Tf(t,u)\,du\right),\qquad r_t=f(t,t).}
$$
The solution of the <continuous-time bank account> equation $dB_t=r_tB_tdt$, $B_0=1$, is $B_t=\exp(\int_0^tr_sds)$; the integration variable is time. Its discounted bond value is
$$
\boxed{Z_t(t,T)=B_t^{-1}P(t,T)
=\exp\left(-\int_0^tr_sds-\int_t^Tf(t,u)\,du\right).}
$$
All these are <adapted processes> when the <Heath-Jarrow-Morton model> coefficients are adapted and the integrals exist.

For <market completeness>, stochastic integration over maturity gives
$$
d\log P(t,T)=\left[r_t-\int_t^T\alpha(t,u)\,du\right]dt+\Sigma(t,T)dW_t,\qquad
\Sigma(t,T)=-\int_t^T\sigma(t,u)\,du.
$$
The <Itô formula> for the exponential then yields
$$
\frac{dP(t,T)}{P(t,T)}
=\left[r_t-\int_t^T\alpha(t,u)\,du+\frac12\Sigma(t,T)^2\right]dt+\Sigma(t,T)dW_t.
$$
Consequently under a <risk-neutral measure> the no-arbitrage drift restriction is
$$
\int_t^T\alpha^Q(t,u)\,du=\frac12\left(\int_t^T\sigma(t,u)\,du\right)^2,\qquad
\alpha^Q(t,T)=\sigma(t,T)\int_t^T\sigma(t,u)\,du.
$$
The last equality needs sufficient maturity regularity and has a positive sign despite the negative definition of $\Sigma$.