// Extracted from RefGrps.tex by MagmaCode 1.2 on Thu Feb 16 14:49:39 2012
//
// Symmetries of Discrete Objects
// Conference and MAGMA Workshop
// Queenstown, New Zealand, 13-17 February 2012
// Lecture 2
// Lecturer: Don Taylor


ListSignatures(CoxeterGroup,GrpPermCox);

M1 := Matrix(3,3,[1,3,3, 3,1,3, 3,3,1]);
IsCoxeterMatrix(M1);

W1 := CoxeterGroup(M1);
IsFinite(W1);

W1;

M2 := CoxeterMatrix("A2H3");
M2;

FPW2 := CoxeterGroup(GrpFPCox,M2);

MW2 := CoxeterGroup(GrpMat,M2);
MW2:Minimal;

CartanName(MW2);

MW1 := CoxeterGroup(GrpMat,M1);
IsFinite(MW1);

// PW1 := CoxeterGroup(GrpPermCox,M1);

CoxeterDiagram(MW2);

W := CoxeterGroup("E7");
Phi := RootSystem(W);
NumPosRoots(Phi);

W;

E7 := CoxeterGroup("E7");
R := RootSystem(E7);
J := CoxeterForm(R);
V := VectorSpace(Rationals(),7,J);
P := PositiveRoots(R);
ChangeUniverse(~P,V);
X := { v : v in P | v[7] eq 1 };
#X;

A := Matrix(27,27,[2*InnerProduct(u,v) : u,v in X])
      - 2*IdentityMatrix(Integers(),27);
gr := Graph< 27 | A >;
G := AutomorphismGroup(gr);
#G;

flag, _ := IsIsomorphic(G,CoxeterGroup("E6"));
flag;

C6 := SymmetricMatrix(
  [1, 3,1, 2,3,1, 2,3,2,1, 2,2,2,3,1, 2,2,3,2,2,1]);
E6 := CoxeterGroup(GrpFPCox,C6);

specht32, A4 := Partition2WGtable([3,2]); // dimension 5
table := InduceWGtable([1,2,4,5],specht32,E6);
wg := WGtable2WG(table);

Hreps := WG2HeckeRep(E6,wg);
#Hreps;

Hreps[1];

Greps := WG2GroupRep(E6,wg);
Greps[1];

G := ShephardTodd(6);
G;

G := ShephardTodd(6 : NumFld);
G;

 roots, coroots, rho, W, J := ComplexRootDatum(27);
 K := BaseRing(J);
 V := VectorSpace(K,Nrows(J),J);
 roots := ChangeUniverse(roots,V);
 coroots := ChangeUniverse(coroots,V);
 rho := map< roots->coroots | a :-> rho(a) >;
 R := {@ W!PseudoReflection(a,rho(a)) : a in roots @};
R[1];

A,B,J,gen,ord := ComplexRootMatrices(3,3,3);
A;

B;

gen,ord;

BaseRing(J);

r := PseudoReflection(A[3],B[3]);
r;

A,B,J, gen, ord := ComplexRootMatrices(27 : NumFld);
// A is the identity matrix}
B;

gen, ord;

r1 := PseudoReflection(A[1],B[1]);
r1;

orbit_reps := function(G,T)
  reps := [];
  while #T gt 0 do
    t := Rep(T);
    Append(~reps,t);
    S := t^G;
    T := { x : x in T | x notin S };
  end while;
  return reps;
end function;

extendGrp := function(W, refreps, H)
  N := Normaliser(W,H);
  X := [ r : r in refreps | r notin H ];
  orbreps := orbit_reps(N,X);
  return [ G : r in orbreps |
        not exists{ E : E in Self() | IsConjugate(W,E,G) }
                where G is sub< W | H, r > ];
end function;

