/* Here we consider H=PSL(2,27)<F_4(7). Let L=3^3.13 be the Borel subgroup of H. Since L is also contained
   in an exotic 3-local subgroup P=3^3.SL(3,3), and both H and P act irreducibly on M(F4), we take random
   conjugates of P by elements in the centralizer of L (in GL(26,k)) until we find one such that G=<H,P>=F4(7).
   Once we have this, we are able to prove that there is a unique H1 containing L among C_{GL(26,k)}(L)-conjugates
   and contained in G. Since |N_G(L):N_H(L)|=3, this yields exactly three subgroups H1 such that L<H1<G.
*/

// Start by setting up L, H and P.
F:=GF(7);

l1:=GL(26,F)![[0,0,0,4,2,0,1,0,0,0,4,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0],
[1,0,6,1,4,0,0,0,0,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,3,6,2,0,0,0,0,1,4,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,3,0,6,0,0,0,0,5,4,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,4,2,0,0,1,0,2,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,2,5,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,1,0,6,0,0,0,0,0,3,0,0,5,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,4,2,1,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,4,6,0,0,0,0,2,5,0,3,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,5,2,3,0,0,0,0,0,6,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,5,0,0,0,0,0,1,4,2,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,1,4,2,0,0,0,0,4,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,1,0,0,0,1,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,0,0,4,0,5,3,2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4,2,5,3],
[1,3,4,6,5,5,1,0,3,3,3,1,5,3,5,5,0,0,6,3,5,2,1,4,0,1],
[5,6,1,5,2,2,4,4,3,5,2,0,1,0,6,0,0,2,5,0,5,2,6,4,6,2],
[0,2,4,3,6,5,5,2,3,4,3,3,4,0,2,3,5,3,4,3,0,3,1,1,5,1],
[6,5,6,5,1,2,0,6,0,2,0,2,1,2,5,0,2,6,3,3,2,3,0,1,4,1],
[5,1,5,0,0,5,6,4,6,1,3,1,6,5,4,4,1,4,1,1,1,6,6,0,2,1],
[6,0,0,4,3,2,6,0,5,4,2,6,2,0,2,3,1,0,4,1,3,6,1,6,4,0],
[4,2,6,6,3,6,2,3,3,2,0,6,0,0,2,3,4,0,5,6,4,1,1,6,0,3],
[0,1,1,5,5,6,3,4,4,4,3,1,6,1,3,6,6,3,0,5,1,5,2,2,6,0],
[0,4,6,6,1,3,4,4,4,5,1,3,6,0,3,1,5,0,6,5,1,2,5,2,6,0],
[2,5,0,3,0,2,1,1,5,3,0,5,6,1,0,6,1,6,5,2,4,0,2,2,0,0],
[1,1,2,6,1,1,0,5,2,4,1,1,5,1,2,6,2,4,4,4,2,1,2,2,4,0],
[2,6,5,2,2,2,0,2,5,0,6,3,3,5,6,1,0,1,4,3,2,5,5,4,3,5],
[6,1,0,2,6,2,5,1,0,5,1,4,6,0,2,3,2,1,0,5,5,4,1,2,4,0],
[3,0,4,6,6,4,1,0,4,3,2,6,2,3,2,5,5,5,2,0,5,1,4,1,5,1],
[5,3,1,5,5,5,3,0,6,4,4,3,0,6,0,4,0,4,3,1,3,3,6,0,0,0]];

G:=sub<GL(26,F)|l1,l2,h2,p2>;
H:=sub<GL(26,F)|l1,l2,h2>;
P:=sub<GL(26,F)|l1,l2,p2>;
L:=sub<GL(26,F)|l1,l2>;

// We need the indices of the trilinear form as well.
seqs:=[[i,j,k]:i,j,k in [1..26]|i le j and j le k];

/* We next give the symmetric trilinear form that comes from F4. This was found by choosing elements of F4, and then
using the G-invariance of the form to obtain constraints on the structure constants of it. Code is included at the end
to reconstruct this, but it can take a while, so we give it here for ease of calculations.
*/

