\section{CW-complexes}

\begin{cislo}\label{CWconstruction}{\bf Constructive definition of
CW-complexes.} \emph{CW-complexes}\index{CW-complex} are all the
spaces which can be obtained by the following construction:
\begin{enumerate}
\item We start with a discrete space $X^0$. Single points of $X^0$
are called 0-dimensional cells.
\item Suppose that we have already constructed $X^{n-1}$.
For every element $\alpha$ of an index set $J_n$ take a map
$f_{\alpha}:S^{n-1}=\partial D^n_{\alpha}\to X^{n-1}$ and put
$$X^n=\bigcup_{\alpha}\left(X^{n-1}\cup_{f_{\alpha}}
D_{\alpha}^n\right ).$$
Interiors of discs $D_{\alpha}^n$ are called $n$-dimensional
cells and denoted by $e_{\alpha}^n$.
\item We can stop our construction for some $n$ and put $X=X^n$ or
we can proceed with $n$ to infinity and put
$$X=\bigcup_{n=0}^{\infty}X^n.$$
In the latter case $X$ is equipped with inductive topology
which means that $A\subseteq X$ is closed (open) iff $A\cap X^n$
is closed (open) in $X^n$ for every $n$.
\end{enumerate}

\begin{example} The sphere $S^n$ is a CW-complex with one cell
$e^0$ in dimension $0$, one cell $e^n$ in dimension $n$
and the constant attaching map $f:S^{n-1}\to e^0$.
\end{example}

\begin{example} The real projective space $\mathbb{RP}^n$
is the space of $1$-dimensional linear subspaces in $\mathbb
R^{n+1}$. It is homeomorhic to
$$S^n/(v\simeq -v)\cong D^n/(w\simeq-w),\quad \text{ for  }w\in \partial D^n=S^{n-1}.$$
However,
$S^{n-1}/(w\simeq-w)\cong\mathbb{RP}^{n-1}$. So $\mathbb{RP}^n$
arises from $\mathbb{RP}^{n-1}$ by attaching  one
$n$-dimensional cell using the projection $f:S^{n-1}\to
\mathbb{RP}^{n-1}$. Hence $\mathbb{RP}^{n}$ is a CW-complex with
one cell in every dimension from $0$ to $n$.

We define
$\mathbb{RP^{\infty}}=\bigcup_{n=1}^{\infty}\mathbb{RP}^n$.
It is again a CW-complex.
\end{example}

\begin{example} The complex projective space $\mathbb{CP}^n$
is the space of complex $1$-dimensional linear subspaces in $\mathbb
C^{n+1}$. It is homeomorhic to
\begin{align*}
S^{2n+1}/(v\simeq \lambda v)
&\cong\{(w,\sqrt{1-\vert w\vert^2})\in\mathbb C^{n+1};\ \Vert
w\Vert\le 1\}/((w,0)\simeq\lambda (w,0),\ \Vert w\Vert =1)\\
&\cong D^{2n}/(w\simeq\lambda w;\ w\in\partial D^{2n})
\end{align*}
for all $\lambda\in \mathbb C$, $\vert \lambda\vert=1$. However,
$\partial D^{2n}/(w\simeq\lambda w)\cong\mathbb{CP}^{n-1}$. So
$\mathbb{CP}^n$
arises from $\mathbb{CP}^{n-1}$ by attaching one
$2n$-dimensional cell using the projection $f:S^{2n-1}=\partial
D^{2n}\to
\mathbb{CP}^{n-1}$. Hence $\mathbb{CP}^{n}$ is a CW-complex with
one cell in every even dimension from $0$ to $2n$.

Define
$\mathbb{CP^{\infty}}=\bigcup_{n=1}^{\infty}\mathbb{CP}^n$.
It is again a CW-complex.
\end{example}
\end{cislo}

\begin{cislo}\label{CWdef}{\bf Another  definition of CW-complexes.}
Sometimes it is advantageous to be able to describe CW-complexes
by their properties. We carry it out in this paragraph. Then
we show that the both definitions of CW-complexes are equivalent.

