#####
#
# This is GAP code
# 
# The file is ~steger/donald/SU21/C2p2/C2p2-3-proj.gap
#
# See file ~steger/donald/SU21/C2p2/D.txt for the definition of the
# division algebra $\D$ and for all the notation.
#
#####

Read("/home/steger/donald/SU21/C2p2/C2p2-proj.gap");
Read("/home/steger/donald/SU21/NormElem.gap");

#####
#
# Free group
#
######

#From: "Donald Cartwright" <donaldc@maths.usyd.edu.au>
#To: "steger@uniss.it" <steger@uniss.it>
#Subject: and results for (C2,p=2,\emptyset)
#Date: Mon, 7 Apr 2008 21:36:13 +1000

FreeGp:=FreeGroup("Z","A","B");
Zf:=FreeGp.1;
Af:=FreeGp.2;
Bf:=FreeGp.3;

RelnList:=[
Zf^3,
(Bf*Zf)^3,
Af*Zf*Bf*Zf^-1*Af^-1*Zf^-1*Af^-1*Zf*Bf^-1,
Af^-1*Bf^-1*Zf^-1*Af^-1*Zf*Bf^-1*Zf*Af^-1*Bf^-1*Zf^-1,
Bf^-1*Zf*Af^-1*Bf^-1*Zf*Bf*Zf^-1*Af*Bf^-1*Zf^-1*Bf^-1,
Bf*Zf^-1*Af*Zf^-1*Bf^-1*Af*Bf^-1*Zf*Af*Zf*Bf,
Af^-2*Zf^-1*Af^-1*Zf^-1*Bf^-1*Zf*Af^-2*Bf*Zf,
(Af^-1*Zf^-1*Af^-1*Bf)^3,
Bf^-1*Zf*Bf^-1*Af*Zf^-1*Af^-2*Bf*Zf^-1*Af^-1*Bf*Zf*Af^-1,
Zf*Af^-1*Bf*Zf*Bf^-1*Zf*Af^-1*Zf*Bf^2*Af*Zf^-1*Bf,
Zf^-1*Af^-1*Zf*Af^-1*Zf^-1*Af^-1*Bf*Af*Zf^-1*Bf^-1*Af*Zf^-1*Af^-2,
Af^-1*Bf^-1*Zf^-1*Af^-1*Zf^-1*Af*Zf*Af^2*Zf*Af*Zf*Af*Zf^-1*Bf,
Af^-1*Bf*Zf^-1*Bf*Af*Bf^-1*Zf*Af^-1*Bf^-2*Zf*Af^-2*Bf*Zf^-1,
Bf^-1*Af*Bf^-1*Zf*Bf^-1*Af*Zf^-1*Bf^-1*Zf^-2*Af^-1*Bf^-2*Zf*Af^-1*Zf,
Af*Zf^-1*Bf^2*Zf^-1*Af^-2*Bf*Zf*Af^-1*Zf*Bf*Af*Zf*Bf^-1*Zf^-1,
Bf^-2*Af^2*Zf^-1*Bf^2*Af*Zf*Bf^-1*Zf^-1*Af*Bf^-1*Zf*Af^-1*Bf^-1,
Af^-1*Bf*Zf^-1*Bf*Af*Zf*Af^-1*Bf*Zf*Af^-1*Bf^-1*Zf^-1*Af^-1*Zf*Bf*Af*Zf^-1*Bf*Af^-1*Bf^-1,
Zf*Af^-1*Bf*Zf^-1*Af*Bf*Zf*Bf*Af^-1*Bf*Zf*Bf*Af*Zf*Bf^-1*Zf^-1*Af*Bf*Zf*Bf*Af^-1
];

GammaBarFP:=FreeGp/RelnList;;
ZFP:=GammaBarFP.1;
AFP:=GammaBarFP.2;
BFP:=GammaBarFP.3;

# Important subgroups of GammaBarFP

index3aFP:=Group(ZFP, AFP);
index3bFP:=Group(AFP, BFP*ZFP, ZFP*BFP);
index3cFP:=Group(AFP, ZFP*BFP^-1, ZFP^-1*BFP);
index3dFP:=Group(AFP, BFP, ZFP*AFP*ZFP^-1);