f26:=[1,0,1,6,6,1,0,0,0,1,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,5,3,0,1,3,0,5,0,2,1,6,3,6,3,3,4,2,6,4,0,2,0,0,2,
4,4,5,6,0,5,6,5,5,3,1,2,2,4,2,2,2,6,6,6,4,1,1,4,1,3,2,6,0,6,6,6,1,2,5,2,4,2,1,6,3,0,5,6,3,4,1,0,0,2,0,5,
0,4,1,2,4,2,6,6,5,0,5,1,0,6,1,3,1,5,1,4,5,0,4,4,2,0,5,4,3,5,3,1,4,2,5,4,3,6,2,5,1,4,2,0,2,5,0,5,2,5,5,0,
5,2,4,5,4,3,3,0,2,4,2,4,4,5,1,1,3,4,5,1,1,5,5,1,0,4,0,1,3,6,1,2,2,1,1,3,2,3,2,6,4,1,2,0,1,1,1,4,4,5,5,0,
0,2,1,3,4,5,0,6,0,5,3,0,0,3,1,1,6,2,3,2,2,2,5,0,3,6,1,1,5,3,2,4,6,2,0,3,3,2,5,2,2,2,4,2,5,3,5,2,5,1,1,3,
1,0,3,6,2,3,4,2,3,5,5,2,4,1,0,1,5,6,6,0,1,4,3,5,3,0,5,0,3,2,0,5,6,1,2,4,4,1,1,5,0,5,3,2,2,6,0,0,3,6,0,4,
5,5,1,2,1,4,0,6,4,2,0,1,5,6,3,6,6,4,4,3,4,3,5,1,1,4,4,0,3,2,6,3,2,4,2,3,6,5,6,5,1,0,3,0,5,0,0,1,2,5,2,0,
3,4,1,4,4,5,6,4,0,5,1,6,4,5,4,0,3,2,2,6,2,6,1,2,4,6,0,5,3,5,6,0,2,4,6,2,3,0,6,1,0,0,3,1,6,0,6,2,2,0,3,4,
5,6,3,6,0,3,0,1,3,6,1,2,5,5,2,1,5,4,1,1,1,0,2,5,3,6,0,4,1,2,1,5,2,1,0,6,4,0,2,2,0,5,0,4,3,4,0,1,5,0,5,0,
6,1,4,4,2,4,6,3,1,4,4,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,5,5,1,0,3,
5,3,6,4,2,2,2,4,4,2,3,1,4,4,6,0,0,6,0,6,2,5,3,3,4,5,5,5,2,5,4,6,2,1,5,3,4,4,2,4,2,2,1,3,5,4,3,5,4,3,0,4,
0,1,4,3,1,3,3,3,1,6,0,0,1,1,3,0,5,4,3,3,3,2,1,5,3,4,6,3,3,0,3,3,6,6,2,5,6,6,3,4,5,2,3,5,3,2,3,0,6,3,2,4,
5,6,2,5,3,3,1,3,3,6,4,6,6,2,1,5,3,6,5,3,4,0,4,4,4,6,3,1,2,6,4,1,3,4,0,1,6,1,0,6,5,4,4,5,6,2,1,1,0,5,4,0,
4,0,2,2,6,6,3,0,3,1,0,0,4,1,2,5,3,5,5,6,0,4,3,4,4,0,2,3,3,4,4,4,3,3,3,0,0,3,1,2,6,5,4,2,3,0,6,0,5,6,1,1,
0,4,2,3,0,0,6,1,2,4,4,1,5,3,3,4,5,6,2,1,3,3,5,2,1,4,0,3,4,4,3,3,0,0,5,6,2,4,3,1,6,0,6,5,3,6,3,4];


// Now set up the centralizer of L in GL(26,F), which is given by all possible matrices scal below.
// We also need this matrix ring so we can multiply elements of F4 by scal, as we have to coerce
// them into this ring first.

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

// Now we introduce some commands so allow us to proceed with the method in the paper.

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

V:=GModule(L);

function ProduceRel(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]*v1[1,j]*w1[1,k]*f26[Position(seqs,Sort([i,j,k]))]:i,j,k in [1..Dimension(V)]];
e2:=&+[u2[1,i]*v2[1,j]*w2[1,k]*f26[Position(seqs,Sort([i,j,k]))]:i,j,k in [1..Dimension(V)]];

return e1-e2;
end function;

// This function determines all subgroups that lie in G and are C_{GL(26,k)}(L)-conjugate to H. It then checks
// that H, P and G are what I say they are. And then it checks that the three H1s are not all the same.

function CheckDetermination()

// First check that there is a single possible H. This is easy.
// We see from this that a must equal b (as a,b cannot be zero), so just a scalar matrix.

ProduceRel([16,16,25],mats!h2) eq 5*b*(a+4*b)*(a-b);
ProduceRel([16,16,26],mats!h2) eq (a-b)*(a^2+3*a*b+b^2);

// We also need to check that the other indecomposable module with the same composition factors cannot lie in F4.

