/* In this case we let H denote a copy of PSL(3,3), L denote the subgroup 3^2.SL(2,3).2, and let G denote
   E6(13). We first give two matrices defining L. We then give a matrix h1 such that <l1,l2,h1> is PSL(3,3).
   We give a matrix j1 such that <l1,l2,j1> is PSL(3,3).2, and then a matrix k1 such that <l1,l2,k1> is
   2F4(2)'. Note that H<J<K.
   
   We then show that there is a unique copy of H in G above L, and find conjugates of J and K that contain
   our conjugate H contained in E6. Note that there are two possible overgroups H, because the 27-dimensional
   module is either 16/11 or 11/16. We give h2 as a matrix from the other class and show that this does not
   work.

   We construct L to lie in NGT via conjugation by an element x1. Our matrices h1, j1 and k1 were chosen at
   random. A posteriori, one could produce H as a subgroup of E6 and show that no other overgroup of L
   preserves the E6 trilinear form, but we prefer a less synthetic proof.
*/

F:=GF(13);

l1:=GL(27,F)![[0,0,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,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],
[9,0,0,0,0,0,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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,5,0,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,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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10,5,1,4,8,4,2,9,6,8,7,10,3,1,0,7,1,5,10,4,2],
[7,11,12,4,5,9,10,3,9,1,6,3,10,9,1,7,5,10,1,9,5,5,1,12,7,6,2],
[0,6,2,9,5,5,7,3,10,0,7,7,1,6,6,11,5,4,4,2,5,4,4,2,8,2,5],
[6,10,12,9,11,11,4,7,8,9,7,10,6,3,10,1,12,8,7,7,8,3,0,7,5,9,0],
[4,10,9,12,2,2,5,12,8,10,8,5,2,2,9,2,9,3,6,0,4,5,8,6,9,2,4],
[1,7,5,5,4,6,5,1,1,4,4,0,6,9,9,4,5,3,2,1,2,6,5,5,9,2,5],
[5,12,6,1,10,4,0,2,6,9,4,5,10,5,11,12,2,12,6,11,9,11,5,11,3,7,8],
[7,1,5,12,4,0,8,0,5,3,2,11,12,9,2,10,7,3,0,9,1,3,4,3,11,12,6],
[4,6,6,7,7,5,2,4,1,3,9,0,9,1,6,6,7,9,10,9,8,2,6,6,3,7,2],
[9,6,11,7,10,12,7,7,4,9,9,1,2,8,10,6,5,11,9,6,10,7,5,2,6,1,8],
[8,1,12,8,12,7,9,4,2,11,1,6,3,1,12,1,7,2,1,10,12,5,12,7,8,10,5],
[11,5,1,4,1,12,11,6,9,0,11,2,8,1,0,11,0,6,11,11,4,3,0,0,6,9,3],
[0,6,8,1,8,4,4,3,3,4,8,0,8,0,8,11,1,2,7,0,7,6,8,12,5,12,7],
[10,2,5,4,12,11,10,12,9,5,6,4,9,2,5,12,12,4,12,8,4,1,5,11,3,6,9],
[8,8,1,6,3,3,3,2,7,6,0,7,6,1,11,2,2,6,3,12,5,2,3,2,6,0,12],
[2,6,7,0,11,10,0,2,2,4,5,11,4,6,10,8,6,3,5,12,8,11,0,4,2,0,7],
[11,4,12,6,10,2,10,11,5,12,12,0,11,3,10,2,4,9,8,4,6,2,10,9,9,10,4],
[11,8,5,7,11,5,4,9,0,5,8,1,7,2,10,4,8,2,8,0,4,0,8,0,6,12,10],
[9,1,4,5,1,3,11,8,5,2,3,6,8,2,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,0,0,0,10,0,2,0,0,0,0,0],
[0,0,0,0,0,0,0,6,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0],
[0,11,0,0,0,0,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,0,0,0,0,0,1,0,0,0,0,0,2,0,0,0],
[0,0,0,0,0,0,0,0,11,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,2,0,0],
[0,0,0,0,0,0,0,0,0,8,0,12,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0],
[0,0,0,0,0,8,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,2],
[0,0,11,0,0,0,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,0,0,0,6,0,0,0,0,0,7,0,0,0],
[0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,8,0,0,0,0,0],
[0,0,0,0,0,6,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,9],
[0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,2,0,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,6,0,0,0,0,0,0,2,0,0,0,0,0,0,0,12,0,0,0,0],
[0,0,0,0,0,0,0,0,6,0,0,0,12,0,0,0,0,0,0,0,0,0,0,0,3,0,0],
[0,0,0,0,0,0,0,0,0,6,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,9,0],
[0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,6,7,0,0,0,0,0,0,0,0,0,0]];

// Now we construct the trilinear form.

seqs:=[[i,j,k]:i,j,k in [1..NumberOfRows(l1)]|i le j and j le k];

