This file is indexed.

/usr/share/gap/lib/liefam.gi is in gap-libs 4r8p8-3.

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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
#############################################################################
##
#W  liefam.gi                   GAP library                     Thomas Breuer
##
##
#Y  Copyright (C)  1997,  Lehrstuhl D für Mathematik,  RWTH Aachen,  Germany
#Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland
#Y  Copyright (C) 2002 The GAP Group
##
##  1. general methods for Lie elements
##  2. methods for free left modules of Lie elements
##     (there are special methods for Lie matrix spaces)
##  3. methods for FLMLORs (and ideals) of Lie elements
##     (there are special methods for Lie matrix spaces)
##


#############################################################################
##
##  1. general methods for Lie elements
##

#############################################################################
##
#M  LieFamily( <Fam> )
##
##  We need to distinguish families of arbitrary ring elements and families
##  that contain matrices,
##  since in the latter case the Lie elements shall also be matrices.
##  Note that matrices cannot be detected from their family,
##  so we decide that the Lie family of a collections family will consist
##  of Lie matrices.
##
InstallMethod( LieFamily,
    "for family of ring elements",
    true,
    [ IsRingElementFamily ], 0,
    function( Fam )

    local F, filt;

    if HasCharacteristic(Fam) and Characteristic(Fam)>0 then
        filt := IsRestrictedLieObject;
    else
        filt := IsLieObject;
    fi;

    # Make the family of Lie elements.
    F:= NewFamily( "LieFamily(...)", filt,CanEasilySortElements,
				     CanEasilySortElements);
    SetUnderlyingFamily( F, Fam );

    if HasCharacteristic( Fam ) then
      SetCharacteristic( F, Characteristic( Fam ) );
    fi;
#T maintain other req/imp properties as implied properties of `F'?

    # Enter the type of objects in the image.
    F!.packedType:= NewType( F, filt and IsPackedElementDefaultRep );

    # Return the Lie family.
    return F;
    end );

InstallMethod( LieFamily,
    "for a collections family (special case of Lie matrices)",
    true,
    [ IsCollectionFamily ], 0,
    function( Fam )

    local F, filt;

    if HasCharacteristic(Fam) and Characteristic(Fam)>0 then
        filt := IsRestrictedLieObject;
    else
        filt := IsLieObject;
    fi;

    # Make the family of Lie elements.
    F:= NewFamily( "LieFamily(...)", filt and IsMatrix );
    SetUnderlyingFamily( F, Fam );

    if HasCharacteristic( Fam ) then
      SetCharacteristic( F, Characteristic( Fam ) );
    fi;
#T maintain other req/imp properties as implied properties of `F'?

    # Enter the type of objects in the image.
    F!.packedType:= NewType( F, filt
                                and IsPackedElementDefaultRep
                                and IsLieMatrix );

    # Return the Lie family.
    return F;
    end );


#############################################################################
##
#M  LieObject( <obj> )  . . . . . . . . . . . . . . . . .  for a ring element
##
InstallMethod( LieObject,
    "for a ring element",
    true,
    [ IsRingElement ], 0,
    obj -> Objectify( LieFamily( FamilyObj( obj ) )!.packedType,
                      [ Immutable( obj ) ] ) );


#############################################################################
##
#M  UnderlyingRingElement( <obj> )  . . . . . . . . . . . .   for a Lie object
##
InstallMethod( UnderlyingRingElement,
    "for a Lie object in default representation",
    true,
    [ IsLieObject and IsPackedElementDefaultRep], 0,
    obj -> obj![1] );


#############################################################################
##
#M  PrintObj( <obj> ) . . . . . . . . . . . . . . . . . . .  for a Lie object
##
InstallMethod( PrintObj,
    "for a Lie object in default representation",
    true,
    [ IsLieObject and IsPackedElementDefaultRep ], SUM_FLAGS,
    function( obj )
    Print( "LieObject( ", obj![1], " )" );
    end );


#############################################################################
##
#M  ViewObj( <obj> )  . . . . . . . . . . . . . . . . . . .  for a Lie matrix
##
##  For Lie matrices, we want to override the special `ViewObj' method for
##  lists.
##
InstallMethod( ViewObj,
    "for a Lie matrix in default representation",
    true,
    [ IsLieMatrix and IsPackedElementDefaultRep ], SUM_FLAGS,
    function( obj )
    Print( "LieObject( " ); View( obj![1] ); Print(  " )" );
    end );


#############################################################################
##
#M  \=( <x>, <y> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
#M  \<( <x>, <y> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
##
InstallMethod( \=,
    "for two Lie objects in default representation",
    IsIdenticalObj,
    [ IsLieObject and IsPackedElementDefaultRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y ) return x![1] = y![1]; end );

