// The short version. For more galois group tests see 
// galois_groups_and_subfields directory
SetEchoInput(true);
F<t> := FunctionField(GF(5));
P<x> := PolynomialRing(F);
G, r, S := GaloisGroup(x^2 + t + 1);
a, b := TransitiveGroupIdentification(G);
assert a eq 1 and b eq 2;
//assert GaloisProof(x^2 + t + 1, S);
FF, R, G := GaloisSplittingField(x^2 + t + 1);
assert &and[Evaluate(x^2 + t + 1, r) eq 0 : r in R];
assert #G eq AbsoluteDegree(FF);
assert &and[Degree(f[1]) eq 1 : f in Factorization(x^2 + t + 1, FF)];
G, r, S := GaloisGroup(x^4 - t + 1);
a, b := TransitiveGroupIdentification(G);
assert a eq 1 and b eq 4;
//assert GaloisProof(x^4 - t + 1, S);
F<t> := FunctionField(GF(7));
P<x> := PolynomialRing(F);
G, r, S := GaloisGroup(x^8 + F.1+1);
a, b := TransitiveGroupIdentification(G);
//assert GaloisProof(x^8 + F.1+1, S);
assert a eq 6 and b eq 8;
F<t> := FunctionField(GF(2));
P<x> := PolynomialRing(F);
a, b := TransitiveGroupIdentification(GaloisGroup(x^3 + (t^2 + t + 1)*x^2 + (t^5
+ t)*x + t^7 + t^5 + t^4 + t^3 + t^2 + 1));
assert a eq 2 and b eq 3;
k:=GF(2);
K<t>:=RationalFunctionField(k);
r<x>:=PolynomialRing(K);
a, b := TransitiveGroupIdentification(GaloisGroup(x^8+x^4+x-t));
assert a eq 25 and b eq 8;
k := GF(5);
kt<t> := FunctionField(k);
p := Places(kt, 1) cat Places(kt, 2);
D := 2*Random(p) + 2*Random(p);
R, mR := RayClassGroup(D);
U := 5*R; repeat U := sub<R|Random(R), U>; until #quo<R|U> eq 5;
A := AbelianExtension(D, U);
DA := DiscriminantDivisor(A);
F := FunctionField(A);
F := FunctionField(Polynomial(kt, DefiningPolynomials(F)[1]));
G := GaloisGroup(F);
a, b := TransitiveGroupIdentification(G);
assert a eq 1 and b eq 5;
a := PermutationGroup(quo<RayClassGroup(A`D)| A`U>);
assert IsIsomorphic(a, G);
k := GF(433);
K<t> := FunctionField(k);
P<y> := PolynomialRing(K);
f := y^9 + (406*t^6 + 406*t^3 + 406)*y^7 + (379*t^9 + 54*t^7 + 379*t^6 + 54*t^4 
+
379*t^3 + 54*t)*y^6 + (53*t^10 + 243*t^9 + 190*t^8 + 53*t^7 + 53*t^6 +
190*t^5 + 53*t^4 + 53*t^3 + 190*t^2 + 243)*y^5 + (106*t^13 + 53*t^12 +
84*t^11 + 296*t^10 + 159*t^9 + 274*t^8 + 159*t^6 + 274*t^5 + 327*t^4 +
106*t^3 + 190*t^2 + 137*t)*y^4 + (358*t^14 + 358*t^13 + 374*t^12 +
411*t^11
+ 398*t^10 + 377*t^9 + 296*t^8 + 208*t^7 + 371*t^5 + 283*t^4 + 59*t^3 +
318*t^2 + 243*t + 56)*y^3 + (389*t^17 + 389*t^16 + 66*t^15 + 22*t^14 +
279*t^13 + 411*t^12 + 132*t^11 + 345*t^10 + 367*t^9 + 176*t^8 + 411*t^7 +
301*t^6 + 110*t^5 + 88*t^4 + 389*t^3 + 22*t)*y^2 + (44*t^18 + 132*t^17 +
318*t^16 + 5*t^15 + 198*t^14 + 149*t^13 + 350*t^12 + 66*t^11 + 259*t^10 +
328*t^9 + 301*t^8 + 78*t^7 + 230*t^6 + 235*t^5 + 247*t^4 + 318*t^3 +
367*t^2
+ 137*t + 296)*y + 88*t^19 + 44*t^18 + 142*t^17 + 17*t^16 + 8*t^15 +
377*t^14 + 428*t^13 + 365*t^12 + 289*t^11 + 208*t^10 + 228*t^9 + 328*t^8 +
416*t^7 + 21*t^6 + 93*t^5 + 5*t^4 + 97*t^3 + 181*t^2 + 137*t + 190
;
a, b := TransitiveGroupIdentification(GaloisGroup(f));
assert a eq 1 and b eq 9;
Cputime();

F<t> := FunctionField(GF(5));
P<x> := PolynomialRing(F); 
FF<a> := FunctionField(x^2 + t - 1);
P<x> := PolynomialRing(FF); 
s, t := TransitiveGroupIdentification(GaloisGroup(x^2 + a + 1));
assert s eq 1 and t eq 2;
s, t := TransitiveGroupIdentification(GaloisGroup(x^4 + ((2*t^2 + 1)*a + (t^2 + 
4))*x^3 + ((4*t^5 + t^4 + 3*t^2 + t + 3)*a +
(2*t^4 + t + 2))*x^2 + ((t^8 + 2*t^7 + t^6 + 4*t^5 + 3*t^4 + 3*t^3 + 3*t^2 +
3*t + 1)*a + (4*t^8 + 2*t^7 + 3*t^6 + 2*t^5 + 3*t^4 + 3*t^3 + 4*t^2 + t +
3))*x + (4*t^11 + t^9 + 4*t^8 + 4*t^7 + 4*t^6 + 2*t^5 + t^4 + 2*t^2 + 4)*a +
4*t^11 + t^10 + 4*t^9 + 3*t^8 + 2*t^7 + 2*t^5 + 3*t^4 + 2*t + 4)
);
assert s eq 5 and t eq 4;
s, t := TransitiveGroupIdentification(GaloisGroup(x^4 - a + 1));
assert s eq 1 and t eq 4;
F<t> := FunctionField(GF(2));
P<x> := PolynomialRing(F);
FF<a> := FunctionField(x^3 + t);
P<x> := PolynomialRing(FF);
s, t := TransitiveGroupIdentification(GaloisGroup(x^3 + (t^2 + t + 1)*x^2 + (t^5
+ t)*x + t^7 + t^5 + t^4 + t^3 + t^2 + 1));
assert s eq 2 and t eq 3;
s, t := TransitiveGroupIdentification(GaloisGroup(x^8 + x^7 + a*x^6 + x^5 + x^2 
+ a*x + 1));
assert s eq 50 and t eq 8;
F<t> := FunctionField(GF(7));
P<x> := PolynomialRing(F);
FF<a> := FunctionField(x^2 + t);
P<x> := PolynomialRing(FF);
s, t := TransitiveGroupIdentification(GaloisGroup(x^8 + F.1+1)); 
assert s eq 6 and t eq 8;
s, t := TransitiveGroupIdentification(GaloisGroup(x^8 + FF.1+1)); 
assert s eq 6 and t eq 8;
k := GF(5);
kx<x> := FunctionField(k);
kxy<y> := PolynomialRing(kx);
K := FunctionField([y^2 + x, y^3 - x]);
_<z> := PolynomialRing(K);
s, t := TransitiveGroupIdentification(GaloisGroup(z^4 + K.1*z^2 + z + x)); 
assert s eq 5 and t eq 4;
k := GF(5);
kt<t> := FunctionField(k);
p := Places(kt, 1) cat Places(kt, 2);
D := 2*Random(p) + 2*Random(p);
R, mR := RayClassGroup(D);
U := 5*R; repeat U := sub<R|Random(R), U>; until #quo<R|U> eq 5;
A := AbelianExtension(D, U);
DA := DiscriminantDivisor(A);
F := FunctionField(A);
F := FunctionField(DefiningPolynomials(F)[1]);
s, t := TransitiveGroupIdentification(GaloisGroup(F)); 
assert s eq 1 and t eq 5;

_<x> := PolynomialRing(Rationals());
K<a> := NumberField([x^2 + 2, x^3 + 5]);
_<y> := PolynomialRing(K);
ta, b := TransitiveGroupIdentification(GaloisGroup(y^5 + y^4 + 3*y^3 - y + 1));
assert ta eq 5 and b eq 5;
KK, R, G := GaloisSplittingField(y^5 + y^4 + 3*y^3 - y + 1);
assert &and[Evaluate((y^5 + y^4 + 3*y^3 - y + 1), r) eq 0 : r in R];
assert #G eq AbsoluteDegree(KK)/AbsoluteDegree(K);
assert &and[Degree(f[1]) eq 1 : f in Factorization(y^5 + y^4 + 3*y^3 - y + 1, KK)];
ta, b := TransitiveGroupIdentification(GaloisGroup(y^3 + a*y^2 - 1));
assert ta eq 2 and b eq 3;
KK, R, G := GaloisSplittingField(y^3 + a*y^2 - 1);
assert &and[Evaluate((y^3 + a*y^2 - 1), r) eq 0 : r in R];
assert #G eq AbsoluteDegree(KK)/AbsoluteDegree(K);
assert &and[Degree(f[1]) eq 1 : f in Factorization(y^3 + a*y^2 - 1, KK)];
KK<aa> := NumberField(y^2 + K.1);
ta, b := TransitiveGroupIdentification(GaloisGroup(KK));
assert ta eq 1 and b eq 2;
KKK, R, G := GaloisSplittingField(DefiningPolynomial(KK));
assert &and[Evaluate((DefiningPolynomial(KK)), r) eq 0 : r in R];
assert #G eq AbsoluteDegree(KKK)/AbsoluteDegree(K);
assert &and[Degree(f[1]) eq 1 : f in Factorization(DefiningPolynomial(KK), KKK)];
_<y> := PolynomialRing(KK);
ta, b := TransitiveGroupIdentification(GaloisGroup(y^3 + aa));
assert ta eq 2 and b eq 3;
KKK, R, G := GaloisSplittingField(y^3 + aa);
assert &and[Evaluate((y^3 + aa), r) eq 0 : r in R];
assert #G eq AbsoluteDegree(KKK)/AbsoluteDegree(KK);
assert &and[Degree(f[1]) eq 1 : f in Factorization(y^3 + aa, KKK)];
ta, b := TransitiveGroupIdentification(GaloisGroup(y^5 + aa*y^3 + 1));
assert ta eq 5 and b eq 5;
//KKK, R, G := GaloisSplittingField(y^5 + aa*y^3 + 1);
//assert #G eq AbsoluteDegree(KKK)/AbsoluteDegree(KK);

F6<t6>:=NumberField(y^3 - 59*y^2 + 42*y + 18) where
y:=PolynomialRing(Rationals()).1;
GaloisGroup(F6);
SplittingField(F6);
KKK, R, G := GaloisSplittingField(DefiningPolynomial(F6));
assert &and[Evaluate(DefiningPolynomial(F6), r) eq 0 : r in R];
assert #G eq AbsoluteDegree(KKK);
