\Chapter{Introduction }

The {\GAP} 4 package {\sf HAP} provides a library of functions for computations related to the cohomology of groups. Both finite and infinite groups are handled, with main emphasis on integer coefficients.
 The main manual for the library is available only in html format and can be accessed from the file pkg/Hap/www/index.html. A summary of the manual is provided below.

HAP can be used to make basic calculations in the cohomology of finite and infinite groups. For example, to calculate the integral homology 
$H_n(D_{201},\bf Z) ={\bf Z}_{402}$
of the dihedral group of order $402$ in dimension $n=99$
we could perform the following commands. 

\beginexample
gap> F:=FreeGroup(2);; x:=F.1;; y:=F.2;;
gap> G:=F/[x^2,y^201,(x*y)^2];; G:=Image(IsomorphismPermGroup(G));;
gap> GroupHomology(G,99);
[ 2, 3, 67 ]
\endexample

The HAP command {\sf GroupHomology(G,n)} returns the abelian 
group invariants of the $n$-dimensional homology of the group $G$ with coefficients in the integers $\bf Z$ with trivial $G$-action. 

The above example has two features that dramatically help the computations. 
Firstly, $D_{201}$ is a relatively small group. Secondly, 
$D_{201}$ has periodic homology with period $4$ (meaning that 
$H_n(D_{201},{\bf Z}) = H_{n+4}(D_{201},{\bf Z})$ for $n>0$)
and so the homology groups themselves are small. 

Typically, the homology of larger non-periodic groups can only be computed in low dimensions. The following commands show that:

 the alternating group $A_7$ (of order 2520) has $H_{10}(A_7,{\bf Z}) = 
Z_6\oplus (Z_3)^2$ .  

 the special linear group $SL_3({\bf Z_3})$ (of order 5616) has 
$H_8(SL_3({\bf Z}_3),{\bf Z})={\bf Z}_6$ .

 the group $SL_3({\bf Z}_5)$ (of order 372000) has 
$H_3(SL_3({\bf Z}_5),{\bf Z}) = {\bf Z}_{24}$ .
	        
 the abelian group $G=C_2\times C_4\times C_6\times C_8\times C_{10} 
\times C_{12}$ (of order 46080) has $H_6(G,{\bf Z})=({\bf Z2})^{280}
\oplus({\bf Z}_4)^{12}\oplus ({\bf Z}_{12})^3$ .

\beginexample
gap> GroupHomology(AlternatingGroup(7),10);
[ 2, 3, 3, 3 ]

gap> S:=Image(IsomorphismPermGroup(SL(3,3)));;
g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]
\endexample

The command {\sf GroupHomology()}
returns the mod $p$ homology when an optional third argument is set equal to a 
prime $p$. The following shows that the Sylow 
$2$-subgroup $P$ of the Mathieu simple group $M_{24}$ has $6$-dimensional mod 
$2$ homology $H_6(P,{\bf Z}_2)=({\bf Z}_2)^143$ . 
(The group $P$ has order 1024 and the computation takes over two hours to 
complete.))

\beginexample
gap> GroupHomology(SylowSubgroup(MathieuGroup(24),2),6,2);
143
\endexample

The homology of certain infinite groups can also be calculated. The following shows that the classical braid group $B$
on eight strings (represented by a linear Coxeter diagram $D$
with seven vertices) has $5$-dimensional integral homology $H_5(B,{\bf Z}) = 
{\bf Z}_3$ .

\beginexample
gap> D:=[  [1,[2,3]],  [2,[3,3]],  [3,[4,3]],  [4,[5,3]],  [5,[6,3]],  [6,[7,3]]  ];;

gap> GroupHomology(D,5);
[ 3 ]
\endexample

The command {\sf GroupHomology(G,n)}
is a composite of several more basic {\sf HAP}
functions and attempts, in a fairly crude way, to make reasonable choices 
for a number of parameters in the calculation of group homology. For a 
particular group $G$ you would almost certainly be better off 
using the more basic functions directly and making the choices yourself! 
Similar comments apply to functions for cohomology (ring) calculations. A summery of the basic {\sf HAP} functions is given in the next chapter. For full details consult the html {\sf HAP} manual.