index9FP:=Group(AFP, ZFP*AFP*ZFP^-1, ZFP*BFP*ZFP^-1*BFP^-1, BFP*AFP*BFP^-1);

# Check the indexes of the subgroups

Index(GammaBarFP,index3aFP) = 3;
Index(GammaBarFP,index3bFP) = 3;
Index(GammaBarFP,index3cFP) = 3;
Index(GammaBarFP,index3dFP) = 3;

Index(GammaBarFP,index9FP) = 9;

# Check normality

IsNormal(GammaBarFP,index3aFP);
IsNormal(GammaBarFP,index3bFP);
IsNormal(GammaBarFP,index3cFP);
IsNormal(GammaBarFP,index3dFP);

IsNormal(GammaBarFP,index9FP);

# Free group versions of these subgroups
FPtoFGSubgp:=g->Group(List(GeneratorsOfGroup(g),UnderlyingElement));

index3aFG:=FPtoFGSubgp(index3aFP);
index3bFG:=FPtoFGSubgp(index3bFP);
index3cFG:=FPtoFGSubgp(index3cFP);
index3dFG:=FPtoFGSubgp(index3dFP);

index9FG:=FPtoFGSubgp(index9FP);

#####
#
# Matrix generators of $(C2,p=2,\{3\})$
#
#####

#From: "Donald Cartwright" <donaldc@maths.usyd.edu.au>
#To: "steger@uniss.it" <steger@uniss.it>
#Subject: Generators for one of the (C_2,p=2) groups?
#Date: Thu, 27 Mar 2008 09:39:47 +1100

ADM:=
[[-1/3*G*Zm^2+1/3*(-G-1)*Zm+1/6*G*Sqrt(-3)+1/6*(G+2),
(1/6*(-2*G-3)*Sqrt(-3)+1/6*(-4*G+1))*Zm^2+(1/3*(G+1)*Sqrt(-3)+1/3*(G+1))*Zm+1/6*(-2*G+1)*Sqrt(-3)+1/6*(-4*G-3),
(1/6*(-2*G-1)*Sqrt(-3)-1/6)*Zm^2+(1/6*(G+2)*Sqrt(-3)+1/2*G)*Zm+-1/6*G*Sqrt(-3)+1/6*(-3*G-2)],
[(1/6*(-G-1)*Sqrt(-3)+1/6*(-3*G-1))*Zm^2+(1/6*(-2*G-1)*Sqrt(-3)-1/2)*Zm+1/6*(-2*G-1)*Sqrt(-3)+1/6,
(1/6*G*Sqrt(-3)+1/6*G)*Zm^2+(1/6*(-G-1)*Sqrt(-3)+1/6*(G+1))*Zm+1/6*G*Sqrt(-3)+1/6*(G+2),
(1/6*(3*G+1)*Sqrt(-3)+1/6*(-G-5))*Zm^2+1/3*(-2*G-2)*Zm+1/6*(-2*G+1)*Sqrt(-3)+1/6*(-4*G-3)],
[(1/6*(3*G+2)*Sqrt(-3)+1/6*(-G+4))*Zm^2+(1/6*G*Sqrt(-3)+1/6*(5*G+2))*Zm+1/6*(-3*G-1)*Sqrt(-3)+1/6*(-G+3),
(1/6*(2*G+1)*Sqrt(-3)-1/6)*Zm^2+(1/6*(G-1)*Sqrt(-3)+1/2*(G+1))*Zm+1/6*(-2*G-1)*Sqrt(-3)+1/6,
(-1/6*G*Sqrt(-3)+1/6*G)*Zm^2+(1/6*(G+1)*Sqrt(-3)+1/6*(G+1))*Zm+1/6*G*Sqrt(-3)+1/6*(G+2)]];

