% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,11pt]{report}

\usepackage[top=37mm,bottom=37mm,left=27mm,right=27mm]{geometry}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}

%%  for a long time these were red and blue by default,
%%  now black, but keep variables to overwrite
\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}


\usepackage{fancyvrb}

\usepackage{mathptmx,helvet}
\usepackage[T1]{fontenc}
\usepackage{textcomp}


\usepackage[
            pdftex=true,
            bookmarks=true,        
            a4paper=true,
            pdftitle={Written with GAPDoc},
            pdfcreator={LaTeX with hyperref package / GAPDoc},
            colorlinks=true,
            backref=page,
            breaklinks=true,
            linkcolor=linkColor,
            citecolor=citeColor,
            filecolor=fileColor,
            urlcolor=urlColor,
            pdfpagemode={UseNone}, 
           ]{hyperref}

\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
%% were never documented, give conflicts with some additional packages

\newcommand{\GAP}{\textsf{GAP}}

%% nicer description environments, allows long labels
\usepackage{enumitem}
\setdescription{style=nextline}

%% depth of toc
\setcounter{tocdepth}{1}





%% command for ColorPrompt style examples
\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}


\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\mbox{}\vfill

\begin{center}{\maintitlesize \textbf{A short HAP tutorial\mbox{}}}\\
\vfill

\hypersetup{pdftitle=A short HAP tutorial}
\markright{\scriptsize \mbox{}\hfill A short HAP tutorial \hfill\mbox{}}
{\Huge \textbf{(\href{../www/SideLinks/About/aboutContents.html} {A more comprehensive tutorial is available here}\\
 and\\
 \href{https://global.oup.com/academic/product/an-invitation-to-computational-homotopy-9780198832980} {A related book is available here}\\
 and\\
 \href{../www/index.html} {The \textsc{HAP} home page is here})\mbox{}}}\\
\vfill

\mbox{}\\[2cm]
{\Large \textbf{Graham Ellis\mbox{}}}\\
\hypersetup{pdfauthor=Graham Ellis}
\end{center}\vfill

\mbox{}\\
\end{titlepage}

\newpage\setcounter{page}{2}
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 1 ]}}

\tableofcontents
\newpage

 
\chapter{\textcolor{Chapter }{Simplicial complexes \& CW complexes}}\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X7E5EA9587D4BCFB4}{}
{
 
\section{\textcolor{Chapter }{The Klein bottle as a simplicial complex}}\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X85691C6980034524}{}
{
 

  

 The following example constructs the Klein bottle as a simplicial complex $K$ on $9$ vertices, and then constructs the cellular chain complex $C_\ast=C_\ast(K)$ from which the integral homology groups $H_1(K,\mathbb Z)=\mathbb Z_2\oplus \mathbb Z$, $H_2(K,\mathbb Z)=0$ are computed. The chain complex $D_\ast=C_\ast \otimes_{\mathbb Z} \mathbb Z_2$ is also constructed and used to compute the mod-$2$ homology vector spaces $H_1(K,\mathbb Z_2)=\mathbb Z_2\oplus \mathbb Z_2$, $H_2(K,\mathbb Z)=\mathbb Z_2$. Finally, a presentation $\pi_1(K) = \langle x,y : yxy^{-1}x\rangle$ is computed for the fundamental group of $K$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@2simplices:=|
  !gapprompt@>| !gapinput@[[1,2,5], [2,5,8], [2,3,8], [3,8,9], [1,3,9], [1,4,9],|
  !gapprompt@>| !gapinput@ [4,5,8], [4,6,8], [6,8,9], [6,7,9], [4,7,9], [4,5,7],|
  !gapprompt@>| !gapinput@ [1,4,6], [1,2,6], [2,6,7], [2,3,7], [3,5,7], [1,3,5]];;|
  !gapprompt@gap>| !gapinput@K:=SimplicialComplex(2simplices);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 2 in characteristic 0 .
  
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 2, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,2);|
  [  ]
  
  !gapprompt@gap>| !gapinput@D:=TensorWithIntegersModP(C,2);|
  Chain complex of length 2 in characteristic 2 .
  
  !gapprompt@gap>| !gapinput@Homology(D,1);|
  2
  !gapprompt@gap>| !gapinput@Homology(D,2);|
  1
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(K);|
  <fp group of size infinity on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2*f1*f2^-1*f1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Other simplicial surfaces}}\logpage{[ 1, 2, 0 ]}
\hyperdef{L}{X7B8F88487B1B766C}{}
{
 The following example constructs the real projective plane $P$, the Klein bottle $K$ and the torus $T$ as simplicial complexes, using the surface genus $g$ as input in the oriented case and $-g$ as input in the unoriented cases. It then confirms that the connected sums $M=K\#P$ and $N=T\#P$ have the same integral homology. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=ClosedSurface(-1);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(-2);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@T:=ClosedSurface(1);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@M:=ConnectedSum(K,P);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@N:=ConnectedSum(T,P);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Homology(M,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(N,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(M,1);|
  [ 2, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(N,1);|
  [ 2, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(M,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(N,2);|
  [  ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Quillen complex}}\logpage{[ 1, 3, 0 ]}
\hyperdef{L}{X80A72C347D99A58E}{}
{
 

 Given a group $G $ one can consider the partially ordered set ${\cal A}_p(G)$ of all non-trivial elementary abelian $p$-subgroups of $G$, the partial order being set inclusion. The order complex $\Delta{\cal A}_p(G)$ is a simplicial complex which is called the \emph{Quillen complex }. 

 The following example constructs the Quillen complex $\Delta{\cal A}_2(S_7)$ for the symmetric group of degree $7$ and $p=2$. This simplicial complex involves $11291$ simplices, of which $4410$ are $2$-simplices.. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=QuillenComplex(SymmetricGroup(7),2);A
  Simplicial complex of dimension 2.
  
  @gapprompt|gap>A @gapinput|Size(K);A
  11291
  
  @gapprompt|gap>A @gapinput|K!.nrSimplices(2);A
  4410
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Quillen complex as a reduced CW-complex}}\logpage{[ 1, 4, 0 ]}
\hyperdef{L}{X7C4A2B8B79950232}{}
{
 Any simplicial complex $K$ can be regarded as a regular CW complex. Different datatypes are used in \textsc{HAP} for these two notions. The following continuation of the above Quillen complex
example constructs a regular CW complex $Y$ isomorphic to (i.e. with the same face lattice as) $K=\Delta{\cal A}_2(S_7)$. An advantage to working in the category of CW complexes is that it may be
possible to find a CW complex $X$ homotopy equivalent to $Y$ but with fewer cells than $Y$. The cellular chain complex $C_\ast(X)$ of such a CW complex $X$ is computed by the following commands. From the number of free generators of $C_\ast(X)$, which correspond to the cells of $X$, we see that there is a single $0$-cell and $160$ $2$-cells. Thus the Quillen complex
\$\$\texttt{\symbol{92}}Delta\texttt{\symbol{123}}\texttt{\symbol{92}}cal
A\texttt{\symbol{125}}{\textunderscore}2(S{\textunderscore}7)
\texttt{\symbol{92}}simeq
\texttt{\symbol{92}}bigvee{\textunderscore}\texttt{\symbol{123}}1\texttt{\symbol{92}}le
i\texttt{\symbol{92}}le 160\texttt{\symbol{125}} S\texttt{\symbol{94}}2\$\$
has the homotopy type of a wedge of $160$ $2$-spheres. This homotopy equivalence is given in \cite[(15.1)]{ksontini} where it was obtained by purely theoretical methods. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);A
  Regular CW-complex of dimension 2
  
  @gapprompt|gap>A @gapinput|C:=ChainComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|C!.dimension(0);A
  1
  @gapprompt|gap>A @gapinput|C!.dimension(1);A
  0
  @gapprompt|gap>A @gapinput|C!.dimension(2);A
  160
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Simple homotopy equivalences}}\logpage{[ 1, 5, 0 ]}
\hyperdef{L}{X782AAB84799E3C44}{}
{
 

For any regular CW complex $Y$ one can look for a sequence of simple homotopy collapses $Y\searrow Y_1 \searrow Y_2 \searrow \ldots \searrow Y_N=X$ with $X$ a smaller, and typically non-regular, CW complex. Such a sequence of collapses
can be recorded using what is now known as a \emph{discrete vector field} on $Y$. The sequence can, for example, be used to produce a chain homotopy
equivalence $f\colon C_\ast Y \rightarrow C_\ast X$ and its chain homotopy inverse $g\colon C_\ast X \rightarrow C_\ast Y$. The function \texttt{ChainComplex(Y)} returns the cellular chain complex $C_\ast(X)$, wheras the function \texttt{ChainComplexOfRegularCWComplex(Y)} returns the chain complex $C_\ast(Y)$. 

 For the above Quillen complex $Y=\Delta{\cal A}_2(S_7)$ the following commands produce the chain homotopy equivalence $f\colon C_\ast Y \rightarrow C_\ast X$ and $g\colon C_\ast X \rightarrow C_\ast Y$. The number of generators of $C_\ast Y$ equals the number of cells of $Y$ in each degree, and this number is listed for each degree. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=QuillenComplex(SymmetricGroup(7),2);;A
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);;A
  @gapprompt|gap>A @gapinput|CY:=ChainComplexOfRegularCWComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|CX:=ChainComplex(Y);A
  Chain complex of length 2 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|equiv:=ChainComplexEquivalenceOfRegularCWComplex(Y);;A
  @gapprompt|gap>A @gapinput|f:=equiv[1];A
  Chain Map between complexes of length 2 . 
  
  @gapprompt|gap>A @gapinput|g:=equiv[2];A
  Chain Map between complexes of length 2 .
  
  
  @gapprompt|gap>A @gapinput|CY!.dimension(0);A
  1316
  @gapprompt|gap>A @gapinput|CY!.dimension(1);A
  5565
  @gapprompt|gap>A @gapinput|CY!.dimension(2);A
  4410
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cellular simplifications preserving homeomorphism type}}\logpage{[ 1, 6, 0 ]}
\hyperdef{L}{X80474C7885AC1578}{}
{
  

For some purposes one might need to simplify the cell structure on a regular
CW-complex $Y$ so as to obtained a homeomorphic CW-complex $W$ with fewer cells. 

The following commands load a $4$-dimensional simplicial complex $Y$ representing the K3 complex surface. Its simplicial structure is taken from \cite{spreerkhuenel} and involves $1704$ cells of various dimensions. The commands then convert the cell structure into
that of a homeomorphic regular CW-complex $W$ involving $774$ cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(SimplicialK3Surface());|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  1704
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(W);|
  774
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a CW-structure on a knot complement}}\logpage{[ 1, 7, 0 ]}
\hyperdef{L}{X7A15484C7E680AC9}{}
{
 The following commands construct the complement $M=S^3\setminus K$ of the trefoil knot $K$. This complement is returned as a $3$-manifold $M$ with regular CW-structure involving four $3$-cells. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|arc:=ArcPresentation(PureCubicalKnot(3,1));B
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  @gapprompt|gap>B @gapinput|S:=SphericalKnotComplement(arc);B
  Regular CW-complex of dimension 3
  
  @gapprompt|gap>B @gapinput|S!.nrCells(3);B
  4
  
\end{Verbatim}
 The following additional commands then show that $M$ is homotopy equivalent to a reduced CW-complex $Y$ of dimension $2$ involving one $0$-cell, two $1$-cells and one $2$-cell. The fundamental group of $Y$ is computed and used to calculate the Alexander polynomial of the trefoil
knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ContractedComplex(S);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@CriticalCells(Y);|
  [ [ 2, 1 ], [ 1, 9 ], [ 1, 11 ], [ 0, 22 ] ]
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^2-x_1+1
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a regular CW-complex by attaching cells}}\logpage{[ 1, 8, 0 ]}
\hyperdef{L}{X829793717FB6DDCE}{}
{
 

  

The following example creates the projective plane $Y$ as a regular CW-complex, and tests that it has the correct integral homology $H_0(Y,\mathbb Z)=\mathbb Z$, $H_1(Y,\mathbb Z)=\mathbb Z_2$, $H_2(Y,\mathbb Z)=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@attch:=RegularCWComplex_AttachCellDestructive;; #Function for attaching cells|
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWDiscreteSpace(3); #Discrete CW-complex consisting of points {1,2,3}|
  Regular CW-complex of dimension 0
  
  !gapprompt@gap>| !gapinput@e1:=attch(Y,1,[1,2]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e2:=attch(Y,1,[1,2]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e3:=attch(Y,1,[1,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e4:=attch(Y,1,[1,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e5:=attch(Y,1,[2,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@e6:=attch(Y,1,[2,3]);; #Attach 1-cell|
  !gapprompt@gap>| !gapinput@f1:=attch(Y,2,[e1,e3,e5]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f2:=attch(Y,2,[e2,e4,e5]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f3:=attch(Y,2,[e2,e3,e6]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@f4:=attch(Y,2,[e1,e4,e6]);; #Attach 2-cell|
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [  ]`
  
\end{Verbatim}
 

The following example creates a 2-complex $K$ corresponding to the group presentation 

$G=\langle x,y,z\ :\ xyx^{-1}y^{-1}=1, yzy^{-1}z^{-1}=1,
zxz^{-1}x^{-1}=1\rangle$. 

The complex is shown to have the correct fundamental group and homology (since
it is the 2-skeleton of the 3-torus $S^1\times S^1\times S^1$). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S1:=RegularCWSphere(1);;|
  !gapprompt@gap>| !gapinput@W:=WedgeSum(S1,S1,S1);;|
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupWithPathReps(W);; x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@K:=RegularCWComplexWithAttachedRelatorCells(W,F,Comm(x,y),Comm(y,z),Comm(x,z));|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(K);|
  <fp group on the generators [ f1, f2, f3 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2^-1*f1*f2*f1^-1, f1^-1*f3*f1*f3^-1, f2^-1*f3*f2*f3^-1 ]
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(K,2);|
  [ 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a regular CW-complex from its face lattice}}\logpage{[ 1, 9, 0 ]}
\hyperdef{L}{X7B7354E68025FC92}{}
{
 

  

The following example creats a $2$-dimensional annulus $A$ as a regular CW-complex, and testing that it has the correct integral homology $H_0(A,\mathbb Z)=\mathbb Z$, $H_1(A,\mathbb Z)=\mathbb Z$, $H_2(A,\mathbb Z)=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@FL:=[];; #The face lattice|
  !gapprompt@gap>| !gapinput@FL[1]:=[[1,0],[1,0],[1,0],[1,0]];;|
  !gapprompt@gap>| !gapinput@FL[2]:=[[2,1,2],[2,3,4],[2,1,4],[2,2,3],[2,1,4],[2,2,3]];;|
  !gapprompt@gap>| !gapinput@FL[3]:=[[4,1,2,3,4],[4,1,2,5,6]];;|
  !gapprompt@gap>| !gapinput@FL[4]:=[];;|
  !gapprompt@gap>| !gapinput@A:=RegularCWComplex(FL);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Homology(A,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(A,1);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(A,2);|
  [  ]
  
  
\end{Verbatim}
 

Next we construct the direct product $Y=A\times A\times A\times A\times A$ of five copies of the annulus. This is a $10$-dimensional CW complex involving $248832$ cells. It will be homotopy equivalent $Y\simeq X$ to a CW complex $X$ involving fewer cells. The CW complex $X$ may be non-regular. We compute the cochain complex $D_\ast = {\rm Hom}_{\mathbb Z}(C_\ast(X),\mathbb Z)$ from which the cohomology groups \\
$H^0(Y,\mathbb Z)=\mathbb Z$, \\
$H^1(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^2(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^3(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^4(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^5(Y,\mathbb Z)=\mathbb Z$, \\
$H^6(Y,\mathbb Z)=0$\\
 are obtained. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=DirectProduct(A,A,A,A,A);|
  Regular CW-complex of dimension 10
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  248832
  !gapprompt@gap>| !gapinput@C:=ChainComplex(Y);|
  Chain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@D:=HomToIntegers(C);|
  Cochain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(D,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,1);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,3);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,4);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,5);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,6);|
  [  ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cup products}}\logpage{[ 1, 10, 0 ]}
\hyperdef{L}{X823FA6A9828FF473}{}
{
 

\textsc{Strategy 1: Use geometric group theory in low dimensions.} 

Continuing with the previous example, we consider the first and fifth
generators $g_1^1, g_5^1\in H^1(Y,\mathbb Z) =\mathbb Z^5$ and establish that their cup product $ g_1^1 \cup g_5^1 = - g_7^2 \in H^2(Y,\mathbb Z) =\mathbb Z^{10}$ is equal to minus the seventh generator of $H^2(Y,\mathbb Z)$. We also verify that $g_5^1\cup g_1^1 = - g_1^1 \cup g_5^1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@cup11:=CupProduct(FundamentalGroup(Y));|
  function( a, b ) ... end
  
  !gapprompt@gap>| !gapinput@cup11([1,0,0,0,0],[0,0,0,0,1]);|
  [ 0, 0, 0, 0, 0, 0, -1, 0, 0, 0 ]
  
  !gapprompt@gap>| !gapinput@cup11([0,0,0,0,1],[1,0,0,0,0]);|
  [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ]
  
  
\end{Verbatim}
 

This computation of low-dimensional cup products is achieved using
group-theoretic methods to approximate the diagonal map $\Delta \colon Y \rightarrow Y\times Y$ in dimensions $\le 2$. In order to construct cup products in higher degrees \textsc{HAP} invokes two further strategies. 

\textsc{Strategy 2: implement the Alexander-Whitney map for a fixed class of spaces.} 

For simplicial complexes the cup product is implemented using the standard
formula for the Alexander-Whitney chain map, together with homotopy
equivalences to improve efficiency. 

As a first example, the following commands construct simplicial surfaces $K=(\mathbb S^1 \times \mathbb S^1) \# (\mathbb S^1 \times \mathbb S^1)$ and $L=(\mathbb S^1 \times \mathbb S^1) \vee \mathbb S^1 \vee \mathbb S^1$ and establish that they have the same cohomology groups. It is then shown that
the cup products $\cup_K\colon H^1(K,\mathbb Z)\times H^1(K,\mathbb Z) \rightarrow H^2(K,\mathbb
Z)$ and $\cup_L\colon H^1(L,\mathbb Z)\times H^1(L,\mathbb Z) \rightarrow H^2(L,\mathbb
Z)$ are antisymmetric bilinear forms of different ranks; hence $K$ and $L$ have different homotopy types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(2);|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@L:=WedgeSum(WedgeSum(ClosedSurface(1),Sphere(1)),Sphere(1));|
  Simplicial complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Cohomology(K,0);Cohomology(L,0);|
  [ 0 ]
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,1);Cohomology(L,1);|
  [ 0, 0, 0, 0 ]
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,2);Cohomology(L,2);|
  [ 0 ]
  [ 0 ]
  !gapprompt@gap>| !gapinput@gens:=[[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]];;|
  !gapprompt@gap>| !gapinput@cupK:=CupProduct(K);;|
  !gapprompt@gap>| !gapinput@cupL:=CupProduct(L);;|
  !gapprompt@gap>| !gapinput@A:=NullMat(4,4);;B:=NullMat(4,4);;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@A[i][j]:=cupK(1,1,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@B[i][j]:=cupL(1,1,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(A);|
  [ [   0,   0,   0,   1 ],
    [   0,   0,   1,   0 ],
    [   0,  -1,   0,   0 ],
    [  -1,   0,   0,   0 ] ]
  !gapprompt@gap>| !gapinput@Display(B);|
  [ [   0,   1,   0,   0 ],
    [  -1,   0,   0,   0 ],
    [   0,   0,   0,   0 ],
    [   0,   0,   0,   0 ] ]
  !gapprompt@gap>| !gapinput@Rank(A);|
  4
  !gapprompt@gap>| !gapinput@Rank(B);|
  2
  
\end{Verbatim}
 

 As a second example of the computation of cups products, the following
commands construct the wedge sum $W=M\vee N$ of a $2$-dimensional orientable simplicial surface of genus 2 and the $K3$ complex surface which is stored as a pure simplicial complex of dimension 4.
The simplicial structure on the $K3$ surface is taken from \cite{spreerkhuenel}. The commands then show that $H^2(W,\mathbb Z)=\mathbb Z^{22}$ and $H^4(W,\mathbb Z)=\mathbb Z$. The final commands comput the matrix $(x\cup y)$ as $x,y$ range over a generating set for $H^2(W,\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=ClosedSurface(2);;|
  !gapprompt@gap>| !gapinput@N:=SimplicialK3Surface();;|
  !gapprompt@gap>| !gapinput@W:=WedgeSum(M,N);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@Cohomology(W,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,1);|
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(W,4);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@cup:=CupProduct(W);;|
  !gapprompt@gap>| !gapinput@SecondCohomologyGens:=IdentityMat(23);;|
  !gapprompt@gap>| !gapinput@A:=NullMat(23,23);;|
  !gapprompt@gap>| !gapinput@for i in [1..23] do|
  !gapprompt@>| !gapinput@for j in [1..23] do|
  !gapprompt@>| !gapinput@A[i][j]:=cup(2,2,SecondCohomologyGens[i],SecondCohomologyGens[j])[1];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(A);|
  [ [   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0 ],
    [   0,  -2,   2,  -1,   0,  -1,   1,  -1,   0,   0,   1,  -1,   0,   0,   1,   1,   2,  -1,  -1,   1,  -1,   0,  -1 ],
    [   0,   2,  -4,   2,  -1,   1,  -1,   1,   0,  -1,  -1,   0,   1,  -1,   1,  -1,  -2,   1,   2,  -2,   1,   0,   3 ],
    [   0,  -1,   2,  -2,   2,  -1,   0,  -1,   1,   1,   1,   0,   0,   0,  -2,   0,   0,   0,   0,   1,   0,   1,  -1 ],
    [   0,   0,  -1,   2,  -4,   1,   1,   1,  -2,  -1,  -1,   0,  -1,  -1,   4,   0,   1,  -1,  -1,  -1,  -1,  -1,   1 ],
    [   0,  -1,   1,  -1,   1,  -2,   0,  -1,   1,   0,   1,  -1,   1,   0,   0,   1,   1,   0,   0,   1,   0,   1,   0 ],
    [   0,   1,  -1,   0,   1,   0,  -2,   1,   0,   0,  -1,   0,   1,   1,  -1,   0,  -1,   0,   0,   0,   1,   0,   0 ],
    [   0,  -1,   1,  -1,   1,  -1,   1,  -2,   1,   0,   1,  -1,   1,   0,   0,   1,   1,   0,   0,   1,   0,   0,   0 ],
    [   0,   0,   0,   1,  -2,   1,   0,   1,  -2,  -1,   0,   0,  -1,  -1,   2,   0,   0,  -1,   0,  -1,  -1,  -1,   0 ],
    [   0,   0,  -1,   1,  -1,   0,   0,   0,  -1,  -2,   0,  -1,   0,   0,   2,   1,   0,   0,   0,   0,   0,  -1,   1 ],
    [   0,   1,  -1,   1,  -1,   1,  -1,   1,   0,   0,  -2,   0,   1,   1,  -1,   0,  -1,   0,   0,   0,   1,  -1,   0 ],
    [   0,  -1,   0,   0,   0,  -1,   0,  -1,   0,  -1,   0,  -2,   1,   0,   2,   1,   1,  -1,   0,   0,   0,   0,   1 ],
    [   0,   0,   1,   0,  -1,   1,   1,   1,  -1,   0,   1,   1,  -2,   0,   0,   0,   0,   1,  -1,   1,  -1,  -1,  -2 ],
    [   0,   0,  -1,   0,  -1,   0,   1,   0,  -1,   0,   1,   0,   0,  -2,   3,   0,   1,  -1,   0,  -1,  -1,   0,   1 ],
    [   0,   1,   1,  -2,   4,   0,  -1,   0,   2,   2,  -1,   2,   0,   3,  -8,  -1,  -2,   1,   1,   1,   2,   0,  -2 ],
    [   0,   1,  -1,   0,   0,   1,   0,   1,   0,   1,   0,   1,   0,   0,  -1,  -2,  -1,   1,   1,  -1,   0,   0,   0 ],
    [   0,   2,  -2,   0,   1,   1,  -1,   1,   0,   0,  -1,   1,   0,   1,  -2,  -1,  -2,   0,   2,  -1,   1,   0,   0 ],
    [   0,  -1,   1,   0,  -1,   0,   0,   0,  -1,   0,   0,  -1,   1,  -1,   1,   1,   0,  -2,  -1,   0,   0,  -1,   1 ],
    [   0,  -1,   2,   0,  -1,   0,   0,   0,   0,   0,   0,   0,  -1,   0,   1,   1,   2,  -1,  -2,   1,  -1,   0,  -2 ],
    [   0,   1,  -2,   1,  -1,   1,   0,   1,  -1,   0,   0,   0,   1,  -1,   1,  -1,  -1,   0,   1,  -2,   0,  -1,   2 ],
    [   0,  -1,   1,   0,  -1,   0,   1,   0,  -1,   0,   1,   0,  -1,  -1,   2,   0,   1,   0,  -1,   0,  -2,   0,   0 ],
    [   0,   0,   0,   1,  -1,   1,   0,   0,  -1,  -1,  -1,   0,  -1,   0,   0,   0,   0,  -1,   0,  -1,   0,  -2,   1 ],
    [   0,  -1,   3,  -1,   1,   0,   0,   0,   0,   1,   0,   1,  -2,   1,  -2,   0,   0,   1,  -2,   2,   0,   1,  -4 ] ]
  
\end{Verbatim}
 A cubical Alexander-Whitney formula can be used similarly for computing the
cohomology ring of a regular CW-complex whose cells all have a cubical
combinatorial face lattice. 

\textsc{Strategy 3: Guess and verify a cellular approximation to the diagonal map.} 

Many naturally occuring cell structures are neither simplicial nor cubical.
For a general regular CW-complex we (currently) require a cellular inclusion $\overline Y \hookrightarrow Y\times Y$ with $\{(y,y)\ :\ y\in Y\}\subset \overline Y$ and with projection $p\colon \overline Y \twoheadrightarrow Y$ that induces isomorphisms on integral homology. The function \texttt{DiagonalApproximation(Y)} constructs a candidate inclusion, but the projection $p\colon \overline Y \twoheadrightarrow Y$ needs to be tested for homology equivalence. If the candidate inclusion passes
this test then the function \texttt{CupProduct(Y)}, involving the candidate space, can be used for cup products. (I think the
test is passed for all regular CW-complexes that are subcomplexes of some
Euclidean space with all cells convex polytopes -- but a proof needs to be
written down!) 

The following example calculates $g_1^2 \cup g_2^2 \ne 0$ where $Y=T\times T$ is the direct product of two copies of a simplicial torus $T$, and where $g_k^n$ denotes the $k$-th generator in some basis of $H^n(Y,\mathbb Z)$. The direct product $Y$ is a CW-complex which is not a simplicial complex. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|K:=RegularCWComplex(ClosedSurface(1));;B
  @gapprompt|gap>B @gapinput|Y:=DirectProduct(K,K);;B
  @gapprompt|gap>B @gapinput|cup:=CupProduct(Y);;B
  @gapprompt|gap>B @gapinput|cup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);B
  [ 5 ]
  
  @gapprompt|gap>B @gapinput|D:=DiagonalApproximation(Y);;B
  @gapprompt|gap>B @gapinput|p:=D!.projection;B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|P:=ChainMap(p);B
  Chain Map between complexes of length 4 . 
  
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,0));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,2));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,3));B
  true
  @gapprompt|gap>B @gapinput|IsIsomorphismOfAbelianFpGroups(Homology(P,4));B
  true
  
\end{Verbatim}
 }

 Of course, an alternative approach to this particular example would be to
first give the direct product $Y=T\times T$ the structure of a simplicial complex and then use the Alexander-Whitney map
of Strategy 2. A simplicial structure for $T\times T$ can be obtained using the function $SCCartesianProduct(T,T)$ from the \textsc{SimpComp} package. The details are as follows. (The result is consistent with the
preceding computation since the choice of a basis for cohomology groups is far
from unique.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(1);;|
  !gapprompt@gap>| !gapinput@facets:=MaximalSimplicesOfSimplicialComplex(K);;|
  !gapprompt@gap>| !gapinput@LoadPackage("simpcomp");;|
  !gapprompt@gap>| !gapinput@scK:=SCFromFacets(S);;|
  !gapprompt@gap>| !gapinput@scY:=SCCartesianProduct(scK,scK);;|
  !gapprompt@gap>| !gapinput@Y:=MaximalSimplicesToSimplicialComplex(SCFacetsEx(scY));|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@cup:=CupProduct(Y);;|
  !gapprompt@gap>| !gapinput@cup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);|
  [ 0 ]
  
\end{Verbatim}
 
\section{\textcolor{Chapter }{Cohomology Rings}}\logpage{[ 1, 11, 0 ]}
\hyperdef{L}{X80B6849C835B7F19}{}
{
 The cup product gives the cohomology $H^\ast(X,R)$ of a space $X$ with coefficients in a ring $R$ the structure of a graded commutitive ring. This is currently implemented only
for $Y$ a simplicial complex and $R=\mathbb Z_p$ the field of $p$ elements. 

The folowing commands compute the mod $2$ cohomology ring $H^\ast(W,\mathbb Z_2)$ of the above wedge sum $W=M\vee N$ of a $2$-dimensional orientable simplicial surface of genus 2 and the $K3$ complex simplicial surface (of real dimension 4). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=ClosedSurface(2);;|
  !gapprompt@gap>| !gapinput@N:=SimplicialK3Surface();;|
  !gapprompt@gap>| !gapinput@W:=WedgeSum(M,N);;|
  !gapprompt@gap>| !gapinput@A:=CohomologyRing(W,2);|
  <algebra of dimension 29 over GF(2)>
  !gapprompt@gap>| !gapinput@x:=Basis(A)[25];|
  v.25
  !gapprompt@gap>| !gapinput@y:=Basis(A)[27];|
  v.27
  !gapprompt@gap>| !gapinput@x*y;|
  v.29
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Intersection forms of $4$-manifolds}}\logpage{[ 1, 12, 0 ]}
\hyperdef{L}{X7F9B01CF7EE1D2FC}{}
{
 The cup product gives rise to the intersection form of a connected, closed,
orientable $4$-manifold $Y$ is a symmetric bilinear form 

$qY\colon H^2(Y,\mathbb Z)/Torsion \times H^2(Y,\mathbb Z)/Torsion
\longrightarrow \mathbb Z$ 

which we represent as a symmetric matrix. 

The following example constructs the direct product $L=S^2\times S^2$ of two $2$-spheres, the connected sum $M=\mathbb CP^2 \# \overline{\mathbb CP^2}$ of the complex projective plane $\mathbb CP^2$ and its oppositely oriented version $\overline{\mathbb CP^2}$, and the connected sum $M=\mathbb CP^2 \# \mathbb CP^2$. The manifolds $L$, $M$ and $N$ are each shown to have a CW-structure involving one $0$-cell, two $1$-cells and one $2$-cell. They are thus simply connected and have identical cohomology. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S:=Sphere(2);;|
  !gapprompt@gap>| !gapinput@S:=RegularCWComplex(S);;|
  !gapprompt@gap>| !gapinput@L:=DirectProduct(S,S);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@M:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),-1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@N:=ConnectedSum(ComplexProjectiveSpace(2),ComplexProjectiveSpace(2),+1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@CriticalCells(L);|
  [ [ 4, 1 ], [ 2, 13 ], [ 2, 56 ], [ 0, 16 ] ]
  !gapprompt@gap>| !gapinput@CriticalCells(RegularCWComplex(M));|
  [ [ 4, 1 ], [ 2, 109 ], [ 2, 119 ], [ 0, 8 ] ]
  !gapprompt@gap>| !gapinput@CriticalCells(RegularCWComplex(N));|
  [ [ 4, 1 ], [ 2, 119 ], [ 2, 149 ], [ 0, 12 ] ]
  
\end{Verbatim}
 John Milnor showed (as a corollary to a theorem of J. H. C. Whitehead) that
the homotopy type of a simply connected 4-manifold is determined by its
quadratic form. More precisely, a form is said to be of \emph{type I (properly primitive)} if some diagonal entry of its matrix is odd. If every diagonal entry is even,
then the form is of \emph{type II (improperly primitive)}. The \emph{index} of a form is defined as the number of positive diagonal entries minus the
number of negative ones, after the matrix has been diagonalized over the real
numbers. 

\textsc{Theorem.} (Milnor \cite{milnor}) The oriented homotopy type of a simply connected, closed, orientable
4-manifold is determined by its second Betti number and the index and type of
its intersetion form; except possibly in the case of a manifold with definite
quadratic form of rank r {\textgreater} 9. 

 The following commands compute matrices representing the intersection forms $qL$, $qM$, $qN$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@qL:=IntersectionForm(L);;|
  !gapprompt@gap>| !gapinput@qM:=IntersectionForm(M);;|
  !gapprompt@gap>| !gapinput@qN:=IntersectionForm(N);;|
  !gapprompt@gap>| !gapinput@Display(qL);|
  [ [  -2,   1 ],
    [   1,   0 ] ]
  !gapprompt@gap>| !gapinput@Display(qM);|
  [ [  5,  2 ],
    [  2,  1 ] ]
  !gapprompt@gap>| !gapinput@Display(qN);|
  [ [  -3,  -2 ],
    [  -2,  -1 ] ]
  
\end{Verbatim}
 Since $qL$ is of type I, whereas $qM$ and $qN$ are of type II we see that the oriented homotopy type of $L$ is distinct to that of $M$ and that of $N$. Since $qM$ has index $2$ and $qN$ has index $0$ we see that that $M$ and $N$ also have distinct oriented homotopy types. }

 
\section{\textcolor{Chapter }{CW maps and induced homomorphisms}}\logpage{[ 1, 13, 0 ]}
\hyperdef{L}{X8771FF2885105154}{}
{
 

A \emph{strictly cellular} map $f\colon X\rightarrow Y$ of regular CW-complexes is a cellular map for which the image of any cell is a
cell (of possibly lower dimension). Inclusions of CW-subcomplexes, and
projections from a direct product to a factor, are examples of such maps.
Strictly cellular maps can be represented in \textsc{HAP}, and their induced homomorphisms on (co)homology and on fundamental groups
can be computed. 

 The following example begins by visualizing the trefoil knot $\kappa \in \mathbb R^3$. It then constructs a regular CW structure on the complement $Y= D^3\setminus {\rm Nbhd}(\kappa) $ of a small tubular open neighbourhood of the knot lying inside a large closed
ball $D^3$. The boundary of this tubular neighbourhood is a $2$-dimensional CW-complex $B$ homeomorphic to a torus $\mathbb S^1\times \mathbb S^1$ with fundamental group $\pi_1(B)=<a,b\, :\, aba^{-1}b^{-1}=1>$. The inclusion map $f\colon B\hookrightarrow Y$ is constructed. Then a presentation $\pi_1(Y)= <x,y\, |\, xy^{-1}x^{-1}yx^{-1}y^{-1}>$ and the induced homomorphism
\$\$\texttt{\symbol{92}}pi{\textunderscore}1(B)\texttt{\symbol{92}}rightarrow
\texttt{\symbol{92}}pi{\textunderscore}1(Y), a\texttt{\symbol{92}}mapsto
y\texttt{\symbol{94}}\texttt{\symbol{123}}-1\texttt{\symbol{125}}xy\texttt{\symbol{94}}2xy\texttt{\symbol{94}}\texttt{\symbol{123}}-1\texttt{\symbol{125}},
b\texttt{\symbol{92}}mapsto y \$\$ are computed. This induced homomorphism is
an example of a \emph{peripheral system} and is known to contain sufficient information to characterize the knot up to
ambient isotopy. 

 Finally, it is verified that the induced homology homomorphism $H_2(B,\mathbb Z) \rightarrow H_2(Y,\mathbb Z)$ is an isomomorphism. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@ViewPureCubicalKnot(K);;|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@f:=KnotComplementWithBoundary(ArcPresentation(K));|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Target(f));|
  <fp group of size infinity on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f1*f2^-1*f1^-1*f2*f1^-1*f2^-1 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(f);|
  [ f1, f2 ] -> [ f2^-1*f1*f2^2*f1*f2^-1, f1 ]
  
  
  !gapprompt@gap>| !gapinput@phi:=ChainMap(f);|
  Chain Map between complexes of length 2 . 
  
  !gapprompt@gap>| !gapinput@H:=Homology(phi,2);|
  [ g1 ] -> [ g1 ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing a simplicial complex from a regular CW-complex}}\logpage{[ 1, 14, 0 ]}
\hyperdef{L}{X853D6B247D0E18DB}{}
{
 The following example constructs a $3$-dimensional pure regular CW-complex $K$ whose $3$-cells are permutahedra. It then constructs the simplicial complex $B$ by taking barycentric subdivision. It then constructes a smaller, homotopy
equivalent, simplicial complex $N$ by taking the nerve of the cover of $K$ by the closures of its $3$-cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=RegularCWComplex(PureComplexComplement(PurePermutahedralKnot(3,1)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(K);|
  77923
  !gapprompt@gap>| !gapinput@B:=BarycentricSubdivision(K);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(B);|
  1622517
  !gapprompt@gap>| !gapinput@N:=Nerve(K);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(N);|
  48745
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Equivariant CW complexes}}\logpage{[ 1, 15, 0 ]}
\hyperdef{L}{X85A579217DCB6CC8}{}
{
 The above representations of spaces as simplicial complexes and regular CW
complexes have their limitations. One limitation is that the number of cells
needed to describe a space can be unnecessarily large. A minimal simplicial
complex structure for the torus has $7$ vertices, $21$ edges and $14$ triangles. A minimal regular CW-complex structure for the torus has $4$ vertices, $8$ edges and $4$ cells of dimension $2$. By using simplicial sets (which are like simplicial complexes except that
they allow the freedom to attach simplicial cells by gluing their boundary
non-homeomorphically) one obtains a minimal triangulation of the torus
involving $1$ vertex, $3$ edges and $2$ cells of dimension $2$. By using non-regular CW-complexes one obtains a minimal cell structure
involving $1$ vertex, $2$ edges and $1$ cell of dimension $2$. Minimal cell structures (in the four different categories) for the torus are
illustrated as follows. 

  

  

A second limitation to our representations of simplicial and regular
CW-complexes is that they apply only to structures with finitely many cells.
They do no apply, for instance, to the simplicial complex structure on the
real line $\mathbb R$ in which each each integer $n$ is a vertex and each interval $[n,n+1]$ is an edge. 

 Simplicial sets provide one approach to the efficient combinatorial
representation of certain spaces. So too do cubical sets (the analogues of
simplicial sets in which each cell has the combinatorics of an $n$-cube rather than an $n$-simplex). Neither of these two approaches has been implemented in \textsc{HAP}. 

 Simplicial sets endowed with the action of a (possibly infinite) group $G$ provide for an efficient representation of (possibly infinite) cell structures
on a wider class of spaces. Such a structure can be made precise and is known
as a \emph{simplicial group}. Some functionality for simplicial groups is implemented in \textsc{HAP} and described in Chapter \ref{chapSimplicialGroups}. 

A regular CW-complex endowed with the action of a (possibly infinite) group $G$ is an alternative approach to the efficient combinatorial representation of
(possibly infinite) cell structures on spaces. Much of \textsc{HAP} is focused on this approach. As a first example of the idea, the following
commands construct the infinite regular CW-complex $Y=\widetilde T$ arising as the universal cover of the torus $T=\mathbb S^1\times \mathbb S^1$ where $T$ is given the above minimal non-regular CW structure involving $1$ vertex, $2$ edges, and $1$ cell of dimension $2$. The homology $H_n(T,\mathbb Z)$ is computed and the fundamental group of the torus $T$ is recovered. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(2);;x:=F.1;;y:=F.2;;|
  !gapprompt@gap>| !gapinput@G:=F/[ x*y*x^-1*y^-1 ];;|
  !gapprompt@gap>| !gapinput@Y:=EquivariantTwoComplex(G);|
  Equivariant CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfQuotient(Y);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,2);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@FundamentalGroupOfQuotient(Y);|
  <fp group of size infinity on the generators [ f1, f2 ]>
  
\end{Verbatim}
 

As a second example, the following comands load group number $9$ in the library of $3$-dimensional crystallographic groups. They verify that $G$ acts freely on $\mathbb R^3$ (i.e. $G$ is a \emph{Bieberbach group}) and then construct a $G$-equivariant CW-complex $Y=\mathbb R^3$ corresponding to the tessellation of $\mathbb R^3$ by a fundamental domain for $G$. Finally, the cohomology $H_n(M,\mathbb Z)$ of the $3$-dimensional closed manifold $M=\mathbb R^3/G$ is computed. The manifold $M$ is seen to be non-orientable (since it's top-dimensional homology is trivial)
and has a non-regular CW structure with $1$ vertex, $3$ edges, $3$ cells of dimension $2$, and $1$ cell of dimension $3$. (This example uses Polymake software.) 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|G:=SpaceGroup(3,9);;D
  @gapprompt|gap>D @gapinput|IsAlmostBieberbachGroup(Image(IsomorphismPcpGroup(G)));D
  true
  @gapprompt|gap>D @gapinput|Y:=EquivariantEuclideanSpace(G,[0,0,0]);D
  Equivariant CW-complex of dimension 3
  
  @gapprompt|gap>D @gapinput|Y!.dimension(0);D
  1
  @gapprompt|gap>D @gapinput|Y!.dimension(1);D
  3
  @gapprompt|gap>D @gapinput|Y!.dimension(2);D
  3
  @gapprompt|gap>D @gapinput|Y!.dimension(3);D
  1
  @gapprompt|gap>D @gapinput|C:=ChainComplexOfQuotient(Y);D
  Chain complex of length 3 in characteristic 0 . 
  
  @gapprompt|gap>D @gapinput|Homology(C,0);D
  [ 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,1);D
  [ 0, 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,2);D
  [ 2, 0 ]
  @gapprompt|gap>D @gapinput|Homology(C,3);D
  [  ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Orbifolds and classifying spaces}}\logpage{[ 1, 16, 0 ]}
\hyperdef{L}{X86881717878ADCD6}{}
{
 If a discrete group $G$ acts on Euclidean space or hyperbolic space with finite stabilizer groups then
we say that the quotient space obtained by killing the action of $G$ an an \emph{orbifold}. If the stabilizer groups are all trivial then the quotient is of course a
manifold. 

An orbifold is represented as a $G$-equivariant regular CW-complex together with the stabilizer group for a
representative of each orbit of cells and its subgroup consisting of those
group elements that preserve the cell orientation. \textsc{HAP} stores orbifolds using the data type of \emph{non-free resolution} and uses them mainly as a first step in constructing free $\mathbb ZG$-resolutions of $\mathbb Z$. 

 The following commands use an $8$-dimensional equivariant deformation retract of a $GL_3(\mathbb Z[{\bf i}])$-orbifold structure on hyperbolic space to compute $H_5(GL_3({\mathbb Z}[{\bf i}],\mathbb Z) = \mathbb Z_2^5\oplus \mathbb Z_4^2$. (The deformation retract is stored in a library and was supplied by Mathieu
Dutour Sikiric.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Orbifold:=ContractibleGcomplex("PGL(3,Z[i])");|
  Non-free resolution in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(Orbifold,6);|
  Resolution of length 5 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),5);|
  [ 2, 2, 2, 2, 2, 4, 4 ]
  
\end{Verbatim}
 The next example computes an orbifold structure on $\mathbb R^4$, and then the first $12$ degrees of a free resolution/classifying space, for the second $4$-dimensional crystallographic group $G$ in the library of crystallographic groups. The resolution is shown to be
periodic of period $2$ in degrees $\ge 5$. The cohomology is seen to have $11$ ring generators in degree $2$ and no further ring generators. The cohomology groups are:
\$\$H\texttt{\symbol{94}}n(G,\texttt{\symbol{92}}mathbb Z)
=\texttt{\symbol{92}}left(
\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
0, \& \texttt{\symbol{123}}\texttt{\symbol{92}}rm
odd\texttt{\symbol{126}}\texttt{\symbol{125}} n\texttt{\symbol{92}}ge
1\texttt{\symbol{92}}\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}5 \texttt{\symbol{92}}oplus
\texttt{\symbol{92}}mathbb Z\texttt{\symbol{94}}6, \&
n=2\texttt{\symbol{92}}\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}\texttt{\symbol{123}}15\texttt{\symbol{125}}\texttt{\symbol{92}}oplus
\texttt{\symbol{92}}mathbb Z, \& n=4\texttt{\symbol{92}}\texttt{\symbol{92}}
\texttt{\symbol{92}}mathbb
Z{\textunderscore}2\texttt{\symbol{94}}\texttt{\symbol{123}}16\texttt{\symbol{125}},
\& \texttt{\symbol{123}}\texttt{\symbol{92}}rm
even\texttt{\symbol{126}}\texttt{\symbol{125}} n \texttt{\symbol{92}}ge 6
.\texttt{\symbol{92}}\texttt{\symbol{92}}
\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right.\$\$ 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SpaceGroup(4,2);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionCubicalCrystGroup(G,12);A
  Resolution of length 12 in characteristic 0 for <matrix group with 
  5 generators> . 
  
  @gapprompt|gap>A @gapinput|R!.dimension(5);A
  16
  @gapprompt|gap>A @gapinput|R!.dimension(7);A
  16
  @gapprompt|gap>A @gapinput|List([1..16],k->R!.boundary(5,k)=R!.boundary(7,k));A
  [ true, true, true, true, true, true, true, true, true, true, true, true, 
    true, true, true, true ]
  
  @gapprompt|gap>A @gapinput|C:=HomToIntegers(R);A
  Cochain complex of length 12 in characteristic 0 . 
  
  @gapprompt|gap>A @gapinput|Cohomology(C,0);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,4);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,5);A
  [  ]
  @gapprompt|gap>A @gapinput|Cohomology(C,6);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,7);A
  [  ]
  
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,1);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,2);A
  [ [ 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0 ], 
    [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,3);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,4);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,5);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,6);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,7);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,8);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,9);A
  [  ]
  @gapprompt|gap>A @gapinput|IntegralRingGenerators(R,10);A
  [  ]
  
  
\end{Verbatim}
 

 A group $G$ with a finite index torsion free nilpotent subgroup admits a resolution which
is periodic in sufficiently high degrees if and only if all of its finite
index subgroups admit periodic resolutions. The following commands identify
the $99$ $3$-dimensional space groups (respectively, the $1191$ $4$-dimensional space groups) that admit a resolution which is periodic in
degrees $> 3$ (respectively, in degrees $> 4$). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L3:=Filtered([1..219],k->IsPeriodicSpaceGroup(SpaceGroup(3,k)));|
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 17, 18, 19, 21, 24, 26, 27, 28, 
    29, 30, 31, 32, 33, 34, 36, 37, 39, 40, 41, 43, 45, 46, 52, 54, 55, 56, 58, 
    61, 62, 74, 75, 76, 77, 78, 79, 80, 81, 84, 85, 87, 89, 92, 98, 101, 102, 
    107, 111, 119, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 
    152, 153, 154, 155, 157, 159, 161, 162, 163, 164, 165, 166, 168, 171, 172, 
    174, 175, 176, 178, 180, 186, 189, 192, 196, 198, 209 ] 
  
  !gapprompt@gap>| !gapinput@L4:=Filtered([1..4783],k->IsPeriodicSpaceGroup(SpaceGroup(4,k)));|
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 15, 16, 17, 18, 19, 20, 22, 23, 25,
    26, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 42, 43, 44, 46, 47, 48,
    49, 50, 51, 52, 53, 54, 55, 56, 58, 59, 60, 61, 62, 63, 65, 66, 68, 69, 70,
    71, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 89, 90, 91,
    93, 94, 95, 96, 97, 98, 99, 101, 102, 103, 104, 105, 107, 108, 109, 110,
    111, 113, 115, 116, 118, 119, 120, 121, 122, 124, 126, 127, 128, 130, 131,
    134, 141, 144, 145, 149, 151, 153, 154, 155, 156, 157, 158, 159, 160, 162,
    163, 165, 167, 168, 169, 170, 171, 172, 173, 174, 176, 178, 179, 180, 187,
    188, 197, 198, 202, 204, 205, 206, 211, 212, 219, 220, 222, 226, 233, 237,
    238, 239, 240, 241, 242, 243, 244, 245, 247, 248, 249, 250, 251, 253, 254,
    255, 256, 257, 259, 260, 261, 263, 264, 265, 266, 267, 269, 270, 271, 273,
    275, 277, 278, 279, 281, 283, 285, 290, 292, 296, 297, 298, 299, 300, 301,
    303, 304, 305, 314, 316, 317, 319, 327, 328, 329, 333, 335, 342, 355, 357,
    358, 359, 361, 362, 363, 365, 366, 367, 368, 369, 370, 372, 374, 376, 378,
    381, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397,
    398, 399, 400, 401, 402, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413,
    414, 415, 416, 417, 418, 419, 421, 422, 423, 424, 425, 426, 427, 428, 429,
    430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 442, 443, 444, 445,
    446, 447, 448, 450, 451, 458, 459, 462, 464, 465, 466, 467, 469, 470, 473,
    477, 478, 479, 482, 483, 484, 485, 486, 493, 495, 497, 501, 502, 503, 504,
    505, 507, 508, 512, 514, 515, 516, 517, 522, 524, 525, 526, 527, 533, 537,
    539, 540, 541, 542, 543, 544, 546, 548, 553, 555, 558, 562, 564, 565, 566,
    567, 568, 571, 572, 573, 574, 576, 577, 580, 581, 582, 589, 590, 591, 593,
    596, 598, 599, 612, 613, 622, 623, 624, 626, 632, 641, 647, 649, 651, 652,
    654, 656, 657, 658, 659, 661, 662, 663, 665, 666, 667, 668, 669, 670, 671,
    672, 674, 676, 677, 678, 679, 680, 682, 683, 684, 686, 688, 689, 690, 691,
    692, 694, 696, 697, 698, 699, 700, 702, 708, 710, 712, 714, 716, 720, 722,
    728, 734, 738, 739, 741, 742, 744, 745, 752, 754, 756, 757, 758, 762, 763,
    769, 770, 778, 779, 784, 788, 790, 800, 801, 843, 845, 854, 855, 856, 857,
    865, 874, 900, 904, 909, 911, 913, 915, 916, 917, 919, 920, 921, 922, 923,
    924, 925, 926, 927, 929, 931, 932, 933, 934, 936, 938, 940, 941, 943, 945,
    946, 953, 955, 956, 958, 963, 966, 972, 973, 978, 979, 981, 982, 983, 985,
    987, 988, 989, 991, 992, 993, 995, 996, 998, 999, 1000, 1003, 1011, 1022,
    1024, 1025, 1026, 1162, 1167, 1236, 1237, 1238, 1239, 1240, 1241, 1242,
    1243, 1244, 1246, 1248, 1250, 1255, 1264, 1267, 1270, 1273, 1279, 1280,
    1281, 1283, 1284, 1289, 1291, 1293, 1294, 1324, 1325, 1326, 1327, 1328,
    1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, 1339, 1340,
    1341, 1343, 1345, 1347, 1348, 1349, 1350, 1351, 1352, 1354, 1356, 1357,
    1358, 1359, 1361, 1363, 1365, 1367, 1372, 1373, 1374, 1375, 1376, 1377,
    1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1386, 1387, 1388, 1389,
    1390, 1393, 1395, 1397, 1399, 1400, 1401, 1404, 1405, 1408, 1410, 1419,
    1420, 1421, 1422, 1424, 1425, 1426, 1428, 1429, 1438, 1440, 1441, 1442,
    1443, 1444, 1445, 1449, 1450, 1451, 1456, 1457, 1460, 1461, 1462, 1464,
    1465, 1470, 1472, 1473, 1477, 1480, 1481, 1487, 1488, 1489, 1493, 1494,
    1495, 1501, 1503, 1506, 1509, 1512, 1515, 1518, 1521, 1524, 1527, 1530,
    1532, 1533, 1534, 1537, 1538, 1541, 1542, 1544, 1547, 1550, 1552, 1553,
    1554, 1558, 1565, 1566, 1568, 1573, 1644, 1648, 1673, 1674, 1700, 1702,
    1705, 1713, 1714, 1735, 1738, 1740, 1741, 1742, 1743, 1744, 1745, 1746,
    1747, 1748, 1749, 1750, 1751, 1752, 1753, 1754, 1755, 1756, 1757, 1759,
    1761, 1762, 1763, 1765, 1767, 1768, 1769, 1770, 1771, 1772, 1773, 1774,
    1775, 1778, 1779, 1782, 1783, 1785, 1787, 1788, 1789, 1791, 1793, 1795,
    1797, 1798, 1799, 1800, 1801, 1803, 1806, 1807, 1809, 1810, 1811, 1813,
    1815, 1821, 1822, 1823, 1828, 1829, 1833, 1837, 1839, 1842, 1845, 1848,
    1850, 1851, 1852, 1854, 1856, 1857, 1858, 1859, 1860, 1861, 1863, 1866,
    1870, 1873, 1874, 1877, 1880, 1883, 1885, 1886, 1887, 1889, 1892, 1895,
    1915, 1918, 1920, 1923, 1925, 1927, 1928, 1930, 1952, 1953, 1954, 1955,
    2045, 2047, 2049, 2051, 2053, 2054, 2055, 2056, 2057, 2059, 2067, 2068,
    2072, 2075, 2076, 2079, 2084, 2087, 2088, 2092, 2133, 2135, 2136, 2137,
    2139, 2140, 2170, 2171, 2196, 2224, 2234, 2236, 2238, 2254, 2355, 2356,
    2386, 2387, 2442, 2445, 2448, 2451, 2478, 2484, 2487, 2490, 2493, 2496,
    2499, 2502, 2508, 2511, 2514, 2517, 2520, 2523, 2550, 2553, 2559, 2621,
    2624, 2648, 2650, 3046, 3047, 3048, 3049, 3050, 3051, 3052, 3053, 3054,
    3055, 3056, 3057, 3058, 3059, 3060, 3061, 3062, 3063, 3064, 3065, 3066,
    3067, 3068, 3069, 3070, 3071, 3072, 3073, 3074, 3075, 3076, 3077, 3078,
    3079, 3080, 3081, 3082, 3083, 3084, 3085, 3086, 3087, 3089, 3090, 3091,
    3094, 3095, 3096, 3099, 3100, 3101, 3104, 3105, 3106, 3109, 3110, 3111,
    3112, 3113, 3114, 3115, 3117, 3119, 3120, 3121, 3122, 3123, 3124, 3125,
    3127, 3128, 3129, 3130, 3131, 3132, 3133, 3135, 3137, 3139, 3141, 3142,
    3143, 3144, 3145, 3149, 3151, 3152, 3153, 3154, 3155, 3157, 3159, 3160,
    3161, 3162, 3163, 3169, 3170, 3171, 3172, 3173, 3174, 3175, 3177, 3179,
    3180, 3181, 3182, 3183, 3184, 3185, 3187, 3188, 3189, 3190, 3191, 3192,
    3193, 3195, 3197, 3199, 3200, 3201, 3204, 3206, 3207, 3208, 3209, 3210,
    3212, 3214, 3215, 3216, 3217, 3218, 3226, 3234, 3235, 3236, 3244, 3252,
    3253, 3254, 3260, 3268, 3269, 3270, 3278, 3280, 3281, 3282, 3283, 3284,
    3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3295, 3296, 3298, 3299,
    3302, 3303, 3306, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, 3316,
    3317, 3318, 3319, 3320, 3322, 3324, 3326, 3327, 3329, 3330, 3338, 3345,
    3346, 3347, 3348, 3350, 3351, 3352, 3354, 3355, 3356, 3359, 3360, 3361,
    3362, 3374, 3375, 3383, 3385, 3398, 3399, 3417, 3418, 3419, 3420, 3422,
    3424, 3426, 3428, 3446, 3447, 3455, 3457, 3469, 3471, 3521, 3523, 3524,
    3525, 3530, 3531, 3534, 3539, 3542, 3545, 3548, 3550, 3551, 3554, 3557,
    3579, 3580, 3830, 3831, 3832, 3833, 3835, 3837, 3839, 3849, 3851, 3877,
    3938, 3939, 3949, 3951, 3952, 3958, 3960, 3962, 3963, 3964, 3966, 3968,
    3972, 3973, 3975, 4006, 4029, 4030, 4033, 4034, 4037, 4038, 4046, 4048,
    4050, 4062, 4064, 4067, 4078, 4081, 4089, 4090, 4114, 4138, 4139, 4140,
    4141, 4146, 4147, 4148, 4149, 4154, 4155, 4169, 4171, 4175, 4180, 4183,
    4188, 4190, 4204, 4205, 4223, 4224, 4225, 4254, 4286, 4289, 4391, 4397,
    4496, 4499, 4500, 4501, 4502, 4504, 4508, 4510, 4521, 4525, 4544, 4559,
    4560, 4561, 4562, 4579, 4580, 4581, 4583, 4587, 4597, 4598, 4599, 4600,
    4651, 4759, 4760, 4761, 4762, 4766 ]
  
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Cubical complexes \& permutahedral complexes}}\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X7F8376F37AF80AAC}{}
{
 
\section{\textcolor{Chapter }{Cubical complexes}}\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X7D67D5F3820637AD}{}
{
 A \emph{finite simplicial complex} can be defined to be a CW-subcomplex of the canonical regular CW-structure on
a simplex $\Delta^n$ of some dimension $n$. Analogously, a \emph{finite cubical complex} is a CW-subcomplex of the regular CW-structure on a cube $[0,1]^n$ of some dimension $n$. Equivalently, but more conveniently, we can replace the unit interval $[0,1]$ by an interval $[0,k]$ with CW-structure involving $2k+1$ cells, namely one $0$-cell for each integer $0\le j\le k$ and one $1$-cell for each open interval $(j,j+1)$ for $0\le j\le k-1$. A \emph{finite cuical complex} $M$ is a CW-subcompex $M\subset [0,k_1]\times [0,k_2]\times \cdots [0,k_n]$ of a direct product of intervals, the direct product having the usual direct
product CW-structure. The equivalence of these two definitions follows from
the Gray code embedding of a mesh into a hypercube. We say that the cubical
complex has \emph{ambient dimension} $n$. A cubical complex $M$ of ambient dimension $n$ is said to be \emph{pure} if each cell lies in the boundary of an $n$-cell. In other words, $M$ is pure if it is a union of unit $n$-cubes in $\mathbb R^n$, each unit cube having vertices with integer coordinates. 

\textsc{HAP} has a datatype for finite cubical complexes, and a slightly different datatype
for pure cubical complexes. 

 The following example constructs the granny knot (the sum of a trefoil knot
with its reflection) as a $3$-dimensional pure cubical complex, and then displays it. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);|
  prime knot 1 with 3 crossings
  
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);|
  Reflected( prime knot 1 with 3 crossings )
  
  !gapprompt@gap>| !gapinput@M:=KnotSum(K,L);|
  prime knot 1 with 3 crossings + Reflected( prime knot 1 with 3 crossings )
  
  !gapprompt@gap>| !gapinput@Display(M);|
  
\end{Verbatim}
  

 Next we construct the complement $Y=D^3\setminus \mathring{M}$ of the interior of the pure cubical complex $M$. Here $D^3$ is a rectangular region with $M \subset \mathring{D^3}$. This pure cubical complex $Y$ is a union of $5891$ unit $3$-cubes. We contract $Y$ to get a homotopy equivalent pure cubical complex $YY$ consisting of the union of just $775$ unit $3$-cubes. Then we convert $YY$ to a regular CW-complex $W$ involving $11939$ cells. We contract $W$ to obtain a homotopy equivalent regular CW-complex $WW$ involving $5993$ cells. Finally we compute the fundamental group of the complement of the
granny knot, and use the presentation of this group to establish that the
Alexander polynomial $P(x)$ of the granny is 

$P(x) = x^4-2x^3+3x^2-2x+1 \ .$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PureComplexComplement(M);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  5891
  
  !gapprompt@gap>| !gapinput@YY:=ZigZagContractedComplex(Y);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Size(YY);|
  775
  
  !gapprompt@gap>| !gapinput@W:=RegularCWComplex(YY);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(W);|
  11939
  
  !gapprompt@gap>| !gapinput@WW:=ContractedComplex(W);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Size(WW);|
  5993
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(WW);|
  <fp group of size infinity on the generators [ f1, f2, f3 ]>
  
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^4-2*x_1^3+3*x_1^2-2*x_1+1
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Permutahedral complexes}}\logpage{[ 2, 2, 0 ]}
\hyperdef{L}{X85D8195379F2A8CA}{}
{
 

A finite pure cubical complex is a union of finitely many cubes in a
tessellation of $\mathbb R^n$ by unit cubes. One can also tessellate $\mathbb R^n$ by permutahedra, and we define a finite $n$-dimensional pure \emph{permutahedral complex} to be a union of finitely many permutahdra from such a tessellation. There are
two features of pure permutahedral complexes that are particularly useful in
some situations: 
\begin{itemize}
\item  Pure permutahedral complexes are topological manifolds with boundary. 
\item  The method used for finding a smaller pure cubical complex $M'$ homotopy equivalent to a given pure cubical complex $M$ retains the homeomorphism type, and not just the homotopy type, of the space $M$.
\end{itemize}
 

\textsc{Example 1} 

To illustrate these features the following example begins by reading in a
protein backbone from the online \href{https://www.rcsb.org/} {Protein Database}, and storing it as a pure cubical complex $K$. The ends of the protein have been joined, and the homology $H_i(K,\mathbb Z)=\mathbb Z$, $i=0,1$ is seen to be that of a circle. We can thus regard the protein as a knot $K\subset \mathbb R^3$. The protein is visualized as a pure permutahedral complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data1V2X.pdb");;|
  !gapprompt@gap>| !gapinput@K:=ReadPDBfileAsPurePermutahedralComplex("file");|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Homology(K,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 0 ]
  
  Display(K);
  
\end{Verbatim}
  

An alternative method for seeing that the pure permutahedral complex $K$ has the homotopy type of a circle is to note that it is covered by open
permutahedra (small open neighbourhoods of the closed $3$-dimensional permutahedral titles) and to form the nerve $N=Nerve({\mathcal U})$ of this open covering $\mathcal U$. The nerve $N$ has the same homotopy type as $K$. The following commands establish that $N$ is a $1$-dimensional simplicial complex and display $N$ as a circular graph. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@N:=Nerve(K);|
  Simplicial complex of dimension 1.
  
  !gapprompt@gap>| !gapinput@Display(GraphOfSimplicialComplex(N));|
  
\end{Verbatim}
  

 The boundary of the pure permutahedral complex $K$ is a $2$-dimensional CW-complex $B$ homeomorphic to a torus. We next use the advantageous features of pure
permutahedral complexes to compute the homomorphism 

$\phi\colon \pi_1(B) \rightarrow \pi_1(\mathbb R^3\setminus \mathring{K}), a
\mapsto yx^{-3}y^2x^{-2}yxy^{-1}, b\mapsto yx^{-1}y^{-1}x^2y^{-1}$ 

where\\
 $\pi_1(B)=< a,b\, :\, aba^{-1}b^{-1}=1>$,\\
 $\pi_1(\mathbb R^3\setminus \mathring{K}) \cong < x,y\, :\,
y^2x^{-2}yxy^{-1}=1, yx^{-2}y^{-1}x(xy^{-1})^2=1>$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PureComplexComplement(K);|
  Pure permutahedral complex of dimension 3.
  !gapprompt@gap>| !gapinput@Size(Y);|
  418922
  
  !gapprompt@gap>| !gapinput@YY:=ZigZagContractedComplex(Y);|
  Pure permutahedral complex of dimension 3.
  !gapprompt@gap>| !gapinput@Size(YY);|
  3438
  
  !gapprompt@gap>| !gapinput@W:=RegularCWComplex(YY);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=BoundaryMap(W);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@CriticalCells(Source(f));|
  [ [ 2, 1 ], [ 2, 261 ], [ 1, 1043 ], [ 1, 1626 ], [ 0, 2892 ], [ 0, 24715 ] ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(f,2892);|
  [ f1, f2 ] -> [ f2*f1^-3*f2^2*f1^-2*f2*f1*f2^-1, f2*f1^-1*f2^-1*f1^2*f2^-1 ]
  
  !gapprompt@gap>| !gapinput@G:=Target(F);|
  <fp group on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2^2*f1^-2*f2*f1*f2^-1, f2*f1^-2*f2^-1*f1*(f1*f2^-1)^2 ]
  
  
\end{Verbatim}
 

\textsc{Example 2} 

The next example of commands begins by readng two synthetic knots from a CSV
file (containing the coordinates of the two sequences of vertices) and
producing a pure permutahedral complex model of the two knots. The linking
number of two knots is given by the low-dimension cup product of the
complement of the knots. This linking number is computed to be $6$. 

  
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|file1:=HapFile("data175_1.csv");;B
  @gapprompt|gap>B @gapinput|file2:=HapFile("data175_2.csv");;B
  @gapprompt|gap>B @gapinput|K:=ReadCSVfileAsPureCubicalKnot( [file1, file2]);;B
  @gapprompt|gap>B @gapinput|K:=PurePermutahedralComplex(K!.binaryArray);;B
  @gapprompt|gap>B @gapinput|K:=ThickenedPureComplex(K);;B
  @gapprompt|gap>B @gapinput|K:=ContractedComplex(K);;B
  @gapprompt|gap>B @gapinput|#K is a permutahedral complex model of the two input knotsB
  @gapprompt|gap>B @gapinput|Display(K);B
  
  
  @gapprompt|gap>B @gapinput|Y:=PureComplexComplement(K);;B
  @gapprompt|gap>B @gapinput|W:=ZigZagContractedComplex(Y,2);;B
  @gapprompt|gap>B @gapinput|W:=RegularCWComplex(W);;B
  @gapprompt|gap>B @gapinput|W:=ContractedComplex(W);;B
  @gapprompt|gap>B @gapinput|G:=FundamentalGroup(W);;B
  @gapprompt|gap>B @gapinput|cup:=CupProduct(G);;B
  @gapprompt|gap>B @gapinput|cup([1,0],[0,1]);B
  [ -6, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Constructing pure cubical and permutahedral complexes}}\logpage{[ 2, 3, 0 ]}
\hyperdef{L}{X78D3037283B506E0}{}
{
 

 An $n$-dimensional pure cubical or permutahedral complex can be created from an $n$-dimensional array of 0s and 1s. The following example creates and displays
two $3$-dimensional complexes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[[0,0,0],[0,0,0],[0,0,0]],|
  !gapprompt@>| !gapinput@       [[1,1,1],[1,0,1],[1,1,1]],|
  !gapprompt@>| !gapinput@       [[0,0,0],[0,0,0],[0,0,0]]];;|
  !gapprompt@gap>| !gapinput@M:=PureCubicalComplex(A);|
  Pure cubical complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@P:=PurePermutahedralComplex(A);|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Display(M);|
  !gapprompt@gap>| !gapinput@Display(P);|
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Computations in dynamical systems}}\logpage{[ 2, 4, 0 ]}
\hyperdef{L}{X8462CF66850CC3A8}{}
{
 

Pure cubical complexes can be useful for rigourous interval arithmetic
calculations in numerical analysis. They can also be useful for trying to
estimate approximations of certain numerical quantities. To illustrate the
latter we consider the \emph{Henon map} 

$f\colon \mathbb R^2 \rightarrow \mathbb R^2, \left( \begin{array}{cc} x\\ y
\end{array}\right) \mapsto \left( \begin{array}{cc} y+1-ax^2\\ bx \\
\end{array}\right) .$\\
 

Starting with $(x_0,y_0)=(0,0)$ and iterating $(x_{n+1},y_{n+1}) = f(x_n,y_n)$ with the parameter values $a=1.4$, $b=0.3$ one obtains a sequence of points which is known to be dense in the so called \emph{strange attractor} ${\cal A}$ of the Henon map. The first $10$ million points in this sequence are plotted in the following example, with
arithmetic performed to 100 decimal places of accuracy. The sequence is stored
as a $2$-dimensional pure cubical complex where each $2$-cell is square of side equal to $\epsilon =1/500$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=HenonOrbit([0,0],14/10,3/10,10^7,500,100);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Size(M);|
  10287
  
  !gapprompt@gap>| !gapinput@Display(M);|
  
\end{Verbatim}
  

Repeating the computation but with squares of side $\epsilon =1/1000$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=HenonOrbit([0,0],14/10,3/10,10^7,1000,100);|
  
  !gapprompt@gap>| !gapinput@Size(M);|
  24949
  
\end{Verbatim}
 

 we obtain the heuristic estimate 

$\delta \simeq \frac{ \log{ 24949}- \log{ 10287}} {\log{2}} = 1.277 $ 

 for the box-counting dimension of the attractor $\cal A$. }

 }

 
\chapter{\textcolor{Chapter }{Covering spaces}}\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X87472058788D76C0}{}
{
 

Let $Y$ denote a finite regular CW-complex. Let $\widetilde Y$ denote its universal covering space. The covering space inherits a regular
CW-structure which can be computed and stored using the datatype of a $\pi_1Y$-equivariant CW-complex. The cellular chain complex $C_\ast\widetilde Y$ of $\widetilde Y$ can be computed and stored as an equivariant chain complex. Given an
admissible discrete vector field on $ Y,$ we can endow $Y$ with a smaller non-regular CW-structre whose cells correspond to the critical
cells in the vector field. This smaller CW-structure leads to a more efficient
chain complex $C_\ast \widetilde Y$ involving one free generator for each critical cell in the vector field. 
\section{\textcolor{Chapter }{Cellular chains on the universal cover}}\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X85FB4CA987BC92CC}{}
{
 

The following commands construct a $6$-dimensional regular CW-complex $Y\simeq S^1 \times S^1\times S^1$ homotopy equivalent to a product of three circles. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[1,1,1],[1,0,1],[1,1,1]];;|
  !gapprompt@gap>| !gapinput@S:=PureCubicalComplex(A);;|
  !gapprompt@gap>| !gapinput@T:=DirectProduct(S,S,S);;|
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(T);;|
  Regular CW-complex of dimension 6
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  110592
  
\end{Verbatim}
 

The CW-somplex $Y$ has $110592$ cells. The next commands construct a free $\pi_1Y$-equivariant chain complex $C_\ast\widetilde Y$ homotopy equivalent to the chain complex of the universal cover of $Y$. The chain complex $C_\ast\widetilde Y$ has just $8$ free generators. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=ContractedComplex(Y);;A
  @gapprompt|gap>A @gapinput|CU:=ChainComplexOfUniversalCover(Y);;A
  @gapprompt|gap>A @gapinput|List([0..Dimension(Y)],n->CU!.dimension(n));A
  [ 1, 3, 3, 1 ]
  
\end{Verbatim}
 

The next commands construct a subgroup $H < \pi_1Y$ of index $50$ and the chain complex $C_\ast\widetilde Y\otimes_{\mathbb ZH}\mathbb Z$ which is homotopy equivalent to the cellular chain complex $C_\ast\widetilde Y_H$ of the $50$-fold cover $\widetilde Y_H$ of $Y$ corresponding to $H$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|L:=LowIndexSubgroupsFpGroup(CU!.group,50);;A
  @gapprompt|gap>A @gapinput|H:=L[Length(L)-1];;A
  @gapprompt|gap>A @gapinput|Index(CU!.group,H);A
  50
  @gapprompt|gap>A @gapinput|D:=TensorWithIntegersOverSubgroup(CU,H);A
  Chain complex of length 3 in characteristic 0 .
  
  @gapprompt|gap>A @gapinput|List([0..3],D!.dimension);A
  [ 50, 150, 150, 50 ]
  
\end{Verbatim}
 

General theory implies that the $50$-fold covering space $\widetilde Y_H$ should again be homotopy equivalent to a product of three circles. In keeping
with this, the following commands verify that $\widetilde Y_H$ has the same integral homology as $S^1\times S^1\times S^1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,1);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,2);|
  [ 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(D,3);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Spun knots and the Satoh tube map}}\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X7E5CC04E7E3CCDAD}{}
{
 

We'll contruct two spaces $Y,W$ with isomorphic fundamental groups and isomorphic intergal homology, and use
the integral homology of finite covering spaces to establsh that the two
spaces have distinct homotopy types. 

By \emph{spinning} a link $K \subset \mathbb R^3$ about a plane $ P\subset \mathbb R^3$ with $P\cap K=\emptyset$, we obtain a collection $Sp(K)\subset \mathbb R^4$ of knotted tori. The following commands produce the two tori obtained by
spinning the Hopf link $K$ and show that the space $Y=\mathbb R^4\setminus Sp(K) = Sp(\mathbb R^3\setminus K)$ is connected with fundamental group $\pi_1Y = \mathbb Z\times \mathbb Z$ and homology groups $H_0(Y)=\mathbb Z$, $H_1(Y)=\mathbb Z^2$, $H_2(Y)=\mathbb Z^4$, $H_3(Y,\mathbb Z)=\mathbb Z^2$. The space $Y$ is only constructed up to homotopy, and for this reason is $3$-dimensional. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Hopf:=PureCubicalLink("Hopf");|
  Pure cubical link.
  
  !gapprompt@gap>| !gapinput@Y:=SpunAboutInitialHyperplane(PureComplexComplement(Hopf));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [  ]
  !gapprompt@gap>| !gapinput@GY:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(GY);|
  [ f2, f3 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(GY);|
  [ f3^-1*f2^-1*f3*f2 ]
  
\end{Verbatim}
 

An alternative embedding of two tori $L\subset \mathbb R^4 $ can be obtained by applying the 'tube map' of Shin Satoh to a welded Hopf link \cite{MR1758871}. The following commands construct the complement $W=\mathbb R^4\setminus L$ of this alternative embedding and show that $W $ has the same fundamental group and integral homology as $Y$ above. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=HopfSatohSurface();|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ContractedComplex(RegularCWComplex(PureComplexComplement(L)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(W,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [ 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,4);|
  [  ]
  
  !gapprompt@gap>| !gapinput@GW:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(GW);|
  [ f1, f2 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(GW);|
  [ f1^-1*f2^-1*f1*f2 ]
  
\end{Verbatim}
 

Despite having the same fundamental group and integral homology groups, the
above two spaces $Y$ and $W$ were shown by Kauffman and Martins \cite{MR2441256} to be not homotopy equivalent. Their technique involves the fundamental
crossed module derived from the first three dimensions of the universal cover
of a space, and counts the representations of this fundamental crossed module
into a given finite crossed module. This homotopy inequivalence is recovered
by the following commands which involves the $5$-fold covers of the spaces. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|CY:=ChainComplexOfUniversalCover(Y);A
  Equivariant chain complex of dimension 3
  @gapprompt|gap>A @gapinput|LY:=LowIndexSubgroups(CY!.group,5);;A
  @gapprompt|gap>A @gapinput|invY:=List(LY,g->Homology(TensorWithIntegersOverSubgroup(CY,g),2));;A
  
  @gapprompt|gap>A @gapinput|CW:=ChainComplexOfUniversalCover(W);A
  Equivariant chain complex of dimension 3
  @gapprompt|gap>A @gapinput|LW:=LowIndexSubgroups(CW!.group,5);;A
  @gapprompt|gap>A @gapinput|invW:=List(LW,g->Homology(TensorWithIntegersOverSubgroup(CW,g),2));;A
  
  @gapprompt|gap>A @gapinput|SSortedList(invY)=SSortedList(invW);A
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology with local coefficients}}\logpage{[ 3, 3, 0 ]}
\hyperdef{L}{X7C304A1C7EF0BA60}{}
{
 

The $\pi_1Y$-equivariant cellular chain complex $C_\ast\widetilde Y$ of the universal cover $\widetilde Y$ of a regular CW-complex $Y$ can be used to compute the homology $H_n(Y,A)$ and cohomology $H^n(Y,A)$ of $Y$ with local coefficients in a $\mathbb Z\pi_1Y$-module $A$. To illustrate this we consister the space $Y$ arising as the complement of the trefoil knot, with fundamental group $\pi_1Y = \langle x,y : xyx=yxy \rangle$. We take $A= \mathbb Z$ to be the integers with non-trivial $\pi_1Y$-action given by $x.1=-1, y.1=-1$. We then compute 

$\begin{array}{lcl} H_0(Y,A) &= &\mathbb Z_2\, ,\\ H_1(Y,A) &= &\mathbb Z_3\,
,\\ H_2(Y,A) &= &\mathbb Z\, .\end{array}$ 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|K:=PureCubicalKnot(3,1);;E
  @gapprompt|gap>E @gapinput|Y:=PureComplexComplement(K);;E
  @gapprompt|gap>E @gapinput|Y:=ContractedComplex(Y);;E
  @gapprompt|gap>E @gapinput|Y:=RegularCWComplex(Y);;E
  @gapprompt|gap>E @gapinput|Y:=SimplifiedComplex(Y);;E
  @gapprompt|gap>E @gapinput|C:=ChainComplexOfUniversalCover(Y);;E
  @gapprompt|gap>E @gapinput|G:=C!.group;;E
  @gapprompt|gap>E @gapinput|GeneratorsOfGroup(G);E
  [ f1, f2 ]
  @gapprompt|gap>E @gapinput|RelatorsOfFpGroup(G);E
  [ f2^-1*f1^-1*f2^-1*f1*f2*f1, f1^-1*f2^-1*f1^-1*f2*f1*f2 ]
  @gapprompt|gap>E @gapinput|hom:=GroupHomomorphismByImages(G,Group([[-1]]),[G.1,G.2],[[[-1]],[[-1]]]);;E
  @gapprompt|gap>E @gapinput|A:=function(x); return Determinant(Image(hom,x)); end;;E
  @gapprompt|gap>E @gapinput|D:=TensorWithTwistedIntegers(C,A); #Here the function A represents E
  @gapprompt|gap>E @gapinput|#the integers with twisted action of G.E
  Chain complex of length 3 in characteristic 0 .
  @gapprompt|gap>E @gapinput|Homology(D,0);E
  [ 2 ]
  @gapprompt|gap>E @gapinput|Homology(D,1);E
  [ 3 ]
  @gapprompt|gap>E @gapinput|Homology(D,2);E
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Distinguishing between two non-homeomorphic homotopy equivalent spaces}}\logpage{[ 3, 4, 0 ]}
\hyperdef{L}{X7A4F34B780FA2CD5}{}
{
 

The granny knot is the sum of the trefoil knot and its mirror image. The reef
knot is the sum of two identical copies of the trefoil knot. The following
commands show that the degree $1$ homology homomorphisms 

$H_1(p^{-1}(B),\mathbb Z) \rightarrow H_1(\widetilde X_H,\mathbb Z)$ 

 distinguish between the homeomorphism types of the complements $X\subset \mathbb R^3$ of the granny knot and the reef knot, where $B\subset X$ is the knot boundary, and where $p\colon \widetilde X_H \rightarrow X$ is the covering map corresponding to the finite index subgroup $H < \pi_1X$. More precisely, $p^{-1}(B)$ is in general a union of path components 

$p^{-1}(B) = B_1 \cup B_2 \cup \cdots \cup B_t$ . 

 The function \texttt{FirstHomologyCoveringCokernels(f,c)} inputs an integer $c$ and the inclusion $f\colon B\hookrightarrow X$ of a knot boundary $B$ into the knot complement $X$. The function returns the ordered list of the lists of abelian invariants of
cokernels 

${\rm coker}(\ H_1(p^{-1}(B_i),\mathbb Z) \rightarrow H_1(\widetilde
X_H,\mathbb Z)\ )$ 

arising from subgroups $H < \pi_1X$ of index $c$. To distinguish between the granny and reef knots we use index $c=6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);;|
  !gapprompt@gap>| !gapinput@granny:=KnotSum(K,L);;|
  !gapprompt@gap>| !gapinput@reef:=KnotSum(K,K);;|
  !gapprompt@gap>| !gapinput@fg:=KnotComplementWithBoundary(ArcPresentation(granny));;|
  !gapprompt@gap>| !gapinput@fr:=KnotComplementWithBoundary(ArcPresentation(reef));;|
  !gapprompt@gap>| !gapinput@a:=FirstHomologyCoveringCokernels(fg,6);;|
  !gapprompt@gap>| !gapinput@b:=FirstHomologyCoveringCokernels(fr,6);;|
  !gapprompt@gap>| !gapinput@a=b;|
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{ Second homotopy groups of spaces with finite fundamental group}}\logpage{[ 3, 5, 0 ]}
\hyperdef{L}{X869FD75B84AAC7AD}{}
{
 

If $p:\widetilde Y \rightarrow Y$ is the universal covering map, then the fundamental group of $\widetilde Y$ is trivial and the Hurewicz homomorphism $\pi_2\widetilde Y\rightarrow H_2(\widetilde Y,\mathbb Z)$ from the second homotopy group of $\widetilde Y$ to the second integral homology of $\widetilde Y$ is an isomorphism. Furthermore, the map $p$ induces an isomorphism $\pi_2\widetilde Y \rightarrow \pi_2Y$. Thus $H_2(\widetilde Y,\mathbb Z)$ is isomorphic to the second homotopy group $\pi_2Y$. 

 If the fundamental group of $Y$ happens to be finite, then in principle we can calculate $H_2(\widetilde Y,\mathbb Z) \cong \pi_2Y$. We illustrate this computation for $Y$ equal to the real projective plane. The above computation shows that $Y$ has second homotopy group $\pi_2Y \cong \mathbb Z$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=[ [1,2,3], [1,3,4], [1,2,6], [1,5,6], [1,4,5], A
  @gapprompt|>A @gapinput|        [2,3,5], [2,4,5], [2,4,6], [3,4,6], [3,5,6]];;A
  
  @gapprompt|gap>A @gapinput|K:=MaximalSimplicesToSimplicialComplex(K);A
  Simplicial complex of dimension 2.
  
  @gapprompt|gap>A @gapinput|Y:=RegularCWComplex(K);  A
  Regular CW-complex of dimension 2
  @gapprompt|gap>A @gapinput|# Y is a regular CW-complex corresponding to the projective plane.A
  
  @gapprompt|gap>A @gapinput|U:=UniversalCover(Y);A
  Equivariant CW-complex of dimension 2
  
  @gapprompt|gap>A @gapinput|G:=U!.group;; A
  @gapprompt|gap>A @gapinput|# G is the fundamental group of Y, which by the next command A
  @gapprompt|gap>A @gapinput|# is finite of order 2.A
  @gapprompt|gap>A @gapinput|Order(G);A
  2
  
  @gapprompt|gap>A @gapinput|U:=EquivariantCWComplexToRegularCWComplex(U,Group(One(G))); A
  Regular CW-complex of dimension 2
  @gapprompt|gap>A @gapinput|#U is the universal cover of YA
  
  @gapprompt|gap>A @gapinput|Homology(U,0);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|Homology(U,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(U,2);A
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Third homotopy groups of simply connected spaces}}\logpage{[ 3, 6, 0 ]}
\hyperdef{L}{X87F8F6C3812A7E73}{}
{
  
\subsection{\textcolor{Chapter }{First example: Whitehead's certain exact sequence}}\logpage{[ 3, 6, 1 ]}
\hyperdef{L}{X7B506CF27DE54DBE}{}
{
 

For any path connected space $Y$ with universal cover $\widetilde Y$ there is an exact sequence 

 $\rightarrow \pi_4\widetilde Y \rightarrow H_4(\widetilde Y,\mathbb Z)
\rightarrow H_4( K(\pi_2\widetilde Y,2), \mathbb Z ) \rightarrow
\pi_3\widetilde Y \rightarrow H_3(\widetilde Y,\mathbb Z) \rightarrow 0 $ 

 due to J.H.C.Whitehead. Here $K(\pi_2(\widetilde Y),2)$ is an Eilenberg-MacLane space with second homotopy group equal to $\pi_2\widetilde Y$. 

Continuing with the above example where $Y$ is the real projective plane, we see that $H_4(\widetilde Y,\mathbb Z) = H_3(\widetilde Y,\mathbb Z) = 0$ since $\widetilde Y$ is a $2$-dimensional CW-space. The exact sequence implies $\pi_3\widetilde Y \cong H_4(K(\pi_2\widetilde Y,2), \mathbb Z )$. Furthermore, $\pi_3\widetilde Y = \pi_3 Y$. The following commands establish that $\pi_3Y \cong \mathbb Z\, $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);|
  Pcp-group with orders [ 0 ]
  
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialGroup(A,2,5);;|
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfSimplicialGroup(K);|
  Chain complex of length 5 in characteristic 0 .
  
  !gapprompt@gap>| !gapinput@Homology(C,4);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Second example: the Hopf invariant}}\logpage{[ 3, 6, 2 ]}
\hyperdef{L}{X828F0FAB86AA60E9}{}
{
 

 The following commands construct a $4$-dimensional simplicial complex $Y$ with $9$ vertices and $36$ $4$-dimensional simplices, and establish that 

 $\pi_1Y=0 , \pi_2Y=\mathbb Z , H_3(Y,\mathbb Z)=0, H_4(Y,\mathbb Z)=\mathbb Z $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@smp:=[ [ 1, 2, 4, 5, 6 ], [ 1, 2, 4, 5, 9 ], [ 1, 2, 5, 6, 8 ], |
  !gapprompt@>| !gapinput@        [ 1, 2, 6, 4, 7 ], [ 2, 3, 4, 5, 8 ], [ 2, 3, 5, 6, 4 ], |
  !gapprompt@>| !gapinput@        [ 2, 3, 5, 6, 7 ], [ 2, 3, 6, 4, 9 ], [ 3, 1, 4, 5, 7 ],|
  !gapprompt@>| !gapinput@        [ 3, 1, 5, 6, 9 ], [ 3, 1, 6, 4, 5 ], [ 3, 1, 6, 4, 8 ], |
  !gapprompt@>| !gapinput@        [ 4, 5, 7, 8, 3 ], [ 4, 5, 7, 8, 9 ], [ 4, 5, 8, 9, 2 ], |
  !gapprompt@>| !gapinput@        [ 4, 5, 9, 7, 1 ], [ 5, 6, 7, 8, 2 ], [ 5, 6, 8, 9, 1 ],|
  !gapprompt@>| !gapinput@        [ 5, 6, 8, 9, 7 ], [ 5, 6, 9, 7, 3 ], [ 6, 4, 7, 8, 1 ], |
  !gapprompt@>| !gapinput@        [ 6, 4, 8, 9, 3 ], [ 6, 4, 9, 7, 2 ], [ 6, 4, 9, 7, 8 ], |
  !gapprompt@>| !gapinput@        [ 7, 8, 1, 2, 3 ], [ 7, 8, 1, 2, 6 ], [ 7, 8, 2, 3, 5 ],|
  !gapprompt@>| !gapinput@        [ 7, 8, 3, 1, 4 ], [ 8, 9, 1, 2, 5 ], [ 8, 9, 2, 3, 1 ], |
  !gapprompt@>| !gapinput@        [ 8, 9, 2, 3, 4 ], [ 8, 9, 3, 1, 6 ], [ 9, 7, 1, 2, 4 ], |
  !gapprompt@>| !gapinput@        [ 9, 7, 2, 3, 6 ], [ 9, 7, 3, 1, 2 ], [ 9, 7, 3, 1, 5 ] ];;|
  
  !gapprompt@gap>| !gapinput@K:=MaximalSimplicesToSimplicialComplex(smp);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Order(FundamentalGroup(Y));|
  1
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [ 0 ]
  
\end{Verbatim}
 

 Previous commands have established $ H_4(K(\mathbb Z,2), \mathbb Z)=\mathbb Z$. So Whitehead's sequence reduces to an exact sequence 

$\mathbb Z \rightarrow \mathbb Z \rightarrow \pi_3Y \rightarrow 0$ 

in which the first map is $ H_4(Y,\mathbb Z)=\mathbb Z \rightarrow H_4(K(\pi_2Y,2), \mathbb Z )=\mathbb Z $. Hence $\pi_3Y$ is cyclic. 

 HAP is currently unable to compute the order of $\pi_3Y$ directly from Whitehead's sequence. Instead, we can use the \emph{Hopf invariant}. For any map $\phi\colon S^3 \rightarrow S^2$ we consider the space $C(\phi) = S^2 \cup_\phi e^4$ obtained by attaching a $4$-cell $e^4$ to $S^2$ via the attaching map $\phi$. The cohomology groups $H^2(C(\phi),\mathbb Z)=\mathbb Z$, $H^4(C(\phi),\mathbb Z)=\mathbb Z$ are generated by elements $\alpha, \beta$ say, and the cup product has the form 

$- \cup -\colon H^2(C(\phi),\mathbb Z)\times H^2(C(\phi),\mathbb Z) \rightarrow
H^4(C(\phi),\mathbb Z), (\alpha,\alpha) \mapsto h_\phi \beta$ 

for some integer $h_\phi$. The integer $h_\phi$ is the \textsc{Hopf invariant}. The function $h\colon \pi_3(S^3)\rightarrow \mathbb Z$ is a homomorphism and there is an isomorphism 

$\pi_3(S^2\cup e^4) \cong \mathbb Z/\langle h_\phi\rangle$. 

The following commands begin by simplifying the cell structure on the above
CW-complex $Y\cong K$ to obtain a homeomorphic CW-complex $W$ with fewer cells. They then create a space $S$ by removing one $4$-cell from $W$. The space $S$ is seen to be homotopy equivalent to a CW-complex $e^2\cup e^0$ with a single $0$-cell and single $2$-cell. Hence $S\simeq S^2$ is homotopy equivalent to the $2$-sphere. Consequently $Y \simeq C(\phi ) = S^2\cup_\phi e^4 $ for some map $\phi\colon S^3 \rightarrow S^2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(Y);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@S:=RegularCWComplexWithRemovedCell(W,4,6);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@CriticalCells(S);|
  [ [ 2, 6 ], [ 0, 5 ] ]
  
\end{Verbatim}
 

 The next commands show that the map $\phi$ in the construction $Y \simeq C(\phi) $ has Hopf invariant -1. Hence $h\colon \pi_3(S^3)\rightarrow \mathbb Z$ is an isomorphism. Therefore $\pi_3Y=0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@IntersectionForm(K);|
  [ [ -1 ] ]
  
\end{Verbatim}
 

 [The simplicial complex $K$ in this second example is due to W. Kuehnel and T. F. Banchoff and is
homeomorphic to the complex projective plane. ] }

 }

 
\section{\textcolor{Chapter }{Computing the second homotopy group of a space with infinite fundamental group}}\logpage{[ 3, 7, 0 ]}
\hyperdef{L}{X7EAF7E677FB9D53F}{}
{
  The following commands compute the second integral homology 

 $H_2(\pi_1W,\mathbb Z) = \mathbb Z$ 

of the fundamental group $\pi_1W$ of the complement $W$ of the Hopf-Satoh surface. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=HopfSatohSurface();|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ContractedComplex(RegularCWComplex(PureComplexComplement(L)));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@GW:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@IsAspherical(GW);|
  Presentation is aspherical.
  true
  !gapprompt@gap>| !gapinput@R:=ResolutionAsphericalPresentation(GW);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),2);|
  [ 0 ]
  
\end{Verbatim}
 

From Hopf's exact sequence 

 $ \pi_2W \stackrel{h}{\longrightarrow} H_2(W,\mathbb Z) \twoheadrightarrow
H_2(\pi_1W,\mathbb Z) \rightarrow 0$ 

 and the computation $H_2(W,\mathbb Z)=\mathbb Z^4$ we see that the image of the Hurewicz homomorphism is ${\sf im}(h)= \mathbb Z^3$ . The image of $h$ is referred to as the subgroup of \emph{spherical homology classes} and often denoted by $\Sigma^2W$. 

The following command computes the presentation of $\pi_1W$ corresponding to the $2$-skeleton $W^2$ and establishes that $W^2 = S^2\vee S^2 \vee S^2 \vee (S^1\times S^1)$ is a wedge of three spheres and a torus. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupOfRegularCWComplex(W,"no simplification");|
  < fp group on the generators [ f1, f2 ]>
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(F);|
  [ < identity ...>, f1^-1*f2^-1*f1*f2, < identity ...>, <identity ...> ]
  
\end{Verbatim}
 

The next command shows that the $3$-dimensional space $W$ has two $3$-cells each of which is attached to the base-point of $W$ with trivial boundary (up to homotopy in $W^2$). Hence $W = S^3\vee S^3\vee S^2 \vee S^2 \vee S^2 \vee (S^1\times S^1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CriticalCells(W);|
  [ [ 3, 1 ], [ 3, 3148 ], [ 2, 6746 ], [ 2, 20510 ], [ 2, 33060 ], 
    [ 2, 50919 ], [ 1, 29368 ], [ 1, 50822 ], [ 0, 21131 ] ]
  !gapprompt@gap>| !gapinput@CriticalBoundaryCells(W,3,1);|
  [  ]
  !gapprompt@gap>| !gapinput@CriticalBoundaryCells(W,3,3148);|
  [ -50919, 50919 ]
  
\end{Verbatim}
 

 Therefore $\pi_1W$ is the free abelian group on two generators, and $\pi_2W$ is the free $\mathbb Z\pi_1W$-module on three free generators. }

 }

 
\chapter{\textcolor{Chapter }{Three Manifolds}}\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X7BFA4D1587D8DF49}{}
{
 
\section{\textcolor{Chapter }{Dehn Surgery}}\logpage{[ 4, 1, 0 ]}
\hyperdef{L}{X82D1348C79238C2D}{}
{
 The following example constructs, as a regular CW-complex, a closed orientable
3-manifold $W$ obtained from the 3-sphere by drilling out a tubular neighbourhood of a
trefoil knot and then gluing a solid torus to the boundary of the cavity via a
homeomorphism corresponding to a Dehn surgery coefficient $p/q=17/16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@p:=17;;q:=16;;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,p,q);|
  Regular CW-complex of dimension 3
  
\end{Verbatim}
 The next commands show that this $3$-manifold $W$ has integral homology 

 $ H_0(W,\mathbb Z)=\mathbb Z$, $ H_1(W,\mathbb Z)=\mathbb Z_{16}$, $ H_2(W,\mathbb Z)=0$, $ H_3(W,\mathbb Z)=\mathbb Z$ 

 and that the fundamental group $\pi_1(W)$ is non-abelian. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Homology(W,0);Homology(W,1);Homology(W,2);Homology(W,3);|
  [ 0 ]
  [ 16 ]
  [  ]
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@L:=LowIndexSubgroupsFpGroup(F,10);;|
  !gapprompt@gap>| !gapinput@List(L,AbelianInvariants);|
  [ [ 16 ], [ 3, 8 ], [ 3, 4 ], [ 2, 3 ], [ 16, 43 ], [ 8, 43, 43 ] ]
  
\end{Verbatim}
 

 The following famous result of Lickorish and (independently) Wallace shows
that Dehn surgery on knots leads to an interesting range of spaces. 

\textsc{Theorem:} \emph{ Every closed, orientable, connected $3$-manifold can be obtained by surgery on a link in $S^3$. (Moreover, one can always perform the surgery with surgery coefficients $\pm 1$ and with each individual component of the link unknotted.) } }

 
\section{\textcolor{Chapter }{Connected Sums}}\logpage{[ 4, 2, 0 ]}
\hyperdef{L}{X848EDEE882B36F6C}{}
{
 The following example constructs the connected sum $W=A\#B$ of two $3$-manifolds, where $A$ is obtained from a $5/1$ Dehn surgery on the complement of the first prime knot on 11 crossings and $B$ is obtained by a $5/1$ Dehn surgery on the complement of the second prime knot on 11 crossings. The
homology groups 

$H_1(W,\mathbb Z) = \mathbb Z_2\oplus \mathbb Z_{594}$, $H_2(W,\mathbb Z) = 0$, $H_3(W,\mathbb Z) = \mathbb Z$ 

 are computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap1:=ArcPresentation(PureCubicalKnot(11,1));;|
  !gapprompt@gap>| !gapinput@A:=ThreeManifoldViaDehnSurgery(ap1,5,1);;|
  !gapprompt@gap>| !gapinput@ap2:=ArcPresentation(PureCubicalKnot(11,2));;|
  !gapprompt@gap>| !gapinput@B:=ThreeManifoldViaDehnSurgery(ap2,5,1);;|
  !gapprompt@gap>| !gapinput@W:=ConnectedSum(A,B);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 2, 594 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Dijkgraaf-Witten Invariant}}\logpage{[ 4, 3, 0 ]}
\hyperdef{L}{X78AE684C7DBD7C70}{}
{
 Given a closed connected orientable $3$-manifold $W$, a finite group $G$ and a 3-cocycle $\alpha\in H^3(BG,U(1))$ Dijkgraaf and Witten define the complex number 

\$\$
Z\texttt{\symbol{94}}\texttt{\symbol{123}}G,\texttt{\symbol{92}}alpha\texttt{\symbol{125}}(W)
=
\texttt{\symbol{92}}frac\texttt{\symbol{123}}1\texttt{\symbol{125}}\texttt{\symbol{123}}|G|\texttt{\symbol{125}}\texttt{\symbol{92}}sum{\textunderscore}\texttt{\symbol{123}}\texttt{\symbol{92}}gamma\texttt{\symbol{92}}in
\texttt{\symbol{123}}\texttt{\symbol{92}}rm
Hom\texttt{\symbol{125}}(\texttt{\symbol{92}}pi{\textunderscore}1W,
G)\texttt{\symbol{125}} \texttt{\symbol{92}}langle
\texttt{\symbol{92}}gamma\texttt{\symbol{94}}\texttt{\symbol{92}}ast[\texttt{\symbol{92}}alpha],
[M]\texttt{\symbol{92}}rangle \texttt{\symbol{92}}
\texttt{\symbol{92}}in\texttt{\symbol{92}} \texttt{\symbol{92}}mathbb
C\texttt{\symbol{92}} \$\$ where $\gamma$ ranges over all group homomorphisms $\gamma\colon \pi_1W \rightarrow G$. This complex number is an invariant of the homotopy type of $W$ and is useful for distinguishing between certain homotopically distinct $3$-manifolds. 

A homology version of the Dijkgraaf-Witten invariant can be defined as the set
of homology homomorphisms \$\$D{\textunderscore}G(W)
=\texttt{\symbol{92}}\texttt{\symbol{123}}
\texttt{\symbol{92}}gamma{\textunderscore}\texttt{\symbol{92}}ast\texttt{\symbol{92}}colon
H{\textunderscore}3(W,\texttt{\symbol{92}}mathbb Z)
\texttt{\symbol{92}}longrightarrow
H{\textunderscore}3(BG,\texttt{\symbol{92}}mathbb Z)
\texttt{\symbol{92}}\texttt{\symbol{125}}{\textunderscore}\texttt{\symbol{123}}\texttt{\symbol{92}}gamma\texttt{\symbol{92}}in
\texttt{\symbol{123}}\texttt{\symbol{92}}rm
Hom\texttt{\symbol{125}}(\texttt{\symbol{92}}pi{\textunderscore}1W,
G)\texttt{\symbol{125}}.\$\$ Since $H_3(W,\mathbb Z)\cong \mathbb Z$ we represent $D_G(W)$ by the set $D_G(W)=\{ \gamma_\ast(1) \}_{\gamma\in {\rm Hom}(\pi_1W, G)}$ where $1$ denotes one of the two possible generators of $H_3(W,\mathbb Z)$. 

 For any coprime integers $p,q\ge 1$ the \emph{lens space} $L(p,q)$ is obtained from the 3-sphere by drilling out a tubular neighbourhood of the
trivial knot and then gluing a solid torus to the boundary of the cavity via a
homeomorphism corresponding to a Dehn surgery coefficient $p/q$. Lens spaces have cyclic fundamental group $\pi_1(L(p,q))=C_p$ and homology $H_1(L(p,q),\mathbb Z)\cong \mathbb Z_p$, $H_2(L(p,q),\mathbb Z)\cong 0$, $H_3(L(p,q),\mathbb Z)\cong \mathbb Z$. It was proved by J.H.C. Whitehead that two lens spaces $L(p,q)$ and $L(p',q')$ are homotopy equivalent if and only if $p=p'$ and $qq'\equiv \pm n^2 \bmod p$ for some integer $n$. 

 The following session constructs the two lens spaces $L(5,1)$ and $L(5,2)$. The homology version of the Dijkgraaf-Witten invariant is used with $G=C_5$ to demonstrate that the two lens spaces are not homotopy equivalent. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=[[2,1],[2,1]];; #Arc presentation for the trivial knot|
  
  !gapprompt@gap>| !gapinput@L51:=ThreeManifoldViaDehnSurgery(ap,5,1);;|
  !gapprompt@gap>| !gapinput@D:=DijkgraafWittenInvariant(L51,CyclicGroup(5));|
  [ g1^4, g1^4, g1, g1, id ]
  
  !gapprompt@gap>| !gapinput@L52:=ThreeManifoldViaDehnSurgery(ap,5,2);;|
  !gapprompt@gap>| !gapinput@D:=DijkgraafWittenInvariant(L52,CyclicGroup(5));|
  [ g1^3, g1^3, g1^2, g1^2, id ]
  
\end{Verbatim}
 A theorem of Fermat and Euler states that if a prime $p$ is congruent to 3 modulo 4, then for any $q$ exactly one of $\pm q$ is a quadratic residue mod p. For all other primes $p$ either both or neither of $\pm q$ is a quadratic residue mod $p$. Thus for fixed $p \equiv 3 \bmod 4$ the lens spaces $L(p,q)$ form a single homotopy class. There are precisely two homotopy classes of lens
spaces for other $p$. 

 The following commands confirm that $L(13,1) \not\simeq L(13,2)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L13_1:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,1);;|
  !gapprompt@gap>| !gapinput@DijkgraafWittenInvariant(L13_1,CyclicGroup(13));|
  [ g1^12, g1^12, g1^10, g1^10, g1^9, g1^9, g1^4, g1^4, g1^3, g1^3, g1, g1, id ]
  !gapprompt@gap>| !gapinput@L13_2:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,2);;|
  !gapprompt@gap>| !gapinput@DijkgraafWittenInvariant(L13_2,CyclicGroup(13));|
  [ g1^11, g1^11, g1^8, g1^8, g1^7, g1^7, g1^6, g1^6, g1^5, g1^5, g1^2, g1^2, 
    id ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology rings}}\logpage{[ 4, 4, 0 ]}
\hyperdef{L}{X80B6849C835B7F19}{}
{
 The following commands construct the multiplication table (with respect to
some basis) for the cohomology rings $H^\ast(L(13,1),\mathbb Z_{13})$ and $H^\ast(L(13,2),\mathbb Z_{13})$. These rings are isomorphic and so fail to distinguish between the homotopy
types of the lens spaces $L(13,1)$ and $L(13,2)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L13_1:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,1);;|
  !gapprompt@gap>| !gapinput@L13_2:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,2);;|
  !gapprompt@gap>| !gapinput@L13_1:=BarycentricSubdivision(L13_1);;|
  !gapprompt@gap>| !gapinput@L13_2:=BarycentricSubdivision(L13_2);;|
  !gapprompt@gap>| !gapinput@A13_1:=CohomologyRing(L13_1,13);;|
  !gapprompt@gap>| !gapinput@A13_2:=CohomologyRing(L13_2,13);;|
  !gapprompt@gap>| !gapinput@M13_1:=List([1..4],i->[]);;|
  !gapprompt@gap>| !gapinput@B13_1:=CanonicalBasis(A13_1);;|
  !gapprompt@gap>| !gapinput@M13_2:=List([1..4],i->[]);;|
  !gapprompt@gap>| !gapinput@B13_2:=CanonicalBasis(A13_2);;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@M13_1[i][j]:=B13_1[i]*B13_1[j];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@for i in [1..4] do|
  !gapprompt@>| !gapinput@for j in [1..4] do|
  !gapprompt@>| !gapinput@M13_2[i][j]:=B13_2[i]*B13_2[j];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(M13_1);|
  [ [            v.1,            v.2,            v.3,            v.4 ],
    [            v.2,          0*v.1,  (Z(13)^6)*v.4,          0*v.1 ],
    [            v.3,  (Z(13)^6)*v.4,          0*v.1,          0*v.1 ],
    [            v.4,          0*v.1,          0*v.1,          0*v.1 ] ]
  !gapprompt@gap>| !gapinput@Display(M13_2);|
  [ [          v.1,          v.2,          v.3,          v.4 ],
    [          v.2,        0*v.1,  (Z(13))*v.4,        0*v.1 ],
    [          v.3,  (Z(13))*v.4,        0*v.1,        0*v.1 ],
    [          v.4,        0*v.1,        0*v.1,        0*v.1 ] ]
  
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Linking Form}}\logpage{[ 4, 5, 0 ]}
\hyperdef{L}{X7F56BB4C801AB894}{}
{
 Given a closed connected \textsc{oriented} $3$-manifold $W$ let $\tau H_1(W,\mathbb Z)$ denote the torsion subgroup of the first integral homology. The \emph{linking form} is a bilinear mapping 

$Lk_W\colon \tau H_1(W,\mathbb Z) \times \tau H_1(W,\mathbb Z) \longrightarrow
\mathbb Q/\mathbb Z$. 

To construct this form note that we have a Poincare duality isomorphism 

$\rho\colon H^2(W,\mathbb Z) \stackrel{\cong}{\longrightarrow} H_1(W,\mathbb
Z), z \mapsto z\cap [W]$ 

involving the cap product with the fundamental class $[W]\in H^3(W,\mathbb Z)$. That is, $[M]$ is the generator of $H^3(W,\mathbb Z)\cong \mathbb Z$ determining the orientation. The short exact sequence $\mathbb Z \rightarrowtail \mathbb Q \twoheadrightarrow \mathbb Q/\mathbb Z$ gives rise to a cohomology exact sequence 

$ \rightarrow H^1(W,\mathbb Q) \rightarrow H^1(W,\mathbb Q/\mathbb Z)
\stackrel{\beta}{\longrightarrow} H^2(W,\mathbb Z) \rightarrow H^2(W,\mathbb
Q) \rightarrow $ 

 from which we obtain the isomorphism $\beta \colon \tau H^1(W,\mathbb Q/\mathbb Z) \stackrel{\cong}{\longrightarrow}
\tau H^2(W,\mathbb Z)$. The linking form $Lk_W$ can be defined as the composite 

 $Lk_W\colon \tau H_1(W,\mathbb Z) \times \tau H_1(W,\mathbb Z)
\stackrel{1\times \rho^{-1}}{\longrightarrow} \tau H_1(W,\mathbb Z) \times
\tau H^2(W,\mathbb Z) \stackrel{1\times \beta^{-1}}{\longrightarrow} \tau
H_1(W,\mathbb Z) \times \tau H^1(W,\mathbb Q/\mathbb Z)
\stackrel{ev}{\longrightarrow } \mathbb Q/\mathbb Z $ 

where $ev(x,\alpha)$ evaluates a $1$-cocycle $\alpha$ on a $1$-cycle $x$. 

 The linking form can be used to define the set 

 $I^O(W) = \{Lk_W(g,g) \ \colon \ g\in \tau H_1(W,\mathbb Z)\}$ 

which is an oriented-homotopy invariant of $W$. Letting $W^+$ and $W^-$ denote the two possible orientations on the manifold, the set 

 $I(W) =\{I^O(W^+), I^O(W^-)\}$ 

is a homotopy invariant of $W$ which in this manual we refer to as the \emph{linking form homotopy invariant}. 

 The following commands compute the linking form homotopy invariant for the
lens spaces $L(13,q)$ with $1\le q\le 12$. This invariant distinguishes between the two homotopy types that arise. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LensSpaces:=[];;|
  !gapprompt@gap>| !gapinput@for q in [1..12] do|
  !gapprompt@>| !gapinput@Add(LensSpaces,ThreeManifoldViaDehnSurgery([[1,2],[1,2]],13,q));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Display(List(LensSpaces,LinkingFormHomotopyInvariant));;|
  [ [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], [ 0, 2/13, 
            2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ], 
  
    [ [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ], 
        [ 0, 2/13, 2/13, 5/13, 5/13, 6/13, 6/13, 7/13, 7/13, 8/13, 8/13, 11/13, 11/13 ] ], 
  
    [ [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ], 
        [ 0, 1/13, 1/13, 3/13, 3/13, 4/13, 4/13, 9/13, 9/13, 10/13, 10/13, 12/13, 12/13 ] ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Determining the homeomorphism type of a lens space}}\logpage{[ 4, 6, 0 ]}
\hyperdef{L}{X850C76697A6A1654}{}
{
 In 1935 K. Reidemeister \cite{reidemeister} classified lens spaces up to orientation preserving PL-homeomorphism. This was
generalized by E. Moise \cite{moise} in 1952 to a classification up to homeomorphism -- his method requred the
proof of the Hauptvermutung for $3$-dimensional manifolds. In 1960, following a suggestion of R. Fox, a proof was
given by E.J. Brody \cite{brody} that avoided the need for the Hauptvermutung. Reidemeister's method, using
what is know termed \emph{Reidermeister torsion}, and Brody's method, using tubular neighbourhoods of $1$-cycles, both require identifying a suitable "preferred" generator of $H_1(L(p,q),\mathbb Z)$. In 2003 J. Przytycki and A. Yasukhara \cite{przytycki} provided an alternative method for classifying lens spaces, which uses the
linking form and again requires the identification of a "preferred" generator
of $H_1(L(p,q),\mathbb Z)$. 

 Przytycki and Yasukhara proved the following. 

 \textsc{Theorem.} \emph{Let $\rho\colon S^ 3 \rightarrow L(p, q)$ be the $p$-fold cyclic cover and $K$ a knot in $L(p, q)$ that represents a generator of $H_1 (L(p, q), \mathbb Z)$. If $\rho ^{-1} (K)$ is the trivial knot, then $Lk_{ L(p,q)} ([K], [K]) = q/p$ or $= \overline q/p \in \mathbb Q/\mathbb Z$ where $q\overline q \equiv 1 \bmod p$. } 

The ingredients of this theorem can be applied in HAP, but at present only to
small examples of lens spaces. The obstruction to handling large examples is
that the current default method for computing the linking form involves
barycentric subdivision to produce a simplicial complex from a regular
CW-complex, and then a homotopy equivalence from this typically large
simplicial complex to a smaller non-regular CW-complex. However, for
homeomorphism invariants that are not homotopy invariants there is a need to
avoid homotopy equivalences. In the current version of HAP this means that in
order to obtain delicate homeomorphism invariants we have to perform homology
computations on typically large simplicial complexes. In a future version of
HAP we hope to avoid the obstruction by implementing cup products, cap
products and linking forms entirely within the category of regular
CW-complexes. 

The following commands construct a small lens space $L=L(p,q)$ with unknown values of $p,q$. Subsequent commands will determine the homeomorphism type of $L$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=Random([2,3,5,7,11,13,17]);;|
  !gapprompt@gap>| !gapinput@q:=Random([1..p-1]);;|
  !gapprompt@gap>| !gapinput@L:=ThreeManifoldViaDehnSurgery([[1,2],[1,2]],p,q);|
  Regular CW-complex of dimension 3
  
\end{Verbatim}
 We can readily determine the value of $p=11$ by calculating the order of $\pi_1(L)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalGroupWithPathReps(L);;|
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C11"
  
\end{Verbatim}
 

 The next commands take the default edge path $\gamma\colon S^1\rightarrow L$ representing a generator of the cyclic group $\pi_1(L)$ and lift it to an edge path $\tilde\gamma\colon S^1\rightarrow \tilde L$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|U:=UniversalCover(L);;B
  @gapprompt|gap>B @gapinput|G:=U!.group;;B
  @gapprompt|gap>B @gapinput|p:=EquivariantCWComplexToRegularCWMap(U,Group(One(G)));;B
  @gapprompt|gap>B @gapinput|U:=Source(p);;B
  @gapprompt|gap>B @gapinput|gamma:=[];;B
  @gapprompt|gap>B @gapinput|gamma[2]:=F!.loops[1];;B
  @gapprompt|gap>B @gapinput|gamma[2]:=List(gamma[2],AbsInt);;B
  @gapprompt|gap>B @gapinput|gamma[1]:=List(gamma[2],k->L!.boundaries[2][k]);;B
  @gapprompt|gap>B @gapinput|gamma[1]:=SSortedList(Flat(gamma[1]));;B
  @gapprompt|gap>B @gapinput|B
  @gapprompt|gap>B @gapinput|gammatilde:=[[],[],[],[]];;B
  @gapprompt|gap>B @gapinput|for k in [1..U!.nrCells(0)] doB
  @gapprompt|>B @gapinput|if p!.mapping(0,k) in gamma[1] then Add(gammatilde[1],k); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|for k in [1..U!.nrCells(1)] doB
  @gapprompt|>B @gapinput|if p!.mapping(1,k) in gamma[2] then Add(gammatilde[2],k); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|gammatilde:=CWSubcomplexToRegularCWMap([U,gammatilde]);B
  Map of regular CW-complexes
  
\end{Verbatim}
 

The next commands check that the path $\tilde\gamma$ is unknotted in $\tilde L\cong S^3$ by checking that $\pi_1(\tilde L\setminus {\rm image}(\tilde\gamma))$ is infinite cyclic. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=RegularCWComplexComplement(gammatilde);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(C);|
  <fp group of size infinity on the generators [ f2 ]>
  
\end{Verbatim}
 

Since $\tilde\gamma$ is unkotted the cycle $\gamma$ represents the preferred generator $[\gamma]\in H_1(L,\mathbb Z)$. The next commands compute $Lk_L([\gamma],[\gamma])= 7/11 $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@LinkingFormHomeomorphismInvariant(L);|
  [ 7/11 ]
  
\end{Verbatim}
 

 The classification of Moise/Brody states that $L(p,q)\cong L(p,q')$ if and only if $qq'\equiv \pm 1 \bmod p$. Hence the lens space $L$ has the homeomorphism type 

 $L\cong L(11,7) \cong L(11,8) \cong L(11,4) \cong L(11,3)$. }

 
\section{\textcolor{Chapter }{Surgeries on distinct knots can yield homeomorphic manifolds}}\logpage{[ 4, 7, 0 ]}
\hyperdef{L}{X7EC6B008878CC77E}{}
{
 The lens space $L(5,1)$ is a quotient of the $3$-sphere $S^3$ by a certain action of the cyclic group $C_5$. It can be realized by a $p/q=5/1$ Dehn filling of the complement of the trivial knot. It can also be realized by
Dehn fillings of other knots. To see this, the following commands compute the
manifold $W$ obtained from a $p/q=1/5$ Dehn filling of the complement of the trefoil and show that $W$ at least has the same integral homology and same fundamental group as $L(5,1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,1,5);;|
  !gapprompt@gap>| !gapinput@Homology(W,1);|
  [ 5 ]
  !gapprompt@gap>| !gapinput@Homology(W,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(W,3);|
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C5"
  
  
\end{Verbatim}
 

The next commands construct the universal cover $\widetilde W$ and show that it has the same homology as $S^3$ and trivivial fundamental group $\pi_1(\widetilde W)=0$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|U:=UniversalCover(W);;A
  @gapprompt|gap>A @gapinput|G:=U!.group;;A
  @gapprompt|gap>A @gapinput|Wtilde:=EquivariantCWComplexToRegularCWComplex(U,Group(One(G)));A
  Regular CW-complex of dimension 3
  
  @gapprompt|gap>A @gapinput|Homology(Wtilde,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,2);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,3);A
  [ 0 ]
  
  @gapprompt|gap>A @gapinput|F:=FundamentalGroup(Wtilde);A
  <fp group on the generators [  ]>
  
\end{Verbatim}
 By construction the space $\widetilde W$ is a manifold. Had we not known how the regular CW-complex $\widetilde W$ had been constructed then we could prove that it is a closed $3$-manifold by creating its barycentric subdivision $K=sd\widetilde W$, which is homeomorphic to $\widetilde W$, and verifying that the link of each vertex in the simplicial complex $sd\widetilde W$ is a $2$-sphere. The following commands carry out this proof: each link is shown to
admit a discrete vector field with precisely two critical cells -- one $0$-cell and one $2$-cell. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|K:=BarycentricSubdivision(Wtilde);D
  Simplicial complex of dimension 3.
  
  @gapprompt|gap>D @gapinput|L:=[];;D
  @gapprompt|gap>D @gapinput|for v in K!.vertices doD
  @gapprompt|>D @gapinput|Add(L,CriticalCells(RegularCWComplex(VertexLink(K,v))));D
  @gapprompt|>D @gapinput|od;D
  @gapprompt|gap>D @gapinput|SSortedList(List(L,Size));D
  [ 2 ]
  @gapprompt|gap>D @gapinput|C:=Concatenation(L);;D
  @gapprompt|gap>D @gapinput|SSortedList(List(C,x->x[1]));D
  [ 0, 2 ]
  
\end{Verbatim}
 The Poincare conjecture (now proven) implies that $\widetilde W$ is homeomorphic to $S^3$. Hence $W=S^3/C_5$ is a quotient of the $3$-sphere by an action of $C_5$ and is hence a lens space $L(5,q)$ for some $q$. 

 The next commands determine that $W$ is homeomorphic to $L(5,4)\cong L(5,1)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Lk:=LinkingFormHomeomorphismInvariant(W);|
  [ 0, 4/5 ]
  
\end{Verbatim}
 

 Moser \cite{lmoser} gives a precise decription of the lens spaces arising from surgery on the
trefoil knot and more generally from surgery on torus knots. Greene \cite{greene} determines the lens spaces that arise by integer Dehn surgery along a knot in
the three-sphere }

 
\section{\textcolor{Chapter }{Finite fundamental groups of $3$-manifolds}}\logpage{[ 4, 8, 0 ]}
\hyperdef{L}{X7B425A3280A2AF07}{}
{
 Lens spaces are examples of $3$-manifolds with finite fundamental groups. The complete list of finite groups $G$ arising as fundamental groups of closed connected $3$-manifolds is recalled in \ref{Secfinitefundman} where one method for computing their cohomology rings is presented. Their
cohomology could also be computed from explicit $3$-manifolds $W$ with $\pi_1W=G$. For instance, the following commands realize a closed connected $3$-manifold $W$ with $\pi_1W = C_{11}\times SL_2(\mathbb Z_5)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ap:=ArcPresentation(PureCubicalKnot(3,1));;|
  !gapprompt@gap>| !gapinput@W:=ThreeManifoldViaDehnSurgery(ap,1,11);;|
  !gapprompt@gap>| !gapinput@F:=FundamentalGroup(W);;|
  !gapprompt@gap>| !gapinput@Order(F);|
  1320
  !gapprompt@gap>| !gapinput@AbelianInvariants(F);|
  [ 11 ]
  !gapprompt@gap>| !gapinput@StructureDescription(F);|
  "C11 x SL(2,5)"
  
\end{Verbatim}
 Hence the group $G=C_{11}\times SL_2(\mathbb Z_5)$ of order $1320$ acts freely on the $3$-sphere $\widetilde W$. It thus has periodic cohomology with 
\[ H_n(G,\mathbb Z) = \left\{ \begin{array}{ll} \mathbb Z_{11} & n\equiv 1 \bmod
4 \\ 0 & n\equiv 2 \bmod 4 \\ \mathbb Z_{1320} & n \equiv 3\bmod 4\\ \mathbb 0
& n\equiv 0 \bmod 4 \\ \end{array}\right. \]
 for $n > 0$. }

 }

 
\chapter{\textcolor{Chapter }{Topological data analysis}}\logpage{[ 5, 0, 0 ]}
\hyperdef{L}{X7B7E077887694A9F}{}
{
 
\section{\textcolor{Chapter }{Persistent homology }}\logpage{[ 5, 1, 0 ]}
\hyperdef{L}{X80A70B20873378E0}{}
{
 

Pairwise distances between $74$ points from some metric space have been recorded and stored in a $74\times 74$ matrix $D$. The following commands load the matrix, construct a filtration of length $100$ on the first two dimensions of the assotiated clique complex (also known as
the \emph{Rips Complex}), and display the resulting degree $0$ persistent homology as a barcode. A single bar with label $n$ denotes $n$ bars with common starting point and common end point. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data253a.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  
  !gapprompt@gap>| !gapinput@G:=SymmetricMatrixToFilteredGraph(D,100);|
  Filtered graph on 74 vertices.
  
  !gapprompt@gap>| !gapinput@K:=FilteredRegularCWComplex(CliqueComplex(G,2));|
  Filtered regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(K,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

 The next commands display the resulting degree $1$ persistent homology as a barcode. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(K,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

 The following command displays the $1$ skeleton of the simplicial complex arizing as the $65$-th term in the filtration on the clique complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=FiltrationTerm(K,65);|
  Regular CW-complex of dimension 1
  
  !gapprompt@gap>| !gapinput@Display(HomotopyGraph(Y));|
  
\end{Verbatim}
  

These computations suuggest that the dataset contains two persistent path
components (or clusters), and that each path component is in some sense
periodic. The final command displays one possible representation of the data
as points on two circles. 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 1, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

Each point in the dataset was an image consisting of $732\times 761$ pixels. This point was regarded as a vector in $\mathbb R^{732\times 761}$ and the matrix $D$ was constructed using the Euclidean metric. The images were the following: 

  }

 }

 
\section{\textcolor{Chapter }{Mapper clustering}}\logpage{[ 5, 2, 0 ]}
\hyperdef{L}{X849556107A23FF7B}{}
{
 

The following example reads in a set $S$ of vectors of rational numbers. It uses the Euclidean distance $d(u,v)$ between vectors. It fixes some vector
\$u{\textunderscore}0\texttt{\symbol{92}}in S\$ and uses the associated
function $f\colon D\rightarrow [0,b] \subset \mathbb R, v\mapsto d(u_0,v)$. In addition, it uses an open cover of the interval $[0,b]$ consisting of $100$ uniformly distributed overlapping open subintervals of radius $r=29$. It also uses a simple clustering algorithm implemented in the function \texttt{cluster}. 

 These ingredients are input into the Mapper clustering procedure to produce a
simplicial complex $M$ which is intended to be a representation of the data. The complex $M$ is $1$-dimensional and the final command uses GraphViz software to visualize the
graph. The nodes of this simplicial complex are "buckets" containing data
points. A data point may reside in several buckets. The number of points in
the bucket determines the size of the node. Two nodes are connected by an edge
when their end-point nodes contain common data points. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data134.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@dx:=EuclideanApproximatedMetric;;|
  !gapprompt@gap>| !gapinput@dz:=EuclideanApproximatedMetric;;|
  !gapprompt@gap>| !gapinput@L:=List(S,x->Maximum(List(S,y->dx(x,y))));;|
  !gapprompt@gap>| !gapinput@n:=Position(L,Minimum(L));;|
  !gapprompt@gap>| !gapinput@f:=function(x); return [dx(S[n],x)]; end;;|
  !gapprompt@gap>| !gapinput@P:=30*[0..100];; P:=List(P, i->[i]);;|
  !gapprompt@gap>| !gapinput@r:=29;;|
  !gapprompt@gap>| !gapinput@epsilon:=75;;|
  !gapprompt@gap>| !gapinput@ cluster:=function(S)|
  !gapprompt@>| !gapinput@  local Y, P, C;|
  !gapprompt@>| !gapinput@  if Length(S)=0 then return S; fi;|
  !gapprompt@>| !gapinput@  Y:=VectorsToOneSkeleton(S,epsilon,dx);|
  !gapprompt@>| !gapinput@  P:=PiZero(Y);|
  !gapprompt@>| !gapinput@  C:=Classify([1..Length(S)],P[2]);|
  !gapprompt@>| !gapinput@  return List(C,x->S{x});|
  !gapprompt@>| !gapinput@ end;;|
  !gapprompt@gap>| !gapinput@M:=Mapper(S,dx,f,dz,P,r,cluster);|
  Simplicial complex of dimension 1.
  
  !gapprompt@gap>| !gapinput@Display(GraphOfSimplicialComplex(M));|
  
\end{Verbatim}
  
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 2, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

 The datacloud $S$ consists of the $400$ points in the plane shown in the following picture. 

  }

 }

 
\section{\textcolor{Chapter }{Digital image analysis}}\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X825C5B837A08F579}{}
{
 

The following example reads in a digital image as a filtered pure cubical
complexex. The filtration is obtained by thresholding at a sequence of
uniformly spaced values on the greyscale range. The persistent homology of
this filtered complex is calculated in degrees $0$ and $1$ and displayed as two barcodes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("image1.3.2.png");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,20);|
  Filtered pure cubical complex of dimension 2.
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(F,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

The $20$ persistent bars in the degree $0$ barcode suggest that the image has $20$ objects. The degree $1$ barcode suggests that $14$ (or possibly $17$) of these objects have holes in them. 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 3, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

The following image was used in the example. 

  }

 }

 
\section{\textcolor{Chapter }{Random simplicial complexes}}\logpage{[ 5, 4, 0 ]}
\hyperdef{L}{X87AF06677F05C624}{}
{
 

For a positive integer $n$ and probability $p$ we denote by $Y(n,p)$ the \emph{Linial-Meshulam random simplicial 2-complex}. Its $1$-skeleton is the complete graph on $n$ vertices; each possible $2$-simplex is included independently with probability $p$. 

The following commands first compute the number $h_i$ of non-trivial cyclic summands in $H_i(Y(100,p), \mathbb Z)$ for a range of probabilities $p$ and $i=1,2$ and then produce a plot of $h_i$ versus $p$. The plot for $h_1$ is red and the plot for $h_2$ is blue. A plot for the Euler characteristic $1-h_1+h_2$ is shown in green. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;M:=[];;|
  !gapprompt@gap>| !gapinput@for p in [1..100] do|
  !gapprompt@>| !gapinput@K:=RegularCWComplex(RandomSimplicialTwoComplex(100,p/1000));;|
  !gapprompt@>| !gapinput@h1:=Length(Homology(K,1));;|
  !gapprompt@>| !gapinput@h2:=Length(Homology(K,2));;|
  !gapprompt@>| !gapinput@Add(L, [1.0*(p/1000),h1,"red"]);|
  !gapprompt@>| !gapinput@Add(L, [1.0*(p/1000),h2,"blue"]);|
  !gapprompt@>| !gapinput@Add(M, [1.0*(p/1000),1-h1+h2,"green"]);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@ScatterPlot(L);|
  !gapprompt@gap>| !gapinput@ScatterPlot(M);|
  
\end{Verbatim}
 

   

From this plot it seems that there is a \emph{phase change threshold} at around $p=0.025$. An inspection of the first homology groups $H_1(Y(100,p), \mathbb Z)$ shows that in most cases there is no torsion. However, around the threshold
some of the complexes do have torsion in their first homology. 

Similar commands for $Y(75,p)$ suggest a phase transition at around $p=0.035$ in this case. The following commands compute $H_1(Y(75,p), \mathbb Z)$ for $900$ random $2$-complexes with $p$ in a small interval around $ 0.035$ and, in each case where there is torsion, the torsion coefficients are stored
in a list. The final command prints these lists -- all but one of which are of
length $1$. For example, there is one $2$-dimensional simplicial complex on $75$ vertices whose first homology contains the summand $\mathbb Z_{107879661870516800665161182578823128}$. The largest prime factor is $80555235907994145009690263$ occuring in the summand $\mathbb Z_{259837760616287294231081766978855}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@torsion:=function(n,p)|
  !gapprompt@>| !gapinput@local H, Y;|
  !gapprompt@>| !gapinput@Y:=RegularCWComplex(RandomSimplicialTwoComplex(n,p));|
  !gapprompt@>| !gapinput@H:=Homology(Y,1);|
  !gapprompt@>| !gapinput@H:=Filtered(H,x->not x=0);|
  !gapprompt@>| !gapinput@return H;|
  !gapprompt@>| !gapinput@end;|
  function( n, p ) ... end
  
  
  !gapprompt@gap>| !gapinput@L:=[];;for n in [73000..73900] do|
  !gapprompt@>| !gapinput@t:=torsion(75,n/2000000);  |
  !gapprompt@>| !gapinput@if not t=[] then Add(L,t); fi;|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@Display(L);|
  [ [                                     2 ],
    [                                    26 ],
    [     259837760616287294231081766978855 ],
    [                                     2 ],
    [                                     3 ],
    [                                     2 ],
    [          2761642698060127444812143568 ],
    [       2626355281010974663776273381976 ],
    [                                     2 ],
    [                                     3 ],
    [         33112382751264894819430785350 ],
    [                                    16 ],
    [                                     4 ],
    [                                     3 ],
    [                                     2 ],
    [                                     3 ],
    [                                     2 ],
    [      85234949999183888967763100590977 ],
    [                                     2 ],
    [      24644196130785821107897718662022 ],
    [                                     2,                                     2 ],
    [                                     2 ],
    [           416641662889025645492982468 ],
    [         41582773001875039168786970816 ],
    [                                     2 ],
    [            75889883165411088431747730 ],
    [         33523474091636554792305315165 ],
    [  107879661870516800665161182578823128 ],
    [          5588265814409119568341729980 ],
    [                                     2 ],
    [          5001457249224115878015053458 ],
    [                                    10 ],
    [                                    12 ],
    [                                     2 ],
    [                                     2 ],
    [                                     3 ],
    [          7757870243425246987971789322 ],
    [       8164648856993269673396613497412 ],
    [                                     2 ] ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Group theoretic computations}}\logpage{[ 6, 0, 0 ]}
\hyperdef{L}{X7C07F4BD8466991A}{}
{
 
\section{\textcolor{Chapter }{Third homotopy group of a supsension of an Eilenberg-MacLane space }}\logpage{[ 6, 1, 0 ]}
\hyperdef{L}{X86D7FBBD7E5287C9}{}
{
 

The following example uses the nonabelian tensor square of groups to compute
the third homotopy group 

$\pi_3(S(K(G,1))) = \mathbb Z^{30}$ 

of the suspension of the Eigenberg-MacLane space $K(G,1)$ for $G$ the free nilpotent group of class $2$ on four generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(4);;G:=NilpotentQuotient(F,2);;|
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Representations of knot quandles}}\logpage{[ 6, 2, 0 ]}
\hyperdef{L}{X803FDFFE78A08446}{}
{
 

 The following example constructs the finitely presented quandles associated to
the granny knot and square knot, and then computes the number of quandle
homomorphisms from these two finitely prresented quandles to the $17$-th quandle in \textsc{HAP}'s library of connected quandles of order $24$. The number of homomorphisms differs between the two cases. The computation
therefore establishes that the complement in $\mathbb R^3$ of the granny knot is not homeomorphic to the complement of the square knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=ConnectedQuandle(24,17,"import");;|
  !gapprompt@gap>| !gapinput@K:=PureCubicalKnot(3,1);;|
  !gapprompt@gap>| !gapinput@L:=ReflectedCubicalKnot(K);;|
  !gapprompt@gap>| !gapinput@square:=KnotSum(K,L);;|
  !gapprompt@gap>| !gapinput@granny:=KnotSum(K,K);;|
  !gapprompt@gap>| !gapinput@gcsquare:=GaussCodeOfPureCubicalKnot(square);;|
  !gapprompt@gap>| !gapinput@gcgranny:=GaussCodeOfPureCubicalKnot(granny);;|
  !gapprompt@gap>| !gapinput@Qsquare:=PresentationKnotQuandle(gcsquare);;|
  !gapprompt@gap>| !gapinput@Qgranny:=PresentationKnotQuandle(gcgranny);;|
  !gapprompt@gap>| !gapinput@NumberOfHomomorphisms(Qsquare,Q);|
  408
  !gapprompt@gap>| !gapinput@NumberOfHomomorphisms(Qgranny,Q);|
  24
  
\end{Verbatim}
 

 The following commands compute a knot quandle directly from a pdf file
containing the following hand-drawn image of the knot. 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ gc:=ReadLinkImageAsGaussCode("myknot.pdf");|
  [ [ [ -2, 4, -1, 3, -3, 2, -4, 1 ] ], [ -1, -1, 1, -1 ] ]
  !gapprompt@gap>| !gapinput@Q:=PresentationKnotQuandle(gc);|
  Quandle presentation of 4 generators and 4 relators.
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying knots}}\logpage{[ 6, 3, 0 ]}
\hyperdef{L}{X7E4EFB987DA22017}{}
{
 Low index subgrops of the knot group can be used to identify knots with few
crossings. For instance, the following commands read in the following image of
a knot and identify it as a sum of two trefoils. The commands determine the
prime components only up to reflection, and so they don't distinguish between
the granny and square knots. 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gc:=ReadLinkImageAsGaussCode("myknot2.png");|
  [ [ [ -4, 7, -5, 4, -7, 5, -3, 6, -2, 3, 8, -8, -6, 2, 1, -1 ] ], 
    [ 1, -1, -1, -1, -1, -1, -1, 1 ] ]
  !gapprompt@gap>| !gapinput@IdentifyKnot(gc);;|
  PrimeKnot(3,1) + PrimeKnot(3,1)    modulo reflections of components. 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Aspherical $2$-complexes}}\logpage{[ 6, 4, 0 ]}
\hyperdef{L}{X8664E986873195E6}{}
{
 

The following example uses Polymake's linear programming routines to establish
that the $2$-complex associated to the group presentation $<x,y,z : xyx=yxy,\, yzy=zyz,\, xzx=zxz>$ is aspherical (that is, has contractible universal cover). The presentation is
Tietze equivalent to the presentation used in the computer code, and the
associated $2$-complexes are thus homotopy equivalent. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(6);;|
  !gapprompt@gap>| !gapinput@x:=F.1;;y:=F.2;;z:=F.3;;a:=F.4;;b:=F.5;;c:=F.6;;|
  !gapprompt@gap>| !gapinput@rels:=[a^-1*x*y, b^-1*y*z, c^-1*z*x, a*x*(y*a)^-1,|
  !gapprompt@>| !gapinput@   b*y*(z*b)^-1, c*z*(x*c)^-1];;|
  !gapprompt@gap>| !gapinput@Print(IsAspherical(F,rels),"\n");|
  Presentation is aspherical.
  
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bogomolov multiplier}}\logpage{[ 6, 5, 0 ]}
\hyperdef{L}{X7F719758856A443D}{}
{
 

The Bogomolov multiplier of a group is an isoclinism invariant. Using this
property, the following example shows that there are precisely three groups of
order $243$ with non-trivial Bogomolov multiplier. The groups in question are numbered 28,
29 and 30 in \textsc{GAP}'s library of small groups of order $243$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=AllSmallGroups(3^5);;|
  !gapprompt@gap>| !gapinput@C:=IsoclinismClasses(L);;|
  !gapprompt@gap>| !gapinput@for c in C do|
  !gapprompt@>| !gapinput@if Length(BogomolovMultiplier(c[1]))>0 then|
  !gapprompt@>| !gapinput@Print(List(c,g->IdGroup(g)),"\n\n\n"); fi;|
  !gapprompt@>| !gapinput@od;|
  [ [ 243, 28 ], [ 243, 29 ], [ 243, 30 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Second group cohomology and group extensions}}\label{secExtensions}
\logpage{[ 6, 6, 0 ]}
\hyperdef{L}{X8333413B838D787D}{}
{
 Any group extension $N\rightarrowtail E \twoheadrightarrow G$ gives rise to: 
\begin{itemize}
\item  an outer action $\alpha\colon G\rightarrow Out(G)$ of $G$ on $N$.
\item an action $G\rightarrow Aut(Z(N))$ of $G$ on the centre of $N$, uniquely induced by the outer action $\alpha$ and the canonical action of $Out(N)$ on $Z(N)$.
\item a $2$-cocycle $f\colon G\times G\rightarrow Z(N)$ with values in the $G$-module $A=Z(N)$.
\end{itemize}
 

Any outer homomorphism $\alpha\colon G\rightarrow Out(N)$ gives rise to a cohomology class $k$ in $H^3(G,Z(N))$. It was shown by Eilenberg and Mac$\,$Lane that the class $k$ is trivial if and only if the outer action $\alpha$ arises from some group extension $N\rightarrowtail E\twoheadrightarrow G$. If $k$ is trivial then there is a bijection between the second cohomology group $H^2(G,Z(N))$ and Yoneda equivalence classes of extensions of $G$ by $N$ that are compatible with $\alpha$. 

\textsc{First Example.} 

 Consider the group $H=SmallGroup(64,134)$. Consider the normal subgroup $N=NormalSubgroups(G)[15]$ and quotient group $G=H/N$. We have $N=C_2\times D_4$, $A=Z(N)=C_2\times C_2$ and $G=C_2\times C_2$. 

 Suppose we wish to classify all extensions $C_2\times D_4 \rightarrowtail E \twoheadrightarrow C_2\times C_2$ that induce the given outer action of $G$ on $N$. The following commands show that, up to Yoneda equivalence, there are two
such extensions. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=SmallGroup(64,134);;|
  !gapprompt@gap>| !gapinput@N:=NormalSubgroups(H)[15];;|
  !gapprompt@gap>| !gapinput@A:=Centre(GOuterGroup(H,N));;|
  !gapprompt@gap>| !gapinput@G:=ActingGroup(A);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,3);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,A);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,2);|
  [ 2 ]
  
\end{Verbatim}
 

The following additional commands return a standard $2$-cocycle $f:G\times G\rightarrow A =C_2\times C_2$ corresponding to the non-trivial element in $H^2(G,A)$. The value $f(g,h)$ of the $2$-cocycle is calculated for all $16$ pairs $g,h \in G$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|CH:=CohomologyModule(C,2);;B
  @gapprompt|gap>B @gapinput|Elts:=Elements(ActedGroup(CH));B
  [ <identity> of ..., f1 ]
  
  @gapprompt|gap>B @gapinput|x:=Elts[2];;B
  @gapprompt|gap>B @gapinput|c:=CH!.representativeCocycle(x);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|f:=Mapping(c);;B
  @gapprompt|gap>B @gapinput|for g in G do for h in G doB
  @gapprompt|>B @gapinput|Print(f(g,h),"\n");B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|>B @gapinput|od;B
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  f6
  <identity> of ...
  f6
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  <identity> of ...
  f6
  <identity> of ...
  f6
  
\end{Verbatim}
 

The following commands will then construct and identify all extensions of $N$ by $G$ corresponding to the given outer action of $G$ on $N$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|H := SmallGroup(64,134);;B
  @gapprompt|gap>B @gapinput|N := NormalSubgroups(H)[15];;B
  @gapprompt|gap>B @gapinput|ON := GOuterGroup(H,N);;B
  @gapprompt|gap>B @gapinput|A := Centre(ON);;B
  @gapprompt|gap>B @gapinput|G:=ActingGroup(A);;B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;B
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,A);;B
  @gapprompt|gap>B @gapinput|CH:=CohomologyModule(C,2);;B
  @gapprompt|gap>B @gapinput|Elts:=Elements(ActedGroup(CH));;B
  
  @gapprompt|gap>B @gapinput|lst := List(Elts{[1..Length(Elts)]},x->CH!.representativeCocycle(x));;B
  @gapprompt|gap>B @gapinput|ccgrps := List(lst, x->CcGroup(ON, x));;B
  @gapprompt|gap>B @gapinput|#So ccgrps is a list of groups, each being an extension of G by N, correspondingB
  @gapprompt|gap>B @gapinput|#to the two elements in H^2(G,A).B
  
  @gapprompt|gap>B @gapinput|#The following command produces the GAP identification number for each group.B
  @gapprompt|gap>B @gapinput|L:=List(ccgrps,IdGroup);B
  [ [ 64, 134 ], [ 64, 135 ] ]
  
\end{Verbatim}
 

\textsc{Second Example} 

The following example illustrates how to construct a cohomology class $k$ in $H^2(G, A)$ from a cocycle $f:G \times G \rightarrow A$, where $G=SL_2(\mathbb Z_4)$ and $A=\mathbb Z_8$ with trivial action. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|#We'll construct G=SL(2,Z_4) as a permutation group.B
  @gapprompt|gap>B @gapinput|G:=SL(2,ZmodnZ(4));;B
  @gapprompt|gap>B @gapinput|G:=Image(IsomorphismPermGroup(G));;B
  
  @gapprompt|gap>B @gapinput|#We'll construct Z_8=Z/8Z as a G-outer groupB
  @gapprompt|gap>B @gapinput|z_8:=Group((1,2,3,4,5,6,7,8));;B
  @gapprompt|gap>B @gapinput|Z_8:=TrivialGModuleAsGOuterGroup(G,z_8);;B
  
  @gapprompt|gap>B @gapinput|#We'll compute the group h=H^2(G,Z_8)B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;  #R is a free resolutionB
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,Z_8);; # C is a chain complexB
  @gapprompt|gap>B @gapinput|H:=CohomologyModule(C,2);; #H is the second cohomology H^2(G,Z_8)B
  @gapprompt|gap>B @gapinput|h:=ActedGroup(H);; #h is the underlying group of HB
  
  @gapprompt|gap>B @gapinput|#We'll compute  cocycles c2, c5 for the second and fifth cohomology classsB
  @gapprompt|gap>B @gapinput|c2:=H!.representativeCocycle(Elements(h)[2]);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|c5:=H!.representativeCocycle(Elements(h)[5]);B
  Standard 2-cocycle 
  
  @gapprompt|gap>B @gapinput|#Now we'll construct the cohomology classes C2, C5 in the group h corresponding to the cocycles c2, c5.B
  @gapprompt|gap>B @gapinput|C2:=CohomologyClass(H,c2);;B
  @gapprompt|gap>B @gapinput|C5:=CohomologyClass(H,c5);;B
   
  @gapprompt|gap>B @gapinput|#Finally, we'll show that C2, C5 are distinct cohomology classes, both of order 4.B
  @gapprompt|gap>B @gapinput|C2=C5;B
  false
  @gapprompt|gap>B @gapinput|Order(C2);B
  4
  @gapprompt|gap>B @gapinput|Order(C5);B
  4
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Second group cohomology and cocyclic Hadamard matrices}}\label{secHadamard}
\logpage{[ 6, 7, 0 ]}
\hyperdef{L}{X7C60E2B578074532}{}
{
 An \emph{Hadamard matrix} is a square $n\times n$ matrix $H$ whose entries are either $+1$ or $-1$ and whose rows are mutually orthogonal, that is $H H^t = nI_n$ where $H^t$ denotes the transpose and $I_n$ denotes the $n\times n$ identity matrix. 

Given a group $G=\{g_1,g_2,\ldots,g_n\}$ of order $n$ and the abelian group $A=\{1,-1\}$ of square roots of unity, any $2$-cocycle $f\colon G\times G\rightarrow A$ corresponds to an $n\times n$ matrix $F=(f(g_i,g_j))_{1\le i,j\le n}$ whose entries are $\pm 1$. If $F$ is Hadamard it is called a \emph{cocyclic Hadamard matrix} corresponding to $G$. 

The following commands compute all $192$ of the cocyclic Hadamard matrices for the abelian group $G=\mathbb Z_4\oplus \mathbb Z_4$ of order $n=16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AbelianGroup([4,4]);;|
  !gapprompt@gap>| !gapinput@F:=CocyclicHadamardMatrices(G);;|
  !gapprompt@gap>| !gapinput@Length(F);|
  192
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Third group cohomology and homotopy $2$-types}}\label{secCat1}
\logpage{[ 6, 8, 0 ]}
\hyperdef{L}{X78040D8580D35D53}{}
{
  \textsc{Homotopy 2-types} 

 The third cohomology $H^3(G,A)$ of a group $G$ with coefficients in a $G$-module $A$, together with the corresponding $3$-cocycles, can be used to classify homotopy $2$-types. A \emph{homotopy 2-type} is a CW-complex whose homotopy groups are trivial in dimensions $n=0$ and $n>2$. There is an equivalence between the two categories 
\begin{enumerate}
\item  (Homotopy category of connected CW-complexes $X$ with trivial homotopy groups $\pi_n(X)$ for $n>2$) 
\item  (Localization of the category of simplicial groups with Moore complex of
length $1$, where localization is with respect to homomorphisms inducing isomorphisms on
homotopy groups) 
\end{enumerate}
 which reduces the homotopy theory of $2$-types to a 'computable' algebraic theory. Furthermore, a simplicial group
with Moore complex of length $1$ can be represented by a group $H$ endowed with two endomorphisms $s\colon H\rightarrow H$ and $t\colon H\rightarrow H$ satisfying the axioms 
\begin{itemize}
\item $ss=s$, $ts=s$,
\item $tt=t$, $st=t$,
\item  $[\ker s, \ker t] = 1$.
\end{itemize}
 Ths triple $(H,s,t)$ was termed a \emph{cat$^1$-group} by J.-L. Loday since it can be regarded as a group $H$ endowed with one compatible category structure. 

The \emph{homotopy groups} of a cat$^1$-group $H$ are defined as: $\pi_1(H) = {\rm image}(s)/t(\ker(s))$; $\pi_2(H)=\ker(s) \cap \ker(t)$; $\pi_n(H)=0$ for $n> 2$ or $n=0$. Note that $\pi_2(H)$ is a $\pi_1(H)$-module where the action is induced by conjugation in $H$. 

A homotopy $2$-type $X$ can be represented by a cat$^1$-group $H$ or by the homotopy groups $\pi_1X=\pi_1H$, $\pi_2X=\pi_2H$ and a cohomology class $k\in H^3(\pi_1X,\pi_2X)$. This class $k$ is the \emph{Postnikov invariant}. 

\textsc{Relation to Group Theory} 

A number of standard group-theoretic constructions can be viewed naturally as
a cat$^1$-group. 
\begin{enumerate}
\item  A $\mathbb ZG$-module $A$ can be viewed as a cat$^1$-group $(H,s,t)$ where $H$ is the semi-direct product $A\rtimes G$ and $s(a,g)=(1,g)$, $t(a,g)=(1,g)$. Here $\pi_1(H)=G$ and $\pi_2(H)=A$.
\item  A group $G$ with normal subgroup $N$ can be viewed as a cat$^1$-group $(H,s,t)$ where $H$ is the semi-direct product $N\rtimes G$ and $s(n,g)=(1,g)$, $t(n,g)=(1,ng)$. Here $\pi_1(H)=G/N$ and $\pi_2(H)=0$.
\item  The homomorphism $\iota \colon G\rightarrow Aut(G)$ which sends elements of a group $G$ to the corresponding inner automorphism can be viewed as a cat$^1$-group $(H,s,t)$ where $H$ is the semi-direct product $G\rtimes Aut(G)$ and $s(g,a)=(1,a)$, $t(g,a)=(1,\iota (g)a)$. Here $\pi_1(H)=Out(G)$ is the outer automorphism group of $G$ and $\pi_2(H)=Z(G)$ is the centre of $G$.
\end{enumerate}
 These three constructions are implemented in \textsc{HAP}. 

\textsc{Example} 

The following commands begin by constructing the cat$^1$-group $H$ of Construction 3 for the group $G=SmallGroup(64,134)$. They then construct the fundamental group of $H$ and the second homotopy group of as a $\pi_1$-module. These homotopy groups have orders $8$ and $2$ respectively. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(64,134);;|
  !gapprompt@gap>| !gapinput@H:=AutomorphismGroupAsCatOneGroup(G);;|
  !gapprompt@gap>| !gapinput@pi_1:=HomotopyGroup(H,1);;|
  !gapprompt@gap>| !gapinput@pi_2:=HomotopyModule(H,2);;|
  !gapprompt@gap>| !gapinput@Order(pi_1);|
  8
  !gapprompt@gap>| !gapinput@Order(ActedGroup(pi_2));|
  2
  
\end{Verbatim}
 

 The following additional commands show that there are $1024$ Yoneda equivalence classes of cat$^1$-groups with fundamental group $\pi_1$ and $\pi_1$- module equal to $\pi_2$ in our example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(pi_1,4);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,pi_2);;|
  !gapprompt@gap>| !gapinput@CH:=CohomologyModule(C,3);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(ActedGroup(CH));|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 A $3$-cocycle $f \colon \pi_1 \times \pi_1 \times \pi_1 \rightarrow \pi_2$ corresponding to a random cohomology class $k\in H^3(\pi_1,\pi_2)$ can be produced using the following command. }

 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|x:=Random(Elements(ActedGroup(CH)));;B
  @gapprompt|gap>B @gapinput|f:=CH!.representativeCocycle(x);B
  Standard 3-cocycle 
  
\end{Verbatim}
 The $3$-cocycle corresponding to the Postnikov invariant of $H$ itself can be easily constructed directly from its definition in terms of a
set-theoretic 'section' of the crossed module corresponding to $H$. }

 
\chapter{\textcolor{Chapter }{Cohomology of groups}}\logpage{[ 7, 0, 0 ]}
\hyperdef{L}{X7E34E2C6868F2726}{}
{
 
\section{\textcolor{Chapter }{Finite groups }}\logpage{[ 7, 1, 0 ]}
\hyperdef{L}{X807B265978F90E01}{}
{
 

It is possible to compute the low degree (co)homology of a finite group or
monoid of small order directly from the bar resolution. The following commands
take this approach to computing the fifth integral homology 

$H_5(Q_4,\mathbb Z) = \mathbb Z_2\oplus\mathbb Z_2$ 

of the quaternion group $G=Q_4$ of order $8$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Q:=QuaternionGroup(8);;A
  @gapprompt|gap>A @gapinput|B:=BarComplexOfMonoid(Q,6);;                 A
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(B);;A
  @gapprompt|gap>A @gapinput|Homology(C,5);A
  [ 2, 2 ]
  
  
  @gapprompt|gap>A @gapinput|List([0..6],B!.dimension);A
  [ 1, 7, 49, 343, 2401, 16807, 117649 ]
  @gapprompt|gap>A @gapinput|List([0..6],C!.dimension);A
  [ 1, 2, 2, 1, 2, 4, 102945 ]
  
\end{Verbatim}
 

However, this approach is of limited applicability since the bar resolution
involves $|G|^k$ free generators in degree $k$. A range of techniques, tailored to specific classes of groups, can be used
to compute the (co)homology of larger finite groups. 

 The following example computes the fourth integral cohomomogy of the Mathieu
group $M_{24}$. 

$H^4(M_{24},\mathbb Z) = \mathbb Z_{12}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupCohomology(MathieuGroup(24),4);|
  [ 4, 3 ]
  
\end{Verbatim}
 

The following example computes the third integral homology of the Weyl group $W=Weyl(E_8)$, a group of order $696729600$. 

$H_3(Weyl(E_8),\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb
Z_{12}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=SimpleLieAlgebra("E",8,Rationals);;|
  !gapprompt@gap>| !gapinput@W:=WeylGroup(RootSystem(L));;|
  !gapprompt@gap>| !gapinput@Order(W);|
  696729600
  !gapprompt@gap>| !gapinput@GroupHomology(W,3);|
  [ 2, 2, 4, 3 ]
  
\end{Verbatim}
 

The preceding calculation could be achieved more quickly by noting that $W=Weyl(E_8)$ is a Coxeter group, and by using the associated Coxeter polytope. The
following example uses this approach to compute the fourth integral homology
of $W$. It begins by displaying the Coxeter diagram of $W$, and then computes 

$H_4(Weyl(E_8),\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2 \oplus Z_2 \oplus
\mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3],[5,3]],[5,[6,3]],[6,[7,3]],[7,[8,3]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@polytope:=CoxeterComplex_alt(D,5);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(polytope,5);|
  Resolution of length 5 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);|
  Chain complex of length 5 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,4);|
  [ 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example computes the sixth mod-$2$ homology of the Sylow $2$-subgroup $Syl_2(M_{24})$ of the Mathieu group $M_{24}$. 

$H_6(Syl_2(M_{24}),\mathbb Z_2) = \mathbb Z_2^{143}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(SylowSubgroup(MathieuGroup(24),2),6,2);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example constructs the Poincare series 

$p(x)=\frac{1}{-x^3+3*x^2-3*x+1}$ 

for the cohomology $H^\ast(Syl_2(M_{12},\mathbb F_2)$. The coefficient of $x^n$ in the expansion of $p(x)$ is equal to the dimension of the vector space $H^n(Syl_2(M_{12},\mathbb F_2)$. The computation involves \textsc{Singular}'s Groebner basis algorithms and the Lyndon-Hochschild-Serre spectral
sequence. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@P:=PoincareSeriesLHS(G);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 The additional following command uses the Poincare series 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@RankHomologyPGroup(G,P,1000);|
  251000
  
\end{Verbatim}
 to determine that $H_{1000}(Syl_2(M_{12},\mathbb Z)$ is a direct sum of 251000 non-trivial cyclic $2$-groups. 

The following example constructs the series 

$p(x)=\frac{x^4-x^3+x^2-x+1}{x^6-x^5+x^4-2*x^3+x^2-x+1}$ 

whose coefficient of $x^n$ is equal to the dimension of the vector space $H^n(M_{11},\mathbb F_2)$ for all $n$ in the range $0\le n\le 14$. The coefficient is not guaranteed correct for $n\ge 15$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@PoincareSeriesPrimePart(MathieuGroup(11),2,14);|
  (x_1^4-x_1^3+x_1^2-x_1+1)/(x_1^6-x_1^5+x_1^4-2*x_1^3+x_1^2-x_1+1)
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Nilpotent groups}}\logpage{[ 7, 2, 0 ]}
\hyperdef{L}{X8463EF6A821FFB69}{}
{
 The following example computes 

$H_4(N,\mathbb Z) = \mathbb (Z_3)^4 \oplus \mathbb Z^{84}$ 

for the free nilpotent group $N$ of class $2$ on four generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(4);; N:=NilpotentQuotient(F,2);;|
  !gapprompt@gap>| !gapinput@GroupHomology(N,4);|
  [ 3, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Crystallographic and Almost Crystallographic groups}}\logpage{[ 7, 3, 0 ]}
\hyperdef{L}{X82E8FAC67BC16C01}{}
{
 

The following example computes 

$H_5(G,\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_2$ 

for the $3$-dimensional crystallographic space group $G$ with Hermann-Mauguin symbol "P62" 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(SpaceGroupBBNWZ("P62"),5);|
  [ 2, 2 ]
  
\end{Verbatim}
 

The following example computes 

$H^5(G,\mathbb Z)= \mathbb Z$ 

 for an almost crystallographic group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlmostCrystallographicPcpGroup( 4, 50, [ 1, -4, 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@GroupCohomology(G,4);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Arithmetic groups}}\logpage{[ 7, 4, 0 ]}
\hyperdef{L}{X7AFFB32587D047FE}{}
{
 

The following example computes 

$H_6(SL_2({\cal O},\mathbb Z) = \mathbb Z_2 \oplus \mathbb Z_{12}$ 

for ${\cal O}$ the ring of integers of the number field $\mathbb Q(\sqrt{-2})$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=ContractibleGcomplex("SL(2,O-2)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(C,7);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),6);|
  [ 2, 12 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Artin groups}}\logpage{[ 7, 5, 0 ]}
\hyperdef{L}{X800CB6257DC8FB3A}{}
{
 

The following example computes 

$H_5(G,\mathbb Z) = \mathbb Z_3$ 

for $G$ the classical braid group on eight strings. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3]],[4,[5,3]],[5,[6,3]],[6,[7,3]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);;|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionArtinGroup(D,6);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);;|
  !gapprompt@gap>| !gapinput@Homology(C,5);|
  [ 3 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Graphs of groups}}\logpage{[ 7, 6, 0 ]}
\hyperdef{L}{X7BAFCA3680E478AE}{}
{
 

The following example computes 

$H_5(G,\mathbb Z) = \mathbb Z_2\oplus Z_2\oplus Z_2 \oplus Z_2 \oplus Z_2$ 

for $G$ the graph of groups corresponding to the amalgamated product $G=S_5*_{S_3}S_4$ of the symmetric groups $S_5$ and $S_4$ over the canonical subgroup $S_3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");|
  !gapprompt@gap>| !gapinput@S4:=SymmetricGroup(4);SetName(S4,"S4");|
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");|
  !gapprompt@gap>| !gapinput@AS5:=GroupHomomorphismByFunction(A,S5,x->x);|
  !gapprompt@gap>| !gapinput@AS4:=GroupHomomorphismByFunction(A,S4,x->x);|
  !gapprompt@gap>| !gapinput@D:=[S5,S4,[AS5,AS4]];|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,6);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),5);|
  [ 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology with coefficients in a module}}\logpage{[ 7, 7, 0 ]}
\hyperdef{L}{X7C3DEDD57BB4D537}{}
{
 There are various ways to represent a $\mathbb ZG$-module $A$ with action $G\times A \rightarrow A, (g,a)\mapsto \alpha(g,a)$. 

One possibility is to use the data type of a \emph{$G$-Outer Group} which involves three components: an $ActedGroup$ $A$; an $Acting Group$ $G$; a $Mapping$ $(g,a)\mapsto \alpha(g,a)$. The following example uses this data type to compute the cohomology $H^4(G,A) =\mathbb Z_5 \oplus \mathbb Z_{10}$ of the symmetric group $G=S_6$ with coefficients in the integers $A=\mathbb Z$ where odd permutations act non-trivially on $A$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);;|
  
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);;|
  !gapprompt@gap>| !gapinput@alpha:=function(g,a); return a^SignPerm(g); end;;|
  !gapprompt@gap>| !gapinput@A:=GModuleAsGOuterGroup(G,A,alpha);|
  ZG-module with abelian invariants [ 0 ] and G= SymmetricGroup( [ 1 .. 6 ] )
  
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@C:=HomToGModule(R,A);|
  G-cocomplex of length 5 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(C,4);|
  [ 2, 2, 5 ]
  
\end{Verbatim}
 

 If $A=\mathbb Z^n$ and $G$ acts as 

$G\times A \rightarrow A, (g, (x_1,x_2,\ldots,x_n)) \mapsto
(x_{\pi(g)^{-1}(1)}, x_{\pi(g)^{-1}(2)}, \ldots, x_{\pi(g)^{-1}(n)})$ 

 where $\pi\colon G\rightarrow S_n$ is a (not necessarily faithful) permutation representation of degree $n$ then we can avoid the use of $G$-outer groups and use just the homomorphism $\pi$ instead. The following example uses this data type to compute the cohomology 

$H^6(G,A) =\mathbb Z_2 \oplus \mathbb Z_{6}$ 

and the homology 

$H_6(G,A) =\mathbb Z_2 $ 

 of the alternating group $G=A_5$ with coefficients in $A=\mathbb Z^5$ where elements of $G$ act on $\mathbb Z^5$ via the canonical permutation of basis elements. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@pi:=PermToMatrixGroup(SymmetricGroup(5),5);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,7);;|
  !gapprompt@gap>| !gapinput@C:=HomToIntegralModule(R,pi);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,6);|
  [ 2, 6 ]
  
  !gapprompt@gap>| !gapinput@D:=TensorWithIntegralModule(R,pi);;|
  !gapprompt@gap>| !gapinput@Homology(D,6);|
  [ 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology as a functor of the first variable}}\logpage{[ 7, 8, 0 ]}
\hyperdef{L}{X7E573EA582CCEF2E}{}
{
 Suppose given a group homomorphism $f\colon G_1\rightarrow G_2$ and a $G_2$-module $A$. Then $A$ is naturally a $G_1$-module with action via $f$, and there is an induced cohomology homomorphism $H^n(f,A)\colon H^n(G_2,A) \rightarrow H^n(G_1,A)$. 

The following example computes this cohomology homomorphism in degree $n=6$ for the inclusion $f\colon A_5 \rightarrow S_5$ and $A=\mathbb Z^5$ with action that permutes the canonical basis. The final commands determine
that the kernel of the homomorphism $H^6(f,A)$ is the Klein group of order $4$ and that the cokernel is cyclic of order $6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G1:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@G2:=SymmetricGroup(5);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(G1,G2,x->x);;|
  !gapprompt@gap>| !gapinput@pi:=PermToMatrixGroup(G2,5);;|
  !gapprompt@gap>| !gapinput@R1:=ResolutionFiniteGroup(G1,7);;|
  !gapprompt@gap>| !gapinput@R2:=ResolutionFiniteGroup(G2,7);;|
  !gapprompt@gap>| !gapinput@F:=EquivariantChainMap(R1,R2,f);;|
  !gapprompt@gap>| !gapinput@C:=HomToIntegralModule(F,pi);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(C,6);|
  [ g1, g2, g3 ] -> [ id, id, g3 ]
  
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(c)/Image(c));|
  [ 2, 3 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology as a functor of the second variable and the long exact coefficient
sequence}}\logpage{[ 7, 9, 0 ]}
\hyperdef{L}{X796731727A7EBE59}{}
{
 A short exact sequence of $\mathbb ZG$-modules $A \rightarrowtail B \twoheadrightarrow C$ induces a long exact sequence of cohomology groups 

$ \rightarrow H^n(G,A) \rightarrow H^n(G,B) \rightarrow H^n(G,C) \rightarrow
H^{n+1}(G,A) \rightarrow $ . 

 Consider the symmetric group $G=S_4$ and the sequence $ \mathbb Z_4 \rightarrowtail \mathbb Z_8 \twoheadrightarrow \mathbb Z_2$ of trivial $\mathbb ZG$-modules. The following commands compute the induced cohomology homomorphism 

$f\colon H^3(S_4,\mathbb Z_4) \rightarrow H^3(S_4,\mathbb Z_8)$ 

and determine that the image of this induced homomorphism has order $8$ and that its kernel has order $2$. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|G:=SymmetricGroup(4);;D
  @gapprompt|gap>D @gapinput|x:=(1,2,3,4,5,6,7,8);;D
  @gapprompt|gap>D @gapinput|a:=Group(x^2);;D
  @gapprompt|gap>D @gapinput|b:=Group(x);;D
  @gapprompt|gap>D @gapinput|ahomb:=GroupHomomorphismByFunction(a,b,y->y);;D
  @gapprompt|gap>D @gapinput|A:=TrivialGModuleAsGOuterGroup(G,a);;D
  @gapprompt|gap>D @gapinput|B:=TrivialGModuleAsGOuterGroup(G,b);;D
  @gapprompt|gap>D @gapinput|phi:=GOuterGroupHomomorphism();;D
  @gapprompt|gap>D @gapinput|phi!.Source:=A;;D
  @gapprompt|gap>D @gapinput|phi!.Target:=B;;D
  @gapprompt|gap>D @gapinput|phi!.Mapping:=ahomb;;D
   
  @gapprompt|gap>D @gapinput|Hphi:=CohomologyHomomorphism(phi,3);;D
  
  @gapprompt|gap>D @gapinput|Size(ImageOfGOuterGroupHomomorphism(Hphi));D
  8
  
  @gapprompt|gap>D @gapinput|Size(KernelOfGOuterGroupHomomorphism(Hphi));D
  2
  
\end{Verbatim}
 

 The following commands then compute the homomorphism 

$H^3(S_4,\mathbb Z_8) \rightarrow H^3(S_4,\mathbb Z_2)$ 

induced by $\mathbb Z_4 \rightarrowtail \mathbb Z_8 \twoheadrightarrow \mathbb Z_2$, and determine that the kernel of this homomorphsim has order $8$. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|bhomc:=NaturalHomomorphismByNormalSubgroup(b,a);D
  @gapprompt|gap>D @gapinput|B:=TrivialGModuleAsGOuterGroup(G,b);D
  @gapprompt|gap>D @gapinput|C:=TrivialGModuleAsGOuterGroup(G,Image(bhomc));D
  @gapprompt|gap>D @gapinput|psi:=GOuterGroupHomomorphism();D
  @gapprompt|gap>D @gapinput|psi!.Source:=B;D
  @gapprompt|gap>D @gapinput|psi!.Target:=C;D
  @gapprompt|gap>D @gapinput|psi!.Mapping:=bhomc;D
  
  @gapprompt|gap>D @gapinput|Hpsi:=CohomologyHomomorphism(psi,3);D
  
  @gapprompt|gap>D @gapinput|Size(KernelOfGOuterGroupHomomorphism(Hpsi));D
  8
  
\end{Verbatim}
 

The following commands then compute the connecting homomorphism 

$H^2(S_4,\mathbb Z_2) \rightarrow H^3(S_4,\mathbb Z_4)$ 

and determine that the image of this homomorphism has order $2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@delta:=ConnectingCohomologyHomomorphism(psi,2);;|
  !gapprompt@gap>| !gapinput@Size(ImageOfGOuterGroupHomomorphism(delta));|
  
\end{Verbatim}
 Note that the various orders are consistent with exactness of the sequence 

$H^2(S_4,\mathbb Z_2) \rightarrow H^3(S_4,\mathbb Z_4) \rightarrow
H^3(S_4,\mathbb Z_8) \rightarrow H^3(S_4,\mathbb Z_2) $ . }

 
\section{\textcolor{Chapter }{Transfer Homomorphism}}\logpage{[ 7, 10, 0 ]}
\hyperdef{L}{X80F6FD3E7C7E4E8D}{}
{
 Consider the action of the symmetric group $G=S_5$ on $A=\mathbb Z^5$ which permutes the canonical basis. The action restricts to the sylow $2$-subgroup $P=Syl_2(G)$. The following commands compute the cohomology transfer homomorphism $t^4\colon H^4(P,A) \rightarrow H^4(S_5,A)$ and determine its kernel and image. The integral homology transfer $t_4\colon H_4(S_5,\mathbb Z) \rightarrow H_5(P,\mathbb Z)$ is also computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(5);;|
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@A:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@tr:=TransferCochainMap(R,P,A);|
  Cochain Map between complexes of length 5 . 
  
  !gapprompt@gap>| !gapinput@t4:=Cohomology(tr,4);|
  [ g1, g2, g3, g4 ] -> [ id, g1, g2, g4 ]
  !gapprompt@gap>| !gapinput@StructureDescription(Kernel(t4));|
  "C2 x C2"
  !gapprompt@gap>| !gapinput@StructureDescription(Image(t4));|
  "C4 x C2"
  
  !gapprompt@gap>| !gapinput@tr:=TransferChainMap(R,P);|
  Chain Map between complexes of length 5 . 
  
  !gapprompt@gap>| !gapinput@Homology(tr,4);|
  [ g1 ] -> [ g1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology rings of finite fundamental groups of 3-manifolds }}\label{Secfinitefundman}
\logpage{[ 7, 11, 0 ]}
\hyperdef{L}{X79B1406C803FF178}{}
{
 A \emph{spherical 3-manifold} is a 3-manifold arising as the quotient $S^3/\Gamma$ of the 3-sphere $S^3$ by a finite subgroup $\Gamma$ of $SO(4)$ acting freely as rotations. The geometrization conjecture, proved by Grigori
Perelman, implies that every closed connected 3-manifold with a finite
fundamental group is homeomorphic to a spherical 3-manifold. 

 A spherical 3-manifold $S^3/\Gamma$ has finite fundamental group isomorphic to $\Gamma$. This fundamental group is one of: 
\begin{itemize}
\item  $\Gamma=C_m=\langle x\ |\ x^m\rangle$ (\textsc{cyclic fundamental group})
\item  $\Gamma=C_m\times \langle x,y \ |\ xyx^{-1}=y^{-1}, x^{2^k}=y^n \rangle$ for integers $k, m\ge 1, n\ge 2$ and $m$ coprime to $2n$ (\textsc{prism manifold case})
\item  $\Gamma= C_m\times \langle x,y, z \ |\ (xy)^2=x^2=y^2, zxz^{-1}=y, zyz^{-1}=xy,
z^{3^k}=1\rangle $ for integers $k,m\ge 1$ and $m$ coprime to 6 (\textsc{tetrahedral case})
\item  $\Gamma=C_m\times\langle x,y\ |\ (xy)^2=x^3=y^4\rangle $ for $m\ge 1$ coprime to 6 (\textsc{octahedral case})
\item $\Gamma=C_m\times \langle x,y\ |\ (xy)^2=x^3=y^5\rangle $ for $m\ge 1$ coprime to 30 (\textsc{icosahedral case}).
\end{itemize}
 This list of cases is taken from the \href{https://en.wikipedia.org/wiki/Spherical_3-manifold} {Wikipedia pages}. The group $\Gamma$ has periodic cohomology since it acts on a sphere. The cyclic group has period
2 and in the other four cases it has period 4. (Recall that in general a
finite group $G$ has \emph{periodic cohomology of period $n$} if there is an element $u\in H^n(G,\mathbb Z)$ such that the cup product $-\ \cup u\colon H^k(G,\mathbb Z) \rightarrow H^{k+n}(G,\mathbb Z)$ is an isomorphism for all $k\ge 1$. It can be shown that $G$ has periodic cohomology of period $n$ if and only if $H^{n}(G,\mathbb Z)=\mathbb Z_{|G|}$.) 

The cohomology of the cyclic group is well-known, and the cohomology of a
direct product can be obtained from that of the factors using the Kunneth
formula. 

 In the icosahedral case with $m=1$ the following commands yield
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z)=Z[t]/(120t=0)\$\$ with generator $t$ of degree 4. The final command demonstrates that a periodic resolution is used
in the computation. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|F:=FreeGroup(2);;x:=F.1;;y:=F.2;;A
  @gapprompt|gap>A @gapinput|G:=F/[(x*y)^2*x^-3, x^3*y^-5];;A
  @gapprompt|gap>A @gapinput|Order(G);A
  120
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(G,5);;A
  @gapprompt|gap>A @gapinput|n:=0;;Cohomology(HomToIntegers(R),n);A
  [ 0 ]
  @gapprompt|gap>A @gapinput|n:=1;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=2;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=3;;Cohomology(HomToIntegers(R),n);A
  [  ]
  @gapprompt|gap>A @gapinput|n:=4;;Cohomology(HomToIntegers(R),n);A
  [ 120 ]
  
  @gapprompt|gap>A @gapinput|List([0..5],k->R!.dimension(k));A
  [ 1, 2, 2, 1, 1, 2 ]
  
\end{Verbatim}
 In the octahedral case with $m=1$ we obtain
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z) = \texttt{\symbol{92}}mathbb Z[s,t]/(s\texttt{\symbol{94}}2=24t, 2s=0,
48t=0)\$\$ where $s$ has degree 2 and $t$ has degree 4, from the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(2);;x:=F.1;;y:=F.2;;|
  !gapprompt@gap>| !gapinput@G:=F/[(x*y)^2*x^-3, x^3*y^-4];;|
  !gapprompt@gap>| !gapinput@Order(G);|
  48
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@n:=0;;Cohomology(HomToIntegers(R),n);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@n:=1;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=2;;Cohomology(HomToIntegers(R),n);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@n:=3;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=4;;Cohomology(HomToIntegers(R),n);|
  [ 48 ]
  !gapprompt@gap>| !gapinput@IntegralCupProduct(R,[1],[1],2,2);|
  [ 24 ]
  
\end{Verbatim}
 In the tetrahedral case with $m=1$ we obtain
\$\$H\texttt{\symbol{94}}\texttt{\symbol{92}}ast(\texttt{\symbol{92}}Gamma,\texttt{\symbol{92}}mathbb
Z) = \texttt{\symbol{92}}mathbb Z[s,t]/(s\texttt{\symbol{94}}2=16t, 3s=0,
24t=0)\$\$ where $s$ has degree 2 and $t$ has degree 4, from the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@G:=F/[(x*y)^2*x^-2, x^2*y^-2, z*x*z^-1*y^-1, z*y*z^-1*y^-1*x^-1,z^3];;|
  !gapprompt@gap>| !gapinput@Order(G);|
  24
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@n:=1;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=2;;Cohomology(HomToIntegers(R),n);|
  [ 3 ]
  !gapprompt@gap>| !gapinput@n:=3;;Cohomology(HomToIntegers(R),n);|
  [  ]
  !gapprompt@gap>| !gapinput@n:=4;;Cohomology(HomToIntegers(R),n);|
  [ 24 ]
  !gapprompt@gap>| !gapinput@IntegralCupProduct(R,[1],[1],2,2);|
  [ 16 ]
  
\end{Verbatim}
 A theoretical calculation of the integral and mod-p cohomology rings of all of
these fundamental groups of spherical 3-manifolds is given in \cite{tomoda}. }

 
\section{\textcolor{Chapter }{Explicit cocycles }}\logpage{[ 7, 12, 0 ]}
\hyperdef{L}{X833A19F0791C3B06}{}
{
 Given a $\mathbb ZG$-resolution $R_\ast$ and a $\mathbb ZG$-module $A$, one defines an \emph{$n$-cocycle} to be a $\mathbb ZG$-homomorphism $f\colon R_n \rightarrow A$ for which the composite homomorphism $fd_{n+1}\colon R_{n+1}\rightarrow A$ is zero. If $R_\ast$ happens to be the standard bar resolution (i.e. the cellular chain complex of
the nerve of the group $G$ considered as a one object category) then the free $\mathbb ZG$-generators of $R_n$ are indexed by $n$-tuples $(g_1 | g_2 | \ldots | g_n)$ of elements $g_i$ in $G$. In this case we say that the $n$-cocycle is a \emph{standard n-cocycle} and we think of it as a set-theoretic function 

$f \colon G \times G \times \cdots \times G \longrightarrow A$ 

satisfying a certain algebraic cocycle condition. Bearing in mind that a
standard $n$-cocycle really just assigns an element $f(g_1, \ldots ,g_n) \in A$ to an $n$-simplex in the nerve of $G$ , the cocycle condition is a very natural one which states that \emph{$f$ must vanish on the boundary of a certain $(n+1)$-simplex}. For $n=2$ the condition is that a $2$-cocycle $f(g_1,g_2)$ must satisfy 

$g.f(h,k) + f(g,hk) = f(gh,k) + f(g,h)$ 

 for all $g,h,k \in G$. This equation is explained by the following picture. 

 

 The definition of a cocycle clearly depends on the choice of $\mathbb ZG$-resolution $R_\ast$. However, the cohomology group $H^n(G,A)$, which is a group of equivalence classes of $n$-cocycles, is independent of the choice of $R_\ast$. 

 There are some occasions when one needs explicit examples of standard
cocycles. For instance: 
\begin{itemize}
\item  Let $G$ be a finite group and $k$ a field of characteristic $0$. The group algebra $k(G)$, and the algebra $F(G)$ of functions $d_g\colon G\rightarrow k, h\rightarrow d_{g,h}$, are both Hopf algebras. The tensor product $F(G) \otimes k(G)$ also admits a Hopf algebra structure known as the quantum double $D(G)$. A twisted quantum double $D_f(G)$ was introduced by R. Dijkraaf, V. Pasquier \& P. Roche \cite{dpr}. The twisted double is a quasi-Hopf algebra depending on a $3$-cocycle $f\colon G\times G\times G\rightarrow k$. The multiplication is given by $(d_g \otimes x)(d_h \otimes y) = d_{gx,xh}\beta_g(x,y)(d_g \otimes xy)$ where $\beta_a $ is defined by $\beta_a(h,g) = f(a,h,g) f(h,h^{-1}ah,g)^{-1} f(h,g,(hg)^{-1}ahg)$ . Although the algebraic structure of $D_f(G)$ depends very much on the particular $3$-cocycle $f$, representation-theoretic properties of $D_f(G)$ depend only on the cohomology class of $f$. 
\item  An explicit $2$-cocycle $f\colon G\times G\rightarrow A$ is needed to construct the multiplication $(a,g)(a',g') = (a + g\cdot a' + f(g,g'), gg')$ in the extension a group $G$ by a $\mathbb ZG$-module $A$ determined by the cohomology class of $f$ in $H^2(G,A)$. See \ref{secExtensions}. 
\item  In work on coding theory and Hadamard matrices a number of papers have
investigated square matrices $(a_{ij})$ whose entries $a_{ij}=f(g_i,g_j)$ are the values of a $2$-cocycle $f\colon G\times G \rightarrow \mathbb Z_2$ where $G$ is a finite group acting trivially on $\mathbb Z_2$. See for instance \cite{horadam} and \ref{secHadamard}. 
\end{itemize}
 

 Given a $\mathbb ZG$-resolution $R_\ast$ (with contracting homotopy) and a $\mathbb ZG$-module $A$ one can use HAP commands to compute explicit standard $n$-cocycles $f\colon G^n \rightarrow A$. With the twisted quantum double in mind, we illustrate the computation for $n=3$, $G=S_3$, and $A=U(1)$ the group of complex numbers of modulus $1$ with trivial $G$-action. 

 We first compute a $\mathbb ZG$-resolution $R_\ast$. The Universal Coefficient Theorem gives an isomorphism $H_3(G,U(1)) = Hom_{\mathbb Z}(H_3(G,\mathbb Z), U(1))$, The multiplicative group $U(1)$ can thus be viewed as $\mathbb Z_m$ where $m$ is a multiple of the exponent of $H_3(G,\mathbb Z)$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SymmetricGroup(3);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionFiniteGroup(G,4);;A
  @gapprompt|gap>A @gapinput|TR:=TensorWithIntegers(R);;A
  @gapprompt|gap>A @gapinput|Homology(TR,3);A
  [ 6 ]
  @gapprompt|gap>A @gapinput|R!.dimension(3);A
  4
  @gapprompt|gap>A @gapinput|R!.dimension(4);A
  5
  
\end{Verbatim}
 

 We thus replace the very infinite group U(1) by the finite cyclic group $\mathbb Z_6$. Since the resolution $R_\ast $ has $4$ generators in degree $3$, a homomorphism $f\colon R^3\rightarrow U(1)$ can be represented by a list $f=[f_1, f_2, f_3, f_4]$ with $f_i$ the image in $\mathbb Z_6$ of the $i$th generator. The cocycle condition on $f$ can be expressed as a matrix equation 

$Mf^t = 0 \bmod 6$. 

 where the matrix $M$ is obtained from the following command and $f^t$ denotes the transpose. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=CocycleCondition(R,3);;|
  
\end{Verbatim}
 A particular cocycle $f=[f_1, f_2, f_3, f_4]$ can be obtained by choosing a solution to the equation
Mf\texttt{\symbol{94}}t=0. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@SolutionsMod2:=NullspaceModQ(TransposedMat(M),2);|
  [ [ 0, 0, 0, 0 ], [ 0, 0, 1, 1 ], [ 1, 1, 0, 0 ], [ 1, 1, 1, 1 ] ]
  
  !gapprompt@gap>| !gapinput@SolutionsMod3:=NullspaceModQ(TransposedMat(M),3);|
  [ [ 0, 0, 0, 0 ], [ 0, 0, 0, 1 ], [ 0, 0, 0, 2 ], [ 0, 0, 1, 0 ],
    [ 0, 0, 1, 1 ], [ 0, 0, 1, 2 ], [ 0, 0, 2, 0 ], [ 0, 0, 2, 1 ],
    [ 0, 0, 2, 2 ] ]
  
\end{Verbatim}
 A non-standard $3$-cocycle $f$ can be converted to a standard one using the command \texttt{StandardCocycle(R,f,n,q)} . This command inputs $ R_\ast$, integers $n$ and $q$, and an $n$-cocycle $f$ for the resolution $R_\ast$. It returns a standard cocycle $G^n \rightarrow \mathbb Z_q$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=3*SolutionsMod2[3] - SolutionsMod3[5];   #An example solution to Mf=0 mod 6.|
  [ 3, 3, -1, -1 ]
  
  !gapprompt@gap>| !gapinput@Standard_f:=StandardCocycle(R,f,3,6);;|
  
  !gapprompt@gap>| !gapinput@g:=Random(G); h:=Random(G); k:=Random(G);|
  (1,2)
  (1,3,2)
  (1,3)
  
  !gapprompt@gap>| !gapinput@Standard_f(g,h,k);|
  3
  
\end{Verbatim}
 A function $f\colon G\times G\times G \rightarrow A$ is a standard $3$-cocycle if and only if 

$g\cdot f(h,k,l) - f(gh,k,l) + f(g,hk,l) - f(g,h,kl) + f(g,h,k) = 0$ 

for all $g,h,k,l \in G$. In the above example the group $G=S_3$ acts trivially on $A=Z_6$. The following commands show that the standard $3$-cocycle produced in the example really does satisfy this $3$-cocycle condition. B
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@sf:=Standard_f;;|
  
  !gapprompt@gap>| !gapinput@Test:=function(g,h,k,l);|
  !gapprompt@>| !gapinput@return sf(h,k,l) - sf(g*h,k,l) + sf(g,h*k,l) - sf(g,h,k*l) + sf(g,h,k);|
  !gapprompt@>| !gapinput@end;|
  function( g, h, k, l ) ... end
  
  !gapprompt@gap>| !gapinput@for g in G do for h in G do for k in G do for l in G do|
  !gapprompt@>| !gapinput@Print(Test(g,h,k,l),",");|
  !gapprompt@>| !gapinput@od;od;od;od;|
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,6,0,0,6,
  0,0,0,0,0,6,6,6,0,6,0,12,12,6,12,6,0,12,6,0,6,6,0,0,0,0,0,0,0,12,12,6,6,6,0,
  6,6,0,6,6,0,0,-6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,0,0,0,0,0,0,6,0,0,6,6,0,6,6,
  0,6,0,0,6,6,6,0,0,0,0,0,0,0,-6,0,0,-6,0,-6,0,0,0,0,0,0,0,0,6,6,0,6,0,0,6,0,0,
  0,0,0,6,6,6,0,0,0,6,6,6,0,0,0,0,-6,0,6,6,0,0,0,0,0,0,0,12,6,6,0,6,0,0,0,0,12,
  6,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,0,0,6,0,0,0,0,0,6,6,
  6,0,0,0,6,12,6,6,0,0,0,-6,0,0,6,0,0,0,0,0,0,0,12,12,6,6,6,0,0,0,0,6,6,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,0,6,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,
  6,6,0,6,6,0,12,12,6,12,12,0,0,0,0,0,0,0,6,6,0,0,0,0,6,6,6,12,12,0,-6,-6,0,0,
  0,0,6,6,0,0,6,0,0,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,
  0,6,0,0,6,0,0,0,0,0,0,0,0,0,0,0,6,6,0,6,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,6,6,0,6,6,0,6,0,0,6,6,6,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,6,6,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,0,0,0,0,0,0,0,-6,0,6,0,6,0,6,0,0,0,0,0,0,0,12,12,6,12,12,0,6,6,0,6,6,0,
  0,0,0,0,0,0,12,12,6,12,12,0,6,6,0,6,6,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,
  0,0,0,0,0,0,6,0,0,6,6,0,6,6,0,6,0,0,6,6,6,0,0,0,-6,0,0,0,-6,0,0,-6,0,-6,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,6,6,0,0,0,0,0,0,0,6,6,0,0,0,
  0,0,0,0,6,6,0,-6,0,0,-6,0,0,12,6,0,-6,-6,0,0,0,0,6,6,0,0,6,0,0,6,0,6,6,0,0,0,
  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  0,0,0,-6,0,0,0,0,0,0,0,0,0,0,6,6,6,6,6,0,6,12,0,6,0,0,6,0,0,0,6,0,0,0,0,0,0,
  0,6,12,0,0,0,0,0,0,0,6,6,0,-6,-6,0,0,0,0,0,0,0,0,6,0,0,6,0,6,6,0,0,0,0,0,0,0,
  6,0,0,0,6,0,0,6,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,
  0,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,6,6,0,6,6,0,6,6,6,12,12,0,0,0,0,0,0,0,6,6,0,
  6,6,0,6,6,6,12,12,0,0,0,0,0,0,0,6,6,0,0,6,0,0,6,0,6,6,
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Cohomology operations}}\logpage{[ 8, 0, 0 ]}
\hyperdef{L}{X81FDD09B8454C905}{}
{
 
\section{\textcolor{Chapter }{Steenrod operations on the classifying space of a finite $2$-group}}\logpage{[ 8, 1, 0 ]}
\hyperdef{L}{X80638C137E300A52}{}
{
 The following example determines a presentation for the cohomology ring $H^\ast(Syl_2(M_{12}),\mathbb Z_2)$. The Lyndon-Hochschild-Serre spectral sequence, and Groebner basis routines
from \textsc{Singular}, are used to determine how much of a resolution to compute for the
presentation. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@Mod2CohomologyRingPresentation(G);|
  Graded algebra GF(2)[ x_1, x_2, x_3, x_4, x_5, x_6, x_7 ] / 
  [ x_2*x_3, x_1*x_2, x_2*x_4, x_3^3+x_3*x_5, 
    x_1^2*x_4+x_1*x_3*x_4+x_3^2*x_4+x_3^2*x_5+x_1*x_6+x_4^2+x_4*x_5, 
    x_1^2*x_3^2+x_1*x_3*x_5+x_3^2*x_5+x_3*x_6, 
    x_1^3*x_3+x_3^2*x_4+x_3^2*x_5+x_1*x_6+x_3*x_6+x_4*x_5, 
    x_1*x_3^2*x_4+x_1*x_3*x_6+x_1*x_4*x_5+x_3*x_4^2+x_3*x_4*x_5+x_3*x_5^\
  2+x_4*x_6, x_1^2*x_3*x_5+x_1*x_3^2*x_5+x_3^2*x_6+x_3*x_5^2, 
    x_3^2*x_4^2+x_3^2*x_5^2+x_1*x_5*x_6+x_3*x_4*x_6+x_4*x_5^2, 
    x_1*x_3*x_4^2+x_1*x_3*x_4*x_5+x_1*x_3*x_5^2+x_3^2*x_5^2+x_1*x_4*x_6+\
  x_2^2*x_7+x_2*x_5*x_6+x_3*x_4*x_6+x_3*x_5*x_6+x_4^2*x_5+x_4*x_5^2+x_6^\
  2, x_1*x_3^2*x_6+x_3^2*x_4*x_5+x_1*x_5*x_6+x_4*x_5^2, 
    x_1^2*x_3*x_6+x_1*x_5*x_6+x_2^2*x_7+x_2*x_5*x_6+x_3*x_5*x_6+x_6^2 
   ] with indeterminate degrees [ 1, 1, 1, 2, 2, 3, 4 ]
  
\end{Verbatim}
 The command \texttt{CohomologicalData(G,n)} prints complete information for the cohomology ring $H^\ast(G, Z_2 )$ of a $2$-group $G$ provided that the integer $n$ is at least the maximal degree of a relator in a minimal set of relators for
the ring. Groebner basis routines from \textsc{Singular} are called involved in the example. 

The following example produces complete information on the Steenrod algebra of
group number $8$ in \textsc{GAP}'s library of groups of order $32$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  Group number: 8
  Group description: C2 . ((C4 x C2) : C2) = (C2 x C2) . (C4 x C2)
  
  Cohomology generators
  Degree 1: a, b
  Degree 2: c, d
  Degree 3: e
  Degree 5: f, g
  Degree 6: h
  Degree 8: p
  
  Cohomology relations
  1: f^2
  2: c*h+e*f
  3: c*f
  4: b*h+c*g
  5: b*e+c*d
  6: a*h
  7: a*g
  8: a*f+b*f
  9: a*e+c^2
  10: a*c
  11: a*b
  12: a^2
  13: d*e*h+e^2*g+f*h
  14: d^2*h+d*e*f+d*e*g+f*g
  15: c^2*d+b*f
  16: b*c*g+e*f
  17: b*c*d+c*e
  18: b^2*g+d*f
  19: b^2*c+c^2
  20: b^3+a*d
  21: c*d^2*e+c*d*g+d^2*f+e*h
  22: c*d^3+d*e^2+d*h+e*f+e*g
  23: b^2*d^2+c*d^2+b*f+e^2
  24: b^3*d
  25: d^3*e^2+d^2*e*f+c^2*p+h^2
  26: d^4*e+b*c*p+e^2*g+g*h
  27: d^5+b*d^2*g+b^2*p+f*g+g^2
  
  Poincare series
  (x^5+x^2+1)/(x^8-2*x^7+2*x^6-2*x^5+2*x^4-2*x^3+2*x^2-2*x+1)
  
  Steenrod squares
  Sq^1(c)=0
  Sq^1(d)=b*b*b+d*b
  Sq^1(e)=c*b*b
  Sq^2(e)=e*d+f
  Sq^1(f)=c*d*b*b+d*d*b*b
  Sq^2(f)=g*b*b
  Sq^4(f)=p*a
  Sq^1(g)=d*d*d+g*b
  Sq^2(g)=0
  Sq^4(g)=c*d*d*d*b+g*d*b*b+g*d*d+p*a+p*b
  Sq^1(h)=c*d*d*b+e*d*d
  Sq^2(h)=d*d*d*b*b+c*d*d*d+g*c*b
  Sq^4(h)=d*d*d*d*b*b+g*e*d+p*c
  Sq^1(p)=c*d*d*d*b
  Sq^2(p)=d*d*d*d*b*b+c*d*d*d*d
  Sq^4(p)=d*d*d*d*d*b*b+d*d*d*d*d*d+g*d*d*d*b+g*g*d+p*d*d
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Steenrod operations on the classifying space of a finite $p$-group}}\logpage{[ 8, 2, 0 ]}
\hyperdef{L}{X7D5ACA56870A40E9}{}
{
 The following example constructs the first eight degrees of the mod-$3$ cohomology ring $H^\ast(G,\mathbb Z_3)$ for the group $G$ number 4 in \textsc{GAP}'s library of groups of order $81$. It determines a minimal set of ring generators lying in degree $\le 8$ and it evaluates the Bockstein operator on these generators. Steenrod powers
for $p\ge 3$ are not implemented as no efficient method of implementation is known. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(81,4);;|
  !gapprompt@gap>| !gapinput@A:=ModPSteenrodAlgebra(G,8);;|
  !gapprompt@gap>| !gapinput@List(ModPRingGenerators(A),x->Bockstein(A,x));|
  [ 0*v.1, 0*v.1, v.5, 0*v.1, (Z(3))*v.7+v.8+(Z(3))*v.9 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Bredon homology}}\logpage{[ 9, 0, 0 ]}
\hyperdef{L}{X786DB80A8693779E}{}
{
 
\section{\textcolor{Chapter }{Davis complex}}\logpage{[ 9, 1, 0 ]}
\hyperdef{L}{X7B0212F97F3D442A}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(W,{\cal R}) = \mathbb Z^{21}$ 

 for the infinite Coxeter group $W$ associated to the Dynkin diagram shown in the computation, with coefficients
in the complex representation ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3]],[4,[5,6]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=DavisComplex(D);;|
  !gapprompt@gap>| !gapinput@D:=TensorWithComplexRepresentationRing(C);;|
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Arithmetic groups}}\logpage{[ 9, 2, 0 ]}
\hyperdef{L}{X7AFFB32587D047FE}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(SL_2({\cal O}_{-3}),{\cal R}) = \mathbb Z_2\oplus \mathbb Z^{9}$ 

$\underline H_1(SL_2({\cal O}_{-3}),{\cal R}) = \mathbb Z$ 

for ${\cal O}_{-3}$ the ring of integers of the number field $\mathbb Q(\sqrt{-3})$, and $\cal R$ the complex reflection ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ContractibleGcomplex("SL(2,O-3)");;|
  !gapprompt@gap>| !gapinput@IsRigid(R);|
  false
  !gapprompt@gap>| !gapinput@S:=BaryCentricSubdivision(R);;|
  !gapprompt@gap>| !gapinput@IsRigid(S);|
  true
  !gapprompt@gap>| !gapinput@C:=TensorWithComplexRepresentationRing(S);;|
  !gapprompt@gap>| !gapinput@Homology(C,0);|
  [ 2, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  [ 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Crystallographic groups}}\logpage{[ 9, 3, 0 ]}
\hyperdef{L}{X7DEBF2BB7D1FB144}{}
{
 

The following example computes the Bredon homology 

$\underline H_0(G,{\cal R}) = \mathbb Z^{17}$ 

 for $G$ the second crystallographic group of dimension $4$ in \textsc{GAP}'s library of crystallographic groups, and for $\cal R$ the Burnside ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,2);;|
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup(G);;|
  !gapprompt@gap>| !gapinput@B:=CrystGFullBasis(G);;|
  !gapprompt@gap>| !gapinput@R:=CrystGcomplex(gens,B,1);;|
  !gapprompt@gap>| !gapinput@IsRigid(R);|
  false
  !gapprompt@gap>| !gapinput@S:=CrystGcomplex(gens,B,0);;|
  !gapprompt@gap>| !gapinput@IsRigid(S);|
  true
  !gapprompt@gap>| !gapinput@D:=TensorWithBurnsideRing(S);;|
  !gapprompt@gap>| !gapinput@Homology(D,0);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Chain Complexes}}\logpage{[ 10, 0, 0 ]}
\hyperdef{L}{X7A06103979B92808}{}
{
 HAP uses implementations of chain complexes of free $\mathbb K$-modules for each of the rings $\mathbb K = \mathbb Z$, $\mathbb K = \mathbb Q$, $\mathbb K = \mathbb F_p$ with $p$ a prime number, $\mathbb K = \mathbb ZG$, $\mathbb K = \mathbb F_pG$ with $G$ a group. The implemented chain complexes have the form 

$ C_n \stackrel{d_n}{\longrightarrow } C_{n-1}
\stackrel{d_{n-1}}{\longrightarrow } \cdots \stackrel{d_2}{\longrightarrow }
C_1 \stackrel{d_1}{\longrightarrow } C_0 \stackrel{d_0}{\longrightarrow } 0\ .$ 

Such a complex is said to have \emph{length} $n$ and the rank of the free $\mathbb K$-module $C_k$ is referred to as the \emph{dimenion} of the complex in degree $k$. 

 For the case $\mathbb K = \mathbb ZG$ (resp. $\mathbb K = \mathbb F_pG$) the main focus is on free chain complexes that are exact at each degree $k$, i.e. ${\rm im}(d_{k+1})={\rm ker}(d_k)$, for $0 < k < n$ and with $C_0/{\rm im}(d_1) \cong \mathbb Z$ (resp. $C_0/{\rm im}(d_1) \cong \mathbb F_p$). We refer to such a chain complex as a \emph{resolution of length } $n$ even though $d_n$ will typically not be injective. More correct terminology would refer to such
a chain complex as the first $n$ degrees of a free resolution. 

The following sections illustrate some constructions of chain complexes.
Constructions for resolutions are described in the next chapter \ref{resolutions}. 
\section{\textcolor{Chapter }{Chain complex of a simplicial complex and simplicial pair}}\logpage{[ 10, 1, 0 ]}
\hyperdef{L}{X782DE78884DD6992}{}
{
 

The following example constructs the Quillen simplicial complex $Q={\mathcal A}_p(G)$ for $p=2$ and $G=A_8$; this is the order complex of the poset of non-trivial elementary $2$-subgroups of $G$. The chain complex $C_\ast = C_\ast(Q)$ is then computed and seen to have the same number of free generators as $Q$ has simplices. (To ensure indexing of subcomplexes is consistent with that of
the large complex it is best to work with vertices represented as integers.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuillenComplex(AlternatingGroup(8),2);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(Q);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(Q);|
  55015
  !gapprompt@gap>| !gapinput@Size(C);|
  55015
  
\end{Verbatim}
 Next the simplicial complex $Q$ is converted to one whose vertices are represented by integers and a
contactible subcomplex $L < Q$ is computed. The chain complex $D_\ast=C_\ast(Q,L)$ of the simplicial pair $(Q,L)$ is constructed and seen to have the correct size. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=IntegerSimplicialComplex(Q);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@L:=ContractibleSubcomplex(Q);|
  Simplicial complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@D:=ChainComplexOfPair(Q,L);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D)=Size(Q)-Size(L);|
  true
  !gapprompt@gap>| !gapinput@Size(D);|
  670
  gap>
  
\end{Verbatim}
 The next commands produce a smalled chain complex $B_\ast$ chain homotopy equivalent to $D_\ast$ and compute the homology $H_k(Q,\mathbb Z) \cong H_k(B_\ast)$ for $k=1,2,3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(D);|
  Chain complex of length 3 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(B);|
  64
  !gapprompt@gap>| !gapinput@Homology(B,1);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(B,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(B,3);|
  [  ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain complex of a cubical complex and cubical pair}}\logpage{[ 10, 2, 0 ]}
\hyperdef{L}{X79E7A13E7DE9C412}{}
{
 The following example reads in the digital image 

  

as a $2$-dimensional pure cubical complex $M$ and constructs the chain complex $C_\ast=C_\ast(M)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ReadImageAsPureCubicalComplex(file,400);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(C); |
  173243
  
\end{Verbatim}
 Next an acyclic pure cubical subcomplex $L < M$ is computed and the chain complex $D_\ast=C_\ast(M,L)$ of the pair is constructed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=AcyclicSubcomplexOfPureCubicalComplex(K);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@D:=ChainComplexOfPair(K,L);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D);|
  618
  
\end{Verbatim}
 Finally the chain complex $D_\ast$ is simplified to a homotopy equivalent chain complex $B_\ast$ and the homology $H_1(M,\mathbb Z) \cong H_1(B_\ast)$ is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(D);|
  Chain complex of length 2 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(B);|
  20
  !gapprompt@gap>| !gapinput@Homology(B,1);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain complex of a regular CW-complex}}\logpage{[ 10, 3, 0 ]}
\hyperdef{L}{X86C38E87817F2EAD}{}
{
 The next example constructs a $15$-dimensional regular CW-complex $Y$ that is homotopy equivalent to the $2$-dimensional torus. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Circle:=PureCubicalComplex([[1,1,1,1,1],[1,1,0,1,1],[1,1,1,1,1]]);|
  Pure cubical complex of dimension 2.
  
  !gapprompt@gap>| !gapinput@Torus:=DirectProductOfPureCubicalComplexes(Circle,Circle);|
  Pure cubical complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@CTorus:=CechComplexOfPureCubicalComplex(Torus);|
  Simplicial complex of dimension 15.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(CTorus);|
  Regular CW-complex of dimension 15
  
\end{Verbatim}
 Next the cellular chain complex $C_\ast=C_\ast(Y)$ is constructed. Also, a minimally generated chain complex $D_\ast=C_\ast(Y')$ of a non-regular CW-complex $Y'\simeq Y$ is constructed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=ChainComplexOfRegularCWComplex(Y);|
  Chain complex of length 15 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(C);|
  1172776
  
  !gapprompt@gap>| !gapinput@D:=ChainComplex(Y);|
  Chain complex of length 15 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Size(D);|
  4
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Chain Maps of simplicial and regular CW maps}}\logpage{[ 10, 4, 0 ]}
\hyperdef{L}{X7F9662EF83A1FA76}{}
{
 The next example realizes the complement of the first prime knot on $11$ crossings as a pure permutahedral complex. The complement is converted to a
regular CW-complex $Y$ and the boundary inclusion $f\colon \partial Y \hookrightarrow Y$ is constructed as a map of regular CW-complexes. Then the induced chain map $F\colon C_\ast(\partial Y) \hookrightarrow C_\ast(Y)$ is constructed. Finally the homology homomorphism $H_1(F)\colon H_1(C_\ast(\partial Y)) \rightarrow H_1(C_\ast(Y))$ is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=PurePermutahedralKnot(11,1);;|
  !gapprompt@gap>| !gapinput@M:=PureComplexComplement(K);|
  Pure permutahedral complex of dimension 3.
  
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(M);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=BoundaryMap(Y);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@F:=ChainMap(f);|
  Chain Map between complexes of length 2 . 
  
  !gapprompt@gap>| !gapinput@H:=Homology(F,1);|
  [ g1, g2 ] -> [ g1^-1, g1^-1 ]
  
  !gapprompt@gap>| !gapinput@Kernel(H);|
  Pcp-group with orders [ 0 ]
  
\end{Verbatim}
 The command \texttt{ChainMap(f)} can be used to construct the chain map $C_\ast(K) \rightarrow C_\ast(K')$ induced by a map $f\colon K\rightarrow K'$ of simplicial complexes. }

 
\section{\textcolor{Chapter }{Constructions for chain complexes}}\logpage{[ 10, 5, 0 ]}
\hyperdef{L}{X8127E17383F45359}{}
{
 It is straightforward to implement basic constructions on chain complexes. A
few constructions are illustrated in the following example. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|res:=ResolutionFiniteGroup(SymmetricGroup(5),5);;B
  @gapprompt|gap>B @gapinput|C:=TensorWithIntegers(res);B
  Chain complex of length 5 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|D:=ContractedComplex(C);#A chain homotopic complexB
  Chain complex of length 5 in characteristic 0 . 
  @gapprompt|gap>B @gapinput|List([0..5],C!.dimension);B
  [ 1, 4, 10, 20, 35, 56 ]
  @gapprompt|gap>B @gapinput|List([0..5],D!.dimension);B
  [ 1, 1, 2, 4, 6, 38 ]
  
  @gapprompt|gap>B @gapinput|CxC:=TensorProduct(C,C);B
  Chain complex of length 10 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|SC:=SuspendedChainComplex(C);B
  Chain complex of length 6 in characteristic 0 . 
  
  @gapprompt|gap>B @gapinput|RC:=ReducedSuspendedChainComplex(C);B
  Chain complex of length 6 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|PC:=PathObjectForChainComplex(C);B
  Chain complex of length 5 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|dualC:=HomToIntegers(C);B
  Cochain complex of length 5 in characteristic 0 .
  
  @gapprompt|gap>B @gapinput|Cxp:=TensorWithIntegersModP(C,5);B
  Chain complex of length 5 in characteristic 5 .
  
  @gapprompt|gap>B @gapinput|CxQ:=TensorWithRationals(C); #The quirky -1/2 denotes rationalsB
  Chain complex of length 5 in characteristic -1/2 .
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Filtered chain complexes}}\logpage{[ 10, 6, 0 ]}
\hyperdef{L}{X7AAAB26682CD8AC4}{}
{
 A sequence of inclusions of chain complexes $C_{0,\ast} \le C_{1,\ast} \le \cdots \le C_{T-1,\ast} \le C_{T,\ast}$ in which the preferred basis of $C_{k-1,\ell}$ is the beginning of the preferred basis of $C_{k,\ell}$ is referred to as a \emph{filtered chain complex}. Filtered chain complexes give rise to spectral sequences such as the \emph{equivariant spectral sequence} of a $G-CW$-complex with subgroup $H < G$. A particular case is the Lyndon-Hochschild-Serre spectral sequence for the
homology of a group extension $N \rightarrowtail G \twoheadrightarrow Q$ with $E^2_{p,q}=H_p(Q,H_q(N, \mathbb Z))$. 

The following commands construct the filtered chain complex underlying the
Lyndon-Hochschild-Serre spectral sequence for the dihedral group $G=D_{32}$ of order 64 and its centre $N=Z(G)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=DihedralGroup(64);;|
  !gapprompt@gap>| !gapinput@N:=Center(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries([G,N],3);;|
  !gapprompt@gap>| !gapinput@C:=FilteredTensorWithIntegersModP(R,2);|
  Chain complex of length 3 in characteristic 2 .
  
\end{Verbatim}
 The differentials $d^r_{p,q}$ in a given page $E^r$ of the spectral sequence arise from the induced homology homomorphisms $\iota^{s,t}_\ell\colon H_{\ell}(C_{s,\ast}) \rightarrow H_{\ell}(C_{t,\ast})$ for $s\le t$. Textbooks traditionally picture the differential in $E^r$ as an array of sloping arrows with non-zero groups $E^r_{p,q}\neq 0$ represented by dots. An alternative representation of this information is as a
barcode (of the sort used in Topological Data Analysis). The homomorphisms $\iota^{\ast,\ast}_2$ in the example, with coefficients converted to mod $2$, are pictured by the bar code 

  

 which was produced by the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=2;;k:=2;;|
  !gapprompt@gap>| !gapinput@P:=PersistentHomologyOfFilteredChainComplex(C,k,p);;|
  !gapprompt@gap>| !gapinput@BarCodeDisplay(P);|
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Sparse chain complexes}}\logpage{[ 10, 7, 0 ]}
\hyperdef{L}{X856F202D823280F8}{}
{
 Boundary homomorphisms in all of the above examples of chain complexes are
represented by matrices. In cases where the matrices are large and have many
zero entries it is better to use sparse matrices. 

The following commands demonstrate the conversion of the matrix 

$A=\left(\begin{array}{ccc} 0 &2 &0\\ -3 &0 & 0\\ 0 & 0 &4 \end{array}\right)$ 

to sparse form, and vice-versa. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|A:=[[0,2,0],[-3,0,0],[0,0,4]];;D
  @gapprompt|gap>D @gapinput|S:=SparseMat(A);D
  Sparse matrix with 3 rows and 3 columns in characteristic 0
  
  @gapprompt|gap>D @gapinput|NamesOfComponents(S);D
  [ "mat", "characteristic", "rows", "cols" ]
  @gapprompt|gap>D @gapinput|S!.mat;D
  [ [ [ 2, 2 ] ], [ [ 1, -3 ] ], [ [ 3, 4 ] ] ]
  
  @gapprompt|gap>D @gapinput|B:=SparseMattoMat(S);D
  [ [ 0, 2, 0 ], [ -3, 0, 0 ], [ 0, 0, 4 ] ]
  
\end{Verbatim}
 

To illustrate the use of sparse chain complexes we consider the data points
represented in the following digital image. 

 

 The following commands read in this image as a $2$-dimensional pure cubical complex and store the Euclidean coordinates of the
black pixels in a list. Then 200 points are selected at random from this list
and used to construct a $200\times 200$ symmetric matrix $S$ whose entries are the Euclidean distance between the sample data points. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|file:=HapFile("data500.png");;B
  @gapprompt|gap>B @gapinput|M:=ReadImageAsPureCubicalComplex(file,400);;B
  @gapprompt|gap>B @gapinput|A:=M!.binaryArray;;B
  @gapprompt|gap>B @gapinput|data:=[];;B
  @gapprompt|gap>B @gapinput|for i in [1..Length(A)] doB
  @gapprompt|>B @gapinput|for j in [1..Length(A[1])] doB
  @gapprompt|>B @gapinput|if A[i][j]=1 then Add(data,[i,j]); fi;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|>B @gapinput|od;B
  @gapprompt|gap>B @gapinput|sample:=List([1..200],i->Random(data));;B
  @gapprompt|gap>B @gapinput|S:=VectorsToSymmetricMatrix(sample,EuclideanApproximatedMetric);;B
  
\end{Verbatim}
 The symmetric distance matrix $S$ is next converted to a filtered chain complex arising from a filtered
simplicial complex (using the standard \emph{persistent homology} pipeline). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricMatrixToFilteredGraph(S,10,100);; |
  #Filtration length T=10, distances greater than 100 discarded.
  !gapprompt@gap>| !gapinput@N:=SimplicialNerveOfFilteredGraph(G,2);;|
  !gapprompt@gap>| !gapinput@C:=SparseFilteredChainComplexOfFilteredSimplicialComplex(N);;|
  Filtered sparse chain complex of length 2 in characteristic 0 .
  
\end{Verbatim}
 Next, the induced homology homomorphisms in degrees 1 and 2, with rational
coefficients, are computed and displayed a barcodes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P0:=PersistentHomologyOfFilteredSparseChainComplex(C,0);;|
  !gapprompt@gap>| !gapinput@P1:=PersistentHomologyOfFilteredSparseChainComplex(C,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P0);|
  
\end{Verbatim}
 

 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P1);|
  
\end{Verbatim}
 

 

 The barcodes are consistent with the data points having been sampled from a
space with the homotopy type of an annulus. }

 }

 
\chapter{\textcolor{Chapter }{Resolutions}}\label{resolutions}
\logpage{[ 11, 0, 0 ]}
\hyperdef{L}{X7C0B125E7D5415B4}{}
{
 There is a range of functions in HAP that input a group $G$, integer $n$, and attempt to return the first $n$ terms of a free $\mathbb ZG$-resolution $R_\ast$ of the trivial module $\mathbb Z$. In some cases an explicit contracting homotopy is provided on the
resolution. The function \texttt{Size(R)} returns a list whose $k$th term is the sum of the lengths of the boundaries of the generators in
degree $k$. 
\section{\textcolor{Chapter }{Resolutions for small finite groups}}\logpage{[ 11, 1, 0 ]}
\hyperdef{L}{X83E8F9DA7CDC0DA7}{}
{
 The following uses discrete Morse theory to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);; n:=6;;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,n);|
  Resolution of length 6 in characteristic 0 for Group([ (1,2), (1,2,3,4,5,6) 
   ]) .
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 58, 186, 452, 906, 1436 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for very small finite groups}}\logpage{[ 11, 2, 0 ]}
\hyperdef{L}{X7EEA738385CC3AEA}{}
{
 The following uses linear algebra over $\mathbb Z$ to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuaternionGroup(128);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSmallGroup(Q,20);|
  Resolution of length 20 in characteristic 0 for <pc group of size 128 with 
  2 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128, 4, 42, 8, 128 ]
  
\end{Verbatim}
 The suspicion that this resolution $R_\ast$ is periodic of period $4$ can be verified by constructing the chain complex $C_\ast=R_\ast\otimes_{\mathbb Z}\mathbb ZG$ and verifying that boundary matrices repeat with period $4$. 

 A second example of a periodic resolution, for the Dihedral group $D_{2k+1}=\langle x, y\ |\ x^2= xy^kx^{-1}y^{-k-1}\rangle$ of order $2k+2$ in the case $k=1$, is constructed and verified for periodicity in the next example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSmallGroup(D,15);;|
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 4, 7, 8, 6, 4, 8, 8, 6, 4, 8, 8, 6, 4, 8, 8 ]
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegersOverSubgroup(R,Group(One(D)));;|
  !gapprompt@gap>| !gapinput@n:=4;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=5;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=6;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=7;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  !gapprompt@gap>| !gapinput@n:=8;;BoundaryMatrix(C,n)=BoundaryMatrix(C,n+4);|
  true
  
\end{Verbatim}
 This periodic resolution for $D_3$ can be found in a paper by R. Swan \cite{swan2}. The resolution was proved for arbitrary $D_{2k+1}$ by Irina Kholodna \cite{kholodna} (Corollary 5.5) and is the cellular chain complex of the universal cover of a
CW-complex $X$ with two cells in dimensions $1, 2 \bmod 4$ and one cell in dimensions $0,3 \bmod 4$. The $2$-skelecton is the $2$-complex for the given presentation of $D_{2k+1}$ and an attaching map for the $3$-cell is represented as follows. 

  

 A slightly different periodic resolution for $D_{2k+1}$ has been obtain more recently by FEA Johnson \cite{johnson}. Johnson's resolution has two free generators in each degree. Interestingly,
running the following code for many values of $k >1$ seems to produce a periodic resolution with two free generators in each degree
for most values of $k$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|k:=20;;rels:=[x^2,x*y^k*x^-1*y^(-1-k)];;D:=F/rels;;A
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(D,7);;A
  @gapprompt|gap>A @gapinput|List([0..7],R!.dimension);A
  [ 1, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for finite groups acting on orbit polytopes}}\logpage{[ 11, 3, 0 ]}
\hyperdef{L}{X86C0983E81F706F5}{}
{
 The following uses Polymake convex hull computations and homological
perturbation theory to construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SignedPermutationGroup(5);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C2 x ((C2 x C2 x C2 x C2) : S5)"
  
  !gapprompt@gap>| !gapinput@v:=[1,2,3,4,5];;  #The resolution depends on the choice of vector.|
  !gapprompt@gap>| !gapinput@P:=PolytopalComplex(G,[1,2,3,4,5]);|
  Non-free resolution in characteristic 0 for <matrix group of size 3840 with 
  9 generators> . 
  No contracting homotopy available.
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(P,6);|
  Resolution of length 5 in characteristic 0 for <matrix group of size 
  3840 with 9 generators> . 
  No contracting homotopy available.
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 60, 214, 694, 6247, 273600 ]
  
\end{Verbatim}
 The convex polytope $P_G(v)={\rm Convex~Hull}\{g\cdot v\ |\ g\in G\}$ used in the resolution depends on the choice of vector $v\in \mathbb R^n$. Two such polytopes for the alternating group $G=A_4$ acting on $\mathbb R^4$ can be visualized as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(4);;|
  !gapprompt@gap>| !gapinput@OrbitPolytope(G,[1,2,3,4],["VISUAL"]);|
  !gapprompt@gap>| !gapinput@OrbitPolytope(G,[1,1,3,4],["VISUAL"]);|
  
  !gapprompt@gap>| !gapinput@P1:=PolytopalComplex(G,[1,2,3,4]);;|
  !gapprompt@gap>| !gapinput@P2:=PolytopalComplex(G,[1,1,3,4]);;|
  !gapprompt@gap>| !gapinput@R1:=FreeGResolution(P1,20);;|
  !gapprompt@gap>| !gapinput@R2:=FreeGResolution(P2,20);;|
  !gapprompt@gap>| !gapinput@Size(R1);|
  [ 6, 11, 32, 24, 36, 60, 65, 102, 116, 168, 172, 248, 323, 628, 650, 1093, 
    1107, 2456, 2344, 6115 ]
  !gapprompt@gap>| !gapinput@Size(R2);|
  [ 4, 11, 20, 24, 36, 60, 65, 102, 116, 168, 172, 248, 323, 628, 650, 1093, 
    1107, 2456, 2344, 6115 ]
  
\end{Verbatim}
 

   }

 
\section{\textcolor{Chapter }{Minimal resolutions for finite $p$-groups over $\mathbb F_p$}}\logpage{[ 11, 4, 0 ]}
\hyperdef{L}{X85374EA47E3D97CF}{}
{
 The following uses linear algebra to construct a minimal free $\mathbb F_pG$-resolution of the trivial module $\mathbb F$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionPrimePowerGroup(P,20);|
  Resolution of length 20 in characteristic 2 for Group(
  [ (2,8,4,12)(3,11,7,9), (2,3)(4,7)(6,10)(9,11), (3,7)(6,10)(8,11)(9,12), 
    (1,10)(3,7)(5,6)(8,12), (2,4)(3,7)(8,12)(9,11), (1,5)(6,10)(8,12)(9,11) 
   ]) . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 6, 62, 282, 740, 1810, 3518, 6440, 10600, 17040, 24162, 34774, 49874, 
    62416, 81780, 106406, 145368, 172282, 208926, 262938, 320558 ]
  
\end{Verbatim}
 The resolution has the minimum number of generators possible in each degree
and can be used to guess a formula for the Poincare series 

$P(x) = \Sigma_{k\ge 0} \dim_{\mathbb F_p}H^k(G,\mathbb F_p)\,x^k$. 

The guess is certainly correct for the coefficients of $x^k$ for $k\le 20$ and can be used to guess the dimension of say $H^{2000}(G,\mathbb F_p)$. 

 Most likely $\dim_{\mathbb F_2}H^{2000}(G,\mathbb F_2) = 2001000$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=PoincareSeries(R,20);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
  !gapprompt@gap>| !gapinput@ExpansionOfRationalFunction(P,2000)[2000];|
  2001000
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for abelian groups}}\logpage{[ 11, 5, 0 ]}
\hyperdef{L}{X866C8D91871D1170}{}
{
 The following uses the formula for the tensor product of chain complexes to
construct a resolution. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([2,4,8,0,0]);;|
  !gapprompt@gap>| !gapinput@StructureDescription(A);|
  "Z x Z x C8 x C4 x C2"
  
  !gapprompt@gap>| !gapinput@R:=ResolutionAbelianGroup(A,10);|
  Resolution of length 10 in characteristic 0 for Pcp-group with orders 
  [ 2, 4, 8, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 90, 296, 680, 1256, 2024, 2984, 4136, 5480, 7016 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for nilpotent groups}}\logpage{[ 11, 6, 0 ]}
\hyperdef{L}{X7B332CBE85120B38}{}
{
 The following uses the NQ package to express the free nilpotent group of class $3$ on three generators as a Pcp group $G$, and then uses homological perturbation on the lower central series to
construct a resolution. The resolution is used to exhibit $2$-torsion in $H_4(G,\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(F,3));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,5);|
  Resolution of length 5 in characteristic 0 for Pcp-group with orders 
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 28, 377, 2377, 9369, 25850 ]
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),4);|
  [ 2, 2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 The following uses homological perturbation on the lower central series to
construct a resolution for the Sylow $2$-subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(12);;|
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@StructureDescription(P);|
  "((C4 x C4) : C2) : C2"
  
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(P,9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 279 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 80, 310, 939, 2556, 6768, 19302, 61786, 237068 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for groups with subnormal series}}\logpage{[ 11, 7, 0 ]}
\hyperdef{L}{X7B03997084E00509}{}
{
 The following uses homological perturbation on a subnormal series to construct
a resolution for the Sylow $2$-subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@sn:=ElementaryAbelianSeries(P);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSubnormalSeries(sn,9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 64 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 78, 288, 812, 1950, 4256, 8837, 18230, 39120 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for groups with normal series}}\logpage{[ 11, 8, 0 ]}
\hyperdef{L}{X814FFCE080B3A826}{}
{
 The following uses homological perturbation on a normal series to construct a
resolution for the Sylow $2$-subgroup $P=Syl_2(M_{12})$ of the Mathieu simple group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@P1:=EfficientNormalSubgroups(P)[1];;|
  !gapprompt@gap>| !gapinput@P2:=Intersection(DerivedSubgroup(P),P1);;|
  !gapprompt@gap>| !gapinput@P3:=Group(One(P));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries([P,P1,P2,P3],9);|
  Resolution of length 9 in characteristic 
  0 for <permutation group with 64 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 60, 200, 532, 1238, 2804, 6338, 15528, 40649 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for polycyclic (almost) crystallographic groups }}\logpage{[ 11, 9, 0 ]}
\hyperdef{L}{X81227BF185C417AF}{}
{
 The following uses the Polycyclic package and homological perturbation to
construct a resolution for the crystallographic group \texttt{G:=SpaceGroup(3,165)}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(3,165);;|
  !gapprompt@gap>| !gapinput@G:=Image(IsomorphismPcpGroup(G));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAlmostCrystalGroup(G,20);|
  Resolution of length 20 in characteristic 0 for Pcp-group with orders 
  [ 3, 2, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 49, 117, 195, 273, 351, 429, 507, 585, 663, 741, 819, 897, 975, 1053, 
    1131, 1209, 1287, 1365, 1443 ]
  
\end{Verbatim}
 The following constructs a resolution for an almost crystallographic Pcp group $G$. The final commands establish that $G$ is not isomorphic to a crystallographic group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlmostCrystallographicPcpGroup( 4, 50, [ 1, -4, 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAlmostCrystalGroup(G,20);|
  Resolution of length 20 in characteristic 0 for Pcp-group with orders 
  [ 4, 0, 0, 0, 0 ] . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 53, 137, 207, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 223, 
    223, 223, 223, 223, 223 ]
  
  
  !gapprompt@gap>| !gapinput@T:=Kernel(NaturalHomomorphismOnHolonomyGroup(G));;|
  !gapprompt@gap>| !gapinput@IsAbelian(T);|
  false
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for Bieberbach groups }}\logpage{[ 11, 10, 0 ]}
\hyperdef{L}{X814BCDD6837BB9C5}{}
{
 The following constructs a resolution for the Bieberbach group \texttt{G=SpaceGroup(3,165)} by using convex hull algorithms to construct a Dirichlet domain for its free
action on Euclidean space $\mathbb R^3$. By construction the resolution is trivial in degrees $\ge 3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(3,165);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G);|
  Resolution of length 4 in characteristic 
  0 for SpaceGroupOnRightBBNWZ( 3, 6, 1, 1, 4 ) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 10, 18, 8, 0 ]
  
\end{Verbatim}
 The fundamental domain constructed for the above resolution can be visualized
using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainBieberbachGroup(G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Display(F);|
  
\end{Verbatim}
 

  

 A different fundamental domain and resolution for $G$ can be obtained by changing the choice of vector $v\in \mathbb R^3$ in the definition of the Dirichlet domain 

$D(v) = \{x\in \mathbb R^3\ | \ ||x-v|| \le ||x-g.v||\ {\rm for~all~} g\in G\}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G,[1/2,1/2,1/2]);|
  Resolution of length 4 in characteristic 
  0 for SpaceGroupOnRightBBNWZ( 3, 6, 1, 1, 4 ) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 28, 42, 16, 0 ]
  
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainBieberbachGroup(G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Display(F);|
  
\end{Verbatim}
 

  

 A higher dimensional example is handled in the next session. A list of the $62$ $7$-dimensional Hantze-Wendt Bieberbach groups is loaded and a resolution is
computed for the first group in the list. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("HW-7dim.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@G:=HWO7Gr[1];|
  <matrix group with 7 generators>
  
  !gapprompt@gap>| !gapinput@R:=ResolutionBieberbachGroup(G);|
  Resolution of length 8 in characteristic 0 for <matrix group with 
  7 generators> . 
  No contracting homotopy available.
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 284, 1512, 3780, 4480, 2520, 840, 84, 0 ]
  
\end{Verbatim}
 

The homological perturbation techniques needed to extend this method to
crystallographic groups acting non-freely on $\mathbb R^n$ has not yet been implemenyed. This is on the TO-DO list. }

 
\section{\textcolor{Chapter }{Resolutions for arbitrary crystallographic groups}}\logpage{[ 11, 11, 0 ]}
\hyperdef{L}{X87ADCB7D7FC0B4D3}{}
{
 An implementation of the above method for Bieberbach groups is also available
for arbitrary crystallographic groups. The following example constructs a
resolution for the group \texttt{G:=SpaceGroupIT(3,227)}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroupIT(3,227);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSpaceGroup(G,11);|
  Resolution of length 11 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 38, 246, 456, 644, 980, 1427, 2141, 2957, 3993, 4911, 6179 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for crystallographic groups admitting cubical fundamental domain}}\logpage{[ 11, 12, 0 ]}
\hyperdef{L}{X7B9B3AF487338A9B}{}
{
 The following uses subdivision techniques to construct a resolution for the
Bieberbach group \texttt{G:=SpaceGroup(4,122)}. The resolution is endowed with a contracting homotopy. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,122);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionCubicalCrystGroup(G,20);|
  Resolution of length 20 in characteristic 0 for <matrix group with 
  6 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 8, 24, 24, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 Subdivision and homological perturbation are used to construct the following
resolution (with contracting homotopy) for a crystallographic group with
non-free action. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,1100);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionCubicalCrystGroup(G,20);|
  Resolution of length 20 in characteristic 0 for <matrix group with 
  8 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 40, 215, 522, 738, 962, 1198, 1466, 1734, 2034, 2334, 2666, 2998, 3362, 
    3726, 4122, 4518, 4946, 5374, 5834, 6294 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for Coxeter groups }}\logpage{[ 11, 13, 0 ]}
\hyperdef{L}{X78DD8D068349065A}{}
{
 The following session constructs the Coxeter diagram for the Coxeter group $B=B_7$ of order $645120$. A resolution for $G$ is then computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=[[1,[2,3]],[2,[3,3]],[3,[4,3]],[4,[5,3]],[5,[6,3]],[6,[7,4]]];;|
  !gapprompt@gap>| !gapinput@CoxeterDiagramDisplay(D);;|
  
\end{Verbatim}
 

  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionCoxeterGroup(D,5);|
  Resolution of length 5 in characteristic 
  0 for <permutation group of size 645120 with 7 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 112, 492, 1604, 5048 ]
  
\end{Verbatim}
 The routine extension of this method to infinite Coxeter groups is on the
TO-DO list. }

 
\section{\textcolor{Chapter }{Resolutions for Artin groups }}\logpage{[ 11, 14, 0 ]}
\hyperdef{L}{X7C69E7227F919CC9}{}
{
 The following session constructs a resolution for the infinite Artin group $G$ associated to the Coxeter group $B_7$. Exactness of the resolution depends on the solution to the $K(\pi,1)$ Conjecture for Artin groups of spherical type. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionArtinGroup(D,8);|
  Resolution of length 8 in characteristic 0 for <fp group on the generators 
  [ f1, f2, f3, f4, f5, f6, f7 ]UNKNOWNEntity(gr) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 14, 98, 310, 610, 918, 1326, 2186, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for $G=SL_2(\mathbb Z[1/m])$}}\logpage{[ 11, 15, 0 ]}
\hyperdef{L}{X8032647F8734F4EB}{}
{
 The following uses homological perturbation to construct a resolution for $G=SL_2(\mathbb Z[1/6])$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2Z(6,10);|
  Resolution of length 10 in characteristic 0 for SL(2,Z[1/6]) . 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 44, 679, 6910, 21304, 24362, 48506, 43846, 90928, 86039, 196210 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for selected groups $G=SL_2( {\mathcal O}(\mathbb Q(\sqrt{d}) )$}}\logpage{[ 11, 16, 0 ]}
\hyperdef{L}{X7BE4DE82801CD38E}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=SL_2({\mathcal O}(\mathbb Q(\sqrt{-5}))$. The finite complexes were contributed independently by A. Rahm, M.
Dutour-Scikiric and S. Schoenenbeck and are stored in the folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-5,10);|
  Resolution of length 10 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 22, 114, 120, 200, 146, 156, 136, 254, 168, 170 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for selected groups $G=PSL_2( {\mathcal O}(\mathbb Q(\sqrt{d}) )$}}\logpage{[ 11, 17, 0 ]}
\hyperdef{L}{X7D9CCB2C7DAA2310}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=PSL_2({\mathcal O}(\mathbb Q(\sqrt{-11}))$. The finite complexes were contributed independently by A. Rahm, M.
Dutour-Scikiric and S. Schoenenbeck and are stored in the folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers(-11,10);|
  Resolution of length 10 in characteristic 0 for PSL(2,O-11) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 12, 59, 89, 107, 125, 230, 208, 270, 326, 515 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for a few higher-dimensional arithmetic groups }}\logpage{[ 11, 18, 0 ]}
\hyperdef{L}{X7F699587845E6DB1}{}
{
 The following uses finite "Voronoi complexes" and homological perturbation to
construct a resolution for $G=PSL_4(\mathbb Z)$. The finite complexes were contributed by M. Dutour-Scikiric and are stored
in the folder \texttt{\texttt{\symbol{126}}pkg/Hap1.v/lib/Perturbations/Gcomplexes}. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ V:=ContractibleGcomplex("PSL(4,Z)_d");|
  Non-free resolution in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(V,5);|
  Resolution of length 5 in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 18, 210, 1444, 26813 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for finite-index subgroups }}\logpage{[ 11, 19, 0 ]}
\hyperdef{L}{X7812EB3F7AC45F87}{}
{
 The next commands first construct the congruence subgroup $\Gamma_0(I)$ of index $144$ in $SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ for the ideal $I$ in ${\cal O}\mathbb Q(\sqrt{-2})$ generated by $4+5\sqrt{-2}$. The commands then compute a resolution for the congruence subgroup $G=\Gamma_0(I) \le SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-2);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,4+5*Sqrt(-2));;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  <[group of 2x2 matrices in characteristic 0>
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  144
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-2,4,true);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,G);|
  Resolution of length 4 in characteristic 0 for <matrix group with 
  290 generators> . 
  
  !gapprompt@gap>| !gapinput@Size(S);|
  [ 1152, 8496, 30960, 59616 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Simplifying resolutions }}\logpage{[ 11, 20, 0 ]}
\hyperdef{L}{X84CAAA697FAC8E0D}{}
{
 The next commands construct a resolution $R_\ast$ for the symmetric group $S_5$ and convert it to a resolution $S_\ast$ for the finite index subgroup $A_4 < S_5$. An heuristic algorithm is applied to $S_\ast$ in the hope of obtaining a smaller resolution $T_\ast$ for the alternating group $A_4$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SymmetricGroup(5),5);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,AlternatingGroup(4));|
  Resolution of length 5 in characteristic 0 for Alt( [ 1 .. 4 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(S);|
  [ 80, 380, 1000, 2040, 3400 ]
  !gapprompt@gap>| !gapinput@T:=SimplifiedComplex(S);|
  Resolution of length 5 in characteristic 0 for Alt( [ 1 .. 4 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(T);|
  [ 4, 34, 22, 19, 196 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Resolutions for graphs of groups and for groups with aspherical presentations }}\logpage{[ 11, 21, 0 ]}
\hyperdef{L}{X780C3F038148A1C7}{}
{
 The following example constructs a resolution for a finitely presented group
whose presentation is known to have the property that its associated $2$-complex is aspherical. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FreeGroup(3);;x:=F.1;;y:=F.2;;z:=F.3;;|
  !gapprompt@gap>| !gapinput@rels:=[x*y*x*(y*x*y)^-1, y*z*y*(z*y*z)^-1, z*x*z*(x*z*x)^-1];;|
  !gapprompt@gap>| !gapinput@G:=F/rels;;|
  !gapprompt@gap>| !gapinput@R:=ResolutionAsphericalPresentation(G,10);|
  Resolution of length 10 in characteristic 0 for <fp group on the generators 
  [ f1, f2, f3 ]> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 6, 18, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 The following commands create a resolution for a graph of groups corresponding
to the amalgamated product $G=H\ast_AK$ where $H=S_5$ is the symmetric group of degree $5$, $K=S_4$ is the symmetric group of degree $4$ and the common subgroup is $A=S_3$. }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");;|
  Sym( [ 1 .. 5 ] )
  !gapprompt@gap>| !gapinput@S4:=SymmetricGroup(4);SetName(S4,"S4");;|
  Sym( [ 1 .. 4 ] )
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");;|
  Sym( [ 1 .. 3 ] )
  !gapprompt@gap>| !gapinput@AS5:=GroupHomomorphismByFunction(A,S5,x->x);;|
  !gapprompt@gap>| !gapinput@AS4:=GroupHomomorphismByFunction(A,S4,x->x);;|
  !gapprompt@gap>| !gapinput@D:=[S5,S4,[AS5,AS4]];;|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);;|
  
\end{Verbatim}
 

  

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,8);;|
  !gapprompt@gap>| !gapinput@Size(R);|
  [ 16, 68, 162, 302, 480, 627, 869, 1290 ]
  
\end{Verbatim}
 
\section{\textcolor{Chapter }{Resolutions for $\mathbb FG$-modules }}\logpage{[ 11, 22, 0 ]}
\hyperdef{L}{X85AB973F8566690A}{}
{
 Let $\mathbb F=\mathbb F_p$ be the field of $p$ elements and let $M$ be some $\mathbb FG$-module. We might wish to construct a free $\mathbb FG$-resolution for $M$. We can handle this by constructing a short exact sequence 

$ DM \rightarrowtail P \twoheadrightarrow M$ 

 in which $P$ is free (or projective). Then any resolution of $DM$ yields a resolution of $M$ and we can represent $DM$ as a submodule of $P$. We refer to $DM$ as the \emph{desuspension} of $M$. Consider for instance $G=Syl_2(GL(4,2))$ and $\mathbb F=\mathbb F_2$. The matrix group $G$ acts via matrix multiplication on $M=\mathbb F^4$. The following example constructs a free $\mathbb FG$-resolution for $M$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=GL(4,2);;A
  @gapprompt|gap>A @gapinput|S:=SylowSubgroup(G,2);;A
  @gapprompt|gap>A @gapinput|M:=GModuleByMats(GeneratorsOfGroup(S),GF(2));;A
  @gapprompt|gap>A @gapinput|DM:=DesuspensionMtxModule(M);;A
  @gapprompt|gap>A @gapinput|R:=ResolutionFpGModule(DM,20);A
  Resolution of length 20 in characteristic 2 for <matrix group of 
  size 64 with 3 generators> .
  
  @gapprompt|gap>A @gapinput|List([0..20],R!.dimension);A
  [ 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136, 
  153, 171, 190, 210, 231, 253 ]
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Simplicial groups}}\label{chapSimplicialGroups}
\logpage{[ 12, 0, 0 ]}
\hyperdef{L}{X7D818E5F80F4CF63}{}
{
 
\section{\textcolor{Chapter }{Crossed modules}}\label{secCrossedModules}
\logpage{[ 12, 1, 0 ]}
\hyperdef{L}{X808C6B357F8BADC1}{}
{
 A \emph{crossed module} consists of a homomorphism of groups $\partial\colon M\rightarrow G$ together with an action $(g,m)\mapsto\, {^gm}$ of $G$ on $M$ satisfying 
\begin{enumerate}
\item  $\partial(^gm) = gmg^{-1}$
\item  $^{\partial m}m' = mm'm^{-1}$
\end{enumerate}
 for $g\in G$, $m,m'\in M$. 

 A crossed module $\partial\colon M\rightarrow G$ is equivalent to a cat$^1$-group $(H,s,t)$ (see \ref{secCat1}) where $H=M \rtimes G$, $s(m,g) = (1,g)$, $t(m,g)=(1,(\partial m)g)$. A cat$^1$-group is, in turn, equivalent to a simplicial group with Moore complex has
length $1$. The simplicial group is constructed by considering the cat$^1$-group as a category and taking its nerve. Alternatively, the simplicial group
can be constructed by viewing the crossed module as a crossed complex and
using a nonabelian version of the Dold-Kan theorem. 

The following example concerns the crossed module 

$\partial\colon G\rightarrow Aut(G), g\mapsto (x\mapsto gxg^{-1})$ 

associated to the dihedral group $G$ of order $16$. This crossed module represents, up to homotopy type, a connected space $X$ with $\pi_iX=0$ for $i\ge 3$, $\pi_2X=Z(G)$, $\pi_1X = Aut(G)/Inn(G)$. The space $X$ can be represented, up to homotopy, by a simplicial group. That simplicial
group is used in the example to compute 

$H_1(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_2(X,\mathbb Z)= \mathbb Z_2 $, 

$H_3(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_4(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2$, 

$H_5(X,\mathbb Z)= \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_2 \oplus
\mathbb Z_2\oplus \mathbb Z_2\oplus \mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=AutomorphismGroupAsCatOneGroup(DihedralGroup(16));|
  Cat-1-group with underlying group Group( 
  [ f1, f2, f3, f4, f5, f6, f7, f8, f9 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(C);|
  512
  !gapprompt@gap>| !gapinput@Q:=QuasiIsomorph(C);|
  Cat-1-group with underlying group Group( [ f9, f8, f1, f2*f3, f5 ] ) . 
  
  !gapprompt@gap>| !gapinput@Size(Q);|
  32
  
  !gapprompt@gap>| !gapinput@N:=NerveOfCatOneGroup(Q,6);|
  Simplicial group of length 6
  
  !gapprompt@gap>| !gapinput@K:=ChainComplexOfSimplicialGroup(N);|
  Chain complex of length 6 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(K,1);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,2);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,3);|
  [ 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,4);|
  [ 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(K,5);|
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Eilenberg-MacLane spaces as simplicial groups (not recommended)}}\label{eilennot}
\logpage{[ 12, 2, 0 ]}
\hyperdef{L}{X795E339978B42775}{}
{
 

The following example concerns the Eilenberg-MacLane space $X=K(\mathbb Z_3,3)$ which is a path-connected space with $\pi_3X=\mathbb Z_3$, $\pi_iX=0$ for $3\ne i\ge 1$. This space is represented by a simplicial group, and perturbation techniques
are used to compute 

$H_7(X,\mathbb Z)=\mathbb Z_3 \oplus \mathbb Z_3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianGroup([3]);;AbelianInvariants(A);   |
  [ 3 ]
  !gapprompt@gap>| !gapinput@ K:=EilenbergMacLaneSimplicialGroup(A,3,8);|
  Simplicial group of length 8
  
  !gapprompt@gap>| !gapinput@C:=ChainComplex(K);|
  Chain complex of length 8 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(C,7);                                          |
  [ 3, 3 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Eilenberg-MacLane spaces as simplicial free abelian groups (recommended)}}\label{eilen}
\logpage{[ 12, 3, 0 ]}
\hyperdef{L}{X7D91E64D7DD7F10F}{}
{
 

For integer $n>1$ and abelian group $A$ the Eilenberg-MacLane space $K(A,n)$ is better represented as a simplicial free abelian group. (The reason is that
the functorial bar resolution of $A$ can be replaced in computations by the smaller functorial Chevalley-Eilenberg
complex of $A$, obviating the need for perturbation techniques.) 

The following commands compute the integral homology $H_n(K(\mathbb Z,3),\mathbb Z)$ for $ 0\le n \le 16$. (Note that one typically needs fewer than $n$ terms of the Eilenberg-MacLance space to compute its $n$-th homology -- an error is printed if too few terms of the space are
available for a given computation.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);; #infinite cyclic group                    |
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,3,14);|
  Simplicial free abelian group of length 14
  
  !gapprompt@gap>| !gapinput@for n in [0..16] do|
  !gapprompt@>| !gapinput@Print("Degree ",n," integral homology of K is ",Homology(K,n),"\n");|
  !gapprompt@>| !gapinput@od;|
  Degree 0 integral homology of K is [ 0 ]
  Degree 1 integral homology of K is [  ]
  Degree 2 integral homology of K is [  ]
  Degree 3 integral homology of K is [ 0 ]
  Degree 4 integral homology of K is [  ]
  Degree 5 integral homology of K is [ 2 ]
  Degree 6 integral homology of K is [  ]
  Degree 7 integral homology of K is [ 3 ]
  Degree 8 integral homology of K is [ 2 ]
  Degree 9 integral homology of K is [ 2 ]
  Degree 10 integral homology of K is [ 3 ]
  Degree 11 integral homology of K is [ 5, 2 ]
  Degree 12 integral homology of K is [ 2 ]
  Degree 13 integral homology of K is [  ]
  Degree 14 integral homology of K is [ 10, 2 ]
  Degree 15 integral homology of K is [ 7, 6 ]
  Degree 16 integral homology of K is [  ]
  
\end{Verbatim}
 For an $n$-connected pointed space $X$ the Freudenthal Suspension Theorem states that the map $X \rightarrow \Omega(\Sigma X)$ induces a map $\pi_k(X) \rightarrow \pi_k(\Omega(\Sigma X))$ which is an isomorphism for $k\le 2n$ and epimorphism for $k=2n+1$. Thus the Eilenberg-MacLane space $K(A,n+1)$ can be constructed from the suspension $\Sigma K(A,n)$ by attaching cells in dimensions $\ge 2n+1$. In particular, there is an isomorphism $ H_{k-1}(K(A,n),\mathbb Z) \rightarrow H_k(K(A,n+1),\mathbb Z)$ for $k\le 2n$ and epimorphism for $k=2n+1$. 

 For instance, $ H_{k-1}(K(\mathbb Z,3),\mathbb Z) \cong H_k(K(\mathbb Z,4),\mathbb Z) $ for $k\le 6$ and $ H_6(K(\mathbb Z,3),\mathbb Z) \twoheadrightarrow H_7(K(\mathbb Z,4),\mathbb Z) $. This assertion is seen in the following session. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);; #infinite cyclic group                    |
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,4,11);|
  Simplicial free abelian group of length 11
  
  !gapprompt@gap>| !gapinput@for n in [0..13] do|
  !gapprompt@>| !gapinput@Print("Degree ",n," integral homology of K is ",Homology(K,n),"\n");|
  !gapprompt@>| !gapinput@od;|
  Degree 0 integral homology of K is [ 0 ]
  Degree 1 integral homology of K is [  ]
  Degree 2 integral homology of K is [  ]
  Degree 3 integral homology of K is [  ]
  Degree 4 integral homology of K is [ 0 ]
  Degree 5 integral homology of K is [  ]
  Degree 6 integral homology of K is [ 2 ]
  Degree 7 integral homology of K is [  ]
  Degree 8 integral homology of K is [ 3, 0 ]
  Degree 9 integral homology of K is [  ]
  Degree 10 integral homology of K is [ 2, 2 ]
  Degree 11 integral homology of K is [  ]
  Degree 12 integral homology of K is [ 5, 12, 0 ]
  Degree 13 integral homology of K is [ 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Elementary theoretical information on $H^\ast(K(\pi,n),\mathbb Z)$}}\logpage{[ 12, 4, 0 ]}
\hyperdef{L}{X84ABCA497C577132}{}
{
  

The cup product is not implemented for the cohomology ring $H^\ast(K(\pi,n),\mathbb Z)$. Standard theoretical spectral sequence arguments have to be applied to
obtain basic information relating to the ring structure. To illustrate this
the following commands compute $H^n(K(\mathbb Z,2),\mathbb Z)$ for the first few values of $n$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,2,10);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Cohomology(K,k));|
  [ [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ] ]
  
\end{Verbatim}
 There is a fibration sequence $K(\pi,n) \hookrightarrow \ast \twoheadrightarrow K(\pi,n+1)$ in which $\ast$ denotes a contractible space. For $n=1, \pi=\mathbb Z$ the terms of the $E_2$ page of the Serre integral cohomology spectral sequence for this fibration are 
\begin{itemize}
\item  $E_2^{pq}= H^p( K(\mathbb Z,2), H^q(K(\mathbb Z,1),\mathbb Z) )$ .
\end{itemize}
 Since $K(\mathbb Z,1)$ can be taken to be the circle $S^1$ we know that it has non-trivial cohomology in degrees $0$ and $1$ only. The first few terms of the $E_2$ page are given in the following table. \begin{center}
\begin{tabular}{l|lllllllllll} $1$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $\mathbb Z$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ &
 $8$ &
 $9$ &
 $10$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\mathbb Z,1) \hookrightarrow \ast \twoheadrightarrow K(\mathbb Z,2)$\end{center}

 Let $x$ denote the generator of $H^1(K(\mathbb Z,1),\mathbb Z)$ and $y$ denote the generator of $H^2(K(\mathbb Z,2),\mathbb Z)$. Since $\ast$ has zero cohomology in degrees $\ge 1$ we see that the differential must restrict to an isomorphism $d_2\colon E_2^{0,1} \rightarrow E_2^{2,0}$ with $d_2(x)=y$. Then we see that the differential must restrict to an isomorphism $d_2\colon E_2^{2,1} \rightarrow E_2^{4,0}$ defined on the generator $xy$ of $E_2^{2,1}$ by 
\[d_2(xy) = d_2(x)y + (-1)^{{\rm deg}(x)}xd_2(y) =y^2\ . \]
 Hence $E_2^{4,0} \cong H^4(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^2$. The argument extends to show that $H^6(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^3$, $H^8(K(\mathbb Z,2),\mathbb Z)$ is generated by $y^4$, and so on. 

In fact, to obtain a complete description of the ring $H^\ast(K(\mathbb Z,2),\mathbb Z)$ in this fashion there is no benefit to using computer methods at all. We only
need to know the cohomology ring $H^\ast(K(\mathbb Z,1),\mathbb Z) =H^\ast(S^1,\mathbb Z)$ and the single cohomology group $H^2(K(\mathbb Z,2),\mathbb Z)$. 

A similar approach can be attempted for $H^\ast(K(\mathbb Z,3),\mathbb Z)$ using the fibration sequence $K(\mathbb Z,2) \hookrightarrow \ast \twoheadrightarrow K(\mathbb Z,3)$ and, as explained in Chapter 5 of \cite{hatcher}, yields the computation of the group $H^i(K(\mathbb Z,3),\mathbb Z)$ for $4\le i\le 13$. The method does not directly yield $H^3(K(\mathbb Z,3),\mathbb Z)$ and breaks down in degree $14$ yielding only that $H^{14}(K(\mathbb Z,3),\mathbb Z) = 0 {\rm ~or~} \mathbb Z_3$. The following commands provide $H^3(K(\mathbb Z,3),\mathbb Z)= \mathbb Z$ and $H^{14}(K(\mathbb Z,3),\mathbb Z) =0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=AbelianPcpGroup([0]);;|
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,3,15);;|
  !gapprompt@gap>| !gapinput@Cohomology(K,3);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(K,14);|
  [  ]
  
\end{Verbatim}
 However, the implementation of these commands is currently a bit naive, and
computationally inefficient, since they do not currently employ any
homological perturbation techniques. }

 
\section{\textcolor{Chapter }{The first three non-trivial homotopy groups of spheres}}\label{firstthree}
\logpage{[ 12, 5, 0 ]}
\hyperdef{L}{X7F828D8D8463CC20}{}
{
 

The Hurewicz Theorem immediately gives 
\[\pi_n(S^n)\cong \mathbb Z ~~~ (n\ge 1)\]
 and 
\[\pi_k(S^n)=0 ~~~ (k\le n-1).\]
 

As a CW-complex the Eilenberg-MacLane space $K=K(\mathbb Z,n)$ can be obtained from an $n$-sphere $S^n=e^0\cup e^n$ by attaching cells in dimensions $\ge n+2$ so as to kill the higher homotopy groups of $S^n$. From the inclusion $\iota\colon S^n\hookrightarrow K(\mathbb Z,n)$ we can form the mapping cone $X=C(\iota)$. The long exact homotopy sequence 

$ \cdots \rightarrow \pi_{k+1}K \rightarrow \pi_{k+1}(K,S^n) \rightarrow \pi_{k}
S^n \rightarrow \pi_kK \rightarrow \pi_k(K,S^n) \rightarrow \cdots$ 

 implies that $\pi_k(K,S^n)=0$ for $0 \le k\le n+1$ and $\pi_{n+2}(K,S^n)\cong \pi_{n+1}(S^n)$. The relative Hurewicz Theorem gives an isomorphism $\pi_{n+2}(K,S^n) \cong H_{n+2}(K,S^n,\mathbb Z)$. The long exact homology sequence 

$ \cdots H_{n+2}(S^n,\mathbb Z) \rightarrow H_{n+2}(K,\mathbb Z) \rightarrow
H_{n+2}(K,S^n, \mathbb Z) \rightarrow H_{n+1}(S^n,\mathbb Z) \rightarrow
\cdots$ 

 arising from the cofibration $S^n \hookrightarrow K \twoheadrightarrow X$ implies that $\pi_{n+1}(S^n)\cong \pi_{n+2}(K,S^n) \cong H_{n+2}(K,S^n,\mathbb Z) \cong
H_{n+2}(K,\mathbb Z)$. From the \textsc{GAP} computations in \ref{eilen} and the Freudenthal Suspension Theorem we find: 
\[ \pi_3S^2 \cong \mathbb Z, ~~~~~~ \pi_{n+1}(S^n)\cong \mathbb Z_2~~~(n\ge 3).\]
 

The Hopf fibration $S^3\rightarrow S^2$ has fibre $S^1 = K(\mathbb Z,1)$. It can be constructed by viewing $S^3$ as all pairs $(z_1,z_2)\in \mathbb C^2$ with $|z_1|^2+|z_2|^2=1$ and viewing $S^2$ as $\mathbb C\cup \infty$; the map sends $(z_1,z_2)\mapsto z_1/z_2$. The homotopy exact sequence of the Hopf fibration yields $\pi_k(S^3) \cong \pi_k(S^2)$ for $k\ge 3$, and in particular 
\[\pi_4(S^2) \cong \pi_4(S^3) \cong \mathbb Z_2\ .\]
 It will require further techniques (such as the Postnikov tower argument in
Section \ref{postnikov2} below) to establish that $\pi_5(S^3) \cong \mathbb Z_2$. Once we have this isomorphism for $\pi_5(S^3)$, the generalized Hopf fibration $S^3 \hookrightarrow S^7 \twoheadrightarrow S^4$ comes into play. This fibration is contructed as for the classical fibration,
but using pairs $(z_1,z_2)$ of quaternions rather than pairs of complex numbers. The Hurewicz Theorem
gives $\pi_3(S^7)=0$; the fibre $S^3$ is thus homotopic to a point in $S^7$ and the inclusion of the fibre induces the zero homomorphism $\pi_k(S^3) \stackrel{0}{\longrightarrow} \pi_k(S^7) ~~(k\ge 1)$. The exact homotopy sequence of the generalized Hopf fibration then gives $\pi_k(S^4)\cong \pi_k(S^7)\oplus \pi_{k-1}(S^3)$. On taking $k=6$ we obtain $\pi_6(S^4)\cong \pi_5(S^3) \cong \mathbb Z_2$. Freudenthal suspension then gives 
\[\pi_{n+2}(S^n)\cong \mathbb Z_2,~~~(n\ge 2).\]
 }

 
\section{\textcolor{Chapter }{The first two non-trivial homotopy groups of the suspension and double
suspension of a $K(G,1)$}}\label{firsttwo}
\logpage{[ 12, 6, 0 ]}
\hyperdef{L}{X81E2F80384ADF8C2}{}
{
 

For any group $G$ we consider the homotopy groups $\pi_n(\Sigma K(G,1))$ of the suspension $\Sigma K(G,1)$ of the Eilenberg-MacLance space $K(G,1)$. On taking $G=\mathbb Z$, and observing that $S^2 = \Sigma K(\mathbb Z,1)$, we specialize to the homotopy groups of the $2$-sphere $S^2$. 

By construction, 
\[\pi_1(\Sigma K(G,1))=0\ .\]
 The Hurewicz Theorem gives 
\[\pi_2(\Sigma K(G,1)) \cong G_{ab}\]
 via the isomorphisms $\pi_2(\Sigma K(G,1)) \cong H_2(\Sigma K(G,1),\mathbb Z) \cong
H_1(K(G,1),\mathbb Z) \cong G_{ab}$. R. Brown and J.-L. Loday \cite{brownloday} obtained the formulae 
\[\pi_3(\Sigma K(G,1)) \cong \ker (G\otimes G \rightarrow G, x\otimes y\mapsto
[x,y]) \ ,\]
 
\[\pi_4(\Sigma^2 K(G,1)) \cong \ker (G\, {\widetilde \otimes}\, G \rightarrow G,
x\, {\widetilde \otimes}\, y\mapsto [x,y]) \]
 involving the nonabelian tensor square and nonabelian symmetric square of the
group $G$. The following commands use the nonabelian tensor and symmetric product to
compute the third and fourth homotopy groups for $G =Syl_2(M_{12})$ the Sylow $2$-subgroup of the Mathieu group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);   |
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  gap>
  !gapprompt@gap>| !gapinput@FourthHomotopyGroupOfDoubleSuspensionB(G);|
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Postnikov towers and $\pi_5(S^3)$ }}\label{postnikov2}
\logpage{[ 12, 7, 0 ]}
\hyperdef{L}{X83EAC40A8324571F}{}
{
 A Postnikov system for the sphere $S^3$ consists of a sequence of fibrations $\cdots X_3\stackrel{p_3}{\rightarrow} X_2\stackrel{p_2}{\rightarrow}
X_1\stackrel{p_1}{\rightarrow} \ast$ and a sequence of maps $\phi_n\colon S^3 \rightarrow X_n$ such that 
\begin{itemize}
\item  $p_n \circ \phi_n =\phi_{n-1}$ 
\item The map $\phi_n\colon S^3 \rightarrow X_n$ induces an isomorphism $\pi_k(S^3)\rightarrow \pi_k(X_n)$ for all $k\le n$ 
\item $\pi_k(X_n)=0$ for $k > n$
\item and consequently each fibration $p_n$ has fibre an Eilenberg-MacLane space $K(\pi_n(S^3),n)$.
\end{itemize}
 The space $X_n$ is obtained from $S^3$ by adding cells in dimensions $\ge n+2$ and thus 
\begin{itemize}
\item $H_k(X_n,\mathbb Z)=H_k(S^3,\mathbb Z)$ for $k\le n+1$. 
\end{itemize}
 So in particular $X_1=X_2=\ast, X_3=K(\mathbb Z,3)$ and we have a fibration sequence $K(\pi_4(S^3),4) \hookrightarrow X_4 \twoheadrightarrow K(\mathbb Z,3)$. The terms in the $E_2$ page of the Serre integral cohomology spectral sequence of this fibration are 
\begin{itemize}
\item $E_2^{p,q}=H^p(\,K(\mathbb Z,3),\,H_q(K(\mathbb Z_2,4),\mathbb Z)\,)$.
\end{itemize}
 The first few terms in the $E_2$ page can be computed using the commands of Sections \ref{eilennot} and \ref{eilen} and recorded as follows. \begin{center}
\begin{tabular}{l|llllllllll} $8$ &
 $\mathbb Z_2$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $7$ &
 $\mathbb Z_2$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $6$ &
 $0$ &
 $0$&
 $0$&
 &
 &
 &
 &
 &
 &
 \\
 $5$ &
 $\pi_4(S^3)$ &
 $0$ &
 $0$ &
 $\pi_4(S^3)$ &
 $0$ &
 $0$&
 $0$ &
 $$&
 &
 \\
 $4$ &
 $0$ &
 $0$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $3$ &
 $0$ &
 $0$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $1$ &
$0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_2$ &
 $0$ &
 $\mathbb Z_3$ &
 $\mathbb Z_2$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ &
 $8$ &
 $9$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E_2$ cohomology page for $K(\pi_4(S^3),4) \hookrightarrow X_4 \twoheadrightarrow X_3$\end{center}

 Since we know that $H^5(X_4,\mathbb Z) =0$, the differentials in the spectral sequence must restrict to an isomorphism $E_2^{0,5}=\pi_4(S^3) \stackrel{\cong}{\longrightarrow} E_2^{6,0}=\mathbb Z_2$. This provides an alternative derivation of $\pi_4(S^3) \cong \mathbb Z_2$. We can also immediately deduce that $H^6(X_4,\mathbb Z)=0$. Let $x$ be the generator of $E_2^{0,5}$ and $y$ the generator of $E_2^{3,0}$. Then the generator $xy$ of $E_2^{3,5}$ gets mapped to a non-zero element $d_7(xy)=d_7(x)y -xd_7(y)$. Hence the term $E_2^{0,7}=\mathbb Z_2$ must get mapped to zero in $E_2^{3,5}$. It follows that $H^7(X_4,\mathbb Z)=\mathbb Z_2$. 

The integral cohomology of Eilenberg-MacLane spaces yields the following
information on the $E_2$ page $E_2^{p,q}=H_p(\,X_4,\,H^q(K(\pi_5S^3,5),\mathbb Z)\,)$ for the fibration $K(\pi_5(S^3),5) \hookrightarrow X_5 \twoheadrightarrow X_4$. \begin{center}
\begin{tabular}{l|llllllll} $6$ &
 $\pi_5(S^3)$ &
 $0$ &
 $0$ &
 $\pi_5(S^3)$ &
 $0$ &
 $0$ &
 &
 \\
 $5$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $4$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $0$ &
 $H^7(X_4,\mathbb Z)$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E_2$ cohomology page for $K(\pi_5(S^3),5) \hookrightarrow X_5 \twoheadrightarrow X_4$\end{center}

 Since we know that $H^6(X_5,\mathbb Z)=0$, the differentials in the spectral sequence must restrict to an isomorphism $E_2^{0,6}=\pi_5(S^3) \stackrel{\cong}{\longrightarrow}
E_2^{7,0}=H^7(X_4,\mathbb Z)$. We can conclude the desired result: 
\[\pi_5(S^3) = \mathbb Z_2\ .\]
 

 $~~~$



 Note that the fibration $X_4 \twoheadrightarrow K(\mathbb Z,3)$ is determined by a cohomology class $\kappa \in H^5(K(\mathbb Z,3), \mathbb Z_2) = \mathbb Z_2$. If $\kappa=0$ then we'd have $X_4 =K(\mathbb Z_2,4)\times K(\mathbb Z,3)$ and, as the following commands show, we'd then have $H_4(X_4,\mathbb Z)=\mathbb Z_2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialGroup(AbelianPcpGroup([0]),3,7);;|
  !gapprompt@gap>| !gapinput@L:=EilenbergMacLaneSimplicialGroup(CyclicGroup(2),4,7);;|
  !gapprompt@gap>| !gapinput@CK:=ChainComplex(K);;|
  !gapprompt@gap>| !gapinput@CL:=ChainComplex(L);;|
  !gapprompt@gap>| !gapinput@T:=TensorProduct(CK,CL);;|
  !gapprompt@gap>| !gapinput@Homology(T,4);|
  [ 2 ]
  
\end{Verbatim}
 Since we know that $H_4(X_4,\mathbb Z)=0$ we can conclude that the Postnikov invariant $\kappa$ is the non-zero class in $H^5(K(\mathbb Z,3), \mathbb Z_2) = \mathbb Z_2$. }

 
\section{\textcolor{Chapter }{Towards $\pi_4(\Sigma K(G,1))$ }}\label{postnikov}
\logpage{[ 12, 8, 0 ]}
\hyperdef{L}{X8227000D83B9A17F}{}
{
 Consider the suspension $X=\Sigma K(G,1)$ of a classifying space of a group $G$ once again. This space has a Postnikov system in which $X_1 = \ast$, $X_2= K(G_{ab},2)$. We have a fibration sequence $K(\pi_3 X, 3) \hookrightarrow X_3 \twoheadrightarrow K(G_{ab},2)$. The corresponding integral cohomology Serre spectral sequence has $E_2$ page with terms 
\begin{itemize}
\item  $E_2^{p,q}=H^p(\,K(G_{ab},2), H^q(K(\pi_3 X,3)),\mathbb Z)\, )$. 
\end{itemize}
 

As an example, for the Alternating group $G=A_4$ of order $12$ the following commands of Section \ref{firsttwo} compute $G_{ab} = \mathbb Z_3$ and $\pi_3 X = \mathbb Z_6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 3 ]
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);|
  [ 2, 3 ]
  
\end{Verbatim}
 The first terms of the $E_2$ page can be calculated using the commands of Sections \ref{eilennot} and \ref{eilen}. \begin{center}
\begin{tabular}{l|llllllll} $7$ &
 $\mathbb Z_2 $ &
 $0$ &
 $$ &
 $$ &
 $$ &
 $$ &
 &
 \\
 $6$ &
 $\mathbb Z_2$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 &
 \\
 $5$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ &
 \\
 $4$ &
 $\mathbb Z_6$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $$ &
 $$ &
 $$ &
 \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $0$ &
 $\mathbb Z_3$ &
 $0$ &
 $\mathbb Z_9$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ &
 $7$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\pi_3 X,3) \hookrightarrow X_3 \twoheadrightarrow X_2$\end{center}

 We know that $H^1(X_3,\mathbb Z)=0$, $H^2(X_3,\mathbb Z)=H^1(G,\mathbb Z) =0$, $H^3(X_3,\mathbb Z)=H^2(G,\mathbb Z) =\mathbb Z_3$, and that $H^4(X_3,\mathbb Z)$ is a subgroup of $H^3(G,\mathbb Z) = \mathbb Z_2$. It follows that the differential induces a surjection $E_2^{0,4}=\mathbb Z_6 \twoheadrightarrow E_2^{5,0}=\mathbb Z_3$. Consequently $H^4(X_3,\mathbb Z)=\mathbb Z_2$ and $H^5(X_3,\mathbb Z)=0$ and $H^6(X_3,\mathbb Z)=\mathbb Z_2$. 

The $E_2$ page for the fibration $K(\pi_4 X,4) \hookrightarrow X_4 \twoheadrightarrow X_3$ contains the following terms. \begin{center}
\begin{tabular}{l|lllllll} $5$ &
 $\pi_4 X$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ &
 $$ \\
 $4$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ &
 $$ &
 $$ \\
 $3$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $$ \\
 $2$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 \\
 $1$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ &
 $0$ \\
 $0$ &
 $\mathbb Z$ &
 $0$ &
 $0$ &
 $\mathbb Z_3$ &
 $\mathbb Z_2$ &
 $0$ &
 $\mathbb Z_2$ \\
 $q/p$ &
 $0$ &
 $1$ &
 $2$ &
 $3$ &
 $4$ &
 $5$ &
 $6$ \\
\end{tabular}\\[2mm]
\textbf{Table: }$E^2$ cohomology page for $K(\pi_4 X,4) \hookrightarrow X_4 \twoheadrightarrow X_3$\end{center}

 We know that $H^5(X_4,\mathbb Z)$ is a subgroup of $H^4(G,\mathbb Z)=\mathbb Z_6$, and hence that there is a homomorphisms $\pi_4X \rightarrow \mathbb Z_2$ whose kernel is a subgroup of $\mathbb Z_6$. If follows that $|\pi_4 X|\le 12$. }

 
\section{\textcolor{Chapter }{Enumerating homotopy 2-types}}\logpage{[ 12, 9, 0 ]}
\hyperdef{L}{X7F5E6C067B2AE17A}{}
{
  A \emph{2-type} is a CW-complex $X$ whose homotopy groups are trivial in dimensions $n=0 $ and $n>2$. As explained in \ref{secCat1} the homotopy type of such a space can be captured algebraically by a cat$^1$-group $G$. Let $X$, $Y$ be $2$-tytpes represented by cat$^1$-groups $G$, $H$. If $X$ and $Y$ are homotopy equivalent then there exists a sequence of morphisms of cat$^1$-groups 
\[G \rightarrow K_1 \rightarrow K_2 \leftarrow K_3 \rightarrow \cdots
\rightarrow K_n \leftarrow H\]
 in which each morphism induces isomorphisms of homotopy groups. When such a
sequence exists we say that $G$ is \emph{quasi-isomorphic} to $H$. We have the following result. 

\textsc{Theorem.} The $2$-types $X$ and $Y$ are homotopy equivalent if and only if the associated cat$^1$-groups $G$ and $H$ are quasi-isomorphic. 

The following commands produce a list $L$ of all of the $62$ non-isomorphic cat$^1$-groups whose underlying group has order $16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for G in AllSmallGroups(16) do|
  !gapprompt@>| !gapinput@Append(L,CatOneGroupsByGroup(G));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Length(L);|
  62
  
\end{Verbatim}
 The next commands use the first and second homotopy groups to prove that the
list $L$ contains at least $37$ distinct quasi-isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Invariants:=function(G)|
  !gapprompt@>| !gapinput@local inv;|
  !gapprompt@>| !gapinput@inv:=[];|
  !gapprompt@>| !gapinput@inv[1]:=IdGroup(HomotopyGroup(G,1));|
  !gapprompt@>| !gapinput@inv[2]:=IdGroup(HomotopyGroup(G,2));|
  !gapprompt@>| !gapinput@return inv;|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@C:=Classify(L,Invariants);;|
  !gapprompt@gap>| !gapinput@Length(C);|
  
\end{Verbatim}
 The following additional commands use second and third integral homology in
conjunction with the first two homotopy groups to prove that the list $L$ contains \textsc{at least} $49$ distinct quasi-isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Invariants2:=function(G)|
  !gapprompt@>| !gapinput@local inv;|
  !gapprompt@>| !gapinput@inv:=[];|
  !gapprompt@>| !gapinput@inv[1]:=Homology(G,2);|
  !gapprompt@>| !gapinput@inv[2]:=Homology(G,3);|
  !gapprompt@>| !gapinput@return inv;|
  !gapprompt@>| !gapinput@end;;|
  !gapprompt@gap>| !gapinput@C:=RefineClassification(C,Invariants2);;|
  
  !gapprompt@gap>| !gapinput@Length(C);|
  49
  
\end{Verbatim}
 The following commands show that the above list $L$ contains \textsc{at most} $51$ distinct quasi-isomorphism types. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=List(L,QuasiIsomorph);;|
  !gapprompt@gap>| !gapinput@M:=[];;|
  
  !gapprompt@gap>| !gapinput@for q in Q do|
  !gapprompt@>| !gapinput@bool:=true;;|
  !gapprompt@>| !gapinput@for m in M do|
  !gapprompt@>| !gapinput@if not IsomorphismCatOneGroups(m,q)=fail then bool:=false; break; fi;|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@>| !gapinput@if bool then Add(M,q); fi;|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@Length(M);|
  51
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying cat$^1$-groups of low order}}\logpage{[ 12, 10, 0 ]}
\hyperdef{L}{X7D99B7AA780D8209}{}
{
  Let us define the \emph{order} of a cat$^1$-group to be the order of its underlying group. The function \texttt{IdQuasiCatOneGroup(C)} inputs a cat$^1$-group $C$ of "low order" and returns an integer pair $[n,k]$ that uniquely idenifies the quasi-isomorphism type of $C$. The integer $n$ is the order of a smallest cat$^1$-group quasi-isomorphic to $C$. The integer $k$ identifies a particular cat$^1$-group of order $n$. 

The following commands use this function to show that there are precisely $49$ distinct quasi-isomorphism types of cat$^1$-groups of order $16$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for G in AllSmallGroups(16) do|
  !gapprompt@>| !gapinput@Append(L,CatOneGroupsByGroup(G));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@M:=List(L,IdQuasiCatOneGroup);|
  [ [ 16, 1 ], [ 16, 2 ], [ 16, 3 ], [ 16, 4 ], [ 16, 5 ], [ 4, 4 ], [ 1, 1 ], 
    [ 16, 6 ], [ 16, 7 ], [ 16, 8 ], [ 16, 9 ], [ 16, 10 ], [ 16, 11 ], 
    [ 16, 9 ], [ 16, 12 ], [ 16, 13 ], [ 16, 14 ], [ 16, 15 ], [ 4, 1 ], 
    [ 4, 2 ], [ 16, 16 ], [ 16, 17 ], [ 16, 18 ], [ 16, 19 ], [ 16, 20 ], 
    [ 16, 21 ], [ 16, 22 ], [ 16, 23 ], [ 16, 24 ], [ 16, 25 ], [ 16, 26 ], 
    [ 16, 27 ], [ 16, 28 ], [ 4, 3 ], [ 4, 1 ], [ 4, 4 ], [ 4, 4 ], [ 4, 2 ], 
    [ 4, 5 ], [ 16, 29 ], [ 16, 30 ], [ 16, 31 ], [ 16, 32 ], [ 16, 33 ], 
    [ 16, 34 ], [ 4, 3 ], [ 4, 4 ], [ 4, 4 ], [ 16, 35 ], [ 16, 36 ], [ 4, 3 ], 
    [ 16, 37 ], [ 16, 38 ], [ 16, 39 ], [ 16, 40 ], [ 16, 41 ], [ 16, 42 ], 
    [ 16, 43 ], [ 4, 3 ], [ 4, 4 ], [ 1, 1 ], [ 4, 5 ] ]
  !gapprompt@gap>| !gapinput@Length(SSortedList(M));|
  49
  
\end{Verbatim}
 The next example first identifies the order and the identity number of the cat$^1$-group $C$ corresponding to the crossed module (see \ref{secCrossedModules}) 
\[\iota\colon G \longrightarrow Aut(G), g \mapsto (x\mapsto gxg^{-1})\]
 for the dihedral group $G$ of order $10$. It then realizes a smallest possible cat$^1$-group $D$ of this quasi-isomorphism type. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=AutomorphismGroupAsCatOneGroup(DihedralGroup(10));|
  Cat-1-group with underlying group Group( [ f1, f2, f3, f4, f5 ] ) . 
  
  !gapprompt@gap>| !gapinput@Order(C);|
  200
  !gapprompt@gap>| !gapinput@IdCatOneGroup(C);|
  [ 200, 42, 4 ]
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@IdQuasiCatOneGroup(C);|
  [ 2, 1 ]
  !gapprompt@gap>| !gapinput@D:=SmallCatOneGroup(2,1);|
  Cat-1-group with underlying group Group( [ f1 ] ) . 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Identifying crossed modules of low order}}\logpage{[ 12, 11, 0 ]}
\hyperdef{L}{X7F386CF078CB9A20}{}
{
  

The following commands construct the crossed module $\partial \colon G\otimes G \rightarrow G$ involving the nonabelian tensor square of the dihedral group \$G\$ of order $10$, identify it as being number $71$ in the list of crossed modules of order $100$, create a quasi-isomorphic crossed module of order $4$, and finally construct the corresponding cat$^1$-group of order $100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=DihedralGroup(10);;|
  !gapprompt@gap>| !gapinput@T:=NonabelianTensorSquareAsCrossedModule(G);|
  Crossed module with group homomorphism GroupHomomorphismByImages( Group( 
  [ f3*f1*f3^-1*f1^-1, f3*f2*f3^-1*f2^-1 ] ), Group( [ f1, f2 ] ), 
  [ f3*f1*f3^-1*f1^-1, f3*f2*f3^-1*f2^-1 ], [ <identity> of ..., f2^3 ] )
  
  !gapprompt@gap>| !gapinput@IdCrossedModule(T);|
  [ 100, 71 ]
  !gapprompt@gap>| !gapinput@Q:=QuasiIsomorph(T);|
  Crossed module with group homomorphism Pcgs([ f2 ]) -> [ <identity> of ... ]
  
  !gapprompt@gap>| !gapinput@Order(Q);|
  4
  !gapprompt@gap>| !gapinput@C:=CatOneGroupByCrossedModule(T);|
  Cat-1-group with underlying group Group( [ F1, F2, F1 ] ) . 
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Congruence Subgroups, Cuspidal Cohomology and Hecke Operators}}\logpage{[ 13, 0, 0 ]}
\hyperdef{L}{X86D5DB887ACB1661}{}
{
 In this chapter we explain how HAP can be used to make computions about
modular forms associated to congruence subgroups $\Gamma$ of $SL_2(\mathbb Z)$. Also, in Subsection 10.8 onwards, we demonstrate cohomology computations for
the \emph{Picard group} $SL_2(\mathbb Z[i])$, some \emph{Bianchi groups} $PSL_2({\cal O}_{-d}) $ where ${\cal O}_{d}$ is the ring of integers of $\mathbb Q(\sqrt{-d})$ for square free positive integer $d$, and some other groups of the form $SL_m({\cal O})$, $GL_m({\cal O})$, $PSL_m({\cal O})$, $PGL_m({\cal O})$, for $m=2,3,4$ and certain ${\cal O}=\mathbb Z, {\cal O}_{-d}$. 
\section{\textcolor{Chapter }{Eichler-Shimura isomorphism}}\label{sec:EichlerShimura}
\logpage{[ 13, 1, 0 ]}
\hyperdef{L}{X79A1974B7B4987DE}{}
{
 

We begin by recalling the Eichler-Shimura isomorphism \cite{eichler}\cite{shimura} 
\[ S_k(\Gamma) \oplus \overline{S_k(\Gamma)} \oplus E_k(\Gamma) \cong_{\sf Hecke}
H^1(\Gamma,P_{\mathbb C}(k-2))\]
 

 which relates the cohomology of groups to the theory of modular forms
associated to a finite index subgroup $\Gamma$ of $SL_2(\mathbb Z)$. In subsequent sections we explain how to compute with the right-hand side of
the isomorphism. But first, for completeness, let us define the terms on the
left-hand side. 

 Let $N$ be a positive integer. A subgroup $\Gamma$ of $SL_2(\mathbb Z)$ is said to be a \emph{congruence subgroup} of level $N $ if it contains the kernel of the canonical homomorphism $\pi_N\colon SL_2(\mathbb Z) \rightarrow SL_2(\mathbb Z/N\mathbb Z)$. So any congruence subgroup is of finite index in $SL_2(\mathbb Z)$, but the converse is not true. 

One congruence subgroup of particular interest is the group $\Gamma_1(N)=\ker(\pi_N)$, known as the \emph{principal congruence subgroup} of level $N$. Another congruence subgroup of particular interest is the group $\Gamma_0(N)$ of those matrices that project to upper triangular matrices in $SL_2(\mathbb Z/N\mathbb Z)$. 

A \emph{modular form} of weight $k$ for a congruence subgroup $\Gamma$ is a complex valued function on the upper-half plane, $f\colon {\frak{h}}=\{z\in \mathbb C : Re(z)>0\} \rightarrow \mathbb C$, satisfying: 
\begin{itemize}
\item  $\displaystyle f(\frac{az+b}{cz+d}) = (cz+d)^k f(z)$ for $\left(\begin{array}{ll}a&b\\ c &d \end{array}\right) \in \Gamma$, 
\item  $f$ is `holomorphic' on the \emph{extended upper-half plane} $\frak{h}^\ast = \frak{h} \cup \mathbb Q \cup \{\infty\}$ obtained from the upper-half plane by `adjoining a point at each cusp'. 
\end{itemize}
 The collection of all weight $k$ modular forms for $\Gamma$ form a vector space $M_k(\Gamma)$ over $\mathbb C$. 

A modular form $f$ is said to be a \emph{cusp form} if $f(\infty)=0$. The collection of all weight $k$ cusp forms for $\Gamma$ form a vector subspace $S_k(\Gamma)$. There is a decomposition 
\[M_k(\Gamma) \cong S_k(\Gamma) \oplus E_k(\Gamma)\]
 

 involving a summand $E_k(\Gamma)$ known as the \emph{Eisenstein space}. See \cite{stein} for further introductory details on modular forms. 

The Eichler-Shimura isomorphism is more than an isomorphism of vector spaces.
It is an isomorphism of Hecke modules: both sides admit notions of \emph{Hecke operators}, and the isomorphism preserves these operators. The bar on the left-hand side
of the isomorphism denotes complex conjugation, or \emph{anti-holomorphic} forms. See \cite{wieser} for a full account of the isomorphism. 



 On the right-hand side of the isomorphism, the $\mathbb Z\Gamma$-module $P_{\mathbb C}(k-2)\subset \mathbb C[x,y]$ denotes the space of homogeneous degree $k-2$ polynomials with action of $\Gamma$ given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot p(x,y) =
p(dx-by,-cx+ay)\ .\]
 In particular $P_{\mathbb C}(0)=\mathbb C$ is the trivial module. Below we shall compute with the integral analogue $P_{\mathbb Z}(k-2) \subset \mathbb Z[x,y]$. 



 In the following sections we explain how to use the right-hand side of the
Eichler-Shimura isomorphism to compute eigenvalues of the Hecke operators
restricted to the subspace $S_k(\Gamma)$ of cusp forms. }

 
\section{\textcolor{Chapter }{Generators for $SL_2(\mathbb Z)$ and the cubic tree}}\logpage{[ 13, 2, 0 ]}
\hyperdef{L}{X7BFA2C91868255D9}{}
{
 

 The matrices $S=\left(\begin{array}{rr}0&-1\\ 1 &0 \end{array}\right)$ and $T=\left(\begin{array}{rr}1&1\\ 0 &1 \end{array}\right)$ generate $SL_2(\mathbb Z)$ and it is not difficult to devise an algorithm for expressing an arbitrary
integer matrix $A$ of determinant $1$ as a word in $S$, $T$ and their inverses. The following illustrates such an algorithm. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=[[4,9],[7,16]];;|
  !gapprompt@gap>| !gapinput@word:=AsWordInSL2Z(A);|
  [ [ [ 1, 0 ], [ 0, 1 ] ], [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, -1 ], [ 0, 1 ] ], 
    [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, 1 ], [ 0, 1 ] ], [ [ 0, 1 ], [ -1, 0 ] ], 
    [ [ 1, -1 ], [ 0, 1 ] ], [ [ 1, -1 ], [ 0, 1 ] ], [ [ 1, -1 ], [ 0, 1 ] ], 
    [ [ 0, 1 ], [ -1, 0 ] ], [ [ 1, 1 ], [ 0, 1 ] ], [ [ 1, 1 ], [ 0, 1 ] ] ]
  !gapprompt@gap>| !gapinput@Product(word);|
  [ [ 4, 9 ], [ 7, 16 ] ]
  
\end{Verbatim}
 It is convenient to introduce the matrix $U=ST = \left(\begin{array}{rr}0&-1\\ 1 &1 \end{array}\right)$. The matrices $S$ and $U$ also generate $SL_2(\mathbb Z)$. In fact we have a free presentation $SL_2(\mathbb Z)= \langle S,U\, |\, S^4=U^6=1, S^2=U^3 \rangle $. 



 The \emph{cubic tree} $\cal T$ is a tree (\emph{i.e.} a $1$-dimensional contractible regular CW-complex) with countably infinitely many
edges in which each vertex has degree $3$. We can realize the cubic tree $\cal T$ by taking the left cosets of ${\cal U}=\langle U\rangle$ in $SL_2(\mathbb Z)$ as vertices, and joining cosets $x\,{\cal U} $ and $y\,{\cal U}$ by an edge if, and only if, $x^{-1}y \in {\cal U}\, S\,{\cal U}$. Thus the vertex $\cal U $ is joined to $S\,{\cal U} $, $US\,{\cal U}$ and $U^2S\,{\cal U}$. The vertices of this tree are in one-to-one correspondence with all reduced
words in $S$, $U$ and $U^2$ that, apart from the identity, end in $S$. 

 From our realization of the cubic tree $\cal T$ we see that $SL_2(\mathbb Z)$ acts on $\cal T$ in such a way that each vertex is stabilized by a cyclic subgroup conjugate to ${\cal U}=\langle U\rangle$ and each edge is stabilized by a cyclic subgroup conjugate to ${\cal S} =\langle S \rangle$. 

 In order to store this action of $SL_2(\mathbb Z)$ on the cubic tree $\cal T$ we just need to record the following finite amount of information. 

  }

 
\section{\textcolor{Chapter }{One-dimensional fundamental domains and generators for congruence subgroups}}\logpage{[ 13, 3, 0 ]}
\hyperdef{L}{X7D1A56967A073A8B}{}
{
 The modular group ${\cal M}=PSL_2(\mathbb Z)$ is isomorphic, as an abstract group, to the free product $\mathbb Z_2\ast \mathbb Z_3$. By the Kurosh subgroup theorem, any finite index subgroup $M \subset {\cal M}$ is isomorphic to the free product of finitely many copies of $\mathbb Z_2$s, $\mathbb Z_3$s and $\mathbb Z$s. A subset $\underline x \subset M$ is an \emph{independent} set of subgroup generators if $M$ is the free product of the cyclic subgroups $<x >$ as $x$ runs over $\underline x$. Let us say that a set of elements in $SL_2(\mathbb Z)$ is \emph{projectively independent} if it maps injectively onto an independent set of subgroup generators $\underline x\subset {\cal M}$. The generating set $\{S,U\}$ for $SL_2(\mathbb Z)$ given in the preceding section is projectively independent. 

 We are interested in constructing a set of generators for a given congruence
subgroup $\Gamma$. If a small generating set for $\Gamma$ is required then we should aim to construct one which is close to being
projectively independent. 

 It is useful to invoke the following general result which follows from a
perturbation result about free $\mathbb ZG$-resolutons in \cite[Theorem 2]{ellisharrisskoldberg} and an old observation of John Milnor that a free $\mathbb ZG$-resolution can be realized as the cellular chain complex of a CW-complex if
it can be so realized in low dimensions. 

\textsc{Theorem.} Let $X$ be a contractible CW-complex on which a group $G$ acts by permuting cells. The cellular chain complex $C_\ast X$ is a $\mathbb ZG$-resolution of $\mathbb Z$ which typically is not free. Let $[e^n]$ denote the orbit of the n-cell $e^n$ under the action. Let $G^{e^n} \le G$ denote the stabilizer subgroup of $e^n$, in which group elements are not required to stabilize $e^n$ point-wise. Let $Y_{e^n}$ denote a contractible CW-complex on which $G^{e^n}$ acts cellularly and freely. Then there exists a contractible CW-complex $W$ on which $G$ acts cellularly and freely, and in which the orbits of $n$-cells are labelled by $[e^p]\otimes [f^q]$ where $p+q=n$ and $[e^p]$ ranges over the $G$-orbits of $p$-cells in $X$, $[f^q]$ ranges over the $G^{e^p}$-orbits of $q$-cells in $Y_{e^p}$. 

 

Let $W$ be as in the theorem. Then the quotient CW-complex $B_G=W/G$ is a classifying space for $G$. Let $T$ denote a maximal tree in the $1$-skeleton $B^1_G$. Basic geometric group theory tells us that the $1$-cells in $B^1_G\setminus T$ correspond to a generating set for $G$. 

 Suppose we wish to compute a set of generators for a principal congruence
subgroup $\Gamma=\Gamma_1(N)$. In the above theorem take $X={\cal T}$ to be the cubic tree, and note that $\Gamma$ acts freely on $\cal T$ and thus that $W={\cal T}$. To determine the $1$-cells of $B_{\Gamma}\setminus T$ we need to determine a cellular subspace $D_\Gamma \subset \cal T$ whose images under the action of $\Gamma$ cover $\cal T$ and are pairwise either disjoint or identical. The subspace $D_\Gamma$ will not be a CW-complex as it won't be closed, but it can be chosen to be
connected, and hence contractible. We call $D_\Gamma$ a \emph{fundamental region} for $\Gamma$. We denote by $\mathring D_\Gamma$ the largest CW-subcomplex of $D_\Gamma$. The vertices of $\mathring D_\Gamma$ are the same as the vertices of $D_\Gamma$. Thus $\mathring D_\Gamma$ is a subtree of the cubic tree with $|\Gamma|/6$ vertices. For each vertex $v$ in the tree $\mathring D_\Gamma$ define $\eta(v)=3 -{\rm degree}(v)$. Then the number of generators for $ \Gamma $ will be $(1/2)\sum_{v\in \mathring D_\Gamma} \eta(v)$. 

 The following commands determine projectively independent generators for $\Gamma_1(6)$ and display $\mathring D_{\Gamma_1(6)}$. The subgroup $\Gamma_1(6)$ is free on $13$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=HAP_PrincipalCongruenceSubgroup(6);;|
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  
  
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup(G);|
  [ [ [ -83, -18 ], [ 60, 13 ] ], [ [ -77, -18 ], [ 30, 7 ] ], 
    [ [ -65, -12 ], [ 168, 31 ] ], [ [ -53, -12 ], [ 84, 19 ] ], 
    [ [ -47, -18 ], [ 222, 85 ] ], [ [ -41, -12 ], [ 24, 7 ] ], 
    [ [ -35, -6 ], [ 6, 1 ] ], [ [ -11, -18 ], [ 30, 49 ] ], 
    [ [ -11, -6 ], [ 24, 13 ] ], [ [ -5, -18 ], [ 12, 43 ] ], 
    [ [ -5, -12 ], [ 18, 43 ] ], [ [ -5, -6 ], [ 6, 7 ] ], 
    [ [ 1, 0 ], [ -6, 1 ] ] ]
  
\end{Verbatim}
 

  

An alternative but very related approach to computing generators of congruence
subgroups of $SL_2(\mathbb Z)$ is described in \cite{kulkarni}. 

The congruence subgroup $\Gamma_0(N)$ does not act freely on the vertices of $\cal T$, and so one needs to incorporate a generator for the cyclic stabilizer group
according to the above theorem. Alternatively, we can replace the cubic tree
by a six-fold cover ${\cal T}'$ on whose vertex set $\Gamma_0(N)$ acts freely. This alternative approach will produce a redundant set of
generators. The following commands display $\mathring D_{\Gamma_0(39)}$ for a fundamental region in ${\cal T}'$. They also use the corresponding generating set for $\Gamma_0(39)$, involving $18$ generators, to compute the abelianization $\Gamma_0(39)^{ab}= \mathbb Z_2 \oplus \mathbb Z_3^2 \oplus \mathbb Z^9$. The abelianization shows that any generating set has at least $11$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  !gapprompt@gap>| !gapinput@Length(GeneratorsOfGroup(G));|
  18
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 3 ]
  
\end{Verbatim}
 

  

 Note that to compute $D_\Gamma$ one only needs to be able to test whether a given matrix lies in $\Gamma$ or not. Given an inclusion $\Gamma'\subset \Gamma$ of congruence subgroups, it is straightforward to use the trees $\mathring D_{\Gamma'}$ and $\mathring D_{\Gamma}$ to compute a system of coset representative for $\Gamma'\setminus \Gamma$. }

 
\section{\textcolor{Chapter }{Cohomology of congruence subgroups}}\logpage{[ 13, 4, 0 ]}
\hyperdef{L}{X818BFA9A826C0DB3}{}
{
 To compute the cohomology $H^n(\Gamma,A)$ of a congruence subgroup $\Gamma$ with coefficients in a $\mathbb Z\Gamma$-module $A$ we need to construct $n+1$ terms of a free $\mathbb Z\Gamma$-resolution of $\mathbb Z$. We can do this by first using perturbation techniques (as described in \cite{buiellis}) to combine the cubic tree with resolutions for the cyclic groups of order $4$ and $6$ in order to produce a free $\mathbb ZG$-resolution $R_\ast$ for $G=SL_2(\mathbb Z)$. This resolution is also a free $\mathbb Z\Gamma$-resolution with each term of rank 
\[{\rm rank}_{\mathbb Z\Gamma} R_k = |G:\Gamma|\times {\rm rank}_{\mathbb ZG}
R_k\ .\]
 

For congruence subgroups of lowish index in $G$ this resolution suffices to make computations. 

The following commands compute 
\[H^1(\Gamma_0(39),\mathbb Z) = \mathbb Z^9\ .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2Z_alt(2);|
  Resolution of length 2 in characteristic 0 for SL(2,Integers) .
  
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,gamma);|
  Resolution of length 2 in characteristic 0 for 
  CongruenceSubgroupGamma0( 39)  .
  
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(S),1);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 

This computation establishes that the space $M_2(\Gamma_0(39))$ of weight $2$ modular forms is of dimension $9$. 

The following commands show that ${\rm rank}_{\mathbb Z\Gamma_0(39)} R_1 = 112$ but that it is possible to apply `Tietze like' simplifications to $R_\ast$ to obtain a free $\mathbb Z\Gamma_0(39)$-resolution $T_\ast$ with ${\rm rank}_{\mathbb Z\Gamma_0(39)} T_1 = 11$. It is more efficient to work with $T_\ast$ when making cohomology computations with coefficients in a module $A$ of large rank. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|S!.dimension(1);A
  112
  @gapprompt|gap>A @gapinput|T:=TietzeReducedResolution(S);A
  Resolution of length 2 in characteristic 0 for CongruenceSubgroupGamma0(
  39)  . 
  
  @gapprompt|gap>A @gapinput|T!.dimension(1);A
  11
  
\end{Verbatim}
 

The following commands compute 
\[H^1(\Gamma_0(39),P_{\mathbb Z}(8)) = \mathbb Z_3 \oplus \mathbb Z_6 \oplus
\mathbb Z_{168} \oplus \mathbb Z^{84}\ ,\]
 
\[H^1(\Gamma_0(39),P_{\mathbb Z}(9)) = \mathbb Z_2 \oplus \mathbb Z_2 .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=HomogeneousPolynomials(gamma,8);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(HomToIntegralModule(T,P),1);|
  [ 3, 6, 168, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Length(c);|
  87
  
  !gapprompt@gap>| !gapinput@P:=HomogeneousPolynomials(gamma,9);;|
  !gapprompt@gap>| !gapinput@c:=Cohomology(HomToIntegralModule(T,P),1);|
  [ 2, 2 ]
  
\end{Verbatim}
 

This computation establishes that the space $M_{10}(\Gamma_0(39))$ of weight $10$ modular forms is of dimension $84$, and $M_{11}(\Gamma_0(39))$ is of dimension $0$. (There are never any modular forms of odd weight, and so $M_k(\Gamma)=0$ for all odd $k$ and any congruence subgroup $\Gamma$.) 
\subsection{\textcolor{Chapter }{Cohomology with rational coefficients}}\logpage{[ 13, 4, 1 ]}
\hyperdef{L}{X7F55F8EA82FE9122}{}
{
 To calculate cohomology $H^n(\Gamma,A)$ with coefficients in a $\mathbb Q\Gamma$-module $A$ it suffices to construct a resolution of $\mathbb Z$ by non-free $\mathbb Z\Gamma$-modules where $\Gamma$ acts with finite stabilizer groups on each module in the resolution. Computing
over $\mathbb Q$ is computationally less expensive than computing over $\mathbb Z$. The following commands first compute $H^1(\Gamma_0(39),\mathbb Q) = H_1(\Gamma_0(39),\mathbb Q)= \mathbb Q^9$. As a larger example, they then compute $H^1(\Gamma_0(2^{13}-1),\mathbb Q) =\mathbb Q^{1365}$ where $\Gamma_0(2^{13}-1)$ has index $8192$ in $SL_2(\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,Z)");|
  Non-free resolution in characteristic 0 for SL(2,Integers) . 
  
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@KK:=NonFreeResolutionFiniteSubgroup(K,gamma);|
  Non-free resolution in characteristic 0 for <matrix group with 
  18 generators> . 
  
  !gapprompt@gap>| !gapinput@C:=TensorWithRationals(KK);|
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  9
  
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(2^13-1);;|
  !gapprompt@gap>| !gapinput@IndexInSL2Z(G);|
  8192
  !gapprompt@gap>| !gapinput@KK:=NonFreeResolutionFiniteSubgroup(K,G);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithRationals(KK);;|
  !gapprompt@gap>| !gapinput@Homology(C,1);|
  1365
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Cuspidal cohomology}}\logpage{[ 13, 5, 0 ]}
\hyperdef{L}{X84D30F1580CD42D1}{}
{
 To define and compute cuspidal cohomology we consider the action of $SL_2(\mathbb Z)$ on the upper-half plane ${\frak h}$ given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right) z = \frac{az +b}{cz+d}\ .\]
 A standard 'fundamental domain' for this action is the region 
\[\begin{array}{ll} D=&\{z\in {\frak h}\ :\ |z| > 1, |{\rm Re}(z)| <
\frac{1}{2}\} \\ & \cup\ \{z\in {\frak h} \ :\ |z| \ge 1, {\rm
Re}(z)=-\frac{1}{2}\}\\ & \cup\ \{z \in {\frak h}\ :\ |z|=1, -\frac{1}{2} \le
{\rm Re}(z) \le 0\} \end{array} \]
 illustrated below. 

 

 The action factors through an action of $PSL_2(\mathbb Z) =SL_2(\mathbb Z)/\langle \left(\begin{array}{rr}-1&0\\ 0 &-1
\end{array}\right)\rangle$. The images of $D$ under the action of $PSL_2(\mathbb Z)$ cover the upper-half plane, and any two images have at most a single point in
common. The possible common points are the bottom left-hand corner point which
is stabilized by $\langle U\rangle$, and the bottom middle point which is stabilized by $\langle S\rangle$. 

 A congruence subgroup $\Gamma$ has a `fundamental domain' $D_\Gamma$ equal to a union of finitely many copies of $D$, one copy for each coset in $\Gamma\setminus SL_2(\mathbb Z)$. The quotient space $X=\Gamma\setminus {\frak h}$ is not compact, and can be compactified in several ways. We are interested in
the Borel-Serre compactification. This is a space $X^{BS}$ for which there is an inclusion $X\hookrightarrow X^{BS}$ and this inclusion is a homotopy equivalence. One defines the \emph{boundary} $\partial X^{BS} = X^{BS} - X$ and uses the inclusion $\partial X^{BS} \hookrightarrow X^{BS} \simeq X$ to define the cuspidal cohomology group, over the ground ring $\mathbb C$, as 
\[ H_{cusp}^n(\Gamma,P_{\mathbb C}(k-2)) = \ker (\ H^n(X,P_{\mathbb C}(k-2))
\rightarrow H^n(\partial X^{BS},P_{\mathbb C}(k-2)) \ ).\]
 Strictly speaking, this is the definition of \emph{interior cohomology} $H_!^n(\Gamma,P_{\mathbb C}(k-2))$ which in general contains the cuspidal cohomology as a subgroup. However, for
congruence subgroups of $SL_2(\mathbb Z)$ there is equality $H_!^n(\Gamma,P_{\mathbb C}(k-2)) = H_{cusp}^n(\Gamma,P_{\mathbb C}(k-2))$. 

 Working over $\mathbb C$ has the advantage of avoiding the technical issue that $\Gamma $ does not necessarily act freely on ${\frak h}$ since there are points with finite cyclic stabilizer groups in $SL_2(\mathbb Z)$. But it has the disadvantage of losing information about torsion in
cohomology. So HAP confronts the issue by working with a contractible
CW-complex $\tilde X^{BS}$ on which $\Gamma$ acts freely, and $\Gamma$-equivariant inclusion $\partial \tilde X^{BS} \hookrightarrow \tilde X^{BS}$. The definition of cuspidal cohomology that we use, which coincides with the
above definition when working over $\mathbb C$, is 
\[ H_{cusp}^n(\Gamma,A) = \ker (\ H^n({\rm Hom}_{\, \mathbb
Z\Gamma}(C_\ast(\tilde X^{BS}), A)\, ) \rightarrow H^n(\ {\rm Hom}_{\, \mathbb
Z\Gamma}(C_\ast(\tilde \partial X^{BS}), A)\, \ ).\]
 

The following data is recorded and, using perturbation theory, is combined
with free resolutions for $C_4$ and $C_6$ to constuct $\tilde X^{BS}$. 

 

 The following commands calculate 
\[H^1_{cusp}(\Gamma_0(39),\mathbb Z) = \mathbb Z^6\ .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@k:=2;; deg:=1;; c:=CuspidalCohomologyHomomorphism(gamma,deg,k);|
  [ g1, g2, g3, g4, g5, g6, g7, g8, g9 ] -> [ g1^-1*g3, g1^-1*g3, g1^-1*g3, 
    g1^-1*g3, g1^-1*g2, g1^-1*g3, g1^-1*g4, g1^-1*g4, g1^-1*g4 ]
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 From the Eichler-Shimura isomorphism and the already calculated dimension of $M_2(\Gamma_0(39))\cong \mathbb C^9$, we deduce from this cuspidal cohomology that the space $S_2(\Gamma_0(39))$ of cuspidal weight $2$ forms is of dimension $3$, and the Eisenstein space $E_2(\Gamma_0(39))\cong \mathbb C^3$ is of dimension $3$. 

The following commands show that the space $S_4(\Gamma_0(39))$ of cuspidal weight $4$ forms is of dimension $12$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@k:=4;; deg:=1;; c:=CuspidalCohomologyHomomorphism(gamma,deg,k);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(c));|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Hecke operators on forms of weight 2}}\logpage{[ 13, 6, 0 ]}
\hyperdef{L}{X80861D3F87C29C43}{}
{
 A congruence subgroup $\Gamma \le SL_2(\mathbb Z)$ and element $g\in SL_2(\mathbb Q)$ determine the subgroup $\Gamma' = \Gamma \cap g\Gamma g^{-1} $ and homomorphisms 
\[ \Gamma\ \hookleftarrow\ \Gamma'\ \ \stackrel{\gamma \mapsto g^{-1}\gamma
g}{\longrightarrow}\ \ g^{-1}\Gamma' g\ \hookrightarrow \Gamma\ . \]
 These homomorphisms give rise to homomorphisms of cohomology groups 
\[H^n(\Gamma,\mathbb Z)\ \ \stackrel{tr}{\leftarrow} \ \ H^n(\Gamma',\mathbb Z)
\ \ \stackrel{\alpha}{\leftarrow} \ \ H^n(g^{-1}\Gamma' g,\mathbb Z) \ \
\stackrel{\beta}{\leftarrow} H^n(\Gamma, \mathbb Z) \]
 with $\alpha$, $\beta$ functorial maps, and $tr$ the transfer map. We define the composite $T_g=tr \circ \alpha \circ \beta\colon H^n(\Gamma, \mathbb Z) \rightarrow
H^n(\Gamma, \mathbb Z)$ to be the \emph{ Hecke operator } determined by $g$. Further details on this description of Hecke operators can be found in \cite[Appendix by P. Gunnells]{stein}. 

For each prime integer $p\ge 1$ we set $T_p =T_g$ with for $g=\left(\begin{array}{cc}1&0\\0&p\end{array}\right)$. 

The following commands compute $T_2$ and $T_5$ for $n=1$ and $\Gamma=\Gamma_0(39)$. The commands also compute the eigenvalues of these two Hecke operators. The
final command confirms that $T_2$ and $T_5$ commute. (It is a fact that $T_pT_q=T_qT_p$ for all primes $p,q$.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@p:=2;;N:=1;;h:=HeckeOperatorWeight2(gamma,p,N);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Source(h));|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@T2:=HomomorphismAsMatrix(h);;|
  !gapprompt@gap>| !gapinput@Display(T2);|
  [ [  -2,  -2,   2,   2,   1,   2,   0,   0,   0 ],
    [  -2,   0,   1,   2,  -2,   2,   2,   2,  -2 ],
    [  -2,  -1,   2,   2,  -1,   2,   1,   1,  -1 ],
    [  -2,  -1,   2,   2,   1,   1,   0,   0,   0 ],
    [  -1,   0,   0,   2,  -3,   2,   3,   3,  -3 ],
    [   0,   1,   1,   1,  -1,   0,   1,   1,  -1 ],
    [  -1,   1,   1,  -1,   0,   1,   2,  -1,   1 ],
    [  -1,  -1,   0,   2,  -3,   2,   1,   4,  -1 ],
    [   0,   1,   0,  -1,  -2,   1,   1,   1,   2 ] ]
  !gapprompt@gap>| !gapinput@Eigenvalues(Rationals,T2);|
  [ 3, 1 ]
  
  !gapprompt@gap>| !gapinput@p:=5;;N:=1;;h:=HeckeOperator(gamma,p,N);;|
  !gapprompt@gap>| !gapinput@T5:=HomomorphismAsMatrix(h);;|
  !gapprompt@gap>| !gapinput@Display(T5);|
  [ [  -1,  -1,   3,   4,   0,   0,   1,   1,  -1 ],
    [  -5,  -1,   5,   4,   0,   0,   3,   3,  -3 ],
    [  -2,   0,   4,   4,   1,   0,  -1,  -1,   1 ],
    [  -2,   0,   3,   2,  -3,   2,   4,   4,  -4 ],
    [  -4,  -2,   4,   4,   3,   0,   1,   1,  -1 ],
    [  -6,  -4,   5,   6,   1,   2,   2,   2,  -2 ],
    [   1,   5,   0,  -4,  -3,   2,   5,  -1,   1 ],
    [  -2,  -2,   2,   4,   0,   0,  -2,   4,   2 ],
    [   1,   3,   0,  -4,  -4,   2,   2,   2,   4 ] ]
  !gapprompt@gap>| !gapinput@Eigenvalues(Rationals,T5);|
  [ 6, 2 ]
  
  gap>T2*T5=T5*T2;
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Hecke operators on forms of weight $ \ge 2$}}\logpage{[ 13, 7, 0 ]}
\hyperdef{L}{X7CE754B0859B2843}{}
{
 The above definition of Hecke operator $T_g$ for $g\in SL_2(\mathbb Q)$ extends to a Hecke operator $T_g\colon H^1(\Gamma,P_{\mathbb Q}(k-2) ) \rightarrow H^1(\Gamma,P_{\mathbb
Q}(k-2) )$ for $k\ge 2$. We work over the rationals rather than the integers in order to ensure that
the action of $\Gamma$ on homogeneous polynomials extends to an action of $g$. The following commands compute the matrix of $T_2\colon H^1(\Gamma,P_{\mathbb Q}(k-2) ) \rightarrow H^1(\Gamma,P_{\mathbb
Q}(k-2) )$ for $\Gamma=SL_2(\mathbb Z)$ and $k=4$; 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=HAP_CongruenceSubgroupGamma0(1);;|
  !gapprompt@gap>| !gapinput@h:=HeckeOperator(H,2,12);;Display(h);|
  [ [   2049,  -7560,      0 ],
    [      0,    -24,      0 ],
    [      0,      0,    -24 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Reconstructing modular forms from cohomology computations}}\logpage{[ 13, 8, 0 ]}
\hyperdef{L}{X84CC51EE8525E0D9}{}
{
 

Given a modular form $f\colon {\frak h} \rightarrow \mathbb C$ associated to a congruence subgroup $\Gamma$, and given a compact edge $e$ in the tessellation of ${\frak h}$ (\emph{i.e.} an edge in the cubic tree $\cal T$) arising from the above fundamental domain for $SL_2(\mathbb Z)$, we can evaluate 
\[\int_e f(z)\,dz \ .\]
 In this way we obtain a cochain $f_1\colon C_1({\cal T}) \rightarrow \mathbb C$ in $Hom_{\mathbb Z\Gamma}(C_1({\cal T}), \mathbb C)$ representing a cohomology class $c(f) \in H^1(\, Hom_{\mathbb Z\Gamma}(C_\ast({\cal T}), \mathbb C) \,) =
H^1(\Gamma,\mathbb C)$. The correspondence $f\mapsto c(f)$ underlies the Eichler-Shimura isomorphism. Hecke operators can be used to
recover modular forms from cohomology classes. 

Hecke operators restrict to operators on cuspidal cohomology. On the left-hand
side of the Eichler-Shimura isomorphism Hecke operators restrict to operators $T_s\colon S_2(\Gamma) \rightarrow S_2(\Gamma)$ for $s\ge 1$. 

Let us now introduce the function $q=q(z)=e^{2\pi i z}$ which is holomorphic on $\mathbb C$. For any modular form $f(z)$ there are numbers $a_s$ such that 
\[f(z) = \sum_{s=0}^\infty a_sq^s \]
 for all $z\in {\frak h}$. The form $f$ is a cusp form if $a_0=0$. 

 A non-zero cusp form $f\in S_2(\Gamma)$ is an \emph{eigenform} if it is simultaneously an eigenvector for the Hecke operators $T_s$ for all $s =1,2,3,\cdots$. An eigenform is said to be \emph{normalized} if its coefficient $a_1=1$. It turns out that if $f$ is a normalized eigenform then the coefficient $a_s$ is an eigenvalue for $T_s$ (see for instance \cite{stein} for details). It can be shown \cite{atkinlehner} that $f\in S_2(\Gamma_0(N))$ admits a basis of eigenforms. 

 This all implies that, in principle, we can construct an approximation to an
explicit basis for the space $S_2(\Gamma)$ of cusp forms by computing eigenvalues for Hecke operators. 

 Suppose that we would like a basis for $S_2(\Gamma_0(11))$. The following commands first show that $H^1_{cusp}(\Gamma_0(11),\mathbb Z)=\mathbb Z\oplus \mathbb Z$ from which we deduce that $S_2(\Gamma_0(11)) =\mathbb C$ is $1$-dimensional. Then eigenvalues of Hecke operators are calculated to establish
that the modular form 
\[f = q -2q^2 -q^3 +2q^4 +q^5 +2q^6 -2q^7 + -2q^9 -2q^{10} + \cdots \]
 constitutes a basis for $S_2(\Gamma_0(11))$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(11);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(CuspidalCohomologyHomomorphism(gamma,1,2)));|
  [ 0, 0 ]
  
  !gapprompt@gap>| !gapinput@T1:=HomomorphismAsMatrix(HeckeOperator(gamma,1,1));; Display(T1);|
  [ [  1,  0,  0 ],
    [  0,  1,  0 ],
    [  0,  0,  1 ] ]
  !gapprompt@gap>| !gapinput@T2:=HomomorphismAsMatrix(HeckeOperator(gamma,2,1));; Display(T2);|
  [ [   3,  -4,   4 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  !gapprompt@gap>| !gapinput@T3:=HomomorphismAsMatrix(HeckeOperator(gamma,3,1));; Display(T3);|
  [ [   4,  -4,   4 ],
    [   0,  -1,   0 ],
    [   0,   0,  -1 ] ]
  !gapprompt@gap>| !gapinput@T5:=HomomorphismAsMatrix(HeckeOperator(gamma,5,1));; Display(T5);|
  [ [   6,  -4,   4 ],
    [   0,   1,   0 ],
    [   0,   0,   1 ] ]
  !gapprompt@gap>| !gapinput@T7:=HomomorphismAsMatrix(HeckeOperator(gamma,7,1));; Display(T7);|
  [ [   8,  -8,   8 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  
\end{Verbatim}
 

 For a normalized eigenform $f=1 + \sum_{s=2}^\infty a_sq^s$ the coefficients $a_s$ with $s$ a composite integer can be expressed in terms of the coefficients $a_p$ for prime $p$. If $r,s$ are coprime then $T_{rs} =T_rT_s$. If $p$ is a prime that is not a divisor of the level $N$ of $\Gamma$ then $a_{p^m} =a_{p^{m-1}}a_p - p a_{p^{m-2}}.$ If the prime $ p$ divides $N$ then $a_{p^m} = (a_p)^m$. It thus suffices to compute the coefficients $a_p$ for prime integers $p$ only. 

 The following commands establish that $S_{12}(SL_2(\mathbb Z))$ has a basis consisting of one cusp eigenform 

$q - 24q^2 + 252q^3 - 1472q^4 + 4830q^5 - 6048q^6 - 16744q^7 + 84480q^8 -
113643q^9 $ 

$- 115920q^{10} + 534612q^{11} - 370944q^{12} - 577738q^{13} + 401856q^{14} +
1217160q^{15} + 987136q^{16}$ 

$ - 6905934q^{17} + 2727432q^{18} + 10661420q^{19} + ...$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=HAP_CongruenceSubgroupGamma0(1);;|
  !gapprompt@gap>| !gapinput@for p in [2,3,5,7,11,13,17,19] do|
  !gapprompt@>| !gapinput@T:=HeckeOperator(H,p,1,12);;|
  !gapprompt@>| !gapinput@Print("eigenvalues= ",Eigenvalues(Rationals,T), " and eigenvectors = ", Eigenvectors(Rationals,T)," for p= ",p,"\n");|
  !gapprompt@>| !gapinput@od;|
  eigenvalues= [ 2049, -24 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 2
  eigenvalues= [ 177148, 252 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 3
  eigenvalues= [ 48828126, 4830 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 5
  eigenvalues= [ 1977326744, -16744 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 7
  eigenvalues= [ 285311670612, 534612 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 11
  eigenvalues= [ 1792160394038, -577738 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 13
  eigenvalues= [ 34271896307634, -6905934 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 17
  eigenvalues= [ 116490258898220, 10661420 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 19
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Picard group}}\logpage{[ 13, 9, 0 ]}
\hyperdef{L}{X8180E53C834301EF}{}
{
 Let us now consider the \emph{Picard group} $G=SL_2(\mathbb Z[ i])$ and its action on \emph{upper-half space} 
\[{\frak h}^3 =\{(z,t) \in \mathbb C\times \mathbb R\ |\ t > 0\} \ . \]
 To describe the action we introduce the symbol $j$ satisfying $j^2=-1$, $ij=-ji$ and write $z+tj$ instead of $(z,t)$. The action is given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\left(a(z+tj)+b\right)\left(c(z+tj)+d\right)^{-1}\ .\]
 Alternatively, and more explicitly, the action is given by 
\[\left(\begin{array}{ll}a&b\\ c &d \end{array}\right)\cdot (z+tj) \ = \
\frac{(az+b)\overline{(cz+d) } + a\overline c y^2}{|cz +d|^2 + |c|^2y^2} \ +\
\frac{y}{|cz+d|^2+|c|^2y^2}\, j \ .\]
 

A standard 'fundamental domain' $D$ for this action is the following region (with some of the boundary points
removed). 
\[ \{z+tj\in {\frak h}^3\ |\ 0 \le |{\rm Re}(z)| \le \frac{1}{2}, 0\le {\rm
Im}(z) \le \frac{1}{2}, z\overline z +t^2 \ge 1\} \]
  

The four bottom vertices of $D$ are $a = -\frac{1}{2} +\frac{1}{2}i +\frac{\sqrt{2}}{2}j$, $b = -\frac{1}{2} +\frac{\sqrt{3}}{2}j$, $c = \frac{1}{2} +\frac{\sqrt{3}}{2}j$, $d = \frac{1}{2} +\frac{1}{2}i +\frac{\sqrt{2}}{2}j$. 

The upper-half space ${\frak h}^3$ can be retracted onto a $2$-dimensional subspace ${\cal T} \subset {\frak h}^3$. The space ${\cal T}$ is a contractible $2$-dimensional regular CW-complex, and the action of the Picard group $G$ restricts to a cellular action of $G$ on ${\cal T}$. Under this action there is one orbit of $2$-cells, represented by the curvilinear square with vertices $a$, $b$, $c$ and $d$ in the picture. This $2$-cell has stabilizer group isomorphic to the quaternion group $Q_4$ of order $8$. There are two orbits of $1$-cells, both with stabilizer group isomorphic to a semi-direct product $C_3:C_4$. There is one orbit of $0$-cells, with stabilizer group isomorphic to $SL(2,3)$. 

Using perturbation techniques, the $2$-complex ${\cal T}$ can be combined with free resolutions for the cell stabilizer groups to
contruct a regular CW-complex $X$ on which the Picard group $G$ acts freely. The following commands compute the first few terms of the free $\mathbb ZG$-resolution $R_\ast =C_\ast X$. Then $R_\ast$ is used to compute 
\[H^1(G,\mathbb Z) =0\ ,\]
 
\[H^2(G,\mathbb Z) =\mathbb Z_2\oplus \mathbb Z_2\ ,\]
 
\[H^3(G,\mathbb Z) =\mathbb Z_6\ ,\]
 
\[H^4(G,\mathbb Z) =\mathbb Z_4\oplus \mathbb Z_{24}\ ,\]
 and compute a free presentation for $G$ involving four generators and seven relators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,O-1)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,5);;|
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),1);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),2);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),3);|
  [ 6 ]
  !gapprompt@gap>| !gapinput@Cohomology(HomToIntegers(R),4);|
  [ 4, 24 ]
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);|
  rec( freeGroup := <free group on the generators [ f1, f2, f3, f4 ]>, 
    gens := [ 184, 185, 186, 187 ], 
    relators := [ f1^2*f2^-1*f1^-1*f2^-1, f1*f2*f1*f2^-2, 
        f3*f2^2*f1*(f2*f1^-1)^2*f3^-1*f1^2*f2^-2, 
        f1*(f2*f1^-1)^2*f3^-1*f1^2*f2^-1*f3^-1, 
        f4*f2*f1*(f2*f1^-1)^2*f4^-1*f1*f2^-1, f1*f4^-1*f1^-2*f4^-1, 
        f3*f2*f1*(f2*f1^-1)^2*f4^-1*f1*f2^-1*f3^-1*f4*f2 ] )
  
\end{Verbatim}
 We can also compute the cohomology of $G=SL_2(\mathbb Z[i])$ with coefficients in a module such as the module $P_{\mathbb Z[i]}(k)$ of degree $k$ homogeneous polynomials with coefficients in $\mathbb Z[i]$ and with the action described above. For instance, the following commands
compute 
\[H^1(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^4 \oplus \mathbb Z_4 \oplus
\mathbb Z_8 \oplus \mathbb Z_{40} \oplus \mathbb Z_{80}\, ,\]
 
\[H^2(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^{24} \oplus \mathbb
Z_{520030}\oplus \mathbb Z_{1040060} \oplus \mathbb Z^2\, ,\]
 
\[H^3(G,P_{\mathbb Z[i]}(24)) = (\mathbb Z_2)^{22} \oplus \mathbb Z_{4}\oplus
(\mathbb Z_{12})^2 \, .\]
 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 4, 8, 40, 80 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    520030, 1040060, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 12, 12 
   ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bianchi groups}}\logpage{[ 13, 10, 0 ]}
\hyperdef{L}{X858B1B5D8506FE81}{}
{
 The \emph{Bianchi groups} are the groups $G=PSL_2({\cal O}_{-d})$ where $d$ is a square free positive integer and ${\cal O}_{-d}$ is the ring of integers of the imaginary quadratic field $\mathbb Q(\sqrt{-d})$. More explicitly, 
\[{\cal O}_{-d} = \mathbb Z\left[\sqrt{-d}\right]~~~~~~~~ {\rm if~} d \equiv 1
{\rm ~mod~} 4\, ,\]
 
\[{\cal O}_{-d} = \mathbb Z\left[\frac{1+\sqrt{-d}}{2}\right]~~~~~ {\rm if~} d
\equiv 2,3 {\rm ~mod~} 4\, .\]
 These groups act on upper-half space ${\frak h}^3$ in the same way as the Picard group. Upper-half space can be tessellated by a
'fundamental domain' for this action. Moreover, as with the Picard group, this
tessellation contains a $2$-dimensional cellular subspace ${\cal T}\subset {\frak h}^3$ where ${\cal T}$ is a contractible CW-complex on which $G$ acts cellularly. It should be mentioned that the fundamental domain and the
contractible $2$-complex ${\cal T}$ are not uniquely determined by $G$. Various algorithms exist for computing ${\cal T}$ and its cell stabilizers. One algorithm due to Swan \cite{swan} has been implemented by Alexander Rahm \cite{rahmthesis} and the output for various values of $d$ are stored in HAP. Another approach is to use Voronoi's theory of perfect
forms. This approach has been implemented by Sebastian Schoennenbeck \cite{schoennenbeck} and, again, its output for various values of $d$ are stored in HAP. The following commands combine data from Schoennenbeck's
algorithm with free resolutions for cell stabiliers to compute 
\[H^1(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^4 \oplus
\mathbb Z_{12} \oplus \mathbb Z_{24} \oplus \mathbb Z_{9240} \oplus \mathbb
Z_{55440} \oplus \mathbb Z^4\,, \]
 
\[H^2(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = \begin{array}{l} (\mathbb
Z_2)^{26} \oplus \mathbb (Z_{6})^8 \oplus \mathbb (Z_{12})^{9} \oplus \mathbb
Z_{24} \oplus (\mathbb Z_{120})^2 \oplus (\mathbb Z_{840})^3\\ \oplus \mathbb
Z_{2520} \oplus (\mathbb Z_{27720})^2 \oplus (\mathbb Z_{24227280})^2 \oplus
(\mathbb Z_{411863760})^2\\ \oplus \mathbb
Z_{2454438243748928651877425142836664498129840}\\ \oplus \mathbb
Z_{14726629462493571911264550857019986988779040}\\ \oplus \mathbb
Z^4\end{array}\ , \]
 
\[H^3(PSL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^{23} \oplus
\mathbb Z_{4} \oplus (\mathbb Z_{12})^2\ . \]
 Note that the action of $SL_2({\cal O}_{-d})$ on $P_{{\cal O}_{-d}}(k)$ induces an action of $PSL_2({\cal O}_{-d})$ provided $k$ is even. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-6,4);A
  Resolution of length 4 in characteristic 0 for PSL(2,O-6) . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 12, 24, 9240, 55440, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 6, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 120, 120, 
    840, 840, 840, 2520, 27720, 27720, 24227280, 24227280, 411863760, 411863760, 
    2454438243748928651877425142836664498129840, 
    14726629462493571911264550857019986988779040, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 12, 
    12 ]
  
\end{Verbatim}
 

We can also consider the coefficient module 
\[ P_{{\cal O}_{-d}}(k,\ell) = P_{{\cal O}_{-d}}(k) \otimes_{{\cal O}_{-d}}
\overline{P_{{\cal O}_{-d}}(\ell)} \]
 where the bar denotes a twist in the action obtained from complex conjugation.
For an action of the projective linear group we must insist that $k+\ell$ is even. The following commands compute 
\[H^2(PSL_2({\cal O}_{-11}),P_{{\cal O}_{-11}}(5,5)) = (\mathbb Z_2)^8 \oplus
\mathbb Z_{60} \oplus (\mathbb Z_{660})^3 \oplus \mathbb Z^6\,, \]
 a computation which was first made, along with many other cohomology
computationsfor Bianchi groups, by Mehmet Haluk Sengun \cite{sengun}. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-11,3);;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(R!.group,5,5);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 60, 660, 660, 660, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 

The function \texttt{ResolutionPSL2QuadraticIntegers(-d,n)} relies on a limited data base produced by the algorithms implemented by
Schoennenbeck and Rahm. The function also covers some cases covered by
entering a sring "-d+I" as first variable. These cases correspond to
projective special groups of module automorphisms of lattices of rank 2 over
the integers of the imaginary quadratic number field $\mathbb Q(\sqrt{-d})$ with non-trivial Steinitz-class. In the case of a larger class group there are
cases labelled "-d+I2",...,"-d+Ik" and the Ij together with O-d form a system
of representatives of elements of the class group modulo squares and Galois
action. For instance, the following commands compute 
\[H_2(PSL({\cal O}_{-21+I2}),\mathbb Z) = \mathbb Z_2\oplus \mathbb Z^6\, .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers("-21+I2",3);|
  Resolution of length 3 in characteristic 0 for PSL(2,O-21+I2)) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),2);|
  [ 2, 0, 0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some other infinite matrix groups}}\logpage{[ 13, 11, 0 ]}
\hyperdef{L}{X86A6858884B9C05B}{}
{
 Analogous to the functions for Bianchi groups, HAP has functions 
\begin{itemize}
\item \texttt{ResolutionSL2QuadraticIntegers(-d,n)} 
\item \texttt{ResolutionSL2ZInvertedInteger(m,n)}
\item \texttt{ResolutionGL2QuadraticIntegers(-d,n)}
\item \texttt{ResolutionPGL2QuadraticIntegers(-d,n)}
\item \texttt{ResolutionGL3QuadraticIntegers(-d,n)}
\item \texttt{ResolutionPGL3QuadraticIntegers(-d,n)}
\end{itemize}
 for computing free resolutions for certain values of $SL_2({\cal O}_{-d})$, $SL_2(\mathbb Z[\frac{1}{m}])$, $GL_2({\cal O}_{-d})$ and $PGL_2({\cal O}_{-d})$. Additionally, the function 
\begin{itemize}
\item \texttt{ResolutionArithmeticGroup("string",n)}
\end{itemize}
 can be used to compute resolutions for groups whose data (provided by
Sebastian Schoennenbeck, Alexander Rahm and Mathieu Dutour) is stored in the
directory \texttt{gap/pkg/Hap/lib/Perturbations/Gcomplexes} . 

For instance, the following commands compute 
\[H^1(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^4 \oplus
\mathbb Z_{12} \oplus \mathbb Z_{24} \oplus \mathbb Z_{9240} \oplus \mathbb
Z_{55440} \oplus \mathbb Z^4\,, \]
 
\[H^2(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = \begin{array}{l} (\mathbb
Z_2)^{26} \oplus \mathbb (Z_{6})^7 \oplus \mathbb (Z_{12})^{10} \oplus \mathbb
Z_{24} \oplus (\mathbb Z_{120})^2 \oplus (\mathbb Z_{840})^3\\ \oplus \mathbb
Z_{2520} \oplus (\mathbb Z_{27720})^2 \oplus (\mathbb Z_{24227280})^2 \oplus
(\mathbb Z_{411863760})^2\\ \oplus \mathbb
Z_{2454438243748928651877425142836664498129840}\\ \oplus \mathbb
Z_{14726629462493571911264550857019986988779040}\\ \oplus \mathbb
Z^4\end{array}\ , \]
 
\[H^3(SL_2({\cal O}_{-6}),P_{{\cal O}_{-6}}(24)) = (\mathbb Z_2)^{58} \oplus
(\mathbb Z_{4})^4 \oplus (\mathbb Z_{12})\ . \]
 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionSL2QuadraticIntegers(-6,4);A
  Resolution of length 4 in characteristic 0 for PSL(2,O-6) . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 12, 24, 9240, 55440, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 120, 
    120, 840, 840, 840, 2520, 27720, 27720, 24227280, 24227280, 411863760, 
    411863760, 2454438243748928651877425142836664498129840, 
    14726629462493571911264550857019986988779040, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 12, 12 ]
  
\end{Verbatim}
 

The following commands construct free resolutions up to degree 5 for the
groups $SL_2(\mathbb Z[\frac{1}{2}])$, $GL_2({\cal O}_{-2})$, $GL_2({\cal O}_{2})$, $PGL_2({\cal O}_{2})$, $GL_3({\cal O}_{-2})$, $PGL_3({\cal O}_{-2})$. The final command constructs a free resolution up to degree 3 for $PSL_4(\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R1:=ResolutionSL2ZInvertedInteger(2,5);|
  Resolution of length 5 in characteristic 0 for SL(2,Z[1/2]) . 
  
  !gapprompt@gap>| !gapinput@R2:=ResolutionGL2QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for GL(2,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R3:=ResolutionGL2QuadraticIntegers(2,5);|
  Resolution of length 5 in characteristic 0 for GL(2,O2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R4:=ResolutionPGL2QuadraticIntegers(2,5);|
  Resolution of length 5 in characteristic 0 for PGL(2,O2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R5:=ResolutionGL3QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for GL(3,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R6:=ResolutionPGL3QuadraticIntegers(-2,5);|
  Resolution of length 5 in characteristic 0 for PGL(3,O-2) . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@R7:=ResolutionArithmeticGroup("PSL(4,Z)",3);|
  Resolution of length 3 in characteristic 0 for <matrix group with 655 generators> . 
  No contracting homotopy available. 
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Ideals and finite quotient groups}}\logpage{[ 13, 12, 0 ]}
\hyperdef{L}{X7EF5D97281EB66DA}{}
{
 The following commands first construct the number field $\mathbb Q(\sqrt{-7})$, its ring of integers ${\cal O}_{-7}={\cal O}(\mathbb Q(\sqrt{-7}))$, and the principal ideal $I=\langle 5 + 2\sqrt{-7}\rangle \triangleleft {\cal O}(\mathbb Q(\sqrt{-7}))$ of norm ${\cal N}(I)=53$. The ring $I$ is prime since its norm is a prime number. The primality of $I$ is also demonstrated by observing that the quotient ring $R={\cal O}_{-7}/I$ is an integral domain and hence isomorphic to the unique finite field of order $53 $, $R\cong \mathbb Z/53\mathbb Z$ . (In a ring of quadratic integers \emph{prime ideal} is the same as \emph{maximal ideal}). 

The finite group $G=SL_2({\cal O}_{-7}\,/\,I)$ is then constructed and confirmed to be isomorphic to $SL_2(\mathbb Z/53\mathbb Z)$. The group $G$ is shown to admit a periodic $\mathbb ZG$-resolution of $\mathbb Z$ of period dividing $52$. 

Finally the integral homology 
\[H_n(G,\mathbb Z) = \left\{\begin{array}{ll} 0 & n\ne 3,7, {\rm~for~} 0\le n
\le 8,\\ \mathbb Z_{2808} & n=3,7, \end{array}\right.\]
 is computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-7);|
  Q(Sqrt(-7))
  
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);|
  O(Q(Sqrt(-7)))
  
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,5+2*Sqrt(-7));|
  ideal of norm 53 in O(Q(Sqrt(-7)))
  
  !gapprompt@gap>| !gapinput@R:=OQ mod I;|
  ring mod ideal of norm 53
  
  !gapprompt@gap>| !gapinput@IsIntegralRing(R);|
  true
  
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup( SL2QuadraticIntegers(-7) );;|
  !gapprompt@gap>| !gapinput@G:=Group(gens*One(R));;G:=Image(IsomorphismPermGroup(G));;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "SL(2,53)"
  
  !gapprompt@gap>| !gapinput@IsPeriodic(G);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(G);|
  52
  
  !gapprompt@gap>| !gapinput@GroupHomology(G,1);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,2);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,3);|
  [ 8, 27, 13 ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,4);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,5);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,6);|
  [  ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,7);|
  [ 8, 27, 13 ]
  !gapprompt@gap>| !gapinput@GroupHomology(G,8);|
  [  ]
  
\end{Verbatim}
 

The following commands show that the rational prime $7$ is not prime in ${\cal O}_{-5}={\cal O}(\mathbb Q(\sqrt{-5}))$. Moreover, $7$ totally splits in ${\cal O}_{-5}$ since the final command shows that only the rational primes $2$ and $5$ ramify in ${\cal O}_{-5}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,7);;|
  !gapprompt@gap>| !gapinput@IsPrime(I);|
  false
  
  !gapprompt@gap>| !gapinput@Factors(Discriminant(OQ));|
  [ -2, 2, 5 ]
  
\end{Verbatim}
 

 For $d < 0$ the rings ${\cal O}_d={\cal O}(\mathbb Q(\sqrt{d}))$ are unique factorization domains for precisely 
\[ d = -1, -2, -3, -7, -11, -19, -43, -67, -163.\]
 This result was conjectured by Gauss, and essentially proved by Kurt Heegner,
and then later proved by Harold Stark. 

The following commands construct the classic example of a prime ideal $I$ that is not principal. They then illustrate reduction modulo $I$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,[2,1+Sqrt(-5)]);|
  ideal of norm 2 in O(Q(Sqrt(-5)))
  
  !gapprompt@gap>| !gapinput@6 mod I;|
  0
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Congruence subgroups for ideals}}\logpage{[ 13, 13, 0 ]}
\hyperdef{L}{X7D1F72287F14C5E1}{}
{
 

 Given a ring of integers ${\cal O}$ and ideal $I \triangleleft {\cal O}$ there is a canonical homomorphism $\pi_I\colon SL_2({\cal O}) \rightarrow SL_2({\cal O}/I)$. A subgroup $\Gamma \le SL_2({\cal O})$ is said to be a \emph{congruence subgroup} if it contains $\ker \pi_I$. Thus congruence subgroups are of finite index. Generalizing the definition
in \ref{sec:EichlerShimura} above, we define the \emph{principal congruence subgroup} $\Gamma_1(I)=\ker \pi_I$, and the congruence subgroup $\Gamma_0(I)$ consisting of preimages of the upper triangular matrices in $SL_2({\cal O}/I)$. 

 The following commands construct $\Gamma=\Gamma_0(I)$ for the ideal $I\triangleleft {\cal O}\mathbb Q(\sqrt{-5})$ generated by $12$ and $36\sqrt{-5}$. The group $\Gamma$ has index $385$ in $SL_2({\cal O}\mathbb Q(\sqrt{-5}))$. The final command displays a tree in a Cayley graph for $SL_2({\cal O}\mathbb Q(\sqrt{-5}))$ whose nodes represent a transversal for $\Gamma$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-5);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,[36*Sqrt(-5), 12]);;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  CongruenceSubgroupGamma0(ideal of norm 144 in O(Q(Sqrt(-5)))) 
  
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  385
   
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  
\end{Verbatim}
  

The next commands first construct the congruence subgroup $\Gamma_0(I)$ of index $144$ in $SL_2({\cal O}\mathbb Q(\sqrt{-2}))$ for the ideal $I$ in ${\cal O}\mathbb Q(\sqrt{-2})$ generated by $4+5\sqrt{-2}$. The commands then compute 
\[H_1(\Gamma_0(I),\mathbb Z) = \mathbb Z_3 \oplus \mathbb Z_6 \oplus \mathbb
Z_{30} \oplus \mathbb Z^8\, ,\]
 
\[H_2(\Gamma_0(I), \mathbb Z) = (\mathbb Z_2)^9 \oplus \mathbb Z^7\, ,\]
 
\[H_3(\Gamma_0(I), \mathbb Z) = (\mathbb Z_2)^9 \, .\]
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-2);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,4+5*Sqrt(-2));;|
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);|
  CongruenceSubgroupGamma0(ideal of norm 66 in O(Q(Sqrt(-2)))) 
  
  !gapprompt@gap>| !gapinput@IndexInSL2O(G);|
  144
  
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-2,4,true);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,G);;|
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),1);|
  [ 3, 6, 30, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),2);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(S),3);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{First homology}}\logpage{[ 13, 14, 0 ]}
\hyperdef{L}{X85E912617AFE03F4}{}
{
 The isomorphism $H_1(G,\mathbb Z) \cong G_{ab}$ allows for the computation of first integral homology using computational
methods for finitely presented groups. Such methods underly the following
computation of 
\[H_1( \Gamma_0(I),\mathbb Z) \cong \mathbb Z_2 \oplus \cdots \oplus \mathbb
Z_{4078793513671}\]
 where $I$ is the prime ideal in the Gaussian integers generated by $41+56\sqrt{-1}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-1);;|
  !gapprompt@gap>| !gapinput@OQ:=RingOfIntegers(Q);;|
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,41+56*Sqrt(-1));|
  ideal of norm 4817 in O(GaussianRationals)
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 2, 2, 4, 5, 7, 16, 29, 43, 157, 179, 1877, 7741, 22037, 292306033, 
    4078793513671 ]
  
\end{Verbatim}
 

We write $G^{ab}_{tors}$ to denote the maximal finite summand of the first homology group of $G$ and refer to this as the \emph{torsion subgroup}. Nicholas Bergeron and Akshay Venkatesh \cite{bergeron} have conjectured relationships between the torsion in congruence subgroups $\Gamma$ and the volume of their quotient manifold ${\frak h}^3/\Gamma$. For instance, for the Gaussian integers they conjecture 
\[ \frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)} \rightarrow
\frac{\lambda}{18\pi},\ \lambda =L(2,\chi_{\mathbb Q(\sqrt{-1})}) = 1
-\frac{1}{9} + \frac{1}{25} - \frac{1}{49} + \cdots\]
 as the norm of the prime ideal $I$ tends to $\infty$. The following approximates $\lambda/18\pi = 0.0161957$ and $\frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)} = 0.00913432$ for the above example. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuadraticNumberField(-1);;|
  !gapprompt@gap>| !gapinput@Lfunction(Q,2)/(18*3.142);|
  0.0161957
  
  !gapprompt@gap>| !gapinput@1.0*Log(Product(AbelianInvariants(F)),10)/Norm(I);|
  0.00913432
  
\end{Verbatim}
 

 The link with volume is given by the Humbert volume formula 
\[ {\rm Vol} ( {\frak h}^3 / PSL_2( {\cal O}_{d} ) ) = \frac{|D|^{3/2}}{24}
\zeta_{ \mathbb Q( \sqrt{d} ) }(2)/\zeta_{\mathbb Q}(2) \]
 valid for square-free $d<0$, where $D$ is the discriminant of $\mathbb Q(\sqrt{d})$. The volume of a finite index subgroup $\Gamma$is obtained by multiplying the right-hand side by the index $|PSL_2({\cal O}_d)\,:\, \Gamma|$. }

 }

 
\chapter{\textcolor{Chapter }{Parallel computation}}\logpage{[ 14, 0, 0 ]}
\hyperdef{L}{X7F571E8F7BBC7514}{}
{
 
\section{\textcolor{Chapter }{An embarassingly parallel computation}}\logpage{[ 14, 1, 0 ]}
\hyperdef{L}{X7EAE286B837D27BA}{}
{
 

The following example creates five child processes and uses them
simultaneously to compute the second integral homology of each of the $267$ groups of order $64$. The final command shows that 

$H_2(G,\mathbb Z)=\mathbb Z_2^{15}$ 

for the $267$-th group $G$ in \textsc{GAP}'s library of small groups. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Processes:=List([1..5],i->ChildProcess());;|
  !gapprompt@gap>| !gapinput@fn:=function(i);return GroupHomology(SmallGroup(64,i),2);end;;|
  !gapprompt@gap>| !gapinput@for p in Processes do|
  !gapprompt@>| !gapinput@ChildPut(fn,"fn",p);|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@NrSmallGroups(64);|
  267
  
  !gapprompt@gap>| !gapinput@L:=ParallelList([1..267],"fn",Processes);;|
  
  !gapprompt@gap>| !gapinput@L[267];|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The function \texttt{ParallelList()} is built from \textsc{HAP}'s six core functions for parallel computation. }

 
\section{\textcolor{Chapter }{An non-embarassingly parallel computation}}\logpage{[ 14, 2, 0 ]}
\hyperdef{L}{X7AA9C5B27A8322D0}{}
{
 

The following commands use core functions to compute the product $A=M\times N$ of two random matrices by distributing the work over two processors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RandomMat(2000,2000);; |
  !gapprompt@gap>| !gapinput@N:=RandomMat(2000,2000);;|
  
  !gapprompt@gap>| !gapinput@s:=ChildProcess();;|
  
  !gapprompt@gap>| !gapinput@Mtop:=M{[1..1000]};; |
  !gapprompt@gap>| !gapinput@Mbottom:=M{[1001..2000]};;|
  
  !gapprompt@gap>| !gapinput@ChildPut(Mtop,"Mtop",s); |
  !gapprompt@gap>| !gapinput@ChildPut(N,"N",s);|
  !gapprompt@gap>| !gapinput@NextAvailableChild([s]);;|
  
  !gapprompt@gap>| !gapinput@ChildCommand("Atop:=Mtop*N;;",s);; |
  !gapprompt@gap>| !gapinput@Abottom:=Mbottom*N;; |
  !gapprompt@gap>| !gapinput@A:=ChildGet("Atop",s);;|
  !gapprompt@gap>| !gapinput@Append(A,Abottom);;                |
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Regular CW-structure on knots}}\logpage{[ 15, 0, 0 ]}
\hyperdef{L}{X807B5257781BD6F3}{}
{
 
\section{\textcolor{Chapter }{Knot complements in the 3-ball}}\logpage{[ 15, 1, 0 ]}
\hyperdef{L}{X86F56A85848347FF}{}
{
 While methods for endowing knot complements with CW-structure already exist in
HAP (see section 2.1), they often result in a large number of cells which can
make computing with them taxing. The following example shows how one can
obtain a comparatively small 3-dimensional regular CW-complex corresponding to
the complement of a thickened trefoil knot from an arc presentation. Recall
that an arc presentation is encoded in HAP as a list of integer pairs
corresponding to the position of the endpoints of each horizontal arc in a
grid. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@k_:=PureCubicalKnot(3,1);                  |
  prime knot 1 with 3 crossings
  
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(k_);                  |
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  !gapprompt@gap>| !gapinput@k_:=RegularCWComplex(PureComplexComplement(k_));|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(k_);|
  13291
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc);                                         |
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@Size(k);|
  395
  
\end{Verbatim}
 An optional argument of \texttt{"rand"} in the \texttt{KnotComplement} function randomises the order in which $2$-cells are added to the complex. This allows for alternate presentations of
the knot group. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(PureCubicalKnot(3,1));|
  [ [ 2, 5 ], [ 1, 3 ], [ 2, 4 ], [ 3, 5 ], [ 1, 4 ] ]
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc,"rand");|
  Random 2-cell selection is enabled.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@g:=FundamentalGroup(k); RelatorsOfFpGroup(g); |
  #I  there are 2 generators and 1 relator of total length 6
  <fp group of size infinity on the generators [ f1, f2 ]>
  [ f2^-1*f1*f2^-1*f1^-1*f2*f1^-1 ]
  !gapprompt@gap>| !gapinput@k:=KnotComplement(arc,"rand");               |
  Random 2-cell selection is enabled.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@g:=FundamentalGroup(k); RelatorsOfFpGroup(g);|
  #I  there are 2 generators and 1 relator of total length 7
  <fp group of size infinity on the generators [ f1, f2 ]>
  [ f1*f2^-2*f1*f2*f1^-1*f2 ]
  
\end{Verbatim}
 It is often useful to obtain an inclusion of regular CW-complexes $\iota : \partial (N(K)) \hookrightarrow B^3 \backslash N(K)$ from the boundary of a tubular neighbourhood of some knot $N(K)$ into its complement in the $3$-ball $B^3 \backslash N(K)$. The below example does this for the first prime knot on 11 crossings. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=ArcPresentation(PureCubicalKnot(11,1));|
  [ [ 2, 9 ], [ 1, 3 ], [ 2, 6 ], [ 4, 7 ], [ 3, 5 ], [ 6, 10 ], [ 4, 8 ], 
    [ 9, 11 ], [ 7, 10 ], [ 1, 8 ], [ 5, 11 ] ]
  !gapprompt@gap>| !gapinput@k:=KnotComplementWithBoundary(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@Size(Source(i));|
  616
  !gapprompt@gap>| !gapinput@Size(Target(i));|
  1043
  
\end{Verbatim}
 Note that we can add $n$-cells to regular CW-complexes by specifying the $(n-1)$-cells in their boundaries and $(n+1)$-cells in their coboundaries. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|k:=KnotComplement([[1,2],[1,2]])!.boundaries;;B
  @gapprompt|gap>B @gapinput|Homology(RegularCWComplex(k),0);B
  [ 0 ]
  @gapprompt|gap>B @gapinput|AddCell(k,0,[0],[]);                          B
  @gapprompt|gap>B @gapinput|Homology(RegularCWComplex(k),0);B
  [ 0, 0 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Tubular neighbourhoods}}\logpage{[ 15, 2, 0 ]}
\hyperdef{L}{X83EA2A38801E7A4C}{}
{
 Let $Y$ denote a CW-subcomplex of a regular CW-complex $X$ and let $N(Y)$ denote an open tubular neighbourhood of $Y$. Given an inclusion of regular CW-complexes $f : Y \hookrightarrow X$, this algorithm describes a procedure for obtaining the associated inclusion $f' : \partial C \hookrightarrow C$ where $C=X \backslash N(Y)$ and $\partial C$ denotes the boundary of $C$. The following is also assumed: 

Let $e^n$ denote a cell of $X \backslash Y$ of dimension $n$ with $\bar{e}^n$ denoting its closure. For each $n$-cell, all of the connected components of the subcomplex $\bar{e}^n \cap Y$ are contractible. 

Some additional terminology and notation is needed to describe this algorithm.
The output regular CW-complex $X \backslash N(Y)$ consists of the cell complex $X \backslash Y$ as well as some additional cells to maintain regularity. A cell of $ X \backslash N(Y)$ is referred to as \emph{internal} if it lies in $X \backslash Y$, it is \emph{external} otherwise. Let $\bar{e}^n$ denote the closure in $X$ of an internal cell $e^n$. Note that $\bar{e}^n$ is a CW-subcomplex of $X$ and so is the intersection $\bar{e}^n \cap Y$ which can be expressed as the union 

$\bar{e}^n \cap Y = A_1 \cup A_2 \cup \cdots \cup A_k$ 

 of its path components $A_i$ all of which are CW-subcomplexes of $Y$. For each $n$-cell of $X \backslash Y$ there is one internal $n$-cell $e^n$ of $X \backslash N(Y)$. For $n \geq 1$ there is also one external $(n-1)$-cell $f^{e^n}_{A_i}$ for each path component $A_i$ of $\bar{e}^n \cap Y$. Lastly, we need a method for determining the homological boundary of the
internal and external cells: 

$\bullet$ The boundary of an internal $n$-cell $e^n$ consists of all those internal $(n-1)$-cells of $\bar{e}^n$ together with all external $(n-1)$-cells $f^{e^n}_{A_i}$ where $A_i$ is a path component of $\bar{e}^n \cap Y$. 

$\bullet$ The boundary of an external $(n-1)$-cell $f^{e^n}_{A_i}$ consists of all those external $(n-2)$-cells $f^{e^{n-1}}_{B_j}$ where $e^{n-1}$ is an $(n-1)$-cell of $\bar{e}^n$ and $B_j \subseteq A_i$ is a path component of $A_i$. 

The following three steps comprise the algorithm. 

$(1)$ For each internal $n$-cell $e^n \subset X \backslash Y$, compute the CW-complex $\bar{e}^n \cap Y$ as a union of path components $A_1 \cup A_2 \cup \cdots \cup A_k$. This information can be used to determine the number of cells of $X \backslash N(Y)$ in each dimension. 

$(2)$ Create a list $B=[ \; [ \; \; ], [ \; \; ], \ldots, [ \; \; ] \; ]$ of length $\textrm{dim}X +1$. 

$(3)$ For $0 \leq n \leq \textrm{dim}X$ set $B[n+1]=[ b_1, b_2, \ldots, b_{\alpha_n} ]$ where $\alpha_n$ is the number of $n$-cells in $X \backslash N(Y)$ and $b_i$ is a list of integers describing the $(n-1)$-cells of the $i ^ \textrm{th}$ $n$-cell of $X \backslash N(Y)$. The internal cells will always be listed before the external cells in each
sublist. Return B as a regular CW-complex. 

 The following example computes the tubular neighbourhood of a $1$-dimensional subcomplex of a $3$-dimensional complex corresponding to the Hopf link embedded in the closed $3$-ball. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=[[2,4],[1,3],[2,4],[1,3]];;            |
  !gapprompt@gap>| !gapinput@f:=ArcPresentationToKnottedOneComplex(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@comp:=RegularCWComplexComplement(f);|
  Testing contractibility...
  151 out of 151 cells tested.
  The input is compatible with this algorithm.
  Regular CW-complex of dimension 3
  
  
\end{Verbatim}
 Note that the output of this algorithm is just a regular CW-complex, not an
inclusion map. The function \texttt{BoundaryMap} can be employed to obtain the boundary of a pure complex. This results in
three path components for this example: two corresponding to the boundary of
the knotted tori and the other corresponding to the boundary of the $3$-ball in which the link was embedded. These path components can be obtained as
individual CW-subcomplexes if desired. A CW-subcomplex is represented in HAP
as a list $[X,s]$ where $X$ is a regular CW-complex and $s$ is a list of length $n$ whose $i^\textrm{th}$ entry lists the indexing of each $(i-1)$-cell of the $n$-dimensional subcomplex of $X$. CW-subcomplexes and CW maps can be converted between each other
interchangeably. This next example obtains the inclusion detailed in the above
algorithm, finds the path components of the source of said inclusion, shows
that they are in fact disjoint, and then obtains the first four integral
homology groups of each component. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f_:=BoundaryMap(comp);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@f_:=RegularCWMapToCWSubcomplex(f_);;|
  !gapprompt@gap>| !gapinput@paths:=PathComponentsCWSubcomplex(f_);|
  [ [ Regular CW-complex of dimension 3
          , 
        [ [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 18, 19, 20 ], 
            [ 1, 2, 3, 4, 5, 6, 13, 14, 15, 16, 17, 18, 33, 34, 35, 46, 47, 48 
               ], [ 11, 12, 13, 14, 15, 16, 35, 36 ] ] ], 
    [ Regular CW-complex of dimension 3
          , [ [ 21, 24, 25, 27, 30, 31, 32, 37, 38, 39, 40, 43, 45, 46, 48 ], 
            [ 49, 51, 53, 56, 57, 59, 61, 63, 65, 67, 69, 71, 73, 74, 76, 79, 
                82, 83, 86, 87, 90, 91 ], [ 37, 39, 41, 44, 45, 47, 49 ] ] ], 
    [ Regular CW-complex of dimension 3
          , [ [ 22, 23, 26, 28, 29, 33, 34, 35, 36, 41, 42, 44, 47, 49, 50 ], 
            [ 50, 52, 54, 55, 58, 60, 62, 64, 66, 68, 70, 72, 75, 77, 78, 80, 
                81, 84, 85, 88, 89, 92 ], [ 38, 40, 42, 43, 46, 48, 50 ] ] ] ]
  !gapprompt@gap>| !gapinput@paths:=List(paths,CWSubcomplexToRegularCWMap);|
  [ Map of regular CW-complexes
      , Map of regular CW-complexes
      , Map of regular CW-complexes
       ]
  !gapprompt@gap>| !gapinput@List([1..3],x->List(Difference([1..3],[x]),y->IntersectionCWSubcomplex(paths[x],paths[y])));|
  [ [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ], [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ], [ [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ], [ Regular CW-complex of dimension 3
              , [ [  ], [  ], [  ] ] ] ] ]
  
  !gapprompt@gap>| !gapinput@List(paths,x->List([0..3],y->Homology(Source(x),y)));|
  [ [ [ 0 ], [  ], [ 0 ], [  ] ], [ [ 0 ], [ 0, 0 ], [ 0 ], [  ] ], 
    [ [ 0 ], [ 0, 0 ], [ 0 ], [  ] ] ]
  
\end{Verbatim}
 As previously mentioned, for the tubular neighbourhood algorithm to work, we
require that no external cells yield non-contractible path-components in their
intersection with the subcomplex. If this is ever the case then we can
subdivide the offending cell to prevent this from happening. We have
implemented two subdivision algorithms in HAP, one for barycentrically
subdividing a given cell, and the other for subdividing an $n$-cell into as many $n$-cells as there are $(n-1)$-cells in its boundary. Barycentric subdivision is integrated into the \texttt{RegularCWComplexComplement} function and will be performed automatically as required. The following
example shows this automatic subdivision running via the complement of a
tubular neighbourhood of the unknot, then obtains an inclusion map from the
closure of an arbitrary $3$-cell of this complex and then compares the difference in size of the two
different subdivisions of a 2-cell in the boundary of this $3$-cell. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@arc:=[[1,2],[1,2]];;|
  !gapprompt@gap>| !gapinput@unknot:=ArcPresentationToKnottedOneComplex(arc);|
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@f:=RegularCWComplexComplement(unknot);|
  Testing contractibility...
  79 out of 79 cells tested.
  Subdividing 3 cell(s):
  100% complete. 
  Testing contractibility...
  145 out of 145 cells tested.
  The input is compatible with this algorithm.
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@f:=Objectify(HapRegularCWMap,rec(source:=f,target:=f,mapping:={i,j}->j));    |
  Map of regular CW-complexes
  
  !gapprompt@gap>| !gapinput@closure:=ClosureCWCell(Target(f),3,1);|
  [ Regular CW-complex of dimension 3
      , 
    [ [ 1, 2, 3, 4, 7, 8, 9, 10, 11, 13, 14, 20, 21, 22, 23, 25 ], 
        [ 1, 2, 3, 7, 8, 9, 10, 11, 15, 16, 17, 20, 21, 22, 23, 24, 25, 27, 28, 55, 58, 59, 
            60, 63 ], [ 1, 4, 7, 8, 9, 13, 14, 15, 18, 52 ], [ 1 ] ] ]
  !gapprompt@gap>| !gapinput@Size(Target(f));                                          |
  195
  !gapprompt@gap>| !gapinput@Size(Target(BarycentricallySubdivideCell(f,2,1)));        |
  231
  !gapprompt@gap>| !gapinput@Size(Target(SubdivideCell(f,2,1)));        |
  207
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Knotted surface complements in the 4-ball}}\logpage{[ 15, 3, 0 ]}
\hyperdef{L}{X78C28038837300BD}{}
{
 A construction of Satoh's, the tube map, associates a ribbon torus-knot to
virtual knot diagrams. A virtual knot diagram differs from a knot diagram in
that it allows for a third type of crossing, a virtual crossing. The image of
such a crossing via the tube map is two tori which pass through each other. An
arc diagram is a triple of lists \texttt{[arc,cross,cols]} that encode virtual knot diagrams. \texttt{arc} is an arc presentation. \texttt{cross} is a list of length the number of crossings in the knot associated to the arc
presentation whose entries are $-1,0$ or $1$ corresponding to an undercrossing (horizontal arc underneath vertical arc), a
virtual crossing (depicted by intersecting horizontal and vertical arcs) and
an overcrossing (horizontal arc above vertical arc) respectively. \texttt{cols} is a list of length the number of $0$ entries in \texttt{cross} and its entries are $1,2,3$ or $4$. It describes the types of 'colourings' we assign to the virtual crossings.
We interpret each integer as the change in 4-dimensional height information as
represented by a colour scale from blue (lower down in 4-space), to green (0
level), to red (higher up in 4-space). Without loss of generality, we impose
that at each virtual crossing, the vertical arc passes through the horizontal
arc. Thus, $1$ corresponds to the vertical bar entering the horizontal bar as blue and
leaving as blue, $2$ corresponds to entering as blue and leaving as red, $3$ corresponds to entering as red and leaving as blue and $4$ corresponds to entering and leaving as red. A coloured arc diagram can be
visualised using the \texttt{ViewColouredArcDiagram} function. 
\begin{Verbatim}[commandchars=!|B,fontsize=\small,frame=single,label=Example]
  !gapprompt|gap>B !gapinput|arc:=ArcPresentation(PureCubicalKnot(6,1));B
  [ [ 5, 8 ], [ 4, 6 ], [ 3, 5 ], [ 2, 4 ], [ 1, 3 ], [ 2, 7 ], [ 6, 8 ], [ 1, 7 ] ]
  !gapprompt|gap>B !gapinput|cross:=[0,0,1,-1,-1,0];;B
  !gapprompt|gap>B !gapinput|cols:=[1,4,3];;B
  !gapprompt|gap>B !gapinput|ViewColouredArcDiagram(arc,cross,cols);  B
  convert-im6.q16: pixels are not authentic `/tmp/HAPtmpImage.txt' @ error/cache.c/QueueAuthenticPixelCacheNexus/4381.
  
  
\end{Verbatim}
 

  

 Towards obtaining a regular CW-decomposition of ribbon torus-knots, we first
begin by embedding a self-intersecting knotted torus in the 3-ball. The
function \texttt{ArcDiagramToTubularSurface} inputs a coloured arc diagram and outputs an inclusion from the boundary of
some (potentially self-intersecting) torus in the $3$-ball. By inputting just an arc presentation, one can obtain an inclusion
identical to the \texttt{KnotComplementWithBoundary} function. By additionally inputting a list of $-1$s and $1$s, one can obtain an inclusion similar to \texttt{KnotComplementWithBoundary} but where there is extra freedom in determining whether or not a given
crossing is an under/overcrossing. If one inputs both of the above but
includes $0$ entries in the \texttt{cross} list and includes the list of colours, the output is then an inclusion from an
embedded self-intersecting torus into the 3-ball where each $2$-cell (the top-dimensional cells of the self-intersecting surface) is assigned
a colour. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface(arc);        B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,cross]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,cross,cols]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|List([1..Length(Source(tub)!.boundaries[3])],x->tub!.colour(2,tub!.mapping(2,x)));B
  [ [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], 
    [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ -1 ], [ -1 ], 
    [ 0 ], [ 0 ], [ -1 ], [ -1 ], [ -1 ], [ -1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ 1 ], 
    [ 0 ], [ 0 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ 1 ], [ 0 ], 
    [ 0 ], [ -1 ], [ -1 ], [ 1 ], [ -1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ -1 ], [ -1 ], [ 0 ], 
    [ 1 ], [ 1 ], [ 0 ], [ 0 ], [ 0 ], [ 0 ], [ 1 ], [ -1 ], [ 0 ] ]
  
\end{Verbatim}
 From this self-intersecting surface with colour, we can lift it to a surface
without self-intersections in $\mathbb{R}^4$. We do this by constructing a regular CW-complex of the direct product $B^3 \times [a,b]$ where $B^3$ denotes the $3$-ball, $a$ is $1$ less than the smallest integer assigned to a cell by the colouring, and $b$ is $1$ greater than the largest integer assigned to a cell by the colouring. The
subcomplex of the direct product corresponding to the surface without
intersection can be obtained using the colouring with additional care taken to
not lift any 1-cells arising as double-point singularities. The following
example constructs the complement of a ribbon torus-link embedded in $\mathbb{R}^4$ obtained from the Hopf link with one virtual crossing and then calculates some
invariants of the resulting space. We compare the size of this complex, as
well as how long it takes to obtain the same invariants, with a cubical
complex of the same space. As barycentric subdivision can massively increase
the size of the cell complex, the below method sequentially obtains the
tubular neighbourhood of the entire subcomplex by obtaining the tubular
neighbourhood of each individual $2$-cell. This has yet to be optimised so it currently takes some time to
complete. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|arc:=[[2,4],[1,3],[2,4],[1,3]];;                B
  @gapprompt|gap>B @gapinput|tub:=ArcDiagramToTubularSurface([arc,[0,-1],[2]]);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|tub:=LiftColouredSurface(tub);B
  Map of regular CW-complexes
  
  @gapprompt|gap>B @gapinput|Dimension(Source(tub));B
  2
  @gapprompt|gap>B @gapinput|Dimension(Source(tub));B
  4
  @gapprompt|gap>B @gapinput|map:=RegularCWMapToCWSubcomplex(tub);;B
  @gapprompt|gap>B @gapinput|sub:=SortedList(map[2][3]);;B
  @gapprompt|gap>B @gapinput|sub:=List(sub,x->x-(Position(sub,x)-1));;B
  @gapprompt|gap>B @gapinput|clsr:=ClosureCWCell(map[1],2,sub[1])[2];;B
  @gapprompt|gap>B @gapinput|seq:=CWSubcomplexToRegularCWMap([map[1],clsr]);;B
  @gapprompt|gap>B @gapinput|tub:=RegularCWComplexComplement(seq);B
  Testing contractibility...
  3501 out of 3501 cells tested.
  The input is compatible with this algorithm.
  @gapprompt|gap>B @gapinput|for i in [2..Length(sub)] doB
  @gapprompt|>B @gapinput|    clsr:=ClosureCWCell(tub,2,sub[i])[2];;B
  @gapprompt|>B @gapinput|    seq:=CWSubcomplexToRegularCWMap([tub,clsr]);;B
  @gapprompt|>B @gapinput|    tub:=RegularCWComplexComplement(seq);B
  @gapprompt|>B @gapinput|od;B
  Testing contractibility...
  3612 out of 3612 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3693 out of 3693 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3871 out of 3871 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  3925 out of 3925 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4084 out of 4084 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4216 out of 4216 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4348 out of 4348 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4529 out of 4529 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4688 out of 4688 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4723 out of 4723 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  4918 out of 4918 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5107 out of 5107 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5269 out of 5269 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5401 out of 5401 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5548 out of 5548 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5702 out of 5702 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  5846 out of 5846 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6027 out of 6027 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6089 out of 6089 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6124 out of 6124 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6159 out of 6159 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6349 out of 6349 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6467 out of 6467 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6639 out of 6639 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6757 out of 6757 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  6962 out of 6962 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7052 out of 7052 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7242 out of 7242 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7360 out of 7360 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7470 out of 7470 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7561 out of 7561 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7624 out of 7624 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7764 out of 7764 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7904 out of 7904 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  7979 out of 7979 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8024 out of 8024 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8086 out of 8086 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8148 out of 8148 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8202 out of 8202 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8396 out of 8396 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8534 out of 8534 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8625 out of 8625 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8736 out of 8736 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8817 out of 8817 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  8983 out of 8983 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9073 out of 9073 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9218 out of 9218 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9323 out of 9323 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9442 out of 9442 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9487 out of 9487 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9538 out of 9538 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9583 out of 9583 cells tested.
  The input is compatible with this algorithm.
  Testing contractibility...
  9634 out of 9634 cells tested.
  The input is compatible with this algorithm.
  @gapprompt|gap>B @gapinput|Size(tub);      B
  9685
  @gapprompt|gap>B @gapinput|total_time_1:=0;;B
  @gapprompt|gap>B @gapinput|List([0..4],x->Homology(tub,x)); total_time_1:=total_time_1+time;;B
  [ [ 0 ], [ 0, 0 ], [ 0, 0, 0, 0 ], [ 0, 0 ], [  ] ]
  @gapprompt|gap>B @gapinput|c:=ChainComplexOfUniversalCover(tub);; total_time_1:=total_time_1+time;;B
  @gapprompt|gap>B @gapinput|l:=Filtered(LowIndexSubgroups(c!.group,5),g->Index(c!.group,g)=5);; total_time_1:=total_time_1+time;;B
  @gapprompt|gap>B @gapinput|inv:=Set(l,g->Homology(TensorWithIntegersOverSubgroup(c,g),2)); total_time_1:=total_time_1+time;;B
  [ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ] 
   ]
  @gapprompt|gap>B @gapinput|total_time_1;B
  3407
  @gapprompt|gap>B @gapinput|hopf:=PureComplexComplement(HopfSatohSurface());;B
  @gapprompt|gap>B @gapinput|hopf:=RegularCWComplex(hopf);;B
  @gapprompt|gap>B @gapinput|Size(hopf);B
  4508573
  @gapprompt|gap>B @gapinput|total_time_2:=0;;B
  @gapprompt|gap>B @gapinput|c_:=ChainComplexOfUniversalCover(hopf);; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|l_:=Filtered(LowIndexSubgroups(c_!.group,5),g->Index(c_!.group,g)=5);; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|inv_:=Set(l_,g->Homology(TensorWithIntegersOverSubgroup(c_,g),2));; total_time_2:=total_time_2+time;;B
  @gapprompt|gap>B @gapinput|total_time_2;B
  1116000
  @gapprompt|gap>B @gapinput|inv_=inv;B
  true
  
\end{Verbatim}
 }

 }

 \def\bibname{References\logpage{[ "Bib", 0, 0 ]}
\hyperdef{L}{X7A6F98FD85F02BFE}{}
}

\bibliographystyle{alpha}
\bibliography{mybib.xml}

\addcontentsline{toc}{chapter}{References}

\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}
\hyperdef{L}{X83A0356F839C696F}{}
}

\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Index}


\printindex

\newpage
\immediate\write\pagenrlog{["End"], \arabic{page}];}
\immediate\closeout\pagenrlog
\end{document}
