% 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 from its face lattice}}\logpage{[ 1, 8, 0 ]}
\hyperdef{L}{X7B7354E68025FC92}{}
{
 

  

The following example begins by creating 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, 9, 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, 10, 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, 11, 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, 12, 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, 13, 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, 14, 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, 15, 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 $20$ degrees of a free resolution/classifying space, for the second $4$-dimensional crystallographic group $G$ in the library of crystallographic groups. The cohomology is seen to have $11$ ring generators in degree $2$ and no further ring generators in degrees $< 12$. 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}}[ll]
0, \& \texttt{\symbol{123}}\texttt{\symbol{92}}rm
odd\texttt{\symbol{126}}\texttt{\symbol{125}} n\texttt{\symbol{92}}le
20\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}},
\& 5 \texttt{\symbol{92}}le n \texttt{\symbol{92}}le 19
.\texttt{\symbol{92}}\texttt{\symbol{92}}
\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right.\$\$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroup(4,2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionCubicalCrystGroup(G,20);|
  Resolution of length 20 in characteristic 0 for <matrix group with 
  5 generators> . 
  
  !gapprompt@gap>| !gapinput@C:=HomToIntegers(R);|
  Cochain complex of length 20 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(C,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(C,1);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(C,2);|
  [ 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(C,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(C,4);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(C,5);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(C,6);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Cohomology(C,7);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(C,8);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@Cohomology(C,9);|
  [  ]
  !gapprompt@gap>| !gapinput@Cohomology(C,10);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  !gapprompt@gap>| !gapinput@## etcetera for n up to 19|
  
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,1);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,2);|
  [ [ 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>| !gapinput@IntegralRingGenerators(R,3);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,4);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,5);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,6);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,7);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,8);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,9);|
  [  ]
  !gapprompt@gap>| !gapinput@IntegralRingGenerators(R,10);|
  [  ]
  
  
\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}{}
{
  

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$. 
\subsection{\textcolor{Chapter }{First example}}\logpage{[ 3, 6, 1 ]}
\hyperdef{L}{X78F3D0B97B42A34C}{}
{
 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}}\logpage{[ 3, 6, 2 ]}
\hyperdef{L}{X84C89D4A7DD0CDD6}{}
{
 

 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,
H_4(K(\pi_2Y,2), \mathbb Z) =\mathbb Z $. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=[ [ 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@Y:=MaximalSimplicesToSimplicialComplex(Y);|
  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}
 

 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 $. In order to determine $\pi_3Y$ it remains compute this first map. This computation is currently not available
in HAP. 

 [The simplicial complex in this second example is due to W. Kiihnel and T. F.
Banchoff and is of the homotopy type of the complex projective plane. So,
assuming this extra knowledge, we have $\pi_3Y=0$.] }

 }

 