hh2:=GL(26,F)![[5,5,0,6,2,4,2,6,4,0,6,6,2,6,1,1,3,1,1,2,2,6,5,4,4,0],
[6,0,2,5,0,3,6,1,2,6,3,0,1,3,4,3,4,2,5,1,3,0,3,3,0,5],
[4,6,5,6,4,1,5,6,3,1,6,1,0,3,6,1,0,3,3,1,4,2,4,3,0,5],
[6,1,0,0,3,0,2,0,3,0,3,1,3,2,2,5,5,3,6,5,2,4,3,1,0,5],
[6,6,6,2,1,2,0,2,5,3,5,4,2,0,0,6,5,5,2,2,0,3,4,3,0,2],
[6,3,6,5,1,5,3,5,5,5,3,4,4,6,5,1,1,4,4,6,3,3,5,0,4,0],
[2,2,6,0,2,1,4,4,3,6,6,2,5,5,0,0,6,6,1,3,4,3,6,1,1,0],
[4,0,3,6,3,0,1,0,3,3,2,3,2,6,0,2,2,0,0,6,2,4,2,1,6,2],
[5,3,3,5,3,4,0,4,0,0,4,3,1,4,1,0,1,1,5,0,2,3,2,5,2,0],
[6,0,1,5,4,0,3,2,4,6,6,5,6,0,3,2,5,6,0,5,2,0,2,1,0,4],
[4,6,6,5,6,0,1,3,6,4,3,1,2,0,6,2,1,2,5,4,5,4,6,3,1,5],
[4,6,2,6,4,3,1,0,2,1,1,6,5,5,0,6,2,6,1,5,0,2,5,0,2,2],
[6,1,0,3,5,5,3,6,6,4,6,6,6,4,4,6,2,5,5,6,3,5,5,5,3,3],
[0,0,0,0,0,0,0,0,0,0,0,0,0,5,3,1,5,6,5,0,6,2,0,2,3,2],
[0,0,0,0,0,0,0,0,0,0,0,0,0,6,1,0,1,2,0,1,1,6,5,0,2,6],
[0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,0,6,0,0,2,5,2,0,1,6,3],
[0,0,0,0,0,0,0,0,0,0,0,0,0,4,5,4,0,1,1,0,6,1,3,5,0,1],
[0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,1,2,1,1,4,0,0,5,6,6,4],
[0,0,0,0,0,0,0,0,0,0,0,0,0,3,1,5,0,0,5,1,3,4,3,0,1,6],
[0,0,0,0,0,0,0,0,0,0,0,0,0,5,3,5,4,1,5,6,5,6,6,5,4,5],
[0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,6,3,5,5,3,6,1,5,6,5,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,5,2,0,3,4,0,1,3,5,5,1,0,2],
[0,0,0,0,0,0,0,0,0,0,0,0,0,5,2,0,4,2,4,6,3,2,1,6,0,3],
[0,0,0,0,0,0,0,0,0,0,0,0,0,4,6,3,6,0,4,3,4,4,5,0,3,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,5,2,0,0,5,4,4,4,6,1,4],
[0,0,0,0,0,0,0,0,0,0,0,0,0,6,2,5,1,4,3,5,3,1,6,1,6,4]];

ProduceRel([16,16,25],mats!hh2) eq b^3;

//This shows that we cannot embed both into F4.

// Now we check that a generator for N_G(L)/N_H(L) does not act on H, but instead permutes three subgroups H containing L.

NL:=Normalizer(P,L); repeat x:=Random(NL); until not(x in L);
NH:=sub<GL(26,F)|H,NL>; Index(NH,H) eq 3;
// We make it a subgroup of GL(26,F) because constructing it as a subgroup of G takes a long time.

// Now check that H lies in F4. First we check that H is PSL(2,27) and P is 3^3.PSL(3,3), the exotic 3-local subgroup.

Bool:=IsIsomorphic(PSL(2,27),H); Bool;
NP:=NormalSubgroups(P:OrderEqual:=27)[1]`subgroup;
IsIsomorphic(PSL(3,3),P/NP) and IsElementaryAbelian(NP);

// Now we check that the subgroup generated by H and P has a 1-dimensional trilinear form

M:=GModule(G);
Dimension(Fix(SymmetricPower(M,3))) eq 1;

// Finally, we can check directly that they generate F4(7).

Gtree:=CompositionTree(G);
CompositionTreeNonAbelianFactors(G) eq [*<"F",4,7>*];

return "";
end function;


// We now give code that can prove that the trilinear form we gave is the correct one. Choose g in F4 one of l1,
// l2, h2 and p2, and use G-invariance to obtain linear relations.

function CheckF4Form()

mat:=[];
for h in [l1,l2,h2,p2] 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(h)] do if(h[aa,i] ne 0) then for j in [1..NumberOfRows(h)] do if(h[bb,j] ne 0) then for k in [1..NumberOfRows(h)] do
      val[Position(seqs,Sort([i,j,k]))]+:=h[aa,i]*h[bb,j]*h[cc,k];
    end for; end if; end for; end if; end for;
    val[nn]-:=1; Append(~mat,val); delete val;
  end for;
end for;

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


"The function CheckF4Form() checks that the trilinear form f26 from F4 is correct";
"The function CheckDetermination() checks that the determination of the possible conjugates into F4 is correct.";