\section{Review of homological algebra (Allechar Serrano L\'opez)}

\begin{enumerate}
\item[1.] Let $\mathcal{C}$ be an additive category. Set $C(\mathcal{C})=$ category of complexes

\[\cdots\rightarrow X^n\rightarrow X^{n+1}\rightarrow\cdots\]

in $\mathcal{C}$ and $K(\mathcal{C})=$ category of complexes modulo chain homotopy equivalence, i.e. 

\begin{align*}
\mathrm{ob}K(\mathcal{C})&=\mathrm{ob}C(\mathcal{C})\\
\Hom_{K(\mathcal{C})}(X, Y)&=\Hom_{C(\mathcal{C})}(X, Y)/\sim
\end{align*}

where $\sim$ is given by $f\sim g$ if there exists a chain homotopy between them.

Recall 

\begin{center}
\begin{tikzcd}
\cdots \arrow[r] &X^{n-1} \arrow[r] &X^n \arrow[r] \arrow[dl, "s"] &X^{n+1} \arrow[r] \arrow[dl, "s"] &\cdots\\ 
\cdots \arrow[r] &Y^{n-1} \arrow[r] &Y^n \arrow[r] &Y^{n+1} \arrow[r] &\cdots
\end{tikzcd}
\end{center}

a chain homotopy between maps $f, g: X\rightarrow Y$ is a collection $s_n:X^n\rightarrow Y^{n-1}$ such that $f-g=ds+sd$.

 We will write $C^{?}(\mathcal{C})$ and $K^{?}(\mathcal{C})$ to denote the analogous categories of complexes bounded from below ($?=+$), from above ($?=-$), or from both directions ($?=b$).

\begin{exmpl}

If $\mathcal{C}$ is an abelian category. Any complex $X\in C(\mathcal{C})$ has (co)homology objects in $\mathcal{C}$, namely

\[H^n(X)=\dfrac{\ker(d^n_X)}{\mathrm{image}(d^{n-1}_X)}\in\mathcal{C}\]

Maps in $C(\mathcal{C})$ induce maps on homology, and homotopic maps induce the same map on $H^n$.

\end{exmpl}

\item[2.] Additional structure on $C(\mathcal{C})$, $K(\mathcal{C})$:

\underline{shift} autoequivalences $X\rightarrow X[1]$ where $(X[1])^n=X^{n+1}$. More generally, for all $k\in \mathbb{Z}$, we have $X[k]\in C(\mathcal{C})$ (or $K(\mathcal{C})$) with $(X[k])^n=X^{n+k}$ and $d^n_{X[k]}=(-1)^kd^{n+k}_X$. These shifts are indeed functors: if $f: X\rightarrow Y$, then $f[k]:X[k]\rightarrow Y[k]$ by $f[k]^n=f^{n+k}$.\\

\textit{New objects from old:} (In parallel with algebraic topology)\\

Let $f: X\rightarrow Y$ be a map in $C(\mathcal{C})$. Define a cone of $f$ by $C(f)\in C(\mathcal{C})$ such that $C(f)^n=X^{n+1}\oplus Y^n$ with

\[d^n_{C(f)}: X^{n+1}\oplus Y^n \longrightarrow X^{n+2}\oplus Y^{n+1}\]

where the map on $X^{n+1}$ is given by $(d^n_{X[1]}, f)$ and on $Y^n$ it is given by $(0, d^n_Y)$.

\begin{ex}
Check that $d^2=0$.

We have that 

\[\left(\begin{tabular}{cc}
$d^{n+1}_{X[1]}$ & $f$ \\ 
$0$ & $d^{n+1}_Y$ \\ 
\end{tabular}\right)\left(\begin{tabular}{cc}
$d^n_{X[1]}$ & $f$ \\ 
$0$ & $d^n_Y$ \\ 
\end{tabular} \right)=\left(\begin{tabular}{cc}
$d^{n+1}_{X[1]}\circ d^n_{X[1]}$ & $d^{n+1}_{X[1]}\circ f+f\circ d^n_{Y}$ \\ 
$0$ & $d^{n+1}_{Y}\circ d^n_{Y}$ \\ 
\end{tabular}\right)=\left(\begin{tabular}{cc}
$0$ & $0$\\
$0$ & $0$
\end{tabular}\right)\]

\end{ex}

\subsection{Topological analogue}

If $X$ is a topological space, recall that the cone of $X$, 


\begin{center}
\begin{tikzpicture}
    \draw[dashed] (0,0) arc (170:10:1cm and 0.2cm)coordinate[pos=0] (a);
    \draw (0,0) arc (-170:-10:1cm and 0.2cm)coordinate (b);
    \draw ([yshift=2cm]$(a)!0.5!(b)$);
    \draw (a) -- ([yshift=2cm]$(a)!0.5!(b)$) -- (b);
  \end{tikzpicture}

$C(X)=\dfrac{X\times I}{X\times \{1\}}$
\end{center}

and if $f:X\rightarrow Y$ is a map of topological spaces, then $C(f)$ is the pushout

\begin{center}
\begin{tikzcd}
X \arrow[r, "f"] \arrow[d, "i"]&Y \arrow[d]\\
C(X) \arrow[r] &C(f)
\end{tikzcd}
\end{center}

i.e. $C(f)=\dfrac{C(X)\cup Y}{(x, 0)\sim f(x)}$

\begin{exmpl}
\ 
\begin{itemize}
\item[(\textbf{Top})] 

$Y=\{*\}$ and $f:X\rightarrow \{*\}$. Then  

\begin{center}
\begin{tikzpicture}
    \draw[dashed] (0,2) arc (170:10:1cm and 0.2cm)coordinate[pos=0] (a);
    \draw (0,2) arc (-170:-10:1cm and 0.2cm)coordinate (b);
    \draw ([yshift=2cm]$(a)!0.5!(b)$);
    \draw (a) -- ([yshift=2cm]$(a)!0.5!(b)$) -- (b);
    %\draw[dashed] (0,0) arc (170:10:1cm and 0.2cm)coordinate[pos=0] (a);
    %\draw (0,-) arc (-170:-10:1cm and 0.2cm)coordinate (b);
    \draw ([yshift=2cm]$(a)!0.9!(b)$);
    \draw (a) -- ([yshift=2cm]$(2, -3)!0.5!(0, -1)$) -- (b);
  \end{tikzpicture}
  
$C(f)=\text{suspension of } X$
\end{center}

\item[(\textbf{Alg})] 

$Y=$ the zero complex, $f:X\rightarrow 0$. Then $C(f)^n=X^{n+1}$ with boundary map $d^n_{X[1]}$, i.e., $C(F)=X[1]$.
\end{itemize}
\end{exmpl}

\begin{exmpl}
\
\begin{itemize}
\item[(\textbf{Top})] $C(\mathrm{id}_X)=C(X)$
\item[(\textbf{Alg})]\begin{ex}
$\mathcal{C}$ abelian, $X\in C(\mathcal{C})$. Then $C(\mathrm{id}_X)$ has trivial homology.

The identity morphism on the mapping cone is homotopic to zero via the map

\[s_n=\left(\begin{tabular}{cc}
$0$ & $0$ \\ 
id$_{X^n}$ & $0$ \\ 
\end{tabular} \right)\]

So, the identity $id_{C(id_X)}$ is equal to the zero map and the mapping cone is isomorphic to the zero complex. Hence, it has trivial homology and it is irreducible.

\end{ex}
\end{itemize}
\end{exmpl}


\begin{exmpl}{Cones as substitutes for cokernels in non-abelian settings}
\
\begin{itemize}
\item[(\textbf{Top})] If $f: X\hookrightarrow Y$ is a nice inclusion (cofibration), then $C(f)\xrightarrow{\text{collapse }C(X)}Y/X$ is a homotopy equivalence.
\item[(\textbf{Alg})] Let $\mathcal{C}=\text{the abelian category of }R-\text{modules}$ for some ring $R$. Let $M, N\in \mathcal{C}$ and $f:M\rightarrow N$. Regard this as a map between complexes concentrated in degree zero. Then $C(f)^n=(M)^{n+1}\oplus (N)^n$, i.e.,

\[\cdots\rightarrow 0\rightarrow C(f)^{-1}= M\xrightarrow{f} C(f)^0=N\rightarrow 0\rightarrow\cdots \]

i.e., $C(f)$ is a complex such that 

\begin{align*}
H^{-1}(C(f))&=\ker(f)\\
H^0(C(f))&=\mathrm{coker}(f) 
\end{align*}

In particular, if $f$ is an inclusion $H^n(C(f))=0$ for all $n\neq 0$ and $H^0(C(f))=N/M$.
\end{itemize}
\end{exmpl}

\item[3.] What happens in $K(\mathcal{C})$ that does not happen in $C(\mathcal{C})$?

From the cone construction, for any $f:X\rightarrow Y$ we get maps of complexes

\[X\xrightarrow{f}Y\xrightarrow{i(f)}C(f)\xrightarrow{\pi(f)}X[1]\]

\begin{ex}\label{rot}
In $K(\mathcal{C})$, we have isomorphisms $X[1]\overset{\psi}{\xrightarrow{\sim}} C(i(f))$ such that

\begin{center}
\begin{tikzcd}
Y \arrow[r, "i(f)"] \arrow[d, equal] &C(f) \arrow[r, "\pi(f)"] \arrow[d, equal] &X[1] \arrow{d}{\sim}[swap]{\psi}\arrow{r}{-f[1]}  &Y[1]\arrow[d, equal]\\
Y \arrow[r, "i(f)"] &C(f)\arrow[r, "i(i(f))"] &C(i(f)) \arrow{r}{\pi(i(f))} &Y[1] 
\end{tikzcd}
\end{center}

commutes in $K(\mathcal{C})$.

We want to show that the rotated triangle 

\[Y\xrightarrow{i(f)} C(f)\xrightarrow{\pi(f)} X[1]\xrightarrow{-f[1]} Y[1]\]

is isomorphic in $K(C)$ to the standard triangle for $i(f)$

\[Y\xrightarrow{i(f)} C(f)\xrightarrow{i(i(f))} C(i(f))\xrightarrow{\pi(i(f))}Y[1]\]

Define $\phi=(\phi_n):X[1]\rightarrow C(i(f))$ by setting $\phi=(-f, \text{id}_X, 0)$ and define $\psi: C(i(f))\rightarrow X[1]$ by setting $\psi:(0, \text{id}_X, 0)$. These gives morphisms of triangles since we have $\pi(i(f))\circ \phi=-f[1]$ and $\phi\circ\pi(f)\sim i(i(f))$. Similarly, $\psi$ is a morphism of triangles since $\pi(f)=\psi\circ (i(i(f)))$ and $-f[1]\circ\psi\sim\pi(i(f))$. Now, this morphisms are isomorphisms since $\psi\circ\phi=\text{id}_{X[1]}$ and $\phi\circ\psi\sim\text{id}_{C(i(f))}$.

\end{ex}

\begin{defn}
A triangle, $\triangle$, in $K(\mathcal{C})$ is any sequence of maps 
\[X\rightarrow Y\rightarrow Z\rightarrow X[1]\]
A distinguished triangle is a triangle that is isomorphic to one of the form 
\[X\xrightarrow{f} Y\xrightarrow{i(f)} C(f)\xrightarrow{\pi(f)} X[1]\] 
for some map $f$.
\end{defn}

\begin{thm}{(Verdier)}
For an additive category $\mathcal{C}$, $K(\mathcal{C})$ equipped with its shift autoequivalence $[1]$ and its collection of distinguished triangles is a triangulated category.
\end{thm}
Here's what this means:
\begin{defn}
A triangulated category is an additive abelian category $\mathcal{D}$ with autoequivalence $[1]:\mathcal{D}\rightarrow\mathcal{D}$ and a designated collection of ``distinguished triangles" inside the collection of all triangles, satisfying

\begin{itemize}
\item[(TR1)] 
\begin{itemize}
\item For all $X\in\mathcal{D}$, $X\xrightarrow{\mathrm{id}_X} X\rightarrow 0\rightarrow X[1]$ is a distinguished triangle
\item any triangle isomorphic to a distinguished triangle is itself distinguished
\item any map $f:X\rightarrow Y$ can be completed to a distinguished triangle, i.e., there exist $Z$ and maps such that $X\xrightarrow{f} Y\rightarrow Z \rightarrow X[1]$ is a distinguished triangle; such a $Z$ is called a cone of $f$.
\end{itemize}

\begin{exmpl}
For $K(\mathcal{C})=\mathcal{D}$, we have to check that $X\xrightarrow{\mathrm{id}_X} X\rightarrow 0 \rightarrow X[1]$ is distinguished, which is equivalent to the exercise of showing that the cone of the identity map is contractible.
\end{exmpl}

\item[(TR2)] A triangle is distinguished if and only if its rotation is distinguished, i.e., 

\begin{align*}
\triangle &: X\xrightarrow{f} Y\xrightarrow{g} Z\xrightarrow{h} X[1]\\
\mathrm{rot}(\triangle) &: Y\xrightarrow{g} Z\xrightarrow{h} X[1]\xrightarrow{-f[1]} Y[1]
\end{align*}

\begin{rmk}
For $K(\mathcal{C})=\mathcal{D}$, this axiom is equivalent to Exercise \ref{rot}.
\end{rmk}

\item[(TR3)] Given two distinguished triangles and maps $\alpha$ and $\beta$ between their terms making this diagram commute

\begin{center}
\begin{tikzcd}
X \arrow{r}{f} \arrow{d}[swap]{\alpha} &Y \arrow{r}{g} \arrow{d}[swap]{\beta} &Z \arrow{r}{h} \arrow[d, dashrightarrow, "\exists\gamma"] &X[1] \arrow{d}{\alpha[1]}\\
X' \arrow{r}{f'} &Y' \arrow{r}{g'} &Z' \arrow{r}{h'} &X'[1]
\end{tikzcd}
\end{center}

