This file is indexed.

/usr/share/gap/grp/basicprm.gi is in gap-libs 4r7p9-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
#############################################################################
##
#W  basicprm.gi                 GAP Library                      Frank Celler
##
##
#Y  Copyright (C)  1996,  Lehrstuhl D für Mathematik,  RWTH Aachen,  Germany
##
##  This file  contains the methods  for  the construction  of the basic perm
##  group types.
##


#############################################################################
##
#M  TrivialGroupCons( <IsPermGroup> )
##
InstallMethod( TrivialGroupCons,
    "perm group",
    [ IsPermGroup and IsFinite ],
    function( filter )
    filter:= Group( () );
    SetIsTrivial( filter, true );
    return filter;
    end );


#############################################################################
##
#M  AbelianGroupCons( <IsPermGroup>, <ints> )
##
InstallMethod( AbelianGroupCons,
    "perm group",
    true,
    [ IsPermGroup and IsFinite,
      IsList ],
    0,

function( filter, ints )
    local   grp,  grps;

    if not ForAll( ints, IsInt )  then
        Error( "<ints> must be a list of integers" );
    fi;
    if not ForAll( ints, x -> 0 < x )  then
        TryNextMethod();
    fi;

    grps := List( ints, x -> CyclicGroupCons( IsPermGroup, x ) );
    # the way a direct product is constructed guarantees the right
    # generators
    grp  := CallFuncList( DirectProduct, grps );
    SetSize( grp, Product(ints) );
    SetIsAbelian( grp, true );
    return grp;
end );


#############################################################################
##
#M  ElementaryAbelianGroupCons( <IsPermGroup>, <size> )
##
InstallMethod( ElementaryAbelianGroupCons, "perm group", true,
    [ IsPermGroup and IsFinite, IsPosInt ],
    0,function(filter,size)

    local G;

    if size = 1 or IsPrimePowerInt( size )  then
        G := AbelianGroup( filter, Factors(size) );
    else
        Error( "<n> must be a prime power" );
    fi;
    SetIsElementaryAbelian( G, true );
    return G;
end);


#############################################################################
##
#M  AlternatingGroupCons( <IsPermGroup>, <deg> )
##
InstallMethod( AlternatingGroupCons,
    "perm group with degree",
    true,
    [ IsPermGroup and IsFinite,
      IsInt],
    0,

function( filter, deg )
    if deg<0 then TryNextMethod();fi;
    return AlternatingGroupCons( IsPermGroup, [ 1 .. deg ] );
end );


#############################################################################
##
#M  AlternatingGroupCons( <IsPermGroup>, <dom> )
##
InstallOtherMethod( AlternatingGroupCons,
    "perm group with domain",
    true,
    [ IsPermGroup and IsFinite,
      IsDenseList ],
    0,

function( filter, dom )
    local   alt,  dl,  g,  l;

    dom := Set(dom);
    IsRange( dom );
    if Length(dom) < 3  then
        alt := GroupByGenerators( [], () );
        SetSize(           alt, 1 );
        SetMovedPoints(    alt, [] );
        SetNrMovedPoints(  alt, 0 );
        SetIsPerfectGroup( alt, true );
    else
        if Length(dom) mod 2 = 0  then
            dl := dom{[ 1 .. Length(dom)-1 ]};
        else
            dl := dom;
        fi;
        g := [ MappingPermListList( dl, Concatenation( dl{[2..Length(dl)]},
                 [dl[1]] ) ) ];
        if 3 < Length(dom)  then
            l := Length(dom);
            Add( g, (dom[l-2],dom[l-1],dom[l]) );
        fi;
        alt := GroupByGenerators(g);
	if Length(dom)<5000 then
	  SetSize( alt, Factorial(Length(dom))/2 );
	fi;
        SetMovedPoints( alt, dom );
        SetNrMovedPoints( alt, Length(dom) );
        if 4 < Length(dom)  then
            SetIsSimpleGroup(  alt, true );
            SetIsPerfectGroup( alt, true );
        elif 2 < Length(dom)  then
            SetIsPerfectGroup( alt, false );
        fi;
        SetIsPrimitiveAffine( alt, Length( dom ) < 5 );
    fi;
    SetIsAlternatingGroup( alt, true );
    SetIsNaturalAlternatingGroup( alt, true );
    return alt;
end );

#############################################################################
##
#M  AlternatingGroupCons( <IsPermGroup and IsRegular>, <deg> )
##
InstallMethod( AlternatingGroupCons,
    "regular perm group with degree",
    true,
    [ IsPermGroup and IsRegular and IsFinite,
      IsInt],
    0,

function( filter, deg )
    if deg<0 then TryNextMethod();fi;
    return AlternatingGroupCons( IsPermGroup and IsRegular,
                                 [ 1 .. deg ] );
end );