ents:=[29,83,90,98,105,117,119,131,136,137,161,179,190,206,223,229,276,277,291,329,335,344,374,434,449,456,468,482,488,512,514,536,
541,543,557,562,580,593,595,623,628,674,686,688,716,759,766,781,795,807,812,839,855,861,866,868,887,899,918,920,932,967,973,
988,1028,1055,1080,1088,1116,1118,1126,1142,1177,1185,1190,1203,1217,1223,1224,1241,1243,1256,1258,1287,1298,1300,1306,1316,1326,
1331,1339,1345,1355,1390,1396,1423,1439,1443,1449,1473,1480,1492,1498,1506,1514,1515,1530,1536,1551,1562,1573,1585,1595,1597,1610,
1619,1624,1631,1656,1658,1675,1679,1700,1708,1722,1724,1755,1757,1766,1774,1779,1792,1803,1831,1833,1846,1852,1861,1865,1871,1883,
1884,1908,1913,1914,1940,1948,1961,1966,1981,1994,2000,2006,2022,2025,2026,2044,2055,2067,2070,2072,2087,2106,2113,2115,2153,2166,
2180,2197,2199,2206,2219,2231,2234,2242,2250,2252,2261,2263,2295,2308,2310,2321,2325,2371,2395,2407,2411,2419,2436,2441,2443,2452,
2454,2461,2463,2475,2490,2504,2509,2515,2540,2550,2564,2586,2588,2600,2602,2610,2616,2621,2627,2649,2653,2664,2666,2683,2686,2709,
2715,2726,2728,2752,2754,2761,2762,2773,2792,2798,2808,2813,2821,2831,2853,2875,2877,2891,2899,2905,2916,2938,2942,2953,2955,2972,
2987,2999,3016,3023,3032,3034,3043,3055,3070,3084,3089,3108,3119,3147,3149,3168,3177,3181,3187,3199,3208,3216,3227,3229,3261,3276,
3287,3292,3303,3322,3328,3338,3343,3351,3388,3404,3409,3427,3441,3451,3474,3480,3492,3507,3533,3537,3550,3564,3590,3608];

vals:=[1,11,7,12,8,11,9,11,11,2,11,2,4,6,5,11,11,2,6,1,7,1,1,11,1,5,11,2,2,11,7,11,4,7,7,11,11,10,3,3,11,10,6,5,1,8,
2,6,3,8,5,2,8,5,3,11,8,6,12,12,9,2,11,1,1,8,11,10,9,1,6,8,11,12,8,12,12,8,3,3,3,8,8,11,10,6,10,6,8,5,2,6,5,10,
3,11,2,4,6,8,3,12,3,10,9,11,2,7,8,3,2,7,11,10,8,2,7,12,3,10,3,1,7,12,7,1,5,12,7,4,9,10,10,8,8,12,6,2,2,7,4,1,
10,2,11,9,2,3,7,11,4,1,6,4,12,9,10,10,2,10,10,1,10,7,12,10,12,7,10,2,3,10,11,3,10,4,10,1,10,5,3,12,5,5,5,5,10,5,
10,6,11,1,3,6,7,7,3,10,3,2,8,8,7,10,1,5,7,4,3,11,11,4,7,6,3,4,7,5,11,10,8,3,3,4,7,3,7,8,9,2,10,1,3,4,8,5,6,
2,10,3,12,9,11,1,4,3,5,4,3,8,10,3,5,10,5,12,7,3,8,1,5,2,2,7,4,5,3,10,4,11,3,11,7,6,2,4,4,8,12,10,6,5,3,6,7,
11,7,5,10,5,8,11,8,5,5];