then there exists $\gamma: Z\rightarrow Z'$ such that all squares commute. 

\begin{exmpl}
For $K(\mathcal{C})$ this is easy to check since we can reduce to triangles of the form $X\xrightarrow{f}Y\xrightarrow{i(f)}C(f)\xrightarrow{\pi(f)}X[1]$.
\end{exmpl}

\item[(TR4)] Octahedron axiom. We won't state this in detail.

Motto: triangulated analogue of third isomorphism theorem: $(Y/X)/(Z/X)\cong Y/Z$.
\end{itemize}
\end{defn}
We will often use the following:
\begin{ex}
Let  $X\xrightarrow{f} Y \xrightarrow{g} Z \xrightarrow{h} X[1]$  be a distinguished triangle in a triangulated category $\mathcal{D}$. Then for any $U \in \mathcal{D}$, the induced sequence
\[
 \cdots \to \Hom(U, X) \to \Hom(U, Y) \to \Hom(U, Z) \to \Hom(U, X[1]) \to \cdots
\]
is exact.
\begin{proof}Indeed, if $l: U \to Y$ is a morphism such that $g\circ l=0$, then we have a commutative diagram

\begin{center}
\begin{tikzcd}
U \arrow{r} \arrow{d}[swap]{l} &0 \arrow{r} \arrow{d} &U[1] \arrow{r}{-1}  &U[1] \arrow{d}{-l[1]}\\
Y \arrow{r}{g} &Z \arrow{r}{h} &X[1] \arrow{r}{-f[1]} &Y[1]
\end{tikzcd}
\end{center}

