These are some notes on credit derivatives from a mathematical point of view.
It is WIP and based mostly off Modelling singlename and multiname Credit Derivatives (O'Kane, 2009).
Contents 

Fundamentals 
Notation Table 
Discount Curves 
Short Rates 
Discount processes 
Constant Rate Case 
Annuities 
Credit Events 
Risky Annuties 
Hazard Rates 
EventTriggered Payments 
Insurance Premiums 
Fundamentals
Notation Table
We adopt the following notation throughout this document:
Notation  Meaning 

$s$  Time parameter 
$t$  Time parameter 
$\xi$  Time parameter 
$T$  Maturity date of contract 
$\tau$  Credit event 
$Z(s,t)$  discount curve 
$r(t)$  short rate process 
$D(t)$  discount process 
$\Gamma(t)$  annuity process 
$A(t)$  annuity valuation process 
$Q(t,T)$  survival curve 
$\lambda(t)$  hazard rate process 
$\hat Z (t,T)$  risky discount curve 
$\hat A (t)$  risky annuity valuation process 
$I$  Indicator variable 
$\mathcal F$  filtration 
Assume that all stochastic processes, unless otherwise specified, are adapted to some common filtration $\mathcal F$. We us $\mathbb{E}_s [X]$ as shorthand for the conditional expectation of the random variable $X$ with respect to $\mathcal F_{s}$ for some time parameter $s$:
Time is represented with a real number $s$, with $s=0$ usually indicating the time at which some contract was created.
Discount Curves
Consider a hypothetical bond maturing at time $t$ (the maturity or tenor) having the following properties:
 UnitNotional
 At time $t$ the bond holder will be paid one unit of currency.
 ZeroCoupon
 No payments to the bond holder will be made before time $t$.
 Risk Free
 The notional is guaranteed to be paid in full and on time.
Denote the fair value of this bond ascertained at time $s$ ("today") as $Z(s,t)$. Here, $Z$ is known as the discount curve. This can be thought of as a bitemporal function. But more precisely, $Z$ is a parametrized class of stochastic processes. That is, for a fixed $t$, $s\mapsto Z(s,t)$ is a stochastic proccess.
We make the following assumptions on $Z$:
 $Z(s,t) > 0$
 $Z(s,t+h)=Z(s,t)\mathbb{E}_s[Z(t,t+h)]$
 For fixed $s$, $t\mapsto Z(s,t)$ is Riemann integrable.
 (Optional) For fixed $s$, $t \mapsto Z(s,t)$ is smooth.
The fourth assumption is optional. Most of the theory we develop won't require it. But it does aid in the definition of the short rate and discount process.
Exercise. From above assumptions, show that $Z(s,s)=1$.
Short Rates
Assume that $t \mapsto Z(s,t)$ is smooth.
Define $Z'$ as the derivative of $Z$ with respect to its second argument. That is, $Z'(s,t)=\frac{\partial Z(s,t)}{\partial t}$. Then
Consequently,
Here, $r(t)=Z'(t,t)$ is the short rate process. It can be thought of as the "instanteous" interest rate at time $t$.
Discount processes
The discount process corresponding to the short rate process $r(t)$ is defined as
With this notation, the discount curve may be written as
Constant Rate Case
In the case that $r$ is a constantvalue stochastic process, e.g. $r(t)=r_o$, then the discount process is just an exponential function $D(t)=e^{r_ot}$. And the discount cuve is $Z(s,t)=e^{r_o(st)}$.
Annuities
An annuity is a schedule of future payments. Denote $\Gamma (t)$ as the total payments of an annuity up to and including time $t$.
Assuming zero risk, the fair value of the remaining annuity at time $t$ is defined as the following RiemannStieltjes integral:
 Discrete Case

Consider an annuity consisting of discrete payments
$\gamma_1,\ldots,\gamma_N$ at times $\xi_1,\ldots,\xi_N$. Then
$A(t) = \sum_{n=1}^{N} \gamma_n Z(t,\xi_n)I(t>\xi_n),$where $I$ is the indicator variable. Here $t_N$ is the maturity of the annuity.
 Smooth Case

Suppose that $\Gamma$ is smooth. And define $\gamma(t) = \Gamma' (t)$
as the annuity rate. Then
$A(t) = \int_t^\infty Z(t,\xi)\gamma (\xi) ds.$
 Smooth Case With Maturity

Suppose that $\Gamma' (t) = \gamma(t)I(t < T)$.
Then the annuity value process can be written as
$A(t)=\int_t^T Z(t,\xi)\gamma(\xi)d\xi.$Here, $T$ is the maturity of the annuity.
Credit Events
A credit event is a contractuallyobligated event wherein a debt security (e.g. a bond) has been determined to not be fully honored.
Mathematically, a credit event $\tau$ is a stopping time. That is, a random variable representing some point in time.
It's distribution can be described by the survival curve $Q$:
This is the probability ascertained at time $t$ that a credit event will not occur before or during time $T$.
Risky Annuties
Consider an annuity $\Lambda (t)$ that is risky. That is, scheduled payment occuring at or after a credit event $\tau$ are unrealized. The forwardlooking fair value of this annuity is given by the risky value process:
Hazard Rates
The hazard rate $\lambda (t)$ is the instanteous likelihood that a credit event will occur at time $t$. Mathematically, it is a stochastic process $\lambda$ defined by:
Intuitively, $\lambda(t) dt$ is the likelihood that a credit event will occur between times $t$ and $t+dt$.
Equivalently, the survival curve may be derived from an a priori defined hazard rate:
The relationship between $\lambda$ and $Q$ is analogous to that of $r$ and $Z$.
EventTriggered Payments
Consider a payment of one unit of currency paid out at time $\tau$ if $\tau < T$ for some tenor $T$. This is a form of insurance. And it's value at time $t$ is given by
Insurance Premiums
One may want the bet that a a credit event will occur. Or perhaps one is already entitled to an annuity and may want to hedge the risks associated with a credit event. In this case, they will purchase an credit event triggered payment from a protection seller (i.e. an insurer).
While such protection can be purchased for a lumpsum upfront, often it is done through an annuity paid out to the protection seller. However, these payments will continue up to when a credit event occurs (if it does occur) or to the maturity of the underlying annuity.
The corresponding annuity function is:
Note that this is necessarily a stochastic process since it depends on the stopping time $\tau$.
Assuming this is a risk free annuity.