1############################################################################################
2############################################################################################
3############################################################################################
4##                                                                                         #
5##                                         REPSN                                           #
6##                                                                                         #
7##                                     A GAP4 Packege                                      #
8##                      for Constructing Representations of Finite Groups                  #
9##                                                                                         #
10##                Developed by: Vahid Dabbaghian                                           #
11##                              Department of Mathematics,                                 #
12##                              Simon Fraser University,                                   #
13##                              Burnaby, BC, Canada.                                       #
14##                              E-mail: vdabbagh@sfu.ca                                    #
15##                              Home Page: www.sfu.ca/~vdabbagh                            #
16##                                                                                         #
17############################################################################################
18
19
20
21############################################################################################
22############################################################################################
23################################### A Main Function ########################################
24## This program returns a representation of a group $G$ affording $\chi$.
25## In this program the following programs and subroutines are called.
26## 1. CharacterSubgroupRepresentation
27## 2. PerfectRepresentation
28## 3. ReducedSubgroupCharacter
29## 4. InducedSubgroupRepresentation
30## 5. ExtendedRepresentationNormal
31## 6. IrreducibleAffordingRepresentation
32############################################################################################
33
34 InstallGlobalFunction( IrreducibleAffordingRepresentation,
35 function( chi )
36 local n, k, g, c, rep, G;
37 G := UnderlyingGroup( chi );
38 if chi[1] = 1 then return CharacterSubgroupRepresentation( chi );
39 fi;
40 k := NaturalHomomorphismByNormalSubgroupNC( G, Kernel( chi ) );
41 if Size(Kernel(chi)) > 1 then
42 g := Image(k);
43 c := Filtered(Irr(Image(k)), x-> chi=RestrictedClassFunction( x, k ) );
44 else
45 g := G;
46 c := [chi];
47 fi;
48 if IsPerfect( g ) then rep := PerfectRepresentation( g, c[1], SpecialCoversData );
49 else
50    n := ReducedSubgroupCharacter( c[1] );
51    if n[2][1] < c[1][1] then
52      rep := InducedSubgroupRepresentation( g, IrreducibleAffordingRepresentation( n[2] ) );
53    fi;
54    if n[2][1] = c[1][1] then
55      if IsPerfect(n[1]) and PerfectRepresentation( n[1], n[2], 1 ) = true then
56        return CharacterSubgroupRepresentation( chi );
57      fi;
58      rep := ExtendedRepresentationNormal( c[1], IrreducibleAffordingRepresentation( n[2] ) );
59    fi;
60 fi;
61 return CompositionMapping( rep, k );
62 end );
63
64
65############################################################################################
66############################################################################################
67####################################### A main Function ####################################
68## This is a test function. If $R$ is a representation of $G$ and $\chi$ is an irreducible
69## character of $G$ then this program returns "true" if the trace of $R(x)$ is equal to
70## $\chi(x)$ for all representatives $x$ of the conjugacy classes of $G$. The inputs of this
71## program are a representation rep and a character chi of a group.
72############################################################################################
73
74 InstallGlobalFunction( IsAffordingRepresentation,
75 function( chi, rep )
76 local tbl, ccl, i;
77     tbl:= UnderlyingCharacterTable( chi );
78     ccl:= ConjugacyClasses( tbl );
79     for i in [ 1 .. Length( ccl ) ] do
80       if Trace( Representative( ccl[i] )^rep ) <> chi[i] then
81         return false;
82       fi;
83     od;
84     return true;
85 end );
86
87
88############################################################################################
89############################################################################################
90####################################### A main Function ####################################
91## This program finds all $p$-subgroups of a group $G$ which are $\chi$-subgroups.
92## In this program the following programs and subroutines are called,
93## 1. LinearConstituentWithMultiplicityOne
94## 2. PSubgroups
95############################################################################################
96
97 InstallGlobalFunction( AllCharacterPSubgroups,
98 function( G, chi )
99 local i, lin, P, psub, L;
100 psub := [ ];
101 L := PSubgroups( G );
102 for P in L do
103    lin := LinearConstituentWithMultiplicityOne( chi, P );
104    if lin <> fail then Add( psub, P );
105    fi;
106 od;
107 return psub;
108 end );
109
110
111############################################################################################
112############################################################################################
113####################################### A main Function ####################################
114## This program finds standard subgroups (Sylow subgroups and their normalizers, centralizers
115## and derived subgroups) of a group $G$ which are $\chi$-subgroups.
116## In this program the following programs and subroutines are called,
117## 1. LinearConstituentWithMultiplicityOne
118## 2. StandardSubgroups
119############################################################################################
120
121 InstallGlobalFunction( AllCharacterStandardSubgroups,
122 function( G, chi )
123 local i, lin, P, psub, L;
124 psub := [ ];
125 L := StandardSubgroups( G );
126 for P in L do
127    lin := LinearConstituentWithMultiplicityOne( chi, P );
128    if lin <> fail then Add( psub, P );
129    fi;
130 od;
131 return psub;
132 end );
133
134
135############################################################################################
136############################################################################################
137####################################### A main Function ####################################
138## This program finds all $\chi$-subgroups of $G$ among the lattice of subgroups.
139## In this program the following programs and subroutines are called,
140## 1. LinearConstituentWithMultiplicityOne
141############################################################################################
142
143 InstallGlobalFunction( AllCharacterSubgroups,
144 function( G, chi )
145 local H, i, lin, l, S;
146 S := [ ];
147 l := List( ConjugacyClassesSubgroups( G ), Representative );
148 for H in l do
149   lin := LinearConstituentWithMultiplicityOne( chi, H );
150   if lin <> fail then Add( S, H );
151   fi;
152 od;
153 return S;
154 end );
155
156
157############################################################################################
158############################################################################################
159##################################### A Main Function ######################################
160## This is a test function. If $H$ is a $\chi$-subgroup then it returns "true", otherwise
161## it returns "false".
162## In this program the following programs and subroutines are called,
163## 1. LinearConstituentWithMultiplicityOne
164############################################################################################
165
166 InstallGlobalFunction( IsCharacterSubgroup,
167 function( chi, H )
168 local l;
169 l := LinearConstituentWithMultiplicityOne( chi, H );
170 if  l = fail then return false;
171 else return true;
172 fi;
173 end );
174
175
176############################################################################################
177############################################################################################
178#################################### A Main Function #######################################
179## This program computes an equivalent representation to the representation rep by
180## transforming rep to a new basis. If $x, y,...$ are the generators of the image
181## of rep, this program finds this new basis among the elements
182## $x, y, xy, x^2, y^2, x^2y,...$.
183############################################################################################
184
185 InstallGlobalFunction( EquivalentRepresentation,
186 function( rep )
187 local l, l1, L, LL, V, f, G, GG, U, N, u, s, i, d, row, g, S, B, Mb;
188 d := 0;
189 L := [ ];
190 LL := [ ];
191 l := [ ];
192 GG := [ ];
193 U := GeneratorsOfGroup( Image( rep ) );
194 g := PreImagesRange( rep );
195 S := GeneratorsOfGroup( g );
196 f := FieldOfMatrixGroup( Image(rep) );
197 V := FullRowSpace( f, DimensionsMat( U[1] )[1] );
198 G := [ Identity (Image( rep ) ) ];
199 Append( G, List( [ 1..Length( U ) ] ,i -> U[ i ] ) );
200 while d = 0 do
201   for u in U do
202     for s in G do
203       Add( GG , s*u );
204       GG := Set( GG );
205     od;
206   od;
207   G := GG;
208   Mb := MutableBasis( f, List( [ 1..Length(GG) ], i -> GG[i][1] ));
209   LL := BasisVectors( Mb );
210   l1 := TransposedMat( LL );
211   N := LinearIndependentColumns( l1 );
212   if Length(N) = Dimension( V ) then
213   for i in N do
214     Add( l, LL [i] );
215   od;
216   B := Basis( V, l );
217   for u in U do
218     row := List( [ 1..Dimension(V) ] , i -> Coefficients (  B, l[i]*u ) );
219     Add( L, row );
220   od;
221     return GroupHomomorphismByImagesNC( g, Group( L ), S, L );
222   fi;
223 od;
224 end );
225
226
227############################################################################################
228############################################################################################
229################################### A Main Function ########################################
230## This is a program for constructing representation of finite groups according
231## to Dixon's method. The input of this program are a group $G$ and an irreducible
232## character $\chi$ of $G$, or $G$, $\chi$ and a $\chi$-subgroup.
233## In this program the following programs and subroutines are called.
234## 1. CharacterSubgroup
235## 2. CharacterSubgroupLinearConstituent
236## 3. InducedSubgroupRepresentation
237## 4. RepresentationMatrixGenerators
238## 5. CharacterSubgroupRepresentation
239############################################################################################
240
241    InstallGlobalFunction( CharacterSubgroupRepresentation,
242 function( arg )
243    local  G, U, r, chi, s, S, H, f, M, m1, Y, rep;
244    chi := arg[1];
245    G := UnderlyingGroup( chi );
246    U := GeneratorsOfGroup( G );
247    if chi[1] = 1 then
248        if Length( U ) = 0 then
249           if IsPermGroup(G) then
250              return GroupHomomorphismByImagesNC( Group(()), Group([[1]]), [()], [[[1]]] );
251           else
252              return GroupHomomorphismByImagesNC( G, G, U, U );
253           fi;
254        fi;
255        r := List( [ 1..Length( U ) ],i -> [ [ U[ i ] ^ arg[ 1 ] ] ] );
256        return GroupHomomorphismByImagesNC( G, Group( r ), U, r );
257    fi;
258    if Length( arg ) = 1  then
259        if IsClassFunction( chi ) and IsCharacter( chi )  then
260          s := CharacterSubgroup( G, chi );
261          H := s[1];
262          f := s[2];
263        else  Error( "first argument must be an ordinary character");
264       fi;
265    fi;
266    if Length( arg ) = 2  then
267        if IsSubgroup ( G, arg[2] ) and IsClassFunction( chi ) and IsCharacter( chi ) then
268        H := arg[2];
269        s := CharacterSubgroupLinearConstituent( chi, [ H ] );
270        if s = fail then Error( "the given group is not a chi-subgroup"); fi;
271        H := s[1];
272        f := s[2];
273        else Error (  "first argument is not a character or second argument is not a subgroup of the given group " );
274    fi; fi;
275    if Index( G, H ) = chi[1] then
276    rep := CharacterSubgroupRepresentation( f );
277    return InducedSubgroupRepresentation ( G, rep );
278    fi;
279    M := MatrixRepsn( chi, G, H, f);
280    m1 := M[1];
281    Y := M[2];
282    r := RepresentationMatrixGenerators( U, Y, m1, f, chi, H );
283    return GroupHomomorphismByImagesNC( G, Group( r ), U, r );
284 end );
285
286
287############################################################################################
288############################################################################################
289#################################### A Main Function #######################################
290## If rep is a representation of a subgroup $H$ of a group $G$, this programs
291## returns an induced representation of rep of group $G$.
292############################################################################################
293
294 InstallGlobalFunction( InducedSubgroupRepresentation,
295 function( G, rep )
296 local M, M1, mat, u, U, rt, i, j, k, LL, L, m, Ls, Lr, l, d, h, r, t, nmat, lrt;
297 mat := [ ];
298 L := [ ];
299 h := PreImagesRange( rep );
300 if Size(h) = 1 then d := 1;
301 else
302 d := DimensionsMat( GeneratorsOfGroup( Image(rep) )[1] )[1];
303 fi;
304 U := GeneratorsOfGroup( G );
305 rt := RightTransversal( G, h );
306 lrt := Length( rt );
307 nmat := NullMat(d,d);
308 for u in U do
309  M := [ ];
310  for i in [1..lrt] do
311   t := rt[i]*u;
312   M1 := [ ];
313    for j in [1..lrt] do
314      r := t*rt[j]^(-1);
315      if r in h then
316       Add( M1, r^rep );
317       else Add( M1, nmat );
318      fi;
319    od;
320   Add( M, M1 );
321  od;
322  Add( mat, M );
323 od;
324 for m in mat do
325 LL := [ ];
326 Lr := [ ];
327 Ls := [ ];
328  for i in [1..lrt] do
329    for j in [1..d] do
330      for k in [1..lrt] do
331          Add( LL, m[i][k][j] );
332      od;
333    Add( Ls, Concatenation(LL) );
334    LL := [ ];
335    od;
336    Add( Lr, Ls );
337  od;
338  Add( L, Lr );
339 od;
340 l := List( L, i-> i[1] );
341 return GroupHomomorphismByImagesNC( G, Group( l ), U, l );
342 end );
343
344
345############################################################################################
346############################################################################################
347#################################### A Main Function #######################################
348## The inputs of this program are an irreducible character $\chi$ of a group $G$ and
349## a representation rep of a subgroup $H$ of $G$ affording the irreducible character
350## $\chi_H$.
351## In this program the following programs and subroutines are called,
352## 1. ModuleBasis
353############################################################################################
354
355 InstallGlobalFunction( ExtendedRepresentation,
356 function( chi, rep )
357 local S, C, mat, B, i, j, s, u, U, L, n, M, l, h, G, Mat, dim;
358 S := [ ];
359 C := [ ];
360 mat := [ ];
361 L := [ ];
362 n := chi[1];
363 h := PreImagesRange( rep );
364 if Size(h) = 1 then
365    B := [ [ [ [ 1 ] ] ], [ Identity( h ) ] ];
366    else
367    Mat := GeneratorsOfGroup(Image(rep));
368    dim := DimensionsMat( Mat[1] )[1];
369    Info( InfoWarning, 1, "Need to extend a representation of degree ", dim, ". This may take a while." );
370    B := ModuleBasis( h, rep );
371 fi;
372 G := UnderlyingGroup( chi );
373 U := GeneratorsOfGroup( G );
374 for u in U do
375   for i in [1..n^2] do
376     for j in [1..n] do
377       Append( L, TransposedMat( B[1][i] )[j] );
378     od;
379     Add( mat, L );
380     L := [ ];
381     Add( C, (B[2][i]*u)^chi );
382   od;
383   s := SolutionMat( TransposedMat(mat), C );
384   M:= List( [ 1 .. n ], i -> s{ [ (i-1)*n+1 .. i*n ] } );
385   Add( S, M );
386   mat := [ ];
387   C := [ ];
388 od;
389 return  GroupHomomorphismByImagesNC( G, Group( S ), U, S );
390 end );
391
392
393############################################################################################
394############################################################################################
395#################################### A Main Function #######################################
396## The inputs of this program are an irreducible character $\chi$ of a group $G$ and
397## a representation rep of a normal subgroup $H$ of $G$ affording the irreducible
398## character $\chi_H$.
399############################################################################################
400
401 InstallGlobalFunction( ExtendedRepresentationNormal,
402 function( chi, rep )
403 local R, S, C, G, x, M1, M2, M, Mat, i, s, u, U, Uh, h, b, w, o, n, dim;
404 C := [ ];
405 n := chi[1];
406 h := PreImage( rep );;
407 Uh:= GeneratorsOfGroup( h );;
408 U := ShallowCopy( Uh );;
409 Mat := List( [1..Length(U)], i -> U[i]^rep );;
410 Mat := ShallowCopy( Mat );;
411 if Size( h ) = 1 then dim := 1;
412   else
413   dim := DimensionsMat( Mat[1] )[1];
414   Info( InfoWarning, 1, "Need to extend a representation of degree ", dim, ". This may take a while." );
415 fi;
416 G := UnderlyingGroup( chi );
417 repeat
418   repeat x:= PseudoRandom( G );
419   until not x in h and x^chi <> 0;
420   for u in Uh do
421     R := u^rep;
422     S := ( x^(-1)*u*x )^rep;
423     M1 := KroneckerProduct( R, IdentityMat(n) );
424     M2 := KroneckerProduct( IdentityMat(n), TransposedMat(S) );
425     Append( C, M1 - M2);
426   od;
427     b := IdentityMat(n);
428     b := Concatenation(b);
429     Add( C, b );
430     w := List( [1..Length(Uh)*n^2] , i->0 );
431     Add( w, x^chi );
432     s := SolutionMat( TransposedMat(C), w );
433     M:= List( [ 1 .. n ], i -> s{ [ (i-1)*n+1 .. i*n ] } );
434     Add( Mat, M );
435     C := [ ];
436     Add( U, x );
437 until Size ( Group(U) ) = Size( G );
438 return GroupHomomorphismByImagesNC( Group(U), Group( Mat ), U, Mat );
439 end );
440
441
442############################################################################################
443############################################################################################
444################################### A Main Function ########################################
445## This program returns constituents and multiplicities a representation $rep$.
446## In this program the following program is called.
447## 1. IrreducibleAffordingRepresentation
448############################################################################################
449
450   InstallGlobalFunction( ConstituentsOfRepresentation,
451 function( rep )
452   local D, G, ctb, chi, con, R, C, m, i, r, UG, l;
453   D := [ ];
454   G := PreImagesRange( rep );
455   UG := GeneratorsOfGroup( G );
456   ctb := CharacterTable( G );
457   con := ConjugacyClasses( ctb );
458   chi := ClassFunction( ctb, List( con , i -> TraceMat( Image( rep, Representative( i )))));
459   R := RestrictedClassFunction( chi, G );
460   C := ConstituentsOfCharacter( R );
461   m := MatScalarProducts( C, [ R ] );
462   for i in [1..Length( C )] do
463      r := IrreducibleAffordingRepresentation( C[i] );
464      l := List( UG, i -> i^r );
465      Add( D, [ m[1][i], GroupHomomorphismByImagesNC( G, Group( l ), UG, l ) ] );
466   od;
467   return D;
468 end );
469
470
471############################################################################################
472############################################################################################
473################################### A Main Function ########################################
474## This program computes an equivalnet block diagonal representation to a given
475## representation, or computes a block diagonal representation of the given list of
476## irreducible representations.
477## In this program the following program is called.
478## 1. DiagonalBlockMatrix
479############################################################################################
480
481   InstallGlobalFunction( EquivalentBlockRepresentation,
482 function( reps )
483   local G, UG, U, i, j, k, matlist, mat, Mat;
484   Mat := [ ]; U := [ ];
485   if not IsList( reps ) then
486      reps := ConstituentsOfRepresentation( reps ) ;
487   fi;
488   if Length( reps ) = 1 and reps[1][1] = 1 then return reps[1][2]; fi;
489   G := PreImagesRange( reps[1][2] );
490   UG := GeneratorsOfGroup( G );
491   for k in [1..Length( reps )] do
492       for j in [1..reps[k][1]] do
493            Add( U, GeneratorsOfGroup( Image( reps[k][2] ) ) );
494       od;
495   od;
496   for i in [1..Length( U[1] )] do
497      matlist := List( U, j-> j[i] );
498      mat := DiagonalBlockMatrix( matlist );
499      Add( Mat, mat );
500   od;
501   return GroupHomomorphismByImagesNC( G, Group( Mat ), UG, Mat );;
502 end );
503
504
505############################################################################################
506############################################################################################
507################################### A Main Function ########################################
508## This program returns true if the representation $rep$ is reducible.
509############################################################################################
510
511 InstallGlobalFunction( IsReducibleRepresentation,
512 function( rep )
513   local G, ctb, chi, con;
514   G := PreImagesRange( rep );
515   ctb := CharacterTable( G );
516   con := ConjugacyClasses( ctb );
517   chi := ClassFunction( ctb, List( con , i -> TraceMat( Image( rep, Representative( i )))));
518   if IsIrreducibleCharacter( chi ) = false then return true;
519   else return true;
520   fi;
521 end );
522
523
524############################################################################################
525############################################################################################
526##################################### A Utility Function ###################################
527##
528##
529
530 InstallGlobalFunction( DiagonalBlockMatrix,
531 function( matrices )
532   local dimension,  partialSum,  totalLength,  result,  m,  i,  range;
533   dimension := List( matrices, Length );
534   partialSum := List([0..Length( matrices )], x -> Sum( dimension{[1..x]} ));
535   range := List( [1..Length( matrices )], x -> [ partialSum[x]+1..partialSum[x+1] ] );
536   totalLength := Sum( dimension );
537   result := NullMat( totalLength, totalLength, Field(matrices[1][1][1]) );
538   for m in [1..Length( matrices )] do
539     for i in [1..dimension[m]] do
540       result[ range[m][i] ]{range[m]} := matrices[m][i];
541     od;
542   od;
543   return result;
544 end );
545
546
547############################################################################################
548############################################################################################
549##################################### A Utility Function ###################################
550##
551##
552
553 InstallGlobalFunction( AlphaRepsn,
554    function( x, f, chi, H )
555    local  z, sum, C, l, a, i, t;
556    sum := 0; t:=0;
557    C := ConjugacyClasses(H);
558    l := List(C, Representative);
559    for i in [1..Length(l)] do
560        a := ( l[i] ^ -1 ) ^ f;
561        for z in C[i] do
562          t := t +  (z * x ) ^ chi;
563        od;
564        t := t * a;
565        sum := sum + t ;
566        t := 0;
567    od;
568    return sum;
569 end );
570
571
572############################################################################################
573############################################################################################
574##################################### A Utility Function ###################################
575## This program finds a linear constituent with multiplicity one of $\chi_H$.
576## If such a constituent does not exist, it returns "false".
577##
578
579 InstallGlobalFunction( LinearConstituentWithMultiplicityOne,
580 function( chi, H )
581 local rest;
582 rest:= RestrictedClassFunction( chi, H );
583 return First( LinearCharacters( H ), lambda -> ScalarProduct( rest, lambda ) = 1 );
584 end );
585
586
587############################################################################################
588############################################################################################
589##################################### A Utility Function ###################################
590## This program finds a $\chi$-subgroup from the list S. If such a subgroup
591## does not exist it returns "fail".
592##
593
594 InstallGlobalFunction( CharacterSubgroupLinearConstituent,
595 function( chi, S )
596 local  j, lin;
597 for j  in [1..Length(S)]  do
598    lin := LinearConstituentWithMultiplicityOne( chi, S[j]);
599    if lin <> fail then
600       return [ S[j] ,lin ];
601    fi;
602 od;
603 return fail;
604 end );
605
606
607############################################################################################
608############################################################################################
609##################################### A Utility Function ###################################
610## This Program constructs the matrix A discribed in Dixon's paper.
611##
612
613 InstallGlobalFunction( MatrixRepsn,
614    function( chi, G, H, f )
615    local  mat, matn, X, Xinv, j, n, x, d, h, Y;
616    h := Size(H);
617    mat := [ [ h ] ];
618    X := [ Identity( G ) ];
619    Xinv:= [ Identity( G ) ];
620    d := DegreeOfCharacter( chi );
621    while Length( X ) < d  do
622        matn := [  ];
623        n := Length( X );
624        x := PseudoRandom( G );
625        for j  in [ 1 .. n ]  do
626            Y := x * Xinv[j];
627            matn[j] := AlphaRepsn( Y, f, chi, H );
628            mat[j][n + 1] := ComplexConjugate( matn[j] );
629        od;
630        matn[n + 1] := h;
631        mat[n + 1] := matn;
632        if RankMat( mat ) = Length( mat) then
633            X[n + 1] := x;
634            Xinv[n + 1] := x^-1;
635        fi;
636    od;
637    return [ mat, X ];
638 end );
639
640
641############################################################################################
642############################################################################################
643##################################### A Utility Function ###################################
644## This program finds a $\chi$-subgroup among the Sylow subgroups of $G$.
645##
646
647 InstallGlobalFunction( CharacterSylowSubgroup,
648 function( G, chi )
649 local   S, x, pair, coll, sizes, lin;
650 coll:= Collected( Factors( Size( G ) ) );
651 sizes:= List( coll, x -> x[1]^x[2] );
652 SortParallel( sizes, coll );
653 for pair in coll do
654 S:= SylowSubgroup( G, pair[1] );
655    lin := LinearConstituentWithMultiplicityOne( chi, S );
656    if lin <> fail then
657       return S;
658    fi;
659 od;
660 return fail;
661 end );
662
663
664############################################################################################
665############################################################################################
666##################################### A Utility Function ###################################
667## This program constructs the matrices of the representation, corresponding
668## to set of generators U in the main Lemma of Dixon's paper.
669##
670
671 InstallGlobalFunction( RepresentationMatrixGenerators,
672    function( U, Y, m1, f, chi, H )
673    local  u, i, j, m2, L, X, inv, Yinv, lenY;
674    L := [ ];
675    lenY := Length( Y );
676    Yinv := List( Y, i -> i^-1 );
677    inv := Inverse( m1 );
678    for u  in U  do
679      m2 := [ ];
680      for i in [ 1 .. lenY ] do
681        m2[i] := [ ];
682        for j in [ 1 .. lenY ] do
683            X := ( Y[i] * u ) * Yinv[j];
684            m2[i][j] := AlphaRepsn( X, f, chi, H );
685        od;
686     od;
687     Add( L, m2 * inv );
688    od;
689    return L;
690 end );
691
692
693############################################################################################
694############################################################################################
695##################################### A Utility Function ###################################
696## This program finds the smallest possible $\chi$-subgroup of $G$. At the first
697## it checks among the standard subgroups of $G$ and then the lattice of subgroups of the
698## Sylow subgroups. If there is no subgroup as a $\chi$-subgroup then it searches among
699## the lattice of subgroups of $G$.
700##
701
702 InstallGlobalFunction( CharacterSubgroup,
703 function( G, chi )
704 local N, s, S, pi, i, L, reps, sp, l;
705      reps := [  ];
706      N := StandardSubgroups( G );
707      s := CharacterSubgroupLinearConstituent( chi, N );
708  #   if s <> fail the return s; fi;
709      if s = fail then
710         pi := Set(FactorsInt( Size(G) ) );
711         for i in [1..Length(pi)] do
712             S := SylowSubgroup( G, pi[i] );
713             sp := List(ConjugacyClassesSubgroups(S),Representative);
714             L := sp[1];
715             repeat
716                 Add( reps, L );
717                 L := First( sp, g -> not ForAny( reps, rep -> IsConjugate( G, g, rep ) ) );
718                 until L = fail;
719             reps := Set( reps );
720             l := List( reps, Size );
721             SortParallel( l , reps );
722             s := CharacterSubgroupLinearConstituent( chi, reps );
723        od;
724      fi;
725      if s = fail  then
726             if not ( HasConjugacyClassesSubgroups( G ) or HasTableOfMarks( G ) ) then
727                  Info( InfoWarning, 1, "need to compute subgroup lattice of a group of order ", Size( G ) );
728             fi;
729            S := List( ConjugacyClassesSubgroups( G ), Representative );
730            s := CharacterSubgroupLinearConstituent( chi, S );
731            if s = fail  then
732               Error ( "Dixon's method does not work for the given character ");
733            fi;
734      fi;
735 return s;
736 end );
737
738
739############################################################################################
740############################################################################################
741##################################### A Utility Function ###################################
742## The inputs of this program are a group $G$ and a representation rep of a subgroup
743## $H$ of $G$ which is the restriction of a representation of $G$ to $H$.
744## Using the Burnside's Theorem, this program finds a basis for the matrix algebra
745## of the image of rep.
746##
747
748 InstallGlobalFunction( ModuleBasis,
749 function( G, rep )
750 local V, f, B, u, x, L, l, d, i, N, P;
751 l := [ ];
752 L := [ ];
753 B := [ ];
754 d := DimensionsMat( GeneratorsOfGroup( Image(rep) )[1] )[1];
755 for i in [1..2*d^2] do
756   x := PseudoRandom( G );
757   Add( l, x^rep );
758 od;
759 f := FieldOfMatrixGroup( Image(rep) );
760 V := MutableBasis( f, l );
761 while NrBasisVectors(V) < d^2 do
762   x := PseudoRandom(G);
763   u := x^rep;
764   if IsContainedInSpan( V, u ) = false then
765              CloseMutableBasis( V, u );
766              Add( l, u );
767   fi;
768 od;
769 for i in [1..Length(l)] do
770   Add( L, Concatenation( l[i] ) );
771 od;
772 N := LinearIndependentColumns( TransposedMat( L ) );
773 for i in N do
774   Add( B, l[i] );
775 od;
776 P := List( [1..d^2], i->PreImagesRepresentative( rep, B[i] ) );
777 return [B,P];
778 end );
779
780
781############################################################################################
782############################################################################################
783##################################### A Utility Function ###################################
784## This is a subprogram for the function ``MinimalNormalSubgps".
785##
786
787 InstallGlobalFunction( AddToSubgpList,
788 function( nt, U )
789 local i, N;
790 for N in nt do
791   if IsSubgroup( U, N ) then
792      return nt;
793   fi;
794 od;
795 for i in [1..Length(nt)] do
796   if IsSubgroup(nt[i], U) then
797      nt[i] := false;
798   fi;
799 od;
800 nt := Filtered( nt, x -> not IsBool(x) );
801 Add( nt, U );
802 return nt;
803 end );
804
805
806############################################################################################
807############################################################################################
808##################################### A Utility Function ###################################
809## This function finds the minimal normal subgroups of a group $G$.
810##
811
812 InstallGlobalFunction( MinimalNormalSubgps,
813 function( G )
814 local cl, nt, c, U;
815 cl := ConjugacyClasses( G );
816 nt := [];
817 for c in cl do
818   if IsPrime( Order( Representative(c) ) ) then
819      U  := SubgroupNC( G, [Representative(c)] );
820      U  := NormalClosure( G, U );
821      nt := AddToSubgpList( nt, U );
822   fi;
823 od;
824 return nt;
825 end );
826
827
828############################################################################################
829############################################################################################
830###################################### A Utility Function ##################################
831## If $\chi$ is an irreducible chracter of $G$, this program reduces the problem of
832## constructing a representation of $G$ affording $\chi$ to a perfect subgroup of $G$.
833## It finds either a subgroup $H$ and an irreducible character $\phi$ of $H$ such that
834## $\chi=\phi^G$ or a subgroup $H$ such that $\chi_H$ is irreducible. The input of this
835## program is $\chi$ and the outputs are either $H$ and $\phi$ or $H$ and $\chi_H$.
836##
837
838 InstallGlobalFunction( ReducedSubgroupCharacter,
839 function( chi )
840 local k, i, N, I, R, Ri, Rc, C, Ci, Cc, c, L, n, G;
841 G := UnderlyingGroup( chi );
842 N := DerivedSeries( G );
843 k := 0;
844 for i in [2..Length( N )] do
845   R := RestrictedClassFunction( chi, N[i] );
846   C := ConstituentsOfCharacter(R);
847   if Length(C) > 1 then
848    I := InertiaSubgroup( G, C[1] );
849    Ri := RestrictedClassFunction( chi, I );
850    Ci := ConstituentsOfCharacter( Ri );
851    for c in Ci do
852      Rc := RestrictedClassFunction( c, N[i] );
853      Cc := ConstituentsOfCharacter( Rc );
854      if C[1] in Cc then return [I,c];
855      fi;
856    od;
857   elif IsIrreducibleCharacter( R ) then
858      k := i; c := R;
859   fi;
860 od;
861 if k > 0 then return [ N[k], c ];
862 fi;
863 L := ChiefSeriesThrough( G, [N[2]] );
864 n := Length(L);
865 for i in [2..n] do
866   R := RestrictedClassFunction( chi, L[i] );
867   C := ConstituentsOfCharacter( R );
868   if Length(C) > 1 then
869       I := InertiaSubgroup( G, C[1] );
870       Ri := RestrictedClassFunction( chi, I );
871       Ci := ConstituentsOfCharacter( Ri );
872         for c in Ci do
873          Rc := RestrictedClassFunction( c, L[i] );
874          Cc := ConstituentsOfCharacter( Rc );
875          if C[1] in Cc then return [I,c];
876          fi;
877         od;
878   fi;
879 od;
880 end );
881
882
883############################################################################################
884############################################################################################
885##################################### A Utility Function ###################################
886## This program lists all $p$-subgroups of $G$ which are not $G$-conjugate.
887##
888
889 InstallGlobalFunction( PSubgroups,
890 function( G )
891 local P, S, reps, L, rep, g, sp, l;
892 reps := [ ];
893 S := List( Set(FactorsInt( Size(G) ) ), i->SylowSubgroup( G, i ) );
894 for P in S do
895   sp := List(ConjugacyClassesSubgroups(P),Representative);
896   L := sp[1];
897   repeat
898   Add( reps, L );
899   L := First( sp, g -> not ForAny( reps, rep -> IsConjugate( G, g, rep ) ) );
900   until L = fail;
901 od;
902 reps := Set( reps );
903 l := List( reps, Size );
904 SortParallel( l , reps );
905 return reps;
906 end );
907
908
909############################################################################################
910############################################################################################
911##################################### A Utility Function ###################################
912## For all Sylow $p$-subgroups $P$ of $G$ of order $p^a$, this program lists $P$, the
913## normalizer of $P$ in $G$ if $a <= 2$, and the derived subgroup $P'$ of $P$ and the
914## centralizer of $P'$ in $G$ if $a > 2$.
915##
916
917 InstallGlobalFunction( StandardSubgroups,
918 function( G )
919 local reps, S, P, D, l, i, col;
920 col := Collected( FactorsInt( Size ( G ) ) );
921 S := List(col, i-> SylowSubgroup( G, i[1] ) );
922 reps := S;
923 for i in [1..Length(col)] do
924   if col[i][2] <= 2 then
925            Add( reps, Normalizer( G, S[i] ) );
926   else if not IsAbelian( S[i] ) then
927                D := DerivedSubgroup( S[i] );
928                Add( reps, D );
929                Add( reps, Centralizer( G, D ) );
930        fi;
931   fi;
932 od;
933 reps := Set( reps );
934 l := List( reps, Size );
935 SortParallel( l , reps );
936 return reps;
937 end );
938
939
940############################################################################################
941############################################################################################
942##################################### A Utility Function ###################################
943## This program is for constructing representations of groups $6.A_6$, $2.A_7$,
944## $3.A_7$, $6.A_7$ and $2.A_8$, affording some special characters. These are the
945## characters, say $\chi$, such that there exists a $\chi$-subgroup which is
946## not a $p$-subgroup.
947##
948
949 InstallGlobalFunction( CoversOfAlternatingGroupsRepresentation,
950 function( G, chi, size, hom )
951 # See section 4.4 of thesis.
952 local L, g, c, C, H;
953 L := [ ];
954 g := Image( hom );
955 C := List( ConjugacyClassesSubgroups( g ), Representative );
956 for c in C do
957     if Size(c) = size then
958       Add( L, PreImage( hom, c ) );
959     fi;
960 od;
961 H := CharacterSubgroupLinearConstituent( chi, L )[1];
962 return CharacterSubgroupRepresentation( chi, H );
963 end );
964
965
966############################################################################################
967############################################################################################
968##################################### A Utility Function ###################################
969## This program is for constructing representations of covering groups, say $G$, of
970## group $U_4(3)$, affording an irreducible character $\chi$ of degree less than 32.
971## This program finds a maximal subgroup $M$ of $G$ such that $\chi_M$ is irreducible.
972##
973
974 InstallGlobalFunction( CoversOfU43Representation,
975 function( chi, hom )
976 local g, k, d, c, n, r, max, R;
977 g := Image( hom );
978    if chi[1] in [6,15] then
979      k := SylowSubgroup( g, 3 );
980      d := DerivedSubgroup( k );
981      c := Centralizer( k, d );
982      n := Normalizer( g, c );
983    fi;
984    if chi[1] = 21 then
985      r := IsomorphicSubgroups( g, PSL(3,4) );
986      n := Image( r[1] );
987    fi;
988 max := PreImage( hom, n );
989 R := RestrictedClassFunction( chi, max );
990 return ExtendedRepresentation( chi, IrreducibleAffordingRepresentation( R ) );
991 end );
992
993
994############################################################################################
995############################################################################################
996##################################### A Utility Function ###################################
997## This program is for constructing representations of covering group $G:=3.O_7(3)$
998## of group $O_7(3)$ affording an irreducible character $\chi$ of degree less than 32.
999## This program finds a maximal subgroup $M$ of $G$ such that $\chi_M$ is irreducible.
1000##
1001
1002 InstallGlobalFunction( CoversOfO73Representation,
1003 function( chi, hom )
1004 local g, P, n, C, f, l, F, t, M, max, R;;
1005 g := Image( hom );;
1006 P := SylowSubgroup( g, 3 );;
1007 n := Normalizer( g, P );;
1008 C := List( ConjugacyClasses( n ), Representative );;
1009 f := Filtered( C, i-> i in P );;
1010 l := List( f, i-> NormalClosure( n, Group( i ) ) );;
1011 F := Filtered( l, i-> Size( i ) = 243 );;
1012 for t in F do
1013   M := Normalizer( g, t );
1014   if Index( g, M ) = 364 then
1015     max := PreImage( hom, M );
1016     R := RestrictedClassFunction( chi, max );
1017     return ExtendedRepresentation( chi, IrreducibleAffordingRepresentation( R ) );
1018   fi;
1019 od;
1020 end );
1021
1022
1023############################################################################################
1024############################################################################################
1025##################################### A Utility Function ###################################
1026## This program is for constructing representations of covering group $G:=3.U_6(2)$
1027## of group $U_6(2)$ affording an irreducible character $\chi$ of degree less than 32.
1028## This program finds a maximal subgroup $M$ of $G$ such that $\chi_M$ is irreducible.
1029##
1030
1031 InstallGlobalFunction( CoversOfU62Representation,
1032 function( chi, hom )
1033 local g, k, u, c, n, m, R;
1034 g := Image( hom );
1035 k := SylowSubgroup( g, 2 );
1036 u := UpperCentralSeries( k );
1037 c := Centralizer( k, u[3] );
1038 n := Normalizer( g, c );
1039 m := PreImage( hom, n );
1040 R := RestrictedClassFunction( chi, m );
1041 return ExtendedRepresentation( chi, IrreducibleAffordingRepresentation( R ) );
1042 end );
1043
1044
1045############################################################################################
1046############################################################################################
1047##################################### A Utility Function ###################################
1048## For computing projective representations based on Minkwitz's method
1049##
1050
1051 InstallGlobalFunction( ProjectiveReps,
1052 function( chi, rep, g )
1053 local d, N, mat, y, G, e, T, ZG;
1054 G := UnderlyingGroup( chi );
1055 ZG := Center(G);
1056 N := PreImages( rep );
1057 d := DimensionsMat( GeneratorsOfGroup( Image(rep) )[1] )[1];
1058 e := chi[1]/d;
1059 T := List(RightTransversal(N,ZG),i->CanonicalRightCosetElement(ZG,i));
1060 mat := (d/(e*Size(T))) * Sum(List(T, y-> (g*(y^(-1)))^chi * ImagesRepresentative( rep,y ) ) );
1061 return mat;
1062 end );
1063
1064
1065############################################################################################
1066############################################################################################
1067##################################### A Utility Function ###################################
1068## Group generators for Minkwitz's method
1069##
1070
1071 InstallGlobalFunction( GeneratorsProjective,
1072 function( chi, rep )
1073 local z, N, U, g, e, ZG, G;
1074 G := UnderlyingGroup( chi );
1075 ZG := Center(G);
1076 N := FittingSubgroup( G );
1077 U := [];
1078 z := Size(G);
1079 repeat g:=Random( Difference( G, N ) );
1080    if g^chi<>0 then
1081       Add(U,g);
1082    fi;
1083 until U<>[] and Size(Group(U))=z;
1084 return U;
1085 end );
1086
1087
1088############################################################################################
1089############################################################################################
1090##################################### A Utility Function ###################################
1091## A program for finding suitable ordinary representation of the cover of G/F to use in
1092## Schur's theorem
1093##
1094
1095 InstallGlobalFunction( FilteringCharacters,
1096 function( chi, rep, U, Phi, h, EpiGf, IsoGf, SGf )
1097 local LU, d, e, l, le, ls, conj, G, Uproj, Iso, phi, Iphi, lUSGf, mu, A, S3, WS, s, s1, s2, s3, g, cfp, a, WsGf, j, TrA, tst;
1098 LU := Length(U);
1099 d := DimensionsMat( GeneratorsOfGroup( Image(rep) )[1] )[1];
1100 e := chi[1]/d;
1101 G := Group(U);;                                                                  ###### G=<x1,...,xn> and U={x1...,xn} ######
1102 Uproj := List( U, i-> ProjectiveReps( chi, rep, i) );;                           ###### [A1,...An] where Ai=V(xi) for a Proj. Reps V of G ######
1103 l  := List( [1..LU], i->ImagesRepresentative( h, U[i] ) );
1104 le := List( [1..LU], i->PreImagesRepresentative( EpiGf, l[i] ) );
1105 ls := List( [1..LU], i->ImagesRepresentative( IsoGf, le[i] ) );                  ###### \bar{x1},...,\bar{xn} in the cover of G/F ######
1106 conj := List( ConjugacyClasses(SGf), Representative );
1107 Iso := IsomorphismFpGroupByGenerators(G,U);;
1108 for phi in Phi do
1109   Iphi := IrreducibleAffordingRepresentation( phi );
1110   lUSGf := List( [1..LU], i->ImagesRepresentative( Iphi, ls[i] ) );
1111   mu := List(lUSGf, t -> Trace(t));
1112   if ForAll(mu, t -> (t <> 0)) then
1113     A:=[]; S3:=[]; WS:=[];
1114     for s in conj do
1115        s1:= PreImagesRepresentative( IsoGf, s );
1116        s2:= ImagesRepresentative( EpiGf, s1 );
1117        s3:= PreImagesRepresentative( h, s2 );                                   ####### \bar{s} in the cover ######
1118        g := ImagesRepresentative( Iso, s3 );                                    ####### \bar{s}=w(x1,...xn)  ######
1119        cfp := ExtRepOfObj(g);
1120        Add(S3,s3);
1121        a := IdentityMat( d );
1122        for j in [1..Length(cfp)/2] do
1123            a := a * (e/(mu[cfp[2*j-1]])*Uproj[cfp[2*j-1]])^cfp[2*j];            ####### A=w(A1,...,An) #######
1124        od;
1125        Add(A,a);
1126        WsGf := Identity( SGf );
1127        for j in [1..Length(cfp)/2] do
1128            WsGf := WsGf * (ls[cfp[2*j-1]])^cfp[2*j];                            ####### WsGf=w(\bar{x1},...,\bar{xn})  #######
1129        od;
1130        Add(WS, WsGf);
1131     od;
1132     TrA := List( [1..Length(conj)], i->Trace(A[i]) );
1133     tst:= Filtered( [1..Length(conj)], i->TrA[i]<>0 );
1134     if List( tst, i-> WS[i]^phi) = List( tst, i-> S3[i]^chi/TrA[i] ) then return [lUSGf, mu];
1135     fi;
1136   fi;
1137 od;
1138 end );
1139
1140
1141############################################################################################
1142############################################################################################
1143##################################### A Utility Function ###################################
1144## A program for computing representation of a perfect group $G$ with abelian
1145## $Soc(G/Z(G))$ affording \chi, in the case that \chi_F=e*\theta and e not prime.
1146##
1147
1148 InstallGlobalFunction( IrrRepsNotPrime,
1149 function(chi,theta,f)
1150 local G, h, e, Gf, EpiGf, SchurGf, IsoGf, SGf, chiSGf, Vf, U, lVG, SGfReps, r, i;
1151    G := UnderlyingGroup( chi );;
1152    h := NaturalHomomorphismByNormalSubgroup( G, f );;
1153    e:= chi[1]/theta[1];;
1154    Gf := Image(h);;
1155    EpiGf := EpimorphismSchurCover( Gf, [2,3,5,7,11] );;
1156    SchurGf := PreImage(EpiGf);;
1157    IsoGf := IsomorphismPermGroup(SchurGf);;
1158    SGf := Image(IsoGf);;                                                   ####### SGf is a perm. reps of a cover of G/F #######
1159    chiSGf:= Filtered( Irr(SGf), i->i[1] = e);
1160    Vf := IrreducibleAffordingRepresentation( theta );
1161## The following 2 lines is for computing a projective representation of G of degree \theta(1)
1162## Here it computes the matrices V(x) for generators x in U
1163   U := GeneratorsProjective( chi, Vf );
1164   lVG := List( [1..Length(U)], i->ProjectiveReps( chi, Vf, U[i] ) );
1165## The program "FilteringCharacters" checks to find the suitable representation of
1166## the central cover of G/F
1167   SGfReps := FilteringCharacters( chi, Vf, U, chiSGf, h, EpiGf, IsoGf, SGf );
1168   r := List( [1..Length(U)], i->(e/SGfReps[2][i])*KroneckerProduct( SGfReps[1][i], lVG[i] ) );
1169   return GroupHomomorphismByImagesNC( Group(U), Group( r ), U, r );
1170 end );
1171
1172
1173############################################################################################
1174############################################################################################
1175##################################### A Utility Function ###################################
1176## This program returns a representation of a perfect group $G$ with abelian $Soc(G/Z(G))$
1177## using Gallagher's Theorem
1178##
1179
1180 InstallGlobalFunction( GallagherRepsn,
1181 function( G, chi, h, f, C, m, U )
1182 local IrrG, i, R, psi, e1, r1, im, Irrim, e2, r2, r, l;
1183 IrrG := Irr(G);
1184 psi:=0;
1185 for i in [1..Length(IrrG)] do
1186    R := RestrictedClassFunction( IrrG[i], f );
1187    if R = C[1] then
1188       psi := IrrG[i];
1189       e1 := IrreducibleAffordingRepresentation( psi );
1190       r1 := List( [1..Length(U)], i->ImagesRepresentative( e1, U[i] ) );
1191       break;
1192    fi;
1193 od;
1194 if psi <> 0 then
1195   im := Image( h );
1196   Irrim := Irr(im);
1197   for i in [1..Length( Irrim )] do
1198      if m[1][1] = Irrim[i][1] then
1199        R := RestrictedClassFunction( Irrim[i], h );
1200        if chi = psi*R then
1201           e2 := IrreducibleAffordingRepresentation( Irrim[i] );
1202           l := List( [1..Length(U)], i->ImagesRepresentative( h, U[i] ) );
1203           r2 := List( [1..Length(l)], i->ImagesRepresentative( e2, l[i] ) );
1204           r := List( [1..Length(r1)], i->KroneckerProduct( r1[i], r2[i] ) );
1205           return GroupHomomorphismByImagesNC( G, Group( r ), U, r );
1206        fi;
1207      fi;
1208   od;
1209 fi;
1210 end );
1211
1212
1213############################################################################################
1214############################################################################################
1215##################################### A Utility Function ###################################
1216## This program returns a representation of a perfect group $G$ with abelian
1217## $Soc(G/Z(G))$. This function calls the following three functions:
1218## 1. ExtendedRepresentationNormal
1219## 2. InducedSubgroupRepresentation
1220## 3. GallagherRepsn
1221##
1222
1223 InstallGlobalFunction( PerfectAbelianSocleRepresentation,
1224 function( G, chi )
1225 local Ug, U, f, R, C, m, I, t, Rc, Cc, h, P;
1226 Ug := GeneratorsOfGroup( G );;
1227 U := ShallowCopy( Ug );;
1228 f := FittingSubgroup( G );;
1229 R := RestrictedClassFunction( chi , f );;
1230 C := ConstituentsOfCharacter( R );;
1231 m := MatScalarProducts( C, [ R ] );
1232 ######### if \chi_F is irreducible #########
1233 if IsIrreducibleCharacter( R ) then
1234    return ExtendedRepresentationNormal( chi, IrreducibleAffordingRepresentation( R ) );
1235 fi;
1236 ######### if \chi is imprimitive #########
1237 if Length( C ) > 1 then
1238   I := InertiaSubgroup( G, C[1] );
1239   R := RestrictedClassFunction( chi, I );
1240   C := ConstituentsOfCharacter( R );
1241   for t in C do
1242     Rc := RestrictedClassFunction( t, f );
1243     Cc := ConstituentsOfCharacter( Rc );
1244     if C[1] in Cc then
1245        return InducedSubgroupRepresentation( G, IrreducibleAffordingRepresentation( t ));;
1246     fi;
1247   od;
1248 fi;
1249 h := NaturalHomomorphismByNormalSubgroup( G, f );
1250 ######### if \chi_F=e*\theta for e prime #########
1251 if Length( C ) = 1  and IsPrime( m[1][1] ) then
1252    P := PreImage( h , SylowSubgroup( Image(h), m[1][1] ) );
1253    R := RestrictedClassFunction( chi , P );
1254    if IsIrreducibleCharacter( R ) then
1255       return ExtendedRepresentation( chi, IrreducibleAffordingRepresentation( R ) );
1256    else
1257       return GallagherRepsn( G, chi, h, f, C, m, U );
1258    fi;
1259 fi;
1260 ######### if \chi_F=e*\theta for e not prime #########
1261 if Length( C ) = 1 and IsPrime( m[1][1] ) = false then
1262    return IrrRepsNotPrime( chi, C[1], f );;
1263 fi;
1264 end );
1265
1266
1267############################################################################################
1268############################################################################################
1269##################################### A Utility Function ###################################
1270## This program returns a representation of a perfect group $G$ with abelian
1271## $Soc(G/Z(G))$. This function calls the following three functions:
1272## 1. ExtendedRepresentationNormal3
1273## 2. InducedSubgroupRepresentation3
1274## 3. GallagherRepsn
1275##
1276
1277 InstallGlobalFunction( SocleMoreComponents,
1278 function( G, chi, S )
1279 local Ug, U, R, C, m, I, t, Rc, Cc, h, P;
1280 Ug := GeneratorsOfGroup( G );;
1281 U := ShallowCopy( Ug );;
1282 R := RestrictedClassFunction( chi , S );;
1283 C := ConstituentsOfCharacter( R );;
1284 m := MatScalarProducts( C, [ R ] );
1285 ######### if \chi_S is irreducible #########
1286 if IsIrreducibleCharacter( R ) then
1287    return ExtendedRepresentationNormal( chi, IrreducibleAffordingRepresentation( R ) );
1288 fi;
1289 ######### if \chi is imprimitive #########
1290 if Length( C ) > 1 then
1291   I := InertiaSubgroup( G, C[1] );
1292   R := RestrictedClassFunction( chi, I );
1293   C := ConstituentsOfCharacter( R );
1294   for t in C do
1295     Rc := RestrictedClassFunction( t, S );
1296     Cc := ConstituentsOfCharacter( Rc );
1297     if C[1] in Cc then
1298        return InducedSubgroupRepresentation( G, IrreducibleAffordingRepresentation( t ));;
1299     fi;
1300   od;
1301 fi;
1302 h := NaturalHomomorphismByNormalSubgroup( G, S );
1303 ######### if \chi_F=e*\theta for e in [ 2, 3] #########
1304 if Length( C ) = 1  and m[1][1] in [ 2, 3 ] then
1305    P := PreImage( h , SylowSubgroup( Image(h), m[1][1] ) );
1306    R := RestrictedClassFunction( chi , P );
1307    if IsIrreducibleCharacter( R ) then
1308       return ExtendedRepresentation( chi, IrreducibleAffordingRepresentation( R ) );
1309    fi;
1310 else
1311    return GallagherRepsn( G, chi, h, S, C, m, U );
1312 fi;
1313 end );
1314
1315
1316############################################################################################
1317############################################################################################
1318##################################### A Utility Function ###################################
1319## This program returns a representation of a perfect group $G$.
1320##
1321
1322 InstallGlobalFunction( PerfectRepresentation,
1323 function( arg )
1324 local  G, chi, hom, n, a, r, s, S, c, C, i, R, l, L, M, Co, cl, so, N, x, I, t, Ri, Ci, Rc, Cc, run, ls, j, k, A;
1325 G := arg[1];
1326 chi := arg[2];
1327 hom := NaturalHomomorphismByNormalSubgroup( G, Centre( G ) );
1328 L := [ ]; M := [ ];
1329 n := MinimalNormalSubgroups( Image(hom) );;
1330 a := Filtered( n, IsAbelian );
1331 ## First program checks to find an abelian normal subgroup N not < Z(G).
1332 if a=n then
1333   cl := List( ConjugacyClasses( G ), Representative );
1334   so := Difference( cl, Centre( G) );
1335   for x in so do
1336      N := NormalClosure( G, Group( x ) );
1337      if IsAbelian(N) then
1338         R := RestrictedClassFunction( chi , N );
1339         C := ConstituentsOfCharacter( R );
1340         I := InertiaSubgroup( G, C[1] );
1341         Ri := RestrictedClassFunction( chi, I );
1342         Ci := ConstituentsOfCharacter( Ri );
1343         for t in Ci do
1344           Rc := RestrictedClassFunction( t, N );
1345           Cc := ConstituentsOfCharacter( Rc );
1346           if C[1] in Cc then
1347              Info( InfoWarning, 1, " the given character of degree ", chi[1], " is imprimitive" );
1348              return InducedSubgroupRepresentation( G, IrreducibleAffordingRepresentation( t ));;
1349           fi;
1350         od;
1351      fi;
1352   od;
1353   return PerfectAbelianSocleRepresentation( G, chi );
1354   else S := Difference( n, a );
1355 ## S is the non-abelian part of the soc(G/Z) which is the direct product of simple groups
1356 ## if Length( S ) = 1 then G is a central cover of a simple group and we use Dixon's method
1357   if Length( arg ) = 3 and Length( S ) = 1 and arg[3] = 1 then
1358       return true;
1359   fi;
1360 ## if Length( S ) >= 5 then we apply Gallaghe's method.
1361 ## For checking the components of S we only use the size of these components.
1362   ls := List(S,Size);
1363   A := 0;
1364   Sort(ls);
1365   for k in [1..Length(ls)] do
1366      if ls[k] > A then
1367         A:=ls[k];
1368         j := 0;
1369      fi;
1370      j:=j+1;
1371      if j > 4 then;
1372         return  SocleMoreComponents( G, chi, S );
1373      fi;
1374   od;
1375 ## if Length( S ) > 1 then, if number of isomorphic components of S is <= 5 then we use
1376 ## the Tensor Product method.
1377   for s in S do
1378      Append( M, GeneratorsOfGroup( s ) );
1379   od;
1380   c := Centralizer( Image( hom ), Group( M ) );
1381   if Size(c) > 1 then Add( S, c ); fi;
1382   S := List( S, i -> PreImage( hom, i ) );
1383   Co := [ () ];
1384   for i in [ 1..Length( S ) ] do
1385      R := RestrictedClassFunction( chi, S[i] );
1386      C := ConstituentsOfCharacter( R );
1387      r := CharacterSubgroupRepresentation( C[1] );
1388      Add( L, GeneratorsOfGroup( Image( r ) ) );
1389      Co := Concatenation(List( Co, u->u*GeneratorsOfGroup( S[i] ) ) );
1390   od;
1391   if Length(L) = 1 then return r;
1392   fi;
1393   r := L[1];
1394   for i in [ 2..Length( L ) ] do
1395     r := Concatenation( List( r, u -> List( L[i] , v -> KroneckerProduct( u, v ) ) ) );
1396   od;
1397 fi;
1398 if arg[3] <> 1 then
1399 M := arg[3];
1400 for i in [1..Length(M)] do
1401    if Size(G) = M[i][1]  and Size(Centre(G)) = M[i][2] and chi[1] = M[i][3] and IsSimple( Image(hom) ) then
1402          if Length[ M[i] ] = 5 then run := M[i][4]( G, chi, M[i][5], hom ); fi;
1403          if Length[ M[i] ] = 4 then run := M[i][4]( chi, hom ); fi;
1404        return run;
1405    fi;
1406 od;
1407 fi;
1408 return GroupHomomorphismByImagesNC( G, Group( r ), Co, r );
1409 end );
1410