/* In this case we let H denote a copy of PSL(2,13), L denote the subgroup 13.6, and let G denote E6(2^12).
   We give matrices defining L, an element of order 13 and an element of order 6. We construct L to lie in
   normalizer of a torus NGT, as constructed using the GroupOfLieType command. We give H as L and a matrix
   h1, 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.

   We also give a matrix l3, which turns L into a 13.12, but does not normalize our subgroup H of G. This
   means that there are exactly two copies of H containing L.

   We also give a matrix j1 that, together with L, yields a copy of G2(3). We check that the conjugate h11
   of h1 that lies in E6 lies in <l1,l2,j1>, and then that j1 lies in E6.
*/

q:=2^12;
F<zz>:=GF(q);
z:=zz^315;

l1:=GL(27,F)![[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,1,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,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,1,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,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,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,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,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,1,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0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0,0,0,0,0,0,0,0,0,0,0,0,0,1,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,0,0,0,0,0,1,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,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,1,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,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0]];

L:=sub<GL(27,F)|l1,l2>;

h1:=GL(27,F)![[zz^2015,zz^1014,0,zz^1871,0,0,0,0,zz^599,zz^3055,0,0,zz^1534,zz^559,zz^754,zz^4030,zz^3835,zz^2574,0,0,0,zz^3575,zz^3965,zz^624,0,zz^2413,0],
[zz^26,zz^3835,0,zz^1377,0,0,0,0,zz^105,zz^3861,0,0,zz^3575,zz^2015,zz^3965,zz^546,zz^3666,zz^3055,0,0,0,zz^3731,zz^1586,zz^4030,0,zz^1919,0],
[0,0,zz^845,zz^1053,zz^3591,zz^3786,zz^2681,zz^2291,zz^1053,0,zz^2665,zz^2470,0,0,0,0,0,0,zz^1690,zz^1235,zz^3380,0,0,0,zz^146,zz^1053,zz^471],
[zz^2628,zz^3122,0,zz^2418,zz^3838,zz^3838,zz^3838,zz^3838,zz^1743,zz^3170,0,0,zz^1850,zz^3122,zz^3664,zz^1356,zz^2628,zz^3664,0,0,0,zz^1356,zz^3170,zz^1850,zz^3838,zz^2605,zz^3838],
[0,0,0,0,zz^2665,zz^2470,zz^845,zz^1235,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^3380,0,zz^1690],
[0,0,0,0,zz^2470,zz^1690,zz^3380,zz^845,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^1235,0,zz^2665],
[0,0,0,0,zz^845,zz^3380,zz^2665,zz^1690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^2470,0,zz^1235],
[0,0,0,0,zz^1235,zz^845,zz^1690,zz^2470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^2665,0,zz^3380],
[zz^1356,zz^1850,0,zz^1743,zz^3838,zz^3838,zz^3838,zz^3838,zz^2605,zz^2628,0,0,zz^3664,zz^1850,zz^3122,zz^3170,zz^1356,zz^3122,0,0,0,zz^3170,zz^2628,zz^3664,zz^3838,zz^2418,zz^3838],
[zz^3055,zz^754,0,zz^2413,0,0,0,0,zz^1871,zz^3575,0,0,zz^1014,zz^2574,zz^624,zz^2015,zz^3965,zz^1534,0,0,0,zz^3835,zz^4030,zz^559,0,zz^599,0],
[0,0,zz^2665,zz^1053,zz^2681,zz^146,zz^3591,zz^471,zz^1053,0,zz^845,zz^3380,0,0,0,0,0,0,zz^1235,zz^1690,zz^2470,0,0,0,zz^3786,zz^1053,zz^2291],
[0,0,zz^2470,zz^1053,zz^146,zz^2291,zz^3786,zz^3591,zz^1053,0,zz^3380,zz^1235,0,0,0,0,0,0,zz^845,zz^2665,zz^1690,0,0,0,zz^471,zz^1053,zz^2681],
[zz^546,zz^3575,0,zz^105,0,0,0,0,zz^1919,zz^26,0,0,zz^3055,zz^4030,zz^3835,zz^1586,zz^3731,zz^2015,0,0,0,zz^3861,zz^3666,zz^3965,0,zz^1377,0],
[zz^3666,zz^2015,0,zz^1377,0,0,0,0,zz^105,zz^1586,0,0,zz^4030,zz^3835,zz^3055,zz^3731,zz^26,zz^3965,0,0,0,zz^546,zz^3861,zz^3575,0,zz^1919,0],
[zz^3861,zz^3965,0,zz^1919,0,0,0,0,zz^1377,zz^3731,0,0,zz^3835,zz^3055,zz^4030,zz^26,zz^1586,zz^3575,0,0,0,zz^3666,zz^546,zz^2015,0,zz^105,0],
[zz^4030,zz^1534,0,zz^599,0,0,0,0,zz^2413,zz^2015,0,0,zz^2574,zz^624,zz^1014,zz^3965,zz^3575,zz^559,0,0,0,zz^3055,zz^3835,zz^754,0,zz^1871,0],
[zz^3835,zz^559,0,zz^1871,0,0,0,0,zz^599,zz^3965,0,0,zz^624,zz^1014,zz^2574,zz^3575,zz^2015,zz^754,0,0,0,zz^4030,zz^3055,zz^1534,0,zz^2413,0],
[zz^1586,zz^3055,0,zz^1919,0,0,0,0,zz^1377,zz^546,0,0,zz^2015,zz^3965,zz^3575,zz^3666,zz^3861,zz^4030,0,0,0,zz^26,zz^3731,zz^3835,0,zz^105,0],
[0,0,zz^1690,zz^1053,zz^2291,zz^2681,zz^471,zz^3786,zz^1053,0,zz^1235,zz^845,0,0,0,0,0,0,zz^3380,zz^2470,zz^2665,0,0,0,zz^3591,zz^1053,zz^146],
[0,0,zz^1235,zz^1053,zz^471,zz^3591,zz^2291,zz^146,zz^1053,0,zz^1690,zz^2665,0,0,0,0,0,0,zz^2470,zz^3380,zz^845,0,0,0,zz^2681,zz^1053,zz^3786],
[0,0,zz^3380,zz^1053,zz^3786,zz^471,zz^146,zz^2681,zz^1053,0,zz^2470,zz^1690,0,0,0,0,0,0,zz^2665,zz^845,zz^1235,0,0,0,zz^2291,zz^1053,zz^3591],
[zz^3575,zz^624,0,zz^599,0,0,0,0,zz^2413,zz^3835,0,0,zz^754,zz^1534,zz^559,zz^3055,zz^4030,zz^1014,0,0,0,zz^3965,zz^2015,zz^2574,0,zz^1871,0],
[zz^3965,zz^2574,0,zz^2413,0,0,0,0,zz^1871,zz^4030,0,0,zz^559,zz^754,zz^1534,zz^3835,zz^3055,zz^624,0,0,0,zz^2015,zz^3575,zz^1014,0,zz^599,0],
[zz^3731,zz^4030,0,zz^105,0,0,0,0,zz^1919,zz^3666,0,0,zz^3965,zz^3575,zz^2015,zz^3861,zz^546,zz^3835,0,0,0,zz^1586,zz^26,zz^3055,0,zz^1377,0],
[0,0,0,0,zz^3380,zz^1235,zz^2470,zz^2665,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^1690,0,zz^845],
[zz^3170,zz^3664,0,zz^2605,zz^3838,zz^3838,zz^3838,zz^3838,zz^2418,zz^1356,0,0,zz^3122,zz^3664,zz^1850,zz^2628,zz^3170,zz^1850,0,0,0,zz^2628,zz^1356,zz^3122,zz^3838,zz^1743,zz^3838],
[0,0,0,0,zz^1690,zz^2665,zz^1235,zz^3380,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,zz^845,0,zz^2470]];