\begin{defin*}\label{CW} A \emph{cell complex}\index{cell complex} is a
Hausdorff topological space $X$ such that
\begin{enumerate}
\item $X$ as a set is a disjoint union of cells $e_{\alpha}$
$$X=\bigcup_{\alpha\in J}e_{\alpha}.$$
\item For every cell $e_{\alpha}$ there is a number, called
dimension.
$$X^n=\bigcup_{\dim e_{\alpha}\le n}e_{\alpha}$$
is the $n$-skeleton of $X$.
\item Cells of dimension 0 are points. For every cell of
dimension $\ge 1$ there is a characteristic map
$$\varphi_{\alpha}:(D^n,S^{n-1})\to (X,X^{n-1})$$
which is a homeomorphism of $\inte D^n$ onto $e_{\alpha}$.
\end{enumerate}

The \emph{cell subcomplex}\index{cell subcomplex} $Y$ of a cell complex $X$ is
a union $Y=\bigcup_{\alpha\in K}e_{\alpha}$ , $K\subseteq J$, which is
a cell complex with the same characterictic maps as the
complex $X$.

A \emph{CW-complex}\index{CW-complex} is a cell complex satisfying  the
following conditions:
\begin{enumerate}
\item[(C)] Closure finite property. The closure of every cell belongs to a
finite subcomplex, i.~e. subcomplex consisting only from a finite
number of cells.
\item[(W)] Weak topology property. $F$ is closed in $X$ if and
only if $F\cap \bar e_{\alpha}$ is closed for every $\alpha$.
\end{enumerate}
\end{defin*}
\end{cislo}

\begin{example*} Examples of cell complexes which are not
CW-complexes:
\begin{enumerate}
\item $S^2$ where every point is 0-cell. It does not satisfy
property (W).
\item $D^3$ with cells $e^3=\inte B^3$, $e_{x}^0=\{x\}$ for all
$x\in S^2$. It does not satisfy (C).
\item $X=\{1/n;\ n\ge 1\}\cup\{0\}\subset \mathbb R$. It does
not satisfy (W).
\item $X=\bigcup_{n=1}^{\infty}\{x\in\mathbb R^2;\ \Vert
x-(1/n,0)\Vert=1/n\}\subset\mathbb R^2$. If it were a CW-complex,
the set $\{(1/n,0)\in\mathbb R^2;\ n\ge 1\}$ would be closed in $X$, and
consequently in $\mathbb R^2$.
\end{enumerate}
\end{example*}

\begin{cislo}\label{CWeq}{\bf Equivalence of definitions.} 

\begin{prop*} The definitions
\ref{CWconstruction} and \ref{CW} of CW-complexes are equivalent.
\end{prop*}

\begin{proof} We will show that a space $X$ constructed according
to \ref{CWconstruction} satisfies definition \ref{CW}. The proof
in the opposite direction is left as an exercise to the reader.

The cells of dimension 0 are points of $X^0$. The cells of
dimension $n$ are interiors of discs $D_{\alpha}^n$ attached to
$X^{n-1}$ with charakteristic maps
$$\varphi_{\alpha}:(D_{\alpha}^n,S^{n-1}_{\alpha})\to
(X^{n-1}\cup_{f_{\alpha}}D_{\alpha}^n,X^{n-1})$$
induced by identity on $D_{\alpha}^n$. So $X$ is a cell complex.
From the construction \ref{CWconstruction} it follows that $X$
satisfies property (W).
It remains to prove property (C). We will carry it out
by induction.

Let $n=0$. Then $\overline{e_{\alpha}^0}=e_{\alpha}^0$.

Let (C) holds for all cells of dimension $\le n-1$.
$\overline{e_{\alpha}^n}$ is a compact set (since it is an image of
$D_{\alpha}^n$). Its boundary $\partial e_{\alpha}^n$ is compact in
$X^{n-1}$. Consider the set of indices
$$K=\{\beta\in J;\ \partial e_{\alpha}^n\cap
e_{\beta}\ne\emptyset\}.$$
If we show that $K$ is finite, from the inductive assumption we
get that $\bar e_{\alpha}^n$ lies in a finite subcomplex which is
a union of finite subcomplexes for $\bar e_{\beta}$, $\beta\in
K$.