#############################################################################
##
#M  AlternatingGroupCons( <IsPermGroup and IsRegular>, <dom> )
##
InstallOtherMethod( AlternatingGroupCons,
    "regular perm group with domain",
    true,
    [ IsPermGroup and IsRegular and IsFinite,
      IsDenseList ],
    0,

function( filter, dom )
    local   alt;

    alt := AlternatingGroupCons( IsPermGroup, dom );
    alt := Action( alt, AsList(alt), OnRight );
    SetIsAlternatingGroup( alt, true );
    return alt;
end );


#############################################################################
##
#M  CyclicGroupCons( <IsPermGroup and IsRegular>, <n> )
##
InstallMethod( CyclicGroupCons,
    "regular perm group",
    true,
    [ IsPermGroup and IsRegular and IsFinite,
      IsInt and IsPosRat ],
    0,

function( filter, n )
    local   g, c;

    g := PermList( Concatenation( [2..n], [1] ) );
    c := GroupByGenerators( [g] );    
    SetSize( c, n );
    SetIsCyclic( c, true );
    if n > 1 then
        SetMinimalGeneratingSet (c, [g]);
    else
        SetMinimalGeneratingSet (c, []);
    fi;
    return c;
end );


#############################################################################
##
#M  DihedralGroupCons( <IsPermGroup>, <2n> )
##
InstallMethod( DihedralGroupCons,
    "perm. group",
    true,
    [ IsPermGroup, IsPosInt ], 0,
    function( filter, 2n )

    local D, g, h;
    if 2n = 2 then
      D:= GroupByGenerators( [ (1,2) ] );
    elif 2n = 4 then
      D := GroupByGenerators( [ (1,2), (3,4) ] );
    elif 2n mod 2 = 1 then
      Error( "<2n> must be an even integer" );
    else
      g:= PermList( Concatenation( [ 2 .. 2n/2 ], [ 1 ] ) );
      h:= PermList( Concatenation( [ 1 ], Reversed( [ 2 .. 2n/2 ] ) ) );
      D:= GroupByGenerators( [ g, h ] );
    fi;
    return D;
    end );

#############################################################################
##
#M  QuaternionGroupCons( <IsPermGroup>, <4n> )
##
InstallMethod( QuaternionGroupCons,
    "perm. group",
    true,
    [ IsPermGroup, IsPosInt ], 0,
function( filter, n )
  local y, z, x;
  if 0 <> n mod 4 then TryNextMethod(); fi;
  y := PermList( Concatenation( [2..n/2], [1], [n/2+2..n], [n/2+1] ) );
  x := PermList( Concatenation( Cycle( y^-1, [n/2+1..n], n/2+1 ), Cycle( y^-1, [1..n/2], n/4+1 ) ) );
  return Group(x,y);
end );


#############################################################################
##
#M  MathieuGroupCons( <IsPermGroup>, <degree> )
##
##  The returned permutation groups are compatible only in the following way.
##  $M_{23}$ is the stabilizer of the point $24$ in $M_{24}$.
##  $M_{21}$ is the stabilizer of the point $22$ in $M_{22}$.
##  $M_{11}$ is the stabilizer of the point $12$ in $M_{12}$.
##  $M_{10}$ is the stabilizer of the point $11$ in $M_{11}$.
##  $M_{9}$ is the stabilizer of the point $10$ in $M_{10}$.
##
InstallMethod( MathieuGroupCons,
    "perm group with degree",
    [ IsPermGroup and IsFinite, IsPosInt ],
    function( filter, degree )
    local M;

    # degree 9, base 1 2, indices 9 8
    if degree = 9  then
      M:= Group(
            (1,4,9,8)(2,5,3,6),
            (1,6,5,2)(3,7,9,8) );
      SetSize( M, 72 );

    # degree 10, base 1 2 3, indices 10 9 8
    elif degree = 10  then
      M:= Group(
            (1,9,6,7,5)(2,10,3,8,4),
            (1,10,7,8)(2,9,4,6) );
      SetSize( M, 720 );

    # degree 11, base 1 2 3 4, indices 11 10 9 8
    elif degree = 11  then
      M:= Group(
            (1,2,3,4,5,6,7,8,9,10,11),
            (3,7,11,8)(4,10,5,6) );
      SetSize( M, 7920 );
      SetIsSimpleGroup( M, true );

    # degree 12, base 1 2 3 4 5, indices 12 11 10 9 8
    elif degree = 12  then
      M:= Group(
            (1,2,3,4,5,6,7,8,9,10,11),
            (3,7,11,8)(4,10,5,6),
            (1,12)(2,11)(3,6)(4,8)(5,9)(7,10) );
      SetSize( M, 95040 );
      SetIsSimpleGroup( M, true );

    # degree 21, base 1 2 3 4, indices 21 20 16 3
    elif degree = 21  then
      M:= Group(
             (1,4,5,9,3)(2,8,10,7,6)(12,15,16,20,14)(13,19,21,18,17),
             (1,21,5,12,20)(2,16,3,4,17)(6,18,7,19,15)(8,13,9,14,11) );
      SetSize( M, 20160 );
      SetIsSimpleGroup( M, true );

    # degree 22, base 1 2 3 4 5, indices 22 21 20 16 3
    elif degree = 22  then
      M:= Group(
            (1,2,3,4,5,6,7,8,9,10,11)(12,13,14,15,16,17,18,19,20,21,22),
            (1,4,5,9,3)(2,8,10,7,6)(12,15,16,20,14)(13,19,21,18,17),
            (1,21)(2,10,8,6)(3,13,4,17)(5,19,9,18)(11,22)(12,14,16,20) );
      SetSize( M, 443520 );
      SetIsSimpleGroup( M, true );

    # degree 23, base 1 2 3 4 5 6, indices 23 22 21 20 16 3
    elif degree = 23  then
      M:= Group(
            (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23),
            (3,17,10,7,9)(4,13,14,19,5)(8,18,11,12,23)(15,20,22,21,16) );
      SetSize( M, 10200960 );
      SetIsSimpleGroup( M, true );

    # degree 24, base 1 2 3 4 5 6 7, indices 24 23 22 21 20 16 3
    elif degree = 24  then
      M:= Group(
            (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23),
            (3,17,10,7,9)(4,13,14,19,5)(8,18,11,12,23)(15,20,22,21,16),
            (1,24)(2,23)(3,12)(4,16)(5,18)(6,10)(7,20)(8,14)(9,21)(11,17)
            (13,22)(19,15) );
      SetSize( M, 244823040 );
      SetIsSimpleGroup( M, true );

    # error
    else
        Error("degree <d> must be 9, 10, 11, 12, 21, 22, 23, or 24" );
    fi;

    return M;
    end );