f27:=[0:i in [1..#seqs]];
for i in [1..#ents] do f27[ents[i]]:=vals[i]; end for;

// Now for the centralizer of L in GL(27,F).

R<a,b,c>:=PolynomialRing(F,3);
mats:=MatrixRing(R,NumberOfRows(l1));
scal:=mats!DiagonalMatrix([a,a,a,b,b,b,b,b,b,b,b,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c]);

scal*mats!l1 eq mats!l1*scal and scal*mats!l2 eq mats!l2*scal;


function Matricise(v)
return Matrix(1,NumberOfColumns(v),[R!v[i]:i in [1..NumberOfColumns(v)]]);
end function;

V:=GModule(L);
g1:=mats!h1;
g2:=mats!h2;

intseqs1:=[seqs[i]:i in ents];
intseqs:=&join{{[i[1],i[2],i[3]],[i[1],i[3],i[2]],[i[2],i[1],i[3]],[i[2],i[3],i[1]],[i[3],i[1],i[2]],[i[3],i[2],i[1]]}:i in intseqs1};

function ProdRel(seq,g)

u:=V.seq[1]; v:=V.seq[2]; w:=V.seq[3];
u1:=Matricise(u)*scal; v1:=Matricise(v)*scal; w1:=Matricise(w)*scal;
u2:=Matricise(u)*g*scal; v2:=Matricise(v)*g*scal; w2:=Matricise(w)*g*scal;
e1:=&+[u1[1,i[1]]*v1[1,i[2]]*w1[1,i[3]]*f27[Position(seqs,Sort([i[1],i[2],i[3]]))]:i in intseqs];
e2:=&+[u2[1,i[1]]*v2[1,i[2]]*w2[1,i[3]]*f27[Position(seqs,Sort([i[1],i[2],i[3]]))]:i in intseqs];

return e1-e2;
end function;

function CheckRel(seq,gg)
u:=V.seq[1]; v:=V.seq[2]; w:=V.seq[3];
u2:=u^gg; v2:=v^gg; w2:=w^gg;
e1:=&+[u[i[1]]*v[i[2]]*w[i[3]]*f27[Position(seqs,Sort([i[1],i[2],i[3]]))]:i in intseqs];
e2:=&+[u2[i[1]]*v2[i[2]]*w2[i[3]]*f27[Position(seqs,Sort([i[1],i[2],i[3]]))]:i in intseqs];
return e1-e2;
end function;

function CheckDetermination()

// Case of second group element
ProdRel([1,4,15],g2) eq 6*b^2*(a+12*b);
ProdRel([1,4,4],g2) eq 6*(a+7*b)*(a+9*b)*(a+10*b);
// These are inconsistent, so this case cannot occur.

// Left with first group element
ProdRel([1,4,15],g1) eq 5*c^2*(b-12*a);
// Thus a=12*b
ProdRel([1,12,16],g1) eq 8*c^2*(c-5*a);
coeffs1:=[a,12*a,5*a];
// This solves all monomials.

sca1:=GL(27,13)!Evaluate(scal,[1,12,5]);
k11:=k1^sca1;

// We only need to check k1 because:
K1:=sub<GL(27,13)|[l1,l2,k1]>;
h1 in K1 and j1 in K1;

{CheckRel(i,k11):i in seqs} eq {0};

// This proves that the copy of PSL(3,3) we constructed is contained in PSL(3,3).2<2F4(2).

return "";
end function;


// We now give code that can prove that the trilinear form we gave is the correct one. First compute
// the space of trilinear forms for L, and then use one random element of E6 to drop the space to
// 1-dimensional. This is faster than the usual way because we have to conjugate by x1.

function CheckE6Form()

q:=13;
w:=PrimitiveElement(F);
GG:=GroupOfLieType("E6",q);
W:=VectorSpace(F,6);
rho:=StandardRepresentation(GG);
Over:=GL(27,q^3);
g1:=elt<GG|W![w,1,1,1,1,1]>;
g2:=elt<GG|W![1,w,1,1,1,1]>;
g3:=elt<GG|W![1,1,w,1,1,1]>;
g4:=elt<GG|W![1,1,1,w,1,1]>;
g5:=elt<GG|W![1,1,1,1,w,1]>;
g6:=elt<GG|W![1,1,1,1,1,w]>;
Refs:=Reflections(GG);
Mats:=[rho(i):i in [g1,g2,g3,g4,g5,g6]];
MatsE:=[rho(i):i in Refs];

NGT:=sub<Over|Mats cat MatsE>;

Over!(l1^(x1^-1)) in NGT and Over!(l2^(x1^-1)) in NGT;

mat:=[];
for h in [l1,l2] do
  for nn in [1..#seqs] do aa:=seqs[nn,1]; bb:=seqs[nn,2]; cc:=seqs[nn,3];
    val:=[F!0:i in [1..#seqs]];
    for i in [1..NumberOfRows(l1)] do if(h[aa,i] ne 0) then for j in [1..NumberOfRows(l1)] do if(h[bb,j] ne 0) then for k in [1..NumberOfRows(l1)] do if(h[cc,k] ne 0) then
      val[Position(seqs,Sort([i,j,k]))]+:=h[aa,i]*h[bb,j]*h[cc,k];
    end if; end for; end if; end for; end if; end for;
    val[nn]-:=1; Append(~mat,val); delete val;
  end for;
end for;

repeat
  repeat g:=Random(GG); until IsCoercible(GL(27,13),rho(g));
  h:=x1^-1*GL(27,13)!rho(g)*x1;
  for ni in [1..17] do nn:=Random([1..#seqs]); aa:=seqs[nn,1]; bb:=seqs[nn,2]; cc:=seqs[nn,3];
    val:=[F!0:i in [1..#seqs]];
    for i in [1..NumberOfRows(l1)] do if(h[aa,i] ne 0) then for j in [1..NumberOfRows(l1)] do if(h[bb,j] ne 0) then for k in [1..NumberOfRows(l1)] do if(h[cc,k] ne 0) then
      val[Position(seqs,Sort([i,j,k]))]+:=h[aa,i]*h[bb,j]*h[cc,k];
    end if; end for; end if; end for; end if; end for;
    val[nn]-:=1; Append(~mat,val); delete val;
  end for;
  dd:=Dimension(Nullspace(Transpose(Matrix(F,mat))));
until dd eq 1;

ftest:=Nullspace(Transpose(Matrix(F,mat))).1;
return &and[ftest[i] eq f27[i]:i in [1..#seqs]];
end function;

"The function CheckE6Form() checks that the trilinear form f27 from E6 is correct";
"The function CheckDetermination() checks that the determination of the possible conjugates into E6 is correct.";
