  
  [1X2 [33X[0;0YExamples[133X[101X
  
  
  [1X2.1 [33X[0;0YComputing the mod [22Xp[122X[101X[1X group cohomology[133X[101X
  
  [33X[0;0YLet [22XG[122X be a group and [22XF[122X be a field, and let [22XFG[122X be the group ring of [22XG[122X over [22XF[122X.
  A  free  [22XFG[122X-resolution  of  the  ground  ring is an exact sequence of module
  homomorphisms[133X
  
  
  [24X[33X[0;6Y... ---> M_(n+1) ---> M_n ---> M_(n-1) ---> ... ---> M_1 ---> FG --->> F[133X
  
  [124X
  
  [33X[0;0YWhere  each  [22XM_n[122X  is  a  free  [22XFG[122X-module and the image of [22Xd_n+1: M_n+1 → M_n[122X
  equals the kernel of [22Xd_n: M_n → M_n-1[122X for all [22Xn > 0[122X. The maps [22Xd_n[122X are called
  boundary  homomorphisms.  In  [5XHAPprime[105X  we  consider  the  case where [22XG[122X is a
  [22Xp[122X-group and [22XF[122X is the prime field [22XGF(p)[122X, and this is assumed from now on.[133X
  
  [33X[0;0YIf  we  now  define  the Abelian group [22XD_n[122X to be [22XHom(M_n, F)[122X, the set of all
  homomorphisms  [22XM_n -> F[122X, we can obtain the dual of this sequence, which will
  be a cochain complex of Abelian group homomorphisms[133X
  
  
  [24X[33X[0;6Y... <--- D_(n+1) <--- D_n ---> D_(n-1) <--- ... <--- D_1 <--- F <--- F[133X
  
  [124X
  
  [33X[0;0YEach  group [22XD_n[122X will be isomorphic to [22XF^|M_n|[122X where [22X|M_n|[122X is the rank of the
  module  [22XM_n[122X.  Unlike  the  resolution,  this  sequence will generally not be
  exact, but one can define the mod-[22Xp[122X cohomology group of [22XG[122X at degree [22Xn[122X to be[133X
  
  
  [24X[33X[0;6YH^n(G, F) = ker(D_n ---> D_(n+1)) / im(D_(n-1) ---> D_n)[133X
  
  [124X
  
  [33X[0;0Yfor  all  [22Xn  >  0[122X. As with the [22XD_n[122X, the mod-[22Xp[122X cohomology groups will also be
  isomorphic  to  vector  spaces over [22XF[122X. In the case where the resolution [22XR[122X is
  minimal  (where  each  module [22XM_n[122X has the minimal number of generators), the
  dimensions  of  the  (co)homology  groups  [22XH^n(G,  F)[122X  are  identical to the
  dimensions  of  the  resolution  modules  [22XM_n[122X. The group cohomology (and the
  similar  group  homology)  is  an  invariant  of [22XG[122X, and does not depend on a
  particular free [22XFG[122X-resolution.[133X
  
  [33X[0;0YIn  the  general  case,  there  are  thus  two stages to computing the group
  cohomology of [22XG[122X up to the [22Xn[122Xth cohomology group:[133X
  
  [31X1[131X   [33X[0;6YCompute [22XR[122X, a free [22XFG[122X-resolution for [22XFG[122X, with at least [22Xn+1[122X terms.[133X
  
  [31X2[131X   [33X[0;6YConstruct  the  cochain  complex  [22XC[122X  from [22XR[122X and compute the [22Xn[122X homology
        groups of [22XC[122X[133X
  
  [33X[0;0YFor  example, to calculate the 9th mod-[22Xp[122X cohomology group of the 134th order
  64  in  the  [5XGAP[105X  small groups library (which is the Sylow 2-subgroup of the
  Mathieu    group    [22XM_12[122X),    we    can    use    the    [5XHAPprime[105X   function
  [2XResolutionPrimePowerGroupRadical[102X  ([14X3.1-1[114X)  to  compute  10  terms  of a free
  [22XFG[122X-resolution  for  [22XG[122X and then use [5XHAP[105X functions to find the rank [22Xb_9[122X of the
  cohomology  group,  which  will be isomorphic to [22XF^b_9[122X. Alternatively, since
  [2XResolutionPrimePowerGroupRadical[102X    ([14X3.1-1[114X)   always   returns   a   minimal
  resolution,  the  cohomology  group dimensions can be read directly from the
  resolution.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(64, 134);;[127X[104X
    [4X[25Xgap>[125X [27X# First construct a FG-resolution for the group G[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroupRadical(G, 10);[127X[104X
    [4X[28XResolution of length 10 in characteristic 2 for <pc group of size 64 with[128X[104X
    [4X[28X6 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27X# Convert this into a cochain complex (over the prime field with p=2)[127X[104X
    [4X[25Xgap>[125X [27XC := HomToIntegersModP(R, 2);[127X[104X
    [4X[28XCochain complex of length 10 in characteristic 2 .[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27X# And get the rank of the 9th cohomology group[127X[104X
    [4X[25Xgap>[125X [27Xb9 := Cohomology(C, 9);[127X[104X
    [4X[28X55[128X[104X
    [4X[25Xgap>[125X [27X[127X[104X
    [4X[25Xgap>[125X [27X# Since R is a free resolution, the ranks of the cohomology groups[127X[104X
    [4X[25Xgap>[125X [27X# are the same as the module ranks in R[127X[104X
    [4X[25Xgap>[125X [27XResolutionModuleRanks(R);[127X[104X
    [4X[28X[ 3, 6, 10, 15, 21, 28, 36, 45, 55, 66 ][128X[104X
  [4X[32X[104X
  
  
  [1X2.2   [33X[0;0YComparing   the   memory   usage  and  speed  of  [5XHAPprime[105X[101X[1X  and  [5XHAP[105X[101X[1X's[101X
  [1X[9XResolutionPrimePowerGroup[109X[101X[1X functions[133X[101X
  
  [33X[0;0YFor small [22Xp[122X-groups, the group ring [22XFG[122X can be considered as a vector space of
  rank  [22X|G|[122X with the elements of [22XG[122X as its basis elements. Each module [22XM_n[122X in a
  [22XFG[122X-resolution  is  also  a  vector  space  (of  dimension  [22X|M_n||G|[122X) and the
  boundary  maps  [22Xd_n[122X  can  be represented as vector space homomorphisms. As a
  result,  standard linear algebra techniques can be used to compute a minimal
  resolution  by  constructing  a  sequence  of module homomorphisms where the
  kernel  of  one  map  is  the  image of the next, and where the modules have
  minimal   generating  sets.  See  Chapter  [14X'HAPprime  Datatypes:  Resolution
  construction functions'[114X in the datatypes manual for further details.[133X
  
  [33X[0;0YAs  the  groups  get  larger, this approach becomes less feasible due to the
  amount  of  time  and  memory  needed to store and compute the null space of
  large   matrices.   The   [5XHAP[105X   function   [2XResolutionPrimePowerGroup[102X   ([14XHAP:
  ResolutionPrimePowerGroup[114X)       and       the       [5XHAPprime[105X      functions
  [2XResolutionPrimePowerGroupRadical[102X   ([14X3.1-1[114X)  and  [2XResolutionPrimePowerGroupGF[102X
  ([14X3.1-1[114X) all use this linear algebra approach, but the [5XHAPprime[105X functions are
  optimised  to save memory, allowing the computation of resolutions which are
  longer, or are of larger groups, than are possible using [5XHAP[105X alone.[133X
  
  
  [1X2.2-1 [33X[0;0Y[5XHAPprime[105X[101X[1X takes less memory to store resolutions[133X[101X
  
  [33X[0;0YConsider  computing  a  resolution of a group of an arbitrary group of order
  128,  [10XG  =  SmallGroup(128,  844)[110X  using  [5XHAP[105X. Computation is performed on a
  dual-core Intel Core2Duo running at 2.66MHz, and the memory available to [5XGAP[105X
  is the standard initial allocation of 256Mb.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(128, 844);;[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroup(G, 9);[127X[104X
    [4X[28XResolution of length 9 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xtime;[127X[104X
    [4X[28X27685[128X[104X
    [4X[25Xgap>[125X [27X# Can we construct a resolution of length ten?[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroup(G, 10);[127X[104X
    [4X[28Xexceeded the permitted memory (`-o' command line option) at[128X[104X
    [4X[28Xres := SemiEchelonMatDestructive( List( mat, ShallowCopy ) );[128X[104X
    [4X[28X called from[128X[104X
    [4X[28XSemiEchelonMat( NullspaceMat( BndMat ) ) called from[128X[104X
    [4X[28XZGbasisOfKernel( i - 1 ) called from[128X[104X
    [4X[28X<function>( <arguments> ) called from read-eval-loop[128X[104X
    [4X[28XEntering break read-eval-print loop ...[128X[104X
    [4X[28Xyou can 'quit;' to quit to outer loop, or[128X[104X
    [4X[28Xyou can 'return;' to continue[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  [5XHAPprime[105X  function  [2XResolutionPrimePowerGroupRadical[102X  ([14X3.1-1[114X)  uses  an
  almost  identical  algorithm, but stores its boundary maps more efficiently.
  As a result, with the same memory allowance:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(128, 844);;[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroupRadical(G, 9);[127X[104X
    [4X[28XResolution of length 9 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xtime;[127X[104X
    [4X[28X25321[128X[104X
    [4X[25Xgap>[125X [27X# Can we construct a resolution of length ten?[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupRadical(R);;[127X[104X
    [4X[25Xgap>[125X [27X# Yes! How about eleven?[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupRadical(R);[127X[104X
    [4X[28XResolution of length 11 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XResolutionModuleRanks(R);[127X[104X
    [4X[28X[ 3, 6, 11, 19, 30, 44, 62, 85, 113, 146, 185 ][128X[104X
    [4X[25Xgap>[125X [27X[127X[104X
    [4X[25Xgap>[125X [27X# But it will run out of memory if we try to go to twelve terms[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupRadical(R);[127X[104X
    [4X[28Xexceeded the permitted memory (`-o' command line option) at[128X[104X
    [4X[28X...[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  [5XHAPprime[105X version can compute two further terms of the resolution, which
  given  the  sizes  of  the  additional  modules  represents  a  considerable
  improvement.  Just  representing the homomorphism [22Xd_10: (FG)^146 -> (FG)^113[122X
  as  vectors  requires  nearly as much memory again as representing the first
  nine  homomorphisms.  To  compute and store the same resolution of length 11
  using  [2XResolutionPrimePowerGroup[102X ([14XHAP: ResolutionPrimePowerGroup[114X) would need
  a  little  over three times the memory used here by [5XHAPprime[105X. The time taken
  by both versions is very similar.[133X
  
  [33X[0;0YIn   the  example  above,  note  also  the  use  of  the  [5XHAPprime[105X  function
  [2XExtendResolutionPrimePowerGroupRadical[102X  ([14X3.1-2[114X),  which makes it much easier
  to add terms to an existing resolution. In standard [5XHAP[105X, if one decides that
  a  resolution is too short and that more terms are required, then the entire
  resolution must be computed again from scratch.[133X
  
  
  [1X2.2-2 [33X[0;0Y[5XHAPprime[105X[101X[1X takes less memory to compute resolutions[133X[101X
  
  [33X[0;0YThe  function  [2XResolutionPrimePowerGroupGF[102X  ([14X3.1-1[114X)  uses a new algorithm to
  compute   the   kernel   of  [22XFG[122X-module  homomorphisms  when  [22XFG[122X-modules  are
  represented  using  a  set of [22XG[122X-generating vectors (see [14X'HAPprime Datatypes:
  FG-module homomorphisms'[114X in the datatypes reference manual). This provides a
  further   memory   saving   over  [2XResolutionPrimePowerGroupRadical[102X  ([14X3.1-1[114X),
  although at the cost of a much slower computation time:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(128, 844);;[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroupGF(G, 9);[127X[104X
    [4X[28XResolution of length 9 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xtime;[127X[104X
    [4X[28X422742[128X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[25Xgap>[125X [27XR := ExtendResolutionPrimePowerGroupGF(R);;[127X[104X
    [4X[28XResolution of length 15 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XResolutionModuleRanks(R);[127X[104X
    [4X[28X[ 3, 6, 11, 19, 30, 44, 62, 85, 113, 146, 185, 231, 284, 344, 412 ][128X[104X
    [4X[25Xgap>[125X [27X# But it will run out of (the inital 256Mb) of memory at sixteen terms[127X[104X
  [4X[32X[104X
  
  [33X[0;0YUsing [2XResolutionPrimePowerGroupGF[102X ([14X3.1-1[114X) we can get a further four terms of
  the  resolution.  For  this resolution, this represents a memory saving of a
  factor  of  five  over  [2XResolutionPrimePowerGroupRadical[102X ([14X3.1-1[114X) and fifteen
  over [2XResolutionPrimePowerGroup[102X ([14XHAP: ResolutionPrimePowerGroup[114X), although it
  does take fifteen times as long as either of those just to compute the first
  nine terms, and scales less well with size.[133X
  
  
  [1X2.2-3 [33X[0;0YAutomatic selection of the best method[133X[101X
  
  [33X[0;0YThe    two    functions    [2XResolutionPrimePowerGroupRadical[102X    ([14X3.1-1[114X)   and
  [2XResolutionPrimePowerGroupGF[102X  ([14X3.1-1[114X)  offer  a  trade-off  between  time and
  memory.  The function [2XResolutionPrimePowerGroupAutoMem[102X ([14X3.1-1[114X) automates the
  decision  of  which  version  to  use,  switching from the [10XRadical[110X to the [10XGF[110X
  version  when  it  estimates that it is about to run out of available memory
  for  the  faster  version.  In  this  example,  we  have  also  increase the
  [2XInfoHAPprime[102X  ([14X1.6-1[114X)  info  level to display progress information. At level
  two,  the  rank  of  each  module  in  the  resolution is displayed as it is
  calculated, giving an indication of progress. With this setting, the user is
  also  notified  when  the  [10XAutoMem[110X  function  switches,  and the [10XGF[110X function
  displays a rolling estimate of its completion time (which is not shown since
  that output is overwritten when completed)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := SmallGroup(128, 844);;[127X[104X
    [4X[25Xgap>[125X [27XSetInfoLevel(InfoHAPprime, 2);[127X[104X
    [4X[25Xgap>[125X [27XR := ResolutionPrimePowerGroupAutoMem(G, 15);[127X[104X
    [4X[28X#I  Dimension 2: rank 6[128X[104X
    [4X[28X#I  Dimension 3: rank 11[128X[104X
    [4X[28X#I  Dimension 4: rank 19[128X[104X
    [4X[28X#I  Dimension 5: rank 30[128X[104X
    [4X[28X#I  Dimension 6: rank 44[128X[104X
    [4X[28X#I  Dimension 7: rank 62[128X[104X
    [4X[28X#I  Dimension 8: rank 85[128X[104X
    [4X[28X#I  Dimension 9: rank 113[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 10: rank 146[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 11: rank 185[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 12: rank 231[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 13: rank 284[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 14: rank 344[128X[104X
    [4X[28X#I  Finding kernel of homomorphism by splitting:[128X[104X
    [4X[28X#I   - Finding kernel of U[128X[104X
    [4X[28X#I   - Finding kernel of V[128X[104X
    [4X[28X#I   - Finding intersection of U and V[128X[104X
    [4X[28X#I   - Finding intersection preimages[128X[104X
    [4X[28X#I  Dimension 15: rank 412[128X[104X
    [4X[28XResolution of length 15 in characteristic 2 for <pc group of size 128 with[128X[104X
    [4X[28X7 generators> .[128X[104X
    [4X[28XNo contracting homotopy available.[128X[104X
    [4X[28XA partial contracting homotopy is available.[128X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XStringTime(time);[127X[104X
    [4X[28X" 5:45:53.613"[128X[104X
  [4X[32X[104X
  