BDM:=[
[(-1/6*G*Sqrt(-3)+1/6*(-G-2))*Zm+1/6*Sqrt(-3)+1/6*(-2*G-1),
(-1/6*Sqrt(-3)+1/6*(2*G+3))*Zm^2+(1/6*Sqrt(-3)+1/6*(-2*G+1))*Zm+-1/3*G*Sqrt(-3)+1/3,
(1/6*(G+1)*Sqrt(-3)+1/6*(G+3))*Zm^2+(-1/3*Sqrt(-3)-1/3)*Zm+1/6*(G+1)*Sqrt(-3)+1/6*(5*G-1)],
[2/3*G*Zm^2+(1/6*(2*G-1)*Sqrt(-3)+1/6)*Zm+1/6*(G+3)*Sqrt(-3)+1/6*(-G-1),
(-1/6*Sqrt(-3)+1/6*(2*G+1))*Zm+1/6*Sqrt(-3)+1/6*(-2*G-1),
(1/6*(-G-1)*Sqrt(-3)+1/6*(-G-3))*Zm^2+(-1/6*G*Sqrt(-3)+1/6*(G-2))*Zm+-1/3*G*Sqrt(-3)+1/3],
[-2/3*G*Zm^2+(1/6*G*Sqrt(-3)+1/6*(G-2))*Zm+1/12*(G-1)*Sqrt(-3)+1/12*(3*G+7),
(-1/3*G*Sqrt(-3)-1/3*G)*Zm^2+(1/6*(-G+1)*Sqrt(-3)+1/6*(-3*G+1))*Zm+1/6*(G+3)*Sqrt(-3)+1/6*(-G-1),
(1/6*(G+1)*Sqrt(-3)+1/6*(-G+1))*Zm+1/6*Sqrt(-3)+1/6*(-2*G-1)]];

ZDM:=[[Zm,  0,  0],
     [0,Zm^4,  0],
     [0,  0,Zm^7]];

ZDM in DM;
ADM in DM;
BDM in DM;

IsOne(iotaDM(ZDM)*ZDM);
IsOne(iotaDM(ADM)*ADM);
IsOne(iotaDM(BDM)*BDM);

GammaBarDM:=Group(ZDM,ADM,BDM);;
DMHom:=GroupHomomorphismByImages(FreeGp,GammaBarDM,
  [Zf,Af,Bf],[ZDM,ADM,BDM]);;
ForAll(RelnList,x->IsPOne(x^DMHom));

#####
#
# Construct matrices for the group generators acting on~$\D$ by
# conjugation
#
######

DMtoPDM:=mtx->TransposedMat(
  List(basisDM,bmtx->
    Coefficients(basisDM,mtx*bmtx*mtx^-1)
));

ZPDM:=DMtoPDM(ZDM);;
APDM:=DMtoPDM(ADM);;
BPDM:=DMtoPDM(BDM);;

GammaBarPDM:=Group(ZPDM,APDM,BPDM);;
FGtoPDM:=GroupHomomorphismByImages(FreeGp,GammaBarPDM,
  [Zf,Af,Bf],[ZPDM,APDM,BPDM]);;
ForAll(RelnList,x->IsOne(x^FGtoPDM));

######
#
# Find the matrices for the group generators acting by conjugation on
# the self-adjoint, traceless part of~$\D$.
#
#####

PDMtoPSA:=mtx->TransposedMat(
  List(DMSelfAdjBasis,SAVec->
    Coefficients(DMSelfAdjBasis,mtx*SAVec)
));

ZPSA0:=PDMtoPSA(ZPDM);;
APSA0:=PDMtoPSA(APDM);;
BPSA0:=PDMtoPSA(BPDM);;

#####
#
# Adjust the basis of the self-adjoint part of~$\D$ so that
# the group generators correspond to integral matrices.
#
#####

GammaBarPSA0:=Group(ZPSA0,APSA0,BPSA0);;

ILatPSA0:=InvariantLattice(GammaBarPSA0)^-1;
ZPSA:=ZPSA0^ILatPSA0;
APSA:=APSA0^ILatPSA0;
BPSA:=BPSA0^ILatPSA0;