InstallMethod( \<,
    "for two Lie objects in default representation",
    IsIdenticalObj,
    [ IsLieObject and IsPackedElementDefaultRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y ) return x![1] < y![1]; end );


#############################################################################
##
#M  \+( <x>, <y> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
#M  \-( <x>, <y> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
#M  \*( <x>, <y> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
#M  \^( <x>, <n> )  . . . . . . . . . . . . . . . . . . . for two Lie objects
##
##  The addition, subtraction, and multiplication of Lie objects is obvious.
##  If only one operand is a Lie object then we suspect that the operation
##  for the unpacked object is defined, and that the Lie object shall behave
##  as the unpacked object.
##
InstallMethod( \+,
    "for two Lie objects in default representation",
    IsIdenticalObj,
    [ IsLieObject and IsPackedElementDefaultRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y ) return LieObject( x![1] + y![1] ); end );

InstallMethod( \+,
    "for Lie object in default representation, and ring element",
    true,
    [ IsLieObject and IsPackedElementDefaultRep, IsRingElement ], 0,
    function( x, y )
    local z;
    z:= x![1] + y;
    if IsFamLieFam( FamilyObj( z ), FamilyObj( x ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \+,
    "for ring element, and Lie object in default representation",
    true,
    [ IsRingElement, IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y )
    local z;
    z:= x + y![1];
    if IsFamLieFam( FamilyObj( z ), FamilyObj( x ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \-,
    "for two Lie objects in default representation",
    IsIdenticalObj,
    [ IsLieObject and IsPackedElementDefaultRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y ) return LieObject( x![1] - y![1] ); end );

InstallMethod( \-,
    "for Lie object in default representation, and ring element",
    true,
    [ IsLieObject and IsPackedElementDefaultRep, IsRingElement ], 0,
    function( x, y )
    local z;
    z:= x![1] - y;
    if IsFamLieFam( FamilyObj( z ), FamilyObj( x ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \-,
    "for ring element, and Lie object in default representation",
    true,
    [ IsRingElement, IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y )
    local z;
    z:= x - y![1];
    if IsFamLieFam( FamilyObj( z ), FamilyObj( x ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \*,
    "for two Lie objects in default representation",
    IsIdenticalObj,
    [ IsLieObject and IsPackedElementDefaultRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y ) return LieObject( LieBracket( x![1], y![1] ) ); end );

InstallMethod( \*,
    "for Lie object in default representation, and ring element",
    true,
    [ IsLieObject and IsPackedElementDefaultRep, IsRingElement ], 0,
    function( x, y )
    local z;
    z:= x![1] * y;
    if IsFamLieFam( FamilyObj( z ), FamilyObj( x ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \*,
    "for ring element, and Lie object in default representation",
    true,
    [ IsRingElement, IsLieObject and IsPackedElementDefaultRep ], 0,
    function( x, y )
    local z;
    z:= x * y![1];
    if IsFamLieFam( FamilyObj( z ), FamilyObj( y ) ) then
      return LieObject( z );
    else
      TryNextMethod();
    fi;
    end );

InstallMethod( \^,
    "for Lie object in default representation, and positive integer",
    true,
    [ IsLieObject and IsPackedElementDefaultRep, IsPosInt ], 0,
    function( x, n )
    if 1 < n then
      return LieObject( Zero( x![1] ) );
    else
      return x;
    fi;
    end );

#############################################################################
##
#M  PthPowerImage( <lie_obj> ) . . . . . . . . .  for a restricted Lie object
##
InstallMethod(PthPowerImage, "for restricted Lie object",
	[ IsRestrictedLieObject ],
        function(x)
    return LieObject(x![1]^Characteristic(FamilyObj(x)));
end);
InstallMethod(PthPowerImage, "for restricted Lie object and integer",
	[ IsRestrictedLieObject, IsInt ],
        function(x,n)
    local y;
    y := x![1];
    while n>0 do
	y := y^Characteristic(FamilyObj(x));
	n := n-1;
    od;
    return LieObject(y);
end);

#############################################################################
##
#M  ZeroOp( <lie_obj> ) . . . . . . . . . . . . . . . . . .  for a Lie object
##
InstallMethod( ZeroOp,
    "for Lie object in default representation",
    true,
    [ IsLieObject and IsPackedElementDefaultRep ], SUM_FLAGS,
    x -> LieObject( Zero( x![1] ) ) );


#############################################################################
##
#M  OneOp( <lie_obj> )  . . . . . . . . . . . . . . . . . .  for a Lie object
##
InstallOtherMethod( OneOp,
    "for Lie object",
    true,
    [ IsLieObject ], 0,
    ReturnFail );


#############################################################################
##
#M  InverseOp( <lie_obj> )  . . . . . . . . . . . . . . . .  for a Lie object
##
InstallOtherMethod( InverseOp,
    "for Lie object",
    true,
    [ IsLieObject ], 0,
    ReturnFail );


#############################################################################
##
#M  AdditiveInverseOp( <lie_obj> )  . . . . . . . . . . . .  for a Lie object
##
InstallMethod( AdditiveInverseOp,
    "for Lie object in default representation",
    true,
    [ IsLieObject and IsPackedElementDefaultRep ], 0,
    x -> LieObject( - x![1] ) );


#############################################################################
##
#M  \[\]( <mat>, <i> )  . . . . . . . . . . . . . . . . . .  for a Lie matrix
#M  Length( <mat> )
#M  IsBound\[\]( <mat>, <i> )
#M  Position( <mat>, <obj> )
##
InstallMethod( \[\],
    "for Lie matrix in default representation, and positive integer",
    true,
    [ IsLieMatrix and IsPackedElementDefaultRep, IsPosInt ], 0,
    function( mat, i ) return mat![1][i]; end );

InstallMethod( Length,
    "for Lie matrix in default representation",
    true,
    [ IsLieMatrix and IsPackedElementDefaultRep ], 0,
    mat -> Length( mat![1] ) );

InstallMethod( IsBound\[\],
    "for Lie matrix in default representation, and integer",
    true,
    [ IsLieMatrix and IsPackedElementDefaultRep, IsPosInt ], 0,
    function( mat, i ) return IsBound( mat![1][i] ); end );

InstallMethod( Position,
    "for Lie matrix in default representation, row vector, and integer",
    true,
    [ IsLieMatrix and IsPackedElementDefaultRep, IsRowVector, IsInt ], 0,
    function( mat, v, pos ) return Position( mat![1], v, pos ); end );


#############################################################################
##
#R  IsLieEmbeddingRep( <map> )
##
##  representation of the embedding of a family into its Lie family
##
DeclareRepresentation( "IsLieEmbeddingRep", IsAttributeStoringRep,
    [ "packedType" ] );


#############################################################################
##
#M  Embedding( <Fam>, <LieFam> )
##
InstallOtherMethod( Embedding,
    "for two families, the first with known Lie family",
    true,
    [ IsFamily and HasLieFamily, IsFamily ], 0,
    function( Fam, LieFam )

    local emb;

    # Is this the right method?
    if not IsFamLieFam( Fam, LieFam ) then
      TryNextMethod();
    fi;

    # Make the mapping object.
    emb := Objectify( TypeOfDefaultGeneralMapping( Fam, LieFam,
                              IsLieEmbeddingRep
                          and IsNonSPGeneralMapping
                          and IsMapping
                          and IsInjective
                          and IsSurjective ),
                      rec() );

    # Enter preimage and image.
    SetPreImagesRange( emb, Fam    );
    SetImagesSource(   emb, LieFam );

    # Return the embedding.
    return emb;
    end );

InstallMethod( ImagesElm,
    "for Lie embedding and object",
    FamSourceEqFamElm,
    [ IsGeneralMapping and IsLieEmbeddingRep, IsObject ], 0,
    function( emb, elm )
    return [ LieObject( elm ) ];
    end );

InstallMethod( PreImagesElm,
    "for Lie embedding and Lie object in default representation",
    FamRangeEqFamElm,
    [ IsGeneralMapping and IsLieEmbeddingRep,
      IsLieObject and IsPackedElementDefaultRep ], 0,
    function( emb, elm )
    return [ elm![1] ];
    end );


#############################################################################
##
#M  IsUnit( <lie_obj> )
##
InstallOtherMethod( IsUnit,
    "for a Lie object (return `false')",
    true,
    [ IsLieObject ], 0,
    ReturnFalse );


#############################################################################
##
##  2. methods for free left modules of Lie elements
##
##  There are special methods for Lie matrix spaces, both Gaussian and
##  non-Gaussian (see ...).
##  Note that in principle the non-Gaussian Lie matrix spaces could be
##  handled via the generic methods for spaces of Lie elements,
##  but the special methods are more efficient; they avoid one indirection
##  by assigning a row vector to each Lie matrix.
##

#############################################################################
##
#M  MutableBasis( <R>, <lieelms> )
#M  MutableBasis( <R>, <lieelms>, <zero> )
##
##  In general, we choose a mutable basis that stores a mutable basis for a
##  nice module.
##
##  Note that the case of Lie matrices must *not* be treated by these methods
##  since the space may be Gaussian and thus handled in a completely
##  different way.
##
InstallMethod( MutableBasis,
    "for ring and collection of Lie elements",
    function( F1, F2 ) return not IsElmsCollLieColls( F1, F2 ); end,
    [ IsRing, IsLieObjectCollection ], 0,
    MutableBasisViaNiceMutableBasisMethod2 );

InstallOtherMethod( MutableBasis,
    "for ring, (possibly empty) list, and Lie zero",
    function( F1, F2, F3 ) return not IsElmsLieColls( F1, F3 ); end,
    [ IsRing, IsList, IsLieObject ], 0,
    MutableBasisViaNiceMutableBasisMethod3 );


#############################################################################
##
#M  NiceFreeLeftModuleInfo( <liemodule> )
#M  NiceVector( <M>, <lieelm> )
#M  UglyVector( <M>, <vector> ) .  for left module of Lie objects, and vector
##
InstallHandlingByNiceBasis( "IsLieObjectsModule", rec(
    # Note that the case of Lie matrices must *not* be treated by these
    # methods since the space may be Gaussian and thus handled in a
    # completely different way.
    detect := function( R, gens, V, zero )
      if not IsLieObjectCollection( V ) then
        return false;
      elif zero = false then
        return not IsElmsCollLieColls( FamilyObj( R ), FamilyObj( gens ) );
      else
        return not IsElmsLieColls( FamilyObj( R ), FamilyObj( zero ) );
      fi;
      end,

    NiceFreeLeftModuleInfo := ReturnFalse,

    NiceVector := function( M, lieelm )
      if IsPackedElementDefaultRep( lieelm ) then
        return lieelm![1];
      else
        TryNextMethod();
      fi;
      end,

    UglyVector := function( M, vector )
      return LieObject( vector );
      end ) );


#############################################################################
##
#M  TwoSidedIdealByGenerators( <L>, <elms> )
#M  LeftIdealByGenerators( <L>, <elms> )
#M  RightIdealByGenerators( <L>, <elms> )
##
##  For Lie algebras <L>, we construct two-sided ideals in all three cases.
##
IdealByGeneratorsForLieAlgebra := function( L, elms )
    local I, lad;

    I:= Objectify( NewType( FamilyObj( L ),
                                IsFLMLOR
                            and IsAttributeStoringRep
                            and IsLieAlgebra ),
                   rec() );

    lad:= LeftActingDomain( L );
    SetLeftActingDomain( I, lad );
    SetGeneratorsOfTwoSidedIdeal( I, elms );
    SetGeneratorsOfLeftIdeal( I, elms );
    SetGeneratorsOfRightIdeal( I, elms );
    SetLeftActingRingOfIdeal( I, L );
    SetRightActingRingOfIdeal( I, L );

    if IsEmpty( elms ) then
      SetIsTrivial( I, true );
    fi;

    CheckForHandlingByNiceBasis( lad, elms, I, false );
    return I;
end;

InstallMethod( TwoSidedIdealByGenerators,
    "for Lie algebra and collection of Lie objects",
    IsIdenticalObj,
    [ IsLieAlgebra, IsLieObjectCollection and IsList ], 0,
    IdealByGeneratorsForLieAlgebra );

InstallMethod( LeftIdealByGenerators,
    "for Lie algebra and collection of Lie objects",
    IsIdenticalObj,
    [ IsLieAlgebra, IsLieObjectCollection and IsList ], 0,
    IdealByGeneratorsForLieAlgebra );

InstallMethod( RightIdealByGenerators,
    "for Lie algebra and collection of Lie objects",
    IsIdenticalObj,
    [ IsLieAlgebra, IsLieObjectCollection and IsList ], 0,
    IdealByGeneratorsForLieAlgebra );

InstallMethod( TwoSidedIdealByGenerators,
    "for Lie algebra and empty list",
    true,
    [ IsLieAlgebra, IsList and IsEmpty ], 0,
    IdealByGeneratorsForLieAlgebra );

InstallMethod( LeftIdealByGenerators,
    "for Lie algebra and empty list",
    true,
    [ IsLieAlgebra, IsList and IsEmpty ], 0,
    IdealByGeneratorsForLieAlgebra );

InstallMethod( RightIdealByGenerators,
    "for Lie algebra and empty list",
    true,
    [ IsLieAlgebra, IsList and IsEmpty ], 0,
    IdealByGeneratorsForLieAlgebra );


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