#############################################################################
##
#M  SymmetricGroupCons( <IsPermGroup>, <deg> )
##
InstallMethod( SymmetricGroupCons,
    "perm group with degree",
    true,
    [ IsPermGroup and IsFinite,
      IsInt ],
    0,

function( filter, deg )
    if deg<0 then TryNextMethod();fi;
    return SymmetricGroupCons( IsPermGroup, [ 1 .. deg ] );
end );


#############################################################################
##
#M  SymmetricGroupCons( <IsPermGroup>, <dom> )
##
InstallOtherMethod( SymmetricGroupCons,
    "perm group with domain",
    true,
    [ IsPermGroup and IsFinite,
      IsDenseList ],
    0,

function( filters, dom )
    local   sym,  g;
    
    dom := Set(dom);
    IsRange( dom );
    if Length(dom) < 2  then
        sym := GroupByGenerators( [], () );
        SetSize(           sym, 1 );
        SetMovedPoints(    sym, [] );
        SetNrMovedPoints(  sym, 0 );
        SetIsPerfectGroup( sym, true );
    else
        g := [ MappingPermListList( dom, Concatenation( 
                 dom{[2..Length(dom)]}, [ dom[1] ] ) ) ];
        if 2 < Length(dom)  then
            Add( g, ( dom[1], dom[2] ) );
        fi;
        sym := GroupByGenerators( g );
	if Length(dom)<5000 then
	  SetSize( sym, Factorial(Length(dom)) );
	fi;
        SetMovedPoints(   sym, dom );
        SetNrMovedPoints( sym, Length(dom) );
    fi;
    SetIsPrimitiveAffine( sym, Length( dom ) < 5 );
    SetIsSymmetricGroup( sym, true );
    SetIsNaturalSymmetricGroup( sym, true );
    return sym;
end );


#############################################################################
##
#M  SymmetricGroupCons( <IsPermGroup and IsRegular>, <deg> )
##
InstallMethod( SymmetricGroupCons,
    "regular perm group with degree",
    true,
    [ IsPermGroup and IsRegular and IsFinite,
      IsInt],
    0,

function( filter, deg )
    if deg<0 then TryNextMethod();fi;
    return SymmetricGroupCons( IsPermGroup and IsRegular,
                               [ 1 .. deg ] );
end );


#############################################################################
##
#M  SymmetricGroupCons( <IsPermGroup and IsRegular>, <dom> )
##
InstallOtherMethod( SymmetricGroupCons,
    "regular perm group with domain",
    true,
    [ IsPermGroup and IsRegular and IsFinite,
      IsDenseList ],
    0,

function( filter, dom )
    local   alt;

    alt := SymmetricGroupCons( IsPermGroup, dom );
    alt := Action( alt, AsList(alt), OnRight );
    SetIsSymmetricGroup( alt, true );
    return alt;
end );


#############################################################################
##
#E