where the top and bottom rows are distinguished triangles. Hence there is a morphism $\phi:U\rightarrow X$ such that $-\phi[1]$ makes the diagram commute. In particular, $l=f\circ\phi$. The same holds for $\Hom(\cdot, U)$: we say that $\Hom(U, \cdot)$ and $\Hom(\cdot, U)$ are cohomological functors. \end{proof}
\end{ex}


\item[4.] Now let $\mathcal{C}$ be a abelian category. Then $K(\mathcal{C})$ and $C(\mathcal{C})$ have more structure: they have homology functors

\begin{center}
\begin{tikzcd}
H^n: C(\mathcal{C})\arrow{r} \arrow{d} &\mathcal{C} \arrow[dl, leftarrow, "\text{factors through }K(\mathcal{C})"]\\
K(\mathcal{C})
\end{tikzcd}
\end{center}

and more generally, we have \underline{truncation} functors $\tau^{\leqslant n}$, $\tau^{\geqslant n}$ given by

\begin{align*}
\tau^{\leqslant n}(X) &= (\cdots \rightarrow X^{n-2}\rightarrow X^{n-1} \rightarrow \ker(d^n_X) \rightarrow 0 \rightarrow 0\rightarrow \cdots)\\
\tau^{\geqslant n}(X) &= (\cdots \rightarrow 0 \rightarrow 0 \rightarrow \mathrm{coker}(d^{n-1}_X) \rightarrow X^{n+1} \rightarrow X^{n+2} \rightarrow \cdots)
\end{align*}

so $\tau^{\leqslant n}$ has the same cohomology as $X$ in degrees $\leqslant n$ and $\tau^{\geqslant n}$ has the same cohomology as $X$ in degrees $\geqslant n$.

