% 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 HAP tutorial\mbox{}}}\\
\vfill

\hypersetup{pdftitle=A HAP tutorial}
\markright{\scriptsize \mbox{}\hfill A HAP tutorial \hfill\mbox{}}
{\Huge \textbf{(See also an \href{../www/SideLinks/About/aboutContents.html} {older tutorial} or \href{comp.pdf} {mini\texttt{\symbol{45}}course notes} or related \href{https://global.oup.com/academic/product/an-invitation-to-computational-homotopy-9780198832980} {book}) \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\texttt{\symbol{45}}$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\texttt{\symbol{45}}trivial elementary abelian $p$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell and $160$ $2$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}complex $Y$ so as to obtained a homeomorphic CW\texttt{\symbol{45}}complex $W$ with fewer cells. 

The following commands load a $4$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}manifold $M$ with regular CW\texttt{\symbol{45}}structure involving four $3$\texttt{\symbol{45}}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\texttt{\symbol{45}}complex $Y$ of dimension $2$ involving one $0$\texttt{\symbol{45}}cell, two $1$\texttt{\symbol{45}}cells and one $2$\texttt{\symbol{45}}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\texttt{\symbol{45}}complex by attaching cells}}\logpage{[ 1, 8, 0 ]}
\hyperdef{L}{X829793717FB6DDCE}{}
{
 

  

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

The following example creates a 2\texttt{\symbol{45}}complex $K$ corresponding to the group presentation 

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

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

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

  

The following example creats a $2$\texttt{\symbol{45}}dimensional annulus $A$ as a regular CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}regular. We compute the cochain complex $D_\ast = {\rm Hom}_{\mathbb Z}(C_\ast(X),\mathbb Z)$ from which the cohomology groups \\
$H^0(Y,\mathbb Z)=\mathbb Z$, \\
$H^1(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^2(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^3(Y,\mathbb Z)=\mathbb Z^{10}$, \\
$H^4(Y,\mathbb Z)=\mathbb Z^5$, \\
$H^5(Y,\mathbb Z)=\mathbb Z$, \\
$H^6(Y,\mathbb Z)=0$\\
 are obtained. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=DirectProduct(A,A,A,A,A);|
  Regular CW-complex of dimension 10
  
  !gapprompt@gap>| !gapinput@Size(Y);|
  248832
  !gapprompt@gap>| !gapinput@C:=ChainComplex(Y);|
  Chain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@D:=HomToIntegers(C);|
  Cochain complex of length 10 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Cohomology(D,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,1);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,3);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,4);|
  [ 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,5);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(D,6);|
  [  ]
  
  
\end{Verbatim}
 }

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

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

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

This computation of low\texttt{\symbol{45}}dimensional cup products is
achieved using group\texttt{\symbol{45}}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 three further strategies. 

\textsc{Strategy 2: implement the Alexander\texttt{\symbol{45}}Whitney map for
simplicial complexes.} 

For simplicial complexes the cup product is implemented using the standard
formula for the Alexander\texttt{\symbol{45}}Whitney chain map, together with
homotopy equivalences to improve efficiency. 

As a first example, the following commands construct simplicial complexes $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^2(K,\mathbb Z)\times H^2(K,\mathbb Z) \rightarrow H^4(K,\mathbb
Z)$ and $\cup_L\colon H^2(L,\mathbb Z)\times H^2(L,\mathbb Z) \rightarrow H^4(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 connected sums $V=M\# M$ and $W=M\# \overline M$ where $M$ is the $K3$ complex surface which is stored as a pure simplicial complex of dimension 4
and where $\overline M$ denotes the opposite orientation on $M$. The simplicial structure on the $K3$ surface is taken from \cite{spreerkhuenel}. The commands then show that $H^2(V,\mathbb Z)=H^2(W,\mathbb Z)=\mathbb Z^{44}$ and $H^4(V,\mathbb Z)=H^4(W,\mathbb Z)=\mathbb Z$. The final commands compute the matrix $AV=(x\cup y)$ as $x,y$ range over a generating set for $H^2(V,\mathbb Z)$ and the corresponding matrix $AW$ for $W$. These two matrices are seen to have a different number of positive
eigenvalues from which we can conclude that $V$ is not homotopy equivalent to $W$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=SimplicialK3Surface();;|
  !gapprompt@gap>| !gapinput@V:=ConnectedSum(M,M,+1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@W:=ConnectedSum(M,M,-1);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@Cohomology(V,2);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !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, 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(V,4);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Cohomology(W,4);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@cupV:=CupProduct(V);;|
  !gapprompt@gap>| !gapinput@cupW:=CupProduct(W);;|
  !gapprompt@gap>| !gapinput@AV:=NullMat(44,44);;      |
  !gapprompt@gap>| !gapinput@AW:=NullMat(44,44);;|
  !gapprompt@gap>| !gapinput@gens:=IdentityMat(44);;|
  !gapprompt@gap>| !gapinput@for i in [1..44] do|
  !gapprompt@>| !gapinput@for j in [1..44] do|
  !gapprompt@>| !gapinput@AV[i][j]:=cupV(2,2,gens[i],gens[j])[1];                               |
  !gapprompt@>| !gapinput@AW[i][j]:=cupW(2,2,gens[i],gens[j])[1];|
  !gapprompt@>| !gapinput@od;od;                                 |
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(AV);|
  rec( determinant := 1, negative_eigenvalues := 22, positive_eigenvalues := 22,
    zero_eigenvalues := 0 )
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(AW);|
  rec( determinant := 1, negative_eigenvalues := 6, positive_eigenvalues := 38, 
    zero_eigenvalues := 0 )
  
\end{Verbatim}
 A cubical cubical version of the Alexander\texttt{\symbol{45}}Whitney formula,
due to J.\texttt{\symbol{45}}P. Serre, could be used for computing the
cohomology ring of a regular CW\texttt{\symbol{45}}complex whose cells all
have a cubical combinatorial face lattice. This has not been implemented in
HAP. However, the following more general approach has been implemented. 

\textsc{Strategy 3: Implement a cellular approximation to the diagonal map on an
arbitrary finite regular CW\texttt{\symbol{45}}complex.} 

The following example calculates the cup product $H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)$ for the $4$\texttt{\symbol{45}}dimensional orientable manifold $W=M\times M$ where $M$ is the closed surface of genus $2$. The manifold $W$ is stored as a regular CW\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RegularCWComplex(ClosedSurface(2));;|
  !gapprompt@gap>| !gapinput@W:=DirectProduct(M,M);|
  Regular CW-complex of dimension 4
  
  !gapprompt@gap>| !gapinput@Size(W);|
  5776
  !gapprompt@gap>| !gapinput@W:=SimplifiedComplex(W);;|
  !gapprompt@gap>| !gapinput@Size(W);                                |
  1024
  
  !gapprompt@gap>| !gapinput@Homology(W,2);           |
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@Homology(W,4);|
  [ 0 ]
  
  !gapprompt@gap>| !gapinput@cup:=CupProduct(W);;|
  !gapprompt@gap>| !gapinput@SecondCohomologtGens:=IdentityMat(18);;   |
  !gapprompt@gap>| !gapinput@A:=NullMat(18,18);;|
  !gapprompt@gap>| !gapinput@for i in [1..18] do|
  !gapprompt@>| !gapinput@for j in [1..18] do|
  !gapprompt@>| !gapinput@A[i][j]:=cup(2,2,SecondCohomologtGens[i],SecondCohomologtGens[j])[1];|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(A);|
  [ [    0,   -1,    0,    0,    0,    0,    3,   -2,    0,    0,    0,    1,   -1,    0,    0,    1,    0,    0 ],
    [   -1,  -10,    1,    2,   -2,    1,    6,   -1,    0,   -3,    4,   -1,   -1,   -1,    4,   -2,   -2,    0 ],
    [    0,    1,   -2,    1,    0,   -1,    0,    0,    1,    0,   -1,    1,    0,    0,    1,   -1,    0,    0 ],
    [    0,    2,    1,   -2,    1,    0,    0,   -1,    0,    1,    0,    0,    0,    0,   -1,    2,    0,    0 ],
    [    0,   -2,    0,    1,    0,    0,    1,   -1,    0,    0,   -1,    0,    0,    0,    0,   -1,    0,    0 ],
    [    0,    1,   -1,    0,    0,    0,    0,    1,   -1,    1,    0,    0,    0,    0,    1,   -1,    0,    0 ],
    [    3,    6,    0,    0,    1,    0,   -4,    0,   -1,    2,    4,   -5,    2,   -1,    1,    0,    3,    0 ],
    [   -2,   -1,    0,   -1,   -1,    1,    0,    4,   -2,    0,    0,    3,   -1,    1,   -1,    0,   -2,    0 ],
    [    0,    0,    1,    0,    0,   -1,   -1,   -2,    4,   -3,  -10,    1,    0,    0,   -3,    3,    0,    0 ],
    [    0,   -3,    0,    1,    0,    1,    2,    0,   -3,    2,    3,    0,    0,    0,    1,   -3,    0,    0 ],
    [    0,    4,   -1,    0,   -1,    0,    4,    0,  -10,    3,   18,    1,    0,    0,    0,    4,    0,    1 ],
    [    1,   -1,    1,    0,    0,    0,   -5,    3,    1,    0,    1,    0,    0,    0,   -2,   -1,   -1,    0 ],
    [   -1,   -1,    0,    0,    0,    0,    2,   -1,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0 ],
    [    0,   -1,    0,    0,    0,    0,   -1,    1,    0,    0,    0,    0,    0,    0,    0,   -1,   -1,    0 ],
    [    0,    4,    1,   -1,    0,    1,    1,   -1,   -3,    1,    0,   -2,    1,    0,    0,    2,    2,    0 ],
    [    1,   -2,   -1,    2,   -1,   -1,    0,    0,    3,   -3,    4,   -1,    0,   -1,    2,    0,    0,    0 ],
    [    0,   -2,    0,    0,    0,    0,    3,   -2,    0,    0,    0,   -1,    0,   -1,    2,    0,    0,    0 ],
    [    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0,    0,    0,    0,    0 ] ]
  
  !gapprompt@gap>| !gapinput@SignatureOfSymmetricMatrix(A);|
  rec( determinant := -1, negative_eigenvalues := 9, positive_eigenvalues := 9,
    zero_eigenvalues := 0 )
  
  
\end{Verbatim}
 The matrix $A$ representing the cup product $H^2(W,\mathbb Z)\times H^2(W,\mathbb Z) \rightarrow H^4(W,\mathbb Z)$ is shown to have $9$ positive eigenvalues, $9$ negative eigenvalues, and no zero eigenvalue. 

\textsc{Strategy 4: 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\texttt{\symbol{45}}complex we can attempt to
construct 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{CupProductOfRegularCWComplex{\textunderscore}alt(Y)}, involving the candidate space, can be used for cup products. (I think the
test is passed for all regular CW\texttt{\symbol{45}}complexes that are
subcomplexes of some Euclidean space with all cells convex polytopes
\texttt{\symbol{45}}\texttt{\symbol{45}} 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$\texttt{\symbol{45}}th generator in some basis of $H^n(Y,\mathbb Z)$. The direct product $Y$ is a CW\texttt{\symbol{45}}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:=CupProductOfRegularCWComplex_alt(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, either of Strategies 2 or 3 could also be used for this example. To
use the Alexander\texttt{\symbol{45}}Whitney formula of Strategy 2 we would
need to give the direct product $Y=T\times T$ a simplicial structure. This could be obtained using the function \texttt{DirectProduct(T,T)}. 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@KK:=DirectProduct(K,K);|
  Simplicial complex of dimension 4.
  
  !gapprompt@gap>| !gapinput@cup:=CupProduct(KK);;                |
  !gapprompt@gap>| !gapinput@cup(2,2,[1,0,0,0,0,0],[0,1,0,0,0,0]);|
  [ 0 ]
  
\end{Verbatim}
 
\section{\textcolor{Chapter }{Intersection forms of $4$\texttt{\symbol{45}}manifolds}}\logpage{[ 1, 11, 0 ]}
\hyperdef{L}{X7F9B01CF7EE1D2FC}{}
{
 The cup product gives rise to the intersection form of a connected, closed,
orientable $4$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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 $N=\mathbb CP^2 \# \mathbb CP^2$. The manifolds $L$, $M$ and $N$ are each shown to have a CW\texttt{\symbol{45}}structure involving one $0$\texttt{\symbol{45}}cell, two $1$\texttt{\symbol{45}}cells and one $2$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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);|
  [ [  1,  0 ],
    [  0,  1 ] ]
  !gapprompt@gap>| !gapinput@Display(qN);|
  [ [   1,   0 ],
    [   0,  -1 ] ]
  
\end{Verbatim}
 Since $qL$ is of type II, whereas $qM$ and $qN$ are of type I 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 }{Cohomology Rings}}\logpage{[ 1, 12, 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. The function \texttt{CohomologyRing(Y,p)} returns the cohomology as an algebra for $Y$ a simplicial complex and $R=\mathbb Z_p$ the field of $p$ elements. For more general regular CW\texttt{\symbol{45}}complexes or $R=\mathbb Z$ the cohomology ring structure can be determined using the function \texttt{CupProduct(Y)}. 

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$\texttt{\symbol{45}}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}
 

The functions \texttt{CupProduct} and \texttt{IntersectionForm} can be used to determine integral cohomology rings. For example, the integral
cohomology ring of an arbitrary closed surface was calculated in \cite[Theorem 3.5]{goncalves}. For any given surface $M$ this result can be recalculated using the intersection form. For instance, for
an orientable surface of genus $g$ it is well\texttt{\symbol{45}}known that $H^1(M,\mathbb Z)=\mathbb Z^{2g}$, $H^2(M,\mathbb Z)=\mathbb Z$. The ring structure multiplication is thus given by the matrix of the
intersection form. For say $g=3$ the ring multiplication is given, with respect to some cohomology basis, in
the following. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=ClosedSurface(3);;|
  !gapprompt@gap>| !gapinput@Display(IntersectionForm(M));|
  [ [   0,   0,   1,  -1,  -1,   0 ],
    [   0,   0,   0,   1,   1,   0 ],
    [  -1,   0,   0,   1,   1,  -1 ],
    [   1,  -1,  -1,   0,   0,   1 ],
    [   1,  -1,  -1,   0,   0,   0 ],
    [   0,   0,   1,  -1,   0,   0 ] ]
  
\end{Verbatim}
 By changing the basis $B$ for $H^1(M,\mathbb Z)$ we obtain the following simpler matrix representing multiplication in $H^\ast(M,\mathbb Z)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@B:=[ [ 0, 1, -1, -1, 1, 0 ],|
  !gapprompt@>| !gapinput@        [ 1, 0, 1, 1, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 0, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 0, 1, -1, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 1, 0, 0 ],|
  !gapprompt@>| !gapinput@        [ 0, 0, 1, 1, 0, 1 ] ];;|
  !gapprompt@gap>| !gapinput@Display(IntersectionForm(M,B));|
  [ [   0,   1,   0,   0,   0,   0 ],
    [  -1,   0,   0,   0,   0,   0 ],
    [   0,   0,   0,   0,   1,   0 ],
    [   0,   0,   0,   0,   0,   1 ],
    [   0,   0,  -1,   0,   0,   0 ],
    [   0,   0,   0,  -1,   0,   0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bockstein homomorphism}}\logpage{[ 1, 13, 0 ]}
\hyperdef{L}{X83035DEC7C9659C6}{}
{
 The following example evaluates the Bockstein homomorphism $\beta_2\colon H^\ast(X,\mathbb Z_2) \rightarrow H^{\ast +1}(X,\mathbb Z_2)$ on an additive basis for $X=\Sigma^{100}(\mathbb RP^2 \times \mathbb RP^2)$ the $100$\texttt{\symbol{45}}fold suspension of the direct product of two projective
planes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=SimplifiedComplex(RegularCWComplex(ClosedSurface(-1)));|
  Regular CW-complex of dimension 2
  !gapprompt@gap>| !gapinput@PP:=DirectProduct(P,P);;|
  !gapprompt@gap>| !gapinput@SPP:=Suspension(PP,100); |
  Regular CW-complex of dimension 104
  !gapprompt@gap>| !gapinput@A:=CohomologyRing(SPP,2); |
  <algebra of dimension 9 over GF(2)>
  !gapprompt@gap>| !gapinput@List(Basis(A),x->Bockstein(A,x));|
  [ 0*v.1, v.4, v.6, 0*v.1, v.7+v.8, 0*v.1, v.9, v.9, 0*v.1 ]
  
  
\end{Verbatim}
 If only the Bockstein homomorphism is required, and not the cohomology ring
structure, then the Bockstein could also be computedirectly from a chain
complex. The following computes the Bockstein $\beta_2\colon H^2(Y,\mathbb Z_2) \rightarrow H^{3}(Y,\mathbb Z_2)$ for the direct product $Y=K \times K \times K \times K$ of four copies of the Klein bottle represented as a regular
CW\texttt{\symbol{45}}complex with $331776$ cells. The order of the kernel and image of $\beta_2$ are computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ClosedSurface(-2);;                |
  !gapprompt@gap>| !gapinput@K:=SimplifiedComplex(RegularCWComplex(K));;|
  !gapprompt@gap>| !gapinput@KKKK:=DirectProduct(K,K,K,K); |
  Regular CW-complex of dimension 8
  !gapprompt@gap>| !gapinput@Size(KKKK);|
  331776
  !gapprompt@gap>| !gapinput@C:=ChainComplex(KKKK);;|
  !gapprompt@gap>| !gapinput@bk:=Bockstein(C,2,2);;|
  !gapprompt@gap>| !gapinput@Order(Kernel(bk));|
  1024
  !gapprompt@gap>| !gapinput@Order(Image(bk)); |
  262144
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Diagonal maps on associahedra and other polytopes}}\logpage{[ 1, 14, 0 ]}
\hyperdef{L}{X87135D067B6CDEEC}{}
{
 By a \emph{diagonal approximation} on a regular CW\texttt{\symbol{45}}complex $X$ we mean any cellular map $\Delta\colon X\rightarrow X\times X$ that is homotopic to the diagonal map $X\rightarrow X\times X, x\mapsto (x,x)$ and equal to the diagonal map when restricted to the $0$\texttt{\symbol{45}}skeleton. Theoretical formulae for diagonal maps on a
polytope $X$ can have interesting combinatorial aspects. To illustrate this let us
consider, for $n=3$, the $n$\texttt{\symbol{45}}dimensional polytope ${\cal K}^{n+2}$ known as the associahedron. The following commands display the $1$\texttt{\symbol{45}}skeleton of ${\cal K}^{5}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=3;;Y:=RegularCWAssociahedron(n+2);;|
  !gapprompt@gap>| !gapinput@Display(GraphOfRegularCWComplex(Y));|
  
  				
\end{Verbatim}
 

  

 The induced chain map $C_\ast({\cal K}^{n+2}) \rightarrow C_\ast({\cal K}^{n+2}\times {\cal K}^{n+2})$ sends the unique free generator $e^n_1$ of $C_n({\cal K}^{n+2})$ to a sum $\Delta(e^n_1)$ of a number of distinct free generators of $C_n({\cal K}^{n+2}\times {\cal K}^{n+2})$. Let $|\Delta(e^n_1)|$ denote the number of free generators. For $n=3$ the following commands show that $|\Delta(e^3_1)|=22$ with each free generator occurring with coefficient $\pm 1$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|n:=3;;Y:=RegularCWAssociahedron(n+2);;    B
  @gapprompt|gap>B @gapinput|D:=DiagonalChainMap(Y);;Filtered(D!.mapping([1],n),x->x<>0);B
  [ 1, 1, -1, -1, 1, 1, -1, -1, 1, -1, 1, 1, -1, 1, 1, 1, -1, -1, 1, 1, 1, 1 ]
  
                                  
\end{Verbatim}
 Repeating this example for $0\le n\le 6$ yields the sequence $|\Delta(e^n_1)|: 1, 2, 6, 22, 91, 408, 1938, \cdots\ $. The \href{https://oeis.org/A000139} {On\texttt{\symbol{45}}line Encyclopedia of Integer Sequences} explains that this is the beginning of the sequence given by the number of
canopy intervals in the Tamari lattices. 

Repeating the same experiment for the permutahedron, using the command \texttt{RegularCWPermutahedron(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 8, 50, 432, 4802,\cdots$. The \href{https://oeis.org/A007334} {On\texttt{\symbol{45}}line Encyclopedia of Integer Sequences} explains that this is the beginning of the sequence given by the number of
spanning trees in the graph $K_{n}/e$, which results from contracting an edge $e$ in the complete graph $K_{n}$ on $n$ vertices. 

Repeating the experiment for the cube, using the command \texttt{RegularCWCube(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 4, 8, 16, 32,\cdots$. 

Repeating the experiment for the simplex, using the command \texttt{RegularCWSimplex(n)}, yields the sequence $|\Delta(e^n_1)|: 1, 2, 3, 4, 5, 6,\cdots$. }

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

A \emph{strictly cellular} map $f\colon X\rightarrow Y$ of regular CW\texttt{\symbol{45}}complexes is a cellular map for which the
image of any cell is a cell (of possibly lower dimension). Inclusions of
CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional CW\texttt{\symbol{45}}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}}\texttt{\symbol{45}}1\texttt{\symbol{125}}xy\texttt{\symbol{94}}2xy\texttt{\symbol{94}}\texttt{\symbol{123}}\texttt{\symbol{45}}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\texttt{\symbol{45}}complex}}\logpage{[ 1, 16, 0 ]}
\hyperdef{L}{X853D6B247D0E18DB}{}
{
 The following example constructs a $3$\texttt{\symbol{45}}dimensional pure regular CW\texttt{\symbol{45}}complex $K$ whose $3$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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 }{Some limitations to representing spaces as regular CW complexes}}\logpage{[ 1, 17, 0 ]}
\hyperdef{L}{X7900FD197F175551}{}
{
 By a \emph{classifying space} for a group $G$ we mean a path\texttt{\symbol{45}}connected space $BG$ with fundamental group $\pi_1(BG)\cong G$ isomorphic to $G$ and with higher homotopy groups $\pi_n(BG)=0$ trivial for all $n\ge 2$. The homology of the group $G$ can be defined to be the homology of $BG$: $H_n(G,\mathbb Z) = H_n(BG,\mathbb Z)$. 

In principle $BG$ can always be constructed as a regular CW\texttt{\symbol{45}}complex. For
instance, the following extremely slow commands construct the $5$\texttt{\symbol{45}}skeleton $Y^5$ of a regular CW\texttt{\symbol{45}}classifying space $Y=BG$ for the dihedral group of order $16$ and use it to calculate $H_1(G,\mathbb Z)=\mathbb Z_2\oplus \mathbb Z_2$, $H_2(G,\mathbb Z)=\mathbb Z_2$, $H_3(G,\mathbb Z)=\mathbb Z_{2}\oplus \mathbb Z_2 \oplus \mathbb Z_8$, $H_4(G,\mathbb Z)=\mathbb Z_{2} \oplus \mathbb Z_2$. The final command shows that the constructed space $Y^5$ in this example is a $5$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex with a
total of $15289$ cells. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ClassifyingSpaceFiniteGroup(DihedralGroup(16),5);|
  Regular CW-complex of dimension 5
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [ 2, 2, 8 ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [ 2, 2 ]
  !gapprompt@gap>| !gapinput@Size(Y);|
  15289
  
  
\end{Verbatim}
 The $n$\texttt{\symbol{45}}skeleton of a regular CW\texttt{\symbol{45}}classifying
space of a finite group necessarily involves a large number of cells. For the
group $G=C_2$ of order two a classifying space can be take to be real projective space $BG=\mathbb RP^\infty$ with $n$\texttt{\symbol{45}}skeleton $BG^n=\mathbb RP^n$. To realize $BG^n=\mathbb RP^n$ as a simplicial complex it is known that one needs at least 6 vertices for $n=2$, at least 11 vertices for $n=3$ and at least 16 vertices for $n=4$. One can do a bit better by allowing $BG$ to be a regular CW\texttt{\symbol{45}}complex. For instance, the following
creates $\mathbb RP^4$ as a regular CW\texttt{\symbol{45}}complex with 5 vertices. This construction
of $\mathbb RP^4$ involves a total of 121 cells. A minimal triangulation of $\mathbb RP^4$ would require 991 simplices. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=ClassifyingSpaceFiniteGroup(CyclicGroup(2),4);A
  Regular CW-complex of dimension 4
  @gapprompt|gap>A @gapinput|Y!.nrCells(0);                                   A
  5
  @gapprompt|gap>A @gapinput|Y!.nrCells(1);A
  20
  @gapprompt|gap>A @gapinput|Y!.nrCells(2);A
  40
  @gapprompt|gap>A @gapinput|Y!.nrCells(3);                                   A
  40
  @gapprompt|gap>A @gapinput|Y!.nrCells(4);A
  16
  
\end{Verbatim}
 The space $\mathbb RP^n$ can be given the structure of a regular CW\texttt{\symbol{45}}complex with $n+1$ vertices. Kuehnel has described a triangulation of $\mathbb RP^n$ with $2^{n+1}-1$ vertices. 

The above examples suggest that it is inefficient/impractical to attempt to
compute the $n$\texttt{\symbol{45}}th homology of a group $G$ by first constructing a regular CW\texttt{\symbol{45}}complex corresponding
for the $n+1$ of a classifying space $BG$, even for quite small groups $G$, since such spaces seem to require a large number of cells in each dimension.
On the other hand, by dropping the requirement that $BG$ must be regular we can obtain much smaller CW\texttt{\symbol{45}}complexes.
The following example constructs $\mathbb RP^9$ as a regular CW\texttt{\symbol{45}}complex and then shows that it can be given
a non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}structure with just one
cell in each dimension. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=ClassifyingSpaceFiniteGroup(CyclicGroup(2),9);|
  Regular CW-complex of dimension 9
  !gapprompt@gap>| !gapinput@Size(Y);|
  29524
  !gapprompt@gap>| !gapinput@CriticalCells(Y);|
  [ [ 9, 1 ], [ 8, 124 ], [ 7, 1215 ], [ 6, 1246 ], [ 5, 487 ], [ 4, 254 ], 
    [ 3, 117 ], [ 2, 54 ], [ 1, 9 ], [ 0, 10 ] ]
  
\end{Verbatim}
 It is of course well\texttt{\symbol{45}}known that $\mathbb RP^\infty$ admits a theoretically described CW\texttt{\symbol{45}}structure with just one
cell in each dimension. The question is: how best to represent this on a
computer? }

 
\section{\textcolor{Chapter }{Equivariant CW complexes}}\logpage{[ 1, 18, 0 ]}
\hyperdef{L}{X85A579217DCB6CC8}{}
{
 As just explained, the 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\texttt{\symbol{45}}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\texttt{\symbol{45}}homeomorphically) one obtains a minimal triangulation
of the torus involving $1$ vertex, $3$ edges and $2$ cells of dimension $2$. By using non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}cube rather than an $n$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}equivariant CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional closed manifold $M=\mathbb R^3/G$ is computed. The manifold $M$ is seen to be non\texttt{\symbol{45}}orientable (since it's
top\texttt{\symbol{45}}dimensional homology is trivial) and has a
non\texttt{\symbol{45}}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}
 The fundamental domain for the action of $G$ in the above example is constructed to be the
Dirichlet\texttt{\symbol{45}}Voronoi region in $\mathbb R^3$ whose points are closer to the origin $v=(0,0,0)$ than to any other point $v^g$ in the orbit of the origin under the action of $G$. This fundamental domain can be visualized as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([0,0,0],G);|
  <polymake object>
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
\end{Verbatim}
 

 

 Other fundamental domains for the same group action can be obtained by
choosing some other starting vector $v$. For example: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([1/2,1/3,1/5],G);;|
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
  !gapprompt@gap>| !gapinput@F:=FundamentalDomainStandardSpaceGroup([1/7,1/2,1/2],G);|
  !gapprompt@gap>| !gapinput@Polymake(F,"VISUAL");|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{Orbifolds and classifying spaces}}\label{secOrbifolds}
\logpage{[ 1, 19, 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$\texttt{\symbol{45}}equivariant regular CW\texttt{\symbol{45}}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\texttt{\symbol{45}}free resolution} and uses them mainly as a first step in constructing free $\mathbb ZG$\texttt{\symbol{45}}resolutions of $\mathbb Z$. 

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

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

 }

 
\chapter{\textcolor{Chapter }{Cubical complexes \& permutahedral complexes}}\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X7F8376F37AF80AAC}{}
{
 
\section{\textcolor{Chapter }{Cubical complexes}}\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X7D67D5F3820637AD}{}
{
 A \emph{finite simplicial complex} can be defined to be a CW\texttt{\symbol{45}}subcomplex of the canonical
regular CW\texttt{\symbol{45}}structure on a simplex $\Delta^n$ of some dimension $n$. Analogously, a \emph{finite cubical complex} is a CW\texttt{\symbol{45}}subcomplex of the regular
CW\texttt{\symbol{45}}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\texttt{\symbol{45}}structure involving $2k+1$ cells, namely one $0$\texttt{\symbol{45}}cell for each integer $0\le j\le k$ and one $1$\texttt{\symbol{45}}cell for each open interval $(j,j+1)$ for $0\le j\le k-1$. A \emph{finite cuical complex} $M$ is a CW\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell. In other words, $M$ is pure if it is a union of unit $n$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cubes. We contract $Y$ to get a homotopy equivalent pure cubical complex $YY$ consisting of the union of just $775$ unit $3$\texttt{\symbol{45}}cubes. Then we convert $YY$ to a regular CW\texttt{\symbol{45}}complex $W$ involving $11939$ cells. We contract $W$ to obtain a homotopy equivalent regular CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional CW\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional pure cubical or permutahedral complex can be
created from an $n$\texttt{\symbol{45}}dimensional array of 0s and 1s. The following example
creates and displays two $3$\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional pure cubical complex where each $2$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}complex. Let $\widetilde Y$ denote its universal covering space. The covering space inherits a regular
CW\texttt{\symbol{45}}structure which can be computed and stored using the
datatype of a $\pi_1Y$\texttt{\symbol{45}}equivariant CW\texttt{\symbol{45}}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\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}structre
whose cells correspond to the critical cells in the vector field. This smaller
CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}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\texttt{\symbol{45}}somplex $Y$ has $110592$ cells. The next commands construct a free $\pi_1Y$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}equivariant cellular chain complex $C_\ast\widetilde Y$ of the universal cover $\widetilde Y$ of a regular CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}trivial $\pi_1Y$\texttt{\symbol{45}}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\texttt{\symbol{45}}homeomorphic homotopy
equivalent spaces}}\logpage{[ 3, 4, 0 ]}
\hyperdef{L}{X7A4F34B780FA2CD5}{}
{
 

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

 The following commands construct a $4$\texttt{\symbol{45}}dimensional simplicial complex $Y$ with $9$ vertices and $36$ $4$\texttt{\symbol{45}}dimensional simplices, and establish that 

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

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

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

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

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

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

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

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

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

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

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

 }

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

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

of the fundamental group $\pi_1W$ of the complement $W$ of the Hopf\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}dimensional space $W$ has two $3$\texttt{\symbol{45}}cells each of which is attached to the
base\texttt{\symbol{45}}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$\texttt{\symbol{45}}module on three free generators. }

 }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

where $ev(x,\alpha)$ evaluates a $1$\texttt{\symbol{45}}cocycle $\alpha$ on a $1$\texttt{\symbol{45}}cycle $x$. 

 The linking form can be used to define the set 

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

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

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

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

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

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

 Przytycki and Yasukhara proved the following. 

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

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

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

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

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

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

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

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

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

The next commands construct the universal cover $\widetilde W$ and show that it has the same homology as $S^3$ and trivivial fundamental group $\pi_1(\widetilde W)=0$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|U:=UniversalCover(W);;A
  @gapprompt|gap>A @gapinput|G:=U!.group;;A
  @gapprompt|gap>A @gapinput|Wtilde:=EquivariantCWComplexToRegularCWComplex(U,Group(One(G)));A
  Regular CW-complex of dimension 3
  
  @gapprompt|gap>A @gapinput|Homology(Wtilde,1);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,2);A
  [  ]
  @gapprompt|gap>A @gapinput|Homology(Wtilde,3);A
  [ 0 ]
  
  @gapprompt|gap>A @gapinput|F:=FundamentalGroup(Wtilde);A
  <fp group on the generators [  ]>
  
\end{Verbatim}
 By construction the space $\widetilde W$ is a manifold. Had we not known how the regular CW\texttt{\symbol{45}}complex $\widetilde W$ had been constructed then we could prove that it is a closed $3$\texttt{\symbol{45}}manifold by creating its barycentric subdivision $K=sd\widetilde W$, which is homeomorphic to $\widetilde W$, and verifying that the link of each vertex in the simplicial complex $sd\widetilde W$ is a $2$\texttt{\symbol{45}}sphere. The following command carries out this proof. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@IsClosedManifold(Wtilde);|
  
  true
  
