
F<z>:=CyclotomicField(7);

F8<xi>:=GF(8);
Ox:=[i:i in F8];
perg1:=[1] cat [Position(Ox,i+1)+1:i in Ox];
g1x:=PermutationMatrix(F,perg1);

pertau:=[2,1] cat [Position(Ox,Ox[i]^-1)+1:i in [2..8]];
coeffstau:=[1,1] cat [z^Log(Ox[i]):i in [2..8]];
taux:=MonomialMatrix(coeffstau,Sym(9)!pertau);

perhxi:=[1] cat [Position(Ox,i*xi^2)+1:i in Ox];
coeffshxi:=[z] cat [z^-1:i in Ox];
hxix:=MonomialMatrix(coeffshxi,Sym(9)!perhxi);


coeffstauy:=[1,1] cat [(z^4)^Log(Ox[i]):i in [2..8]];
tauy:=MonomialMatrix(coeffstauy,Sym(9)!pertau);
coeffshxiy:=[z^4] cat [z^-4:i in Ox];
hxiy:=MonomialMatrix(coeffshxiy,Sym(9)!perhxi);

coeffstauz:=[1,1] cat [(z^2)^Log(Ox[i]):i in [2..8]];
tauz:=MonomialMatrix(coeffstauz,Sym(9)!pertau);
coeffshxiz:=[z^2] cat [z^-2:i in Ox];
hxiz:=MonomialMatrix(coeffshxiz,Sym(9)!perhxi);

tauV:=DiagonalJoin([taux,tauy,tauz]);
hxiV:=DiagonalJoin([hxix,hxiy,hxiz]);
g1V:=DiagonalJoin([g1x,g1x,g1x]);


G:=sub<GL(27,F)|g1V,hxiV,tauV>;


pers:=[10,11,12,14,16,18,13,15,17,19,20,21,23,25,27,22,24,26,1,2,3,5,7,9,4,6,8];
sV:=PermutationMatrix(F,pers);
G2:=sub<GL(27,F)|g1V,hxiV,tauV,sV>;


// We show that G2 really is SL(2,8).3 first.

CompositionFactors(G2);
#Center(G2) eq 1;

// Then we have to show the claim about the element u that is diagonal along the three 7-dimensional modules.

B:=sub<G2|g1V,hxiV>;
VB:=GModule(B);

// Create the elements x_e, y_e and z_e.

xe:=VB.2+VB.4+VB.5+VB.7-VB.3-VB.6-VB.8-VB.9;
ye:=VB.(9+2)+VB.(9+4)+VB.(9+5)+VB.(9+7)-VB.(9+3)-VB.(9+6)-VB.(9+8)-VB.(9+9);
ze:=VB.(18+2)+VB.(18+4)+VB.(18+5)+VB.(18+7)-VB.(18+3)-VB.(18+6)-VB.(18+8)-VB.(18+9);

// The 7-dimensional submodules are generated by them.

V7X:=sub<VB|xe>;
V7Y:=sub<VB|ye>;
V7Z:=sub<VB|ze>;

hom1:=AHom(V7X,V7Y);
hom2:=AHom(V7Y,V7Z);

Normalize((hom1.1)(xe)) eq ye;
Normalize((hom2.1)(ye)) eq ze;