The familiar statement that ``a short exact sequence of complexes yields a long exact sequence in cohomology" generalizes to

\begin{lem}
$H^0: K(\mathcal{C}) \rightarrow \mathcal{C}$ is a cohomological functor, i.e., for any distinguished triangle $X\rightarrow Y\rightarrow Z\rightarrow X[1]$ we get an exact sequence 
\[H^0(X)\rightarrow H^0(Y)\rightarrow H^0(Z)\]
\end{lem}

\begin{proof}
Exercise.
\end{proof}

\begin{cor}
For any distinguished triangle, we get a long exact sequence

\[\cdots \rightarrow H^n(X)\rightarrow H^n(Y)\rightarrow H^n(Z)\rightarrow H^{n+1}(X)\rightarrow\cdots\]
\end{cor}

\begin{proof}
Use previous lemma and the fact that a rotation of a distinguished triangle is also a distinguished triangle.
\end{proof}

\begin{exmpl}
An example of a short exact sequence in $C(\mathcal{C})$ whose image in $K(\mathcal{C})$ is not a distinguished triangle. Consider $\mathcal{C}=\underline{\mathrm{Ab}}$. Take the short exact sequence of complexes

\[ 0\rightarrow \mathbb{Z}/2\xrightarrow{[2]} \mathbb{Z}/4\xrightarrow{\mathrm{proj}} \mathbb{Z}/2\rightarrow 0\]


\begin{prop}
In $K(\underline{\mathrm{Ab}})$, $\mathbb{Z}/2\rightarrow\mathbb{Z}/4\rightarrow\mathbb{Z}/2$ cannot be completed to a distinguished triangle.
\end{prop}

\begin{proof}
Suppose it could be completed. Then we would have the distinguished triangles

\begin{center}
\begin{tikzcd}
\mathbb{Z}/2 \arrow{r}{[2]} \arrow[d, equal] &\mathbb{Z}/4 \arrow{r} \arrow[d, dashed, "\beta"] &\mathbb{Z}/2 \arrow[r, "h=0"]\arrow{d}{0} &\mathbb{Z}/2[1] \arrow[d, equal]\\
\mathbb{Z}/2 \arrow{r} &\mathbb{Z}/2 \arrow{r} &0 \arrow{r} &\mathbb{Z}/2[1]
\end{tikzcd}
\end{center}

Then in $K(\underline{\mathrm{Ab}})$ we can fill in $\beta$ making all squares commute (TR3). In $K(\underline{\mathrm{Ab}})$, $\beta\circ[2]=\text{id}:\mathbb{Z}/2\rightarrow\mathbb{Z}/2$.

So in $C(\underline{\text{Ab}})$, there exists a chain homotopy $s$ from $\text{id}_{\mathbb{Z}/2}$ to $\beta\circ[2]$. Since both complexes are concentrated in degree $0$, $s$ must be zero, so $\beta\circ[2]=\mathrm{id}_{\mathbb{Z}/2}$ in $C(\underline{\text{Ab}})$, hence $\underline{\mathrm{Ab}}$. This implies that $\mathbb{Z}/4\cong\mathbb{Z}/2\oplus\mathbb{Z}/2$, a contradiction.
\end{proof}

\begin{rmk}
The short exact sequence of complexes still gives a long exact sequence in cohomology even though it does not give a distinguished triangle in $K(\underline{\mathrm{Ab}})$. The derived category will fix this lack of distinguished triangles. 

Let $\mathcal{C}$ be an abelian category, and let $0 \to X \to Y \to Z \to 0$ be a short exact sequence in $C(\mathcal{C})$. We want to see what would be needed to complete this to a distinguished triangle. Look at

\begin{center}
\begin{tikzcd}
X \arrow{r}{f} \arrow[d, equal] &Y \arrow{r} \arrow[d, equal] &C(f) \arrow{r} \arrow{d}{\phi=(0, g)} &X[1] \arrow[d, equal]\\
X \arrow{r}[swap]{f} &Y \arrow{r}{g} &Z \arrow[r, dashed, "?"] &X[1]
\end{tikzcd}
\end{center}
If $\phi$ were invertible, then we could fill in the bottom row to complete the short exact sequence to a distinguished triangle. As we've seen, this may not be possible in $K(\mathcal{C})$, so instead we look for a related category in which $\phi$ becomes invertible. 
\end{rmk}
\end{exmpl}
\end{enumerate}

\begin{lem}
For a short exact sequence $0\rightarrow X\xrightarrow{f} Y\rightarrow Z\rightarrow 0$, $\phi: C(f)\rightarrow Z$ is an isomorphism on cohomology.
\end{lem}

\begin{defn}
A map of complexes inducing isomorphisms on cohomology is called a quasi-isomorphism.
\end{defn}

\begin{proof}
We have a short exact sequence of complexes $0\rightarrow C(\mathrm{id}_X)\rightarrow C(f)\xrightarrow{\phi} Z\rightarrow 0$ given in degree $n$ by

\[0 \to X^{n+1}\oplus X^n\xrightarrow{\mathrm{id}_X\oplus f} X^{n+1}\oplus Y^n \xrightarrow{(0, g)} Z^n \to 0\]

We get a long exact sequence on $H^n$, and then conclude the proof using that $H^n(C(\mathrm{id}_X))=0$ for all $n$.
\end{proof}

We will now pass to a new category, $D(\mathcal{C})$, where quasi-isomorphisms become isomorphisms.

\begin{defn}
Let $\mathcal{C}$ be an abelian category. There exist (see below for a set-theoretic caveat) a category $D(\mathcal{C})$ and a functor $Q: K(\mathcal{C})\rightarrow D(\mathcal{C})$ satisfying