Choosing one point from every intersection $\partial
e_{\alpha}^n\cap e_{\beta}$, $\beta\in K$ we form a set $A$.
$A$ is closed since any intersection with a cell is empty or
a onepoint set. Simultaneously, it is open, since every its
element $a$ forms an open subset (for $A-\{a\}$ is closed).
So $A$ is a discrete subset in the compact set $\partial
e_{\alpha}^n$, consequently, it is finite.
\end{proof}
\end{cislo}

\begin{cislo}\label{CWcompact} {\bf Compact sets in CW complexes.} 
\begin{lemma*} Let $X$ be a
CW-complex. Then any compact set
$A\subseteq X$ lies in a finite subcomplex, particularly, there is
$n$ such that $A\subseteq X^{n}$.
\end{lemma*}

\begin{proof} Consider the set of indices
$$K=\{\beta\in J;\ A\cap e_{\beta}\ne\emptyset\}.$$
Similarly as in \ref{CWeq} we will show that $K$ is a finite set. Then
$A\subseteq\bigcup_{\beta\in K}\bar e_{\beta}$ and every
$\bar e_{\beta}$ lies in a finite subcomplexes. Hence $A$
itself is a subset of a finite subcomplex.
\end{proof}
\end{cislo}

\begin{cislo}\label{CWmaps}{\bf Cellular maps.} Let $X$ and $Y$
be CW-complexes. A map $f:X\to Y$ is called a \emph{cellular
map}\index{cellular map} if $f(X^n)\subseteq Y^n$ for all $n$.
In Section 5 %\ref{HCWca} 
we will prove  that every map
$g:X\to Y$ is homotopic to a cellular map $f:X\to Y$.
If moreover, $g$ restricted to a subcomplex $A\subset X$ is already
cellular, $f$ can be chosen in such a way that $f=g$ on $A$.
\end{cislo}

\begin{cislo}{\bf Spaces homotopy equivalent to CW-complexes.} One can show
that every open subset of $\mathbb R^n$ is a CW-complex. In [Hatcher], %\cite{Ha},
 Theorem A.11, it is proved that every retract of a
CW-complex is homotopy equivalent to a CW-complex. These two
facts imply that every compact manifold with or without boundary
is homotopy equivalent to a CW-complex. (See [Hatcher], %\cite{Ha}, 
 Corollary A.12.)
\end{cislo}

\begin{cislo}\label{CWhep}{\bf CW complexes and HEP.} The most important result of this 
section is the following theorem:
 
\begin{thm*} Let $A$ be a subcomplex
of a CW-complex $X$. Then the pair $(X,A)$ has the homotopy
extension property.
\end{thm*}

\begin{proof} According to the last theorem in Section 1 it is sufficient to prove that
$X\times\{0\}\cup A\times I$ is a retract of $X\times I$. We will prove that it is 
even a deformation retract. There is a retraction $r_n:D^n\times I\to
D^n\times\{0\}\cup S^{n-1}\times I$. (See Section 1.) Then $h_n:D^n\times I\times I\to D^n\times I$
defined by 
$$h_n(x,s,t)=(1-t)(x,s)+tr_n(x,s)$$
is a deformation retraction, i.e. a homotopy between $\id$ and $r_n$. 

Put $Y^{-1}=A$, $Y^{n}=X^{n}\cup A$.  Using $h_n$ we can define
a deformation retraction $H_n:Y^{n}\times I\times I \to Y^n\times I$ 
for the retract $Y^n\times \{0\}\cup Y^{n-1}\times I$
of $Y^n\times I$. Now define the deformation retraction $H:
X\times I\times I\to X\times I$ for the retract $X\times\{0\}\cup A\times I$ 
succesively on the subspaces $X\times \{0\}\times I\cup Y^n\times I\times I$
with values in $X\times \{0\}\cup Y^n\times I$. For
$n=0$ put
\begin{align*}
H(x,s,t)&=(x,s) \qquad \text{for }(x,s)\in X\times\{0\} \text{ or } t\in [0,1/2],\\
H(x,s,t)&=H_0(x,s,2(t-1/2)) \quad \text{for }x\in Y^0 \text{ and } t\in [1/2,1].
\end{align*}
Suppose that we have already defined $H$ on $X\times \{0\}\cup Y^{n-1}\times I$.
On $X\times \{0\}\cup Y^n\times I$ we put
\begin{align*}
H(x,s,t)&=(x,s) \qquad \text{for }(x,s)\in X\times\{0\} \text{ or } t\in [0,1/2^{n+1}],\\
H(x,s,t)&=H_n(x,s,2^{n+1}(t-1/2^{n+1})) \quad \text{for }x\in Y^n \text{ and } t\in [1/2^{n+1},1/2^n],\\
H(x,s,t)&=H(H(x,s,1/2^n),t) \quad \text{ for }x\in Y^n \text{ and } t\in [1/2^{n},1].
\end{align*} 
$H:X\times I\times I\to X\times I$ is continuous since so are its restrictions
on $X\times \{0\}\times I\cup Y^n\times I\times I$ and the space $X\times I\times I$
is a direct limit of the subspaces $X\times \{0\}\times I\cup Y^n\times I\times I$.

