# Affine Kac–Moody Lie Algebras

For affine Lie algebras there exists a well-known explicit construction of these in terms of an underlying finite-dimensional Lie algebra and a central extension (see [[Kac, 1990](../../references.md#cite-kac90)] (Chapters 7,8)). We briefly reiterate the construction here. Suppose $A$ is an affine Cartan matrix, so that $\frak{g}(A)$ is an affine Lie algebra; then $A$ is of affine Cartan type X̃$_n$ for X$=$A,B,C,D,E,F, or G, and some $n$. If we let $\frak{g}_0$ be the finite variant (i.e., a Lie algebra of Cartan type X$_n$) then

$$
\frak{g}(A) \cong \frak{g}_0 \otimes {\bf C}[t, t^{-1}] \oplus {\bf C}c \oplus {\bf C}d
$$

for some formal basis elements $c$ and $d$, where ${\bf C}[t, t^{-1}]$ is the ring of Laurent polynomials over ${\bf C}$. In Magma we represent affine Lie algebras and their elements using the form on the right hand side.

Multiplication is given by $[t^k \otimes x \oplus \lambda c \oplus \mu d, t^{k_1} \otimes y \oplus \lambda_1 c \oplus \mu_1 d] =$$$(t^{k+k_1} \otimes [x,y] + \mu k_1 t^{k_1} \otimes y - \mu_1 k t^k \otimes x ) \oplus k \delta_{k,-k_1} (x|y) c,$$

where $(x|y)$ denotes a fixed non-degenerate invariant symmetric bilinear ${\bf C}$-valued form on $\frak{g}_0$.

If we fix $E_i$, $F_i$ to be canonical generators of $g_0$, then the canonical generators of $\frak{g}(A)$, as described in the introduction ([Introduction](introduction.md#sectalgliekmintro)) are given by $e_0 = t \otimes E_0$, $f_0 = t^{-1} \otimes F_0$, and $e_i = 1 \otimes E_i$, $f_i = 1 \otimes F_i$, for $i = 1, \ldots, l$, where $l$ is the rank of the Cartan matrix.

Affine Lie algebras and their elements are of type `AlgKac` and `AlgKacElt` respectively.

## Constructing Affine Kac–Moody Lie Algebras

### `AffineLieAlgebra(N, F): MonStgElt, Fld -> AlgKac`

Construct the affine Kac–Moody Lie algebra of type N over the field $F$. N should be a string describing an affine Cartan type (e.g. `A~3`). See Section [Finite and Affine Coxeter Groups](../CoxeterSystems/finiteaffine.md#sectcartanfinaff) for more information on the conventions, syntax, and functions for creating and working with affine Cartan matrices.

### `AffineLieAlgebra(C, F): AlgMatElt, Fld -> AlgKac`

Construct the affine Kac–Moody Lie algebra with affine Cartan matrix $C$ over the field $F$.

### `Example: construct (ex-055fd7)`

We demonstrate the construction functions.

```magma
> L := AffineLieAlgebra("G~2", Rationals());
> L;
Affine Kac--Moody Lie algebra over Rational Field
> C := Matrix(Integers(),3,3,[2,-1,-1,-1,2,-1,-1,-1,2]);
> CartanName(C);
A~2
> L := AffineLieAlgebra(C, Rationals());
> L;
Affine Kac--Moody Lie algebra over Rational Field

```

## Properties of Affine Kac–Moody Lie Algebras

### `CartanMatrix(L): AlgKac -> AlgMatElt`

The Cartan matrix of $L$.

### `CartanName(L): AlgKac -> MonStgElt`

The Cartan type of $L$.

### `Dimension(L): AlgKac -> Infty`

Infinity.

### `CoefficientRing(L): AlgKac -> Rng`

### `BaseRing(L): AlgKac -> Rng`

The coefficient ring of $L$.

### `FiniteLieAlgebra(L): AlgKac -> AlgLie`

The Lie algebra $\frak{g}_0$ underlying $L$ (see the Introduction, Section [Introduction](introduction.md#sectalgliekmintro)).

### `LaurentSeriesRing(L): AlgKac -> RngSerLaur`

The Laurent series ring ${\bf C}[t, t^{-1}]$ underlying $L$ (see the Introduction, Section [Introduction](introduction.md#sectalgliekmintro)).

### `StandardGenerators(L): AlgKac -> SeqEnum[AlgKacElt], SeqEnum[AlgKacElt], SeqEnum[AlgKacElt]`

The standard generators of $L$. These are returned as three sequences, the first containing the $e_i$, the second containing the $f_i$, and the last containing the $h_i$. Note that the root usually labeled “0” occurs as the last element of each of these sequences.

### `Example: construct (ex-17cbd6)`

We demonstrate some properties of affine Lie algebras.

```magma
> L := AffineLieAlgebra("A~2", Rationals());
> L;
Affine Kac--Moody Lie algebra over Rational Field
> Lf := FiniteLieAlgebra(L);
> Lf;
Lie Algebra of dimension 8 with base ring Rational Field
> SemisimpleType(Lf);
A2
> e,f,h := StandardGenerators(L);
> e;
[ (0 0 0 0 0 1 0 0), (0 0 0 0 0 0 1 0), (t)*(1 0 0 0 0 0 0 0) ]
> F<e1,e2,e0,f1,f2,f0> := FreeLieAlgebra(Rationals(), 6);
> phi := hom<F -> L | e cat f>;
> phi(e1);
(0 0 0 0 0 1 0 0)
> phi(e1*e0) eq phi(e1)*phi(e0);
true

```

## Constructing Elements of Affine Kac–Moody Lie Algebras

### `L . i: AlgKac, RngIntElt -> AlgKacElt`

The $i$-th basis element of the finite dimensional Lie algebra underlying $L$, as an element of $L$.

### `HasAttribute(L, "c"): AlgKac, MonStgElt -> BoolElt, AlgKacElt`

### `HasAttribute(L, "d"): AlgKac, MonStgElt -> BoolElt, AlgKacElt`

Return `true` and the basis element $c$ or $d$ of $L$, according to the second argument of `HasAttribute`.

### `elt<L | {<} [ {<} p₁, y₁ {>}, ... ], λ, μ {>} >: AlgKac, Tup -> AlgKacElt`

For a 3-tuple $t$ such that $t_1$ is a sequence of elements of ${\bf C}[t, t^{-1}] \times \frak{g}_0$, and $t_2$ and $t_3$ are elements of the coefficient ring of $L$, construct

$$
\sum_{(p,y) \in t_1} p \otimes y \oplus t_2 c \oplus t_3 d \in L.
$$

See [`EltTup`](#function-kmaff-elttup) below for the converse function.

## Properties of Elements of Affine Kac–Moody Lie Algebras

### `EltTup(x): AlgKacElt -> Tup`

The element $x$ of the affine Lie algebra $L$ as a three-tuple $t$ such that

$$
x = \sum_{(p,y) \in t_1} p \otimes y \oplus t_2 c \oplus t_3 d.
$$

The first entry, $t_1$, is a sequence of pairs $(p, y) \in {\bf C}[t, t^{-1}] \times \frak{g}_0$, $t_2$ is the coefficient of $c$ and $t_3$ is the coefficient of $d$.

### `IsZero(x): AlgKacElt -> BoolElt`

Whether $x$ is zero.

### `x eq y: AlgKacElt, AlgKacElt -> BoolElt`

Whether $x$ and $y$ are equal.

### `x + y: AlgKacElt, AlgKacElt -> AlgKacElt`

### `x - y: AlgKacElt, AlgKacElt -> AlgKacElt`

### `x * y: AlgKacElt, AlgKacElt -> AlgKacElt`

### `c * y: RngElt, AlgKacElt -> AlgKacElt`

Respectively the sum, difference, and multiplication of $x$ and $y$.

### `-x: AlgKacElt -> AlgKacElt`

The negation of $x$.

### `Example: construct (ex-1599ed)`

We perform various computations with elements of an affine Lie algebra.

```magma
> L<t> := AffineLieAlgebra("B~3", Rationals());
> Lf := FiniteLieAlgebra(L);
> e,f,h := StandardGenerators(L);
> E,F,H := StandardBasis(Lf);
> e[1] eq L!E[1];
true
> x := e[4];
> x;
(t)*(1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> EltTup(x);
<[
    <t, (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)>
], 0, 0>
> elt<L | EltTup(x) > eq x;
true
> y := elt<L | <[<t^2-t^-2, F[1]>,<-2,Lf.3>], -1/3, 1> >;
> y;
(-2)*(0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (-t^-2 + t^2)*(0 0
0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0) -1/3*c + d
> z := t^3*L.2 - 1/5*h[1] + 1/7*L`c-L`d;
> z;
(t^3)*(0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) + (2/5)*(0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0) (-1/5)*(0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0) + 1/7*c -1*d
> x*(y*z) + y*(z*x) + z*(x*y);
0

```