\begin{itemize}
\item[1)] $Q(\text{quasi-isomorphism})=\text{isomorphism}$
\item[2)] For all functors $F$ such that $F(\text{quasi-isomorphism})=\text{isomorphism in }\mathcal{D}$ 

\begin{center}
\begin{tikzcd}[column sep=small]
K(\mathcal{C})\arrow{rr}{Q} \arrow[dr, "F"] & &D(\mathcal{C})\arrow[dl, dashrightarrow, "\exists !"]\\
&\mathcal{D} &
\end{tikzcd}
\end{center}

we can uniquely complete the diagram such that it commutes.
\end{itemize}
In other words, $D(\mathcal{C})$ is the localization of $K(\mathcal{C})$ with respect to quasi-isomorphisms (more on this later).

Moreover, 

\begin{itemize}
\item[1.] $D(\mathcal{C})$ is a triangulated category
\begin{itemize}
\item additive
\item $[1]$ induced from $K(\mathcal{C})$
\item distinguished triangles are triangles in $D(\mathcal{C})$ isomorphic in $D(\mathcal{C})$ to the image of distinguished triangles in $K(\mathcal{C})$
\end{itemize}
\item[2.] Cohomology functors and truncations descend to $D(\mathcal{C})$, i.e., we get functors 

\begin{center}
\begin{tikzcd}[column sep=small]
H^n: D(\mathcal{C})\arrow{rr} \arrow[dr, leftarrow, "Q"] & &\mathcal{C} \arrow[dl, leftarrow, "H^n"]\\
&K(\mathcal{C}) &
\end{tikzcd}
\end{center}

and $\tau^{\leqslant n}: D(\mathcal{C})\rightarrow D^{-}(\mathcal{C})$, $\tau^{\geqslant n}: D(\mathcal{C})\rightarrow D^{+}(\mathcal{C})$ again by factoring the earlier $\tau^{\leqslant n}, \tau^{\geqslant n}$.
\end{itemize}
\end{defn}

\subsection{The construction of $D(\mathcal{C})$}

We have $\mathrm{ob}D(\mathcal{C})=\mathrm{ob}K(\mathcal{C})=\mathrm{ob}C(\mathcal{C})$.
For $X, Y\in D(\mathcal{C})$, $\Hom_{D(\mathcal{C})}(X, Y)=\{(s,f)\}/\sim$, where $s, f$ are maps in $K(\mathcal{C})$ 

\begin{center}
\begin{tikzcd}[column sep=small]
& X' \arrow{dl}[swap]{s} \arrow{dr}{f} & \\
X  & & Y
\end{tikzcd}
\end{center}

such that $s$ is a quasi-isomorphism ($f$ is any map in $K(\mathcal{C})$). The equivalence relationship is given by $(s, f)\sim(t, g)$ if there exists a diagram

\begin{center}
\begin{tikzcd}[column sep=small]
& & X''' \arrow{dl}[swap]{u} \arrow{dr}{h} & &\\
& X' \arrow{dl}[swap]{s} \arrow{drrr}[swap]{f} & & X'' \arrow{dr}{g}\arrow{dlll}{t} &\\
X & & & &Y
\end{tikzcd}
\end{center}

where $u$ is a quasi-isomorphism such that the triangles commute. 

There is a set-theoretic subtlety here: for general $\mathcal{C}$, $\Hom_{D(\mathcal{C})}(X, Y)$ may not be a set, but in the cases of interest to us it will be.

To define composition, we use the following property of the class of quasi-isomorphisms:

\begin{defn}
In any category $\mathcal{B}$, a localizing class of morphisms is a class $S$ of maps satisfying

\begin{itemize}
\item[1)] $S$ is closed under composition and $\mathrm{id}_X\in S$ for all $X$
\item[2)] For all $Z\xrightarrow{s\in S} Y \xleftarrow{f} X$, there exists a commutative diagram

\begin{center}
\begin{tikzcd}
W \arrow{r}{g} \arrow{d}{t} &Z \arrow{d}{s}\\
X \arrow{r}{f} &Y
\end{tikzcd}
\end{center}

with $s\in S$, and likewise

\begin{center}
\begin{tikzcd}
W \arrow[r, dashleftarrow, "g"] \arrow[d, dashleftarrow, "t"] &Z \arrow[d, leftarrow, "s"]\\
X \arrow[r, leftarrow, "f"] &Y
\end{tikzcd}
\end{center}

\item[3)] For any two maps $f, g: X\rightarrow Y$, there exists $s\in S$ such that $sf=sg \Leftrightarrow$ there exists $t\in S$ such that $ft=gt$. 
\end{itemize}
\end{defn}

Now, we use the fact that $S=\{\text{quasi-isomorphisms}\}\subset K(\mathcal{C})$ is a localizing class (this requires proof, but we omit it) to define composition in $D(\mathcal{C})$. Given maps $F$, $G$ represented by roofs

\[F=\left\lbrace\begin{tikzcd}
[column sep=small]
 & X' \arrow{dl}[swap]{s} \arrow{dr}{f} & \\
 X  & & Y
\end{tikzcd}\right. \hfill\text{ and } G=\left\lbrace\begin{tikzcd}
[column sep=small]
 & X'' \arrow{dl}[swap]{t} \arrow{dr}{g} & \\
 Y  & & Z
\end{tikzcd}\right.\]

there exists a commutative diagram (since quasi-isomorphisms are a localizing class)
\begin{center}
\begin{tikzcd}[column sep=small]
& & X''' \arrow{dl}[swap]{u \in S} \arrow{dr}{h} & &\\
& X' \arrow{dl}[swap]{s} \arrow{dr}{f} & & X'' \arrow{dr}{g}\arrow{dl}[swap]{t} &\\
X & &Y & &Z.
\end{tikzcd}
\end{center}
 
Then $G\circ F\in\Hom_{D(\mathcal{C})}(X, Z)$ is represented by the roof  