%vlozeno 20130304
\begin{figure}[htb]
  \centering
  \def\svgwidth{400pt}
  \input{img/02_fig-5.pdf_tex}
  \caption{Image of H depending on t}
\end{figure}
%vlozeno 20130304

\end{proof}
\end{cislo}

\begin{cislo}\label{CW1crit}{\bf First criterion for homotopy
equivalence.}  

\begin{prop*}Suppose that a pair $(X,A)$ has the homotopy
extension property  and that $A$ is contractible (in $A$).
Then the canonical projection  $q:X\to X/A$ is a homotopy
equivalence.
\end{prop*}

\begin{proof} Since $A$ is contractible, there is a homotopy
$h:A\times I\to A$ between $\id_A$ and constant map. This
homotopy together with $\id_X:X\to X$ can be extended to a homotopy
$f:X\times I\to X$. Since $f(A,t)\subseteq A$ for all $t\in I$,
there is a homotopy $\tilde f:X/A\times I\to X/A$ such that
the diagram
$$
\xymatrix{
X\times I \ar[r]^f \ar[d]_q& X \ar[d]^q \\
X/A\times I \ar[r]_{\tilde f}  & X/A
}
$$
commutes. Define $g:X/A\to X$ by $g([x])=f(x,1)$. Then
$\id_X\sim g\circ q$ via the homotopy $f$ and $\id_{X/A}\sim
q\circ g$ via the homotopy $\tilde f$. Hence $X$ is homotopy
equivalent to $X/A$.
\end{proof}

\begin{ex} Using the previous criterion show that
$S^2/S^0\sim S^2\lor S^1$.
\end{ex}

\begin{ex} Using the previous criterion show that
the suspension and the reduced suspension of a CW-complex are homotopy
equivalent.
\end{ex}

\end{cislo}

\begin{cislo}\label{CW2crit} {\bf Second criterion for homotopy
equivalence.} 

\begin{prop*} Let $(X,A)$ be a pair of CW-complexes and let
$Y$ be a space. Suppose that $f,g:A\to Y$ are homotopic maps.
Then $X\cup_{f}Y$ and $X\cup_{g}Y$ are homotopy equivalent.
\end{prop*}

\begin{proof} Let $F:A\times I\to Y$ be a homotopy between
$f$ and $g$. We will show that $X\cup_{f}Y$ and $X\cup_{g}Y$
are both deformation retracts of $(X\times I)\cup_{F}Y$.
Consequently, they have to be homotopy equivalent.

We construct a deformation retraction in two steps.
\begin{enumerate}
\item $(X\times\{0\})\cup_f Y$ is a deformation retract of
$(X\times\{0\}\cup A\times I)\cup_F Y$.
\item $(X\times\{0\}\cup A\times I)\cup_F Y$ is a deformation
retract of $(X\times I)\cup_F Y$.
\end{enumerate}
\end{proof}

\begin{ex*} Let $(X,A)$ be a pair of CW-complexes. Suppose
that $A$ is a contractible in $X$, i.~e. there is a homotopy
$F:A\to X$ between $\id_X$ and $\operatorname{const}$. Using the first
criterion show that $X/A\cong X\cup CA/CA\sim X\cup CA$.
Using the second criterion prove that $X\cup CA\sim X\lor SA$.
Then
$$X/A\sim X\lor SA.$$
Apply it to compute $S^n/S^i$, $i<n$.
\end{ex*}
\end{cislo}