Solution (source code)

= Solution

For a continuous positive <survival time>, $S'(t)=-f(t)$ and the <hazard function> is $h(t)=f(t)/S(t)$ wherever $S(t)>0$. Therefore
$$
\frac{d}{dt}\log S(t)=-h(t).
$$
Since $S(0)=1$, integrating gives the <cumulative hazard function> identity
$$
\boxed{S(t)=\exp\{-H(t)\},\qquad H(t)=\int_0^t h(u)\,du.}
$$
At an endpoint where survival reaches zero, the corresponding cumulative hazard is interpreted as $+\infty$ and the exponential as zero.