Solution (source code)

= Solution

To avoid confusing the <continuous-time bank account> with the coefficient of $r_t$, denote the latter by $b(\tau)$ and the other coefficient by $a(\tau)$, where $\tau=T-t$. Apply the <Itô formula> to $D_t[a(\tau)+b(\tau)r_t]$. Since the expression is affine in $r$, its second rate derivative is zero. Its drift is
$$
D_t\left[-a'(\tau)-b'(\tau)r_t+b(\tau)r_t(r_t-1)
-r_t(a(\tau)+b(\tau)r_t)\right]dt.
$$
The quadratic terms cancel. The remaining expression is
$$
D_t\{-a'(\tau)+[-b'(\tau)-a(\tau)-b(\tau)]r_t\}\,dt.
$$
It vanishes when $a'=0$ and $b'=-a-b$. For a unit bond payoff choose terminal conditions $a(0)=1$, $b(0)=0$, giving
$$
\boxed{a(\tau)=1,\qquad b(\tau)=e^{-\tau}-1.}
$$
The resulting <local martingale> is $D_t[1-(1-e^{-\tau})r_t]$. The allowed bound $0\leq r_t\leq1$ puts it between zero and one, so the <bounded local martingale criterion> makes it a true <martingale>. At maturity it equals $D_T$. Comparing with part (a) therefore gives
$$
\boxed{P(t,T)=1-(1-e^{-(T-t)})r_t.}
$$
In particular $e^{-(T-t)}\leq P(t,T)\leq1$, and $P(T,T)=1$. This is <linear bond pricing in a bounded short-rate diffusion>; choosing zero coefficients would produce a <local martingale> but would not price the required terminal payoff.