Solution (source code)

= Solution

Let $\Phi$ denote the standard <normal distribution> <cumulative distribution function>, and $\phi$ its density. Put $\tau=T-t$. For $K>0$ and $t<T$, define
$$
d_1=\frac{\log(S_t/K)+(r+\sigma^2/2)\tau}{\sigma\sqrt\tau},\qquad d_2=d_1-\sigma\sqrt\tau.
$$
Under the <risk-neutral measure>, conditional on $\mathcal F_t$,
$$
S_T=S_t\exp\bigl((r-\sigma^2/2)\tau+\sigma\sqrt\tau\,Z\bigr),\qquad Z\sim N(0,1).
$$
Thus $Q(S_T<K\mid\mathcal F_t)=\Phi(-d_2)$. The identity $e^{az}\phi(z)=e^{a^2/2}\phi(z-a)$ for the standard <Gaussian distribution> <probability density function> gives
$$
\mathbb E_Q[S_T\mathbf1_{\{S_T\geq K\}}\mid\mathcal F_t]=S_te^{r\tau}\Phi(d_1).
$$
Split the payout according to whether the stock exceeds the floor and discount. The <risk-neutral pricing> process is
$$
\boxed{\xi_t=V(t,S_t)=S_t\Phi(d_1)+Ke^{-r(T-t)}\Phi(-d_2),\qquad \xi_T=\max(K,S_T).}
$$
Its discounted value is $\mathbb E_Q[\xi_T/B_T\mid\mathcal F_t]$, a true <martingale>. Thus adding this asset preserves the <equivalent martingale measure> and gives no <arbitrage>. This is the <guaranteed terminal stock floor in the Black-Scholes model>. For $K\leq0$, positivity of the stock makes the claim simply $S_T$, and the price is $\xi_t=S_t$.