> < ^ Date: Thu, 09 Nov 2000 17:16:08 +0100 (MET)
> < ^ From: Willem de Graaf <degraaf@math.uu.nl >
< ^ Subject: Universal Enveloping Algebra

Dear Jan,

respect to different bases of the underlying Lie algebra. I think that
changing the code a little for that is not such a bad idea. Below
I append a version that accepts a basis as a second argument (the
one argument version will still work after this has bean read in).
With this the following is possible:

```gap> L:= SimpleLieAlgebra("A",1,Rationals);
<Lie algebra of dimension 3 over Rationals>
gap> b:= Basis(L);
CanonicalBasis( <Lie algebra of dimension 3 over Rationals> )
gap> vv:= [ b, b+b, b+b ];
[ v.1, v.1+v.2, v.2+v.3 ]
gap> b1:= Basis(L, vv );
Basis( <Lie algebra of dimension 3 over Rationals>, [ v.1, v.1+v.2, v.2+v.3
] )
gap> u:= UniversalEnvelopingAlgebra( L, b1 );
<algebra-with-one of dimension infinity over Rationals>
gap> g:= GeneratorsOfAlgebraWithOne( u );
[ [(1)*x.1], [(1)*x.2], [(1)*x.3] ]
gap> g*g;
[(-1)*x.1+(1)*x.1*x.2+(1)*x.2+(-1)*x.3]  # i.e., the basis `b1' is used
gap> UniversalEnvelopingAlgebra(L);
<algebra-with-one of dimension infinity over Rationals>
```

Best wishes,

Willem

```#############################################################################
##
#M  UniversalEnvelopingAlgebra( <L>, <B> )
##
InstallOtherMethod( UniversalEnvelopingAlgebra,
"for a finite dimensional Lie algebra and a basis of it",
true,
[ IsLieAlgebra, IsBasis ], 0,
function( L, B )
```
```local F,          # free associative algebra
U,          # universal enveloping algebra, result
gen,        # loop over algebra generators of `U'
Fam,        # elements family of `U'
T,          # s.c. table of a basis of `L'
FamMon,     # family of monomials
FamFree;    # elements family of `F'
```

# Check the argument.
if not IsFiniteDimensional( L ) then
Error( "<L> must be finite dimensional" );
fi;

# Construct the universal enveloping algebra.
F:= FreeAssociativeAlgebraWithOne( LeftActingDomain( L ),
Dimension( L ), "x" );
U:= FactorFreeAlgebraByRelators( F, [ Zero( F ) ] );

SetDimension( U, infinity );
for gen in GeneratorsOfLeftOperatorRingWithOne( U ) do
SetIsNormalForm( gen, true );
od;
SetIsNormalForm( Zero( U ), true );

```# Enter data to handle elements.
Fam:= ElementsFamily( FamilyObj( U ) );
Fam!.normalizedType:= NewType( Fam,
IsElementOfFpAlgebra
and IsPackedElementDefaultRep
and IsNormalForm );
```

T:= StructureConstantsTable( B );
FamMon:= ElementsFamily( FamilyObj( UnderlyingMagma( F ) ) );
FamFree:= ElementsFamily( FamilyObj( F ) );

```SetNiceNormalFormByExtRepFunction( Fam,
function( Fam, extrep )
local zero, i;
zero:= extrep;
extrep:= DescriptionOfNormalizedUEAElement( T, extrep );
for i in [ 1, 3 .. Length( extrep ) - 1 ] do
extrep[i]:= ObjByExtRep( FamMon, extrep[i] );
od;
return Objectify( Fam!.normalizedType,
[ Objectify( FamFree!.defaultType, [ zero, extrep ] ) ] );
end );
```

SetOne( U, ElementOfFpAlgebra( Fam, One( F ) ) );

# Enter `L'; it is used to set up the embedding (as a vector space).
Fam!.liealgebra:= L;
#T is not allowed ...

# Return the universal enveloping algebra.
return U;
end );