\begin{center}
\begin{tikzcd}[column sep=small]
 & X''' \arrow{dl}[swap]{s \circ u} \arrow{dr}{g\circ h} & \\
 X  & & Z 
\end{tikzcd}
\end{center}

\begin{rmk}
For any category $\mathcal{B}$ and localizing class $S$ of morphisms, we can (modulo set-theoretic difficulties! we need some statement like ``all morphisms are equivalent to those defined using only a \textit{set} $S$'') define $\mathcal{B}[S^{-1}]$ by the same formulas. This comes with a canonical (localization) functor $Q \colon \mathcal{B} \to \mathcal{B}[S^{-1}]$ satisfying the universal property that the diagram

\begin{center}
\begin{tikzcd}[column sep=small]
\mathcal{B}\arrow{rr}{F} \arrow[dr, rightarrow, "Q"] & &\mathcal{D} \arrow[dl, dashleftarrow, "\exists !"]\\
&\mathcal{B}[S^{-1}] &
\end{tikzcd}
\end{center}

can be uniquely completed for any functor $F$ such that $F(S)\subset\text{isomorphisms in }\mathcal{D}$.
\end{rmk}

\subsection{Truncation structure on $D(\mathcal{C})$ and $t$-structures}

\begin{defn}
Let $\mathcal{C}$ be any triangulated category. A $t$-structure on $\mathcal{C}$ is a pair $(\mathcal{C}^{\leqslant 0}, \mathcal{C}^{\geqslant 0})$ of full subcategories of $\mathcal{C}$ satisfying the following properties: 

Set $\mathcal{C}^{\leqslant 0}[n]:= \mathcal{C}^{\leqslant -n}$ and $\mathcal{C}^{\geqslant 0}[n]:= \mathcal{C}^{\geqslant -n}$
\begin{itemize}
\item[i)] $\mathcal{C}^{\leqslant -1}\subseteq \mathcal{C}^{\leqslant 0}$ and $\mathcal{C}^{\geqslant 1}\subseteq \mathcal{C}^{\geqslant 0}$
\item[ii)] $\Hom_{\mathcal{C}}(\mathcal{C}^{\leqslant 0}, \mathcal{C}^{\geqslant 1})=0$
\item[iii)] For all $X\in\mathcal{C}$, there exists a distinguished triangle $X_{\leqslant 0}\rightarrow X\rightarrow X_{\geqslant 1}\rightarrow X_{\leqslant 0}[1]$ with $X_{\leqslant 0}\in \mathcal{C}^{\leqslant 0}$ and $X_{\geqslant 1}\in \mathcal{C}^{\geqslant 1}$. 
\end{itemize}
\end{defn}

\begin{prop}
For an abelian category $\mathcal{A}$ and $\mathcal{C}=D(\mathcal{A})$, set

\begin{align*}
\mathcal{C}^{\leqslant 0}&=\{\text{full subcategory of } D(\mathcal{A})\text{ of complexes } X \text{ such that } H^nX=0 \forall n>0\}\\
\mathcal{C}^{\geqslant 0}&=\{\text{full subcategory of } D(\mathcal{A})\text{ of complexes } X \text{ such that } H^nX=0 \forall n<0\}
\end{align*}
Then $(\mathcal{C}^{\leqslant 0}, \mathcal{C}^{\geqslant 0})$ is a $t$-structure on $D(\mathcal{A})$.
\end{prop}

\begin{proof}
\
\begin{itemize}
\item[i)] obvious
\item[iii)] In $C(\mathcal{A})$ we can form  $\mathrm{coker}(\tau^{\leqslant 0}X\rightarrow X)$. This cokernel is quasi-isomorphic to $\tau^{\geqslant 1}X$. Use the fact that short exact sequences of complexes yield a distinguished triangle in $D(\mathcal{A})$.
\item[ii)] interesting: see subsequent discussion for the proof.
\end{itemize}
\end{proof}

We will expand on this point (ii):
\
\begin{defn}\label{ext}
For all $X, Y \in D(\mathcal{A})$, define $\mathrm{Ext}^i_\mathcal{A}(X, Y)=\Hom_{D(\mathcal{A})}(X, Y[i])$.
\end{defn}

\begin{lem}
Given $X, Y\in D(\mathcal{A})$ and $a, b\in \mathbb{Z}$ such that $H^i(X)=0$ for $i>a$ (i.e. $X\in D(\mathcal{A})^{\leqslant a}$) and $H^j(Y)=0$ for $j<b$ (i.e. $Y\in D(\mathcal{A})^{\geqslant b}$). Then $\mathrm{Ext}^n_\mathcal{A}(X, Y)=0$ for $n<b-a$ and $\mathrm{Ext}^{b-a}_\mathcal{A}(X, Y)=\Hom_\mathcal{A}(H^a(X), H^b(Y))$.
\end{lem}

\begin{proof}
By assumption, $Y\rightarrow \tau^{\geqslant b}Y$ is a quasi-isomorphism, so we can replace $Y$ by a complex that is zero in degrees $< b$. Also $\tau^{\leqslant a}X\rightarrow X$ is a quasi-isomorphism, so we can replace $X$ by a complex that is zero in degrees $> a$. Now any map $X\rightarrow Y[n]$ in $D(\mathcal{A})$ can be represented by

\begin{center}
\begin{tikzcd}[column sep=small]
 & L \arrow{dl}[swap]{s} \arrow{dr}{f} & \\
 X  & & Y[n] 
\end{tikzcd}
\end{center}

where $s$ is a quasi-isomorphism. We can assume $L^i=0$ for $i>a$. So $f^i:L^i\rightarrow Y^{n+i}$ and claim this is zero for $n<b-a$. If $i>a$, then $L^i=0$ and we obtain the result. If $i\leqslant a$, then $n+i\leqslant n+a< b$ so $Y^{n+i}=0$ and we obtain the result.

\begin{ex}
For $n=b-a$ the map $f$ induces and is equivalent to a map $H^a(X)\rightarrow H^b(Y)$.
\end{ex}
\end{proof}
Note that for $n>b-a$, in general we do have interesting $\mathrm{Ext}^n_\mathcal{A}$'s.
\begin{rmk}
 Definition \ref{ext} gives us a definition of Ext groups even for abelian categories not having enough injectives. If $\mathcal{A}$ has enough injectives, then we also have the classical definition of $\mathrm{Ext}^n(X, Y)$ for $X, Y\in\mathcal{A}$ as $n^{\text{th}}$ derived functor of $\Hom(X,\cdot)$ and in this setting

\[\underbrace{\mathrm{Ext}_\mathcal{A}^n\overbrace{(X, Y)}^{\substack{\text{objects of}\\ \text{$\mathcal{A}$ placed}\\ \text{in degree 0}}}}_{D(\mathcal{A}) \text{ definition}}\simeq \underbrace{\mathrm{Ext}^n(X, Y)}_{\text{classical definition}}\]

We can check this via the universal $\delta$-functor formalism: for $n=0$, both sides are $\Hom_\mathcal{A}(X, Y)$ and so it suffices to show both families of higher Ext's are universal $\delta$-functors. We know this for the ``classical'' $\mathrm{Ext}$-groups, so we just have to check that $\mathrm{Ext}_\mathcal{A}^n(X, \cdot)$ is effaceable for all $n>0$. For this (since $\mathcal{A}$ has enough injectives) it is enough to show $\mathrm{Ext}^n_\mathcal{A}(X, I)=0$ for all $n>0$ where $I$ is an injective, i.e., we must show

\[\Hom_{D(\mathcal{A})}(X, I[n])=0\]

for all $n>0$. We'll show much more in the following lemma and theorem.
\end{rmk}

\begin{lem}\label{maptoinj}
For $X\in K^+(\mathcal{A})$, $I$ a bounded below complex of injectives $\in K^+(\text{injective objects})$, $\Hom_{K(\mathcal{A})}(X, I)\rightarrow \Hom_{D(\mathcal{A})}(X, I)$ is an isomorphism.

In particular, for $X\in\mathcal{A}$, $I\in\mathcal{A}$, $n>0$.

\[\underbrace{\Hom_{K(\mathcal{A})}(X, I[n])}_{\substack{\text{$=0$ (for degree reasons)}\\ \text{$I[n]$ concentrated in degree $-n$,}\\ \text{so no maps in $C(\mathcal{A})$}}}=\Hom_{D(\mathcal{A})}(X, I[n])\]
\end{lem}

We will see this in the course of proving the following theorem:

\begin{thm}
Let $\mathcal{A}$ be an abelian category with enough injectives. Let $\mathcal{I}=$ full subcategory consisting of injective objects. Then the natural functor

\[K^+(\mathcal{I})\rightarrow D^+(\mathcal{A})\]

is an equivalence.
\end{thm}

\begin{proof}
Essential surjectivity follows from $\mathcal{A}$ having enough injectives. Hence, any object of $D^+(\mathcal{A})$ is quasi-isomorphic to a complex of injectives.

For full faithfulness, we described maps $X\rightarrow Y$ in $D^+\mathcal{A}$ as equivalence classes of 

\begin{center}
\begin{tikzcd}[column sep=small]
 & X' \arrow{dl}[swap]{s} \arrow{dr}{f} & \\
 X  & & Y 
\end{tikzcd}
\end{center}

where $s$ is a quasi-isomorphism and $f$ is any map in $K(\mathcal{A})$. Since quasi-isomorphisms form a localizing class, we can instead take equivalence classes of

\begin{center}
\begin{tikzcd}[column sep=small]
 & X' \arrow[dl, leftarrow, swap, "f"] \arrow[dr, leftarrow, "s"] & \\
 X  & & Y 
\end{tikzcd}
\end{center}
 
Now suppose we have $X, Y\in K^+\mathcal{I}$.

We will check that any pair $(f, s), (g, t)$ of maps between $X$ and $Y$ that become equivalent in $D^+\mathcal{A}$ are already equivalent in $K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]$; the argument that we are about to give easily adapts to prove Lemma \ref{maptoinj} as well, and one then deduces $K^+\mathcal{I} \xrightarrow{\sim} K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]$ to complete the proof of the theorem (these final details are left as an exercise).

The key point will be the following assertion, whose proof is postponed until the end of the argument:
\begin{itemize}
\item[(*)] For all $I \in K^+(\mathcal{I}$, $X \in K^+(\mathcal{A})$, if $s \colon I \to X$ is a quasi-isomorphism, 
then there exists $t \colon X \to I$ such that $t \circ s= \mathrm{id}_{I} \in K^+(\mathcal{I})$.
\end{itemize}

Suppose there exists $X'''\in D^+\mathcal{A}$ and maps $h, u\in K^+\mathcal{A}$ with $u$ a quasi-isomorphism such that the following diagram commutes