j1:=GL(27,F)![[zz^325,zz^3949,zz^1621,zz^2219,zz^452,zz^338,zz^1634,zz^923,zz^3962,zz^1521,0,zz^936,zz^936,0,0,zz^351,0,zz^1621,0,zz^3949,zz^1150,zz^3478,zz^2917,zz^1150,0,zz^1404,0],
[zz^1476,zz^845,zz^1039,zz^2873,zz^2746,zz^2807,zz^1052,zz^3783,zz^2028,zz^2794,zz^3302,zz^1871,zz^1232,zz^3626,zz^4017,zz^2456,zz^113,zz^3899,zz^3626,zz^1430,zz^1425,zz^1784,zz^2335,zz^568,zz^1404,0,0],
[zz^3974,zz^976,zz^3770,zz^2028,zz^1574,zz^3198,zz^2731,zz^2744,zz^1313,zz^1808,zz^3563,zz^3033,zz^2393,zz^1352,zz^3563,zz^3754,zz^2441,zz^1885,zz^507,zz^3836,zz^2272,zz^505,zz^3141,zz^1605,0,0,zz^1404],
[zz^3861,zz^2393,zz^3754,zz^2210,zz^1116,zz^3611,zz^1809,zz^3592,zz^1495,zz^1989,zz^2746,zz^3539,zz^3539,zz^1637,zz^2746,zz^3159,zz^1404,zz^3754,zz^1637,zz^2393,zz^1271,zz^1521,zz^351,zz^1271,zz^1784,zz^1430,zz^568],
[0,zz^1232,zz^2456,zz^3574,zz^2145,zz^3655,zz^1753,zz^345,zz^1429,0,zz^1647,zz^2807,zz^2807,zz^1052,zz^1647,0,0,zz^2456,zz^1052,zz^1232,zz^3626,0,0,zz^3626,zz^1425,zz^3899,zz^2335],
[0,zz^686,zz^3332,zz^2389,zz^505,zz^1560,zz^1425,zz^2325,zz^959,0,zz^452,zz^1782,zz^1782,zz^3962,zz^452,0,0,zz^3332,zz^3962,zz^686,zz^2441,0,0,zz^2441,zz^3478,zz^3949,zz^1150],
[0,zz^1808,zz^3033,zz^3511,zz^1627,zz^1110,zz^2145,zz^2020,zz^1366,0,zz^1574,zz^2744,zz^2744,zz^1043,zz^1574,0,0,zz^3033,zz^1043,zz^1808,zz^3563,0,0,zz^3563,zz^505,zz^3836,zz^1605],
[0,zz^2493,zz^3038,zz^3311,zz^1605,zz^1380,zz^2335,zz^390,zz^2011,0,zz^2219,zz^833,zz^833,zz^1634,zz^2219,0,0,zz^3038,zz^1634,zz^2493,zz^113,0,0,zz^113,zz^1150,zz^1621,zz^2917],
[zz^3861,zz^2794,zz^1871,zz^1625,zz^3041,zz^2083,zz^2159,zz^369,zz^650,zz^1989,zz^989,zz^1382,zz^1382,zz^2731,zz^989,zz^3159,zz^1404,zz^1871,zz^2731,zz^2794,zz^2453,zz^1521,zz^351,zz^2453,zz^2272,zz^1885,zz^3141],
[zz^3159,zz^234,0,zz^3038,zz^3302,zz^2456,0,zz^2132,zz^351,zz^1105,zz^2011,zz^1429,zz^1429,zz^2335,zz^2011,zz^1753,zz^2917,0,zz^2335,zz^234,0,zz^1404,0,0,zz^113,zz^3626,0],
[zz^614,zz^533,zz^2807,zz^2847,zz^2794,0,zz^2456,zz^3861,zz^2132,zz^369,zz^3770,zz^2083,zz^345,zz^1039,zz^1885,zz^3655,zz^446,zz^2807,zz^3899,zz^3783,zz^1647,zz^2746,zz^1052,zz^1637,zz^4017,0,zz^3626],
[zz^2986,zz^1622,zz^3198,zz^1352,zz^686,zz^3754,zz^351,zz^2847,0,zz^3041,zz^959,zz^2990,zz^1495,zz^1425,zz^244,zz^1809,zz^1150,zz^338,zz^568,zz^1782,zz^3962,zz^452,zz^1634,zz^3962,zz^2441,zz^507,0],
[zz^2986,zz^3783,zz^3389,0,zz^1521,zz^2847,zz^3038,zz^2794,zz^3302,zz^3041,zz^1605,zz^1625,zz^3380,zz^3311,zz^2272,zz^1809,zz^1150,zz^833,zz^61,zz^923,zz^2219,zz^452,zz^1634,zz^2219,0,zz^4017,zz^113],
[zz^3137,zz^2744,zz^2483,zz^3692,zz^1808,zz^3861,zz^3754,0,zz^2847,zz^2020,zz^976,zz^1110,zz^3592,zz^845,zz^3836,zz^3611,zz^279,zz^3198,zz^1430,zz^2744,zz^989,zz^1574,zz^2731,zz^1043,zz^3563,0,zz^507],
[zz^614,zz^308,zz^2954,zz^507,zz^4017,zz^263,0,zz^3773,0,zz^369,zz^2405,zz^3331,zz^4046,zz^142,zz^1235,zz^3655,zz^446,zz^2954,zz^1380,zz^3539,zz^2873,zz^2746,zz^1052,zz^2028,zz^2734,zz^1742,zz^351],
[zz^1989,0,zz^3744,zz^1521,0,zz^3692,zz^1352,zz^1808,zz^686,zz^1627,zz^505,zz^3511,zz^3511,zz^2389,zz^505,zz^1300,zz^3478,zz^3744,zz^2389,0,0,0,zz^1404,0,0,zz^3563,zz^2441],
[0,0,0,zz^2786,zz^2201,0,zz^263,0,zz^3773,zz^2413,zz^1369,zz^3985,zz^3985,zz^2941,zz^1369,zz^1462,zz^325,0,zz^2941,0,zz^2574,zz^1989,zz^3159,zz^2574,zz^1157,zz^3861,zz^1742],
[zz^3974,zz^898,zz^2405,zz^3783,0,zz^2986,zz^3198,zz^1989,0,zz^1808,zz^686,zz^3692,zz^2847,zz^3332,zz^686,zz^3754,zz^2441,zz^1235,zz^1271,zz^2325,zz^244,zz^505,zz^3141,zz^959,zz^452,zz^923,zz^3962],
[zz^3137,zz^1967,zz^3942,0,0,zz^2786,zz^507,zz^2201,zz^4017,zz^2020,zz^898,zz^3059,zz^3904,zz^3445,zz^2325,zz^3611,zz^279,zz^1382,zz^2795,zz^1967,zz^2028,zz^1574,zz^2731,zz^1313,zz^1521,zz^1157,zz^2734],
[zz^1476,zz^3445,zz^142,0,zz^3783,zz^3159,0,zz^2986,zz^3198,zz^2794,zz^2493,zz^2847,zz^2132,zz^3038,zz^2453,zz^2456,zz^113,zz^1380,zz^3038,zz^2795,zz^3311,zz^1784,zz^2335,zz^61,zz^2219,zz^338,zz^1634],
[zz^3985,zz^1110,zz^4046,zz^533,zz^1989,zz^614,zz^2954,0,0,zz^2201,zz^4017,zz^3773,zz^3773,zz^1433,zz^1157,zz^263,zz^2734,zz^3331,zz^3483,zz^3592,zz^2990,zz^1116,zz^2159,zz^1495,zz^2746,zz^3783,zz^2028],
[zz^1462,zz^1381,zz^3655,zz^3159,zz^533,0,0,zz^614,zz^2954,zz^3861,zz^2106,0,0,0,zz^2106,0,zz^351,zz^3655,0,zz^1381,zz^3574,zz^1300,zz^1753,zz^3574,zz^2873,zz^2807,zz^1052],
[zz^2413,zz^2020,zz^1759,zz^1967,0,zz^3137,zz^2483,0,zz^1989,0,0,0,0,zz^2691,0,zz^3861,zz^1521,zz^1759,zz^2691,zz^2020,zz^1366,zz^1627,zz^1105,zz^1366,zz^1574,zz^2744,zz^1313],
[zz^3985,zz^3059,zz^345,0,zz^1967,0,zz^3159,zz^3137,zz^2483,zz^2201,zz^3956,zz^2786,zz^2786,zz^507,zz^77,zz^263,zz^2734,zz^2083,zz^1742,zz^3904,zz^1625,zz^1116,zz^2159,zz^3380,zz^2028,zz^3198,zz^2731],
[0,zz^3773,zz^263,zz^1381,zz^1110,zz^1462,zz^3655,zz^3985,zz^4046,0,zz^308,zz^614,zz^614,zz^2954,zz^308,0,0,zz^263,zz^2954,zz^3773,zz^3483,0,0,zz^3483,zz^1560,zz^2941,zz^1380],
[zz^3861,zz^3956,zz^1433,zz^3445,zz^898,zz^1476,zz^142,zz^3974,zz^2405,zz^1989,zz^1622,zz^2986,zz^2986,zz^3389,zz^1622,zz^3159,zz^1404,zz^1433,zz^3389,zz^3956,zz^2734,zz^1521,zz^351,zz^2734,zz^279,zz^2600,zz^446],
[0,zz^2201,zz^2786,zz^3059,zz^2020,zz^3985,zz^345,zz^2413,zz^1759,0,zz^1967,zz^3137,zz^3137,zz^3942,zz^1967,0,0,zz^2786,zz^3942,zz^2201,zz^77,0,0,zz^77,zz^2325,zz^1369,zz^390]];