GammaBarPSA:=Group(ZPSA,APSA,BPSA);;
FGtoPSA:=GroupHomomorphismByImages(FreeGp,GammaBarPSA,
  [Zf,Af,Bf],[ZPSA,APSA,BPSA]);;
ForAll(RelnList,x->IsOne(x^FGtoPSA));


#APSA:=[
#[67, -60,-118, 430, -29,-175,  65, 245,-191,-1090,3820,-1762,1174,1575,4020, 9410],
#[50, -70, -35, -71,   7,  49,  48,  96,  48, -236,1089, -318, 224, 722, 976, 1630],
#[12,  -3,  -6, -67, -21,  26,  54,  67,  95, -330,1270,  -93, 163, 150, 100, 1285],
#[61, -81, -65,  94,   5, -18,  41, 137, -42, -501,1978, -881, 573,1210,2304, 4510],
#[11, -22,   8,-133,  10,  65,  11,  -2,  74,   67, -83,  184,-104,  76,-296, -897],
#[78, -92,-103, 267,  -1, -94,  56, 213,-114, -869,3185,-1497, 975,1695,3645, 7810],
#[ 8, -17,  -9,  26,  11,  -5,  -8,   6, -30,   11, -34, -114,  45, 177, 347,  353],
#[-7,   8,  21,-118,  19,  41,  18,  -2, 115,    6,-132,  269,-135,-217,-802, -933],
#[25, -34, -22,   3,  -2,   9,  20,  50,   2, -178, 766, -283, 193, 466, 801, 1485],
#[-5,   5,   3,  17,  16, -14,   2,   8,  22,  -80, 118,  -55,  43,  -2, -15,  514],
#[-1,   1,   2,  -8,   1,   3,   0,  -2,   8,   -3,   8,   14,  -5,  -7, -39,  -25],
#[ 1,  -6,   4, -32,  20,  12,   0,   0,  28,   41,-224,   70, -56, -26,-211, -377],
#[15, -30,  -3, -75,   5,  44,  10,   5,  10,  140,-360,  135,-112,  60,-130,-1070],
#[ 3,  -7,   0, -18,   2,  11,  -1,  -3,   0,   46,-125,   36, -32,  17, -28, -296],
#[ 0,   0,   3, -24,   1,  10,   2,  -2,  17,   10, -21,   48, -25, -21,-112, -199],
#[-3,   5,   0,  21,   3, -12,  -2,   1,  -4,  -25,  28,  -33,  21, -17,  21,  220]];
#BPSA:=[
#[26, -30, -11, -83,  -4,  28,  64,  93, 156, -430, 1530,-201, 240, 390,  380, 2025],
#[28, -13, -44, 116,  48, -92, 123, 248, 183,-1027, 2840,-792, 638, 535,  859, 5861],
#[-5,  -1,  -3,  77, -19, -16, -62, -66,-124,  193, -425,-115,  14, 175,  630,  -70],
#[19,   1, -27,  41,  -7, -47, 101, 150,  99, -509, 1477,-254, 246,  22,   53, 2178],
#[ 3,   9, -19, 104,  12, -60,  27,  71,  -5, -270,  661,-293, 194,  83,  319, 1792],
#[34, -20, -32,  -9,   8, -28, 126, 194, 184, -714, 2160,-378, 370, 295,  295, 3295],
#[-4,  17,   2, -17, -20,  -2,  29,  13,   9,   39, -147, 189,-111,-331, -566, -977],
#[ 3,   0,   1, -35,  14,   7,  19,  25,  47,  -20,  -53,  68, -47, -53, -315, -248],
#[ 7,   0, -10,  16,  -5, -17,  37,  53,  30, -167,  486, -79,  78, -10,    4,  673],
#[-9,  17,  22,-127, -36,  57,   4, -66,  -9,  457,-1331, 632,-440,-606,-1263,-3884],
#[-2,   3,   2,  -3,  -6,   3,  -6, -15, -18,   79, -226,  65, -54, -69,  -97, -495],
#[ 4,   5,  -2, -34,  11,  -2,  49,  62,  85, -168,  369,  42,   7,-121, -431,  236],
#[ 4,   5, -11,  30,  10, -32,  60,  95,  80, -370,  975,-180, 178,  -5,  -30, 1670],
#[ 0,   3,  -3,  16,   0, -11,  11,  18,   7,  -70,  181, -42,  37, -17,    5,  336],
#[ 2,  -2,  -4,  18,   8, -10,   3,  16,   7,  -77,  201, -93,  63,  83,  148,  586],
#[-1,   1,   5, -32,  -4,  15,  -1, -14,   5,   84, -239, 117, -80, -85, -220, -697]];
#ZPSA:=[
#[ 1,   0, -15, 101,   1, -38,  -9,  14, -68,-128, 425,-294, 184, 190, 660, 1475],
#[ 0,   1,  -3,  15,   3,  -6, -13,   4,   0, -60, 233, -78,  61,  83, 162,  510],
#[ 0,   0, -23, 186, -30, -62, -52, -36,-189,  14, 180,-404, 215, 300,1265, 1490],
#[ 0,   0,   0, -11,   0,  14, -37, -41, -45, 163,-373,  68, -70,   3,  28, -716],
#[ 0,   0,   0,   0, -14,   8, -31, -38, -45, 136,-262,  50, -49,  12, 105, -566],
#[ 0,   0,   0, -15,  15,  10, -15, -15, -15,  90,-285,  60, -58, -45,-125, -505],
#[ 0,   0,   3, -26,  -7,  16, -21, -30, -17, 134,-312, 108, -83, -40,-102, -792],
#[ 0,   0,  -6,  50,  -5, -20, -11, -12, -57,  80,-266, -26, -13, -45, 134, -197],
#[ 0,   0,   3, -30,   0,  17, -12, -19,  -4,  85,-197,  82, -60, -23,-108, -549],
#[ 0,   0,   0,  -1, -11,   7, -23, -43, -63, 243,-683, 148,-139,-139,-129,-1342],
#[ 0,   0,   0,   0,  -3,   2,  -6, -10, -14,  46,-115,  22, -22, -13,   3, -224],
#[ 0,   0,   0,   0,   0,  -1,  -6,  -7,  -8,  61,-203,  53, -45, -65,-101, -405],
#[ 0,   0,   0,   0,   0,  -3,   0,  15,  30,-105, 345, -60,  64,  75,  75,  585],
#[ 0,   0,   0,   0,   0,   0,  -3,   0,   3, -12,  51, -12,  11,  22,  29,   96],
#[ 0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   1,    0],
#[ 0,   0,   0,   0,   0,   0,   0,  -3,  -6,  30,-105,  24, -22, -33, -46, -197]];