\end{Verbatim}
 The Poincare conjecture (now proven) implies that $\widetilde W$ is homeomorphic to $S^3$. Hence $W=S^3/C_5$ is a quotient of the $3$\texttt{\symbol{45}}sphere by an action of $C_5$ and is hence a lens space $L(5,q)$ for some $q$. 

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

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

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

 
\section{\textcolor{Chapter }{Poincare's cube manifolds}}\logpage{[ 4, 9, 0 ]}
\hyperdef{L}{X78912D227D753167}{}
{
 In his seminal paper on "Analysis situs", published in 1895, Poincare
constructed a series of closed 3\texttt{\symbol{45}}manifolds which played an
important role in the development of his theory. A good account of these
manifolds is given in the online \href{http://www.map.mpim-bonn.mpg.de/Poincar%C3%A9%27s_cube_manifolds} {Manifold Atlas Project (MAP)}. Most of his examples are constructed by identifications on the faces of a
(solid) cube. The function \texttt{PoincareCubeCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a cube by identifying the six faces
pairwise; the vertices and faces of the cube are numbered as follows 

  

 and barycentric subdivision is used to ensure that the quotient is represented
as a regular CW\texttt{\symbol{45}}complex. 

Examples 3 and 4 from Poincare's paper, described in the following figures
taken from \href{http://www.map.mpim-bonn.mpg.de/Poincar%C3%A9%27s_cube_manifolds} {MAP}, 

  

are constructed in the following example. Both are checked to be orientable
manifolds, and are shown to have different homology. (Note that the second
example in Poincare's paper is not a manifold
\texttt{\symbol{45}}\texttt{\symbol{45}} the links of some of its vertices are
not homeomorphic to a 2\texttt{\symbol{45}}sphere.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=1;;C:=2;;D:=3;;B:=4;;|
  !gapprompt@gap>| !gapinput@Ap:=5;;Cp:=6;;Dp:=7;;Bp:=8;;|
  
  !gapprompt@gap>| !gapinput@L:=[[A,B,D,C],[Bp,Dp,Cp,Ap]];;|
  !gapprompt@gap>| !gapinput@M:=[[A,B,Bp,Ap],[Cp,C,D,Dp]];;|
  !gapprompt@gap>| !gapinput@N:=[[A,C,Cp,Ap],[D,Dp,Bp,B]];;|
  !gapprompt@gap>| !gapinput@Ex3:=PoincareCubeCWComplex(L,M,N);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@IsClosedManifold(Ex3);|
  
  true
  
  !gapprompt@gap>| !gapinput@L:=[[A,B,D,C],[Bp,Dp,Cp,Ap]];;|
  !gapprompt@gap>| !gapinput@M:=[[A,B,Bp,Ap],[C,D,Dp,Cp]];;|
  !gapprompt@gap>| !gapinput@N:=[[A,C,Cp,Ap],[B,D,Dp,Bp]];;|
  !gapprompt@gap>| !gapinput@Ex4:=PoincareCubeCWComplex(L,M,N);|
  Regular CW-complex of dimension 3
  
  !gapprompt@gap>| !gapinput@IsClosedManifold(Ex4);|
  true
  
  !gapprompt@gap>| !gapinput@List([0..3],k->Homology(Ex3,k));|
  [ [ 0 ], [ 2, 2 ], [  ], [ 0 ] ]
  !gapprompt@gap>| !gapinput@List([0..3],k->Homology(Ex4,k));|
  [ [ 0 ], [ 2, 0 ], [ 0 ], [ 0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{There are at least 25 distinct cube manifolds}}\logpage{[ 4, 10, 0 ]}
\hyperdef{L}{X8761051F84C6CEC2}{}
{
 The function \texttt{PoincareCubeCWComplex(A,G)} can also be applied to two inputs where $A$ is a pairing of the six faces such as $A=[[1,2],[3,4],[5,6]]$ and $G$ is a list of three elements of the dihedral group of order $8$ such as $G=[(2,4),(2,4),(2,4)*(1,3)]$. The dihedral elements specify how each pair of faces are glued together.
With these inputs it is easy to iterate over all possible values of $A$ and $G$ in order to construct all possible closed 3\texttt{\symbol{45}}manifolds
arising from the pairwise identification of faces of a cube. We call such a
manifold a \emph{\textsc{cube manifold}}. Distinct values of $A$ and $G$ can of course yield homeomorphic spaces. To ensure that each possible cube
manifold is constructed, at least once, up to homeomorphism it suffices to
consider 

$A=[ [1,2], [3,4], [5,6] ]$, $A=[ [1,2], [3,5], [4,6] ]$, $A=[ [1,4], [2,6], [3,5] ]$ 

 and all $G$ in $D_8\times D_8\times D_8$. 

The following commands iterate through these $3\times8^3 = 1536$ pairs $(A,G)$ and show that in precisely 163 cases (just over 10\% of cases) the quotient
CW\texttt{\symbol{45}}complex is a closed 3\texttt{\symbol{45}}manifold. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A1:= [ [1,2], [3,4], [5,6] ];;|
  !gapprompt@gap>| !gapinput@A2:=[ [1,2], [3,5], [4,6] ];;|
  !gapprompt@gap>| !gapinput@A3:=[ [1,4], [2,6], [3,5] ];;|
  !gapprompt@gap>| !gapinput@D8:=DihedralGroup(IsPermGroup,8);;|
  
  !gapprompt@gap>| !gapinput@Manifolds:=[];;|
  !gapprompt@gap>| !gapinput@for A in [A1,A2,A3] do|
  !gapprompt@>| !gapinput@for x in D8 do|
  !gapprompt@>| !gapinput@for y in D8 do|
  !gapprompt@>| !gapinput@for z in D8 do|
  !gapprompt@>| !gapinput@G:=[x,y,z];|
  !gapprompt@>| !gapinput@F:=PoincareCubeCWComplex(A,G);|
  !gapprompt@>| !gapinput@b:=IsClosedManifold(F);|
  !gapprompt@>| !gapinput@if b=true then Add(Manifolds,F); fi;|
  !gapprompt@>| !gapinput@od;od;od;od;|
  
  !gapprompt@gap>| !gapinput@Size(Manifolds);|
  163
  
\end{Verbatim}
 The following additional commands use integral homology and low index
subgroups of fundamental groups to establish that the 163 cube manifolds
represent at least 25 distinct homotopy equivalence classes of manifolds. One
homotopy class is represented by up to 40 of the manifolds, and at least four
of the homotopy classes are each represented by a single manifold.. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@invariant1:=function(m);|
  !gapprompt@>| !gapinput@return List([1..3],k->Homology(m,k));|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@C:=Classify(Manifolds,invariant1);;|
  
  !gapprompt@gap>| !gapinput@invariant2:=function(m)|
  !gapprompt@>| !gapinput@local L;|
  !gapprompt@>| !gapinput@L:=FundamentalGroup(m);|
  !gapprompt@>| !gapinput@if GeneratorsOfGroup(L)= [] then return [];fi;|
  !gapprompt@>| !gapinput@L:=LowIndexSubgroupsFpGroup(L,5);|
  !gapprompt@>| !gapinput@L:=List(L,AbelianInvariants);|
  !gapprompt@>| !gapinput@L:=SortedList(L);|
  !gapprompt@>| !gapinput@return L;|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@D:=RefineClassification(C,invariant2);;|
  !gapprompt@gap>| !gapinput@List(D,Size);|
  [ 40, 2, 10, 15, 8, 6, 2, 6, 2, 5, 7, 1, 4, 11, 7, 7, 10, 4, 4, 2, 1, 3, 1, 
    1, 4 ]
  
\end{Verbatim}
 The next commands construct a list of 18 orientable cube manifolds and a list
of 7 non\texttt{\symbol{45}}orientable cube manifolds. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Manifolds:=List(D,x->x[1]);;|
  !gapprompt@gap>| !gapinput@OrientableManifolds:=Filtered(Manifolds,m->Homology(m,3)=[0]);;|
  !gapprompt@gap>| !gapinput@NonOrientableManifolds:=Filtered(Manifolds,m->Homology(m,3)=[]);;|
  !gapprompt@gap>| !gapinput@Length(OrientableManifolds);|
  18
  !gapprompt@gap>| !gapinput@Length(NonOrientableManifolds);|
  7
  
\end{Verbatim}
 The next commands show that the 7 non\texttt{\symbol{45}}orientable cube
manifolds all have infinite fundamental groups. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(NonOrientableManifolds,m->IsFinite(FundamentalGroup(m)));|
  [ false, false, false, false, false, false, false ]
  
\end{Verbatim}
 The final commands show that (at least) 9 of the orientable manifolds have
finite fundamental groups and list the isomorphism types of these finite
groups. Note that it is now known that any closed
3\texttt{\symbol{45}}manifold with finite fundamental group is spherical (i.e.
is a quotient of the 3\texttt{\symbol{45}}sphere). Spherical manifolds with
cyclic fundamental group are, by definition, lens spaces. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(OrientableManifolds{[4,8,10,11,12,13,15,16,18]},m->|
            IsFinite(FundamentalGroup(m)));
  [ true, true, true, true, true, true, true, true, true ]
  
  !gapprompt@gap>| !gapinput@List(OrientableManifolds{[4,8,10,11,12,13,15,16,18]},m->|
            StructureDescription(FundamentalGroup(m)));
  [ "Q8", "C2", "C4", "C3 : C4", "C12", "C8", "C14", "C6", "1" ]
  
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Face pairings for 25 distinct cube manifolds}}\logpage{[ 4, 10, 1 ]}
\hyperdef{L}{X7D50795883E534A3}{}
{
 The following are the face pairings of 25 non\texttt{\symbol{45}}homeomorphic
cube manifolds, with vertices of the cube numbered as describe above. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|for i in [1..25] do                                              A
  @gapprompt|>A @gapinput|p:=Manifolds[i]!.cubeFacePairings;A
  @gapprompt|>A @gapinput|Print("Manifold ",i," has face pairings:\n");A
  @gapprompt|>A @gapinput|Print(p[1],"\n",p[2],"\n",p[3],"\n");A
  @gapprompt|>A @gapinput|Print("Fundamental group is:  ");A
  @gapprompt|>A @gapinput|if i in [ 1, 9, 12, 14, 15, 16, 17, 18, 19, 20, 22, 23, 25 ] thenA
  @gapprompt|>A @gapinput|Print(StructureDescription(FundamentalGroup(Manifolds[i])),"\n");A
  @gapprompt|>A @gapinput|else Print("infinite non-cyclic\n"); fi;A
  @gapprompt|>A @gapinput|if Homology(Manifolds[i],3)=[0] then Print("Orientable, ");A
  @gapprompt|>A @gapinput|else Print("Non orientable, "); fi;A
  @gapprompt|>A @gapinput|Print(ManifoldType(Manifolds[i]),"\n");A
  @gapprompt|>A @gapinput|for x in Manifolds[i]!.edgeDegrees doA
  @gapprompt|>A @gapinput|Print(x[2]," edges of \"degree\" ",x[1],",  ");A
  @gapprompt|>A @gapinput|od;A
  @gapprompt|>A @gapinput|Print("\n\n");A
  @gapprompt|>A @gapinput|od;A
  
  Manifold 1 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 7, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 3, 2, 6, 7 ] ]
  Fundamental group is:  Z x C2
  Non orientable, other
  4 edges of "degree" 2,  4 edges of "degree" 4,  
  
  Manifold 2 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 8, 4, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, other
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 3 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 4 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 6, 7, 3, 2 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 5 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 6, 5, 8, 7 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 6, 7, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 6 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 7 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 8 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  4 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 9 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 5, 6, 7 ] ]
  [ [ 1, 4, 8, 5 ], [ 6, 2, 3, 7 ] ]
  Fundamental group is:  Q8
  Orientable, spherical
  8 edges of "degree" 3,  
  
  Manifold 10 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, other
  4 edges of "degree" 2,  4 edges of "degree" 4,  
  
  Manifold 11 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 3, 7, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  infinite non-cyclic
  Non orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 12 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z x Z x Z
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 13 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 4, 8, 7, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 6, 7, 8 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 14 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 7, 8, 5, 6 ] ]
  [ [ 1, 4, 8, 5 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  C2
  Orientable, spherical
  12 edges of "degree" 2,  
  
  Manifold 15 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 7, 8, 4 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z
  Non orientable, other
  4 edges of "degree" 1,  2 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 16 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 2, 3, 7, 6 ] ]
  Fundamental group is:  Z
  Orientable, other
  4 edges of "degree" 1,  2 edges of "degree" 2,  2 edges of "degree" 8,  
  
  Manifold 17 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C4
  Orientable, spherical
  2 edges of "degree" 1,  2 edges of "degree" 3,  2 edges of "degree" 8,  
  
  Manifold 18 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 6, 2, 3, 7 ] ]
  Fundamental group is:  C3 : C4
  Orientable, spherical
  2 edges of "degree" 2,  4 edges of "degree" 5,  
  
  Manifold 19 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C12
  Orientable, spherical
  2 edges of "degree" 2,  2 edges of "degree" 3,  2 edges of "degree" 7,  
  
  Manifold 20 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 3, 4, 8, 7 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 4, 1 ] ]
  [ [ 5, 8, 7, 6 ], [ 3, 7, 6, 2 ] ]
  Fundamental group is:  C8
  Orientable, spherical
  8 edges of "degree" 3,  
  
  Manifold 21 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 3, 4, 8 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  [ [ 5, 8, 7, 6 ], [ 7, 6, 2, 3 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 22 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 5, 6, 7, 8 ] ]
  [ [ 3, 7, 8, 4 ], [ 7, 6, 2, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 8, 4, 1, 5 ] ]
  Fundamental group is:  C14
  Orientable, spherical
  2 edges of "degree" 2,  4 edges of "degree" 5,  
  
  Manifold 23 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 5, 6, 7, 8 ] ]
  [ [ 3, 7, 8, 4 ], [ 7, 6, 2, 3 ] ]
  [ [ 1, 2, 3, 4 ], [ 5, 8, 4, 1 ] ]
  Fundamental group is:  C6
  Orientable, spherical
  6 edges of "degree" 2,  2 edges of "degree" 6,  
  
  Manifold 24 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 7, 8, 5, 6 ] ]
  [ [ 3, 7, 8, 4 ], [ 2, 3, 7, 6 ] ]
  [ [ 1, 2, 3, 4 ], [ 4, 1, 5, 8 ] ]
  Fundamental group is:  infinite non-cyclic
  Orientable, euclidean
  6 edges of "degree" 4,  
  
  Manifold 25 has face pairings:
  [ [ 1, 5, 6, 2 ], [ 6, 7, 8, 5 ] ]
  [ [ 3, 7, 8, 4 ], [ 3, 7, 6, 2 ] ]
  [ [ 1, 2, 3, 4 ], [ 1, 5, 8, 4 ] ]
  Fundamental group is:  1
  Orientable, spherical
  4 edges of "degree" 1,  4 edges of "degree" 5,
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Platonic cube manifolds}}\logpage{[ 4, 10, 2 ]}
\hyperdef{L}{X837811BB8181666E}{}
{
 A \emph{platonic solid} is a convex, regular polyhedron in $3$\texttt{\symbol{45}}dimensional euclidean $\mathbb E^3$ or spherical $\mathbb S^3$ or hyperbolic space $\mathbb H^3$. Being \emph{regular} means that all edges are congruent, all faces are congruent, all angles
between adjacent edges in a face are congruent, all dihedral angles between
adjacent faces are congruent. A platonic cube in euclidean space has six
congruent square faces with diherdral angle $\pi/2$. A platonic cube in spherical space has dihedral angles $2\pi/3$. A platonic cube in hyperbolic space has dihedral angles $2\pi/5$. This can alternatively be expressed by saying that in a tessellation of $\mathbb E^3$ by platonic cubes each edge is adjacent to 4 square faces. In a tessellation
of $\mathbb S^3$ by platonic cubes each edge is adjacent to 3 square faces. In a tessellation
of $\mathbb H^3$ by platonic cubes each edge is adjacent to 5 five square faces. 

 Any cube manifold $M$ induces a cubical CW\texttt{\symbol{45}}decomposition of its universal cover $\widetilde M$. We say that $M$ is a \emph{platonic cube manifold} if every edge in $\widetilde M$ is adjacent to 4 faces in the euclidean case $\widetilde M=\mathbb E^3$, is adjacent to 3 faces in the spherical case $\widetilde M=\mathbb S^3$, is adjacent to 5 faces in the hyperbolic case $\widetilde M=\mathbb H^3$. 

 In the above list of 25 cube manifolds we see that the euclidean manifolds 3,
4, 5, 6, 11 are platonic and that the spherical manifolds 9, 20 are platonic. }

 }

 
\section{\textcolor{Chapter }{There are at most 41 distinct cube manifolds}}\logpage{[ 4, 11, 0 ]}
\hyperdef{L}{X8084A36082B26D86}{}
{
 Using the \href{https://simpcomp-team.github.io/simpcomp/README.html} {Simpcomp} package for GAP we can show that many of the 163 cube manifolds constructed
above are homeomorphic. We do this by showing that barycentric subdivisions of
many of the manifolds are combinatorially the same. 

The following commands establish homeomorphisms (simplicial complex
isomorphisms) between manifolds in each equivalence class D[i] above for $1 \le i\le 25$, and then discard all but one manifold in each homeomorphism class. We are
left with 59 cube manifolds, some of which may be homeomorphic, representing
at least 25 distinct homeomorphism classes. The 59 manifolds are stored in the
list DD of length 25 each of whose terms is a list of cube manifolds. 
\begin{Verbatim}[commandchars=@|F,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>F @gapinput|LoadPackage("Simpcomp");;F
  
  @gapprompt|gap>F @gapinput|inv3:=function(m)F
  @gapprompt|>F @gapinput|local K;F
  @gapprompt|>F @gapinput|K:=BarycentricSubdivision(m);F
  @gapprompt|>F @gapinput|K:=MaximalSimplicesOfSimplicialComplex(K);F
  @gapprompt|>F @gapinput|K:=SC(K);F
  @gapprompt|>F @gapinput|if not SCIsStronglyConnected(K) then Print("WARNING!\n"); fi;F
  @gapprompt|>F @gapinput|return SCExportIsoSig( K );F
  @gapprompt|>F @gapinput|end;F
  function( m ) ... end
  
  @gapprompt|gap>F @gapinput|DD:=[];;F
  @gapprompt|gap>F @gapinput|for x in D doF
  @gapprompt|>F @gapinput|y:=Classify(x,inv3);F
  @gapprompt|>F @gapinput|Add(DD,List(y,z->z[1]));F
  @gapprompt|>F @gapinput|od;F
  
  @gapprompt|gap>F @gapinput|List(DD,Size);F
  [ 9, 1, 3, 3, 3, 1, 1, 1, 1, 1, 2, 1, 2, 7, 4, 4, 3, 1, 1, 1, 1, 3, 1, 1, 3 ]
  
\end{Verbatim}
 The function \texttt{PoincareCubeCWCompex()} applies cell simplifications in its construction of the quotient of a
CW\texttt{\symbol{45}}complex. A variant \texttt{PoincareCubeCWCompexNS()} performs no cell simplifications and thus returns a bigger cell complex which
we can attempt to use to establish further homeomorphisms. This is done in the
following session and succeeds in showing that there are at most 51 distinct
homeomorphism types of cube manifolds. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|DD:=List(DD,x->List(x,y->PoincareCubeCWComplexNS(B
  @gapprompt|>B @gapinput|y!.cubeFacePairings[1],y!.cubeFacePairings[2],y!.cubeFacePairings[3])));;B
  
  @gapprompt|gap>B @gapinput|D:=[];;B
  @gapprompt|gap>B @gapinput|for x in DD doB
  @gapprompt|>B @gapinput|y:=Classify(x,inv3);B
  @gapprompt|>B @gapinput|Add(D,List(y,z->z[1]));B
  >od;;
  
  @gapprompt|gap>B @gapinput|List(D,Size);B
  [ 8, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 4, 4, 4, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
\end{Verbatim}
 Making further modifications to the cell structures of the manifolds that
leave their homeomorphism types unchanged can help to identify further
simplicial isomorphisms between barycentric subdivisions. For instance, the
following commands succeed in establishing that there are at most 45 distinct
homeomorphism types of cube manifolds. 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|DD:=[];;E
  @gapprompt|gap>E @gapinput|for x in D doE
  @gapprompt|>E @gapinput|if Length(x)>1 thenE
  @gapprompt|>E @gapinput|Add(DD, List(x,y->BarycentricallySimplifiedComplex(y)));E
  @gapprompt|>E @gapinput|else Add(DD,x);E
  @gapprompt|>E @gapinput|fi;E
  @gapprompt|>E @gapinput|od;E
  @gapprompt|gap>E @gapinput|D:=[];;E
  
  @gapprompt|gap>E @gapinput|for x in DD doE
  @gapprompt|>E @gapinput|y:=Classify(x,inv3);E
  @gapprompt|>E @gapinput|Add(D,List(y,z->z[1]));E
  @gapprompt|>E @gapinput|od;E
  
  @gapprompt|gap>E @gapinput|List(D,Size);E
  [ 7, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
  @gapprompt|gap>E @gapinput|DD:=List(D,x->List(x,y->PoincareCubeCWComplexNS(E
  @gapprompt|>E @gapinput|y!.cubeFacePairings[1],y!.cubeFacePairings[2],y!.cubeFacePairings[3])));;E
  
  @gapprompt|gap>E @gapinput|D1:=[];;E
  @gapprompt|gap>E @gapinput|for x in DD doE
  @gapprompt|>E @gapinput|if Length(x)>1 thenE
  @gapprompt|>E @gapinput|Add(D1, List(x,y->BarycentricallySimplifiedComplex(RegularCWComplex(BarycentricSubdivision(y)))));E
  @gapprompt|>E @gapinput|else Add(D1,x);E
  @gapprompt|>E @gapinput|fi;E
  @gapprompt|>E @gapinput|od;E
  
  @gapprompt|gap>E @gapinput|DD:=[];;E
  @gapprompt|gap>E @gapinput|for x in D1 doE
  @gapprompt|>E @gapinput|y:=Classify(x,inv3);E
  @gapprompt|>E @gapinput|Add(DD,List(y,z->z[1]));E
  @gapprompt|>E @gapinput|od;;E
  
  @gapprompt|gap>E @gapinput|Print(List(DD,Size),"\n");E
  [ 6, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 2, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 2 ]
  
\end{Verbatim}
 

The two manifolds in DD[14] have fundamental group $C_2$ and are thus lens spaces. There is only one homeomorphism class of such lens
spaces and so these two manifolds are homeomorphic. The three manifolds in
DD[17] are lens spaces with fundamental group $C_4$. Again, there is only one homeomorphism class of such lens spaces and so
these three manifolds are homeomorphic. The two manifolds in DD[25] have
trivial fundamental group and are hence both homeomorphic to the
3\texttt{\symbol{45}}sphere. These observations mean that there are at most 41
closed manifolds arising from a cube by identifying the cube's faces pairwise. 

 These observations can be incorporated into our list DD of equivalence classes
of manifolds as follows. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DD[14]:=DD[14]{[1]};;|
  !gapprompt@gap>| !gapinput@DD[17]:=DD[17]{[1]};;|
  !gapprompt@gap>| !gapinput@DD[25]:=DD[25]{[1]};;|
  !gapprompt@gap>| !gapinput@List(DD,Size);|
  [ 6, 1, 3, 3, 2, 1, 1, 1, 1, 1, 2, 1, 2, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{There are precisely 18 orientable cube manifolds, of which 9 are spherical and
5 are euclidean}}\logpage{[ 4, 12, 0 ]}
\hyperdef{L}{X7B63C22C80E53758}{}
{
 The following commands show that there are at least 18 and at most 21
orientable cube manifolds. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@DDorient:=Filtered(DD,x->Homology(x[1],3)=[0]);;|
  !gapprompt@gap>| !gapinput@List(DDorient,Size);|
  [ 1, 1, 1, 1, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
  
\end{Verbatim}
 The next commands show that the fundamental groups of the two manifolds in
DDorient[7] are isomorphic to $\mathbb Z \times \mathbb Z : \mathbb Z$, and that the fundamental groups of the three manifolds in DDorient[9] are
isomorphic to $\mathbb Z$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g1:=FundamentalGroup(DDorient[7][1]);;|
  !gapprompt@gap>| !gapinput@g2:=FundamentalGroup(DDorient[7][2]);;|
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(g1);|
  [ f1^-1*f2*f1*f2^-1, f3^-1*f1*f3*f1, f3^-1*f2^-1*f3*f2^-1 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(g2);|
  [ f1*f2*f1^-1*f2^-1, f1^-1*f3*f1^-1*f3^-1, f3*f2*f3^-1*f2 ]
  
  !gapprompt@gap>| !gapinput@h1:=FundamentalGroup(DDorient[9][1]);;|
  !gapprompt@gap>| !gapinput@h2:=FundamentalGroup(DDorient[9][2]);;|
  !gapprompt@gap>| !gapinput@h3:=FundamentalGroup(DDorient[9][3]);;|
  !gapprompt@gap>| !gapinput@StructureDescription(h1);|
  "Z"
  !gapprompt@gap>| !gapinput@StructureDescription(h2);|
  "Z"
  !gapprompt@gap>| !gapinput@StructureDescription(h3);|
  "Z"
  
\end{Verbatim}
 Since neither $\mathbb Z\times \mathbb Z : \mathbb Z$ nor $\mathbb Z$ is a free product of two non\texttt{\symbol{45}}trivial groups we conclude
that the manifolds in DDorient[7] and DDorient[9] are prime. Since oriented
prime 3\texttt{\symbol{45}}manifolds are determined up to homeomorphism by
their fundamental groups we can conclude that there are precisely 18
orientable closed manifolds arising from a cube by identifying the cube's
faces pairwise. 

 A compact 3\texttt{\symbol{45}}manifold $M$ is \emph{spherical} if it is of the form $M=S^3/\Gamma$ where $\Gamma$ is a finite group acting freely as rotations on $S^3$. The fundamental group of $M$ is then the finite group $\Gamma$. Perelmen showed that a compact 3\texttt{\symbol{45}}manifold is spherical if
and only if its fundamental group is finite. 

 A compact 3\texttt{\symbol{45}}manifold is \emph{euclidean} if it is of the form $M=\mathbb R^3/\Gamma$ where $\Gamma$ is a group of affine transformations acting freely on $\mathbb R^3$. The fundamental group is then $\Gamma$ and is called a \emph{Bieberbach group} of dimension 3. It can be shown that a group $\Gamma$ is isomorphic to a Bieberbach group of dimension $n$ if and only if there is a short exact sequence $\mathbb Z^n \rightarrowtail \Gamma \twoheadrightarrow P$ with $P$ a finite group. 

The following command establishes that there are precisely 9 orientable
spherical manifolds and 5 closed orientable euclidean manifolds arising from
pairwise identifications of the faces of the cube. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@List(OrientableManifolds,ManifoldType);|
  [ "euclidean", "other", "other", "spherical", "other", "euclidean", 
    "euclidean", "spherical", "other", "spherical", "spherical", "spherical", 
    "spherical", "euclidean", "spherical", "spherical", "euclidean", "spherical" ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cube manifolds with boundary}}\logpage{[ 4, 13, 0 ]}
\hyperdef{L}{X796BF3817BD7F57D}{}
{
 If a space $Y$ obtained from identifying faces of the cube fails to be a manifold then it
fails because one or more vertices of $Y$ fail to have a spherical link. By using barycentric subdivision if necessary,
we can ensure that the stars of any two non\texttt{\symbol{45}}manifold
vertices of $Y$ have trivial intersection. Removing the stars of the
non\texttt{\symbol{45}}manifold vertices from $Y$ yields a 3\texttt{\symbol{45}}manifold with boundary $\hat Y$. 

The following commands show that there are 367 combinatorially different
regular CW\texttt{\symbol{45}}complexes $Y$ that arise by identifying faces of a cube in pairs and which fail to be
manifolds. The commands also show that these spaces give rise to at least 180
non\texttt{\symbol{45}}homeomorphic manifolds $\hat Y$ with boundary. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A1:= [ [1,2], [3,4], [5,6] ];;|
  !gapprompt@gap>| !gapinput@A2:=[ [1,2], [3,5], [4,6] ];;|
  !gapprompt@gap>| !gapinput@A3:=[ [1,4], [2,6], [3,5] ];;|
  !gapprompt@gap>| !gapinput@D8:=DihedralGroup(IsPermGroup,8);;|
  
  !gapprompt@gap>| !gapinput@NonManifolds:=[];;|
  !gapprompt@gap>| !gapinput@for A in [A1,A2,A3] do|
  !gapprompt@>| !gapinput@for x in D8 do|
  !gapprompt@>| !gapinput@for y in D8 do|
  !gapprompt@>| !gapinput@for z in D8 do|
  !gapprompt@>| !gapinput@G:=[x,y,z];|
  !gapprompt@>| !gapinput@F:=PoincareCubeCWComplex(A,G);|
  !gapprompt@>| !gapinput@b:=IsClosedManifold(F);|
  !gapprompt@>| !gapinput@if b=false then Add(NonManifolds,F); fi;|
  !gapprompt@>| !gapinput@od;od;od;od;|
  
  !gapprompt@gap>| !gapinput@D:=Classify(NonManifolds,inv3); #See above for inv3|
  !gapprompt@gap>| !gapinput@D:=List(D,x->x[1]);;|
  !gapprompt@gap>| !gapinput@Size(D);|
  367
  
  !gapprompt@gap>| !gapinput@M:=List(D,ThreeManifoldWithBoundary);;|
  !gapprompt@gap>| !gapinput@C:=Classify(M,invariant1);; #See above for invariant1       |
  !gapprompt@gap>| !gapinput@List(C,Size);|
  [ 33, 13, 3, 18, 21, 7, 6, 13, 51, 2, 1, 15, 11, 11, 1, 35, 2, 2, 6, 15, 
    17, 2, 3, 2, 14, 17, 3, 1, 25, 8, 4, 1, 4 ]
  
  !gapprompt@gap>| !gapinput@inv5:=function(m)                       |
  !gapprompt@>| !gapinput@local B;|
  !gapprompt@>| !gapinput@B:=BoundaryOfPureRegularCWComplex(m);;|
  !gapprompt@>| !gapinput@return invariant1(B);|
  !gapprompt@>| !gapinput@end;;|
  
  !gapprompt@gap>| !gapinput@CC:=RefineClassification(C,inv5);;|
  !gapprompt@gap>| !gapinput@List(CC,Size);|
  [ 25, 5, 3, 5, 4, 4, 2, 1, 11, 3, 4, 7, 3, 6, 4, 1, 5, 1, 1, 5, 1, 13, 4, 
    6, 40, 1, 2, 1, 11, 4, 5, 3, 1, 2, 7, 4, 1, 14, 11, 10, 2, 2, 6, 9, 3, 3, 
    2, 15, 2, 3, 2, 14, 17, 2, 1, 1, 4, 7, 14, 8, 3, 1, 1, 4 ]
  
  !gapprompt@gap>| !gapinput@CC:=RefineClassification(CC,invariant2);;|
  !gapprompt@gap>| !gapinput@List(CC,Size);                              |
  [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 3, 1, 1, 2, 1, 2, 1, 4, 2, 3, 2, 3, 
    4, 3, 2, 1, 1, 3, 2, 4, 3, 1, 1, 5, 1, 1, 3, 1, 1, 1, 13, 3, 1, 4, 2, 1, 
    2, 2, 3, 3, 3, 4, 4, 2, 4, 4, 4, 4, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 2, 3, 4, 3, 1, 2, 3, 2, 3, 4, 3, 3, 2, 2, 1, 1, 2, 1, 1, 2, 
    1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 10, 5, 2, 3, 2, 14, 17, 1, 1, 1, 
    1, 4, 5, 2, 9, 1, 4, 7, 1, 3, 1, 1, 4 ]
  !gapprompt@gap>| !gapinput@Length(CC);|
  180
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Octahedral manifolds}}\logpage{[ 4, 14, 0 ]}
\hyperdef{L}{X7EC4359B7DF208B0}{}
{
 The above construction of 3\texttt{\symbol{45}}manifolds as quotients of a
cube can be extended to other polytopes. A polytope of particular interest,
and one that appears several times in the classic book on
Three\texttt{\symbol{45}}Manifolds by William Thurston \cite{thurston}, is the octahedron. The function \texttt{PoincareOctahahedronCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from an octahedron by identifying the
eight faces pairwise; the vertices and faces of the octahedron are numbered as
follows. 

  

The following commands construct a spherical 3\texttt{\symbol{45}}manifold Y
with fundamental group equal to the binary tetrahedral group $G$. The commands then use the universal cover of this manifold to construct the
first four terms of a free periodic $\mathbb ZG$\texttt{\symbol{45}}resolution of $\mathbb Z$ of period $4$. The resolution has one free generator in dimensions $4n$ and $4n+3$ for $n\ge 0$. It has two free generators in dimensions $4n+1$ and $4n+2$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|L:=[ [ 1, 4, 5 ], [ 2, 6, 3 ] ];;A
  @gapprompt|gap>A @gapinput|M:=[ [ 3, 4, 5 ], [ 6, 1, 2 ] ];;A
  @gapprompt|gap>A @gapinput|N:=[ [ 2, 3, 5 ], [ 6, 4, 1 ] ];;A
  @gapprompt|gap>A @gapinput|P:=[ [ 1, 2, 5 ], [ 6, 3, 4 ] ];;A
  @gapprompt|gap>A @gapinput|Y:=PoincareOctahedronCWComplex(L,M,N,P);;A
  @gapprompt|gap>A @gapinput|IsClosedManifold(Y);A
  true
  
  @gapprompt|gap>A @gapinput|G:=FundamentalGroup(Y);;A
  @gapprompt|gap>A @gapinput|StructureDescription(G);A
  "SL(2,3)"
  
  @gapprompt|gap>A @gapinput|R:=ChainComplexOfUniversalCover(Y);A
  Equivariant chain complex of dimension 3
  
  @gapprompt|gap>A @gapinput|List([0..3],R!.dimension);A
  [ 1, 2, 2, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Dodecahedral manifolds}}\logpage{[ 4, 15, 0 ]}
\hyperdef{L}{X85FFF9B97B7AD818}{}
{
 Another polytope of interest, and one that can be used to construct the
Poincare homology sphere, is the dodecahedron. The function \texttt{PoincareDodecahedronCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a dodecahedron by identifying the $12$ pentagonal faces pairwise; the vertices of the prism are numbered as follows. 

  

The following commands construct the Poincare homology $3$\texttt{\symbol{45}}sphere (with fundamental group equal to the binary
icosahedral group of order 120). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=PoincareDodecahedronCWComplex(|
  !gapprompt@>| !gapinput@[[1,2,3,4,5],[6,7,8,9,10]],|
  !gapprompt@>| !gapinput@[[1,11,16,12,2],[19,9,8,18,14]],|
  !gapprompt@>| !gapinput@[[2,12,17,13,3],[20,10,9,19,15]],|
  !gapprompt@>| !gapinput@[[3,13,18,14,4],[16,6,10,20,11]],|
  !gapprompt@>| !gapinput@[[4,14,19,15,5],[17,7,6,16,12]],|
  !gapprompt@>| !gapinput@[[5,15,20,11,1],[18,8,7,17,13]]);|
  Regular CW-complex of dimension 3
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@List([0..3],n->Homology(Y,n));|
  [ [ 0 ], [  ], [  ], [ 0 ] ]
  !gapprompt@gap>| !gapinput@StructureDescription(FundamentalGroup(Y));|
  "SL(2,5)"
  
\end{Verbatim}
 The following commands construct Seifert\texttt{\symbol{45}}Weber space, a
rational homology sphere. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=PoincareDodecahedronCWComplex(|
  !gapprompt@>| !gapinput@[[1,2,3,4,5],[7,8,9,10,6]],|
  !gapprompt@>| !gapinput@[[1,11,16,12,2],[9,8,18,14,19]],|
  !gapprompt@>| !gapinput@[[2,12,17,13,3],[10,9,19,15,20]],|
  !gapprompt@>| !gapinput@[[3,13,18,14,4],[6,10,20,11,16]],|
  !gapprompt@>| !gapinput@[[4,14,19,15,5],[7,6,16,12,17]],|
  !gapprompt@>| !gapinput@[[5,15,20,11,1],[8,7,17,13,18]]);|
  Regular CW-complex of dimension 3
  !gapprompt@gap>| !gapinput@IsClosedManifold(W);|
  true
  !gapprompt@gap>| !gapinput@List([0..3],n->Homology(W,n));|
  [ [ 0 ], [ 5, 5, 5 ], [  ], [ 0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Prism manifolds}}\logpage{[ 4, 16, 0 ]}
\hyperdef{L}{X78B75E2E79FBCC54}{}
{
 Another polytope of interest is the prism constructed as the direct product $D_n\times [0,1]$ of an n\texttt{\symbol{45}}gonal disk $D_n$ with the unit interval. The function \texttt{PoincarePrismCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a prism with even $n\ge 4$ by identifying the $n+2$ faces pairwise; the vertices of the prism are numbered as follows. 

  

The case $n=4$ is that of a cube. The following commands construct a manifold $Y$ arising from a hexagonal prism ($n=6$) with fundamental group $\pi_1Y=C_5\times Q_{32}$ equal to the direct product of the cyclic group of order $5$ and the quaternion group of order $32$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[[1,2,3,4,5,6],[11,12,7,8,9,10]];;                 |
  !gapprompt@gap>| !gapinput@M:=[[1,7,8,2],[4,5,11,10]];;             |
  !gapprompt@gap>| !gapinput@N:=[[2,8,9,3],[6,1,7,12]];;             |
  !gapprompt@gap>| !gapinput@P:=[[3,9,10,4],[6,12,11,5]];;             |
  !gapprompt@gap>| !gapinput@Y:=PoincarePrismCWComplex(L,M,N,P);;|
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(Y);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C5 x Q32"
  
\end{Verbatim}
 

An exhaustive search through all manifolds constructed from a hexagonal prism
by identify faces pairwise shows that the finite groups arising as fundamental
groups are precisely: $ Q_8$, $Q_{16}$, $C_4$, $ C_3 : C_4$, $ C_5 : C_4$, $ C_8$, $C_{16}$, $C_{12}$, $C_{20}$, $C_2$, $ C_6$, $ C_3 \times Q_8$, $ C_3 \times Q_{16}$, $C_5 \times Q_{32} $. Each of these finite groups $G=\pi_1Y$ is either cyclic (in which case the corresponding manifold is a lens space) or
else has the propert that $G/Z(G)$ is dihedral (in which case the corresponding manifold is called a \emph{prism manifold}). The majority of the manifolds arising from a hexagonal prism have infinite
fundamental group. 

 Infinite families of spherical $3$\texttt{\symbol{45}}maniolds can be constructed from the infinite family of
prisms. For instance, a prism manifold which we denote by $P_r$ can be obtained from a prism $D_{2r}\times [0,1]$ by identifying the left and right side under a twist of $\pi/r$, and identifying opposite square faces under a twist of $\pi/2$. Its fundamental group $\pi_1P_r$ is the binary dihedral group of order $4r$. The following commands construct $P_r$ for $r=3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=[[1,2,3,4,5,6],[8,9,10,11,12,7]];;|
  !gapprompt@gap>| !gapinput@M:=[[1,7,8,2],[11,10,4,5]];;|
  !gapprompt@gap>| !gapinput@N:=[[2,8,9,3],[12,11,5,6]];;|
  !gapprompt@gap>| !gapinput@P:=[[3,9,10,4],[7,12,6,1]];;|
  !gapprompt@gap>| !gapinput@Y:=PoincarePrismCWComplex(L,M,N,P);;|
  !gapprompt@gap>| !gapinput@IsClosedManifold(Y);|
  true
  !gapprompt@gap>| !gapinput@StructureDescription(FundamentalGroup(Y));|
  "C3 : C4"
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Bipyramid manifolds}}\logpage{[ 4, 17, 0 ]}
\hyperdef{L}{X7F31DFDA846E8E75}{}
{
 Yet another polytope of interest is the bipyramid constructed as the
suspension of an n\texttt{\symbol{45}}gonal disk $D_n$. The function \texttt{PoincareBipyramidCWComplex()} can be used to construct any 3\texttt{\symbol{45}}dimensional
CW\texttt{\symbol{45}}complex arising from a bipyramid with $n\ge 3$ by identifying the $2n$ faces pairwise; the vertices of the prism are numbered as follows. 

  

 For $n=4$ the bipyramid is the octahedron. }

 }

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

Pairwise distances between $74$ points from some metric space have been recorded and stored in a $74\times 74$ matrix $D$. The following commands load the matrix, construct a filtration of length $100$ on the first two dimensions of the assotiated clique complex (also known as
the \emph{Vietoris\texttt{\symbol{45}}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 first 54 terms in the filtration each have 74 path components
\texttt{\symbol{45}}\texttt{\symbol{45}} one for each point in the sample.
During the next 9 filtration terms the number of path components reduces,
meaning that sample points begin to coalesce due to the formation of edges in
the simplicial complexes. Then, two path components persist over an interval
of 18 filtration terms, before they eventually coalesce. 

 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}
  

 Interpreting short bars as noise, we see for instance that the $65$th term in the filtration could be regarded as noiseless and belonging to a
"stable interval" in the filtration with regards to first and second homology
functors. The following command displays (up to homotopy) the $1$ skeleton of the simplicial complex arizing as the $65$\texttt{\symbol{45}}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 suggest that the dataset contains two persistent path
components (or clusters), and that each path component is in some sense
periodic. The final command displays one possible representation of the data
as points on two circles. 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 1, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

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

  }

 }

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

The following example reads in a set $S$ of vectors of rational numbers. It uses the Euclidean distance $d(u,v)$ between vectors. It fixes some vector $u_0\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$\texttt{\symbol{45}}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 they 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}}\label{pointcloud}
\logpage{[ 5, 2, 1 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

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

  }

 }

 
\section{\textcolor{Chapter }{Some tools for handling pure complexes}}\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X7BBDE0567DB8C5DA}{}
{
 A CW\texttt{\symbol{45}}complex $X$ is said to be \emph{pure} if all of its top\texttt{\symbol{45}}dimensional cells have a common
dimension. There are instances where such a space $X$ provides a convenient ambient space whose subspaces can be used to model
experimental data. For instance, the plane $X=\mathbb R^2$ admits a pure regular CW\texttt{\symbol{45}}structure whose $2$\texttt{\symbol{45}}cells are open unit squares with integer coordinate
vertices. An alternative, and sometimes preferrable, pure regular
CW\texttt{\symbol{45}}structure on $\mathbb R^2$ is one where the $2$\texttt{\symbol{45}}cells are all reguar hexagons with sides of unit length.
Any digital image can be thresholded to produce a
black\texttt{\symbol{45}}white image and this black\texttt{\symbol{45}}white
image can naturally be regared as a finite pure cellular subcomplex of either
of the two proposed CW\texttt{\symbol{45}}structures on $\mathbb R^2$. Analogously, thresholding can be used to represent $3$\texttt{\symbol{45}}dimensional greyscale images as finite pure cellular
subspaces of cubical or permutahedral CW\texttt{\symbol{45}}structures on $\mathbb R^3$, and to represent RGB colour photographs as analogous subcomplexes of $\mathbb R^5$. 

 In this section we list a few functions for performing basic operations on $n$\texttt{\symbol{45}}dimensional pure cubical and pure permutahedral finite
subcomplexes $M$ of $X=R^n$. We refer to $M$ simply as a \emph{pure complex}. In subsequent sections we demonstrate how these few functions on pure
complexes allow for in\texttt{\symbol{45}}depth analysis of experimental data. 

(\textsc{Aside.} The basic operations could equally well be implemented for other
CW\texttt{\symbol{45}}decompositions of $X=\mathbb R^n$ such as the regular CW\texttt{\symbol{45}}decompositions arising as the
tessellations by a fundamental domain of a Bieberbach group (=torsion free
crytallographic group). Moreover, the basic operations could also be
implemented for other manifolds such as an $n$\texttt{\symbol{45}}torus $X=S^1\times S^1 \times \cdots \times S^1$ or $n$\texttt{\symbol{45}}sphere $X=S^n$ or for $X$ the universal cover of some interesting hyperbolic $3$\texttt{\symbol{45}}manifold. An example use of the ambient manifold $X=S^1\times S^1\times S^1$ could be for the construction of a cellular subspace recording the time of
day, day of week and week of the year of crimes committed in a population.) 

\textsc{Basic operations returning pure complexes.} ( Function descriptions available \href{../doc/chap1_mj.html#X7FD50DF6782F00A0} {here}.) 
\begin{itemize}
\item \texttt{PureCubicalComplex(binary array)}
\item \texttt{PurePermutahedralComplex(binary array)}
\item  \texttt{ReadImageAsPureCubicalComplex(file,threshold)}
\item  \texttt{ReadImageSquenceAsPureCubicalComplex(file,threshold)}
\item \texttt{PureComplexBoundary(M)}
\item  \texttt{PureComplexComplement(M)} 
\item  \texttt{PureComplexRandomCell(M)}
\item  \texttt{PureComplexThickened(M)}
\item \texttt{ContractedComplex(M, optional subcomplex of M)}
\item \texttt{ExpandedComplex(M, optional supercomplex of M)}
\item  \texttt{PureComplexUnion(M,N)}
\item  \texttt{PureComplexIntersection(M,N)}
\item  \texttt{PureComplexDifference(M,N)}
\item  \texttt{FiltrationTerm(F,n)}
\end{itemize}
 

\textsc{Basic operations returning filtered pure complexes.} 
\begin{itemize}
\item  \texttt{PureComplexThickeningFiltration(M,length)}
\item  \texttt{ReadImageAsFilteredPureCubicalComplex(file,length)}
\end{itemize}
 }

 
\section{\textcolor{Chapter }{Digital image analysis and persistent homology}}\logpage{[ 5, 4, 0 ]}
\hyperdef{L}{X79616D12822FDB9A}{}
{
 

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,40);|
  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 there are $14$ (or possibly $17$) holes in these $20$ objects. 
\subsection{\textcolor{Chapter }{Naive example of image segmentation by automatic thresholding}}\logpage{[ 5, 4, 1 ]}
\hyperdef{L}{X8066F9B17B78418E}{}
{
 Assuming that short bars and isolated points in the barcodes represent noise
while long bars represent essential features, a "noiseless" representation of
the image should correspond to a term in the filtration corresponding to a
column in the barcode incident with all the long bars but incident with no
short bars or isolated points. There is no noiseless term in the above
filtration of length 40. However (in conjunction with the next subsection) the
following commands confirm that the 64th term in the filtration of length 500
is such a term and display this term as a binary image. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,500);;|
  !gapprompt@gap>| !gapinput@Y:=FiltrationTerm(F,64);            |
  Pure cubical complex of dimension 2.
  !gapprompt@gap>| !gapinput@BettiNumber(Y,0);|
  20
  !gapprompt@gap>| !gapinput@BettiNumber(Y,1);|
  14
  !gapprompt@gap>| !gapinput@Display(Y);|
  
\end{Verbatim}
  }

 
\subsection{\textcolor{Chapter }{Refining the filtration}}\logpage{[ 5, 4, 2 ]}
\hyperdef{L}{X7E6436E0856761F2}{}
{
 The first filtration for the image has 40 terms. One may wish to investigate a
filtration with more terms, say 500 terms, with a view to analysing, say,
those 1\texttt{\symbol{45}}cycles that are born by term 25 of the filtration
and that die between terms 50 and 60. The following commands produce the
relevant barcode showing that there is precisely one such
1\texttt{\symbol{45}}cycle. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,500);;|
  !gapprompt@gap>| !gapinput@L:=[20,60,61,62,63,64,65,66,67,68,69,70];;          |
  !gapprompt@gap>| !gapinput@T:=FiltrationTerms(F,L);;|
  !gapprompt@gap>| !gapinput@P0:=PersistentBettiNumbers(T,0);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P0);|
  !gapprompt@gap>| !gapinput@P1:=PersistentBettiNumbers(T,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P1);|
  
\end{Verbatim}
 

$\beta_0$:

  

 $\beta_1$:

  }

 
\subsection{\textcolor{Chapter }{Background to the data}}\logpage{[ 5, 4, 3 ]}
\hyperdef{L}{X7D512DA37F789B4C}{}
{
 

The following image was used in the example. 

  }

 }

 
\section{\textcolor{Chapter }{A second example of digital image segmentation}}\logpage{[ 5, 5, 0 ]}
\hyperdef{L}{X7A8224DA7B00E0D9}{}
{
 In order to automatically count the number of coins in this picture 

  

 we can load the image as a filtered pure cubical complex $F$ of filtration length 40 say, and observe the degree zero persistent Betti
numbers to establish that the 28\texttt{\symbol{45}}th term or so of $F$ seems to be 'noise free' in degree zero. We can then set $M$ equal to the 28\texttt{\symbol{45}}th term of $F$ and thicken $M$ a couple of times say to remove any tiny holes it may have. We can then
construct the complement $C$ of $M$. Then we can construct a 'neighbourhood thickening' filtration $T$ of $C$ with say $50$ consecutive thickenings. The degree one persistent barcode for $T$ has $24$ long bars, suggesting that the original picture consists of $24$ coins. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex("my_coins.png",40);;|
  !gapprompt@gap>| !gapinput@M:=FiltrationTerm(F,24);;  #Chosen after viewing degree 0 barcode for F|
  !gapprompt@gap>| !gapinput@M:=PureComplexThickened(M);;|
  !gapprompt@gap>| !gapinput@M:=PureComplexThickened(M);;|
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(M);;|
  !gapprompt@gap>| !gapinput@T:=ThickeningFiltration(C,50);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbers(T,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The pure cubical complex \texttt{W:=PureComplexComplement(FiltrationTerm(T,25))} has the correct number of path components, namely $25$, but its path components are very much subsets of the regions in the image
corresponding to coins. The complex $W$ can be thickened repeatedly, subject to no two path components being allowed
to merge, in order to obtain a more realistic image segmentation with path
components corresponding more closely to coins. This is done in the follow
commands which use a makeshift function \texttt{Basins(L)} available \href{tutex/basins.g} {here}. The commands essentially implement a standard watershed segmentation
algorithm but do so by using the language of filtered pure cubical complexes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@W:=PureComplexComplement(FiltrationTerm(T,25));;|
  !gapprompt@gap>| !gapinput@L:=[];;|
  !gapprompt@gap>| !gapinput@for i in [1..PathComponentOfPureComplex(W,0)] do|
  !gapprompt@gap>| !gapinput@P:=PathComponentOfPureComplex(W,i);;|
  !gapprompt@gap>| !gapinput@Q:=ThickeningFiltration(P,50,M);;|
  !gapprompt@gap>| !gapinput@Add(L,Q);;|
  !gapprompt@gap>| !gapinput@od;;|
  
  !gapprompt@gap>| !gapinput@B:=Basins(L);|
  !gapprompt@gap>| !gapinput@Display(B);|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{A third example of digital image segmentation}}\logpage{[ 5, 6, 0 ]}
\hyperdef{L}{X8290E7D287F69B98}{}
{
 The following image is number 3096 in the \href{https://www2.eecs.berkeley.edu/Research/Projects/CS/vision/bsds/} {BSDS500 database of images} \cite{MartinFTM01}. 

  

A common first step in segmenting such an image is to appropriately threshold
the corresponding gradient image. 

   

 The following commands use the thresholded gradient image to produce an
outline of the aeroplane. The outline is a pure cubical complex with one path
component and with first Betti number equal to 1. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/3096b.jpg");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,30);;|
  !gapprompt@gap>| !gapinput@F:=ComplementOfFilteredPureCubicalComplex(F);;|
  !gapprompt@gap>| !gapinput@M:=FiltrationTerm(F,27);;  #Thickening chosen based on degree 0 barcode|
  !gapprompt@gap>| !gapinput@Display(M);;|
  !gapprompt@gap>| !gapinput@P:=List([1..BettiNumber(M,0)],n->PathComponentOfPureComplex(M,n));;|
  !gapprompt@gap>| !gapinput@P:=Filtered(P,m->Size(m)>10);;|
  !gapprompt@gap>| !gapinput@M:=P[1];;|
  !gapprompt@gap>| !gapinput@for m in P do|
  !gapprompt@>| !gapinput@M:=PureComplexUnion(M,m);;|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@T:=ThickeningFiltration(M,50);;|
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,11),0);|
  1
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,11),1);|
  1
  !gapprompt@gap>| !gapinput@BettiNumber(FiltrationTerm(T,12),1);|
  0
  !gapprompt@gap>| !gapinput@#Confirmation that 11-th filtration term has one hole and the 12-th term is contractible.|
  !gapprompt@gap>| !gapinput@C:=FiltrationTerm(T,11);;|
  !gapprompt@gap>| !gapinput@for n in Reversed([1..10]) do|
  !gapprompt@>| !gapinput@C:=ContractedComplex(C,FiltrationTerm(T,n));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@C:=PureComplexBoundary(PureComplexThickened(C));;|
  !gapprompt@gap>| !gapinput@H:=HomotopyEquivalentMinimalPureCubicalSubcomplex(FiltrationTerm(T,12),C);;|
  !gapprompt@gap>| !gapinput@B:=ContractedComplex(PureComplexBoundary(H));;|
  !gapprompt@gap>| !gapinput@Display(B);|
  
\end{Verbatim}
  }

 