\begin{center}
\begin{tikzcd}[column sep=small]
& & X''' \arrow[dl, leftarrow, swap, "h"] \arrow[dr, leftarrow, "u"] & &\\
& X' \arrow[dl, leftarrow, swap, "f"] \arrow[drrr, leftarrow, swap, "s"] & & X'' \arrow[dr, leftarrow, "t"]\arrow[dlll, leftarrow, "g"] &\\
X & & & &Y
\end{tikzcd}
\end{center}

%Use (*) so that given any bounded below complex of injectives $I$ and any $X$, for any quasi-isomorphism $I\xrightarrow{s} X$, there exists $X\xrightarrow{t} I$ such that $t\circ s\simeq_{\text{homotopic}}\mathrm{id}_I$.

Apply (*) to \begin{tikzcd}
Y \arrow[rr, bend right=25, swap, "\sim \mathrm{id}_Y"] \arrow{r}{u\circ t} & X''' \arrow[r, dashed, "i"] &Y 
\end{tikzcd}

Replace the previous roof diagram with its composite with $X'''\xrightarrow{i} Y$ to conclude $(f, s)$ and $(g, t)$ are equivalent in $K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]$. This shows that 

\[K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]\rightarrow D^+\mathcal{A}\] 

is faithful.

Now, we need to show it is full. Given $X, Y\in K^+\mathcal{I}$ and a map between them in $D^+\mathcal{A}$

\begin{center}
\begin{tikzcd}
& X'\arrow[dl, leftarrow, swap, "f"] \arrow[dr, leftarrow, "s"]&\\
X & &Y
\end{tikzcd}
\end{center} 

for $X'\in D^+\mathcal{A}$.

Apply (*) again: \begin{tikzcd}
Y \arrow[rr, bend right=25, swap, "\simeq \mathrm{id}_Y"] \arrow{r}{s} & X' \arrow[r, "\exists t"] &Y 
\end{tikzcd}

Then $(t\circ f, t\circ s=\mathrm{id}_Y)$ is a map $X\rightarrow Y$ in $K^+\mathcal{I}$ and it is equivalent in $D^+\mathcal{A}$ to $(f, s)$ via

\begin{center}
\begin{tikzcd}[column sep=small]
& & Y \arrow[dl, equal] \arrow[dr, leftarrow, "t"] & &\\
& Y \arrow[dl, leftarrow, swap, "t\circ f"] \arrow[drrr, equal] & & X'' \arrow[dr, leftarrow, "s"]\arrow[dlll, leftarrow, "f"] &\\
X & & & &Y
\end{tikzcd}
\end{center}

Thus $K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]\rightarrow D^+\mathcal{A}$ is fully faithful. As noted above, we are done since (by Lemma \ref{maptoinj})

\[K^+\mathcal{I}\rightarrow K^+\mathcal{I}[(\text{quasi-isomorphisms})^{-1}]\] 

is an isomorphisms of categories.
\end{proof}

\begin{ex}
Use a similar argument to the above to prove Lemma \ref{maptoinj}:
If $I\in K^+(\mathcal{I})$, then for any $X\in D^+\mathcal{A}$

\[\Hom_{K(\mathcal{A})}(X, I)\rightarrow \Hom_{D(\mathcal{A})}(X, I)\]

is an isomorphism.

Consider $g^{-1}u:X\xrightarrow{u} Z \xleftarrow{g} Y$ is equivalent and $s: Z\rightarrow Y$, so $u$ is equivalent to $(sg)g^{-1}u:X\rightarrow Y$. Conversely, if $f, f': X\rightarrow Y$ in $K(\mathcal{A})$ become identified in $D(\mathcal{A})$ then $tf=tf'$ for some quasi-isomorphism $t:Y\rightarrow Z$, hence $f=stf=stf'=f'$.

\end{ex}
\begin{proof} of (*)\\
$I\xrightarrow{s}X$ a quasi-isomorphisms with $I\in K^+\mathcal{I}$ and $X\in D^+\mathcal{A}$. Take the cone, so 

\[I\xrightarrow{s} X\xrightarrow{i(s)} C(s)\xrightarrow{\pi(s)} I[1]\]

is a distinguished triangle in $K^+\mathcal{A}$. Since $s$ is a quasi-isomorphism, $C(s)$ is acyclic (i.e., $H^n(C(s))=0$ for all $n$) by the long exact sequence in $H^n$.

Apply $\Hom(\cdot, I)$ to this distinguished triangle to get the following long exact sequence

\[\cdots\rightarrow \Hom(C(s), I)\rightarrow \Hom(X, I)\rightarrow \Hom(I, I)\rightarrow \Hom(C(s)[-1], I)\rightarrow \cdots\]

(this long exact sequence of $\Hom$ exists for all distinguished triangles in a triangulated category).

To get (*), it suffices to show $\Hom(C(s)[-1], I)=0$.

We claim that if $C$ is any acyclic bounded below complex and $I\in K^+\mathcal{I}$, then $\Hom_{K(\mathcal{A})}(C, I)=0$.

Since $C, I$ are bounded below, up to a shift we may assume that both are zero in degree $<0$, so we have

\begin{center}
\begin{tikzcd}
0 \arrow{r} &C^0 \arrow{r}{d^0_C} \arrow{d}[swap]{\pi^0} &C^1 \arrow{r}{d^1_C} \arrow{d}{\pi^1} \arrow[dl, dashed, "\exists k^0"] &C^2 \arrow{r} \arrow{d}{\pi^2} &\cdots\\
0\arrow{r} &I^0 \arrow{r} &I^1 \arrow{r} &I^2 \arrow{r} &\cdots
\end{tikzcd}
\end{center} 

since $C$ is acyclic, then $d^0_C$ is injective so there exists $k^0$ since $I^0$ is injective.

To get the map $k^1:C^2\rightarrow I^1$, note $(\pi^1-d^0_I\underbrace{k^0)\circ d^0_C}_{\pi^0}:C^0\rightarrow I^1$ is zero since $\pi$ is a map of complexes. So 

\begin{center}
\begin{tikzcd}
0 \arrow{r} &\mathrm{coker}(d^0_C) \arrow{r}{d^1_C} \arrow{d}[swap]{\pi^1-d^0_Ik^0} &C^2 \arrow[dl, dashed, "\exists k^1"]\\
 &I^1 &
\end{tikzcd}
\end{center}

such that $k^1\circ d^1_C=\pi^1-d^0_I\circ k^0$.

Iterate this construction, and the resulting chain-homotopy $k$ shows that $\pi$ is nullhomotopic.


\end{proof}