######
#
# Do calculations $\mod 2$
#
######

toMod2:=x->x*One(GF(2));
toMod2M:=mtx->fOnM(toMod2,mtx);

ZPSAMod2:=toMod2M(ZPSA);;
APSAMod2:=toMod2M(APSA);;
BPSAMod2:=toMod2M(BPSA);;

GammaBarPSAMod2:=Group(ZPSAMod2,APSAMod2,BPSAMod2);;
FGtoPSAMod2:=GroupHomomorphismByImages(FreeGp,GammaBarPSAMod2,
  [Zf,Af,Bf],[ZPSAMod2,APSAMod2,BPSAMod2]);;
ForAll(RelnList,x->IsOne(x^FGtoPSAMod2));

Read("/home/steger/donald/SU21/NormElem2.gap");

Mod2H1:=Group(NormElem2(GammaBarPSAMod2,2));
Size(Mod2H1)=64;
StructureDescription(Mod2H1)="C2 x C2 x C2 x C2 x C2 x C2";
Mod2Q1:=Group(Mod2H1LAL);
not Size(Mod2Q1)*Size(Mod2H1) = Size(GammaBarPSAMod2);

Mod2NHNS1:=NaturalHomomorphismByNormalSubgroup(GammaBarPSAMod2,Mod2H1);;
Mod2Q1:=Image(Mod2NHNS1);
Size(Mod2Q1)*Size(Mod2H1) = Size(GammaBarPSAMod2);