\section{\textcolor{Chapter }{Naive example of digital image contour extraction}}\logpage{[ 5, 7, 0 ]}
\hyperdef{L}{X7957F329835373E9}{}
{
 The following greyscale image is available from the \href{http://www.ipol.im/pub/art/2014/74/FrechetAndConnectedCompDemo.tgz} {online appendix} to the paper \cite{coeurjolly}. 

  

The following commands produce a picture of contours from this image based on
greyscale values. They also produce a picture of just the closed contours (the
non\texttt{\symbol{45}}closed contours having been homotopy collapsed to
points). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/circularGradient.png");;|
  !gapprompt@gap>| !gapinput@L:=[];;                                                          |
  !gapprompt@gap>| !gapinput@for n in [1..15] do|
  !gapprompt@>| !gapinput@M:=ReadImageAsPureCubicalComplex(file,n*30000);|
  !gapprompt@>| !gapinput@M:=PureComplexBoundary(M);;|
  !gapprompt@>| !gapinput@Add(L,M);|
  !gapprompt@>| !gapinput@od;;|
  !gapprompt@gap>| !gapinput@C:=L[1];;|
  !gapprompt@gap>| !gapinput@for n in [2..Length(L)] do C:=PureComplexUnion(C,L[n]); od;|
  !gapprompt@gap>| !gapinput@Display(C);|
  !gapprompt@gap>| !gapinput@Display(ContractedComplex(C));|
  
\end{Verbatim}
 Contours from the above greyscale image: 

  

 Closed contours from the above greyscale image: 

  

 Very similar results are obtained when applied to the file \texttt{circularGradientNoise.png}, containing noise, available from the \href{http://www.ipol.im/pub/art/2014/74/FrechetAndConnectedCompDemo.tgz} {online appendix} to the paper \cite{coeurjolly}. 

The number of distinct "light sources" in the image can be read from the
countours. Alternatively, this number can be read directly from the barcode
produced by the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,20);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The seventeen bars in the barcode correspond to seventeen light sources. The
length of a bar is a measure of the "persistence" of the corresponding light
source. A long bar may initially represent a cluster of several lights whose
members may eventually be distinguished from each other as new bars (or
persistent homology classes) are created. 

Here the command \texttt{PersistentBettiNumbersAlt} has been used. This command is explained in the following section. 

The follwowing commands use a watershed method to partition the digital image
into regions, one region per light source. A makeshift function \texttt{Basins(L)}, available \href{tutex/basins.g} {here}, is called. (The efficiency of the example could be easily improved. For
simplicity it uses generic commands which, in principle, can be applied to
cubical or permutarhedral complexes of higher dimensions.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=Filename(DirectoriesPackageLibrary("HAP"),"../tutorial/images/circularGradient.png");;|
  !gapprompt@gap>| !gapinput@F:=ReadImageAsFilteredPureCubicalComplex(file,20);;|
  !gapprompt@gap>| !gapinput@FF:=ComplementOfFilteredPureCubicalComplex(F);|
  
  !gapprompt@gap>| !gapinput@W:=(FiltrationTerm(FF,3));|
  !gapprompt@gap>| !gapinput@for n in [4..23] do|
  !gapprompt@>| !gapinput@L:=[];;|
  !gapprompt@>| !gapinput@for i in [1..PathComponentOfPureComplex(W,0)] do|
  !gapprompt@>| !gapinput@ P:=PathComponentOfPureComplex(W,i);;|
  !gapprompt@>| !gapinput@ Q:=ThickeningFiltration(P,150,FiltrationTerm(FF,n));;|
  !gapprompt@>| !gapinput@ Add(L,Q);;|
  !gapprompt@>| !gapinput@od;;|
  !gapprompt@>| !gapinput@W:=Basins(L);|
  !gapprompt@>| !gapinput@od;|
  
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(W);;|
  !gapprompt@gap>| !gapinput@T:=PureComplexThickened(C);; C:=ContractedComplex(T,C);;  |
  !gapprompt@gap>| !gapinput@Display(C);|
  
\end{Verbatim}
 

  }

 
\section{\textcolor{Chapter }{Alternative approaches to computing persistent homology}}\label{secAltPersist}
\logpage{[ 5, 8, 0 ]}
\hyperdef{L}{X7D2CC9CB85DF1BAF}{}
{
 From any sequence $X_0 \subset X_1 \subset X_2 \subset \cdots \subset X_T$ of cellular spaces (such as pure cubical complexes, or cubical complexes, or
simplicial complexes, or regular CW complexes) we can construct a filtered
chain complex $C_\ast X_0 \subset C_\ast X_1 \subset C_\ast X_2 \subset \cdots C_\ast X_T$. The induced homology homomorphisms $H_n(C_\ast X_0,\mathbb F) \rightarrow H_n(C_\ast X_1,\mathbb F) \rightarrow
H_n(C_\ast X_2,\mathbb F) \rightarrow \cdots \rightarrow H_n(C_\ast
X_T,\mathbb F)$ with coefficients in a field $\mathbb F$ can be computed by applying an appropriate sequence of elementary row
operations to the boundary matrices in the chain complex $C_\ast X_T\otimes \mathbb F$; the boundary matrices are sparse and are best represented as such; the row
operations need to be applied in a fashion that respects the filtration. This
method is used in the above examples of persistent homology. The method is not
practical when the number of cells in $X_T$ is large. 

An alternative approach is to construct an admissible discrete vector field on
each term $X_k$ in the filtration. For each vector field there is a
non\texttt{\symbol{45}}regular CW\texttt{\symbol{45}}complex $Y_k$ whose cells correspond to the critical cells in $X_k$ and for which there is a homotopy equivalence $X_k\simeq Y_k$. For each $k$ the composite homomorphism $H_n(C_\ast Y_k, \mathbb F) \stackrel{\cong}{\rightarrow} H_n(C_\ast X_k,
\mathbb F) \rightarrow H_n(C_\ast X_{k+1}, \mathbb F)
\stackrel{\cong}{\rightarrow} H_n(C_\ast Y_{k+1}, \mathbb F)$ can be computed and the persistent homology can be derived from these homology
homomorphisms. This method is implemented in the function \texttt{PersistentBettiNUmbersAlt(X,n,p)} where $p$ is the characteristic of the field, $n$ is the homology degree, and $X$ can be a filtered pure cubical complex, or a filtered simplicial complex, or a
filtered regular CW complex, or indeed a filtered chain complex (represented
in sparse form). This function incorporates the functions \texttt{ContractedFilteredPureCubicalComplex(X)} and \texttt{ContractedFilteredRegularComplex(X)} which respectively input a filtered pure cubical complex and filtered regular
CW\texttt{\symbol{45}}complex and return a filtered complex of the same data
type in which each term of the output filtration is a deformation retract of
the corresponding term in the input filtration. 

In this approach the vector fields on the various spaces $X_k$ are completely independent and so the method lends itself to a degree of easy
parallelism. This is not incorporated into the current implementation. 

 As an illustration we consider a synthetic data set $S$ consisting of $3527$ points sampled, with errors, from an `unknown' manifold $M$ in $\mathbb R^3$. From such a data set one can associate a $3$\texttt{\symbol{45}}dimensional cubical complex $X_0$ consisting of one unit cube centred on each (suitably scaled) data point. A
visualization of $X_0$ is shown below. 

  

 Given a pure cubical complex $X_s$ we construct $X_{s+1} =X_s \cup \{\overline e^3_\lambda\}_{\lambda\in \Lambda}$ by adding to $X_s$ each closed unit cube $\overline e^3_\lambda$ in $\mathbb R^3$ that intersects non\texttt{\symbol{45}}trivially with $X_s$. We construct the filtered cubical complex $X_\ast =\{X_i\}_{0\le i\le 19}$ and compute the persistence matrices $\beta_d^{\ast\ast}$ for $d=0,1,2$ and for $\mathbb Z_2$ coefficients. The filtered complex $X_\ast$ is quite large. In particular, the final space $X_{19}$ in the filtration involves $1\,092727$ vertices, $3\,246354$ edges, $3\,214836$ faces of dimension $2$ and $1\,061208$ faces of dimension $3$. The usual matrix reduction approach to computing persistent Betti numbers
would involve an appropriate row reduction of sparse matrices one of which has
over 3 million rows and 3 million columns. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data247.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);;|
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(T,20);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,[0,1,2]);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
  

The barcodes suggest that the data points might have been sampled from a
manifold with the homotopy type of a torus. 
\subsection{\textcolor{Chapter }{Non\texttt{\symbol{45}}trivial cup product}}\logpage{[ 5, 8, 1 ]}
\hyperdef{L}{X86FD0A867EC9E64F}{}
{
 Of course, a wedge $S^2\vee S^1\vee S^1$ has the same homology as the torus $S^1\times S^1$. By establishing that a 'noise free' model for our data points, say the
10\texttt{\symbol{45}}th term $X_{10}$ in the filtration, has a non\texttt{\symbol{45}}trivial cup product $\cup\colon H^1(X_{10},\mathbb Z) \times H^1(X_{10},\mathbb Z) \rightarrow
H^2(X_{10},\mathbb Z)$ we can eliminate $S^2\vee S^1\vee S^1$ as a candidate from which the data was sampled. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@X10:=RegularCWComplex(FiltrationTerm(F,10));;|
  !gapprompt@gap>| !gapinput@cup:=LowDimensionalCupProduct(X10);;|
  !gapprompt@gap>| !gapinput@cup([1,0],[0,1]);|
  [ 1 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Explicit homology generators}}\logpage{[ 5, 8, 2 ]}
\hyperdef{L}{X783EF0F17B629C46}{}
{
 It could be desirable to obtain explicit representatives of the persistent
homology generators that "persist" through a significant sequence of
filtration terms. There are two such generators in degree $1$ and one such generator in degree $2$. The explicit representatives in degree $n$ could consist of an inclusion of pure cubical complexes $Y_n \subset X_{10}$ for which the incuced homology homomorphism $H_n(Y_n,\mathbb Z) \rightarrow H_n(X_{10},\mathbb Z)$ is an isomorphism, and for which $Y_n$ is minimal in the sense that its homotopy type changes if any one or more of
its top dimensional cells are removed. Ideally the space $Y_n$ should be "close to the original dataset" $X_0$. The following commands first construct an explicit degree $2$ homology generator representative $Y_2\subset X_{10}$ where $Y_2$ is homotopy equivalent to $X_{10}$. They then construct an explicit degree $1$ homology generators representative $Y_1\subset X_{10}$ where $Y_1$ is homotopy equivalent to a wedge of two circles. The final command displays
the homology generators representative $Y_1$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y2:=FiltrationTerm(F,10);;                   |
  !gapprompt@gap>| !gapinput@for t in Reversed([1..9]) do|
  !gapprompt@>| !gapinput@Y2:=ContractedComplex(Y2,FiltrationTerm(F,t));|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Y2:=ContractedComplex(Y2);;|
  
  !gapprompt@gap>| !gapinput@Size(FiltrationTerm(F,10));|
  918881
  !gapprompt@gap>| !gapinput@Size(Y2);                  |
  61618
  
  !gapprompt@gap>| !gapinput@Y1:=PureComplexDifference(Y2,PureComplexRandomCell(Y2));;|
  !gapprompt@gap>| !gapinput@Y1:=ContractedComplex(Y1);;|
  !gapprompt@gap>| !gapinput@Size(Y1);|
  474
  !gapprompt@gap>| !gapinput@Display(Y1);|
  
\end{Verbatim}
 

  

 }

 }

 
\section{\textcolor{Chapter }{Knotted proteins}}\logpage{[ 5, 9, 0 ]}
\hyperdef{L}{X80D0D8EB7BCD05E9}{}
{
 The \href{https://www.rcsb.org/} {Protein Data Bank} contains a wealth of data which can be investigated with respect to
knottedness. Information on a particular protein can be downloaded as a .pdb
file. Each protein consists of one or more chains of amino acids and the file
gives 3\texttt{\symbol{45}}dimensional Euclidean coordinates of the atoms in
amino acids. Each amino acid has a unique "alpha carbon" atom (labelled as
"CA" in the pdb file). A simple 3\texttt{\symbol{45}}dimensional curve, the \emph{protein backbone}, can be constructed through the sequence of alpha carbon atoms. Typically the
ends of the protein backbone lie near the "surface" of the protein and can be
joined by a path outside of the protein to obtain a simple closed curve in
Euclidean 3\texttt{\symbol{45}}space. 

The following command reads in the pdb file for the T.thermophilus 1V2X
protein, which consists of a single chain of amino acids, and uses Asymptote
software to produce an interactive visualization of its backbone. A path
joining the end vertices of the backbone is displayed in blue. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data1V2X.pdb");;|
  !gapprompt@gap>| !gapinput@DisplayPDBfile(file);|
  
\end{Verbatim}
 

   

The next command reads in the pdb file for the T.thermophilus 1V2X protein and
represents it as a $3$\texttt{\symbol{45}}dimensional pure cubical complex $K$. A resolution of $r=5$ is chosen and this results in a representation as a subcomplex $K$ of an ambient rectangular box of volume equal to $184\times 186\times 294$ unit cubes. The complex $K$ should have the homotopy type of a circle and the protein backbone is a
1\texttt{\symbol{45}}dimenional curve that should lie in $K$. The final command displays $K$. 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>E @gapinput|r:=5;;E
  @gapprompt|gap>E @gapinput|K:=ReadPDBfileAsPureCubicalComplex(file,r);;      E
  @gapprompt|gap>E @gapinput|K:=ContractedComplex(K);;E
  @gapprompt|gap>E @gapinput|K!.properties;E
  [ [ "dimension", 3 ], [ "arraySize", [ 184, 186, 294 ] ] ]
  
  @gapprompt|gap>E @gapinput|Display(K);E
  
\end{Verbatim}
 

   

Next we create a filtered pure cubical complex by repeatedly thickening $K$. We perform $15$ thickenings, each thickening being a term in the filtration. The $\beta_1$ barcode for the filtration is displayed. This barcode is a descriptor for the
geometry of the protein. For current purposes it suffices to note that the
first few terms of the filtration have first homology equal to that of a
circle. This indicates that the Euclidean coordinates in the pdb file robustly
determine some knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(K,15);;|
  !gapprompt@gap>| !gapinput@F:=FilteredPureCubicalComplexToCubicalComplex(F);;|
  !gapprompt@gap>| !gapinput@F:=FilteredCubicalComplexToFilteredRegularCWComplex(F);;|
  !gapprompt@gap>| !gapinput@P:=PersistentBettiNumbersAlt(F,1);;|
  !gapprompt@gap>| !gapinput@BarCodeCompactDisplay(P);|
  
\end{Verbatim}
 

  

 The next commands compute a presentation for the fundamental group $\pi_1(\mathbb R^3\setminus K)$ and the Alexander polynomial for the knot. This is the same Alexander
polynomial as for the trefoil knot. Also, Tietze transformations can be used
to see that the fundamental group is the same as for the trefoil knot. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=PureComplexComplement(K);;|
  !gapprompt@gap>| !gapinput@C:=ContractedComplex(C);;|
  !gapprompt@gap>| !gapinput@G:=FundamentalGroup(C);;|
  !gapprompt@gap>| !gapinput@GeneratorsOfGroup(G);|
  [ f1, f2 ]
  !gapprompt@gap>| !gapinput@RelatorsOfFpGroup(G);|
  [ f2*f1^-1*f2^-1*f1^-1*f2*f1 ]
  
  !gapprompt@gap>| !gapinput@AlexanderPolynomial(G);|
  x_1^2-x_1+1
  
\end{Verbatim}
 }

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

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

The following commands first compute the number $h_i$ of non\texttt{\symbol{45}}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$\texttt{\symbol{45}}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
\texttt{\symbol{45}}\texttt{\symbol{45}} all but one of which are of length $1$. For example, there is one $2$\texttt{\symbol{45}}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}
 }

 
\section{\textcolor{Chapter }{Computing homology of a clique complex (Vietoris\texttt{\symbol{45}}Rips
complex) }}\logpage{[ 5, 11, 0 ]}
\hyperdef{L}{X875EE92F7DBA1E27}{}
{
 Topological data analysis provides one motivation for wanting to compute the
homology of a clique complex. Consider for instance the cloud of data points
shown in Example \ref{pointcloud}. This data is a set $S$ of 400 points in the plane. Let $\Gamma$ be the graph with vertex set $S$ and with two vertices joined by an edge if they lie within a Euclidean
distance of 40 of each other. The clique complex $K=K(\Gamma)$ could be studied to see what it reveals about the data. The following commands
construct $K$ and show that it is a 23\texttt{\symbol{45}}dimensional simplicial complex
consisting of a total of 36191976 simplices. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data134.txt");;                              |
  !gapprompt@gap>| !gapinput@Read(file);|
  !gapprompt@gap>| !gapinput@A:=VectorsToSymmetricMatrix(S,EuclideanApproximatedMetric);;|
  !gapprompt@gap>| !gapinput@threshold:=40;; |
  !gapprompt@gap>| !gapinput@grph:=SymmetricMatrixToGraph(A,threshold);;|
  !gapprompt@gap>| !gapinput@dimension_cap:=100;; |
  !gapprompt@gap>| !gapinput@K:=CliqueComplex(grph,dimension_cap);|
  Simplicial complex of dimension 23.
  
  !gapprompt@gap>| !gapinput@Size(K);|
  36191976
  
\end{Verbatim}
 

 The computation of the homology of this clique complex $K$ is a challenge because of its size. If we are only interested in $K$ up to homotopy then we could try to modify the graph $\Gamma$ in such a way that the homotopy type of the clique complex is unchanged but
the size of the clique complex is reduced. This is done in the following
commands, producing a smaller $19$\texttt{\symbol{45}}dimensional simplicial complex $K$ with 4180652 simplices. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@ContractGraph(grph);;|
  
  !gapprompt@gap>| !gapinput@dimension_cap:=100;; |
  !gapprompt@gap>| !gapinput@K:=CliqueComplex(grph,dimension_cap);|
  Simplicial complex of dimension 19.
  
  !gapprompt@gap>| !gapinput@Size(K);|
  4180652
  
\end{Verbatim}
 

To compute the homology of $K$ in degrees $0$ to $5$ say, we could represent $K$ as a regular CW\texttt{\symbol{45}}complex $Y$ and then compute the homology of $Y$ as follows. The homology $H_n(K)=\mathbb Z$ for $n=0,1$ and $H_n(K)= 0$ for $n=2,3,4,5$ is consistent with the data having been sampled from a space with the homotopy
type of a circle. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(K);|
  Regular CW-complex of dimension 19
  
  !gapprompt@gap>| !gapinput@Homology(Y,0);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,1);|
  [ 0 ]
  !gapprompt@gap>| !gapinput@Homology(Y,2);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,3);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,4);|
  [  ]
  !gapprompt@gap>| !gapinput@Homology(Y,5)|
  [  ]
  
\end{Verbatim}
 }

 }

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

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

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

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

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

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

 The following commands compute a knot quandle directly from a pdf file
containing the following hand\texttt{\symbol{45}}drawn image of the knot. 

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

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

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

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

The following example uses Polymake's linear programming routines to establish
that the $2$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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 }{Group presentations and homotopical syzygies}}\logpage{[ 6, 5, 0 ]}
\hyperdef{L}{X84C0CB8B7C21E179}{}
{
 Free resolutons for a group $G$ are constructed in \textsc{HAP} as the cellular chain complex $R_\ast=C_\ast(\tilde X)$ of the universal cover of some CW\texttt{\symbol{45}}complex $X=K(G,1)$. The $2$\texttt{\symbol{45}}skeleton of $X$ gives rise to a free presentation for the group $G$. This presentation depends on a choice of maximal tree in the $1$\texttt{\symbol{45}}skeleton of $X$ in cases where $X$ has more than one $0$\texttt{\symbol{45}}cell. The attaching maps of $3$\texttt{\symbol{45}}cells in $X$ can be regarded as \emph{homotopical syzygies} or van Kampen diagrams over the group presentation whose boundaries spell the
trivial word. 

The following example constructs four terms of a resolution for the free
abelian group $G$ on $n=3$ generators, and then extracts the group presentation from the resolution as
well as the unique homotopical syzygy. The syzygy is visualized in terms of
its graph of edges, directed edges being coloured according to the
corresponding group generator. (In this example the
CW\texttt{\symbol{45}}complex $\tilde X$ is regular, but in cases where it is not the visualization may be a quotient
of the $1$\texttt{\symbol{45}}skeleton of the syzygy.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=3;;c:=1;;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(n),c));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,4);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup;|
  <free group on the generators [ x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ y^-1*x^-1*y*x, z^-1*x^-1*z*x, z^-1*y^-1*z*y ]
  !gapprompt@gap>| !gapinput@IdentityAmongRelatorsDisplay(R,1);|
  
\end{Verbatim}
 

  

 This homotopical syzygy represents a relationship between the three relators $[x,y]$, $[x,z]$ and $[y,z]$ where $[x,y]=xyx^{-1}y^{-1}$. The syzygy can be thought of as a geometric relationship between commutators
corresponding to the well\texttt{\symbol{45}}known
Hall\texttt{\symbol{45}}Witt identity: 

$ [\ [x,y],\ {^yz}\ ]\ \ [\ [y,z],\ {^zx}\ ]\ \ [\ [z,x],\ {^xy}\ ]\ \ =\ \ 1\ \
.$ 

The homotopical syzygy is special since in this example the edge directions
and labels can be understood as specifying three homeomorphisms between pairs
of faces. Viewing the syzygy as the boundary of the $3$\texttt{\symbol{45}}ball, by using the homeomorphisms to identify the faces in
each face pair we obtain a quotient CW\texttt{\symbol{45}}complex $M$ involving one vertex, three edges, three $2$\texttt{\symbol{45}}cells and one $3$\texttt{\symbol{45}}cell. The cell structure on the quotient exists because,
under the restrictions of homomorphisms to the edges, any cycle of edges
retricts to the identity map on any given edge. The following result tells us
that $M$ is in fact a closed oriented compact $3$\texttt{\symbol{45}}manifold. 

\textsc{Theorem.} [Seifert u. Threlfall, Topologie, p.208] \emph{Let $S^2$ denote the boundary of the $3$\texttt{\symbol{45}}ball $B^3$ and suppose that the sphere $S^2$ is given a regular CW\texttt{\symbol{45}}structure in which the faces are
partitioned into a collection of face pairs. Suppose that for each face pair
there is an orientation reversing homeomorphism between the two faces that
sends edges to edges and vertices to vertices. Suppose that by using these
homeomorphisms to identity face pairs we obtain a (not necessarily regular)
CW\texttt{\symbol{45}}structure on the quotient $M$. Then $M$ is a closed compact orientable manifold if and only if its Euler
characteristic is $\chi(M)=0$.} 

The next commands construct a presentation and associated unique homotopical
syzygy for the free nilpotent group of class $c=2$ on $n=2$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@n:=2;;c:=2;;|
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(n),c));;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNilpotentGroup(G,4);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup;|
  <free group on the generators [ x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ z*x*y*x^-1*y^-1, z*x*z^-1*x^-1, z*y*z^-1*y^-1 ]
  !gapprompt@gap>| !gapinput@IdentityAmongRelatorsDisplay(R,1);|
  
\end{Verbatim}
 

  

The syzygy represents the following relationship between commutators (in a
free group). 

$ [\ [x^{-1},y][x,y]\ ,\ [y,x][y^{-1},x]y^{-1}\ ]\ [\ [y,x][y^{-1},x]\ , \
x^{-1} \ ] \ \ =\ \ 1$ 

 Again, using the theorem of Seifert and Threlfall we see that the free
nilpotent group of class two on two generators arises as the fundamental group
of a closed compact orientable $3$\texttt{\symbol{45}}manifold $M$. }

 
\section{\textcolor{Chapter }{Bogomolov multiplier}}\logpage{[ 6, 6, 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\texttt{\symbol{45}}trivial Bogomolov multiplier. The groups in
question are numbered 28, 29 and 30 in \textsc{GAP}'s library of small groups of order $243$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@L:=AllSmallGroups(3^5);;|
  !gapprompt@gap>| !gapinput@C:=IsoclinismClasses(L);;|
  !gapprompt@gap>| !gapinput@for c in C do|
  !gapprompt@>| !gapinput@if Length(BogomolovMultiplier(c[1]))>0 then|
  !gapprompt@>| !gapinput@Print(List(c,g->IdGroup(g)),"\n\n\n"); fi;|
  !gapprompt@>| !gapinput@od;|
  [ [ 243, 28 ], [ 243, 29 ], [ 243, 30 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Second group cohomology and group extensions}}\label{secExtensions}
\logpage{[ 6, 7, 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(N)$ 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$\texttt{\symbol{45}}cocycle" $f\colon G\times G\rightarrow 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 (non\texttt{\symbol{45}}canonical) 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$\texttt{\symbol{45}}cocycle $f:G\times G\rightarrow A =C_2\times C_2$ corresponding to the non\texttt{\symbol{45}}trivial element in $H^2(G,A)$. The value $f(g,h)$ of the $2$\texttt{\symbol{45}}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 }{Cocyclic groups: a convenient way of representing certain groups}}\label{secCocyclic}
\logpage{[ 6, 8, 0 ]}
\hyperdef{L}{X7F04FA5E81FFA848}{}
{
 \textsc{GAP} offers a number of data types for representing groups, including those of
fp\texttt{\symbol{45}}groups (\emph{finitely presented groups}), pc\texttt{\symbol{45}}groups (\emph{power\texttt{\symbol{45}}conjugate presentated groups} for finite polycyclic groups), pcp\texttt{\symbol{45}}groups (\emph{polycyclically presented groups} for finite and infinite polycyclic groups), permutation groups (for finite
groups), and matrix groups over a field or ring. Each data type has its
advantages and limitations. 

 Based on the definitions and examples in Section \ref{secExtensions} the additional data type of a cc\texttt{\symbol{45}}group (\emph{cocyclic group}) is provided in \textsc{HAP}. This can be used for a group $E$ arising as a group extension $N\rightarrowtail E \twoheadrightarrow G$ and is a component object involving: 
\begin{itemize}
\item \texttt{E!.Base} consisting of some representation of a group $G$.
\item \texttt{E!.Fibre} consisting of some representation of a group $N$.
\item \texttt{E!.OuterGroup} consisting of an outer action $\alpha\colon G\rightarrow Out(N)$ of $G$ on $N$.
\item \texttt{E!.Cocycle} consisting of a "$2$\texttt{\symbol{45}}cocycle" $f\colon G\times G\rightarrow N$.
\end{itemize}
 

The first example in Section \ref{secExtensions} illustrates the construction of cc\texttt{\symbol{45}}groups for which both
the base $G$ and fibre $N$ are finite pc\texttt{\symbol{45}}groups. That example extends to any scenario
in which the base $G$ is a group for which: 
\begin{enumerate}
\item we can construct the first 3 degrees of a free $\mathbb ZG$\texttt{\symbol{45}}resolution $C_\ast X$.
\item we can construct the first 2 terms of a contracting homotopy $h_i\colon C_nX\rightarrow C_{n+1}X $ for $i=0,1$. 
\item $N$ is a group in which we can multiply elements effectively and for which we can
determine the centre $Z(N)$ and outer automorphism group $Out(N)$. 
\end{enumerate}
 

 As an illustration where the base group is a non\texttt{\symbol{45}}solvable
finite group and the fibre is the infinite cyclic group, with base group
acting trivially on the fibre, the following commands list up to Yoneda
equivalence all central extensions $\mathbb Z \rightarrowtail E \twoheadrightarrow G$ for $G=A_5:C_{16}$. The base group is a non\texttt{\symbol{45}}solvable
semi\texttt{\symbol{45}}direct product of order $960$ and thus none of the $16$ extensions are polycyclic. The commands classify the extensions according to
their integral homology in degrees $ \le 2$, showing that there are precisely 5 such equivalence classes of extensions.
Thus, there are at least 5 distinct isomorphism types among the $16$ extensions. A presentation is constructed for the group corresponding to the
sixteenth extension. The final command lists the orders of the 16 cohomology
group elements corresponding to the 16 extensions. The 16th element has order
1, meaning that the sixteenth extension is the direct product $C_\infty\ \times\ A_5:C_{16}$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|G:=SmallGroup(960,637);;B
  @gapprompt|gap>B @gapinput|StructureDescription(G);B
  "A5 : C16"
  
  @gapprompt|gap>B @gapinput|N:=AbelianPcpGroup([0]);;B
  @gapprompt|gap>B @gapinput|N:=TrivialGModuleAsGOuterGroup(G,N);;B
  @gapprompt|gap>B @gapinput|R:=ResolutionFiniteGroup(G,3);;B
  @gapprompt|gap>B @gapinput|C:=HomToGModule(R,N);;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(N, x));;B
  
  @gapprompt|gap>B @gapinput|inv:=function(gg)B
  @gapprompt|>B @gapinput|local T;B
  @gapprompt|>B @gapinput|T:=ResolutionInfiniteCcGroup(gg,3);B
  @gapprompt|>B @gapinput|return List([1..2],i->Homology(TensorWithIntegers(T),i));B
  @gapprompt|>B @gapinput|end;;B
  
  @gapprompt|gap>B @gapinput|EquivClasses:=Classify(ccgrps,inv);B
   [ <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity>, <Cc-group of Size infinity>, 
        <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity>, <Cc-group of Size infinity> ], 
    [ <Cc-group of Size infinity> ], [ <Cc-group of Size infinity> ] ]
  @gapprompt|gap>B @gapinput|List(EquivClasses,Size);B
  [ 8, 4, 2, 1, 1 ]
  
  @gapprompt|gap>B @gapinput|F16:=Image(IsomorphismFpGroup(ccgrps[16]));B
  <fp group on the generators [ x, y, z, w, v ]>
  @gapprompt|gap>B @gapinput|RelatorsOfFpGroup(F16);B
  [ (x^2*y*z*w*z*y)^3*x^2*(y*x*w*y^2*z*x*y*z*y)^3*y*x*w*y^2*z*x*y^2*z*w*y^2*z*y,
    x*y^-2*w^-1*z^-1*y^-1*x^-1*y, x*z^-1*y^-1*z^-1*w^-1*z^-1*y^-1*x^-1*z, 
    x*y^-2*z^-1*w^-1*z^-1*y^-1*x^-1*w, z^-2, w^-2, y^-3, w*y^-1*w^-1*y^-1, 
    w*z*w^-1*z^-1*w^-1*z, z*y^2*(z^-1*y^-1)^2, v^-1*x^-1*v*x, v*y*v^-1*y^-1, 
    v*z*v^-1*z^-1, v*w*v^-1*w^-1 ]
  
  @gapprompt|gap>B @gapinput|List(Elts,Order);B
  [ 16, 16, 16, 16, 16, 16, 16, 16, 8, 8, 8, 8, 4, 4, 2, 1 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Effective group presentations}}\logpage{[ 6, 9, 0 ]}
\hyperdef{L}{X863080FE8270468D}{}
{
 For any free $\mathbb ZG$\texttt{\symbol{45}}resolution $R_\ast=C_\ast X$ arising as the cellular chain complex of a contractible
CW\texttt{\symbol{45}}complex, the terms in degrees $\le 2$ correspond to a free presentation for the group $G$. The following example accesses this presentation for the group $PGL_3(\mathbb Z[\sqrt{-1}])$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("PGL(3,Z[i])");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,2);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@G:=P.freeGroup/P.relators;|
  <fp group on the generators [ v, w, x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ v^2, w^-1*v*w*v^-1, w^-1*v^-1*w^-1, (x^-1*w)^3, (y^-1*w)^3, (z^-1*w)^4, 
    y^-1*v^-1*z*y^-1*x, y^-1*v*x*v^-1*x*v, v^-1*z*v^-1*x*y, v^-1*x*v*y*v*x*v*y, 
    x^3, x*z*y, y^-1*v^-1*y^2*v*y^-1, (v*y)^4, z^-1*y*v*z^-1, (v*y*z)^2, 
    v^-1*(z*v)^2*z ]
  
\end{Verbatim}
 

 The homomorphism $h_0\colon R_0 \rightarrow R_1$ of a contracting homotopy provides a unique expression for each element of $G$ as a word in the free generators. To illustrate this, we consider the Sylow $2$\texttt{\symbol{45}}subgroup $H=Syl_2(M_{24})$ of the Mathieu group $M_{24}$. We obtain a resolution $R_\ast$ for $H$ by recursively applying perturbation techniques to a composition series for $H$. Such a resolution will yield a "kind of" power\texttt{\symbol{45}}conjugate
presentation for $H$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@H:=SylowSubgroup(MathieuGroup(24),2);|
  <permutation group of size 1024 with 10 generators>
  !gapprompt@gap>| !gapinput@Order(H);|
  1024
  !gapprompt@gap>| !gapinput@C:=CompositionSeries(H);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionSubnormalSeries(C,2);;|
  !gapprompt@gap>| !gapinput@P:=PresentationOfResolution(R);;|
  !gapprompt@gap>| !gapinput@P.freeGroup/P.relators;|
  <fp group on the generators [ q, r, s, t, u, v, w, x, y, z ]>
  !gapprompt@gap>| !gapinput@P.relators;|
  [ q^-2*z*y*x*w*v, q*r^-1*q^-1*y*u*r, s*q*s^-1*q^-1, t*q*t^-1*q^-1, 
    q*u^-1*q^-1*y*v*u, y*q*v^-1*q^-1, q*w^-1*q^-1*z*x, w*q*x^-1*q^-1, 
    q*y^-1*q^-1*z*v, z*q*z^-1*q^-1, r^-2, t*r*s^-1*r^-1, s*r*t^-1*r^-1, 
    u*r*u^-1*r^-1, v*r*v^-1*r^-1, r*w^-1*r^-1*y*w*u, r*x^-1*r^-1*y*x*u, 
    y*r*y^-1*r^-1, z*r*z^-1*r^-1, s^-2, t*s*t^-1*s^-1, x*s*u^-1*s^-1, 
    s*v^-1*s^-1*z*y*w*u, s*w^-1*s^-1*y*v*u, u*s*x^-1*s^-1, s*y^-1*s^-1*y*x*u, 
    z*s*z^-1*s^-1, t^-2, t*u^-1*t^-1*y*x*u, t*v^-1*t^-1*z*w, t*w^-1*t^-1*z*v, 
    y*t*x^-1*t^-1, x*t*y^-1*t^-1, z*t*z^-1*t^-1, u^-2, v*u*v^-1*u^-1, 
    u*w^-1*u^-1*z*w, x*u*x^-1*u^-1, y*u*y^-1*u^-1, z*u*z^-1*u^-1, v^-2, 
    w*v*w^-1*v^-1, v*x^-1*v^-1*z*x, y*v*y^-1*v^-1, z*v*z^-1*v^-1, w^-2, 
    x*w*x^-1*w^-1, w*y^-1*w^-1*z*y, z*w*z^-1*w^-1, x^-2, y*x*y^-1*x^-1, 
    z*x*z^-1*x^-1, y^-2, z*y*z^-1*y^-1, z^-2 ]
  
\end{Verbatim}
 

 The following additional commands use the contracting homotopy homomorphism $h_0\colon R_0\rightarrow R_1$ to express some random elements of $H$ as words in the free generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,6)(2,3)(4,9)(5,16)(7,10)(8,21)(11,18)(12,17)(13,19)(14,20)(15,22)(23,24)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*t^-1*x^-1*y^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,6)(2,23,10,18)(3,22,19,24)(4,11,15,9)(7,8,21,13)(12,14)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*u^-1*w^-1*x^-1*z^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,14,5,17)(2,7,9,19)(3,11,4,22)(6,12,16,20)(8,18,24,15)(10,23,13,21)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*r^-1*t^-1*v^-1*x^-1*z^-1
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@g:=Random(H);|
  (1,14,5,17)(2,21)(3,9)(4,24)(6,12,16,20)(7,11,15,13)(8,23)(10,18,22,19)
  !gapprompt@gap>| !gapinput@P.wordInFreeGenerators(g);|
  q^-1*r^-1*t^-1*v^-1*w^-1*z^-1
  
\end{Verbatim}
 

 Because the resolution $R_\ast$ was obtained from a composition series, the unique word associated to an
element $g\in H$ always has the form $q^{\epsilon_1} r^{\epsilon_2} s^{\epsilon_3} t^{\epsilon_4} u^{\epsilon_5}
v^{\epsilon_6} w^{\epsilon_7} x^{\epsilon_8} y^{\epsilon_9} z^{\epsilon_{10}}$ determined by the exponent vector $(\epsilon_1,\cdots,\epsilon_{10}) \in (\mathbb Z_2)^{10}$. }

 
\section{\textcolor{Chapter }{Second group cohomology and cocyclic Hadamard matrices}}\label{secHadamard}
\logpage{[ 6, 10, 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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}types}}\label{secCat1}
\logpage{[ 6, 11, 0 ]}
\hyperdef{L}{X78040D8580D35D53}{}
{
  \textsc{Homotopy 2\texttt{\symbol{45}}types} 

 The third cohomology $H^3(G,A)$ of a group $G$ with coefficients in a $G$\texttt{\symbol{45}}module $A$, together with the corresponding $3$\texttt{\symbol{45}}cocycles, can be used to classify homotopy $2$\texttt{\symbol{45}}types. A \emph{homotopy 2\texttt{\symbol{45}}type} is a CW\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}group} by J.\texttt{\symbol{45}}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$\texttt{\symbol{45}}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)$\texttt{\symbol{45}}module where the action is induced by conjugation in $H$. 

A homotopy $2$\texttt{\symbol{45}}type $X$ can be represented by a cat$^1$\texttt{\symbol{45}}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\texttt{\symbol{45}}theoretic constructions can be
viewed naturally as a cat$^1$\texttt{\symbol{45}}group. 
\begin{enumerate}
\item  A $\mathbb ZG$\texttt{\symbol{45}}module $A$ can be viewed as a cat$^1$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}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$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}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$\texttt{\symbol{45}}group $(H,s,t)$ where $H$ is the semi\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}groups with fundamental group $\pi_1$ and $\pi_1$\texttt{\symbol{45}} 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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cocycle corresponding to the Postnikov invariant of $H$ itself can be easily constructed directly from its definition in terms of a
set\texttt{\symbol{45}}theoretic 'section' of the crossed module corresponding
to $H$. }

 
\chapter{\textcolor{Chapter }{Cohomology of groups (and Lie Algebras)}}\logpage{[ 7, 0, 0 ]}
\hyperdef{L}{X787E37187B7308C9}{}
{
 
\section{\textcolor{Chapter }{Finite groups }}\logpage{[ 7, 1, 0 ]}
\hyperdef{L}{X807B265978F90E01}{}
{
 
\subsection{\textcolor{Chapter }{Naive homology computation for a very small group}}\logpage{[ 7, 1, 1 ]}
\hyperdef{L}{X80A721AC7A8D30A3}{}
{
 

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

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

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

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

 This naive approach does have the merit of being applicable to arbitrary small
monoids. The following calculates the homology in degrees $\le 7$ of a monoid of order 8, the monoid being specified by its multiplication
table. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|T:=[ [  1,  1,  1,  4,  4,  4,  4,  1 ],A
  @gapprompt|>A @gapinput|        [  1,  1,  1,  4,  4,  4,  4,  2 ],A
  @gapprompt|>A @gapinput|        [  1,  1,  1,  4,  4,  4,  4,  3 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  4 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  5 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  6 ],A
  @gapprompt|>A @gapinput|        [  4,  4,  4,  1,  1,  1,  1,  7 ],A
  @gapprompt|>A @gapinput|        [  1,  2,  3,  4,  5,  6,  7,  8 ] ];;A
  @gapprompt|gap>A @gapinput|M:=MonoidByMultiplicationTable(T);A
  <monoid of size 8, with 8 generators>
  @gapprompt|gap>A @gapinput|B:=BarComplexOfMonoid(M,8);;A
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(B);;A
  @gapprompt|gap>A @gapinput|List([0..7],i->Homology(C,i));A
  [ [ 0 ], [ 2 ], [  ], [ 2 ], [  ], [ 2 ], [  ], [ 2 ] ]
  
  
  @gapprompt|gap>A @gapinput|List([0..8],B!.dimension);A
  [ 1, 7, 49, 343, 2401, 16807, 117649, 823543, 5764801 ]
  @gapprompt|gap>A @gapinput|List([0..8],C!.dimension);A
  [ 1, 1, 1, 1, 1, 1, 1, 1, 5044201 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{A more efficient homology computation}}\logpage{[ 7, 1, 2 ]}
\hyperdef{L}{X838CEA3F850DFC82}{}
{
 

 The following example computes the seventh integral homology 

$H_7(M_{23},\mathbb Z) = \mathbb Z_{16}\oplus\mathbb Z_{15}$ 

and fourth integral cohomomogy 

$H^4(M_{24},\mathbb Z) = \mathbb Z_{12}$ 

and fifth integral homology 

$H_5(M_{24},\mathbb Z) =\mathbb Z_{14}$ 

of the Mathieu groups $M_{23}$ and $M_{24}$. (Warning: the computation of $H_7(M_{23},\mathbb Z)$ takes a couple of hours to run and the computation for $H_5(M_{24},\mathbb Z)$ takes an hour to run.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@GroupHomology(MathieuGroup(23),7);|
  [ 16, 3, 5 ]
  
  !gapprompt@gap>| !gapinput@GroupCohomology(MathieuGroup(24),4);|
  [ 4, 3 ]
  
  !gapprompt@gap>| !gapinput@GroupHomology(MathieuGroup(24),5);|
  [ 2, 7 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Computation of an induced homology homomorphism}}\logpage{[ 7, 1, 3 ]}
\hyperdef{L}{X842E93467AD09EC1}{}
{
 

The following example computes the cokernel 

${\rm coker}( H_3(A_7,\mathbb Z) \rightarrow H_3(S_{10},\mathbb Z)) \cong
\mathbb Z_2\oplus \mathbb Z_2$ 

of the degree\texttt{\symbol{45}}3 integral homomogy homomorphism induced by
the canonical inclusion $A_7 \rightarrow S_{10}$ of the alternating group on $7$ letters into the symmetric group on $10$ letters. The analogous cokernel with $\mathbb Z_2$ homology coefficients is also computed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(10);;|
  !gapprompt@gap>| !gapinput@H:=AlternatingGroup(7);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@F:=GroupHomology(f,3);|
  MappingByFunction( Pcp-group with orders [ 4, 3 ], Pcp-group with orders 
  [ 2, 2, 4, 3 ], function( x ) ... end )
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(F)/Image(F));|
  [ 2, 2 ]
  
  !gapprompt@gap>| !gapinput@Fmod2:=GroupHomology(f,3,2);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Range(Fmod2)/Image(Fmod2));|
  [ 2, 2 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Some other finite group homology computations}}\logpage{[ 7, 1, 4 ]}
\hyperdef{L}{X8754D2937E6FD7CE}{}
{
 

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

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

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

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

The following example computes the sixth mod\texttt{\symbol{45}}$2$ homology of the Sylow $2$\texttt{\symbol{45}}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 computes the sixth mod\texttt{\symbol{45}}$2$ homology of the Unitary group $U_3(4)$ of order 312000. 

$H_6(U_3(4),\mathbb Z_2) = \mathbb Z_2^{4}$ 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GU(3,4);;|
  !gapprompt@gap>| !gapinput@Order(G);|
  312000
  !gapprompt@gap>| !gapinput@GroupHomology(G,6,2);|
  [ 2, 2, 2, 2 ]
  
\end{Verbatim}
 

The following example constructs the Poincare series 

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

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

The following example constructs the series 

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

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

 }

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

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

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

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

The following example computes 

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

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

The following example computes 

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

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

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

The following example computes 

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

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

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

The following example computes 

$H_n(G,\mathbb Z) =\left\{ \begin{array}{ll} \mathbb Z &n=0,1,7,8\\ \mathbb
Z_2, &n=2,3\\ \mathbb Z_2\oplus \mathbb Z_6, &n=4,6\\ \mathbb Z_3 \oplus
\mathbb Z_6,& n=5\\ 0, &n>8 \end{array}\right. $ 

for $G$ the Artin group of type $E_8$. (Similar commands can be used to compute a resolution and homology of
arbitrary Artin monoids and, in thoses cases such as the spherical cases where
the $K(\pi,1)$\texttt{\symbol{45}}conjecture is known to hold, the homology is equal to that
of the corresponding Artin group.) 
\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@R:=ResolutionArtinGroup(D,9);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);;|
  !gapprompt@gap>| !gapinput@List([0..8],n->Homology(C,n));|
  [ [ 0 ], [ 0 ], [ 2 ], [ 2 ], [ 2, 6 ], [ 3, 6 ], [ 2, 6 ], [ 0 ], [ 0 ] ]
  
\end{Verbatim}
 The Artin group $G$ projects onto the Coxeter group $W$ of type $E_8$. The group $W$ has a natural representation as a group of $8\times 8$ integer matrices. This projection gives rise to a representation $\rho\colon G\rightarrow GL_8(\mathbb Z)$. The following command computes the cohomology group $H^6(G,\rho) = (\mathbb Z_2)^6$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|gensG:=GeneratorsOfGroup(G);;A
  @gapprompt|gap>A @gapinput|W:=CoxeterDiagramMatCoxeterGroup(D);;A
  @gapprompt|gap>A @gapinput|gensW:=GeneratorsOfGroup(W);;A
  @gapprompt|gap>A @gapinput|rho:=GroupHomomorphismByImages(G,W,gensG,gensW);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,rho);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,6);A
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

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

The following example computes 

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

for $G$ the graph of groups corresponding to the amalgamated product $G=S_5*_{S_3}S_4$ of the symmetric groups $S_5$ and $S_4$ over the canonical subgroup $S_3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");|
  !gapprompt@gap>| !gapinput@S4:=SymmetricGroup(4);SetName(S4,"S4");|
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");|
  !gapprompt@gap>| !gapinput@AS5:=GroupHomomorphismByFunction(A,S5,x->x);|
  !gapprompt@gap>| !gapinput@AS4:=GroupHomomorphismByFunction(A,S4,x->x);|
  !gapprompt@gap>| !gapinput@D:=[S5,S4,[AS5,AS4]];|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,6);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),5);|
  [ 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 The next example computes the integral homology of $SL_2(\mathbb Z)$ in degrees $\le 5$ using the isomorphism $SL_2(\mathbb Z) \cong C_4\ast_{C_2}C_6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@x:=(1,2,3,4,5,6,7,8,9,10,11,12);;|
  !gapprompt@gap>| !gapinput@C6:=Group(x^2);;SetName(C6,"C6");;|
  !gapprompt@gap>| !gapinput@C4:=Group(x^3);;SetName(C4,"C4");;|
  !gapprompt@gap>| !gapinput@C2:=Group(x^6);;SetName(C2,"C2");;|
  !gapprompt@gap>| !gapinput@C2C6:=GroupHomomorphismByFunction(C2,C6,x->x);;|
  !gapprompt@gap>| !gapinput@C2C4:=GroupHomomorphismByFunction(C2,C4,x->x);;|
  !gapprompt@gap>| !gapinput@D:=[C6,C4,[C2C6,C2C4]];;|
  !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@List([0..5],n->Homology(TensorWithIntegers(R),n));|
  [ [ 0 ], [ 12 ], [  ], [ 12 ], [  ], [ 12 ] ]
  
\end{Verbatim}
 The next commands compute the integral homology in degree $7$ of a graph of groups corresponding to the HNN extension $G=H*_A$ where $H$ is the symmetric group $H=S_5$ and $A$ is the subgroup $A=S_3$ and $f:A\rightarrow H$ is the homomorphism $(1,2) \rightarrow (3,4)$, $(1,2,3) \rightarrow (3,4,5)$. The HNN extension $G$ is obtained from $H$ by adding a generator $t$ subject to the relations $t^{-1} a t = f(a)$ for $a \in A$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@S5:=SymmetricGroup(5);SetName(S5,"S5");;|
  !gapprompt@gap>| !gapinput@A:=SymmetricGroup(3);SetName(A,"S3");;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByImages(A,S5,[(1,2),(1,2,3)],[(3,4),(3,4,5)]);;|
  !gapprompt@gap>| !gapinput@g:=GroupHomomorphismByFunction(A,S5,x->x);;|
  !gapprompt@gap>| !gapinput@D:=[S5,[f,g]];;|
  !gapprompt@gap>| !gapinput@GraphOfGroupsDisplay(D);;|
  
\end{Verbatim}
  
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionGraphOfGroups(D,8);;|
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R),7);|
  [ 2, 2, 60 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Lie algebra homology and free nilpotent groups}}\logpage{[ 7, 7, 0 ]}
\hyperdef{L}{X7CE849E58706796C}{}
{
 One method of producting a Lie algebra $L$ from a group $G$ is by forming the direct sum $L(G) = G/\gamma_2G \oplus \gamma_2G/\gamma_3G \oplus \gamma_3G/\gamma_4G
\oplus \cdots$ of the quotients of the lower central series $\gamma_1G=G$, $\gamma_{n+1}G=[\gamma_nG,G]$. Commutation in $G$ induces a Lie bracket $L(G)\times L(G) \rightarrow L(G)$. 

 The homology $H_n(L)$ of a Lie algebra (with trivial coefficients) can be calculated as the homology
of the Chevalley\texttt{\symbol{45}}Eilenberg chain complex $C_\ast(L)$. This chain complex is implemented in \textsc{HAP} in the cases where the underlying additive group of $L$ is either finitely generated torsion free or finitely generated of prime
exponent $p$. In these two cases the ground ring for the Lie algebra/
Chevalley\texttt{\symbol{45}}Eilenberg complex is taken to be $\mathbb Z$ and $\mathbb Z_p$ respectively. 

 For example, consider the quotient $G=F/\gamma_8F$ of the free group $F=F(x,y)$ on two generators by eighth term of its lower central series. So $G$ is the \emph{free nilpotent group of class 7 on two generators}. The following commands compute $H_4(L(G)) = \mathbb Z_2^{77} \oplus \mathbb Z_6^8 \oplus \mathbb Z_{12}^{51}
\oplus \mathbb Z_{132}^{11} \oplus \mathbb Z^{2024}$ and show that the fourth homology in this case contains 2\texttt{\symbol{45}},
3\texttt{\symbol{45}} and 11\texttt{\symbol{45}}torsion. (The commands take an
hour or so to complete.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(2),7));;|
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@h:=LieAlgebraHomology(L,4);;|
  !gapprompt@gap>| !gapinput@Collected(h);|
  [ [ 0, 2024 ], [ 2, 77 ], [ 6, 8 ], [ 12, 51 ], [ 132, 11 ] ]
  
\end{Verbatim}
 

 For a free nilpotent group $G$ the additive homology $H_n(L(G))$ of the Lie algebra can be computed more quickly in \textsc{HAP} than the integral group homology $H_n(G,\mathbb Z)$. Clearly there are isomorphisms$H_1(G) \cong H_1(L(G)) \cong G_{ab}$ of abelian groups in homological degree $n=1$. Hopf's formula can be used to establish an isomorphism $H_2(G) \cong H_2(L(G))$ also in degree $n=2$. The following two theorems provide further isomorphisms that allow for the
homology of a free nilpotent group to be calculated more efficiently as the
homology of the associated Lie algebra. 

\textsc{Theorem 1.} \cite{kuzmin} \emph{Let $G$ be a finitely generated free nilpotent group of class 2. Then the integral
group homology $H_n(G,\mathbb Z)$ is isomorphic to the integral Lie algebra homology $H_n(L(G),\mathbb Z)$ in each degree $n\ge0$.} 

 \textsc{Theorem 2.} \cite{igusa} \emph{Let $G$ be a finitely generated free nilpotent group (of any class). Then the integral
group homology $H_n(G,\mathbb Z)$ is isomorphic to the integral Lie algebra homology $H_n(L(G),\mathbb Z)$ in degrees $n=0, 1, 2, 3$.} 

We should remark that experimentation on free nilpotent groups of class $\ge 4$ has not yielded a group for which the isomorphism $H_n(G,\mathbb Z) \cong H_n(L(G),\mathbb G)$ fails. For instance, the isomorphism holds in degree $n=4$ for the free nilpotent group of class 5 on two generators, and for the free
nilpotent group of class 2 on four generators: 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(2),5));;|
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@Collected( LieAlgebraHomology(L,4) );|
  [ [ 0, 85 ], [ 7, 1 ] ]
  !gapprompt@gap>| !gapinput@Collected( GroupHomology(G,4) );|
  [ [ 0, 85 ], [ 7, 1 ] ]
  
  !gapprompt@gap>| !gapinput@G:=Image(NqEpimorphismNilpotentQuotient(FreeGroup(4),2));;  |
  !gapprompt@gap>| !gapinput@L:=LowerCentralSeriesLieAlgebra(G);;|
  !gapprompt@gap>| !gapinput@Collected( LieAlgebraHomology(L,4) );|
  [ [ 0, 84 ], [ 3, 4 ] ]
  !gapprompt@gap>| !gapinput@Collected( GroupHomology(G,4) );|
  [ [ 0, 84 ], [ 3, 4 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Cohomology with coefficients in a module}}\logpage{[ 7, 8, 0 ]}
\hyperdef{L}{X7C3DEDD57BB4D537}{}
{
 There are various ways to represent a $\mathbb ZG$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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, v) \mapsto \rho(g)\, v $ 

 where $\rho\colon G\rightarrow Gl_n(\mathbb Z)$ is a (not necessarily faithful) matrix representation of degree $n$ then we can avoid the use of $G$\texttt{\symbol{45}}outer groups and use just the homomorphism $\rho$ instead. The following example uses this data type to compute the cohomology 

$H^6(G,A) =\mathbb Z_2 $ 

and the homology 

$H_6(G,A) = 0 $ 

 of the alternating group $G=A_5$ with coefficients in $A=\mathbb Z^5$ where elements of $G$ act on $\mathbb Z^5$ via an irreducible representation. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@rho:=IrreducibleRepresentations(G)[5];|
  [ (1,2,3,4,5), (3,4,5) ] -> 
  [ 
    [ [ 0, 0, 1, 0, 0 ], [ -1, -1, 0, 0, 1 ], [ 0, 1, 1, 1, 0 ], 
        [ 1, 0, -1, 0, -1 ], [ -1, -1, 0, -1, 0 ] ], 
    [ [ -1, -1, 0, 0, 1 ], [ 1, 0, -1, 0, -1 ], [ 0, 0, 0, 0, 1 ], 
        [ 0, 0, 1, 0, 0 ], [ 0, 0, 0, 1, 0 ] ] ]
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,7);;|
  !gapprompt@gap>| !gapinput@C:=HomToIntegralModule(R,rho);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,6);|
  [ 2 ]
  !gapprompt@gap>| !gapinput@D:=TensorWithIntegralModule(R,rho);|
  Chain complex of length 7 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Homology(D,6);|
  [  ]
  
\end{Verbatim}
 

If $V=K^d$ is a vetor space of dimension $d$ over the field $K=GF(p)$ with $p$ a prime and $G$ acts on $V$ via a homomorphism $\rho\colon G\rightarrow GL_d(K)$ then the homology $H^n(G,V)$ can again be computed without the use of G\texttt{\symbol{45}}outer groups. As
an example, the following commands compute 

$H^4(GL(3,2),V) =K^2$ 

where $K=GF(2)$ and $GL(3,2)$ acts with its natural action on $V=K^3$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GL(3,2);;|
  !gapprompt@gap>| !gapinput@rho:=GroupHomomorphismByFunction(G,G,x->x);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(G,5);;|
  !gapprompt@gap>| !gapinput@C:=HomToModPModule(R,rho);;|
  !gapprompt@gap>| !gapinput@Cohomology(C,4);|
  2
  
\end{Verbatim}
 

The following example constructs the Artin braid group $G=B_3$ on three strings, the surjection $G\twoheadrightarrow S_3$, a complex representation $S_3\rightarrow GL_2(\mathbb C)$ and the composite representation $\rho\colon G\rightarrow GL_2(\mathbb C)$. The group $G$ acts on the vector space $V=\mathbb C\oplus \mathbb C$ via $\rho$. Then the dimensions of the cohomology groups $H^n(G,V)$ are computed. 
\begin{Verbatim}[commandchars=@|J,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>J @gapinput|D:=[[1,[2,3]],[2,[3,3]]];;J
  @gapprompt|gap>J @gapinput|R:=ResolutionArtinGroup(D,4);;J
  @gapprompt|gap>J @gapinput|G:=R!.group;; #Braid groupJ
  @gapprompt|gap>J @gapinput|r:=[G.1^2,G.2^2,G.3^2];;Q:=G/r;;J
  @gapprompt|gap>J @gapinput|q:=GroupHomomorphismByImages(G,Q,GeneratorsOfGroup(G),GeneratorsOfGroup(Q));;J
  @gapprompt|gap>J @gapinput|h:=IrreducibleRepresentations(Q)[3];J
  Pcgs([ f1^-1*f2^-1*f3^-2*f1^-1, f3^-1*f2^-1*f1^-1*f2^-1, f2*f3^-1*f1^-1*f2^-1,
    f3^-1*f1^-1 ]) -> [ [ [ 0, 1 ], [ 1, 0 ] ], [ [ E(3), 0 ], [ 0, E(3)^2 ] ], 
    [ [ 1, 0 ], [ 0, 1 ] ], [ [ 1, 0 ], [ 0, 1 ] ] ]
  @gapprompt|gap>J @gapinput|rho:=GroupHomomorphismByFunction(G,Image(h),x->Image(h,Image(q,x)));;J
  @gapprompt|gap>J @gapinput|C:=HomToModuleOverCyclotomicField(R,rho);J
  Cochain complex of length 4 over field of characteristic 0. 
  
  @gapprompt|gap>J @gapinput|Cohomology(C,1);J
  1
  @gapprompt|gap>J @gapinput|Cohomology(C,2);J
  1
  
\end{Verbatim}
 

 It can be computationally difficult to compute resolutions for large finite
groups. But the $p$\texttt{\symbol{45}}primary part of the homology can be computed using
resolutions of Sylow $p$\texttt{\symbol{45}}subgroups. This approach is used in the following example
that computes the $2$\texttt{\symbol{45}}primary part 

$H_{2}(G,\mathbb Z)_{(2)} = \mathbb Z_2 \oplus \mathbb Z_2\oplus \mathbb Z_2$ 

of the degree 2 integral homology of the Rubik's cube group $G$. This group has order $43252003274489856000$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gens:= [|
  !gapprompt@>| !gapinput@   ( 1, 3, 8, 6)( 2, 5, 7, 4)( 9,33,25,17)(10,34,26,18)(11,35,27,19),|
  !gapprompt@>| !gapinput@   ( 9,11,16,14)(10,13,15,12)( 1,17,41,40)( 4,20,44,37)( 6,22,46,35),|
  !gapprompt@>| !gapinput@   (17,19,24,22)(18,21,23,20)( 6,25,43,16)( 7,28,42,13)( 8,30,41,11),|
  !gapprompt@>| !gapinput@   (25,27,32,30)(26,29,31,28)( 3,38,43,19)( 5,36,45,21)( 8,33,48,24),|
  !gapprompt@>| !gapinput@   (33,35,40,38)(34,37,39,36)( 3, 9,46,32)( 2,12,47,29)( 1,14,48,27),|
  !gapprompt@>| !gapinput@   (41,43,48,46)(42,45,47,44)(14,22,30,38)(15,23,31,39)(16,24,32,40)|
  !gapprompt@>| !gapinput@ ];; G:=Group(gens);;P:=SylowSubgroup(G,2);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionNormalSeries(BigStepUCS(P,6),3);;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,TensorWithIntegers,2);|
  [ 2, 2, 2 ]
  
\end{Verbatim}
 The same approach is used in the following example that computes the $2$\texttt{\symbol{45}}primary part 

$H_{11}(A_7,A)_{(2)} = \mathbb Z_2 \oplus \mathbb Z_2\oplus \mathbb Z_4$ 

of the degree 11 homology of the alternating group $A_7$ of degree $7$ with coefficients in the module $A=\mathbb Z^7$ on which $A_7$ acts by permuting basis vectors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(7);;|
  !gapprompt@gap>| !gapinput@rho:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SylowSubgroup(G,2),12);;|
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithIntegralModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,F,11);|
  [ 2, 2, 4 ]
  
\end{Verbatim}
 Similar commands compute 

$H_{3}(A_{10},A)_{(2)} = \mathbb Z_4$ 

with coefficient module $A=\mathbb Z^{10}$ on which $A_{10}$ acts by permuting basis vectors. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=AlternatingGroup(10);;|
  !gapprompt@gap>| !gapinput@rho:=PermToMatrixGroup(G);;|
  !gapprompt@gap>| !gapinput@R:=ResolutionFiniteGroup(SylowSubgroup(G,2),4);;|
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithIntegralModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,R,F,3);|
  [ 4 ]
  
\end{Verbatim}
 

The following commands compute 

$H_{100}(GL(3,2),V)= K^{34}$ 

where $V$ is the vector space of dimension $3$ over $K=GF(2)$ acting via some irreducible representation $\rho\colon GL(3,2) \rightarrow GL(V)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=GL(3,2);;|
  !gapprompt@gap>| !gapinput@rho:=IrreducibleRepresentations(G,GF(2))[3];|
  CompositionMapping( [ (5,7)(6,8), (2,3,5)(4,7,6) ] -> 
  [ <an immutable 3x3 matrix over GF2>, <an immutable 3x3 matrix over GF2> ],
   <action isomorphism> )
  !gapprompt@gap>| !gapinput@F:=function(X); return TensorWithModPModule(X,rho); end;;|
  !gapprompt@gap>| !gapinput@S:=ResolutionPrimePowerGroup(SylowSubgroup(G,2),101);;|
  !gapprompt@gap>| !gapinput@PrimePartDerivedFunctorViaSubgroupChain(G,S,F,100);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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}
 }

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

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

 
\section{\textcolor{Chapter }{Cohomology as a functor of the second variable and the long exact coefficient
sequence}}\logpage{[ 7, 10, 0 ]}
\hyperdef{L}{X796731727A7EBE59}{}
{
 A short exact sequence of $\mathbb ZG$\texttt{\symbol{45}}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$\texttt{\symbol{45}}modules. The following commands compute the induced
cohomology homomorphism 

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

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

 The following commands then compute the homomorphism 

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

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

The following commands then compute the connecting homomorphism 

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

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

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

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

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

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

The cohomology of the cyclic group is well\texttt{\symbol{45}}known, and the
cohomology of a direct product can be obtained from that of the factors using
the Kunneth formula. 

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

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

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

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

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

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

 

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

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

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

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

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

$Mf^t = 0 \bmod 6$. 

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

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

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

 
\section{\textcolor{Chapter }{Quillen's complex and the $p$\texttt{\symbol{45}}part of homology }}\label{secWebb}
\logpage{[ 7, 14, 0 ]}
\hyperdef{L}{X7C5233E27D2D603E}{}
{
 Let $G$ be a finite group with order divisible by prime $p$. Let ${\mathcal A}={\mathcal A}_p(G)$ denote Quillen's simplicial complex arising as the order complex of the poset
of non\texttt{\symbol{45}}trivial elementary abelian $p$\texttt{\symbol{45}}subgroups of $G$. The group $G$ acts on $\mathcal A$. Denote the orbit of a $k$\texttt{\symbol{45}}simplex $e^k$ by $[e^k]$, and the stabilizer of $e^k$ by $Stab(e^k) \le G$. For a finite abelian group $H$ let $H_p$ denote the Sylow $p$\texttt{\symbol{45}}subgroup or the "$p$\texttt{\symbol{45}}part". In Theorem 3.3 of \cite{Webb} P.J. Webb proved the following. 

 \textsc{Theorem.}\cite{Webb} For any $G$\texttt{\symbol{45}}module $M$ there is a (non natural) isomomorphism

 $H_n(G,M)_p \oplus \bigoplus_{[e^k]\, :\, k~{\rm odd}~}H_n(Stab(e^k),M)_p \cong
\bigoplus_{[e^k]\, : \, k~{\rm even}~}H_n(Stab(e^k),M)_p$ 

 for $n\ge 1$. The isomorphism can also be expressed as 

 $H_n(G,M)_p \cong \bigoplus_{[e^k]\, : \, k~{\rm even}~}H_n(Stab(e^k),M)_p\ -\
\bigoplus_{[e^k] \, :\, k~{\rm odd}~}H_n(Stab(e^k),M)_p$ 

where terms can often be cancelled. 

Thus the additive structure of the $p$\texttt{\symbol{45}}part of the homology of $G$ is determined by that of the stabilizer groups. The result also holds with
homology replaced by cohomology. 

\textsc{Illustration 1} 

 As an illustration of the theorem, the following commands calculate 

 $H_n(SL_3(\mathbb Z_2),\mathbb Z) \cong H_n(S_4,\mathbb Z)_2 \oplus
H_n(S_4,\mathbb Z)_2 \ominus H_n(D_8,\mathbb Z)_2 \oplus H_n(S_3,\mathbb Z)_3
\oplus H_n(C_7 : C_3,\mathbb Z)_7 $ 

 where $n\ge 1$, $S_k$ denotes the symmetric group on $n$ letters, $D_8$ the dihedral group of order $8$ and $C_7 : C_3$ a nonabelian semi\texttt{\symbol{45}}direct product of cyclic groups.
Furthermore, for $n\ge 1$ 

$ H_n(C_7 : C_3,\mathbb Z)_7 =\left\{\begin{array}{ll}\mathbb Z_7,\ n \equiv 5
{\rm \ mod\ } 6\\ 0,\ {\rm otherwise} \end{array}\right.$ 

and 

$ H_n(S_3,\mathbb Z)_3 =\left\{\begin{array}{ll}\mathbb Z_3,\ n \equiv 3 {\rm \
mod\ } 4\\ 0,\ n{\rm ~otherwise .} \end{array}\right.$ 

 Formulas for $H_n(S_4,\mathbb Z)$ and $ H_n(D_8,\mathbb Z)$ can be found in the literature. Alternatively, they can be computed using \textsc{GAP} for a given value of $n$. For $n=27$ we find 

$ H_{27}(S_4,\mathbb Z)_2 \oplus H_{27}(S_4,\mathbb Z)_2 \ominus
H_{27}(D_8,\mathbb Z)_2 \cong \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb
Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_4$ 

 and 

$H_{27}(SL_3(\mathbb Z_2),\mathbb Z) \cong \mathbb Z_2 \oplus \mathbb Z_2
\oplus \mathbb Z_2 \oplus \mathbb Z_2 \oplus \mathbb Z_4 \oplus \mathbb Z_3 $ . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SL(3,2);;Factors(Order(G));|
  [ 2, 2, 2, 3, 7 ]
  !gapprompt@gap>| !gapinput@D2:=HomologicalGroupDecomposition(G,2);;|
  !gapprompt@gap>| !gapinput@D3:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@D7:=HomologicalGroupDecomposition(G,7);;|
  !gapprompt@gap>| !gapinput@List(D2[1],StructureDescription);|
  [ "S4", "S4" ]
  !gapprompt@gap>| !gapinput@List(D2[2],StructureDescription);|
  [ "D8" ]
  !gapprompt@gap>| !gapinput@List(D3[1],StructureDescription);|
  [ "S3" ]
  !gapprompt@gap>| !gapinput@List(D3[2],StructureDescription);|
  [  ]
  !gapprompt@gap>| !gapinput@List(D7[1],StructureDescription);|
  [ "C7 : C3" ]
  !gapprompt@gap>| !gapinput@List(D7[2],StructureDescription);|
  [  ]
  
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D7[1][1]);|
  6
  !gapprompt@gap>| !gapinput@List([1..6],n->GroupHomology(D7[1][1],n));|
  [ [ 3 ], [  ], [ 3 ], [  ], [ 3, 7 ], [  ] ]
  
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D3[1][1]);|
  4
  !gapprompt@gap>| !gapinput@List([1..4],n->GroupHomology(D3[1][1],n));|
  [ [ 2 ], [  ], [ 6 ], [  ] ]
  
  !gapprompt@gap>| !gapinput@R_S4:=ResolutionFiniteGroup(Group([(1,2),(2,3),(3,4)]),28);;|
  !gapprompt@gap>| !gapinput@R_D8:=ResolutionFiniteGroup(Group([(1,2),(1,3)(2,4)]),28);;|
  
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R_S4),27);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 12 ]
  !gapprompt@gap>| !gapinput@Homology(TensorWithIntegers(R_D8),27);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4 ]
  
\end{Verbatim}
 

\textsc{Illustration 2} 

 As a further illustration of the theorem, the following commands calculate 

 $H_n(M_{12},M)_3 \cong \bigoplus_{1\le i\le 3}\,H_n(Stab_i,M)_3 -
\bigoplus_{4\le i\le 5}H_n(Stab_i,M)_3$ 

 for the Mathieu simple group $M_{12}$ of order $95040$, where 

$Stab_1\cong Stab_3=(((C_3 \times C_3) : Q_8) : C_3) : C_2$ 

$Stab_2=A_4 \times S_3$ 

$Stab_4=C_3 \times S_3$ 

$Stab_5=((C_3 \times C_3) : C_3) : (C_2 \times C_2)$ . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(12);;|
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@List(D[1],StructureDescription);|
  [ "(((C3 x C3) : Q8) : C3) : C2", "A4 x S3", "(((C3 x C3) : Q8) : C3) : C2" ]
  !gapprompt@gap>| !gapinput@List(D[2],StructureDescription);|
  [ "C3 x S3", "((C3 x C3) : C3) : (C2 x C2)" ]
  
\end{Verbatim}
 

\textsc{Illustration 3} 

 As a third illustration, the following commands show that $H_n(M_{23},M)_{p}$ is periodic for primes $p=5, 7, 11, 23$ of periods dividing $8, 6, 10, 22$ respectively. They also show that $H_n(M_{23},\mathbb Z)_{(3)}=0$ for $n=8,9,12,13$ and $H_n(M_{23},\mathbb Z)_{(3)}=\mathbb Z_3$ for $n=10,11$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(23);;|
  !gapprompt@gap>| !gapinput@Factors(Order(G));|
  [ 2, 2, 2, 2, 2, 2, 2, 3, 3, 5, 7, 11, 23 ]
  
  !gapprompt@gap>| !gapinput@sd:=StructureDescription;;|
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,5);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C15 : C4" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  8
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,7);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C2 x (C7 : C3)" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  6
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,11);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C11 : C5" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  10
  
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,23);;|
  !gapprompt@gap>| !gapinput@List(D[1],sd);List(D[2],sd);|
  [ "C23 : C11" ]
  [  ]
  !gapprompt@gap>| !gapinput@IsPeriodic(D[1][1]);|
  true
  !gapprompt@gap>| !gapinput@CohomologicalPeriod(D[1][1]);|
  22
  
\end{Verbatim}
 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(23);;|
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@List(D[1],StructureDescription);List(D[2],StructureDescription);|
  [ "(C3 x C3) : QD16", "A5 : S3" ]
  [ "S3 x S3" ]
  !gapprompt@gap>| !gapinput@for n in [8..13] do|
  !gapprompt@>| !gapinput@Print(List(D[1],g->GroupHomology(g,n))," , ",List(D[2],g->GroupHomology(g,n)),"\n\n");|
  !gapprompt@>| !gapinput@od;|
  [ [ 2, 2 ], [ 2, 2, 2 ] ] , [ [ 2, 2, 2, 2 ] ]
  
  [ [ 2, 2, 2, 2 ], [ 2, 2, 2, 2 ] ] , [ [ 2, 2, 2, 2, 2, 2 ] ]
  
  [ [ 2, 2, 3 ], [ 2, 2, 2, 3, 3 ] ] , [ [ 2, 2, 2, 2, 2, 3, 3 ] ]
  
  [ [ 2, 2, 2, 8, 3 ], [ 2, 2, 2, 2, 4, 3, 3, 3, 3 ] ] , 
  [ [ 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3 ] ]
  
  [ [ 2, 2, 2 ], [ 2, 2, 2, 2 ] ] , [ [ 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 order $|M_{23}|=10200960$ is divisible by primes $p=2, 3, 5, 7, 11, 23$. For $p=3$ the following commands establish that the Poincare series 

$(x^{16} - 2x^{15}$ $ + 3x^{14} - 4x^{13}$ $ + 4x^{12} - 4x^{11}$ $ + 4x^{10} - 3x^9$ $ + 3x^8 - 3x^7 +$ $ 4x^6 - 4x^5 $ $+ 4x^4 -4x^3$ $ + 3x^2 -2x + 1) /$ $ (x^{18} - 2x^{17}$ $ + 3x^{16} - 4x^{15}$ $ + 4x^{14} - $ $4x^{13} + 4x^{12}$ $ - 4x^{11} + 4x^{10}$ $ - 4x^9 + 4x^8$ $ - 4x^7 + 4x^6 $ $ - 4x^5 + 4x^4$ $ - 4x^3 +$ $ 3x^2 - 2x + 1)$ 

describes the dimension of the vector space $H^n(M_{23},\mathbb Z_3)$ up to at least degree $n=40$. To prove that it describes the dimension in all degrees one would need to
verify "completion criteria". 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(23);;|
  !gapprompt@gap>| !gapinput@D:=HomologicalGroupDecomposition(G,3);;|
  !gapprompt@gap>| !gapinput@List(D[1],StructureDescription);|
  [ "(C3 x C3) : QD16", "A5 : S3" ]
  !gapprompt@gap>| !gapinput@List(D[2],StructureDescription);|
  [ "S3 x S3" ]
  
  !gapprompt@gap>| !gapinput@P1:=PoincareSeriesPrimePart(D[1][1],3,40);|
  (x_1^16-2*x_1^15+3*x_1^14-4*x_1^13+4*x_1^12-4*x_1^11+4*x_1^10-3*x_1^9+3*x_1^8-3*x_1^7+4*x_1^6-4*x_1^5+\
  4*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)/(x_1^18-2*x_1^17+3*x_1^16-4*x_1^15+4*x_1^14-4*x_1^13+4*x_1^12-4*x_1^1\
  1+4*x_1^10-4*x_1^9+4*x_1^8-4*x_1^7+4*x_1^6-4*x_1^5+4*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@P2:=PoincareSeriesPrimePart(D[1][2],3,40);|
  (x_1^4-2*x_1^3+3*x_1^2-2*x_1+1)/(x_1^6-2*x_1^5+3*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@P3:=PoincareSeriesPrimePart(D[2][1],3,40);|
  (x_1^4-2*x_1^3+3*x_1^2-2*x_1+1)/(x_1^6-2*x_1^5+3*x_1^4-4*x_1^3+3*x_1^2-2*x_1+1)
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Homology of a Lie algebra}}\logpage{[ 7, 15, 0 ]}
\hyperdef{L}{X865CC8E0794C0E61}{}
{
 Let $A$ be the Lie algebra constructed from the associative algebra $M^{4\times 4}(\mathbb Q)$ of all $4\times 4$ rational matrices. Let $V$ be its adjoint module (with underlying vector space of dimension $16$ and equal to that of $A$). The following commands compute $H_{4}(A,V) = \mathbb Q$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|M:=FullMatrixAlgebra(Rationals,4);; B
  @gapprompt|gap>B @gapinput|A:=LieAlgebra(M);;B
  @gapprompt|gap>B @gapinput|V:=AdjointModule(A);;B
  @gapprompt|gap>B @gapinput|C:=ChevalleyEilenbergComplex(V,17);;B
  @gapprompt|gap>B @gapinput|List([0..17],C!.dimension);B
  [ 16, 256, 1920, 8960, 29120, 69888, 128128, 183040, 205920, 183040, 128128, 
    69888, 29120, 8960, 1920, 256, 16, 0 ]
  @gapprompt|gap>B @gapinput|Homology(C,4);B
  1
  
\end{Verbatim}
 

Note that the eighth term $C_{8}(V)$ in the Chevalley\texttt{\symbol{45}}Eilenberg complex $C_\ast(V)$ is a vector space of dimension $205920$ and so it will take longer to compute the homology in degree $8$. 

As a second example, let $B$ be the classical Lie ring of type $B_3$ over the ring of integers. The following commands compute $H_3(B,\mathbb Z)= \mathbb Z \oplus \mathbb Z_2^{105}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@A:=SimpleLieAlgebra("B",7,Integers);       |
  <Lie algebra of dimension 105 over Integers>
  !gapprompt@gap>| !gapinput@C:=ChevalleyEilenbergComplex(A,4,"sparse");|
  Sparse chain complex of length 4 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@D:=ContractedComplex(C);|
  Sparse chain complex of length 4 in characteristic 0 . 
  
  !gapprompt@gap>| !gapinput@Collected(Homology(D,3));|
  [ [ 0, 1 ], [ 2, 105 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Covers of Lie algebras}}\logpage{[ 7, 16, 0 ]}
\hyperdef{L}{X86B4EE4783A244F7}{}
{
 A short exact sequence of Lie algebras 

$ M \rightarrowtail C \twoheadrightarrow L $ 

 (over a field $k$) is said to be a \emph{stem extension} of $L$ if $M$ lies both in the centre $Z(C)$ and in the derived subalgeba $C^2$. If, in addition, the rank of the vector space $M$ is equal to the rank of the second Chevalley\texttt{\symbol{45}}Eilenberg
homology $H_2(L,k)$ then the Lie algebra $C$ is said to be a \emph{cover} of $L$. 

Each finite dimensional Lie algebra $L$ admits a cover $C$, and this cover can be shown to be unique up to Lie isomorphism. 

The cover can be used to determine whether there exists a Lie algebra $E$ whose central quotient $E/Z(E)$ is isomorphic to $L$. The image in $L$ of the centre of $C$ is called the \emph{Lie Epicentre} of $L$, and this image is trivial if and only if such an $E$ exists. 

The cover can also be used to determine the stem extensions of $L$. It can be shown that each stem extension is a quotient of the cover by an
ideal in the Lie multiplier $H_2(L,k)$. 
\subsection{\textcolor{Chapter }{Computing a cover}}\logpage{[ 7, 16, 1 ]}
\hyperdef{L}{X7DFF32A67FF39C82}{}
{
 The following commands compute the cover $C$ of the solvable but non\texttt{\symbol{45}}nilpotent
13\texttt{\symbol{45}}dimensional Lie algebra $L$ (over $k=\mathbb Q$) that was introduced by M. Wuestner \cite{Wustner}. They also show that: the second homology of $C$ is trivial and compute the ranks of the homology groups in other dimensions;
the Lie algebra $L$ is not isomorphic to any central quotient $E/Z(E)$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@SCTL:=EmptySCTable(13,0,"antisymmetric");;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 6, [ 1, 7 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 8, [ 1, 9 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 10, [ 1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 12, [ 1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 7, [ -1, 6 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 9, [ -1, 8 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 11, [ -1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 1, 13, [ -1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 7, [ 1, 2 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 8, 9, [ 1, 3 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 9, [ -1, 5 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 7, 8, [ 1, 5 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 8, [ 1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 9, [ 1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 3, 6, [ 1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 3, 7, [ 1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 2, 3, [ 1, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 6, [ -1, 12 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 7, [ -1, 13 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 8, [ -1, 10 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 5, 9, [ -1, 11 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 6, 11, [ -1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 7, 10, [ 1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 8, 13, [ 1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@SetEntrySCTable( SCTL, 9, 12, [ -1/2, 4 ] );;|
  !gapprompt@gap>| !gapinput@L:=LieAlgebraByStructureConstants(Rationals,SCTL);;|
  
  !gapprompt@gap>| !gapinput@C:=Source(LieCoveringHomomorphism(L));|
  <Lie algebra of dimension 15 over Rationals>
  
  !gapprompt@gap>| !gapinput@Dimension(LieEpiCentre(L));|
  1
  
  !gapprompt@gap>| !gapinput@ch:=ChevalleyEilenbergComplex(C,17);;|
  !gapprompt@gap>| !gapinput@List([0..16],n->Homology(ch,n));     |
  [ 1, 1, 0, 9, 23, 27, 47, 88, 88, 47, 27, 23, 9, 0, 1, 1, 0 ]
  
\end{Verbatim}
 }

 }

 }

 
\chapter{\textcolor{Chapter }{Cohomology rings and Steenrod operations for groups}}\logpage{[ 8, 0, 0 ]}
\hyperdef{L}{X7ED29A58858AAAF2}{}
{
 
\section{\textcolor{Chapter }{Mod\texttt{\symbol{45}}$p$ cohomology rings of finite groups}}\logpage{[ 8, 1, 0 ]}
\hyperdef{L}{X877CAF8B7E64DE04}{}
{
 For a finite group $G$, prime $p$ and positive integer $deg$ the function \texttt{ModPCohomologyRing(G,p,deg)} computes a finite dimensional graded ring equal to the cohomology ring $H^{\le deg}(G,\mathbb Z_p) := H^\ast(G,\mathbb Z_p)/\{x=0\ :\ {\rm
degree}(x)>deg \}$ . 

The following example computes the first $14$ degrees of the cohomology ring $H^\ast(M_{11},\mathbb Z_2)$ where $M_{11}$ is the Mathieu group of order $7920$. The ring is seen to be generated by three elements $a_3, a_4, a_6$ in degrees $3,4,5$. 
\begin{Verbatim}[commandchars=@|B,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>B @gapinput|G:=MathieuGroup(11);;          B
  @gapprompt|gap>B @gapinput|p:=2;;deg:=14;;B
  @gapprompt|gap>B @gapinput|A:=ModPCohomologyRing(G,p,deg);B
  <algebra over GF(2), with 20 generators>
  
  @gapprompt|gap>B @gapinput|gns:=ModPRingGenerators(A);B
  [ v.1, v.6, v.8+v.10, v.13 ]
  @gapprompt|gap>B @gapinput|List(gns,A!.degree);B
  [ 0, 3, 4, 5 ]
  
\end{Verbatim}
 

The following additional command produces a rational function $f(x)$ whose series expansion $f(x) = \sum_{i=0}^\infty f_ix^i$ has coefficients $f_i$ which are guaranteed to satisfy $f_i = \dim H^i(G,\mathbb Z_p)$ in the range $0\le i\le deg$. We refer to $f(x)$ as the \emph{Poincare series} for the group at the prime $p=2$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(A);|
  (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)
  
  
  !gapprompt@gap>| !gapinput@Let's use f to list the first few cohomology dimensions|
  !gapprompt@gap>| !gapinput@ExpansionOfRationalFunction(f,deg); |
  [ 1, 0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 2, 3, 2, 2 ]
  
\end{Verbatim}
 An alternative command for computing the Poincare series is the following. In
this alternative we choose to ensure correctness in degrees $\le 100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@PoincareSeriesPrimePart(MathieuGroup(11),2,100);|
  The series is guaranteed correct for group cohomology in degrees < 101
  (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}
 If one needs to verify that the Poincare series is valid in all degrees then
more work is required. One readily implemented (but computationally
non\texttt{\symbol{45}}optimal) approach is to use Peter Symmonds result \cite{Symmonds} that: if a non\texttt{\symbol{45}}cyclic finite group $G$ has a faithful complex representation equal to a sum of irreducibles of
dimensions $n_i$ then the cohomology ring $H^\ast(G,\mathbb Z_p)$ is generated by elements of degree at most $\sum n_i^2$; a degree bound for the relations is $2 \sum n_i^2$. The following commands use this bound, in conjunction with Webb's result \ref{secWebb} on the Quillen complex, to obtained a Poincare series that is guaranteed
correct in all degree. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=MathieuGroup(11);;|
  !gapprompt@gap>| !gapinput@h:=HomologicalGroupDecomposition(G,2);;|
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[1][1]);|
  rec( generators_degree_bound := 4, relators_degree_bound := 8 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[1][1],2,9);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f11:=HilbertPoincareSeries(F);|
  (x_1^2-x_1+1)/(x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[1][2]);|
  rec( generators_degree_bound := 9, relators_degree_bound := 18 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[1][2],2,19);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f12:=HilbertPoincareSeries(F);|
  (x_1^2+1)/(x_1^4-x_1^3-x_1+1)
  
  !gapprompt@gap>| !gapinput@ModPCohomologyPresentationBounds(h[2][1]);|
  rec( generators_degree_bound := 4, relators_degree_bound := 8 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(h[2][1],2,9);;F:=PresentationOfGradedStructureConstantAlgebra(A);;f21:=HilbertPoincareSeries(F);|
  (1)/(x_1^2-2*x_1+1)
  
  !gapprompt@gap>| !gapinput@f11+f12-f21;|
  (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}
 
\subsection{\textcolor{Chapter }{Ring presentations (for the commutative $p=2$ case)}}\logpage{[ 8, 1, 1 ]}
\hyperdef{L}{X870E0299782638AF}{}
{
 The cohomology ring $H^\ast(G,\mathbb Z_p)$ is graded commutative which, in the case $p=2$, implies strictly commutative. The following additional commands can be
applied in the $p=2$ setting to determine a presentation for a graded commutative ring $F$ that is guaranteed to be isomorphic to the cohomology ring $H^\ast(G,\mathbb Z_p)$ in degrees $i\le deg$. If $deg$ is chosen "sufficiently large" then $F$ will be isomorphic to the cohomology ring. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@F:=PresentationOfGradedStructureConstantAlgebra(A);|
  Graded algebra GF(2)[ x_1, x_2, x_3 ] / [ x_1^2*x_2+x_3^2 
   ] with indeterminate degrees [ 3, 4, 5 ]
  
\end{Verbatim}
 

 The additional command 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=HilbertPoincareSeries(F);|
  (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}
 invokes a call to \textsc{Singular} in order to calculate the Poincare series of the graded algebra $F$. }

 }

 
\section{\textcolor{Chapter }{Poincare Series for Mod\texttt{\symbol{45}}$p$ cohomology}}\logpage{[ 8, 2, 0 ]}
\hyperdef{L}{X862538218748627F}{}
{
 For a finite $p$\texttt{\symbol{45}}group $G$ the command \texttt{PoincarePolynomial(G)} returns a rational function $f(x)=p(x)/q(x)$ whose series expansion $f(x) = \sum_{i=0}^\infty f_ix^i$ has coefficients $f_i$ that are guaranteed to satisfy $f_i = \dim H^i(G,\mathbb Z_p)$ in the range $0\le i < 1+ deg$ for some displayed value of $deg$. Furthermore, the coefficients $f_i$ are guaranteed to be integers for all $0\le i\le 1000$ and the order of the pole of $f(x)$ at $x=1$ is guaranteed to equal the $p$\texttt{\symbol{45}}rank of $G$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SmallGroup(3^4,10);;|
  !gapprompt@gap>| !gapinput@StructureDescription(G);|
  "C3 . ((C3 x C3) : C3) = (C3 x C3) . (C3 x C3)"
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(G);|
  The series is guaranteed correct for group cohomology in degrees < 14
  (-x_1^3+x_1^2+1)/(x_1^6-2*x_1^5+2*x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
\end{Verbatim}
 

If a higher value of $deg$ is required then this can be entered as an optional second argument. For
instance, the following increases the value to $deg=100$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@f:=PoincareSeries(G,100);|
  The series is guaranteed correct for group cohomology in degrees < 101
  (-x_1^3+x_1^2+1)/(x_1^6-2*x_1^5+2*x_1^4-2*x_1^3+2*x_1^2-2*x_1+1)
  
\end{Verbatim}
 

 As mentioned above, one approach to verifying that the Poincare series is
valid in all degrees is to use Peter Symmonds result \cite{Symmonds} that: if a non\texttt{\symbol{45}}cyclic finite group $G$ has a faithful complex representation equal to a sum of irreducibles of
dimensions $n_i$ then the cohomology ring $H^\ast(G,\mathbb Z_p)$ is generated by elements of degree at most $\sum n_i^2$; a degree bound for the relations is $2 \sum n_i^2$. Thus, if we use at least $\sum n_i^2$ degrees of a resolution to construct a presentation for the cohomology ring
then the presented ring maps surjectively onto the actual cohomology ring.
Furthermore, if this surjection is a bijection in the first $2 \sum n_i^2$ degrees then it is necessarily an isomorphism in all degrees. 

 The following commands use this approach to obtain a guaranteed presentation
and Poincare series for the Sylow $2$\texttt{\symbol{45}}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@ModPCohomologyPresentationBounds(G);|
  rec( generators_degree_bound := 16, relators_degree_bound := 32 )
  !gapprompt@gap>| !gapinput@A:=ModPCohomologyRing(G,16);;|
  !gapprompt@gap>| !gapinput@F:=PresentationOfGradedStructureConstantAlgebra(A);|
  Graded algebra GF(2)[ x_1, x_2, x_3, x_4, x_5, x_6, x_7 ] / 
  [ x_1*x_3, x_1*x_2, x_1*x_4, x_2*x_3^2+x_3^3+x_3*x_4+x_3*x_5, 
    x_2*x_6+x_3*x_6+x_4*x_5, x_2*x_3*x_4+x_3^2*x_4+x_3*x_6, 
    x_2^2*x_4+x_3^2*x_4+x_3*x_6+x_4^2, x_3^2*x_6+x_3*x_4^2+x_3*x_4*x_5, 
    x_2*x_4*x_5+x_4*x_6, x_3^2*x_4*x_5+x_3*x_4*x_6+x_3*x_5*x_6, 
    x_1^3*x_6+x_1^2*x_7+x_1*x_5*x_6+x_3*x_5*x_6+x_4*x_5^2+x_6^2, 
    x_3*x_4^2*x_5+x_3*x_6^2 ] with indeterminate degrees [ 1, 1, 1, 2, 2, 3, 4 ]
  !gapprompt@gap>| !gapinput@f:=HilbertPoincareSeries(F);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
  !gapprompt@gap>| !gapinput@ff:=PoincareSeries(G,32);|
  The series is guaranteed correct for group cohomology in degrees < 33
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 

 An alternative approach to obtaining a guaranteed presentation is to implement
Len even's spectral sequence proof of the finite generation of cohomology
rings of finite groups. The following example determines a guaranteed
presentation in this way for the cohomology ring $H^\ast(Syl_2(M_{12}),\mathbb Z_2)$. The Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence, and Groebner basis routines from \textsc{Singular} (for commutative rings), are used to determine how much of a resolution is
needed to compute the guaranteed correct presentation. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@F:=Mod2CohomologyRingPresentation(G);|
  Alpha version of completion test code will be used. This needs further work.
  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_1^3+x_1^2*x_3+x_1*x_5, 
    x_1*x_3*x_4+x_1*x_3*x_5+x_3^2*x_4+x_1*x_6+x_3*x_6+x_4*x_5, 
    x_1^2*x_4+x_1^2*x_5+x_1*x_3*x_5+x_3^2*x_4+x_1*x_6+x_4^2, 
    x_1^2*x_3^2+x_1^2*x_5+x_1*x_3*x_5+x_1*x_6+x_3*x_6+x_4^2+x_4*x_5, 
    x_1^2*x_6+x_1*x_3*x_6+x_1*x_4*x_5+x_3^2*x_6+x_3*x_4^2+x_3*x_4*x_5, 
    x_1*x_3^2*x_5+x_3^3*x_4+x_1*x_3*x_6+x_1*x_4^2+x_3^2*x_6+x_3*x_4^2+x_4*x_6,
    x_1^2*x_3*x_5+x_1*x_3*x_6+x_1*x_4^2+x_1*x_5^2, 
    x_3^3*x_6+x_3^2*x_4^2+x_3^2*x_4*x_5+x_3*x_4*x_6+x_3*x_5*x_6+x_4^3+x_4*x_5^2, 
    x_1*x_3^2*x_6+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_6^2, 
    x_1^2*x_5^2+x_1*x_3*x_5^2+x_3^2*x_4^2+x_3^2*x_4*x_5+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 ]
  
  !gapprompt@gap>| !gapinput@f:=HilbertPoincareSeries(F);|
  (1)/(-x_1^3+3*x_1^2-3*x_1+1)
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Functorial ring homomorphisms in Mod\texttt{\symbol{45}}$p$ cohomology}}\logpage{[ 8, 3, 0 ]}
\hyperdef{L}{X780DF87680C3F52B}{}
{
 The following example constructs the ring homomorphism 

$F\colon H^{\le deg}(G,\mathbb Z_p) \rightarrow H^{\le deg}(H,\mathbb Z_p)$ 

 induced by the group homomorphism $f\colon H\rightarrow G$ with $H=A_5$, $G=S_5$, $f$ the canonical inclusion of the alternating group into the symmetric group, $p=2$ and $deg=7$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(5);;H:=AlternatingGroup(5);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@p:=2;; deg:=7;;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,p,deg);|
  [ v.1, v.2, v.4+v.6, v.5, v.7, v.8, v.9, v.12+v.15, v.13, v.14, v.16+v.17, 
    v.18, v.19, v.20, v.22+v.24+v.28, v.23, v.25, v.26, v.27 ] -> 
  [ v.1, 0*v.1, v.4+v.5+v.6, 0*v.1, v.7+v.8, 0*v.1, 0*v.1, v.14+v.15, 0*v.1, 
    0*v.1, v.16+v.17+v.19, 0*v.1, 0*v.1, 0*v.1, v.22+v.23+v.26+v.27+v.28, 
    v.25, 0*v.1, 0*v.1, 0*v.1 ]
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Testing homomorphism properties}}\logpage{[ 8, 3, 1 ]}
\hyperdef{L}{X834CED9D7A104695}{}
{
 

The following commands are consistent with $F$ being a ring homomorphism. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@x:=Random(Source(F));|
  v.4+v.6+v.8+v.9+v.12+v.13+v.14+v.15+v.18+v.20+v.22+v.24+v.25+v.28+v.32+v.35
  !gapprompt@gap>| !gapinput@y:=Random(Source(F));|
  v.1+v.2+v.7+v.9+v.13+v.23+v.26+v.27+v.32+v.33+v.34+v.35
  !gapprompt@gap>| !gapinput@Image(F,x)+Image(F,y)=Image(F,x+y);|
  true
  !gapprompt@gap>| !gapinput@Image(F,x)*Image(F,y)=Image(F,x*y);|
  true
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Testing functorial properties}}\logpage{[ 8, 3, 2 ]}
\hyperdef{L}{X7A0D505D844F0CD4}{}
{
 The following example takes two "random" automorphisms $f,g\colon K\rightarrow K$ of the group $K$ of order $24$ arising as the direct product $K=C_3\times Q_8$ and constructs the three ring isomorphisms $F,G,FG\colon H^{\le 5}(K,\mathbb Z_2) \rightarrow H^{\le 5}(K,\mathbb Z_2)$ induced by $f, g$ and the composite $f\circ g$. It tests that $FG$ is indeed the composite $G\circ F$. Note that when we create the ring $H^{\le 5}(K,\mathbb Z_2)$ twice in \textsc{GAP} we obtain two canonically isomorphic but distinct implimentations of the ring.
Thus the canocial isomorphism between these distinct implementations needs to
be incorporated into the test. Note also that \textsc{GAP} defines $g\ast f = f\circ g$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=SmallGroup(24,11);;|
  !gapprompt@gap>| !gapinput@aut:=AutomorphismGroup(K);;|
  !gapprompt@gap>| !gapinput@f:=Elements(aut)[5];;|
  !gapprompt@gap>| !gapinput@g:=Elements(aut)[8];;|
  !gapprompt@gap>| !gapinput@fg:=g*f;;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.2+v.3, v.3, v.4+v.5, v.5, 
    v.6, v.7 ]
  !gapprompt@gap>| !gapinput@G:=ModPCohomologyRing(g,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.2+v.3, v.2, v.5, v.4+v.5, 
    v.6, v.7 ]
  !gapprompt@gap>| !gapinput@FG:=ModPCohomologyRing(fg,2,5);|
  [ v.1, v.2, v.3, v.4, v.5, v.6, v.7 ] -> [ v.1, v.3, v.2, v.4, v.4+v.5, v.6, 
    v.7 ]
  
  !gapprompt@gap>| !gapinput@sF:=Source(F);;tF:=Target(F);;|
  !gapprompt@gap>| !gapinput@sG:=Source(G);; |
  !gapprompt@gap>| !gapinput@tGsF:=AlgebraHomomorphismByImages(tF,sG,Basis(tF),Basis(sG));;|
  !gapprompt@gap>| !gapinput@List(GeneratorsOfAlgebra(sF),x->Image(G,Image(tGsF,Image(F,x))));|
  [ v.1, v.3, v.2, v.4, v.4+v.5, v.6, v.7 ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Computing with larger groups}}\logpage{[ 8, 3, 3 ]}
\hyperdef{L}{X855764877FA44225}{}
{
 

Mod\texttt{\symbol{45}}$p$ cohomology rings of finite groups are constructed as the rings of stable
elements in the cohomology of a (non\texttt{\symbol{45}}functorially) chosen
Sylow $p$\texttt{\symbol{45}}subgroup and thus require the construction of a free
resolution only for the Sylow subgroup. However, to ensure the functoriality
of induced cohomology homomorphisms the above computations construct free
resolutions for the entire groups $G,H$. This is a more expensive computation than finding resolutions just for Sylow
subgroups. 

The default algorithm used by the function \texttt{ModPCohomologyRing()} for constructing resolutions of a finite group $G$ is \texttt{ResolutionFiniteGroup()} or \texttt{ResolutionPrimePowerGroup()} in the case when $G$ happens to be a group of prime\texttt{\symbol{45}}power order. If the user is
able to construct the first $deg$ terms of free resolutions $RG, RH$ for the groups $G, H$ then the pair \texttt{[RG,RH]} can be entered as the third input variable of \texttt{ModPCohomologyRing()}. 

For instance, the following example constructs the ring homomorphism 

$F\colon H^{\le 7}(A_6,\mathbb Z_2) \rightarrow H^{\le 7}(S_6,\mathbb Z_2)$ 

 induced by the the canonical inclusion of the alternating group $A_6$ into the symmetric group $S_6$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SymmetricGroup(6);;|
  !gapprompt@gap>| !gapinput@H:=AlternatingGroup(6);;|
  !gapprompt@gap>| !gapinput@f:=GroupHomomorphismByFunction(H,G,x->x);;|
  !gapprompt@gap>| !gapinput@RG:=ResolutionFiniteGroup(G,7);;   |
  !gapprompt@gap>| !gapinput@RH:=ResolutionFiniteSubgroup(RG,H);;|
  !gapprompt@gap>| !gapinput@F:=ModPCohomologyRing(f,2,[RG,RH]);       |
  [ v.1, v.2+v.3, v.6+v.8+v.10, v.7+v.9, v.11+v.12, v.13+v.15+v.16+v.18+v.19, 
    v.14+v.16+v.19, v.17, v.22, v.23+v.28+v.32+v.35, 
    v.24+v.26+v.27+v.29+v.32+v.33+v.35, v.25+v.26+v.27+v.29+v.32+v.33+v.35, 
    v.30+v.32+v.33+v.34+v.35, v.36+v.39+v.43+v.45+v.47+v.49+v.50+v.55, 
    v.38+v.45+v.47+v.49+v.50+v.55, v.40, 
    v.41+v.43+v.45+v.47+v.48+v.49+v.50+v.53+v.55, 
    v.42+v.43+v.45+v.46+v.47+v.49+v.53+v.54, v.44+v.45+v.46+v.47+v.49+v.53+v.54,
    v.51+v.52, v.58+v.60, v.59+v.68+v.73+v.77+v.81+v.83, 
    v.62+v.68+v.74+v.77+v.78+v.80+v.81+v.83+v.84, 
    v.63+v.69+v.73+v.74+v.78+v.80+v.84, v.64+v.68+v.73+v.77+v.81+v.83, v.65, 
    v.66+v.75+v.81, v.67+v.68+v.69+v.70+v.73+v.74+v.78+v.80+v.84, 
    v.71+v.72+v.73+v.76+v.77+v.78+v.80+v.82+v.83+v.84, v.79 ] -> 
  [ v.1, 0*v.1, v.4+v.5+v.6, 0*v.1, v.8, v.8, 0*v.1, v.7, 0*v.1, 
    v.12+v.13+v.14+v.15, v.12+v.13+v.14+v.15, v.12+v.13+v.14+v.15, 
    v.12+v.13+v.14+v.15, v.18+v.19, 0*v.1, 0*v.1, v.18+v.19, v.18+v.19, 
    v.18+v.19, v.16+v.17, 0*v.1, v.25, v.22+v.24+v.25+v.26+v.27+v.28, 
    v.22+v.24+v.25+v.26+v.27+v.28, 0*v.1, 0*v.1, v.25, v.22+v.24+v.26+v.27+v.28,
    v.22+v.24+v.26+v.27+v.28, v.23 ]
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Steenrod operations for finite $2$\texttt{\symbol{45}}groups}}\logpage{[ 8, 4, 0 ]}
\hyperdef{L}{X80114B0483EF9A67}{}
{
 The command \texttt{CohomologicalData(G,n)} prints complete information for the cohomology ring $H^\ast(G, Z_2 )$ and steenrod operations for a $2$\texttt{\symbol{45}}group $G$ provided that the integer $n$ is at least the maximal degree of a generator or relator in a minimal set of
generatoirs and relators for the ring. 

The following example produces complete information on the Steenrod algebra of
group number $8$ in \textsc{GAP}'s library of groups of order $32$. Groebner basis routines (for commutative rings) from \textsc{Singular} are called in the example. (This example take over 2 hours to run. Most other
groups of order 32 run significantly quicker.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@CohomologicalData(SmallGroup(32,8),12);|
  
  Integer argument is large enough to ensure completeness of cohomology ring presentation.
  
  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$\texttt{\symbol{45}}group}}\logpage{[ 8, 5, 0 ]}
\hyperdef{L}{X7D5ACA56870A40E9}{}
{
 The following example constructs the first eight degrees of the
mod\texttt{\symbol{45}}$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}
 }

 
\section{\textcolor{Chapter }{Mod\texttt{\symbol{45}}$p$ cohomology rings of crystallographic groups}}\logpage{[ 8, 6, 0 ]}
\hyperdef{L}{X7D2D26C0784A0E14}{}
{
 Mod $p$ cohomology ring computations can be attempted for any group $G$ for which we can compute sufficiently many terms of a free $ZG$\texttt{\symbol{45}}resolution with contracting homotopy. The contracting
homotopy is not needed if only the dimensions of the cohomology in each degree
are sought. Crystallographic groups are one class of infinite groups where
such computations can be attempted. 
\subsection{\textcolor{Chapter }{Poincare series for crystallographic groups}}\logpage{[ 8, 6, 1 ]}
\hyperdef{L}{X81C107C07CF02F0E}{}
{
 Consider the space group $G=SpaceGroupOnRightIT(3,226,'1')$. The following computation computes the infinite series 

 $(-2x^4+2x^2+1)/(-x^5+2x^4-x^3+x^2-2x+1)$ 

in which the coefficient of the monomial $x^n$ is guaranteed to equal the dimension of the vector space $H^n(G,\mathbb Z_2)$ in degrees $n\le 14$. One would need to involve a theoretical argument to establish that this
equality in fact holds in every degree $n\ge 0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SpaceGroupIT(3,226);|
  SpaceGroupOnRightIT(3,226,'1')
  !gapprompt@gap>| !gapinput@R:=ResolutionSpaceGroup(G,15);|
  Resolution of length 15 in characteristic 0 for <matrix group with 
  8 generators> . 
  No contracting homotopy available. 
  
  !gapprompt@gap>| !gapinput@D:=List([0..14],n->Cohomology(HomToIntegersModP(R,2),n));|
  [ 1, 2, 5, 9, 11, 15, 20, 23, 28, 34, 38, 44, 51, 56, 63 ]
  
  !gapprompt@gap>| !gapinput@PoincareSeries(D,14);|
  (-2*x_1^4+2*x_1^2+1)/(-x_1^5+2*x_1^4-x_1^3+x_1^2-2*x_1+1)
  
  
\end{Verbatim}
 Consider the space group $SpaceGroupOnRightIT(3,103,'1')$. The following computation uses a different construction of a free resolution
to compute the infinite series 

 $ (x^3+2x^2+2x+1)/(-x+1) $ 

in which the coefficient of the monomial $x^n$ is guaranteed to equal the dimension of the vector space $H^n(G,\mathbb Z_2)$ in degrees $n\le 99$. The final commands show that $G$ acts on a (cubical) cellular decomposition of $\mathbb R^3$ with cell ctabilizers being either trivial or cyclic of order $2$ or $4$. From this extra calculation it follows that the cohomology is periodic in
degrees greater than $3$ and that the Poincare series is correct in every degree $n \ge 0$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|G:=SpaceGroupIT(3,103);A
  SpaceGroupOnRightIT(3,103,'1')
  @gapprompt|gap>A @gapinput|R:=ResolutionCubicalCrystGroup(G,100);A
  Resolution of length 100 in characteristic 0 for <matrix group with 6 generators> . 
  
  @gapprompt|gap>A @gapinput|D:=List([0..99],n->Cohomology(HomToIntegersModP(R,2),n));;A
  @gapprompt|gap>A @gapinput|PoincareSeries(D,99);A
  (x_1^3+2*x_1^2+2*x_1+1)/(-x_1+1)
  
  
  #Torsion subgroups are cyclic
  @gapprompt|gap>A @gapinput|B:=CrystGFullBasis(G);;A
  @gapprompt|gap>A @gapinput|C:=CrystGcomplex(GeneratorsOfGroup(G),B,1);;A
  @gapprompt|gap>A @gapinput|for n in [0..3] doA
  @gapprompt|>A @gapinput|for k in [1..C!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print(StructureDescription(C!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  C4  C2  C4  1  1  C4  C2  C4  1  1  1  1  
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Mod $2$ cohomology rings of $3$\texttt{\symbol{45}}dimensional crystallographic groups}}\logpage{[ 8, 6, 2 ]}
\hyperdef{L}{X7F5C242F7BC938A5}{}
{
 Computations in the \emph{integral} cohomology of a crystallographic group are illustrated in Section \ref{secOrbifolds}. The commands underlying that illustration could be further developed and
adapted to mod $p$ cohomology. Indeed, the authors of the paper \cite{liuye} have developed commands for accessing the mod $2$ cohomology of $3$\texttt{\symbol{45}}dimensional crystallographic groups with the aim of
establishing a connection between these rings and the lattice structure of
crystals with space group symmetry. Their code is available at the github
repository \cite{liuyegithub}. In particular, their code contains the command 
\begin{itemize}
\item  \texttt{SpaceGroupCohomologyRingGapInterface(ITC)}
\end{itemize}
 that inputs an integer in the range $1\le ITC\le 230$ corresponding to the numbering of a $3$\texttt{\symbol{45}}dimensional space group $G$ in the International Table for Crystallography. This command returns 
\begin{itemize}
\item  a presentation for the mod $2$ cohomology ring $H^\ast(G,\mathbb Z_2)$. The presentation is guaranteed to be correct for low degree cohomology. In
cases where the cohomology is periodic in degrees $ \ge 5$ (which can be tested using \texttt{IsPeriodicSpaceGroup(G)}) the presentation is guaranteed correct in all degrees. In
non\texttt{\symbol{45}}periodic cases some additional mathematical argument
needs to be provided to be mathematically sure that the presentation is
correct in all degrees. 
\item  the Lieb\texttt{\symbol{45}}Schultz\texttt{\symbol{45}}Mattis anomaly
(degree\texttt{\symbol{45}}3 cocycles) associated with the Irreducible Wyckoff
Position (see the paper \cite{liuye} for a definition). 
\end{itemize}
 The command \texttt{SpaceGroupCohomologyRingGapInterface(ITC)} is fast for most groups (a few seconds to a few minutes) but can be very slow
for certain space groups (e.g. ITC $= 228$ and ITC $= 142$). The following illustration assumes that two relevant files have been
downloaded from \cite{liuyegithub} and illustrates the command for ITC $ =30$ and ITC $=216$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Read("SpaceGroupCohomologyData.gi");        #These two files must be |
  !gapprompt@gap>| !gapinput@Read("SpaceGroupCohomologyFunctions.gi");   #downloaded from|
  !gapprompt@gap>| !gapinput@      #https://github.com/liuchx1993/Space-Group-Cohomology-and-LSM/|
   
  !gapprompt@gap>| !gapinput@IsPeriodicSpaceGroup(SpaceGroupIT(3,30));|
  true
  
  !gapprompt@gap>| !gapinput@SpaceGroupCohomologyRingGapInterface(30);|
  ===========================================
  Mod-2 Cohomology Ring of Group No. 30:
  Z2[Ac,Am,Ax,Bb]/<R2,R3,R4>
  R2:  Ac.Am  Am^2  Ax^2+Ac.Ax  
  R3:  Am.Bb  
  R4:  Bb^2  
  ===========================================
  LSM:
  2a Ac.Bb+Ax.Bb
  2b Ax.Bb
  true
  
  
  !gapprompt@gap>| !gapinput@IsPeriodicSpaceGroup(SpaceGroupIT(3,216));|
  false
  
  !gapprompt@gap>| !gapinput@SpaceGroupCohomologyRingGapInterface(216);|
  ===========================================
  Mod-2 Cohomology Ring of Group No. 216:
  Z2[Am,Ba,Bb,Bxyxzyz,Ca,Cb,Cc,Cxyz]/<R4,R5,R6>
  R4:  Am.Ca  Am.Cb  Ba.Bxyxzyz+Am.Cc  Bb^2+Am.Cc+Ba.Bb  Bb.Bxyxzyz+Am^2.Bb+Am.Cxyz  Bxyxzyz^2  
  R5:  Bxyxzyz.Ca  Ba.Cb+Bb.Ca  Bb.Cb+Bb.Ca  Bxyxzyz.Cb  Bxyxzyz.Cc  Ba.Cxyz+Am.Ba.Bb+Bb.Cc  Bb.Cxyz+Am^2.Cc+Am.Ba.Bb+Bb.Cc  Bxyxzyz.Cxyz+Am^3.Bb+Am^2.Cxyz 
  ===========================================
  LSM:
  4a Ca+Cc+Cxyz
  4b Cb+Cc+Cxyz
  4c Cb+Cxyz
  4d Cxyz
  true
  
\end{Verbatim}
 In the example the naming convention for ring generators follows the paper \cite{liuye}. }

 }

 }

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

The following example computes the Bredon homology 

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

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

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

The following example computes the Bredon homology 

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

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

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

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

The following example computes the Bredon homology 

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

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

 }

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

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

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

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

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

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

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

  

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

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

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

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

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

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

  

 which was produced by the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@p:=2;;k:=2;;|
  !gapprompt@gap>| !gapinput@P:=PersistentHomologyOfFilteredChainComplex(C,k,p);;|
  !gapprompt@gap>| !gapinput@BarCodeDisplay(P);|
  
\end{Verbatim}
 Let us view a barcode as a graph with vertices arranged in columns. We then
refer to a connected component of this graph as a \emph{bar}. Let us say that any bar with a vertex in the final
(right\texttt{\symbol{45}}hand) column is of \emph{length} $\infty$. Let us define the \emph{length} of any other bar to be $r-1$ where $r$ is the number of vertices in the bar. Theorem 3.1 in \cite{Romero} implies that the differential $d^r_{p,q}=0$ for $p+q=k$ if and only if there is no bar of length $r$ in the barcode arising in this way for any degree $k$ homology barcode. So the following commands demonstrate that $d^r=0$ for $r\ge 2$ at least for $k\le 7$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@for k in [1..7] do|
  !gapprompt@>| !gapinput@R:=ResolutionNormalSeries([G,N],k+1);;|
  !gapprompt@>| !gapinput@C:=FilteredTensorWithIntegersModP(R,2);|
  !gapprompt@>| !gapinput@P:=PersistentHomologyOfFilteredChainComplex(C,k,2);;|
  !gapprompt@>| !gapinput@BarCodeDisplay(P);|
  !gapprompt@>| !gapinput@od;|
  
\end{Verbatim}
        }

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

The following commands demonstrate the conversion of the matrix 

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

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

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

 

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

 

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

 

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

 }

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

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

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

  

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

The performance of the function \texttt{ResolutionSmallGroup(G,n)} is very sensistive to the choice of presentation for the input group $G$. If $G$ is an fp\texttt{\symbol{45}}group then the defining presentation for $G$ is used. If $G$ is a permutaion group or finite matrix group then \textsc{GAP} functions are invoked to find a presentation for $G$. The following commands use a geometrically derived presentation for $SL(2,5)$ as input in order to obtain the first few terms of a periodic resolution for
this group of period $4$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|Y:=PoincareDodecahedronCWComplex( A
  @gapprompt|>A @gapinput|[[1,2,3,4,5],[6,7,8,9,10]],A
  @gapprompt|>A @gapinput|[[1,11,16,12,2],[19,9,8,18,14]],A
  @gapprompt|>A @gapinput|[[2,12,17,13,3],[20,10,9,19,15]],A
  @gapprompt|>A @gapinput|[[3,13,18,14,4],[16,6,10,20,11]],A
  @gapprompt|>A @gapinput|[[4,14,19,15,5],[17,7,6,16,12]],A
  @gapprompt|>A @gapinput|[[5,15,20,11,1],[18,8,7,17,13]]);;A
  @gapprompt|gap>A @gapinput|G:=FundamentalGroup(Y);A
  <fp group on the generators [ f1, f2 ]>
  @gapprompt|gap>A @gapinput|RelatorsOfFpGroup(G);A
  [ f2^-1*f1^-1*f2*f1^-1*f2^-1*f1, f2^-1*f1*f2^2*f1*f2^-1*f1^-1 ]
  @gapprompt|gap>A @gapinput|StructureDescription(G);A
  "SL(2,5)"
  @gapprompt|gap>A @gapinput|R:=ResolutionSmallGroup(G,3);;A
  @gapprompt|gap>A @gapinput|List([0..3],R!.dimension);    A
  [ 1, 2, 2, 1 ]
  
\end{Verbatim}
 }

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

   }

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

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

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

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

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

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

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

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

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

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

  

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

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

  

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  

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

$ DM \rightarrowtail P \twoheadrightarrow M$ 

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

 }

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

 A crossed module $\partial\colon M\rightarrow G$ is equivalent to a cat$^1$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}MacLane spaces as simplicial groups (not
recommended)}}\label{eilennot}
\logpage{[ 12, 2, 0 ]}
\hyperdef{L}{X795E339978B42775}{}
{
 

The following example concerns the Eilenberg\texttt{\symbol{45}}MacLane space $X=K(\mathbb Z_3,3)$ which is a path\texttt{\symbol{45}}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\texttt{\symbol{45}}MacLane spaces as simplicial free abelian groups
(recommended)}}\label{eilen}
\logpage{[ 12, 3, 0 ]}
\hyperdef{L}{X7D91E64D7DD7F10F}{}
{
 

For integer $n>1$ and abelian group $A$ the Eilenberg\texttt{\symbol{45}}MacLane space $K(A,n)$ is better represented as a simplicial free abelian group. (The reason is that
the functorial bar resolution of a group can be replaced in computations by
the smaller functorial Chevalley\texttt{\symbol{45}}Eilenberg complex of the
group when the group is free abelian, obviating the need for perturbation
techniques. When $A$ has torision we can replace it with an inclusion of free abelian groups $A_1 \hookrightarrow A_0$ with $A\cong A_0/A_1$ and again invoke the Chevalley\texttt{\symbol{45}}Eilenberg complex. The
current implementation unfortunately handles only free abelian $A$ but the easy extension to non\texttt{\symbol{45}}free $A$ is planned for a future release.) 

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\texttt{\symbol{45}}MacLance space to compute its $n$\texttt{\symbol{45}}th homology \texttt{\symbol{45}}\texttt{\symbol{45}} 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$\texttt{\symbol{45}}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\texttt{\symbol{45}}MacLane space $K(A,n+1)$ can be constructed from the suspension $\Sigma K(A,n)$ by attaching cells in dimensions $\ge 2n+1$. In particular, there is an isomorphism $ H_{k-1}(K(A,n),\mathbb Z) \rightarrow H_k(K(A,n+1),\mathbb Z)$ for $k\le 2n$ and epimorphism for $k=2n+1$. 

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

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

The cup product is not implemented for the cohomology ring $H^\ast(K(\pi,n),\mathbb Z)$. Standard theoretical spectral sequence arguments have to be applied to
obtain basic information relating to the ring structure. To illustrate this
the following commands compute $H^n(K(\mathbb Z,2),\mathbb Z)$ for the first few values of $n$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=EilenbergMacLaneSimplicialFreeAbelianGroup(A,2,10);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Cohomology(K,k));|
  [ [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ], [  ], [ 0 ] ]
  
\end{Verbatim}
 There is a fibration sequence $K(\pi,n) \hookrightarrow \ast \twoheadrightarrow K(\pi,n+1)$ in which $\ast$ denotes a contractible space. For $n=1, \pi=\mathbb Z$ the terms of the $E_2$ page of the Serre integral cohomology spectral sequence for this fibration are 
\begin{itemize}
\item  $E_2^{pq}= H^p( K(\mathbb Z,2), H^q(K(\mathbb Z,1),\mathbb Z) )$ .
\end{itemize}
 Since $K(\mathbb Z,1)$ can be taken to be the circle $S^1$ we know that it has non\texttt{\symbol{45}}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\texttt{\symbol{45}}trivial homotopy groups of spheres}}\label{firstthree}
\logpage{[ 12, 5, 0 ]}
\hyperdef{L}{X7F828D8D8463CC20}{}
{
 

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

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

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

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

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

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

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

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

For any group $G$ we consider the homotopy groups $\pi_n(\Sigma K(G,1))$ of the suspension $\Sigma K(G,1)$ of the Eilenberg\texttt{\symbol{45}}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$\texttt{\symbol{45}}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.\texttt{\symbol{45}}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$\texttt{\symbol{45}}subgroup of the Mathieu group $M_{12}$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=SylowSubgroup(MathieuGroup(12),2);;|
  !gapprompt@gap>| !gapinput@ThirdHomotopyGroupOfSuspensionB(G);   |
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  gap>
  !gapprompt@gap>| !gapinput@FourthHomotopyGroupOfDoubleSuspensionB(G);|
  [ 2, 2, 2, 2, 2, 2 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Postnikov towers and $\pi_5(S^3)$ }}\label{postnikov2}
\logpage{[ 12, 7, 0 ]}
\hyperdef{L}{X83EAC40A8324571F}{}
{
 A Postnikov system for the sphere $S^3$ consists of a sequence of fibrations $\cdots X_3\stackrel{p_3}{\rightarrow} X_2\stackrel{p_2}{\rightarrow}
X_1\stackrel{p_1}{\rightarrow} \ast$ and a sequence of maps $\phi_n\colon S^3 \rightarrow X_n$ such that 
\begin{itemize}
\item  $p_n \circ \phi_n =\phi_{n-1}$ 
\item The map $\phi_n\colon S^3 \rightarrow X_n$ induces an isomorphism $\pi_k(S^3)\rightarrow \pi_k(X_n)$ for all $k\le n$ 
\item $\pi_k(X_n)=0$ for $k > n$
\item and consequently each fibration $p_n$ has fibre an Eilenberg\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}zero class in $H^5(K(\mathbb Z,3), \mathbb Z_2) = \mathbb Z_2$. }

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

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

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

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

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

 
\section{\textcolor{Chapter }{Enumerating homotopy 2\texttt{\symbol{45}}types}}\logpage{[ 12, 9, 0 ]}
\hyperdef{L}{X7F5E6C067B2AE17A}{}
{
  A \emph{2\texttt{\symbol{45}}type} is a CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}group $G$. Let $X$, $Y$ be $2$\texttt{\symbol{45}}tytpes represented by cat$^1$\texttt{\symbol{45}}groups $G$, $H$. If $X$ and $Y$ are homotopy equivalent then there exists a sequence of morphisms of cat$^1$\texttt{\symbol{45}}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\texttt{\symbol{45}}isomorphic} to $H$. We have the following result. 

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

The following commands produce a list $L$ of all of the $62$ non\texttt{\symbol{45}}isomorphic cat$^1$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}groups of low order}}\logpage{[ 12, 10, 0 ]}
\hyperdef{L}{X7D99B7AA780D8209}{}
{
  Let us define the \emph{order} of a cat$^1$\texttt{\symbol{45}}group to be the order of its underlying group. The
function \texttt{IdQuasiCatOneGroup(C)} inputs a cat$^1$\texttt{\symbol{45}}group $C$ of "low order" and returns an integer pair $[n,k]$ that uniquely idenifies the quasi\texttt{\symbol{45}}isomorphism type of $C$. The integer $n$ is the order of a smallest cat$^1$\texttt{\symbol{45}}group quasi\texttt{\symbol{45}}isomorphic to $C$. The integer $k$ identifies a particular cat$^1$\texttt{\symbol{45}}group of order $n$. 

The following commands use this function to show that there are precisely $49$ distinct quasi\texttt{\symbol{45}}isomorphism types of cat$^1$\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}group $D$ of this quasi\texttt{\symbol{45}}isomorphism type. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@C:=AutomorphismGroupAsCatOneGroup(DihedralGroup(10));|
  Cat-1-group with underlying group Group( [ f1, f2, f3, f4, f5 ] ) . 
  
  !gapprompt@gap>| !gapinput@Order(C);|
  200
  !gapprompt@gap>| !gapinput@IdCatOneGroup(C);|
  [ 200, 42, 4 ]
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@IdQuasiCatOneGroup(C);|
  [ 2, 1 ]
  !gapprompt@gap>| !gapinput@D:=SmallCatOneGroup(2,1);|
  Cat-1-group with underlying group Group( [ f1 ] ) . 
  
\end{Verbatim}
 }

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

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

 }

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

We begin by recalling the Eichler\texttt{\symbol{45}}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\texttt{\symbol{45}}hand side of the isomorphism. But first, for
completeness, let us define the terms on the left\texttt{\symbol{45}}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(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\texttt{\symbol{45}}half plane, $f\colon {\frak{h}}=\{z\in \mathbb C : Im(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\texttt{\symbol{45}}half plane} $\frak{h}^\ast = \frak{h} \cup \mathbb Q \cup \{\infty\}$ obtained from the upper\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}hand side of the isomorphism denotes complex
conjugation, or \emph{anti\texttt{\symbol{45}}holomorphic} forms. See \cite{wieser} for a full account of the isomorphism. 



 On the right\texttt{\symbol{45}}hand side of the isomorphism, the $\mathbb Z\Gamma$\texttt{\symbol{45}}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\texttt{\symbol{45}}hand side of the Eichler\texttt{\symbol{45}}Shimura
isomorphism to compute eigenvalues of the Hecke operators restricted to the
subspace $S_k(\Gamma)$ of cusp forms. }

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

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



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

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

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

\textsc{Theorem.} Let $X$ be a contractible CW\texttt{\symbol{45}}complex on which a group $G$ acts by permuting cells. The cellular chain complex $C_\ast X$ is a $\mathbb ZG$\texttt{\symbol{45}}resolution of $\mathbb Z$ which typically is not free. Let $[e^n]$ denote the orbit of the n\texttt{\symbol{45}}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\texttt{\symbol{45}}wise. Let $Y_{e^n}$ denote a contractible CW\texttt{\symbol{45}}complex on which $G^{e^n}$ acts cellularly and freely. Then there exists a contractible
CW\texttt{\symbol{45}}complex $W$ on which $G$ acts cellularly and freely, and in which the orbits of $n$\texttt{\symbol{45}}cells are labelled by $[e^p]\otimes [f^q]$ where $p+q=n$ and $[e^p]$ ranges over the $G$\texttt{\symbol{45}}orbits of $p$\texttt{\symbol{45}}cells in $X$, $[f^q]$ ranges over the $G^{e^p}$\texttt{\symbol{45}}orbits of $q$\texttt{\symbol{45}}cells in $Y_{e^p}$. 

 

Let $W$ be as in the theorem. Then the quotient CW\texttt{\symbol{45}}complex $B_G=W/G$ is a classifying space for $G$. Let $T$ denote a maximal tree in the $1$\texttt{\symbol{45}}skeleton $B^1_G$. Basic geometric group theory tells us that the $1$\texttt{\symbol{45}}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(N)$,$N>2$. 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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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 $|SL_2(\mathbb Z):\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(6)$ and display $\mathring D_{\Gamma(6)}$. The subgroup $\Gamma(6)$ is free on $13$ generators. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@G:=HAP_PrincipalCongruenceSubgroup(6);;|
  !gapprompt@gap>| !gapinput@HAP_SL2TreeDisplay(G);|
  
  
  !gapprompt@gap>| !gapinput@gens:=GeneratorsOfGroup(G);|
  [ [ [ -83, -18 ], [ 60, 13 ] ], [ [ -77, -18 ], [ 30, 7 ] ], 
    [ [ -65, -12 ], [ 168, 31 ] ], [ [ -53, -12 ], [ 84, 19 ] ], 
    [ [ -47, -18 ], [ 222, 85 ] ], [ [ -41, -12 ], [ 24, 7 ] ], 
    [ [ -35, -6 ], [ 6, 1 ] ], [ [ -11, -18 ], [ 30, 49 ] ], 
    [ [ -11, -6 ], [ 24, 13 ] ], [ [ -5, -18 ], [ 12, 43 ] ], 
    [ [ -5, -12 ], [ 18, 43 ] ], [ [ -5, -6 ], [ 6, 7 ] ], 
    [ [ 1, 0 ], [ -6, 1 ] ] ]
  
\end{Verbatim}
 

  

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

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

  

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

 
\section{\textcolor{Chapter }{Cohomology of congruence subgroups}}\logpage{[ 13, 4, 0 ]}
\hyperdef{L}{X818BFA9A826C0DB3}{}
{
 To compute the cohomology $H^n(\Gamma,A)$ of a congruence subgroup $\Gamma$ with coefficients in a $\mathbb Z\Gamma$\texttt{\symbol{45}}module $A$ we need to construct $n+1$ terms of a free $\mathbb Z\Gamma$\texttt{\symbol{45}}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$\texttt{\symbol{45}}resolution $R_\ast$ for $G=SL_2(\mathbb Z)$. This resolution is also a free $\mathbb Z\Gamma$\texttt{\symbol{45}}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)$\texttt{\symbol{45}}resolution $T_\ast$ with ${\rm rank}_{\mathbb Z\Gamma_0(39)} T_1 = 11$. It is more efficient to work with $T_\ast$ when making cohomology computations with coefficients in a module $A$ of large rank. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|S!.dimension(1);A
  112
  @gapprompt|gap>A @gapinput|T:=TietzeReducedResolution(S);A
  Resolution of length 2 in characteristic 0 for CongruenceSubgroupGamma0(
  39)  . 
  
  @gapprompt|gap>A @gapinput|T!.dimension(1);A
  11
  
\end{Verbatim}
 

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

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

 }

 
\section{\textcolor{Chapter }{Cuspidal cohomology}}\logpage{[ 13, 5, 0 ]}
\hyperdef{L}{X84D30F1580CD42D1}{}
{
 To define and compute cuspidal cohomology we consider the action of $SL_2(\mathbb Z)$ on the upper\texttt{\symbol{45}}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\texttt{\symbol{45}}half plane, and any two images have at most
a single point in common. The possible common points are the bottom
left\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}complex $\tilde X^{BS}$ on which $\Gamma$ acts freely, and $\Gamma$\texttt{\symbol{45}}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\texttt{\symbol{45}}Shimura isomorphism and the already
calculated dimension of $M_2(\Gamma_0(39))\cong \mathbb C^9$, we deduce from this cuspidal cohomology that the space $S_2(\Gamma_0(39))$ of cuspidal weight $2$ forms is of dimension $3$, and the Eisenstein space $E_2(\Gamma_0(39))\cong \mathbb C^3$ is of dimension $3$. 

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

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

For $\Gamma=\Gamma_0(N)$, prime integer $p$ coprime to $N$, and cohomology degree $n=1$ we define the \emph{Hecke operator} $T_p =T_g$ where $g=\left(\begin{array}{cc}1&0\\0&p\end{array}\right)$. Further details on this description of Hecke operators can be found in \cite[Appendix by P. Gunnells]{stein}. 

The following commands compute $T_2$ and $T_5$ 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 $p,q$.) 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(39);;|
  !gapprompt@gap>| !gapinput@p:=2;;k:=2;;T2:=HeckeOperator(gamma,p,k);;|
  !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;;k:=2;;h:=HeckeOperator(gamma,p,k);;|
  !gapprompt@gap>| !gapinput@Display(T5);|
  [ [  -1,  -1,   3,   4,   0,   0,   1,   1,  -1 ],
    [  -5,  -1,   5,   4,   0,   0,   3,   3,  -3 ],
    [  -2,   0,   4,   4,   1,   0,  -1,  -1,   1 ],
    [  -2,   0,   3,   2,  -3,   2,   4,   4,  -4 ],
    [  -4,  -2,   4,   4,   3,   0,   1,   1,  -1 ],
    [  -6,  -4,   5,   6,   1,   2,   2,   2,  -2 ],
    [   1,   5,   0,  -4,  -3,   2,   5,  -1,   1 ],
    [  -2,  -2,   2,   4,   0,   0,  -2,   4,   2 ],
    [   1,   3,   0,  -4,  -4,   2,   2,   2,   4 ] ]
  !gapprompt@gap>| !gapinput@Eigenvalues(Rationals,T5);|
  [ 6, 2 ]
  
  gap>T2*T5=T5*T2;
  true
  
\end{Verbatim}
 }

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

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

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

 Let $\Gamma=\Gamma_0(N)$. The above defined Hecke operators restrict to operators on cuspidal
cohomology. On the left\texttt{\symbol{45}}hand side of the
Eichler\texttt{\symbol{45}}Shimura isomorphism Hecke operators restrict to
operators $T_s\colon S_2(\Gamma) \rightarrow S_2(\Gamma)$ for $s\ge 1$. 

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

 A non\texttt{\symbol{45}}zero cusp form $f\in S_2(\Gamma)$ is a cusp \emph{eigenform} if it is simultaneously an eigenvector for the Hecke operators $T_s$ for all $s =1,2,3,\cdots$ coprime to the level $N$. A cusp eigenform is said to be \emph{normalized} if its coefficient $a_1=1$. It turns out that if $f$ is normalized 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 $S_2(\Gamma_0(N))$ admits a "basis constructed from eigenforms". 

 This all implies that, in principle, we can construct an approximation to an
explicit basis for the space $S_2(\Gamma_0(N))$ 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$\texttt{\symbol{45}}dimensional and thus admits a basis of eigenforms. Then
eigenvalues of Hecke operators are calculated to establish that the modular
form 
\[f = q -2q^2 -q^3 +2q^4 +q^5 +2q^6 -2q^7 + -2q^9 -2q^{10} + \cdots \]
 constitutes a basis for $S_2(\Gamma_0(11))$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@gamma:=HAP_CongruenceSubgroupGamma0(11);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(Kernel(CuspidalCohomologyHomomorphism(gamma,1,2)));|
  [ 0, 0 ]
  
  !gapprompt@gap>| !gapinput@T1:=HeckeOperator(gamma,1,2);; Display(T1);|
  [ [  1,  0,  0 ],
    [  0,  1,  0 ],
    [  0,  0,  1 ] ]
  !gapprompt@gap>| !gapinput@T2:=HeckeOperator(gamma,2,2);; Display(T2);|
  [ [   3,  -4,   4 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  !gapprompt@gap>| !gapinput@T3:=HeckeOperator(gamma,3,2);; Display(T3);|
  [ [   4,  -4,   4 ],
    [   0,  -1,   0 ],
    [   0,   0,  -1 ] ]
  !gapprompt@gap>| !gapinput@T5:=HeckeOperator(gamma,5,2);; Display(T5);|
  [ [   6,  -4,   4 ],
    [   0,   1,   0 ],
    [   0,   0,   1 ] ]
  !gapprompt@gap>| !gapinput@T7:=HeckeOperator(gamma,7,2);; Display(T7);|
  [ [   8,  -8,   8 ],
    [   0,  -2,   0 ],
    [   0,   0,  -2 ] ]
  
\end{Verbatim}
 

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

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

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

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

$ - 6905934q^{17} + 2727432q^{18} + 10661420q^{19} + ...$ 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|R:=ResolutionSL2Z_alt(2);;D
  @gapprompt|gap>D @gapinput|G:=R!.group;;D
  @gapprompt|gap>D @gapinput|P:=HomogeneousPolynomials(G,14);D
  MappingByFunction( SL(2,Integers), <matrix group with 
  2 generators>, function( x ) ... end )
  @gapprompt|gap>D @gapinput|Cohomology(HomToIntegralModule(R,P),1);D
  [ 2, 2, 156, 0, 0, 0 ]
  @gapprompt|gap>D @gapinput|#Thus the space S_12 of cusp forms is of dimension 1D
  
  
  @gapprompt|gap>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(1);;D
  @gapprompt|gap>D @gapinput|for p in [2,3,5,7,11,13,17,19] doD
  @gapprompt|>D @gapinput|T:=HeckeOperator(G,p,12);;D
  @gapprompt|>D @gapinput|Print("eigenvalues= ",Eigenvalues(Rationals,T), " and eigenvectors = ", Eigenvectors(Rationals,T)," for p= ",p,"\n");D
  @gapprompt|>D @gapinput|od;D
  eigenvalues= [ 2049, -24 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 2
  eigenvalues= [ 177148, 252 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 3
  eigenvalues= [ 48828126, 4830 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 5
  eigenvalues= [ 1977326744, -16744 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 7
  eigenvalues= [ 285311670612, 534612 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 11
  eigenvalues= [ 1792160394038, -577738 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 13
  eigenvalues= [ 34271896307634, -6905934 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 17
  eigenvalues= [ 116490258898220, 10661420 ] and eigenvectors = [ [ 1, -2520/691, 0 ], [ 0, 1, 0 ], [ 0, 0, 1 ] ] for p= 19
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{The Picard group}}\logpage{[ 13, 9, 0 ]}
\hyperdef{L}{X8180E53C834301EF}{}
{
 Let us now consider the \emph{Picard group} $G=SL_2(\mathbb Z[ i])$ and its action on \emph{upper\texttt{\symbol{45}}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 t^2}{|cz +d|^2 + |c|^2t^2} \ +\
\frac{t}{|cz+d|^2+|c|^2t^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\texttt{\symbol{45}}half space ${\frak h}^3$ can be retracted onto a $2$\texttt{\symbol{45}}dimensional subspace ${\cal T} \subset {\frak h}^3$. The space ${\cal T}$ is a contractible $2$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex, and the
action of the Picard group $G$ restricts to a cellular action of $G$ on ${\cal T}$. 

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

 
\section{\textcolor{Chapter }{Bianchi groups}}\logpage{[ 13, 10, 0 ]}
\hyperdef{L}{X858B1B5D8506FE81}{}
{
 The \emph{Bianchi groups} are the groups $G=PSL_2({\cal O}_{-d})$ where $d$ is a square free positive integer and ${\cal O}_{-d}$ is the ring of integers of the imaginary quadratic field $\mathbb Q(\sqrt{-d})$. More explicitly, 
\[{\cal O}_{-d} = \mathbb Z\left[\sqrt{-d}\right]~~~~~~~~ {\rm if~} d \equiv 1,2
{\rm ~mod~} 4\, ,\]
 
\[{\cal O}_{-d} = \mathbb Z\left[\frac{1+\sqrt{-d}}{2}\right]~~~~~ {\rm if~} d
\equiv 3 {\rm ~mod~} 4\, .\]
 These groups act on upper\texttt{\symbol{45}}half space ${\frak h}^3$ in the same way as the Picard group. Upper\texttt{\symbol{45}}half space can
be tessellated by a 'fundamental domain' for this action. Moreover, as with
the Picard group, this tessellation contains a $2$\texttt{\symbol{45}}dimensional cellular subspace ${\cal T}\subset {\frak h}^3$ where ${\cal T}$ is a contractible CW\texttt{\symbol{45}}complex on which $G$ acts cellularly. It should be mentioned that the fundamental domain and the
contractible $2$\texttt{\symbol{45}}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(\texttt{\symbol{45}}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 "\texttt{\symbol{45}}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\texttt{\symbol{45}}trivial Steinitz\texttt{\symbol{45}}class. In the
case of a larger class group there are cases labelled
"\texttt{\symbol{45}}d+I2",...,"\texttt{\symbol{45}}d+Ik" and the Ij together
with O\texttt{\symbol{45}}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 }{(Co)homology of Bianchi groups and $SL_2({\cal O}_{-d})$}}\logpage{[ 13, 11, 0 ]}
\hyperdef{L}{X851390E07C3B3BB1}{}
{
 The (co)homology of Bianchi groups has been studied in papers such as \cite{Schwermer} \cite{Vogtmann} \cite{Berkove00} \cite{Berkove06} \cite{Rahm11} \cite{Rahm13} \cite{Rahm13a} \cite{Rahm20}. Calculations in these papers can often be verified by computer. For
instance, the calculation 
\[H_q(PSL_2({\cal O}_{-15}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z^2
\oplus \mathbb Z_6 & q=1,\\ \mathbb Z \oplus \mathbb Z_6 & q=2,\\ \mathbb Z_6
& q\ge 3\\ \end{array}\right. \]
 obtained in \cite{Rahm11} can be verified as follows, once we note that Bianchi groups have virtual
cohomological dimension 2 and, if all stabilizer groups are periodic with
period dividing m, then the homology has period dividing m in degree $\ge 3$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-15)");;A
  @gapprompt|gap>A @gapinput|PK:=QuotientOfContractibleGcomplex(K,Group(-One(K!.group)));;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print( CohomologicalPeriod(K!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  2  2  2  2  2  2  2  2  2  2  2  2  2  2  
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(PK,5);;A
  @gapprompt|gap>A @gapinput|for n in [0..4] doA
  @gapprompt|>A @gapinput|Print("H_",n," = ", Homology(TensorWithIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H_0 = [ 0 ]
  H_1 = [ 6, 0, 0 ]
  H_2 = [ 6, 0 ]
  H_3 = [ 6 ]
  H_4 = [ 6 ]
  
\end{Verbatim}
 All finite subgroups of $SL_2({\cal O}_{-d})$ are periodic. Thus the above example can be adapted from PSL to SL for any
square=free $d\ge 1$. For example, the calculation 
\[H^q(SL_2({\cal O}_{-2}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z &
q=1,\\ \mathbb Z_6 & q=2 {\rm \ mod\ } 4,\\ \mathbb Z_2 \oplus \mathbb Z_{12}
& q= 3 {\rm \ mod\ } 4\\ \mathbb Z_2 \oplus \mathbb Z_{24} & q= 0 {\rm \ mod\
} 4 (q>0)\\ \mathbb Z_{12} & q= 1 {\rm \ mod\ } 4 (q > 1)\\ \end{array}\right. \]
 obtained in \cite{Schwermer} can be verified as follows. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-2)");;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|Print(CohomologicalPeriod(K!.stabilizer(n,k)),"  ");A
  @gapprompt|>A @gapinput|od;od;A
  2  4  2  4  2  2  2  2  2  2  2  2  
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,11);;A
  @gapprompt|gap>A @gapinput|for n in [0..10] doA
  @gapprompt|>A @gapinput|Print("H^",n," = ", Cohomology(HomToIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H^0 = [ 0 ]
  H^1 = [ 0 ]
  H^2 = [ 6 ]
  H^3 = [ 2, 12 ]
  H^4 = [ 2, 24 ]
  H^5 = [ 12 ]
  H^6 = [ 6 ]
  H^7 = [ 2, 12 ]
  H^8 = [ 2, 24 ]
  H^9 = [ 12 ]
  H^10 = [ 6 ]
  
\end{Verbatim}
 A quotient of a periodic group by a central subgroup of order 2 need not be
periodic. For this reason the (co)homology of PSL can be a bit more tricky
than SL. For example, the calculation 
\[H^q(PSL_2({\cal O}_{-13}),\mathbb Z) = \left\{\begin{array}{ll} \mathbb Z^3
\oplus (\mathbb Z_2)^2 & q=1,\\ \mathbb Z^2 \oplus \mathbb Z_4 \oplus (\mathbb
Z_3)^2 \oplus \mathbb Z_2 & q=2,\\ (\mathbb Z_2)^q \oplus (\mathbb Z_{3})^2 &
q= 3 {\rm \ mod\ } 4\\ (\mathbb Z_2)^q & q= 0 {\rm \ mod\ } 4 (q>0)\\ (\mathbb
Z_2)^q & q= 1 {\rm \ mod\ } 4 (q>1)\\ (\mathbb Z_2)^q \oplus (\mathbb Z_{3})^2
& q= 2 {\rm \ mod\ } 4 (q > 2)\\ \end{array}\right. \]
 was obtained in \cite{Rahm11}. The following commands verify the calculation in the first 34 degrees, but
for a proof valid for all degrees one needs to analyse the computation to spot
that there is a certain "periodicity of period 2" in the computations for $q\ge 3$. This analysis is done in \cite{Rahm11}. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("SL(2,O-13)");;A
  @gapprompt|gap>A @gapinput|PK:=QuotientOfContractibleGcomplex(K,Group(-One(K!.group)));;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..PK!.dimension(n)] doA
  @gapprompt|>A @gapinput|S:=SmallGroup(IdGroup(PK!.stabilizer( n, k )));A
  @gapprompt|>A @gapinput|Print( [n,k]," is periodic ",IsPeriodic(S),"\n  ");A
  @gapprompt|>A @gapinput|od;od;A
  [ 0, 1 ] is periodic true
  [ 0, 2 ] is periodic true
  [ 0, 3 ] is periodic true
  [ 0, 4 ] is periodic true
  [ 0, 5 ] is periodic true
  [ 0, 6 ] is periodic true
  [ 0, 7 ] is periodic false
  [ 0, 8 ] is periodic false
  [ 1, 1 ] is periodic true
  [ 1, 2 ] is periodic true
  [ 1, 3 ] is periodic true
  [ 1, 4 ] is periodic true
  [ 1, 5 ] is periodic true
  [ 1, 6 ] is periodic true
  [ 1, 7 ] is periodic true
  [ 1, 8 ] is periodic true
  [ 1, 9 ] is periodic true
  [ 1, 10 ] is periodic true
  [ 1, 11 ] is periodic true
  [ 1, 12 ] is periodic true
  [ 1, 13 ] is periodic true
  [ 2, 1 ] is periodic true
  [ 2, 2 ] is periodic true
  [ 2, 3 ] is periodic true
  [ 2, 4 ] is periodic true
  [ 2, 5 ] is periodic true
  [ 2, 6 ] is periodic true
  [ 2, 7 ] is periodic true
  [ 2, 8 ] is periodic true
  [ 2, 9 ] is periodic true
  [ 2, 10 ] is periodic true
  [ 2, 11 ] is periodic true
  
  @gapprompt|gap>A @gapinput|R:=ResolutionPSL2QuadraticIntegers(-13,35);;A
  @gapprompt|gap>A @gapinput|for n in [0..34] doA
  @gapprompt|>A @gapinput|Print("H_",n," = ", Homology(TensorWithIntegers(R),n),"\n");A
  @gapprompt|>A @gapinput|od;A
  H_0 = [ 0 ]
  H_1 = [ 2, 2, 0, 0, 0 ]
  H_2 = [ 6, 12, 0, 0 ]
  H_3 = [ 2, 6, 6 ]
  H_4 = [ 2, 2, 2, 2 ]
  H_5 = [ 2, 2, 2, 2, 2 ]
  H_6 = [ 2, 2, 2, 2, 6, 6 ]
  H_7 = [ 2, 2, 2, 2, 2, 6, 6 ]
  H_8 = [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_9 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_10 = [ 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_11 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_12 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_13 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_14 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_15 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_16 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_17 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_18 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_19 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_20 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_21 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_22 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_23 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 6 ]
  H_24 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_25 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_26 = [ 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 ]
  H_27 = [ 2, 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 ]
  H_28 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_29 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_30 = [ 2, 2, 2, 2, 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 ]
  H_31 = [ 2, 2, 2, 2, 2, 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 ]
  H_32 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_33 = [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_34 = [ 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
  
\end{Verbatim}
 The Lyndon\texttt{\symbol{45}}Hochschild\texttt{\symbol{45}}Serre spectral
sequence $H_p(G/N,H_q(N,A)) \Rightarrow H_{p+q}(G,A)$ for the groups $G=SL_2({\mathcal O}_{-d})$ and $N\cong C_2$ the central subgroup with $G/N\cong PSL_2({\mathcal O}_{-d})$, and the trivial module $A = \mathbb Z_{\ell}$, implies that for primes $\ell>2$ we have a natural isomorphism $H_n(PSL_2({\mathcal O}_{-d}),\mathbb Z_{\ell}) \cong H_n(SL_2({\mathcal
O}_{-d}),\mathbb Z_{\ell})$. It follows that we have an isomorphism of $\ell$\texttt{\symbol{45}}primary parts $H_n(PSL_2({\mathcal O}_{-d}),\mathbb Z)_{(\ell)} \cong H_n(SL_2({\mathcal
O}_{-d}),\mathbb Z)_{(\ell)}$. Since $ H_n(SL_2({\mathcal O}_{-d}),\mathbb Z)_{(\ell)}$ is periodic in degrees $ \ge 3$ we can recover the $3$\texttt{\symbol{45}}primary part of $H_n(PSL_2({\mathcal O}_{-13}),\mathbb Z)$ in all degrees $q\ge1$ from the following computation by ignoring all $2$\texttt{\symbol{45}}power factors in the output. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionSL2QuadraticIntegers(-13,13);;|
  !gapprompt@gap>| !gapinput@for n in [3..12] do|
  !gapprompt@>| !gapinput@Print("H_",n," at prime p=3 is: ", Filtered(Homology(TensorWithIntegers(R),n), m->IsInt(m/3)),"\n");|
  !gapprompt@>| !gapinput@od;|
  H_3 at prime p=3 is: [ 6, 24 ]
  H_4 at prime p=3 is: [  ]
  H_5 at prime p=3 is: [  ]
  H_6 at prime p=3 is: [ 6, 12 ]
  H_7 at prime p=3 is: [ 6, 24 ]
  H_8 at prime p=3 is: [  ]
  H_9 at prime p=3 is: [  ]
  H_10 at prime p=3 is: [ 6, 12 ]
  H_11 at prime p=3 is: [ 6, 24 ]
  H_12 at prime p=3 is: [  ]
  !gapprompt@gap>| !gapinput@#Ignore the 2-power factors in the output|
  
\end{Verbatim}
 The ring ${\mathcal O}_{-163}$ is an example of a principal ideal domain that is not a Euclidean domain. It
seems that no complete calculation of $H_n(PSL_2({\mathcal O}_{-163}),\mathbb Z)$ is yet available in the literature. The following comands compute this
homology in the first $31$ degrees. The computation suggests a general formula in higher degrees. All but
two of the stabilizer groups for the action of $PSL_2({\mathcal O}_{-163})$ are periodic. The non\texttt{\symbol{45}}periodic group $A_4$ occurs twice in degree $0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@R:=ResolutionPSL2QuadraticIntegers(-163,32);;|
  !gapprompt@gap>| !gapinput@for n in [1..31] do|
  !gapprompt@>| !gapinput@Print("H_",n,"= ",Homology(TensorWithIntegers(R),n),"\n");|
  !gapprompt@>| !gapinput@od;|
  H_1= [ 0, 0, 0, 0, 0, 0, 0 ]
  H_2= [ 2, 12, 0, 0, 0, 0, 0, 0 ]
  H_3= [ 6 ]
  H_4= [  ]
  H_5= [ 2, 2, 2 ]
  H_6= [ 2, 6 ]
  H_7= [ 6 ]
  H_8= [ 2, 2, 2, 2 ]
  H_9= [ 2, 2, 2 ]
  H_10= [ 2, 6 ]
  H_11= [ 2, 2, 2, 2, 6 ]
  H_12= [ 2, 2, 2, 2 ]
  H_13= [ 2, 2, 2 ]
  H_14= [ 2, 2, 2, 2, 2, 6 ]
  H_15= [ 2, 2, 2, 2, 6 ]
  H_16= [ 2, 2, 2, 2 ]
  H_17= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_18= [ 2, 2, 2, 2, 2, 6 ]
  H_19= [ 2, 2, 2, 2, 6 ]
  H_20= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_21= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_22= [ 2, 2, 2, 2, 2, 6 ]
  H_23= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_24= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_25= [ 2, 2, 2, 2, 2, 2, 2 ]
  H_26= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_27= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_28= [ 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_29= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
  H_30= [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  H_31= [ 2, 2, 2, 2, 2, 2, 2, 2, 6 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some other infinite matrix groups}}\logpage{[ 13, 12, 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})$, $PGL_2({\cal O}_{d})$, $GL_3({\cal O}_{d})$ and $PGL_3({\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 SL(2,O-6) . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|G:=R!.group;;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(G,24);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,1);A
  [ 2, 2, 2, 2, 12, 24, 9240, 55440, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  @gapprompt|gap>A @gapinput|Cohomology(C,2);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 6, 6, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 24, 120, 
    120, 840, 840, 840, 2520, 27720, 27720, 24227280, 24227280, 411863760, 
    411863760, 2454438243748928651877425142836664498129840, 
    14726629462493571911264550857019986988779040, 0, 0, 0, 0 ]
  @gapprompt|gap>A @gapinput|Cohomology(C,3);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 12, 12 ]
  
\end{Verbatim}
 

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

 
\section{\textcolor{Chapter }{Ideals and finite quotient groups}}\logpage{[ 13, 13, 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$\texttt{\symbol{45}}resolution of $\mathbb Z$ of period dividing $52$. 

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

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

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

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

 
\section{\textcolor{Chapter }{Congruence subgroups for ideals}}\logpage{[ 13, 14, 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(I)=\ker \pi_I$, and the congruence subgroup $\Gamma_0(I)$ consisting of preimages of the upper triangular matrices in $SL_2({\cal O}/I)$. 

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

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

 
\section{\textcolor{Chapter }{First homology}}\logpage{[ 13, 15, 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 \oplus \mathbb Z_2 \oplus \cdots
\oplus \mathbb Z_{124336989193985597}\]
 where $I$ is the prime ideal in the Gaussian integers generated by $-95+66\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,-95+66*Sqrt(-1));|
  ideal of norm 13381 in O(GaussianRationals)
  !gapprompt@gap>| !gapinput@G:=HAP_CongruenceSubgroupGamma0(I);;|
  !gapprompt@gap>| !gapinput@AbelianInvariants(G);|
  [ 0, 2, 2, 2, 2, 3, 4, 5, 16, 31, 223, 857, 13913, 106103, 1267133821, 
    141880858099, 1290077458421, 92119226692240157, 124336989193985597 ]
  
\end{Verbatim}
 The command \texttt{AbelianInvariants(G)} can be quite time consuming. An alternative approach is to compute the first
homology of $G$ from a chain complex $C$ using the command \texttt{ContractedComplex(C,b)}. This command inputs a chain complex and optionally a positive integer $b$ and attempts to return a quasi\texttt{\symbol{45}}isomorphic chain complex
with fewer generators in each degree. The optional integer $b$ is used to limit the extent to which simplification of $C$ takes place. If no integer $b$ is entered then no limit is placed on the simplification procedure. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|R:=ResolutionSL2QuadraticIntegers(-1,3,true);;A
  @gapprompt|gap>A @gapinput|S:=ResolutionFiniteSubgroup(R,G);;A
  @gapprompt|gap>A @gapinput|C:=TensorWithIntegers(S);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 13382, 53528, 93674, 93674 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,20);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 681, 11418, 50884 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,40);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 541, 10765, 50371 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,60);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 521, 10555, 50181 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,80);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 506, 10251, 49892 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,100);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 481, 9778, 49444 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,200);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 433, 7648, 47362 ]
  @gapprompt|gap>A @gapinput|C:=ContractedComplex(C,300);;A
  @gapprompt|gap>A @gapinput|List([0..3],C!.dimension);A
  [ 1, 354, 6652, 46445 ]
  @gapprompt|gap>A @gapinput|h:=Homology(C,1);A
  [ 2, 2, 2, 2, 4, 5575961616921963080290825077053419457519929798345389608972206812096744968225641101360, 0 ]
  
\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.0147988$ 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@Loge10:=0.434294481903;; #Log_10(e)|
  !gapprompt@gap>| !gapinput@T:=Product([ 2, 2, 2, 2, 3, 4, 5, 16, 31, 223, 857, 13913, 106103, |
  !gapprompt@>| !gapinput@                1267133821, 141880858099, 1290077458421, 92119226692240157, |
  !gapprompt@>| !gapinput@                124336989193985597 ]);;|
  !gapprompt@gap>| !gapinput@1.0*Log(Product(T,10)/(Loge*Norm(I));|
  0.0147988
  
\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\texttt{\symbol{45}}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\texttt{\symbol{45}}hand side by the index $|PSL_2({\cal O}_d)\,:\, \Gamma|$. 

 The following commands produce a graph of $ \frac{\log |\Gamma_0(I)_{tors}^{ab}|}{{\rm Norm}(I)}$ against ${\rm Norm}(I)$ for prime ideals $I$ of norm $49 \le {\rm Norm}(I) \le 6833$ (where one ideal for each norm is taken). 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|Q:=QuadraticNumberField(-1);;D
  @gapprompt|gap>D @gapinput|OQ:=RingOfIntegers(Q);;D
  @gapprompt|gap>D @gapinput|N:=QuadraticIntegersByNorm(OQ,20000);;D
  
  @gapprompt|gap>D @gapinput|#########################################D
  @gapprompt|gap>D @gapinput|fn:=function(x);D
  @gapprompt|>D @gapinput|if IsRat(x) then return x; fi;D
  @gapprompt|>D @gapinput|return x!.rational+x!.irrational*Sqrt(-1);D
  @gapprompt|>D @gapinput|end;D
  @gapprompt|gap>D @gapinput|#########################################D
  
  @gapprompt|gap>D @gapinput|NN:=List(N,fn);D
  @gapprompt|gap>D @gapinput|P:=Filtered(NN,x->IsPrime(QuadraticIdeal(OQ,x)));D
  @gapprompt|gap>D @gapinput|PP:=Classify(P,x->Norm(Q,x));D
  @gapprompt|gap>D @gapinput|PP:=List(PP,x->x[1]);;D
  @gapprompt|gap>D @gapinput|PP:=Filtered(PP,x->not x=0);D
  
  @gapprompt|gap>D @gapinput|Loge:=0.434294481903;; ###Log_10(e)D
  @gapprompt|gap>D @gapinput|#########################################D
  @gapprompt|gap>D @gapinput|ffn:=function(x)D
  @gapprompt|>D @gapinput|local I, G, A, T, S, F;D
  @gapprompt|>D @gapinput|I:=QuadraticIdeal(OQ,x);D
  @gapprompt|>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(I);;D
  @gapprompt|>D @gapinput|A:=AbelianInvariants(G);D
  @gapprompt|>D @gapinput|T:=Filtered(A,x->not x=0);D
  @gapprompt|>D @gapinput|return [Norm(Q,x),1.0*Log(Product(T),10)/(Loge*Norm(I))];D
  @gapprompt|>D @gapinput|end;D
  @gapprompt|gap>D @gapinput|#########################################D
  
  @gapprompt|gap>D @gapinput|S:=List(PP{[9..447]},ffn);D
  @gapprompt|gap>D @gapinput|ScatterPlot(S);D
  
\end{Verbatim}
  }

 }

 
\chapter{\textcolor{Chapter }{Fundamental domains for Bianchi groups}}\logpage{[ 14, 0, 0 ]}
\hyperdef{L}{X805848868005D528}{}
{
 
\section{\textcolor{Chapter }{Bianchi groups}}\logpage{[ 14, 1, 0 ]}
\hyperdef{L}{X858B1B5D8506FE81}{}
{
 The \emph{Bianchi groups} are the groups $G_{-d}=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})$. These groups act on \emph{upper\texttt{\symbol{45}}half space} 
\[{\frak h}^3 =\{(z,t) \in \mathbb C\times \mathbb R\ |\ t > 0\} \]
 by the formula 
\[\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}\ \]
 where we use the symbol $j$ satisfying $j^2=-1$, $ij=-ji$ and write $z+tj$ instead of $(z,t)$. Alternatively, 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 t^2}{|cz +d|^2 + |c|^2t^2} \ +\
\frac{t}{|cz+d|^2+|c|^2t^2}\, j \ .\]
 

We take the boundary $\partial {\frak h}^3$ to be the Riemann sphere $\mathbb C \cup \infty$ and let $\overline{\frak h}^3$ denote the union of ${\frak h}^3$ and its boundary. The action of $G_{-d}$ extends to the boundary. The element $\infty$ and each element of the number field $\mathbb Q(\sqrt{-d})$ are thought of as lying in the boundary $\partial {\frak h}^3$ and are referred to as \emph{cusps}. Let $X$ denote the union of ${\frak h}^3$ with the set of cusps, $X={\frak h}^3 \cup \{\infty\} \cup \mathbb Q(\sqrt{-d})$. It follows from work of Bianchi and Humbert that the space $X$ admits the structure of a regular CW\texttt{\symbol{45}}complex (depending on $d$) for which the action of $G_{-d}$ on ${\frak h}^3$ extends to a cellular action on $X$ which permutes cells. Moreover, $G_{-d}$ acts transitively on the $3$\texttt{\symbol{45}}cells of $X$ and each $3$\texttt{\symbol{45}}cell has trivial stabilizer in $G_{-d}$. Details are provided in Richard Swan's paper \cite{swanB}. 

 We refer to the closure in $X$ of any one of these $3$\texttt{\symbol{45}}cells as a \emph{fundamental domain} for the action $G_{-d}$. Cohomology of $G_{-d}$ can be computed from a knowledge of the combinatorial structure of this
fundamental domain together with a knowledge of the stabilizer groups of the
cells of dimension $\le 2$. }

 
\section{\textcolor{Chapter }{Swan's description of a fundamental domain}}\logpage{[ 14, 2, 0 ]}
\hyperdef{L}{X872D22507F797001}{}
{
 A pair $(a,b)$ of elements in ${\cal O}_{-d}$ is said to be \emph{unimodular} if the ideal generated by $a,b$ is the whole ring ${\cal O}_{-d}$ and $a\ne 0$. A unimodular pair can be represented by a hemisphere in $\overline{\frak h}^3$ with base centred at the point $b/a \in \mathbb C$ and of radius $|1/a|$. The radius is $\le 1$. Think of the points in ${\frak h}^3$ as lying strictly above $\mathbb C$. Let $B$ denote the space obtained by removing the interiors of all such hemispheres
from ${\frak h}^3$. 

 When $d \equiv 3 {\rm \ mod\ } 4$ let $F$ be the subspace of $\overline{\frak h}^3$ consisting of the points $x+iy+jt$ with $-1/2 \le x \le 1/2$, $-1/4 \le y \le 1/4$, $t \ge 0$. Otherwise, let $F$ be the subspace of $\overline{\frak h}^3$ consisting of the points $x+iy+jt$ with $-1/2 \le x \le 1/2$, $-1/2 \le y \le 1/2$, $t \ge 0$. 

 It is explained in \cite{swanB} that $F\cap B$ is a $3$\texttt{\symbol{45}}cell in the above mentioned regular
CW\texttt{\symbol{45}}complex structure on $X$. }

 
\section{\textcolor{Chapter }{Computing a fundamental domain}}\logpage{[ 14, 3, 0 ]}
\hyperdef{L}{X7B9DE54F7ECB7E44}{}
{
 Explicit fundamental domains for certain values of $d$ were calculated by Bianchi in the 1890s and further calculations were made by
Swan in 1971 \cite{swanB}. In the 1970s, building on Swan's work, \href{https://www.sciencedirect.com/science/article/pii/S0723086913000042} {Robert Riley} developed a computer program for computing fundamental domains of certain
Kleinian groups (including Bianchi groups). In their 2010 PhD theses \href{https://theses.hal.science/tel-00526976/en/} {Alexander Rahm} and \href{https://wrap.warwick.ac.uk/id/eprint/35128/} {M.T. Aranes} independently developed Pari/GP and Sage software based on Swan's ideas. In
2011 \href{https://mathstats.uncg.edu/sites/yasaki/publications/bianchipolytope.pdf} {Dan Yasaki} used a different approach based on Voronoi's theory of perfect forms in his
Magma software for fundamental domains of Bianchi groups. \href{http://www.normalesup.org/~page/Recherche/Logiciels/logiciels-en.html} {Aurel Page} developed software for fundamental domains of Kleinian groups in his 2010
masters thesis. In 2018 \href{https://github.com/schoennenbeck/VMH-DivisionAlgebras} {Sebastian Schoennenbeck} used a more general approach based on perfect forms in his Magma software for
computing fundamental domains of Bianchi and other groups. Output from the
code of Alexander Rahm and Sebastian Schoennenbeck for certain Bianchi groups
has been stored iin \textsc{HAP} for use in constructing free resolutions. 

More recently a \textsc{GAP} implementation of Swan's algorithm has been included in \textsc{HAP}. The implementation uses exact computations in $\mathbb Q(\sqrt{-d})$ and in $\mathbb Q(\sqrt{d})$. A bespoke implementation of these two fields is part of the implementation
so as to avoid making apparently slower computations with cyclotomic numbers.
The account of Swan's algorithm in the thesis of Alexander Rahm was the main
reference during the implementation. }

 
\section{\textcolor{Chapter }{Examples}}\logpage{[ 14, 4, 0 ]}
\hyperdef{L}{X7A489A5D79DA9E5C}{}
{
 The fundamental domain $D=\overline{F \cap B}$ (where the overline denotes closure) has boundary $\partial D$ involving the four vertical quadrilateral $2$\texttt{\symbol{45}}cells contained in the four vertical quadrilateral $2$\texttt{\symbol{45}}cells of $\partial F$. We refer to these as the \emph{vertical $2$\texttt{\symbol{45}}cells} of $D$. When visualizing $D$ we ignore the $3$\texttt{\symbol{45}}cell and the four vertical $2$\texttt{\symbol{45}}cells entirely and visualize only the remaining $2$\texttt{\symbol{45}}cells. These $2$\texttt{\symbol{45}}cells can be viewed as a $2$\texttt{\symbol{45}}dimensional image by projecting them onto the complex
plane, or they can be viewed as an interactive $3$\texttt{\symbol{45}}dimensional image. 

A fundamental domain for $G_{-39}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-39);|
  3-dimensional Bianchi polyhedron over OQ( Sqrt(-39) ) 
  involving hemispheres of minimum squared radius 1/39 
  and non-cuspidal vertices of minimum squared height 1/49 . 
  
  !gapprompt@gap>| !gapinput@Display3D(D);;|
  !gapprompt@gap>| !gapinput@Display2D(D);;|
  
\end{Verbatim}
   

 A \emph{cusp vertex} of $D$ is any vertex of $D$ lying in $\mathbb C \cup \infty$. In the above visualizations for $G_{-39}$ several cusp vertices in $\mathbb C$ are : in the 2\texttt{\symbol{45}}dimensional visualization they are
represented by red dots. Computer calculations show that these cusps lie in
precisely three orbits under the action of $G_{-d}$. Thus, together with the orbit of $\infty$ there are four distinct orbits of cusps. By the well\texttt{\symbol{45}}known
correspondence between cusp orbits and elements of the class group it follows
that the class group of $\mathbb Q(\sqrt{-39})$ is of order $4$. 

The following additional commands comvert the ``bottom surface'' of the
Bianchi polyhedron $D$ to a $2$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex and then
displays the $1$\texttt{\symbol{45}}skeleton of this $2$\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-39);;|
  !gapprompt@gap>| !gapinput@Y:=RegularCWComplex(D);|
  Regular CW-complex of dimension 2
  
  !gapprompt@gap>| !gapinput@Display(GraphOfRegularCWComplex(Y));|
  
\end{Verbatim}
  

A fundamental domain for $G_{-22}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-22);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  
\end{Verbatim}
   

Two cusps are visible in these visualizations for $G_{-22}$. They lie in a single orbit. Thus, together with the orbit of $\infty$, there are two orbits of cusps for this group. 

 An alternative visualization for $G_{-22}$ can be produced, in which the cells in a given orbit are coloured with a
common colour. The following commands produce this visualization. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-22);;|
  !gapprompt@gap>| !gapinput@Display3D(K);|
  
\end{Verbatim}
  

A fundamental domain for $G_{-163}$ can be visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-163);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-163);;|
  !gapprompt@gap>| !gapinput@Display3D(K);|
  
\end{Verbatim}
    

There is just a single orbit of cusps in this example, the orbit containing $\infty$, since $\mathbb Q(\sqrt{-163})$ is a principal ideal domain and hence has trivial class group. 

A fundamental domain for $G_{-33}$ is visualized using the following commands. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@D:=BianchiPolyhedron(-33);;|
  !gapprompt@gap>| !gapinput@Display3D(OQ,D);;|
  !gapprompt@gap>| !gapinput@Display2D(OQ,D);;|
  
\end{Verbatim}
   }

 
\section{\textcolor{Chapter }{Establishing correctness of a fundamental domain}}\logpage{[ 14, 5, 0 ]}
\hyperdef{L}{X86CD59CB7A04EE5A}{}
{
 The cusps of a fundamental domain can be calculated independently of the
domain computation. The remaining vertices of the domain will have positive
heights. To prove that the computation is correct we need to establish that no
non\texttt{\symbol{45}}cuspidal vertex lies below any hemishpere centered on
the complex plane at $b/a\in \mathbb C$ with $(a,b)$ a unimodular pair. As these hemispheres have increasingly smaller radius we
only need to check those finitely many hemispheres with radius smaller than
the height of the lowest non\texttt{\symbol{45}}cuspidal vertex. 

For a few values of $d$ the smallest radius $r$ of a hemisphere contributing to the fundamental domain boundary has been
stored. For cases where this smallest radius is not stored a very slow method
for finding $r$ is implemented and the user is advised to speed things up by guessiing a value $N=1/r^2$ and then test that this value of $N$ is indeed large enough. The following commands illustrate this for $d=-46$ with a guess of $N=600$. Once the test is done we can see that in fact a smaller guess of $N=441$ would have sufficed. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@P:=BianchiPolyhedron(-46);|
  Try 
    P:=BianchiPolyhedron(OQ,N);
  for some guessed positive integer value of N and then try
    SwanBianchiCriterion(P);
  to test if the value of N was large enough. If the test returns false then you\
  'll need to try a larger value of N.
  
  A successful value of N can be stored as a pair [d,N] in the list HAPRECORD wh\
  ich can be edited manually in the file hap/lib/Congruence/bianchi.gi .
  
  
  !gapprompt@gap>| !gapinput@P:=BianchiPolyhedron(-46,600);|
  3-dimensional Bianchi polyhedron over OQ( Sqrt(
  -46) ) involving hemispheres of minimum squared radius 1/
  441 and non-cuspidal vertices of minimum squared height 1/8280 . 
  
  !gapprompt@gap>| !gapinput@SwanBianchiCriterion(P);|
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Computing quotient $2$\texttt{\symbol{45}}complexes}}\logpage{[ 14, 6, 0 ]}
\hyperdef{L}{X7BBAEFD781559384}{}
{
 The space $X={\frak h}^3 \cup \{\infty\} \cup \mathbb Q(\sqrt{-d})$ retracts onto an $SL_2({\mathcal O}_{-d})$\texttt{\symbol{45}}equivariant $2$\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}complex $K \subset X$. By barycentrically subdividing $K$ we can assume that the group action on $K$ is \emph{rigid} in the sense that any group element in the stabilizer of a cell fixes that
cell pointwise. Given a congruence subgroup $\Gamma \le SL_2({\mathcal O}_{-d})$ the quotient space $Y=K/\Gamma$ inherits a regular CW\texttt{\symbol{45}}structure. We have $H_n(\Gamma,\mathbb Q) = H_n(Y,\mathbb Q)$ and $H_n(\Gamma,\mathbb Z_p) = H_n(Y,\mathbb Z_p)$ for any prime not dividing the order of any group element in $\Gamma$. At these primes the $p$\texttt{\symbol{45}}torsion in $H_n(Y,\mathbb Z)$ equals that in $H_n(\Gamma,\mathbb Z)$.  The following session computes the integral homology of $Y$ for $\Gamma=\Gamma_0(71) \le SL(2,{\mathcal O}_{-2})$ and establishes that $\Gamma$ has no $p$\texttt{\symbol{45}}torsion for primes $p>3$ and has index $5042$. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|K:=BianchiGcomplex(-2);;D
  @gapprompt|gap>D @gapinput|iso:=K!.isomorphismToGroupCyclotomicMats;;D
  @gapprompt|gap>D @gapinput|KK:=BarycentricSubdivision(K);; #KK is a rigid complexD
  @gapprompt|gap>D @gapinput|ResolutionIsomorphismGroup(KK,iso);; #matrices in G=SL(2,O-2) now haveD
  @gapprompt|gap>D @gapinput|                                     #cyclotomic entriesD
  
  @gapprompt|gap>D @gapinput|OQ:=RingOfIntegers(QuadraticNumberField(-2));;D
  @gapprompt|gap>D @gapinput|I:=QuadraticIdeal(OQ,71);;D
  @gapprompt|gap>D @gapinput|N:=HAP_CongruenceSubgroupGamma0(I);; #A congruence subgroup of GD
  @gapprompt|gap>D @gapinput|IndexInSL2O(N);D
  5042
  
  @gapprompt|gap>D @gapinput|Y:=GComplexToRegularCWComplex(KK,N); #Y = KK/N is a quotient CW-complexD
  Regular CW-complex of dimension 2
  
  @gapprompt|gap>D @gapinput|Homology(Y,0);D
  [ 0 ]
  @gapprompt|gap>D @gapinput|Homology(Y,1);D
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 
    4, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 
    16, 16, 16, 16, 16, 16, 16, 16, 32, 32, 96, 672, 8471771350548821313678624, 
    42358856752744106568393120, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0 ]
  @gapprompt|gap>D @gapinput|Homology(Y,2);D
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  
  @gapprompt|gap>D @gapinput|Flat(List([0..2], n->D
  @gapprompt|>D @gapinput|              List([1..K!.dimension(n)],k->Order(K!.stabilizer(n,k)))  ));D
  [ 24, 6, 8, 4 ]
  @gapprompt|gap>D @gapinput|Factors(8471771350548821313678624);D
  [ 2, 2, 2, 2, 2, 3, 7, 17, 17, 17, 19, 617, 873263, 250653841 ]
  @gapprompt|gap>D @gapinput|Factors(42358856752744106568393120);D
  [ 2, 2, 2, 2, 2, 3, 5, 7, 17, 17, 17, 19, 617, 873263, 250653841 ]
  
\end{Verbatim}
 The above computation can be corroborated by using a free resolution to
calculate $H_1(\Gamma_0(71),\mathbb Z)$ at all primes. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  		
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(KK,2);;|
  !gapprompt@gap>| !gapinput@S:=ResolutionFiniteSubgroup(R,N);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(S);;|
  !gapprompt@gap>| !gapinput@D:=ContractedComplex(C);;|
  !gapprompt@gap>| !gapinput@Homology(D,1);|
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 
    4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 16, 16, 16, 16,
    16, 16, 16, 16, 16, 16, 16, 32, 96, 96, 672, 8471771350548821313678624, 
    127076570258232319705179360, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 
    0, 0, 0, 0, 0 ]
  
\end{Verbatim}
 The next example computes a CW complex $Y$ with $H^\ast(Y,\mathbb Z) =H^\ast(\Gamma_0(23),\mathbb Z)$ modulo the primes $2,3$ for $\Gamma_0(23) < SL_2({\mathcal O}_{-2})$ and shows that a basis $b_1,b_2,\ldots b_9$ for $H^1(W,\mathbb Z) =\mathbb Z^{9}$ satisfies $b_i\cup b_j=0$ except for $b_1\cup b_6 = -b_6\cup b_1\neq 0$, $b_1\cup b_7 =-b_7\cup b_1\ne 0$, $b_1\cup b_9=-b_9\cup b_1\ne 0$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
                  
  !gapprompt@gap>| !gapinput@I:=QuadraticIdeal(OQ,23);;|
  !gapprompt@gap>| !gapinput@N:=HAP_CongruenceSubgroupGamma0(I);;|
  !gapprompt@gap>| !gapinput@Y:=GComplexToRegularCWComplex(KK,N);;|
  !gapprompt@gap>| !gapinput@Y:=SimplifiedComplex(Y);;|
  !gapprompt@gap>| !gapinput@Cohomology(Y,1);|
  [ 0, 0, 0, 0, 0, 0, 0, 0, 0 ]
  !gapprompt@gap>| !gapinput@B:=IdentityMat(9);; # represents the 9 cohomology generators|
  !gapprompt@gap>| !gapinput@C:=NullMat(9,9);;|
  !gapprompt@gap>| !gapinput@cup:=CupProduct(Y);;|
  !gapprompt@gap>| !gapinput@for i in [1..9] do|
  !gapprompt@>| !gapinput@for j in [j+1..9] do|
  !gapprompt@>| !gapinput@if not IsZero(cup(1,1,B[i],B[j])) then C[i][j]:=1; C[j,i]:=1; fi;|
  !gapprompt@>| !gapinput@od;od;|
  !gapprompt@gap>| !gapinput@Display(C);|
  [ [  0,  0,  0,  0,  0,  1,  1,  0,  1 ],
    [  0,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  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,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  1,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  1,  0,  0,  0,  0,  0,  0,  0,  0 ] ]
  
  
\end{Verbatim}
 

THe following additional commands compute the $11$\texttt{\symbol{45}}primary parts $H^2(\Gamma_0(23),\mathbb Z)_{(11)}=\mathbb Z_{11}$, $H^n(\Gamma_0(23),\mathbb Z)_{(11)}=0$ for $2\ne n>0$. They then compute the cohomology ring $A=H^\ast(\Gamma_0(23),\mathbb Z_{11})$, a basis $B$ of $H^1(\Gamma_0(23),\mathbb Z_{11}) =(\mathbb Z_{11})^{10}$, and procuce a matrix $C=(c_{ij})$ with $c_{ij}=0$ if $b_i\cup b_j=0$, $c_{ij}=1$ if $b_i\cup b_j\ne 0$ for $b_i,b_j\in B$. 
\begin{Verbatim}[commandchars=@|E,fontsize=\small,frame=single,label=Example]
                  
  @gapprompt|gap>E @gapinput|Cohomology(Y,2);E
  [ 2, 2, 2, 4, 4, 4, 4, 4, 44, 0, 0, 0, 0, 0, 0, 0, 0 ]
  @gapprompt|gap>E @gapinput|A:=CohomologyRing(Y,11);E
  <algebra of dimension 20 over GF(11)>
  @gapprompt|gap>E @gapinput|B:=Basis(A);;E
  @gapprompt|gap>E @gapinput|B:=Filtered(B,b->A!.degree(b)=1);;E
  @gapprompt|gap>E @gapinput|C:=NullMat(Length(B),Length(B));;E
  @gapprompt|gap>E @gapinput|for i in [1..Length(B)] doE
  @gapprompt|>E @gapinput|for j in [1..Length(B)] doE
  @gapprompt|>E @gapinput|if not IsZero(B[i]*B[j]) then C[i][j]:=1; fi;E
  @gapprompt|>E @gapinput|od;od;E
  @gapprompt|gap>E @gapinput|Display(C);E
  [ [  0,  0,  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  1,  1,  1 ],
    [  0,  0,  0,  0,  0,  0,  0,  1,  1,  1 ],
    [  0,  0,  0,  0,  0,  1,  1,  1,  1,  1 ],
    [  0,  0,  0,  0,  0,  0,  0,  1,  1,  1 ],
    [  0,  0,  0,  1,  0,  0,  1,  1,  1,  1 ],
    [  0,  0,  0,  1,  0,  1,  0,  1,  1,  1 ],
    [  0,  1,  1,  1,  1,  1,  1,  0,  1,  1 ],
    [  0,  1,  1,  1,  1,  1,  1,  1,  0,  1 ],
    [  0,  1,  1,  1,  1,  1,  1,  1,  1,  0 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Computing a free resolution for $SL_2({\mathcal O}_{-d})$}}\logpage{[ 14, 7, 0 ]}
\hyperdef{L}{X78476F127B73BBD1}{}
{
 The above fundamental domains can be used to construct free resolutions for $SL_2({\mathcal O}_{-d})$ and $PSL_2({\mathcal O}_{-d})$. The following commands illustrate the computation of free resolutions for $SL_2({\mathcal O}_{-43})$ and $SL_2({\mathcal O}_{-10})$ and $SL_2({\mathcal O}_{-14})$ and their integral homology (which in each case is periodic of period dividing $4$ in degrees $\ge 3$). The computation of fundamental domains uses exact arithmetic in the two
field extensions $\mathbb Q(\sqrt{d})$ and $ \mathbb Q(\sqrt{-d})$. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-43);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@C:=TensorWithIntegers(R);;|
  !gapprompt@gap>| !gapinput@List([0..10],n->Homology(C,n));|
  [ [ 0 ], [ 0, 0 ], [ 2, 2, 12, 0 ], [ 2, 2, 24 ], [ 2, 2 ], [ 2 ], 
    [ 2, 2, 12 ], [ 2, 2, 24 ], [ 2, 2 ], [ 2 ], [ 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-10);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Homology(TensorWithIntegers(R),k));|
  [ [ 0 ], [ 2, 2, 0, 0, 0 ], [ 2, 2, 2, 12, 0, 0 ], [ 2, 2, 2, 24 ], 
    [ 2, 4, 12 ], [ 2, 2, 2, 6 ], [ 2, 2, 2, 12 ], [ 2, 2, 2, 24 ], 
    [ 2, 4, 12 ], [ 2, 2, 2, 6 ], [ 2, 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-14);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,11);;|
  !gapprompt@gap>| !gapinput@List([0..10],k->Homology(TensorWithIntegers(R),k));|
  [ [ 0 ], [ 6, 0, 0, 0, 0, 0 ], [ 2, 2, 2, 4, 12, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ], [ 2, 2, 2, 2, 24 ], 
    [ 2, 2, 2, 4, 12 ], [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ], 
    [ 2, 2, 2, 2, 24 ], [ 2, 2, 2, 4, 12 ] ]
  
\end{Verbatim}
 The following commands count the number of orbits of cusps (in addition to the
orbit of $\infty$). They determine that there is precisely one element in the ideal class group
of ${\mathcal O}_{-43}$ (i.e it is a principal ideal domain) and that there are precisely two elements
in the ideal class group of ${\mathcal O}_{-10}$ and precisely four elements in the ideal class group of ${\mathcal O}_{-14}$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-43);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 24, 24, 6, 6, 4, 4, 12, 12 ]
  
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-10);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 6, 4, 4, 6, infinity ]
  
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-14);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 6, 2, 2, 2, infinity, infinity, 2, infinity, 6, 4 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Some sanity checks}}\logpage{[ 14, 8, 0 ]}
\hyperdef{L}{X784B2156823AEB15}{}
{
 There is ample scope for bugs in the implementation of the above method for
computing resolutions of Bianchi groups. The following sanity checks lend
confidence to the implementation. 
\subsection{\textcolor{Chapter }{Equivariant Euler characteristic}}\logpage{[ 14, 8, 1 ]}
\hyperdef{L}{X7E5A36D47F9D4A47}{}
{
 Let $X$ be any cell complex with an action of a group $G$ such that (i) $X$ has finitely many $G$\texttt{\symbol{45}}orbits of cells, and (ii) the stabilizer subgroup in $G$ for each cell is either finite or free abelian. One defines the \emph{equivariant Euler characteristic} \$\$\texttt{\symbol{92}}chi{\textunderscore}G(X) =
\texttt{\symbol{92}}sum{\textunderscore}e
(\texttt{\symbol{45}}1)\texttt{\symbol{94}}\texttt{\symbol{123}}dim\texttt{\symbol{126}}
e\texttt{\symbol{125}} / |Stab{\textunderscore}G(e)|\$\$ where $e$ ranges over a set of representatives of the orbits of those cells with finite
stabilizers. If $G$ has a finite index torsion free subgroup and if the complex $X$ is contractible then one can define the Euler characteristic of the group to
be $\chi(G) = \chi_G(X)$. It is known that $\chi (SL_n({\mathcal O})) = \chi(GL_n({\mathcal O})) =0$ for $\mathcal O$ the ring of integers of a number field \cite{Gangl}. 

One easy test to make in our computations is to check that the equivariant
Euler characteristic of the $2$\texttt{\symbol{45}}complex is indeed zero. The following commands perform
this test for the group $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  
  @gapprompt|gap>A @gapinput|chi:=0;;A
  @gapprompt|gap>A @gapinput|for n in [0..2] doA
  @gapprompt|>A @gapinput|for k in [1..K!.dimension(n)] doA
  @gapprompt|>A @gapinput|g:=Order(K!.stabilizer(n,k));A
  @gapprompt|>A @gapinput|if g < infinity then chi:=chi + (-1)^n/g; fi;A
  @gapprompt|>A @gapinput|od;od;A
  @gapprompt|gap>A @gapinput|chi;A
  0
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Boundary squares to zero}}\logpage{[ 14, 8, 2 ]}
\hyperdef{L}{X852CDAFF84C5DF01}{}
{
 The signs in the boundary maps of the free resolution are delicate. Another
easy test is to check that the boundary in the resolution squares to zero. The
following commands perform this check for the group $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,10);;A
  @gapprompt|gap>A @gapinput|n:=2;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=3;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=4;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  @gapprompt|gap>A @gapinput|n:=5;;List([1..R!.dimension(n)],k->ResolutionBoundaryOfWord(R,n-1,R!.boundary(n,k)));A
  [ [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], [  ], 
    [  ], [  ], [  ] ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Compare different algorithms or implementations}}\logpage{[ 14, 8, 3 ]}
\hyperdef{L}{X7E64819A7C058EDD}{}
{
 Sebastian Schoennenbeck in his thesis work computed some contractible $2$\texttt{\symbol{45}}complexes on which Bianchi groups act with finite
stabilizers (even when the ideal class is greater than $1$) using a different approach to that of Swan. These computed complexes are
stored in \textsc{HAP} and provide an alternative way of computing cohomology for the stored groups.
Alexander Rahm in his thesis work implemented Swan's approach and has provided
some $2$\texttt{\symbol{45}}complexes that are also stored in \textsc{HAP} in cases where the ideal class is equal to $1$. 

The following commands test that Sebastian Schoennenbeck's $2$\texttt{\symbol{45}}complex for $SL_2({\mathcal O}_{-23})$ yields the same integral homology as the above \textsc{HAP} implementation. Both computations use \textsc{HAP}'s implementation of Wall's perturbation technique for computing the
resolution from the $2$\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@K:=ContractibleGcomplex("SL(2,O-23)");;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,10);;|
  !gapprompt@gap>| !gapinput@List([0..9],n->Homology(TensorWithIntegers(R),n));|
  [ [ 0 ], [ 12, 0, 0, 0 ], [ 2, 2, 12, 0, 0 ], [ 2, 2, 12 ], [ 2, 2, 12 ], 
    [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ] ]
  
  !gapprompt@gap>| !gapinput@K:=BianchiGcomplex(-23);;|
  !gapprompt@gap>| !gapinput@R:=FreeGResolution(K,10);;|
  !gapprompt@gap>| !gapinput@List([0..9],n->Homology(TensorWithIntegers(R),n));|
  [ [ 0 ], [ 12, 0, 0, 0 ], [ 2, 2, 12, 0, 0 ], [ 2, 2, 12 ], [ 2, 2, 12 ], 
    [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ], [ 2, 2, 12 ] ]
  
\end{Verbatim}
 }

 
\subsection{\textcolor{Chapter }{Compare geometry to algebra}}\logpage{[ 14, 8, 4 ]}
\hyperdef{L}{X8223864085412705}{}
{
 The number of cusps (i.e. the number of orbits of vertices with infinite
stabilizer subgroup) must be precisely one less than the number of elements in
the ideal class group of ${\mathcal O}_{-d}$. The following commands check this for $SL_2({\mathcal O}_{-23})$ where ${\mathcal O}_{-23}$ is known to have class number 3. (This class number is easily computed from a
formula in Swan's paper.) 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(0)],k->Order(K!.stabilizer(0,k)));A
  [ 6, 2, 2, 4, infinity, infinity ]
  
\end{Verbatim}
 A visualization of the fundamental domain tells us a certain amount about the
algebra. In the case of $SL_2({\mathcal O}_{-23})$ 

  

 a fundamental domain for the action on $\mathbb C$ by the translation subgroup generated by the matrices \$\$
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
1 \&1\texttt{\symbol{92}}\texttt{\symbol{92}} 0
\&1\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right),
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}ll\texttt{\symbol{125}}
1 \&\texttt{\symbol{92}}omega\texttt{\symbol{92}}\texttt{\symbol{92}} 0
\&1\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right)
\$\$ $\omega = (1+\sqrt{-23})/2$ is indicated by the white rectangle. From this we see that under the action of $SL_2({\mathcal O}_{-23})$ there are at most $11$ orbits of $2$\texttt{\symbol{45}}cells, the central decagon and ten quadrilaterals.
However, the matrix \$\$
\texttt{\symbol{92}}left(\texttt{\symbol{92}}begin\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{123}}rr\texttt{\symbol{125}}
0 \&\texttt{\symbol{45}}1\texttt{\symbol{92}}\texttt{\symbol{92}} 1
\&0\texttt{\symbol{92}}end\texttt{\symbol{123}}array\texttt{\symbol{125}}\texttt{\symbol{92}}right)
\$\$ maps $(z,0)$ to $(-1/z,0)$ and fixes $(0,1)$. This isometry identifies points on the boundary of the decagon pairwise.
These observations are consistent with the above listing of the six orbit
stabilizers and the following algebraic information on the boundaries of the $2$\texttt{\symbol{45}}cells in the Bianchi $2$\texttt{\symbol{45}}complex. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|List([1..K!.dimension(2)],k->Length(K!.boundary(2,k)));A
  [ 10, 4, 4, 4, 4, 4 ]
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Group presentations}}\logpage{[ 14, 9, 0 ]}
\hyperdef{L}{X78BC9D077956089A}{}
{
 Swan's reason for studying fundamental domains was to obtain explicit group
presentations for $SL_2({\mathcal O}_{-d})$ for various values of $d$. The following commands obtain a presentation for $SL_2({\mathcal O}_{-23})$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,2);;A
  @gapprompt|gap>A @gapinput|P:=PresentationOfResolution(R);A
  @gapprompt|gap>A @gapinput|G:=SimplifiedFpGroup(P!.freeGroup/P!.relators);A
  <fp group on the generators [ k, r, s, w, x ]>
  @gapprompt|gap>A @gapinput|RelatorsOfFpGroup(G);A
  [ w^-1*k*w*k^-1, s^-1*r*s*r^-1, k^6, x^-1*k^-3*x*k^-3, s^-1*k^-3*s*k^-3, 
    r^-1*w*x^-1*s*r*w^-1*x*s^-1, r^-1*k^-3*r*k^-3, 
    x*k^-2*r^-1*x*r^-1*s^-1*k^-1*s^-1, x^-1*k^3*s*r*x^-1*s*r ]
  
  @gapprompt|gap>A @gapinput|#Next we identify the generators as matricesA
  @gapprompt|gap>A @gapinput|GeneratorsOfGroup(P!.freeGroup);A
  [ k, m, n, p, q, r, s, t, u, v, w, x, y, z ]
  @gapprompt|gap>A @gapinput|P!.gens;A
  [ 19, 6, 6, 20, 6, 21, 22, 6, 52, 53, 2, 50, 1, 4 ]
  
  @gapprompt|gap>A @gapinput|k:=R!.elts[19];A
  [ [ 1, 1 ], 
    [ -1, 0 ] ]
  @gapprompt|gap>A @gapinput|r:=R!.elts[21];A
  [ [ 3, 3 + -1 Sqrt(-23) ], 
    [ -3/2 + -1/2 Sqrt(-23), -5 ] ]
  @gapprompt|gap>A @gapinput|s:=R!.elts[22];A
  [ [ 2 + 1 Sqrt(-23), 13/2 + 1/2 Sqrt(-23) ], 
    [ 5/2 + -1/2 Sqrt(-23), -1 Sqrt(-23) ] ]
  @gapprompt|gap>A @gapinput|w:=R!.elts[2];A
  [ [ 3/2 + 1/2 Sqrt(-23), -3/2 + 1/2 Sqrt(-23) ], 
    [ 3/2 + -1/2 Sqrt(-23), 3 ] ]
  @gapprompt|gap>A @gapinput|x:=R!.elts[50];A
  [ [ 11/2 + 1/2 Sqrt(-23), 15/2 + -1/2 Sqrt(-23) ], 
    [ -1 Sqrt(-23), -4 + -1 Sqrt(-23) ] ]
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Swan's generators}}\logpage{[ 14, 9, 1 ]}
\hyperdef{L}{X795000AA87CCB76E}{}
{
 The five generators in the above presentation for $SL_2({\mathcal O}_{-23})$ are obtained by constructing the low dimensions of a
CW\texttt{\symbol{45}}classifying space, forming a maximal tree in its $1$\texttt{\symbol{45}}skeleton, constructing a presentation whose generators
correspond to edges not in the tree, and then applying Tietze operations to
simplify this presentation. Swan's approach instead uses generators
corresponding to the "face pairings" of the $3$\texttt{\symbol{45}}dimensional fundamental domain. For $d\ne 1, 3$ the number of these face\texttt{\symbol{45}}pairing generators in $SL_2({\mathcal O}_{-d})$ is equal to $3$ plus the number of orbits of $2$\texttt{\symbol{45}}cells in the equivariant $2$\texttt{\symbol{45}}complex $K$. The three extra generators are the two translations corresponding to the
vertical faces of the $3$\texttt{\symbol{45}}dimensional fundamental domain which get homotopied to
edges in $K$, plus the element $\left(\begin{array}{rr} -1 & 0\\0 & -1\end{array}\right)$ which acts trivially on ${\frak H}^3$. For $d=1,3$ there is one further generator due to the existence of
non\texttt{\symbol{45}}trivial units in ${\mathcal O}(\mathbb Q(\sqrt{-1}))$ and ${\mathcal O}(\mathbb Q(\sqrt{-3}))$. 

 The following commands show that for $SL_2({\mathcal O}_{-23})$ there are 6 orbits of $2$\texttt{\symbol{45}}cells in $K$ and then lists Swan's 9 generators. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=BianchiGcomplex(-23);;A
  @gapprompt|gap>A @gapinput|K!.dimension(2);A
  6
  @gapprompt|gap>A @gapinput|for g in GeneratorsOfGroup(K!.group) doA
  @gapprompt|>A @gapinput|Print(g,"\n");A
  @gapprompt|>A @gapinput|od;A
  [ [ -1, 0 ], [ 0, -1 ] ]
  [ [ 1, 1 ], [ 0, 1 ] ]
  [ [ 1, 1/2 + 1/2 Sqrt(-23) ], [ 0, 1 ] ]
  [ [ -1, 0 ], [ 1, -1 ] ]
  [ [ 5 + 2 Sqrt(-23), -11 ], [ 3/2 + -1/2 Sqrt(-23), 3/2 + 1/2 Sqrt(-23) ] ]
  [ [ 208 + 25 Sqrt(-23), -225 + 25 Sqrt(-23) ], [ 3/2 + 1/2 Sqrt(-23), -3 ] ]
  [ [ 18 + 91 Sqrt(-23), -437 ], [ 5/2 + 1/2 Sqrt(-23), -5/2 + 1/2 Sqrt(-23) ] ]
  [ [ 1 + -6 Sqrt(-23), -29 ], [ 5/2 + -1/2 Sqrt(-23), -5/2 + -1/2 Sqrt(-23) ] ]
  [ [ 1 Sqrt(-23), -6 ], [ 4, 1 Sqrt(-23) ] ]
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Finite index subgroups}}\logpage{[ 14, 10, 0 ]}
\hyperdef{L}{X786CFAA17C0A6E7A}{}
{
 The following commands compute the integral homology of a congruence subgroup $G$ of index 24 in $SL_2({\mathcal O}_{-23})$. They also compute a presentation for $G$ with 13 generators and 24 relators. 
\begin{Verbatim}[commandchars=@|D,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>D @gapinput|OQ:=RingOfIntegers(QuadraticNumberField(-23));;D
  @gapprompt|gap>D @gapinput|I:=QuadraticIdeal(OQ,[Sqrt(-23)]);D
  ideal of norm 23 in O(Q(Sqrt(-23)))
  @gapprompt|gap>D @gapinput|G:=HAP_CongruenceSubgroupGamma0(I);D
  <group of 2x2 matrices in characteristic 0>
  @gapprompt|gap>D @gapinput|IndexInSL2O(G);D
  24
  
  @gapprompt|gap>D @gapinput|K:=BianchiGcomplex(-23);;D
  @gapprompt|gap>D @gapinput|R:=FreeGResolution(K,11);;D
  @gapprompt|gap>D @gapinput|R:=QuadraticToCyclotomicCoefficients(R);;D
  @gapprompt|gap>D @gapinput|S:=ResolutionFiniteSubgroup(R,G);;D
  @gapprompt|gap>D @gapinput|List([0..10],n->Homology(TensorWithIntegers(S),n));D
  [ [ 0 ], [ 2, 0, 0, 0, 0, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0, 0, 0 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ],
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 2, 2, 2, 2 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2 ] ]
  
  @gapprompt|gap>D @gapinput|P:=PresentationOfResolution(S);;D
  @gapprompt|gap>D @gapinput|H:=SimplifiedFpGroup(P!.freeGroup/P!.relators);D
  <fp group on the generators [ f8, f10, f15, f70, f86, f125, f132, f138, f182, 
    f187, f191, f273, f279 ]>
  @gapprompt|gap>D @gapinput|Length(RelatorsOfFpGroup(H));D
  24
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Totally real quadratic fields / Hilbert modular group}}\logpage{[ 14, 11, 0 ]}
\hyperdef{L}{X82F46C8B782420AB}{}
{
 For square free $d>0$ the group $PSL_2({\mathcal O}_d)$ is a subgroup of $PSL_2(\mathbb R)$ but not a discrete subgroup. It embeds as a discrete subgroup of $PSL_2(\mathbb R)\times PSL_2(\mathbb R)$ but a fundamental domain for its action on ${\frak h}^2 \times {\frak h}^2$ is not implemented in HAP. One can obtain a contractible $GL_2({\mathcal O}_d)$\texttt{\symbol{45}}equivariant complex using \href{https://github.com/schoennenbeck/VMH-TotallyRealNumberFields} {Sebastian Schoennenbeck's Magma implementation} of Voronoi's algorithm to produce text files that can be read into HAP. A few
of these text files are stored in HAP. The following commands use one such
text file to compute integral homology groups of $GL_2({\mathcal O}(\mathbb Q(\sqrt{14})))$. In this example the contractible complex is $4$\texttt{\symbol{45}}dimensional and has $33$ orbits of $4$\texttt{\symbol{45}}dimensional cells. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|K:=ContractibleGcomplex("GL(2,O14)");A
  Non-free resolution in characteristic 0 for matrix group . 
  No contracting homotopy available. 
  
  @gapprompt|gap>A @gapinput|List([0..5],K!.dimension);A
  [ 144, 463, 532, 234, 33, 0 ]
  
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(K,6);;A
  @gapprompt|gap>A @gapinput|List([0..5],n->Homology(TensorWithIntegers(R),n));A
  [ [ 0 ], [ 2, 2, 2, 0 ], [ 2, 2, 2, 2, 2, 2, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 24, 24, 0, 0, 0, 0 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 12, 24 ], 
    [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4 ] ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Calling Magma's Voronoi algorithm directly}}\logpage{[ 14, 12, 0 ]}
\hyperdef{L}{X85F5853D819AE0E1}{}
{
 If 
\begin{itemize}
\item the \textsc{Magma} computational algebra system can be started using the line command \texttt{magma} and
\item  \href{https://github.com/schoennenbeck/VMH-ImaginaryQuadraticNumberFields} {Sebastian Schoennenbeck's Magma implementation} of Voronoi's algorithm for imaginary quadratic number fields is copied to
\texttt{\symbol{126}}pkg/Voronoi/VMH\texttt{\symbol{45}}ImaginaryQuadraticNumberFields
and
\item \href{https://github.com/schoennenbeck/VMH-TotallyRealNumberFields} {Sebastian Schoennenbeck's Magma implementation} of Voronoi's algorithm for totally real quadratic number fields is copied to
\texttt{\symbol{126}}pkg/Voronoi/VMH\texttt{\symbol{45}}TotallyRealNumberFields 
\end{itemize}
 then one can use the \textsc{GAP} commands \texttt{VoronoiGL(n,d)} and \texttt{VoronoiSL(n,d)} to call the \textsc{Magma} implementation of the Voronoi algorithm directly. For example, the following
commands do this to calculate the homology groups $H^4(GL_2({\mathcal O}_{-5} ),P_{{\mathcal O}_{-5}}(8)) = (\mathbb Z_2)^{17}
\oplus (\mathbb Z_4)^2 \oplus (\mathbb Z_8)^2 $ and $H_4(GL_2({\mathcal O}(\mathbb Q(\sqrt{5})),\mathbb Z) = (\mathbb Z_2)^7 \oplus
\mathbb Z_{60}$ and $H_n(GL_3({\mathcal O}_{-5}),\mathbb Z)$ for $n=1,2$. 
\begin{Verbatim}[commandchars=@|A,fontsize=\small,frame=single,label=Example]
  @gapprompt|gap>A @gapinput|V:=VoronoiComplexSL(2,-5);; #makes a call to MagmaA
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(V,5);;A
  @gapprompt|gap>A @gapinput|M:=HomogeneousPolynomials(R!.group,8);;A
  @gapprompt|gap>A @gapinput|C:=HomToIntegralModule(R,M);;A
  @gapprompt|gap>A @gapinput|Cohomology(C,4);A
  [ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 8, 8 ]
  
  @gapprompt|gap>A @gapinput|V:=VoronoiComplexGL(2,5);; #makes a call to MagmaA
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(V,5);;A
  @gapprompt|gap>A @gapinput|Homology(TensorWithIntegers(R),4);A
  [ 2, 2, 2, 2, 2, 2, 2, 60 ]
  
  @gapprompt|gap>A @gapinput|#V:=VoronoiComplexGL(3,-5);; #makes a call to Magma (requires much time)A
  @gapprompt|gap>A @gapinput|V:=ContractibleGcomplex("SL(3,O-5)");; #loads stored data (is faster) A
  @gapprompt|gap>A @gapinput|R:=FreeGResolution(V,4);;A
  @gapprompt|gap>A @gapinput|Homology(TensorWithIntegers(R),1);A
  [ 2 ]
  @gapprompt|gap>A @gapinput|Homology(TensorWithIntegers(R),2);A
  [ 2, 2, 2, 4 ]
  
\end{Verbatim}
 }

 }

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

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

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

for the $2328$\texttt{\symbol{45}}th group $G$ in \textsc{GAP}'s library of small groups. The penulimate command shows that the parallel
computation achieves a speedup of 10.4 . 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@Processes:=List([1..15],i->ChildProcess());;|
  !gapprompt@gap>| !gapinput@fn:=function(i);return GroupHomology(SmallGroup(128,i),2);end;;|
  !gapprompt@gap>| !gapinput@for p in Processes do|
  !gapprompt@>| !gapinput@ChildPut(fn,"fn",p);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");L:=ParallelList([1..2328],"fn",Processes);;Exec("date +%s");|
  1716105545
  1716105554
  !gapprompt@gap>| !gapinput@Exec("date +%s");L1:=List([1..2328],fn);;Exec("date +%s");|
  1716105586
  1716105680
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(680-586)/(554-545);|
  10.4444
  
  !gapprompt@gap>| !gapinput@L[2328];|
  [ 2, 2, 2, 2, 2, 2, 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 }{A non\texttt{\symbol{45}}embarassingly parallel computation}}\logpage{[ 15, 2, 0 ]}
\hyperdef{L}{X80F359DD7C54D405}{}
{
 

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(10000,10000);;|
  !gapprompt@gap>| !gapinput@N:=RandomMat(10000,10000);;|
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@s:=ChildProcess();;|
  !gapprompt@gap>| !gapinput@|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716109418
  !gapprompt@gap>| !gapinput@Mtop:=M{[1..5000]};;|
  !gapprompt@gap>| !gapinput@Mbottom:=M{[5001..10000]};;|
  !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);;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716110143
  
  !gapprompt@gap>| !gapinput@AA:=M*N;;Exec("date +%s");|
  1716111389
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(111389-110143)/(110143-109418);|
  1.71862
  
\end{Verbatim}
 

The next commands compute the product $A=M\times N$ of two random matrices by distributing the work over fifteen processors. The
parallelization is very naive (the entire matrices $M$ and $N$ are communicated to all processes) and the computation achieves a speedup of
7.6. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@M:=RandomMat(15000,15000);;|
  !gapprompt@gap>| !gapinput@N:=RandomMat(15000,15000);;|
  !gapprompt@gap>| !gapinput@S:=List([1..15],i->ChildCreate());;|
  
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716156583
  !gapprompt@gap>| !gapinput@ChildPutObj(M,"M",S);|
  !gapprompt@gap>| !gapinput@ChildPutObj(N,"N",S);|
  !gapprompt@gap>| !gapinput@for i in [1..15] do|
  !gapprompt@>| !gapinput@cmd:=Concatenation("A:=M{[1..1000]+(",String(i),"-1)*1000}*N;");|
  !gapprompt@>| !gapinput@ChildCommand(cmd,S[i]);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@A:=[];;|
  !gapprompt@gap>| !gapinput@for i in [1..15] do|
  !gapprompt@>| !gapinput@ C:=ChildGet("A",S[i]);|
  !gapprompt@>| !gapinput@ Append(A,C);|
  !gapprompt@>| !gapinput@od;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");|
  1716157489
  
  !gapprompt@gap>| !gapinput@AA:=M*N;;Exec("date +%s");|
  1716164405
  
  !gapprompt@gap>| !gapinput@speedup:=1.0*(64405-57489)/(57489-56583);|
  7.63355
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Parallel persistent homology}}\logpage{[ 15, 3, 0 ]}
\hyperdef{L}{X8496786F7FCEC24A}{}
{
 Section \ref{secAltPersist} illustrates an alternative method of computing the persitent Betti numbers of
a filtered pure cubical complex. The method lends itself to parallelisation.
However, the following parallel computation of persistent Betti numbers
achieves only a speedup of $1.5$ due to a significant time spent transferring data structures between
processes. On the other hand, the persistent Betti function could be used to
distribute computations over several computers. This might be useful for
larger computations that require significant memory resources. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@file:=HapFile("data247.txt");;|
  !gapprompt@gap>| !gapinput@Read(file);;|
  !gapprompt@gap>| !gapinput@F:=ThickeningFiltration(T,25);;|
  !gapprompt@gap>| !gapinput@S:=List([1..15],i->ChildCreate());;|
  !gapprompt@gap>| !gapinput@N:=[0,1,2];;|
  !gapprompt@gap>| !gapinput@Exec("date +%s");P:=ParallelPersistentBettiNumbers(F,N,S);;Exec("date +%s");|
  1717160785
  1717161285
  
  !gapprompt@gap>| !gapinput@Exec("date +%s");Q:=PersistentBettiNumbersAlt(F,N);;Exec("date +%s");|
  1717161528
  1717162276
  !gapprompt@gap>| !gapinput@speedup:=1.0*(1717162276-1717161528)/(1717161285-1717160785);|
  1.496
  
\end{Verbatim}
 }

 }

 
\chapter{\textcolor{Chapter }{Regular CW\texttt{\symbol{45}}structure on knots (written by Kelvin Killeen)}}\logpage{[ 16, 0, 0 ]}
\hyperdef{L}{X7C57D4AB8232983E}{}
{
 
\section{\textcolor{Chapter }{Knot complements in the 3\texttt{\symbol{45}}ball}}\logpage{[ 16, 1, 0 ]}
\hyperdef{L}{X86F56A85848347FF}{}
{
 While methods for endowing knot complements with
CW\texttt{\symbol{45}}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\texttt{\symbol{45}}dimensional regular CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cells to regular CW\texttt{\symbol{45}}complexes by
specifying the $(n-1)$\texttt{\symbol{45}}cells in their boundaries and $(n+1)$\texttt{\symbol{45}}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{[ 16, 2, 0 ]}
\hyperdef{L}{X83EA2A38801E7A4C}{}
{
 Let $Y$ denote a CW\texttt{\symbol{45}}subcomplex of a regular
CW\texttt{\symbol{45}}complex $X$ and let $N(Y)$ denote an open tubular neighbourhood of $Y$. Given an inclusion of regular CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}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\texttt{\symbol{45}}subcomplexes of $Y$. For each $n$\texttt{\symbol{45}}cell of $X \backslash Y$ there is one internal $n$\texttt{\symbol{45}}cell $e^n$ of $X \backslash N(Y)$. For $n \geq 1$ there is also one external $(n-1)$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell $e^n$ consists of all those internal $(n-1)$\texttt{\symbol{45}}cells of $\bar{e}^n$ together with all external $(n-1)$\texttt{\symbol{45}}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)$\texttt{\symbol{45}}cell $f^{e^n}_{A_i}$ consists of all those external $(n-2)$\texttt{\symbol{45}}cells $f^{e^{n-1}}_{B_j}$ where $e^{n-1}$ is an $(n-1)$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell $e^n \subset X \backslash Y$, compute the CW\texttt{\symbol{45}}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$\texttt{\symbol{45}}cells in $X \backslash N(Y)$ and $b_i$ is a list of integers describing the $(n-1)$\texttt{\symbol{45}}cells of the $i ^ \textrm{th}$ $n$\texttt{\symbol{45}}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\texttt{\symbol{45}}complex. 

 The following example computes the tubular neighbourhood of a $1$\texttt{\symbol{45}}dimensional subcomplex of a $3$\texttt{\symbol{45}}dimensional complex corresponding to the Hopf link
embedded in the closed $3$\texttt{\symbol{45}}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\texttt{\symbol{45}}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$\texttt{\symbol{45}}ball in which the link was embedded. These path components
can be obtained as individual CW\texttt{\symbol{45}}subcomplexes if desired. A
CW\texttt{\symbol{45}}subcomplex is represented in HAP as a list $[X,s]$ where $X$ is a regular CW\texttt{\symbol{45}}complex and $s$ is a list of length $n$ whose $i^\textrm{th}$ entry lists the indexing of each $(i-1)$\texttt{\symbol{45}}cell of the $n$\texttt{\symbol{45}}dimensional subcomplex of $X$. CW\texttt{\symbol{45}}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\texttt{\symbol{45}}contractible
path\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell into as many $n$\texttt{\symbol{45}}cells as there are $(n-1)$\texttt{\symbol{45}}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$\texttt{\symbol{45}}cell of this complex and then compares the difference in
size of the two different subdivisions of a 2\texttt{\symbol{45}}cell in the
boundary of this $3$\texttt{\symbol{45}}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\texttt{\symbol{45}}ball}}\logpage{[ 16, 3, 0 ]}
\hyperdef{L}{X78C28038837300BD}{}
{
 A construction of Satoh's, the tube map, associates a ribbon
torus\texttt{\symbol{45}}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\texttt{\symbol{45}}dimensional
height information as represented by a colour scale from blue (lower down in
4\texttt{\symbol{45}}space), to green (0 level), to red (higher up in
4\texttt{\symbol{45}}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|ViewArc2Presentation([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\texttt{\symbol{45}}decomposition of ribbon
torus\texttt{\symbol{45}}knots, we first begin by embedding a
self\texttt{\symbol{45}}intersecting knotted torus in the
3\texttt{\symbol{45}}ball. The function \texttt{ArcDiagramToTubularSurface} inputs a coloured arc diagram and outputs an inclusion from the boundary of
some (potentially self\texttt{\symbol{45}}intersecting) torus in the $3$\texttt{\symbol{45}}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\texttt{\symbol{45}}intersecting torus into the
3\texttt{\symbol{45}}ball where each $2$\texttt{\symbol{45}}cell (the top\texttt{\symbol{45}}dimensional cells of the
self\texttt{\symbol{45}}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\texttt{\symbol{45}}intersecting surface with colour, we can
lift it to a surface without self\texttt{\symbol{45}}intersections in $\mathbb{R}^4$. We do this by constructing a regular CW\texttt{\symbol{45}}complex of the
direct product $B^3 \times [a,b]$ where $B^3$ denotes the $3$\texttt{\symbol{45}}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\texttt{\symbol{45}}cells arising as
double\texttt{\symbol{45}}point singularities. The following example
constructs the complement of a ribbon torus\texttt{\symbol{45}}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$\texttt{\symbol{45}}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}