J:=sub<GL(27,F)|l1,l2,j1>;

// Here is the centralizer in GL(27,F) for L, even as a subgroup of NGT. This makes computation incredibly easy.

R<a,b,c,m1,m2,m3,m4,n1,n2,n3,n4>:=PolynomialRing(F,11);
mats:=MatrixRing(R,27);
scal:=mats!DiagonalMatrix([a:i in [1..27]]);
scal[4,9]:=b; scal[4,26]:=c; scal[9,4]:=c; scal[9,26]:=b; scal[26,4]:=b; scal[26,9]:=c;
a1:=[1,10,22,17,23,16];
a2:=[27,7,6,8,5,25];
a3:=[2,15,24,14,18,13];
a4:=[20,11,21,19,3,12];
for i in [1..#a1] do scal[a1[i],a1[i]]:=m1; scal[a1[i],a2[i]]:=m2; scal[a2[i],a1[i]]:=m3; scal[a2[i],a2[i]]:=m4; end for;
for i in [1..#a3] do scal[a3[i],a3[i]]:=n1; scal[a3[i],a4[i]]:=n2; scal[a4[i],a3[i]]:=n3; scal[a4[i],a4[i]]:=n4; end for;

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

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

ents:=[300,322,340,354,359,609,637,661,681,697,901,917,947,1004,1020,1164,1182,1246,1283,1311,1399,1419,1521,1558,1577,1710,1744,1787,
1821,1922,1958,1989,2029,2184,2227,2260,2357,2388,2427,2586,2609,2710,2749,2859,2991];

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

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

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};

V:=GModule(L);

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;

g:=mats!h1;
function ProdRel(seq)
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;

coeffs0:=[a,b,c,m1,m2,m3,m4,n1,n2,n3,n4];

function ChangeCoefficient(coeffs,coeff,target)
coeffs2:=coeffs;
nn:=Position(coeffs0,coeff);
coeffs2[nn]:=target;
return [Evaluate(i,coeffs2):i in coeffs];
end function;

function ChangeCoefficients(coeffs,coeff,target)
coeffs2:=coeffs;
for i in [1..#coeff] do
  nn:=Position(coeffs0,coeff[i]);
  coeffs2[nn]:=target[i];
end for;
return [Evaluate(i,coeffs2):i in coeffs];
end function;

function CheckDetermination()

f1:=ProdRel([5,6,7]); //This is m3^3+m4^3
ProdRel([3,5,27])-zz^796*f1 eq m3*m4*n4;
ProdRel([1,7,12]) eq n4*(m1*m4+m2*m3+zz^494*m3*n1+zz^494*m4*n1)+zz^494*n2*n3*(m3+m4);

// Since m3^3+m4^3=0, if one of m3 and m4 is zero then the other is. But if both are then the determinant of scal is zero.
// Thus n4=0. Notice that this means that n2 and n3 cannot be zero, since otherwise det(scal)=0. Thus the third equation
// means that m3+m4=0.

c1:=ChangeCoefficients(coeffs0,[n4,m4],[0,m3]);

Evaluate(ProdRel([1,4,8]),c1) eq zz^1550*m3^2*(a+zz^2568*b+zz^1809*c);
c2:=ChangeCoefficient(c1,c,(a+zz^2568*b)/zz^1809);

Evaluate(ProdRel([5,6,9]),c2) eq m3^2*(a+b+zz^772*n2);
Evaluate(ProdRel([4,5,8]),c2) eq m3^2*(a+b+zz^278*m1+zz^278*m2);
c3:=ChangeCoefficients(c2,[m2,n2],[(a+b)/zz^278+m1,(a+b)/zz^772]);

Evaluate(ProdRel([3,11,12]),c3) eq zz^1812*n3^2*(a+zz^1527*b+zz^2283*n3);
c4:=ChangeCoefficient(c3,n3,(a+zz^1527*b)/zz^2283);

Evaluate(ProdRel([1,2,6]),c4) eq zz^3045*m3*(a+b)*(a+b+zz^772*n1);
Evaluate(Determinant(scal),c4) eq zz^1437*m3^6*(a+b)^14*(a+zz^1527*b)^7;
// Since this determinant cannot be zero, we see that a+b+zz^772*n1=0.
c5:=ChangeCoefficient(c4,n1,(a+b)/zz^772);

Evaluate(ProdRel([1,17,26]),c5) eq m1^2*(a+b);
c6:=ChangeCoefficient(c5,m1,0);

Evaluate(ProdRel([1,3,6]),c6) eq zz^1534*m3*(a+b)*(a+zz^1527*b+zz^3079*m3);
c7:=ChangeCoefficient(c6,m3,(a+zz^1527*b)/zz^3079);

// This kills all coefficients. Now quotient out by the centralizer of H in GL(27,k).
c8:=ChangeCoefficients(c7,[a,b],[1,0]);

sca:=GL(27,F)!Evaluate(scal,c8);
h11:=h1^sca;
h12:=h11^l3;
H1:=sub<GL(27,F)|l1,l2,h11>;
not(h12 in H1);

h11 in J;

{CheckRel(i,j1):i in seqs} eq {0};
return "";
end function;


// We now give code that can prove that the trilinear form we gave is the correct one. Choose two random elements that
// generate the subgroup NGT, and then build the trilinear form relations. We also check that l1 and l2 lie in
// NGT.

function CheckE6Form()

GG:=GroupOfLieType("E6",q);
W:=VectorSpace(F,6);
rho:=StandardRepresentation(GG);
Over:=GL(27,q);
g1:=elt<GG|W![z,1,1,1,1,1]>;
g2:=elt<GG|W![1,z,1,1,1,1]>;
g3:=elt<GG|W![1,1,z,1,1,1]>;
g4:=elt<GG|W![1,1,1,z,1,1]>;
g5:=elt<GG|W![1,1,1,1,z,1]>;
g6:=elt<GG|W![1,1,1,1,1,z]>;
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>;
T:=sub<NGT|Mats>;
E:=sub<NGT|MatsE>;

l1 in NGT and l2 in NGT and l3 in NGT;

// Check that C_G(x)=T in the paper
Order(Centralizer(E,l2)) eq 1;

repeat y1:=Random(NGT); y2:=Random(NGT); until NGT eq sub<NGT|y1,y2>;

mat:=[];
for h in [y1,y2] 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;

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.";