Mod2H2:=Group(NormElem2(Mod2QQ1,2));
Size(Mod2H2)=64;
StructureDescription(Mod2H2)="C2 x C2 x C2 x C2 x C2 x C2";
Mod2ASA2:=
  AbelianSubfactorAction(Mod2Q1,Mod2H2,Group(One(Mod2H2)));
Mod2Q2:=Image(Mod2ASA2[1]);
Size(Mod2Q2)*Size(Mod2H2) = Size(Mod2QQ1);

StructureDescription(Mod2Q2) = "C3 x (C7 : C3)";

PSAMod2Hom63:=CompositionMapping(Mod2ASA2[1],Mod2NHNS1);
PSAMod2Q63:=Range(PSAMod2Hom63);
StructureDescription(PSAMod2Q63) = "C3 x (C7 : C3)";;
	
index3aPSAMod2:=Image(FGtoPSAMod2,index3aFG);
index3bPSAMod2:=Image(FGtoPSAMod2,index3bFG);
index3cPSAMod2:=Image(FGtoPSAMod2,index3cFG);
index3dPSAMod2:=Image(FGtoPSAMod2,index3dFG);

index9PSAMod2:=Image(FGtoPSAMod2,index9FG);

Index(GammaBarPSAMod2,index3aPSAMod2) = 3;
Index(GammaBarPSAMod2,index3bPSAMod2) = 3;
Index(GammaBarPSAMod2,index3cPSAMod2) = 3;
Index(GammaBarPSAMod2,index3dPSAMod2) = 3;

Index(GammaBarPSAMod2,index9PSAMod2) = 9;

Intersection(index3aPSAMod2,index3bPSAMod2) = index9PSAMod2; 
Intersection(index3aPSAMod2,index3cPSAMod2) = index9PSAMod2; 
Intersection(index3aPSAMod2,index3dPSAMod2) = index9PSAMod2; 
Intersection(index3bPSAMod2,index3cPSAMod2) = index9PSAMod2; 
Intersection(index3bPSAMod2,index3dPSAMod2) = index9PSAMod2; 
Intersection(index3cPSAMod2,index3dPSAMod2) = index9PSAMod2; 

index3aPSAMod2Q63:=Image(PSAMod2Hom63,index3aPSAMod2);
index3bPSAMod2Q63:=Image(PSAMod2Hom63,index3bPSAMod2);
index3cPSAMod2Q63:=Image(PSAMod2Hom63,index3cPSAMod2);
index3dPSAMod2Q63:=Image(PSAMod2Hom63,index3dPSAMod2);

index9PSAMod2Q63:=Image(PSAMod2Hom63,index9PSAMod2);

Index(PSAMod2Q63,index3aPSAMod2Q63) = 3;
Index(PSAMod2Q63,index3bPSAMod2Q63) = 3;
Index(PSAMod2Q63,index3cPSAMod2Q63) = 3;
Index(PSAMod2Q63,index3dPSAMod2Q63) = 3;

Index(PSAMod2Q63,index9PSAMod2Q63) = 9;

IsSubgroup(index3aPSAMod2Q63,Center(PSAMod2Q63));
not IsSubgroup(index3bPSAMod2Q63,Center(PSAMod2Q63));
not IsSubgroup(index3cPSAMod2Q63,Center(PSAMod2Q63));
not IsSubgroup(index3dPSAMod2Q63,Center(PSAMod2Q63));

######
#
# Do calculations $\mod 3$
#
######

toMod3:=x->x*One(GF(3));
toMod3M:=mtx->fOnM(toMod3,mtx);

ZPSAMod3:=toMod3M(ZPSA);;
APSAMod3:=toMod3M(APSA);;
BPSAMod3:=toMod3M(BPSA);;

GammaBarPSAMod3:=Group(ZPSAMod3,APSAMod3,BPSAMod3);;
FGtoPSAMod3:=GroupHomomorphismByImages(FreeGp,GammaBarPSAMod3,
  [Zf,Af,Bf],[ZPSAMod3,APSAMod3,BPSAMod3]);;
ForAll(RelnList,x->IsOne(x^FGtoPSAMod3));