\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 }{Topological data analysis}}\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X7B7E077887694A9F}{}
{
 
\section{\textcolor{Chapter }{Persistent homology }}\logpage{[ 4, 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{[ 4, 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{[ 4, 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{[ 4, 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{[ 4, 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{[ 4, 3, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

The following image was used in the example. 

  }

 }

 
\section{\textcolor{Chapter }{Random simplicial complexes}}\logpage{[ 4, 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{[ 5, 0, 0 ]}
\hyperdef{L}{X7C07F4BD8466991A}{}
{
 
\section{\textcolor{Chapter }{Third homotopy group of a supsension of an Eilenberg-MacLane space }}\logpage{[ 5, 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{[ 5, 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}
 }

 
\section{\textcolor{Chapter }{Aspherical $2$-complexes}}\logpage{[ 5, 3, 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{[ 5, 4, 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}}\logpage{[ 5, 5, 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}}\logpage{[ 5, 6, 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{[ 5, 7, 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{[ 6, 0, 0 ]}
\hyperdef{L}{X7E34E2C6868F2726}{}
{
 
\section{\textcolor{Chapter }{Finite groups }}\logpage{[ 6, 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=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Q:=QuaternionGroup(8);;|
  !gapprompt@gap>| !gapinput@B:=BarComplexOfMonoid(Q,6);;                 |
  !gapprompt@gap>| !gapinput@C:=ContractedComplex(B);;|
  !gapprompt@gap>| !gapinput@Homology(C,5);|
  [ 2, 2 ]
  
\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]
  p> 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 polynomial 

$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@PoincareSeriesLHS(G);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 

The following example constructs the polynomial 

$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{[ 6, 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 groups}}\logpage{[ 6, 3, 0 ]}
\hyperdef{L}{X7DEBF2BB7D1FB144}{}
{
 

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}
 }

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

The following example computes 

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

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{[ 6, 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{[ 6, 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{[ 6, 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_6$ 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 }{Exact cohomology coefficient sequence}}\logpage{[ 6, 8, 0 ]}
\hyperdef{L}{X7832969482AD05FF}{}
{
 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) $ . }

 }

 
\chapter{\textcolor{Chapter }{Cohomology operations}}\logpage{[ 7, 0, 0 ]}
\hyperdef{L}{X81FDD09B8454C905}{}
{
 
\section{\textcolor{Chapter }{Steenrod operations on the classifying space of a finite $2$-group}}\logpage{[ 7, 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{[ 7, 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{[ 8, 0, 0 ]}
\hyperdef{L}{X786DB80A8693779E}{}
{
 
\section{\textcolor{Chapter }{Davis complex}}\logpage{[ 8, 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{[ 8, 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{[ 8, 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 }{Simplicial groups}}\label{chapSimplicialGroups}
\logpage{[ 9, 0, 0 ]}
\hyperdef{L}{X7D818E5F80F4CF63}{}
{
 
\section{\textcolor{Chapter }{Crossed modules}}\label{secCrossedModules}
\logpage{[ 9, 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{[ 9, 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{[ 9, 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{[ 9, 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{[ 9, 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{postnikov} 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{[ 9, 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{postnikov}
\logpage{[ 9, 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{[ 9, 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{[ 9, 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{[ 9, 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{[ 9, 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{[ 10, 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{[ 10, 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{[ 10, 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{[ 10, 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@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{[ 10, 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 ZG$-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$.) }

 
\section{\textcolor{Chapter }{Cuspidal cohomology}}\logpage{[ 10, 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}}\logpage{[ 10, 6, 0 ]}
\hyperdef{L}{X8577E83782C87EBD}{}
{
 A congruence subgroup $\Gamma \le SL_m(\mathbb Z)$ and element $g\in SL_m(\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 integer $s\ge 1$ we set $T_s =T_s$ with for $g=\left(\begin{array}{cc}1&0\\0&\frac{1}{s}\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 integers $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:=HeckeOperator(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 }{Reconstructing modular forms from cohomology computations}}\logpage{[ 10, 7, 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_n$ 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 +q^4 +q^5 +2q^6 -2q^7 +2q^8 -3q^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@T4:=HomomorphismAsMatrix(HeckeOperator(gamma,4,1));; Display(T4);|
  [ [   6,  -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@T6:=HomomorphismAsMatrix(HeckeOperator(gamma,6,1));; Display(T6);|
  [ [  12,  -8,   8 ],
    [   0,   2,   0 ],
    [   0,   0,   2 ] ]
  !gapprompt@gap>| !gapinput@T7:=HomomorphismAsMatrix(HeckeOperator(gamma,7,1));; Display(T7);|
  [ [   8,  -8,   8 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  !gapprompt@gap>| !gapinput@T8:=HomomorphismAsMatrix(HeckeOperator(gamma,8,1));; Display(T8);|
  [ [  12,  -8,   8 ],
    [   0,   2,   0 ],
    [   0,   0,   2 ] ]
  !gapprompt@gap>| !gapinput@T9:=HomomorphismAsMatrix(HeckeOperator(gamma,9,1));; Display(T9);|
  [ [   12,  -12,   12 ],
    [    0,   -3,    0 ],
    [    0,    0,   -3 ] ]
  !gapprompt@gap>| !gapinput@T10:=HomomorphismAsMatrix(HeckeOperator(gamma,10,1));; Display(T10);|
  [ [   18,  -16,   16 ],
    [    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. }

 
\section{\textcolor{Chapter }{The Picard group}}\logpage{[ 10, 8, 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{[ 10, 9, 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{[ 10, 10, 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{[ 10, 11, 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{[ 10, 12, 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{[ 10, 13, 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{[ 11, 0, 0 ]}
\hyperdef{L}{X7F571E8F7BBC7514}{}
{
 
\section{\textcolor{Chapter }{An embarassingly parallel computation}}\logpage{[ 11, 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{[ 11, 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{[ 12, 0, 0 ]}
\hyperdef{L}{X807B5257781BD6F3}{}
{
 
\section{\textcolor{Chapter }{Knot complements in the 3-ball}}\logpage{[ 12, 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{[ 12, 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{[ 12, 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}