#Size(GammaBarPSAMod3) = 8*9*10*9^5; time; #

Mod3H1:=Group(NormElem2(GammaBarPSAMod3,3));
Size(Mod3H1)=9^3;
StructureDescription(Mod3H1) =
  "C3 x C3 x C3";
Mod3Q1:=QGroup(GammaBarPSAMod3,Mod3H1,3);

FGtoMod3Q1:=GroupHomomorphismByImages(FreeGp,Mod3Q1,
  [Zf,Af,Bf],GeneratorsOfGroup(Mod3Q1));;
ForAll(RelnList,x->IsOne(x^FGtoMod3Q1));

Mod3H2:=ChSeriesMod3Q1[3];
Mod3H2LAL:=LinearActionLayer(
  Mod3Q1,GeneratorsOfGroup(Mod3Q1),Pcgs(Mod3H2));
Mod3Q2:=Group(Mod3H2LAL);
FGtoMod3Q2:=GroupHomomorphismByImages(FreeGp,Mod3Q2,
  [Zf,Af,Bf],Mod3H2LAL);;
ForAll(RelnList,x->IsOne(x^FGtoMod3Q2));
IdSmallGroup(Mod3Q2) = IdSmallGroup(SL(2,9));

AbelianInvariants(Mod3Q1) = [];

index3aPSAMod3:=Image(FGtoPSAMod3,index3aFG);
index3bPSAMod3:=Image(FGtoPSAMod3,index3bFG);
index3cPSAMod3:=Image(FGtoPSAMod3,index3cFG);
index3dPSAMod3:=Image(FGtoPSAMod3,index3dFG);

index9PSAMod3:=Image(FGtoPSAMod3,index9FG);

index3aPSAMod3 = GammaBarPSAMod3;
index3bPSAMod3 = GammaBarPSAMod3;
index3cPSAMod3 = GammaBarPSAMod3;
index3dPSAMod3 = GammaBarPSAMod3;

index9PSAMod3 = GammaBarPSAMod3;

Intersection(index3aPSAMod3,index3bPSAMod3) = index9PSAMod3; 
Intersection(index3aPSAMod3,index3cPSAMod3) = index9PSAMod3; 
Intersection(index3aPSAMod3,index3dPSAMod3) = index9PSAMod3; 
Intersection(index3bPSAMod3,index3cPSAMod3) = index9PSAMod3; 
Intersection(index3bPSAMod3,index3dPSAMod3) = index9PSAMod3; 
Intersection(index3cPSAMod3,index3dPSAMod3) = index9PSAMod3; 

index3aMod3Q1:=Image(FGtoMod3Q1,index3aFG);
index3bMod3Q1:=Image(FGtoMod3Q1,index3bFG);
index3cMod3Q1:=Image(FGtoMod3Q1,index3cFG);
index3dMod3Q1:=Image(FGtoMod3Q1,index3dFG);
	
index9Mod3Q1:=Image(FGtoMod3Q1,index9FG);

index3aMod3Q1 = Mod3Q1;
index3bMod3Q1 = Mod3Q1;
index3cMod3Q1 = Mod3Q1;
index3dMod3Q1 = Mod3Q1;

index9Mod3Q1 = Mod3Q1;

index3aMod3Q2:=Image(FGtoMod3Q2,index3aFG);
index3bMod3Q2:=Image(FGtoMod3Q2,index3bFG);
index3cMod3Q2:=Image(FGtoMod3Q2,index3cFG);
index3dMod3Q2:=Image(FGtoMod3Q2,index3dFG);

index9Mod3Q2:=Image(FGtoMod3Q2,index9FG);

index3aMod3Q2 = Mod3Q2;
index3bMod3Q2 = Mod3Q2;
index3cMod3Q2 = Mod3Q2;
index3dMod3Q2 = Mod3Q2;

index9Mod3Q2 = Mod3Q2;

######
#
# Do calculations $\mod 5$
#
######

toMod5:=x->x*One(GF(5));
toMod5M:=mtx->fOnM(toMod5,mtx);

ZPSAMod5:=toMod5M(ZPSA);;
APSAMod5:=toMod5M(APSA);;
BPSAMod5:=toMod5M(BPSA);;

GammaBarPSAMod5:=Group(ZPSAMod5,APSAMod5,BPSAMod5);;
FGtoPSAMod5:=GroupHomomorphismByImages(FreeGp,GammaBarPSAMod5,
  [Zf,Af,Bf],[ZPSAMod5,APSAMod5,BPSAMod5]);;
ForAll(RelnList,x->IsOne(x^FGtoPSAMod5));

Mod5H1:=Group(NormElem2(GammaBarPSAMod5,5));
Size(Mod5H1)=5^8; time; #150437
StructureDescription(Mod5H1) =
  "C5 x C5 x C5 x C5 x C5 x C5 x C5 x C5";
Mod5Q1:=QGroup(GammaBarPSAMod5,Mod5H1,5);
IsomorphismGroups(PGU(3,5),Mod5Q1); time; #28630

MTXMod5H1:=GModuleByMats(GeneratorsOfGroup(Mod5Q1),GF(5));
MTX.IsAbsolutelyIrreducible(MTXMod5H1);
	
# Structure of GammaBarPSAMod5 seems to be
# 
#   1 -> C5^8 -> GammaBarPSAMod5 -> PGU(3,5) -> 1
#
# with a faithful action on C5^8.

FGtoMod5Q1:=GroupHomomorphismByImages(FreeGp,Mod5Q1,
  [Zf,Af,Bf],GeneratorsOfGroup(Mod5Q1));
ForAll(RelnList,x->IsOne(x^FGtoMod5Q1));

index3aMod5Q1:=Image(FGtoMod5Q1,index3aFG);
index3bMod5Q1:=Image(FGtoMod5Q1,index3bFG);
index3cMod5Q1:=Image(FGtoMod5Q1,index3cFG);
index3dMod5Q1:=Image(FGtoMod5Q1,index3dFG);

index9Mod5Q1:=Image(FGtoMod5Q1,index9FG);

index3aMod5Q1 = Mod5Q1;
index3bMod5Q1 = Mod5Q1;
index3cMod5Q1 = Mod5Q1;
Index(Mod5Q1,index3dMod5Q1) = 3;

index9Mod5Q1 = index3dMod5Q1;

#####
#
# Consider abelianizations
#
#####

# (C2,p=2,\{3\})
AbelianInvariants(GammaBarFP) = [3,3];
AbelianInvariants(GammaBarPSAMod2) = [3,3];
AbelianInvariants(Mod3Q1) = [];
AbelianInvariants(Mod5Q1) = [3];

# (C2,p=2,\{3\},D_3)
AbelianInvariants(index3aFP) = [3,7];
AbelianInvariants(index3aPSAMod2) = [3,7];
AbelianInvariants(index3aMod3Q1) = [];
AbelianInvariants(index3aMod5Q1) = [3];

# (C2,p=2,\{3\},(d^2D)_3)
AbelianInvariants(index3bFP) = [3];
AbelianInvariants(index3bPSAMod2) = [3];
AbelianInvariants(index3bMod3Q1) = [];
AbelianInvariants(index3bMod5Q1) = [3];

# (C2,p=2,\{3\},(dD)_3)
AbelianInvariants(index3cFP) = [3];
AbelianInvariants(index3cPSAMod2) = [3];
AbelianInvariants(index3cMod3Q1) = [];
AbelianInvariants(index3cMod5Q1) = [3];

# (C2,p=2,\{3\},d_3)
AbelianInvariants(index3dFP) = [3];
AbelianInvariants(index3dPSAMod2) = [3];
AbelianInvariants(index3dMod3Q1) = [];
AbelianInvariants(index3dMod5Q1) = [];

# (C2,p=2,\{3\},d_3 D_3)
AbelianInvariants(index9FP) = [7];
AbelianInvariants(index9PSAMod2) = [7];
AbelianInvariants(index9Mod3Q1) = [];
AbelianInvariants(index9Mod5Q1) = [];
