---
title: "Handbook of Magma Functions, Part XIII: Lie Theory"
version: "2.30-1"
canonical: "https://docs.magma-maths.org/LieTheory/index-lie-theory.html"
---

# Lie Theory

- [Introduction to Lie Theory](https://docs.magma-maths.org/LieTheory/Introduction/index-introduction.md): Overview of Lie theory in Magma.
- [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md): Coxeter matrices, Coxeter graphs, Cartan matrices, and Dynkin diagrams.
- [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md): Root systems, Dynkin diagrams, and Cartan matrices.
- [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md): Root data, coroots, weights, and related constructions.
- [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md): Coxeter group constructors, word arithmetic, and Bruhat order.
- [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md): Real and complex reflection groups and their properties.
- [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md): Structure constants, subalgebras, ideals, and derivations.
- [Kac-Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/index-kac-moody-lie-algebras.md): Construction and structural invariants of Kac-Moody Lie algebras.
- [Quantum Groups](https://docs.magma-maths.org/LieTheory/QuantumGroups/index-quantum-groups.md): Quantized enveloping algebras, their representations, and Hopf structure.
- [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md): Groups of Lie type, Borel subgroups, and parabolic subgroups.
- [Representations of Lie Groups and Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/index-representations-of-lie-groups-and-algebras.md): Highest weight representations of Lie algebras and reductive algebraic groups.

<a id="lie-introduction"></a>
<a id="chaplieintro"></a>
## Introduction to Lie Theory

A number of structures from Lie theory and the theory of Coxeter groups can be handled by Magma. Specifically, facilities are provided for:

1. Coxeter matrices, Coxeter graphs, Cartan matrices, Dynkin diagrams, and Cartan’s naming system for Coxeter groups;
2. Finite root systems and finite root data;
3. Coxeter groups in three different formats: as finitely presented groups, as permutation groups, and as reflection groups;
4. Complex reflection groups;
5. Lie algebras, given as structure constant algebras, matrix algebras, or finitely generated algebras;
6. Groups of Lie type (connected reductive algebraic groups);
7. Representations of Lie algebras and groups of Lie type;
8. Universal enveloping algebras and Quantum groups.

- [Descriptions of Coxeter Groups](https://docs.magma-maths.org/LieTheory/Introduction/descriptions.md)
- [Root Systems and Root Data](https://docs.magma-maths.org/LieTheory/Introduction/descriptions-2.md)
- [Coxeter and Reflection Groups](https://docs.magma-maths.org/LieTheory/Introduction/groups.md)
- [Lie Algebras and Groups of Lie Type](https://docs.magma-maths.org/LieTheory/Introduction/descriptions-3.md)
- [Highest Weight Representations](https://docs.magma-maths.org/LieTheory/Introduction/descriptions-4.md)
- [Universal Enveloping Algebras and Quantum Groups](https://docs.magma-maths.org/LieTheory/Introduction/descriptions-5.md)
- [Bibliography](https://docs.magma-maths.org/LieTheory/Introduction/bibliography.md)

<a id="descriptions"></a>
<a id="sectlieintrodesc"></a>
### Descriptions of Coxeter Groups

A *Coxeter system* is a group $G$ with finite generating set $S=\{s_1,\dots,s_n\}$, defined by the power relations $s_i^2=1$ for $i=1,\dots,n$ and braid relations

$$
s_is_js_i\cdots = s_js_is_j\cdots
$$

for $i,j=1,\dots,n$ with $i<j$, where each side of this relation has length $m_{ij}\ge 2$. Although traditionally $m_{ij}=\infty$ signifies that the corresponding relation is omitted, for technical reasons, we use $m_{ij}=0$ instead. Set $m_{ji}=m_{ij}$ and $m_{ii}=1$. The group $G$ is called a *Coxeter group* and $S$ is called the set of *Coxeter generators*. Since every group in Magma has a preferred generating set, no distinction is made between a Coxeter system and its Coxeter group.

Due to the importance and ubiquity of Coxeter groups, a number of different ways of describing these groups and their reflections have been developed. Functions for manipulating these descriptions are described in Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan).

Coxeter groups are usually described by a *Coxeter matrix* $M=(m_{ij})_{i,j=1}^n$, or by a *Coxeter graph* with vertices $1,\dots,n$ and an edge connecting $i$ and $j$ labeled by $m_{ij}$ whenever $m_{ij}\ge 3$.

Coxeter systems are mainly important because they provide presentations for the real reflection groups. A *Cartan matrix* describes a particular reflection representation of a Coxeter group. In certain cases, such a representation can be described by an integer-labelled digraph, called the *Dynkin digraph* (this is equivalent to a *Dynkin diagram*, but we have modified the definition for technical reasons).

For finite and affine Coxeter groups, the naming system due to Cartan is also used. Hyperbolic Coxeter groups of degree larger than $3$ are numbered.

<a id="descriptions-2"></a>
<a id="sectlieintroroot"></a>
### Root Systems and Root Data

A (real) reflection is an automorphism of a real vector space that acts as negation on a one-dimensional subspace while fixing a hyperplane pointwise. The subspace is described by a vector called the *root*, while the hyperplane is described as the kernel of an element of the dual space called the *coroot*.

A root system is a collection of root/coroot pairs that is closed under the action of the corresponding reflections. Only finite root systems are supported at the present time. A root system gives a much more detailed description of a reflection representation of a finite Coxeter group.

Root systems are used to classify the *semisimple Lie algebras*. The closely related concept of a root datum is used to classify the *groups of Lie type*.

This is described in Chapters [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys) and [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm).

<a id="groups"></a>
<a id="sectlieintrogrpcox"></a>
### Coxeter and Reflection Groups

Three different methods are provided for computing with a Coxeter group: the Coxeter presentation, the permutation representation on roots, or a reflection representation.

For most purposes, the presentation will be the most useful of these descriptions. The standard normal form is used for elements (the lexicographically least word of minimal length). Robert Howlett has implemented his highly efficient method for normalising and multiplying elements, based on ideas from [[BH93](https://docs.magma-maths.org/references.md#cite-brinkhowlett93)].

If the Coxeter group is finite, it is often better to use the permutation representation. Note that elements are represented as permutations on the set of roots. This is not the minimal degree representation, but is more useful in many cases.

Finally, Coxeter groups can be represented as a reflection group over the reals (in practice over a number field, since the reals are not infinite precision). Although functions are provided for creating reflection groups over an arbitrary field, fewer facilities are available for such groups. In addition, functions are provided to construct all the finite *complex* reflection groups.

Efficient functions are provided for converting between these three forms of Coxeter group.

This is described in Chapters [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox) and [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="descriptions-3"></a>
<a id="sectlieintroalggrp"></a>
### Lie Algebras and Groups of Lie Type

Lie algebras can be constructed in three different ways in Magma: as structure constant algebras, as Lie matrix algebras, or as finitely presented algebras. Most of our functionality is for algebras of finite dimension over a field. Algorithms designed and implemented by de Graaf [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)] are available for determining the structure of a Lie algebra. In particular, if the algebra is reductive, its root system and its highest-weight representations can be determined.

We provide functionality for computing with groups of Lie type (i.e. reductive algebraic groups and their split (untwisted) groups, given by the Steinberg presentation. A canonical form for words in this group, and algorithms for computing with these words are given in [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps), [CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)]. Twisted groups are given by a modified version of this presentation using Galois cohomology [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)]. Efficient algorithms have been implemented for arithmetic with the Steinberg presentation and for converting between this presentation and matrix representations over the base field. Note that these presentations are not in the category `GrpFP` since the generators are parametrised by field elements and so the groups involved are not necessarily finitely generated.

This is described in Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="descriptions-4"></a>
<a id="sectlieintrorepn"></a>
### Highest Weight Representations

The representations of Lie algebras and connected reductive Lie groups are classified by *highest weights*. In addition to being able to construct these representations [[dG01](https://docs.magma-maths.org/references.md#cite-wdg-lie-hwrep)], we can compute the combinatorics of their weights. This includes all the functionality of the LiE system [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)]. This is described in Chapter [Representations of Lie Groups and Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/index-representations-of-lie-groups-and-algebras.md#chapliereps).

<a id="descriptions-5"></a>
<a id="sectliequae"></a>
### Universal Enveloping Algebras and Quantum Groups

Given a semisimple Lie algebra over a field of characteristic zero, we can construct an integral basis for its universal enveloping algebra. Functionality for computing in these algebras is described in Section [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#sectunivea). Moreover, we provide functionality for computing in their quantised versions, which are called quantum groups. This is described in Chapter [Quantum Groups](https://docs.magma-maths.org/LieTheory/QuantumGroups/index-quantum-groups.md#chap-quagrps).

<a id="coxeter-description"></a>
<a id="chapcartan"></a>
## Coxeter Systems

- [Introduction](https://docs.magma-maths.org/LieTheory/CoxeterSystems/introduction.md)
- [Coxeter Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md)
  - [`IsCoxeterMatrix(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-iscoxetermatrix-algmatelt)
  - [`CoxeterMatrix(G): GrphUnd → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-coxetermatrix-grphund)
  - [`CoxeterMatrix(C): AlgMatElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-coxetermatrix-algmatelt)
  - [`CoxeterMatrix(D): GrphDir → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-coxetermatrix-grphdir)
  - [Example: Coxeter Matrix Construction](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#example-ex-8161cb)
  - [`IsCoxeterIsomorphic(M1, M2): AlgMatElt, AlgMatElt → BoolElt, SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-iscoxeterisomorphic-algmatelt-algmatelt)
  - [`CoxeterGroupOrder(M): AlgMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-coxetergrouporder-algmatelt)
  - [`CoxeterGroupFactoredOrder(M): AlgMatElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-coxetergroupfactoredorder-algmatelt)
  - [Example: Coxeter Matrix Operations](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#example-ex-84a070)
  - [`IsCoxeterIrreducible(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-iscoxeterirreducible-algmatelt)
  - [`IsSimplyLaced(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#function-issimplylaced-algmatelt)
  - [Example: Coxeter Matrix Properties](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#example-ex-e19461)
- [Coxeter Graphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md)
  - [`IsCoxeterGraph(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-iscoxetergraph-grphund)
  - [`CoxeterGraph(M): AlgMatElt → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-coxetergraph-algmatelt)
  - [`CoxeterGraph(C): AlgMatElt → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-coxetergraph-algmatelt-2)
  - [`CoxeterGraph(D): GrphDir → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-coxetergraph-grphdir)
  - [`CoxeterGroupOrder(G): GrphUnd → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-coxetergrouporder-grphund)
  - [`CoxeterGroupFactoredOrder(G): GrphUnd → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-coxetergroupfactoredorder-grphund)
  - [Example: Coxeter Graph Operations](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#example-ex-a98e43)
  - [`IsSimplyLaced(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#function-issimplylaced-grphund)
  - [Example: Coxeter Graph Properties](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#example-ex-9639e1)
- [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md)
  - [`IsCartanMatrix(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-intriscart)
  - [`CartanMatrix(M): AlgMatElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-cartanmatrix-algmatelt)
  - [`CartanMatrix(G): GrphUnd → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-cartanmatrix-grphund)
  - [`CartanMatrix(D): GrphDir → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-cartanmatrix-grphdir)
  - [Example: Constructing Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#example-ex-0d7e25)
  - [`IsCoxeterIsomorphic(C1, C2): AlgMatElt, AlgMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-iscoxeterisomorphic-algmatelt-algmatelt-2)
  - [`IsCartanEquivalent(C1, C2): AlgMatElt, AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-iscartanequivalent-algmatelt-algmatelt)
  - [Example: Cartan Matrix Equivalence](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#example-ex-1ab47d)
  - [`NumberOfPositiveRoots(C): AlgMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-numberofpositiveroots-algmatelt)
  - [`NumPosRoots(C): AlgMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-numposroots-algmatelt)
  - [`CoxeterGroupOrder(C): AlgMatElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-coxetergrouporder-algmatelt-2)
  - [`CoxeterGroupFactoredOrder(C): AlgMatElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-coxetergroupfactoredorder-algmatelt-2)
  - [`FundamentalGroup(C): AlgMatElt → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-fundamentalgroup-algmatelt)
  - [Example: Cartan Matrix Operations](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#example-ex-918786)
  - [`IsCoxeterIrreducible(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-iscoxeterirreducible-algmatelt-2)
  - [`IsCrystallographic(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-iscrystallographic-algmatelt)
  - [`IsSimplyLaced(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#function-issimplylaced-algmatelt-2)
  - [Example: Cartan Matrix Properties](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#example-ex-839a84)
- [Dynkin Digraphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md)
  - [`IsDynkinDigraph(D): GrphDir → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-isdynkindigraph-grphdir)
  - [`DynkinDigraph(C): AlgMatElt → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-dynkindigraph-algmatelt)
  - [`CoxeterGroupOrder(D): GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-coxetergrouporder-grphdir)
  - [`CoxeterGroupFactoredOrder(D): GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-coxetergroupfactoredorder-grphdir)
  - [`FundamentalGroup(D): GrphDir → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-fundamentalgroup-grphdir)
  - [`IsSimplyLaced(D): GrphDir → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#function-issimplylaced-grphdir)
  - [Example: Cartan Matrix of a Dynkin Digraph](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#example-ex-9a3784)
- [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md)
  - [`IsCoxeterFinite(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterfinite-algmatelt)
  - [`IsCoxeterFinite(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterfinite-grphund)
  - [`IsCoxeterFinite(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterfinite-algmatelt-2)
  - [`IsCoxeterFinite(D): GrphDir → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterfinite-grphdir)
  - [`IsCoxeterFinite(N): MonStgElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterfinite-monstgelt)
  - [`IsCoxeterAffine(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeteraffine-algmatelt)
  - [`IsCoxeterAffine(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeteraffine-grphund)
  - [`IsCoxeterAffine(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeteraffine-algmatelt-2)
  - [`IsCoxeterAffine(D): GrphDir → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeteraffine-grphdir)
  - [`IsCoxeterAffine(N): MonStgElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeteraffine-monstgelt)
  - [Example: Testing Finite and Affine Types](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-ebe4bc)
  - [`CoxeterMatrix(N): MonStgElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-coxetermatrix-monstgelt)
  - [`CoxeterGraph(N): MonStgElt → GrpUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-coxetergraph-monstgelt)
  - [`CartanMatrix(N): MonStgElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-cartanmatrix-monstgelt)
  - [`DynkinDigraph(N): MonStgElt → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-dynkindigraph-monstgelt)
  - [Example: Matrices and Graphs from Cartan Names](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-f6d3c0)
  - [`IrreducibleCoxeterMatrix(X, n): MonStgElt, RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-irreduciblecoxetermatrix-monstgelt-rngintelt)
  - [`IrreducibleCoxeterGraph(X, n): MonStgElt, RngIntElt → GrpUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-irreduciblecoxetergraph-monstgelt-rngintelt)
  - [`IrreducibleCartanMatrix(X, n): MonStgElt, RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-irreduciblecartanmatrix-monstgelt-rngintelt)
  - [`IrreducibleDynkinDigraph(X, n): MonStgElt, RngIntElt → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-irreducibledynkindigraph-monstgelt-rngintelt)
  - [Example: Irreducible Coxeter Graphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-fc81db)
  - [`IsCoxeterIsomorphic(N1, N2): MonStgElt, MonStgElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscoxeterisomorphic-monstgelt-monstgelt)
  - [`IsCartanEquivalent(N1, N2): MonStgElt, MonStgElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-iscartanequivalent-monstgelt-monstgelt)
  - [Example: Isomorphism and Equivalence](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-d3e86e)
  - [`IsSimplyLaced(N): MonStgElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-issimplylaced-monstgelt)
  - [`CoxeterGroupOrder(N): MonStgElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-coxetergrouporder-monstgelt)
  - [`CoxeterGroupFactoredOrder(N): MonStgElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-coxetergroupfactoredorder-monstgelt)
  - [`NumberOfPositiveRoots(N): MonStgElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-numberofpositiveroots-monstgelt)
  - [`NumPosRoots(N): MonStgElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-numposroots-monstgelt)
  - [`FundamentalGroup(N): MonStgElt → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-fundamentalgroup-monstgelt)
  - [Example: Coxeter Group Orders](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-d07ed7)
  - [`CartanName(M): AlgMatElt → MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-cartanname-algmatelt)
  - [`CartanName(G): GrphUnd → MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-cartanname-grphund)
  - [`CartanName(C): AlgMatElt → MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-cartanname-algmatelt-2)
  - [`CartanName(D): GrphDir → MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#function-cartanname-grphdir)
  - [Example: Cartan Name of a Coxeter Matrix](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-8583c3)
  - [`DynkinDiagram(M): AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-dynkindiagram-algmatelt)
  - [`DynkinDiagram(G): GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-dynkindiagram-grphund)
  - [`DynkinDiagram(C): AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-dynkindiagram-algmatelt-2)
  - [`DynkinDiagram(D): GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-dynkindiagram-grphdir)
  - [`DynkinDiagram(N): MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-dynkindiagram-monstgelt)
  - [Example: Dynkin Diagram of a Reducible Type](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-08ba7b)
  - [`CoxeterDiagram(M): AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-coxeterdiagram-algmatelt)
  - [`CoxeterDiagram(G): GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-coxeterdiagram-grphund)
  - [`CoxeterDiagram(C): AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-coxeterdiagram-algmatelt-2)
  - [`CoxeterDiagram(D): GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-coxeterdiagram-grphdir)
  - [`CoxeterDiagram(N): MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#procedure-coxeterdiagram-monstgelt)
  - [Example: Coxeter Diagram of a Reducible Type](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#example-ex-f3140d)
- [Hyperbolic Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md)
  - [`IsCoxeterHyperbolic(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-iscoxeterhyperbolic-algmatelt)
  - [`IsCoxeterCompactHyperbolic(M): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-iscoxetercompacthyperbolic-algmatelt)
  - [`IsCoxeterHyperbolic(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-iscoxeterhyperbolic-grphund)
  - [`IsCoxeterCompactHyperbolic(G): GrphUnd → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-iscoxetercompacthyperbolic-grphund)
  - [`HyperbolicCoxeterMatrix(i): RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-hyperboliccoxetermatrix-rngintelt)
  - [`HyperbolicCoxeterGraph(i): RngIntElt → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#function-hyperboliccoxetergraph-rngintelt)
  - [Example: Compact Hyperbolic Coxeter Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#example-ex-4b6e52)
- [Related Structures](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md)
  - [`RootSystem(M): AlgMatElt → RootSys`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootsystem-algmatelt)
  - [`RootSystem(G): GrphUnd → RootSys`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootsystem-grphund)
  - [`RootSystem(C): AlgMatElt → RootSys`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootsystem-algmatelt-2)
  - [`RootSystem(D): GrphDir → RootSys`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootsystem-grphdir)
  - [`RootSystem(N): MonStgElt → RootSys`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootsystem-monstgelt)
  - [`RootDatum(C): AlgMatElt → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootdatum-algmatelt)
  - [`RootDatum(M): AlgMatElt → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootdatum-algmatelt-2)
  - [`RootDatum(G): GrphUnd → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootdatum-grphund)
  - [`RootDatum(D): GrphDir → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootdatum-grphdir)
  - [`RootDatum(N): MonStgElt → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-rootdatum-monstgelt)
  - [`CoxeterGroup(grpcat, M): Cat, AlgMatElt → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-cat-algmatelt)
  - [`CoxeterGroup(grpcat, G): Cat, GrphUnd → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-cat-grphund)
  - [`CoxeterGroup(grpcat, D): Cat, GrphDir → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-cat-grphdir)
  - [`CoxeterGroup(grpcat, N): Cat, MonStgElt → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-cat-monstgelt)
  - [`CoxeterGroup(M): AlgMatElt → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-algmatelt)
  - [`CoxeterGroup(C): AlgMatElt → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-algmatelt-2)
  - [`CoxeterGroup(G): GrphUnd → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-grphund)
  - [`CoxeterGroup(D): GrphDir → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-grphdir)
  - [`CoxeterGroup(N): MonStgElt → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-coxetergroup-monstgelt)
  - [`ReflectionGroup(M): AlgMatElt → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-reflectiongroup-algmatelt)
  - [`ReflectionGroup(G): GrphUnd → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-reflectiongroup-grphund)
  - [`ReflectionGroup(C): AlgMatElt → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-reflectiongroup-algmatelt-2)
  - [`ReflectionGroup(D): GrphDir → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-reflectiongroup-grphdir)
  - [`ReflectionGroup(N): MonStgElt → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-reflectiongroup-monstgelt)
  - [`LieAlgebra(C, k): AlgMatElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-liealgebra-algmatelt-rng)
  - [`LieAlgebra(D, k): GrphDir, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-liealgebra-grphdir-rng)
  - [`LieAlgebra(N, k): MonStgElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-liealgebra-monstgelt-rng)
  - [`MatrixLieAlgebra(C, k): AlgMatElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-matrixliealgebra-algmatelt-rng)
  - [`MatrixLieAlgebra(D, k): GrphDir, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-matrixliealgebra-grphdir-rng)
  - [`MatrixLieAlgebra(N, k): MonStgElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-matrixliealgebra-monstgelt-rng)
  - [`GroupOfLieType(C, k): AlgMatElt, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-groupoflietype-algmatelt-rng)
  - [`GroupOfLieType(D, k): GrphDir, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-groupoflietype-grphdir-rng)
  - [`GroupOfLieType(N, k): MonStgElt, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related-2.md#function-groupoflietype-monstgelt-rng)
- [Bibliography](https://docs.magma-maths.org/LieTheory/CoxeterSystems/bibliography.md)

<a id="sectcartanintro"></a>
<a id="id1"></a>
### Introduction

The functions in this chapter handle basic descriptions of Coxeter systems. A *Coxeter system* is a group $G$ with finite generating set $S=\{s_1,\dots,s_n\}$, defined by relations $s_i^2=1$ for $i=1,\dots,n$ and

$$
s_is_js_i\cdots = s_js_is_j\cdots
$$

for $i,j=1,\dots,n$ with $i<j$, where each side of this relation has length $m_{ij}\ge 2$. Traditionally, $m_{ij}=\infty$ signifies that the corresponding relation is omitted but for technical reasons $m_{ij}=0$ is used in Magma instead. The group $G$ is called a *Coxeter group* and $S$ is called the set of *Coxeter generators*. Since every group in Magma has a preferred generating set, no distinction is made between a Coxeter system and its Coxeter group. See [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] for more details on the theory of Coxeter groups.

The *rank* of the Coxeter system is $n=|S|$. A Coxeter system is said to be *reducible* if there is a proper subset $I$ of $\{1,\dots,n\}$ such that $m_{ij}=2$ or $m_{ji}=2$ whenever $i\in I$ and $j\notin I$. In this case, $G$ is an (internal) direct product of the Coxeter subgroups $W_I=\langle s_i \mid i \in I \rangle$ and $W_{I^c}=\langle s_i \mid i \notin I \rangle$. Note that an *irreducible* Coxeter group may still be a nontrivial direct product of abstract subgroups (for example, $W(G_2)\cong S_2\times S_3$). Two Coxeter systems are *Coxeter isomorphic* (or *graph isomorphic*) if there is a group isomorphism between them which takes Coxeter generators to Coxeter generators. In other words, the two groups are the same modulo renumbering of the generators.

Coxeter groups and their representations as reflection groups have a number of useful descriptions. In this chapter, Coxeter matrices, Coxeter graphs, Cartan matrices, and Dynkin digraphs will be discussed. The classification of finite and affine Coxeter groups provides a naming system for these groups. In Chapters [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys) and [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm), finite root systems and root data, which provide a more detailed description of finite Coxeter groups, are discussed. Coxeter groups themselves are discussed in Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox); reflection representations of Coxeter groups are discussed in Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="coxetermat"></a>
<a id="sectcartancoxmat"></a>
### Coxeter Matrices

A Coxeter system is defined by the numbers $m_{ij}\in\{2,3,\dots,\infty\}$ for $i,j=1,\dots n$ and $i<j$, as in the previous section. Setting $m_{ji}=m_{ij}$ and $m_{ii}=1$, yields a matrix $M=(m_{ij})_{i,j=1}^n$ that is called the *Coxeter matrix*.

Since $\infty$ is not an integer in Magma, it will be represented by $0$ in Coxeter matrices.

<a id="function-iscoxetermatrix-algmatelt"></a>
#### `IsCoxeterMatrix(M): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the matrix $M$ is the Coxeter matrix of some Coxeter group.

<a id="function-coxetermatrix-grphund"></a>
#### `CoxeterMatrix(G): GrphUnd -> AlgMatElt`

<a id="function-coxetermatrix-algmatelt"></a>
#### `CoxeterMatrix(C): AlgMatElt -> AlgMatElt`

<a id="function-coxetermatrix-grphdir"></a>
#### `CoxeterMatrix(D): GrphDir -> AlgMatElt`

The Coxeter matrix corresponding to a Coxeter graph $G$, Cartan matrix $C$, or Dynkin digraph $D$.

<a id="example-ex-8161cb"></a>
#### `Example: Coxeter Matrix Construction (ex-8161cb)`

```magma
> M := SymmetricMatrix([1, 3,1, 2,3,1]);
> M;
[1 3 2]
[3 1 3]
[2 3 1]
> IsCoxeterMatrix(M);
true
```

<a id="function-iscoxeterisomorphic-algmatelt-algmatelt"></a>
#### `IsCoxeterIsomorphic(M1, M2): AlgMatElt, AlgMatElt -> BoolElt, SeqEnum`

Returns `true` if and only if the Coxeter matrices $M_1$ and $M_2$ give rise to isomorphic Coxeter systems. If so, a sequence giving the permutation of the underlying basis which takes $M_1$ to $M_2$ is also returned.

<a id="function-coxetergrouporder-algmatelt"></a>
#### `CoxeterGroupOrder(M): AlgMatElt -> RngIntElt`

<a id="function-coxetergroupfactoredorder-algmatelt"></a>
#### `CoxeterGroupFactoredOrder(M): AlgMatElt -> SeqEnum`

The (factored) order of the Coxeter group with Coxeter matrix $M$.

<a id="example-ex-84a070"></a>
#### `Example: Coxeter Matrix Operations (ex-84a070)`

```magma
> M1 := SymmetricMatrix([1, 3,1, 2,3,1]);
> M2 := SymmetricMatrix([1, 3,1, 3,2,1]);
> IsCoxeterIsomorphic(M1, M2);
true [ 2, 1, 3 ]
>
> CoxeterGroupOrder(M1);
24
```

<a id="function-iscoxeterirreducible-algmatelt"></a>
#### `IsCoxeterIrreducible(M): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the matrix $M$ is the Coxeter matrix of an irreducible Coxeter system. If the Coxeter matrix is reducible, this function also returns a nontrivial subset $I$ of $\{1,\dots,n\}$ such that $m_{ij}=2$ whenever $i\in I$, $j\notin I$.

<a id="function-issimplylaced-algmatelt"></a>
#### `IsSimplyLaced(M): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the Coxeter matrix $M$ is simply laced, i.e. all its entries are 1, 2, or 3.

<a id="example-ex-e19461"></a>
#### `Example: Coxeter Matrix Properties (ex-e19461)`

```magma
> M := SymmetricMatrix([1, 3,1, 2,3,1]);
> IsCoxeterIrreducible(M);
true
> M := SymmetricMatrix([1, 2,1, 2,3,1]);
> IsCoxeterIrreducible(M);
false { 1 }
```

<a id="coxetergraph"></a>
<a id="sectcartancoxgrph"></a>
### Coxeter Graphs

A *Coxeter graph* is an undirected labelled graph describing a Coxeter system. Suppose a Coxeter system has Coxeter matrix $M=(m_{ij})_{i,j=1}^n$. Then the Coxeter graph has vertices $1,\dots,n$; whenever $m_{ij}>2$ there is an edge connecting $i$ and $j$ labeled by the value of $m_{ij}$. When $m_{ij}=3$, the label is usually omitted.

Since $\infty$ is not an integer, it will be represented by $0$ in our Coxeter graphs. Clearly a Coxeter graph must be standard, i.e. its vertices must be the integers $1,2,\dots,n$ for some $n$. A Coxeter system is irreducible if, and only if, its Coxeter graph is connected. Two Coxeter graphs give rise to Coxeter isomorphic groups if, and only if, they are isomorphic as labelled graphs. See Chapter [Graphs](https://docs.magma-maths.org/Combinatorics/Graphs/index-graphs.md#graph) for more information on graphs.

<a id="function-iscoxetergraph-grphund"></a>
#### `IsCoxeterGraph(G): GrphUnd -> BoolElt`

Returns `true` if, and only if, the graph $G$ is the Coxeter graph of some Coxeter group.

<a id="function-coxetergraph-algmatelt"></a>
#### `CoxeterGraph(M): AlgMatElt -> GrphUnd`

<a id="function-coxetergraph-algmatelt-2"></a>
#### `CoxeterGraph(C): AlgMatElt -> GrphUnd`

<a id="function-coxetergraph-grphdir"></a>
#### `CoxeterGraph(D): GrphDir -> GrphUnd`

The Coxeter graph corresponding to a Coxeter matrix $M$, Cartan matrix $C$, or Dynkin digraph $D$.

<a id="function-coxetergrouporder-grphund"></a>
#### `CoxeterGroupOrder(G): GrphUnd -> .`

<a id="function-coxetergroupfactoredorder-grphund"></a>
#### `CoxeterGroupFactoredOrder(G): GrphUnd -> .`

The (factored) order of the Coxeter group with Coxeter graph $G$.

<a id="example-ex-a98e43"></a>
#### `Example: Coxeter Graph Operations (ex-a98e43)`

```magma
> G := PathGraph(4);
> AssignLabel(G, 1,2, 4);
> AssignLabel(G, 3,4, 4);
> IsCoxeterGraph(G);
true
> CoxeterGroupOrder(G);
Infinity
>
> M := SymmetricMatrix([1, 3,1, 2,5,1]);
> G := CoxeterGraph(M);
> Labels(EdgeSet(G));
[ undef, 5 ]
```

<a id="function-issimplylaced-grphund"></a>
#### `IsSimplyLaced(G): GrphUnd -> BoolElt`

Returns `true` if, and only if, the Coxeter graph $G$ is simply laced, i.e. unlabelled.

<a id="example-ex-9639e1"></a>
#### `Example: Coxeter Graph Properties (ex-9639e1)`

```magma
> G := PathGraph(2);
> IsSimplyLaced(G);
true
> AssignLabel(G, 1,2, 6);
> IsSimplyLaced(G);
false
```

<a id="cartanmat"></a>
<a id="sectcartancarmat"></a>
### Cartan Matrices

A *Cartan matrix* is a real valued matrix $C=(c_{ij})_{i,j=1}^n$ satisfying the properties:

1. $c_{ii}=2$;
2. $c_{ij}\le 0$ for $i\ne j$;
3. $c_{ij}=0$ if, and only if, $c_{ji}=0$; and
4. if $n_{ij}:=c_{ij}c_{ji}<4$, then $n_{ij}=4\cos^2(\pi/m_{ij})$ for some integer $m_{ij}\ge2$. In Magma, Cartan matrices can be defined over the integer ring (Chapter [Ring of Integers](https://docs.magma-maths.org/BasicRings/Integers/index-integers.md#rngint)), the rational field (Chapter [Rational Field](https://docs.magma-maths.org/BasicRings/Rationals/index-rationals.md#fldrat)), number fields (Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main)), and cyclotomic fields (Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)). The real field (Chapter [Real and Complex Fields](https://docs.magma-maths.org/BasicRings/RealAndComplexFields/index-real-and-complex-fields.md#chapfldre)) is *not* allowed since it is not infinite precision. A Cartan matrix is called *crystallographic* if all its entries are integers.

Given a Cartan matrix, the corresponding Coxeter matrix $M=(m_{ij})_{i,j=1}^n$ is defined by $m_{ii}=1$; $m_{ij}$ as in (4) if $n_{ij}<4$; $m_{ij}=\infty$ (ie, $0$) if $n_{ij}\ge 4$. The significance of Cartan matrices is due to the following construction: Let $X$ be a real inner-product space with basis $\alpha_1,\dots,\alpha_n$. Take the unique basis $\alpha^\star_1,\dots,\alpha^\star_n$ for $X$ such that $(\alpha_i,\alpha_j^\star)=c_{ij}$. Let $s_i$ be the reflection in $\alpha_i$ and $\alpha_i^\star$, i.e. $s_i:V\rightarrow V$ is defined by $vs_i= v-(v,\alpha_i^\star)\alpha_i$. Then the group generated by $s_1,\dots,s_n$ is a Coxeter group with Coxeter matrix $M$. In other words, a Cartan matrix specifies a faithful representation of the Coxeter group as a real reflection group. For more details on reflection groups see Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-intriscart"></a>
#### `IsCartanMatrix(C): AlgMatElt -> BoolElt`

```magma
RealInjection: Any                    Default: false
```

Returns `true` if, and only if, the matrix $C$ is a Cartan matrix.

Number field elements and cyclotomic field elements do not have a natural identification with real numbers. The `RealInjection` flag allows the user to provide one. If the base field of $C$ is a number field, the flag should be an injection into the real field; if the base field is cyclotomic, the flag should be an injection into the complex field taking real values on the entries of $C$. If no real injection is given, conditions (2) and (4) of the definition are not checked.

<a id="function-cartanmatrix-algmatelt"></a>
#### `CartanMatrix(M): AlgMatElt -> AlgMatElt`

<a id="function-cartanmatrix-grphund"></a>
#### `CartanMatrix(G): GrphUnd -> AlgMatElt`

```magma
Symmetric: BoolElt                      Default: false
BaseField: MonStgElt                    Default: "NumberField"
```

A Cartan matrix corresponding to the Coxeter matrix $M$ or Coxeter graph $G$. Note that the Cartan matrix of a Coxeter system is not unique. By default this function returns the Cartan matrix with $c_{ij}=-4\cos^2(\pi/m_{ij})$, $c_{ji}=-1$ when $m_{ij}\ne2$ and $i<j$. This matrix is crystallographic whenever there exists a crystallographic Cartan matrix corresponding to $M$.

If the `Symmetric` flag is set `true`, the symmetric Cartan matrix with

$$
c_{ij}=c_{ji}=-2\cos(\pi/m_{ij})
$$

is returned.

The `BaseField` flag determines the field over which the Cartan matrix is defined. If the matrix is crystallographic however, it is defined over the integers regardless of the value of this flag. The possible values are:

1. `"NumberField"`: An algebraic number field. This is the default. See Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).
2. `"Cyclotomic"` or `"SparseCyclotomic"`: A cyclotomic field with the sparse representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).
3. `"DenseCyclotomic"`: A cyclotomic field with the dense representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).

<a id="function-cartanmatrix-grphdir"></a>
#### `CartanMatrix(D): GrphDir -> AlgMatElt`

The crystallographic Cartan matrix corresponding to the Dynkin digraph $D$.

<a id="example-ex-0d7e25"></a>
#### `Example: Constructing Cartan Matrices (ex-0d7e25)`

```magma
> C := Matrix(2,2, [ 2,-3, -1,2 ]);
> C;
> IsCartanMatrix(C);
true
> CoxeterMatrix(C);
[1 6]
[6 1]
>
> G := PathGraph(4);
> AssignLabel(G, 1,2, 4);
> AssignLabel(G, 3,4, 4);
> CartanMatrix(G);
[ 2 -2  0  0]
[-1  2 -1  0]
[ 0 -1  2 -2]
[ 0  0 -1  2]
> CartanMatrix(G : Symmetric, BaseField := "Cyclotomic");
[2 zeta(8)_8^3 - zeta(8)_8 0 0]
[zeta(8)_8^3 - zeta(8)_8 2 -1 0]
[0 -1 2 zeta(8)_8^3 - zeta(8)_8]
[0 0 zeta(8)_8^3 - zeta(8)_8 2]
```

<a id="function-iscoxeterisomorphic-algmatelt-algmatelt-2"></a>
#### `IsCoxeterIsomorphic(C1, C2): AlgMatElt, AlgMatElt -> RngIntElt`

Tests if the Cartan matrices $C_1$ and $C_2$ give rise to isomorphic Coxeter systems; i.e., their Coxeter matrices are equal modulo a permutation of the underlying basis. If `true`, a sequence giving the permutation of the underlying basis which takes the Coxeter matrix of $C_1$ to the Coxeter matrix of $C_2$ is also returned.

<a id="function-iscartanequivalent-algmatelt-algmatelt"></a>
#### `IsCartanEquivalent(C1, C2): AlgMatElt, AlgMatElt -> BoolElt`

Returns `true` if, and only if, the crystallographic Cartan matrices $C_1$ and $C_2$ are Cartan equivalent, i.e. they are equal modulo permutation of the underlying basis. If so, a sequence giving the permutation of the underlying basis which takes $C_1$ to $C_2$ is also returned.

<a id="example-ex-1ab47d"></a>
#### `Example: Cartan Matrix Equivalence (ex-1ab47d)`

Cartan equivalence is a stronger condition than Coxeter isomorphism.

```magma
> C1 := Matrix(2,2, [ 2,-2, -2,2 ]);
> C2 := Matrix(2,2, [ 2,-1, -5,2 ]);
> IsCoxeterIsomorphic(C1, C2);
true [ 1, 2 ]
> IsCartanEquivalent(C1, C2);
false
```

<a id="function-numberofpositiveroots-algmatelt"></a>
#### `NumberOfPositiveRoots(C): AlgMatElt -> RngIntElt`

<a id="function-numposroots-algmatelt"></a>
#### `NumPosRoots(C): AlgMatElt -> RngIntElt`

The number of positive roots of the root system with Cartan matrix $C$. See Subsection [Simple and Positive Roots](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#subsectrspossimple) for the definition of positive roots.

<a id="function-coxetergrouporder-algmatelt-2"></a>
#### `CoxeterGroupOrder(C): AlgMatElt -> .`

<a id="function-coxetergroupfactoredorder-algmatelt-2"></a>
#### `CoxeterGroupFactoredOrder(C): AlgMatElt -> .`

The (factored) order of the Coxeter group with Cartan matrix $C$.

<a id="function-fundamentalgroup-algmatelt"></a>
#### `FundamentalGroup(C): AlgMatElt -> GrpAb`

The fundamental group of the crystallographic Cartan matrix $C$, i.e. ${\mathbb{Z}}^n/\Gamma$ where $n$ is the degree of $C$ and $\Gamma$ is the lattice generated by the rows of $C$. The natural mapping ${\mathbb{Z}}^n\to{\mathbb{Z}}^n/\Gamma$ is the second returned value.

<a id="example-ex-918786"></a>
#### `Example: Cartan Matrix Operations (ex-918786)`

```magma
> C := CartanMatrix(PathGraph(4));
> FundamentalGroup(C);
Abelian Group isomorphic to Z/5
Defined on 1 generator
Relations:
    5*$.1 = 0
Mapping from: Standard Lattice of rank 4 and degree 4 to Abelian Group
isomorphic to Z/5
Defined on 1 generator
Relations:
    5*$.1 = 0
```

<a id="function-iscoxeterirreducible-algmatelt-2"></a>
#### `IsCoxeterIrreducible(C): AlgMatElt -> BoolElt`

Returns `true` if, and only if, $C$ is the Cartan matrix of an irreducible Coxeter system. If the Coxeter matrix is reducible, this function also returns a nontrivial subset $I$ of $\{1,\dots,n\}$ such that $m_{ij}=2$ (i.e., $c_{ij}=0$) whenever $i\in I$, $j\notin I$.

<a id="function-iscrystallographic-algmatelt"></a>
#### `IsCrystallographic(C): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the Cartan matrix $C$ is crystallographic, i.e. $C$ has integral entries.

<a id="function-issimplylaced-algmatelt-2"></a>
#### `IsSimplyLaced(C): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the Cartan matrix $C$ is simply laced, i.e. all the entries in its Coxeter matrix are 1, 2, or 3.

<a id="example-ex-839a84"></a>
#### `Example: Cartan Matrix Properties (ex-839a84)`

```magma
> C := Matrix(2,2, [ 2,-2, -2,2 ]);
> IsCoxeterIrreducible(C);
true
> IsCrystallographic(C);
true
> IsSimplyLaced(C);
false
```

<a id="dynkindigraph"></a>
<a id="sectcartandyndigrph"></a>
### Dynkin Digraphs

A *Dynkin digraph* is a directed labelled graph describing a *crystallographic* Cartan matrix $C=(c_{ij})_{i,j=1}^n$. The Dynkin digraph has vertices $1,\dots,n$; whenever $c_{ij}<0$ there is an edge from $i$ to $j$ labeled by the value $-c_{ij}$. When $c_{ij}=-1$, the label is usually omitted.

In the literature, the term *Dynkin diagram* is used, but here this will be reserved for a printed display of the Dynkin digraph (or Coxeter graph) corresponding to a finite or affine Coxeter group (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff) below). For convenience, Dynkin digraphs have labelled edges rather than multiple edges.

Clearly a Dynkin digraph must be standard, i.e. its vertices must be the integers $1,2,\dots,n$ for some $n$. A Dynkin digraph has an edge from $i$ to $j$ if, and only if, it has an edge from $j$ to $i$ (although the labels may be different). Hence strong and weak connectivity are equivalent for these graphs. The Coxeter system is irreducible if, and only if, the Dynkin digraph is connected. Two Dynkin digraphs give rise to Cartan equivalent Cartan matrices if they are isomorphic as labelled digraphs. See Chapter [Graphs](https://docs.magma-maths.org/Combinatorics/Graphs/index-graphs.md#graph) for more information on digraphs.

Note that functions are not given for computing the Dynkin digraph of a Coxeter matrix or Coxeter graph, since a particular choice of crystallographic Cartan matrix is required.

<a id="function-isdynkindigraph-grphdir"></a>
#### `IsDynkinDigraph(D): GrphDir -> BoolElt`

Returns `true` if, and only if, the digraph $D$ is the Dynkin digraph of some crystallographic Cartan matrix.

<a id="function-dynkindigraph-algmatelt"></a>
#### `DynkinDigraph(C): AlgMatElt -> GrphDir`

The Dynkin digraph of the crystallographic Cartan matrix $C$.

<a id="function-coxetergrouporder-grphdir"></a>
#### `CoxeterGroupOrder(D): GrphDir -> .`

<a id="function-coxetergroupfactoredorder-grphdir"></a>
#### `CoxeterGroupFactoredOrder(D): GrphDir -> .`

The (factored) order of the Coxeter group with Dynkin digraph $D$.

<a id="function-fundamentalgroup-grphdir"></a>
#### `FundamentalGroup(D): GrphDir -> GrpAb`

The fundamental group of the Dynkin digraph $D$, i.e. ${\mathbb{Z}}^n/\Gamma$ where $n$ is the degree of $D$ and $\Gamma$ is the lattice generated by the rows of the corresponding Cartan matrix. The natural mapping ${\mathbb{Z}}^n\to{\mathbb{Z}}^n/\Gamma$ is the second returned value.

<a id="function-issimplylaced-grphdir"></a>
#### `IsSimplyLaced(D): GrphDir -> BoolElt`

Returns `true` if, and only if, the Dynkin digraph $D$ is simply laced, i.e. unlabelled.

<a id="example-ex-9a3784"></a>
#### `Example: Cartan Matrix of a Dynkin Digraph (ex-9a3784)`

```magma
> D := Digraph< 4 | <1,{2,3,4}>, <2,{1}>, <3,{1}>, <4,{1}> >;
> AssignLabel(D, 1,2, 2);
> AssignLabel(D, 1,3, 5);
> IsDynkinDigraph(D);
true
> CartanMatrix(D);
[ 2 -2 -5 -1]
[-1  2  0  0]
[-1  0  2  0]
[-1  0  0  2]
> FundamentalGroup(D);
Abelian Group isomorphic to Z/2 + Z/8
Defined on 2 generators
Relations:
    2*$.1 = 0
    8*$.2 = 0
Mapping from: Standard Lattice of rank 4 and degree 4 to Abelian Group
isomorphic to Z/2 + Z/8
Defined on 2 generators
Relations:
    2*$.1 = 0
    8*$.2 = 0
```

<a id="finiteaffine"></a>
<a id="sectcartanfinaff"></a>
### Finite and Affine Coxeter Groups

Functions related to the classification of finite and affine Coxeter groups are described in this section. This classification is due to Cartan [[Car52](https://docs.magma-maths.org/references.md#cite-cartan)] and Coxeter [[Cox34](https://docs.magma-maths.org/references.md#cite-coxeter)].

An affine reflection group is a group generated by reflections in affine space (in other words, real reflections in a hyperplane that does not necessarily pass through the origin). A Coxeter group is called *affine* if it is infinite and it has a representation as a discrete, properly acting, affine reflection group (see [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] for more details on discreteness and proper action). Note that a Coxeter group is finite if, and only if, it has a representation as a discrete, properly acting group of reflections of the sphere; hence finite Coxeter groups are sometimes called *spherical*.

A Coxeter group is finite if, and only if, all its irreducible components are finite; a Coxeter group is affine if, and only if, all its irreducible components are finite or affine, and at least one component is affine. So it suffices to classify irreducible Coxeter groups.

The Dynkin diagrams of the irreducible finite crystallographic Coxeter groups are:

```
  An  1---2---3- ... -n        Bn  1---2- ... -(n-1)=>=n

                                                     (n-1)
                                                    /
  Cn  1---2- ... -(n-1)=<=n    Dn  1---1- ... -(n-2)
                                                    \\
                                                     n

  E6  1---3---4---5---6        E7  1---3---4---5---6---7
              |                          |
              2                          2

  E8  1---3---4---5---6---7---8
              |
              2

  F4  1---2=>=3---4            G2  1=<=2
                                     3
```

Due to the difficulty of drawing a triple bond with text characters, the edge for $G_2$ is labelled.

The only irreducible noncrystallographic finite Coxeter groups are $H_3$, $H_4$ and $I_2(m)$ for $m = 5$ and $m > 6$. The Coxeter graphs of these groups are:

```
  H3  1---2---3                H4  1---2---3---4
        5                            5

  I2(m) 1---2
          m
```

Note that there is some redundancy in this classification; specifically $A_1=B_1=C_1=D_1$, $A_2=I_2(3)$, $B_2=C_2=I_2(4)$, $D_2=A_1+A_1$, $D_3=A_3$, $G_2=I_2(6)$. Furthermore, for $n\ge3$, types $B_n$ and $C_n$ have identical Coxeter matrices but inequivalent crystallographic Cartan matrices for $n>2$.

All irreducible affine groups are crystallographic. There is one corresponding to each irreducible crystallographic finite group. Their Dynkin diagrams are:

```
  A~1      1-------2           A~n     1---2- ... -n
             infty                     |           |
                                       ----(n+1)----

          1
           \\
  B~n       2- ... -(n-1)=>=n
           /
      (n+1)

  C~n     (n+1)=>=1---1- ... -(n-1)=<=n

          1           (n-1)
           \         /
  D~n       2- ... -(n-2)
           /         \\
      (n+1)           n

  E~6    1---3---4---5---6     E~7    8---1---3---4---5---6---7
                 |                                |
                 2                                2
                 |
                 7

  E~8    1---3---4---5---6---7---8---9
                 |
                 2

  F~4    5---1---2=>=3---4     G~2    1=<=2---3
                                        3
```

The labels on the vertices of these diagrams show the standard vertex order used in Magma, which is consistent with the order used in [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)].

<a id="function-iscoxeterfinite-algmatelt"></a>
#### `IsCoxeterFinite(M): AlgMatElt -> BoolElt`

<a id="function-iscoxeterfinite-grphund"></a>
#### `IsCoxeterFinite(G): GrphUnd -> BoolElt`

<a id="function-iscoxeterfinite-algmatelt-2"></a>
#### `IsCoxeterFinite(C): AlgMatElt -> BoolElt`

<a id="function-iscoxeterfinite-grphdir"></a>
#### `IsCoxeterFinite(D): GrphDir -> BoolElt`

<a id="function-iscoxeterfinite-monstgelt"></a>
#### `IsCoxeterFinite(N): MonStgElt -> BoolElt`

Returns `true` if, and only if, the corresponding Coxeter group is finite. The input variable can be a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$.

<a id="function-iscoxeteraffine-algmatelt"></a>
#### `IsCoxeterAffine(M): AlgMatElt -> BoolElt`

<a id="function-iscoxeteraffine-grphund"></a>
#### `IsCoxeterAffine(G): GrphUnd -> BoolElt`

<a id="function-iscoxeteraffine-algmatelt-2"></a>
#### `IsCoxeterAffine(C): AlgMatElt -> BoolElt`

<a id="function-iscoxeteraffine-grphdir"></a>
#### `IsCoxeterAffine(D): GrphDir -> BoolElt`

<a id="function-iscoxeteraffine-monstgelt"></a>
#### `IsCoxeterAffine(N): MonStgElt -> BoolElt`

Returns `true` if, and only if, the corresponding Coxeter group is affine. The input variable can be a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$.

<a id="example-ex-ebe4bc"></a>
#### `Example: Testing Finite and Affine Types (ex-ebe4bc)`

```magma
> IsCoxeterAffine("A~2");
true
> IsCoxeterAffine("A~2B2");
true
> IsCoxeterAffine("A2B2");
false
> IsCoxeterFinite("A2B2");
true
```

<a id="function-coxetermatrix-monstgelt"></a>
#### `CoxeterMatrix(N): MonStgElt -> AlgMatElt`

The Coxeter matrix with Cartan name given by the string $N$.

<a id="function-coxetergraph-monstgelt"></a>
#### `CoxeterGraph(N): MonStgElt -> GrpUnd`

The Coxeter graph with Cartan name given by the string $N$.

<a id="function-cartanmatrix-monstgelt"></a>
#### `CartanMatrix(N): MonStgElt -> AlgMatElt`

```magma
Symmetric: BoolElt                      Default: false
BaseField: MonStgElt                    Default: "NumberField"
```

The Cartan matrix with Cartan name given by the string $N$. By default, the crystallographic matrix is returned for crystallographic types; otherwise the Cartan matrix with $c_{ij}=-4\cos^2(\pi/m_{ij})$, $c_{ji}=-1$ when $m_{ij}\ne2$ and $i<j$ is returned.

If the `Symmetric` flag is set `true`, the symmetric Cartan matrix with $c_{ij}=c_{ji}=-2\cos(\pi/m_{ij})$ is returned.

The `BaseField` flag determines the field over which the Cartan matrix is defined. If the matrix is crystallographic however, it is defined over the integers regardless of the value of this flag. The possible values are:

1. `"NumberField"`: An algebraic number field. This is the default. See Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).
2. `"Cyclotomic"` or `"SparseCyclotomic"`: A cyclotomic field with the sparse representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).
3. `"DenseCyclotomic"`: A cyclotomic field with the dense representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).

<a id="function-dynkindigraph-monstgelt"></a>
#### `DynkinDigraph(N): MonStgElt -> GrphDir`

The Dynkin digraph with Cartan name given by the string $N$. The Cartan name must be crystallographic, i.e. it cannot involve types $H_3$, $H_4$, and $I_2(m)$.

<a id="example-ex-f6d3c0"></a>
#### `Example: Matrices and Graphs from Cartan Names (ex-f6d3c0)`

```magma
> CoxeterMatrix("I2(7)");
[1 7]
[7 1]
> CoxeterGraph("A3");
Graph
Vertex  Neighbours

1       2 ;
2       1 3 ;
3       2 ;

> CartanMatrix("H3" : Symmetric);
[   2 -$.1    0]
[-$.1    2   -1]
[   0   -1    2]
> DynkinDigraph("A~2");
Digraph
Vertex  Neighbours

1       2 3 ;
2       1 3 ;
3       1 2 ;
```

The code for interpreting a string as a Cartan name is quite flexible: letters and numbers must alternate, except in type $I$ where brackets must be used.

```magma
> M := CoxeterMatrix("A_5B3 c2I2 (5)");
> CartanName(M);
A5 B3 B2 I2(5)
```

<a id="function-irreduciblecoxetermatrix-monstgelt-rngintelt"></a>
#### `IrreducibleCoxeterMatrix(X, n): MonStgElt, RngIntElt -> AlgMatElt`

The irreducible Coxeter matrix with Cartan name $X_n$ (or $I_2(n)$ if $X=$`"I"`).

<a id="function-irreduciblecoxetergraph-monstgelt-rngintelt"></a>
#### `IrreducibleCoxeterGraph(X, n): MonStgElt, RngIntElt -> GrpUnd`

The irreducible Coxeter graph with Cartan name $X_n$ (or $I_2(n)$ if $X=$`"I"`).

<a id="function-irreduciblecartanmatrix-monstgelt-rngintelt"></a>
#### `IrreducibleCartanMatrix(X, n): MonStgElt, RngIntElt -> AlgMatElt`

```magma
Symmetric: BoolElt                      Default: false
BaseField: MonStgElt                    Default: "NumberField"
```

The irreducible Cartan matrix with Cartan name $X_n$ (or $I_2(n)$ if $X=$`"I"`).

If the `Symmetric` flag is set `true`, the symmetric Cartan matrix with $c_{ij}=c_{ji}=-2\cos(\pi/m_{ij})$ is returned.

The `BaseField` flag determines which field the Cartan matrix is defined over. If the matrix is crystallographic however, it is defined over the integers regardless of the value of this flag. The possible values are:

1. `"NumberField"`: An algebraic number field. This is the default. See Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).
2. `"Cyclotomic"` or `"SparseCyclotomic"`: A cyclotomic field with the sparse representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).
3. `"DenseCyclotomic"`: A cyclotomic field with the dense representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).

<a id="function-irreducibledynkindigraph-monstgelt-rngintelt"></a>
#### `IrreducibleDynkinDigraph(X, n): MonStgElt, RngIntElt -> GrphDir`

The irreducible Dynkin digraph with Cartan name $X_n$. The Cartan name must be crystallographic, i.e. it cannot involve types $H_3$, $H_4$, or $I_2(m)$.

<a id="example-ex-fc81db"></a>
#### `Example: Irreducible Coxeter Graphs (ex-fc81db)`

These functions are useful in loops.

```magma
> for n in [1..5] do
>     IsTree(IrreducibleCoxeterGraph("A~", n));
> end for;
true
false
false
false
false
> C := &join[ IrreducibleCoxeterGraph(t, 4) : t in ["A","B","C","D","F"] ];
```

<a id="function-iscoxeterisomorphic-monstgelt-monstgelt"></a>
#### `IsCoxeterIsomorphic(N1, N2): MonStgElt, MonStgElt -> BoolElt`

Returns `true` if and only if the Cartan names given by the strings $N_1$ and $N_2$ correspond to isomorphic Coxeter systems.

<a id="function-iscartanequivalent-monstgelt-monstgelt"></a>
#### `IsCartanEquivalent(N1, N2): MonStgElt, MonStgElt -> BoolElt`

Returns `true` if and only if the Cartan names given by the strings $N_1$ and $N_2$ correspond to Cartan equivalent Cartan matrices. The Cartan names must be crystallographic; i.e., they cannot involve types $H_3$, $H_4$, and $I_2(m)$.

<a id="example-ex-d3e86e"></a>
#### `Example: Isomorphism and Equivalence (ex-d3e86e)`

```magma
> IsCoxeterIsomorphic("A1A1", "D2");
true
> IsCoxeterIsomorphic("B5", "C5");
true
> IsCartanEquivalent("B5", "C5");
false
```

<a id="function-issimplylaced-monstgelt"></a>
#### `IsSimplyLaced(N): MonStgElt -> BoolElt`

Returns `true` if, and only if, the Coxeter matrix with Cartan name given by the string $N$ is simply laced, i.e. all its entries are 1, 2, or 3.

<a id="function-coxetergrouporder-monstgelt"></a>
#### `CoxeterGroupOrder(N): MonStgElt -> .`

<a id="function-coxetergroupfactoredorder-monstgelt"></a>
#### `CoxeterGroupFactoredOrder(N): MonStgElt -> .`

The (factored) order of the Coxeter group with Cartan name given by the string $N$.

<a id="function-numberofpositiveroots-monstgelt"></a>
#### `NumberOfPositiveRoots(N): MonStgElt -> .`

<a id="function-numposroots-monstgelt"></a>
#### `NumPosRoots(N): MonStgElt -> .`

The number of positive roots of the Coxeter group with Cartan name given by the string $N$. See Subsection [Simple and Positive Roots](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#subsectrspossimple) for the definition of positive roots.

<a id="function-fundamentalgroup-monstgelt"></a>
#### `FundamentalGroup(N): MonStgElt -> GrpAb`

The fundamental group of the crystallographic Cartan matrix with Cartan name given by the string $N$, i.e. ${\mathbb{Z}}^n/\Gamma$ where $\Gamma$ is the lattice generated by the rows of the Cartan matrix. The natural mapping ${\mathbb{Z}}^n\to{\mathbb{Z}}^n/\Gamma$ is the second returned value.

<a id="example-ex-d07ed7"></a>
#### `Example: Coxeter Group Orders (ex-d07ed7)`

```magma
> CoxeterGroupOrder("F4");
1152
> CoxeterGroupFactoredOrder("F4");
[ <2, 7>, <3, 2> ]
> NumPosRoots("F4");
24
> #FundamentalGroup("F4");
1
```

<a id="function-cartanname-algmatelt"></a>
#### `CartanName(M): AlgMatElt -> MonStgElt`

<a id="function-cartanname-grphund"></a>
#### `CartanName(G): GrphUnd -> MonStgElt`

<a id="function-cartanname-algmatelt-2"></a>
#### `CartanName(C): AlgMatElt -> MonStgElt`

<a id="function-cartanname-grphdir"></a>
#### `CartanName(D): GrphDir -> MonStgElt`

The Cartan name of a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, or Dynkin digraph $D$. If the corresponding Coxeter group is neither finite nor affine, an error is flagged.

<a id="example-ex-8583c3"></a>
#### `Example: Cartan Name of a Coxeter Matrix (ex-8583c3)`

```magma
> CartanName(SymmetricMatrix([1, 3,1, 2,3,1]));
A3
> CartanName(SymmetricMatrix([1, 3,1, 3,3,1]));
A~2
> CartanName(SymmetricMatrix([1, 3,1, 4,3,1]));
The component at rows and columns [ 1, 2, 3 ]
is not a finite or affine Coxeter matrix
> C := Matrix(4,4, [2,-2,0,0, -1,2,0,0, 0,0,2,-2, 0,0,-1,2] );
> C;
[ 2 -2  0  0]
[-1  2  0  0]
[ 0  0  2 -2]
[ 0  0 -1  2]
```

<a id="procedure-dynkindiagram-algmatelt"></a>
#### `DynkinDiagram(M): AlgMatElt`

<a id="procedure-dynkindiagram-grphund"></a>
#### `DynkinDiagram(G): GrphUnd`

<a id="procedure-dynkindiagram-algmatelt-2"></a>
#### `DynkinDiagram(C): AlgMatElt`

<a id="procedure-dynkindiagram-grphdir"></a>
#### `DynkinDiagram(D): GrphDir`

<a id="procedure-dynkindiagram-monstgelt"></a>
#### `DynkinDiagram(N): MonStgElt`

Print the Dynkin diagram of a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. If the corresponding group is neither affine nor crystallographic, an error is flagged.

<a id="example-ex-08ba7b"></a>
#### `Example: Dynkin Diagram of a Reducible Type (ex-08ba7b)`

```magma
> DynkinDiagram("A~5 D4 BC3");

A~5    1 - 2 - 3 - 4 - 5
       |               |
       ------- 6 -------

D4    9
     /
7 - 8
     \\
      10

BC3    11 - 12 =>= 13
```

<a id="procedure-coxeterdiagram-algmatelt"></a>
#### `CoxeterDiagram(M): AlgMatElt`

<a id="procedure-coxeterdiagram-grphund"></a>
#### `CoxeterDiagram(G): GrphUnd`

<a id="procedure-coxeterdiagram-algmatelt-2"></a>
#### `CoxeterDiagram(C): AlgMatElt`

<a id="procedure-coxeterdiagram-grphdir"></a>
#### `CoxeterDiagram(D): GrphDir`

<a id="procedure-coxeterdiagram-monstgelt"></a>
#### `CoxeterDiagram(N): MonStgElt`

Print the Coxeter diagram of a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. If the corresponding group is not affine or is not crystallographic, an error is flagged.

<a id="example-ex-f3140d"></a>
#### `Example: Coxeter Diagram of a Reducible Type (ex-f3140d)`

```magma
> CoxeterDiagram("A~5 D4 BC3");

A~5    1 - 2 - 3 - 4 - 5
       |               |
       ------- 6 -------

D4    9
     /
7 - 8
     \\
      10

BC3    11 - 12 === 13
```

<a id="related"></a>
<a id="sectcartanhyperbolic"></a>
### Hyperbolic Groups

A hyperbolic reflection group is a group generated by reflections in hyperbolic space. A Coxeter group is called *hyperbolic* if it is infinite, nonaffine, and it has a representation as a discrete, properly acting, hyperbolic reflection group whose Tits’ cone consists entirely of vectors with negative norm (see [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] for more details). A hyperbolic reflection group is *compact hyperbolic* if it is hyperbolic with a compact fundamental region.

Every infinite nonaffine Coxeter group of rank 3 is hyperbolic. There are only 72 hyperbolic groups of rank larger than 3 which, for convenience, are numbered from 1 to 72. The numbering is essentially arbitrary.

<a id="function-iscoxeterhyperbolic-algmatelt"></a>
#### `IsCoxeterHyperbolic(M): AlgMatElt -> BoolElt`

<a id="function-iscoxetercompacthyperbolic-algmatelt"></a>
#### `IsCoxeterCompactHyperbolic(M): AlgMatElt -> BoolElt`

Returns `true` if, and only if, the matrix $M$ is the Coxeter matrix of a (compact) hyperbolic Coxeter group.

<a id="function-iscoxeterhyperbolic-grphund"></a>
#### `IsCoxeterHyperbolic(G): GrphUnd -> BoolElt`

<a id="function-iscoxetercompacthyperbolic-grphund"></a>
#### `IsCoxeterCompactHyperbolic(G): GrphUnd -> BoolElt`

Returns `true` if, and only if, the graph $G$ is the Coxeter graph of a (compact) hyperbolic Coxeter group.

<a id="function-hyperboliccoxetermatrix-rngintelt"></a>
#### `HyperbolicCoxeterMatrix(i): RngIntElt -> AlgMatElt`

The Coxeter matrix of the $i$th hyperbolic Coxeter group of rank larger than 3.

<a id="function-hyperboliccoxetergraph-rngintelt"></a>
#### `HyperbolicCoxeterGraph(i): RngIntElt -> GrphUnd`

The Coxeter graph of the $i$th hyperbolic Coxeter group of rank larger than 3.

<a id="example-ex-4b6e52"></a>
#### `Example: Compact Hyperbolic Coxeter Matrices (ex-4b6e52)`

```magma
> for i in [1..72] do
>   if IsCoxeterCompactHyperbolic(HyperbolicCoxeterMatrix(i)) then
>     printf "%o, ", i;
>   end if;
> end for;
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
```

<a id="related-2"></a>
<a id="sectcartanrelated"></a>
### Related Structures

In this section functions for creating other structures from Coxeter matrices, Coxeter graphs, Cartan matrices, Dynkin diagrams, and Cartan names are listed. The reader is referred to the appropriate sections of the Handbook for more details.

<a id="function-rootsystem-algmatelt"></a>
#### `RootSystem(M): AlgMatElt -> RootSys`

<a id="function-rootsystem-grphund"></a>
#### `RootSystem(G): GrphUnd -> RootSys`

<a id="function-rootsystem-algmatelt-2"></a>
#### `RootSystem(C): AlgMatElt -> RootSys`

<a id="function-rootsystem-grphdir"></a>
#### `RootSystem(D): GrphDir -> RootSys`

<a id="function-rootsystem-monstgelt"></a>
#### `RootSystem(N): MonStgElt -> RootSys`

The finite root system of a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. If the corresponding Coxeter group is infinite, an error is flagged. See Chapter [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys).

<a id="function-rootdatum-algmatelt"></a>
#### `RootDatum(C): AlgMatElt -> RootDtm`

<a id="function-rootdatum-algmatelt-2"></a>
#### `RootDatum(M): AlgMatElt -> RootDtm`

<a id="function-rootdatum-grphund"></a>
#### `RootDatum(G): GrphUnd -> RootDtm`

<a id="function-rootdatum-grphdir"></a>
#### `RootDatum(D): GrphDir -> RootDtm`

<a id="function-rootdatum-monstgelt"></a>
#### `RootDatum(N): MonStgElt -> RootDtm`

The finite root datum of a crystallographic Cartan matrix $C$, Coxeter matrix $M$, Coxeter graph $G$, Dynkin digraph $D$, or Cartan name given by the string $N$. If the corresponding Coxeter group is infinite, an error is flagged. See Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm).

<a id="function-coxetergroup-cat-algmatelt"></a>
#### `CoxeterGroup(grpcat, M): Cat, AlgMatElt -> grpcat`

<a id="function-coxetergroup-cat-grphund"></a>
#### `CoxeterGroup(grpcat, G): Cat, GrphUnd -> grpcat`

<a id="function-coxetergroup-cat-grphdir"></a>
#### `CoxeterGroup(grpcat, D): Cat, GrphDir -> grpcat`

<a id="function-coxetergroup-cat-monstgelt"></a>
#### `CoxeterGroup(grpcat, N): Cat, MonStgElt -> grpcat`

The Coxeter group in the category given by the first argument, which can be [`GrpMat`](https://docs.magma-maths.org/FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat) (a reflection group), [`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox), `GrpFP` (a finitely presented group), [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) or `GrpPerm` (a permutation group).

The second argument can be a Coxeter matrix, a Cartan matrix, a Coxeter graph, a Dynkin digraph, or a Cartan name given by a string.

If the first argument is [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) or `GrpPerm` and the corresponding Coxeter group is infinite, an error is flagged. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox).

<a id="function-coxetergroup-algmatelt"></a>
#### `CoxeterGroup(M): AlgMatElt -> Grp`

<a id="function-coxetergroup-algmatelt-2"></a>
#### `CoxeterGroup(C): AlgMatElt -> Grp`

<a id="function-coxetergroup-grphund"></a>
#### `CoxeterGroup(G): GrphUnd -> Grp`

<a id="function-coxetergroup-grphdir"></a>
#### `CoxeterGroup(D): GrphDir -> Grp`

<a id="function-coxetergroup-monstgelt"></a>
#### `CoxeterGroup(N): MonStgElt -> Grp`

The Coxeter group of a Coxeter matrix, a Cartan matrix, Coxeter graph, a Dynkin digraph, or the Cartan name given by a string. If the resulting Coxeter group is finite, it is returned as a permutation group; otherwise it is returned as a finitely presented group.

<a id="function-reflectiongroup-algmatelt"></a>
#### `ReflectionGroup(M): AlgMatElt -> GrpMat`

<a id="function-reflectiongroup-grphund"></a>
#### `ReflectionGroup(G): GrphUnd -> GrpMat`

<a id="function-reflectiongroup-algmatelt-2"></a>
#### `ReflectionGroup(C): AlgMatElt -> GrpMat`

<a id="function-reflectiongroup-grphdir"></a>
#### `ReflectionGroup(D): GrphDir -> GrpMat`

<a id="function-reflectiongroup-monstgelt"></a>
#### `ReflectionGroup(N): MonStgElt -> GrpMat`

The reflection group of a Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. See Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-liealgebra-algmatelt-rng"></a>
#### `LieAlgebra(C, k): AlgMatElt, Rng -> AlgLie`

<a id="function-liealgebra-grphdir-rng"></a>
#### `LieAlgebra(D, k): GrphDir, Rng -> AlgLie`

<a id="function-liealgebra-monstgelt-rng"></a>
#### `LieAlgebra(N, k): MonStgElt, Rng -> AlgLie`

```magma
Isogeny: Any                    Default: "Ad"
```

The Lie algebra over the ring $k$ of a crystallographic Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. The Lie algebra is constructed from a root datum with the given `Isogeny` (see Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). If the corresponding Coxeter group is not crystallographic, an error is flagged. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="function-matrixliealgebra-algmatelt-rng"></a>
#### `MatrixLieAlgebra(C, k): AlgMatElt, Rng -> AlgLie`

<a id="function-matrixliealgebra-grphdir-rng"></a>
#### `MatrixLieAlgebra(D, k): GrphDir, Rng -> AlgLie`

<a id="function-matrixliealgebra-monstgelt-rng"></a>
#### `MatrixLieAlgebra(N, k): MonStgElt, Rng -> AlgLie`

The Lie algebra over the ring $k$ of a crystallographic Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. It is the standard representation of the Lie algebra constructed from a root datum with the default `Isogeny` (see Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). If the corresponding Coxeter group is not crystallographic, an error is flagged. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="function-groupoflietype-algmatelt-rng"></a>
#### `GroupOfLieType(C, k): AlgMatElt, Rng -> GrpLie`

<a id="function-groupoflietype-grphdir-rng"></a>
#### `GroupOfLieType(D, k): GrphDir, Rng -> GrpLie`

<a id="function-groupoflietype-monstgelt-rng"></a>
#### `GroupOfLieType(N, k): MonStgElt, Rng -> GrpLie`

```magma
Isogeny: Any                    Default: "Ad"
```

The group of Lie type over the ring $k$ of a crystallographic Cartan matrix $C$, Dynkin digraph $D$, or Cartan name given by the string $N$. If the corresponding Coxeter group is infinite, an error is flagged. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="chaprootsys"></a>
<a id="id1"></a>
## Root Systems

- [Introduction](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md)
  - [Reflections](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#reflections)
  - [Definition of a Root System](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#definition-of-a-root-system)
  - [Simple and Positive Roots](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#simple-and-positive-roots)
  - [The Coxeter Group](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#the-coxeter-group)
  - [Nonreduced Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/introduction.md#nonreduced-root-systems)
- [Constructing Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md)
  - [`RootSystem(N): MonStgElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-intrrootsystemn)
  - [Example: Root Systems from a Name](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#example-ex-ff0977)
  - [`RootSystem(M): AlgMatElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-rootsystem-algmatelt)
  - [`RootSystem(G): GrphUnd → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-rootsystem-grphund)
  - [`RootSystem(C): AlgMatElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-rootsystem-algmatelt-2)
  - [`RootSystem(D): GrphDir → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-rootsystem-grphdir)
  - [Example: Root Systems from a Matrix](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#example-ex-4f54b6)
  - [`RootSystem(A, B): Mtrx, Mtrx → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-rootsystem-mtrx-mtrx)
  - [Example: Nonsemisimple Root System of Type G2](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#example-ex-ad34e4)
  - [`IrreducibleRootSystem(X, n): MonStgElt, RngIntElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-irreduciblerootsystem-monstgelt-rngintelt)
  - [`StandardRootSystem(X, n): MonStgElt, RngIntElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-intrstandardrootsystem)
  - [Example: Irreducible Dihedral Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#example-ex-28a4fc)
  - [`ToralRootSystem(n): RngIntElt → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-toralrootsystem-rngintelt)
  - [`TrivialRootSystem() → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-trivialrootsystem)
- [Operators on Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md)
  - [`R1 eq R2: RootSys, RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#operation-op-eq-rootsys-rootsys)
  - [`IsIsomorphic(R1, R2): RootSys, RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-isisomorphic-rootsys-rootsys)
  - [`IsCartanEquivalent(R1, R2): RootSys, RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-iscartanequivalent-rootsys-rootsys)
  - [Example: Isomorphism and Cartan Equivalence](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#example-ex-d4eea1)
  - [`CartanName(R): RootSys → List`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-cartanname-rootsys)
  - [`CoxeterDiagram(R): RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#procedure-coxeterdiagram-rootsys)
  - [`DynkinDiagram(R): RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#procedure-dynkindiagram-rootsys)
  - [`CoxeterMatrix(R): RootSys → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-coxetermatrix-rootsys)
  - [`CoxeterGraph(R): RootSys → GrphUnd`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-coxetergraph-rootsys)
  - [`CartanMatrix(R): RootSys → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-cartanmatrix-rootsys)
  - [`DynkinDigraph(R): RootSys → GrphDir`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-dynkindigraph-rootsys)
  - [Example: Dynkin and Coxeter Diagrams](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#example-ex-f78777)
  - [`BaseField(R): RootSys → Fld`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-basefield-rootsys)
  - [`BaseRing(R): RootSys → Fld`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-basering-rootsys)
  - [`RealInjection(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-realinjection-rootsys)
  - [`Rank(R): RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-rank-rootsys)
  - [`Dimension(R): RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-dimension-rootsys)
  - [`CoxeterGroupOrder(R): RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#function-coxetergrouporder-rootsys)
  - [Example: Base Field, Rank, and Coxeter Group Order](https://docs.magma-maths.org/LieTheory/RootSystems/operators-root-sys.md#example-ex-5eca2e)
- [Properties of Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md)
  - [`IsIrreducible(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-isirreducible-rootsys)
  - [`IsProjectivelyIrreducible(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-isprojectivelyirreducible-rootsys)
  - [`IsReduced(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-isreduced-rootsys)
  - [`IsSemisimple(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-issemisimple-rootsys)
  - [`IsCrystallographic(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-iscrystallographic-rootsys)
  - [`IsSimplyLaced(R): RootSys → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#function-issimplylaced-rootsys)
  - [Example: Testing Properties of a Root System](https://docs.magma-maths.org/LieTheory/RootSystems/properties-root-system.md#example-ex-a19f70)
- [Roots and Coroots](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md)
  - [Accessing Roots and Coroots](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#accessing-roots-and-coroots)
    - [`RootSpace(R): RootSys → ModTupFld`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rootspace-rootsys)
    - [`CorootSpace(R): RootSys → ModTupFld`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-corootspace-rootsys)
    - [`SimpleRoots(R): RootSys → Mtrx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-simpleroots-rootsys)
    - [`SimpleCoroots(R): RootSys → Mtrx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-simplecoroots-rootsys)
    - [Example: Root and Coroot Spaces](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-fe8350)
    - [`NumberOfPositiveRoots(R): RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-numberofpositiveroots-rootsys)
    - [`NumPosRoots(R): RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-numposroots-rootsys)
    - [`Roots(R): RootSys → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-roots-rootsys)
    - [`Coroots(R): RootSys → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-coroots-rootsys)
    - [`PositiveRoots(R): RootSys → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-positiveroots-rootsys)
    - [`PositiveCoroots(R): RootSys → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-positivecoroots-rootsys)
    - [`Root(R, r): RootSys, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-root-rootsys-rngintelt)
    - [`Coroot(R, r): RootSys, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-coroot-rootsys-rngintelt)
    - [`RootPosition(R, v): RootSys, . → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rootposition-rootsys)
    - [`CorootPosition(R, v): RootSys, . → SetIndx`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-corootposition-rootsys)
    - [Example: Roots and Coroots of a Root System](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-89c0a9)
    - [`HighestRoot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestroot-rootsys)
    - [`HighestCoroot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestcoroot-rootsys)
    - [`HighestLongRoot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestlongroot-rootsys)
    - [`HighestLongCoroot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestlongcoroot-rootsys)
    - [`HighestShortRoot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestshortroot-rootsys)
    - [`HighestShortCoroot(R): RootSys → .`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-highestshortcoroot-rootsys)
    - [Example: Highest Roots](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-77bd29)
    - [`CoxeterForm(R): RootSys → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-coxeterform-rootsys)
    - [`DualCoxeterForm(R): RootSys → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-dualcoxeterform-rootsys)
  - [Reflections](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#reflections)
    - [`SimpleReflectionMatrices(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-simplereflectionmatrices-rootsys)
    - [`SimpleCoreflectionMatrices(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-simplecoreflectionmatrices-rootsys)
    - [`ReflectionMatrices(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionmatrices-rootsys)
    - [`CoreflectionMatrices(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-coreflectionmatrices-rootsys)
    - [`ReflectionMatrix(R, r): RootSys, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionmatrix-rootsys-rngintelt)
    - [`CoreflectionMatrix(R, r): RootSys, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-coreflectionmatrix-rootsys-rngintelt)
    - [`SimpleReflectionPermutations(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-simplereflectionpermutations-rootsys)
    - [`ReflectionPermutations(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionpermutations-rootsys)
    - [`ReflectionPermutation(R, r): RootSys, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionpermutation-rootsys-rngintelt)
    - [`ReflectionWords(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionwords-rootsys)
    - [`ReflectionWord(R, r): RootSys, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-reflectionword-rootsys-rngintelt)
    - [Example: Reflection Matrices, Permutations, and Words](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-a58034)
  - [Operations and Properties for Roots and Coroot Indices](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#operations-and-properties-for-roots-and-coroot-indices)
    - [`Sum(R, r, s): RootSys, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-sum-rootsys-rngintelt-rngintelt)
    - [`IsPositive(R, r): RootSys, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-ispositive-rootsys-rngintelt)
    - [`IsNegative(R, r): RootSys, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-isnegative-rootsys-rngintelt)
    - [`Negative(R, r): RootSys, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-negative-rootsys-rngintelt)
    - [Example: Arithmetic with Root Indices](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-8a578c)
    - [`RootHeight(R, r): RootSys, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rootheight-rootsys-rngintelt)
    - [`CorootHeight(R, r): RootSys, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-corootheight-rootsys-rngintelt)
    - [`RootNorms(R): RootSys → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rootnorms-rootsys)
    - [`CorootNorms(R): RootSys → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-corootnorms-rootsys)
    - [`RootNorm(R, r): RootSys, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rootnorm-rootsys-rngintelt)
    - [`CorootNorm(R, r): RootSys, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-corootnorm-rootsys-rngintelt)
    - [`IsLongRoot(R, r): RootSys, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-islongroot-rootsys-rngintelt)
    - [`IsShortRoot(R, r): RootSys, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-isshortroot-rootsys-rngintelt)
    - [`IsIndivisibleRoot(R, r): RootSys, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-isindivisibleroot-rootsys-rngintelt)
    - [`LeftString(R, r, s): RootSys, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-leftstring-rootsys-rngintelt-rngintelt)
    - [`RightString(R, r, s): RootSys, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rightstring-rootsys-rngintelt-rngintelt)
    - [`LeftStringLength(R, r, s): RootSys, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-leftstringlength-rootsys-rngintelt-rngintelt)
    - [`RightStringLength(R, r, s): RootSys, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-rightstringlength-rootsys-rngintelt-rngintelt)
    - [Example: Heights, Norms, and Root Strings](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-e2515b)
    - [`AdditiveOrder(R): RootSys → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-additiveorder-rootsys)
    - [`IsAdditiveOrder(R, Q): RootSys, [RngIntElt] → BoolElt`](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#function-isadditiveorder-rootsys-rngintelt)
    - [Example: Additive Order on Positive Roots](https://docs.magma-maths.org/LieTheory/RootSystems/roots-coroots-weights.md#example-ex-20f94b)
- [Building Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md)
  - [`sub<R | a>: RootSys, SetEnum → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#constructor-constructor-sub-rootsys-setenum-rootsys)
  - [`sub<R | s>: RootSys, SetEnum → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#constructor-constructor-sub-rootsys-setenum-rootsys-2)
  - [`R1 subset R2: RootSys, RootSys → BoolElt, .`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#operation-op-subset-rootsys-rootsys)
  - [`R1 + R2: RootSys, RootSys → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#operation-op-plus-rootsys-rootsys)
  - [`DirectSum(R1, R2): RootSys, RootSys → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#function-directsum-rootsys-rootsys)
  - [`R1 join R2: RootSys, RootSys → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#operation-op-join-rootsys-rootsys)
  - [Example: Sums of Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#example-ex-f885fa)
  - [`DirectSumDecomposition(R): RootSys → []`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#function-directsumdecomposition-rootsys)
  - [`IndecomposableSummands(R): RootDtm → [], RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#function-indecomposablesummands-rootdtm)
  - [`Dual(R): RootSys → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#function-dual-rootsys)
  - [`IndivisibleSubsystem(R): RootSys → RootSys`](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#function-indivisiblesubsystem-rootsys)
  - [Example: Direct Sums and Duals of Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/create-new-root-system.md#example-ex-feab7e)
- [Related Structures](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md)
  - [`RootDatum(R): RootSys → RootDtm`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-rootdatum-rootsys)
  - [`CoxeterGroup(grpcat,R): Cat, RootSys → grpcat`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-coxetergroup-cat-rootsys)
  - [`CoxeterGroup(R): RootSys → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-coxetergroup-rootsys)
  - [`WeylGroup(R): RootSys → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-weylgroup-rootsys)
  - [`CoxeterGroup(GrpPermCox, R): Cat, RootSys → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-coxetergroup-cat-rootsys-2)
  - [`ReflectionGroup(R): RootSys → GrpMat`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-reflectiongroup-rootsys)
  - [`CoxeterGroup(GrpPermCox, W): Cat, RootSys → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-coxetergroup-cat-rootsys-3)
  - [`LieAlgebra(R, k): RootSys, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-liealgebra-rootsys-rng)
  - [`MatrixLieAlgebra(R, k): RootSys → GrpMat`](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#function-matrixliealgebra-rootsys)
  - [Example: Structures Related to a Root System](https://docs.magma-maths.org/LieTheory/RootSystems/related-structures.md#example-ex-3411ae)
- [Bibliography](https://docs.magma-maths.org/LieTheory/RootSystems/bibliography.md)

<a id="sectrsintro"></a>
<a id="id1"></a>
### Introduction

This chapter describes Magma functions for computing with finite real root systems. A root system describes the reflections in a reflection group (Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl)). Root systems are essential in the theories of finite Coxeter groups (Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)) and Lie algebras (Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie)). See [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] for more details on the theory of root systems. The closely related concept of a root datum is discussed in Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm).

<a id="refl"></a>
<a id="subsectrsrfl"></a>
#### Reflections

Let $X$ and $Y$ be vector spaces over a field $k$ with bilinear pairing $\langle\circ,\circ\rangle:X\times Y\rightarrow k$ that identifies $Y$ with the dual of $X$. Given nonzero $\alpha\in X$ and $\alpha^\star\in Y$, the linear map $s_\alpha:X\rightarrow X$ is defined by

$$
x s_\alpha= x - \langle x,\alpha^\star\rangle\alpha
$$

and the linear map $s_\alpha^\star:Y\rightarrow Y$ by

$$
y s_\alpha^\star= y - \langle\alpha,y \rangle\alpha^\star.
$$

These maps are called *reflections* if one of the following equivalent properties hold: $\langle\alpha,\alpha^\star\rangle=2$; ${s_\alpha}^2=1$; $\langle xs_\alpha,ys_\alpha^\star\rangle = \langle x,y\rangle$ for all $x\in X$ and $y\in Y$; $\alpha s_\alpha=-\alpha$. The mapping $s_\alpha^\star$ is also called a *coreflection*: this just means it is a reflection defined on $Y$ instead of $X$. Magma functions for computing with reflections are described in Section [Construction of Pseudo-reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#sectrefgrprfl).

If $X$ has an inner product, then we can take $Y=X$ and use the inner product as our pairing. In Magma, we generally take $X=Y$ to be a row space, with the bilinear pairing given by the standard inner product $\langle x,y\rangle = xy^T$. However, it is sometimes useful to allow $X$ and $Y$ to be distinct subspaces of a row space.

For the purposes of this chapter, $k$ will always be the rational field (Chapter [Rational Field](https://docs.magma-maths.org/BasicRings/Rationals/index-rationals.md#fldrat)), a number field (Chapter [Rational Field](https://docs.magma-maths.org/BasicRings/Rationals/index-rationals.md#fldrat)), or a cyclotomic field (Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)). The real field (Chapter [Real and Complex Fields](https://docs.magma-maths.org/BasicRings/RealAndComplexFields/index-real-and-complex-fields.md#chapfldre)) is *not* allowed since it is not infinite precision.

<a id="rootsys"></a>
<a id="subsectrsdefn"></a>
#### Definition of a Root System

Suppose $\Phi$ is a finite subset of $X\setminus \{0\}$. For each $\alpha$ in $\Phi$, suppose a corresponding nonzero $\alpha^\star$ in $Y$ is given; set $\Phi^\star=\{\alpha^\star\mid\alpha\in\Phi\}$. The tuple $R=(X,\Phi,Y,\Phi^\star)$ is called a *root system* if the following conditions are satisfied for every $\alpha$ in $\Phi$

1. $s_\alpha$ and $s_\alpha^\star$ are reflections;
2. $\Phi$ is closed under the action of $s_\alpha$; and
3. $\Phi^\star$ is closed under the action of $s_\alpha^\star$.

The set $X$ is called the *root space* and $Y$ is called the *coroot space*. The elements of $\Phi$ are called *roots* and the elements of $\Phi^\star$ are called *coroots*. A root system is said to be *crystallographic* if $\langle\alpha,\beta^\star\rangle$ is integral for every root $\alpha$ and coroot $\beta^\star$. A root system is *reduced*, if $\alpha,\beta\in\Phi$ with $\beta$ a scalar product of $\alpha$ implies $\alpha=\pm\beta$. Note that it is possible for the set of roots to be empty, in which case the system is called *toral*.

<a id="positive-simple-roots"></a>
<a id="subsectrspossimple"></a>
#### Simple and Positive Roots

A subset $\Delta$ of $\Phi$ is called a set of *simple roots* if

1. $\Delta$ is a basis for the span of the roots $k\Phi\le X$; and
2. $\Phi = \Phi^+\cup\Phi^-$, where $\Phi^+$ is the set of linear combinations of elements of $\Delta$ with nonnegative coefficients, and $\Phi^- = -\Phi^+$. Every root system has a set of simple roots. Simple roots are frequently called fundamental roots. The elements of $\Phi^+$ are called *positive roots* and the elements of $\Phi^-$ are called *negative roots*. The coroots corresponding to the simple (respectively, positive, negative) roots are the *simple* (respectively, *positive*, *negative*) *coroots*.

The *rank* of a root system is the size of $\Delta$, i.e. the dimension of the subspace $k\Phi$. The rank cannot be larger than the *dimension* of the root system (i.e. the dimension of $X$); if the rank and dimension are equal, the root system is said to be *semisimple*.

Choose a basis $e_1,\dots,e_d$ for $X$ and a dual basis $f_1,\dots,f_d$ for $Y$, so that $\langle e_i,f_j\rangle=\delta_{ij}$. A reduced root system is determined by a pair of real matrices $A$ and $B$ where the rows of $A$ are the simple roots and the rows of $B$ are the corresponding coroots; i.e. $A_{ij}=\langle\alpha_i,f_j\rangle$ and $B_{ij}=\langle e_j,\alpha_i^\star\rangle$.

<a id="positive-simple-roots-2"></a>
<a id="subsectrscoxgrp"></a>
#### The Coxeter Group

The group $W$ generated by the reflections $s_\alpha$, for $\alpha$ a simple root, is a finite Coxeter group. The *Cartan matrix* of a root system is

$$
C =
  \left(\left\langle\,\alpha_i,\alpha_j^\star\,\right\rangle\right)_{i,j=1}^n =
  AB^t.
$$

Note that the root system is crystallographic if, and only if, its Cartan matrix is crystallographic. As in Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan), the Cartan matrix is used to define the Coxeter matrix, Coxeter graph, and Dynkin digraph of a root system.

The classification of Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff) applies to reduced semisimple root systems. The isomorphism class of a reduced root system is determined by its Coxeter graph and its dimension.

A *Coxeter form* is a $W$-invariant bilinear form on $X$. If $R$ is reduced and irreducible, then the roots can have at most two different lengths with respect to this form. We call the roots *long* or *short* accordingly. The Coxeter form is normalised so that the short roots in each component have length one. Note that, even if $X=Y$, this form will generally not be the same as the pairing $\langle\circ,\circ\rangle$; however it can be arranged for them to be the same (see [`StandardRootSystem`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-intrstandardrootsystem)).

<a id="nonred-root-systems"></a>
<a id="subsectrsnonred"></a>
#### Nonreduced Root Systems

A root system is *reduced*, if $\alpha,\beta\in\Phi$ with $\beta$ a scalar product of $\alpha$ implies $\alpha=\pm\beta$. A root $\alpha$ with the property $2\alpha\notin \Phi$ is called *reduced*. A root $\alpha$ with the property ${1\over 2}\alpha\in\Phi$ is called *divisible*. If $R$ is a root system, then the set $R_0$ of indivisible roots in $R$ form the *indivisible subsystem*.

Let $R$ be a nonreduced irreducible *crystallographic* root system of rank $n$. It can be shown that $R_0$ is irreducible of type of type $B_n$ and every root is either in $R_0$, or is two times a short root of $R_0$. The Cartan type of $R$ in this case is $BC_n$. For noncrystallographic root systems the situation is more complex.

Note that the Cartan matrix, Coxeter matrix, Coxeter diagram, Coxeter group, and Dynkin diagram are the same for $R$ and $R_0$. Thus, when creating a non-reduced crystallographic root system for a given Cartan matrix, Coxeter matrix, Coxeter diagram, Coxeter group, or Dynkin diagram, one must specify the set of nonreduced simple roots. For example, let $C$ be a cartan matrix of type $B_2\times B_3$. Then the set of non-reduced fundamental roots can be one of $\emptyset$, $\{2\}$, $\{5\}$, or $\{2,5\}$, in which cases the root system will be of types $B_2\times B_3$, $BC_2\times B_3$, $B_2\times BC_3$, or $BC_2\times BC_3$ respectively.

<a id="construct-root-system"></a>
<a id="sectrsconstr"></a>
### Constructing Root Systems

We first describe some optional parameters that are common to many functions described in this section.

```magma
RealInjection: Any                    Default: false
```

Number field elements and cyclotomic field elements do not have a natural identification with real numbers. The `RealInjection` flag allows the user to provide one. If the base field of the Cartan matrix $C$ is a number field, the flag should be an injection into the real field; if the base field is cyclotomic, the flag should be an injection into the complex field taking real values on the entries of $C$ (see more in Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat)).

```magma
Nonreduced: SetEnum                    Default: {}
```

The optional argument `Nonreduced` is used to distinguish the reducedness of a root system in case the input doesn’t uniquely determine it.

```magma
Symmetric: BoolElt                    Default: false
```

If the `Symmetric` flag is set `true`, the symmetric Cartan matrix is used. For types $I_2(m)$, $H_3$, $H_4$ the symmetric Cartan matrix is *always* used, since the root system is nonreduced otherwise.

```magma
BaseField: MonStgElt                    Default: "NumberField"
```

The `BaseField` flag determines the field over which the Cartan matrix is defined. The possible values are:

1. `"NumberField"`: An algebraic number field. This is the default. See Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main).
2. `"Cyclotomic"` or `"SparseCyclotomic"`: A cyclotomic field with the sparse representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).
3. `"DenseCyclotomic"`: A cyclotomic field with the dense representation for elements. See Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc).

<a id="function-intrrootsystemn"></a>
#### `RootSystem(N): MonStgElt -> RootSys`

```magma
Symmetric: BoolElt                      Default: false
BaseField: MonStgElt                    Default: "NumberField"
```

The root system with Cartan name given by the string $N$. In addition to the Cartan names in Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff), we allow `"BCn"` for the irreducible nonreduced system, and `"Tn"` for the $n$-dimensional toral subsystem. Note that `"Tn"` is used for input only and does not appear in the string returned by `CartanName` when applied to the resulting root system (see example below). For descriptions of the parameters `Symmetric` and `BaseField` see the beginning of this section

<a id="example-ex-ff0977"></a>
#### `Example: Root Systems from a Name (ex-ff0977)`

```magma
> RootSystem("H3 E6");
Root system of type H3 E6
> RootSystem("A2 T1 I2(5)");
Root system of type A2 I2(5)
```

<a id="function-rootsystem-algmatelt"></a>
#### `RootSystem(M): AlgMatElt -> RootSys`

<a id="function-rootsystem-grphund"></a>
#### `RootSystem(G): GrphUnd -> RootSys`

```magma
Nonreduced: SetEnum                      Default: {}
Symmetric : BoolElt                      Default: false
BaseField : MonStgElt                    Default: "NumberField"
```

The semisimple root system with Coxeter matrix $M$ or Coxeter graph $G$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)). If the corresponding Coxeter group is infinite, an error is flagged. For descriptions of the parameters `Nonreduced`, `Symmetric`, and `BaseField` see the beginning of this section.

<a id="function-rootsystem-algmatelt-2"></a>
#### `RootSystem(C): AlgMatElt -> RootSys`

```magma
RealInjection: Any                        Default: false
Nonreduced   : SetEnum                    Default: {}
```

The semisimple root system with Cartan matrix $C$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)). If the corresponding Coxeter group is infinite, an error is flagged. For descriptions of the parameters `RealInjection` and `Nonreduced` see the beginning of this section.

<a id="function-rootsystem-grphdir"></a>
#### `RootSystem(D): GrphDir -> RootSys`

```magma
Nonreduced: SetEnum                    Default: {}
```

The semisimple crystallographic root system with Cartan matrix $C$, or Dynkin diagram $D$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)). If the corresponding Coxeter group is infinite, an error is flagged. For a description of the parameter `Nonreduced` see the beginning of this section.

<a id="example-ex-4f54b6"></a>
#### `Example: Root Systems from a Matrix (ex-4f54b6)`

```magma
> M := SymmetricMatrix([1, 3,1, 2,3,1]);
> RootSystem(M);
Root system of type A3
> M := SymmetricMatrix([1, 3,1, 3,3,1]);
> RootSystem(M);

>> RootSystem(M);
             ^
Runtime error in 'RootSystem': Not a finite root system in rows/columns
[ 1, 2, 3 ]
```

<a id="function-rootsystem-mtrx-mtrx"></a>
#### `RootSystem(A, B): Mtrx, Mtrx -> RootSys`

```magma
RealInjection: Any                        Default: false
Nonreduced   : SetEnum                    Default: {}
```

The root system with simple roots given by the rows of the matrix $A$ and simple coroots given by the rows of the matrix $B$. The matrices $A$ and $B$ must have the following properties:

1. $A$ and $B$ must have the same number of rows and the same number of columns; they must be defined over the same ring, which must be the integers, the rational field, a number field, or a cyclotomic field;
2. the number of columns must be at least the number of rows; and
3. $AB^t$ must be the Cartan matrix of a finite Coxeter group.

For descriptions of the parameters `RealInjection` and `Nonreduced` see the beginning of this section.

<a id="example-ex-ad34e4"></a>
#### `Example: Nonsemisimple Root System of Type G2 (ex-ad34e4)`

The following code creates a nonsemisimple root system of type $G_2$.

```magma
> A := Matrix(2,3, [1,-1,0, -1,1,-1]);
> B := Matrix(2,3, [1,-1,1, 0,1,-1]);
> RootSystem(A, B);
Root system of type G2
```

<a id="function-irreduciblerootsystem-monstgelt-rngintelt"></a>
#### `IrreducibleRootSystem(X, n): MonStgElt, RngIntElt -> RootSys`

```magma
Symmetric: BoolElt                      Default: false
BaseField: MonStgElt                    Default: "NumberField"
```

The irreducible root system with Cartan name $X_n$ (or $I_2(n)$ if $X=``I"$) given by the string $X$ and integer $n$. In addition to the Cartan names in Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff), we allow `"BCn"` for the irreducible nonreduced system. For descriptions of the parameters `Symmetric` and `BaseField` see the beginning of this section.

<a id="function-intrstandardrootsystem"></a>
#### `StandardRootSystem(X, n): MonStgElt, RngIntElt -> RootSys`

The standard root system with Cartan name $X_n$ (or $I_2(n)$ if $X=``I"$) given by the string $X$ and integer $n$, i.e. the root system whose Coxeter form is the same as the standard inner product. In addition to the Cartan names in Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff), we allow `"BCn"` for the irreducible nonreduced system. For type $A_n$, the standard root system is not semisimple.

<a id="example-ex-28a4fc"></a>
#### `Example: Irreducible Dihedral Root Systems (ex-28a4fc)`

```magma
> Rs := { IrreducibleRootSystem("I", n) : n in [3..20] };
> { R : R in Rs | IsCrystallographic(R) };
{
    Root system of type I2(3) ,
    Root system of type I2(4) ,
    Root system of type I2(6)
}
```

<a id="function-toralrootsystem-rngintelt"></a>
#### `ToralRootSystem(n): RngIntElt -> RootSys`

The toral root system of dimension $n$, i.e., the $n$-dimensional root system with no roots or coroots.

<a id="function-trivialrootsystem"></a>
#### `TrivialRootSystem() -> RootSys`

The trivial root system of dimension $0$.

<a id="operators-root-sys"></a>
<a id="sectrsop"></a>
### Operators on Root Systems

<a id="operation-op-eq-rootsys-rootsys"></a>
#### `R1 eq R2: RootSys, RootSys -> BoolElt`

Returns `true` if, and only if, the root systems $R_1$ and $R_2$ are identical.

<a id="function-isisomorphic-rootsys-rootsys"></a>
#### `IsIsomorphic(R1, R2): RootSys, RootSys -> BoolElt`

Returns `true` if, and only if, root systems $R_1$ and $R_2$ are isomorphic.

<a id="function-iscartanequivalent-rootsys-rootsys"></a>
#### `IsCartanEquivalent(R1, R2): RootSys, RootSys -> BoolElt`

Returns `true` if, and only if, the crystallographic root systems $R_1$ and $R_2$ are Cartan equivalent, i.e. their Cartan matrices are the same modulo a permutation of the underlying basis.

<a id="example-ex-d4eea1"></a>
#### `Example: Isomorphism and Cartan Equivalence (ex-d4eea1)`

Note that the root systems $B_n$ and $C_n$ are isomorphic but not Cartan equivalent. Hence Cartan equivalence is *not* an invariant of a root system since it depends on the particular representation of the (co)roots within the (co)root space.

```magma
> R := RootSystem("B4");  S := RootSystem("C4");
> IsIsomorphic(R, S);
true
> IsCartanEquivalent(R, S);
false
```

<a id="function-cartanname-rootsys"></a>
#### `CartanName(R): RootSys -> List`

The Cartan name of the root system $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-coxeterdiagram-rootsys"></a>
#### `CoxeterDiagram(R): RootSys`

Print the Coxeter diagram of the root system $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-dynkindiagram-rootsys"></a>
#### `DynkinDiagram(R): RootSys`

Print the Dynkin diagram of the root system $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)). If $R$ is not crystallographic, an error is flagged.

<a id="function-coxetermatrix-rootsys"></a>
#### `CoxeterMatrix(R): RootSys -> AlgMatElt`

The Coxeter matrix of the root system $R$ (Section [Coxeter Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#sectcartancoxmat)).

<a id="function-coxetergraph-rootsys"></a>
#### `CoxeterGraph(R): RootSys -> GrphUnd`

The Coxeter graph of the root system $R$ (Section [Coxeter Graphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#sectcartancoxgrph)).

<a id="function-cartanmatrix-rootsys"></a>
#### `CartanMatrix(R): RootSys -> AlgMatElt`

The Cartan matrix of the root system $R$ (Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat)).

<a id="function-dynkindigraph-rootsys"></a>
#### `DynkinDigraph(R): RootSys -> GrphDir`

The Dynkin digraph of the root system $R$ (Section [Dynkin Digraphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#sectcartandyndigrph)). If $R$ is not crystallographic, an error is flagged.

<a id="example-ex-f78777"></a>
#### `Example: Dynkin and Coxeter Diagrams (ex-f78777)`

```magma
> R := RootSystem("F4");
> DynkinDiagram(R);

F4    1 - 2 =>= 3 - 4
> CoxeterDiagram(R);

F4    1 - 2 === 3 - 4
```

<a id="function-basefield-rootsys"></a>
#### `BaseField(R): RootSys -> Fld`

<a id="function-basering-rootsys"></a>
#### `BaseRing(R): RootSys -> Fld`

The field over which the root system $R$ is defined.

<a id="function-realinjection-rootsys"></a>
#### `RealInjection(R): RootSys -> .`

The real injection of the root system $R$ (Section [Constructing Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#sectrsconstr)).

<a id="function-rank-rootsys"></a>
#### `Rank(R): RootSys -> RngIntElt`

The rank of the root system $R$, i.e. the number of simple (co)roots.

<a id="function-dimension-rootsys"></a>
#### `Dimension(R): RootSys -> RngIntElt`

The dimension of the root system $R$, i.e. the dimension of the (co)root space. This is always at least as large as the rank, with equality when $R$ is semisimple.

<a id="function-coxetergrouporder-rootsys"></a>
#### `CoxeterGroupOrder(R): RootSys -> RngIntElt`

The order of the Coxeter group of the root system $R$.

<a id="example-ex-5eca2e"></a>
#### `Example: Base Field, Rank, and Coxeter Group Order (ex-5eca2e)`

```magma
> R := RootSystem("I2(7)");
> BaseField(R);
Number Field with defining polynomial x^3 - x^2 - 2*x + 1 over the
Rational Field
> Rank(R) eq Dimension(R);
true
> CoxeterGroupOrder(R);
14
```

<a id="properties-root-system"></a>
<a id="sectrsprop"></a>
### Properties of Root Systems

<a id="function-isirreducible-rootsys"></a>
#### `IsIrreducible(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is irreducible.

<a id="function-isprojectivelyirreducible-rootsys"></a>
#### `IsProjectivelyIrreducible(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is a direct sum of a simple system and a toral system. This is equivalent to $R$ having a connected Coxeter diagram.

<a id="function-isreduced-rootsys"></a>
#### `IsReduced(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is reduced.

<a id="function-issemisimple-rootsys"></a>
#### `IsSemisimple(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is semisimple, i.e. its rank is equal to its dimension.

<a id="function-iscrystallographic-rootsys"></a>
#### `IsCrystallographic(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is crystallographic, i.e. its Cartan matrix is integral.

<a id="function-issimplylaced-rootsys"></a>
#### `IsSimplyLaced(R): RootSys -> BoolElt`

Returns `true` if, and only if, the root system $R$ is simply laced, i.e. its Coxeter graph contains no labelled edges.

<a id="example-ex-a19f70"></a>
#### `Example: Testing Properties of a Root System (ex-a19f70)`

```magma
> R := RootSystem("A5 B2");
> IsIrreducible(R);
false
> IsSemisimple(R);
true
> IsCrystallographic(R);
true
> IsSimplyLaced(R);
false
```

<a id="roots-coroots-weights"></a>
<a id="sectrsroot"></a>
### Roots and Coroots

The roots are stored as an indexed set

$$
\{@\; \alpha_1,\dots,\alpha_N,\alpha_{N+1},\dots,\alpha_{2N} \; @\},
$$

where $\alpha_1,\dots,\alpha_N$ are the positive roots (in an order compatible with height), and $\alpha_{N+1},\dots,\alpha_{2N}$ are the corresponding negative roots (i.e. $\alpha_{i+N}=-\alpha_i$). The simple roots are $\alpha_1,\dots,\alpha_n$ where $n$ is the rank.

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space (this is the default); or
2. `"Root"`: the basis of simple (co)roots.

<a id="access"></a>
<a id="subsectrsrootaccess"></a>
#### Accessing Roots and Coroots

<a id="function-rootspace-rootsys"></a>
##### `RootSpace(R): RootSys -> ModTupFld`

<a id="function-corootspace-rootsys"></a>
##### `CorootSpace(R): RootSys -> ModTupFld`

The vector space containing the (co)roots of the root system $R$, i.e. $X$ (respectively, $Y$).

<a id="function-simpleroots-rootsys"></a>
##### `SimpleRoots(R): RootSys -> Mtrx`

<a id="function-simplecoroots-rootsys"></a>
##### `SimpleCoroots(R): RootSys -> Mtrx`

The simple (co)roots of the root system $R$ as the rows of a matrix, i.e. $A$ (respectively, $B$).

<a id="example-ex-fe8350"></a>
##### `Example: Root and Coroot Spaces (ex-fe8350)`

```magma
> R := RootSystem("G2");
> RootSpace(R);
Full Vector space of degree 2 over Rational Field
> CorootSpace(R);
Full Vector space of degree 2 over Rational Field
> SimpleRoots(R);
[1 0]
[0 1]
> SimpleCoroots(R);
[ 2 -3]
[-1  2]
> CartanMatrix(R);
[ 2 -1]
[-3  2]
```

<a id="function-numberofpositiveroots-rootsys"></a>
##### `NumberOfPositiveRoots(R): RootSys -> RngIntElt`

<a id="function-numposroots-rootsys"></a>
##### `NumPosRoots(R): RootSys -> RngIntElt`

The number of positive roots of the root system $R$. This is also the number of positive coroots. The total number of (co)roots is twice the number of positive (co)roots.

<a id="function-roots-rootsys"></a>
##### `Roots(R): RootSys -> SetIndx`

<a id="function-coroots-rootsys"></a>
##### `Coroots(R): RootSys -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of (co)roots of the root system $R$, i.e. $\{@\,\alpha_1,\dots\alpha_{2N}\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}$).

<a id="function-positiveroots-rootsys"></a>
##### `PositiveRoots(R): RootSys -> SetIndx`

<a id="function-positivecoroots-rootsys"></a>
##### `PositiveCoroots(R): RootSys -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of positive (co)roots of the root system $R$, i.e. $\{@\,\alpha_1,\dots\alpha_N\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}$).

<a id="function-root-rootsys-rngintelt"></a>
##### `Root(R, r): RootSys, RngIntElt -> SetIndx`

<a id="function-coroot-rootsys-rngintelt"></a>
##### `Coroot(R, r): RootSys, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root $\alpha_r$ (respectively, $\alpha_r^\star$) of the root system $R$.

<a id="function-rootposition-rootsys"></a>
##### `RootPosition(R, v): RootSys, . -> SetIndx`

<a id="function-corootposition-rootsys"></a>
##### `CorootPosition(R, v): RootSys, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root in the root system $R$, return its index; otherwise return 0. These functions will try to coerce $v$, which can be a vector or a sequence representing a vector, into the appropriate vector space; $v$ should be written with respect to the basis specified by the parameter `Basis`.

<a id="example-ex-89c0a9"></a>
##### `Example: Roots and Coroots of a Root System (ex-89c0a9)`

```magma
> A := Matrix(2,3, [1,-1,0, -1,1,-1]);
> B := Matrix(2,3, [1,-1,1, 0,1,-1]);
> R := RootSystem(A, B);
> Roots(R);
{@
    (1 -1  0),
    (-1  1 -1),
    (0  0 -1),
    (1 -1 -1),
    (2 -2 -1),
    (1 -1 -2),
    (-1  1  0),
    (1 -1  1),
    (0 0 1),
    (-1  1  1),
    (-2  2  1),
    (-1  1  2)
@}
> PositiveCoroots(R);
{@
    (1 -1  1),
    (0  1 -1),
    (1  2 -2),
    (2  1 -1),
    (1 0 0),
    (1  1 -1)
@}
> #Roots(R) eq 2*NumPosRoots(R);
true
> Root(R, 4);
(1 -1 -1)
> Root(R, 4 : Basis := "Root");
(2 1)
> RootPosition(R, [1,-1,-1]);
4
> RootPosition(R, [2,1] : Basis := "Root");
4
```

<a id="function-highestroot-rootsys"></a>
##### `HighestRoot(R): RootSys -> .`

<a id="function-highestcoroot-rootsys"></a>
##### `HighestCoroot(R): RootSys -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique (co)root of greatest height in the irreducible root system $R$.

<a id="function-highestlongroot-rootsys"></a>
##### `HighestLongRoot(R): RootSys -> .`

<a id="function-highestlongcoroot-rootsys"></a>
##### `HighestLongCoroot(R): RootSys -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique long (co)root of greatest height in the irreducible root system $R$.

<a id="function-highestshortroot-rootsys"></a>
##### `HighestShortRoot(R): RootSys -> .`

<a id="function-highestshortcoroot-rootsys"></a>
##### `HighestShortCoroot(R): RootSys -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique short (co)root of greatest height in the irreducible root system $R$.

<a id="example-ex-77bd29"></a>
##### `Example: Highest Roots (ex-77bd29)`

```magma
> R := RootSystem("G2");
> HighestRoot(R);
(3 2)
> HighestLongRoot(R);
(3 2)
> HighestShortRoot(R);
(2 1)
```

<a id="function-coxeterform-rootsys"></a>
##### `CoxeterForm(R): RootSys -> AlgMatElt`

<a id="function-dualcoxeterform-rootsys"></a>
##### `DualCoxeterForm(R): RootSys -> AlgMatElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix of an inner product on the (co)root space of the root system $R$ which is invariant under the action of the (co)roots. This inner product is uniquely determined up to a constant on each irreducible component of $R$. The inner product is normalised so that the short roots in each crystallographic component have length one.

<a id="rootrefl"></a>
<a id="subsectrsrootaction"></a>
#### Reflections

The root $\alpha$ acts on the root space via the reflection $s_\alpha$; the coroot $\alpha^\star$ acts on the coroot space via the coreflection $s_\alpha^\star$.

<a id="function-simplereflectionmatrices-rootsys"></a>
##### `SimpleReflectionMatrices(R): RootSys -> []`

<a id="function-simplecoreflectionmatrices-rootsys"></a>
##### `SimpleCoreflectionMatrices(R): RootSys -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of matrices giving the action of the simple (co)roots of the root system $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_n}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_n}^\star$).

<a id="function-reflectionmatrices-rootsys"></a>
##### `ReflectionMatrices(R): RootSys -> []`

<a id="function-coreflectionmatrices-rootsys"></a>
##### `CoreflectionMatrices(R): RootSys -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of matrices giving the action of the (co)roots of the root system $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_{2N}}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_{2N}}^\star$).

<a id="function-reflectionmatrix-rootsys-rngintelt"></a>
##### `ReflectionMatrix(R, r): RootSys, RngIntElt -> []`

<a id="function-coreflectionmatrix-rootsys-rngintelt"></a>
##### `CoreflectionMatrix(R, r): RootSys, RngIntElt -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix giving the action of the $r$th (co)root of the root system $R$ on the (co)root space, i.e. the matrix of $s_{\alpha_r}$ (respectively, $s_{\alpha_r}^\star$).

<a id="function-simplereflectionpermutations-rootsys"></a>
##### `SimpleReflectionPermutations(R): RootSys -> []`

The sequence of permutations giving the action of the simple (co)roots of the root system $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutations-rootsys"></a>
##### `ReflectionPermutations(R): RootSys -> []`

The sequence of permutations giving the action of the (co)roots of the root system $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutation-rootsys-rngintelt"></a>
##### `ReflectionPermutation(R, r): RootSys, RngIntElt -> []`

The permutation giving the action of the $r$th (co)root of the root system $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionwords-rootsys"></a>
##### `ReflectionWords(R): RootSys -> []`

The sequence of words in the simple reflections for all the reflections of the root system $R$. These words are given as sequences of integers. In other words, if $[a_1,\dots,a_l] = \hbox{\tt ReflectionWords(R)[r]}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="function-reflectionword-rootsys-rngintelt"></a>
##### `ReflectionWord(R, r): RootSys, RngIntElt -> []`

The word in the simple reflections for the $r$th reflection of the root system $R$. The word is given as a sequence of integers. In other words, if $[a_1,\dots,a_l] = \hbox{\tt ReflectionWord(R,r)}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="example-ex-a58034"></a>
##### `Example: Reflection Matrices, Permutations, and Words (ex-a58034)`

```magma
> R := RootSystem("B3");
> mx := ReflectionMatrix(R, 4);
> perm := ReflectionPermutation(R, 4);
> wd := ReflectionWord(R, 4);
> RootPosition(R, Root(R,2) * mx) eq 2^perm;
true
> perm eq &*[ ReflectionPermutation(R, r) : r in wd ];
true
>
> mx := CoreflectionMatrix(R, 4);
> CorootPosition(R, Coroot(R,2) * mx) eq 2^perm;
true
```

<a id="ops-root-coroot"></a>
<a id="subsectrsrootop"></a>
#### Operations and Properties for Roots and Coroot Indices

<a id="function-sum-rootsys-rngintelt-rngintelt"></a>
##### `Sum(R, r, s): RootSys, RngIntElt, RngIntElt -> RngIntElt`

The index of the sum of the $r$th and $s$th roots in the crystallographic root system $R$, or 0 if the sum is not a root. In other words, if $t = \hbox{\tt Sum(R,r,s)} \ne 0$ then $\alpha_t=\alpha_r+\alpha_s$. We require $\alpha_r\ne\pm\alpha_s$.

<a id="function-ispositive-rootsys-rngintelt"></a>
##### `IsPositive(R, r): RootSys, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the root system $R$ is a positive root.

<a id="function-isnegative-rootsys-rngintelt"></a>
##### `IsNegative(R, r): RootSys, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the root system $R$ is a negative root.

<a id="function-negative-rootsys-rngintelt"></a>
##### `Negative(R, r): RootSys, RngIntElt -> RngIntElt`

The index of the negative of the $r$th (co)root of the root system $R$. In other words, if $s = \hbox{\tt Negative(R,r)}$ then $\alpha_s=-\alpha_r$.

<a id="example-ex-8a578c"></a>
##### `Example: Arithmetic with Root Indices (ex-8a578c)`

```magma
> R := RootSystem("G2");
> Sum(R, 1, Negative(R,5));
10
> IsPositive(R, 10);
false
> Negative(R, 10);
4
> P := PositiveRoots(R);
> P[1] - P[5] eq -P[4];
true
```

<a id="function-rootheight-rootsys-rngintelt"></a>
##### `RootHeight(R, r): RootSys, RngIntElt -> RngIntElt`

<a id="function-corootheight-rootsys-rngintelt"></a>
##### `CorootHeight(R, r): RootSys, RngIntElt -> RngIntElt`

The height of the $r$th (co)root of the root system $R$, i.e. the sum of the coefficients of $\alpha_r$ (respectively, $\alpha_r^\star$) with respect to the simple (co)roots.

<a id="function-rootnorms-rootsys"></a>
##### `RootNorms(R): RootSys -> [RngIntElt]`

<a id="function-corootnorms-rootsys"></a>
##### `CorootNorms(R): RootSys -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the root system $R$.

<a id="function-rootnorm-rootsys-rngintelt"></a>
##### `RootNorm(R, r): RootSys, RngIntElt -> RngIntElt`

<a id="function-corootnorm-rootsys-rngintelt"></a>
##### `CorootNorm(R, r): RootSys, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the root system $R$.

<a id="function-islongroot-rootsys-rngintelt"></a>
##### `IsLongRoot(R, r): RootSys, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root system $R$ is long. This only makes sense for irreducible crystallographic root systems. Note that for non-reduced root systems, the roots which are not indivisible are actually longer than the long ones.

<a id="function-isshortroot-rootsys-rngintelt"></a>
##### `IsShortRoot(R, r): RootSys, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root system $R$ is short. This only makes sense for irreducible crystallographic root systems.

<a id="function-isindivisibleroot-rootsys-rngintelt"></a>
##### `IsIndivisibleRoot(R, r): RootSys, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root system $R$ is indivisible, ie, $\alpha_r/2$ is not a root.

<a id="function-leftstring-rootsys-rngintelt-rngintelt"></a>
##### `LeftString(R, r, s): RootSys, RngIntElt, RngIntElt -> RngIntElt`

Indices in the crystallographic root system $R$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s-\alpha_r,\alpha_s-2\alpha_r,\dots,\alpha_s-p\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_p]$ where $\alpha_{r_i}=\alpha_s-i\alpha_r$ and $\alpha_s-(p+1)\alpha_r$ is not a root. We require that $\alpha_r\ne\pm\alpha_s$.

<a id="function-rightstring-rootsys-rngintelt-rngintelt"></a>
##### `RightString(R, r, s): RootSys, RngIntElt, RngIntElt -> RngIntElt`

Indices in the crystallographic root system $R$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s+\alpha_r,\alpha_s+2\alpha_r,\dots,\alpha_s+q\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_q]$ where $\alpha_{r_i}=\alpha_s+i\alpha_r$ and $\alpha_s+(q+1)\alpha_r$ is not a root. We require that $\alpha_r\ne\pm\alpha_s$.

<a id="function-leftstringlength-rootsys-rngintelt-rngintelt"></a>
##### `LeftStringLength(R, r, s): RootSys, RngIntElt, RngIntElt -> RngIntElt`

The largest $p$ such that $\alpha_s-p\alpha_r$ is a root. We require that the root system $R$ be crystallographic and $\alpha_s\ne\pm\alpha_r$.

<a id="function-rightstringlength-rootsys-rngintelt-rngintelt"></a>
##### `RightStringLength(R, r, s): RootSys, RngIntElt, RngIntElt -> RngIntElt`

The largest $q$ such that $\alpha_s+q\alpha_r$ is a root. We require that the root system $R$ be crystallographic and $\alpha_s\ne\pm\alpha_r$.

<a id="example-ex-e2515b"></a>
##### `Example: Heights, Norms, and Root Strings (ex-e2515b)`

```magma
> R := RootSystem("G2");
> RootHeight(R, 5);
4
> F := CoxeterForm(R);
> v := Root(R, 5);
> (v*F, v) eq RootNorm(R, 5);
true
> IsLongRoot(R, 5);
true
> LeftString(R, 1, 5);
[ 4, 3, 2 ]
> roots := Roots(R);
> for i in [1..3] do
>   RootPosition(R, roots[5]-i*roots[1]);
> end for;
4
3
2
> R := RootSystem("BC2");
> Root(R,2), IsIndivisibleRoot(R,2);
(0 1) true
> Root(R,4), IsIndivisibleRoot(R,4);
(0 2) false
```

<a id="function-additiveorder-rootsys"></a>
##### `AdditiveOrder(R): RootSys -> SeqEnum`

An additive order on the positive roots of the root system $R$, i.e. a sequence containing the numbers $1,\dots,N$ in some order so that $\alpha_r+\alpha_s=\alpha_t$ implies $t$ is between $r$ and $s$. This is computed using the techniques of [[Pap94](https://docs.magma-maths.org/references.md#cite-papi)].

<a id="function-isadditiveorder-rootsys-rngintelt"></a>
##### `IsAdditiveOrder(R, Q): RootSys, [RngIntElt] -> BoolElt`

Returns `true` if, and only if, the sequence $Q$ gives an additive order on a set of positive roots of the root system $R$. $Q$ must be a sequence of integers in the range $[1..N]$, where $N$ is the number of positive roots of $R$, with no gaps or repeats.

<a id="example-ex-20f94b"></a>
##### `Example: Additive Order on Positive Roots (ex-20f94b)`

```magma
> R := RootSystem("A5");
> a := AdditiveOrder(R);
> Position(a, 2);
6
> Position(a, 3);
10
> Position(a, Sum(R, 2, 3));
7
```

<a id="create-new-root-system"></a>
<a id="sectrssub"></a>
### Building Root Systems

<a id="constructor-constructor-sub-rootsys-setenum-rootsys"></a>
#### `sub<R | a>: RootSys, SetEnum -> RootSys`

The root subsystem of the root system $R$ generated by the roots $\alpha_{a_1},\dots,\alpha_{a_k}$ where $a=\{a_1,\dots,a_k\}$ is a set of integers.

<a id="constructor-constructor-sub-rootsys-setenum-rootsys-2"></a>
#### `sub<R | s>: RootSys, SetEnum -> RootSys`

The root subsystem of the root system $R$ generated by the roots $\alpha_{s_1},\dots,\alpha_{s_k}$ where $s=[s_1,\dots,s_k]$ is a *sequence* of integers. In this version the roots must be simple in the root subsystem (i.e. none of them may be a summand of another), otherwise an error is signalled. The simple roots will appear in the subsystem in the given order.

<a id="operation-op-subset-rootsys-rootsys"></a>
#### `R1 subset R2: RootSys, RootSys -> BoolElt, .`

Returns `true` if and only if the root system $R_1$ is a subset of the root system $R_2$. If true, returns an injection as sequence of roots as second return value.

<a id="operation-op-plus-rootsys-rootsys"></a>
#### `R1 + R2: RootSys, RootSys -> RootSys`

<a id="function-directsum-rootsys-rootsys"></a>
#### `DirectSum(R1, R2): RootSys, RootSys -> RootSys`

The direct sum of the root systems $R_1$ and $R_2$. The root space of the result is the direct sum of the root spaces of $R_1$ and $R_2$.

<a id="operation-op-join-rootsys-rootsys"></a>
#### `R1 join R2: RootSys, RootSys -> RootSys`

The union of the root systems $R_1$ and $R_2$. The root systems must have the same root space, which will also be the root space of the result.

<a id="example-ex-f885fa"></a>
#### `Example: Sums of Root Systems (ex-f885fa)`

```magma
> R  := RootSystem("A1A1");
> R1 := sub<R|[1]>;
> R2 := sub<R|[2]>;
> R1 + R2;
Root system of dimension 4 of type A1 A1
> R1 join R2;
Root system of dimension 2 of type A1 A1
```

```magma
> R1 := RootSystem("A3T2B4T3");
> R2 := RootSystem("T3G2T4BC3");
> R1 + R2;
Root system of dimension 24 of type A3 B4 G2 BC3
> R1 join R2;
Root system of dimension 12 of type A3 B4 G2 BC3
```

<a id="function-directsumdecomposition-rootsys"></a>
#### `DirectSumDecomposition(R): RootSys -> []`

<a id="function-indecomposablesummands-rootdtm"></a>
#### `IndecomposableSummands(R): RootDtm -> [], RootDtm, Map`

The set of irreducible direct summands of the semisimple root system $R$.

<a id="function-dual-rootsys"></a>
#### `Dual(R): RootSys -> RootSys`

The dual of the root system $R$, obtained by swapping the roots and coroots.

<a id="function-indivisiblesubsystem-rootsys"></a>
#### `IndivisibleSubsystem(R): RootSys -> RootSys`

The root system consisting of all indivisible roots of the root system $R$.

<a id="example-ex-feab7e"></a>
#### `Example: Direct Sums and Duals of Root Systems (ex-feab7e)`

```magma
> R1 := RootSystem("H4");
> R2 := RootSystem("B4");
> R1 + Dual(R2);
Root system of type H4 C4
> R := RootSystem("BC2");
> I := IndivisibleSubsystem(R); I;
I: Root system of type B2
> I subset R;
true [ 1, 2, 3, 5, 7, 8, 9, 11 ]
```

<a id="sectrsrel"></a>
<a id="id1"></a>
### Related Structures

In this section functions for creating other structures from a root system are briefly listed. The reader is referred to the appropriate chapters of the Handbook for more details.

<a id="function-rootdatum-rootsys"></a>
#### `RootDatum(R): RootSys -> RootDtm`

The (split) root datum corresponding to the root system $R$. The coefficients of the simple roots and coroots must be integral; otherwise an error is signalled. See Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)

<a id="function-coxetergroup-cat-rootsys"></a>
#### `CoxeterGroup(grpcat, R): Cat, RootSys -> grpcat`

The Coxeter group (of type `grpcat`) of a root system $R$. There are variations of this signature. The first argument can be `GrpMat`, `GrpPermCox`, `GrpPerm`, `GrpFPCox` or `GrpFP` and the second argument can be a root system or root datum. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox). If the first argument is `GrpFPCox` the braid group and pure braid group can be computed from the Coxeter group using the commands in Section [Braid Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md#sectgrpcoxbraid).

<a id="function-coxetergroup-rootsys"></a>
#### `CoxeterGroup(R): RootSys -> GrpPermCox`

<a id="function-weylgroup-rootsys"></a>
#### `WeylGroup(R): RootSys -> GrpPermCox`

The permutation Coxeter group with root system $R$. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox).

<a id="function-coxetergroup-cat-rootsys-2"></a>
#### `CoxeterGroup(GrpPermCox, R): Cat, RootSys -> RngIntElt`

<a id="function-reflectiongroup-rootsys"></a>
#### `ReflectionGroup(R): RootSys -> GrpMat`

The reflection group of the root system $R$. See Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-coxetergroup-cat-rootsys-3"></a>
#### `CoxeterGroup(GrpPermCox, W): Cat, RootSys -> GrpPermCox`

<a id="function-liealgebra-rootsys-rng"></a>
#### `LieAlgebra(R, k): RootSys, Rng -> AlgLie`

The Lie algebra of the root system $R$ over the base ring $k$. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="function-matrixliealgebra-rootsys"></a>
#### `MatrixLieAlgebra(R, k): RootSys -> GrpMat`

The matrix Lie algebra of the root system $R$ over the base ring $k$. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="example-ex-3411ae"></a>
#### `Example: Structures Related to a Root System (ex-3411ae)`

```magma
> R := RootSystem("b3");
> SemisimpleType(LieAlgebra(R, Rationals()));
B3
> #CoxeterGroup(R);
48
```

<a id="chaprootdtm"></a>
<a id="id1"></a>
## Root Data

- [Introduction](https://docs.magma-maths.org/LieTheory/RootData/introduction.md)
  - [Reflections](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#reflections)
  - [Definition of a Split Root Datum](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#definition-of-a-split-root-datum)
  - [Simple and Positive Roots](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#simple-and-positive-roots)
  - [The Coxeter Group](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#the-coxeter-group)
  - [Nonreduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#nonreduced-root-data)
  - [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#isogeny-of-split-reduced-root-data)
  - [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#extended-root-data)
- [Constructing Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md)
  - [`RootDatum(N): MonStgElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-intrrootdatum)
  - [Example: Creating Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-c80243)
  - [Example: Creating Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-cd6016)
  - [`RootDatum(C): AlgMatElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-rootdatum-algmatelt)
  - [`RootDatum(D): GrphDir → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-rootdatum-grphdir)
  - [`RootDatum(A, B): Mtrx, Mtrx → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-rootdatum-mtrx-mtrx)
  - [Example: Nonsemisimple Root Datum of Type G2](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-46dafe)
  - [`IrreducibleRootDatum(X, n): MonStgElt, RngIntElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-irreduciblerootdatum-monstgelt-rngintelt)
  - [`StandardRootDatum(X, n): MonStgElt, RngIntElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-intrstandardrootdatum)
  - [Example: Irreducible Root Data by Type](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-8489eb)
  - [`ToralRootDatum(n): RngIntElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-toralrootdatum-rngintelt)
  - [Example: Toral Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-c91fea)
  - [`TrivialRootDatum() → RootDat`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-trivialrootdatum)
  - [Constructing Sparse Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#constructing-sparse-root-data)
    - [`SparseRootDatum(N): MonStgElt → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-monstgelt)
    - [`SparseRootDatum(N): MonStgElt → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-monstgelt-2)
    - [`SparseRootDatum(C): AlgMatElt → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-algmatelt)
    - [`SparseRootDatum(D): GrphDir → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-grphdir)
    - [`SparseRootDatum(R): RootSys → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-rootsys)
    - [`SparseRootDatum(A, B): Mtrx, Mtrx → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-mtrx-mtrx)
    - [`SparseIrreducibleRootDatum(X, n): MonStgElt, RngIntElt → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparseirreduciblerootdatum-monstgelt-rngintelt)
    - [`SparseStandardRootDatum(X, n): MonStgElt, RngIntElt → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparsestandardrootdatum-monstgelt-rngintelt)
    - [Example: Creating Sparse Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-c58524)
    - [`SparseRootDatum(R): RootDtm → RootDtmSprs`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-sparserootdatum-rootdtm)
    - [`RootDatum(R): RootDtmSprs → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#function-rootdatum-rootdtmsprs)
    - [Example: Sums and Subdata of Sparse Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#example-ex-7d922a)
- [Operations on Root Data](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md)
  - [`R1 eq R2: RootDtm, RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#operation-op-eq-rootdtm-rootdtm)
  - [`IsIsomorphic(R1, R2): RootDtm, RootDtm → BoolElt, [RngIntElt], Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-isisomorphic-rootdtm-rootdtm)
  - [`IsCartanEquivalent(R1, R2): RootDtm, RootDtm → BoolElt, SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-iscartanequivalent-rootdtm-rootdtm)
  - [`IsIsogenous(R1, R2): RootDtm, RootDtm → BoolElt, SeqEnum, RootDtm, Map, Map, RootDtm, Map, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-isisogenous-rootdtm-rootdtm)
  - [Example: Isomorphism and Isogeny of Root Data](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#example-ex-864e8f)
  - [`CartanName(R): RootStr → MonStgElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-cartanname-rootstr)
  - [`TwistedCartanName(R): RootDtm → MonStgElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-twistedcartanname-rootdtm)
  - [`CoxeterDiagram(R): RootStr`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#procedure-coxeterdiagram-rootstr)
  - [`DynkinDiagram(R): RootStr`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#procedure-dynkindiagram-rootstr)
  - [`CoxeterMatrix(R): RootStr → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-coxetermatrix-rootstr)
  - [`CoxeterGraph(R): RootStr → GrphUnd`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-coxetergraph-rootstr)
  - [`CartanMatrix(R): RootStr → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-cartanmatrix-rootstr)
  - [`DynkinDigraph(R): RootStr → GrphDir`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-dynkindigraph-rootstr)
  - [Example: Dynkin and Coxeter Diagrams](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#example-ex-de9285)
  - [`GammaAction(R): RootDtm → Rec`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammaaction-rootdtm)
  - [`GammaRootSpace(R): RootDtm → GSetEnum, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammarootspace-rootdtm)
  - [`GammaCorootSpace(R): RootDtm → GSetEnum, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammacorootspace-rootdtm)
  - [`GammaOrbitOnRoots(R,r): RootDtm, RngIntElt → GSetEnum`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammaorbitonroots-rootdtm-rngintelt)
  - [`GammaOrbitsOnRoots(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammaorbitsonroots-rootdtm)
  - [`PositiveGammaOrbitsOnRoots(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-positivegammaorbitsonroots-rootdtm)
  - [`NegativeGammaOrbitsOnRoots(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-negativegammaorbitsonroots-rootdtm)
  - [`ZeroGammaOrbitsOnRoots(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-zerogammaorbitsonroots-rootdtm)
  - [`GammaActionOnSimples(R): RootDtm → HomGrp`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-gammaactiononsimples-rootdtm)
  - [`OrbitsOnSimples(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-orbitsonsimples-rootdtm)
  - [`DistinguishedOrbitsOnSimples(R): RootDtm → SeqEnum[GSetEnum]`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-distinguishedorbitsonsimples-rootdtm)
  - [`BaseRing(R): RootDtm → RngInt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-basering-rootdtm)
  - [`Rank(R): RootStr → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-rank-rootstr)
  - [`AbsoluteRank(R): RootDtm → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-absoluterank-rootdtm)
  - [`RelativeRank(R): RootDtm → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-relativerank-rootdtm)
  - [`Dimension(R): RootStr → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-dimension-rootstr)
  - [`TwistingDegree(R): RootDtm → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-twistingdegree-rootdtm)
  - [`AnisotropicSubdatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-anisotropicsubdatum-rootdtm)
  - [Example: Operations for Twisted Root Data](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#example-ex-9c2a05)
  - [`CoxeterGroupOrder(R): RootStr → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-coxetergrouporder-rootstr)
  - [`GroupOfLieTypeOrder(R, q): RootDtm, RngElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-groupoflietypeorder-rootdtm-rngelt)
  - [`GroupOfLieTypeFactoredOrder(R, q): RootDtm, RngElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-groupoflietypefactoredorder-rootdtm-rngelt)
  - [Example: Order of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#example-ex-da6059)
  - [`FundamentalGroup(R): RootDtm → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-fundamentalgroup-rootdtm)
  - [`IsogenyGroup(R): RootDtm → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-isogenygroup-rootdtm)
  - [`CoisogenyGroup(R): RootDtm → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#function-coisogenygroup-rootdtm)
  - [Example: Isogeny and Fundamental Groups](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#example-ex-2f8db1)
- [Properties of Root Data](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md)
  - [`IsFinite(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isfinite-rootstr)
  - [`IsIrreducible(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isirreducible-rootstr)
  - [`IsAbsolutelyIrreducible(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isabsolutelyirreducible-rootstr)
  - [`IsProjectivelyIrreducible(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isprojectivelyirreducible-rootstr)
  - [`IsReduced(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isreduced-rootdtm)
  - [`IsSemisimple(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-issemisimple-rootstr)
  - [`IsCrystallographic(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-iscrystallographic-rootstr)
  - [`IsSimplyLaced(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-issimplylaced-rootstr)
  - [`IsAdjoint(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isadjointr)
  - [`IsWeaklyAdjoint(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isweaklyadjoint-rootdtm)
  - [`IsSimplyConnected(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-issimplyconnectedr)
  - [`IsWeaklySimplyConnected(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isweaklysimplyconnected-rootdtm)
  - [Example: Testing Properties of a Root Datum](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#example-ex-ece71b)
  - [`IsReduced(R): RootStr → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isreduced-rootstr)
  - [`IsSplit(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-issplit-rootdtm)
  - [`IsTwisted(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-istwisted-rootdtm)
  - [`IsQuasisplit(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isquasisplit-rootdtm)
  - [`IsInner(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isinner-rootdtm)
  - [`IsOuter(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isouter-rootdtm)
  - [`IsAnisotropic(R): RootDtm → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isanisotropic-rootdtm)
- [Roots, Coroots, and Weights](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md)
  - [Accessing Roots and Coroots](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#accessing-roots-and-coroots)
    - [`RootSpace(R): RootStr → ModTupFld`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootspace-rootstr)
    - [`CorootSpace(R): RootStr → ModTupFld`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootspace-rootstr)
    - [`FullRootLattice(R): RootDtm → Lat, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-fullrootlattice-rootdtm)
    - [`FullCorootLattice(R): RootDtm → Lat, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-fullcorootlattice-rootdtm)
    - [`RootLattice(R): RootDtm → Lat, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootlattice-rootdtm)
    - [`CorootLattice(R): RootDtm → Lat, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootlattice-rootdtm)
    - [Example: Root Space and Root Lattices](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-f812ae)
    - [`IsRootSpace(V): ModTupFld → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isrootspace-modtupfld)
    - [`IsCorootSpace(V): ModTupFld → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-iscorootspace-modtupfld)
    - [`IsInRootSpace(v): ModTupFldElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isinrootspace-modtupfldelt)
    - [`IsCorootSpace(v): ModTupFldElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-iscorootspace-modtupfldelt)
    - [`RootDatum(V): ModTupFld → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootdatum-modtupfld)
    - [Example: Recognising a Root Space](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-ddfc7e)
    - [`ZeroRootLattice(R): RootDtm → Lat`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-zerorootlattice-rootdtm)
    - [`ZeroRootSpace(R): RootDtm → ModTupFld, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-zerorootspace-rootdtm)
    - [`RelativeRootSpace(R): RootDtm → ModTupFld, Map`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-relativerootspace-rootdtm)
    - [`SimpleRoots(R): RootStr → Mtrx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simpleroots-rootstr)
    - [`SimpleCoroots(R): RootStr → Mtrx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simplecoroots-rootstr)
    - [Example: Spaces and Lattices of a G2 Root Datum](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-b96105)
    - [`NumberOfPositiveRoots(R): RootStr → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-numberofpositiveroots-rootstr)
    - [`NumPosRoots(R): RootStr → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-numposroots-rootstr)
    - [`Roots(R): RootStr → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-roots-rootstr)
    - [`Coroots(R): RootStr → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coroots-rootstr)
    - [`PositiveRoots(R): RootStr → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-positiveroots-rootstr)
    - [`PositiveCoroots(R): RootStr → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-positivecoroots-rootstr)
    - [`Root(R, r): RootStr, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-root-rootstr-rngintelt)
    - [`Coroot(R, r): RootStr, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coroot-rootstr-rngintelt)
    - [`RootPosition(R, v): RootStr, . → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootposition-rootstr)
    - [`CorootPosition(R, v): RootStr, . → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootposition-rootstr)
    - [`BasisChange(R,v): RootStr, Any → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-basischange-rootstr-any)
    - [Example: Roots and Coroots of a Root Datum](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-f22cf4)
    - [`IsInRootSpace(R,v): RootDtm, ModTupFldElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isinrootspace-rootdtm-modtupfldelt)
    - [`IsInCorootSpace(R,v): RootDtm, ModTupFldElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isincorootspace-rootdtm-modtupfldelt)
    - [`HighestRoot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestroot-rootstr)
    - [`HighestCoroot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestcoroot-rootstr)
    - [`HighestLongRoot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestlongroot-rootstr)
    - [`HighestLongCoroot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestlongcoroot-rootstr)
    - [`HighestShortRoot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestshortroot-rootstr)
    - [`HighestShortCoroot(R): RootStr → .`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-highestshortcoroot-rootstr)
    - [Example: Highest Roots](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-a8cbef)
    - [`RelativeRoots(R): RootDtm → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-relativeroots-rootdtm)
    - [`PositiveRelativeRoots(R): RootDtm → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-positiverelativeroots-rootdtm)
    - [`NegativeRelativeRoots(R): RootDtm → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-negativerelativeroots-rootdtm)
    - [`SimpleRelativeRoots(R): RootDtm → SetIndx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simplerelativeroots-rootdtm)
    - [`RelativeRootDatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-relativerootdatum-rootdtm)
    - [`GammaOrbitsRepresentatives(R, delta): RootDtm, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-gammaorbitsrepresentatives-rootdtm-rngintelt)
    - [Example: Two Twisted Root Data of Type E6](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-bec95e)
    - [`CoxeterForm(R): RootDtm → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coxeterform-rootdtm)
    - [`DualCoxeterForm(R): RootDtm → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-dualcoxeterform-rootdtm)
  - [Reflections](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#reflections)
    - [`SimpleReflectionMatrices(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simplereflectionmatrices-rootdtm)
    - [`SimpleCoreflectionMatrices(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simplecoreflectionmatrices-rootdtm)
    - [`ReflectionMatrices(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionmatrices-rootdtm)
    - [`CoreflectionMatrices(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coreflectionmatrices-rootdtm)
    - [`ReflectionMatrix(R, r): RootDtm, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionmatrix-rootdtm-rngintelt)
    - [`CoreflectionMatrix(R, r): RootDtm, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coreflectionmatrix-rootdtm-rngintelt)
    - [`SimpleReflectionPermutations(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-simplereflectionpermutations-rootdtm)
    - [`ReflectionPermutations(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionpermutations-rootdtm)
    - [`ReflectionPermutation(R, r): RootDtm, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionpermutation-rootdtm-rngintelt)
    - [`ReflectionWords(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionwords-rootdtm)
    - [`ReflectionWord(R, r): RootDtm, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-reflectionword-rootdtm-rngintelt)
    - [Example: Reflection Matrices, Permutations, and Words](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-458120)
  - [Operations and Properties for Root and Coroot Indices](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#operations-and-properties-for-root-and-coroot-indices)
    - [`Sum(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-sum-rootdtm-rngintelt-rngintelt)
    - [`IsPositive(R, r): RootStr, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-ispositive-rootstr-rngintelt)
    - [`IsNegative(R, r): RootStr, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isnegative-rootstr-rngintelt)
    - [`Negative(R, r): RootStr, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-negative-rootstr-rngintelt)
    - [`LeftString(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-leftstring-rootdtm-rngintelt-rngintelt)
    - [`RightString(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rightstring-rootdtm-rngintelt-rngintelt)
    - [`LeftStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-intrleftstringlength)
    - [`RightStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-intrrightstringlength)
    - [Example: Arithmetic with Root Indices](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-15650f)
    - [`RootHeight(R, r): RootStr, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootheight-rootstr-rngintelt)
    - [`CorootHeight(R, r): RootStr, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootheight-rootstr-rngintelt)
    - [`RootNorms(R): RootStr → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootnorms-rootstr)
    - [`CorootNorms(R): RootStr → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootnorms-rootstr)
    - [`RootNorm(R, r): RootStr, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootnorm-rootstr-rngintelt)
    - [`CorootNorm(R, r): RootStr, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-corootnorm-rootstr-rngintelt)
    - [`IsLongRoot(R, r): RootStr, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-islongroot-rootstr-rngintelt)
    - [`IsShortRoot(R, r): RootStr, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isshortroot-rootstr-rngintelt)
    - [`IsIndivisibleRoot(R, r): RootStr, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isindivisibleroot-rootstr-rngintelt)
    - [Example: Heights, Norms, and Root Strings](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-1c59aa)
    - [`RootClosure(R, S): RootDtm, SetEnum[RngIntElt] → SetEnum[RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-rootclosure-rootdtm-setenum-rngintelt)
    - [`AdditiveOrder(R): RootStr → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-additiveorder-rootstr)
    - [`IsAdditiveOrder(R, Q): RootStr, [RngIntElt] → BoolElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isadditiveorder-rootstr-rngintelt)
    - [Example: Additive Order on Positive Roots](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-24f6a0)
  - [Weights](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#weights)
    - [`WeightLattice(R): RootDtm → Lat`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-weightlattice-rootdtm)
    - [`CoweightLattice(R): RootDtm → Lat`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-coweightlattice-rootdtm)
    - [`FundamentalWeights(R): RootDtm → Mtrx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-fundamentalweights-rootdtm)
    - [`FundamentalCoweights(R): RootDtm → Mtrx`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-fundamentalcoweights-rootdtm)
    - [Example: Weight Lattice of a Root Datum](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-28403f)
    - [`IsDominant(R, v): RootDtm, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-isdominant-rootdtm)
    - [`DominantWeight(R, v): RootDtm, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-dominantweight-rootdtm)
    - [`WeightOrbit(R, v): RootDtm, . → {@ ModTupFldElt @}, [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-weightorbit-rootdtm)
    - [Example: Dominant Weights and Weight Orbits](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#example-ex-4bce9a)
- [Building Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md)
  - [`sub<R | a>: RootDtm, SetEnum → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#constructor-constructor-sub-rootdtm-setenum-rootdtm)
  - [`sub<R | s>: RootDtm, SetEnum → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#constructor-constructor-sub-rootdtm-setenum-rootdtm-2)
  - [Example: Root Subdata](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#example-ex-dc9697)
  - [`R1 subset R2: RootDtm, RootDtm → BoolElt, .`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#operation-op-subset-rootdtm-rootdtm)
  - [`R1 + R2: RootDtm, RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#operation-op-plus-rootdtm-rootdtm)
  - [`DirectSum(R1, R2): RootDtm, RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-directsum-rootdtm-rootdtm)
  - [`R1 join R2: RootDtm, RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#operation-op-join-rootdtm-rootdtm)
  - [Example: Sums of Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#example-ex-67182b)
  - [`DirectSumDecomposition(R): RootDtm → [], RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-directsumdecomposition-rootdtm)
  - [`IndecomposableSummands(R): RootDtm → [], RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-indecomposablesummands-rootdtm)
  - [Example: Decomposing a Root Datum](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#example-ex-7e44ad)
  - [`Dual(R): RootDtm → RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-dual-rootdtm)
  - [`SimplyConnectedVersion(R): RootDtm → RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-simplyconnectedversion-rootdtm)
  - [`AdjointVersion(R): RootDtm → RootDtm, Map`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-adjointversion-rootdtm)
  - [`IndivisibleSubdatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-indivisiblesubdatum-rootdtm)
  - [`Radical(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-radical-rootdtm)
  - [Example: Direct Sums, Duals, and Radicals](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#example-ex-187258)
  - [`TwistedRootDatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-twistedrootdatum-rootdtm)
  - [`TwistedRootDatum(N): MonStgElt → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-twistedrootdatum-monstgelt)
  - [Example: Constructing Twisted Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#example-ex-4dc407)
  - [`UntwistedRootDatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-untwistedrootdatum-rootdtm)
  - [`SplitRootDatum(R): RootDtm → RootDtm`](https://docs.magma-maths.org/LieTheory/RootData/create-new-root-datum.md#function-splitrootdatum-rootdtm)
- [Morphisms of Root Data](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md)
  - [`hom<R -\>S | phiX, phiY>: RootDtm, RootDtm, Map, Map → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#constructor-constructor-hom-rootdtm-rootdtm-map-map-map)
  - [`hom<R -\>S | phiX, phiY>: RootDtm, RootDtm, Mtrx, Mtrx → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#constructor-constructor-hom-rootdtm-rootdtm-mtrx-mtrx-map)
  - [`hom<R -\>S | Q>: RootDtm, RootDtm, [RngIntElt] → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#constructor-constructor-hom-rootdtm-rootdtm-rngintelt-map)
  - [`Morphism(R, S, phiX, phiY): RootDtm, RootDtm, Map, Map → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-morphism-rootdtm-rootdtm-map-map)
  - [`Morphism(R, S, phiX, phiY): RootDtm, RootDtm, Mtrx, Mtrx → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-morphism-rootdtm-rootdtm-mtrx-mtrx)
  - [`Morphism(R, S, Q): RootDtm, RootDtm, [RngIntElt] → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-morphism-rootdtm-rootdtm-rngintelt)
  - [`DualMorphism(R, S, phiX, phiY): RootDtm, RootDtm, Map, Map → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-dualmorphism-rootdtm-rootdtm-map-map)
  - [`DualMorphism(R, S, phiX, phiY): RootDtm, RootDtm, Mtrx, Mtrx → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-dualmorphism-rootdtm-rootdtm-mtrx-mtrx)
  - [`DualMorphism(R, S, Q): RootDtm, RootDtm, [RngIntElt] → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-dualmorphism-rootdtm-rootdtm-rngintelt)
  - [`RootImages(phi): Map → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-rootimages-map)
  - [`RootPermutation(phi): Map → GrpPermElt`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-rootpermutation-map)
  - [`IdentityMap(R): RootDtm → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-identitymap-rootdtm)
  - [`IdentityAutomorphism(R): RootDtm → Map`](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#function-identityautomorphism-rootdtm)
  - [Example: Creating Root Data Homomorphisms](https://docs.magma-maths.org/LieTheory/RootData/morphisms-root-datum.md#example-ex-b874c1)
- [Constants Associated with Root Data](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md)
  - [`ExtraspecialPairs(R): RootDtm → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-extraspecialpairs-rootdtm)
  - [`NumExtraspecialPairs(R): RootDtm → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-numextraspecialpairs-rootdtm)
  - [`ExtraspecialPair(R,r): RootDtm, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-extraspecialpair-rootdtm-rngintelt)
  - [`ExtraspecialSigns(R): RootDtm → []`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-extraspecialsigns-rootdtm)
  - [`LieConstant_p(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-p-rootdtm-rngintelt-rngintelt)
  - [`LieConstant_q(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-q-rootdtm-rngintelt-rngintelt)
  - [`CartanInteger(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-cartaninteger-rootdtm-rngintelt-rngintelt)
  - [`LieConstant_N(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-n-rootdtm-rngintelt-rngintelt)
  - [`LieConstant_epsilon(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-epsilon-rootdtm-rngintelt-rngintelt)
  - [`LieConstant_M(R, r, s, i): RootDtm, RngIntElt, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-m-rootdtm-rngintelt-rngintelt-rngintelt)
  - [`LieConstant_C(R, i, j, r, s): RootDtm, RngIntElt, RngIntElt, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-c-rootdtm-rngintelt-rngintelt-rngintelt-rngintelt)
  - [`LieConstant_eta(R, r, s): RootDtm, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-lieconstant-eta-rootdtm-rngintelt-rngintelt)
  - [`StructureConstants(R): RootDtm → RngIntElt`](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#function-structureconstants-rootdtm)
  - [Example: Verifying Root Datum Constants](https://docs.magma-maths.org/LieTheory/RootData/constants-root-datum.md#example-ex-6b2ee2)
- [Related Structures](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md)
  - [`RootSystem(R): RootDtm → RootSys`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-rootsystem-rootdtm)
  - [`CoxeterGroup(grpcat, R): Cat, RootDtm → grpcat`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-coxetergroup-cat-rootdtm)
  - [`CoxeterGroup(R): RootDtm → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-coxetergroup-rootdtm)
  - [`WeylGroup(R): RootDtm → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-weylgroup-rootdtm)
  - [`CoxeterGroup(GrpPermCox, R): Cat, RootDtm → GrpPermCox`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-coxetergroup-cat-rootdtm-2)
  - [`ReflectionGroup(R): RootDtm → GrpMat`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-reflectiongroup-rootdtm)
  - [`LieAlgebraHomorphism(phi,k): Map, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-liealgebrahomorphism-map-rng)
  - [`LieAlgebra(R, k): RootDtm, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-liealgebra-rootdtm-rng)
  - [`GroupOfLieType(R, k): RootDtm, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-groupoflietype-rootdtm-rng)
  - [`GroupOfLieTypeHomomorphism(phi, k): Map, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#function-groupoflietypehomomorphism-map-rng)
  - [Example: Structures Related to a Root Datum](https://docs.magma-maths.org/LieTheory/RootData/related-structures.md#example-ex-174972)
- [Bibliography](https://docs.magma-maths.org/LieTheory/RootData/bibliography.md)

<a id="sectrdintro"></a>
<a id="id1"></a>
### Introduction

This chapter describes Magma functions for computing with (extended) root data. Root data are fundamental to Lie theory: Lie algebras (Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie)) and groups of Lie type (Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie)). Our description of split reduced root data follows [[Dem70](https://docs.magma-maths.org/references.md#cite-demazure)] and [[Car93](https://docs.magma-maths.org/references.md#cite-carter-big)] except that reflections act on the right as in customary in Magma. Our description of extended root data follows [[Sat71](https://docs.magma-maths.org/references.md#cite-satake-class)], [[Sch69](https://docs.magma-maths.org/references.md#cite-schattschneider)], and [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)]. Our description of split non-reduced root data follows [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)].

The closely related concept of a root system is discussed in Chapter [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys). When working with Lie algebras or groups of Lie type, root data should be used. When working with Coxeter groups (Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)) or reflection groups (Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl)), it is likely that only root systems are of interest.

<a id="refl"></a>
<a id="subsectrdrfl"></a>
#### Reflections

Let $X$ and $Y$ be free ${\mathbb{Z}}$-modules with bilinear pairing $\langle\circ,\circ\rangle:X\times Y\rightarrow {\mathbb{Z}}$ that identifies $Y$ with the dual of $X$. Given nonzero $\alpha\in X$ and $\alpha^\star\in Y$, we define the ${\mathbb{Z}}$-linear map $s_\alpha:X\rightarrow X$ by

$$
x s_\alpha= x - \langle x,\alpha^\star\rangle\alpha
$$

and the ${\mathbb{Z}}$-linear map $s_\alpha^\star:Y\rightarrow Y$ by

$$
y s_\alpha^\star= y - \langle\alpha,y \rangle\alpha^\star.
$$

These maps are called *reflections* if one of the following equivalent properties hold: $\langle\alpha,\alpha^\star\rangle=2$; ${s_\alpha}^2=1$; $\langle xs_\alpha,ys_\alpha^\star\rangle = \langle x,y\rangle$ for all $x\in X$ and $y\in Y$; $\alpha s_\alpha=-\alpha$. The map $s_\alpha^\star$ is also called a *coreflection*: this just means it is a reflection defined on $Y$ instead of $X$. Magma functions for computing with reflections are described in Section [Construction of Pseudo-reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#sectrefgrprfl).

If $X$ has an inner product, then we can take $Y=X$ and use the inner product as our pairing. In Magma, $X$ and $Y$ are usually standard ${\mathbb{Z}}$-modules. However, it is sometimes useful to allow $X$ and $Y$ to be distinct sublattices of a standard lattice. The bilinear pairing is always given by the standard inner product: $\langle x,y\rangle = xy^T$.

<a id="rootdtm"></a>
<a id="subsectrddefn"></a>
#### Definition of a Split Root Datum

Suppose $\Phi$ is a finite subset of $X\setminus \{0\}$. For each $\alpha$ in $\Phi$, suppose there is a corresponding $\alpha^\star$ in $Y\setminus \{0\}$; set $\Phi^\star=\{\alpha^\star\mid\alpha\in\Phi\}$. The datum $R=(X,\Phi,Y,\Phi^\star)$ is said to be a *(split) root datum* if the following conditions are satisfied for every $\alpha$ in $\Phi$

1. $s_\alpha$ and $s_\alpha^\star$ are reflections;
2. $\Phi$ is closed under the action of $s_\alpha$; and
3. $\Phi^\star$ is closed under the action of $s_\alpha^\star$.

The lattice $X$ is called the *full root lattice* and $Y$ the *full coroot lattice*. The vector space $X\otimes{\mathbb{Q}}$ is called the *root space* and $Y\otimes{\mathbb{Q}}$ the *coroot space*. The elements of $\Phi$ are called *roots* and the elements of $\Phi^\star$ are called *coroots*. A root datum is *reduced*, if $\alpha,\beta\in\Phi$ with $\beta$ a scalar product of $\alpha$ implies $\alpha=\pm\beta$.

<a id="positive-simple-roots"></a>
<a id="subsectrdpossimple"></a>
#### Simple and Positive Roots

A subset $\Delta$ of $\Phi$ is called a set of *simple roots* if

1. $\Delta$ is a basis for the rational span of the roots ${\mathbb{Q}}\Phi\le {\mathbb{Q}}\otimes X$; and
2. $\Phi = \Phi^+\cup\Phi^-$, where $\Phi^+$ is the set of linear combinations of elements of $\Delta$ with nonnegative coefficients, and $\Phi^- = -\Phi^+$. Every root datum has a set of simple roots. Simple roots are frequently called fundamental roots. The elements of $\Phi^+$ are called *positive roots* and the elements of $\Phi^-$ *negative roots*. The coroots corresponding to the simple (resp. positive, negative) roots are the *simple* (respectively, *positive*, *negative*) *coroots*.

The *rank* of the root datum is the size of $\Delta$, i.e. the dimension of the subspace ${\mathbb{Q}}\Phi$. The rank cannot be larger than the *dimension* of the root datum (i.e. the dimension of ${\mathbb{Q}}\otimes X$). If the rank and dimension are equal, the root datum is said to be *semisimple*.

Choose a basis $e_1,\dots,e_d$ for $X$ and a dual basis $f_1,\dots,f_d$ for $Y$, so that $\langle e_i,f_j\rangle=\delta_{ij}$. A reduced root system is determined by a pair of integral matrices $A$ and $B$ where the rows of $A$ are the simple roots and the rows of $B$ are the corresponding coroots; i.e. $A_{ij}=\langle\alpha_i,f_j\rangle$ and $B_{ij}=\langle e_j,\alpha_i^\star\rangle$.

<a id="rootdatum-cox-grps"></a>
<a id="subsectrdcoxgrp"></a>
#### The Coxeter Group

The group $W$ generated by the reflections $s_\alpha$, for $\alpha$ a simple root, is a finite Coxeter group. The *Cartan matrix* of a root datum is

$$
C =
  \left(\left\langle\,\alpha_i,\alpha_j^\star\,\right\rangle\right)_{i,j=1}^n =
  AB^t.
$$

As in Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan), the Cartan matrix is used to define the Coxeter matrix, Coxeter graph, and Dynkin digraph of a root datum.

A *Coxeter form* is a $W$-invariant bilinear form on $X$. If $R$ is reduced and irreducible, then the roots can have at most two different lengths with respect to this form. We call the roots *long* or *short* accordingly. The Coxeter form is normalised so that the short roots in each component have length one. Note that, even if $X=Y$, this form will generally not be the same as the pairing $\langle\circ,\circ\rangle$; however it can often be arranged for them to be the same (see [`StandardRootSystem`](https://docs.magma-maths.org/LieTheory/RootSystems/construct-root-system.md#function-intrstandardrootsystem)).

<a id="nonred-root-data"></a>
<a id="subsectrdnonred"></a>
#### Nonreduced Root Data

A root datum is *reduced*, if $\alpha,\beta\in\Phi$ with $\beta$ a scalar product of $\alpha$ implies $\alpha=\pm\beta$. A root $\alpha$ with the property $2\alpha\notin \Phi$ is called *reduced*. A root $\alpha$ with the property ${1\over 2}\alpha\in\Phi$ is called *divisible*. If $R$ is a root datum, then the set $R_0$ of indivisible roots in $R$ form the *indivisible subsystem*.

Let $R$ be a nonreduced irreducible root datum of rank $n$. It can be shown that $R_0$ is irreducible of type of type $B_n$ and every root is either in $R_0$, or is two times a short root of $R_0$. The Cartan type of $R$ in this case is $BC_n$.

Note that the Cartan matrix, Coxeter matrix, Coxeter diagram, Coxeter group, and Dynkin diagram are the same for $R$ and $R_0$. Thus, when creating a non-reduced root datum for a given Cartan matrix, Coxeter matrix, Coxeter diagram, Coxeter group, or Dynkin diagram, one must specify the set of non-reduced fundamental roots. E.g., let $C$ be a cartan matrix of type $B_2\times B_3$. Then the set of nonreduced fundamental roots can be one of $\emptyset$, $\{2\}$, $\{5\}$, or $\{2,5\}$, in which cases the root datum will be of types $B_2\times B_3$, $BC_2\times B_3$, $B_2\times BC_3$, or $BC_2\times BC_3$ respectively.

<a id="rootdata"></a>
<a id="subsectrdisogeny"></a>
#### Isogeny of Split Reduced Root Data

The Dynkin digraph and dimension do not completely determine the isomorphism type of a split root datum, as the Coxeter graph and dimension do for a root system. Two root data with isomorphic Dynkin digraphs are said to be *Cartan equivalent*. We now describe the isomorphism classes within each Cartan equivalence class of split reduced irreducible root data. Since every semisimple reduced root datum is isogenous to a direct sum of irreducible root data, this immediately gives a classification of the split semisimple root data. Classifying nonsemisimple root data would be more complicated.

The *weights* of a root datum are the $\lambda$ in ${\mathbb{Q}}\Phi\le X\otimes{\mathbb{Q}}$ such that $\langle\lambda,\alpha^\star\rangle\in{\mathbb{Z}}$ for every coroot $\alpha^\star$. The weights form a lattice $\Lambda$ called the *weight lattice*. We now have lattices ${\mathbb{Z}}\Phi\le X \le\Lambda$ (note that the second inclusion holds only for semisimple root data). The isomorphism class of a root datum in a fixed Cartan equivalence class is determined by the position of $X$ between the root lattice ${\mathbb{Z}}\Phi$ and the weight lattice $\Lambda$. Alternatively, the isomorphism class is determined by the *isogeny group* $X/{\mathbb{Z}}\Phi$ within the *fundamental group* $\Lambda/{\mathbb{Z}}\Phi$. The fundamental group is determined by the Cartan matrix $C$: it is isometric to ${\mathbb{Z}}^n/\Theta$ where $\Theta$ is the lattice generated by the rows of $C$. The fundamental groups of the irreducible Cartan equivalence classes are

**•**
$A_n$: ${\mathbb{Z}}/(n+1)$;

**•**
$B_n$, $C_n$, $E_7$: ${\mathbb{Z}}/2$;

**•**
$D_n$: ${\mathbb{Z}}/4$ for $n$ odd, ${\mathbb{Z}}/2 \times {\mathbb{Z}}/2$ for $n$ even;

**•**
$E_6$: ${\mathbb{Z}}/3$;

**•**
$E_8$, $F_4$, $G_2$: trivial. If $X={\mathbb{Z}}\Phi$ the root datum is said to be *adjoint*; if $X=\Lambda$ it is said to be *simply connected*. The quotient $Y/{\mathbb{Z}}\Phi^\star$ is called the *coisogeny group*; in the semisimple case it is isomorphic to $\Lambda/{\mathbb{Z}}\Phi$.

<a id="extended-rootdtm"></a>
<a id="subsectextrd"></a>
#### Extended Root Data

An extended root datum is a split root datum $R=(X,\Phi,Y,\Phi^\star)$ and a permutation group $\Gamma$ with actions on $X$ and $Y$ that respect the pairing $\langle\circ,\circ\rangle$.

Fix a set of simple roots $\Delta$. Let $O(\chi)$ denote the orbit of $\chi\in X$ under the $\Gamma$-action. Then, for $\alpha\in\Phi$ either $O(\alpha)$ is contained in $\Phi^+$, or it is contained in $\Phi^-$, or the sum of the roots of $O(\alpha)$ is zero. We call $O(\alpha)$ a *positive*, *negative*, or *zero orbit*, respectively. Put

$$
X_0      := \{ \chi \in X \mid
          \sum_{\gamma\in\Gamma} \chi^{\gamma} = 0 \}.
$$

Let $\Phi_0 := \Phi \cap X_0$ and $\Delta_0 := \Delta \cap X_0$. Then $X_0$ is a submodule of $X$, $\Phi_0$ is a subsystem of $\Phi$, and $\Delta_0$ is a fundamental system of $\Phi_0$. Note that $\Delta_0$ is not necessarily a basis of $X_0$. Analogously, we define $Y_0$ and $\Phi^\star_0$. The subdatum $R_0 = (X_0, \Phi_0, Y_0, \Phi^\star_0)$ is called the *anisotropic subdatum* of $R$.

Set $\bar{X} := X/X_0$ and let $\pi:X\to \bar{X}$ be the standard projection. Then $\bar{X}$ is a free ${\mathbb{Z}}$-module and $\pi$ is a homomorphism of modules. Let $\bar{\Phi}$ and $\bar{\Delta}$ be the images under $\pi$ of $\Phi \setminus \Phi_0$ and $\Delta \setminus \Delta_0$, respectively. Then $\bar{\Phi}$ is a root system and $\bar{\Delta}$ is a fundamental system of it. We call $\bar{\Phi}$ the *relative root system* and $\bar{\Delta}$ the *relative fundamental system*. Note that $\bar{\Phi}$ need not be irreducible nor reduced even if $\Phi$ is. The rank of the relative system is $|\bar{\Delta}|$ and is called the *relative rank*, whereas the rank $|\Delta|$ of $\Phi$ is called the *absolute rank*. Let $\bar{\Phi}^+$ and $\bar{\Phi}^-$ denote the images under $\pi$ of $\Phi^+ \setminus \Phi_0$ and $\Phi^- \setminus \Phi_0$. When $X_0=X$, the relative root system is an empty set and the form is called *anisotropic*.

Each $\gamma\in\Gamma$ acts on $X$ by $\chi \mapsto \chi^{\sigma w}$ for some unique $w\in W$ and $\sigma$ a Dynkin diagram symmetry. By $\alpha \mapsto \alpha^\sigma$ for $\alpha\in \Delta$ we define the $[\Gamma]$-action on $\Delta$. The extended root datum is called *inner* if the $[\Gamma]$-action is trivial and *outer* otherwise. The orbits of the $[\Gamma]$-action, that are not contained in $X_0$ are called *distinguished*.

An extended root datum is called *twisted* if the $\Gamma$-action is not trivial.

The (split) Cartan name of an extended root datum is the name of the corresponding split root datum. An extended root datum is *absolutely irreducible* if the corresponding split datum is irreducible. It is irreducible if there is no direct sum decomposition of the split datum which is preserved under the action of $\Gamma$. The *twisted Cartan name* of a root datum is the Cartan name, with extra information describing the twist. The name ${}^mX_{n,e}$ indicates a root datum with split Cartan name $X_n$, where the kernel of the $[\Gamma]$-action has index $m$ in $\Gamma$, and $e$ is the rank of the relative root system. The twisted Cartan name describes absolutely irreducible root data up to isomorphism. This is not true for simple root data however.

<a id="create-root-datum"></a>
<a id="sectrdconstr"></a>
### Constructing Root Data

We first describe some optional parameters that are common to many functions described below.

```magma
Isogeny: Any                    Default: "Ad"
```

The optional parameter `Isogeny` specifies the isomorphism class of the root datum within the Cartan equivalence class (see Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). For irreducible Cartan names, `Isogeny` can be one of the following:

1. A string: `"Ad"` for adjoint or `"SC"` for simply connected.
2. An integer giving the size of the isogeny subgroup within the fundamental group. The root datum must be absolutely irreducible. This does not work in type $D_n$ with $n$ even and $\hbox{\tt Isogeny}=2$, since in this case there are three distinct isomorphism classes (see the example below to create these data).
3. An injection of an abelian group into the fundamental group.

For compound Cartan names, `Isogeny` can be a string (`"Ad"` or `"SC"`); an injection into the fundamental group; or a list of strings, integers, and injections (one for each direct summand).

```magma
Signs: Any                    Default: 1
```

Many of the constants associated with root data depend on the choice of the sign $\epsilon_{rs}$ for each extraspecial pair $(r,s)$. This parameter allows the user to fix these signs for the root datum $R$ by giving a sequence $s$ of length `NumExtraspecialPairs(R)` consisting of integers $1$ or $-1$. It is also possible to set `Signs` to $1$ instead of a sequence of all $1$ and to $-1$ instead of a sequence of all $-1$.

```magma
Twist: Any                    Default: 1
```

This optional parameter defines a $\Gamma$-action of an extended root datum and will accept the following values:

1. a homomorphism from $\Gamma$ into `Sym(2*N)`, where $N$ is the number of positive roots, specifying the action of $\Gamma$ on the (co)roots. (Only for semisimple root data).
2. an integer $i$ giving the order of $\Gamma$, e.g., $1,2,3,6$ for ${}^1D_4$, ${}^2D_4$, ${}^3D_4$, ${}^6D_4$ (only if $i = 1$ or the root datum is irreducible).
3. $\langle D,i \rangle$, where $D$ is a set of distinguished orbits as sets of integers and $i$ (integer) is the order of the Dynkin diagram symmetry involved (only for irreducible root data).
4. $\langle \Gamma,ims \rangle$, where $\Gamma$ is the acting group and $ims$ define images either as permutations of the simple roots or as permutation of all roots (only for semisimple root data).
5. $\langle \Gamma, imsR, imsC \rangle$, where $\Gamma$ is the acting group and $imsR$ ($imsC$) is a sequence of matrices defining the action of $\Gamma$ on the root space (coroot space).

```magma
Nonreduced: SetEnum                    Default: {}
```

The optional argument `Nonreduced` is used to give the set of indices of the nonreduced simple roots. Note that a root datum cannot be both twisted and nonreduced.

<a id="function-intrrootdatum"></a>
#### `RootDatum(N): MonStgElt -> RootDtm`

```magma
Isogeny: Any                    Default: "Ad"
Signs  : Any                    Default: 1
Twist  : Any                    Default: 1
```

A root datum with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)). In addition to the possible Cartan names described in Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff), this function will also accept `"Tn"` as a component of the Cartan name, which stands for an $n$-dimensional toral subdatum. Note, however, that this addition is for input only and will not appear in the string returned by `CartanName` when applied to the resulting root datum (see example below).

If the optional parameter `Isogeny` is a list, its length should be equal to the total number of components. Entries of this list corresponding to toral components will be ignored.

If the corresponding Coxeter group is infinite affine, an error is flagged.

<a id="example-ex-c80243"></a>
#### `Example: Creating Root Data (ex-c80243)`

Examples of adjoint and simply connected irreducible root data.

```magma
> RootDatum("E6");
Adjoint root datum of type E6
> RootDatum("E6" : Isogeny := "SC");
Simply connected root datum of type E6
```

With nonirreducible root data the isogeny can be given as a list.

```magma
> R := RootDatum("A5 B3" : Isogeny := [* 3, "Ad" *]);
> R : Maximal;
Root datum of type A5 B3 with simple roots
[1 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 0 0 1 0 0 0 0]
[1 2 0 1 3 0 0 0]
[0 0 0 0 0 1 0 0]
[0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 0 1]
and simple coroots
[ 2 -1  0  0  0  0  0  0]
[-1  2 -1  0 -1  0  0  0]
[ 0 -1  2 -1  1  0  0  0]
[ 0  0 -1  2 -1  0  0  0]
[ 0  0  0 -1  1  0  0  0]
[ 0  0  0  0  0  2 -1  0]
[ 0  0  0  0  0 -1  2 -1]
[ 0  0  0  0  0  0 -2  2]
>
> RootDatum("E6 A3 B4" : Isogeny := "SC");
Simply connected root datum of type E6 A3 B4
```

Nonsemisimple root data can be constructed by specifying a central torus.

```magma
> R := RootDatum("B3 T2 A2" : Isogeny := [* "SC", 0, "Ad" *]);
> R;
R: Root datum of type B3 A2
> Dimension(R), Rank(R);
7 5
> SimpleCoroots(R);
[ 1  0  0  0  0  0  0]
[ 0  1  0  0  0  0  0]
[ 0  0  1  0  0  0  0]
[ 0  0  0  0  0  2 -1]
[ 0  0  0  0  0 -1  2]
```

The following code creates the three root data of type $D_6$ with isogeny groups of size 2 using injections into the fundamental group.

```magma
> G< a, b > := FundamentalGroup("D6");
> G;
Abelian Group isomorphic to Z/2 + Z/2
Defined on 2 generators
Relations:
    2*a = 0
    2*b = 0
> _, inj1 := sub< G | a >;
> R1 := RootDatum("D6" : Isogeny := inj1);
> _, inj2 := sub< G | b >;
> R2 := RootDatum("D6" : Isogeny := inj2);
> _, inj3 := sub< G | a*b >;
> R3 := RootDatum("D6" : Isogeny := inj3);
```

<a id="example-ex-cd6016"></a>
#### `Example: Creating Extended Root Data (ex-cd6016)`

Examples of extended root data:

```magma
> R := RootDatum("A5" : Twist := 2 ); R;
R: Twisted adjoint root datum of type 2A5,3
> R eq RootDatum("A5" : Twist := < Sym(2), [Sym(5)|(1,5)(2,4)] > );
true
> R eq RootDatum("A5" : Twist := < {{1,5},{2,4},{3}}, 2 > );
true
> RootDatum("D4" : Twist := 1);
Adjoint root datum of type D4
> RootDatum("D4" : Twist := 2);
Twisted adjoint root datum of type 2D4,3
> RootDatum("D4" : Twist := 3);
Twisted adjoint root datum of type 3D4,2
> RootDatum("D4" : Twist := 6);
Twisted adjoint root datum of type 6D4,2
>
> R := RootDatum("A2");
> TwistedRootDatum(R : Twist := 2);
Twisted adjoint root datum of type 2A2,1
```

<a id="function-rootdatum-algmatelt"></a>
#### `RootDatum(C): AlgMatElt -> RootDtm`

```magma
Isogeny   : Any                        Default: "Ad"
Signs     : Any                        Default: 1
Twist     : Any                        Default: 1
Nonreduced: SetEnum                    Default: {}
```

A semisimple root datum with crystallographic Cartan matrix $C$. If the corresponding Coxeter group is infinite, an error is flagged.

<a id="function-rootdatum-grphdir"></a>
#### `RootDatum(D): GrphDir -> RootDtm`

```magma
Isogeny   : Any                        Default: "Ad"
Signs     : Any                        Default: 1
Twist     : Any                        Default: 1
Nonreduced: SetEnum                    Default: {}
```

A semisimple root datum with Dynkin digraph $D$. If the corresponding Coxeter group is infinite, an error is flagged.

<a id="function-rootdatum-mtrx-mtrx"></a>
#### `RootDatum(A, B): Mtrx, Mtrx -> RootDtm`

```magma
Signs     : Any                        Default: 1
Twist     : Any                        Default: 1
Nonreduced: SetEnum                    Default: {}
```

The root datum with simple roots given by the rows of the matrix $A$ and simple coroots given by the rows of the matrix $B$. The matrices $A$ and $B$ must have the following properties:

1. $A$ and $B$ must be integral matrices with the same number of rows and the same number of columns;
2. the number of columns must be at least the number of rows; and
3. $AB^t$ must be the Cartan matrix of a finite Coxeter group.

<a id="example-ex-46dafe"></a>
#### `Example: Nonsemisimple Root Datum of Type G2 (ex-46dafe)`

An example of a nonsemisimple root system of type $G_2$:

```magma
> A := Matrix(2,3, [1,-1,0, -1,1,-1]);
> B := Matrix(2,3, [1,-1,1, 0,1,-1]);
> RootDatum(A, B);
Root datum of type G2
```

An example of a non-reduced root datum and usage of `Nonreduced` argument:

```magma
> C := CoxeterMatrix("B2B2");
> RootDatum(C);
Adjoint root datum of type B2 B2
> RootDatum(C : Nonreduced:={2});
Adjoint root datum of type BC2 B2
> RootDatum(C : Nonreduced:={4});
Adjoint root datum of type B2 BC2
> RootDatum(C : Nonreduced:={2,4});
Adjoint root datum of type BC2 BC2
```

<a id="function-irreduciblerootdatum-monstgelt-rngintelt"></a>
#### `IrreducibleRootDatum(X, n): MonStgElt, RngIntElt -> RootDtm`

```magma
Signs: Any                    Default: 1
Twist: Any                    Default: 1
```

The irreducible root datum with Cartan name $X_n$.

<a id="function-intrstandardrootdatum"></a>
#### `StandardRootDatum(X, n): MonStgElt, RngIntElt -> RootDtm`

```magma
Signs: Any                    Default: 1
Twist: Any                    Default: 1
```

The standard root datum with Cartan name $X_n$, i.e. the root datum with the standard inner product equal to the Coxeter form up to a constant. For technical reasons, this is only possible for the classical types, i.e. $X$ must be `"A"`, `"B"`, `"C"`, or `"D"`. Note that the standard root datum is not semisimple for type $A_n$.

<a id="example-ex-8489eb"></a>
#### `Example: Irreducible Root Data by Type (ex-8489eb)`

These functions are useful in loops.

```magma
> for X in ["A","B","G"] do
>   print NumPosRoots(IrreducibleRootDatum(X, 2));
> end for;
3
4
6
```

<a id="function-toralrootdatum-rngintelt"></a>
#### `ToralRootDatum(n): RngIntElt -> RootDtm`

```magma
Twist: Any                    Default: 1
```

The toral root datum of dimension $n$, i.e., the $n$-dimensional root datum with no roots or coroots.

<a id="example-ex-c91fea"></a>
#### `Example: Toral Root Data (ex-c91fea)`

Toral root datum of dimension 3 and a twisted version of it:

```magma
> ToralRootDatum(3);
Toral root datum of dimension 3
> M := Matrix(Rationals(),3,3,[0,1,0,1,0,0,0,0,1]);M;
[0 1 0]
[1 0 0]
[0 0 1]
> ToralRootDatum(3 : Twist := <Sym(2),[M],[M]>);
Twisted toral root datum of dimension 3
```

<a id="function-trivialrootdatum"></a>
#### `TrivialRootDatum() -> RootDat`

The trivial root datum of dimension $0$.

<a id="sparse-root-data-create"></a>
<a id="sparserdcreate"></a>
#### Constructing Sparse Root Data

Sparse root data differ from the usual root data only in the internal representation of the objects. The internal representation is less memory expensive and requires less time for creation. Sparse root data have type `RootDtmSprs`, which is a subcategory of `RootDtm`.

There are some limitation on the root data which can have sparse representation. First, sparse representation only makes sense for classical root data, that is of types $A$, $B$, $C$, and $D$. At the moment only root data with a connected Coxeter diagram may have sparse representation and no twisted sparse root data can be constructed.

<a id="function-sparserootdatum-monstgelt"></a>
##### `SparseRootDatum(N): MonStgElt -> RootDtmSprs`

<a id="function-sparserootdatum-monstgelt-2"></a>
##### `SparseRootDatum(N): MonStgElt -> RootDtmSprs`

<a id="function-sparserootdatum-algmatelt"></a>
##### `SparseRootDatum(C): AlgMatElt -> RootDtmSprs`

<a id="function-sparserootdatum-grphdir"></a>
##### `SparseRootDatum(D): GrphDir -> RootDtmSprs`

<a id="function-sparserootdatum-rootsys"></a>
##### `SparseRootDatum(R): RootSys -> RootDtmSprs`

<a id="function-sparserootdatum-mtrx-mtrx"></a>
##### `SparseRootDatum(A, B): Mtrx, Mtrx -> RootDtmSprs`

<a id="function-sparseirreduciblerootdatum-monstgelt-rngintelt"></a>
##### `SparseIrreducibleRootDatum(X, n): MonStgElt, RngIntElt -> RootDtmSprs`

<a id="function-sparsestandardrootdatum-monstgelt-rngintelt"></a>
##### `SparseStandardRootDatum(X, n): MonStgElt, RngIntElt -> RootDtmSprs`

These functions have the same syntax as their counterparts without the “`Sparse`” in the name (see Section [Constructing Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#sectrdconstr)). The root datum returned has sparse representation. See [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps)] for the algorithms used to construct sparse root data.

<a id="example-ex-c58524"></a>
##### `Example: Creating Sparse Root Data (ex-c58524)`

```magma
> SparseRootDatum("A2");
Sparse adjoint root datum of dimension 2 of type A2
> SparseStandardRootDatum("A", 2);
Sparse root datum of dimension 3 of type A2
> SparseRootDatum("A2") eq RootDatum("A2");
true
```

<a id="function-sparserootdatum-rootdtm"></a>
##### `SparseRootDatum(R): RootDtm -> RootDtmSprs`

Return a sparse root datum equal to the root datum $R$.

<a id="function-rootdatum-rootdtmsprs"></a>
##### `RootDatum(R): RootDtmSprs -> RootDtm`

Return a non-sparse root datum equal to the root datum $R$.

<a id="example-ex-7d922a"></a>
##### `Example: Sums and Subdata of Sparse Root Data (ex-7d922a)`

Due to the restrictions mentioned above, some operations that create new root data, will return a non-sparse root datum even though the input was sparse.

```magma
> R := SparseRootDatum("A2");
> T := ToralRootDatum(3);
> R+T;
Sparse root datum of dimension 5 of type A2
> R+R;
Adjoint root datum of dimension 4 of type A2 A2
```

<a id="operators-root-dtm"></a>
<a id="sectrdop"></a>
### Operations on Root Data

<a id="operation-op-eq-rootdtm-rootdtm"></a>
#### `R1 eq R2: RootDtm, RootDtm -> BoolElt`

Returns `true` if, and only if, $R_1$ and $R_2$ are identical root data.

<a id="function-isisomorphic-rootdtm-rootdtm"></a>
#### `IsIsomorphic(R1, R2): RootDtm, RootDtm -> BoolElt, [RngIntElt], Map`

Returns `true` if, and only if, $R_1$ and $R_2$ are isomorphic root data. If `true`, the second value returned is a sequence giving the simple root of $R_2$ corresponding to each simple root of $R_1$, and the third value returned is an isomorphism $R_1\to R_2$. This function is currently only implemented for semisimple root data.

<a id="function-iscartanequivalent-rootdtm-rootdtm"></a>
#### `IsCartanEquivalent(R1, R2): RootDtm, RootDtm -> BoolElt, SeqEnum`

Returns `true` if and only if the root data $R_1$ and $R_2$ are Cartan equivalent; i.e. they have isomorphic Dynkin diagrams. If `true`, the second value returned is a sequence giving the simple root of $R_2$ corresponding to each simple root of $R_1$.

<a id="function-isisogenous-rootdtm-rootdtm"></a>
#### `IsIsogenous(R1, R2): RootDtm, RootDtm -> BoolElt, SeqEnum, RootDtm, Map, Map, RootDtm, Map, Map`

Returns `true` if, and only if, $R_1$ and $R_2$ are isogenous root data. If `true`, the subsequent values returned are: a sequence giving the root of $R_2$ corresponding to each root of $R_1$, the corresponding adjoint root datum $R_{ad}$, the morphisms $R_{ad}\to R_1$ and $R_{ad}\to R_2$, the corresponding simply connected root datum $R_{sc}$, and the morphisms $R_1\to R_{sc}$ and $R_2\to R_{sc}$.

<a id="example-ex-864e8f"></a>
#### `Example: Isomorphism and Isogeny of Root Data (ex-864e8f)`

An example of isogenous root data:

```magma
> R1 := RootDatum("A3");
> R2 := RootDatum("A3" : Isogeny := "SC");
> R1 eq R2;
false
> IsIsomorphic(R1, R2);
false
> IsCartanEquivalent(R1, R2);
true [ 1, 2, 3 ]
> IsIsogenous(R1, R2);
true [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 ]
Adjoint root datum of type A3
Mapping from: RootDtm: ad to RootDtm: ad
Mapping from: RootDtm: ad to RootDtm: sc
Simply connected root datum of type A3
Mapping from: RootDtm: ad to RootDtm: sc
Mapping from: RootDtm: sc to RootDtm: sc
```

An example of distinct isomorphic root data:

```magma
> C := CartanMatrix("B2");
> R1 := RootDatum(C);
> R2 := RootDatum(Transpose(C));
> R1; R2;
Adjoint root datum of type B2
Adjoint root datum of type C2
> R1 eq R2;
false
> IsIsomorphic(R1, R2);
true [ 2, 1 ]
```

<a id="function-cartanname-rootstr"></a>
#### `CartanName(R): RootStr -> MonStgElt`

The Cartan name of the root datum $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-twistedcartanname-rootdtm"></a>
#### `TwistedCartanName(R): RootDtm -> MonStgElt`

The twisted Cartan name of the root datum $R$. E.g., `"2A3,2"`.

<a id="procedure-coxeterdiagram-rootstr"></a>
#### `CoxeterDiagram(R): RootStr`

Print the Coxeter diagram of the root datum $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-dynkindiagram-rootstr"></a>
#### `DynkinDiagram(R): RootStr`

Print the Dynkin diagram of the root datum $R$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-coxetermatrix-rootstr"></a>
#### `CoxeterMatrix(R): RootStr -> AlgMatElt`

The Coxeter matrix of the root datum $R$ (Section [Coxeter Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#sectcartancoxmat)).

<a id="function-coxetergraph-rootstr"></a>
#### `CoxeterGraph(R): RootStr -> GrphUnd`

The Coxeter graph of the root datum $R$ (Section [Coxeter Graphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#sectcartancoxgrph)).

<a id="function-cartanmatrix-rootstr"></a>
#### `CartanMatrix(R): RootStr -> AlgMatElt`

The Cartan matrix of the root datum $R$ (Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat)).

<a id="function-dynkindigraph-rootstr"></a>
#### `DynkinDigraph(R): RootStr -> GrphDir`

The Dynkin digraph of the root datum $R$ (Section [Dynkin Digraphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#sectcartandyndigrph)).

<a id="example-ex-de9285"></a>
#### `Example: Dynkin and Coxeter Diagrams (ex-de9285)`

```magma
> R := RootDatum("F4");
> DynkinDiagram(R);

F4    1 - 2 =>= 3 - 4
> CoxeterDiagram(R);

F4    1 - 2 === 3 - 4
```

<a id="function-gammaaction-rootdtm"></a>
#### `GammaAction(R): RootDtm -> Rec`

The $\Gamma$-action of the root datum $R$. This is a record consisting of four elements: `gamma` is the Group $\Gamma$ acting on $R$, `perm_ac` is the homomorphism defining the permutation action of $\Gamma$ on the set of all roots of $R$, finally `mats_rt` and `mats_co` are sequences of matrices defining the action of $\Gamma$ on the root and coroot spaces of $R$.

<a id="function-gammarootspace-rootdtm"></a>
#### `GammaRootSpace(R): RootDtm -> GSetEnum, Map`

<a id="function-gammacorootspace-rootdtm"></a>
#### `GammaCorootSpace(R): RootDtm -> GSetEnum, Map`

Given a root datum $R$, create the fixed space of $\Gamma$ acting on the (co)root space $V = {\mathbb{Q}}\otimes X$ of $R$ as well as the embedding in $V$.

<a id="function-gammaorbitonroots-rootdtm-rngintelt"></a>
#### `GammaOrbitOnRoots(R, r): RootDtm, RngIntElt -> GSetEnum`

The orbit through the $r$th root of the $\Gamma$-action on the root datum $R$.

<a id="function-gammaorbitsonroots-rootdtm"></a>
#### `GammaOrbitsOnRoots(R): RootDtm -> SeqEnum[GSetEnum]`

<a id="function-positivegammaorbitsonroots-rootdtm"></a>
#### `PositiveGammaOrbitsOnRoots(R): RootDtm -> SeqEnum[GSetEnum]`

<a id="function-negativegammaorbitsonroots-rootdtm"></a>
#### `NegativeGammaOrbitsOnRoots(R): RootDtm -> SeqEnum[GSetEnum]`

<a id="function-zerogammaorbitsonroots-rootdtm"></a>
#### `ZeroGammaOrbitsOnRoots(R): RootDtm -> SeqEnum[GSetEnum]`

The sequence of all (respectively positive, negative, and zero) orbits of the $\Gamma$-action on the root datum $R$ (Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)).

<a id="function-gammaactiononsimples-rootdtm"></a>
#### `GammaActionOnSimples(R): RootDtm -> HomGrp`

The $[\Gamma]$-action on the simple (co)roots of the root datum $R$. (Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)). This function was called `GammaActionPi` in the last release.

<a id="function-orbitsonsimples-rootdtm"></a>
#### `OrbitsOnSimples(R): RootDtm -> SeqEnum[GSetEnum]`

The sequence of all orbits of the $[\Gamma]$-action on the simple (co)roots of the root datum $R$ (Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)). This function was called `OrbitsPi` in the last release.

<a id="function-distinguishedorbitsonsimples-rootdtm"></a>
#### `DistinguishedOrbitsOnSimples(R): RootDtm -> SeqEnum[GSetEnum]`

The sequence of distinguished orbits of the $[\Gamma]$-action on the simple (co)roots of the root datum $R$ (Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)). This function was called `DistinguishedOrbitsPi` in the last release.

<a id="function-basering-rootdtm"></a>
#### `BaseRing(R): RootDtm -> RngInt`

The base ring of the root datum $R$ is the field of rational numbers.

<a id="function-rank-rootstr"></a>
#### `Rank(R): RootStr -> RngIntElt`

<a id="function-absoluterank-rootdtm"></a>
#### `AbsoluteRank(R): RootDtm -> RngIntElt`

The (absolute) rank of the root datum $R$, i.e. the number of simple (co)roots.

<a id="function-relativerank-rootdtm"></a>
#### `RelativeRank(R): RootDtm -> RngIntElt`

The relative rank of the root datum $R$, i.e. the number of simple (co)roots of the relative root system. This is the same as absolute rank for split root data.

<a id="function-dimension-rootstr"></a>
#### `Dimension(R): RootStr -> RngIntElt`

The dimension of the root datum $R$, i.e. the dimension of the (co)root space. This is at least as large as the rank, with equality when $R$ is semisimple.

<a id="function-twistingdegree-rootdtm"></a>
#### `TwistingDegree(R): RootDtm -> RngIntElt`

The twisting degree of the root datum $R$, i.e. the order of $\Gamma$ divided by the kernel of the $[\Gamma]$-action.

<a id="function-anisotropicsubdatum-rootdtm"></a>
#### `AnisotropicSubdatum(R): RootDtm -> RootDtm`

The anisitropic subdatum of the root datum $R$.

<a id="example-ex-9c2a05"></a>
#### `Example: Operations for Twisted Root Data (ex-9c2a05)`

Consider the twisted root datum of type ${}^2A_{3,1}$ with distinguished orbit $\{2\}$:

```magma
> R := RootDatum( "A3" : Twist := < {{2}}, 2 > );
```

First, print out the action of $\Gamma$ on the root datum:

```magma
> GammaAction(R);
rec<recformat<gamma: GrpPerm, perm_ac: HomGrp, mats_rt, mats_co> |
     gamma := Permutation group acting on a set of cardinality 4
     Order = 4 = 2^2
          (1, 2, 3, 4),
     perm_ac := Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $,
     Degree 12, Order 2^10 * 3^5 * 5^2 * 7 * 11 induced by
          (1, 2, 3, 4) |--> (1, 3, 7, 9)(2, 4, 6, 5)(8, 10, 12, 11),
     mats_rt := [
          [ 0  0  1]
          [ 1  1  0]
          [-1  0  0]
     ],
     mats_co := [
          [ 0  0  1]
          [ 0  1  0]
          [-1  1  0]
     ]
     >
```

Compute the orbits of the $\Gamma$-action:

```magma
> PositiveGammaOrbitsOnRoots(R);
[
     GSet{ 2, 4, 5, 6 }
]
> NegativeGammaOrbitsOnRoots(R);
[
     GSet{ 8, 10, 11, 12 }
]
> ZeroGammaOrbitsOnRoots(R);
[
     GSet{ 1, 3, 7, 9 }
]
> &+[ Root(R,r) : r in ZeroGammaOrbitsOnRoots(R)[1] ];
(0 0 0)
```

Compute the $[\Gamma]$-action and its orbits:

```magma
> GammaActionOnSimples(R);
Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $,
Degree 3, Order 2 * 3 induced by
     (1, 2, 3, 4) |--> (1, 3)
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 1, 3 }
]
> DistinguishedOrbitsOnSimples(R);
[
     GSet{ 2 }
]
```

Absolute and relative rank and the twisting degree, as well as their appearance in the name of the root datum:

```magma
> AbsoluteRank(R);
3
> RelativeRank(R);
1
> TwistingDegree(R);
2
> R;
R: Twisted adjoint root datum of type 2A3,1
```

anisotropic subdatum:

```magma
> A := AnisotropicSubdatum(R); A;
A: Twisted root datum of type 2(A1 A1)2,0
> GammaAction(A)`perm_ac;
Homomorphism of GrpPerm: $, Degree 4, Order 2^2 into GrpPerm: $,
Degree 4, Order 2^2 induced by
     (1, 2, 3, 4) |--> (1, 2, 3, 4)
```

<a id="function-coxetergrouporder-rootstr"></a>
#### `CoxeterGroupOrder(R): RootStr -> RngIntElt`

The order of the (split) Coxeter group of the root datum $R$.

<a id="function-groupoflietypeorder-rootdtm-rngelt"></a>
#### `GroupOfLieTypeOrder(R, q): RootDtm, RngElt -> RngIntElt`

The order of the group of Lie type with split root datum $R$ over the field of cardinality $q$.

<a id="function-groupoflietypefactoredorder-rootdtm-rngelt"></a>
#### `GroupOfLieTypeFactoredOrder(R, q): RootDtm, RngElt -> RngIntElt`

The factored order of the group of Lie type with split root datum $R$ over the field of order $q$.

<a id="example-ex-da6059"></a>
#### `Example: Order of a Group of Lie Type (ex-da6059)`

As well as accepting a specific prime power, these functions also take an indeterminate so that the generic order formula can be computed.

```magma
> P<q> := PolynomialRing(Integers());
> R := RootDatum("F4");
> GroupOfLieTypeFactoredOrder(R, q);
[
    <q - 1, 4>,
    <q, 24>,
    <q + 1, 4>,
    <q^2 - q + 1, 2>,
    <q^2 + 1, 2>,
    <q^2 + q + 1, 2>,
    <q^4 - q^2 + 1, 1>,
    <q^4 + 1, 1>
]
>
> R := RootDatum("B2");
> ord := GroupOfLieTypeOrder(R, q);
> forall{ q : q in [2..200] | not IsPrimePower(q) or
>   Evaluate(ord, q) eq GroupOfLieTypeOrder(R, q) };
true
```

<a id="function-fundamentalgroup-rootdtm"></a>
#### `FundamentalGroup(R): RootDtm -> GrpAb, Map`

The fundamental group $\Lambda/{\mathbb{Z}}\Phi$ of the root datum $R$ together with the projection $\Lambda\rightarrow\Lambda/{\mathbb{Z}}\Phi$. See Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny).

<a id="function-isogenygroup-rootdtm"></a>
#### `IsogenyGroup(R): RootDtm -> GrpAb, Map`

The isogeny group $X/{\mathbb{Z}}\Phi$ of the root datum $R$ together with the projection $X\rightarrow X/{\mathbb{Z}}\Phi$. If $R$ is semisimple, the injection $X/{\mathbb{Z}}\Phi\rightarrow\Lambda/{\mathbb{Z}}\Phi$ is also returned. See Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny).

<a id="function-coisogenygroup-rootdtm"></a>
#### `CoisogenyGroup(R): RootDtm -> GrpAb, Map`

The coisogeny group $Y/{\mathbb{Z}}\Phi^\star$ of the root datum $R$ together with the projection $Y\rightarrow Y/{\mathbb{Z}}\Phi^\star$. If $R$ is semisimple, the projection $Y/{\mathbb{Z}}\Phi^\star\rightarrow\Lambda/{\mathbb{Z}}\Phi$ is also returned. See Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny).

<a id="example-ex-2f8db1"></a>
#### `Example: Isogeny and Fundamental Groups (ex-2f8db1)`

In the semisimple case, the fundamental group contains the isogeny group, with quotient isomorphic to the coisogeny group.

```magma
> R := RootDatum("A5" : Isogeny := 3);
> F := FundamentalGroup(R);
> G := IsogenyGroup(R);
> H := CoisogenyGroup(R);
> #G * #H eq #F;
true
```

Nonsemisimple root data have infinite isogeny groups.

```magma
> R := StandardRootDatum("A", 5);
> IsogenyGroup(R);
Abelian Group isomorphic to Z
Defined on 1 generator (free)
```

<a id="properties-root-datum"></a>
<a id="sectrdprop"></a>
### Properties of Root Data

<a id="function-isfinite-rootstr"></a>
#### `IsFinite(R): RootStr -> BoolElt`

Returns `true` for any root datum $R$.

<a id="function-isirreducible-rootstr"></a>
#### `IsIrreducible(R): RootStr -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is irreducible.

<a id="function-isabsolutelyirreducible-rootstr"></a>
#### `IsAbsolutelyIrreducible(R): RootStr -> BoolElt`

Returns `true` if, and only if, the split version of the root datum $R$ is irreducible.

<a id="function-isprojectivelyirreducible-rootstr"></a>
#### `IsProjectivelyIrreducible(R): RootStr -> BoolElt`

Returns `true` if, and only if, the quotient of the root datum $R$ modulo its radical is irreducible. This is equivalent for $R$ to have a connected Coxeter diagram.

<a id="function-isreduced-rootdtm"></a>
#### `IsReduced(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is reduced.

<a id="function-issemisimple-rootstr"></a>
#### `IsSemisimple(R): RootStr -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is semisimple, i.e. its rank is equal to its dimension.

<a id="function-iscrystallographic-rootstr"></a>
#### `IsCrystallographic(R): RootStr -> BoolElt`

Returns `true` for any root datum $R$.

<a id="function-issimplylaced-rootstr"></a>
#### `IsSimplyLaced(R): RootStr -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is simply laced, i.e. its Dynkin diagram contains no multiple bonds.

<a id="function-isadjointr"></a>
#### `IsAdjoint(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is adjoint, i.e. its isogeny group is trivial.

<a id="function-isweaklyadjoint-rootdtm"></a>
#### `IsWeaklyAdjoint(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is weakly adjoint, i.e. its isogeny group is isomorphic to ${\mathbb{Z}}^n$, where $n$ is $\dim(R) - {\rm rk}(R)$. Note that if $R$ is semisimple then this function is identical to [`IsAdjoint`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-isadjointr).

<a id="function-issimplyconnectedr"></a>
#### `IsSimplyConnected(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is simply connected, i.e. its isogeny group is equal to the fundamental group, i.e. its coisogeny group is trivial.

<a id="function-isweaklysimplyconnected-rootdtm"></a>
#### `IsWeaklySimplyConnected(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is weakly simply connected, i.e. its coisogeny group is isomorphic to ${\mathbb{Z}}^n$, where $n$ is $\dim(R) - {\rm rk}(R)$. Note that if $R$ is semisimple then this function is identical to [`IsSimplyConnected`](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#function-issimplyconnectedr).

<a id="example-ex-ece71b"></a>
#### `Example: Testing Properties of a Root Datum (ex-ece71b)`

```magma
> R := RootDatum("A5 B2" : Isogeny := "SC");
> IsIrreducible(R);
false
> IsSimplyLaced(R);
false
> IsSemisimple(R);
true
> IsAdjoint(R);
false
```

For some of the exceptional isogeny classes, there is only one isomorphism class of root data, which is both adjoint and simply connected.

```magma
> R := RootDatum("G2");
> IsAdjoint(R);
true
> IsSimplyConnected(R);
true
```

There exist root data that are neither adjoint nor simply connected.

```magma
> R := RootDatum("A3" : Isogeny := 2);
> IsAdjoint(R), IsSimplyConnected(R);
false false
```

Finally, we demonstrate a case where the root datum is not adjoint, but is weakly adjoint.

```magma
> R := RootDatum("A2T1");
> IsAdjoint(R), IsWeaklyAdjoint(R);
false true
> Dimension(R), Rank(R);
3 2
> G := IsogenyGroup(R); G;
Abelian Group isomorphic to Z
Defined on 1 generator (free)
```

<a id="function-isreduced-rootstr"></a>
#### `IsReduced(R): RootStr -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is reduced.

<a id="function-issplit-rootdtm"></a>
#### `IsSplit(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is split, i.e. the $\Gamma$-action is trivial.

<a id="function-istwisted-rootdtm"></a>
#### `IsTwisted(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is twisted, i.e. the $\Gamma$-action is not trivial.

<a id="function-isquasisplit-rootdtm"></a>
#### `IsQuasisplit(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is quasisplit, i.e. the anisotropic subdatum is trivial.

<a id="function-isinner-rootdtm"></a>
#### `IsInner(R): RootDtm -> BoolElt`

<a id="function-isouter-rootdtm"></a>
#### `IsOuter(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is inner (resp. outer).

<a id="function-isanisotropic-rootdtm"></a>
#### `IsAnisotropic(R): RootDtm -> BoolElt`

Returns `true` if, and only if, the root datum $R$ is anisotropic, i.e. when $X=X_0$.

<a id="roots-coroots-weights"></a>
<a id="sectrdroot"></a>
### Roots, Coroots, and Weights

The roots are stored as an indexed set

$$
\{@\; \alpha_1,\dots,\alpha_N,\alpha_{N+1},\dots,\alpha_{2N} \; @\},
$$

where $\alpha_1,\dots,\alpha_N$ are the positive roots in an order compatible with height; and $\alpha_{N+1},\dots,\alpha_{2N}$ are the corresponding negative roots (i.e. $\alpha_{i+N}=-\alpha_i$). The simple roots are $\alpha_1,\dots,\alpha_n$ where $n$ is the rank.

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space. This is the default.
2. `"Root"`: the basis of simple (co)roots.
3. `"Weight"`: the basis of fundamental (co)weights (see Subsection [Weights](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#subsectrdrootweight) below).

<a id="access"></a>
<a id="subsectrdrootaccess"></a>
#### Accessing Roots and Coroots

<a id="function-rootspace-rootstr"></a>
##### `RootSpace(R): RootStr -> ModTupFld`

<a id="function-corootspace-rootstr"></a>
##### `CorootSpace(R): RootStr -> ModTupFld`

The vector space containing the (co)roots of the root datum $R$, i.e. $X\otimes{\mathbb{Q}}$ (respectively, $Y\otimes{\mathbb{Q}}$).

<a id="function-fullrootlattice-rootdtm"></a>
##### `FullRootLattice(R): RootDtm -> Lat, Map`

<a id="function-fullcorootlattice-rootdtm"></a>
##### `FullCorootLattice(R): RootDtm -> Lat, Map`

The lattice containing the (co)roots of the root datum $R$, i.e. $X$ (respectively, $Y$). An inclusion map into the (co)root space of $R$ is returned as the second value.

<a id="function-rootlattice-rootdtm"></a>
##### `RootLattice(R): RootDtm -> Lat, Map`

<a id="function-corootlattice-rootdtm"></a>
##### `CorootLattice(R): RootDtm -> Lat, Map`

The lattice spanned by the (co)roots of the root datum $R$. An inclusion map into the (co)root space of $R$ is returned as the second value.

<a id="example-ex-f812ae"></a>
##### `Example: Root Space and Root Lattices (ex-f812ae)`

The root space, full root lattice, and the root lattice of the standard root datum of type $A_2$:

```magma
> R := StandardRootDatum("A",2);
> V := RootSpace(R);
> FullRootLattice(R);
Standard Lattice of rank 3 and degree 3
Mapping from: Standard Lattice of rank 3 and degree 3 to ModTupFld: V
> RootLattice(R);
Lattice of rank 2 and degree 3
Basis:
( 1 -1  0)
( 0  1 -1)
Mapping from: Lattice of rank 2 and degree 3 to ModTupFld: V
```

<a id="function-isrootspace-modtupfld"></a>
##### `IsRootSpace(V): ModTupFld -> BoolElt`

<a id="function-iscorootspace-modtupfld"></a>
##### `IsCorootSpace(V): ModTupFld -> BoolElt`

Return `true` if, and only if, $V$ is the (co)root space of some root datum.

<a id="function-isinrootspace-modtupfldelt"></a>
##### `IsInRootSpace(v): ModTupFldElt -> BoolElt`

<a id="function-iscorootspace-modtupfldelt"></a>
##### `IsCorootSpace(v): ModTupFldElt -> BoolElt`

Return `true` if, and only if, $V$ is an element of the (co)root space of some root datum.

<a id="function-rootdatum-modtupfld"></a>
##### `RootDatum(V): ModTupFld -> RootDtm`

If $V$ is the (co)root space of some root datum, this returns the datum.

<a id="example-ex-ddfc7e"></a>
##### `Example: Recognising a Root Space (ex-ddfc7e)`

```magma
> R := RootDatum("a3");
> V := RootSpace(R);
> v := V.1;
> IsRootSpace(V);
true
> RootDatum(V);
R: Adjoint root datum of dimension 3 of type A3
> IsInRootSpace(v);
true
```

<a id="function-zerorootlattice-rootdtm"></a>
##### `ZeroRootLattice(R): RootDtm -> Lat`

<a id="function-zerorootspace-rootdtm"></a>
##### `ZeroRootSpace(R): RootDtm -> ModTupFld, Map`

For the given root datum $R$, return the lattice $X_0$ and the vector space $X_0\otimes{\mathbb{Q}}$, respectively (see Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)).

<a id="function-relativerootspace-rootdtm"></a>
##### `RelativeRootSpace(R): RootDtm -> ModTupFld, Map`

For the given root datum $R$, return the vector space $\bar{X} = (X\otimes{\mathbb{Q}})/(X_0\otimes{\mathbb{Q}})$ containing the relative roots (see Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd)). The projection from $X\otimes{\mathbb{Q}}$ onto $\bar{X}$ is returned as second return value.

<a id="function-simpleroots-rootstr"></a>
##### `SimpleRoots(R): RootStr -> Mtrx`

<a id="function-simplecoroots-rootstr"></a>
##### `SimpleCoroots(R): RootStr -> Mtrx`

The simple (co)roots of the root datum $R$ as the rows of a matrix, i.e. $A$ (respectively, $B$).

<a id="example-ex-b96105"></a>
##### `Example: Spaces and Lattices of a G2 Root Datum (ex-b96105)`

```magma
> R := RootDatum("G2");
> RootSpace(R);
Full Vector space of degree 2 over Rational Field
> FullRootLattice(R);
Standard Lattice of rank 2 and degree 2
Mapping from: Standard Lattice of rank 2 and degree 2 to Full Vector space of
degree 2 over Rational Field
> RootLattice(R);
Standard Lattice of rank 2 and degree 2
Mapping from: Standard Lattice of rank 2 and degree 2 to Full Vector space of
degree 2 over Rational Field
> CorootSpace(R);
Full Vector space of degree 2 over Rational Field
> SimpleRoots(R);
[1 0]
[0 1]
> SimpleCoroots(R);
[ 2 -3]
[-1  2]
> CartanMatrix(R);
[ 2 -1]
[-3  2]
> Rank(R) eq Dimension(R);
true
```

<a id="function-numberofpositiveroots-rootstr"></a>
##### `NumberOfPositiveRoots(R): RootStr -> RngIntElt`

<a id="function-numposroots-rootstr"></a>
##### `NumPosRoots(R): RootStr -> RngIntElt`

The number of positive roots of the root datum $R$. This is also the number of positive coroots. The total number of (co)roots is twice the number of positive (co)roots.

<a id="function-roots-rootstr"></a>
##### `Roots(R): RootStr -> SetIndx`

<a id="function-coroots-rootstr"></a>
##### `Coroots(R): RootStr -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of (co)roots of the root datum $R$, i.e. $\{@\,\alpha_1,\dots\alpha_{2N}\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}$).

<a id="function-positiveroots-rootstr"></a>
##### `PositiveRoots(R): RootStr -> SetIndx`

<a id="function-positivecoroots-rootstr"></a>
##### `PositiveCoroots(R): RootStr -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of positive (co)roots of the root datum $R$, i.e. $\{@\,\alpha_1,\dots\alpha_N\,@\}$ (respectively, $\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}$).

<a id="function-root-rootstr-rngintelt"></a>
##### `Root(R, r): RootStr, RngIntElt -> SetIndx`

<a id="function-coroot-rootstr-rngintelt"></a>
##### `Coroot(R, r): RootStr, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root $\alpha_r$ (respectively, $\alpha_r^\star$) of the root datum $R$.

<a id="function-rootposition-rootstr"></a>
##### `RootPosition(R, v): RootStr, . -> SetIndx`

<a id="function-corootposition-rootstr"></a>
##### `CorootPosition(R, v): RootStr, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root in the root datum $R$, return its index; otherwise return 0. These functions will try to coerce $v$ into the appropriate lattice; $v$ should be written with respect to the basis specified by the parameter `Basis`.

<a id="function-basischange-rootstr-any"></a>
##### `BasisChange(R, v): RootStr, Any -> SeqEnum`

```magma
InBasis : MonStgElt                    Default: "Standard"
OutBasis: MonStgElt                    Default: "Standard"
Coroots : BoolElt                      Default: false
```

Changes the basis of the vector $v$ contained in the space spanned by the (co)roots of the root datum $R$. The vector $v$ is considered as an element of the root space by default. If the parameter `Coroots` is set to `true`, $v$ is considered as an element of the coroot space. The optional arguments `InBasis` and `OutBasis` may take the same values as the parameter `Basis` as described at the beginning of the current section.

<a id="example-ex-f22cf4"></a>
##### `Example: Roots and Coroots of a Root Datum (ex-f22cf4)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> Roots(R);
{@
    (1 0 0),
    (0 1 0),
    (1 0 2),
    (1 1 0),
    (1 1 2),
    (2 1 2),
    (-1  0  0),
    (0 -1  0),
    (-1  0 -2),
    (-1 -1  0),
    (-1 -1 -2),
    (-2 -1 -2)
@}
> PositiveCoroots(R);
{@
    (2 -1 -1),
    (-1  2  0),
    (0 -1  1),
    (1  1 -1),
    (-1  1  1),
    (1 0 0)
@}
> #Roots(R) eq 2*NumPosRoots(R);
true
> Coroot(R, 4);
(1  1 -1)
> Coroot(R, 4 : Basis := "Root");
(1 1 0)
> CorootPosition(R, [1,1,-1]);
4
> CorootPosition(R, [1,1,0] : Basis := "Root");
4
> BasisChange(R, [1,0,0] : InBasis:="Root");
(1 0 0)
> BasisChange(R, [1,0,0] : InBasis:="Root", Coroots);
( 2 -1 -1)
```

<a id="function-isinrootspace-rootdtm-modtupfldelt"></a>
##### `IsInRootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt`

<a id="function-isincorootspace-rootdtm-modtupfldelt"></a>
##### `IsInCorootSpace(R, v): RootDtm, ModTupFldElt -> BoolElt`

Returns `true` if and only if the vector $v$ is contained in the (co)root space of the root datum $R$.

<a id="function-highestroot-rootstr"></a>
##### `HighestRoot(R): RootStr -> .`

<a id="function-highestcoroot-rootstr"></a>
##### `HighestCoroot(R): RootStr -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique (co)root of greatest height in the irreducible root datum $R$.

<a id="function-highestlongroot-rootstr"></a>
##### `HighestLongRoot(R): RootStr -> .`

<a id="function-highestlongcoroot-rootstr"></a>
##### `HighestLongCoroot(R): RootStr -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique long (co)root of greatest height in the irreducible root datum $R$.

<a id="function-highestshortroot-rootstr"></a>
##### `HighestShortRoot(R): RootStr -> .`

<a id="function-highestshortcoroot-rootstr"></a>
##### `HighestShortCoroot(R): RootStr -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique short (co)root of greatest height in the irreducible root datum $R$.

<a id="example-ex-a8cbef"></a>
##### `Example: Highest Roots (ex-a8cbef)`

```magma
> R := RootDatum("G2");
> HighestRoot(R);
(3 2)
> HighestLongRoot(R);
(3 2)
> HighestShortRoot(R);
(2 1)
```

<a id="function-relativeroots-rootdtm"></a>
##### `RelativeRoots(R): RootDtm -> SetIndx`

<a id="function-positiverelativeroots-rootdtm"></a>
##### `PositiveRelativeRoots(R): RootDtm -> SetIndx`

<a id="function-negativerelativeroots-rootdtm"></a>
##### `NegativeRelativeRoots(R): RootDtm -> SetIndx`

<a id="function-simplerelativeroots-rootdtm"></a>
##### `SimpleRelativeRoots(R): RootDtm -> SetIndx`

The indexed set of all (resp. positive, negative, simple) relative roots of the root datum $R$. Note that the relative roots are returned in the order induced by the standard ordering on the (nonrelative) roots of $R$.

<a id="function-relativerootdatum-rootdtm"></a>
##### `RelativeRootDatum(R): RootDtm -> RootDtm`

The relative root datum of the root datum $R$.

<a id="function-gammaorbitsrepresentatives-rootdtm-rngintelt"></a>
##### `GammaOrbitsRepresentatives(R, delta): RootDtm, RngIntElt -> SeqEnum`

The preimage of a relative root $\delta$ is a disjoint union of $\Gamma$-orbits on the set of all roots of the root datum $R$. This intrinsic returns a sequence of representatives of these orbits.

<a id="example-ex-bec95e"></a>
##### `Example: Two Twisted Root Data of Type E6 (ex-bec95e)`

We first consider the twisted root datum of type ${}^2E_6$, which is quasisplit:

```magma
> DynkinDiagram(RootDatum("E6"));

E6    1 - 3 - 4 - 5 - 6
              |
              2
>
> R := RootDatum("E6" : Twist:=2 ); R;
R: Twisted adjoint root datum of type 2E6,4
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R) eq OrbitsOnSimples(R);
true
> AnisotropicSubdatum(R);
Twisted toral root datum of dimension 6
[]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type F4
> _,pi := RelativeRootSpace(R);
> DynkinDiagram(RR);

F4    1 - 2 =>= 4 - 3
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [1,6, 3,5, 4, 2]];
[ 3, 3, 4, 4, 2, 1 ]
```

now one with distinguished orbits $\{2\}$ and $\{4\}$:

```magma
> R := RootDatum("E6" : Twist := <{{2},{4}},2> ); R;
R: Twisted adjoint root datum of type 2E6,2
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 }
]
> AnisotropicSubdatum(R);
Twisted root datum of type 2(A2 A2)4,0
[ 1, 3, 5, 6, 7, 11, 37, 39, 41, 42, 43, 47 ]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type G2
> DynkinDiagram(RR);

G2    2 =<= 1
         3
> _,pi := RelativeRootSpace(R);
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [2,4]];
[ 1, 2 ]
```

and now the one with distinguished orbits $\{2\}$ and $\{1,6\}$, which has a non-reduced relative root datum:

```magma
> R := RootDatum("E6" : Twist := <{{2},{1,6}},2> ); R;
R: Twisted adjoint root datum of dimension 6 of type 2E6,2
> OrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 4 },
     GSet{ 1, 6 },
     GSet{ 3, 5 }
]
> DistinguishedOrbitsOnSimples(R);
[
     GSet{ 2 },
     GSet{ 1, 6 }
]
> AnisotropicSubdatum(R);
Twisted root datum of type 2A3,0
[ 3, 4, 5, 9, 10, 15, 39, 40, 41, 45, 46, 51 ]
> RR := RelativeRootDatum(R);RR;
RR: Adjoint root datum of type BC2
> DynkinDiagram(RR);

BC2    1 =>= 2
> _,pi := RelativeRootSpace(R);
> [ Position(Roots(RR), pi(Root(R,i)) ) : i in [2, 1,6]];
[ 1, 2, 2 ]
```

Finally, the twisted root Datum of type ${}^6D_{4,1}$:

```magma
> T := RootDatum( "D4" : Twist:=<{{2}},6> );
> T;
T: Twisted adjoint root datum of dimension 4 of type 6D4,1
> RelativeRootDatum(T);
Adjoint root datum of type BC1
> GammaOrbitsRepresentatives(T,1);
[ 11, 5 ]
> GammaOrbitsRepresentatives(T,2);
[ 12 ]
```

<a id="function-coxeterform-rootdtm"></a>
##### `CoxeterForm(R): RootDtm -> AlgMatElt`

<a id="function-dualcoxeterform-rootdtm"></a>
##### `DualCoxeterForm(R): RootDtm -> AlgMatElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix of an inner product on the (co)root space of the root datum $R$ which is invariant under the action of the (co)roots. The inner product is normalised so that the short roots in each irreducible component have length one.

<a id="rootrefl"></a>
<a id="subsectrdrootaction"></a>
#### Reflections

The root $\alpha$ acts on the root space via the reflection $s_\alpha$; the coroot $\alpha^\star$ acts on the coroot space via the coreflection $s_\alpha^\star$.

<a id="function-simplereflectionmatrices-rootdtm"></a>
##### `SimpleReflectionMatrices(R): RootDtm -> []`

<a id="function-simplecoreflectionmatrices-rootdtm"></a>
##### `SimpleCoreflectionMatrices(R): RootDtm -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of matrices giving the action of the simple (co)roots of the root datum $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_n}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_n}^\star$).

<a id="function-reflectionmatrices-rootdtm"></a>
##### `ReflectionMatrices(R): RootDtm -> []`

<a id="function-coreflectionmatrices-rootdtm"></a>
##### `CoreflectionMatrices(R): RootDtm -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of matrices giving the action of the (co)roots of the root datum $R$ on the (co)root space, i.e. the matrices of $s_{\alpha_1},\dots,s_{\alpha_{2N}}$ (respectively, $s_{\alpha_1}^\star,\dots,s_{\alpha_{2N}}^\star$).

<a id="function-reflectionmatrix-rootdtm-rngintelt"></a>
##### `ReflectionMatrix(R, r): RootDtm, RngIntElt -> []`

<a id="function-coreflectionmatrix-rootdtm-rngintelt"></a>
##### `CoreflectionMatrix(R, r): RootDtm, RngIntElt -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix giving the action of the $r$th (co)root of the root datum $R$ on the (co)root space, i.e. the matrix of $s_{\alpha_r}$ (respectively, $s_{\alpha_r}^\star$).

<a id="function-simplereflectionpermutations-rootdtm"></a>
##### `SimpleReflectionPermutations(R): RootDtm -> []`

The sequence of permutations giving the action of the simple (co)roots of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutations-rootdtm"></a>
##### `ReflectionPermutations(R): RootDtm -> []`

The sequence of permutations giving the action of the (co)roots of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutation-rootdtm-rngintelt"></a>
##### `ReflectionPermutation(R, r): RootDtm, RngIntElt -> []`

The permutation giving the action of the $r$th (co)root of the root datum $R$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionwords-rootdtm"></a>
##### `ReflectionWords(R): RootDtm -> []`

The sequence of words in the simple reflections for all the reflections of the root datum $R$. These words are given as sequences of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWords(R)[r]}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="function-reflectionword-rootdtm-rngintelt"></a>
##### `ReflectionWord(R, r): RootDtm, RngIntElt -> []`

The word in the simple reflections for the $r$th reflection of the root datum $R$. The word is given as a sequence of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWord(R,r)}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="example-ex-458120"></a>
##### `Example: Reflection Matrices, Permutations, and Words (ex-458120)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> mx := ReflectionMatrix(R, 4);
> perm := ReflectionPermutation(R, 4);
> wd := ReflectionWord(R, 4);
> RootPosition(R, Root(R,2) * mx) eq 2^perm;
true
> perm eq &*[ ReflectionPermutation(R, r) : r in wd ];
true
>
> mx := CoreflectionMatrix(R, 4);
> CorootPosition(R, Coroot(R,2) * mx) eq 2^perm;
true
```

<a id="ops-root-coroot"></a>
<a id="subsectrdrootop"></a>
#### Operations and Properties for Root and Coroot Indices

<a id="function-sum-rootdtm-rngintelt-rngintelt"></a>
##### `Sum(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The index of the sum of the $r$th and $s$th roots in the root datum $R$, or 0 if the sum is not a root. In other words, if $t = \hbox{\tt Sum(R,r,s)} \ne 0$ then $\alpha_t=\alpha_r+\alpha_s$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied.

<a id="function-ispositive-rootstr-rngintelt"></a>
##### `IsPositive(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the root datum $R$ is a positive root.

<a id="function-isnegative-rootstr-rngintelt"></a>
##### `IsNegative(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the root datum $R$ is a negative root.

<a id="function-negative-rootstr-rngintelt"></a>
##### `Negative(R, r): RootStr, RngIntElt -> RngIntElt`

The index of the negative of the $r$th (co)root of the root datum $R$. In other words, if $s = \hbox{\tt Negative(R,r)}$ then $\alpha_s=-\alpha_r$.

<a id="function-leftstring-rootdtm-rngintelt-rngintelt"></a>
##### `LeftString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

Indices in the root datum $R$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s-\alpha_r,\alpha_s-2\alpha_r,\dots,\alpha_s-p\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_p]$ where $\alpha_{r_i}=\alpha_s-i\alpha_r$ and $\alpha_s-(p+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied.

<a id="function-rightstring-rootdtm-rngintelt-rngintelt"></a>
##### `RightString(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

Indices in the root datum $R$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s+\alpha_r,\alpha_s+2\alpha_r,\dots,\alpha_s+q\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_q]$ where $\alpha_{r_i}=\alpha_s+i\alpha_r$ and $\alpha_s+(q+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied.

<a id="function-intrleftstringlength"></a>
##### `LeftStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The largest $p$ such that $\alpha_s-p\alpha_r$ is a root of the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-intrrightstringlength"></a>
##### `RightStringLength(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The largest $q$ such that $\alpha_s+q\alpha_r$ is a root of the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="example-ex-15650f"></a>
##### `Example: Arithmetic with Root Indices (ex-15650f)`

```magma
> R := RootDatum("G2");
> Sum(R, 1, Negative(R,5));
10
> IsPositive(R, 10);
false
> Negative(R, 10);
4
> P := PositiveRoots(R);
> P[1] - P[5] eq -P[4];
true
```

<a id="function-rootheight-rootstr-rngintelt"></a>
##### `RootHeight(R, r): RootStr, RngIntElt -> RngIntElt`

<a id="function-corootheight-rootstr-rngintelt"></a>
##### `CorootHeight(R, r): RootStr, RngIntElt -> RngIntElt`

The height of the $r$th (co)root of the root datum $R$, i.e. the sum of the coefficients of $\alpha_r$ (respectively, $\alpha_r^\star$) with respect to the simple (co)roots.

<a id="function-rootnorms-rootstr"></a>
##### `RootNorms(R): RootStr -> [RngIntElt]`

<a id="function-corootnorms-rootstr"></a>
##### `CorootNorms(R): RootStr -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the root datum $R$.

<a id="function-rootnorm-rootstr-rngintelt"></a>
##### `RootNorm(R, r): RootStr, RngIntElt -> RngIntElt`

<a id="function-corootnorm-rootstr-rngintelt"></a>
##### `CorootNorm(R, r): RootStr, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the root datum $R$.

<a id="function-islongroot-rootstr-rngintelt"></a>
##### `IsLongRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root datum $R$ is long. This only makes sense for irreducible crystallographic root data. Note that for non-reduced root data, the roots which are not indivisible, are actually longer than the long ones.

<a id="function-isshortroot-rootstr-rngintelt"></a>
##### `IsShortRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root datum $R$ is short. This only makes sense for irreducible crystallographic root data.

<a id="function-isindivisibleroot-rootstr-rngintelt"></a>
##### `IsIndivisibleRoot(R, r): RootStr, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the root system $R$ is indivisible.

<a id="example-ex-1c59aa"></a>
##### `Example: Heights, Norms, and Root Strings (ex-1c59aa)`

Note that the Coxeter form is defined over the rationals. Since it is not possible to multiply a lattice element by a rational matrix, (co)roots must be coerced into a rational vector space first.

```magma
> R := RootDatum("G2");
> RootHeight(R, 5);
4
> F := CoxeterForm(R);
> v := VectorSpace(Rationals(),2) ! Root(R, 5);
> (v*F, v) eq RootNorm(R, 5);
true
> IsLongRoot(R, 5);
true
> LeftString(R, 1, 5);
[ 4, 3, 2 ]
> roots := Roots(R);
> for i in [1..3] do
>   RootPosition(R, roots[5]-i*roots[1]);
> end for;
4
3
2
```

<a id="function-rootclosure-rootdtm-setenum-rngintelt"></a>
##### `RootClosure(R, S): RootDtm, SetEnum[RngIntElt] -> SetEnum[RngIntElt]`

The closure in the root datum $R$ of the set $S$ of root indices. That is the indices of every root that can be written as a sum of roots with indices in $S$.

<a id="function-additiveorder-rootstr"></a>
##### `AdditiveOrder(R): RootStr -> SeqEnum`

An additive order on the positive roots of the root datum $R$, i.e. a sequence containing the numbers $1,\dots,N$ in some order such that $\alpha_r+\alpha_s=\alpha_t$ implies $t$ is between $r$ and $s$. This is computed using the techniques of [[Pap94](https://docs.magma-maths.org/references.md#cite-papi)]

<a id="function-isadditiveorder-rootstr-rngintelt"></a>
##### `IsAdditiveOrder(R, Q): RootStr, [RngIntElt] -> BoolElt`

Returns `true` if, and only if, $Q$ gives an additive order on a set of positive roots of $R$. $Q$ must be a sequence of integers in the range $[1..N]$ with no gaps or repeats.

<a id="example-ex-24f6a0"></a>
##### `Example: Additive Order on Positive Roots (ex-24f6a0)`

```magma
> R := RootDatum("A5");
> a := AdditiveOrder(R);
> Position(a, 2);
6
> Position(a, 3);
10
> Position(a, Sum(R, 2, 3));
7
```

<a id="subsectrdrootweight"></a>
<a id="id2"></a>
#### Weights

<a id="function-weightlattice-rootdtm"></a>
##### `WeightLattice(R): RootDtm -> Lat`

The weight lattice $\Lambda$ of the root datum $R$. i.e. the $\lambda$ in ${\mathbb{Q}}\Phi\le{\mathbb{Q}}\otimes X$ such that $\langle\lambda,\alpha^\star\rangle\in{\mathbb{Z}}$ for every coroot $\alpha^\star$.

<a id="function-coweightlattice-rootdtm"></a>
##### `CoweightLattice(R): RootDtm -> Lat`

The coweight lattice $\Lambda^\star$ of the root datum $R$, i.e. the $\lambda^\star$ in ${\mathbb{Q}}\Phi^\star\le{\mathbb{Q}}\otimes Y$ such that $\langle\alpha,\lambda^\star\rangle\in{\mathbb{Z}}$ for every root $\alpha$.

<a id="function-fundamentalweights-rootdtm"></a>
##### `FundamentalWeights(R): RootDtm -> Mtrx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental weights $\lambda_1,\dots,\lambda_n$ of the root datum $R$ given as the rows of a matrix. This is the basis of the weight lattice $\Lambda$ dual to the simple coroots, i.e. $\langle\lambda_i,\alpha_j^\star\rangle=\delta_{ij}$.

<a id="function-fundamentalcoweights-rootdtm"></a>
##### `FundamentalCoweights(R): RootDtm -> Mtrx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental coweights $\lambda_1^\star,\dots,\lambda_n^\star$ of the root datum $R$ given as the rows of a matrix. This is the basis of the coweight lattice $\Lambda^\star$ dual to the simple roots, i.e. $\langle\alpha_i,\lambda_j^\star\rangle=\delta_{ij}$.

<a id="example-ex-28403f"></a>
##### `Example: Weight Lattice of a Root Datum (ex-28403f)`

```magma
> R := RootDatum("E6");
> WeightLattice(R);
Lattice of rank 6 and degree 6
Basis:
(4  3  5  6  4  2)
(3  6  6  9  6  3)
(5  6 10 12  8  4)
(6  9 12 18 12  6)
(4  6  8 12 10  5)
(2  3  4  6  5  4)
Basis Denominator: 3
> FundamentalWeights(R);
[ 4/3    1  5/3    2  4/3  2/3]
[   1    2    2    3    2    1]
[ 5/3    2 10/3    4  8/3  4/3]
[   2    3    4    6    4    2]
[ 4/3    2  8/3    4 10/3  5/3]
[ 2/3    1  4/3    2  5/3  4/3]
```

<a id="function-isdominant-rootdtm"></a>
##### `IsDominant(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

Returns `true` if, and only if, $v$ is a dominant weight for the root datum $R$, ie, a nonnegative integral linear combination of the fundamental weights.

<a id="function-dominantweight-rootdtm"></a>
##### `DominantWeight(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique dominant weight in the same $W$-orbit as the weight $v$, where $W$ is the Weyl group of the root datum $R$. The second value returned is a Weyl group element taking $v$ to the dominant weight. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

<a id="function-weightorbit-rootdtm"></a>
##### `WeightOrbit(R, v): RootDtm, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $W$-orbit of the weight $v$ as an indexed set, where $W$ is the Weyl group of the root datum $R$. The first element in the orbit is always dominant. The second value returned is a sequence of Weyl group elements taking the weight to the corresponding element of the orbit. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

<a id="example-ex-4bce9a"></a>
##### `Example: Dominant Weights and Weight Orbits (ex-4bce9a)`

```magma
> R := RootDatum("B3");
> DominantWeight(R, [1,-1,0] : Basis:="Weight");
(1 0 0)
[ 2, 3, 2, 1 ]
> #WeightOrbit(R, [1,-1,0] : Basis:="Weight");
6
```

<a id="create-new-root-datum"></a>
<a id="sectrdsub"></a>
### Building Root Data

<a id="constructor-constructor-sub-rootdtm-setenum-rootdtm"></a>
#### `sub<R | a>: RootDtm, SetEnum -> RootDtm`

The root subdatum of the root datum $R$ generated by the roots $\alpha_{a_1},\dots,\alpha_{a_k}$ where $a=\{a_1,\dots,a_k\}$ is a set of integers.

<a id="constructor-constructor-sub-rootdtm-setenum-rootdtm-2"></a>
#### `sub<R | s>: RootDtm, SetEnum -> RootDtm`

The root subdatum of the root datum $R$ generated by the roots $\alpha_{s_1},\dots,\alpha_{s_k}$ where $s=[s_1,\dots,s_k]$ is a *sequence* of integers. In this version the roots must be simple in the root subdatum (i.e. none of them may be a summand of another) otherwise an error is signalled. The simple roots will appear in the subdatum in the given order.

<a id="example-ex-dc9697"></a>
#### `Example: Root Subdata (ex-dc9697)`

```magma
> R := RootDatum("A4");
> PositiveRoots(R);
{@
    (1 0 0 0),
    (0 1 0 0),
    (0 0 1 0),
    (0 0 0 1),
    (1 1 0 0),
    (0 1 1 0),
    (0 0 1 1),
    (1 1 1 0),
    (0 1 1 1),
    (1 1 1 1)
@}
> s := sub< R | [6,1,4] >;
> s;
Root datum of type A3
> PositiveRoots(s);
{@
    (0 1 1 0),
    (1 0 0 0),
    (0 0 0 1),
    (1 1 1 0),
    (0 1 1 1),
    (1 1 1 1)
@}
> s := sub< R | [1,5] >;
Error: The given roots are not simple in a subdatum
> s := sub< R | {1,5} >;
> s;
Root datum of type A2
> PositiveRoots(s);
{@
    (1 0 0 0),
    (0 1 0 0),
    (1 1 0 0)
@}
```

<a id="operation-op-subset-rootdtm-rootdtm"></a>
#### `R1 subset R2: RootDtm, RootDtm -> BoolElt, .`

Returns `true` if and only if the root datum $R_1$ is a subset of the root datum $R_2$. If true, returns an injection as sequence of roots as second return value.

<a id="operation-op-plus-rootdtm-rootdtm"></a>
#### `R1 + R2: RootDtm, RootDtm -> RootDtm`

<a id="function-directsum-rootdtm-rootdtm"></a>
#### `DirectSum(R1, R2): RootDtm, RootDtm -> RootDtm`

The external direct sum of the root data $R_1$ and $R_2$. The full (co)root space of the result is the direct sum of the full (co)root spaces of $R_1$ and $R_2$.

<a id="operation-op-join-rootdtm-rootdtm"></a>
#### `R1 join R2: RootDtm, RootDtm -> RootDtm`

The internal direct sum of the root data $R_1$ and $R_2$. The root data must have the same full (co)root space, which will also be the full (co)root space of the result. The root data must have disjoint (co)root spaces.

<a id="example-ex-67182b"></a>
#### `Example: Sums of Root Data (ex-67182b)`

```magma
> R  := RootDatum("A1A1");
> R1 := sub<R|[1]>;
> R2 := sub<R|[2]>;
> R1 + R2;
Root datum of dimension 4 of type A1 A1
> R1 join R2;
R: Adjoint root datum of dimension 2 of type A1 A1
```

<a id="function-directsumdecomposition-rootdtm"></a>
#### `DirectSumDecomposition(R): RootDtm -> [], RootDtm, Map`

<a id="function-indecomposablesummands-rootdtm"></a>
#### `IndecomposableSummands(R): RootDtm -> [], RootDtm, Map`

Returns a sequence $Q$ of irreducible root data, a root datum $S$ which is the direct sum of the terms of $Q$, and an isogeny map $\phi:S\to R$. The root datum $R$ must be semisimple. Note that a semisimple root datum $R$ need not be a direct sum of simple root data, but it is isogenous to a direct sum of root data $S$.

<a id="example-ex-7e44ad"></a>
#### `Example: Decomposing a Root Datum (ex-7e44ad)`

If the root datum in adjoint or simply connected, then it is a direct sum of simples. In this case we get $S=R$.

```magma
> R := RootDatum("A4B5" : Isogeny:="SC");
> Q, S := DirectSumDecomposition( R );
> R eq S;
true
> R eq Q[1] join Q[2];
true
```

The join of the summands of the direct sum decomposition is the original root datum again:

```magma
> R eq &join DirectSumDecomposition(R);
true
> R eq &+    DirectSumDecomposition(R);
false
```

```magma
> R1 := RootDatum("A3T2B4T3");
> R2 := RootDatum("T3G2T4BC3");
> R1 + R2;
Adjoint root datum of dimension 24 of type A3 B4 G2 BC3
> R1 join R2;
Root datum of dimension 12 of type A3 B4 G2 BC3
```

Here is an example of a semisimple root datum which is not a direct sum of simple subdata. Note that a simple root datum of type $A_1$ is either simply connected or adjoint.

```magma
> G<a,b>:=FundamentalGroup("A1A1");
> _,inj:=sub<G|a*b>;
> R:=RootDatum("A1A1":Isogeny:=inj);
> ad := RootDatum( "A1" : Isogeny:="Ad" );
> sc := RootDatum( "A1" : Isogeny:="SC" );
> IsIsomorphic( R, DirectSum(ad,ad) );
false
> IsIsomorphic( R, DirectSum(ad,sc) );
false
> IsIsomorphic( R, DirectSum(sc,sc) );
false
> Q, S := DirectSumDecomposition( R );
> R eq S;
false
```

<a id="function-dual-rootdtm"></a>
#### `Dual(R): RootDtm -> RootDtm, Map`

The dual of the root datum $R$, obtained by swapping the roots and coroots. The second value returned is the dual morphism from $R$ to its dual.

<a id="function-simplyconnectedversion-rootdtm"></a>
#### `SimplyConnectedVersion(R): RootDtm -> RootDtm, Map`

The simply connected version of the root datum $R$. If $R$ is semisimple then the injection of the simply connected version into $R$ is returned as the second value.

<a id="function-adjointversion-rootdtm"></a>
#### `AdjointVersion(R): RootDtm -> RootDtm, Map`

The adjoint version of the root datum $R$. If $R$ is semisimple then the projection from $R$ to its adjoint version is returned as the second value.

<a id="function-indivisiblesubdatum-rootdtm"></a>
#### `IndivisibleSubdatum(R): RootDtm -> RootDtm`

The root datum consisting of all indivisible roots of the root datum $R$.

<a id="function-radical-rootdtm"></a>
#### `Radical(R): RootDtm -> RootDtm`

The radical of the root datum $R$, ie, the toral subdatum whose root (resp. coroot) space consists of the vectors perpendicular to every coroot (resp. root).

<a id="example-ex-187258"></a>
#### `Example: Direct Sums, Duals, and Radicals (ex-187258)`

An adjoint or simply connected root datum is always a direct sum of irreducible subdata. In these cases we take $S=R$.

```magma
> R1 := RootDatum("A5");
> R2 := RootDatum("B4");
> R := DirectSum(R1, Dual(R2));
> DirectSumDecomposition(R);
{
    Root datum of type A5 ,
    Root datum of type C4
}
```

```magma
> R := RootDatum("BC2");
> I := IndivisibleSubdatum(R); I;
I: Root datum of type B2
> I subset R;
true [ 1, 2, 3, 5, 7, 8, 9, 11 ]
```

```magma
> R := StandardRootDatum("A", 3);
> Radical(R);
Toral root datum of dimension 1
```

<a id="function-twistedrootdatum-rootdtm"></a>
#### `TwistedRootDatum(R): RootDtm -> RootDtm`

<a id="function-twistedrootdatum-monstgelt"></a>
#### `TwistedRootDatum(N): MonStgElt -> RootDtm`

```magma
Twist: Any                    Default: 1
```

Create a twisted root datum from the root datum $R$, or from the semisimple root datum with Cartan name $N$. The twist may be specified in any of the following ways:

- An integer, specifying the order of the twist;
- A permutation, specifying the action of the primitive roots;
- A pair $<D, i>$, where $D$ is a set of distinguished orbits as sets of integers, and $i$ is the order of the Dynkin diagram symmetry;
- A pair $<\Gamma, Q>$, where $\Gamma$ is the acting group, and $Q$ is a sequence containing the permutation of the primitive roots for each of the generators of $\Gamma$;
- A homomorphism from $\Gamma$ to the symmetric group whose order is the number of roots of $R$, describing how the acting group $\Gamma$ acts on the roots.

<a id="example-ex-4dc407"></a>
#### `Example: Constructing Twisted Root Data (ex-4dc407)`

We construct a twisted root datum in a number of ways.

```magma
> S := TwistedRootDatum("D4" : Twist := 3);
> S;
S: Twisted adjoint root datum of dimension 4 of type 3D4,2

> R := RootDatum("A1A3");
> DynkinDiagram(R);

A1    1

A3    2 - 3 - 4
> S := TwistedRootDatum(R : Twist := Sym(4)!(2,4));
> S;
S: Twisted adjoint root datum of dimension 4 of type 2(A1 A3)4,3

> S := TwistedRootDatum("A4" : Twist := <{{1,4},{2,3}}, 2>);
> S;
S: Twisted adjoint root datum of dimension 4 of type 2A4,2

> R := RootDatum("E6" : Isogeny := "SC");
> DynkinDiagram(R);

E6    1 - 3 - 4 - 5 - 6
              |
              2
> S := TwistedRootDatum(R : Twist := <Sym(2) ,[ Sym(6)!(1,6)(3,5) ]>);
> S;
S: Twisted simply connected root datum of dimension 6 of type 2E6,4

> R := RootDatum("D4");
> DynkinDiagram(R);

D4    3
     /
1 - 2
     \\
      4
> Gamma := Sym(3);
> Gamma.1, Gamma.2;
(1, 2, 3)
(1, 2)
> S := TwistedRootDatum(R : Twist := <Gamma, [ Sym(4) | (1,3,4), (1,4) ]>);
> S;
S: Twisted adjoint root datum of dimension 4 of type 6D4,2

> R := RootDatum("A2");
> DynkinDiagram(R);

A2    1 - 2
> Roots(R);
{@
    (1 0),
    (0 1),
    (1 1),
    (-1  0),
    ( 0 -1),
    (-1 -1)
@}
> S6 := Sym(#Roots(R));
> phi := hom<Sym(2) -> S6 | S6!(1,2)(4,5)>;
> S := TwistedRootDatum(R : Twist := phi);
```

<a id="function-untwistedrootdatum-rootdtm"></a>
#### `UntwistedRootDatum(R): RootDtm -> RootDtm`

<a id="function-splitrootdatum-rootdtm"></a>
#### `SplitRootDatum(R): RootDtm -> RootDtm`

The split version of the (twisted) root datum $R$.

<a id="morphisms-root-datum"></a>
<a id="sectrdmorphism"></a>
### Morphisms of Root Data

Morphisms are currently only defined for split root data. Let $R_i=(X_i,\Phi_i,Y_i,\Phi_i^\star)$ be a root datum for $i=1,2$. A *morphism* of root data $\phi:R_1\to R_2$ consists of a pair of ${\mathbb{Z}}$-linear maps $\phi_X:X_1\to X_2$ and $\Phi_Y:Y_1\to Y_2$ satisfying

1. $\phi_X(\Phi_1)\subseteq\Phi_2\cup\{0\}$; and
2. $\phi_Y(\alpha^\star)=\phi_X(\alpha)^\star$ (with the convention that $0^\star=0$).

A *fractional morphism* is similar, except that it consists of ${\mathbb{Q}}$-linear maps on the (co)root spaces $X_1\otimes{\mathbb{Q}}\to X_2\otimes{\mathbb{Q}}$ and $Y_1\otimes{\mathbb{Q}}\to Y_2\otimes{\mathbb{Q}}$. The main examples of fractional morphisms are isogeny maps (Section [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). A *dual morphism* is similar, except that the maps are $X_1\to Y_2$ and $Y_1\to X_2$. This is clearly equivalent to a morphism from $R_1$ to the dual of $R_2$. Finally we define a *dual fractional morphism* in the obvious way.

A (fractional) morphism $\phi:R_1\to R_2$ also stores a sign corresponding to each simple root of $R_1$. This has no effect on the action of $\phi$ on roots or coroots, but does effect the definition of the corresponding homomorphisms of Lie algebras and groups of Lie type.

<a id="constructor-constructor-hom-rootdtm-rootdtm-map-map-map"></a>
#### `hom<R -\>S | phiX, phiY>: RootDtm, RootDtm, Map, Map -> Map`

<a id="constructor-constructor-hom-rootdtm-rootdtm-mtrx-mtrx-map"></a>
#### `hom<R -\>S | phiX, phiY>: RootDtm, RootDtm, Mtrx, Mtrx -> Map`

Construct a (fractional) morphism $\phi : R\to S$ of root data with the given linear maps or matrices `phiX` and `phiY` for the action of $\phi$ on $X_1$ and $Y_1$.

<a id="constructor-constructor-hom-rootdtm-rootdtm-rngintelt-map"></a>
#### `hom<R -\>S | Q>: RootDtm, RootDtm, [RngIntElt] -> Map`

Construct a (fractional) morphism of root data $R\to S$ with the given sequence of root images. The sequence $Q$ must have length $2N$ and consist of elements in the range $[0,\dots,2M]$, where $N$ is the number of positive roots of $R$ and $M$ is the number of positive roots of $S$. The domain $R$ must be semisimple.

<a id="function-morphism-rootdtm-rootdtm-map-map"></a>
#### `Morphism(R, S, phiX, phiY): RootDtm, RootDtm, Map, Map -> Map`

<a id="function-morphism-rootdtm-rootdtm-mtrx-mtrx"></a>
#### `Morphism(R, S, phiX, phiY): RootDtm, RootDtm, Mtrx, Mtrx -> Map`

```magma
Check: BoolElt                    Default: true
```

Construct a (fractional) morphism $\phi : R\to S$ of root data with the given linear maps or matrices `phiX` and `phiY` for the action of $\phi$ on $X_1$ and $Y_1$. The domain $R$ must be semisimple.

If `Check` is set to `false`, the function does not check that the maps send (co)roots to (co)roots. This function is the same as the constructor `hom`, except for the optional parameter.

<a id="function-morphism-rootdtm-rootdtm-rngintelt"></a>
#### `Morphism(R, S, Q): RootDtm, RootDtm, [RngIntElt] -> Map`

```magma
Check: BoolElt                    Default: true
```

Construct a (fractional) morphism of root data $R\to S$ with the given sequence of root images. The sequence $Q$ must have length $2N$ and consist of elements in the range $[0,\dots,2M]$, where $N$ is the number of positive roots of $R$ and $M$ is the number of positive roots of $S$. The domain $R$ must be semisimple.

If `Check` is set to `false`, the function does not check that the maps send (co)roots to (co)roots. This function is the same as the constructor `hom`, except for the optional parameter.

<a id="function-dualmorphism-rootdtm-rootdtm-map-map"></a>
#### `DualMorphism(R, S, phiX, phiY): RootDtm, RootDtm, Map, Map -> Map`

<a id="function-dualmorphism-rootdtm-rootdtm-mtrx-mtrx"></a>
#### `DualMorphism(R, S, phiX, phiY): RootDtm, RootDtm, Mtrx, Mtrx -> Map`

```magma
Check: BoolElt                    Default: true
```

Construct a (fractional) dual morphism of root data $R\to S$ with the given linear maps or matrices of linear maps. If `Check` is set to `false`, the function does not check that the maps send (co)roots to (co)roots.

<a id="function-dualmorphism-rootdtm-rootdtm-rngintelt"></a>
#### `DualMorphism(R, S, Q): RootDtm, RootDtm, [RngIntElt] -> Map`

```magma
Check: BoolElt                    Default: true
```

Construct a (fractional) dual morphism of root data $R\to S$ with the given sequence of root images. The sequence $Q$ must have length $2N$ and consist of elements in the range $[0,\dots,2M]$, where $N$ is the number of positive roots of $R$ and $M$ is the number of positive roots of $S$. The domain $R$ must be semisimple. If `Check` is set to `false`, the function does not check that the maps send (co)roots to (co)roots.

<a id="function-rootimages-map"></a>
#### `RootImages(phi): Map -> [RngIntElt]`

The indices of the root images of the (dual) (fractional) morphism $\phi$.

<a id="function-rootpermutation-map"></a>
#### `RootPermutation(phi): Map -> GrpPermElt`

The indices of the root images of the automorphism $\phi$.

<a id="function-identitymap-rootdtm"></a>
#### `IdentityMap(R): RootDtm -> Map`

<a id="function-identityautomorphism-rootdtm"></a>
#### `IdentityAutomorphism(R): RootDtm -> Map`

The identity morphism $R\to R$.

<a id="example-ex-b874c1"></a>
#### `Example: Creating Root Data Homomorphisms (ex-b874c1)`

We construct the fractional morphism from the standard root datum of type $A_3$ onto the adjoint root datum of type $A_3$. This will allow us to construct the algebraic projection ${GL}_4\to{PGL}_4$ in Section [Algebraic Homomorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/homomorphism.md#sectgrpliehom).

```magma
> RGL := StandardRootDatum( "A", 3 );
> RPGL := RootDatum( "A3" );
> A := VerticalJoin( SimpleRoots(RGL), Vector([Rationals()|1,1,1,1]) )^-1 *
>   VerticalJoin( SimpleRoots(RPGL), Vector([Rationals()|0,0,0]) );
> B := VerticalJoin( SimpleCoroots(RGL), Vector([Rationals()|1,1,1,1]) )^-1 *
>   VerticalJoin( SimpleCoroots(RPGL), Vector([Rationals()|0,0,0]) );
> phi := hom< RGL -> RPGL | A, B >;
> v := Coroot(RGL,1);
> v; phi(v);
( 1 -1  0  0)
( 2 -1  0 )
```

<a id="constants-root-datum"></a>
<a id="sectrdconst"></a>
### Constants Associated with Root Data

In this section functions for a number of constants associated with root data will be described. These constants are needed to define Lie algebras and groups of Lie type. The notation of [[Car72b](https://docs.magma-maths.org/references.md#cite-carter-small)] will be used, except that the constants are defined for right actions rather than left actions [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="function-extraspecialpairs-rootdtm"></a>
#### `ExtraspecialPairs(R): RootDtm -> SeqEnum`

The sequence of extraspecial pairs of the root datum $R$ (see [[Car72b](https://docs.magma-maths.org/references.md#cite-carter-small), page 58]). That is the sequence $[(r_i,s_i)]_{i=1}^{N-n}$ where $r_i$ is minimal such that $\alpha_{r_i}+\alpha_{s_i}=\alpha_{i+n}$ ($n$ is the rank of $R$ and $N$ is the number of positive roots).

<a id="function-numextraspecialpairs-rootdtm"></a>
#### `NumExtraspecialPairs(R): RootDtm -> SeqEnum`

The number of extraspecial pairs of the root datum $R$. This function doesn’t actually compute the extraspecial pairs, thus is much more efficient than calling `#ExtraspecialPairs(R)` in case extraspecial pairs are not yet computed.

<a id="function-extraspecialpair-rootdtm-rngintelt"></a>
#### `ExtraspecialPair(R, r): RootDtm, RngIntElt -> SeqEnum`

The extraspecial pair of the $r$th root in the root datum $R$. That is the pair $(s,t)$ where $s$ is minimal such that $\alpha_{s}+\alpha_{t}=\alpha_{r}$.

<a id="function-extraspecialsigns-rootdtm"></a>
#### `ExtraspecialSigns(R): RootDtm -> []`

Return the sequence of extraspecial signs of the root datum $R$.

<a id="function-lieconstant-p-rootdtm-rngintelt-rngintelt"></a>
#### `LieConstant_p(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The constant $p_{rs}$ for the root datum $R$, i.e. the largest $p$ such that $\alpha_s-p\alpha_r$ is a root. This is the same as [`LeftStringLength`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-intrleftstringlength). The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-lieconstant-q-rootdtm-rngintelt-rngintelt"></a>
#### `LieConstant_q(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The constant $q_{rs}$ for the root datum $R$, i.e. the largest $q$ such that $\alpha_s+q\alpha_r$ is a root. This is the same as [`RightStringLength`](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#function-intrrightstringlength). The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-cartaninteger-rootdtm-rngintelt-rngintelt"></a>
#### `CartanInteger(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The Cartan integer $\langle\alpha_r,\alpha_s^\star\rangle$ for the root datum $R$.

<a id="function-lieconstant-n-rootdtm-rngintelt-rngintelt"></a>
#### `LieConstant_N(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The Lie algebra structure constant $N_{rs}$ for the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-lieconstant-epsilon-rootdtm-rngintelt-rngintelt"></a>
#### `LieConstant_epsilon(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The constant $\epsilon_{rs}= \hbox{Sign}(N_{rs})$ for the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-lieconstant-m-rootdtm-rngintelt-rngintelt-rngintelt"></a>
#### `LieConstant_M(R, r, s, i): RootDtm, RngIntElt, RngIntElt, RngIntElt -> RngIntElt`

The constant $M_{rsi}={1\over{i!}}N_{s_0r}\cdots N_{s_{i-1}r}$ where $\alpha_{s_i} = i\alpha_r+\alpha_s$ for the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-lieconstant-c-rootdtm-rngintelt-rngintelt-rngintelt-rngintelt"></a>
#### `LieConstant_C(R, i, j, r, s): RootDtm, RngIntElt, RngIntElt, RngIntElt, RngIntElt -> RngIntElt`

The Lie group structure constant $C_{ijrs}$ for the root datum $R$. The conditions $\alpha_s\ne\pm\alpha_r$ and $\alpha_r+\alpha_s\in\Phi$ must be satisfied.

<a id="function-lieconstant-eta-rootdtm-rngintelt-rngintelt"></a>
#### `LieConstant_eta(R, r, s): RootDtm, RngIntElt, RngIntElt -> RngIntElt`

The constant

$$
\eta_{rs}= (-1)^{p_{rs}} {\epsilon_{r,s-pr}\cdots \epsilon_{r,s-r}\over
     \epsilon_{r,s-pr}\cdots \epsilon_{r,s+(q-p-1)r}}
$$

for the root datum $R$. The condition $\alpha_s\ne\pm\alpha_r$ must be satisfied.

<a id="function-structureconstants-rootdtm"></a>
#### `StructureConstants(R): RootDtm -> RngIntElt`

The Lie algebra structure constants for the reductive Lie algebra with root datum $R$ in the sparse format described in Section [Constructors for Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#sectalglieconstr).

<a id="example-ex-6b2ee2"></a>
#### `Example: Verifying Root Datum Constants (ex-6b2ee2)`

The code below verifies some standard formulas in the root datum of type $F_4$:

```magma
> R := RootDatum("F4");
> N := NumPosRoots(R);
> r := Random([1..N]);
> s := Random([1..r-1] cat [r+1..r+N-1] cat [r+N+1..2*N]);
```

1. Agreement of the Cartan matrix with the Cartan integers.

```magma
> C := CartanMatrix(R);
> C[2,3] eq CartanInteger(R,2,3);
true
```

2. $p_{rs}$ is the length of the left string through $\alpha_s$ in the direction of $\alpha_r$.

```magma
> LieConstant_p(R,r,s) eq #LeftString(R,r,s);
true
```

3. $q_{rs}$ is the length of the right string through $\alpha_s$ in the direction of $\alpha_r$.

```magma
> LieConstant_q(R,r,s) eq #RightString(R,r,s);
true
```

4. $\langle\alpha_s,\alpha_r^\star\rangle=p_{rs}-q_{rs}$.

```magma
> CartanInteger(R,s,r) eq
> LieConstant_p(R,r,s) - LieConstant_q(R,r,s);
true
```

5. $N_{rs} = \epsilon_{rs}(p_{rs}+1)$.

```magma
> LieConstant_N(R,r,s) eq
> LieConstant_epsilon(R,r,s) * (LieConstant_p(R,r,s) + 1);
true
```

<a id="sectrdrel"></a>
<a id="id1"></a>
### Related Structures

In this section functions for creating other structures from a root datum are briefly listed. See the appropriate chapters of the Handbook for more details.

<a id="function-rootsystem-rootdtm"></a>
#### `RootSystem(R): RootDtm -> RootSys`

The root system corresponding to the root datum $R$. See Chapter [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys).

<a id="function-coxetergroup-cat-rootdtm"></a>
#### `CoxeterGroup(grpcat, R): Cat, RootDtm -> grpcat`

The Coxeter group (of type `grpcat`) of a root datum $R$. There are variations of this signature. The first argument can be `GrpMat`, `GrpPermCox`, `GrpPerm`, `GrpFPCox` or `GrpFP` and the second argument can be a root system or root datum. (See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox).) If the first argument is `GrpFPCox` the braid group and pure braid group can be computed from the Coxeter group using the commands in Section [Braid Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md#sectgrpcoxbraid).

<a id="function-coxetergroup-rootdtm"></a>
#### `CoxeterGroup(R): RootDtm -> GrpPermCox`

<a id="function-weylgroup-rootdtm"></a>
#### `WeylGroup(R): RootDtm -> GrpPermCox`

The permutation Coxeter group with root datum $R$. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox).

<a id="function-coxetergroup-cat-rootdtm-2"></a>
#### `CoxeterGroup(GrpPermCox, R): Cat, RootDtm -> GrpPermCox`

<a id="function-reflectiongroup-rootdtm"></a>
#### `ReflectionGroup(R): RootDtm -> GrpMat`

The reflection group of the root datum $R$. See Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-liealgebrahomorphism-map-rng"></a>
#### `LieAlgebraHomorphism(phi, k): Map, Rng -> AlgLie`

The homomorphism of reductive Lie algebras over the ring $k$ corresponding to the root datum morphism $\phi$. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="function-liealgebra-rootdtm-rng"></a>
#### `LieAlgebra(R, k): RootDtm, Rng -> AlgLie`

The reductive Lie algebra over the ring $k$ with root datum $R$. See Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie).

<a id="function-groupoflietype-rootdtm-rng"></a>
#### `GroupOfLieType(R, k): RootDtm, Rng -> GrpLie`

The group of Lie type over the ring $k$ with root datum $R$. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="function-groupoflietypehomomorphism-map-rng"></a>
#### `GroupOfLieTypeHomomorphism(phi, k): Map, Rng -> GrpLie`

The algebraic homomorphism of groups of Lie type over the ring $k$ corresponding to the root datum morphism $\phi$. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="example-ex-174972"></a>
#### `Example: Structures Related to a Root Datum (ex-174972)`

```magma
> R := RootDatum("b3");
> SemisimpleType(LieAlgebra(R, Rationals()));
B3
> #CoxeterGroup(R);
48
> GroupOfLieType(R, Rationals());
$: Group of Lie type B3 over Rational Field
```

<a id="chapgrpfpcox"></a>
<a id="chapgrppermcox"></a>
<a id="chapgrpcox"></a>
<a id="id1"></a>
## Coxeter Groups

- [Introduction](https://docs.magma-maths.org/LieTheory/CoxeterGroups/introduction.md)
  - [The Normal Form for Words](https://docs.magma-maths.org/LieTheory/CoxeterGroups/introduction.md#the-normal-form-for-words)
- [Constructing Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md)
  - [`CoxeterGroup(grpcat, N): Cat, MonStgElt → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-monstgelt)
  - [`CoxeterGroup(N): MonStgElt → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-monstgelt)
  - [`IrreducibleCoxeterGroup(grpcat, X, n): Cat, MonStgElt, RngIntElt → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-irreduciblecoxetergroup-cat-monstgelt-rngintelt)
  - [`IrreducibleCoxeterGroup(X, n): MonStgElt, RngIntElt → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-irreduciblecoxetergroup-monstgelt-rngintelt)
  - [Example: Constructing a Coxeter Group by Name](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#example-ex-fcfb78)
  - [`CoxeterGroup(grpcat, M): Cat, AlgMatElt → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-algmatelt)
  - [`CoxeterGroup(grpcat, G): Cat, GrphUnd → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-grphund)
  - [`CoxeterGroup(grpcat, D): Cat, GrphDir → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-grphdir)
  - [`CoxeterGroup(M): AlgMatElt → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-algmatelt)
  - [`CoxeterGroup(G): GrphUnd → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-grphund)
  - [`CoxeterGroup(D): GrphDir → Grp`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-grphdir)
  - [Example: Coxeter Group from a Coxeter Matrix](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#example-ex-2b7d19)
  - [`CoxeterGroup(grpcat, R): Cat, RootStr → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-rootstr)
  - [`CoxeterGroup(R): RootStr → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-rootstr)
  - [`CoxeterGroup(A, B): Mtrx, Mtrx → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-mtrx-mtrx)
  - [`CoxeterGroup(grpcat, A, B): Cat, Mtrx, Mtrx → grpcat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#function-coxetergroup-cat-mtrx-mtrx)
  - [Example: Coxeter Group from a Root Datum](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct.md#example-ex-af5154)
- [Converting Between Types of Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md)
  - [`CoxeterGroup(grpcat, W): Cat, Grp → grpcat, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#function-coxetergroup-cat-grp)
  - [Example: Converting to a Permutation Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#example-ex-bd0d74)
  - [`ReflectionGroup(W): GrpFPCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#function-reflectiongroup-grpfpcox)
  - [`ReflectionGroup(W): GrpPermCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#function-reflectiongroup-grppermcox)
  - [Example: Converting to a Reflection Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#example-ex-576a6b)
- [Operations on Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md)
  - [`IsIsomorphic(W1, W2): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-isisomorphic-grppermcox-grppermcox)
  - [`IsCoxeterIsomorphic(W1, W2): GrpFPCox, GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-iscoxeterisomorphic-grpfpcox-grpfpcox)
  - [`IsCoxeterIsomorphic(W1, W2): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-iscoxeterisomorphic-grppermcox-grppermcox)
  - [`IsCartanEquivalent(W1, W2): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-iscartanequivalent-grppermcox-grppermcox)
  - [Example: Testing Coxeter Isomorphism](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-892fbe)
  - [`RootSystem(W): GrpPermCox → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-rootsystem-grppermcox)
  - [`RootDatum(W): GrpPermCox → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-rootdatum-grppermcox)
  - [Example: Root System of a Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-e5a910)
  - [`CartanName(W): GrpFPCox → List`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-cartanname-grpfpcox)
  - [`CartanName(W): GrpPermCox → MonStgElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-cartanname-grppermcox)
  - [`CoxeterDiagram(W): GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#procedure-coxeterdiagram-grpfpcox)
  - [`CoxeterDiagram(W): GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#procedure-coxeterdiagram-grppermcox)
  - [`DynkinDiagram(W): GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#procedure-dynkindiagram-grppermcox)
  - [Example: Cartan Names and Diagrams](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-93c1ec)
  - [`CoxeterMatrix(W): GrpFPCox → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-coxetermatrix-grpfpcox)
  - [`CoxeterMatrix(W): GrpPermCox → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-coxetermatrix-grppermcox)
  - [`CoxeterGraph(W): GrpFPCox → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-coxetergraph-grpfpcox)
  - [`CoxeterGraph(W): GrpPermCox → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-coxetergraph-grppermcox)
  - [`CartanMatrix(W): GrpPermCox → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-cartanmatrix-grppermcox)
  - [`DynkinDigraph(W): GrpPermCox → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-dynkindigraph-grppermcox)
  - [`Rank(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-rank-grpfpcox)
  - [`Rank(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-rank-grppermcox)
  - [`NumberOfGenerators(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numberofgenerators-grpfpcox)
  - [`NumberOfGenerators(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numberofgenerators-grppermcox)
  - [`NumberOfPositiveRoots(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numberofpositiveroots-grpfpcox)
  - [`NumberOfPositiveRoots(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numberofpositiveroots-grppermcox)
  - [`NumPosRoots(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numposroots-grpfpcox)
  - [`NumPosRoots(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-numposroots-grppermcox)
  - [`Dimension(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-dimension-grppermcox)
  - [Example: Rank and Dimension](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-6345f3)
  - [`ConjugacyClasses(W): GrpFPCox → [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-conjugacyclasses-grpfpcox)
  - [`ConjugacyClasses(W): GrpPermCox → [GrpPermElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-conjugacyclasses-grppermcox)
  - [`FundamentalGroup(W): GrpPermCox → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-fundamentalgroup-grppermcox)
  - [`IsogenyGroup(W): GrpPermCox → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-isogenygroup-grppermcox)
  - [`CoisogenyGroup(W): GrpPermCox → GrpAb`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-coisogenygroup-grppermcox)
  - [`BasicDegrees(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-basicdegrees-grpfpcox)
  - [`BasicDegrees(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-basicdegrees-grppermcox)
  - [`BasicCodegrees(W): GrpFPCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-basiccodegrees-grpfpcox)
  - [`BasicCodegrees(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-basiccodegrees-grppermcox)
  - [Example: Basic Degrees of E6](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-d80f8f)
  - [`BruhatLessOrEqual(x, y): GrpPermElt, GrpPermElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-bruhatlessorequal)
  - [`BruhatDescendants(x): GrpPermElt → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-bruhatdescendants)
  - [`BruhatDescendants(X): SetEnum → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-bruhatdescendants-setenum)
  - [Example: Bruhat Descendants](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#example-ex-3232ff)
- [Properties of Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md)
  - [`IsFinite(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-isfinite-grpfpcox)
  - [`IsAffine(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-isaffine-grpfpcox)
  - [`IsHyperbolic(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-ishyperbolic-grpfpcox)
  - [`IsCompactHyperbolic(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-iscompacthyperbolic-grpfpcox)
  - [`IsIrreducible(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-isirreducible-grpfpcox)
  - [`IsIrreducible(W): GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-isirreducible-grppermcox)
  - [`IsSemisimple(W): GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-issemisimple-grppermcox)
  - [`IsCrystallographic(W): GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-iscrystallographic-grppermcox)
  - [`IsSimplyLaced(W): GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-issimplylaced-grppermcox)
  - [`IsSimplyLaced(W): GrpFPCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#function-issimplylaced-grpfpcox)
  - [Example: Properties of a Hyperbolic Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-prop.md#example-ex-5b007e)
- [Operations on Elements](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md)
  - [Example: Arithmetic with Coxeter Words](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#example-ex-8999bf)
  - [`# w: GrpFPCoxElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#operation-operation-grpfpcoxelt-rngintelt)
  - [`Length(w): GrpFPCoxElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-length-grpfpcoxelt)
  - [`Length(W, w): GrpPermCox, GrpPermElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-length-grppermcox-grppermelt)
  - [`CoxeterLength(w): GrpFPCoxElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeterlength-grpfpcoxelt)
  - [`CoxeterLength(W, w): GrpPermCox, GrpPermElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeterlength-grppermcox-grppermelt)
  - [`LongestElement(W): GrpFPCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-longestelement-grpfpcox)
  - [`LongestElement(W): GrpPermCox → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-longestelement-grppermcox)
  - [`CoxeterElement(W): GrpFPCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeterelement-grpfpcox)
  - [`CoxeterElement(W): GrpPermCox → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeterelement-grppermcox)
  - [`CoxeterNumber(W): GrpFPCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeternumber-grpfpcox)
  - [`CoxeterNumber(W): GrpPermCox → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-coxeternumber-grppermcox)
  - [Example: Longest Elements and Coxeter Elements](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#example-ex-ba43d4)
  - [`LeftDescentSet(W, w): GrpFPCox, GrpFPCoxElt → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-leftdescentset-grpfpcox-grpfpcoxelt)
  - [`LeftDescentSet(W, w): GrpPermCox, GrpPermElt → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-leftdescentset-grppermcox-grppermelt)
  - [`RightDescentSet(W, w): GrpFPCox, GrpFPCoxElt → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-rightdescentset-grpfpcox-grpfpcoxelt)
  - [`RightDescentSet(W, w): GrpPermCox, GrpPermElt → SetEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#function-rightdescentset-grppermcox-grppermelt)
  - [Example: Left and Right Descent Sets](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-elt-op.md#example-ex-e2a89d)
- [Roots, Coroots, and Reflections](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md)
  - [Accessing Roots and Coroots](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#accessing-roots-and-coroots)
    - [`RootSpace(W): GrpPermCox → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rootspace-grppermcox)
    - [`CorootSpace(W): GrpPermCox → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-corootspace-grppermcox)
    - [`SimpleRoots(W): GrpPermCox → Mtrx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-simpleroots-grppermcox)
    - [`SimpleCoroots(W): GrpPermCox → Mtrx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-simplecoroots-grppermcox)
    - [Example: Root Space and Coroot Space](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-18ee8e)
    - [`NumberOfPositiveRoots(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-numberofpositiveroots-grppermcox-2)
    - [`NumPosRoots(W): GrpPermCox → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-numposroots-grppermcox-2)
    - [`Roots(W): GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-roots-grppermcox)
    - [`Coroots(W): GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-coroots-grppermcox)
    - [`PositiveRoots(W): GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-positiveroots-grppermcox)
    - [`PositiveCoroots(W): GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-positivecoroots-grppermcox)
    - [`Root(W, r): GrpPermCox, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-root-grppermcox-rngintelt)
    - [`Coroot(W, r): GrpPermCox, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-coroot-grppermcox-rngintelt)
    - [`RootPosition(W, v): GrpPermCox, . → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rootposition-grppermcox)
    - [`CorootPosition(W, v): GrpPermCox, . → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-corootposition-grppermcox)
    - [Example: Roots and Coroots from Matrices](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-adcde8)
    - [`HighestRoot(W): GrpPermCox → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-highestroot-grppermcox)
    - [`HighestLongRoot(W): GrpPermCox → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-highestlongroot-grppermcox)
    - [`HighestShortRoot(W): GrpPermCox → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-highestshortroot-grppermcox)
    - [Example: Highest Roots of G2](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-3e3fcd)
    - [`CoxeterForm(W): GrpPermCox → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-coxeterform-grppermcox)
    - [`DualCoxeterForm(W): GrpPermCox → AlgMatElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-dualcoxeterform-grppermcox)
    - [`AdditiveOrder(W): GrpPermCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-additiveorder-grppermcox)
    - [`PapiOrder(W,w): GrpPermCox, GrpPermElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-papiorder-grppermcox-grppermelt)
    - [`PapiOrder(W, wd): GrpPermCox, SeqEnum[RngIntElt] → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-papiorder-grppermcox-seqenum-rngintelt)
  - [Operations and Properties for Root and Coroot Indices](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#operations-and-properties-for-root-and-coroot-indices)
    - [`Sum(W, r, s): GrpPermCox, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-sum-grppermcox-rngintelt-rngintelt)
    - [`IsPositive(W, r): GrpPermCox, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-ispositive-grppermcox-rngintelt)
    - [`IsNegative(W, r): GrpPermCox, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-isnegative-grppermcox-rngintelt)
    - [`Negative(W, r): GrpPermCox, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-negative-grppermcox-rngintelt)
    - [`LeftString(W, r, s): GrpPermCox, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-leftstring-grppermcox-rngintelt-rngintelt)
    - [`RightString(W, r, s): GrpPermCox, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rightstring-grppermcox-rngintelt-rngintelt)
    - [`LeftStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-leftstringlength-grppermcox-rngintelt-rngintelt)
    - [`RightStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rightstringlength-grppermcox-rngintelt-rngintelt)
    - [Example: Arithmetic with Root Indices](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-9ecc9b)
    - [`RootHeight(W, r): GrpPermCox, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rootheight-grppermcox-rngintelt)
    - [`CorootHeight(W, r): GrpPermCox, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-corootheight-grppermcox-rngintelt)
    - [`RootNorms(W): GrpPermCox → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rootnorms-grppermcox)
    - [`CorootNorms(W): GrpPermCox → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-corootnorms-grppermcox)
    - [`RootNorm(W, r): GrpPermCox, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-rootnorm-grppermcox-rngintelt)
    - [`CorootNorm(W, r): GrpPermCox, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-corootnorm-grppermcox-rngintelt)
    - [`IsLongRoot(W, r): GrpPermCox, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-islongroot-grppermcox-rngintelt)
    - [`IsShortRoot(W, r): GrpPermCox, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-isshortroot-grppermcox-rngintelt)
    - [Example: Root Heights, Norms, and Strings](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-237223)
  - [Weights](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#weights)
    - [`WeightLattice(W): GrpPermCox → Lat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-weightlattice-grppermcox)
    - [`CoweightLattice(W): GrpPermCox → Lat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-coweightlattice-grppermcox)
    - [`FundamentalWeights(W): GrpPermCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-fundamentalweights-grppermcox)
    - [`FundamentalCoweights(W): GrpPermCox → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-fundamentalcoweights-grppermcox)
    - [`IsDominant(R, v): RootDtm, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-isdominant-rootdtm)
    - [`DominantWeight(W, v): GrpPermCox, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-dominantweight-grppermcox)
    - [`WeightOrbit(W, v): GrpPermCox, . → {@ ModTupFldElt @}, [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#function-weightorbit-grppermcox)
    - [Example: Dominant Weights](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#example-ex-181d61)
- [Reflections](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md)
  - [`IsReflection(w): GrpFPElt → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-isreflection-grpfpelt)
  - [`IsReflection(w): GrpPermElt → BoolElt, ., ., RngInt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-isreflection-grppermelt)
  - [`Reflections(W): GrpFPCox → [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflections-grpfpcox)
  - [`Reflections(W): GrpPermCox → [GrpPermElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflections-grppermcox)
  - [Example: Reflections in a Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#example-ex-7fa1b2)
  - [`SimpleReflections(W): GrpFPCox → [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-simplereflections-grpfpcox)
  - [`SimpleReflections(W): GrpPermCox → [GrpPermElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-simplereflections-grppermcox)
  - [`SimpleReflectionPermutations(W): GrpPermCox → [GrpPermElt]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-simplereflectionpermutations-grppermcox)
  - [`Reflection(W, r): GrpPermCox, RngIntElt → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflection-grppermcox-rngintelt)
  - [`ReflectionPermutation(W, r): GrpPermCox, RngIntElt → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflectionpermutation-grppermcox-rngintelt)
  - [`SimpleReflectionMatrices(W): GrpPermCox → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-simplereflectionmatrices-grppermcox)
  - [`SimpleCoreflectionMatrices(W): GrpPermCox → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-simplecoreflectionmatrices-grppermcox)
  - [`ReflectionMatrices(W): GrpPermCox → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflectionmatrices-grppermcox)
  - [`CoreflectionMatrices(W): GrpPermCox → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-coreflectionmatrices-grppermcox)
  - [`ReflectionMatrix(W, r): GrpPermCox, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflectionmatrix-grppermcox-rngintelt)
  - [`CoreflectionMatrix(W, r): GrpPermCox, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-coreflectionmatrix-grppermcox-rngintelt)
  - [`ReflectionWords(W): GrpPermCox → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflectionwords-grppermcox)
  - [`ReflectionWord(W, r): GrpPermCox, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#function-reflectionword-grppermcox-rngintelt)
  - [Example: Reflection Matrices, Permutations, and Words](https://docs.magma-maths.org/LieTheory/CoxeterGroups/rootrefl.md#example-ex-56c975)
- [Reflection Subgroups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md)
  - [`ReflectionSubgroup(W, a): GrpPermCox, SetEnum → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-reflectionsubgroup-grppermcox-setenum)
  - [`ReflectionSubgroup(W, s): GrpPermCox, [] → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-reflectionsubgroup-grppermcox)
  - [`StandardParabolicSubgroup(W, J): GrpPermCox, SetEnum → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-standardparabolicsubgroup-grppermcox-setenum)
  - [`IsReflectionSubgroup(W, H): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-isreflectionsubgroup-grppermcox-grppermcox)
  - [`IsParabolicSubgroup(W, H): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-isparabolicsubgroup-grppermcox-grppermcox)
  - [`IsStandardParabolicSubgroup(W, H): GrpPermCox, GrpPermCox → BoolElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-isstandardparabolicsubgroup-grppermcox-grppermcox)
  - [`Overgroup(H): GrpPermCox → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-overgroup-grppermcox)
  - [`Overdatum(H): GrpPermCox → RootDtm`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-overdatum-grppermcox)
  - [`LocalCoxeterGroup(H): GrpPermCox → GrpPermCox, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-localcoxetergroup-grppermcox)
  - [Example: Local Coxeter Group of a Parabolic Subgroup](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#example-ex-0f53d0)
  - [`Transversal(W, H): GrpPermCox, GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversal-grppermcox-grppermcox)
  - [`TransversalWords(W, H): GrpPermCox, GrpPermCox → SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversalwords-grppermcox-grppermcox)
  - [`TransversalElt(W, H, x): GrpPermCox, GrpPermCox, GrpPermElt → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversalelt-grppermcox-grppermcox-grppermelt)
  - [Example: Transversals of a Parabolic Subgroup](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#example-ex-a0c74a)
  - [`TransversalElt(W, x, H): GrpPermCox, GrpPermElt, GrpPermCox → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversalelt-grppermcox-grppermelt-grppermcox)
  - [`TransversalElt(W, H, x, J): GrpPermCox, GrpPermCox, GrpPermElt, GrpPermCox → GrpPermElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversalelt-grppermcox-grppermcox-grppermelt-grppermcox)
  - [`Transversal(W, J): GrpFPCox, {RngIntElt} → {@ GrpFPCoxElt @}`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversal-grpfpcox-rngintelt)
  - [`Transversal(W, J, L): GrpFPCox, {RngIntElt}, RngIntElt → {@ GrpFPCoxElt @}`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversal-grpfpcox-rngintelt-rngintelt)
  - [`Transversal(W, J, K): GrpFPCox, {RngIntElt}, {RngIntElt} → [ GrpFPCoxElt ], [ ]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-transversal-grpfpcox-rngintelt-rngintelt-2)
  - [`DirectProduct(W1, W2): GrpPermCox, GrpPermCox → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-directproduct-grppermcox-grppermcox)
  - [`Dual(W): GrpPermCox → GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#function-dual-grppermcox)
  - [Example: Direct Sums and Duals](https://docs.magma-maths.org/LieTheory/CoxeterGroups/subgroups.md#example-ex-4748b7)
- [Root Actions](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md)
  - [`RootGSet(W): GrpPermCox → GSet`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-rootgset-grppermcox)
  - [`CorootGSet(W): GrpPermCox → GSet`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-corootgset-grppermcox)
  - [Example: Root G-Sets](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#example-ex-90d28a)
  - [`RootAction(W): GrpPermCox → Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-rootaction-grppermcox)
  - [`CorootAction(W): GrpPermCox → Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-corootaction-grppermcox)
  - [Example: Coroot Action](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#example-ex-1fa494)
  - [`ReflectionGroup(W): GrpPermCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-reflectiongroup-grppermcox-2)
  - [`CoreflectionGroup(W): GrpPermCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#function-coreflectiongroup-grppermcox)
  - [Example: Reflection Group of a Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot.md#example-ex-2596af)
- [Standard Action](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md)
  - [`StandardAction(W): GrpFPCox → Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md#function-standardaction-grpfpcox)
  - [`StandardAction(W): GrpPermCox → Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md#function-standardaction-grppermcox)
  - [`StandardActionGroup(W): GrpFPCox → GrpPerm, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md#function-standardactiongroup-grpfpcox)
  - [`StandardActionGroup(W): GrpPermCox → GrpPerm, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md#function-intrstandardactiongroup)
  - [Example: Standard Action of a Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/action-root-coroot-2.md#example-ex-eff773)
- [Braid Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md)
  - [`BraidGroup(W): GrpFPCox → GrpFP, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md#function-braidgroup-grpfpcox)
  - [`PureBraidGroup(W): GrpFPCox → GrpFP, Map`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md#function-purebraidgroup-grpfpcox)
  - [Example: Braid Group of a Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-braid.md#example-ex-a9e54b)
- [$W$-graphs](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md)
  - [`SetVerbose("WGraph", v): MonStgElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#procedure-setverbose-monstgelt-rngintelt-wgraph)
  - [`Mij2EltRootTable(seq): SeqEnum → SeqEnum[SeqEnum[RngIntElt]]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-mij2eltroottable-seqenum)
  - [`Name2Mij(name): MonStgElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-name2mij-monstgelt)
  - [Example: Reflection Table from Coxeter Matrix Entries](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#example-ex-320506)
  - [`Partition2WGtable(pi): SeqEnum → SeqEnum, GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-partition2wgtable-seqenum)
  - [`WGtable2WG(table): SeqEnum → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wgtable2wg-seqenum)
  - [`TestWG(W,wg): GrpFPCox, GrphUnd → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-testwg-grpfpcox-grphund)
  - [`TestWG(W,wg): GrpFPCox, GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-testwg-grpfpcox-grphdir)
  - [`TestWG(tp,wg): MonStgElt, GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-testwg-monstgelt-grphdir)
  - [`TestWG(tp,wg): MonStgElt, GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-testwg-monstgelt-grphdir-2)
  - [Example: W-Graph of a Specht Module](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#example-ex-8afb5c)
  - [`WGelement2WGtable(g,K): GrpFPCoxElt, SetEnum → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wgelement2wgtable-grpfpcoxelt-setenum)
  - [Example: W-Graph of Type B5](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#example-ex-0bb421)
  - [`GetCells(wg): GrphUnd → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-getcells-grphund)
  - [`GetCells(wg): GrphDir → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-getcells-grphdir)
  - [`InduceWG(W,wg,seq): GrpFPCox, GrphUnd, SeqEnum → GrphUnd`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-inducewg-grpfpcox-grphund-seqenum)
  - [`InduceWG(W,wg,seq): GrpFPCox, GrphDir, SeqEnum → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-inducewg-grpfpcox-grphdir-seqenum)
  - [`InduceWGtable(J, table, W): SeqEnum, SeqEnum, GrpFPCox → SeqEnum[SeqEnum[RngIntElt]]`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-inducewgtable-seqenum-seqenum-grpfpcox)
  - [`IsWGsymmetric(dwg): GrphDir → BoolElt, GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-iswgsymmetric-grphdir)
  - [`MakeDirected(uwg): GrphUnd → GrphDir`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-makedirected-grphund)
  - [`TestHeckeRep(W,r): GrpFPCox, SeqEnum → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-testheckerep-grpfpcox-seqenum)
  - [`WG2GroupRep(wg): GrphUnd → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wg2grouprep-grphund)
  - [`WG2GroupRep(wg): GrphDir → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wg2grouprep-grphdir)
  - [`WG2HeckeRep(W,wg): GrpFPCox, GrphUnd → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wg2heckerep-grpfpcox-grphund)
  - [`WG2HeckeRep(W,wg): GrpFPCox, GrphDir → SeqEnum`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wg2heckerep-grpfpcox-grphdir)
  - [`WGidealgens2WGtable(dgens,K): SeqEnum, SetEnum → SeqEnum[SeqEnum[RngIntElt]], SetIndx`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-wgidealgens2wgtable-seqenum-setenum)
  - [Example: W-Graph Ideal in Type E6](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#example-ex-8bb5d1)
  - [`WriteWG(file,uwg): MonStgElt, GrphUnd → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-writewg-monstgelt-grphund)
  - [`WriteWG(file,dwg): MonStgElt, GrphDir → .`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-wgraphs.md#function-writewg-monstgelt-grphdir)
- [Related Structures](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md)
  - [`CoxeterGroup(GrpFP, W): Cat, GrpPermCox → GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-coxetergroup-cat-grppermcox)
  - [`Presentation(W): GrpPermCox → GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-presentation-grppermcox)
  - [`ReflectionGroup(W): GrpPermCox → GrpMat`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-reflectiongroup-grppermcox-3)
  - [`CoxeterGroup(GrpMat, W): Cat, GrpPermCox → GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-coxetergroup-cat-grppermcox-2)
  - [`LieAlgebra(W, R): GrpPermCox, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-liealgebra-grppermcox-rng)
  - [`GroupOfLieType(W, R): GrpPermCox, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/related.md#function-groupoflietype-grppermcox-rng)
- [Bibliography](https://docs.magma-maths.org/LieTheory/CoxeterGroups/bibliography.md)

<a id="sectgrpcoxintro"></a>
<a id="id1"></a>
### Introduction

This chapter describes Magma functions for computing with Coxeter groups. A *Coxeter system* is a group $G$ with finite generating set $S=\{s_1,\dots,s_n\}$, defined by relations $s_i^2=1$ for $i=1,\dots,n$ and

$$
s_is_js_i\cdots = s_js_is_j\cdots
$$

for $i,j=1,\dots,n$ with $i<j$, where each side of this relation has length $m_{ij}\ge 2$. Traditionally, $m_{ij}=\infty$ signifies that the corresponding relation is omitted but, for technical reasons, $m_{ij}=0$ is used in Magma instead. The group $G$ is called a *Coxeter group* and $S$ is called the set of *Coxeter generators*. Since every group in Magma has a preferred generating set, no distinction is made between a Coxeter system and its Coxeter group. See [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] for more details on the theory of Coxeter groups.

The *rank* of the Coxeter system is $n=|S|$. A Coxeter system is said to be *reducible* if there is a proper subset $I$ of $\{1,\dots,n\}$ such that $m_{ij}=2$ or $m_{ji}=2$ whenever $i\in I$ and $j\notin I$. In this case, $G$ is an (internal) direct product of the Coxeter subgroups $W_I=\langle s_i \mid i \in I \rangle$ and $W_{I^c}=\langle s_i \mid i \notin I \rangle$. Note that an *irreducible* Coxeter group may still be a nontrivial direct product of abstract subgroups (for example, $W(G_2)\cong S_2\times S_3$). Two Coxeter groups are *Coxeter isomorphic* if there is a group isomorphism between them which takes Coxeter generators to Coxeter generators. In other words, the two groups are the same modulo renumbering of the generators.

Magma provides three methods for working with Coxeter groups:

1. As a finitely presented group with the standard presentation given above. These groups have type `GrpFPCox`. See Chapter [Finitely Presented Groups](https://docs.magma-maths.org/FinitelyPresentedGroups/FPGroups/index-fpgroups.md#chapgrpfp) for general functions for finitely presented groups.
2. As a permutation group acting on the roots of the root system. Clearly the group must be finite. These groups have type `GrpPermCox`. See Chapter [Permutation Groups](https://docs.magma-maths.org/FiniteGroups/PermutationGroups/index-permutation-groups.md#chapgrpperm) for general functions for permutation groups.
3. As a reflection group, i.e. a matrix group generated by reflections. These groups have the same type as general matrix groups ([`GrpMat`](https://docs.magma-maths.org/FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat)). They can be distinguished with the `IsReflectionGroup` function.

The first two methods are described in this chapter. The third is described in Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

A permutation Coxeter group always has an underlying root system or root datum, and so many commands involving roots also work for these groups. A finitely presented Coxeter group does not have such an underlying structure.

The code for Coxeter groups as permutation groups was originally modelled on the corresponding part of the Chevie package of GAP [[GHL+96](https://docs.magma-maths.org/references.md#cite-chevie)] by Meinholf Geck, Frank Lübeck, Jean Michel, and Götz Pfeiffer.

<a id="reduction"></a>
<a id="subsectgrpcoxred"></a>
#### The Normal Form for Words

Every element $w$ of a Coxeter group $W$ can be written as a word

$$
w = r_1 r_2\cdots r_l
$$

with each $r_i$ in $S$. A *reduced expression* for $w$ is such a word with $l$ minimal; in this case, $l$ is defined to be the *length* of $w$.

An ordering on words in $S$ is obtained by taking the *lexicographic (alphabetic) order* induced by the existing ordering on $S$. The *normal form* for $w$ in $W$ is the smallest reduced expression for $w$ with respect to this ordering. Algorithms for efficiently computing this normal form have been developed and implemented by R.B. Howlett. These algorithms are based on the concept of a minimal root [[Bri98](https://docs.magma-maths.org/references.md#cite-brink98), [BH93](https://docs.magma-maths.org/references.md#cite-brinkhowlett93)].

The main difference of the category of Coxeter groups ([`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox)) from the category of finitely presented groups (`GrpFP`) is that all words are automatically put into this normal form. In particular, this means that two words are equal if, and only if, they are equal as group elements. Coxeter groups can also be constructed in the category `GrpFP` if the user wishes to avoid automatic normalisation of elements (see Section [Converting Between Types of Coxeter Group](https://docs.magma-maths.org/LieTheory/CoxeterGroups/construct-2.md#sectgrpcoxconvert)).

<a id="construct"></a>
<a id="sectgrpcoxconstr"></a>
### Constructing Coxeter Groups

For many of the intrinsics that construct Coxeter groups it is possible to specify the category of the group as the first argument: either [`GrpMat`](https://docs.magma-maths.org/FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat) (a reflection group), [`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox), `GrpFP` (a finitely presented group), [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) or `GrpPerm` (a permutation group). If the category is not supplied, a permutation group of type [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) is returned for finite groups and a finitely presented group of type [`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox) is returned for infinite groups. If [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) is specified for an infinite group, an error is signalled.

<a id="function-coxetergroup-cat-monstgelt"></a>
#### `CoxeterGroup(grpcat, N): Cat, MonStgElt -> grpcat`

The finite or affine Coxeter group of type `grpcat` with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

There are variations of this signature (see below). The second argument can be a Coxeter matrix, a Cartan matrix, a Coxeter graph, a Dynkin digraph, a root system, a root datum or, as in this case, a Cartan name given by a string.

<a id="function-coxetergroup-monstgelt"></a>
#### `CoxeterGroup(N): MonStgElt -> Grp`

The finite Coxeter group of type `GrpPermCox` or the affine Coxeter group of type `GrpFPCox` with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-irreduciblecoxetergroup-cat-monstgelt-rngintelt"></a>
#### `IrreducibleCoxeterGroup(grpcat, X, n): Cat, MonStgElt, RngIntElt -> grpcat`

<a id="function-irreduciblecoxetergroup-monstgelt-rngintelt"></a>
#### `IrreducibleCoxeterGroup(X, n): MonStgElt, RngIntElt -> .`

The finite or affine irreducible Coxeter group of type `grpcat` with Cartan name $X_n$, or $I_2(n)$ if $X=$`"I"` (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="example-ex-fcfb78"></a>
#### `Example: Constructing a Coxeter Group by Name (ex-fcfb78)`

```magma
> CoxeterGroup(GrpFPCox, "B3");
Coxeter group: Finitely presented group on 3 generators
Relations
    $.1 * $.2 * $.1 = $.2 * $.1 * $.2
    $.1 * $.3 = $.3 * $.1
    ($.2 * $.3)^2 = ($.3 * $.2)^2
    $.1^2 = Id($)
    $.2^2 = Id($)
    $.3^2 = Id($)
> CoxeterGroup("A2B2");
Coxeter group: Permutation group acting on a set of cardinality 14
Order = 48 = 2^4 * 3
    (1, 8)(2, 5)(9, 12)
    (1, 5)(2, 9)(8, 12)
    (3, 10)(4, 6)(11, 13)
    (3, 7)(4, 11)(10, 14)
```

Note that if the category is not supplied, a permutation group of type [`GrpPermCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox) is returned for finite groups and a finitely presented group of type [`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox) is returned for infinite groups.

<a id="function-coxetergroup-cat-algmatelt"></a>
#### `CoxeterGroup(grpcat, M): Cat, AlgMatElt -> grpcat`

The Coxeter group of type `grpcat` with Coxeter or Cartan matrix $M$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-coxetergroup-cat-grphund"></a>
#### `CoxeterGroup(grpcat, G): Cat, GrphUnd -> grpcat`

The Coxeter group of type `grpcat` with Coxeter graph $G$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-coxetergroup-cat-grphdir"></a>
#### `CoxeterGroup(grpcat, D): Cat, GrphDir -> grpcat`

The Coxeter group of type `grpcat` with Dynkin digraph $D$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-coxetergroup-algmatelt"></a>
#### `CoxeterGroup(M): AlgMatElt -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Coxeter or Cartan matrix $M$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-coxetergroup-grphund"></a>
#### `CoxeterGroup(G): GrphUnd -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Coxeter graph $G$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-coxetergroup-grphdir"></a>
#### `CoxeterGroup(D): GrphDir -> Grp`

The Coxeter group of type `GrpPermCox` or `GrpFPCox` with Dynkin digraph $D$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="example-ex-2b7d19"></a>
#### `Example: Coxeter Group from a Coxeter Matrix (ex-2b7d19)`

```magma
> M := SymmetricMatrix([ 1, 4,1, 3,4,1 ]);
> G<a,b,c> := CoxeterGroup(M);
> G;
Coxeter group: Finitely presented group on 3 generators
Relations
    (a * b)^2 = (b * a)^2
    a * c * a = c * a * c
    (b * c)^2 = (c * b)^2
    a^2 = Id($)
    b^2 = Id($)
    c^2 = Id($)
> M := SymmetricMatrix([ 1, 3,1, 2,3,1 ]);
> G<a,b,c> := CoxeterGroup(M);
> G;
Coxeter group: Permutation group G acting on a set of cardinality 12
Order = 24 = 2^3 * 3
    (1, 7)(2, 4)(5, 6)(8, 10)(11, 12)
    (1, 4)(2, 8)(3, 5)(7, 10)(9, 11)
    (2, 5)(3, 9)(4, 6)(8, 11)(10, 12)
> G<a,b,c> := CoxeterGroup(GrpFPCox, M);
> G;
Coxeter group: Finitely presented group on 3 generators
Relations
    a * b * a = b * a * b
    a * c = c * a
    b * c * b = c * b * c
    a^2 = Id($)
    b^2 = Id($)
    c^2 = Id($)
```

Note that a Coxeter group does not have a unique Cartan matrix.

```magma
> C := CartanMatrix("G2");
> W := CoxeterGroup(GrpFPCox, C);
> CartanMatrix(W);

>> CartanMatrix(W);
               ^
Runtime error in 'CartanMatrix': Bad argument types
Argument types given: GrpFPCox
```

<a id="function-coxetergroup-cat-rootstr"></a>
#### `CoxeterGroup(grpcat, R): Cat, RootStr -> grpcat`

The finite Coxeter group of type `grpcat` with root system or root datum $R$ (see Chapters [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys) and [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)).

<a id="function-coxetergroup-rootstr"></a>
#### `CoxeterGroup(R): RootStr -> GrpPermCox`

The finite Coxeter group of type `GrpPermCox` with root system or root datum $R$ (see Chapters [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys) and [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)).

<a id="function-coxetergroup-mtrx-mtrx"></a>
#### `CoxeterGroup(A, B): Mtrx, Mtrx -> GrpPermCox`

The permutation representation (or, if the group is infinite) the FP representation of the Coxeter group with simple roots given by the rows of the matrix $A$ and simple coroots given by the rows of the matrix $B$. The matrices $A$ and $B$ must have the following properties:

1. $A$ and $B$ must have the same number of rows and the same number of columns; they must be defined over the same field, which must be the rational field, a number field, or a cyclotomic field; the entries must be real;
2. the number of columns must be at least the number of rows; and
3. $AB^t$ must be the Cartan matrix of a Coxeter group.

<a id="function-coxetergroup-cat-mtrx-mtrx"></a>
#### `CoxeterGroup(grpcat, A, B): Cat, Mtrx, Mtrx -> grpcat`

The Coxeter group of type `grpcat` where `grpcat` is `GrpMat`, `GrpPermCox`, `GrpPerm`, or `GrpFPCox`. As above, the rows of $A$ are the simple roots and the rows of $B$ are the simple coroots.

<a id="example-ex-af5154"></a>
#### `Example: Coxeter Group from a Root Datum (ex-af5154)`

```magma
> R := RootDatum("A3" : Isogeny := 2);
> CoxeterGroup(R);
Coxeter group: Permutation group acting on a set of cardinality 12
Order = 24 = 2^3 * 3
    (1, 7)(2, 4)(5, 6)(8, 10)(11, 12)
    (1, 4)(2, 8)(3, 5)(7, 10)(9, 11)
    (2, 5)(3, 9)(4, 6)(8, 11)(10, 12)
```

<a id="construct-2"></a>
<a id="sectgrpcoxconvert"></a>
### Converting Between Types of Coxeter Group

In this section, we describe functions for converting between the various descriptions of Coxeter groups available in Magma.

A Coxeter group $W$ of type `GrpMat` (a reflection group), `GrpPermCox` (a permutation group) or `GrpFPCox` (a finitely presented group) can be converted to a group $W'$ of type `GrpMat`, `GrpPermCox`, `GrpPerm`, `GrpFPCox`, or `GrpFP`. Groups of types `GrpPerm` and `GrpFP` are respectively permutation and finitely presented groups without any attribute that identifies them as Coxeter groups. In most cases the second return value of the conversion function is an isomorphism $W\to W'$.

Since a finitely presented Coxeter group $W$ does not come with a built-in reflection representation, the optional parameters $A$, $B$, and $C$ can be used to specify the representation. They are respectively the matrix whose rows are the simple roots, the matrix whose rows are the simple coroots, and the Cartan matrix. These must have the following properties:

1. $A$ and $B$ must have same number of rows and the same number of columns; they must be defined over the same field, which must be the rational field, a number field, or a cyclotomic field; the entries must be real;
2. the number of columns must be at least the number of rows; and
3. $C=AB^t$ must be a Cartan matrix for $W$.

It is not necessary to specify all three matrices, since any two of them will determine the third. If these matrices are not given, the default is to take $A$ to be the identity and to take $C$ to be the standard Cartan matrix described in Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat).

<a id="function-coxetergroup-cat-grp"></a>
#### `CoxeterGroup(grpcat, W): Cat, Grp -> grpcat, Map`

```magma
A: Mtrx                    Default: 
B: Mtrx                    Default: 
C: Mtrx                    Default: 
```

The Coxeter group $W$ converted to its representation in category `grpcat`. The type (i.e., category) of $W$ can be `GrpMat`, `GrpPermCox`, or `GrpFPCox`. The target type can be `GrpMat`, `GrpPermCox`, `GrpPerm`, `GrpFPCox`, or `GrpFP`. The second return value is the isomorphism from $W$ to the converted group (when available).

The parameters $A$, $B$, and $C$ are only applicable when $W$ is of type `GrpFPCox`.

<a id="example-ex-bd0d74"></a>
#### `Example: Converting to a Permutation Coxeter Group (ex-bd0d74)`

```magma
> W<a,b> := CoxeterGroup(GrpFPCox, "G2");
> Wp, h := CoxeterGroup(GrpPermCox, W);
> a*b;
a * b
> h(a*b);
(1, 11, 12, 7, 5, 6)(2, 4, 3, 8, 10, 9)
```

<a id="function-reflectiongroup-grpfpcox"></a>
#### `ReflectionGroup(W): GrpFPCox -> GrpMat, Map`

```magma
A: Mtrx                    Default: 
B: Mtrx                    Default: 
C: Mtrx                    Default: 
```

A reflection representation $W'$ of the Coxeter group $W$ (of type `GrpFPCox`) together with the isomorphism $W\to W'$.

<a id="function-reflectiongroup-grppermcox"></a>
#### `ReflectionGroup(W): GrpPermCox -> GrpMat, Map`

A reflection representation $W'$ of the Coxeter group $W$ (of type `GrpPermCox`) together with the isomorphism $W\to W'$.

Every permutation Coxeter group has a root system, and this determines the reflection representation.

<a id="example-ex-576a6b"></a>
#### `Example: Converting to a Reflection Group (ex-576a6b)`

```magma
> W<a,b,c> := CoxeterGroup(GrpFPCox, "B3");
> G, h := CoxeterGroup(GrpMat, W);
> a*b; h(a*b);
a * b
[-1 -1  0]
[ 1  0  0]
[ 0  1  1]
```

<a id="group-op"></a>
<a id="sectgrppermcoxop"></a>
<a id="sectgrpcoxop"></a>
### Operations on Coxeter Groups

See Chapter [Finitely Presented Groups](https://docs.magma-maths.org/FinitelyPresentedGroups/FPGroups/index-fpgroups.md#chapgrpfp) for general functions for finitely presented groups, or Chapter [Permutation Groups](https://docs.magma-maths.org/FiniteGroups/PermutationGroups/index-permutation-groups.md#chapgrpperm) for general functions for permutation groups.

<a id="function-isisomorphic-grppermcox-grppermcox"></a>
#### `IsIsomorphic(W1, W2): GrpPermCox, GrpPermCox -> BoolElt`

Returns `true` if, and only if, $W_1$ and $W_2$ are isomorphic as abstract groups. This is only implemented for permutation Coxeter groups.

<a id="function-iscoxeterisomorphic-grpfpcox-grpfpcox"></a>
#### `IsCoxeterIsomorphic(W1, W2): GrpFPCox, GrpFPCox -> BoolElt`

<a id="function-iscoxeterisomorphic-grppermcox-grppermcox"></a>
#### `IsCoxeterIsomorphic(W1, W2): GrpPermCox, GrpPermCox -> BoolElt`

Tests if $W_1$ and $W_2$ are isomorphic as Coxeter systems. If `true`, a sequence giving the permutation of the generators which takes $W_1$ to $W_2$ is also returned.

<a id="function-iscartanequivalent-grppermcox-grppermcox"></a>
#### `IsCartanEquivalent(W1, W2): GrpPermCox, GrpPermCox -> BoolElt`

Returns `true` if and only if the crystallographic Coxeter groups $W_1$ and $W_2$ have Cartan equivalent Cartan matrices. This only makes sense for permutation Coxeter groups.

<a id="example-ex-892fbe"></a>
#### `Example: Testing Coxeter Isomorphism (ex-892fbe)`

```magma
> W1 := CoxeterGroup(GrpFPCox, "B4");
> W2 := CoxeterGroup(GrpFPCox, "C4");
> IsCoxeterIsomorphic(W1, W2);
true [ 1, 2, 3, 4 ]
```

An example of abstractly isomorphic Coxeter groups whose Coxeter systems not isomorphic:

```magma
> W1 := CoxeterGroup("G2");
> W2 := CoxeterGroup("A1A2");
> IsIsomorphic(W1, W2);
true
> IsCoxeterIsomorphic(W1, W2);
false
```

An example of Coxeter isomorphic groups which are not Cartan equivalent:

```magma
> W1 := CoxeterGroup("B3");
> W2 := CoxeterGroup("C3");
> IsIsomorphic(W1, W2);
true
> IsCoxeterIsomorphic(W1, W2);
true [ 1, 2, 3 ]
> IsCartanEquivalent(W1, W2);
false
```

<a id="function-rootsystem-grppermcox"></a>
#### `RootSystem(W): GrpPermCox -> RootDtm`

The underlying root system of the permutation Coxeter group $W$.

<a id="function-rootdatum-grppermcox"></a>
#### `RootDatum(W): GrpPermCox -> RootDtm`

The root datum of the permutation Coxeter group $W$. If $W$ does not have a root datum, an error is flagged.

<a id="example-ex-e5a910"></a>
#### `Example: Root System of a Coxeter Group (ex-e5a910)`

```magma
> W := CoxeterGroup("C5");
> RootSystem(W);
Root system of type C5
> RootDatum(W);
Root datum of type C5
>
> W := CoxeterGroup("H4");
> RootSystem(W);
Root system of type H4
> RootDatum(W);
Error: This group does not have a root datum
```

<a id="function-cartanname-grpfpcox"></a>
#### `CartanName(W): GrpFPCox -> List`

<a id="function-cartanname-grppermcox"></a>
#### `CartanName(W): GrpPermCox -> MonStgElt`

The Cartan name of the finite or affine Coxeter group $W$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-coxeterdiagram-grpfpcox"></a>
#### `CoxeterDiagram(W): GrpFPCox`

<a id="procedure-coxeterdiagram-grppermcox"></a>
#### `CoxeterDiagram(W): GrpPermCox`

Print the Coxeter diagram of the finite or affine Coxeter group $W$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-dynkindiagram-grppermcox"></a>
#### `DynkinDiagram(W): GrpPermCox`

Print the Dynkin diagram of the permutation Coxeter group $W$. If $W$ is not crystallographic, an error is flagged.

<a id="example-ex-93c1ec"></a>
#### `Example: Cartan Names and Diagrams (ex-93c1ec)`

```magma
> W := CoxeterGroup("F4");
> CartanName(W);
F4
> DynkinDiagram(W);

F4    1 - 2 =>= 3 - 4
> CoxeterDiagram(W);

F4    1 - 2 === 3 - 4
```

<a id="function-coxetermatrix-grpfpcox"></a>
#### `CoxeterMatrix(W): GrpFPCox -> AlgMatElt`

<a id="function-coxetermatrix-grppermcox"></a>
#### `CoxeterMatrix(W): GrpPermCox -> AlgMatElt`

The Coxeter matrix of the Coxeter group $W$.

<a id="function-coxetergraph-grpfpcox"></a>
#### `CoxeterGraph(W): GrpFPCox -> GrphUnd`

<a id="function-coxetergraph-grppermcox"></a>
#### `CoxeterGraph(W): GrpPermCox -> GrphUnd`

The Coxeter graph of the Coxeter group $W$.

<a id="function-cartanmatrix-grppermcox"></a>
#### `CartanMatrix(W): GrpPermCox -> AlgMatElt`

The Cartan matrix of the permutation Coxeter group $W$.

<a id="function-dynkindigraph-grppermcox"></a>
#### `DynkinDigraph(W): GrpPermCox -> GrphDir`

The Dynkin digraph of the permutation Coxeter group $W$.

<a id="function-rank-grpfpcox"></a>
#### `Rank(W): GrpFPCox -> RngIntElt`

<a id="function-rank-grppermcox"></a>
#### `Rank(W): GrpPermCox -> RngIntElt`

<a id="function-numberofgenerators-grpfpcox"></a>
#### `NumberOfGenerators(W): GrpFPCox -> RngIntElt`

<a id="function-numberofgenerators-grppermcox"></a>
#### `NumberOfGenerators(W): GrpPermCox -> RngIntElt`

The rank of the Coxeter group $W$.

<a id="function-numberofpositiveroots-grpfpcox"></a>
#### `NumberOfPositiveRoots(W): GrpFPCox -> RngIntElt`

<a id="function-numberofpositiveroots-grppermcox"></a>
#### `NumberOfPositiveRoots(W): GrpPermCox -> RngIntElt`

<a id="function-numposroots-grpfpcox"></a>
#### `NumPosRoots(W): GrpFPCox -> RngIntElt`

<a id="function-numposroots-grppermcox"></a>
#### `NumPosRoots(W): GrpPermCox -> RngIntElt`

The number of positive roots of the Coxeter group $W$.

<a id="function-dimension-grppermcox"></a>
#### `Dimension(W): GrpPermCox -> RngIntElt`

The dimension of the permutation Coxeter group $W$, ie. the dimension of the root space.

<a id="example-ex-6345f3"></a>
#### `Example: Rank and Dimension (ex-6345f3)`

```magma
> R := StandardRootSystem("A", 4);
> W := CoxeterGroup(R);
> Rank(W);
4
> Dimension(W);
5
```

<a id="function-conjugacyclasses-grpfpcox"></a>
#### `ConjugacyClasses(W): GrpFPCox -> [GrpFPCoxElt]`

<a id="function-conjugacyclasses-grppermcox"></a>
#### `ConjugacyClasses(W): GrpPermCox -> [GrpPermElt]`

The conjugacy classes of the finite Coxeter group $W$. This uses the algorithm of [[GP00](https://docs.magma-maths.org/references.md#cite-geckpfeiffer)].

<a id="function-fundamentalgroup-grppermcox"></a>
#### `FundamentalGroup(W): GrpPermCox -> GrpAb`

The fundamental group of the permutation Coxeter group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-isogenygroup-grppermcox"></a>
#### `IsogenyGroup(W): GrpPermCox -> GrpAb`

The isogeny group of the permutation Coxeter group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-coisogenygroup-grppermcox"></a>
#### `CoisogenyGroup(W): GrpPermCox -> GrpAb`

The coisogeny group of the permutation Coxeter group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-basicdegrees-grpfpcox"></a>
#### `BasicDegrees(W): GrpFPCox -> RngIntElt`

<a id="function-basicdegrees-grppermcox"></a>
#### `BasicDegrees(W): GrpPermCox -> RngIntElt`

The degrees of the basic invariant polynomials of the Coxeter group $W$. These are computed using the table in [[Car72b](https://docs.magma-maths.org/references.md#cite-carter-small), page 155].

<a id="function-basiccodegrees-grpfpcox"></a>
#### `BasicCodegrees(W): GrpFPCox -> RngIntElt`

<a id="function-basiccodegrees-grppermcox"></a>
#### `BasicCodegrees(W): GrpPermCox -> RngIntElt`

The basic codegrees of the Coxeter group $W$. These are computed using the algorithm in [[LT09](https://docs.magma-maths.org/references.md#cite-lehrertaylor)].

<a id="example-ex-d80f8f"></a>
#### `Example: Basic Degrees of E6 (ex-d80f8f)`

The product of the basic degrees is the order of the Coxeter group; the sum of the basic degrees is the sum of the rank and the number of positive roots.

```magma
> W := CoxeterGroup("E6");
> degs := BasicDegrees(W);
> degs;
[ 2, 5, 6, 8, 9, 12 ]
> &*degs eq #W;
true
> &+degs eq NumPosRoots(W) + Rank(W);
true
```

<a id="function-bruhatlessorequal"></a>
#### `BruhatLessOrEqual(x, y): GrpPermElt, GrpPermElt -> BoolElt`

If Coxeter group element $x$ is less than or equal to $y$ in the Bruhat order [[Deo77](https://docs.magma-maths.org/references.md#cite-deodhar)]. Suppose $x$ is an element of the Coxeter group $W$. The Bruhat order is the partial order generated by the relations: $x \leq xw$ if $l(x) < l(xw)$, and $xw \leq x$ if $l(xw) < l(x)$, for $x\in W$ and $w$ a reflection. If $l(xw) = l(x) + 1$, then $x$ is called a *Bruhat descendant* of $xw$. The algorithm used is a straightforward recursive procedure.

<a id="function-bruhatdescendants"></a>
#### `BruhatDescendants(x): GrpPermElt -> SetEnum`

```magma
z: GrpPermElt                    Default: 
```

Let $x$ be an element of the Coxeter group $W$, then the returned set $S$ contains the Bruhat descendants of $x$. If $l(yw) = l(y) + 1$, then $y$ is called a *Bruhat descendant* of $yw$. If the optional parameter $z$ is set, only those descendants $y$ with $z \leq y$ are returned. Algorithm: For each fundamental reflection in $x$ it is tested whether leaving it out decreases the length of $x$ by exactly 1. If so, it is included in the result. In particular, this algorithm does not use [`BruhatLessOrEqual`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#function-bruhatlessorequal).

<a id="function-bruhatdescendants-setenum"></a>
#### `BruhatDescendants(X): SetEnum -> SetEnum`

```magma
z: GrpPermElt                    Default: 
```

Let $X$ consist of elements of the Coxeter group $W$, then the returned set $S$ contains the Bruhat descendants of every element of $X$.

If the optional parameter $z$ is set, only those $w$ are returned for which $z \leq w$ in the Bruhat ordering.

<a id="example-ex-3232ff"></a>
#### `Example: Bruhat Descendants (ex-3232ff)`

Bruhat descendants:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> W := CoxeterGroup(GrpPermCox, R);
> Wfp,phi := CoxeterGroup(GrpFPCox, W);
> x := W.1*W.3*W.2*W.4*W.2*W.2*W.2*W.1;
> Eltseq(phi(x));
[ 1, 3, 2, 4, 2, 1 ]
> S := BruhatDescendants(x);
> { Eltseq(phi(w)) : w in S };
{
     [ 1, 3, 2, 4, 2 ],
     [ 3, 2, 4, 2, 1 ],
     [ 1, 2, 4, 2, 1 ],
     [ 1, 3, 2, 1, 4 ],
     [ 1, 3, 4, 2, 1 ]
}
```

<a id="group-prop"></a>
<a id="sectgrpcoxprop"></a>
### Properties of Coxeter Groups

<a id="function-isfinite-grpfpcox"></a>
#### `IsFinite(W): GrpFPCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is finite.

<a id="function-isaffine-grpfpcox"></a>
#### `IsAffine(W): GrpFPCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is affine (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-ishyperbolic-grpfpcox"></a>
#### `IsHyperbolic(W): GrpFPCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is hyperbolic (Section [Hyperbolic Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#sectcartanhyperbolic)).

<a id="function-iscompacthyperbolic-grpfpcox"></a>
#### `IsCompactHyperbolic(W): GrpFPCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is compact hyperbolic (Section [Hyperbolic Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/related.md#sectcartanhyperbolic)).

<a id="function-isirreducible-grpfpcox"></a>
#### `IsIrreducible(W): GrpFPCox -> BoolElt`

<a id="function-isirreducible-grppermcox"></a>
#### `IsIrreducible(W): GrpPermCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is irreducible.

<a id="function-issemisimple-grppermcox"></a>
#### `IsSemisimple(W): GrpPermCox -> BoolElt`

Returns `true` if, and only if, the permutation Coxeter group $W$ is semisimple, i.e. its rank is equal to its dimension.

<a id="function-iscrystallographic-grppermcox"></a>
#### `IsCrystallographic(W): GrpPermCox -> BoolElt`

Returns `true` if, and only if, the permutation Coxeter group $W$ is crystallographic, i.e. if the corresponding reflection representation is defined over the integers.

<a id="function-issimplylaced-grppermcox"></a>
#### `IsSimplyLaced(W): GrpPermCox -> BoolElt`

<a id="function-issimplylaced-grpfpcox"></a>
#### `IsSimplyLaced(W): GrpFPCox -> BoolElt`

Returns `true` if, and only if, the Coxeter group $W$ is simply laced, i.e. its Coxeter graph has no labels.

<a id="example-ex-5b007e"></a>
#### `Example: Properties of a Hyperbolic Coxeter Group (ex-5b007e)`

```magma
> W := CoxeterGroup(GrpFPCox, HyperbolicCoxeterMatrix(22));
> IsFinite(W);
false
> IsAffine(W);
false
> IsHyperbolic(W);
true
> IsCompactHyperbolic(W);
false
> IsIrreducible(W);
true
> IsSimplyLaced(W);
true
> W := CoxeterGroup("A2 D4");
> IsIrreducible(W);
false
> IsSemisimple(W);
true
> IsCrystallographic(W);
true
> IsSimplyLaced(W);
true
```

<a id="group-elt-op"></a>
<a id="sectgrpeltop"></a>
### Operations on Elements

See Chapter [Finitely Presented Groups](https://docs.magma-maths.org/FinitelyPresentedGroups/FPGroups/index-fpgroups.md#chapgrpfp) for general functions for finitely presented groups or Chapter [Permutation Groups](https://docs.magma-maths.org/FiniteGroups/PermutationGroups/index-permutation-groups.md#chapgrpperm) for general functions for permutation groups.

Unlike groups of type `GrpFP`, elements of a group of type [`GrpFPCox`](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox) are always converted into the normal form of Section [The Normal Form for Words](https://docs.magma-maths.org/LieTheory/CoxeterGroups/introduction.md#subsectgrpcoxred).

<a id="example-ex-8999bf"></a>
#### `Example: Arithmetic with Coxeter Words (ex-8999bf)`

Arithmetic with words.

```magma
> W<[s]> := CoxeterGroup(GrpFPCox, "G2");
> w1 := W![2,1,2,1,2] ;
> w1;
s[2] * s[1] * s[2] * s[1] * s[2]
> w2 := W![1,2,2,1,2,1];
> w2;
s[2] * s[1]
> w1 * w2;
s[1] * s[2] * s[1]
> W![1,2,1,2,1,2] eq W![2,1,2,1,2,1];
true
```

<a id="operation-operation-grpfpcoxelt-rngintelt"></a>
#### `# w: GrpFPCoxElt -> RngIntElt`

<a id="function-length-grpfpcoxelt"></a>
#### `Length(w): GrpFPCoxElt -> RngIntElt`

<a id="function-length-grppermcox-grppermelt"></a>
#### `Length(W, w): GrpPermCox, GrpPermElt -> RngIntElt`

<a id="function-coxeterlength-grpfpcoxelt"></a>
#### `CoxeterLength(w): GrpFPCoxElt -> RngIntElt`

<a id="function-coxeterlength-grppermcox-grppermelt"></a>
#### `CoxeterLength(W, w): GrpPermCox, GrpPermElt -> RngIntElt`

The length of $w$ as an element of the Coxeter group $W$, ie. the number of positive roots of $W$ which become negative under the action of $w$. The # operator does not work for permutation Coxeter group elements.

<a id="function-longestelement-grpfpcox"></a>
#### `LongestElement(W): GrpFPCox -> SeqEnum`

<a id="function-longestelement-grppermcox"></a>
#### `LongestElement(W): GrpPermCox -> GrpPermElt`

The unique longest element of the Coxeter group $W$.

<a id="function-coxeterelement-grpfpcox"></a>
#### `CoxeterElement(W): GrpFPCox -> SeqEnum`

<a id="function-coxeterelement-grppermcox"></a>
#### `CoxeterElement(W): GrpPermCox -> GrpPermElt`

The Coxeter element of the Coxeter group $W$, ie. the product of the generators of $W$.

<a id="function-coxeternumber-grpfpcox"></a>
#### `CoxeterNumber(W): GrpFPCox -> SeqEnum`

<a id="function-coxeternumber-grppermcox"></a>
#### `CoxeterNumber(W): GrpPermCox -> GrpPermElt`

The Coxeter number of the irreducible Coxeter group $W$ (see [[Car93](https://docs.magma-maths.org/references.md#cite-carter-big), page 20]).

<a id="example-ex-ba43d4"></a>
#### `Example: Longest Elements and Coxeter Elements (ex-ba43d4)`

```magma
> W<[s]> := CoxeterGroup(GrpFPCox, "F4");
> LongestElement(W);
s[1] * s[2] * s[1] * s[3] * s[2] * s[1] * s[3] * s[2] * s[3] * s[4] * s[3] *
s[2] * s[1] * s[3] * s[2] * s[3] * s[4] * s[3] * s[2] * s[1] * s[3] * s[2] *
s[3] * s[4]
> CoxeterElement(W);
s[1] * s[2] * s[3] * s[4]
> W := CoxeterGroup("E8");
> Length(W, LongestElement(W));
120
> Length(W, CoxeterElement(W));
8
```

The Coxeter number can be described in a variety of ways.

```magma
> W := CoxeterGroup("D5");
> CoxeterNumber(W) eq Order(CoxeterElement(W));
true
> CoxeterNumber(W) eq #Roots(W) / Rank(W);
true
> R := RootDatum(W);
> CoxeterNumber(W) eq &+Eltseq(HighestRoot(R)) + 1;
true
```

<a id="function-leftdescentset-grpfpcox-grpfpcoxelt"></a>
#### `LeftDescentSet(W, w): GrpFPCox, GrpFPCoxElt -> SetEnum`

<a id="function-leftdescentset-grppermcox-grppermelt"></a>
#### `LeftDescentSet(W, w): GrpPermCox, GrpPermElt -> SetEnum`

The set of indices $r$ of simple roots of the Coxeter group $W$ such that the length of the product $s_rw$ is less than that of the element $w$.

<a id="function-rightdescentset-grpfpcox-grpfpcoxelt"></a>
#### `RightDescentSet(W, w): GrpFPCox, GrpFPCoxElt -> SetEnum`

<a id="function-rightdescentset-grppermcox-grppermelt"></a>
#### `RightDescentSet(W, w): GrpPermCox, GrpPermElt -> SetEnum`

The set of indices $r$ of simple roots of the Coxeter group $W$ such that the length of the product $ws_r$ is less than that of the element $w$.

<a id="example-ex-e2a89d"></a>
#### `Example: Left and Right Descent Sets (ex-e2a89d)`

```magma
> W := CoxeterGroup("A5");
> x := W.1*W.2*W.4*W.5;
> LeftDescentSet(W, x);
{ 1, 4 }
> RightDescentSet(W, x);
{ 2, 5 }
```

<a id="root-data-roots"></a>
<a id="sectgrpcoxrdroots"></a>
### Roots, Coroots, and Reflections

The functions in this section give access to the underlying root system (or datum) of a permutation Coxeter group. These functions do not apply to finitely presented Coxeter groups

Roots are stored as an indexed set

$$
\{@\; \alpha_1,\dots,\alpha_N,\alpha_{N+1},\dots,\alpha_{2N} \; @\},
$$

where $\alpha_1,\dots,\alpha_N$ are the positive roots in an order compatible with height; and $\alpha_{N+1},\dots,\alpha_{2N}$ are the corresponding negative roots (i.e. $\alpha_{i+N}=-\alpha_i$). The simple roots are $\alpha_1,\dots,\alpha_n$ where $n$ is the rank.

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space. This is the default.
2. `"Root"`: the basis of simple (co)roots.
3. `"Weight"`: the basis of fundamental (co)weights (see Subsection [Weights](https://docs.magma-maths.org/LieTheory/CoxeterGroups/root-data-roots.md#subsectgrppermcoxrootweight) below).

#### Accessing Roots and Coroots

<a id="function-rootspace-grppermcox"></a>
##### `RootSpace(W): GrpPermCox -> .`

<a id="function-corootspace-grppermcox"></a>
##### `CorootSpace(W): GrpPermCox -> .`

The (co)root space of the Coxeter group $W$. This can be a vector space over a field of characteristic zero (Chapter [Vector Spaces](https://docs.magma-maths.org/MatricesLinearAlgebra/VectorSpaces/index-vector-spaces.md#chapvectspace)), or an integer lattice in the crystallographic case (Chapter [Lattices](https://docs.magma-maths.org/LatticesQuadraticForms/Lattices/index-lattices.md#chaplat)). The (co)reflection group of $W$ acts on the (co)root space.

<a id="function-simpleroots-grppermcox"></a>
##### `SimpleRoots(W): GrpPermCox -> Mtrx`

<a id="function-simplecoroots-grppermcox"></a>
##### `SimpleCoroots(W): GrpPermCox -> Mtrx`

The simple (co)roots of the Coxeter group $W$ as the rows of a matrix.

<a id="example-ex-18ee8e"></a>
##### `Example: Root Space and Coroot Space (ex-18ee8e)`

```magma
> W := CoxeterGroup("G2");
> RootSpace(W);
Full Vector space of degree 2 over Rational Field
> CorootSpace(W);
Full Vector space of degree 2 over Rational Field
> SimpleRoots(W);
[1 0]
[0 1]
> SimpleCoroots(W);
[ 2 -3]
[-1  2]
> CartanMatrix(W);
[ 2 -1]
[-3  2]
```

<a id="function-numberofpositiveroots-grppermcox-2"></a>
##### `NumberOfPositiveRoots(W): GrpPermCox -> RngIntElt`

<a id="function-numposroots-grppermcox-2"></a>
##### `NumPosRoots(W): GrpPermCox -> RngIntElt`

The number of positive roots of the Coxeter group $W$.

<a id="function-roots-grppermcox"></a>
##### `Roots(W): GrpPermCox -> SetIndx`

<a id="function-coroots-grppermcox"></a>
##### `Coroots(W): GrpPermCox -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

An indexed set containing the (co)roots of the Coxeter group $W$.

<a id="function-positiveroots-grppermcox"></a>
##### `PositiveRoots(W): GrpPermCox -> SetIndx`

<a id="function-positivecoroots-grppermcox"></a>
##### `PositiveCoroots(W): GrpPermCox -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

An indexed set containing the positive (co)roots of the Coxeter group $W$.

<a id="function-root-grppermcox-rngintelt"></a>
##### `Root(W, r): GrpPermCox, RngIntElt -> SetIndx`

<a id="function-coroot-grppermcox-rngintelt"></a>
##### `Coroot(W, r): GrpPermCox, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root of the Coxeter group $W$.

<a id="function-rootposition-grppermcox"></a>
##### `RootPosition(W, v): GrpPermCox, . -> SetIndx`

<a id="function-corootposition-grppermcox"></a>
##### `CorootPosition(W, v): GrpPermCox, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root of the Coxeter group $W$, this returns its position; otherwise it returns 0. These functions will try to coerce $v$, which can be a vector or a sequence representing a vector, into the appropriate vector space; $v$ should be written with respect to the basis specified by the parameter `Basis`.

<a id="example-ex-adcde8"></a>
##### `Example: Roots and Coroots from Matrices (ex-adcde8)`

```magma
> A := Matrix(2,3, [1,-1,0, -1,1,-1]);
> B := Matrix(2,3, [1,-1,1, 0,1,-1]);
> W := CoxeterGroup(A, B);
> Roots(W);
{@
    (1 -1  0),
    (-1  1 -1),
    (0  0 -1),
    (1 -1 -1),
    (2 -2 -1),
    (1 -1 -2),
    (-1  1  0),
    (1 -1  1),
    (0 0 1),
    (-1  1  1),
    (-2  2  1),
    (-1  1  2)
@}
> PositiveCoroots(W);
{@
    (1 -1  1),
    (0  1 -1),
    (1  2 -2),
    (2  1 -1),
    (1 0 0),
    (1  1 -1)
@}
> #Roots(W) eq 2*NumPosRoots(W);
true
> Root(W, 4);
(1 -1 -1)
> Root(W, 4 : Basis := "Root");
(2 1)
> RootPosition(W, [1,-1,-1]);
4
> RootPosition(W, [2,1] : Basis := "Root");
4
```

<a id="function-highestroot-grppermcox"></a>
##### `HighestRoot(W): GrpPermCox -> .`

<a id="function-highestlongroot-grppermcox"></a>
##### `HighestLongRoot(W): GrpPermCox -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique (long) root of greatest height of the irreducible Coxeter group $W$.

<a id="function-highestshortroot-grppermcox"></a>
##### `HighestShortRoot(W): GrpPermCox -> .`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique short root of greatest height of the irreducible Coxeter group $W$.

<a id="example-ex-3e3fcd"></a>
##### `Example: Highest Roots of G2 (ex-3e3fcd)`

```magma
> W := RootDatum("G2");
> HighestRoot(W);
(3 2)
> HighestLongRoot(W);
(3 2)
> HighestShortRoot(W);
(2 1)
```

<a id="function-coxeterform-grppermcox"></a>
##### `CoxeterForm(W): GrpPermCox -> AlgMatElt`

<a id="function-dualcoxeterform-grppermcox"></a>
##### `DualCoxeterForm(W): GrpPermCox -> AlgMatElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix of an inner product on the (co)root space of the finite Coxeter group $W$ which is invariant under the action of $W$. This inner product is uniquely determined up to a constant on each irreducible component of $W$. The inner product is normalised so that the short roots in each crystallographic component have length one.

<a id="function-additiveorder-grppermcox"></a>
##### `AdditiveOrder(W): GrpPermCox -> SeqEnum`

An additive order on the positive roots of the finite Coxeter group $W$, i.e. a sequence containing the numbers $1,\dots,N$ in some order such that $\alpha_r+\alpha_s=\alpha_t$ implies $t$ is between $r$ and $s$. This is computed using the techniques of Papi [[Pap94](https://docs.magma-maths.org/references.md#cite-papi)].

<a id="function-papiorder-grppermcox-grppermelt"></a>
##### `PapiOrder(W, w): GrpPermCox, GrpPermElt -> SeqEnum`

<a id="function-papiorder-grppermcox-seqenum-rngintelt"></a>
##### `PapiOrder(W, wd): GrpPermCox, SeqEnum[RngIntElt] -> SeqEnum`

An additive order for the set of positive roots of the finite Coxeter group $W$ sent negative by $w^{-1}$. The element $w$ can be supplied either as an element of the permutation group $W$ or as a sequence representing a word in its generators.

#### Operations and Properties for Root and Coroot Indices

<a id="function-sum-grppermcox-rngintelt-rngintelt"></a>
##### `Sum(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The index of the sum of the $r$th and $s$th roots in the Coxeter group $W$, or 0 if the sum is not a root. In other words, if $t = \hbox{\tt Sum(W,r,s)} \ne 0$ then $\alpha_t=\alpha_r+\alpha_s$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

<a id="function-ispositive-grppermcox-rngintelt"></a>
##### `IsPositive(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the Coxeter group $W$ is a positive root.

<a id="function-isnegative-grppermcox-rngintelt"></a>
##### `IsNegative(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th (co)root of the Coxeter group $W$ is a negative root.

<a id="function-negative-grppermcox-rngintelt"></a>
##### `Negative(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The index of the negative of the $r$th (co)root of the Coxeter group $W$. In other words, if $s = \hbox{\tt Negative(W,r)}$ then $\alpha_s=-\alpha_r$.

<a id="function-leftstring-grppermcox-rngintelt-rngintelt"></a>
##### `LeftString(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

Root indices in the Coxeter group $W$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s-\alpha_r,\alpha_s-2\alpha_r,\dots,\alpha_s-p\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_p]$ where $\alpha_{r_i}=\alpha_s-i\alpha_r$ and $\alpha_s-(p+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

<a id="function-rightstring-grppermcox-rngintelt-rngintelt"></a>
##### `RightString(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

Root indices of the Coxeter group $W$ of the left string through $\alpha_s$ in the direction of $\alpha_r$, i.e. the indices of $\alpha_s+\alpha_r,\alpha_s+2\alpha_r,\dots,\alpha_s+q\alpha_r$. In other words, this returns the sequence $[r_1,\dots,r_q]$ where $\alpha_{r_i}=\alpha_s+i\alpha_r$ and $\alpha_s+(q+1)\alpha_r$ is not a root. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

<a id="function-leftstringlength-grppermcox-rngintelt-rngintelt"></a>
##### `LeftStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The largest $p$ such that $\alpha_s-p\alpha_r$ is a root of the Coxeter group $W$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

<a id="function-rightstringlength-grppermcox-rngintelt-rngintelt"></a>
##### `RightStringLength(W, r, s): GrpPermCox, RngIntElt, RngIntElt -> RngIntElt`

The largest $q$ such that $\alpha_s+q\alpha_r$ is a root of the Coxeter group $W$. The condition $\alpha_r\ne\pm\alpha_s$ must be satisfied. If $W$ is noncrystallographic, an error is flagged.

<a id="example-ex-9ecc9b"></a>
##### `Example: Arithmetic with Root Indices (ex-9ecc9b)`

```magma
> W := RootDatum("G2");
> Sum(W, 1, Negative(W,5));
10
> IsPositive(W, 10);
false
> Negative(W, 10);
4
> P := PositiveRoots(W);
> P[1] - P[5] eq -P[4];
true
```

<a id="function-rootheight-grppermcox-rngintelt"></a>
##### `RootHeight(W, r): GrpPermCox, RngIntElt -> RngIntElt`

<a id="function-corootheight-grppermcox-rngintelt"></a>
##### `CorootHeight(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The height of the $r$th (co)root of the Coxeter group $W$, i.e. the sum of the coefficients of $\alpha_r$ (respectively, $\alpha_r^\star$) with respect to the simple (co)roots.

<a id="function-rootnorms-grppermcox"></a>
##### `RootNorms(W): GrpPermCox -> [RngIntElt]`

<a id="function-corootnorms-grppermcox"></a>
##### `CorootNorms(W): GrpPermCox -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the Coxeter group $W$.

<a id="function-rootnorm-grppermcox-rngintelt"></a>
##### `RootNorm(W, r): GrpPermCox, RngIntElt -> RngIntElt`

<a id="function-corootnorm-grppermcox-rngintelt"></a>
##### `CorootNorm(W, r): GrpPermCox, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the Coxeter group $W$.

<a id="function-islongroot-grppermcox-rngintelt"></a>
##### `IsLongRoot(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the Coxeter group $W$ is long, i.e. the $r$th coroot is short. An error is flagged unless $W$ is irreducible and crystallographic.

<a id="function-isshortroot-grppermcox-rngintelt"></a>
##### `IsShortRoot(W, r): GrpPermCox, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the Coxeter group $W$ is short, i.e. the $r$th coroot is long. An error is flagged unless $W$ is irreducible and crystallographic.

<a id="example-ex-237223"></a>
##### `Example: Root Heights, Norms, and Strings (ex-237223)`

```magma
> W := RootDatum("G2");
> RootHeight(W, 5);
4
> F := CoxeterForm(W);
> v := VectorSpace(Rationals(),2) ! Root(W, 5);
> (v*F, v) eq RootNorm(W, 5);
true
> IsLongRoot(W, 5);
true
> LeftString(W, 1, 5);
[ 4, 3, 2 ]
> roots := Roots(W);
> for i in [1..3] do
>   RootPosition(W, roots[5]-i*roots[1]);
> end for;
4
3
2
```

<a id="subsectgrppermcoxrootweight"></a>
<a id="id2"></a>
#### Weights

<a id="function-weightlattice-grppermcox"></a>
##### `WeightLattice(W): GrpPermCox -> Lat`

<a id="function-coweightlattice-grppermcox"></a>
##### `CoweightLattice(W): GrpPermCox -> Lat`

The (co)weight lattice of the Coxeter group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-fundamentalweights-grppermcox"></a>
##### `FundamentalWeights(W): GrpPermCox -> SeqEnum`

<a id="function-fundamentalcoweights-grppermcox"></a>
##### `FundamentalCoweights(W): GrpPermCox -> SeqEnum`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental (co)weights of the Coxeter group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-isdominant-rootdtm"></a>
##### `IsDominant(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

Returns `true` if, and only if, $v$ is a dominant weight for the root datum $R$, ie, a nonnegative integral linear combination of the fundamental weights.

<a id="function-dominantweight-grppermcox"></a>
##### `DominantWeight(W, v): GrpPermCox, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique element in the $W$-orbit of the weight $v$ which lies in the fundamental Weyl chamber, and the word in the generators which sends $v$ to this element. The Coxeter group $W$ must have a root datum. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

<a id="function-weightorbit-grppermcox"></a>
##### `WeightOrbit(W, v): GrpPermCox, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The orbit of the weight $v$ under the action of $W$. The Coxeter group $W$ must have a root datum. The weight $v$ can be given either as a vector or as a sequence representing the vector and is coerced into the weight lattice first.

<a id="example-ex-181d61"></a>
##### `Example: Dominant Weights (ex-181d61)`

```magma
> W := CoxeterGroup("B3");
> DominantWeight(W, [1,-1,0] : Basis:="Weight");
(1 0 0)
[ 2, 3, 2, 1 ]
> #WeightOrbit(W, [1,-1,0] : Basis:="Weight");
6
```

<a id="rootrefl"></a>
<a id="sectgrpcoxrootaction"></a>
### Reflections

An element of a Coxeter group is called a *reflection* if it is conjugate to one of the Coxeter generators.

In a permutation Coxeter group, the root $\alpha$ acts on the root space via the reflection $s_\alpha$; the coroot $\alpha^\star$ acts on the coroot space via the coreflection $s_\alpha^\star$.

<a id="function-isreflection-grpfpelt"></a>
#### `IsReflection(w): GrpFPElt -> BoolElt`

<a id="function-isreflection-grppermelt"></a>
#### `IsReflection(w): GrpPermElt -> BoolElt, ., ., RngInt`

Returns `true` if, and only if, $w$ is a reflection, i.e. $w$ is conjugate to a Coxeter generator. If $w$ is in a permutation Coxeter group, the root, coroot, and root index are also returned.

<a id="function-reflections-grpfpcox"></a>
#### `Reflections(W): GrpFPCox -> [GrpFPCoxElt]`

<a id="function-reflections-grppermcox"></a>
#### `Reflections(W): GrpPermCox -> [GrpPermElt]`

The sequence of reflections in the finite Coxeter group $W$. If $W$ is a permutation Coxeter group, the $r$th reflection in the sequence corresponds to the $r$th (co)root.

<a id="example-ex-7fa1b2"></a>
#### `Example: Reflections in a Coxeter Group (ex-7fa1b2)`

```magma
> W<a,b> := CoxeterGroup(GrpFPCox, "A2");
> Reflections(W);
[ a, b, a * b * a, a, b, a * b * a ]
> IsReflection(a*b);
false
```

<a id="function-simplereflections-grpfpcox"></a>
#### `SimpleReflections(W): GrpFPCox -> [GrpFPCoxElt]`

<a id="function-simplereflections-grppermcox"></a>
#### `SimpleReflections(W): GrpPermCox -> [GrpPermElt]`

The sequence of simple reflections in the Coxeter group $W$, ie, the generators of $W$.

<a id="function-simplereflectionpermutations-grppermcox"></a>
#### `SimpleReflectionPermutations(W): GrpPermCox -> [GrpPermElt]`

The sequence of simple reflections in the permutation Coxeter group $W$, ie, the generators of $W$.

<a id="function-reflection-grppermcox-rngintelt"></a>
#### `Reflection(W, r): GrpPermCox, RngIntElt -> GrpPermElt`

<a id="function-reflectionpermutation-grppermcox-rngintelt"></a>
#### `ReflectionPermutation(W, r): GrpPermCox, RngIntElt -> GrpPermElt`

The reflection in permutation Coxeter group $W$ corresponding to the $r$th (co)root. If $r=1,\dots,n$, this is a generator of $W$.

<a id="function-simplereflectionmatrices-grppermcox"></a>
#### `SimpleReflectionMatrices(W): GrpPermCox -> []`

<a id="function-simplecoreflectionmatrices-grppermcox"></a>
#### `SimpleCoreflectionMatrices(W): GrpPermCox -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrices giving the action of the simple (co)roots on the (co)root space of the permutation Coxeter group $W$.

<a id="function-reflectionmatrices-grppermcox"></a>
#### `ReflectionMatrices(W): GrpPermCox -> []`

<a id="function-coreflectionmatrices-grppermcox"></a>
#### `CoreflectionMatrices(W): GrpPermCox -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrices giving the action of the (co)roots on the (co)root space of the permutation Coxeter group $W$.

<a id="function-reflectionmatrix-grppermcox-rngintelt"></a>
#### `ReflectionMatrix(W, r): GrpPermCox, RngIntElt -> []`

<a id="function-coreflectionmatrix-grppermcox-rngintelt"></a>
#### `CoreflectionMatrix(W, r): GrpPermCox, RngIntElt -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrix giving the action of the $r$th (co)root on the (co)root space of the permutation Coxeter group $W$.

<a id="function-reflectionwords-grppermcox"></a>
#### `ReflectionWords(W): GrpPermCox -> []`

The sequence of words in the simple reflections for all the reflections of the Coxeter group $W$. These words are given as sequences of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWords(W)[r]}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="function-reflectionword-grppermcox-rngintelt"></a>
#### `ReflectionWord(W, r): GrpPermCox, RngIntElt -> []`

The word in the simple reflections for the $r$th reflection of the Coxeter group $W$. The word is given as a sequence of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWord(W,r)}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="example-ex-56c975"></a>
#### `Example: Reflection Matrices, Permutations, and Words (ex-56c975)`

```magma
> W := CoxeterGroup("B3");
> IsReflection(W.1*W.2);
false
> mx := ReflectionMatrix(W, 4);
> perm := Reflection(W, 4);
> wd := ReflectionWord(W, 4);
> rt := VectorSpace(Rationals(), 3) ! Root(W,2);
> RootPosition(W, rt * mx) eq 2^perm;
true
> perm eq &*[ Reflection(W, r) : r in wd ];
true
>
> mx := CoreflectionMatrix(W, 4);
> CorootPosition(W, Coroot(W,2) * mx) eq 2^perm;
true
```

<a id="subgroups"></a>
<a id="sectgrppermcoxnew"></a>
### Reflection Subgroups

A *reflection subgroup* of a Coxeter group is a subgroup which is generated by a set of reflections. Note that reflection subgroups are also Coxeter groups. The most important class of reflection subgroups are the *standard parabolic subgroups*, which are generated by a subset of the simple roots. Given a set of indices $J\subseteq \{1,\dots,\hbox{\tt Rank(W)}\}$, the corresponding standard parabolic is denoted $W_J$. A *parabolic subgroup* is a subgroup which is conjugate to a standard parabolic subgroup. Note that in a reflection subgroup, the elements are given as permutations of the roots of the *larger* group.

Most of the functions in this section are currently only implemented for permutation Coxeter groups with a root *datum* (rather than a root system).

<a id="function-reflectionsubgroup-grppermcox-setenum"></a>
#### `ReflectionSubgroup(W, a): GrpPermCox, SetEnum -> GrpPermCox`

The reflection subgroup of the permutation Coxeter group $W$ generated by the roots $\alpha_{a_1},\dots,\alpha_{a_k}$ where $a=\{a_1,\dots,a_k\}$ is a set of integers. This only works if $W$ has an underlying root datum.

<a id="function-reflectionsubgroup-grppermcox"></a>
#### `ReflectionSubgroup(W, s): GrpPermCox, [] -> GrpPermCox`

The reflection subgroup of the permutation Coxeter group $W$ generated by simple roots $\alpha_{s_1},\dots,\alpha_{s_k}$ where $s=[s_1,\dots,s_k]$ is a *sequence* of integers. In this version the roots must be simple in the root subdatum (ie. none of them may be a summand of another) otherwise an error is signalled. The simple roots will appear in the reflection subgroup in the given order. This only works if $W$ has an underlying root datum.

<a id="function-standardparabolicsubgroup-grppermcox-setenum"></a>
#### `StandardParabolicSubgroup(W, J): GrpPermCox, SetEnum -> GrpPermCox`

The standard parabolic subgroup of the Coxeter group $W$ generated by the simple roots $\alpha_{j_1},\dots,\alpha_{j_k}$ where $J=\{j_1,\dots,j_k\}\subseteq\{1,\dots,\hbox{\tt Rank(W)}\}$. This function works for both finitely presented and permutation Coxeter groups.

<a id="function-isreflectionsubgroup-grppermcox-grppermcox"></a>
#### `IsReflectionSubgroup(W, H): GrpPermCox, GrpPermCox -> BoolElt`

Returns `true` if, and only if, $H$ is a reflection subgroup of the permutation Coxeter group $W$.

<a id="function-isparabolicsubgroup-grppermcox-grppermcox"></a>
#### `IsParabolicSubgroup(W, H): GrpPermCox, GrpPermCox -> BoolElt`

Returns `true` if, and only if, $H$ is a parabolic subgroup of the permutation Coxeter group $W$.

<a id="function-isstandardparabolicsubgroup-grppermcox-grppermcox"></a>
#### `IsStandardParabolicSubgroup(W, H): GrpPermCox, GrpPermCox -> BoolElt`

Returns `true` if, and only if, $H$ is a standard parabolic subgroup of the permutation Coxeter group $W$.

<a id="function-overgroup-grppermcox"></a>
#### `Overgroup(H): GrpPermCox -> GrpPermCox`

The overgroup of $H$, ie. the Coxeter group whose roots are permuted by the elements of the permutation Coxeter subgroup $H$.

<a id="function-overdatum-grppermcox"></a>
#### `Overdatum(H): GrpPermCox -> RootDtm`

The root datum whose roots are permuted by the elements of the permutation Coxeter subgroup $H$.

<a id="function-localcoxetergroup-grppermcox"></a>
#### `LocalCoxeterGroup(H): GrpPermCox -> GrpPermCox, Map`

Given a Coxeter subgroup $H$ this returns the Coxeter group $L$ isomorphic to $H$ but acting on the roots of $H$ itself rather than the roots of its overgroup, together with the isomorphism $L\to H$.

<a id="example-ex-0f53d0"></a>
#### `Example: Local Coxeter Group of a Parabolic Subgroup (ex-0f53d0)`

```magma
> W := CoxeterGroup("A4");
> P := StandardParabolicSubgroup(W, {1,2});
> Overgroup(P) eq W;
true
> L, h := LocalCoxeterGroup(P);
> hinv := Inverse(h);
> L.1;
(1, 4)(2, 3)(5, 6)
> h(L.1);
(1, 11)(2, 5)(6, 8)(9, 10)(12, 15)(16, 18)(19, 20)
> hinv(h(L.1));
(1, 4)(2, 3)(5, 6)
```

<a id="function-transversal-grppermcox-grppermcox"></a>
#### `Transversal(W, H): GrpPermCox, GrpPermCox -> SetIndx`

The indexed set of (right) coset representatives of the reflection subgroup $H$ of the Coxeter group $W$. This contains the unique element of shortest length in each coset. The algorithm is due to Don Taylor (personal communication).

<a id="function-transversalwords-grppermcox-grppermcox"></a>
#### `TransversalWords(W, H): GrpPermCox, GrpPermCox -> SetIndx`

The indexed set of words of (right) coset representatives of the reflection subgroup $H$ of the Coxeter group $W$. The algorithm is due to Don Taylor (personal communication).

<a id="function-transversalelt-grppermcox-grppermcox-grppermelt"></a>
#### `TransversalElt(W, H, x): GrpPermCox, GrpPermCox, GrpPermElt -> GrpPermElt`

The representative of the coset $Hx$ in the Coxeter group $W$. This is the unique element of $Hx$ of shortest length in $W$ and also the unique element of $Hx$ which sends every positive root of $H$ to another positive root. The algorithm is due to Don Taylor (personal communication).

<a id="example-ex-a0c74a"></a>
#### `Example: Transversals of a Parabolic Subgroup (ex-a0c74a)`

```magma
> W := CoxeterGroup("A4");
> P := StandardParabolicSubgroup(W, {1,2});
> x := W.1 * W.2 * W.3;
> x := TransversalElt(W, P, x);
> x eq W.3;
true
> x in Transversal(W, P);
true
```

<a id="function-transversalelt-grppermcox-grppermelt-grppermcox"></a>
#### `TransversalElt(W, x, H): GrpPermCox, GrpPermElt, GrpPermCox -> GrpPermElt`

The representative of the coset $xH$ in the Coxeter group $W$. This is the unique element of $xH$ of shortest length in $W$ and also the unique element of $xH$ which sends every positive root of $H$ to another positive root.

<a id="function-transversalelt-grppermcox-grppermcox-grppermelt-grppermcox"></a>
#### `TransversalElt(W, H, x, J): GrpPermCox, GrpPermCox, GrpPermElt, GrpPermCox -> GrpPermElt`

The representative of the coset $HxJ$ in the Coxeter group $W$. This is the unique element of $HxJ$ of shortest length in $W$ and also the unique element of $HxJ$ which sends every positive root of $HJ$ to another positive root.

<a id="function-transversal-grpfpcox-rngintelt"></a>
#### `Transversal(W, J): GrpFPCox, {RngIntElt} -> {@ GrpFPCoxElt @}`

<a id="function-transversal-grpfpcox-rngintelt-rngintelt"></a>
#### `Transversal(W, J, L): GrpFPCox, {RngIntElt}, RngIntElt -> {@ GrpFPCoxElt @}`

The set of right coset representatives of minimal length for the standard parabolic subgroup $W_J \le W$. In the first form $W$ must be finite and the result is a full transversal. In the second form $W$ may be infinite, but the transversal produced is limited to words of length at most $L$.

<a id="function-transversal-grpfpcox-rngintelt-rngintelt-2"></a>
#### `Transversal(W, J, K): GrpFPCox, {RngIntElt}, {RngIntElt} -> [ GrpFPCoxElt ], [ ]`

The sequence of $W_J,W_K$-double cosets representatives of minimal length in $W$. Restricted to $W$ finite. The second return value gives the generators of the standard parabolic subgroup $W_J\cap W_K^d$ for each double coset representative $d$.

<a id="function-directproduct-grppermcox-grppermcox"></a>
#### `DirectProduct(W1, W2): GrpPermCox, GrpPermCox -> GrpPermCox`

The direct product of the Coxeter groups $W_1$ and $W_2$.

<a id="function-dual-grppermcox"></a>
#### `Dual(W): GrpPermCox -> GrpPermCox`

The dual of the Coxeter group $W$, obtained by swapping the roots and coroots.

<a id="example-ex-4748b7"></a>
#### `Example: Direct Sums and Duals (ex-4748b7)`

```magma
> W1 := CoxeterGroup("G2");
> W2 := CoxeterGroup("C3");
> DirectProduct(W1, Dual(W2));
Coxeter group: Permutation group acting on a set of cardinality 30
Order = 576 = 2^6 * 3^2
    (1, 7)(2, 5)(3, 4)(8, 11)(9, 10)
    (1, 3)(2, 8)(5, 6)(7, 9)(11, 12)
    (13, 22)(14, 16)(17, 20)(19, 21)(23, 25)(26, 29)(28, 30)
    (13, 16)(14, 23)(15, 17)(18, 21)(22, 25)(24, 26)(27, 30)
    (14, 19)(15, 24)(16, 21)(23, 28)(25, 30)
> W1 := CoxeterGroup(GrpFPCox, "G2");
> W2 := CoxeterGroup(GrpFPCox, "A2");
> DirectProduct(W1, W2);
Coxeter group: Finitely presented group on 4 generators
Relations
    $.1 * $.2 * $.1 = $.2 * $.1 * $.2
    $.1 * $.3 = $.3 * $.1
    $.1 * $.4 = $.4 * $.1
    $.2 * $.3 = $.3 * $.2
    $.2 * $.4 = $.4 * $.2
    $.3 * $.4 * $.3 = $.4 * $.3 * $.4
    $.1^2 = Id($)
    $.2^2 = Id($)
    $.3^2 = Id($)
    $.4^2 = Id($)
```

### Root Actions

The functions in this section give access to the action on the underlying root system (or datum) of a permutation Coxeter group. These functions do not apply to finitely presented Coxeter groups

In the following functions, the optional parameter `Basis` determines which basis the roots are given with respect to: `"Standard"` for the standard basis of the root space; `"Root"` for the basis of simple (co)roots; `"Weight"` for the basis of simple (co)weights.

<a id="function-rootgset-grppermcox"></a>
#### `RootGSet(W): GrpPermCox -> GSet`

<a id="function-corootgset-grppermcox"></a>
#### `CorootGSet(W): GrpPermCox -> GSet`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $G$-set of the Coxeter group $W$ acting on the (co)roots.

<a id="example-ex-90d28a"></a>
#### `Example: Root G-Sets (ex-90d28a)`

```magma
> W := CoxeterGroup("B3");
> X := RootGSet(W);
> r := Root(W, 5);
> r;
(0 1 1)
> Image(W.1, X, r);
(1 1 1)
```

<a id="function-rootaction-grppermcox"></a>
#### `RootAction(W): GrpPermCox -> Map`

<a id="function-corootaction-grppermcox"></a>
#### `CorootAction(W): GrpPermCox -> Map`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The map $X\times W \to X$ giving the action of the Coxeter group $W$ on the (co)root space $X$.

<a id="example-ex-1fa494"></a>
#### `Example: Coroot Action (ex-1fa494)`

```magma
> W := CoxeterGroup("B3");
> act := CorootAction(W);
> act([1,-2,1], W.1);
(-1 -1  1)
```

<a id="function-reflectiongroup-grppermcox-2"></a>
#### `ReflectionGroup(W): GrpPermCox -> GrpMat, Map`

<a id="function-coreflectiongroup-grppermcox"></a>
#### `CoreflectionGroup(W): GrpPermCox -> GrpMat, Map`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The Coxeter group $W$ as a real reflection group (ie. as a matrix group over some subfield of **R**) acting on the (co)root space, and the isomorphism from $W$ to the (co)reflection group.

<a id="example-ex-2596af"></a>
#### `Example: Reflection Group of a Coxeter Group (ex-2596af)`

```magma
> W := CoxeterGroup("B3");
> _, h := ReflectionGroup(W);
> W.1*W.3;
(1, 10)(2, 8)(3, 12)(4, 7)(5, 6)(11, 17)(13, 16)(14, 15)
> h(W.1*W.3);
[-1  0  0]
[ 1  1  2]
[ 0  0 -1]
```

### Standard Action

Every finite Coxeter group $W$ has a standard action. For example, the standard action group of a Coxeter group of type $A_n$ is the symmetric group of degree $n+1$ acting on $\{1,\dots,n\}$.

<a id="function-standardaction-grpfpcox"></a>
#### `StandardAction(W): GrpFPCox -> Map`

<a id="function-standardaction-grppermcox"></a>
#### `StandardAction(W): GrpPermCox -> Map`

The standard action of the finite Coxeter group $W$.

<a id="function-standardactiongroup-grpfpcox"></a>
#### `StandardActionGroup(W): GrpFPCox -> GrpPerm, Map`

<a id="function-intrstandardactiongroup"></a>
#### `StandardActionGroup(W): GrpPermCox -> GrpPerm, Map`

The group $G$ of the standard action of the finite Coxeter group $W$, together with an isomorphism $W\to G$.

<a id="example-ex-eff773"></a>
#### `Example: Standard Action of a Coxeter Group (ex-eff773)`

```magma
> W := CoxeterGroup("A3");
> G, h := StandardActionGroup(W);
> IsSymmetric(G);
true
> h(W.1); h(W.2); h(W.3);
(1, 2)
(2, 3)
(3, 4)
```

<a id="group-braid"></a>
<a id="sectgrpfpcoxbraid"></a>
<a id="sectgrpcoxbraid"></a>
### Braid Groups

<a id="function-braidgroup-grpfpcox"></a>
#### `BraidGroup(W): GrpFPCox -> GrpFP, Map`

The braid group $B$ of the Coxeter group $W$ as a finitely presented group, together with the natural map $W\to B$. Words in the braid group are not automatically normalised. However, the braid group of type $A_n$ with normalisation can be constructed with the command `BraidGroup(n+1)` (see Chapter [Braid Groups](https://docs.magma-maths.org/FinitelyPresentedGroups/BraidGroups/index-braid-groups.md#chapgrpbrd)).

<a id="function-purebraidgroup-grpfpcox"></a>
#### `PureBraidGroup(W): GrpFPCox -> GrpFP, Map`

Returns the pure braid group of the Coxeter group $W$, ie. the kernel of the epimorphism from the braid group of $W$ to $W$. Words in the pure braid group are not automatically normalised.

<a id="example-ex-a9e54b"></a>
#### `Example: Braid Group of a Coxeter Group (ex-a9e54b)`

```magma
> W<a,b,c> := CoxeterGroup(GrpFPCox, "B3");
> W;
Coxeter group: Finitely presented group on 3 generators
Relations
    a * b * a = b * a * b
    a * c = c * a
    (b * c)^2 = (c * b)^2
    a^2 = Id($)
    b^2 = Id($)
    c^2 = Id($)
> B<x,y,z> := BraidGroup(W);
> B;
Finitely presented group B on 3 generators
Relations
    x * y * x = y * x * y
    x * z = z * x
    (y * z)^2 = (z * y)^2
> P := PureBraidGroup(W);
> P;
Finitely presented group P on 3 generators
Generators as words in group B
    P.1 = x^2
    P.2 = y^2
    P.3 = z^2
```

<a id="group-wgraphs"></a>
<a id="sectgrpfpcoxwgraph"></a>
### $W$-graphs

Given a Coxeter system $(W,S)$, a $W$-graph is a (directed or undirected) graph with vertex labels and edge weights. The label attached to a vertex $v$ is a subset of $S$ (called the *descent set* of $v$) and the edge weights are scalars (usually integers).

A $W$-graph must determine a representation of the Hecke algebra $H = H\langle q\rangle$ of the associated Coxeter system. The vertices of the $W$-graph can be identified with basis elements of the representation space, and by the conventions adopted here the action of the generator $T_s$ of $H$ associated with an element $s\in S$ on a basis element $v$ is given by

$$
v*T_s = \cases{
    (-q^{-1})*v & if $s$ is in the descent set of $v$,\\
    q*v + \sum' (m*u)&if $s$ is not in the descent set of $v$,\\}
$$

where $\sum'$ indicates the sum over all edges with terminal vertex equal to $v$ for which $s$ is in the descent set of the initial vertex $u$, and $m$ is the weight of the edge.

For the Coxeter group calculations involved in these functions we need to know how the generators $s\in S$ act on the set of elementary roots (see [[Bri98](https://docs.magma-maths.org/references.md#cite-brink98)]).

Magma has a function `ReflectionTable` that provides the necessary information. Specifically, let $W$ be a finitely presented Coxeter group with $N$ elementary roots (numbered from 1 to $N$) and $r$ simple reflections (numbered 1 to $r$). If we define

`eltroots:=ReflectionTable(W);`

then for $i\in \{1, \dots, r\}$ and $j\in \{1, \dots, N\}$, `eltroots[i,j] = k` if the $i$-th simple reflection takes the $j$-th elementary root to the $k$-th elementary root, or to a non-elementary root if $k = 0$, or to a negative root if $k < 0$. (This last alternative occurs if and only if $j = i$ and $k = -i$.) Knowing the table `eltroots` makes it quick and easy to do symbolic computation with elements of $W$, represented as sequences of integers in $\{1, \dots,r\}$ (corresponding to words in $S$).

<a id="procedure-setverbose-monstgelt-rngintelt-wgraph"></a>
#### `SetVerbose("WGraph", v): MonStgElt, RngIntElt`

Set the verbose printing to level $v$ for all $W$-graph related functions. A level of $2$ means that informative messages and progress information will be printed durng a computation.

Sometimes it is convenient to use ‘mij-sequences’ to specify Coxeter groups. The mij-sequence consists of the on or below diagonal entries in the Coxeter matrix. Thus if `seq` is the mij-sequence and $M$ the Coxeter matrix then

`M := SymmetricMatrix(seq);`

and

`seq := &cat[[M[i,j] : j in [1..i]] : i in [1..Rank(W)]];`

<a id="function-mij2eltroottable-seqenum"></a>
#### `Mij2EltRootTable(seq): SeqEnum -> SeqEnum[SeqEnum[RngIntElt]]`

Return the elementary root action table for the Coxeter group defined by the given mij-sequence.

<a id="function-name2mij-monstgelt"></a>
#### `Name2Mij(name): MonStgElt -> SeqEnum`

The mij-sequence of the Coxeter groups of type name.

<a id="example-ex-320506"></a>
#### `Example: Reflection Table from Coxeter Matrix Entries (ex-320506)`

```magma
> e6:=[1,3,1,2,3,1,2,3,2,1,2,2,2,3,1,2,2,3,2,2,1];
> E6 := CoxeterGroup(GrpFPCox, SymmetricMatrix(e6) );
> ReflectionTable(E6) eq Mij2EltRootTable(e6);

true
```

The functions defined in this section are mainly concerned with $W$-graph posets. The motivating example for this concept is the set of all standard tableaux corresponding to a given partition, the partial order being dominance. By definition, if $P$ is a $W$-graph poset then $P$ must be in one-to-one correspondence with a basis for an $H$-module $V$ (where $H$ is the Hecke algebra associated with the given Coxeter system). In the standard tableaux example, this module is the Specht module; hence in the general case we refer to the module $V$ as GSM($P$) (for generalized Specht module). For each $v\in P$ the set $S$ must be the disjoint union of two sets $A(v)$ and $D(v)$, the ascents and descents of $v$. There must be a function $(s,v) \mapsto sv$ from $S \times P$ to $P$ such that the action of $H$ on GSM(P) satisfies the following rules (for all $s \in S$ and $v \in P$):

$$
v*T_s = \cases{
  sv                   &if $sv > v$,\\
  sv + (q-q^{-1})*v    &if $sv < v$,\\
  -q^{-1}*v            &if $sv = v$ and $s\in D(v)$,\\
  q*v + q*\langle\hbox{earlier}\rangle &if $sv = v$ and $s \in A(v)$,\\}
$$

where $\langle$earlier$\rangle$ denotes a linear combination of $\{u \in P \mid u < v\}$ with coefficients that are polynomials in $q$. For each $s \in A(v)$ either $sv = v$ or $sv > v$, and for each $s \in D(v)$ either $sv < v$ or $sv = v$. This (admittedly strange) definition is motivated by the fact that Specht modules satisfy it. If $v$ is a standard tableau corresponding to a partition of $n$ then a number $i$ in $\{1,\dots,n-1\}$ is an ascent of $v$ if $i+1$ is in a later column of $t$ than $i$, and is a descent of $v$ if $i+1$ is in a lower row of $t$ than $i$. The fact that Specht modules satisfy the formulas above is proved in the literature (e.g. Mathas’ book), except that in the “weak ascent” case ($sv = v$ and $s \in A(v)$) it is not proved that the polynomial coefficients of $\{u \in P \mid u < v\}$ are all divisible by $q$. The fact that they are is a theorem of V. M. Nguyen (PhD thesis, University of Sydney, 2010). It turns out that there is an algorithm by which a $W$-graph may be constructed from a $W$-graph poset, the $W$-graph being uniquely determined by the function $(s,v) \mapsto sv$ from $S \times P \to P$ and the descent/ascent sets. The polynomial coefficients in the weak ascent case are not required. Of course the $H$-module determined by the resulting $W$-graph is isomorphic to GSM($P$).

<a id="function-partition2wgtable-seqenum"></a>
#### `Partition2WGtable(pi): SeqEnum -> SeqEnum, GrpFPCox`

Returns the $W$-graph table and the Weyl group for the partition `pi`, where `pi` is a nonincreasing sequence $[a_1,a_2,\dots,a_k]$ of positive integers. It returns the table corresponding to the $W$-graph poset of standard tableaux of the given shape and the finitely presented Coxeter group of type $A_n$, where $n+1 = \sum a_i$.

<a id="function-wgtable2wg-seqenum"></a>
#### `WGtable2WG(table): SeqEnum -> GrphUnd`

Convert a $W$-graph table to a $W$-graph.

<a id="function-testwg-grpfpcox-grphund"></a>
#### `TestWG(W, wg): GrpFPCox, GrphUnd -> .`

<a id="function-testwg-grpfpcox-grphdir"></a>
#### `TestWG(W, wg): GrpFPCox, GrphDir -> .`

<a id="function-testwg-monstgelt-grphdir"></a>
#### `TestWG(tp, wg): MonStgElt, GrphDir -> .`

<a id="function-testwg-monstgelt-grphdir-2"></a>
#### `TestWG(tp, wg): MonStgElt, GrphDir -> .`

This procedure can be used to test whether a presumed undirected or directed $W$-graph is indeed a $W$-graph, where $W$ is a finitely presented Coxeter group of type `tp`. Two input values are required: the Coxeter group $W$ (or its type) and the $W$-graph. When applied to the $W$-graph produced by the `WGtable2WG` function, this tests whether the input table did genuinely correspond to a $W$-graph poset.

For example,

<a id="example-ex-8afb5c"></a>
#### `Example: W-Graph of a Specht Module (ex-8afb5c)`

```magma
> SetVerbose("WGraph",1);
> wtable, W :=Partition2WGtable([4,4,3,1]);
> wg := WGtable2WG(wtable);
> TestWG(W,wg);
```

which should cause the word `true` to be printed 66 times (as the defining relations of the Hecke algebra are checked).

Given a Coxeter system $(W,S)$ and an element $w\in W$, let $P$ be the set $\{x\in W \mid \hbox{length}(wx^{-1}) = \hbox{length}(w) - \hbox{length}(x)\}$, considered as a poset under the Bruhat order on $W$. Given also a subset $J$ of $\{t\in S \mid \hbox{length}(wt) > \hbox{length}(w)\}$, for each $x\in P$ we define $D(x)$ to be union of $\{s\in S \mid \hbox{length}(sx) < \hbox{length}(x)\}$ and $\{s \in S \mid sx = xt \hbox{ for some } t \in J \}$. If $P$ is now a $W$-graph poset with the sets $D(x)$ as the descent sets then we say that $w$ is a $W$-graph determining element relative to $J$.

For example, suppose that $(W,S)$ is of type $A_n$, and given a partition of $n+1$ let $t$ be the (unique) standard tableau whose column group is generated by a subset of $S$. Let $w$ be the maximal length element such that the tableau $wt$ is standard. Then $w$ is a $W$-graph determining element with respect to the set $J$ consisting of those $s \in S$ that are in the column stabilizer of $t$.

Other examples (for any Coxeter system with finite $W$) are provided by the distinguished left coset representatives of maximal length for standard parabolic subgroups $W_K$ (where the set $J$ may be taken to be either $K$ or the empty set).

<a id="function-wgelement2wgtable-grpfpcoxelt-setenum"></a>
#### `WGelement2WGtable(g, K): GrpFPCoxElt, SetEnum -> SeqEnum, SeqEnum`

Returns the $W$-graph table and $W$-graph ideal of a $W$-graph determining element $g$, subset $K$.

<a id="example-ex-0bb421"></a>
#### `Example: W-Graph of Type B5 (ex-0bb421)`

```magma
> b5 := [1,4,1,2,3,1,2,2,3,1,2,2,2,3,1];
> b5mat := SymmetricMatrix(b5);
> W := CoxeterGroup(GrpFPCox, b5mat );
> table, _ := WGelement2WGtable(W![5,4,3,2,1,2,3,4,5],{});
> wg := WGtable2WG(table);
> TestWG(W,wg);

true <1, 2> 4
true <2, 3> 3
true <3, 4> 3
true <4, 5> 3
```

<a id="function-getcells-grphund"></a>
#### `GetCells(wg): GrphUnd -> SeqEnum`

<a id="function-getcells-grphdir"></a>
#### `GetCells(wg): GrphDir -> SeqEnum`

Return the cells of the $W$-graph.

<a id="function-inducewg-grpfpcox-grphund-seqenum"></a>
#### `InduceWG(W, wg, seq): GrpFPCox, GrphUnd, SeqEnum -> GrphUnd`

<a id="function-inducewg-grpfpcox-grphdir-seqenum"></a>
#### `InduceWG(W, wg, seq): GrpFPCox, GrphDir, SeqEnum -> GrphDir`

Induce a $W$-graph from a standard parabolic subgroup.

<a id="function-inducewgtable-seqenum-seqenum-grpfpcox"></a>
#### `InduceWGtable(J, table, W): SeqEnum, SeqEnum, GrpFPCox -> SeqEnum[SeqEnum[RngIntElt]]`

Returns the table of the $W$-graph induced from the table of a parabolic subgroup defined by $J$.

<a id="function-iswgsymmetric-grphdir"></a>
#### `IsWGsymmetric(dwg): GrphDir -> BoolElt, GrphDir`

Test a $W$-graph for symmetry. If the graph is symmetric the second return value is the undirected version of the $W$-graph.

<a id="function-makedirected-grphund"></a>
#### `MakeDirected(uwg): GrphUnd -> GrphDir`

Convert an undirected $W$-graph to a directed $W$-graph.

<a id="function-testheckerep-grpfpcox-seqenum"></a>
#### `TestHeckeRep(W, r): GrpFPCox, SeqEnum -> .`

Tests whether the matrices in r satisfy the defining relations of the Hecke algebra of the Coxeter group $W$.

<a id="function-wg2grouprep-grphund"></a>
#### `WG2GroupRep(wg): GrphUnd -> SeqEnum`

<a id="function-wg2grouprep-grphdir"></a>
#### `WG2GroupRep(wg): GrphDir -> SeqEnum`

The matrix representation of a $W$-graph.

<a id="function-wg2heckerep-grpfpcox-grphund"></a>
#### `WG2HeckeRep(W, wg): GrpFPCox, GrphUnd -> SeqEnum`

<a id="function-wg2heckerep-grpfpcox-grphdir"></a>
#### `WG2HeckeRep(W, wg): GrpFPCox, GrphDir -> SeqEnum`

Returns a sequence of sparse matrices that satisfy the defining relations of the Hecke algebra.

<a id="function-wgidealgens2wgtable-seqenum-setenum"></a>
#### `WGidealgens2WGtable(dgens, K): SeqEnum, SetEnum -> SeqEnum[SeqEnum[RngIntElt]], SetIndx`

Returns the $W$-graph table and $W$-graph ideal of a $W$-graph determining generators dgens and subset $K$.

<a id="example-ex-8bb5d1"></a>
#### `Example: W-Graph Ideal in Type E6 (ex-8bb5d1)`

In type $E_6$ we start with a rank 3 standard parabolic subgroup. The set of minimal coset representatives is a (single-generator) $W$-graph ideal, corresponding to the representation induced from the trivial representation of the parabolic. We compute the $W$-graph and find the cells. The bottom cell is necessarily an ideal in the weak order. It turns out that 3 elements are required to generate it; we can use them to test the function `WGidealgens2WGtable`.

```magma
> mij:=[1,3,1,2,3,1,2,3,2,1,2,2,2,3,1,2,2,3,2,2,1];
> E6 := CoxeterGroup(GrpFPCox, SymmetricMatrix(mij) );
> J := {1,3,5};
> drs := Transversal(E6,J);
> ttt := WGidealgens2WGtable([drs[1398],drs[156],drs[99]],J);
> nwg := WGtable2WG(ttt);
> TestWG(E6,nwg);

true <1, 2> 3
true <2, 3> 3
true <2, 4> 3
true <4, 5> 3
true <3, 6> 3
```

<a id="function-writewg-monstgelt-grphund"></a>
#### `WriteWG(file, uwg): MonStgElt, GrphUnd -> .`

<a id="function-writewg-monstgelt-grphdir"></a>
#### `WriteWG(file, dwg): MonStgElt, GrphDir -> .`

Writes the $W$-graph to a file.

<a id="related"></a>
<a id="sectgrpcoxrelated"></a>
### Related Structures

In this section functions for creating other structures from a permutation Coxeter group are briefly listed. See the appropriate chapters of the Handbook for more details.

<a id="function-coxetergroup-cat-grppermcox"></a>
#### `CoxeterGroup(GrpFP, W): Cat, GrpPermCox -> GrpFPCox`

<a id="function-presentation-grppermcox"></a>
#### `Presentation(W): GrpPermCox -> GrpFPCox`

The finitely presented group isomorphic to the permutation Coxeter group $W$. See Chapter [Finitely Presented Groups](https://docs.magma-maths.org/FinitelyPresentedGroups/FPGroups/index-fpgroups.md#chapgrpfp).

<a id="function-reflectiongroup-grppermcox-3"></a>
#### `ReflectionGroup(W): GrpPermCox -> GrpMat`

<a id="function-coxetergroup-cat-grppermcox-2"></a>
#### `CoxeterGroup(GrpMat, W): Cat, GrpPermCox -> GrpFPCox`

The reflection group isomorphic to the Coxeter group $W$. See Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-liealgebra-grppermcox-rng"></a>
#### `LieAlgebra(W, R): GrpPermCox, Rng -> AlgLie`

The reductive Lie algebra over the ring $R$ with Weyl group $W$. If $W$ is noncrystallographic, an error is flagged. See Section [Almost Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalglieconstrred).

<a id="function-groupoflietype-grppermcox-rng"></a>
#### `GroupOfLieType(W, R): GrpPermCox, Rng -> GrpLie`

The group of Lie type over the ring $R$ with Weyl group $W$. The roots and coroots of $W$ must have integral components. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="fiurg"></a>
<a id="chapgrprfl"></a>
## Reflection Groups

- [Introduction](https://docs.magma-maths.org/LieTheory/ReflectionGroups/introduction.md)
- [Construction of Pseudo-reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md)
  - [`PseudoReflection(a, b): ModTupRngElt, ModTupRngElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-pseudoreflection-modtuprngelt-modtuprngelt)
  - [`Transvection(a, b): ModTupRngElt, ModTupRngElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-transvection-modtuprngelt-modtuprngelt)
  - [`Reflection(a, b): ModTupRngElt, ModTupRngElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-reflection-modtuprngelt-modtuprngelt)
  - [`IsPseudoReflection(r): Mtrx → BoolElt, ModTupRngElt, ModTupRngElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-ispseudoreflection-mtrx)
  - [`IsTransvection(r): Mtrx → BoolElt, ModTupRngElt, ModTupRngElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-istransvection-mtrx)
  - [`IsReflection(r): Mtrx → BoolElt, ModTupRngElt, ModTupRngElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-isreflection-mtrx)
  - [`IsReflectionGroup(G): GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-isreflectiongroup-grpmat)
  - [Example: Creating a Pseudo-reflection](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#example-ex-0f9614)
  - [Example: Group Generated by Reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#example-ex-077df3)
  - [Example: Special Linear Groups Generated by Transvections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#example-ex-d1b70e)
  - [Pseudo-reflections Preserving Reflexive Forms](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#pseudo-reflections-preserving-reflexive-forms)
    - [`SymplecticTransvection(a, alpha): ModTupRngElt, FldElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-symplectictransvection-modtuprngelt-fldelt)
    - [`UnitaryTransvection(a, alpha): ModTupRngElt, FldElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-unitarytransvection-modtuprngelt-fldelt)
    - [`UnitaryReflection(a, zeta): ModTupRngElt, FldElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-unitaryreflection-modtuprngelt-fldelt)
    - [`OrthogonalReflection(a): ModTupFldElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#function-orthogonalreflection-modtupfldelt)
    - [Example: Unitary Transvections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/reflections.md#example-ex-0b2ca4)
- [Construction of Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl.md)
  - [`PseudoReflectionGroup(A, B): Mtrx, Mtrx → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl.md#function-pseudoreflectiongroup-mtrx-mtrx)
  - [Example: Reflection Group from Given Roots and Coroots](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl.md#example-ex-a4b952)
- [Construction of Real Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md)
  - [`ReflectionGroup(M): AlgMatElt → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-algmatelt)
  - [`ReflectionGroup(G): GrphUnd → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-grphund)
  - [`ReflectionGroup(C): AlgMatElt → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-algmatelt-2)
  - [`ReflectionGroup(D): GrphDir → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-grphdir)
  - [`ReflectionGroup(N): MonStgElt → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-monstgelt)
  - [`IrreducibleReflectionGroup(X, n): MonStgElt, RngIntElt → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-irreduciblereflectiongroup-monstgelt-rngintelt)
  - [Example: Real Reflection Group from a Cartan Matrix](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#example-ex-5faa0c)
  - [`ReflectionGroup(R): RootSys → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-rootsys)
  - [`ReflectionGroup(R): RootDtm → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-rootdtm)
  - [Example: Real Reflection Group from a Root Datum](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#example-ex-36ff3b)
  - [`ReflectionGroup(W): GrpFPCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-grpfpcox)
  - [`ReflectionGroup(W): GrpPermCox → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#function-reflectiongroup-grppermcox)
  - [Example: Converting Between Coxeter Group Types](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#example-ex-3ea794)
- [Construction of Finite Complex Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md)
  - [`ShephardTodd(n): RngIntElt → GrpMat, Fld`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-shephardtodd-rngintelt)
  - [Example: Identifying the Complex Reflection Group G24](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-93aefa)
  - [`ComplexReflectionGroup(C): Mtrx → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexreflectiongroup-mtrx)
  - [`ComplexReflectionGroup(X, n): MonStgElt, RngIntElt → GrpMat, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexreflectiongroup-monstgelt-rngintelt)
  - [Example: Reflection Subgroups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-ccc605)
  - [`ShephardTodd(m, p, n): RngIntElt, RngIntElt, RngIntElt → GrpMat, Fld`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-shephardtodd-rngintelt-rngintelt-rngintelt)
  - [`ImprimitiveReflectionGroup(m, p, n): RngIntElt, RngIntElt, RngIntElt → GrpMat, Fld`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-imprimitivereflectiongroup-rngintelt-rngintelt-rngintelt)
  - [Example: Imprimitive Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-980a12)
  - [`ComplexRootMatrices(k): RngIntElt → AlgMatElt, AlgMatElt, AlgMatElt, RngElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexrootmatrices-rngintelt)
  - [`ComplexRootMatrices(m, p, n): RngIntElt, RngIntElt, RngIntElt → AlgMatElt, AlgMatElt, AlgMatElt, RngElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexrootmatrices-rngintelt-rngintelt-rngintelt)
  - [Example: Complex Reflection Group from Root Matrices](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-f3139e)
  - [`ComplexCartanMatrix(k): RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexcartanmatrix-rngintelt)
  - [`ComplexCartanMatrix(m, p, n): RngIntElt, RngIntElt, RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexcartanmatrix-rngintelt-rngintelt-rngintelt)
  - [`BasicRootMatrices(C): Mtrx → AlgMatElt, AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-basicrootmatrices-mtrx)
  - [`CohenCoxeterName(k): RngIntElt → MonStgElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-cohencoxetername-rngintelt)
  - [`ShephardToddNumber(X, n): MonStgElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-shephardtoddnumber-monstgelt-rngintelt)
  - [Example: Converting Reflection Group Names](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-8535df)
  - [Example: Constructing a Reflection Group from Its Name](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#example-ex-fe8c89)
  - [`ComplexRootDatum(k): RngIntElt → SeqEnum, SeqEnum, Map, GrpMat, AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexrootdatum-rngintelt)
  - [`ComplexRootDatum(m, p, n): RngIntElt, RngIntElt, RngIntElt → SeqEnum, SeqEnum, Map, GrpMat, AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#function-complexrootdatum-rngintelt-rngintelt-rngintelt)
- [Operations on Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md)
  - [`IsCoxeterIsomorphic(W1, W2): GrpMat, GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-iscoxeterisomorphic-grpmat-grpmat)
  - [`IsCartanEquivalent(W1, W2): GrpMat, GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-iscartanequivalent-grpmat-grpmat)
  - [Example: Coxeter Isomorphism and Cartan Equivalence](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-ce63f7)
  - [`CartanName(W): GrpMat → List`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-cartanname-grpmat)
  - [`CoxeterDiagram(W): GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#procedure-coxeterdiagram-grpmat)
  - [`DynkinDiagram(W): GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#procedure-dynkindiagram-grpmat)
  - [Example: Cartan Name and Coxeter Diagram](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-0c1a24)
  - [`RootSystem(W): GrpMat → RootDtm`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-rootsystem-grpmat)
  - [`RootDatum(W): GrpMat → RootDtm`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-rootdatum-grpmat)
  - [`CoxeterMatrix(W): GrpMat → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-coxetermatrix-grpmat)
  - [`CoxeterGraph(W): GrpMat → GrphUnd`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-coxetergraph-grpmat)
  - [`CartanMatrix(W): GrpMat → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-cartanmatrix-grpmat)
  - [`DynkinDigraph(W): GrpMat → GrphDir`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-dynkindigraph-grpmat)
  - [`Rank(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-rank-grpmat)
  - [`NumberOfGenerators(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-numberofgenerators-grpmat)
  - [Example: Rank and Dimension](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-6d4455)
  - [`FundamentalGroup(W): GrpMat → GrpAb`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-fundamentalgroup-grpmat)
  - [`IsogenyGroup(W): GrpMat → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-isogenygroup-grpmat)
  - [`CoisogenyGroup(W): GrpMat → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-coisogenygroup-grpmat)
  - [`BasicDegrees(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-basicdegrees-grpmat)
  - [`BasicCodegrees(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-basiccodegrees-grpmat)
  - [Example: Basic Degrees](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-9828d5)
  - [`LongestElement(W): GrpMat → SeqEnum`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-longestelement-grpmat)
  - [`CoxeterElement(W): GrpMat → SeqEnum`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-coxeterelement-grpmat)
  - [`CoxeterNumber(W): GrpMat → SeqEnum`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-coxeternumber-grpmat)
  - [Example: Longest and Coxeter Elements](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-ae7bca)
  - [`LeftDescentSet(W, w): GrpMat, GrpMatElt → SetEnum`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-leftdescentset-grpmat-grpmatelt)
  - [`RightDescentSet(W, w): GrpMat, GrpMatElt → SetEnum`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#function-rightdescentset-grpmat-grpmatelt)
  - [Example: Left and Right Descent Sets](https://docs.magma-maths.org/LieTheory/ReflectionGroups/operations.md#example-ex-609f66)
- [Properties of Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md)
  - [`IsReflectionGroup(G): GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-isreflectiongroup-grpmat-2)
  - [`RootsAndCoroots(G): GrpMat → [RngIntElt], [ModTupRngElt], [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-rootsandcoroots-grpmat)
  - [`IsRealReflectionGroup(G): GrpMat → BoolElt, [], []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-isrealreflectiongroup-grpmat)
  - [Example: Testing for a Reflection Group](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#example-ex-db9a68)
  - [`IsCrystallographic(W): GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-iscrystallographic-grpmat)
  - [`IsSimplyLaced(W): GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-issimplylaced-grpmat)
  - [Example: Properties of an Infinite Reflection Group](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#example-ex-d36942)
  - [`Dual(G): GrpMat → BoolElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-dual-grpmat)
  - [`Overgroup(H): GrpMat → GrpMat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-overgroup-grpmat)
  - [`Overdatum(H): GrpMat → RootDtm`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-overdatum-grpmat)
  - [`StandardAction(W): GrpMat → Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-standardaction-grpmat)
  - [`StandardActionGroup(W): GrpMat → GrpPerm, Map`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/properties.md#function-standardactiongroup-grpmat)
- [Roots, Coroots, and Reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md)
  - [Accessing Roots and Coroots](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#accessing-roots-and-coroots)
    - [`RootSpace(W): GrpMat → Lat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-rootspace-grpmat)
    - [`CorootSpace(W): GrpMat → Lat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-corootspace-grpmat)
    - [Example: Root Space of a Complex Reflection Group](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#example-ex-16412e)
    - [`SimpleOrders(W): GrpMat → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simpleorders-grpmat)
    - [`SimpleRoots(W): GrpMat → Mtrx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simpleroots-grpmat)
    - [`SimpleCoroots(W): GrpMat → Mtrx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simplecoroots-grpmat)
    - [`NumberOfPositiveRoots(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-numberofpositiveroots-grpmat)
    - [`NumPosRoots(W): GrpMat → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-numposroots-grpmat)
    - [`Roots(W): GrpMat → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-roots-grpmat)
    - [`Coroots(W): GrpMat → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coroots-grpmat)
    - [`PositiveRoots(W): GrpMat → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-positiveroots-grpmat)
    - [`PositiveCoroots(W): GrpMat → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-positivecoroots-grpmat)
    - [`Root(W, r): GrpMat, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-root-grpmat-rngintelt)
    - [`Coroot(W, r): GrpMat, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coroot-grpmat-rngintelt)
    - [`RootPosition(W, v): GrpMat, . → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-rootposition-grpmat)
    - [`CorootPosition(W, v): GrpMat, . → SetIndx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-corootposition-grpmat)
    - [Example: Roots and Coroots of a Reflection Group](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#example-ex-194100)
  - [Reflections](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#reflections)
    - [`ReflectionMatrices(W): GrpMat → [AlgMatElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionmatrices-grpmat)
    - [`CoreflectionMatrices(W): GrpMat → [AlgMatElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coreflectionmatrices-grpmat)
    - [`SimpleReflectionMatrices(W): GrpMat → [AlgMatElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simplereflectionmatrices-grpmat)
    - [`SimpleCoreflectionMatrices(W): GrpMat → [AlgMatElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simplecoreflectionmatrices-grpmat)
    - [`ReflectionMatrix(W, r): GrpMat, RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionmatrix-grpmat-rngintelt)
    - [`CoreflectionMatrix(W, r): GrpMat, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coreflectionmatrix-grpmat-rngintelt)
    - [`SimpleReflectionPermutations(W): GrpMat → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-simplereflectionpermutations-grpmat)
    - [`ReflectionPermutations(W): GrpMat → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionpermutations-grpmat)
    - [`ReflectionPermutation(W, r): GrpMat, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionpermutation-grpmat-rngintelt)
    - [`ReflectionWords(W): GrpMat → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionwords-grpmat)
    - [`ReflectionWord(W, r): GrpMat, RngIntElt → []`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-reflectionword-grpmat-rngintelt)
    - [Example: Reflection Matrices and Permutations](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#example-ex-a49ddd)
    - [`Length(w): GrpMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-length-grpmatelt)
    - [`CoxeterLength(w): GrpMatElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coxeterlength-grpmatelt)
  - [Weights](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#weights)
    - [`WeightLattice(W): GrpMat → Lat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-weightlattice-grpmat)
    - [`CoweightLattice(W): GrpMat → Lat`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-coweightlattice-grpmat)
    - [`FundamentalWeights(W): GrpMat → Mtrx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-fundamentalweights-grpmat)
    - [`FundamentalCoweights(W): GrpMat → Mtrx`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-fundamentalcoweights-grpmat)
    - [Example: Weight Lattice of a Reflection Group](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#example-ex-843e25)
    - [`IsDominant(R, v): RootDtm, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-isdominant-rootdtm)
    - [`DominantWeight(W, v): GrpMat, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-dominantweight-grpmat)
    - [`WeightOrbit(W, v): GrpMat, . → {@ ModTupFldElt @}, [GrpFPCoxElt]`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#function-weightorbit-grpmat)
    - [Example: Dominant Weights and Weight Orbits](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#example-ex-a17dda)
- [Related Structures](https://docs.magma-maths.org/LieTheory/ReflectionGroups/related.md)
  - [`CoxeterGroup(GrpFPCox, W): Cat, GrpMat → GrpPermCox`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/related.md#function-coxetergroup-cat-grpmat)
  - [`CoxeterGroup(GrpPermCox, W): Cat, GrpMat → GrpPermCox`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/related.md#function-coxetergroup-cat-grpmat-2)
  - [`LieAlgebra(W, R): GrpMat, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/related.md#function-liealgebra-grpmat-rng)
  - [`GroupOfLieType(W, k): GrpMat, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ReflectionGroups/related.md#function-groupoflietype-grpmat-rng)
- [Bibliography](https://docs.magma-maths.org/LieTheory/ReflectionGroups/bibliography.md)

<a id="sectgrprfllintro"></a>
<a id="id1"></a>
### Introduction

A reflection is a diagonalisable linear transformation of finite order whose space of fixed points is a hyperplane. A reflection group is a finite dimensional linear group over a field $F$, which is generated by a finite number of reflections.

There are no restrictions on the field $F$ and there is no requirement for a reflection to be a transformation of order two. However, if $F$ is a real field, every reflection does have order two and there is a much richer theory. In particular, every Coxeter group is a real reflection group (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)).

The books [[LT09](https://docs.magma-maths.org/references.md#cite-lehrertaylor)], [[Bro10](https://docs.magma-maths.org/references.md#cite-broue)], or [[Kan01](https://docs.magma-maths.org/references.md#cite-kanerefl)] are useful references for complex reflection groups. Standard references for the theory of real reflection groups include [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)] (Chapters 4, 5, 6) and [[Hum90](https://docs.magma-maths.org/references.md#cite-humphreysrefl)].

<a id="reflections"></a>
<a id="sectrefgrprfl"></a>
### Construction of Pseudo-reflections

Let $V$ be a vector space of dimension $n$ over a field $F$. As defined in Bourbaki [[Bou68](https://docs.magma-maths.org/references.md#cite-bourbakilie)], a *pseudo-reflection* in Magma is a linear transformation of $V$ whose space of fixed points is a subspace of dimension $n-1$, namely a hyperplane. (Some authors require a pseudo-reflection to be invertible and diagonalisable.)

A reflection, as defined above, is a pseudo-reflection and so too is a transvection. The Magma package described in this chapter includes code for the construction of transvections but the emphasis is on groups generated by reflections.

If $r$ is a pseudo-reflection, then $\dim(\mathop {\rm im}(1-r)) = 1$ and a basis element of $\mathop {\rm im}(1-r)$ is called a *root* of $r$.

Let $a$ be a root of the pseudo-reflection $r$ and let $H = \ker(1-r)$ be the hyperplane of fixed points of $r$. For all $v\in V$ there exists $\phi(v) \in F$ such that $v - vr = \phi(v)a$. Then $\phi\in V^*$ and $\ker\phi = H$. This means that every pseudo-reflection has the form

$$
vr = v - \phi(v)a
$$

and its determinant is $1-\phi(a)$. The linear functional $\phi$ is a *coroot* of $r$.

- If $\phi(a) = 1$, then $r$ is not invertible; it is the *projection* of $V$ onto $H$ along $a$.
- If $\phi(a) = 0$ (equivalently, $a\in H$), then $r$ is by definition a *transvection*.
- If $\phi(a) \ne 0,1$, then $r$ is called a *reflection*. For the most part we consider only reflections of finite order, but not necessarily of order two.

In Magma both $V$ and its dual space $V^*$ are identified with the space $F^n$ of row vectors of length $n$ and the standard bilinear pairing between $V$ and $V^*$ is $(a,b) \mapsto ab^\mathrm{tr}$, where $b^\mathrm{tr}$ denotes the column vector which is the *transpose* of $b$.

The row vector $b$ which represents the coroot $\phi$ is also called a *coroot* of the pseudo-reflection; it is uniquely determined by $r$ and $a$. The matrix of $r$ is

$$
I - b^\mathrm{tr}a
$$

and, in particular, $ar = (1-ab^\mathrm{tr})a$. Thus $r$ is a reflection of finite order $d$ if and only if $ab^\mathrm{tr}\ne 0, 1$ and $1-ab^\mathrm{tr}$ is a $d$-th root of unity.

<a id="function-pseudoreflection-modtuprngelt-modtuprngelt"></a>
#### `PseudoReflection(a, b): ModTupRngElt, ModTupRngElt -> AlgMatElt`

The matrix of the pseudo-reflection with root $a$ and coroot $b$.

<a id="function-transvection-modtuprngelt-modtuprngelt"></a>
#### `Transvection(a, b): ModTupRngElt, ModTupRngElt -> AlgMatElt`

The matrix of the transvection with root $a$ and coroot $b$. The input is checked to ensure that the root and coroot define a transvection.

<a id="function-reflection-modtuprngelt-modtuprngelt"></a>
#### `Reflection(a, b): ModTupRngElt, ModTupRngElt -> AlgMatElt`

The matrix of the reflection with root $a$ and coroot $b$. The input is checked to ensure that the root and coroot define a reflection.

<a id="function-ispseudoreflection-mtrx"></a>
#### `IsPseudoReflection(r): Mtrx -> BoolElt, ModTupRngElt, ModTupRngElt`

Returns `true` if $r$ is the matrix of a pseudo-reflection, in which case a root and a coroot are returned as well.

<a id="function-istransvection-mtrx"></a>
#### `IsTransvection(r): Mtrx -> BoolElt, ModTupRngElt, ModTupRngElt`

Returns `true` if $r$ is the matrix of a transvection, in which case a root and a coroot are returned as well.

<a id="function-isreflection-mtrx"></a>
#### `IsReflection(r): Mtrx -> BoolElt, ModTupRngElt, ModTupRngElt`

Returns `true` if $r$ is the matrix of a reflection, in which case a root and a coroot are returned as well.

<a id="function-isreflectiongroup-grpmat"></a>
#### `IsReflectionGroup(G): GrpMat -> BoolElt`

```magma
Strict: BoolElt                    Default: true
```

The default action is to return `true` if every generator of $G$ is a reflection. If `Strict` is `false`, the function checks if $G$ can be generated by *some* of its reflections, not necessarily those returned by `Generators(G)`.

<a id="example-ex-0f9614"></a>
#### `Example: Creating a Pseudo-reflection (ex-0f9614)`

Create a pseudo-reflection directly and then check that it is a transvection.

```magma
> V := VectorSpace(GF(5), 3);
> t := PseudoReflection(V![1,0,0],V![0,1,0]);
> t;
[1 0 0]
[4 1 0]
[0 0 1]
> IsTransvection(t);
true (1 0 0)
(0 1 0)
> IsReflection(t);
false
```

<a id="example-ex-077df3"></a>
#### `Example: Group Generated by Reflections (ex-077df3)`

An example of a group which can be generated by reflections even though not every given generator is a reflection.

```magma
> F<omega> := CyclotomicField(3);
> r := Matrix(F,2,2,[1,omega^2,0,omega]);
> IsReflection(r);
true (         0 -omega + 1)
(1/3*(2*omega + 1)                 1)
> s := Matrix(F,2,2,[0,-1,1,0]);
> IsReflection(s);
false
> G := MatrixGroup<2,F | r,s >;
> IsReflectionGroup(G);
false
> IsReflectionGroup(G : Strict := false);
true
> #G;
24
```

To find reflection generators for this group we look for a reflection which, together with the reflection $r$, generates $G$. (This is a rather special example; not every finite reflection group of rank two can be generated by two reflections.)

```magma
> exists(t){ t : t in G | IsReflection(t) and G eq sub<G|r,t> };
true
> t;
[        0 omega + 1]
[        1    -omega]
```

<a id="example-ex-d1b70e"></a>
#### `Example: Special Linear Groups Generated by Transvections (ex-d1b70e)`

The groups ${\operatorname{SL}}(n,q)$ are generated by transvections. To illustrate this we find representatives for the conjugacy classes of ${\operatorname{GL}}(3,25)$ which are transvections and then check that the normal closure is ${\operatorname{SL}}(3,25)$.

```magma
> G := GL(3,25);
> ccl := Classes(G);
> T := [ c : c in ccl | IsTransvection(c[3]) ];
> #T;
1
> t := T[1][3]; t;
[     1      0      0]
[     0      1      1]
[     0      0      1]
> S := ncl< G | t >;
> S eq SL(3,25);
true
```

<a id="reflections-forms"></a>
<a id="subsectgrprflforms"></a>
#### Pseudo-reflections Preserving Reflexive Forms

Let $J$ be the matrix of a non-degenerate reflexive bilinear or sesquilinear form $\beta$ on the vector space $V$ over a field $F$. Then $\beta$ is either a symmetric, alternating, or hermitian form.

We may assume that $F$ is equipped with an automorphism $\sigma$ such that $\sigma^2 = 1$. If $\beta$ is a symmetric or alternating form, $\sigma$ is the identity; if $\beta$ is hermitian, the order of $\sigma :\alpha \mapsto \bar\alpha$ is two and $J = \bar J^\mathrm{tr}$. If $a$ is the row vector $(\alpha_1,\alpha_2,\dots,\alpha_n)$, define $\sigma(a) = (\sigma(\alpha_1),\sigma(\alpha_2),\dots,\sigma(\alpha_n))$.

If $a$ is a root of a pseudo-reflection $r$ and if $r$ preserves $\beta$, then the coroot of $r$ is $\alpha \sigma(a) J^\mathrm{tr}$ for some $\alpha\in F$. Thus the matrix of $r$ is $I-\alpha J^\mathrm{tr}\sigma(a)^\mathrm{tr}a$.

<a id="function-symplectictransvection-modtuprngelt-fldelt"></a>
##### `SymplecticTransvection(a, alpha): ModTupRngElt, FldElt -> AlgMatElt`

The symplectic transvection with root $a$ and multiplier $\alpha$ with respect to the form attached to the parent of $a$. If the form is not alternating a runtime error is generated.

If $\beta$ is a non-degenerate alternating form preserved by a pseudo-reflection $r$, then the dimension of $V$ is even and $r$ must be a transvection. If $a$ is a root of $r$, the coroot is $\alpha aJ^\mathrm{tr}$ and the matrix of $r$ is $I - \alpha J a^\mathrm{tr}a$, for some $\alpha\ne 0$ in $F$.

<a id="function-unitarytransvection-modtuprngelt-fldelt"></a>
##### `UnitaryTransvection(a, alpha): ModTupRngElt, FldElt -> AlgMatElt`

The unitary transvection with root $a$ and multiplier $\alpha$ with respect to the hermitian form attached to the parent of $a$.

The matrix of the unitary transvection is $I - \alpha J\bar a^\mathrm{tr}a$, where $a$ is isotropic and the trace of $\alpha$ is $0$; that is, $a J \bar a^\mathrm{tr}= 0$ and $\alpha + \bar\alpha = 0$.

A runtime error is generated if the form is not hermitian, if $a$ is not isotropic, or if the trace of $\alpha$ is not $0$.

<a id="function-unitaryreflection-modtuprngelt-fldelt"></a>
##### `UnitaryReflection(a, zeta): ModTupRngElt, FldElt -> AlgMatElt`

The unitary reflection with root $a$ and determinant $\zeta$, where $\zeta$ is a root of unity. The reflection preserves the hermitian form attached to the ambient space of $a$ and sends $a$ to $\zeta a$.

In the case of a unitary reflection $r$ with matrix $I-\alpha J^\mathrm{tr}\sigma(a)^\mathrm{tr}a$, the root $a$ must be non-isotropic and $ar = \zeta a$, where $\zeta$ is a root of unity. Therefore, $\alpha = (1-\zeta)/aJ\bar a^\mathrm{tr}$.

The vector $a^\vee = \bar\alpha a$ is the *coroot* of $a$ and the definition of $r$ becomes

$$
v r = v - \beta(v,a^\vee)a.
$$

<a id="function-orthogonalreflection-modtupfldelt"></a>
##### `OrthogonalReflection(a): ModTupFldElt -> AlgMatElt`

The reflection determined by a non-singular vector $a$ of a quadratic space.

A *quadratic space* is a vector space $V$ equipped with a quadratic form $Q$ (see Chapter [Clifford Algebras](https://docs.magma-maths.org/Algebras/CliffordAlgebras/index-clifford-algebras.md#algclff) for more details). The *polar form* of $Q$ is the symmetric bilinear form $\beta(u,v) = Q(u+v)-Q(u)-Q(v)$. Thus $\beta(v,v) = 2Q(v)$ and therefore, if the characteristic of $F$ is not two, $Q$ is uniquely determined by $\beta$.

If $a$ is non-singular (that is, $Q(a) \ne 0$), the formula

$$
vr = v - Q(a)^{-1}\beta(v,a)a
$$

defines a pseudo-reflection. If the characteristic of $F$ is 2, this is a transvection; in all other cases it is a reflection. However, in characteristic 2 there is a certain ambivalence in the literature and the pseudo-reflections just defined are often called reflections.

The *coroot* of $a$ is $a^\vee = Q(a)^{-1}a$. If the characteristic of $F$ is not two, then $a^\vee = 2a/\beta(a,a)$ and this coincides with the usual notion of coroot, as found in [[Hum90](https://docs.magma-maths.org/references.md#cite-humphreysrefl)], for example. In particular, if $\beta(u,v)$ is the standard inner product $(u,v) = uv^\mathrm{tr}$, then the inner product and the pairing between $V$ and its dual are essentially the same and the concepts of coroot and coroot coincide.

<a id="example-ex-0b2ca4"></a>
##### `Example: Unitary Transvections (ex-0b2ca4)`

We create an hermitian space by attaching an hermitian form $J$ to a vector space $V$ over a field with complex conjugation. The vector $a = (1,0,0,0)$ is isotropic with respect to this form and therefore we can use it to create a unitary transvection.

```magma
> K<i> := CyclotomicField( 4 );
> sigma := hom< K -> K | x :-> ComplexConjugate(x) >;
> J := Matrix(4,4,[K|0,0,0,1, 0,0,1,0, 0,1,0,0, 1,0,0,0]);
> V := UnitarySpace(J,sigma);
> a := V![1,0,0,0];
> t := UnitaryTransvection(a,i);
> t;
[ 1  0  0  0]
[ 0  1  0  0]
[ 0  0  1  0]
[-i  0  0  1]
```

Continuing the previous example we note that $b = (1,1,1,1)$ is non-isotropic and we create a unitary reflection of order 4 with $b$ as root.

```magma
> b := V![1,1,1,1];
> InnerProduct(b,b);
4
> r := UnitaryReflection(b,i);
> r, Eigenvalues(r);
[1/4*(i + 3) 1/4*(i - 1) 1/4*(i - 1) 1/4*(i - 1)]
[1/4*(i - 1) 1/4*(i + 3) 1/4*(i - 1) 1/4*(i - 1)]
[1/4*(i - 1) 1/4*(i - 1) 1/4*(i + 3) 1/4*(i - 1)]
[1/4*(i - 1) 1/4*(i - 1) 1/4*(i - 1) 1/4*(i + 3)]
{
    <i, 1>,
    <1, 3>
}
```

<a id="create-group-refl"></a>
<a id="subsectgrprflgrprflconstr"></a>
### Construction of Reflection Groups

In Magma a *pseudo-reflection group* is a group generated by a finite set of invertible pseudo-reflections. A convenient way to provide the generators for a pseudo-reflection group $W$ is via a finite collection of roots and coroots. In this context the roots and coroots of the generators are called the *basic roots* and *basic coroots* of $W$.

In the most general case, even when the pseudo-reflection group $W$ is generated by reflections, there are no known distinguished generating reflections whose roots have properties analogous to simple roots in Weyl groups or Coxeter groups. Therefore, one should be careful to distinguish between the basic roots as defined here and the simple (or fundamental) roots of real reflection groups

See Section [Construction of Real Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-real.md#sectgrprflgrprflconstr) for the construction of real reflection groups and Section [Construction of Finite Complex Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/create-group-refl-complex.md#sectgrprflcomp) for the construction of finite complex reflection groups.

<a id="function-pseudoreflectiongroup-mtrx-mtrx"></a>
#### `PseudoReflectionGroup(A, B): Mtrx, Mtrx -> GrpMat, Map`

The pseudo-reflection group with the basic roots and corresponding coroots given by the rows of the matrices $A$ and $B$.

<a id="example-ex-a4b952"></a>
#### `Example: Reflection Group from Given Roots and Coroots (ex-a4b952)`

A direct construction of the Shephard and Todd group $G(14,1,2)$ with user supplied roots and coroots.

```magma
> F<z> := CyclotomicField(7);
> A := Matrix(F,2,3,[[z,0,1],[0,1,0]]);
> B := Matrix(F,2,3,[[1,1,1],[1,2,1]]);
> G<x,y> := PseudoReflectionGroup(A,B);
> IsReflectionGroup(G);
true
> Order(x),Order(y),Order(x*y);
14 2 28
> #G;
392
```

<a id="create-group-refl-real"></a>
<a id="sectgrprflgrprflconstr"></a>
### Construction of Real Reflection Groups

The only root of unity in the real field is $-1$, hence every pseudoreflection over the real field is a reflection. We call a reflection group *real* if it is defined over the reals and its simple roots and simple coroots are linearly independent. We allow real reflection groups to be defined as matrix groups over the integer ring (Chapter [Ring of Integers](https://docs.magma-maths.org/BasicRings/Integers/index-integers.md#rngint)), the rational field (Chapter [Rational Field](https://docs.magma-maths.org/BasicRings/Rationals/index-rationals.md#fldrat)), number fields (Chapter [Number Fields](https://docs.magma-maths.org/GlobalFields/NumberFields/index-number-fields.md#fldnum-main)), and cyclotomic fields (Chapter [Cyclotomic Fields](https://docs.magma-maths.org/GlobalFields/CyclotomicFields/index-cyclotomic-fields.md#chapfldcyc)); the real field (Chapter [Real and Complex Fields](https://docs.magma-maths.org/BasicRings/RealAndComplexFields/index-real-and-complex-fields.md#chapfldre)) is *not* allowed since it is not infinite precision.

The real reflection groups are just the reflection representations of the Coxeter groups (Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)). This allows us to compute many more properties for these groups than for general reflection groups. Note that the classification of finite real reflection groups is given in Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff).

<a id="function-reflectiongroup-algmatelt"></a>
#### `ReflectionGroup(M): AlgMatElt -> GrpMat`

<a id="function-reflectiongroup-grphund"></a>
#### `ReflectionGroup(G): GrphUnd -> GrpMat`

<a id="function-reflectiongroup-algmatelt-2"></a>
#### `ReflectionGroup(C): AlgMatElt -> GrpMat`

<a id="function-reflectiongroup-grphdir"></a>
#### `ReflectionGroup(D): GrphDir -> GrpMat`

The reflection group with Coxeter matrix $M$, Coxeter graph $G$, Cartan matrix $C$, or Dynkin digraph $D$ (see Chapter [Coxeter Systems](https://docs.magma-maths.org/LieTheory/CoxeterSystems/index-coxeter-systems.md#chapcartan)).

<a id="function-reflectiongroup-monstgelt"></a>
#### `ReflectionGroup(N): MonStgElt -> GrpMat`

The finite or affine reflection group with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-irreduciblereflectiongroup-monstgelt-rngintelt"></a>
#### `IrreducibleReflectionGroup(X, n): MonStgElt, RngIntElt -> GrpMat`

The finite or affine irreducible reflection group with Cartan name $X_n$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="example-ex-5faa0c"></a>
#### `Example: Real Reflection Group from a Cartan Matrix (ex-5faa0c)`

```magma
> C := CartanMatrix("B3" : Symmetric);
> G := ReflectionGroup(C);
> G;
MatrixGroup(3, Number Field with defining polynomial x^2 - 2 over the Rational
Field) of order 48 = 2^4 * 3
Generators:
    [-1  0  0]
    [ 1  1  0]
    [ 0  0  1]

    [  1   1   0]
    [  0  -1   0]
    [  0 $.1   1]

    [  1   0   0]
    [  0   1 $.1]
    [  0   0  -1]
```

<a id="function-reflectiongroup-rootsys"></a>
#### `ReflectionGroup(R): RootSys -> GrpMat`

<a id="function-reflectiongroup-rootdtm"></a>
#### `ReflectionGroup(R): RootDtm -> GrpMat`

The finite reflection group with root system or root datum $R$ (see Chapters [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys) and [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)).

<a id="example-ex-36ff3b"></a>
#### `Example: Real Reflection Group from a Root Datum (ex-36ff3b)`

```magma
> R := RootDatum("B3");
> ReflectionGroup(R);
MatrixGroup(3, Integer Ring) of order 48 = 2^4 * 3
Generators:
    [-1  0  0]
    [ 1  1  0]
    [ 0  0  1]

    [ 1  1  0]
    [ 0 -1  0]
    [ 0  1  1]

    [ 1  0  0]
    [ 0  1  2]
    [ 0  0 -1]
```

<a id="function-reflectiongroup-grpfpcox"></a>
#### `ReflectionGroup(W): GrpFPCox -> GrpMat, Map`

```magma
A: Mtrx                    Default: 
B: Mtrx                    Default: 
C: Mtrx                    Default: 
```

A reflection group $W'$ of the Coxeter group $W$, together with the isomorphism $W\rightarrow W'$ (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)). Since a Coxeter group $W$ does not come with an in-built reflection representation, the optional parameters $A$, $B$, and $C$ can be used to specify the representation. They are respectively the matrix whose rows are the simple roots, the matrix whose rows are the simple coroots, and the Cartan matrix. These must have the following properties:

1. $A$ and $B$ must have same number of rows and the same number of columns; they must be defined over the same field, which must be the rational field, a number field, or a cyclotomic field; the entries must be real;
2. the number of columns must be at least the number of rows; and
3. $C=AB^\mathrm{tr}$ must be a Cartan matrix for $W$.

It is not necessary to specify all three matrices: any two of them will determine the third. If $C$ is not determined, it is taken to be the standard matrix described in Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat).

<a id="function-reflectiongroup-grppermcox"></a>
#### `ReflectionGroup(W): GrpPermCox -> GrpMat, Map`

The reflection group $W'$ isomorphic to the permutation Coxeter group $W$, together with the isomorphism $W\rightarrow W'$ (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpcox)). There are no optional parameters $A$, $B$, and $C$ in this case because every permutation Coxeter group has a root system, and this determines the reflection representation.

<a id="example-ex-3ea794"></a>
#### `Example: Converting Between Coxeter Group Types (ex-3ea794)`

```magma
> W<a,b,c> := CoxeterGroup(GrpFPCox, "B3");
> G, h := CoxeterGroup(GrpMat, W);
> a*b; h(a*b);
a * b
[-1 -1  0]
[ 1  0  0]
[ 0  1  1]
```

<a id="create-group-refl-complex"></a>
<a id="sectgrprflcomp"></a>
### Construction of Finite Complex Reflection Groups

In this section, we describe the classification and construction of finite complex reflection groups.

A finite complex reflection group has a finite root system but there is no known analogue of a set of simple roots as in the theory of finite Coxeter groups. To illustrate the difficulty, one of the examples in this section constructs a complex reflection group of rank 4 which cannot be generated by fewer than 5 generators.

Nevertheless, it is possible to generalise the concept of *root datum* to the complex case and construct all complex reflection groups via their root data.

Let $D$ be the ring of integers of a number field $F$ which admits a well-defined operation of complex conjugation (which in the case of a real number field will be the identity automorphism). Let $\mu(D)$ be the group of roots of unity in $D$ and let $V = F\otimes_D L$.

A *complex root datum* is a $4$-tuple $(L,L^*,\Phi,\rho)$, where

- $L$ and $L^*$ are free $D$-modules of rank $n$ which are in duality via a pairing $L\times L^* \to D : (a,\phi) \mapsto \langle\,a,\phi\,\rangle$;
- $\Phi$ is a finite subset of $L$ and $\rho : \Phi \to L^*$.

For all $a\in \Phi$ we have:

1. for all $\lambda\in F$, we have $\lambda a \in \Phi$ if and only if $\lambda\in \mu(D)$;
2. for all $\lambda \in D$, we have $\rho(\lambda a) = \overline{\lambda}\rho(a)$;
3. $f(a) = 1 - \langle\,a,\rho(a)\,\rangle\in \mu(D)\setminus \{1\}$;
4. the reflection $r_a$ of $V$ defined by $v r_a = v - \langle\,v,\rho(a)\,\rangle a$ and the reflection $r^*_a$ of $V^*$ defined by $\phi r^*_a = \phi - \langle\,a,\phi\,\rangle \rho(a)$ satisfy:

- $\Phi r_a \subseteq \Phi$ and $\Phi^* r^*_a\subseteq \Phi^*$, where $\Phi^* = \rho(\Phi)$.
- $f(a r_b ) = f(a)$ for all $a,b\in \Phi$.

Put $a^* = \rho(a)$ and $V^* = F\otimes_D L^*$. Then $\rho : \Phi \to \Phi^*$ is a bijection and the map

$$
p := V \to V^* : v \mapsto \sum_{a\in\Phi}\overline{\langle\,v,a^*\,\rangle} a^*
$$

is semilinear. Furthermore, $\beta(u,v) = \langle\,u,p(v)\,\rangle$ defines a non-degenerate hermitian form on the span of $\Phi$.

The group $W$ generated by the reflections $\{r_a\mid a\in \Phi\}$ is the *Weyl group* of the root datum. For any set $\{r_1,r_2,\dots,r_k\}$ of reflections that generate $W$, every reflection in $W$ is conjugate to a power of some $r_i$. The set $\Phi$ is a *root system* for $W$ and $\Phi^*$ is the set of *coroots*.

If $a_1$, $a_2$, …, $a_k\in\Phi$ are roots of the reflections $r_1$, $r_2$, …, $r_n$ which generate $W$, then $C = (\langle\,a_i,a^*_j\,\rangle)$ is a *complex Cartan matrix* and the $a_i$ and $a^*_j$ are *basic* roots and coroots of $W$.

Even though there is no satisfactory notion of ‘simple roots’, a complex reflection group can nevertheless be described by means of a complex Cartan matrix. In Magma if the roots are the rows of a matrix $A$ and if the coroots are the rows of a matrix $B$, then $C = AB^\mathrm{tr}$. The matrices $A$ and $B$ are called *basic* root and coroot matrices.

The complex Cartan matrix can be described by a diagram similar to the Dynkin diagram of a Coxeter group. This notation was suggested by Coxeter and used by Cohen in [[Coh76](https://docs.magma-maths.org/references.md#cite-cohen76)]. (There is a different type of diagram used by Broué, Malle, and others.)

Cohen’s naming scheme for the diagrams extends the standard notation $A_n$, $B_n$, …, $H_3$, $H_4$ used for Coxeter groups. Magma uses a slight variation of Cohen’s scheme; that is, in Magma, Cohen’s group $EN_4$ is referred to as $O_4$.

The original numbering system for the primitive complex reflection groups is due to Shephard and Todd [[ST54](https://docs.magma-maths.org/references.md#cite-shephardtodd54)].

<a id="function-shephardtodd-rngintelt"></a>
#### `ShephardTodd(n): RngIntElt -> GrpMat, Fld`

```magma
NumFld: BoolElt                    Default: false
```

This function returns the primitive reflection group $G_n$ using the Shephard and Todd numbering.

By default the matrices are written over the ring of integers of the smallest cyclotomic field which contains the character values of the reflections. If the parameter `NumFld` is set to `true`, the number field generated by the character values of the reflections is used.

The groups available via this function include all finite primitive complex reflection groups other than the symmetric groups $\mathop {\rm Sym}\nolimits(n)$ for $n\ge 5$. The groups are listed below.

Nineteen 2-dimensional primitive complex reflection groups:

Tetrahedral family: $G_4$, …, $G_7$

Octahedral family: $G_8$, …, $G_{15}$

Icosahedral family: $G_{16}$, …, $G_{22}$

Five 3-dimensional complex reflection groups:

$G_{23}$: $W(H_3) = {\mathbb{Z}}_2 \times PSL(2,5)$, order 120.

$G_{24}$: $W(J_3(4)) = {\mathbb{Z}}_2 \times PSL(2,7)$, order 336.

$G_{25}$: $W(L_3) = 3^{1+2}\cdot SL(2,3)$, order 648; Hessian group.

$G_{26}$: $W(M_3) = {\mathbb{Z}}_2 \times 3^{1+2}\cdot SL(2,3)$, order 1296; Hessian group.

$G_{27}$: $W(J_3(5)) = {\mathbb{Z}}_2 \times ({\mathbb{Z}}_3\cdot \mathop {\rm Alt}\nolimits(6))$, order 2160, where ${\mathbb{Z}}_3\cdot \mathop {\rm Alt}\nolimits(6)$ denotes the non-split extension of ${\mathbb{Z}}_3$ by $\mathop {\rm Alt}\nolimits(6)$.

Five $4$-dimensional complex reflection groups in addition to $\mathop {\rm Sym}\nolimits(5)$:

$G_{28}$: $W(F_4) = (SL(2,3)\circ SL(2,3))\cdot ({\mathbb{Z}}_2 \times {\mathbb{Z}}_2)$, order 1152.

$G_{29}$: $W(N_4) = ({\mathbb{Z}}_4\circ 2^{1+4})\cdot \mathop {\rm Sym}\nolimits(5)$, order 7680 (splits).

$G_{30}$: $W(H_4) = (SL(2,5)\circ SL(2,5))\cdot{\mathbb{Z}}_2$, order 14.

$G_{31}$: $W(O_4) = ({\mathbb{Z}}_4\circ 2^{1+4})\cdot Sp(4,2)$, order 46 (non-split) 5 generators.

$G_{32}$: $W(L_4) = {\mathbb{Z}}_3 \times Sp(4,3)$, order $155\thinspace 520 = 2^7 \times 3^5 \times 5$.

One 5-dimensional complex reflection group in addition to $\mathop {\rm Sym}\nolimits(6)$:

$G_{33}$: $W(K_5) = {\mathbb{Z}}_2 \times \Omega(5,3) = {\mathbb{Z}}_2 \times PSp(4,3) = {\mathbb{Z}}_2 \times PSU(4,2)$, order $51\thinspace 840 = 2^7 \times 3^4 \times 5$.

Two $6$-dimensional complex reflection groups in addition to $\mathop {\rm Sym}\nolimits(7)$:

$G_{34}$: $W(K_6) = {\mathbb{Z}}_3\cdot \widehat\Omega^-(6,3)$, order $39\thinspace 191\thinspace 040 = 2^9 \times 3^7 \times 5 \times 7$ (non-split), where $\widehat\Omega^-(6,3)$ is a semidirect product of $\Omega^-(6,3)$ by ${\mathbb{Z}}_2$.

$G_{35}$: $W(E_6) = SO(5,3) = O^-(6,2) = PSp(4,3)\cdot{\mathbb{Z}}_2 = PSU(4,2)\cdot{\mathbb{Z}}_2$, order $51\thinspace 840 = 2^7 \times 3^4 \times 5$.

One 7-dimensional complex reflection group in addition to $\mathop {\rm Sym}\nolimits(8)$:

$G_{36}$: $W(E_7) = {\mathbb{Z}}_2 \times Sp(6,2)$, order $2\thinspace 903\thinspace 040 = 2^{10} \times 3^4 \times 5 \times 7$.

One 8-dimensional complex reflection group in addition to $\mathop {\rm Sym}\nolimits(9)$:

$G_{37}$: $W(E_8) = {\mathbb{Z}}_2\cdot O^+(8,2)$, order $696\thinspace 729\thinspace 600 = 2^{14} \times 3^5 \times 5^2 \times 7$ (non-split).

<a id="example-ex-93aefa"></a>
#### `Example: Identifying the Complex Reflection Group G24 (ex-93aefa)`

We verify that the complex reflection group $G_{24}$ is isomorphic to ${\mathbb{Z}}_2\times \Omega(3,7)$.

```magma
> W := ShephardTodd(24);
> G := sub<GL(3,7) | Omega(3,7), -GL(3,7)!1>;
> IsIsomorphic(W,G):Minimal;
true Homomorphism of MatrixGroup(3, Cyclotomic Field of order 7 and degree 6)
of order 2^4 * 3 * 7 into MatrixGroup(3, GF(7)) of order 2^4 * 3 * 7
```

<a id="function-complexreflectiongroup-mtrx"></a>
#### `ComplexReflectionGroup(C): Mtrx -> GrpMat, Map`

```magma
Reduced: BoolElt                    Default: true
```

This function returns the complex reflection group defined by the (complex) Cartan matrix $C$. When the optional parameter `Reduced` is `true` (the default), the roots and coroots are computed modulo the null space of $C$.

<a id="function-complexreflectiongroup-monstgelt-rngintelt"></a>
#### `ComplexReflectionGroup(X, n): MonStgElt, RngIntElt -> GrpMat, Map`

```magma
NumFld: BoolElt                    Default: false
```

This function returns the primitive reflection group of type $X$ and rank $n$, using the Cohen/Coxeter naming scheme.

By default the matrices are written over the ring of integers of the smallest cyclotomic field which contains the character values of the reflections. If the parameter `NumFld` is set to `true`, the number field generated by the character values of the reflections is used.

<a id="example-ex-ccc605"></a>
#### `Example: Reflection Subgroups (ex-ccc605)`

In this example we find (up to conjugacy) all subgroups of $G = W(O_4) = G_{31}$ that are generated by reflections. This shows that $G$ cannot be generated by fewer than $5$ reflections.

We begin by checking that $G$ has only one class of reflections.

```magma
> G := ComplexReflectionGroup("O",4);
> print #[c[3] : c in Classes(G) | IsReflection(c[3])];
1
> R := Class(G,G.1); #R;
60
> #G;
46080
```

We proceed by building the list of reflection subgroups in ‘layers’, where the $n$-th layer consists of representatives of the subgroups generated by $n$ reflections.

```magma
> L := [sub<G|G.1>];
> layers := [L];
> n := 0;
> while true do
>   n +:= 1;
>   nextlayer := [];
```

We extend each group in layer $n$ by adjoining one additional reflection. The resulting subgroup will be generated by $n$ or $n+1$ reflections. If we haven’t seen it before we add it to the list.

```magma
>   for H in layers[n] do
>     for A in {sub<G|H,s> : s in R | s notin H} do
>       if forall{B : B in L | not IsConjugate(G,A,B)} then
>         Append(~nextlayer,A);
>         Append(~L,A);
>       end if;
>     end for;
>   end for;
>   if IsEmpty(nextlayer) then break; end if;
>   Append(~layers,nextlayer);
```

After the construction of each layer we print the orders of the subgroups.

```magma
>   print n+1,"generators";
>   print [#A : A in nextlayer];
> end while;
2 generators
[ 4, 4, 8, 6 ]
3 generators
[ 8, 8, 16, 24, 12, 16, 24, 48, 16, 96 ]
4 generators
[ 192, 16, 32, 96, 16, 192, 32, 48, 1536, 384, 64, 64, 32,
 7680, 1152, 36, 384, 120, 120, 192, 192 ]
5 generators
[ 64, 384, 3072, 128, 46080 ]
6 generators
[ 256 ]
```

Looking at the orders we see that the first time the group $G_{31}$ appears is in layer $5$. That is, it cannot be generated by $4$ or fewer reflections. It is interesting to note that there is one subgroup which requires $6$ generators; namely the imprimitive group $G(4,2,2)\times G(4,2,2)$.

<a id="function-shephardtodd-rngintelt-rngintelt-rngintelt"></a>
#### `ShephardTodd(m, p, n): RngIntElt, RngIntElt, RngIntElt -> GrpMat, Fld`

<a id="function-imprimitivereflectiongroup-rngintelt-rngintelt-rngintelt"></a>
#### `ImprimitiveReflectionGroup(m, p, n): RngIntElt, RngIntElt, RngIntElt -> GrpMat, Fld`

```magma
NumFld: BoolElt                    Default: false
```

Let $B$ be the direct product of $n$ copies of the cyclic group $C_m$ of order $m$ and represent the elements of $B$ by diagonal matrices $\mathop {\rm diag}\nolimits(\theta_1,\theta_2,\dots,\theta_n)$. The elements of the symmetric group $\mathop {\rm Sym}\nolimits(n)$ can be represented by $n\times n$ permutation matrices and in this guise it acts on the group $B$; the resulting semidirect product is also known as the *wreath product* $C_m\wr \mathop {\rm Sym}\nolimits(n)$.

For each divisor $p$ of $m$ define

$$
A(m,p,n) := \{\,\mathop {\rm diag}\nolimits(\theta_1,\theta_2,\dots,\theta_n)\in B\mid
    (\theta_1\theta_2\cdots\theta_n)^{m/p} = 1\,\}.
$$

It is immediately clear that $A(m,p,n)$ is a subgroup of index $p$ in $B$ that is invariant under the action of $\mathop {\rm Sym}\nolimits(n)$. The semidirect product of $A(m,p,n)$ by the symmetric group $\mathop {\rm Sym}\nolimits(n)$ is the group $G(m,p,n)$. These groups are imprimitive when $m \ge 2$. The group $G(1,1,n)$ is the symmetric group $\mathop {\rm Sym}\nolimits(n)$ acting as permutation matrices.

Shephard and Todd proved that every irreducible imprimitive complex reflection subgroup of $GL(n,{\mathbb{C}})$ is conjugate to $G(m,p,n)$ for some $m$ and $p$.

This function returns the Shephard and Todd group $G(m,p,n) \subset {\operatorname{GL}}(n,F)$, where $p$ divides $m$. In general, $G(m,p,n)$ is irreducible but if $m = p = 1$, the function returns $\mathop {\rm Sym}\nolimits(n)$ in its natural permutation representation, which is not irreducible.

By default the matrices are written over the ring of integers of the smallest cyclotomic field which contains the character values of the reflections. If the parameter `NumFld` is set to `true`, the number field generated by the character values of the reflections is used.

<a id="example-ex-980a12"></a>
#### `Example: Imprimitive Reflection Groups (ex-980a12)`

```magma
> ShephardTodd(6, 3, 3);
MatrixGroup(3, Cyclotomic Field of order 6 and degree 2)
Generators:
     [0 1 0]
     [1 0 0]
     [0 0 1]

     [1 0 0]
     [0 0 1]
     [0 1 0]

     [1      0      0]
     [0      0      z]
     [0 -z + 1      0]

     [1  0   0]
     [0  1   0]
     [0  0  -1]
Mapping from: MatrixGroup(3, Cyclotomic Field of order 6 and degree 2) to GL(3,
CyclotomicField(6))
```

<a id="function-complexrootmatrices-rngintelt"></a>
#### `ComplexRootMatrices(k): RngIntElt -> AlgMatElt, AlgMatElt, AlgMatElt, RngElt, RngIntElt`

<a id="function-complexrootmatrices-rngintelt-rngintelt-rngintelt"></a>
#### `ComplexRootMatrices(m, p, n): RngIntElt, RngIntElt, RngIntElt -> AlgMatElt, AlgMatElt, AlgMatElt, RngElt, RngIntElt`

```magma
NumFld: BoolElt                    Default: false
```

If $G$ is the complex reflection group `ShephardTodd(k)` or `ShephardTodd(m,p,n)`, respectively, these functions return five values: the basic root and coroot matrices for $G$, an invariant hermitian form, a generator for the group of roots of unity of the ring of definition, and the order of the generator.

By default the root matrices are written over the ring of integers of the smallest cyclotomic field which contains the character values of the reflections. If the parameter `NumFld` is set to `true`, the number field generated by the character values of the reflections is used.

<a id="example-ex-f3139e"></a>
#### `Example: Complex Reflection Group from Root Matrices (ex-f3139e)`

```magma
> A,B,J,gen,ordgen := ComplexRootMatrices(13);
> A,B;
[            1               0]
[ -z^2 - z - 1               1]
[z^2 + 2*z + 1    -z^2 - z - 1]

[             2     -z^3 + z + 2]
[           z^2    z^3 + z^2 + 1]
[-z^3 + z^2 - 1          z^2 - 1]
> gen,ordgen;
-z^3
8
> G := PseudoReflectionGroup(A,B);
> #G;
96
```

<a id="function-complexcartanmatrix-rngintelt"></a>
#### `ComplexCartanMatrix(k): RngIntElt -> AlgMatElt`

<a id="function-complexcartanmatrix-rngintelt-rngintelt-rngintelt"></a>
#### `ComplexCartanMatrix(m, p, n): RngIntElt, RngIntElt, RngIntElt -> AlgMatElt`

```magma
NumFld: BoolElt                    Default: false
```

If $A$ and $B$ are the basic root and coroot matrices returned by `ComplexRootMatrices` above, then this function returns $AB^\mathrm{tr}$, where $B^\mathrm{tr}$ is the transpose of $B$. The meaning of the optional parameter `NumFld` has been described above.

<a id="function-basicrootmatrices-mtrx"></a>
#### `BasicRootMatrices(C): Mtrx -> AlgMatElt, AlgMatElt`

```magma
Reduced: BoolElt                    Default: true
```

This function returns a matrix $A$ of roots and a matrix $B$ of coroots such that $C = AB^\mathrm{tr}$. The default, when the optional parameter `Reduced` is `true`, is to compute the roots and coroots modulo the null space of $C$.

<a id="function-cohencoxetername-rngintelt"></a>
#### `CohenCoxeterName(k): RngIntElt -> MonStgElt, RngIntElt`

Cohen’s string name and rank of the Shephard and Todd group $G_k$. This is an extension of the naming scheme for Coxeter groups. For example, the Shephard and Todd group $G_{37}$ is the Coxeter group of type $E_8$ whereas the Shephard and Todd group $G_{32}$ has Cohen name $L_4$.

<a id="function-shephardtoddnumber-monstgelt-rngintelt"></a>
#### `ShephardToddNumber(X, n): MonStgElt, RngIntElt -> RngIntElt`

Given a string $X$ and an integer $n$, this function returns the Shephard and Todd number of the complex reflection group $W(X_n)$ of type $X$ and rank $n$. The rank is the dimension of the space on which the group acts; it is not always the number of generators.

The Shepard and Todd numbers range from 1 to 37. All symmetric groups (type $A$) have Shephard and Todd number 1, all imprimitive groups $G(m,p,n)$ have Shephard and Todd number 2, and all cyclic groups have Shephard and Todd number 3. The primitive complex reflection groups of rank 2 have Shepard and Todd numbers in the range 4 to 22. Except for the group $G_4$ which has type $L_2$, the rank 2 groups do not have Cohen–Coxeter names.

The Shephard and Todd numbers in the range 23 to 37 refer to the Cohen–Coxeter groups $W(E_6)$, $W(E_7)$, $W(E_8)$, $W(F_4)$, $W(H_3)$, $W(H_4)$, $W(J_3(4))$, $W(J_3(5))$, $W(K_5)$, $W(K_6)$, $W(L_3)$, $W(L_4)$, $W(M_3)$, $W(N_4)$, and $EW(N_4)$. Note that in Magma the types of the rank 3 groups $W(J_3(4))$ and $W(J_3(5))$ are $J4$ and $J5$; and the type of the rank 4 group $EW(N_4)$ is $O$.

As a matrix group the Coxeter group of type $A$ is returned by the function `CoxeterGroup(GrpMat,"A",n)`, where $n$ is the rank. The groups of types $B$, $C$ and $D$ are Coxeter groups and imprimitive complex reflection groups. Thus, as matrix groups, they can be obtained via the function `ShephardTodd(2,p,n)`, where $p = 1$ for type $B$ or $C$ and $p=2$ for type $D$.

<a id="example-ex-8535df"></a>
#### `Example: Converting Reflection Group Names (ex-8535df)`

The type of the group $G_{31}$ is $O$ and its rank is 4. This is the notation used in [[LT09](https://docs.magma-maths.org/references.md#cite-lehrertaylor)].

```magma
> ShephardToddNumber("J5",3);
27
> CohenCoxeterName(31);
O 4
```

<a id="example-ex-fe8c89"></a>
#### `Example: Constructing a Reflection Group from Its Name (ex-fe8c89)`

To construct a complex reflection group with a given name, first convert the name to its Shephard and Todd number.

```magma
> G := ShephardTodd(ShephardToddNumber("L",4));
> G;
MatrixGroup(4, Cyclotomic Field of order 3 and degree 2)
Generators:
    [     omega          0          0          0]
    [-omega - 1          1          0          0]
    [         0          0          1          0]
    [         0          0          0          1]

    [        1 omega + 1         0         0]
    [        0     omega         0         0]
    [        0 omega + 1         1         0]
    [        0         0         0         1]

    [         1          0          0          0]
    [         0          1 -omega - 1          0]
    [         0          0      omega          0]
    [         0          0 -omega - 1          1]

    [        1         0         0         0]
    [        0         1         0         0]
    [        0         0         1 omega + 1]
    [        0         0         0     omega]
```

<a id="function-complexrootdatum-rngintelt"></a>
#### `ComplexRootDatum(k): RngIntElt -> SeqEnum, SeqEnum, Map, GrpMat, AlgMatElt`

<a id="function-complexrootdatum-rngintelt-rngintelt-rngintelt"></a>
#### `ComplexRootDatum(m, p, n): RngIntElt, RngIntElt, RngIntElt -> SeqEnum, SeqEnum, Map, GrpMat, AlgMatElt`

```magma
NumFld: BoolElt                    Default: false
```

A root datum for the Shephard and Todd group $G_k$ or, in the second form of the function, the imprimitive group $G(m,p,n)$. This is returned as a $5$-tuple $\Phi$, $\Phi^*$, $\rho$, $W$, $J$, where $\Phi$ is the sequence of roots, $\Phi^*$ the sequence of coroots, $\rho : \Phi\to\Phi^*$ is a bijective map, $W$ is the complex reflection group of the root datum, and $J$ is an hermitian form preserved by $W$.

<a id="operations"></a>
<a id="sectgrprflgrprflop"></a>
### Operations on Reflection Groups

See Chapter [Matrix Groups over General Rings](https://docs.magma-maths.org/FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat) for general functions for matrix groups. Note that most of the functions in this section only work for real reflection groups.

<a id="function-iscoxeterisomorphic-grpmat-grpmat"></a>
#### `IsCoxeterIsomorphic(W1, W2): GrpMat, GrpMat -> BoolElt`

Returns `true` if and only if the real reflection groups $W_1$ and $W_2$ are isomorphic as Coxeter systems.

<a id="function-iscartanequivalent-grpmat-grpmat"></a>
#### `IsCartanEquivalent(W1, W2): GrpMat, GrpMat -> BoolElt`

Returns `true` if and only if the crystallographic real reflection groups $W_1$ and $W_2$ have Cartan equivalent Cartan matrices.

<a id="example-ex-ce63f7"></a>
#### `Example: Coxeter Isomorphism and Cartan Equivalence (ex-ce63f7)`

```magma
> W1 := ReflectionGroup("B3");
> W2 := ReflectionGroup("C3");
> IsCoxeterIsomorphic(W1, W2);
true [ 1, 2, 3 ]
> IsCartanEquivalent(W1, W2);
false
```

<a id="function-cartanname-grpmat"></a>
#### `CartanName(W): GrpMat -> List`

The Cartan name of the finite or affine real reflection group $W$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="procedure-coxeterdiagram-grpmat"></a>
#### `CoxeterDiagram(W): GrpMat`

A display of the Coxeter diagram of the real reflection group $W$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)). If $W$ is not affine or finite, an error is flagged.

<a id="procedure-dynkindiagram-grpmat"></a>
#### `DynkinDiagram(W): GrpMat`

A display of the Coxeter diagram of the real reflection group $W$ (Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)). If $W$ is not affine or finite, or if $W$ is not crystallographic, an error is flagged.

<a id="example-ex-0c1a24"></a>
#### `Example: Cartan Name and Coxeter Diagram (ex-0c1a24)`

```magma
> G := CompleteGraph(3);
> W := ReflectionGroup(G);
> CartanName(W);
A~2
> CoxeterDiagram(W);

A~2    1 - 2
       |   |
       - 3 -
```

<a id="function-rootsystem-grpmat"></a>
#### `RootSystem(W): GrpMat -> RootDtm`

The root system of the finite real reflection group $W$ (Chapter [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys)). If $W$ is infinite, an error is flagged.

<a id="function-rootdatum-grpmat"></a>
#### `RootDatum(W): GrpMat -> RootDtm`

The root datum of the finite real reflection group $W$ (Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)). The roots and coroots of $W$ must have integral components, and $W$ must be finite.

<a id="function-coxetermatrix-grpmat"></a>
#### `CoxeterMatrix(W): GrpMat -> AlgMatElt`

The Coxeter matrix of the real reflection group $W$ (Section [Coxeter Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetermat.md#sectcartancoxmat)).

<a id="function-coxetergraph-grpmat"></a>
#### `CoxeterGraph(W): GrpMat -> GrphUnd`

The Coxeter graph of the real reflection group $W$ (Section [Coxeter Graphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/coxetergraph.md#sectcartancoxgrph)).

<a id="function-cartanmatrix-grpmat"></a>
#### `CartanMatrix(W): GrpMat -> AlgMatElt`

The Cartan matrix of the real reflection group $W$ (Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat)).

<a id="function-dynkindigraph-grpmat"></a>
#### `DynkinDigraph(W): GrpMat -> GrphDir`

The Dynkin digraph of the real reflection group $W$ (Section [Dynkin Digraphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#sectcartandyndigrph)).

<a id="function-rank-grpmat"></a>
#### `Rank(W): GrpMat -> RngIntElt`

<a id="function-numberofgenerators-grpmat"></a>
#### `NumberOfGenerators(W): GrpMat -> RngIntElt`

The rank of the reflection group $W$.

<a id="example-ex-6d4455"></a>
#### `Example: Rank and Dimension (ex-6d4455)`

```magma
> R := StandardRootSystem("A", 4);
> W := ReflectionGroup(R);
> Rank(W);
4
> Dimension(W);
5
```

<a id="function-fundamentalgroup-grpmat"></a>
#### `FundamentalGroup(W): GrpMat -> GrpAb`

The fundamental group of the real reflection group $W$ (Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). The roots and coroots of $W$ must have integral components.

<a id="function-isogenygroup-grpmat"></a>
#### `IsogenyGroup(W): GrpMat -> GrpAb, Map`

The isogeny group of the real reflection group $W$, together with the injection into the fundamental group (Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). The roots and coroots of $W$ must have integral components.

<a id="function-coisogenygroup-grpmat"></a>
#### `CoisogenyGroup(W): GrpMat -> GrpAb, Map`

The fundamental group of the real reflection group $W$ together with the projection onto the fundamental group (Subsection [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). The roots and coroots of $W$ must have integral components.

<a id="function-basicdegrees-grpmat"></a>
#### `BasicDegrees(W): GrpMat -> RngIntElt`

The degrees of the basic invariant polynomials of the reflection group $W$. These are computed using the table in [[Car72b](https://docs.magma-maths.org/references.md#cite-carter-small), page 155] if the group is real, and using the algorithm of [[LT09](https://docs.magma-maths.org/references.md#cite-lehrertaylor)] in other cases. If $W$ is infinite, an error is flagged.

<a id="function-basiccodegrees-grpmat"></a>
#### `BasicCodegrees(W): GrpMat -> RngIntElt`

The basic codegrees of the reflection group $W$. These are computed using the algorithm of [[LT09](https://docs.magma-maths.org/references.md#cite-lehrertaylor)]. If $W$ is infinite, an error is flagged.

<a id="example-ex-9828d5"></a>
#### `Example: Basic Degrees (ex-9828d5)`

The product of the basic degrees is the order of the Coxeter group; the sum of the basic degrees is the sum of the rank and the number of positive roots.

```magma
> W := ReflectionGroup("E6");
> degs := BasicDegrees(W);
> degs;
[ 2, 5, 6, 8, 9, 12 ]
> &*degs eq #W;
true
> &+degs eq NumPosRoots(W) + Rank(W);
true
```

<a id="function-longestelement-grpmat"></a>
#### `LongestElement(W): GrpMat -> SeqEnum`

The unique longest element in the finite real reflection group $W$.

<a id="function-coxeterelement-grpmat"></a>
#### `CoxeterElement(W): GrpMat -> SeqEnum`

The Coxeter element in the reflection group $W$, ie. the product of the generators.

<a id="function-coxeternumber-grpmat"></a>
#### `CoxeterNumber(W): GrpMat -> SeqEnum`

The order of the Coxeter element in the real reflection group $W$.

<a id="example-ex-ae7bca"></a>
#### `Example: Longest and Coxeter Elements (ex-ae7bca)`

Operations on groups.

```magma
> W := ReflectionGroup("A4");
> LongestElement(W);
[ 0  0  0 -1]
[ 0  0 -1  0]
[ 0 -1  0  0]
[-1  0  0  0]
> CoxeterElement(W);
[-1 -1 -1 -1]
[ 1  0  0  0]
[ 0  1  0  0]
[ 0  0  1  0]
```

<a id="function-leftdescentset-grpmat-grpmatelt"></a>
#### `LeftDescentSet(W, w): GrpMat, GrpMatElt -> SetEnum`

The set of indices $r$ of simple roots of the finite real reflection group $W$ such that the length of the product $s_rw$ is less than that of the element $w$.

<a id="function-rightdescentset-grpmat-grpmatelt"></a>
#### `RightDescentSet(W, w): GrpMat, GrpMatElt -> SetEnum`

The set of indices $r$ of simple roots of the finite real reflection group $W$ such that the length of the product $ws_r$ is less than that of the element $w$.

<a id="example-ex-609f66"></a>
#### `Example: Left and Right Descent Sets (ex-609f66)`

```magma
> W := ReflectionGroup("A5");
> x := W.1*W.2*W.4*W.5;
> LeftDescentSet(W, x);
{ 1, 4 }
> RightDescentSet(W, x);
{ 2, 5 }
```

<a id="properties"></a>
<a id="sectgrprflprop"></a>
### Properties of Reflection Groups

See Chapter [Matrix Groups over General Rings](https://docs.magma-maths.org/FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat) for general functions for matrix groups.

<a id="function-isreflectiongroup-grpmat-2"></a>
#### `IsReflectionGroup(G): GrpMat -> BoolElt`

```magma
Strict: BoolElt                    Default: true
```

The default action is to return `true` if every generator of $G$ is a reflection. If `Strict` is `false`, the function checks if $G$ can be generated by *some* of its reflections, not necessarily those returned by `Generators(G)`.

<a id="function-rootsandcoroots-grpmat"></a>
#### `RootsAndCoroots(G): GrpMat -> [RngIntElt], [ModTupRngElt], [ModTupRngElt]`

Returns the orders of the reflections, the roots, and the coroots of the reflection group $G$.

<a id="function-isrealreflectiongroup-grpmat"></a>
#### `IsRealReflectionGroup(G): GrpMat -> BoolElt, [], []`

Returns `true` if and only if the matrix group $G$ is a real reflection group. If `true`, the simple orders, roots, and coroots are also returned.

<a id="example-ex-db9a68"></a>
#### `Example: Testing for a Reflection Group (ex-db9a68)`

```magma
> W := ComplexReflectionGroup("A", 4);
> IsReflectionGroup(W);
true
> IsRealReflectionGroup(W);
true

[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]

[ 2 -1  0  0]
[-1  2 -1  0]
[ 0 -1  2 -1]
[ 0  0 -1  2]
> W := ComplexReflectionGroup("M", 3);
> IsReflectionGroup(W);
true
> IsRealReflectionGroup(W);
                        ^
Runtime error in 'IsRealReflectionGroup': The group must be defined over the
reals
```

<a id="function-iscrystallographic-grpmat"></a>
#### `IsCrystallographic(W): GrpMat -> BoolElt`

Returns `true` if and only if the real reflection group $W$ is crystallographic; i.e., its Cartan matrix has integral entries.

<a id="function-issimplylaced-grpmat"></a>
#### `IsSimplyLaced(W): GrpMat -> BoolElt`

Returns `true` if and only if the real reflection group $W$ is simply laced; i.e., its Coxeter graph has no labels.

<a id="example-ex-d36942"></a>
#### `Example: Properties of an Infinite Reflection Group (ex-d36942)`

```magma
> W := ReflectionGroup("A~2 D4");
> IsFinite(W);
false
> IsCrystallographic(W);
true
> IsSimplyLaced(W);
true
```

<a id="function-dual-grpmat"></a>
#### `Dual(G): GrpMat -> BoolElt`

The dual of the reflection group $G$, ie, the reflection group gotten by swapping roots with coroots.

<a id="function-overgroup-grpmat"></a>
#### `Overgroup(H): GrpMat -> GrpMat`

The overgroup of $H$, i.e. the reflection group whose roots are permuted by the elements of the reflection subgroup $H$.

<a id="function-overdatum-grpmat"></a>
#### `Overdatum(H): GrpMat -> RootDtm`

The root datum whose roots are permuted by the elements of the reflection subgroup $H$.

Every Coxeter group $W$ has a standard action. For example, the standard action group of a Coxeter group of type $A_n$ is the symmetric group of degree $n+1$ acting on $\{1,\dots,n\}$.

<a id="function-standardaction-grpmat"></a>
#### `StandardAction(W): GrpMat -> Map`

The standard action of the reflection group $W$.

<a id="function-standardactiongroup-grpmat"></a>
#### `StandardActionGroup(W): GrpMat -> GrpPerm, Map`

The group $G$ of the standard action of the reflection group $W$, together with an isomorphism $W\to G$.

<a id="action"></a>
<a id="sectgrpfpcoxaction"></a>
### Roots, Coroots, and Reflections

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space. This is the default.
2. `"Root"`: the basis of simple (co)roots.
3. `"Weight"`: the basis of fundamental (co)weights (see Subsection [Weights](https://docs.magma-maths.org/LieTheory/ReflectionGroups/action.md#subsectgrprflrootweight) below).

#### Accessing Roots and Coroots

<a id="function-rootspace-grpmat"></a>
##### `RootSpace(W): GrpMat -> Lat`

<a id="function-corootspace-grpmat"></a>
##### `CorootSpace(W): GrpMat -> Lat`

The base space of the reflection group $W$. If $W$ is not a reflection group, an error occurs.

<a id="example-ex-16412e"></a>
##### `Example: Root Space of a Complex Reflection Group (ex-16412e)`

```magma
> W := ComplexReflectionGroup("M", 3);
> RootSpace(W);
Full Vector space of degree 3 over Cyclotomic Field of order 24 and degree 8
```

<a id="function-simpleorders-grpmat"></a>
##### `SimpleOrders(W): GrpMat -> [RngIntElt]`

The sequence of simple orders of the reflection group $W$. If $W$ is not a reflection group, an error is flagged.

<a id="function-simpleroots-grpmat"></a>
##### `SimpleRoots(W): GrpMat -> Mtrx`

<a id="function-simplecoroots-grpmat"></a>
##### `SimpleCoroots(W): GrpMat -> Mtrx`

The simple (co)roots of the reflection group $W$ as the rows of a matrix, i.e. $A$ (resp. $B$).

<a id="function-numberofpositiveroots-grpmat"></a>
##### `NumberOfPositiveRoots(W): GrpMat -> RngIntElt`

<a id="function-numposroots-grpmat"></a>
##### `NumPosRoots(W): GrpMat -> RngIntElt`

The number of positive roots of the real reflection group $W$. This is also the number of positive coroots. The total number of (co)roots is twice the number of positive (co)roots. This number is finite if and only if $W$ is finite.

<a id="function-roots-grpmat"></a>
##### `Roots(W): GrpMat -> SetIndx`

<a id="function-coroots-grpmat"></a>
##### `Coroots(W): GrpMat -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of (co)roots of the real reflection group $W$, i.e. $\{@\,\alpha_1,\dots\alpha_{2N}\,@\}$ (resp. $\{@\,\alpha_1^\star,\dots\alpha_{2N}^\star\,@\}$). If $W$ is infinite, an error is flagged.

<a id="function-positiveroots-grpmat"></a>
##### `PositiveRoots(W): GrpMat -> SetIndx`

<a id="function-positivecoroots-grpmat"></a>
##### `PositiveCoroots(W): GrpMat -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The indexed set of positive (co)roots of the real reflection group $W$, that is, $\{@\,\alpha_1,\dots\alpha_N\,@\}$ (resp. $\{@\,\alpha_1^\star,\dots\alpha_N^\star\,@\}$). If $W$ is infinite, an error is flagged.

<a id="function-root-grpmat-rngintelt"></a>
##### `Root(W, r): GrpMat, RngIntElt -> SetIndx`

<a id="function-coroot-grpmat-rngintelt"></a>
##### `Coroot(W, r): GrpMat, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root $\alpha_r$ (resp. $\alpha_r^\star$) of the real reflection group $W$. If $W$ is infinite, an error is flagged.

<a id="function-rootposition-grpmat"></a>
##### `RootPosition(W, v): GrpMat, . -> SetIndx`

<a id="function-corootposition-grpmat"></a>
##### `CorootPosition(W, v): GrpMat, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root in the finite real reflection group $W$, return its index; otherwise return 0. These functions will try to coerce $v$ into the appropriate lattice; $v$ should be written with respect to the basis specified by the parameter `Basis`. If $W$ is infinite, an error is flagged.

<a id="example-ex-194100"></a>
##### `Example: Roots and Coroots of a Reflection Group (ex-194100)`

```magma
> W := ReflectionGroup("A3");
> Roots(W);
{@
    (1 0 0),
    (0 1 0),
    (0 0 1),
    (1 1 0),
    (0 1 1),
    (1 1 1),
    (-1  0  0),
    (0 -1  0),
    (0  0 -1),
    (-1 -1  0),
    (0 -1 -1),
    (-1 -1 -1)
@}
> PositiveCoroots(W);
{@
    (2 -1  0),
    (-1  2 -1),
    (0 -1  2),
    (1  1 -1),
    (-1  1  1),
    (1 0 1)
@}
> #Roots(W) eq 2*NumPosRoots(W);
true
> Root(W, 4);
(1 1 0)
> Root(W, 4 : Basis := "Root");
(1 1 0)
> RootPosition(W, [1,1,0]);
4
> A := Matrix(3,3,[1,0,0, -1,-1,-3, 1,2,4]);
> B := Matrix(3,3,[2,-1,0, -1,2,-1, 0,1,0]);
> W := ReflectionGroup(A,B);
> Roots(W);
{@
    (1 0 0),
    (-1 -1 -3),
    (1 2 4),
    (0 -1 -3),
    (0 1 1),
    (1 1 1),
    (-1  0  0),
    (1 1 3),
    (-1 -2 -4),
    (0 1 3),
    (0 -1 -1),
    (-1 -1 -1)
@}
> PositiveCoroots(W);
{@
    (2 -1  0),
    (-1  2 -1),
    (0 1 0),
    (1  1 -1),
    (-1  3 -1),
    (1  2 -1)
@}
> #Roots(W) eq 2*NumPosRoots(W);
true
> Root(W, 4);
(0 -1 -3)
> Root(W, 4 : Basis := "Root");
(1 1 0)
> RootPosition(W, [0,-1,-3]);
4
```

#### Reflections

The root $\alpha$ acts on the root space via the reflection $s_\alpha$; the coroot $\alpha^\star$ acts on the coroot space via the coreflection $s_\alpha^\star$.

<a id="function-reflectionmatrices-grpmat"></a>
##### `ReflectionMatrices(W): GrpMat -> [AlgMatElt]`

<a id="function-coreflectionmatrices-grpmat"></a>
##### `CoreflectionMatrices(W): GrpMat -> [AlgMatElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The sequence of reflections in the finite real reflection group $W$. The $r$th reflection in the sequence corresponds to the $r$th (co)root.

<a id="function-simplereflectionmatrices-grpmat"></a>
##### `SimpleReflectionMatrices(W): GrpMat -> [AlgMatElt]`

<a id="function-simplecoreflectionmatrices-grpmat"></a>
##### `SimpleCoreflectionMatrices(W): GrpMat -> [AlgMatElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The matrices giving the action of the simple (co)roots on the (co)root space of the finite real reflection group $W$.

<a id="function-reflectionmatrix-grpmat-rngintelt"></a>
##### `ReflectionMatrix(W, r): GrpMat, RngIntElt -> AlgMatElt`

<a id="function-coreflectionmatrix-grpmat-rngintelt"></a>
##### `CoreflectionMatrix(W, r): GrpMat, RngIntElt -> []`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The reflection in finite real reflection group $W$ corresponding to the $r$th (co)root. If $r=1,\dots,n$, this is a generator of $W$.

<a id="function-simplereflectionpermutations-grpmat"></a>
##### `SimpleReflectionPermutations(W): GrpMat -> []`

The sequence of permutations giving the action of the simple (co)roots of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutations-grpmat"></a>
##### `ReflectionPermutations(W): GrpMat -> []`

The sequence of permutations giving the action of the (co)roots of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionpermutation-grpmat-rngintelt"></a>
##### `ReflectionPermutation(W, r): GrpMat, RngIntElt -> []`

The permutation giving the action of the $r$th (co)root of the finite reflection group $W$ on the (co)roots. This action is the same for roots and coroots.

<a id="function-reflectionwords-grpmat"></a>
##### `ReflectionWords(W): GrpMat -> []`

The sequence of words in the simple reflections for all the reflections of the real reflection group $W$. These words are given as sequences of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWords(W)[r]}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="function-reflectionword-grpmat-rngintelt"></a>
##### `ReflectionWord(W, r): GrpMat, RngIntElt -> []`

The word in the simple reflections for the $r$th reflection of the real reflection group $W$. The word is given as a sequence of integers. In other words, if $a = [a_1,\dots,a_l] = \hbox{\tt ReflectionWord(W,r)}$, then $s_{\alpha_r} = s_{\alpha_{a_1}} \cdots s_{\alpha_{a_l}}$.

<a id="example-ex-a49ddd"></a>
##### `Example: Reflection Matrices and Permutations (ex-a49ddd)`

```magma
> Q := RationalField();
> W := ReflectionGroup("A3");
> mx := ReflectionMatrix(W, 4);
> perm := ReflectionPermutation(W, 4);
> RootPosition(W, Vector(Q, Eltseq(Root(W,2))) * mx) eq 2^perm;
true
> mx := CoreflectionMatrix(W, 4);
> CorootPosition(W, Coroot(W,2) * mx) eq 2^perm;
true
```

<a id="function-length-grpmatelt"></a>
##### `Length(w): GrpMatElt -> RngIntElt`

<a id="function-coxeterlength-grpmatelt"></a>
##### `CoxeterLength(w): GrpMatElt -> RngIntElt`

The length of $w$ as an element of the Coxeter group $W$, i.e. the number of positive roots of $W$ which become negative under the action of $w$.

<a id="subsectgrprflrootweight"></a>
<a id="id1"></a>
#### Weights

<a id="function-weightlattice-grpmat"></a>
##### `WeightLattice(W): GrpMat -> Lat`

<a id="function-coweightlattice-grpmat"></a>
##### `CoweightLattice(W): GrpMat -> Lat`

The (co)weight lattice of the real reflection group $W$. The roots and coroots of $W$ must have integral components.

<a id="function-fundamentalweights-grpmat"></a>
##### `FundamentalWeights(W): GrpMat -> Mtrx`

<a id="function-fundamentalcoweights-grpmat"></a>
##### `FundamentalCoweights(W): GrpMat -> Mtrx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental weights of the real reflection group $W$ given as the rows of a matrix. The roots and coroots of $W$ must have integral components.

<a id="example-ex-843e25"></a>
##### `Example: Weight Lattice of a Reflection Group (ex-843e25)`

```magma
> W := ReflectionGroup("E6");
> WeightLattice(W);
Lattice of rank 6 and degree 6
Basis:
(4  3  5  6  4  2)
(3  6  6  9  6  3)
(5  6 10 12  8  4)
(6  9 12 18 12  6)
(4  6  8 12 10  5)
(2  3  4  6  5  4)
Basis Denominator: 3
> FundamentalWeights(W);
[ 4/3    1  5/3    2  4/3  2/3]
[   1    2    2    3    2    1]
[ 5/3    2 10/3    4  8/3  4/3]
[   2    3    4    6    4    2]
[ 4/3    2  8/3    4 10/3  5/3]
[ 2/3    1  4/3    2  5/3  4/3]
```

<a id="function-isdominant-rootdtm"></a>
##### `IsDominant(R, v): RootDtm, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

Returns `true` if and only if $v$ is a dominant weight for the root datum $R$, ie, a nonnegative integral linear combination of the fundamental weights.

<a id="function-dominantweight-grpmat"></a>
##### `DominantWeight(W, v): GrpMat, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique dominant weight in the same $W$-orbit as $v$, where $W$ is a real reflection group and $v$ is a weight given as a vector or a sequence representing a vector. The second value returned is a Coxeter group element taking $v$ to the dominant weight.

<a id="function-weightorbit-grpmat"></a>
##### `WeightOrbit(W, v): GrpMat, . -> {@ ModTupFldElt @}, [GrpFPCoxElt]`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $W$-orbit of $v$ as an indexed set, where $W$ is a real reflection group and $v$ is a weight given as a vector or a sequence representing a vector. The first element in the orbit is always dominant. The second value returned is a sequence of Coxeter group words taking the weight $v$ to the corresponding element of the orbit.

<a id="example-ex-a17dda"></a>
##### `Example: Dominant Weights and Weight Orbits (ex-a17dda)`

```magma
> W := CoxeterGroup("B3");
> DominantWeight(W, [1,-1,0] : Basis:="Weight");
(1 0 0)
$.2 * $.3 * $.2 * $.1
> #WeightOrbit(W, [1,-1,0] : Basis:="Weight");
6
```

<a id="related"></a>
<a id="sectgrpfpcoxrel"></a>
### Related Structures

In this section we briefly list functions for creating other structures from a reflection group. See the appropriate chapters of the Handbook for more details.

<a id="function-coxetergroup-cat-grpmat"></a>
#### `CoxeterGroup(GrpFPCox, W): Cat, GrpMat -> GrpPermCox`

The Coxeter group isomorphic to the real reflection group $W$. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox).

<a id="function-coxetergroup-cat-grpmat-2"></a>
#### `CoxeterGroup(GrpPermCox, W): Cat, GrpMat -> GrpPermCox`

The permutation Coxeter group isomorphic to the finite real reflection group $W$. See Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox).

<a id="function-liealgebra-grpmat-rng"></a>
#### `LieAlgebra(W, R): GrpMat, Rng -> AlgLie`

The reductive Lie algebra over the ring $R$ with Weyl group $W$. Unless $W$ is finite, real, and crystallographic, an error is flagged. See Section [Almost Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalglieconstrred).

<a id="function-groupoflietype-grpmat-rng"></a>
#### `GroupOfLieType(W, k): GrpMat, Rng -> GrpLie`

The group of Lie type over the field $k$ with Weyl group $W$. Unless $W$ is finite, real, and crystallographic, an error is flagged. The roots and coroots of $W$ must also have integral components. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="lie-alg"></a>
<a id="chapalglie"></a>
## Lie Algebras

- [Introduction](https://docs.magma-maths.org/LieTheory/LieAlgebras/introduction.md)
  - [Guide for the Reader](https://docs.magma-maths.org/LieTheory/LieAlgebras/introduction.md#guide-for-the-reader)
- [Constructors for Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md)
  - [`LieAlgebra<R, n | Q : parameters >: Rng, RngIntElt, SeqEnum → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#constructor-liealgebrarnq)
  - [`LieAlgebra<M | Q : parameters >: ModTupRng, SeqEnum → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#constructor-constructor-liealgebra-modtuprng-seqenum-alglie)
  - [`LieAlgebra<R, n | T : parameters >: Rng, RngIntElt, SeqEnum → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#constructor-constructor-liealgebra-rng-rngintelt-seqenum-alglie)
  - [`LieAlgebra< t | T : parameters >: SeqEnum, SeqEnum → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#constructor-constructor-liealgebra-seqenum-seqenum-alglie)
  - [`LieAlgebra(A): AlgAss → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-liealgebra-algass)
  - [`LieAlgebra(A): AlgMat → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-liealgebra-algmat)
  - [`AbelianLieAlgebra(R, n): Rng, RngIntElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-abelianliealgebra-rng-rngintelt)
  - [Example: Constructing Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#example-ex-b11bef)
  - [`ChangeBasis(L, B): AlgLie, {[AlgLieElt]} → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-changebasis-alglie-alglieelt)
  - [`ChangeBasis(L, B): AlgLie, {[ModTupFldElt]} → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-changebasis-alglie-modtupfldelt)
  - [`ChangeBasis(L, B): AlgLie, Mtrx → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-changebasis-alglie-mtrx)
  - [`MatrixLieAlgebra(R, n): Rng, RngIntElt → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-matrixliealgebra-rng-rngintelt)
  - [`MatrixLieAlgebra(A): AlgMat → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-matrixliealgebra-algmat)
  - [`Algebra(M): AlgMatLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-algebra-algmatlie)
  - [`LieAlgebra(M): AlgMatLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#function-liealgebra-algmatlie)
  - [Example: Upper Triangular Matrix Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#example-ex-297c34)
- [Finitely Presented Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md)
  - [Construction of the Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#construction-of-the-free-lie-algebra)
    - [`FreeLieAlgebra(F, n): Rng, RngIntElt → AlgFPLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-freeliealgebra-rng-rngintelt)
    - [Example: Creating a Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-49252a)
  - [Properties of the Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#properties-of-the-free-lie-algebra)
    - [`Rank(L): AlgFPLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-algfplierank)
    - [`CoefficientRing(L): AlgFPLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-coefficientring-algfplie)
    - [`BaseRing(L): AlgFPLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-basering-algfplie)
  - [Operations on Elements of the Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#operations-on-elements-of-the-free-lie-algebra)
    - [`x + y: AlgFPLieElt, AlgFPLieElt → AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#operation-op-plus-algfplieelt-algfplieelt)
    - [`x - y: AlgFPLieElt, AlgFPLieElt → AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#operation-op-minus-algfplieelt-algfplieelt)
    - [`x * y: AlgFPLieElt, AlgFPLieElt → AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#operation-op-times-algfplieelt-algfplieelt)
    - [`L ! 0: AlgFPLie, RngIntElt → AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#operation-op-algfplie-rngintelt)
    - [`Zero(L): AlgFPLie → AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-zero-algfplie)
    - [Example: Arithmetic in a Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-0ec7d4)
    - [`IsLeaf(m): AlgFPLieElt → BoolElt, AlgFPLieElt, AlgFPLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-isleaf-algfplieelt)
    - [Example: Leaves of Free Lie Algebra Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-8f1849)
  - [Construction of a Finitely-Presented Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#construction-of-a-finitely-presented-lie-algebra)
    - [`LieAlgebra(R): [ AlgFPLieElt ] → AlgLie, SeqEnum, SeqEnum, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-fpl-liealgebra)
    - [`LieAlgebra(R): { AlgFPLieElt } → AlgLie, SeqEnum, SeqEnum, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-liealgebra-algfplieelt)
    - [Example: Positive Root Subalgebra of E7](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-92e129)
    - [Example: Finitely Presented Lie Ring](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-0d1f8a)
    - [`quo<L | R>: AlgFPLie, [ AlgFPLieElt ] → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#constructor-constructor-quo-algfplie-algfplieelt-alglie-map)
    - [`quo<L | R>: AlgFPLie, { AlgFPLieElt } → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#constructor-constructor-quo-algfplie-algfplieelt-alglie-map-2)
    - [Example: Quotients of Finitely Presented Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-b4f6d4)
    - [`NilpotentQuotient(R, d): [ AlgFPLieElt ], RngIntElt → AlgLie, SeqEnum, SeqEnum, UserProgram`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-nilpotentquotient-algfplieelt-rngintelt)
    - [`NilpotentQuotient(R, d): { AlgFPLieElt, RngIntElt } → AlgLie, SeqEnum, SeqEnum, UserProgram`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-nilpotentquotient-algfplieelt-rngintelt-2)
    - [Example: Nilpotent Quotient](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-ed7e0d)
  - [Homomorphisms of the Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#homomorphisms-of-the-free-lie-algebra)
    - [`hom<L -> M | Q>: AlgFPLie, AlgFPLie, [ AlgFPLieElt ] → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#constructor-constructor-hom-algfplie-algfplie-algfplieelt-map)
    - [`hom<L -> M | Q>: AlgFPLie, TupMod, [ TupModElt ] → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#constructor-constructor-hom-algfplie-tupmod-tupmodelt-map)
    - [Example: Homomorphisms from a Free Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#example-ex-8cb631)
- [Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md)
  - [Constructing Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#constructing-lie-algebras-generated-by-extremal-elements)
    - [`ExtremalLieAlgebra(K, n): Rng, RngIntElt → AlgLieExtr`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-extremalliealgebrakn)
    - [`ExtremalLieAlgebra(K, G): Rng, GrphUnd → AlgLieExtr`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-extremalliealgebra-rng-grphund)
  - [Properties of Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#properties-of-lie-algebras-generated-by-extremal-elements)
    - [`NumberOfGenerators(L): AlgLieExtr → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-numberofgenerators-alglieextr)
    - [`Ngens(L): AlgLieExtr → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-ngens-alglieextr)
    - [`CoefficientRing(L): AlgLieExtr → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-coefficientring-alglieextr)
    - [`BaseRing(L): AlgLieExtr → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-basering-alglieextr)
    - [`CommutatorGraph(L): AlgLieExtr → GrphUnd`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-commutatorgraph-alglieextr)
    - [Example: Lie Algebra from Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-3fa178)
    - [`Basis(L): AlgLieExtr → SeqEnum[AlgFPLieElt], SeqEnum[UserProgram]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-basis-alglieextr)
    - [`ZBasis(L): AlgLieExtr → SeqEnum[AlgFPLieElt], SeqEnum[RngIntElt], SeqEnum[AlgFPLieElt]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-zbasis-alglieextr)
    - [`Dimension(L): AlgLieExtr → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-dimension-alglieextr)
    - [Example: Basis of an Extremal Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-0b6eca)
    - [`MultiplicationTable(~L): AlgLieExtr`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#procedure-multiplicationtablelproc)
    - [`MultiplicationTable(L): AlgLieExtr → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-multiplicationtablel)
    - [Example: Multiplication Table of an Extremal Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-7dacec)
  - [Instances of Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#instances-of-lie-algebras-generated-by-extremal-elements)
    - [`Instance(L): AlgLieExtr → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-instance-alglieextr)
    - [`Instance(L, Q): AlgLieExtr, SeqEnum → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-instance-alglieextr-seqenum)
    - [Example: Instance of an Extremal Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-658a16)
  - [Studying the Parameter Space](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#studying-the-parameter-space)
    - [`FreefValues(L): AlgLieExtr → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-freefvalues)
    - [`fValue(L, x, b): AlgLieExtr, RngIntElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-fvalue-alglieextr-rngintelt-rngintelt)
    - [`fValueProof(L, x, b): AlgLieExtr, RngIntElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#procedure-fvalueproof-alglieextr-rngintelt-rngintelt)
    - [Example: Free Parameters of an Extremal Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-dc2192)
    - [`DimensionsEstimate(L, g): AlgLieExtr, UserProgram → SeqEnum, SetMulti`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-dimensionsestimate)
    - [`InstancesForDimensions(L, g, D): AlgLieExtr, UserProgram, SetEnum[RngIntElt] → Assoc`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-instancesfordimensions-alglieextr-userprogram-setenum-rngintelt)
    - [Example: Dimensions of the Parameter Variety](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-44228f)
- [Families of Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md)
  - [Almost Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#almost-reductive-lie-algebras)
    - [`LieAlgebra(T, k): MonStgElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra)
    - [`LieAlgebra(R, k): RootDtm, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-rootdtm-rng)
    - [`LieAlgebra(R, k): RootSys, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-rootsys-rng)
    - [`LieAlgebra(D, k): GrphDir, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-grphdir-rng)
    - [`LieAlgebra(C, k): AlgMatElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-algmatelt-rng)
    - [`MatrixLieAlgebra(T, k): MonStgElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra)
    - [`MatrixLieAlgebra(R, k): RootDtm, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra-rootdtm-rng)
    - [`MatrixLieAlgebra(R, k): RootSys, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra-rootsys-rng)
    - [`MatrixLieAlgebra(D, k): GrphDir, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra-grphdir-rng)
    - [`MatrixLieAlgebra(C, k): AlgMatElt, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra-algmatelt-rng)
    - [Example: Constructing Semisimple Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-05c3a3)
    - [Example: Isogeny Option for Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-ef718c)
    - [`LieAlgebra(N, k, p): MonStgElt, Rng, GrpPermElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-monstgelt-rng-grppermelt)
    - [`LieAlgebra(R, k, p): RootDtm, Rng, GrpPermElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra-rootdtm-rng-grppermelt)
    - [`TwistedLieAlgebra(R, k): RootDtm, Rng → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-twistedliealgebra-rootdtm-rng)
    - [Example: Twisted Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-0173e2)
  - [Cartan-Type Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#cartan-type-lie-algebras)
    - [`WittLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-wittliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [Example: Witt Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-ea6512)
    - [`SpecialLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, AlgLie, Map, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-specialliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [`ConformalSpecialLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, AlgLie, AlgLie, Map, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-conformalspecialliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [Example: Special Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-c2ee06)
    - [`HamiltonianLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-hamiltonianliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [`ConformalHamiltonianLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, AlgLie, AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-conformalhamiltonianliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [Example: Hamiltonian Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-2e2daf)
    - [`ContactLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] → AlgLie, AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-contactliealgebra-fld-rngintelt-seqenum-rngintelt)
    - [Example: Contact Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-983c1d)
  - [Melikian Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#melikian-lie-algebras)
    - [`MelikianLieAlgebra(F, n1, n2): Fld, RngIntElt, RngIntElt → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-melikianliealgebra-fld-rngintelt-rngintelt)
    - [Example: Melikian Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#example-ex-c70322)
- [Construction of Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md)
  - [`Zero(L): AlgLie → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-zero-alglie)
  - [`Zero(L): AlgMatLie → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-zero-algmatlie)
  - [`L ! 0: AlgLie, RngIntElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#operation-op-alglie-rngintelt)
  - [`L ! 0: AlgMatLie, RngIntElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#operation-op-algmatlie-rngintelt)
  - [`Random(L): AlgLie → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-random-alglie)
  - [`Random(L): AlgMatLie → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-random-algmatlie)
  - [Construction of Elements of Structure Constant Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#construction-of-elements-of-structure-constant-algebras)
    - [`elt<L | r₁, r₂, ..., rₙ>: AlgLie, RngElt, RngElt, ..., RngElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#constructor-constructor-elt-alglie-rngelt-rngelt-rngelt-alglieelt)
    - [`L ! Q: AlgLie, SeqEnum[RngElt] → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#operation-op-alglie-seqenum-rngelt)
    - [`BasisProduct(L, i, j): AlgLie, RngIntElt, RngIntElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-basisproduct-alglie-rngintelt-rngintelt)
    - [`BasisProducts(L): AlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-basisproducts-alglie)
  - [Construction of Matrix Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#construction-of-matrix-elements)
    - [`elt<R | L>: AlgMatLie, [ RngElt ] → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#constructor-constructor-elt-algmatlie-rngelt-algmatlieelt)
    - [`elt<R | L>: AlgMatLie, RngElt, ..., RngElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#constructor-constructor-elt-algmatlie-rngelt-rngelt-algmatlieelt)
    - [`R ! L: AlgMatLie, [RngElt] → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#operation-op-algmatlie-rngelt)
    - [`DiagonalMatrix(L, Q): AlgMatLie, [RngElt] → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-diagonalmatrix-algmatlie-rngelt)
    - [`ScalarMatrix(L, r): AlgMatLie, RngElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#function-scalarmatrix-algmatlie-rngelt)
- [Construction of Subalgebras, Ideals, and Quotients](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md)
  - [`sub<L | A>: AlgLie, List → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-sub-alglie-list-alglie-map)
  - [`sub<L | A>: AlgMatLie, List → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-sub-algmatlie-list-algmatlie-map)
  - [`ideal<L | A>: AlgLie, List → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-ideal-alglie-list-alglie-map)
  - [`ideal<L | A>: AlgMatLie, List → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-ideal-algmatlie-list-algmatlie-map)
  - [`quo<L | A>: AlgLie, List → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-quo-alglie-list-alglie-map)
  - [`quo<L | A>: AlgMatLie, List → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#constructor-constructor-quo-algmatlie-list-algmatlie-map)
  - [`L / S: AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#operation-op-div-alglie-alglie)
  - [`L / S: AlgMatLie, AlgMatLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#operation-op-div-algmatlie-algmatlie)
  - [Example: Quotient of a Matrix Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#example-ex-bb05e7)
  - [`QuotientWithPullback(L, I): AlgLie, AlgLie → AlgLie, Map, UserProgram, UserProgram`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#function-quotientwithpullback-alglie-alglie)
  - [Example: Quotient and Pullback of an Ideal](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#example-ex-83d77d)
- [Operations on Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md)
  - [`L eq K: AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-eq-alglie-alglie)
  - [`L eq K: AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-eq-algmatlie-algmatlie)
  - [`L ne K: AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-ne-alglie-alglie)
  - [`L ne K: AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-ne-algmatlie-algmatlie)
  - [`L subset K: AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-subset-alglie-alglie)
  - [`L subset K: AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-subset-algmatlie-algmatlie)
  - [`L notsubset K: AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-operation-notsubset-alglie-alglie-boolelt)
  - [`L meet M: AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-meet-alglie-alglie)
  - [`L meet M: AlgMatLie, AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-meet-algmatlie-algmatlie)
  - [`L * M: AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-times-alglie-alglie)
  - [`L * M: AlgMatLie, AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-times-algmatlie-algmatlie)
  - [`L ^ n: AlgLie, RngIntElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-op-pow-alglie-rngintelt)
  - [`Morphism(L, M): AlgLie, AlgLie → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-morphism-alglie-alglie)
  - [`IsIsomorphic(L, M): AlgLie, AlgLie → BoolElt, .`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isisomorphiclie)
  - [`IsKnownIsomorphic(L, M): AlgLie, AlgLie → BoolElt, BoolElt, .`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isknownisomorphic-alglie-alglie)
  - [`IsIsomorphism(m): Map[AlgLie, AlgLie] → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isisomorphism-map-alglie-alglie)
  - [Example: Isomorphism of B2 and C2](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-4fbecb)
  - [Example: Isomorphic Ideals of G2 and A2](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-3b3b3e)
  - [Basic Invariants](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#basic-invariants)
    - [`CoefficientRing(L): AlgLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-coefficientring-alglie)
    - [`CoefficientRing(L): AlgMatLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-coefficientring-algmatlie)
    - [`BaseRing(L): AlgLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basering-alglie)
    - [`BaseRing(L): AlgMatLie → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basering-algmatlie)
    - [`Dimension(L): AlgLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-dimension-alglie)
    - [`Dimension(L): AlgMatLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-dimension-algmatlie)
    - [`# L: AlgLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-operation-alglie-rngintelt)
    - [`# L: AlgMatLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-operation-algmatlie-rngintelt)
    - [`Moduli(L): AlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-moduli-alglie)
    - [Example: Moduli of a Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-29430b)
  - [Changing Base Rings](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#changing-base-rings)
    - [`ChangeRing(L, S): AlgLie, Rng → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-changering-alglie-rng)
    - [`ChangeRing(L, S): AlgMatLie, Rng → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-changering-algmatlie-rng)
    - [`ChangeRing(L, S, f): AlgLie, Rng, Map → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-changering-alglie-rng-map)
    - [`ChangeRing(L, S, f): AlgMatLie, Rng, Map → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-changering-algmatlie-rng-map)
  - [Bases](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#bases)
    - [`BasisElement(A, i): AlgLie, RngIntElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basiselement-alglie-rngintelt)
    - [`BasisElement(A, i): AlgMatLie, RngIntElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basiselement-algmatlie-rngintelt)
    - [`A . i: AlgLie, RngIntElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-operation-alglie-rngintelt-alglieelt)
    - [`A . i: AlgMatLie, RngIntElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operation-operation-algmatlie-rngintelt-algmatlieelt)
    - [`Basis(A): AlgLie → [ AlgLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basis-alglie)
    - [`Basis(A): AlgMatLie → [ AlgMatLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-basis-algmatlie)
    - [`IsIndependent(Q): [ AlgLieElt ] → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isindependent-alglieelt)
    - [`IsIndependent(Q): [ AlgMatLieElt ] → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isindependent-algmatlieelt)
    - [`IsIndependent(Q): { AlgLieElt } → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isindependent-alglieelt-2)
    - [`IsIndependent(Q): { AlgMatLieElt } → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isindependent-algmatlieelt-2)
    - [`ExtendBasis(S, L): AlgLie, AlgLie → [ AlgElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-extendbasis-alglie-alglie)
    - [`ExtendBasis(S, L): AlgMatLie, AlgMatLie → [ AlgElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-extendbasis-algmatlie-algmatlie)
    - [`ExtendBasis(Q, L): [ AlgLieElt ], AlgLie → [ AlgElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-extendbasis-alglieelt-alglie)
    - [`ExtendBasis(Q, L): [ AlgMatLie ], AlgMatLie → [ AlgElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-extendbasis-algmatlie-algmatlie-2)
  - [Operations for Semisimple and Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#operations-for-semisimple-and-reductive-lie-algebras)
    - [`SemisimpleType(L): AlgLie → MonStgElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-semisimpletype-alglie)
    - [`SemisimpleType(L): AlgMatLie → MonStgElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-semisimpletype-algmatlie)
    - [`CartanName(L): AlgLie → MonStgElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-cartanname-alglie)
    - [`CartanName(L): AlgMatLie → MonStgElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-cartanname-algmatlie)
    - [Example: Semisimple Type of a Levi Subalgebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-6372db)
    - [`ReductiveType(L): AlgLie → RootDtm, MonStgElt, SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-reductivetype-alglie)
    - [`ReductiveType(L, H): AlgLie, AlgLie → RootDtm, MonStgElt, SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-reductivetype-alglie-alglie)
    - [Example: Reductive Type in Characteristic 2](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-c3afbb)
    - [`RootSystem(L): AlgLie → [ ModTupRngElt ], [ AlgLieElt ], [ ModTupRngElt ], AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-rootsystem-alglie)
    - [`RootSystem(L): AlgMatLie → [ ModTupRngElt ], [ AlgMatLieElt ], [ ModTupRngElt ], AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-rootsystem-algmatlie)
    - [Example: Root System of G2](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-cfabbc)
    - [`RootDatum(L): AlgLie → RootDtm`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-rootdatum-alglie)
    - [`RootDatum(L): AlgMatLie → RootDtm`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-rootdatum-algmatlie)
    - [Example: Root Datum and Cartan Matrix](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-afa536)
    - [`ChevalleyBasis(L): AlgLie → [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-chevalleybasis)
    - [`ChevalleyBasis(L, H): AlgLie, AlgLie → [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-chevalleybasis-alglie-alglie)
    - [`ChevalleyBasis(L): AlgMatLie → [ AlgMatLieElt ], [ AlgMatLieElt ], [ AlgMatLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-chevalleybasis-algmatlie)
    - [Example: Chevalley Basis](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-fc1498)
    - [`ChevalleyBasis(L, H, R): AlgLie, AlgLie, RootDtm → [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-chevalleybasis-alglie-alglie-rootdtm)
    - [`IsChevalleyBasis(L, R, x, y, h): AlgLie, RootDtm, [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ] → BoolElt, [ Tup ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-ischevalleybasis-alglie-rootdtm-alglieelt-alglieelt-alglieelt)
    - [Example: Chevalley Basis in Small Characteristic](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-f1d947)
    - [`TwistedBasis(L, H, R): AlgLie, AlgLie, RootDtm → AlgLie, AlgLie, Rec, AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-twistedbasis)
    - [Example: Twisted Basis of 2A2](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#example-ex-cf55bc)
    - [`WeylGroup(L): AlgLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-weylgroup-alglie)
    - [`WeylGroup(GrpPermCox, L): Cat, AlgLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-weylgroup-cat-alglie)
    - [`WeylGroup(GrpFPCox, L): Cat, AlgLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-weylgroup-cat-alglie-2)
    - [`WeylGroup(GrpMat, L): Cat, AlgLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-weylgroup-cat-alglie-3)
- [Operations on Subalgebras and Ideals](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md)
  - [`DirectSum(L, M): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-directsum-alglie-alglie)
  - [`DirectSum(L, M): AlgMatLie, AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-directsum-algmatlie-algmatlie)
  - [`IndecomposableSummands(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-indecomposablesummands-alglie)
  - [`IndecomposableSummands(L): AlgMatLie → [ AlgMatLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-indecomposablesummands-algmatlie)
  - [`DirectSumDecomposition(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-directsumdecomposition-alglie)
  - [`DirectSumDecomposition(L): AlgMatLie → [ AlgMatLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-directsumdecomposition-algmatlie)
  - [Example: Direct Sum Decomposition](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-45b01f)
  - [Standard Ideals and Subalgebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#standard-ideals-and-subalgebras)
    - [`Centre(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centre-alglie)
    - [`Centre(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centre-algmatlie)
    - [`Center(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-center-alglie)
    - [`Center(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-center-algmatlie)
    - [`Centraliser(L, K): AlgLie, AlgLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centraliser-alglie-alglie)
    - [`Centraliser(L, K): AlgMatLie, AlgMatLie → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centraliser-algmatlie-algmatlie)
    - [`Centralizer(L, K): AlgLie, AlgLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centralizer-alglie-alglie)
    - [`Centralizer(L, K): AlgMatLie, AlgMatLie → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centralizer-algmatlie-algmatlie)
    - [`Centraliser(L, x): AlgLie, AlgLieElt → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centraliser-alglie-alglieelt)
    - [`Centraliser(L, x): AlgMatLie, AlgMatLieElt → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centraliser-algmatlie-algmatlieelt)
    - [`Centralizer(L, x): AlgLie, AlgLieElt → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centralizer-alglie-alglieelt)
    - [`Centralizer(L, x): AlgMatLie, AlgMatLieElt → AlgMatLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-centralizer-algmatlie-algmatlieelt)
    - [`Normaliser(L, K): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-normaliser-alglie-alglie)
    - [`Normaliser(L, K): AlgMatLie, AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-normaliser-algmatlie-algmatlie)
    - [`Normalizer(L, K): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-normalizer-alglie-alglie)
    - [`Normalizer(L, K): AlgMatLie, AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-normalizer-algmatlie-algmatlie)
    - [`SolubleRadical(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-solubleradical-alglie)
    - [`SolubleRadical(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-solubleradical-algmatlie)
    - [`SolvableRadical(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-solvableradical-alglie)
    - [`SolvableRadical(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-solvableradical-algmatlie)
    - [`Nilradical(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-nilradical-alglie)
    - [`Nilradical(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-nilradical-algmatlie)
    - [Example: Centre, Normaliser, and Other Operations](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-d2d791)
  - [Cartan and Toral Subalgebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#cartan-and-toral-subalgebras)
    - [`CartanSubalgebra(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-cartansubalgebra-alglie)
    - [`CartanSubalgebra(L): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-cartansubalgebra-algmatlie)
    - [`IsCartanSubalgebra(L, H): AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-iscartansubalgebra-alglie-alglie)
    - [`IsCartanSubalgebra(L, H): AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-iscartansubalgebra-algmatlie-algmatlie)
    - [Example: Cartan Subalgebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-675c63)
    - [`SplittingCartanSubalgebra(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-splittingcartansubalgebra-alglie)
    - [`SplitMaximalToralSubalgebra(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-splitmaximaltoralsubalgebra)
    - [`IsSplittingCartanSubalgebra(L, H): AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-issplittingcartansubalgebra-alglie-alglie)
    - [`IsSplittingCartanSubalgebra(L, H): AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-issplittingcartansubalgebra-algmatlie-algmatlie)
    - [`SplitToralSubalgebra(L): AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-splittoralsubalgebra)
    - [`IsSplitToralSubalgebra(L, H): AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-issplittoralsubalgebra-alglie-alglie)
    - [Example: Split Toral Subalgebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-3f1c22)
  - [Standard Series](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#standard-series)
    - [`CompositionSeries(L): AlgLie → [ Alg ], [ AlgLie ], AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-compositionseries-alglie)
    - [`CompositionFactors(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-compositionfactors-alglie)
    - [`MinimalIdeals(L : parameters): AlgLie → [ AlgLie ], BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-minimalideals-alglie)
    - [`MaximalIdeals(L : parameters): AlgLie → [ AlgLie ], BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-maximalideals-alglie)
    - [`DerivedSeries(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-derivedseries-alglie)
    - [`DerivedSeries(L): AlgMatLie → [ AlgMatLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-derivedseries-algmatlie)
    - [`LowerCentralSeries(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-lowercentralseries-alglie)
    - [`LowerCentralSeries(L): AlgMatLie → [ AlgMatLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-lowercentralseries-algmatlie)
    - [`UpperCentralSeries(L): AlgLie → [ AlgLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-uppercentralseries-alglie)
    - [`UpperCentralSeries(L): AlgMatLie → [ AlgMatLie ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-uppercentralseries-algmatlie)
    - [Example: Series of a Subalgebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-9cb576)
  - [The Lie Algebra of Derivations](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#the-lie-algebra-of-derivations)
    - [`LieAlgebraOfDerivations(L): AlgLie → AlgLie, Rec`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-liealgebraofderivations-alglie)
    - [Example: Lie Algebra of Derivations](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#example-ex-d37e8c)
- [Properties of Lie Algebras and Ideals](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md)
  - [`KillingForm(L): AlgLie → ModMatFldElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-killingform-alglie)
  - [`KillingForm(L): AlgMatLie → ModMatFldElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-killingform-algmatlie)
  - [`KillingMatrix(L): AlgLie → ModMatFldElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-killingmatrix-alglie)
  - [`KillingMatrix(L): AlgMatLie → ModMatFldElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-killingmatrix-algmatlie)
  - [Example: Killing Matrix of a Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#example-ex-53bd1a)
  - [`IsAbelian(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isabelian-alglie)
  - [`IsAbelian(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isabelian-algmatlie)
  - [`IsSoluble(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issoluble-alglie)
  - [`IsSoluble(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issoluble-algmatlie)
  - [`IsSolvable(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issolvable-alglie)
  - [`IsSolvable(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issolvable-algmatlie)
  - [`IsNilpotent(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isnilpotent-alglie)
  - [`IsNilpotent(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isnilpotent-algmatlie)
  - [`IsCentral(L, M): AlgLie, AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-iscentral-alglie-alglie)
  - [`IsCentral(L, M): AlgMatLie, AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-iscentral-algmatlie-algmatlie)
  - [`IsSimple(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issimple-alglie)
  - [`IsSimple(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issimple-algmatlie)
  - [`IsSemisimple(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issemisimple-alglie)
  - [`IsSemisimple(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-issemisimple-algmatlie)
  - [`IsReductive(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isreductive-alglie)
  - [`IsReductive(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isreductive-algmatlie)
  - [`HasLeviSubalgebra(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-haslevisubalgebra-alglie)
  - [`HasLeviSubalgebra(L): AlgMatLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-haslevisubalgebra-algmatlie)
  - [`IsClassicalType(L): AlgLie → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#function-isclassicaltype-alglie)
  - [Example: Predicates on a Simple Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#example-ex-6ba33a)
- [Operations on Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md)
  - [`x + y: AlgLieElt, AlgLieElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-plus-alglieelt-alglieelt)
  - [`x + y: AlgMatLieElt, AlgMatLieElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-plus-algmatlieelt-algmatlieelt)
  - [`x - y: AlgLieElt, AlgLieElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-minus-alglieelt-alglieelt)
  - [`x - y: AlgMatLieElt, AlgMatLieElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-minus-algmatlieelt-algmatlieelt)
  - [`x * y: AlgLieElt, AlgLieElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-times-alglieelt-alglieelt)
  - [`x * y: AlgMatLieElt, AlgMatLieElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#operation-op-times-algmatlieelt-algmatlieelt)
  - [`IsCentral(L, M): AlgLie, AlgLieElt → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#function-iscentral-alglie-alglieelt)
  - [`IsCentral(L, M): AlgMatLie, AlgMatLieElt → BoolElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#function-iscentral-algmatlie-algmatlieelt)
  - [`NonNilpotentElement(L): AlgLie → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#function-nonnilpotentelement-alglie)
  - [Example: Non-Nilpotent Element](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#example-ex-a38e8a)
  - [`AdjointMatrix(L, x): AlgLie, AlgLieElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#function-adjointmatrix-alglie-alglieelt)
  - [`RightAdjointMatrix(L, x): AlgLie, AlgLieElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#function-rightadjointmatrix-alglie-alglieelt)
  - [Example: Adjoint Matrix of an Element](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#example-ex-c4c36f)
  - [Indexing](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#indexing)
    - [`a[i]: AlgLieElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#indexed-indexed-a-alglieelt-rngintelt-rngelt)
    - [`a[i]: AlgMatLieElt, RngIntElt → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#literal-literal-a-i-algmatlieelt-rngintelt-modtuprngelt)
    - [`a[i] := r: AlgLieElt, RngIntElt, RngElt → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#literal-literal-a-i-r-alglieelt-rngintelt-rngelt-alglieelt)
    - [`a[i] := r: AlgMatLieElt, RngIntElt, ModTupRngElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#literal-literal-a-i-r-algmatlieelt-rngintelt-modtuprngelt-algmatlieelt)
    - [`a[i, j]: AlgMatLieElt, RngIntElt, RngIntElt → RngElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#indexed-indexed-a-algmatlieelt-rngintelt-rngintelt-rngelt)
    - [`a[i, j] := r: AlgMatLieElt, RngIntElt, RngIntElt, RngElt → AlgMatLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#literal-literal-a-i-j-r-algmatlieelt-rngintelt-rngintelt-rngelt-algmatlieelt)
- [The Natural Module](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md)
  - [`Module(L): AlgLie → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-module-alglie)
  - [`RModule(L): AlgMatLie → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-rmodule-algmatlie)
  - [`BaseModule(L): AlgMatLie → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-basemodule-algmatlie)
  - [`Degree(L): AlgLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-degree-alglie)
  - [`Degree(L): AlgMatLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-degree-algmatlie)
  - [`Degree(a): AlgLieElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-degree-alglieelt)
  - [`ElementToSequence(a): AlgLieElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-elementtosequence-alglieelt)
  - [`Eltseq(a): AlgLieElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-eltseq-alglieelt)
  - [`Coordinates(M, a): AlgLie, AlgLieElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-coordinates-alglie-alglieelt)
  - [`Coordinates(M, a): AlgMatLie, AlgMatLieElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-coordinates-algmatlie-algmatlieelt)
  - [`InnerProduct(a, b): AlgLieElt, AlgLieElt → RngElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-innerproduct-alglieelt-alglieelt)
  - [`Support(a): AlgLieElt → SetEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#function-support-alglieelt)
- [Operations for Matrix Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md)
  - [`BaseModule(M): AlgMatLie → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-basemodule-algmatlie-2)
  - [`Generic(M): AlgMatLie → AlgMatLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-generic-algmatlie)
  - [`Kernel(X): AlgMatLieElt → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-kernel-algmatlieelt)
  - [`Nullspace(X): AlgMatLieElt → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-nullspace-algmatlieelt)
  - [`NullspaceOfTranspose(X): AlgMatLieElt → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-nullspaceoftranspose-algmatlieelt)
  - [`RowNullSpace(X): AlgMatLieElt → ModTupRng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#function-rownullspace-algmatlieelt)
- [Homomorphisms](https://docs.magma-maths.org/LieTheory/LieAlgebras/homomorphisms.md)
  - [`hom<L -> M | Q>: AlgLie, AlgLie, [ AlgLieElt ] → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/homomorphisms.md#constructor-constructor-hom-alglie-alglie-alglieelt-map)
  - [`hom<L -> M | Q>: AlgLie, TupMod, [ TupModElt ] → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/homomorphisms.md#constructor-constructor-hom-alglie-tupmod-tupmodelt-map)
- [Automorphisms of Classical-type Reductive Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md)
  - [`IdentityAutomorphism(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-identityautomorphism-alglie)
  - [`InnerAutomorphism(L, x): AlgLie, GrpLieElt → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-innerautomorphism-alglie-grplieelt)
  - [`InnerAutomorphismGroup(L): AlgLie → GrpLie, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-innerautomorphismgroup-alglie)
  - [`DiagonalAutomorphism(L, v): AlgLie, ModTupRngElt → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-diagonalautomorphism-alglie-modtuprngelt)
  - [`GraphAutomorphism(L, p): AlgLie, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-graphautomorphism-alglie-grppermelt)
  - [`DiagramAutomorphism(L, p): AlgLie, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#function-diagramautomorphism-alglie-grppermelt)
  - [Example: Graph Automorphism of Order Three](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#example-ex-d6f1f7)
- [Restrictable Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md)
  - [`IsRestrictable(L): AlgLie → BoolElt, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-isrestrictable-alglie)
  - [`IsRestricted(L): AlgLie → BoolElt, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-isrestricted-alglie)
  - [`IspLieAlgebra(L): AlgLie → BoolElt, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-ispliealgebra-alglie)
  - [`RestrictionMap(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-restrictionmap-alglie)
  - [`pMap(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-pmap-alglie)
  - [Example: Restrictable Lie Algebras and p-Maps](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#example-ex-7334d1)
  - [`RestrictedSubalgebra(Q): SetEnum[AlgLieElt] → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-restrictedsubalgebra-setenum-alglieelt)
  - [`pSubalgebra(Q): SetEnum[AlgLieElt] → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-psubalgebra-setenum-alglieelt)
  - [`pClosure(L, M): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-pclosure-alglie-alglie)
  - [`IsRestrictedSubalgebra(L, M): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-isrestrictedsubalgebra-alglie-alglie)
  - [`IspSubalgebra(L, M): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-ispsubalgebra-alglie-alglie)
  - [`pQuotient(L, M): AlgLie, AlgLie → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-pquotient-alglie-alglie)
  - [`JenningsLieAlgebra(G): Grp → AlgLie, SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#function-jenningsliealgebra-grp)
  - [Example: Jennings Lie Algebra of a p-Group](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#example-ex-2771f0)
- [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md)
  - [Background](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#background)
    - [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#uea-background-1)
    - [The Integral Form of a Universal Enveloping Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#the-integral-form-of-a-universal-enveloping-algebra)
  - [Construction of Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#construction-of-universal-enveloping-algebras)
    - [`UniversalEnvelopingAlgebra(L): AlgLie → AlgUE`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-universalenvelopingalgebra-alglie)
    - [`IntegralUEA(L): AlgLie → AlgIUE`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-integraluea-alglie)
    - [`IntegralUEAlgebra(L): AlgLie → AlgIUE`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-integraluealgebra-alglie)
    - [`IntegralUniversalEnvelopingAlgebra(L): AlgLie → AlgIUE`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-integraluniversalenvelopingalgebra-alglie)
    - [Example: Constructing a Universal Enveloping Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#example-ex-c78d02)
    - [`AssignNames(~U, Q): AlgPBW, [ MonStgElt ]`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#procedure-assignnames-algpbw-monstgelt-ref)
    - [`ChangeRing(U, S): AlgUE, Rng → AlgUE`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-changering-algue-rng)
  - [Related Structures](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#related-structures)
    - [`CoefficientRing(U): AlgPBW → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-coefficientring-algpbw)
    - [`BaseRing(U): AlgPBW → Rng`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-basering-algpbw)
    - [`Algebra(U): AlgUE → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-algebra-algue)
  - [Elements of Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#elements-of-universal-enveloping-algebras)
    - [Creation of Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#creation-of-elements)
      - [`U ! 0: AlgPBW, RngIntElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-algpbw-rngintelt)
      - [`Zero(U): AlgPBW → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-zero-algpbw)
      - [`U ! 1: AlgPBW, RngIntElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-algpbw-rngintelt-2)
      - [`One(U): AlgPBW → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-one-algpbw)
      - [`U . i: AlgPBW, RngIntElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-operation-algpbw-rngintelt-algpbwelt)
      - [`U ! r: AlgPBW, Any → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-algpbw-any)
      - [`HBinomial(U, i, n): AlgIUE, RngIntElt, RngIntElt → AlgIUEElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-hbinomial-algiue-rngintelt-rngintelt)
      - [`HBinomial(h, n): AlgIUEElt, RngIntElt → AlgIUEElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-hbinomial-algiueelt-rngintelt)
      - [Example: Binomial Elements of an Integral Enveloping Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#example-ex-4c79c2)
    - [Operations on Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operations-on-elements)
      - [`x + y: AlgPBWElt, AlgPBWElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-plus-algpbwelt-algpbwelt)
      - [`x - y: AlgPBWElt, AlgPBWElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-minus-algpbwelt-algpbwelt)
      - [`x * y: AlgPBWElt, AlgPBWElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-times-algpbwelt-algpbwelt)
      - [`c * x: RngElt, AlgPBWElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-times-rngelt-algpbwelt)
      - [`x * c: AlgPBWElt, RngElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-times-algpbwelt-rngelt)
      - [`x ^ n: AlgPBWElt, RngIntElt → AlgPBWElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#operation-op-pow-algpbwelt-rngintelt)
      - [`Monomials(u): AlgPBWElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-monomials-algpbwelt)
      - [`Coefficients(u): AlgPBWElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-coefficients-algpbwelt)
      - [`Degree(u, i): AlgPBWElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#function-degree-algpbwelt-rngintelt)
      - [Example: Operations on Enveloping Algebra Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#example-ex-81e4e4)
- [Solvable and Nilpotent Lie Algebras Classification](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md)
  - [The List of Solvable Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#the-list-of-solvable-lie-algebras)
  - [Comments on the Classification over Finite Fields](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#comments-on-the-classification-over-finite-fields)
  - [The List of Nilpotent Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#the-list-of-nilpotent-lie-algebras)
  - [Intrinsics for Working with the Classifications](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#intrinsics-for-working-with-the-classifications)
    - [`SolvableLieAlgebra( F, n, k : parameters): Fld, RngIntElt, RngIntElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-solvableliealgebra-fld-rngintelt-rngintelt)
    - [Example: Solvable Lie Algebra from the Classification](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#example-ex-72dcd0)
    - [`NilpotentLieAlgebra( F, r, k : parameters): Fld, RngIntElt, RngIntElt → AlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-nilpotentliealgebra-fld-rngintelt-rngintelt)
    - [Example: Nilpotent Lie Algebra from the Classification](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#example-ex-3827f2)
    - [`AllSolvableLieAlgebras(F, d): Fld, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-allsolvableliealgebras-fld-rngintelt)
    - [`AllNilpotentLieAlgebras(F, d): Fld, RngIntElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-allnilpotentliealgebras-fld-rngintelt)
    - [`IdDataSLAC(L): AlgLie → MonStgElt, SeqEnum, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-iddataslac-alglie)
    - [`IdDataNLAC(L): AlgLie → MonStgElt, SeqEnum, Map`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-iddatanlac-alglie)
    - [`MatrixOfIsomorphism(f): Map → AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#function-matrixofisomorphism-map)
    - [Example: Identifying a Solvable Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#example-ex-b0dc46)
    - [Example: Identifying a Nilpotent Lie Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#example-ex-7b45ed)
- [Semisimple Subalgebras of Simple Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md)
  - [`SubalgebrasInclusionGraph( t ): MonStgElt → GrphDir`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md#function-subalgebrasinclusiongraph-monstgelt)
  - [Example: Maximal Semisimple Subalgebras of C3](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md#example-ex-7eb7e1)
  - [`RestrictionMatrix( G, k ): GrphDir, RngIntElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md#function-restrictionmatrix-grphdir-rngintelt)
  - [Example: Branching from D4 to G2](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md#example-ex-03a6eb)
- [Nilpotent Orbits in Simple Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md)
  - [`IsGenuineWeightedDynkinDiagram( L, wd ): AlgLie, SeqEnum → BoolElt, SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-isgenuineweighteddynkindiagram-alglie-seqenum)
  - [Example: Classifying Nilpotent Orbits](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-762477)
  - [`NilpotentOrbit( L, wd ): AlgLie, SeqEnum → NilpOrbAlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-nilpotentorbit-alglie-seqenum)
  - [`NilpotentOrbit( L, e ): AlgLie, AlgLieElt → NilpOrbAlgLie`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-nilpotentorbit-alglie-alglieelt)
  - [Example: Nilpotent Orbits by Representative](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-ab5b8b)
  - [`NilpotentOrbits( L ): AlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-nilpotentorbits-alglie)
  - [Example: Nilpotent Orbits of D4](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-1ce736)
  - [`Partition( o ): NilpOrbAlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-partition-nilporbalglie)
  - [Example: Partitions of Nilpotent Orbits](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-52861d)
  - [`SL2Triple( o ): NilpOrbAlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-sl2triple-nilporbalglie)
  - [`SL2Triple( L, e ): AlgLie, AlgLieElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-sl2triple-alglie-alglieelt)
  - [`Representative( o ): NilpOrbAlgLie → AlgLieElt`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-representative-nilporbalglie)
  - [`WeightedDynkinDiagram( o ): NilpOrbAlgLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#function-weighteddynkindiagram-nilporbalglie)
  - [Example: Weighted Dynkin Diagram of an Orbit](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-eb9e7c)
- [Bibliography](https://docs.magma-maths.org/LieTheory/LieAlgebras/bibliography.md)

<a id="sectalglieintro"></a>
<a id="id1"></a>
### Introduction

This chapter is concerned with finite dimensional Lie algebras. A large number of specialised functions are provided for these algebras. We refer to [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)] for a general introduction to the theory of Lie algebras and their algorithms. For some of the functions described here that rely on a non-trivial algorithm we will indicate a precise reference.

Lie algebras are viewed as free modules over a base ring $R$ with a multiplication satisfying the usual Lie axioms. Some functions require additional conditions on the base ring; for example, many functions require that the base ring be a field.

The main computational machinery in Magma for Lie algebras assumes that they are given either as structure constant algebras or as matrix algebras. Functions are provided which, given a finitely presented finite dimensional Lie algebra, will attempt to construct an isomorphic structure constant Lie algebra. As a structure constant algebra, the Lie algebra $L$ of dimension $n$ over a ring $R$ is defined in Magma by giving the $n^3$ *structure constants* $a_{ij}^k \in R (1 \le i, j, k \le n)$ such that, if $\{e_1, e_2, \ldots, e_n\}$ is the basis of $L$, $e_i * e_j = \sum_{k = 1}^n a_{ij}^k * e_k$.

In Magma V there is more functionality for Lie algebras defined by structure constants than for matrix Lie algebras. Throughout this chapter the algebra representation appropriate for a given intrinsic will be noted. For information on matrix algebras considered as associative algebras see Chapter [Matrix Algebras](https://docs.magma-maths.org/Algebras/MatrixAlgebras/index-matrix-algebras.md#chapalgmat).

In addition, some functions are provided for finitely presented Lie algebras and Lie algebras generated by extremal elements, and databases of solvable Lie algebras, nilpotent Lie algebras, and nilpotent orbits in simple Lie algebras are available.

<a id="introduction-guide"></a>
<a id="sectalglieintroguide"></a>
#### Guide for the Reader

As mentioned above, the most extensively supported Lie algebras in Magma are structure constant Lie algebras and matrix Lie algebras. The methods for constructing these (by explicitly specifying structure constants or matrices) are described in Sections [Constructors for Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#sectalglieconstr).

Well known simple finite Lie algebras can be more easily constructed by specifying the type. The classical, reductive, Lie algebras (A$_n$, B$_n$, C$_n$, D$_n$, E$_6$, E$_7$, E$_8$, F$_4$, G$_2$) and their twisted variants are described in Section [Almost Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalglieconstrred), the Witt Lie algebras and its derivatives (of *Cartan-Type*) in Section [Cartan-Type Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalgcartyp), and the Melikian Lie algebras in Section [Melikian Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalgmelikian). Those interested primarily in classical Lie algebras may want to skip to Section [Almost Reductive Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalglieconstrred), which includes a number of examples to get started.

Elementary properties of these Lie algebras (bases, types, Weyl group, etc.) are described in Section [Operations on Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#sectalglieop). This section also contains information about isomorphism testing. Other properties (nilpotency, simplicity) are discussed in Section [Properties of Lie Algebras and Ideals](https://docs.magma-maths.org/LieTheory/LieAlgebras/property.md#sectalglieprop). Some further operations that only apply to matrix Lie algebras may be found in Section [Operations for Matrix Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/matrix.md#sectalglieopmatrix).

Constructors such as direct sums, subalgebras, centralisers, Cartan subalgebras, derived series, etc. are treated in Sections [Construction of Subalgebras, Ideals, and Quotients](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-construct.md#sectalgliesubconstr) and [Operations on Subalgebras and Ideals](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#sectalgliesub); construction of homomorphisms can be found in Section [Homomorphisms](https://docs.magma-maths.org/LieTheory/LieAlgebras/homomorphisms.md#sectalgliehom). The construction of elements of Lie algebras is described in Section [Construction of Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/element-construct.md#sectalglieeltconstr), and operations on them in Section [Operations on Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/elements.md#sectalglieelt).

In addition to these Lie algebras Magma supports two other types of Lie algebras. Firstly finitely presented Lie algebras, as free Lie algebras modulo a set of relations, described in Section [Finitely Presented Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#sectfpalglie). Secondly Lie algebras generated by extremal elements, described in Section [Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#sectalglieextr).

More specialistic functions for structure constant Lie algebras are described in Sections [The Natural Module](https://docs.magma-maths.org/LieTheory/LieAlgebras/natural-module.md#sectalgliemodule) (the natural module), [Automorphisms of Classical-type Reductive Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/automorphisms-classical.md#sectalglieautsclass) (automorphisms of classical-type Lie algebras), [Restrictable Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/restrictable.md#sectalglieresla) (restrictable Lie algebras), and [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#sectunivea) (universal enveloping algebras).

Magma also provides databases and recognition procedures for small-dimensional solvable and nilpotent Lie algebras (described in Section [Solvable and Nilpotent Lie Algebras Classification](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#sectslac)), a database of semisimple subalgebras of simple Lie algebras (described in Section [Semisimple Subalgebras of Simple Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub-sssdb.md#subsectalgliesssclassification)), and a database of nilpotent orbits in simple Lie algebras (described in Section [Nilpotent Orbits in Simple Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#sectnilporb)).

Other chapters that may be of interest are Chapter [Kac-Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/index-kac-moody-lie-algebras.md#chapalgliekm) on Kac–Moody Lie algebras and Chapter [Quantum Groups](https://docs.magma-maths.org/LieTheory/QuantumGroups/index-quantum-groups.md#chap-quagrps) on Quantum Groups. Furthermore, Chapter [Representations of Lie Groups and Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/index-representations-of-lie-groups-and-algebras.md#chapliereps) deals with representations of Lie algebras and groups of Lie type. Of particular importance is Section [Lie Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#sectrdrepsconstralg), dealing with the construction of representations of Lie algebras.

<a id="construct"></a>
<a id="sectalglieconstr"></a>
### Constructors for Lie Algebras

The construction of a Lie algebra defined by structure constants is identical to that of a general structure constant algebra. Most constructors take two optional parameters: `Check` and `Rep`.

By default, the conditions for the algebra to be a Lie algebra are checked. If the user decides to omit this check, by setting the parameter `Check` to `false`, and the algebra is not actually Lie then functions in this section will fail or give incorrect answers.

The optional parameter `Rep` can be used to select the internal representation of the structure constants. The possible values for `Rep` are “`Dense`”, “`Sparse`”, and “`Partial`”, with the default being “`Dense`”. In the dense format, the $n^3$ structure constants are stored as $n^2$ vectors of length $n$. This is the best representation if most of the structure constants are non-zero. The sparse format, intended for use when most structure constants are zero, stores the positions and values of the non-zero structure constants. The partial format stores the vectors, but records for efficiency the positions of the non-zero structure constants.

<a id="constructor-liealgebrarnq"></a>
#### `LieAlgebra<R, n | Q : parameters >: Rng, RngIntElt, SeqEnum -> AlgLie`

<a id="constructor-constructor-liealgebra-modtuprng-seqenum-alglie"></a>
#### `LieAlgebra<M | Q : parameters >: ModTupRng, SeqEnum -> AlgLie`

```magma
Check: BoolElt                      Default: true
Rep  : MonStgElt                    Default: "Dense"
```

This function creates the Lie structure constant algebra $L$ over the free module $M = R^n$, with standard basis $\{e_1, e_2, \ldots, e_n\}$, and structure constants $a_{ij}^k$ being given by the sequence $Q$. The sequence $Q$ can be of any of the following three forms. Note that in all cases the actual ordering of the structure constants is the same: the only difference is that their partitioning into blocks varies.

**(i)**
A sequence of $n$ sequences of $n$ sequences of length $n$. The $j$-th element of the $i$-th sequence is the sequence $[ a_{ij}^1, \ldots, a_{ij}^n ]$, or the element $(a_{ij}^1, \ldots, a_{ij}^n)$ of $M$, giving the coefficients of the product $e_i * e_j$.

**(ii)**
A sequence of $n^2$ sequences of length $n$, or $n^2$ elements of $M$. Here the coefficients of $e_i * e_j$ are given by position $(i - 1)n + j$ of $Q$.

**(iii)**
A sequence of $n^3$ elements of the ring $R$. The sequence elements are the structure constants themselves, in the order $a_{11}^1, a_{11}^2, \ldots, a_{11}^n, a_{12}^1, a_{12}^2, \ldots, a_{nn}^n$. So $a_{ij}^k$ lies in position $(i - 1)n^2 + (j - 1)n + k$ of $Q$.

<a id="constructor-constructor-liealgebra-rng-rngintelt-seqenum-alglie"></a>
#### `LieAlgebra<R, n | T : parameters >: Rng, RngIntElt, SeqEnum -> AlgLie`

```magma
Check: BoolElt                      Default: true
Rep  : MonStgElt                    Default: "Dense"
```

This function creates the Lie structure constant algebra $L$ with standard basis $\{e_1, e_2, \ldots, e_n\}$ over the ring $R$. The sequence $T$ contains quadruples $< i, j, k, a_{ij}^k>$ giving the non-zero structure constants. All other structure constants are defined to be $0$.

<a id="constructor-constructor-liealgebra-seqenum-seqenum-alglie"></a>
#### `LieAlgebra< t | T : parameters >: SeqEnum, SeqEnum -> AlgLie`

```magma
Check: BoolElt                      Default: true
Rep  : MonStgElt                    Default: "Dense"
```

This function creates the Lie structure constant algebra $L$ over the integers, with standard basis $\{e_1, e_2, \ldots, e_n\}$. The sequence $T$ contains quadruples $< i, j, k, a_{ij}^k>$ (where the $a_{ij}^k$ are integers) giving the non-zero structure constants. All other structure constants are defined to be $0$. The argument $t$ is a sequence of length $n$ consisting of nonnegative integers giving the moduli of the basis elements. Thus let $t_i$ denote the $i$-th element of $t$; then $t_ie_i =0$. So if $t_i=0$, then $ke_i \neq 0$ for all integers $k$.

<a id="function-liealgebra-algass"></a>
#### `LieAlgebra(A): AlgAss -> AlgLie, Map`

Given an associative structure-constant algebra $A$, create the Lie algebra $L$ consisting of the elements in $A$ with the induced Lie product $(x,y) \rightarrow x*y - y*x$. As a second value the map identifying the elements of $L$ and $A$ is returned.

<a id="function-liealgebra-algmat"></a>
#### `LieAlgebra(A): AlgMat -> AlgLie`

Given an associative matrix algebra $A$, create a structure-constant Lie algebra $L$ isomorphic to $A$ with the induced Lie product $(x,y) \rightarrow x*y - y*x$.

<a id="function-abelianliealgebra-rng-rngintelt"></a>
#### `AbelianLieAlgebra(R, n): Rng, RngIntElt -> AlgLie`

```magma
Rep: MonStgElt                    Default: "Sparse"
```

Create the abelian Lie algebra of dimension $n$ over the ring $R$.

<a id="example-ex-b11bef"></a>
#### `Example: Constructing Lie Algebras (ex-b11bef)`

We construct the Heisenberg Lie algebra, then a Lie algebra from an associative algebra, and finally a Lie algebra over the integers (also called a Lie ring).

```magma
> T:= [ <1,2,3,1>, <2,1,3,-1> ];
> LieAlgebra< Rationals(), 3 | T >;
Lie Algebra of dimension 3 with base ring Rational Field
> A:= Algebra( GF(27), GF(3) );
> LieAlgebra(A);
Lie Algebra of dimension 3 with base ring GF(3)
> T:= [ <1,2,2,2>, <2,1,2,2> ];
> t:= [0,4];
> K:= LieAlgebra< t | T : Rep:= "Dense" >; K;
Lie Algebra of dimension 2 with base ring Integer Ring
Column moduli: [0, 4]
> LowerCentralSeries( K );
[
    Lie Algebra of dimension 2 with base ring Integer Ring
    Column moduli: [0, 4],
    Lie Algebra of dimension 1 with base ring Integer Ring
    Column moduli: [2],
    Lie Algebra of dimension 0 with base ring Integer Ring
]
```

<a id="function-changebasis-alglie-alglieelt"></a>
#### `ChangeBasis(L, B): AlgLie, {[AlgLieElt]} -> AlgLie`

<a id="function-changebasis-alglie-modtupfldelt"></a>
#### `ChangeBasis(L, B): AlgLie, {[ModTupFldElt]} -> AlgLie`

<a id="function-changebasis-alglie-mtrx"></a>
#### `ChangeBasis(L, B): AlgLie, Mtrx -> AlgLie`

```magma
Rep: MonStgElt                    Default: "Dense"
```

Create a new Lie structure constant algebra $L'$, isomorphic to $L$, by recomputing the structure constants with respect to the basis $B$. The basis $B$ can be specified as a set or sequence of elements of $L$, a set or sequence of vectors, or a matrix. The second returned value is the isomorphism from $L$ to $L'$.

As above, the optional parameter `Rep` can be used to select the internal representation of the structure constants. Note that the default is dense representation, regardless of the representation used by $L$.

<a id="function-matrixliealgebra-rng-rngintelt"></a>
#### `MatrixLieAlgebra(R, n): Rng, RngIntElt -> AlgMatLie`

Given a ring $R$ and an integer $n$, create the full Lie algebra of matrices of degree $d$ over $R$.

<a id="function-matrixliealgebra-algmat"></a>
#### `MatrixLieAlgebra(A): AlgMat -> AlgMatLie`

Given an associative matrix algebra $A$, create the matrix Lie algebra $L$ consisting of the elements in $A$ with the induced Lie product $(x,y) \rightarrow x*y - y*x$.

<a id="function-algebra-algmatlie"></a>
#### `Algebra(M): AlgMatLie -> AlgLie, Map`

<a id="function-liealgebra-algmatlie"></a>
#### `LieAlgebra(M): AlgMatLie -> AlgLie, Map`

Return a structure-constant Lie algebra isomorphic to the matrix Lie algebra $M$.

<a id="example-ex-297c34"></a>
#### `Example: Upper Triangular Matrix Lie Algebra (ex-297c34)`

We construct the subalgebra of the matrix Lie algebra of $2\times 2$ matrices, consisting of upper triangular matrices.

```magma
> L:= MatrixLieAlgebra( Rationals(), 2 );
> a:= L!Matrix( [[1,0],[0,0]] );
> b:= L!Matrix( [[0,0],[1,0]] );
> c:= L!Matrix( [[0,0],[0,1]] );
> K:= sub< L | [ a, b, c ] >;
> Dimension(K);
3
> IsSolvable(K);
true
> IsNilpotent(K);
false
```

<a id="fp-construct-2"></a>
<a id="sectfpalglie"></a>
### Finitely Presented Lie Algebras

A finitely presented Lie algebra is constructed as the quotient of a free Lie algebra on a finite number of generators. Denote the set of generators by $X=\{x_1,\ldots, x_n\}$. Let $F$ denote the base ring. Then the free Lie algebra generated by the $x_i$ over the ring $F$ is denoted by $L_F(X)$. The free magma on $X$ is the set of the $x_i$ together with all bracketed expressions in the $x_i$, e.g., $((x_1,x_2), ((x_1,x_3),x_2)))$. The free Lie algebra $L_F(X)$ is spanned by $M(X)$. However, the elements of this set are not linearly independent. It is a nontrivial problem to describe a basis of the free Lie algebra. One of several possibilities is the well-known *Hall basis*. Currently Magma does not support calculations involving bases of the free Lie algebra, as they are of little use for our main problem: the construction of a basis and multiplication table for a finitely-presented Lie algebra.

It is convenient to define an ordering on the elements of $M(X)$. First of all, each generator is assigned a degree. Usually, the degree of all $x_i$ is taken to be one, but it is also possible to assign different degrees. The degree of a bracket $(a,b)$ is defined to be the sum of the degrees of $a$ and $b$. Let $m, m'$ be two elements of $M(X)$. Then define $m<m'$ if the degree of $m$ is less than the degree of $m'$. If their degrees are equal, then define $m<m'$ if $m=x_i$ and $m'=(a',b')$, for some $a',b'$ in $M(X)$. If both $m$ and $m'$ are generators of the same degree, so that $m=x_i$, $m'=x_j$, then define $m<m'$ if $i<j$. Finally, if both $m$ and $m'$ are bracketed expressions, that is, $m=(a,b)$ and $m'=(a',b')$, then define $m<m'$ if $a<a'$ or $a=a'$ and $b<b'$.

In the free Lie algebra, the relations $(a,b) = -(b,a)$, and $(a,a)=0$ hold. In Magma this is used to rewrite an arbitrary element as a linear combination of elements of the form $(a,b)$ with $a<b$. If instead we were to work relative to a basis for $L_F(X)$, then the use of the Jacobi identity when rewriting elements can lead to rather large expressions. Thus, mathematically speaking, in Magma rather than work in the free Lie algebra, we actually work in the free nonassociative anticommutative algebra. However, as our main interest lies in finitely-presented Lie algebras, this is usually not a problem.

<a id="construct-2"></a>
<a id="sectalgfplconstrfla"></a>
#### Construction of the Free Lie Algebra

<a id="function-freeliealgebra-rng-rngintelt"></a>
##### `FreeLieAlgebra(F, n): Rng, RngIntElt -> AlgFPLie`

Given a ring $F$ and a positive integer $n$, this function creates the free $n$-generator Lie algebra over the ring $F$. The generators are ordered, with the first generator being the biggest in the ordering, and the last generator the smallest. The angle bracket notation can be used to assign names to the generators.

<a id="example-ex-49252a"></a>
##### `Example: Creating a Free Lie Algebra (ex-49252a)`

The following statement creates the Magma object corresponding to the free Lie algebra on three generators over the field ${\bf F}_{2}$.

```magma
> L<a,b,c>:= FreeLieAlgebra(GF(2), 3);
```

<a id="properties"></a>
<a id="sectalgfplprops"></a>
#### Properties of the Free Lie Algebra

<a id="function-algfplierank"></a>
##### `Rank(L): AlgFPLie -> RngIntElt`

The number of generators of the free Lie algebra $L$.

<a id="function-coefficientring-algfplie"></a>
##### `CoefficientRing(L): AlgFPLie -> Rng`

<a id="function-basering-algfplie"></a>
##### `BaseRing(L): AlgFPLie -> Rng`

The coefficient ring of $L$.

<a id="elements"></a>
<a id="sectalgfplelts"></a>
#### Operations on Elements of the Free Lie Algebra

Once a free Lie algebra has been created the user can construct a bracketed expression $(a,b)$, either by simply typing it literally as `(a,b)`, or by using the multiplication operator as in `a*b`. Recall that Magma rewrites elements so they are in the form $(a,b)$ with $a<b$. On some occasions this can lead to the introduction of a minus sign. Also, if an element contains a subexpression of the form $(a,a)$, it will be rewritten to $0$.

We can multiply and add elements, and multiply them by scalars.

<a id="operation-op-plus-algfplieelt-algfplieelt"></a>
##### `x + y: AlgFPLieElt, AlgFPLieElt -> AlgFPLieElt`

<a id="operation-op-minus-algfplieelt-algfplieelt"></a>
##### `x - y: AlgFPLieElt, AlgFPLieElt -> AlgFPLieElt`

<a id="operation-op-times-algfplieelt-algfplieelt"></a>
##### `x * y: AlgFPLieElt, AlgFPLieElt -> AlgFPLieElt`

<a id="operation-op-algfplie-rngintelt"></a>
##### `L ! 0: AlgFPLie, RngIntElt -> AlgFPLieElt`

<a id="function-zero-algfplie"></a>
##### `Zero(L): AlgFPLie -> AlgFPLieElt`

The zero element of the free Lie algebra $L$.

<a id="example-ex-0ec7d4"></a>
##### `Example: Arithmetic in a Free Lie Algebra (ex-0ec7d4)`

```magma
> L<z,y,x> := FreeLieAlgebra(Rationals(), 3);
> x*y;
(x, y)
> (x, y);
(x, y)
> ((x*y)*z);
-(z, (x, y))
> ((x, y), z);
-(z, (x, y))
> ((x, y),(y, x));
0
> 2*((x, y), z) - ((x, z), (y, z)) + 1/2*(x, (x, (y, z)));
-((x, z), (y, z)) + 1/2*(x, (x, (y, z))) - 2*(z, (x, y))
```

<a id="function-isleaf-algfplieelt"></a>
##### `IsLeaf(m): AlgFPLieElt -> BoolElt, AlgFPLieElt, AlgFPLieElt`

Given a monomial element $m$ of the free Lie algebra $L$, return `true` if $m$ is a generator and `false` otherwise. If the result is `true` then the second return value is an integer $i$ such that $m$ is `L.i`. If the result is `false` then $a, b \in L$ are also returned such that $m$ is a multiple of $(a, b)$.

Note that in the latter case $m$ is not equal to $(a, b)$, but merely equal to a scalar multiple of $(a, b)$. See the example for a possible method of retrieving the appropriate scalar.

<a id="example-ex-8f1849"></a>
##### `Example: Leaves of Free Lie Algebra Elements (ex-8f1849)`

```magma
> L<z,y,x>:= FreeLieAlgebra(Rationals(), 3);
> IsLeaf(x);
true 3
> m := 2*((x, y), z);
> m;
-2*(z, (x, y))
> il, a, b := IsLeaf(m);
> il, a, b;
false z
(x, y)
> m eq (a, b);
false
> m eq LeadingCoefficient(m)*(a,b);
true
```

<a id="fp-construct"></a>
<a id="subsectalgfpl"></a>
#### Construction of a Finitely-Presented Lie Algebra

<a id="function-fpl-liealgebra"></a>
##### `LieAlgebra(R): [ AlgFPLieElt ] -> AlgLie, SeqEnum, SeqEnum, Map`

<a id="function-liealgebra-algfplieelt"></a>
##### `LieAlgebra(R): { AlgFPLieElt } -> AlgLie, SeqEnum, SeqEnum, Map`

Given a set or sequence $R$ of elements of a free Lie algebra $L$, let $I$ be the ideal of $L$ generated by the elements of $R$. It is assumed that the quotient algebra $Q = L/I$ is finite dimensional. This function returns the structure constant Lie algebra $K$ isomorphic to the quotient $Q$. If the quotient $Q$ is infinite dimensional then the program will not terminate. (The question of determining whether the quotient is finite dimensional is known to be undecidable.) The function can be interrupted by pressing `Ctrl-C`. The elements of $R$ are referred to as *relations*.

This function works if the base ring is either a field or equal to the ring of integers. In these two cases slightly different objects are returned.

If the base ring is a field then four values are returned:

**(a)**
A structure constant algebra $K$ isomorphic to the quotient $Q$;

**(b)**
A sequence $G$ comprising sequences of integers;

**(c)**
A sequence $B$ of elements of the free Lie algebra $L$;

**(d)**
A map $f : B \times B \rightarrow L$. The sequence $B$ maps to a basis of the quotient algebra, so it is a basis of a complement of the ideal $I$ in the free Lie algebra $L$. The elements of $B$ are in one-to-one correspondence with the basis elements of $K$. If all the relations of $R$ are homogeneous (i.e., if they are linear combinations of elements of the same degree), then $Q$ is graded. The sequence $G$ contains information about the grading. It consists of sequences of length two. The first element of each subsequence is the degree of a homogeneous subspace $H$, while the second element is the dimension of $H$. The basis elements of $K$ are ordered with respect to increasing degree. So from $G$ it is straightforward to read off the degree of each basis element. If the relations are not homogeneous then the sequence $G$ is empty. Finally, $f$ is a map that takes two elements from $B$ as arguments, and returns their product (in $L$) modulo the ideal $I$. The algorithm used is described in [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §7.4.

Secondly, in the case in which the base ring is the ring of integers, four values are returned:

**(a)**
A structure constant algebra $K$ isomorphic to the quotient $Q$;

**(b)**
A sequence $G$ comprising sequences of integers;

**(c)**
A sequence $B$ that is always empty;

**(d)**
A map $f : K \rightarrow L$. Here the structure constant algebra is defined over the ring of integers, so it may have torsion. The sequence $G$ is nonempty only if the input relations are homogeneous in which case it contains the dimensions of the homogeneous components. The function $f$ is a map that takes an element $u$ of $K$ and returns an element of the free algebra $L$ that maps to $u$ under the projection map (from the free algebra to the quotient).

<a id="example-ex-92e129"></a>
##### `Example: Positive Root Subalgebra of E7 (ex-92e129)`

In this example we compute the subalgebra $K$ of $E_7$ spanned by the positive root spaces.

```magma
> L<x7,x6,x5,x4,x3,x2,x1>:= FreeLieAlgebra(RationalField(), 7);
> pp:= { [1,3], [3,4], [2,4], [4,5], [5,6], [6,7] };
> R:= [ ];
> g:= [ L.i : i in [1..7] ];
> for i in [1..7] do
>     for j in [i+1..7] do
>         if [i,j] in pp then
>            a:= (g[i],(g[i],g[j]));
>            Append( ~R, a );
>            Append( ~R, (g[j],(g[j],g[i])) );
>         else
>            Append( ~R, (g[i],g[j]) );
>         end if;
>     end for;
> end for;
> R;
[
    -(x6, x7), -(x7, (x5, x7)), (x5, (x5, x7)), -(x4, x7),
    -(x3, x7), -(x2, x7), -(x1, x7), -(x5, x6), -(x6, (x4, x6)),
    (x4, (x4, x6)), -(x3, x6), -(x2, x6), -(x1, x6), -(x5, (x4, x5)),
    (x4, (x4, x5)), -(x3, x5), -(x2, x5), -(x1, x5), -(x4, (x3, x4)),
    (x3, (x3, x4)), -(x2, x4), -(x1, x4), -(x3, (x2, x3)), (x2, (x2, x3)),
    -(x1, x3), -(x2, (x1, x2)), (x1, (x1, x2))
]
> time K, G, B, f := LieAlgebra(R);
Time: 0.280
> K;
Lie Algebra of dimension 63 with base ring Rational Field
> #B;
63
> B[63];
(x7, (x5, (x4, (x3, (x2, (x1, (x6, (x4, (x3, (x2, (x5, (x4,
    (x3, (x6, (x4, (x5, x7))))))))))))))))
```

<a id="example-ex-0d1f8a"></a>
##### `Example: Finitely Presented Lie Ring (ex-0d1f8a)`

In this example we construct a finitely presented Lie ring (i.e., Lie algebra over the integers).

```magma
> L<y,x>:= FreeLieAlgebra( Integers(), 2 );
> R:= [ x*(x*(x*y))-2*x*y, 2*y*(x*(x*y)), 3*y*(y*(x*y))-x*(x*y),
>  x*(y*(x*(y*(x*y)))) ];
> K,g,b,f:= LieAlgebra( R );
> K;
Lie Algebra of dimension 8 with base ring Integer Ring
Column moduli: [2, 2, 2, 8, 8, 8, 0, 0]
> f(K.4);
(y, (x, y))
> LowerCentralSeries( K );
[
    Lie Algebra of dimension 8 with base ring Integer Ring
    Column moduli: [2, 2, 2, 8, 8, 8, 0, 0],
    Lie Algebra of dimension 6 with base ring Integer Ring
    Column moduli: [2, 2, 2, 8, 8, 8],
    Lie Algebra of dimension 6 with base ring Integer Ring
    Column moduli: [2, 2, 2, 4, 8, 8],
    Lie Algebra of dimension 6 with base ring Integer Ring
    Column moduli: [2, 2, 2, 4, 4, 8],
    Lie Algebra of dimension 6 with base ring Integer Ring
    Column moduli: [2, 2, 2, 4, 4, 4],
    Lie Algebra of dimension 5 with base ring Integer Ring
    Column moduli: [2, 2, 2, 4, 4],
    Lie Algebra of dimension 4 with base ring Integer Ring
    Column moduli: [2, 2, 2, 4],
    Lie Algebra of dimension 3 with base ring Integer Ring
    Column moduli: [2, 2, 2],
    Lie Algebra of dimension 2 with base ring Integer Ring
    Column moduli: [2, 2],
    Lie Algebra of dimension 1 with base ring Integer Ring
    Column moduli: [2],
    Lie Algebra of dimension 0 with base ring Integer Ring
]
```

<a id="constructor-constructor-quo-algfplie-algfplieelt-alglie-map"></a>
##### `quo<L | R>: AlgFPLie, [ AlgFPLieElt ] -> AlgLie, Map`

<a id="constructor-constructor-quo-algfplie-algfplieelt-alglie-map-2"></a>
##### `quo<L | R>: AlgFPLie, { AlgFPLieElt } -> AlgLie, Map`

This function is similar to the function [`LieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-fpl-liealgebra) in that it constructs a structure constant Lie algebra $K$ isomorphic to the quotient $L/I$, where $I$ is the ideal of $L$ generated by the elements (relations) of the sequence $R$. In addition to $K$, an invertible map from $L$ to $K$ is returned.

<a id="example-ex-b4f6d4"></a>
##### `Example: Quotients of Finitely Presented Lie Algebras (ex-b4f6d4)`

In this example we demonstrate the use of the quotient constructor for finitely presented Lie algebras.

```magma
> L<x,y> := FreeLieAlgebra(Rationals(), 2);
> R := [ x*(x*y)-2*x, y*(y*x)-2*y ];
> K, phi := quo<L | R>;
> K;
Lie Algebra of dimension 3 with base ring Rational Field
> SemisimpleType(K);
A1
> [ b @@ phi : b in Basis(K) ];
[
   y,
   x,
   (y, x)
]
> phi(x*y);
( 0  0 -1)
```

<a id="function-nilpotentquotient-algfplieelt-rngintelt"></a>
##### `NilpotentQuotient(R, d): [ AlgFPLieElt ], RngIntElt -> AlgLie, SeqEnum, SeqEnum, UserProgram`

<a id="function-nilpotentquotient-algfplieelt-rngintelt-2"></a>
##### `NilpotentQuotient(R, d): { AlgFPLieElt, RngIntElt } -> AlgLie, SeqEnum, SeqEnum, UserProgram`

Given a set or sequence $R$ of elements of a free Lie algebra $L$, let $I$ be the ideal of $L$ generated by the elements of $R$. Let $d$ be a positive integer or `Infinity()`. This function constructs the class $d$ nilpotent quotient of the Lie algebra $L/I$, a finite dimensional algebra. The function returns the same values as [`LieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-fpl-liealgebra).

This function is similar to the function [`LieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-fpl-liealgebra) except that the quotient is constructed in the free nilpotent Lie algebra of class $d$. All elements of degree strictly larger than `d` will be added to the ideal, so the quotient will be finite-dimensional and nilpotent of class at most `d`.

<a id="example-ex-ed7e0d"></a>
##### `Example: Nilpotent Quotient (ex-ed7e0d)`

In this example, we compute a nilpotent quotient.

```magma
> L<y,x> := FreeLieAlgebra(Rationals(), 2);
> R := [(x, (x, (x, y))) - (y, (y, (x, y)))];
> time K, G, B, f := NilpotentQuotient(R, 10);
Time: 0.040
> K;
Lie Algebra of dimension 109 with base ring Rational Field
> #B;
109
> B[100];
(y, (x, (x, (y, (x, (y, (x, (x, (x, y)))))))))
> G;
[
    [ 1, 2 ],
    [ 2, 1 ],
    [ 3, 2 ],
    [ 4, 2 ],
    [ 5, 4 ],
    [ 6, 5 ],
    [ 7, 10 ],
    [ 8, 15 ],
    [ 9, 26 ],
    [ 10, 42 ]
]
> f(B[3], B[13]);
-(y, (x, (x, (x, (x, (y, (x, y))))))) + (x, (y, (x, (x, (x, (y, (x, y)))))))
```

<a id="fp-hom"></a>
<a id="subsectalgfplhom"></a>
#### Homomorphisms of the Free Lie Algebra

<a id="constructor-constructor-hom-algfplie-algfplie-algfplieelt-map"></a>
##### `hom<L -> M | Q>: AlgFPLie, AlgFPLie, [ AlgFPLieElt ] -> Map`

<a id="constructor-constructor-hom-algfplie-tupmod-tupmodelt-map"></a>
##### `hom<L -> M | Q>: AlgFPLie, TupMod, [ TupModElt ] -> Map`

Given a free Lie algebra $L$ of dimension $n$ over $R$ and either a Lie algebra $M$ over $R$ or a module $M$ over $R$, construct the homomorphism from $L$ to $M$ specified by $Q$. The sequence $Q$ must have length [`Rank`](https://docs.magma-maths.org/LieTheory/LieAlgebras/fp-construct.md#function-algfplierank)`(L)` and be of the form $[m_1, \ldots, m_n]$ ($m_i \in M$) indicating that the $i$-th generator of $L$ maps to $m_i$.

Note that this is in general only a module homomorphism, and it is not checked whether it is an algebra homomorphism.

<a id="example-ex-8cb631"></a>
##### `Example: Homomorphisms from a Free Lie Algebra (ex-8cb631)`

We construct the Lie algebra of type $A_1$ as quotient of a free Lie algebra, using homomorphisms between a free Lie algebra and a structure constant Lie algebra. First, we construct the free Lie algebra and a structure constant Lie algebra of type $A_1$. The elements of a Chevalley basis are obtained by a call to [`ChevalleyBasis`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-chevalleybasis).

```magma
> L<e,f> := FreeLieAlgebra(Rationals(), 2);
> M := LieAlgebra("A1", Rationals() : Isogeny := "SC");
> pos, neg, cart := ChevalleyBasis(M);
> pos, neg, cart;
[ (0 0 1) ]
[ (1 0 0) ]
[ (0 1 0) ]
```

Next, we construct a homomorphism from $L$ to $M$ that sends $e$ to the positive root element, and $f$ to the negative root element. We construct a map from $M$ to $L$ that sends the positive root to $e$, the negative root to $f$, and the Cartan element to $-(e,f)$.

```magma
> phi := hom<L -> M | [ pos[1], neg[1] ]>;
> phi(e), phi(f), phi(e*f);
(0 0 1) (1 0 0) ( 0 -1  0)
> imgs := [ L | f, (f,e), e];
> psi := map<M -> L | x :-> &+[ x[i]*imgs[i] : i in [1..3] ]>;
> psi(cart[1]);
-(f, e)
> psi(phi((e,(e,f))));
-2*e
> assert forall{b : b in Basis(M) | phi(psi(b)) eq b };
```

Finally, we create a sequence of relations showing that the maps `phi` and `psi` are each others inverses for a small set of elements of L. We then compute the quotient of the free Lie algebra with respect to these relations.

```magma
> R := { x - psi(phi(x)) : x in {e, f, (e,f), (e,(e,f)), (f,(f,e))} };
> L2 := quo<L | R>;
> L2;
Lie Algebra of dimension 3 with base ring Rational Field
> SemisimpleType(L2);
A1
```

<a id="alglieextr"></a>
<a id="sectalglieextr"></a>
### Lie Algebras Generated by Extremal Elements

A non-zero element $x$ of a Lie algebra $L$ over the field $K$ is extremal if $[x,[x,y]] \in K x$ for all $y \in L$. If $x$ is extremal, the existence of a linear map $f_x : L \rightarrow K$ such that $[x,[x,y]] = f_x(y) x$ for all $y \in L$ immediately follows from linearity of $[\cdot,\cdot]$.

In this section we describe functions for computing with Lie algebras generated by such extremal elements. For a simple connected undirected finite graph $\Gamma$ we consider an algebraic variety $X$ over $K$ whose $K$-points parametrize Lie algebras generated by extremal elements. Here the generators of the Lie algebras correspond to the vertices of the graph, and we prescribe commutation relations corresponding to the nonedges of $\Gamma$.

Details of the setup may be found in [[Roo11](https://docs.magma-maths.org/references.md#cite-roozemond11)]; we describe the essential ingredients here.

Assume that $\Gamma$ is a connected undirected finite graph with $n$ vertices, without loops or multiple bonds, and that $K$ is a field of characteristic distinct from 2. We let $\Pi$ be the vertex set of $\Gamma$ and denote adjacency of two vertices $x,y \in \Pi$ by $i \sim j$.

We denote by $F(K, \Gamma)$ the quotient of the free Lie algebra over K generated by $\Pi$ modulo the relations $[x,y]=0$ for all $x,y \in \Pi$ with $x \not\sim y$. We write $F^*$ for the space of all $K$-linear functions on $F$. For every $f \in (F^*)^\Pi$ we denote by $L(K,\Gamma, f)$ (often abbreviated to $L(f)$) the quotient of $F(K,\Gamma)$ by the ideal $I( f )$ generated by the infinitely many elements $[x,[x,y]] - f_x(y) x$ for $x \in \Pi$, $y \in F$.

By construction $L( f )$ is a Lie algebra generated by $|\Pi| = n$ extremal elements, the extremal generators corresponding to the vertices of $\Gamma$ and commuting whenever they are not adjacent. The element $f_x \in F^*$ is a parameter expressing the extremality of $x \in \Pi$.

In the Lie algebra $L(0)$ the elements of $\Pi$ map to sandwich elements. This algebra is finite-dimensional, by [[ZK90](https://docs.magma-maths.org/references.md#cite-zk90)] this Lie algebra is finite-dimensional; for general $f \in (F^*)^\Pi$ we have $\dim(L(f)) \leq \dim(L(0))$ by [[CSUW01](https://docs.magma-maths.org/references.md#cite-csuw01), Lemma 4.3]. It is therefore natural to focus on the Lie algebras $L( f )$ of maximal possible dimension, i.e., those of dimension $\dim(L(0))$. We define the set $X := \{ f \in (F^*)^\Pi \mid \dim(L(f)) = \dim(L(0)) \}$, the parameter space for all maximal-dimensional Lie algebras of the form $L( f )$.

The functions currently implemented in Magma allow computation of $X$ and $L(f)$, for any $f$, for the cases where $X$ is an affine space (which is unproven, but true in all currently known cases).

Lie algebras generated by extremal elements are of type `AlgLieExtr`. The verbose flag `"AlgLieExtr"` may be set between 1 and 5 to show details and progress of the various computations.

<a id="alglieextr-construct"></a>
<a id="subsectalglieextrconstr"></a>
#### Constructing Lie Algebras Generated by Extremal Elements

<a id="function-extremalliealgebrakn"></a>
##### `ExtremalLieAlgebra(K, n): Rng, RngIntElt -> AlgLieExtr`

```magma
CommGens       : SeqEnum                    Default: []
HeisenbergPairs: SeqEnum                    Default: []
```

Construct the Lie algebra over the field $K$ generated by $n$ extremal elements. The characteristic of $K$ must be distinct from 2.

The optional argument `CommGens` contains pairs of integers $(i,j)$, with $1 \leq i,j \leq n$, describing that generators $x_i$ and $x_j$ commute, i.e., $[x_i, x_j] = 0$.

The optional argument `HeisenbergPairs` contains pairs of integers $(i,j)$, with $1 \leq i \leq n$ and $1 \leq j \leq \dim(L(0))$, describing that $f_{x_i}(b_j)$ should be taken equal to $0$. (Note that if it is required to have $j > n$ it would be necessary to have prior knowledge about the basis of $L(0)$).

<a id="function-extremalliealgebra-rng-grphund"></a>
##### `ExtremalLieAlgebra(K, G): Rng, GrphUnd -> AlgLieExtr`

```magma
HeisenbergPairs: SeqEnum                    Default: []
```

Construct the Lie algebra over the field $K$ whose extremal generators are described by the graph $G$, i.e., with $|V(G)|$ generators, and $x_i$ and $x_j$ commute whenever vertices $x_i$ and $x_j$ of $G$ are not adjacent.

See [`ExtremalLieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-extremalliealgebrakn) above for a description of the optional argument `HeisenbergPairs`.

<a id="alglieextr-properties"></a>
<a id="subsectalglieextrprops"></a>
#### Properties of Lie Algebras Generated by Extremal Elements

<a id="function-numberofgenerators-alglieextr"></a>
##### `NumberOfGenerators(L): AlgLieExtr -> RngIntElt`

<a id="function-ngens-alglieextr"></a>
##### `Ngens(L): AlgLieExtr -> RngIntElt`

The number of generators of $L$.

<a id="function-coefficientring-alglieextr"></a>
##### `CoefficientRing(L): AlgLieExtr -> Rng`

<a id="function-basering-alglieextr"></a>
##### `BaseRing(L): AlgLieExtr -> Rng`

The coefficient ring of $L$. Immediately after construction, this is equal to the field $K$ provided as argument to [`ExtremalLieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-extremalliealgebrakn). However, after the multiplication table has been computed (see below), the coefficient ring would in general be a multivariate polynomial ring over $K$ describing the parameter space.

<a id="function-commutatorgraph-alglieextr"></a>
##### `CommutatorGraph(L): AlgLieExtr -> GrphUnd`

The graph describing the extremal generators of $L$ and their commutator relations.

<a id="example-ex-3fa178"></a>
##### `Example: Lie Algebra from Extremal Elements (ex-3fa178)`

We construct a Lie algebra generated by $4$ extremal elements in two different manners.

```magma
> QQ := Rationals();
> L := ExtremalLieAlgebra(QQ, BipartiteGraph(2,2));
> Ngens(L), CoefficientRing(L);
4 Rational Field
> G := CommutatorGraph(L); G;
Graph
Vertex  Neighbours

1       3 4 ;
2       3 4 ;
3       1 2 ;
4       1 2 ;

> L := ExtremalLieAlgebra(QQ, 4 : CommGens := [<1,2>,<3,4>]);
> Ngens(L), CoefficientRing(L);
4 Rational Field
> G := CommutatorGraph(L); G;
Graph
Vertex  Neighbours

1       3 4 ;
2       3 4 ;
3       1 2 ;
4       1 2 ;
```

<a id="function-basis-alglieextr"></a>
##### `Basis(L): AlgLieExtr -> SeqEnum[AlgFPLieElt], SeqEnum[UserProgram]`

Compute a monomial basis for $L(0)$ (this is also a monomial basis for $L(f)$ for any $f \in X$; see the introduction of Section [Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#sectalglieextr)).

The first return value is a sequence consisting of monomials of the free Lie algebra over $K$ with $n$ generators, where $K$ is the coefficient ring of $L$ and $n$ is the number of generators. The second return value is a sequence consisting of functions $c$. Each of these functions may be applied to a sequence of generators and a composition function. These may be used to construct the basis elements in other environments.

The algorithm used in this function is due to W. de Graaf.

<a id="function-zbasis-alglieextr"></a>
##### `ZBasis(L): AlgLieExtr -> SeqEnum[AlgFPLieElt], SeqEnum[RngIntElt], SeqEnum[AlgFPLieElt]`

For $L$ a Lie algebra generated by extremal elements over the field of rational numbers, compute a basis of the corresponding Lie ring over the integers.

This function returns three sequences $B$, $T$, $C$, respectively, describing bases for $L(0)$ over **any** field $K$. $B$ is a not necessarily monomial basis, with torsion described by $T$. It is such that if $T[i]$ is nonzero, $m$ say, then $B[i]$ is zero unless the characteristic of $K$ divides $m$.

The third sequence, $C$, is a sequence of monomials that linearly span $L(0)$ over any field $K$. Note, however, that if $T$ contains nonzero elements, then $C$ would in general contain superfluous elements and therefore not be a basis.

The algorithm used in this function is due to W. de Graaf. The only currently known case with nontrivial torsion is for $\Gamma(L) = K_5$.

<a id="function-dimension-alglieextr"></a>
##### `Dimension(L): AlgLieExtr -> RngIntElt`

The dimension of $L(0)$. This value is computed via a basis computation, so potentially quite time-consuming.

<a id="example-ex-0b6eca"></a>
##### `Example: Basis of an Extremal Lie Algebra (ex-0b6eca)`

We continue the previous example [Lie Algebra from Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#example-ex-3fa178) and demonstrate the computation of a basis of $L(0)$.

```magma
> B, C := Basis(L);
> B;
[
    $.1,
    $.2,
    $.3,
    $.4,
    ($.4, $.2),
    ($.4, $.1),
    ($.3, $.2),
    ($.3, $.1),
    ($.4, ($.3, $.2)),
    ($.4, ($.3, $.1)),
    ($.2, ($.4, $.1)),
    ($.2, ($.3, $.1)),
    ($.4, ($.2, ($.3, $.1))),
    ($.3, ($.2, ($.4, $.1))),
    ($.2, ($.4, ($.3, $.1)))
]
> [ c(["x","y","z","u"], func<i,j|i cat j>) : c in C ];
[ x, y, z, u, uy, ux, zy, zx, uzy, uzx, yux, yzx, uyzx, zyux, yuzx ]
> A := FreeAlgebra(Rationals(), 4);
> [ c([A.1,A.2,A.3,A.4], func<x,y|x*y>) : c in C ];
[
    $.1,
    $.2,
    $.3,
    $.4,
    $.4*$.2,
    $.4*$.1,
    $.3*$.2,
    $.3*$.1,
    $.4*$.3*$.2,
    $.4*$.3*$.1,
    $.2*$.4*$.1,
    $.2*$.3*$.1,
    $.4*$.2*$.3*$.1,
    $.3*$.2*$.4*$.1,
    $.2*$.4*$.3*$.1
]
> #B, #C, Dimension(L);
15 15 15
```

<a id="procedure-multiplicationtablelproc"></a>
##### `MultiplicationTable(~L): AlgLieExtr`

```magma
HowMuch   : MonStgElt                    Default: "Auto"
MemLimit  : RngIntElt                    Default: Infinity()
FullJacobi: BoolElt                      Default: false
```

Force computation of a general multiplication table for $L$, i.e., one that may be used for constructing $L(f)$ for any $f \in X$ (see the introduction to this section [Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#sectalglieextr)). This computation is necessary for constructing instances as described in Section [Instances of Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#subsectalglieextrinstances), but it will be done automatically if needed. Data about the variety $X$ is computed concurrently and stored internally; see Section [Studying the Parameter Space](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#subsectalglieextrvariety) for the relevant functions in accessing that information.

The optional parameters may be used to influence the computation, although the defaults should generally work well. `HowMuch` may be set to “Auto” (the default), “Top”, or “Full”, and prescribes whether only the first `Ngens(L)` rows of the multiplication table are computed (“Top”), or all entries (“Full”). If set to “Auto” some fraction of the multiplication table is computed depending on the dimension of $L$ and the other parameters.

`MemLimit` may be set to a positive integer $m$, and if given Magma will attempt to limit its memory usage to $m$ MB, by limiting the portion of the multiplication table that is being computed.

`FullJacobi` may be set to `true` in order to force checking the Jacobi identity for all basis elements, thus providing more certainty with regards to the information about the parameter space $X$. Note that even if this parameter is set to `true` a heuristic (Monte-Carlo) method is used, as considering all $\dim(L(0))^3$ triples quickly becomes infeasible as the dimension grows.

The verbose flag `"AlgLieExtr"` may be set to 3 or more to obtain some information about the default choices Magma makes with regards to these parameters.

<a id="function-multiplicationtablel"></a>
##### `MultiplicationTable(L): AlgLieExtr -> SeqEnum`

```magma
Rep  : MonStgElt                    Default: "Auto"
Check: BoolElt                      Default: true
```

A general multiplication table for $L$.

If `Rep` is set to “Dense” it will be returned as a sequence of sequences of vectors over `CoefficientRing(L)`. If `Rep` is set to “Sparse” it will be returned as a sequence of 4-tuples. If `Rep` is set to “Auto” a choice between these representations is made depending on $\dim(L)$. Both these representations may be used on the right hand side of the [`LieAlgebra<R, n | Q : parameters >`](https://docs.magma-maths.org/LieTheory/LieAlgebras/construct.md#constructor-liealgebrarnq) constructor.

The optional parameter `Check` controls whether the Jacobi identity is verified for all triples (if `true` it will actually be checked for all $\dim(L(0))^3$ triples, as opposed to the behaviour of the procedural version, [`MultiplicationTable`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#procedure-multiplicationtablelproc)`(~L)`, described above).

Note that this function is impractical in terms of CPU time and memory usage once $\dim(L)$ exceeds approximately $50$. In such cases, the Lie algebra is more easily studied using the functions described in Section [Instances of Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#subsectalglieextrinstances).

<a id="example-ex-7dacec"></a>
##### `Example: Multiplication Table of an Extremal Lie Algebra (ex-7dacec)`

We construct the generic Lie algebra generated by $3$ extremal elements and construct a structure constant Lie algebra using the multiplication table.

```magma
> L := ExtremalLieAlgebra(Rationals(), 3);
> L:Maximal;
Lie algebra generated by 3 extremal elements, defined over Rational
Field
> MultiplicationTable(~L);
> L:Maximal;
Lie algebra generated by 3 extremal elements, originally defined over
Rational Field
  Now living over Polynomial ring of rank 4 over Rational Field
  Dimension: 8
  Picked 4 f-values:
    f(2, [1]) = f21
    f(3, [1]) = f31
    f(3, [2]) = f32
    f(1, [32]) = f132

> Dimension(L);
8
> MT := MultiplicationTable(L);
> MT[4][8];
(0   -1/2*f31*f32   0   -1/2*f132   0   0   0   1/2*f32)
> M := LieAlgebra<CoefficientRing(L), 8 | MT>;
> M;
Lie Algebra of dimension 8 with base ring Polynomial ring of rank 4
over Rational Field
> M.4*M.8;
(0   -1/2*f31*f32   0   -1/2*f132   0   0   0   1/2*f32)
> M.1*(M.1*M.2);
(f21   0   0   0   0   0   0   0)
```

<a id="alglieextr-instances"></a>
<a id="subsectalglieextrinstances"></a>
#### Instances of Lie Algebras Generated by Extremal Elements

<a id="function-instance-alglieextr"></a>
##### `Instance(L): AlgLieExtr -> AlgLie`

```magma
Rep  : MonStgElt                    Default: "Auto"
Check: BoolElt                      Default: true
```

The Lie algebra $L(f)$ for general $f$. The Lie algebra returned will in general be defined over a multivariate polynomial ring.

This function is identical to [`MultiplicationTable`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-multiplicationtablel), except that it returns a Lie algebra rather than a multiplication table. Please refer to that function for information on the optional arguments `Rep` and `Check`. Note that this function also is impractical in terms of CPU time and memory usage once $\dim(L)$ exceeds approximately $50$. In such cases, the Lie algebra is more easily studied by constructing particular instances of $L(f)$ individually, as described below.

<a id="function-instance-alglieextr-seqenum"></a>
##### `Instance(L, Q): AlgLieExtr, SeqEnum -> AlgLie, Map`

```magma
Rep  : MonStgElt                    Default: "Auto"
Check: BoolElt                      Default: true
```

Construct $L(f)$ where the $i$-th free parameter of $X$ is set to Q[i]. Consult `L:Maximal` or [`FreefValues`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-freefvalues) to obtain information about the free parameters. The coefficient ring of the Lie algebra $M$ returned will be equal to `Universe(Q)`. As a second return value, an invertible map from $M$ to the free Lie algebra of rank `Ngens(L)` is returned.

The optional argument `Rep` may be “Auto”, “Dense”, or “Sparse” (refer to the documentation at [`MultiplicationTable`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-multiplicationtablel) for more information). `Check` may be set to `true` or `false` and determines whether the Jacobi identity is checked on the Lie algebra returned.

<a id="example-ex-658a16"></a>
##### `Example: Instance of an Extremal Lie Algebra (ex-658a16)`

We construct the generic Lie algebra generated by $3$ extremal elements and study one of its instances.

```magma
> L := ExtremalLieAlgebra(Rationals(), 3);
> MultiplicationTable(~L);
> L:Maximal;
Lie algebra generated by 3 extremal elements, originally defined over
Rational Field
  Now living over Polynomial ring of rank 4 over Rational Field
  Dimension: 8
  Picked 4 f-values:
    f(2, [1]) = f21
    f(3, [1]) = f31
    f(3, [2]) = f32
    f(1, [32]) = f132

> M := Instance(L); M;
Lie Algebra of dimension 8 with base ring Polynomial ring of rank 4
over Rational Field
> M.1*(M.1*M.2);
(f21   0   0   0   0   0   0   0)
```

So in the most general case, $[x_1, [x_1, x_2]] = f_{x_2}(x_1) x_1$. Next, we consider an instance where we set $f_{x_2}(x_1) = 1/7$, $f_{x_3}(x_1) = 1/5$, $f_{x_3}(x_2) = 1/3$, and $f_{x_1}([x_3,x_2]) = 1$.

```magma
> N, phi := Instance(L, [Rationals()|1/7,1/5,1/3,1]);
> N;
Lie Algebra of dimension 8 with base ring Rational Field
> SemisimpleType(N);
A2
> N.1*(N.1*N.2);
(1/7   0   0   0   0   0   0   0)
> y := phi(N.2); z := phi(N.3);
> Parent(y):Minimal;
Free Lie algebra of rank 3 over Rational Field
> (y,(y,z));
-($.2, ($.3, $.2))
> (y,(y,z)) @@ phi;
(  0 1/3   0   0   0   0   0   0)
> (y,(y,z)) @@ phi @ phi;
1/3*$.2
```

<a id="alglieextr-variety"></a>
<a id="subsectalglieextrvariety"></a>
#### Studying the Parameter Space

<a id="function-freefvalues"></a>
##### `FreefValues(L): AlgLieExtr -> SeqEnum, SeqEnum`

The values $f_x(b)$ generating the parameter space $X$ (see the introduction to this section [Lie Algebras Generated by Extremal Elements](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#sectalglieextr) for details). This function returns two sequences: the first of the $f_x(b)$ as elements of `CoefficientRing(L)` and the second of the pairs $(x,b)$ as two-tuples of integers.

<a id="function-fvalue-alglieextr-rngintelt-rngintelt"></a>
##### `fValue(L, x, b): AlgLieExtr, RngIntElt, RngIntElt -> RngElt`

The value $f_x(b)$ as an element of `CoefficientRing(L)`.

<a id="procedure-fvalueproof-alglieextr-rngintelt-rngintelt"></a>
##### `fValueProof(L, x, b): AlgLieExtr, RngIntElt, RngIntElt`

Print a proof of correctness for the value $f_x(b)$.

<a id="example-ex-dc2192"></a>
##### `Example: Free Parameters of an Extremal Lie Algebra (ex-dc2192)`

We consider the generic Lie algebra generated by $4$ extremal elements.

```magma
> L := ExtremalLieAlgebra(Rationals(), 4);
> vals, pairs := FreefValues(L);
> vals;
[
    f21,
    f31,
    f41,
    f32,
    f42,
    f43,
    f143,
    f243,
    f142,
    f132,
    f1432,
    f2431
]
> #vals;
12
> pairs;
[ <2, 1>, <3, 1>, <4, 1>, <3, 2>, <4, 2>, <4, 3>, <1, 5>, <2, 5>, <1,
6>, <1, 8>, <1, 11>, <2, 12> ]
```

This shows that $\dim(X) = 12$. We compute some values $f_x(b)$.

```magma
> fValue(L, 1, 5);
f143
> fValue(L, 4, 17);
-f41*f42
> fValueProof(L, 4, 17);
f(4, [241]) -> -f(4,[2])*f(4,[1]) {f(x,[y,[x,N]]) = -f(x,y)f(x,N) by
  assoc. of f and anti-comm. of L}
    f(4, [2]) = f42 {Free}
    f(4, [1]) = f41 {Free}
= -f41*f42
```

<a id="function-dimensionsestimate"></a>
##### `DimensionsEstimate(L, g): AlgLieExtr, UserProgram -> SeqEnum, SetMulti`

```magma
NumSamples: RngIntElt                    Default: Infinity()
Check     : BoolElt                      Default: true
Rep       : MonStgElt                    Default: "Auto"
AlgLieExtr: Verbose                      Default: 10
```

Estimate the dimensions of the subvarieties of the parameter space $X$ of $L$ giving rise to irreducible Lie algebra modules of different dimensions.

This procedure repeatedly (exactly `NumSamples` times) invokes `Instance(L, g())` to produce a Lie algebra $M$. The composition series of $M$ are computed, and the dimension $e$ of its simple factor is stored. Then, for each of these $e$ encountered, the dimension of the subvariety (inside the algebraic variety $X$) that contains Lie algebras whose top factor has dimension $e$ is estimated using the dimension $d$ of the full f-variety. (Here $d$ is taken to be the number of free f-values computed; see [`FreefValues`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-freefvalues)).

If the verbose flag `"AlgLieExtr"` is set 3 or more, then after each step the estimate is printed as a sequence of triples $(e, n, s)$: $n$ is the number of times dimension $e$ was encountered, and $s$ the estimate for the dimension of the subvariety.

Upon finishing (which will only happen if `NumSamples` is set to some finite number) that sequence of triples is returned. The second return value is a multiset containing the dimensions encountered in the search.

Note that this procedure assumes that $X$ itself is an affine variety (which has been proved if `CommutatorGraph(L)` is a connected simply laced Dynkin diagram of finite or affine type) and that `g` produces uniformly random elements of $X$. If either of these two is not the case, the estimates produced are likely wrong. Moreover, `g` must produce sequences of elements of a finite field.

The optional argument `Rep` may be “Auto”, “Dense”, or “Sparse” (refer to the documentation at [`MultiplicationTable`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-multiplicationtablel) for more information). `Check` may be set to `true` or `false` and determines whether the Jacobi identity is checked on the Lie algebras constructed.

<a id="function-instancesfordimensions-alglieextr-userprogram-setenum-rngintelt"></a>
##### `InstancesForDimensions(L, g, D): AlgLieExtr, UserProgram, SetEnum[RngIntElt] -> Assoc`

```magma
Check: BoolElt                    Default: true
```

For each $d \in D$ attempt to find an instance of $L$ whose simple factor has dimension $d$, by repeatedly invoking `Instance(L, g())`. The result is returned in the form of an associative array $A$ such that, for all $d \in D$, $A[d]$ is a triple $(v, M, \phi)$ where $v$ is such that `Instance(L, v)` is $M$, and $\phi$ is an invertible map from $M$ to the free Lie algebra.

See [`DimensionsEstimate`](https://docs.magma-maths.org/LieTheory/LieAlgebras/alglieextr.md#function-dimensionsestimate) for the required properties of `g`. The optional parameter `Check` may be set to `true` or `false` and determines whether the Jacobi identity is checked on the Lie algebras constructed.

<a id="example-ex-44228f"></a>
##### `Example: Dimensions of the Parameter Variety (ex-44228f)`

We consider the generic Lie algebra generated by $3$ extremal elements.

```magma
> L := ExtremalLieAlgebra(Rationals(), 3);
> FreefValues(L);
[
    f21,
    f31,
    f32,
    f132
]
[ <2, 1>, <3, 1>, <3, 2>, <1, 4> ]
```

So $\dim(X) = 4$. We create a function `g` used to construct random instances of $L$ over GF(5).

```magma
> g := func< | [ Random(GF(5)) : i in [1..4] ]>;
> repeat M := Instance(L, g()); until Rank(KillingForm(M)) eq 8;
> M;
Lie Algebra of dimension 8 with base ring GF(5)
> SemisimpleType(M);
A2
```

So in this case `g()` yielded a Lie algebra of type A$_2$. We use `g` to obtain information about $X$, using 500 random instances.

```magma
> DimensionsEstimate(L, g : NumSamples := 500);
[ <3, 121, "3.12">, <8, 379, "3.83"> ]
{* 3^^121, 8^^379 *}
```

This shows that 379 instances were found where $M$ was simple of dimension 8, and 121 cases where $M$ had a simple factor of dimension 3. Using this result one might conjecture that there is a codimension $1$ subspace of $X$ with Lie algebras whose simple factor has dimension $3$.

```magma
> A := InstancesForDimensions(L, g, {3,8} : Check := false);
> A[3];
<[ 2, 1, 4, 4 ], Lie Algebra of dimension 8 with base ring GF(5),
Mapping from: Lie Algebra of dimension 8 with base ring GF(5) to Free
Lie algebra of rank 3 over GF(5) given by a rule>
> M := A[3][2]; MM := M/SolvableRadical(M); MM;
Lie Algebra of dimension 3 with base ring GF(5)
> SemisimpleType(MM);
A1
> M := A[8][2]; IsSimple(M);
true
> SemisimpleType(M);
A2
```

<a id="family-construct"></a>
<a id="sectfamalglie"></a>
### Families of Lie Algebras

The radical of a Lie algebra is the maximal soluble ideal. A Lie algebra is called *reductive* if its radical is equal to its centre, and *semisimple* if its radical is trivial. A Lie algebra is *almost reductive (resp. simple, semisimple)* if the corresponding group of Lie type is reductive (resp. simple, semisimple). Note that these concepts are equivalent if the field has characteristic zero.

The commands in this section construct almost reductive Lie algebras over an arbitrary field. Such Lie algebras have a corresponding root datum. The matrix versions of these commands give the standard matrix representation, which is the smallest degree representation (with a few exceptions for small characteristic fields).

<a id="reductive-construct"></a>
<a id="chapalgcartyp"></a>
<a id="subsectalglieconstrred"></a>
#### Almost Reductive Lie Algebras

The intrinsics [`LieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-liealgebra) and [`MatrixLieAlgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#function-matrixliealgebra) described below take as first argument an object which describes the type of the reductive Lie algebra to be constructed. Specifically, it may be one of the five following types:

**(a)**
A string describing the Cartan type;

**(b)**
A root datum (see Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm));

**(c)**
A crystallographic root system (see Chapter [Root Systems](https://docs.magma-maths.org/LieTheory/RootSystems/index-root-systems.md#chaprootsys));

**(d)**
A Dynkin digraph (see Section [Dynkin Digraphs](https://docs.magma-maths.org/LieTheory/CoxeterSystems/dynkindigraph.md#sectcartandyndigrph));

**(e)**
A crystallographic Cartan matrix $C$ (see Section [Cartan Matrices](https://docs.magma-maths.org/LieTheory/CoxeterSystems/cartanmat.md#sectcartancarmat)).

In the cases (a), (d), and (e) these intrinsics take an optional argument `Isogeny`. See Section [Constructing Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#sectgrplieconstruct) for the possible values of this flag.

<a id="function-liealgebra"></a>
##### `LieAlgebra(T, k): MonStgElt, Rng -> AlgLie`

<a id="function-liealgebra-rootdtm-rng"></a>
##### `LieAlgebra(R, k): RootDtm, Rng -> AlgLie`

<a id="function-liealgebra-rootsys-rng"></a>
##### `LieAlgebra(R, k): RootSys, Rng -> AlgLie`

<a id="function-liealgebra-grphdir-rng"></a>
##### `LieAlgebra(D, k): GrphDir, Rng -> AlgLie`

<a id="function-liealgebra-algmatelt-rng"></a>
##### `LieAlgebra(C, k): AlgMatElt, Rng -> AlgLie`

```magma
Isogeny: .                    Default: "Ad"
```

Construct the reductive Lie algebra of type $T$ over the ring $k$.

<a id="function-matrixliealgebra"></a>
##### `MatrixLieAlgebra(T, k): MonStgElt, Rng -> AlgLie`

<a id="function-matrixliealgebra-rootdtm-rng"></a>
##### `MatrixLieAlgebra(R, k): RootDtm, Rng -> AlgLie`

<a id="function-matrixliealgebra-rootsys-rng"></a>
##### `MatrixLieAlgebra(R, k): RootSys, Rng -> AlgLie`

<a id="function-matrixliealgebra-grphdir-rng"></a>
##### `MatrixLieAlgebra(D, k): GrphDir, Rng -> AlgLie`

<a id="function-matrixliealgebra-algmatelt-rng"></a>
##### `MatrixLieAlgebra(C, k): AlgMatElt, Rng -> AlgLie`

```magma
Isogeny: .                    Default: "Ad"
```

Construct the reductive matrix Lie algebra of type $T$ over the ring $k$.

<a id="example-ex-05c3a3"></a>
##### `Example: Constructing Semisimple Lie Algebras (ex-05c3a3)`

We construct some (semi)simple Lie algebras.

```magma
> LieAlgebra("D7", RationalField());
Lie Algebra of dimension 91 with base ring Rational Field
> LieAlgebra("G2", GF(5));
Lie Algebra of dimension 14 with base ring GF(5)
> L := LieAlgebra( "G2 B3", Rationals() );
> L;
Lie Algebra of dimension 35 with base ring Rational Field
> DirectSumDecomposition(L);
[
    Lie Algebra of dimension 14 with base ring Rational Field,
    Lie Algebra of dimension 21 with base ring Rational Field
]
> LieAlgebra( "E8", GF(2) );
Lie Algebra of dimension 248 with base ring GF(2)
```

<a id="example-ex-ef718c"></a>
##### `Example: Isogeny Option for Lie Algebras (ex-ef718c)`

This example demonstrates the use of the `Isogeny` option. Over a field of characteristic zero, this option only effects the basis used. In characteristic $p$, it sometimes effects the isomorphism type of the algebra. For type $A_n$ with $p|(n+1)$, the default Isogeny is “Ad” (adjoint), which gives an algebra with nontrivial derived subalgebra but no centre:

```magma
> L := LieAlgebra("A4", GF(5));
> Dimension(L);
24
> Dimension(L*L);
23
> Dimension(Centre(L));
0
```

If you take Isogeny to be “SC” (simply connected), you get a perfect algebra with a nontrivial centre.

```magma
> L := LieAlgebra("A4", GF(5) : Isogeny:="SC");
> Dimension(L);
24
> Dimension(L*L);
24
> Dimension(Centre(L));
1
```

If $p^2|(n+1)$ there is an intermediate isogeny type which has both a centre and a nontrivial derived algebra:

```magma
> L := LieAlgebra("A24", GF(5) : Isogeny:=5);
> Dimension(L);
624
> Dimension(L*L);
623
> Dimension(Centre(L));
1
```

Similar results can be obtained by constructing the Lie algebra from a root datum. This kind of phenomenon happens whenever the characteristic divides the order of the fundamental group of your root datum. See [[Hog82](https://docs.magma-maths.org/references.md#cite-hogeweij82)] for more details.

```magma
> R := RootDatum("E6");
> #FundamentalGroup(R);
3
> L := LieAlgebra(R,GF(3));
> L;
Lie Algebra of dimension 78 with base ring GF(3)
> L*L;
Lie Algebra of dimension 77 with base ring GF(3)
```

<a id="function-liealgebra-monstgelt-rng-grppermelt"></a>
##### `LieAlgebra(N, k, p): MonStgElt, Rng, GrpPermElt -> AlgLie`

<a id="function-liealgebra-rootdtm-rng-grppermelt"></a>
##### `LieAlgebra(R, k, p): RootDtm, Rng, GrpPermElt -> AlgLie`

The twisted (almost) semisimple Lie algebra over the finite field $k$ with Cartan type $N$ given as a string or root datum $R$, with twist given by the permutation $p$. The twist should either be a permutation of the indices of the simple roots, or of the indices of all roots.

<a id="function-twistedliealgebra-rootdtm-rng"></a>
##### `TwistedLieAlgebra(R, k): RootDtm, Rng -> AlgLie`

Given a twisted root datum $R$ and a finite field $k$, construct the twisted Lie algebra $L = R(k)$.

This variant has 5 return values. First, the twisted Lie algebra $L$. Second, a homomorphism $\phi$ from $L$ into the split Lie algebra $L'$ (over a suitable field extension of $k$); Third, $L'$; Fourth, a split toral subalgebra $H$ of $L$, and, fifth, a split toral subalgebra $H'$ of $L'$, such that $\phi(H) \subseteq H'$.

See also [`TwistedBasis`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-twistedbasis).

<a id="example-ex-0173e2"></a>
##### `Example: Twisted Lie Algebras (ex-0173e2)`

We construct two twisted Lie algebras.

```magma
> DynkinDiagram("E6");

E6    1 - 3 - 4 - 5 - 6
              |
              2

> LieAlgebra( "E6", GF(5), Sym(6)!(1,6)(3,5) );
Lie Algebra of dimension 78 with base ring GF(5)
> Rt := TwistedRootDatum(RootDatum("D4") : Twist := 3);
> k := GF(7);
> L, phi, Lp, H, Hp := TwistedLieAlgebra(Rt, k);
> L;
Lie Algebra of dimension 28 with base ring GF(7)
> Lp;
Lie Algebra of dimension 28 with base ring GF(7^3)
> phi(L.3);
(0 0 ksi^49 ksi^7 ksi 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> IsSplitToralSubalgebra(L, H);
true
> IsSplitToralSubalgebra(Lp, Hp);
true
> forall{b : b in Basis(H) | phi(b) in Hp};
true
```

<a id="introduction-2"></a>
<a id="subsectalgcartyp"></a>
#### Cartan-Type Lie Algebras

Simple Lie algebras over fields of characteristic $0$ have been classified and are precisely the twisted forms of Lie algebras of types $A_l, B_l, C_l, D_l, E_6, E_7, E_8, F_4$ and $G_2$ (see previous Subsection). Over fields of finite characteristic $p$, the analogues of these algebras are called *classical-type* (including the exceptional algebras). Over such fields there are other simple Lie algebras, the first of them found by Witt sometimes before 1937. For $p \geq 7$, the only non-classical simple Lie algebras are the Lie algebras of *Cartan-type*, which we discuss in this section. For $p=5$, one further class of simple Lie algebras occurs: *Melikian* algebras, which are discussed in the next section. In characteristic $2$ and $3$, the classification of simple Lie algebras is not yet complete.

Cartan-type Lie algebras are non-classical Lie algebras which arise from infinite dimensional algebras of differential operators over ${\mathbb{C}}$:

- (generalised) Witt algebras,
- special and conformal special Lie algebras,
- Hamiltonian and conformal Hamiltonian Lie algebras,
- and contact Lie algebras.

The notation and the description of these Lie algebras closely follow Strade and Farnsteiner [[Str04](https://docs.magma-maths.org/references.md#cite-str2004)] and [[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88)]. Where the notation of the two books differs, we follow [[Str04](https://docs.magma-maths.org/references.md#cite-str2004)].

Let $F$ be a finite field of characteristic $p>0$ and $m$ a positive integer. We refer for the definition of $O(m)$ and $x^{(a)}$ to [[Str04](https://docs.magma-maths.org/references.md#cite-str2004), 2.1]. The basis of $O(m)$ is $\{ x^{(a)} | 0\leq a, a\in {\mathbb{N}}^m \}$.

Let $n$ be a sequence of positive integers of length $m$ and set $N := \sum_{i=1}^m n_i$. Define

$$
O(m,n) := \langle x^{(a)} | 0 \leq a_i < p^{n_i} \rangle
$$

For $i=1,\dots,m$ denote by $\partial_i$ the derivation of $O(m)$ defined by

$$
\partial_i(x_j^{(r)}) = \delta_{i,j} x_j^{(r-1)}.
$$

Now define

$$
W(m,n) := \sum_{i=1}^m O(m)\partial_i.
$$

The algebra $W(m,n)$ is the *Witt* algebra and has dimension $m p^N$ over $F$. In particular, $W(1,[1])$ is the standard $p$-dimensional Witt algebra.

The Witt algebra $W(m,n)$ is simple unless $p=2$ and $m=1$ ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.2.4(1)]) and is restrictable if and only if $n=[1,\dots,1]$ ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.2.4(2)]).

Further define $\Omega^0(m,n) := O(m,n),$$\Omega^1(m,n) := {\operatorname{Hom}}{}_{O(m,n)}(W(m,n),O(m,n)),$$\Omega^r(m,n) := \bigwedge^r \Omega^1(m,n),$$\Omega(m,n) := \bigoplus \Omega^r(m,n).$

Let $m\geq 2$ and $\omega_S = dx_1 \wedge \dots \wedge dx_m$. Define the following subalgebras of $W(m,n)$:

$$
S(m,n) := \{ D\in W(m,n) | D(\omega_S) = 0 \},$$$$CS(m,n) := \{ D\in W(m,n) | D(\omega_S) \in F\omega_S \}.
$$

The algebra $S(m,n)$ is the *special* and $CS(m,n)$ is the *conformal special* Lie algebra. The dimension of $S(m,n)$ over $F$ is $(m-1)p^N + 1$ and the dimension of $CS(m,n)$ is $\dim S(m,n) + 1$.

Suppose $m\geq 3$. Then the algebra $S(m,n)^{(1)}$ is simple ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.3.5(1)]) and is restrictable if and only if $n=[1,\dots,1]$ ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.3.5(2)]).

Let $p>2$, $m = 2r \geq 2$ and let $\omega_H = \sum\limits_{i=1}^r dx_i \wedge dx_{i+r}$. Define the following subalgebras of $W(m,n)$:

$$
H(m,n) := \{ D\in W(m,n) | D(\omega_H) = 0 \},$$$$CH(m,n) := \{ D\in W(m,n) | D(\omega_H) \in F\omega_H \}.
$$

The algebra $H(m,n)$ is the *Hamiltonian* and $CH(m,n)$ is the *conformal Hamiltonian* Lie algebra. The dimension of $H(m,n)$ over $F$ is $p^N - 1$ and the dimension of $CH(m,n)$ is $\dim H(m,n) + 1$.

The algebra $H(m,n)^{(2)}$ is simple ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.4.5(1)]) and is restrictable if and only if $n=[1,\dots,1]$ ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.4.5(2)]). And, if $m>2$, then $H(m,n)^{(2)} = H(m,n)^{(1)}$.

Let $p>2$, $m = 2r+1 \geq 3$ and let $\omega_K = dx_m + \sum\limits_{i=1}^r (x_idx_{i+r} - x_{i+r}dx_i)$. Define the following subalgebra of $W(m,n)$:

$$
K(m,n) := \{ D\in W(m,n) | D(\omega_K) \in O(m,n)\omega_K \},
$$

The algebra $K(m,n)$ is the *contact* Lie algebra. The dimension of $K(m,n)$ over $F$ is $p^N$.

The algebra $K(m,n)^{(1)}$ is simple ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.5.5(1)]) and is restrictable if and only if $n=[1,\dots,1]$ ([[SF88](https://docs.magma-maths.org/references.md#cite-str-frn88), 4.5.6]). If $m+3 \not\equiv 0 {\rm\ mod\ }p$, then $K(m,n)^{(1)} = K(m,n)$.

<a id="function-wittliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `WittLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, Map`

```magma
Check: BoolElt                    Default: false
```

The Witt algebra $W(m,n)$ is constructed over the finite field $F$, where $m$ must be a positive integer and $n$ a sequence of positive integers of length $m$. If the optional argument `Check` is `true`, the algebra is checked to be Lie upon construction.

An invertible map from the polynomial ring $P$ over $F$ of degree $2m$ to $W(m,n)$ is returned as second value, to assist in identifying the elements of $W(m,n)$. For $1 \leq i\leq m$ the $i$-th generator of $P$ maps to $x_i$ in $W(m,n)$, and for $m+1 \leq i\leq 2m$ the $i$-th generator of $P$ maps to $\delta_{i-m}$ in $W(m,n)$.

<a id="example-ex-ea6512"></a>
##### `Example: Witt Lie Algebra (ex-ea6512)`

We compute the Witt algebra $W(2,[2,1])$ over $GF(9)$ and verify the multiplication of $x_1^{(1)} \delta_1$ and $x_1^{(2)} x_2^{(1)} \delta_2$.

```magma
> W, phi := WittLieAlgebra(GF(9), 2, [2,1]);
> W;
Lie Algebra of dimension 54 with base ring GF(3^2)
> IsSimple(W);
true
> P<x1, x2, d1, d2> := Domain(phi);
> phi(x1*d1);
(0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> (phi(x1*d1)*phi(x1^2*x2*d2)) @@ phi;
2*x1^2*x2*d2
```

and the standard Witt algebra $W(1,[1])$ over $GF(2)$:

```magma
> W := WittLieAlgebra(GF(2), 1, [1]);
> W;
Lie Algebra of dimension 2 with base ring GF(2)
> IsSimple(W);
false
> IsRestrictedLieAlgebra(W);
true [ (0 0), (0 1) ]
```

<a id="function-specialliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `SpecialLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, AlgLie, Map, Map`

<a id="function-conformalspecialliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `ConformalSpecialLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, AlgLie, AlgLie, Map, Map`

```magma
Check: BoolElt                    Default: false
```

The (conformal) special Lie algebra $(C)S(m,n)$ is constructed over the finite field $F$, where $m\geq 2$ must be an integer and $n$ a sequence of positive integers of length $m$. If the optional argument `Check` is `true`, Magma checks that the algebra constructed is a Lie algebra.

The intrinsic `SpecialLieAlgebra` returns the Witt algebra $W(m,n)$ in which it is embedded as the second return value. In addition, similarly to `WittLieAlgebra`, a map from the polynomial ring $P$ of degree $2m$ over $F$ to $S(m,n)$ is returned as the third return value, and a map from $P$ to $W(m,n)$ as the fourth return value.

Similarly, `ConformalSpecialLieAlgebra` returns the special Lie algebra $S(m,n)$ which it contains and the Witt Lie algebra $W(m,n)$ in which it is embedded in as second and third return values. Maps from $P$ to $CS(m,n)$, $S(m,n)$, and $W(m,n)$ are returned as fourth, fifth, and sixth return values, respectively.

<a id="example-ex-c2ee06"></a>
##### `Example: Special Lie Algebras (ex-c2ee06)`

We compute both $S(3,[1,2,1])$ and $CS(3,[1,2,1])$ over $GF(9)$:

```magma
> CS,S,W := ConformalSpecialLieAlgebra( GF(9), 3, [1,2,1] );
> CS;S;W;
Lie Algebra of dimension 164 with base ring GF(3^2)
Lie Algebra of dimension 163 with base ring GF(3^2)
Lie Algebra of dimension 243 with base ring GF(3^2)
> IsSimple(S);
false
> IsSimple(S*S);
true
> IsRestrictedLieAlgebra(S*S);
false []
```

<a id="function-hamiltonianliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `HamiltonianLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, AlgLie`

<a id="function-conformalhamiltonianliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `ConformalHamiltonianLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, AlgLie, AlgLie`

```magma
Check: BoolElt                    Default: false
```

The (conformal) Hamiltonian Lie algebra $(C)H(m,n)$ is constructed over the finite field $F$ of characteristic at least $3$, where $m\geq 2$ must be even and $n$ a sequence of positive integers of length $m$. If the optional argument `Check` is `true`, the algebra is checked to be Lie upon construction.

The intrinsic `HamiltonianlLieAlgebra` returns the Witt Lie algebra $W(m,n)$ in which it is embedded as the second return value. Additionally, similarly to `WittLieAlgebra`, a map from the polynomial ring $P$ of degree $2m$ over $F$ to $H(m,n)$ is returned as the third return value, and a map from $P$ to $W(m,n)$ as the fourth return value.

Similarly, `ConformalHamiltonianLieAlgebra` returns the Hamiltonian Lie algebra $H(m,n)$ it contains and the Witt Lie algebra $W(m,n)$ in which it is embedded as the second and third return values. Maps from $P$ to $CH(m,n)$, $H(m,n)$, and $W(m,n)$ are returned as the fourth, fifth, and sixth return values, respectively.

<a id="example-ex-2e2daf"></a>
##### `Example: Hamiltonian Lie Algebras (ex-2e2daf)`

We compute both $H(2,[2,2])$ and $CH(2,[2,2])$ over $GF(9)$:

```magma
> CH,H,W := ConformalHamiltonianLieAlgebra( GF(9), 2, [2,2] );
> CH;H;W;
Lie Algebra of dimension 81 with base ring GF(3^2)
Lie Algebra of dimension 80 with base ring GF(3^2)
Lie Algebra of dimension 162 with base ring GF(3^2)
> IsSimple(H);
false
> IsSimple(H*H);
true
> IsSimple(H*H*H);
true
> IsRestrictedLieAlgebra(H*H*H);
false []
```

<a id="function-contactliealgebra-fld-rngintelt-seqenum-rngintelt"></a>
##### `ContactLieAlgebra(F, m, n): Fld, RngIntElt, SeqEnum[RngIntElt] -> AlgLie, AlgLie`

```magma
Check: BoolElt                    Default: false
```

The contact Lie algebra $K(m,n)$ is constructed over the finite field $F$ of characteristic at least $3$, where $m\geq 3$ must be odd and $n$ a sequence of positive integers of length $m$. If the optional argument `Check` is `true`, the algebra is checked to be Lie upon construction.

The intrinsic `ContactLieAlgebra` returns the Witt Lie algebra $W(m,n)$ in which it is embedded as the second return value. Additionally, similarly to `WittLieAlgebra`, a map from the polynomial ring $P$ of degree $2m$ over $F$ to $K(m,n)$ is returned as the third return value, and a map from $P$ to $W(m,n)$ as the fourth return value.

<a id="example-ex-983c1d"></a>
##### `Example: Contact Lie Algebra (ex-983c1d)`

We compute the contact Lie algebra $K(3,[1,1,1])$ over $GF(5)$:

```magma
> K,W := ContactLieAlgebra( GF(5), 3, [1,1,1] );
> K;W;
Lie Algebra of dimension 125 with base ring GF(5)
Lie Algebra of dimension 375 with base ring GF(5)
> K*K eq K;
true
> IsSimple(K);
true
```

<a id="introduction-3"></a>
<a id="subsectalgmelikian"></a>
#### Melikian Lie Algebras

The Melikian Lie Algebras are a class of simple Lie algebras over finite fields of characteristic $5$, parameterized by two positive integers $n_1$, $n_2$. We follow the explicit construction by Strade [[Str04](https://docs.magma-maths.org/references.md#cite-str2004), Section 4.3].

Let $F$ be a field of characteristic $p = 5$ and recall the definition of $O(m,n)$ and $W(m,n)$ from Section [Cartan-Type Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/family-construct.md#subsectalgcartyp). Define $W = W(2, [n_1, n_2])$, $O = O(2, [n_1, n_2])$, and take $W'$ to be a copy of $W$. We equip the vector space $W \oplus O \oplus W'$ with a bilinear product $[\cdot,\cdot]$ that is defined by the following equations, where $D, E \in W$ and $f, f_1, f_2, g, g_1, g_2 \in O$.

- On $W \times W$, the usual multiplication in $W$.
- On $W \times O$: $[D, f] = D(f) - 2\operatorname{div}(D) f$.
- On $W \times W'$: $[D, E'] = ([D,E])' + 2\operatorname{div}(D) E'$.
- On $O \times O$: $[f,g] = 2(g \delta_2(f) - f \delta_2(g)) \delta'_1 + 2(f \delta_1(g) - g \delta_1(f)) \delta'_2$.
- On $O \times W'$: $[f, E'] = fE$.
- On $W' \times W'$: $[f_1 \delta'_1 + f_2 \delta'_2, g_1 \delta'_1 + g_2 \delta'_2] = f_1 g_2 - f_2 g_1$.

Here div is the linear map defined by div($f \delta_i$) = $\delta_i f$. It follows that $M(n_1, n_2)$, of dimension $5^{n_1+n_2+1}$, is a simple Lie algebra [[Str04](https://docs.magma-maths.org/references.md#cite-str2004)] (Lemma 4.3.1, Theorem 4.3.3).

<a id="function-melikianliealgebra-fld-rngintelt-rngintelt"></a>
##### `MelikianLieAlgebra(F, n1, n2): Fld, RngIntElt, RngIntElt -> AlgLie, Map`

```magma
Check: BoolElt                    Default: false
```

The Melikian Lie algebra $M = M(n_1, n_2)$ over $F$. An invertible map from the polynomial ring $P$ of degree $6$ over $F$ to $M$ is returned as second value, to assist in identifying the elements of $M$. Here the six generators of $P$ represent $x_1$, $x_2$, $\delta_1$, $\delta_2$, $\delta'_1$, $\delta'_2$, respectively.

<a id="example-ex-c70322"></a>
##### `Example: Melikian Lie Algebra (ex-c70322)`

We construct $M(2, 1)$ over ${\bf F}_{5}$ and inspect some of its properties.

```magma
> M, phi := MelikianLieAlgebra(GF(5), 2, 1);
> M;
Lie Algebra of dimension 625 with base ring GF(5)
> IsSimple(M);
true
```

Next, we construct subspaces (not subalgebras) $W$, $O$, $W'$ of $M$.

```magma
> P<x1, x2, d1, d2, dp1, dp2> := Domain(phi);
> V := VectorSpace(GF(5), Dimension(M));
> W := sub<V | [ V | phi(x1^i*x2^j*d) : i in [0..24], j in [0..4],
>                                                     d in [d1,d2] ]>;
> O := sub<V | [ V | phi(x1^i*x2^j) : i in [0..24], j in [0..4] ]>;
> Wp := sub<V | [ V | phi(x1^i*x2^j*d) : i in [0..24], j in [0..4],
>                                                      d in [dp1,dp2] ]>;
> Dimension(W), Dimension(O), Dimension(Wp);
250 125 250
> Dimension(W meet O), Dimension(W meet Wp), Dimension(O meet Wp);
0 0 0
```

Finally, we verify that these subspaces multiply as required by the definition.

```magma
> m := func< A, B | sub<V | [ V | M!a*M!b : a in Basis(A), b in Basis(B) ]> >;
> WxWp := m(W, Wp); [ WxWp subset VV : VV in [W, O, Wp] ];
[ false, false, true ]
```

So indeed $[W, W'] \subseteq W'$.

```magma
> VV := [W, O, Wp]; VVnm := ["W", "O", "W'" ];
> mm := function(A, B)
>   AB := m(A, B);
>   for i in [1..#VV] do
>     if AB eq VV[i] then return VVnm[i]; end if;
>   end for;
>   return "??";
> end function;
> mm(W, Wp);
W'
> for i,j in [1..#VV] do
>   printf "[ %2o, %2o ] = %2o%o", VVnm[i], VVnm[j], mm(VV[i], VV[j]),
>     (j eq 3) select "\\n" else ", ";
> end for;
[  W,  W ] =  W, [  W,  O ] =  O, [  W, W' ] = W'
[  O,  W ] =  O, [  O,  O ] = W', [  O, W' ] =  W
[ W',  W ] = W', [ W',  O ] =  W, [ W', W' ] =  O
```

<a id="element-construct"></a>
<a id="sectalglieeltconstr"></a>
### Construction of Elements

<a id="function-zero-alglie"></a>
#### `Zero(L): AlgLie -> AlgLieElt`

<a id="function-zero-algmatlie"></a>
#### `Zero(L): AlgMatLie -> AlgMatLieElt`

<a id="operation-op-alglie-rngintelt"></a>
#### `L ! 0: AlgLie, RngIntElt -> AlgLieElt`

<a id="operation-op-algmatlie-rngintelt"></a>
#### `L ! 0: AlgMatLie, RngIntElt -> AlgMatLieElt`

The zero element of the Lie algebra $L$.

<a id="function-random-alglie"></a>
#### `Random(L): AlgLie -> AlgLieElt`

<a id="function-random-algmatlie"></a>
#### `Random(L): AlgMatLie -> AlgMatLieElt`

Given a Lie algebra $L$ defined over a finite ring, a random element is returned.

#### Construction of Elements of Structure Constant Algebras

<a id="constructor-constructor-elt-alglie-rngelt-rngelt-rngelt-alglieelt"></a>
##### `elt<L | r₁, r₂, ..., rₙ>: AlgLie, RngElt, RngElt, ..., RngElt -> AlgLieElt`

Given a Lie algebra $L$ of dimension $n$ over a ring $R$, and ring elements $r_1, r_2, \ldots, r_n \in R$ construct the element $r_1 * e_1 + r_2 * e_2 + \ldots + r_n * e_n$ of $L$.

<a id="operation-op-alglie-seqenum-rngelt"></a>
##### `L ! Q: AlgLie, SeqEnum[RngElt] -> AlgLieElt`

Given a Lie algebra $L$ of dimension $n$ and a sequence $Q = [r_1, r_2, \ldots, r_n]$ of elements of the base ring $R$ of $L$, the element $r_1 * e_1 + r_2 * e_2 + \ldots + r_n * e_n$ of $L$ is constructed.

<a id="function-basisproduct-alglie-rngintelt-rngintelt"></a>
##### `BasisProduct(L, i, j): AlgLie, RngIntElt, RngIntElt -> AlgLieElt`

Returns the product of the $i$-th and $j$-th basis element of the Lie algebra $L$.

<a id="function-basisproducts-alglie"></a>
##### `BasisProducts(L): AlgLie -> SeqEnum`

```magma
Rep: MonStgElt                    Default: "Dense"
```

Returns the products of all basis elements of the Lie algebra $L$.

The optional parameter `Rep` may be used to specify the format of the result. If `Rep` is set to “Dense”, the products are returned as a sequence $Q$ of $n$ sequences of $n$ elements of $L$, where $n$ is the dimension of $L$. The element $Q[i][j]$ is the product of the $i$-th and $j$-th basis elements.

If `Rep` is set to “Sparse”, the products are returned as a sequence $Q$ containing quadruples $(i,j,k,a_{ijk})$ signifying that the product of the $i$-th and $j$-th basis elements is $\sum_{k=1}^n a_{ijk} b_k$, where $b_k$ is the $k$-th basis element and $n =$ dim($L$).

#### Construction of Matrix Elements

Matrix Lie elements can be constructed using the functions below. For more information on constructing matrices see Section [Construction of a Matrix](https://docs.magma-maths.org/Algebras/MatrixAlgebras/creation.md#algmat-elt-constr).

<a id="constructor-constructor-elt-algmatlie-rngelt-algmatlieelt"></a>
##### `elt<R | L>: AlgMatLie, [ RngElt ] -> AlgMatLieElt`

<a id="constructor-constructor-elt-algmatlie-rngelt-rngelt-algmatlieelt"></a>
##### `elt<R | L>: AlgMatLie, RngElt, ..., RngElt -> AlgMatLieElt`

<a id="operation-op-algmatlie-rngelt"></a>
##### `R ! L: AlgMatLie, [RngElt] -> AlgMatLieElt`

Create the element of the matrix Lie algebra $R$ of degree $n$ whose entries are the $n^2$ elements of the sequence $L$.

<a id="function-diagonalmatrix-algmatlie-rngelt"></a>
##### `DiagonalMatrix(L, Q): AlgMatLie, [RngElt] -> AlgMatLieElt`

Diagonal matrix in the matrix Lie algebra $L$, given by the sequence $Q$ of ring elements.

<a id="function-scalarmatrix-algmatlie-rngelt"></a>
##### `ScalarMatrix(L, r): AlgMatLie, RngElt -> AlgMatLieElt`

Scalar matrix in the matrix Lie algebra $L$, defined by the ring element $r$.

<a id="sub-construct"></a>
<a id="sectalgliesubconstr"></a>
### Construction of Subalgebras, Ideals, and Quotients

If the coefficient ring $R$ of a Lie algebra $L$ is a Euclidean domain, then submodules and ideals can be constructed in Magma; if $R$ is a field then quotients can be constructed in Magma. Note that left, right, and two-sided ideals are identical in a Lie algebra.

<a id="constructor-constructor-sub-alglie-list-alglie-map"></a>
#### `sub<L | A>: AlgLie, List -> AlgLie, Map`

<a id="constructor-constructor-sub-algmatlie-list-algmatlie-map"></a>
#### `sub<L | A>: AlgMatLie, List -> AlgMatLie, Map`

Creates the subalgebra $S$ of the Lie algebra $L$ that is generated by the elements defined by $A$, where $A$ is a list of one or more items of the following types:

**(a)**
An element of $L$;

**(b)**
A set or sequence of elements of $L$;

**(c)**
A subalgebra or ideal of $L$;

**(d)**
A set or sequence of subalgebras or ideals of $L$.

As well as the subalgebra $S$ itself, the constructor returns the inclusion homomorphism $f : S \rightarrow L$.

<a id="constructor-constructor-ideal-alglie-list-alglie-map"></a>
#### `ideal<L | A>: AlgLie, List -> AlgLie, Map`

<a id="constructor-constructor-ideal-algmatlie-list-algmatlie-map"></a>
#### `ideal<L | A>: AlgMatLie, List -> AlgMatLie, Map`

Creates the ideal $I$ of the Lie algebra $L$ generated by the elements defined by $A$, where $A$ is a list of one or more items of the following types:

**(a)**
An element of $L$;

**(b)**
A set or sequence of elements of $L$;

**(c)**
A subalgebra or ideal of $L$;

**(d)**
A set or sequence of subalgebras or ideals of $L$.

As well as the ideal $I$ itself, the constructor returns the inclusion homomorphism $f : I \rightarrow L$.

<a id="constructor-constructor-quo-alglie-list-alglie-map"></a>
#### `quo<L | A>: AlgLie, List -> AlgLie, Map`

<a id="constructor-constructor-quo-algmatlie-list-algmatlie-map"></a>
#### `quo<L | A>: AlgMatLie, List -> AlgMatLie, Map`

Forms the quotient algebra $L / I$, where $I$ is the two-sided ideal of $L$ generated by the elements defined by $A$, where $A$ is a list of one or more items of the following types:

**(a)**
An element of $L$;

**(b)**
A set or sequence of elements of $L$;

**(c)**
A subalgebra or ideal of $L$;

**(d)**
A set or sequence of subalgebras or ideals of $L$.

As well as the quotient $L/I$ itself, the constructor returns the natural homomorphism $f : L \rightarrow L/I$.

<a id="operation-op-div-alglie-alglie"></a>
#### `L / S: AlgLie, AlgLie -> AlgLie`

<a id="operation-op-div-algmatlie-algmatlie"></a>
#### `L / S: AlgMatLie, AlgMatLie -> AlgLie`

The quotient of the Lie algebra $L$ by the ideal closure of the subalgebra $S$.

<a id="example-ex-bb05e7"></a>
#### `Example: Quotient of a Matrix Lie Algebra (ex-bb05e7)`

We construct the quotient of the matrix Lie algebra of $2\times 2$ matrices, by the ideal spanned by the identity matrix.

```magma
> L := MatrixLieAlgebra( Rationals(), 2 );
> Dimension(L);
4
> I := ideal< L | L!Matrix([[1,0],[0,1]]) >;
> Dimension(I);
1
> K := L/I;
> Dimension(K);
3
> SemisimpleType( K );
A1
```

<a id="function-quotientwithpullback-alglie-alglie"></a>
#### `QuotientWithPullback(L, I): AlgLie, AlgLie -> AlgLie, Map, UserProgram, UserProgram`

Given a Lie algebra $L$ and an ideal $I$ of $L$, this intrinsic returns four values: the quotient $Q = L/I$, the natural homomorphism $\mu : L\to Q$, and two functions, $\sigma$ and $\Sigma$ with domain $Q$. The function $\sigma$ is a section of $\mu$ and also returns the kernel of $\mu$. That is, for $y \in Q$, $\sigma(y)$ returns $x$ and $V$, such that $\sigma(x) = y$ and where $V$ is the underlying vector space of $I$. For $y\in Q$, $\Sigma(y)$ is the subalgebra of $L$ generated by $I$ and $x$.

<a id="example-ex-83d77d"></a>
#### `Example: Quotient and Pullback of an Ideal (ex-83d77d)`

We consider an ideal of the Lie algebra of type G$_2$ over the field with $3$ elements.

```magma
> R := RootDatum("G2");
> L := LieAlgebra(R, GF(3));
> pos,neg,cart := StandardBasis(L);
> shrt := [ i : i in [1..NumPosRoots(R)] | IsShortRoot(R, i) ];
> shrt;
[ 1, 3, 4 ]
> I := ideal<L | pos[shrt]>;
> _, str1 := ReductiveType(I); str1;
The 7-dim simple constituent of a Lie algebra of type A2
```

So apparently $I$ is isomorphic to the $7$-dimensional simple constituent of a Lie algebra of type A$_2$. We will now use `QuotientWithPullback` to construct $L/I$.

```magma
> LI, proj, pb, pbsub := QuotientWithPullback(L, I);
> _, str2 := ReductiveType(LI); str2;
The 7-dim simple constituent of a Lie algebra of type A2
```

So apparently $I \simeq L/I$! Finally, we will demonstrate the use of the additional return values. First, we verify that an element of $I$ maps to $0$ in $L/I$:

```magma
> proj(pos[1]);
(0 0 0 0 0 0 0)
```

And then we consider the preimage in $L$ of a randomly chosen element of $L/I$.

```magma
> y := LI![0,1,1,1,1,0,1];
> y;
(0 1 1 1 1 0 1)
> x, V := pb(y);
> x;
(0 1 0 0 1 0 0 1 0 1 0 0 0 1)
> #V;
2187
> assert #V eq #I;
> {* proj(x + v) eq y : v in V *};
{* true^^2187 *}
```

So indeed $x+v$ is a preimage of $y$ for all $v \in V$.

```magma
> M := pbsub(y);
> M, M meet I;
Lie Algebra of dimension 8 with base ring GF(3)
Lie Algebra of dimension 7 with base ring GF(3)
> _,str3 := ReductiveType(M);
> str3;
Twisted Lie algebra of type 2A2 [Ad]
```

<a id="operation"></a>
<a id="sectalglieop"></a>
### Operations on Lie Algebras

<a id="operation-op-eq-alglie-alglie"></a>
#### `L eq K: AlgLie, AlgLie -> BoolElt`

<a id="operation-op-eq-algmatlie-algmatlie"></a>
#### `L eq K: AlgMatLie, AlgMatLie -> BoolElt`

Returns `true` if, and only if, the Lie algebras $L$ and $K$ are equal.

<a id="operation-op-ne-alglie-alglie"></a>
#### `L ne K: AlgLie, AlgLie -> BoolElt`

<a id="operation-op-ne-algmatlie-algmatlie"></a>
#### `L ne K: AlgMatLie, AlgMatLie -> BoolElt`

Returns `true` if, and only if, the Lie algebras $L$ and $K$ are not equal.

<a id="operation-op-subset-alglie-alglie"></a>
#### `L subset K: AlgLie, AlgLie -> BoolElt`

<a id="operation-op-subset-algmatlie-algmatlie"></a>
#### `L subset K: AlgMatLie, AlgMatLie -> BoolElt`

Returns `true` if, and only if, the Lie algebra $L$ is contained in the Lie algebra $K$.

<a id="operation-operation-notsubset-alglie-alglie-boolelt"></a>
#### `L notsubset K: AlgLie, AlgLie -> BoolElt`

Returns `true` if, and only if, the Lie algebra $L$ is not contained in the Lie algebra $K$.

<a id="operation-op-meet-alglie-alglie"></a>
#### `L meet M: AlgLie, AlgLie -> AlgLie`

<a id="operation-op-meet-algmatlie-algmatlie"></a>
#### `L meet M: AlgMatLie, AlgMatLie -> AlgMatLie`

The intersection of the Lie algebras $L$ and $M$ is returned. Note that $L$ and $M$ have a common superalgebra.

<a id="operation-op-times-alglie-alglie"></a>
#### `L * M: AlgLie, AlgLie -> AlgLie`

<a id="operation-op-times-algmatlie-algmatlie"></a>
#### `L * M: AlgMatLie, AlgMatLie -> AlgMatLie`

The Lie algebra product $[L,M]$ of the algebras $L$ and $M$ is returned. Note that $L$ and $M$ must have a common superalgebra.

<a id="operation-op-pow-alglie-rngintelt"></a>
#### `L ^ n: AlgLie, RngIntElt -> AlgLie`

The (left-normed) $n$-th power of the (structure constant) Lie algebra $L$, i.e., $((\ldots (L*L)* \ldots)*L)$ is constructed.

<a id="function-morphism-alglie-alglie"></a>
#### `Morphism(L, M): AlgLie, AlgLie -> Map`

The map giving the morphism from the (structure constant) Lie algebra $L$ to $M$ is constructed. Either $L$ is a subalgebra of $M$, in which case the embedding of $L$ into $M$ is returned, or $M$ is a quotient algebra of $L$, in which case the natural epimorphism from $L$ onto $M$ is returned.

<a id="function-isisomorphiclie"></a>
#### `IsIsomorphic(L, M): AlgLie, AlgLie -> BoolElt, .`

```magma
HL: AlgLie                    Default: false
HM: AlgLie                    Default: false
```

Returns `true` if the Lie algebras $L$ and $M$ are isomorphic. It is currently implemented for trivial cases (such as when the dimensions differ), reductive Lie algebras, solvable Lie algebras up to dimension $4$, nilpotent Lie algebras up to dimension $6$ (some special cases excluded). The solvable and nilpotent cases are handled using the databases for such algebras described in Section [Solvable and Nilpotent Lie Algebras Classification](https://docs.magma-maths.org/LieTheory/LieAlgebras/solvable-nilpotent.md#sectslac)).

In the case of reductive Lie algebras, split maximal toral subalgebras for $L$ and $M$ may be provided in the optional arguments $HL$ and $HM$, respectively. If these are not provided an attempt is made to compute them, a process which may fail, particularly in characteristic $0$.

This intrinsic has two return values: the first a boolean describing whether $L$ and $M$ are isomorphic. If so, the second is an isomorphism from $L$ to $M$, otherwise the second is a string describing the reason for non-isomorphism.

An error is thrown if isomorphism cannot be determined.

<a id="function-isknownisomorphic-alglie-alglie"></a>
#### `IsKnownIsomorphic(L, M): AlgLie, AlgLie -> BoolElt, BoolElt, .`

```magma
HL: AlgLie                    Default: false
HM: AlgLie                    Default: false
```

Returns `true` if Magma can determine isomorphism between Lie algebras $L$ and $M$. If so, the second return value is whether $L$ and $M$ are isomorphic, and the third is an isomorphism or a string (describing the reason for non-isomorphism). Refer to [`IsIsomorphic`](https://docs.magma-maths.org/LieTheory/LieAlgebras/operation.md#function-isisomorphiclie) for more details on applicability and the meanings of the return values.

<a id="function-isisomorphism-map-alglie-alglie"></a>
#### `IsIsomorphism(m): Map[AlgLie, AlgLie] -> BoolElt`

Returns `true` if the mapping $m$ between two Lie algebras is an isomorphism of Lie algebras.

<a id="example-ex-4fbecb"></a>
#### `Example: Isomorphism of B2 and C2 (ex-4fbecb)`

We demonstrate that B$_2$ and C$_2$ are isomorphic over ${\mathbb{Q}}$.

```magma
> k := Rationals();
> L := LieAlgebra("B2", k); M := LieAlgebra("C2", k);
> b, c := IsIsomorphic(L, M);
> b;
true
> IsIsomorphism(c);
true
> c(L.1);
(0 0 1 0 0 0 0 0 0 0)
```

We demonstrate that B$_3$ and C$_3$ are non-isomorphic over ${\mathbb{Q}}$.

```magma
> L := LieAlgebra("B3", k); M := LieAlgebra("C3", k);
> b, c := IsIsomorphic(L, M);
> b;
false
> c;
21-dim component of L1 of type R1: Adjoint root datum of dimension 3 of type B3
didn't match R2:
Adjoint root datum of dimension 3 of type C3
```

We demonstrate that two distinct isogenies of B$_2$ are isomorphic over ${\mathbb{Q}}$.

```magma
> L := LieAlgebra("B2", k : Isogeny := "Ad");
> M := LieAlgebra("B2", k : Isogeny := "SC");
> b, c := IsIsomorphic(L, M);
> b;
true
```

For larger nilpotent algebras Magma cannot decide on the isomorphism question.

```magma
> L := LieAlgebra("B4", k);
> pL, _, _ := StandardBasis(L);
> subL := sub<L | pL>;
> subL;
Lie Algebra of dimension 16 with base ring Rational Field
> M := LieAlgebra("C4", k);
> pM, _, _ := StandardBasis(M);
> subM := sub<M | pM>;
> subL;
Lie Algebra of dimension 16 with base ring Rational Field
> IsNilpotent(subL), IsNilpotent(subM);
true true
> a,b,c := IsKnownIsomorphic(subL, subM);
> a;
false
```

<a id="example-ex-3b3b3e"></a>
#### `Example: Isomorphic Ideals of G2 and A2 (ex-3b3b3e)`

We demonstrate that in characteristic $3$ the Lie algebras of type G$_2$ and A$_2$ have isomorphic nontrivial ideals.

```magma
> k := GF(3);
> CSL := CompositionSeries(LieAlgebra("G2", k));
> CSL;
[
    Lie Algebra of dimension 7 with base ring GF(3),
    Lie Algebra of dimension 14 with base ring GF(3)
]
> L := CSL[1];
> CSM := CompositionSeries(LieAlgebra("A2", k));
> CSM;
[
    Lie Algebra of dimension 7 with base ring GF(3),
    Lie Algebra of dimension 8 with base ring GF(3)
]
> M := CSM[1];
> a,b,c := IsKnownIsomorphic(L, M);
> a;
true
> b, c;
true Mapping from: AlgLie: L to AlgLie: M given by a rule
> IsIsomorphism(c);
true
```

<a id="basic-oper"></a>
<a id="subsectalglieopbasic"></a>
#### Basic Invariants

<a id="function-coefficientring-alglie"></a>
##### `CoefficientRing(L): AlgLie -> Rng`

<a id="function-coefficientring-algmatlie"></a>
##### `CoefficientRing(L): AlgMatLie -> Rng`

<a id="function-basering-alglie"></a>
##### `BaseRing(L): AlgLie -> Rng`

<a id="function-basering-algmatlie"></a>
##### `BaseRing(L): AlgMatLie -> Rng`

The coefficient ring (or base ring) over which the Lie algebra $L$ is defined.

<a id="function-dimension-alglie"></a>
##### `Dimension(L): AlgLie -> RngIntElt`

<a id="function-dimension-algmatlie"></a>
##### `Dimension(L): AlgMatLie -> RngIntElt`

The dimension of the Lie algebra $L$.

<a id="operation-operation-alglie-rngintelt"></a>
##### `# L: AlgLie -> RngIntElt`

<a id="operation-operation-algmatlie-rngintelt"></a>
##### `# L: AlgMatLie -> RngIntElt`

The cardinality of the Lie algebra $L$, if the coefficient ring is finite.

<a id="function-moduli-alglie"></a>
##### `Moduli(L): AlgLie -> SeqEnum`

This returns a sequence of integers, of length equal to the dimension of $L$. If the $i$-th element of this sequence is $a_i$ then $a_i$ is the minimal non-negative integer such that $a_ie_i = 0$. So if $L$ is defined over a field, then the sequence consists of zeros.

<a id="example-ex-29430b"></a>
##### `Example: Moduli of a Lie Algebra (ex-29430b)`

```magma
> T:= [ <1,2,2,2>, <2,1,2,2> ];
> t:= [0,4];
> L:= LieAlgebra< t | T : Rep:= "Dense" >;
> Moduli(L);
[ 0, 4 ]
```

<a id="change-ring"></a>
<a id="subsectalglieopchangering"></a>
#### Changing Base Rings

<a id="function-changering-alglie-rng"></a>
##### `ChangeRing(L, S): AlgLie, Rng -> AlgLie, Map`

<a id="function-changering-algmatlie-rng"></a>
##### `ChangeRing(L, S): AlgMatLie, Rng -> AlgMatLie, Map`

Given a Lie algebra $L$ with base ring $R$, together with a ring $S$, this function constructs the Lie algebra $M$ with base ring $S$ obtained by coercing the coefficients of elements of $L$ into $S$. The homomorphism from $L$ to $M$ is produced as second return value.

<a id="function-changering-alglie-rng-map"></a>
##### `ChangeRing(L, S, f): AlgLie, Rng, Map -> AlgLie, Map`

<a id="function-changering-algmatlie-rng-map"></a>
##### `ChangeRing(L, S, f): AlgMatLie, Rng, Map -> AlgMatLie, Map`

Given a Lie algebra $L$ with base ring $R$, together with a ring $S$ and a map $f: R \rightarrow S$, this function constructs the Lie algebra $M$ with base ring $S$ obtained by mapping the coefficients of elements of $L$ into $S$ via $f$. The homomorphism from $L$ to $M$ is produced as the second return value.

<a id="basis-oper"></a>
<a id="subsectalglieopbasis"></a>
#### Bases

<a id="function-basiselement-alglie-rngintelt"></a>
##### `BasisElement(A, i): AlgLie, RngIntElt -> AlgLieElt`

<a id="function-basiselement-algmatlie-rngintelt"></a>
##### `BasisElement(A, i): AlgMatLie, RngIntElt -> AlgMatLieElt`

<a id="operation-operation-alglie-rngintelt-alglieelt"></a>
##### `A . i: AlgLie, RngIntElt -> AlgLieElt`

<a id="operation-operation-algmatlie-rngintelt-algmatlieelt"></a>
##### `A . i: AlgMatLie, RngIntElt -> AlgMatLieElt`

The $i$-th basis element of the algebra $L$.

<a id="function-basis-alglie"></a>
##### `Basis(A): AlgLie -> [ AlgLieElt ]`

<a id="function-basis-algmatlie"></a>
##### `Basis(A): AlgMatLie -> [ AlgMatLieElt ]`

The basis of the algebra $L$, as a sequence of elements of $L$.

<a id="function-isindependent-alglieelt"></a>
##### `IsIndependent(Q): [ AlgLieElt ] -> BoolElt`

<a id="function-isindependent-algmatlieelt"></a>
##### `IsIndependent(Q): [ AlgMatLieElt ] -> BoolElt`

<a id="function-isindependent-alglieelt-2"></a>
##### `IsIndependent(Q): { AlgLieElt } -> BoolElt`

<a id="function-isindependent-algmatlieelt-2"></a>
##### `IsIndependent(Q): { AlgMatLieElt } -> BoolElt`

Given a set or sequence $Q$ of elements of the $R$-algebra $L$, this functions returns `true` if these elements are linearly independent over $R$; otherwise `false`.

<a id="function-extendbasis-alglie-alglie"></a>
##### `ExtendBasis(S, L): AlgLie, AlgLie -> [ AlgElt ]`

<a id="function-extendbasis-algmatlie-algmatlie"></a>
##### `ExtendBasis(S, L): AlgMatLie, AlgMatLie -> [ AlgElt ]`

<a id="function-extendbasis-alglieelt-alglie"></a>
##### `ExtendBasis(Q, L): [ AlgLieElt ], AlgLie -> [ AlgElt ]`

<a id="function-extendbasis-algmatlie-algmatlie-2"></a>
##### `ExtendBasis(Q, L): [ AlgMatLie ], AlgMatLie -> [ AlgElt ]`

Given an algebra $L$ and either a subalgebra $S$ of dimension $m$ of $L$ or a sequence $Q$ of $m$ linearly independent elements of $L$, this function returns a sequence containing a basis of $L$ such that the first $m$ elements are the basis of $S$ resp. the elements in $Q$.

<a id="red-oper"></a>
<a id="subsectalglieopred"></a>
#### Operations for Semisimple and Reductive Lie Algebras

<a id="function-semisimpletype-alglie"></a>
##### `SemisimpleType(L): AlgLie -> MonStgElt`

<a id="function-semisimpletype-algmatlie"></a>
##### `SemisimpleType(L): AlgMatLie -> MonStgElt`

<a id="function-cartanname-alglie"></a>
##### `CartanName(L): AlgLie -> MonStgElt`

<a id="function-cartanname-algmatlie"></a>
##### `CartanName(L): AlgMatLie -> MonStgElt`

Let $L$ be a Lie algebra. If $L$ has a nondegenerate Killing form, then (over some algebraic extension of the ground field) $L$ is the direct sum of absolutely simple Lie algebras. These Lie algebras have been classified and the classes are named $A_n$, $B_n$, $C_n$, $D_n$, $E_6$, $E_7$, $E_8$, $F_4$, and $G_2$. This function returns a single string containing the types of the direct summands of $L$.

For a description of the algorithm used in the general case we refer to [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §5.17.1. For Lie algebras over fields of characteristic $2$ and $3$ the algorithm used is described in [[Roo10](https://docs.magma-maths.org/references.md#cite-roozemond2010)], Chapter 5.

<a id="example-ex-6372db"></a>
##### `Example: Semisimple Type of a Levi Subalgebra (ex-6372db)`

We compute the semisimple type of the Levi subalgebra of a subalgebra of the simple Lie algebra of type $D_7$.

```magma
> L := LieAlgebra("D7", RationalField());
> L;
Lie Algebra of dimension 91 with base ring Rational Field
> K := Centralizer(L, sub<L | [L.1,L.2,L.3,L.4]>);
> K;
Lie Algebra of dimension 46 with base ring Rational Field
> _,S := HasLeviSubalgebra(K);
> S;
Lie Algebra of dimension 15 with base ring Rational Field
> SemisimpleType(S);
A3
```

<a id="function-reductivetype-alglie"></a>
##### `ReductiveType(L): AlgLie -> RootDtm, MonStgElt, SeqEnum, SeqEnum`

<a id="function-reductivetype-alglie-alglie"></a>
##### `ReductiveType(L, H): AlgLie, AlgLie -> RootDtm, MonStgElt, SeqEnum, SeqEnum`

```magma
AssumeAlmostSimple: BoolElt                    Default: false
```

Let $L$ be a Lie algebra of a reductive algebraic group, and $H$ a split maximal toral subalgebra of $L$. This function identifies the isomorphism type of $L$.

This function has four return values. The first is the appropriate root datum and the second return value a textual description of $L$. The third return value is a sequence $Q$, containing a decomposition of $L$ into direct summands. Finally, the fourth return value is a sequence $P$ of records, such that $P[i]$ contains additional information (often a proof of correctness) of the identification of $Q[i]$.

If a split maximal toral subalgebra $H$ is not given, an attempt is made to compute one by calling [`SplitMaximalToralSubalgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-splitmaximaltoralsubalgebra) if the characteristic of the base field $k$ is at least $5$, or [`SplitToralSubalgebra`](https://docs.magma-maths.org/LieTheory/LieAlgebras/sub.md#function-splittoralsubalgebra) if char($k$) is $2$ or $3$. Note that, if $k$ is infinite, such a subalgebra cannot in general be computed so the second parameter $H$ must be supplied for this function to work.

If the optional parameter `AssumeAlmostSimple` is set to true, the (possibly time consuming) step of computing a direct sum decomposition of $L$ is skipped.

Moreover, note that if $L$ is the Lie algebra of a simple algebraic group but itself non-simple (such as for example A$_n$ of intermediate type in characteristic $n+1$), the third return value $Q$ may not be the direct sum decomposition of $L$ but simply [$L$].

<a id="example-ex-c3afbb"></a>
##### `Example: Reductive Type in Characteristic 2 (ex-c3afbb)`

We consider a particular Lie algebra of type A$_3$ over $k =$GF$(2)$.

```magma
> RA3 := RootDatum("A3" : Isogeny := 2);
> L := LieAlgebra(RA3, GF(2));
> D := DirectSumDecomposition(L);
> D;
[
    Lie Algebra of dimension 14 with base ring GF(2),
    Lie Algebra of dimension 1 with base ring GF(2)
]
> R, str, Q, _ := ReductiveType(L);
> R;
RA3: Root datum of dimension 3 of type A3
> str;
Lie algebra of type A3[ 2]
> Q;
[
    Lie Algebra of dimension 15 with base ring GF(2)
]
```

Note that this is an example where $Q$ is not the direct sum decomposition of $L$. Instead, $L$ in its whole is recognised as the Lie algebra of a simple algebraic group. In the remainder of the example, we investigate the 14-dimensional ideal of $L$.

```magma
> M := D[1]; M;
Lie Algebra of dimension 14 with base ring GF(2)
> R, _, _, P := ReductiveType(M);
> R;
R: Adjoint root datum of dimension 2 of type G2
```

So this computation claims that $L \simeq M \oplus k$, where $M$ is of type G$_2$. Let us use the additional return values to verify that fact.

```magma
> pos  := P[1]`ChevBasData`BasisPos;
> neg  := P[1]`ChevBasData`BasisNeg;
> cart := P[1]`ChevBasData`BasisCart;
> IsChevalleyBasis(M, RootDatum("G2"), pos, neg, cart);
true [ <1, 2, 0>, <1, 3, 0>, <1, 4, 0>, <2, 5, 0> ]
```

This demonstrates the fact that the Lie algebra of type G$_2$ is a constituent of the Lie algebra of type A$_3$ over fields of characteristic 2.

<a id="function-rootsystem-alglie"></a>
##### `RootSystem(L): AlgLie -> [ ModTupRngElt ], [ AlgLieElt ], [ ModTupRngElt ], AlgMatElt`

<a id="function-rootsystem-algmatlie"></a>
##### `RootSystem(L): AlgMatLie -> [ ModTupRngElt ], [ AlgMatLieElt ], [ ModTupRngElt ], AlgMatElt`

Given a semisimple Lie algebra $L$ with a split Cartan subalgebra, this function computes the root system of $L$. This function returns four values:

**(a)**
The roots of $L$ with respect to the Cartan subalgebra which is output by `CartanSubalgebra(L)`. This is a sequence of vectors where the positive roots come first, followed by the negative roots.

**(b)**
A sequence of elements of $L$ which are the root vectors corresponding to the roots of $L$ (so the first element corresponds to the first root and so on).

**(c)**
A sequence of simple roots.

**(d)**
The Cartan matrix of the root system with respect to the sequence of simple roots.

<a id="example-ex-cfabbc"></a>
##### `Example: Root System of G2 (ex-cfabbc)`

We compute the root system of the simple Lie algebra of type $G_2$ over the rational field.

```magma
> L := LieAlgebra("G2", RationalField());
> R, Rv, fund, C:=RootSystem(L);
> R;
[
    (1 0),
    (0 1),
    (1 1),
    (2 1),
    (3 1),
    (3 2),
    (-1  0),
    ( 0 -1),
    (-1 -1),
    (-2 -1),
    (-3 -1),
    (-3 -2)
]
> Rv;
[ (0 0 0 0 0 0 0 0 1 0 0 0 0 0), (0 0 0 0 0 0 0 0 0 1 0 0 0 0),
(0 0 0 0 0 0 0 0 0 0 1 0 0 0), (0 0 0 0 0 0 0 0 0 0 0 1 0 0),
(0 0 0 0 0 0 0 0 0 0 0 0 1 0), (0 0 0 0 0 0 0 0 0 0 0 0 0 1),
(0 0 0 0 0 1 0 0 0 0 0 0 0 0), (0 0 0 0 1 0 0 0 0 0 0 0 0 0),
(0 0 0 1 0 0 0 0 0 0 0 0 0 0), (0 0 1 0 0 0 0 0 0 0 0 0 0 0),
(0 1 0 0 0 0 0 0 0 0 0 0 0 0), (1 0 0 0 0 0 0 0 0 0 0 0 0 0) ]
```

<a id="function-rootdatum-alglie"></a>
##### `RootDatum(L): AlgLie -> RootDtm`

<a id="function-rootdatum-algmatlie"></a>
##### `RootDatum(L): AlgMatLie -> RootDtm`

Here $L$ is a semisimple Lie algebra. This function returns the root datum $D$ of $L$ with respect to the Cartan subalgebra which is output by `CartanSubalgebra(L)`. We note that the order of the positive roots in $D$ is not necessarily the same as the order in which they appear in the root system of $L$.

<a id="example-ex-afa536"></a>
##### `Example: Root Datum and Cartan Matrix (ex-afa536)`

We set up the root datum of a Lie algebra, and extract the Cartan matrix.

```magma
> L:= LieAlgebra("F4", Rationals());
> rd := RootDatum(L);
> rd;
Root datum of type F4
> CartanMatrix(rd);
[ 2  0 -1  0]
[ 0  2  0 -1]
[-1  0  2 -1]
[ 0 -1 -2  2]
```

<a id="function-chevalleybasis"></a>
##### `ChevalleyBasis(L): AlgLie -> [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`

<a id="function-chevalleybasis-alglie-alglie"></a>
##### `ChevalleyBasis(L, H): AlgLie, AlgLie -> [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`

<a id="function-chevalleybasis-algmatlie"></a>
##### `ChevalleyBasis(L): AlgMatLie -> [ AlgMatLieElt ], [ AlgMatLieElt ], [ AlgMatLieElt ]`

```magma
AssumeAlmostSimple: BoolElt                    Default: false
```

Given a semisimple Lie algebra $L$ with a split maximal toral subalgebra $H$, this function returns three sequences, $x$, $y$, and $h$ of elements of $L$. They form a Chevalley basis of $L$. The first sequence gives basis elements corresponding to positive roots, the second to the negative roots and the third to basis elements in a Cartan subalgebra. If a split maximal toral subalgebra $H$ is not given, an attempt is made to compute one.

For Lie algebras over fields of characteristic $2$ and $3$ the algorithm used is described in [[CR09](https://docs.magma-maths.org/references.md#cite-cohenroozemond2009)]. In particular, this involves computing a direct sum decomposition of $L$, which can be quite time consuming. If there is reason to believe that $L$ is (almost) simple, the optional parameter `AssumeAlmostSimple` should be set to `true`.

<a id="example-ex-fc1498"></a>
##### `Example: Chevalley Basis (ex-fc1498)`

We construct a Chevalley basis for two Lie algebras.

```magma
> L := LieAlgebra("A2", RationalField());
> x, y, h:= ChevalleyBasis(L);
> x; y; h;
[ (0 0 0 0 0 1 0 0), (0 0 0 0 0 0 1 0), (0 0 0 0 0 0 0 1) ]
[ (0 0 1 0 0 0 0 0), (0 1 0 0 0 0 0 0), (1 0 0 0 0 0 0 0) ]
[ (0 0 0 1 0 0 0 0), (0 0 0 0 1 0 0 0) ]
> L := LieAlgebra("A3", Rationals());
> print RootDatum(L) : Maximal;
Root datum of type A3 with simple roots
[ 1  0  1]
[ 1 -2  1]
[ 0  1 -2]
and simple coroots
[ 1  1  1]
[ 0 -1  0]
[ 0  0 -1]
```

<a id="function-chevalleybasis-alglie-alglie-rootdtm"></a>
##### `ChevalleyBasis(L, H, R): AlgLie, AlgLie, RootDtm -> [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ]`

Given a semisimple Lie algebra $L$ with a split maximal toral subalgebra $H$, and an irreducible root datum $R$, this function computes a Chevalley basis of $L$ with respect to $H$ and $R$. This basis is returned in the form of three sequences, $x$, $y$, and $h$ of elements of $L$, where the first sequence gives basis elements corresponding to positive roots, the second to the negative roots and the third to basis elements in the toral subalgebra $H$.

<a id="function-ischevalleybasis-alglie-rootdtm-alglieelt-alglieelt-alglieelt"></a>
##### `IsChevalleyBasis(L, R, x, y, h): AlgLie, RootDtm, [ AlgLieElt ], [ AlgLieElt ], [ AlgLieElt ] -> BoolElt, [ Tup ]`

Returns `true` if $x$, $y$, and $h$ form a Chevalley basis of the Lie algebra $L$ with respect to the root datum $R$. If so, return a sequence describing the extraspecial signs as second return value.

<a id="example-ex-f1d947"></a>
##### `Example: Chevalley Basis in Small Characteristic (ex-f1d947)`

We compute a Chevalley basis for a Lie algebra of type E$_6$ inside one of type E$_7$.

```magma
> R := RootDatum("E7");
> L1 := LieAlgebra(R, GF(2));
> p1,n1,c1 := StandardBasis(L1);
> L1;
Lie Algebra of dimension 133 with base ring GF(2)
> DynkinDiagram(R);

E7    1 - 3 - 4 - 5 - 6 - 7
              |
              2
> S, proj := sub<R | [1..6]>;
> S;
S: Root datum of dimension 7 of type E6
> #proj;
72
> projpos := [i : i in proj | i le NumPosRoots(R)];
> #projpos;
36
> L2 := sub<L1 | p1[projpos], n1[projpos]>;
> L2;
Lie Algebra of dimension 78 with base ring GF(2)
> H2 := L2 meet SplitMaximalToralSubalgebra(L1);
> H2;
Lie Algebra of dimension 6 with base ring GF(2)
> p2,n2,c2 := ChevalleyBasis(L2, H2, RootDatum("E6"));
> ok := IsChevalleyBasis(L2, RootDatum("E6"), p2, n2, c2);
> ok;
true
```

<a id="function-twistedbasis"></a>
##### `TwistedBasis(L, H, R): AlgLie, AlgLie, RootDtm -> AlgLie, AlgLie, Rec, AlgMatElt`

For a Lie algebra $L$, a split toral subalgebra $H$ of $L$, and a twisted root datum $R$, the function constructs a “twisted basis” of $L$.

Let $k$ be the coefficient ring of $L$ and $K$ an extension field of $k$ of degree equal to the twisting degree of $R$. This function has $4$ return values. First, $L' = L \otimes K$; second, a homomorphism $\phi$ from $L$ to $L'$, third, a record containing a Chevalley basis of $L'$ with respect to the untwisted root datum of $R$; fourth, a matrix describing the action of the Frobenius automorphism of $K$ on the positive roots of the Chevalley basis of $L'$.

Such a basis constitutes a proof that $L'$ is of type $R$. Consult [[Roo10](https://docs.magma-maths.org/references.md#cite-roozemond2010)], Chapter 5.3, for more details on such twisted bases.

<a id="example-ex-cf55bc"></a>
##### `Example: Twisted Basis of 2A2 (ex-cf55bc)`

We investigate a twisted basis of the Lie algebra of type ${}^2$A$_2$ over the field with $5$ elements. Let $\delta$ be the automorphism of the root system of type A$_2$, let $k =$GF($5$), and let $K =$GF($5^2$).

```magma
> R := TwistedRootDatum(RootDatum("A2") : Twist := 2);
> L := TwistedLieAlgebra(R, GF(5));
> H := SplitToralSubalgebra(L);
> LK, phi, ChevBas, m := TwistedBasis(L, H, R);
> m;
[     0      1]
[     1      0]
```

This matrix `m` shows that $\delta$ acts as expected on the Chevalley basis elements of `LK` $= L \otimes K$. We verify the correctness of `m`.

```magma
> K := CoefficientRing(LK);
> simp := ChevBas`BasisPos[[1..Rank(R)]];
> simp;
[ (     0      0      0      0      0      1  ksi^8      0),
  (     0      0      0      0      0      1 ksi^16      0) ]
> fr := FrobeniusMap(K);
> frv := func<x | Vector([ fr(i) : i in Eltseq(x)])>;
> [ Position(simp, frv(x)) : x in simp ];
[ 2, 1 ]
```

So indeed the Frobenius map (acting on the coordinates of LK) acts as $\delta$. This is equivalent [[Roo10](https://docs.magma-maths.org/references.md#cite-roozemond2010), Lemma 5.3] to the basis elements of L being stable under the composition of the Frobenius map (this time acting on the Chevalley basis of $L \otimes K$) and the root system automorphism $\delta$. We verify this assertion explicitly for this example.

```magma
> p := ChevBas`BasisPos;
> n := ChevBas`BasisNeg;
> c := ChevBas`BasisCart;
> pi := Sym(6)!(1, 2)(4, 5);
> ChevBasLK := VectorSpaceWithBasis([ Vector(x) : x in p cat n cat c]);
> piL := DiagramAutomorphism(LK, pi);
```

Now $\delta$ acts on $L \otimes K$ as `T`, and `fr` is still the Frobenius automorphism of the field $K$. The images of the basis elements of $L$ under `delta` composed with `fr` are as follows:

```magma
> for i in [1..Dimension(L)] do
>    b := phi(L.i);
>    printf "i = %o, b =    %o\n", i, Coordinates(ChevBasLK, Vector(b));
>    printf "   pi(b)^fr = %o\n", [ fr(i) : i in
>                              Coordinates(ChevBasLK, Vector(piL(b))) ];
> end for;
i = 1, b =    [ 0, 0, 0, 0, 0, ksi^9, 0, 0 ]
   (b*T)^fr = [ 0, 0, 0, 0, 0, ksi^9, 0, 0 ]
i = 2, b =    [ 0, 0, 0, ksi^5, ksi, 0, 0, 0 ]
   (b*T)^fr = [ 0, 0, 0, ksi^5, ksi, 0, 0, 0 ]
i = 3, b =    [ 0, 0, 0, ksi^9, ksi^21, 0, 0, 0 ]
   (b*T)^fr = [ 0, 0, 0, ksi^9, ksi^21, 0, 0, 0 ]
i = 4, b =    [ 0, 0, 0, 0, 0, 0, ksi^5, ksi ]
   (b*T)^fr = [ 0, 0, 0, 0, 0, 0, ksi^5, ksi ]
i = 5, b =    [ 0, 0, 0, 0, 0, 0, ksi, ksi^5 ]
   (b*T)^fr = [ 0, 0, 0, 0, 0, 0, ksi, ksi^5 ]
i = 6, b =    [ ksi, ksi^5, 0, 0, 0, 0, 0, 0 ]
   (b*T)^fr = [ ksi, ksi^5, 0, 0, 0, 0, 0, 0 ]
i = 7, b =    [ ksi^21, ksi^9, 0, 0, 0, 0, 0, 0 ]
   (b*T)^fr = [ ksi^21, ksi^9, 0, 0, 0, 0, 0, 0 ]
i = 8, b =    [ 0, 0, ksi^9, 0, 0, 0, 0, 0 ]
   (b*T)^fr = [ 0, 0, ksi^9, 0, 0, 0, 0, 0 ]
```

Thus, all the basis elements of $L$ are stable under the composition of the diagram automorphism $\delta$ and the Frobenius automorphism.

The `WeylGroup` functions are only available for structure constant Lie algebras.

<a id="function-weylgroup-alglie"></a>
##### `WeylGroup(L): AlgLie -> GrpPermCox`

<a id="function-weylgroup-cat-alglie"></a>
##### `WeylGroup(GrpPermCox, L): Cat, AlgLie -> GrpPermCox`

The Weyl group of the reductive Lie algebra $L$, as a permutation Coxeter group (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox)).

<a id="function-weylgroup-cat-alglie-2"></a>
##### `WeylGroup(GrpFPCox, L): Cat, AlgLie -> GrpPermCox`

The Weyl group of the reductive Lie algebra $L$, as a Coxeter group (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox)).

<a id="function-weylgroup-cat-alglie-3"></a>
##### `WeylGroup(GrpMat, L): Cat, AlgLie -> GrpPermCox`

The Weyl group of the reductive Lie algebra $L$, as a reflection group (see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox)).

<a id="sub"></a>
<a id="sectalgliesub"></a>
### Operations on Subalgebras and Ideals

<a id="function-directsum-alglie-alglie"></a>
#### `DirectSum(L, M): AlgLie, AlgLie -> AlgLie`

<a id="function-directsum-algmatlie-algmatlie"></a>
#### `DirectSum(L, M): AlgMatLie, AlgMatLie -> AlgMatLie`

Given Lie algebras $L$ and $M$, this intrinsic constructs a Lie algebra of dimension $n+m$, where $n$ and $m$ are the dimensions of $L$ and $M$, respectively. The basis of the new algebra is the concatenation of the bases of $L$ and $M$ and the products $a * b$ where $a \in L$ and $b \in M$ are defined to be zero.

<a id="function-indecomposablesummands-alglie"></a>
#### `IndecomposableSummands(L): AlgLie -> [ AlgLie ]`

<a id="function-indecomposablesummands-algmatlie"></a>
#### `IndecomposableSummands(L): AlgMatLie -> [ AlgMatLie ]`

<a id="function-directsumdecomposition-alglie"></a>
#### `DirectSumDecomposition(L): AlgLie -> [ AlgLie ]`

<a id="function-directsumdecomposition-algmatlie"></a>
#### `DirectSumDecomposition(L): AlgMatLie -> [ AlgMatLie ]`

Given a Lie algebra $L$, the function returns the direct sum decomposition of $L$ as a sequence of ideals of $L$ whose sum is $L$ and each of which cannot be further decomposed into a direct sum of ideals.

The algorithms used for this function are described in [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §4.12 (semisimple case), §1.15 (general case).

<a id="example-ex-45b01f"></a>
#### `Example: Direct Sum Decomposition (ex-45b01f)`

We compute the direct sum decomposition of the simple Lie algebra of type $D_2$ over the rational field.

```magma
> L := LieAlgebra("D2", RationalField());
> L;
Lie Algebra of dimension 6 with base ring Rational Field
> D := DirectSumDecomposition(L);
> D;
[
    Lie Algebra of dimension 3 with base ring Rational Field,
    Lie Algebra of dimension 3 with base ring Rational Field
]
> Morphism(D[1], L);
[ 0  1  0  0  0  0]
[ 0  0  1 -1  0  0]
[ 0  0  0  0  1  0]
> Morphism(D[2], L);
[1 0 0 0 0 0]
[0 0 1 1 0 0]
[0 0 0 0 0 1]
```

<a id="sub-std"></a>
<a id="subsectalgliesubstd"></a>
#### Standard Ideals and Subalgebras

<a id="function-centre-alglie"></a>
##### `Centre(L): AlgLie -> AlgLie`

<a id="function-centre-algmatlie"></a>
##### `Centre(L): AlgMatLie -> AlgMatLie`

<a id="function-center-alglie"></a>
##### `Center(L): AlgLie -> AlgLie`

<a id="function-center-algmatlie"></a>
##### `Center(L): AlgMatLie -> AlgMatLie`

Given a Lie algebra $L$, returns the centre of $L$.

<a id="function-centraliser-alglie-alglie"></a>
##### `Centraliser(L, K): AlgLie, AlgLie -> AlgLie, Map`

<a id="function-centraliser-algmatlie-algmatlie"></a>
##### `Centraliser(L, K): AlgMatLie, AlgMatLie -> AlgMatLie, Map`

<a id="function-centralizer-alglie-alglie"></a>
##### `Centralizer(L, K): AlgLie, AlgLie -> AlgLie, Map`

<a id="function-centralizer-algmatlie-algmatlie"></a>
##### `Centralizer(L, K): AlgMatLie, AlgMatLie -> AlgMatLie, Map`

Given a Lie algebra $L$ and a subalgebra $K$ of $L$, returns the centraliser of $K$ in $L$, and its injection into $L$.

<a id="function-centraliser-alglie-alglieelt"></a>
##### `Centraliser(L, x): AlgLie, AlgLieElt -> AlgLie, Map`

<a id="function-centraliser-algmatlie-algmatlieelt"></a>
##### `Centraliser(L, x): AlgMatLie, AlgMatLieElt -> AlgMatLie, Map`

<a id="function-centralizer-alglie-alglieelt"></a>
##### `Centralizer(L, x): AlgLie, AlgLieElt -> AlgLie, Map`

<a id="function-centralizer-algmatlie-algmatlieelt"></a>
##### `Centralizer(L, x): AlgMatLie, AlgMatLieElt -> AlgMatLie, Map`

Given a Lie algebra $L$ and an element $x$ of $L$, returns the centraliser of $x$ in $L$, and its injection into $L$.

<a id="function-normaliser-alglie-alglie"></a>
##### `Normaliser(L, K): AlgLie, AlgLie -> AlgLie`

<a id="function-normaliser-algmatlie-algmatlie"></a>
##### `Normaliser(L, K): AlgMatLie, AlgMatLie -> AlgMatLie`

<a id="function-normalizer-alglie-alglie"></a>
##### `Normalizer(L, K): AlgLie, AlgLie -> AlgLie`

<a id="function-normalizer-algmatlie-algmatlie"></a>
##### `Normalizer(L, K): AlgMatLie, AlgMatLie -> AlgMatLie`

Given a Lie algebra $L$ and a subalgebra $K$ of $L$, returns the normaliser of $K$ in $L$, and its injection into $L$.

<a id="function-solubleradical-alglie"></a>
##### `SolubleRadical(L): AlgLie -> AlgLie`

<a id="function-solubleradical-algmatlie"></a>
##### `SolubleRadical(L): AlgMatLie -> AlgMatLie`

<a id="function-solvableradical-alglie"></a>
##### `SolvableRadical(L): AlgLie -> AlgLie`

<a id="function-solvableradical-algmatlie"></a>
##### `SolvableRadical(L): AlgMatLie -> AlgMatLie`

Given a Lie algebra $L$, returns the soluble radical of $L$.

We refer to [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §2.6 for the algorithm used to implement this function.

<a id="function-nilradical-alglie"></a>
##### `Nilradical(L): AlgLie -> AlgLie`

<a id="function-nilradical-algmatlie"></a>
##### `Nilradical(L): AlgMatLie -> AlgMatLie`

Given a Lie algebra $L$, returns the nilradical of $L$.

The algorithm makes use of Cartan subalgebras. We refer to [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], pp. 84, 85 for its description.

<a id="example-ex-d2d791"></a>
##### `Example: Centre, Normaliser, and Other Operations (ex-d2d791)`

We demonstrate the functions for performing basic operations with Lie algebras such as centre, normalizer etc.

```magma
> L := LieAlgebra("D4", RationalField());
> L;
Lie Algebra of dimension 28 with base ring Rational Field
> Centre(L);
Lie Algebra of dimension 0 with base ring Rational Field
> K := sub< L | [L.1, L.2, L.3] >;
> Centralizer(L, K);
Lie Algebra of dimension 10 with base ring Rational Field
> Normalizer(L, K);
Lie Algebra of dimension 19 with base ring Rational Field
> M := Centralizer(L, K);
> S := SolvableRadical(M);
> S;
Lie Algebra of dimension 10 with base ring Rational Field
> Morphism(S, L);
[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 1 0 0 0 0 -1 0 0 0 -1 0 0 -1 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
> Nilradical(M);
Lie Algebra of dimension 9 with base ring Rational Field
```

<a id="sub-cartan-toral"></a>
<a id="subsectalgliecartantoral"></a>
#### Cartan and Toral Subalgebras

<a id="function-cartansubalgebra-alglie"></a>
##### `CartanSubalgebra(L): AlgLie -> AlgLie`

<a id="function-cartansubalgebra-algmatlie"></a>
##### `CartanSubalgebra(L): AlgMatLie -> AlgMatLie`

Given a Lie algebra $L$, this function returns a Cartan subalgebra of $L$. The algorithm works for Lie algebras $L$ defined over a field $F$ such that $|F| > \dim L$ and for restricted Lie algebras of characteristic $p$. If the Lie algebra does not fit into one of these classes then the correctness of the output is not guaranteed.

The algorithm used is described in [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §3.2.

<a id="function-iscartansubalgebra-alglie-alglie"></a>
##### `IsCartanSubalgebra(L, H): AlgLie, AlgLie -> BoolElt`

<a id="function-iscartansubalgebra-algmatlie-algmatlie"></a>
##### `IsCartanSubalgebra(L, H): AlgMatLie, AlgMatLie -> BoolElt`

The intrinsic returns `true` if $H$ is a Cartan subalgebra of $L$, i.e., whether $H$ is nilpotent and $N_L(H) = 0$.

<a id="example-ex-675c63"></a>
##### `Example: Cartan Subalgebra (ex-675c63)`

We compute a Cartan subalgebra of the simple Lie algebra of type $A_4$ over the rational field.

```magma
> L := LieAlgebra("F4", RationalField());
> L;
Lie Algebra of dimension 52 with base ring Rational Field
> H := CartanSubalgebra(L);
Lie Algebra of dimension 4 with base ring Rational Field
> H*H;
Lie Algebra of dimension 0 with base ring Rational Field
> Normalizer(L, H);
Lie Algebra of dimension 4 with base ring Rational Field
```

<a id="function-splittingcartansubalgebra-alglie"></a>
##### `SplittingCartanSubalgebra(L): AlgLie -> AlgLie`

<a id="function-splitmaximaltoralsubalgebra"></a>
##### `SplitMaximalToralSubalgebra(L): AlgLie -> AlgLie`

Given a Lie algebra $L$ over a field $k$ of characteristic at least $5$, a split Cartan subalgebra (equivalently, a split maximal toral subalgebra) is computed for $L$.

The algorithm used is discussed in [[CM09](https://docs.magma-maths.org/references.md#cite-cohenmurray2009)], Sections 5 and 6. This algorithm is proved to work ([[CM09](https://docs.magma-maths.org/references.md#cite-cohenmurray2009), Theorem 6.7]) if $L$ is the Lie algebra of a $k$-split connected reductive group. In other cases, should the algorithm terminate, the output is guaranteed to be correct.

<a id="function-issplittingcartansubalgebra-alglie-alglie"></a>
##### `IsSplittingCartanSubalgebra(L, H): AlgLie, AlgLie -> BoolElt`

<a id="function-issplittingcartansubalgebra-algmatlie-algmatlie"></a>
##### `IsSplittingCartanSubalgebra(L, H): AlgMatLie, AlgMatLie -> BoolElt`

Determine whether $H$ is a splitting Cartan subalgebra of $L$, i.e., whether $H$ is a Cartan subalgebra and the adjoint action of $H$ on $L$ splits completely over the coefficient ring of $L$.

<a id="function-splittoralsubalgebra"></a>
##### `SplitToralSubalgebra(L): AlgLie -> AlgLie`

```magma
TryMaximal: .                    Default: true
```

The intrinsic attempts to compute a split toral subalgebra of a Lie algebra $L$ defined over a finite field $k$. This procedure uses a heuristic algorithm, described in [[Roo10](https://docs.magma-maths.org/references.md#cite-roozemond2010), Chapter 3], that works in many cases even if the characteristic of $k$ is small. Moreover, it attempts to compute a split toral subalgebra of maximal size.

If the function returns without error, the resulting subalgebra $H$ is a split toral subalgebra that does not lie inside a split toral subalgebra $H'$ of larger dimension. It is, however, not guaranteed that $H$ is of maximal dimension among all split toral subalgebras.

The optional parameter `TryMaximal` may be used as follows. If set to `true` (the default) the reductive rank $r$ of $L$ is computed first, and the algorithm attempts to compute a split toral subalgebra of dimension $r$. If set to `false`, the first split toral subalgebra found is returned. Finally, if `TryMaximal` is set to an integer $n \geq 1$, the algorithm attempts to find a split toral subalgebra of dimension $n$. In the latter case, if no split toral subalgebra of dimension $n$ can be found, the biggest that has been found is returned; if on the other hand a split toral subalgebra of dimension *larger* than $n$ is encountered, that is returned.

<a id="function-issplittoralsubalgebra-alglie-alglie"></a>
##### `IsSplitToralSubalgebra(L, H): AlgLie, AlgLie -> BoolElt`

Given a restrictable Lie algebra $L$ over a finite field, the function returns `true` is $H$ is a split toral subalgebra of $L$, i.e., whether $[H,H] = 0$, all elements of $H$ are semisimple, and the basis elements are invariant under the $q$-map associated to $L$.

<a id="example-ex-3f1c22"></a>
##### `Example: Split Toral Subalgebra (ex-3f1c22)`

We construct a twisted Lie algebra $L$ of type ${}^3$D$_4$ over the field $k =$GF$(3^3)$ and verify that the subalgebra $H$ returned by `SplitToralSubalgebra` is indeed a split toral subalgebra. Then, we test whether $C = C_L(H)$ is a (split) toral subalgebra of $L$.

```magma
> k := GF(3, 3);
> L, phi := TwistedLieAlgebra(TwistedRootDatum("D4" : Twist := 3), k);
> H := SplitToralSubalgebra(L);
> H;
Lie Algebra of dimension 2 with base ring GF(3^3)
> IsSplitToralSubalgebra(L, H);
true
> C := Centraliser(L,H); C;
Lie Algebra of dimension 4 with base ring GF(3^3)
> IsToralSubalgebra(L,C), IsSplitToralSubalgebra(L, C);
true false
```

Now we let $K$ be the big field, GF$(3^9)$, and test if $C \otimes K$ is a split toral subalgebra of $L \otimes K$.

```magma
> LK := Codomain(phi);
> LK;
Lie Algebra of dimension 28 with base ring GF(3^9)
> CK := sub<LK | [ phi(b) : b in Basis(C) ]>;
> IsSplitToralSubalgebra(LK, CK);
true
```

<a id="sub-series"></a>
<a id="subsectalglieseries"></a>
#### Standard Series

<a id="function-compositionseries-alglie"></a>
##### `CompositionSeries(L): AlgLie -> [ Alg ], [ AlgLie ], AlgMatElt`

A composition series is computed for the (structure constant) Lie algebra $L$. The function returns three values:

**(a)**
a sequence containing the composition series as an ascending chain of subalgebras such that the successive quotients are irreducible $L$-modules;

**(b)**
a sequence containing the composition factors as structure constant algebras;

**(c)**
a transformation matrix to a basis compatible with the composition series, that is, the first basis elements form a basis of the first term of the composition series, the next extend these to a basis for the second term etc.

<a id="function-compositionfactors-alglie"></a>
##### `CompositionFactors(L): AlgLie -> [ AlgLie ]`

Compute the composition factors of a composition series for the Lie algebra $L$. This function returns the same as the second return value of `CompositionSeries` above, but will often be very much quicker.

<a id="function-minimalideals-alglie"></a>
##### `MinimalIdeals(L : parameters): AlgLie -> [ AlgLie ], BoolElt`

```magma
Limit: RngIntElt                    Default: Infinity()
```

Returns the minimal left/right/two-sided ideals of the (structure constant) Lie algebra $L$ (in non-decreasing size). If `Limit` is set to $n$, at most $n$ ideals are calculated and the second return value indicates whether all of the ideals were computed.

<a id="function-maximalideals-alglie"></a>
##### `MaximalIdeals(L : parameters): AlgLie -> [ AlgLie ], BoolElt`

```magma
Limit: RngIntElt                    Default: Infinity()
```

Returns the maximal left/right/two-sided ideals of the (structure constant) Lie algebra $L$ (in non-decreasing size). If `Limit` is set to $n$, at most $n$ ideals are calculated and the second return value indicates whether all of the ideals were computed.

<a id="function-derivedseries-alglie"></a>
##### `DerivedSeries(L): AlgLie -> [ AlgLie ]`

<a id="function-derivedseries-algmatlie"></a>
##### `DerivedSeries(L): AlgMatLie -> [ AlgMatLie ]`

Given a Lie algebra $L$, this function returns a sequence of ideals of $L$ that form its derived series.

<a id="function-lowercentralseries-alglie"></a>
##### `LowerCentralSeries(L): AlgLie -> [ AlgLie ]`

<a id="function-lowercentralseries-algmatlie"></a>
##### `LowerCentralSeries(L): AlgMatLie -> [ AlgMatLie ]`

Given a Lie algebra $L$, this function returns a sequence of ideals of $L$ that form its lower central series.

<a id="function-uppercentralseries-alglie"></a>
##### `UpperCentralSeries(L): AlgLie -> [ AlgLie ]`

<a id="function-uppercentralseries-algmatlie"></a>
##### `UpperCentralSeries(L): AlgMatLie -> [ AlgMatLie ]`

Given a Lie algebra $L$, this function returns a sequence of ideals of $L$ that form the upper central series of $L$. The function repeatedly uses the algorithm for computing centres while keeping track of the pre-images of the ideals factored out.

<a id="example-ex-9cb576"></a>
##### `Example: Series of a Subalgebra (ex-9cb576)`

We compute each of the type of series of a particular subalgebra of the simple Lie algebra of type $F_4$ over the rational field.

```magma
> L:=LieAlgebra("F4", RationalField());
> L;
Lie Algebra of dimension 52 with base ring Rational Field
> K:=sub< L | [L.1, L.12, L.23, L.34, L.45] >;
> DerivedSeries(K);
[
    Lie Algebra of dimension 20 with base ring Rational Field,
    Lie Algebra of dimension 16 with base ring Rational Field,
    Lie Algebra of dimension 7 with base ring Rational Field,
    Lie Algebra of dimension 0 with base ring Rational Field
]
> LowerCentralSeries(K);
[
    Lie Algebra of dimension 20 with base ring Rational Field,
    Lie Algebra of dimension 16 with base ring Rational Field,
    Lie Algebra of dimension 12 with base ring Rational Field,
    Lie Algebra of dimension 8 with base ring Rational Field,
    Lie Algebra of dimension 5 with base ring Rational Field,
    Lie Algebra of dimension 2 with base ring Rational Field,
    Lie Algebra of dimension 1 with base ring Rational Field,
    Lie Algebra of dimension 0 with base ring Rational Field
]
> UpperCentralSeries(K);
[
    Lie Algebra of dimension 2 with base ring Rational Field,
    Lie Algebra of dimension 3 with base ring Rational Field,
    Lie Algebra of dimension 5 with base ring Rational Field,
    Lie Algebra of dimension 8 with base ring Rational Field,
    Lie Algebra of dimension 12 with base ring Rational Field,
    Lie Algebra of dimension 16 with base ring Rational Field,
    Lie Algebra of dimension 20 with base ring Rational Field
]
```

<a id="derlie"></a>
<a id="sectalgliederivations"></a>
#### The Lie Algebra of Derivations

<a id="function-liealgebraofderivations-alglie"></a>
##### `LieAlgebraOfDerivations(L): AlgLie -> AlgLie, Rec`

Given a Lie algebra $L$, this function constructs its Lie algebra of derivations $\operatorname{Der}(L)$. As second return value, a record containing maps from $L$ to $\operatorname{Der}(L)$ and vice versa, and from $\operatorname{Der}(L)$ to the matrix Lie algebra acting on $L$ is returned.

<a id="example-ex-d37e8c"></a>
##### `Example: Lie Algebra of Derivations (ex-d37e8c)`

We consider the Lie algebra of derivations of D$_4$ in characteristic $2$ or, more precisely, the $26$-dimensional simple constituent $L$ that exists in all varieties of D$_4$ in characteristic $2$.

```magma
> SetSeed(1);
> R := RootDatum("D4");
> D4 := LieAlgebra(R, GF(2));
> pos,neg,cart := StandardBasis(D4);
> L := D4*D4; L;
Lie Algebra of dimension 26 with base ring GF(2)
> IsSimple(L);
true
> DerL, maps := LieAlgebraOfDerivations(L);
> DerL;
Lie Algebra of dimension 52 with base ring GF(2)
> SemisimpleType(DerL);
F4
```

So the Lie algebra of derivations is of type F$_4$. Let us consider one of the maps that was returned as second value.

```magma
> maps;
rec<recformat<mp_DerL_to_L: Map, mp_L_to_DerL: Map, mp_DerL_to_mats:
Map, mp_mats_to_DerL: Map> |
    mp_DerL_to_L := Mapping from: AlgLie: DerL to AlgLie: L given by a
        rule [no inverse],
    mp_L_to_DerL := Mapping from: AlgLie: L to AlgLie: DerL given by a
        rule [no inverse],
    mp_DerL_to_mats := Mapping from: AlgLie: DerL to Matrix Lie
        Algebra given by a rule [no inverse],
    mp_mats_to_DerL := Mapping from: Matrix Lie Algebra to AlgLie:
        DerL given by a rule [no inverse]>
> adL := AdjointRepresentation(L);
> f := maps`mp_DerL_to_mats;
> [ f(b) in Image(adL) : b in Basis(DerL) ];
[ false, true, true, true, true, true, true, true, false, false, true,
false, true, false, false, false, true, false, true, true, true,
false, false, false, true, true, false, false, false, true, true,
false, false, false, true, true, false, false, true, false, true,
false, true, false, false, false, true, false, true, false, false,
false ]
```

So, unsurprisingly, some of the basis elements of $\operatorname{Der}(L)$ are actually elements from $L$, but others are not. We consider one more of these maps and investigate how $L$ lies in $\operatorname{Der}(L)$.

```magma
> g := maps`mp_L_to_DerL;
> I := ideal<DerL | [ g(b) : b in Basis(L) ]>; I;
Lie Algebra of dimension 26 with base ring GF(2)
> pos2, neg2, cart2 := ChevalleyBasis(DerL, SplitToralSubalgebra(DerL));
> [i : i in [1..#pos2] | pos2[i] in I ];
[ 3, 4, 6, 7, 8, 10, 12, 13, 15, 17, 19, 21 ]
> RF4 := RootDatum("F4");
> [ i : i in [1..NumPosRoots(RF4)] | IsShortRoot(RF4, i) ];
[ 3, 4, 6, 7, 8, 10, 12, 13, 15, 17, 19, 21 ]
```

So we conclude that the original Lie algebra $L$ of type D$_4$ exists as the short roots of the Lie algebra of derivations $\operatorname{Der}(L)$ of type F$_4$.

<a id="property"></a>
<a id="sectalglieprop"></a>
### Properties of Lie Algebras and Ideals

<a id="function-killingform-alglie"></a>
#### `KillingForm(L): AlgLie -> ModMatFldElt`

<a id="function-killingform-algmatlie"></a>
#### `KillingForm(L): AlgMatLie -> ModMatFldElt`

<a id="function-killingmatrix-alglie"></a>
#### `KillingMatrix(L): AlgLie -> ModMatFldElt`

<a id="function-killingmatrix-algmatlie"></a>
#### `KillingMatrix(L): AlgMatLie -> ModMatFldElt`

Given a Lie algebra $L$ such that $\{x_1,\ldots ,x_n\}$ is a basis of $L$, return the Killing matrix of $L$, which is defined to be the matrix $({\rm Tr} ({\rm ad}x_i\cdot {\rm ad} x_j))$.

<a id="example-ex-53bd1a"></a>
#### `Example: Killing Matrix of a Lie Algebra (ex-53bd1a)`

```magma
> L:=LieAlgebra("B2",RationalField());
> KillingMatrix(L);
[ 0  0  0  0  0  0  0  0  0  6]
[ 0  0  0  0  0  0  0  0 12  0]
[ 0  0  0  0  0  0  0 12  0  0]
[ 0  0  0  0  0  0  6  0  0  0]
[ 0  0  0  0  6  6  0  0  0  0]
[ 0  0  0  0  6 12  0  0  0  0]
[ 0  0  0  6  0  0  0  0  0  0]
[ 0  0 12  0  0  0  0  0  0  0]
[ 0 12  0  0  0  0  0  0  0  0]
[ 6  0  0  0  0  0  0  0  0  0]
```

<a id="function-isabelian-alglie"></a>
#### `IsAbelian(L): AlgLie -> BoolElt`

<a id="function-isabelian-algmatlie"></a>
#### `IsAbelian(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is abelian.

<a id="function-issoluble-alglie"></a>
#### `IsSoluble(L): AlgLie -> BoolElt`

<a id="function-issoluble-algmatlie"></a>
#### `IsSoluble(L): AlgMatLie -> BoolElt`

<a id="function-issolvable-alglie"></a>
#### `IsSolvable(L): AlgLie -> BoolElt`

<a id="function-issolvable-algmatlie"></a>
#### `IsSolvable(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is soluble.

<a id="function-isnilpotent-alglie"></a>
#### `IsNilpotent(L): AlgLie -> BoolElt`

<a id="function-isnilpotent-algmatlie"></a>
#### `IsNilpotent(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is nilpotent.

<a id="function-iscentral-alglie-alglie"></a>
#### `IsCentral(L, M): AlgLie, AlgLie -> BoolElt`

<a id="function-iscentral-algmatlie-algmatlie"></a>
#### `IsCentral(L, M): AlgMatLie, AlgMatLie -> BoolElt`

Given a subalgebra $M$ of the Lie algebra $L$, return `true` if $M$ is central in $L$.

<a id="function-issimple-alglie"></a>
#### `IsSimple(L): AlgLie -> BoolElt`

<a id="function-issimple-algmatlie"></a>
#### `IsSimple(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is simple.

<a id="function-issemisimple-alglie"></a>
#### `IsSemisimple(L): AlgLie -> BoolElt`

<a id="function-issemisimple-algmatlie"></a>
#### `IsSemisimple(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is semisimple.

<a id="function-isreductive-alglie"></a>
#### `IsReductive(L): AlgLie -> BoolElt`

<a id="function-isreductive-algmatlie"></a>
#### `IsReductive(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, return `true` if $L$ is reductive.

<a id="function-haslevisubalgebra-alglie"></a>
#### `HasLeviSubalgebra(L): AlgLie -> BoolElt`

<a id="function-haslevisubalgebra-algmatlie"></a>
#### `HasLeviSubalgebra(L): AlgMatLie -> BoolElt`

Given a Lie algebra $L$, this function determines whether $L$ has a Levi subalgebra. If the result is `true`, then the function also returns a semisimple subalgebra (complement to the solvable radical) of $L$. If $L$ is defined over a field of characteristic 0, then it always has a Levi subalgebra. However, if $L$ is a Lie algebra of characteristic $p>0$ then $L$ need not have a Levi subalgebra but the function will always find one if it exists.

A description of the algorithm used is contained in [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §4.13.

<a id="function-isclassicaltype-alglie"></a>
#### `IsClassicalType(L): AlgLie -> BoolElt`

Determines if the reductive Lie algebra $L$ is of classical-type. Note that all reductive Lie algebras over fields of characteristic 0 are considered to be classical-type.

<a id="example-ex-6ba33a"></a>
#### `Example: Predicates on a Simple Lie Algebra (ex-6ba33a)`

We test various predicates in the context of the simple Lie algebra of type $D_3$ over the rational field.

```magma
> L:=LieAlgebra("D3",RationalField());
> L;
Lie Algebra of dimension 15 with base ring Rational Field
> K:=sub< L | [L.1,L.2,L.3] >;
> M:=Centralizer(L, K);
> M;
Lie Algebra of dimension 4 with base ring Rational Field
> R:=SolvableRadical(M);
> R;
Lie Algebra of dimension 4 with base ring Rational Field
> HasLeviSubalgebra(M);
true Lie Algebra of dimension 0 with base ring Rational Field
> K:=Centralizer(L, sub< L | [L.1,L.2,L.3] >);
> K;
Lie Algebra of dimension 4 with base ring Rational Field
> IsSolvable(K);
true
> IsNilpotent(K);
true
> R:= SolvableRadical(K);
> IsSolvable(R);
true
> IsNilpotent(R);
true
> N:= Nilradical(K);
> IsNilpotent(N);
true
```

<a id="elements-2"></a>
<a id="sectalglieelt"></a>
### Operations on Elements

<a id="operation-op-plus-alglieelt-alglieelt"></a>
#### `x + y: AlgLieElt, AlgLieElt -> AlgLieElt`

<a id="operation-op-plus-algmatlieelt-algmatlieelt"></a>
#### `x + y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

<a id="operation-op-minus-alglieelt-alglieelt"></a>
#### `x - y: AlgLieElt, AlgLieElt -> AlgLieElt`

<a id="operation-op-minus-algmatlieelt-algmatlieelt"></a>
#### `x - y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

<a id="operation-op-times-alglieelt-alglieelt"></a>
#### `x * y: AlgLieElt, AlgLieElt -> AlgLieElt`

<a id="operation-op-times-algmatlieelt-algmatlieelt"></a>
#### `x * y: AlgMatLieElt, AlgMatLieElt -> AlgMatLieElt`

<a id="function-iscentral-alglie-alglieelt"></a>
#### `IsCentral(L, M): AlgLie, AlgLieElt -> BoolElt`

<a id="function-iscentral-algmatlie-algmatlieelt"></a>
#### `IsCentral(L, M): AlgMatLie, AlgMatLieElt -> BoolElt`

Given an element $x$ of the Lie algebra $L$, return `true` if $x$ is central in $L$.

<a id="function-nonnilpotentelement-alglie"></a>
#### `NonNilpotentElement(L): AlgLie -> AlgLieElt`

Given a (structure constant) Lie algebra $L$, this function returns an element of $L$ that is *not* nilpotent, or the zero element of $L$ if no such element exists.

The algorithm follows [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], §2.7.

<a id="example-ex-a38e8a"></a>
#### `Example: Non-Nilpotent Element (ex-a38e8a)`

We construct a non-nilpotent element of a Lie algebra.

```magma
> L:=LieAlgebra("G2",RationalField());
> NonNilpotentElement(L);
(0 0 0 0 0 1 0 0 0 0 0 0 0 0)
```

<a id="function-adjointmatrix-alglie-alglieelt"></a>
#### `AdjointMatrix(L, x): AlgLie, AlgLieElt -> AlgMatLieElt`

<a id="function-rightadjointmatrix-alglie-alglieelt"></a>
#### `RightAdjointMatrix(L, x): AlgLie, AlgLieElt -> AlgMatLieElt`

Given a (structure constant) Lie algebra $L$ and an element $x$ of a subalgebra or ideal of $L$, return the matrix of ${\rm ad} x$ as an element of a matrix Lie algebra.

<a id="example-ex-c4c36f"></a>
#### `Example: Adjoint Matrix of an Element (ex-c4c36f)`

```magma
> L:=LieAlgebra("B2",RationalField());
> AdjointMatrix(L, L.1);
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 1  0  0  0  0  0  0  0  0  0]
[ 2  0  0  0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0  0  0  0]
[ 0 -1  0  0  0  0  0  0  0  0]
[ 0  0  1  0  0  0  0  0  0  0]
[ 0  0  0  0  0 -1  0  0  0  0]
```

<a id="index-elt-oper"></a>
<a id="subsectalglieeltindex"></a>
#### Indexing

<a id="indexed-indexed-a-alglieelt-rngintelt-rngelt"></a>
##### `a[i]: AlgLieElt, RngIntElt -> RngElt`

<a id="literal-literal-a-i-algmatlieelt-rngintelt-modtuprngelt"></a>
##### `a[i]: AlgMatLieElt, RngIntElt -> ModTupRngElt`

If $a$ is an element of a structure constant Lie algebra $L$ of dimension $n$ and $1 \leq i\leq n$ is a positive integer, then the $i$-th component of the element $a$ is returned (as an element of the base ring $R$ of $L$).

If $a$ is an element of a matrix Lie algebra $L$ of degree $n$ and $1 \leq i \leq n$ then the $i$th row of the matrix $a$ is returned.

<a id="literal-literal-a-i-r-alglieelt-rngintelt-rngelt-alglieelt"></a>
##### `a[i] := r: AlgLieElt, RngIntElt, RngElt -> AlgLieElt`

<a id="literal-literal-a-i-r-algmatlieelt-rngintelt-modtuprngelt-algmatlieelt"></a>
##### `a[i] := r: AlgMatLieElt, RngIntElt, ModTupRngElt -> AlgMatLieElt`

Given an element $a$ belonging to a structure constant Lie algebra of dimension $n$ over $R$, a positive integer $1 \leq i\leq n$, and an element $r \in R$, the $i$-th component of the element $a$ is redefined to be $r$.

If $a$ is an element of a matrix Lie algebra $L$ of degree $n$ over $R$ and $1 \leq i \leq n$, the $i$th row of the matrix $a$ is redefined to be the vector $r$ over $R$.

<a id="indexed-indexed-a-algmatlieelt-rngintelt-rngintelt-rngelt"></a>
##### `a[i, j]: AlgMatLieElt, RngIntElt, RngIntElt -> RngElt`

<a id="literal-literal-a-i-j-r-algmatlieelt-rngintelt-rngintelt-rngelt-algmatlieelt"></a>
##### `a[i, j] := r: AlgMatLieElt, RngIntElt, RngIntElt, RngElt -> AlgMatLieElt`

For an element $a$ of a matrix Lie algebra $L$ of degree $n$ and integers $1 \leq i, j \leq n$ return the element in the $i$th row and $j$th column of $a$ or set this element to be $r$ where $r$ is an element of the coefficient ring of $L$.

<a id="natural-module"></a>
<a id="sectalgliemodule"></a>
### The Natural Module

<a id="function-module-alglie"></a>
#### `Module(L): AlgLie -> ModTupRng`

The module $R^n$ underlying the Lie algebra $L$.

<a id="function-rmodule-algmatlie"></a>
#### `RModule(L): AlgMatLie -> ModTupRng`

The module $R^n$ acted on by the matrix Lie algebra $L$.

<a id="function-basemodule-algmatlie"></a>
#### `BaseModule(L): AlgMatLie -> ModTupRng`

The space $R^n$ acted on by the matrix Lie algebra $L$.

<a id="function-degree-alglie"></a>
#### `Degree(L): AlgLie -> RngIntElt`

<a id="function-degree-algmatlie"></a>
#### `Degree(L): AlgMatLie -> RngIntElt`

The degree of the Lie algebra $L$. If $L$ is a structure constant algebra, this is just the dimension of $L$. If $L$ is a matrix Lie algebra, this is the degree of the matrices in $L$.

<a id="function-degree-alglieelt"></a>
#### `Degree(a): AlgLieElt -> RngIntElt`

Given an element $a$ belonging to the Lie algebra $L$, the dimension of $L$ is returned.

<a id="function-elementtosequence-alglieelt"></a>
#### `ElementToSequence(a): AlgLieElt -> SeqEnum`

<a id="function-eltseq-alglieelt"></a>
#### `Eltseq(a): AlgLieElt -> SeqEnum`

The sequence of coefficients of the Lie element $a$.

<a id="function-coordinates-alglie-alglieelt"></a>
#### `Coordinates(M, a): AlgLie, AlgLieElt -> SeqEnum`

<a id="function-coordinates-algmatlie-algmatlieelt"></a>
#### `Coordinates(M, a): AlgMatLie, AlgMatLieElt -> SeqEnum`

Let $a$ be an element of a Lie algebra $L$ and let $M$ be a subalgebra of $L$ containing $a$. This function returns the coefficients of $a$ with respect to the basis of $L$.

<a id="function-innerproduct-alglieelt-alglieelt"></a>
#### `InnerProduct(a, b): AlgLieElt, AlgLieElt -> RngElt`

The (Euclidean) inner product of the coefficient vectors of $a$ and $b$, where $a$ and $b$ are elements of some Lie algebra.

<a id="function-support-alglieelt"></a>
#### `Support(a): AlgLieElt -> SetEnum`

The support of the Lie algebra element $a$; i.e. the set of indices of the non-zero components of $a$.

<a id="matrix"></a>
<a id="sectalglieopmatrix"></a>
### Operations for Matrix Lie Algebras

This section describes the functionality provided for matrix Lie algebras which is additional to that provided for structure constant Lie algebras. For further information see Chapter [Matrix Algebras](https://docs.magma-maths.org/Algebras/MatrixAlgebras/index-matrix-algebras.md#chapalgmat).

<a id="function-basemodule-algmatlie-2"></a>
#### `BaseModule(M): AlgMatLie -> ModTupRng`

The natural module on which the matrix Lie algebra $M$ acts.

<a id="function-generic-algmatlie"></a>
#### `Generic(M): AlgMatLie -> AlgMatLie`

The full matrix algebra in which the matrix Lie algebra $M$ is naturally embedded.

<a id="function-kernel-algmatlieelt"></a>
#### `Kernel(X): AlgMatLieElt -> ModTupRng`

<a id="function-nullspace-algmatlieelt"></a>
#### `Nullspace(X): AlgMatLieElt -> ModTupRng`

The kernel of the homomorphism represented by the Lie matrix algebra element $X$.

<a id="function-nullspaceoftranspose-algmatlieelt"></a>
#### `NullspaceOfTranspose(X): AlgMatLieElt -> ModTupRng`

<a id="function-rownullspace-algmatlieelt"></a>
#### `RowNullSpace(X): AlgMatLieElt -> ModTupRng`

The row nullspace of the homomorphism represented by the Lie matrix algebra element $X$.

<a id="sectalgliehom"></a>
<a id="id1"></a>
### Homomorphisms

<a id="constructor-constructor-hom-alglie-alglie-alglieelt-map"></a>
#### `hom<L -> M | Q>: AlgLie, AlgLie, [ AlgLieElt ] -> Map`

<a id="constructor-constructor-hom-alglie-tupmod-tupmodelt-map"></a>
#### `hom<L -> M | Q>: AlgLie, TupMod, [ TupModElt ] -> Map`

Given a (structure constant) Lie algebra $L$ of dimension $n$ over $R$ and either a Lie algebra $M$ over $R$ or a module $M$ over $R$, the homomorphism from $L$ to $M$ specified by $Q$ is constructed. The sequence $Q$ may be of the form $[b_1, \ldots, b_n]$, $b_i \in B$, indicating that the $i$-th basis element of $L$ is mapped to $b_1$ or of the form $[<a_1,b_1>, \ldots, <a_n,b_n>]$ indicating that $a_i$ maps to $b_i$, where the $a_i (1 \le i \le n)$ must form a basis of $L$.

Note that this is in general only a module homomorphism, and no check is made for it being an algebra homomorphism.

<a id="automorphisms-classical"></a>
<a id="sectalglieautsclass"></a>
### Automorphisms of Classical-type Reductive Algebras

<a id="function-identityautomorphism-alglie"></a>
#### `IdentityAutomorphism(L): AlgLie -> Map`

The trivial automorphism of the Lie algebra $L$.

<a id="function-innerautomorphism-alglie-grplieelt"></a>
#### `InnerAutomorphism(L, x): AlgLie, GrpLieElt -> Map`

The inner automorphism of the Lie algebra $L$ induced by $x$, where $x$ is an element of the corresponding group of Lie type.

<a id="function-innerautomorphismgroup-alglie"></a>
#### `InnerAutomorphismGroup(L): AlgLie -> GrpLie, Map`

The group of Lie type $G$ corresponding to the Lie algebra $L$. The map $G\to {\operatorname{Aut}}(L)$ is returned as second value.

<a id="function-diagonalautomorphism-alglie-modtuprngelt"></a>
#### `DiagonalAutomorphism(L, v): AlgLie, ModTupRngElt -> Map`

The diagonal automorphism of the Lie algebra $L$ induced by the vector $v$.

<a id="function-graphautomorphism-alglie-grppermelt"></a>
#### `GraphAutomorphism(L, p): AlgLie, GrpPermElt -> Map`

<a id="function-diagramautomorphism-alglie-grppermelt"></a>
#### `DiagramAutomorphism(L, p): AlgLie, GrpPermElt -> Map`

```magma
SimpleSigns: Any                    Default: 1
```

The graph automorphism of the Lie algebra $L$ induced by the permutation $p$. This must be either a permutation of the indices of the simple roots, or a permutation of the indices of all roots.

The optional parameter `SimpleSigns` can be used to specify the signs corresponding to each simple root. This should either be a sequence of integers $\pm1$, or a single integer $\pm1$.

<a id="example-ex-d6f1f7"></a>
#### `Example: Graph Automorphism of Order Three (ex-d6f1f7)`

We construct an automorphism of order three for the simple Lie algebra of type $D_4$.

```magma
> DynkinDiagram( "D4" );

D4    3
     /
1 - 2
     \\
      4

> p:= Sym(4)!(1,3,4);
> L:= LieAlgebra( "D4", Rationals() );
> f:= GraphAutomorphism( L, p );
> f(L.3);
(0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> f(L.4);
(0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> f(L.5);
(0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
```

<a id="restrictable"></a>
<a id="sectalglieresla"></a>
### Restrictable Lie Algebras

A restricted Lie algebra is a Lie algebra over a field of characteristic $p>0$, equipped with a restriction map $x\to x^p$, satisfying the axioms given in [[Jac62b](https://docs.magma-maths.org/references.md#cite-jacobson-lie-alg)]. A restrictable Lie algebra is a Lie algebra which can be equipped with a restriction map. A Lie algebra is restrictable if and only if ${\rm ad} L$ is closed under the $p$th power map. Hence restrictable Lie algebras have a standard restriction map induced by the adjoint representation. For many purposes, it suffices to know that a Lie algebra is restrictable, without needing to know a restriction.

By convention, a Lie algebra over a field of characteristic zero is always considered restrictable, and the restriction map is the identity map.

In Magma, we do not make a distinction between the concepts of restricted and restrictable. Note however that a Lie algebra can have a nonstandard restriction map.

<a id="function-isrestrictable-alglie"></a>
#### `IsRestrictable(L): AlgLie -> BoolElt, Map`

<a id="function-isrestricted-alglie"></a>
#### `IsRestricted(L): AlgLie -> BoolElt, Map`

<a id="function-ispliealgebra-alglie"></a>
#### `IspLieAlgebra(L): AlgLie -> BoolElt, Map`

Returns `true` if, and only if, the Lie algebra $L$ is restrictable. If $L$ is restrictable, the restriction map is returned as a second value.

<a id="function-restrictionmap-alglie"></a>
#### `RestrictionMap(L): AlgLie -> Map`

<a id="function-pmap-alglie"></a>
#### `pMap(L): AlgLie -> Map`

The restriction map of the Lie algebra $L$. If $L$ is not restrictable, an error is signalled.

<a id="example-ex-7334d1"></a>
#### `Example: Restrictable Lie Algebras and p-Maps (ex-7334d1)`

```magma
> L:= LieAlgebra( "A2", GF(5) );
> IsRestrictable( L );
true Mapping from: AlgLie: L to AlgLie: L given by a rule [no inverse]
> pmap:= pMap( L );
> pmap( 2*L.3 + L.4);
(0 0 0 1 0 0 0 0)
```

<a id="function-restrictedsubalgebra-setenum-alglieelt"></a>
#### `RestrictedSubalgebra(Q): SetEnum[AlgLieElt] -> AlgLie`

<a id="function-psubalgebra-setenum-alglieelt"></a>
#### `pSubalgebra(Q): SetEnum[AlgLieElt] -> AlgLie`

Given a sequence $Q$ of elements from the Lie algebra $L$, the function returns the restricted subalgebra generated by the elements of $Q$, i.e., the smallest subalgebra containing $Q$ which is also closed under the restriction map. If the parent of $Q$ is not restrictable, an error is signalled.

<a id="function-pclosure-alglie-alglie"></a>
#### `pClosure(L, M): AlgLie, AlgLie -> AlgLie`

Given Lie algebras $L$ and $M$ such that $L\le M$, this function returns the closure of $L$ under the restriction map of $M$. If $L$ is not a subalgebra of $M$ or $M$ is not restrictable, an error is signalled.

<a id="function-isrestrictedsubalgebra-alglie-alglie"></a>
#### `IsRestrictedSubalgebra(L, M): AlgLie, AlgLie -> AlgLie`

<a id="function-ispsubalgebra-alglie-alglie"></a>
#### `IspSubalgebra(L, M): AlgLie, AlgLie -> AlgLie`

Return `true` if and only if the Lie algebra $L$ is a restricted Lie subalgebra of $M$ with the same restriction map. Note that if $L$ is constructed using the `pClosure` intrinsic, this will always be true. However if $L$ is constructed as a subalgebra, this may be false even if $L$ is restrictable, since the restriction map of $L$ will be the standard map rather than the restriction map of $M$.

<a id="function-pquotient-alglie-alglie"></a>
#### `pQuotient(L, M): AlgLie, AlgLie -> AlgLie`

Given Lie algebras $L$ and $M$ such that $L\le M$, this function returns the quotient of $L$ by the $p$-closure of the Lie algebra $M$, with respect to the inherited restriction map.

<a id="function-jenningsliealgebra-grp"></a>
#### `JenningsLieAlgebra(G): Grp -> AlgLie, SeqEnum`

Let $G$ be a $p$-group. Then the quotients of the successive terms of the Jennings series of $G$ can be viewed as vector spaces over the field of $p$ elements. The direct sum of these vector spaces carries the structure of a Lie algebra (coming from the commutator of $G$). This function returns two values. Firstly, the Lie algebra constructed from $G$ by this process. This Lie algebra is graded. The second returned value is a sequence of sequences of two elements. The first element is the degree of a homogeneous component while the second element is its dimension. The basis elements of the Lie algebra are ordered according to increasing degree. This means that from the dimensions of the homogeneous components it is possible to derive the degree of each basis element.

Lie algebras constructed in this way are naturally restricted. Moreover, if $x$ is a homogeneous element of degree $d$, then the $p$-th power image of $x$ is homogeneous of degree $pd$.

<a id="example-ex-2771f0"></a>
#### `Example: Jennings Lie Algebra of a p-Group (ex-2771f0)`

```magma
> G:= SmallGroup( 3^6, 196 );
> L, gr:= JenningsLieAlgebra( G );
> L;
Lie Algebra of dimension 6 with base ring GF(3)
> gr;
[
    [ 1, 3 ],
    [ 2, 1 ],
    [ 3, 2 ]
]
> // So the first three basis elements are of degree 1,
> // the fourth basis element is of degree 2, and so on.
> pmap:= pMap( L );
> pmap( L.1 );
(0 0 0 0 1 1)
```

<a id="sectunivea"></a>
<a id="id1"></a>
### Universal Enveloping Algebras

This section describes the functionality for universal enveloping algebras of Lie algebras. If a Lie algebra is semisimple and defined over a field of characteristic $0$, then it is possible to write down an integral basis of the universal enveloping algebra that has nice properties. To accommodate this possibility, two constructions of a universal enveloping algebra are provided: a general construction, and one in which this integral basis is used. First we briefly describe the theoretical background behind universal enveloping algebras.

In Magma, universal enveloping algebras have type `AlgUE` and their elements have type `AlgUEElt`. Integral universal enveloping algebras have type `AlgIUE` and their elements have type `AlgIUEElt`. General algebras having a PBW basis (see below) have type `AlgPBW` (elements type `AlgPBWElt`) which inherit from types `Alg` and `Rng`. Consequently, the type `AlgIUE` inherits from `AlgPBW`.

#### Background

<a id="uea-background-1"></a>
<a id="uea"></a>
<a id="id2"></a>
##### Universal Enveloping Algebras

Let $L$ be a Lie algebra over the field $F$ having basis $x_1,\ldots, x_n$. The universal enveloping algebra $U(L)$ of $L$ is the associative algebra with identity, generated by $n$ symbols which are also denoted by $x_1,\ldots, x_n$. These generators satisfy the relations

$$
x_jx_i -x_ix_j = [ x_j,x_i],  1\leq i,j\leq n>.
$$

Here $[x_j,x_i]$ is the product in the Lie algebra $L$, so it is a certain linear combination of the $x_k$.

The theorem of Poincaré-Birkhoff-Witt states that a basis of $U(L)$ is formed by the set of all elements

$$
x_1^{k_1}\cdots x_n^{k_n},
$$

where the $k_i$ are non-negative integers. Furthermore, the product of two such basis elements may be rewritten as a linear combination of basis elements using the defining relations $x_jx_i -x_ix_j = [ x_j,x_i]$ for $j>i$.

<a id="uea-integral-form"></a>
<a id="intuea"></a>
##### The Integral Form of a Universal Enveloping Algebra

If the Lie algebra $L$ happens to be (split) semisimple and of characteristic $0$, then the universal enveloping algebra has a nice basis described by [[Kos66](https://docs.magma-maths.org/references.md#cite-kostant66)]. The first step in constructing this basis involves taking a Chevalley basis of $L$, consisting of the elements $y_1,\ldots, y_s$, $h_1,\ldots, h_r$ and $x_1,\ldots, x_s$. Here the $y_i$ and $x_i$ are root vectors belonging to negative roots and positive roots, respectively. The $h_i$ are basis elements of a Cartan subalgebra. In the universal enveloping algebra we use the divided powers

$$
y_i^{(n)} = {y_i^n\over n!}, ~~ x_i^{(n)} = {x_i^n\over n!},
$$

and the binomials

$$
{h_i \choose k } = { h_i(h_i-1)\cdots (h_i-k+1)\over k!}.
$$

A basis of $U(L)$ is formed by the elements

$$
y_1^{(m_1)}\cdots y_s^{(m_s)} {h_1\choose k_1} \cdots {h_r\choose k_r}
x_1^{(n_1)}\cdots x_s^{(n_s)}.
$$

This basis has the useful property that if we multiply two basis elements, the structure constants will be integers (usually of quite moderate size). So this is a basis of an integral form of the universal enveloping algebra.

<a id="uea-construct"></a>
<a id="sectalgueaconstr"></a>
#### Construction of Universal Enveloping Algebras

<a id="function-universalenvelopingalgebra-alglie"></a>
##### `UniversalEnvelopingAlgebra(L): AlgLie -> AlgUE`

This creates the universal enveloping algebra $U$ of the Lie algebra $L$. Here the $i$-th basis element of $L$ (i.e., `L.i`) corresponds to the $i$-th generator of $U$ (i.e., `U.i`). Every product of generators is rewritten as a linear combination of Poincaré-Birkhoff-Witt monomials (cf. Section [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#uea)).

<a id="function-integraluea-alglie"></a>
##### `IntegralUEA(L): AlgLie -> AlgIUE`

<a id="function-integraluealgebra-alglie"></a>
##### `IntegralUEAlgebra(L): AlgLie -> AlgIUE`

<a id="function-integraluniversalenvelopingalgebra-alglie"></a>
##### `IntegralUniversalEnvelopingAlgebra(L): AlgLie -> AlgIUE`

Given a semisimple Lie algebra $L$ of characteristic $0$, create the integral universal enveloping algebra $U$ of $L$. The basis described in Section [The Integral Form of a Universal Enveloping Algebra](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#intuea) is used.

Let $x$, $y$, and $h$ denote the output of `ChevalleyBasis(L)`. Let $s$ be the length of $x$, and $r$ the length of $h$. Then every generator of $U$ corresponds to an element of $x$, $y$, or $h$. If $1\leq i\leq s$ then the $i$-th generator of $U$ (i.e., `U.i`) corresponds to the $i$-th element of $y$. It is printed as `y_i`. If $s+1\leq i\leq s+r$, then the $i$-th generator of $U$ corresponds to the $k$-th element of $h$, where $k=i-s$. It is printed as `[ h_k ; 1 ]` (i.e., `h_k` choose 1). Finally, if $s+r+1\leq i\leq 2s+r$, then the $i$-th generator corresponds to the $k$-th element of $x$, where $k=i-s-r$. It is printed as `x_k`.

Using this form of the universal enveloping algebra has two advantages. Firstly, the structure constants are integers which usually remain relatively small. Secondly, multiplication of elements is, in general, much faster than is the case with universal enveloping algebras that employ PBW bases.

<a id="example-ex-c78d02"></a>
##### `Example: Constructing a Universal Enveloping Algebra (ex-c78d02)`

```magma
> T:= [ <4,1,1,1>, <1,4,1,-1>, <4,1,3,1>, <1,4,3,-1>, <4,2,2,1>, <2,4,2,-1>,
> <4,3,1,1>, <3,4,1,-1>, <3,1,2,1>, <1,3,2,-1> ];
> L:= LieAlgebra< Rationals(), 4 | T >;
> U:= UniversalEnvelopingAlgebra(L);
> U.4*U.1;
x_1*x_4 + x_1 + x_3
> L:= LieAlgebra("F4", Rationals());
> U:= IntegralUEA(L);
> U.29*U.1;
y_1*x_1 + [ h_1 ; 1 ]
> (1/4)*U.29^2*U.1^2;
y_1^(2)*x_1^(2) + y_1*[ h_1 ; 1 ]*x_1 - 2*y_1*x_1 + [ h_1 ; 2 ]
```

In the last example we divided by $4$ because `U.29^2 = 2 U.29^(2)`, and likewise for `U.1^2`.

<a id="procedure-assignnames-algpbw-monstgelt-ref"></a>
##### `AssignNames(~U, Q): AlgPBW, [ MonStgElt ]`

Assign the names in the sequence $Q$ to the generators of the algebra $U$.

<a id="function-changering-algue-rng"></a>
##### `ChangeRing(U, S): AlgUE, Rng -> AlgUE`

Given a universal enveloping algebra $U$ with base ring $R$, together with a ring $S$, construct the algebra $U'$ with base ring $S$ obtained by coercing the coefficients of elements of $U$ into $S$.

#### Related Structures

<a id="function-coefficientring-algpbw"></a>
##### `CoefficientRing(U): AlgPBW -> Rng`

<a id="function-basering-algpbw"></a>
##### `BaseRing(U): AlgPBW -> Rng`

The ring of coefficients of the universal enveloping algebra $U$.

<a id="function-algebra-algue"></a>
##### `Algebra(U): AlgUE -> AlgLie`

The Lie algebra corresponding to the universal enveloping algebra $U$.

<a id="uea-elements"></a>
<a id="sectalgueaelts"></a>
#### Elements of Universal Enveloping Algebras

Most functions in this section are applicable both to universal enveloping algebras and to integral universal enveloping algebras. Therefore, they are only documented once. An exception is the function `HBinomial`, which is only applicable to integral universal enveloping algebras.

##### Creation of Elements

<a id="operation-op-algpbw-rngintelt"></a>
###### `U ! 0: AlgPBW, RngIntElt -> AlgPBWElt`

<a id="function-zero-algpbw"></a>
###### `Zero(U): AlgPBW -> AlgPBWElt`

The zero element of the universal enveloping algebra $U$.

<a id="operation-op-algpbw-rngintelt-2"></a>
###### `U ! 1: AlgPBW, RngIntElt -> AlgPBWElt`

<a id="function-one-algpbw"></a>
###### `One(U): AlgPBW -> AlgPBWElt`

The identity element of the universal enveloping algebra $U$.

<a id="operation-operation-algpbw-rngintelt-algpbwelt"></a>
###### `U . i: AlgPBW, RngIntElt -> AlgPBWElt`

The $i$-th generator of the universal enveloping algebra $U$.

<a id="operation-op-algpbw-any"></a>
###### `U ! r: AlgPBW, Any -> AlgPBWElt`

Returns $r$ as an element of the enveloping algebra $U$ where $r$ may be anything coercible into the coefficient ring of $U$ or an element of another enveloping algebra of the same type as $U$ whose coefficients can be coerced into the coefficient ring of $U$.

<a id="function-hbinomial-algiue-rngintelt-rngintelt"></a>
###### `HBinomial(U, i, n): AlgIUE, RngIntElt, RngIntElt -> AlgIUEElt`

<a id="function-hbinomial-algiueelt-rngintelt"></a>
###### `HBinomial(h, n): AlgIUEElt, RngIntElt -> AlgIUEElt`

This function is applicable only in the case of integral universal enveloping algebras. It is used for constructing the “binomial” elements $h_i$ choose $n$. In the first form $U$ is an integral universal enveloping algebra, and $i$ is an index between $1$ and the rank of the root datum. In the second form, the element $h$ is simply `U.(s+i)`, where $s$ is the number of positive roots.

<a id="example-ex-4c79c2"></a>
###### `Example: Binomial Elements of an Integral Enveloping Algebra (ex-4c79c2)`

```magma
> L:= LieAlgebra("E6",Rationals());
> U:= IntegralUEA(L);
> HBinomial(U, 4, 10);
[ h_4 ; 10 ]
```

##### Operations on Elements

<a id="operation-op-plus-algpbwelt-algpbwelt"></a>
###### `x + y: AlgPBWElt, AlgPBWElt -> AlgPBWElt`

<a id="operation-op-minus-algpbwelt-algpbwelt"></a>
###### `x - y: AlgPBWElt, AlgPBWElt -> AlgPBWElt`

<a id="operation-op-times-algpbwelt-algpbwelt"></a>
###### `x * y: AlgPBWElt, AlgPBWElt -> AlgPBWElt`

<a id="operation-op-times-rngelt-algpbwelt"></a>
###### `c * x: RngElt, AlgPBWElt -> AlgPBWElt`

<a id="operation-op-times-algpbwelt-rngelt"></a>
###### `x * c: AlgPBWElt, RngElt -> AlgPBWElt`

<a id="operation-op-pow-algpbwelt-rngintelt"></a>
###### `x ^ n: AlgPBWElt, RngIntElt -> AlgPBWElt`

<a id="function-monomials-algpbwelt"></a>
###### `Monomials(u): AlgPBWElt -> SeqEnum`

The sequence of the monomials that occur in the element $u$ of a universal enveloping algebra.

<a id="function-coefficients-algpbwelt"></a>
###### `Coefficients(u): AlgPBWElt -> SeqEnum`

The sequence of coefficients of the monomials in the element $u$ of a universal enveloping algebra. The $k$-th element of this sequence corresponds exactly to the $k$-th monomial in the sequence returned by `Monomials(u)`.

<a id="function-degree-algpbwelt-rngintelt"></a>
###### `Degree(u, i): AlgPBWElt, RngIntElt -> RngIntElt`

Given an element $u$ of a universal enveloping algebra $U$ and an integer $i$, this function returns the degree of $u$ in the $i$-th generator of $U$.

<a id="example-ex-81e4e4"></a>
###### `Example: Operations on Enveloping Algebra Elements (ex-81e4e4)`

```magma
> L:= LieAlgebra("G2",Rationals());
> U:= IntegralUEA(L);

> c:= U.7*U.2;c;
y_2*[ h_1 ; 1 ] + 3*y_2
> Monomials(c);
[
    y_2*[ h_1 ; 1 ],
    y_2
]
> Coefficients(c);
[ 1, 3 ]
> c:= U.10*U.7*U.2; c;
y_2*[ h_1 ; 1 ]*x_2 + 6*y_2*x_2 + [ h_1 ; 1 ]*[ h_2 ; 1 ] + 3*[ h_2 ; 1 ]
> Degree(c, 2);
1
> Degree(c, 7);
1
> Degree(c, 8);
1
```

<a id="solvable-nilpotent"></a>
<a id="sectslac"></a>
### Solvable and Nilpotent Lie Algebras Classification

This section describes functions for working with the classification of solvable Lie algebras of dimension 2, 3, and 4, and the classification of nilpotent Lie algebras having dimensions 3,4,5, and 6. The classification of solvable Lie algebras is taken from [[dG05](https://docs.magma-maths.org/references.md#cite-wdg-slac)], and applies to algebras over any base field. The classification of nilpotent Lie algebras is taken from [[dG07](https://docs.magma-maths.org/references.md#cite-wdg-nlac)]. It lists the nilpotent Lie algebras over any base field, with the exception of fields of characteristic 2, when the dimension is 6.

The functions described here fall into two categories: functions for creating the Lie algebras of the classification, and a function for identifying a given solvable Lie algebra of dimension 2,3,4 or a given nilpotent Lie algebra of dimension 3,4,5,6 as a member of the list.

First we describe the classifications, in order to define names for the Lie algebras that occur. We then describe the functions for working with them in Magma.

<a id="slac-class"></a>
<a id="subsectslaclist"></a>
#### The List of Solvable Lie Algebras

We denote a solvable Lie algebra of dimension $n$ by $L_n^k$, where $k$ ranges between 1 and the number of classes of solvable Lie algebras of dimension $n$. If the class depends on a parameter, say $a$, then we denote the Lie algebra by $L_n^k(a)$. In such cases we also state conditions under which $L_n^k(a)$ is isomorphic to $L_n^k(b)$ (if there are any). We list the nonzero commutators only. The field over which the Lie algebra is defined is denoted by $F$. Here is the list of classes of solvable Lie algebras having dimension not greater than 4:

**$L_2^1$**
Abelian.

**$L_2^2$**
$[x_2,x_1]=x_1$.

**$L_3^1$**
Abelian.

**$L_3^2$**
$[x_3,x_1]=x_1$, $[x_3,x_2]=x_2$.

**$L_3^3(a)$**
$[x_3,x_1]=x_2$, $[x_3,x_2]=ax_1+x_2$.

**$L_3^4(a)$**
$[x_3,x_1]=x_2$, $[x_3,x_2]=ax_1$. Condition of isomorphism: $L_3^4(a)\cong L_3^4(b)$ if and only if there is an $\alpha\in F^*$ with $a=\alpha^2 b$.

**$L_4^1$**
Abelian.

**$L_4^2$**
$[x_4,x_1]=x_1$, $[x_4,x_2]=x_2$, $[x_4,x_3]=x_3$.

**$L_4^3(a)$**
$[x_4,x_1]=x_1$, $[x_4,x_2]=x_3$, $[x_4,x_3]=-ax_2+(a+1)x_3$.

**$L_4^4$**
$[x_4,x_2]=x_3$, $[x_4,x_3]= x_3$.

**$L_4^5$**
$[x_4,x_2]=x_3$.

**$L_4^6(a,b)$**
$[x_4,x_1] = x_2$, $[x_4,x_2]=x_3$, $[x_4,x_3] = ax_1+bx_2+x_3$.

**$L_4^7(a,b)$**
$[x_4,x_1] = x_2$, $[x_4,x_2]=x_3$, $[x_4,x_3] = ax_1+bx_2$. Isomorphism condition: $L_4^7(a,b)\cong L_4^7(c,d)$ if and only if there is an $\alpha\in F^*$ with $a=\alpha^3c$ and $b=\alpha^2d$.

**$L_4^8$**
$[x_1,x_2]=x_2$, $[x_3,x_4]=x_4$.

**$L_4^9(a)$**
$[x_4,x_1] = x_1+ax_2$, $[x_4,x_2]=x_1$, $[x_3,x_1]=x_1$, $[x_3,x_2]=x_2$. Condition on the parameter $a$: $T^2-T-a$ has no roots in $F$. Isomorphism condition: $L_4^9(a)\cong L_4^9(b)$ if and only if the characteristic of $F$ is not $2$ and there is an $\alpha\in F^*$ with $a+{1\over 4} = \alpha^2(b+{1\over 4})$, or the characteristic of $F$ is $2$ and $X^2+X+a+b$ has roots in $F$.

**$L_4^{10}(a)$**
$[x_4,x_1] = x_2$, $[x_4,x_2]=ax_1$, $[x_3,x_1]=x_1$, $[x_3,x_2]=x_2$. Condition on $F$: the characteristic of $F$ is $2$. Condition on the parameter $a$: $a\not\in F^2$. Isomorphism condition: $L_4^{10}(a)\cong L_4^{10}(b)$ if and only if $Y^2+X^2b+a$ has a solution $(X,Y)\in F\times F$ with $X\neq 0$.

**$L_4^{11}(a,b)$**
$[x_4,x_1] = x_1$, $[x_4,x_2] = bx_2$, $[x_4,x_3]=(1+b)x_3$, $[x_3,x_1]=x_2$, $[x_3,x_2]=ax_1$. Condition on $F$: the characteristic of $F$ is $2$. Condition on the parameters $a,b$: $a\neq 0$, $b\neq 1$. Isomorphism condition: $L_4^{11}(a,b)\cong L_4^{11}(c,d)$ if and only if ${a\over c}$ and $(\delta^2+(b+1)\delta+b)/c$ are squares in $F$, where $\delta = (b+1)/(d+1)$.

**$L_4^{12}$**
$[x_4,x_1] = x_1$, $[x_4,x_2]=2x_2$, $[x_4,x_3] = x_3$, $[x_3,x_1]=x_2$.

**$L_4^{13}(a)$**
$[x_4,x_1] = x_1+ax_3$, $[x_4,x_2]=x_2$, $[x_4,x_3] = x_1$, $[x_3,x_1]=x_2$.

**$L_4^{14}(a)$**
$[x_4,x_1] = ax_3$, $[x_4,x_3]=x_1$, $[x_3,x_1]=x_2$. Condition on parameter $a$: $a\neq 0$. Isomorphism condition: $L_4^{14}(a)\cong L_4^{14}(b)$ if and only if there is an $\alpha\in F^*$ with $a=\alpha^2 b$.

<a id="slac-class-finfield"></a>
<a id="subsectslaclistfinfld"></a>
#### Comments on the Classification over Finite Fields

Over general fields the lists are not “precise” in the sense that some classes that depend up on a parameter have an associated isomorphism condition, but not a precise parametrization of the Lie algebras in that class. However, for algebras over finite fields we are able to give a precise list, by restricting the parameter values in some cases. In this section we describe how this is done. Here $F$ will be a finite field of size $q$ with primitive root $\gamma$.

- If the characteristic of $F$ is $2$, then there are two algebras of type $L_3^4(a)$, namely $L_3^4(0)$ and $L_3^4(1)$. If the characteristic is not $2$, then there are three algebras of this type, $L_3^4(0)$, $L_3^4(1)$, $L_3^4(\gamma)$.
- The class $L_4^7(a,b)$ splits into three classes: $L_4^7(a,a)$ ($a\in F$), $L_4^7(a,0)$ ($a\neq 0$), $L_4^7(0,b)$ ($b\neq 0$). Among the algebras of the first class there are no isomorphisms. However, for the other two classes we have the following:-

  1. $L_4^7(a,0)\cong L_4^7(b,0)$ if and only if there is an $\alpha\in F^*$ such that $a=\alpha^3 b$. If $q\equiv 1 \bmod 3$, then exactly a third of the elements of $F^*$ are cubes, namely the $\gamma^i$ with $i$ divisible by $3$. So in this case we get three algebras, $L_4^7(1,0)$, $L_4^7(\gamma,0)$, $L_4^7(\gamma^2,0)$. If $q\not\equiv 1 \bmod 3$ then $F^3=F$, and hence there is only one algebra, namely $L_4^7(1,0)$.
  2. $L_4^7(0,a)\cong L_4^7(0,b)$ if and only if there is an $\alpha \in F^*$ such that $a=\alpha^2 b$. So if $q$ is even then we get one algebra, $L_4^7(0,1)$. If $q$ is odd we get two algebras, $L_4^7(0,1)$, $L_4^7(0,\gamma)$.
- In [[dG05](https://docs.magma-maths.org/references.md#cite-wdg-slac)] it is shown that there is only one Lie algebra in the class $L_4^9(a)$. We let $e$ be the smallest positive integer such that $T^2-T-\gamma^e$ has no roots in $F$. Then we take the Lie algebra $L_4^9(\gamma^e)$ as representative of the class.
- Over a finite field of characteristic $2$ there are no Lie algebras of type $L_4^{10}(a)$, as $F^2=F$ in that case.
- There is only one Lie algebra of type $L_4^{11}(a,b)$ over a field of characteristic $2$, namely $L_4^{11}(1,0)$.
- If $q$ is even then there is only one algebra of type $L_4^{14}(a)$, namely $L_4^{14}(1)$. If $q$ is odd, then there are two algebras, $L_4^{14}(1)$ and $L_4^{14}(\gamma)$.

<a id="nlac-class"></a>
<a id="subsectnlaclist"></a>
#### The List of Nilpotent Lie Algebras

We denote a nilpotent Lie algebra of dimension $r$ by $N_r^k$, where $k$ ranges between 1 and the number of classes of nilpotent Lie algebras of dimension $r$. If the class depends on a parameter, say $a$, then we denote the Lie algebra by $N_r^k(a)$. The complete list of isomorphism classes of nilpotent Lie algebras having dimensions 3, 4, 5, and 6, *where in dimension 6 we exclude base fields of characteristic 2* are as follows:

**$N_3^1$**
Abelian.

**$N_3^2$**
$[x_1,x_2]=x_3$.

**$N_4^1$**
Abelian.

**$N_4^2$**
$[x_1,x_2]=x_3$.

**$N_4^3$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$.

**$N_5^1$**
Abelian.

**$N_5^2$**
$[x_1,x_2]=x_3$.

**$N_5^3$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$.

**$N_5^4$**
$[x_1,x_2] = x_5$, $[x_3,x_4]=x_5$.

**$N_5^5$**
$[x_1,x_2]=x_3$, $[x_1,x_3]= x_5$, $[x_2,x_4] = x_5$.

**$N_5^6$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_2,x_3]=x_5$.

**$N_5^7$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$.

**$N_5^8$**
$[x_1,x_2]=x_4$, $[x_1,x_3]=x_5$.

**$N_5^9$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_2,x_3]=x_5$.

There are nine 6-dimensional nilpotent Lie algebras denoted $N_6^k$ for $k=1, \ldots ,9$ which are the direct sum of $N_5^k$ and a 1-dimensional abelian ideal. Consequently, we get the following Lie algebras:-

**$N_6^{10}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_6$, $[x_4,x_5]=x_6$.

**$N_6^{11}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_6$, $[x_2,x_3]=x_6$, $[x_2,x_5]=x_6$.

**$N_6^{12}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_6$, $[x_2,x_5]=x_6$.

**$N_6^{13}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_5$, $[x_2,x_4]=x_5$, $[x_1,x_5]=x_6$, $[x_3,x_4]=x_6$.

**$N_6^{14}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_2,x_3]=x_5$, $[x_2,x_5]=x_6$, $[x_3,x_4]=-x_6$.

**$N_6^{15}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_2,x_3]=x_5$, $[x_1,x_5]=x_6$, $[x_2,x_4]=x_6$.

**$N_6^{16}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_2,x_5]=x_6$, $[x_3,x_4]=-x_6$.

**$N_6^{17}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_1,x_5]=x_6$, $[x_2,x_3]= x_6$.

**$N_6^{18}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_1,x_4]=x_5$, $[x_1,x_5]=x_6$.

**$N_6^{19}(a)$**
$[x_1,x_2]=x_4$, $[x_1,x_3]=x_5$, $[x_2,x_4]=x_6$, $[x_3,x_5]=a x_6$.

**$N_6^{20}$**
$[x_1,x_2]=x_4$, $[x_1,x_3]=x_5$, $[x_1,x_5]=x_6$, $[x_2,x_4]=x_6$.

**$N_6^{21}(a)$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_4$, $[x_2,x_3]=x_5$, $[x_1,x_4]=x_6$, $[x_2,x_5]= a x_6$ .

**$N_6^{22}(a)$**
$[x_1,x_2]=x_5$, $[x_1,x_3]=x_6$, $[x_2,x_4]= a x_6$, $[x_3,x_4]=x_5$.

**$N_6^{23}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_5$, $[x_1,x_4]=x_6$, $[x_2,x_4]= x_5$ .

**$N_6^{24}(a)$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_5$, $[x_1,x_4]=a x_6$, $[x_2,x_3]=x_6$,$[x_2,x_4]= x_5$.

**$N_6^{25}$**
$[x_1,x_2]=x_3$, $[x_1,x_3]=x_5$, $[x_1,x_4]=x_6$.

**$N_6^{26}$**
$[x_1,x_2]=x_4$, $[x_1,x_3]=x_5$, $[x_2,x_3]=x_6$.

*Note that for all classes that depend on a parameter* $a$*, the Lie algebra with parameter* $a$ *is isomorphic to the Lie algebra (from the same class) with parameter* $b$ *if and only if there is an* $\alpha\in F^*$ *with* $a=\alpha^2 b$*.*

<a id="slac-funs"></a>
<a id="subsectslacfuns"></a>
#### Intrinsics for Working with the Classifications

<a id="function-solvableliealgebra-fld-rngintelt-rngintelt"></a>
##### `SolvableLieAlgebra(F, n, k : parameters): Fld, RngIntElt, RngIntElt -> AlgLie`

```magma
pars: SeqEnum                    Default: [ ]
```

This function returns the solvable Lie algebra $L_n^k$ over the field $F$. The multiplication table is exactly the same as that given in the classification of solvable algebras above, where the basis element $x_i$ corresponds to the $i$-th basis element of the Lie algebra returned.

If the Lie algebra $L_n^k$ depends on one or more parameters, then the parameter `pars` specifies the parameter values corresponding to the Lie algebra which is required.

<a id="example-ex-72dcd0"></a>
##### `Example: Solvable Lie Algebra from the Classification (ex-72dcd0)`

```magma
> F<a>:= RationalFunctionField( Rationals() );
> K:= SolvableLieAlgebra( F, 3, 3 : pars:= [a] );
> K.3*K.1;
(0 1 0)
> K.3*K.2;
(a 1 0)
```

<a id="function-nilpotentliealgebra-fld-rngintelt-rngintelt"></a>
##### `NilpotentLieAlgebra(F, r, k : parameters): Fld, RngIntElt, RngIntElt -> AlgLie`

```magma
pars: SeqEnum                    Default: [ ]
```

This function returns the nilpotent Lie algebra $N_r^k$ over the field $F$. The multiplication table is exactly the same as that given in the classification of nilpotent algebras above, where the basis element $x_i$ corresponds to the $i$-th basis element of the Lie algebra returned.

If the Lie algebra $N_r^k$ depends upon one or more parameters, then the parameter `pars` specifies the parameter values corresponding to the Lie algebra which is required.

<a id="example-ex-3827f2"></a>
##### `Example: Nilpotent Lie Algebra from the Classification (ex-3827f2)`

```magma
> F<a>:= RationalFunctionField( Rationals() );
> K:= NilpotentLieAlgebra( F, 6, 19 : pars:= [a^3] );
> K.3*K.5;
(  0   0   0   0   0 a^3)
```

<a id="function-allsolvableliealgebras-fld-rngintelt"></a>
##### `AllSolvableLieAlgebras(F, d): Fld, RngIntElt -> SeqEnum`

Given a finite field $F$ and $d$ an integer equal to $2$, $3$, or $4$, this function returns a sequence containing all solvable Lie algebras of dimension $d$ over the field $F$.

<a id="function-allnilpotentliealgebras-fld-rngintelt"></a>
##### `AllNilpotentLieAlgebras(F, d): Fld, RngIntElt -> SeqEnum`

Given a finite field $F$ and $d$ an integer equal to $3$, $4$, $5$, or $6$, this function returns a sequence containing all nilpotent Lie algebras of dimension $d$ over the field $F$. If the dimension is $6$ then the characteristic of $F$ may not be $2$.

<a id="function-iddataslac-alglie"></a>
##### `IdDataSLAC(L): AlgLie -> MonStgElt, SeqEnum, Map`

Given a solvable Lie algebra $L$ of dimension 2, 3, or 4, this function returns data that identifies $L$ with the isomorphic algebra in the classification of solvable Lie algebras. (SLAC stands for Solvable Lie Algebras Classification.) Three objects are returned: a string, a sequence, and a map.

The string gives the name of the Lie algebra as it occurs in the classification, with information about the field and the parameters.

The sequence contains the parameters of the Lie algebra in the classification to which $L$ is isomorphic.

The map is an isomorphism from $L$ to the corresponding Lie algebra contained in the classification.

<a id="function-iddatanlac-alglie"></a>
##### `IdDataNLAC(L): AlgLie -> MonStgElt, SeqEnum, Map`

Given a nilpotent Lie algebra $L$ of dimension 3, 4, 5, or 6 this function returns data that identifies $L$ with the isomorphic algebra in the classification of nilpotent Lie algebras. (NLAC stands for Nilpotent Lie Algebras Classification.) Three objects are returned: a string giving the name of the algebra $N$ in the classification, a sequence giving the parameters for $N$, and the isomorphism mapping $L$ to $N$.

<a id="function-matrixofisomorphism-map"></a>
##### `MatrixOfIsomorphism(f): Map -> AlgMatElt`

Given an isomorphism $f$ as returned by either `IdDataSLAC` or `IdDataNLAC`, this function returns the matrix of that isomorphism. The row convention is used, i.e., the $i$-th row contains the coordinates of the image of the $i$-th basis element of the domain of $f$.

<a id="example-ex-b0dc46"></a>
##### `Example: Identifying a Solvable Lie Algebra (ex-b0dc46)`

We define a solvable Lie algebra of dimension $4$ that depends on a parameter $a$. We identify this Lie algebra as a member of the classification.

```magma
> F<a>:= RationalFunctionField( Rationals() );
> T:= [ <1,2,2,1>, <1,2,3,a>, <1,4,4,a>, <2,1,2,-1>, <2,1,3,-a>, <4,1,4,-a> ];
> L:= LieAlgebra< F, 4 | T >;
> s,p,f:= IdDataSLAC( L );
> s;
L4_6( Univariate rational function field over Rational Field
Variables: a, 0, -a/(a^2 + 2*a + 1) )
> p;
[
    0,
    -a/(a^2 + 2*a + 1)
]
> MatrixOfIsomorphism( f );
[0   (-a - 1)/(a - 1)   (-a - 1)/(a - 1)   (a^2 + 2*a + 1)/(a^2 - a)]
[0   -1/(a - 1)   -a/(a - 1)   (a + 1)/(a - 1)]
[0   -1/(a^2 - 1)   -a/(a^2 - 1)   a/(a - 1)]
[1/(a + 1)   0   0   0]
```

So generically, the Lie algebra is isomorphic to $L_4^6( 0, -a/(a^2 + 2a + 1))$. We see that the parameters are not defined if $a=-1$. Furthermore, the isomorphism is not defined if $a=\pm 1$, or $a=0$. We investigate those cases.

```magma
> a:= 1;
> T:= [ <1,2,2,1>, <1,2,3,a>, <1,4,4,a>, <2,1,2,-1>, <2,1,3,-a>, <4,1,4,-a> ];
> L:= LieAlgebra< Rationals(), 4 | T >;
> s,p,f:= IdDataSLAC( L );
> s;
L4_3( Rational Field, 0 )
> MatrixOfIsomorphism( f );
[ 0  1  1  0]
[ 0  0 -1  1]
[ 0  0  0  1]
[ 1  0  0  0]
> a:= -1;
> T:= [ <1,2,2,1>, <1,2,3,a>, <1,4,4,a>, <2,1,2,-1>, <2,1,3,-a>, <4,1,4,-a> ];
> L:= LieAlgebra< Rationals(), 4 | T >;
> s,p,f:= IdDataSLAC( L );
> s;
L4_7( Rational Field, 0, 1 )
> MatrixOfIsomorphism( f );
[   0  1/2  1/2  1/2]
[   0  1/2 -1/2 -1/2]
[   0  1/2 -1/2  1/2]
[   1    0    0    0]
> a:= 0;
> T:= [ <1,2,2,1>, <1,2,3,a>, <1,4,4,a>, <2,1,2,-1>, <2,1,3,-a>, <4,1,4,-a> ];
> L:= LieAlgebra< Rationals(), 4 | T >;
> s,p,f:= IdDataSLAC( L );
> s;
L4_4( Rational Field )
> MatrixOfIsomorphism( f );
[ 0  0  1  0]
[ 0  1  0 -1]
[ 0  1  0  0]
[ 1  0  0  0]
```

We see that for $a=1$ the Lie algebra is isomorphic to $L_4^3(0)$, and the isomorphism is defined over any field. If $a=-1$, then the Lie algebra is isomorphic to $L_4^7( 0, 1 )$. However, the isomorphism is not defined if the characteristic of the field is $2$. But then we are back in the case $a=1$. Finally, for $a=0$ the Lie algebra is isomorphic to $L_4^4$.

<a id="example-ex-7b45ed"></a>
##### `Example: Identifying a Nilpotent Lie Algebra (ex-7b45ed)`

The positive part of the simple Lie algebra of type $G_2$ is a nilpotent Lie algebra of dimension six. We identify it in the classification of nilpotent algebras, both in characteristic 0, and in characteristic 3.

```magma
> L:= LieAlgebra( "G2", Rationals() );
> x,y,h:= ChevalleyBasis( L );
> x;
[ (0 0 0 0 0 0 0 0 1 0 0 0 0 0), (0 0 0 0 0 0 0 0 0 1 0 0 0 0), (0 0 0
0 0 0 0 0 0 0 1 0 0 0), (0 0 0 0 0 0 0 0 0 0 0 1 0 0), (0 0 0 0 0 0 0
0 0 0 0 0 1 0), (0 0 0 0 0 0 0 0 0 0 0 0 0 1) ]
```

So we see that the positive part is spanned by basis vectors `L.i` with i=9, 10, 11, 12, 13, and 14. So

```magma
> K:= sub< L | [ L.i : i in [9,10,11,12,13,14] ] >;
> name,pp,f:= IdDataNLAC( K );
> name;
N6_16( Rational Field )
> MatrixOfIsomorphism( f );
[  1   0   0   0   0   0]
[  0   1   0   0   0   0]
[  0   0   1   0   0   0]
[  0   0   0 1/2   0   0]
[  0   0   0   0 1/6   0]
[  0   0   0   0   0 1/6]
> L:= LieAlgebra( "G2", GF(3) );
> K:= sub< L | [ L.i : i in [9,10,11,12,13,14] ] >;
> name,pp,f:= IdDataNLAC( K );
> name;
N6_19( Finite field of size 3, 0 )
```

We see that in characteristic 3 $L$ is isomorphic to a Lie algebra from a different class.

<a id="sub-sssdb"></a>
<a id="subsectalgliesssclassification"></a>
### Semisimple Subalgebras of Simple Lie Algebras

Here we describe the functions for working with the classification of the semisimple subalgebras of the simple Lie algebras. These subalgebras have been classified for the simple Lie algebras over the complex numbers, of ranks up to 8. They have been classified up to linear equivalence. Two subalgebras $K_1$, $K_2$ of a Lie algebra $L$ are linearly equivalent if for every representation of $L$ the induced representations of $K_1$, $K_2$ are equivalent. The basic function for dealing with them returns a directed graph, describing the inclusions among the subalgebras, and having the subalgebras as labels of the vertices. (We refer to [[dG11](https://docs.magma-maths.org/references.md#cite-wdg-sssdb)] for the background details of this classification.)

<a id="function-subalgebrasinclusiongraph-monstgelt"></a>
#### `SubalgebrasInclusionGraph(t): MonStgElt -> GrphDir`

Here $t$ has to be a simple type of rank not exceeding 8. This function returns a directed graph $G$. The vertices of this graph are numbered from 1 to the number of semisimple subalgebras. Furthermore, the last vertex is numbered 0. A vertex has a label that is the semisimple subalgebra corresponding to it. The label of the last vertex (numbered 0), has the Lie algebra $L$ of type $t$ as its label. All other semisimple Lie algebras are subalgebras of this one.

The Lie algebra $L$ (and its subalgebras) is defined over the rational numbers, or over a cyclotomic field. It is sometimes necessary to take an extension, because for some types not all subalgebras are defined over the rationals.

Moreover, in $G$ there is an edge from the vertex with label $K_1$ to the vertex with label $K_2$ if and only if $K_1$ has a subalgebra that is linearly equivalent (as subalgebra of $L$) to $K_2$. We remark that it does not mean that $K_2$ is a subalgebra of $K_1$ (rather that it is linearly equivalent to a subalgebra of $K_1$).

<a id="example-ex-7eb7e1"></a>
#### `Example: Maximal Semisimple Subalgebras of C3 (ex-7eb7e1)`

We consider the subalgebras of the Lie algebra of type $C_3$. We compute the types of its maximal subalgebras.

```magma
> G:= SubalgebrasInclusionGraph( "C3" );
> G;
Digraph
Vertex  Neighbours

1       ;
2       ;
3       ;
4       ;
5       ;
6       ;
7       ;
8       2 4 ;
9       5 10 ;
10      1 2 ;
11      1 2 3 ;
12      1 5 6 ;
13      3 4 6 ;
14      10 11 ;
15      9 12 14 ;
0       7 8 13 15 ;

> v:= Vertices(G);
> Label( v[10] );
Lie Algebra of dimension 6 with base ring Rational Field
> SemisimpleType( Label( v[7] ) );
A1
> SemisimpleType( Label( v[8] ) );
A2
> SemisimpleType( Label( v[13] ) );
A1 A1
> SemisimpleType( Label( v[15] ) );
A1 C2
```

<a id="function-restrictionmatrix-grphdir-rngintelt"></a>
#### `RestrictionMatrix(G, k): GrphDir, RngIntElt -> AlgMatElt`

Here $G$ is a subalgebras inclusion graph of the simple Lie algebra $L$, as output by the previous function, and $k$ is a nonzero integer, corresponding to a vertex. This function returns the restriction matrix corresponding to $L$ and the Lie algebra that is the label of the $k$-th vertex of $G$. This restriction matrix maps weights in a representation of $L$ to weights of the subalgebra, and can be used to decompose a representation of $L$, as a representation of the subalgebra.

<a id="example-ex-03a6eb"></a>
#### `Example: Branching from D4 to G2 (ex-03a6eb)`

We decompose the adjoint representation of the Lie algebra of type $D_4$, when viewed as a representation of its subalgebra of type $G_2$.

```magma
> G:= SubalgebrasInclusionGraph( "D4" );
> v:= Vertices(G);
> tt:= [ SemisimpleType( Label(a) ) : a in v ];
> Index( tt, "G2" );
17
> M:= RestrictionMatrix( G, 17 );
> R:= RootDatum( "D4" : Isogeny:= "SC" );
> S:= RootDatum( "G2" : Isogeny:= "SC" );
> D:= AdjointRepresentationDecomposition(R);
> E:= Branch( S, D, M );
> WeightsAndMultiplicities(E);
[
    (0 1),
    (1 0)
]
[ 1, 2 ]
```

<a id="nilpotent-orbits"></a>
<a id="sectnilporb"></a>
### Nilpotent Orbits in Simple Lie Algebras

Take a simple Lie algebra over the complex numbers, and consider the connected component of its automorphism group that contains the identity. This group acts on the Lie algebra, and there is interest in understanding the nature of its orbits. The nilpotent orbits for simple Lie algebras have been classified. We refer to the book by Collingwood and McGovern [[CM93](https://docs.magma-maths.org/references.md#cite-colmcgov)] for the details of this classification.

The main technical tools used for the classification are the weighted Dynkin diagram and the $sl_2$-triple. The weighted Dynkin diagram is the Dynkin diagram of the root system of the Lie algebra, with labels that can be 0, 1, 2. A nilpotent orbit is uniquely determined by its weighted Dynkin diagram. By the Jacobson-Morozov theorem a nilpotent element of a semisimple Lie algebra can be embedded (as nilpositive element) in an $sl_2$-triple. Now two nilpotent elements are conjugate (under the group) if and only if the corresponding $sl_2$-triples are conjugate. This yields a bijection between nilpotent orbits and conjugacy classes of simple subalgebras isomorphic to $sl_2$.

This section describes functions for working with the classification of nilpotent orbits in simple Lie algebras. One of the main invariants of a nilpotent orbit is its weighted Dynkin diagram. We represent such a diagram by a sequence of its labels; they are mapped to the nodes of the Dynkin diagram in the order determined by the Cartan matrix of the root datum. Also, an $sl_2$-triple is represented by a sequence $[f,h,e]$ of three elements of a Lie algebra; these satisfy the commutation relations $[h,e]=2e$, $[h,f]=-2f$, $[e,f]=h$.

Throughout this section we consider orbits that are not the zero orbit.

<a id="function-isgenuineweighteddynkindiagram-alglie-seqenum"></a>
#### `IsGenuineWeightedDynkinDiagram(L, wd): AlgLie, SeqEnum -> BoolElt, SeqEnum`

Given a simple Lie algebra $L$, and a sequence $wd$ consisting of integers that are 0, 1, or 2, this function returns `true` if $wd$ corresponds to a nilpotent orbit (in other words, if it is the weighted Dynkin diagram of a nilpotent orbit). If $wd$ does corresponds to a nilpotent orbit, an $sl_2$-triple in $L$, such that the third element lies in the nilpotent orbit corresponding to the weighted Dynkin diagram is returned. If $wd$ does not correspond to a nilpotent orbit. the second return value is a sequence consisting of three zeros of $L$.

<a id="example-ex-762477"></a>
#### `Example: Classifying Nilpotent Orbits (ex-762477)`

We can use this function to find the classification of the nilpotent orbits of a given Lie algebra. First we construct all possible weighted Dynkin diagrams, and then we remove those that do not correspond to an orbit.

```magma
> L:= LieAlgebra( RootDatum("D4"), Rationals() );
> [ w : i,j,k,l in [0,1,2] | IsGenuineWeightedDynkinDiagram(L, w)
>     where w := [i,j,k,l] ];
[
    [ 0, 0, 0, 2 ],
    [ 0, 0, 2, 0 ],
    [ 0, 1, 0, 0 ],
    [ 0, 2, 0, 0 ],
    [ 0, 2, 0, 2 ],
    [ 0, 2, 2, 0 ],
    [ 1, 0, 1, 1 ],
    [ 2, 0, 0, 0 ],
    [ 2, 0, 2, 2 ],
    [ 2, 2, 0, 0 ],
    [ 2, 2, 2, 2 ]
]
```

<a id="function-nilpotentorbit-alglie-seqenum"></a>
#### `NilpotentOrbit(L, wd): AlgLie, SeqEnum -> NilpOrbAlgLie`

This returns the nilpotent orbit in the simple Lie algebra $L$ with weighted Dynkin diagram given by the sequence $wd$. It is *not* checked whether the weighted Dynkin diagram really corresponds to a nilpotent orbit.

<a id="function-nilpotentorbit-alglie-alglieelt"></a>
#### `NilpotentOrbit(L, e): AlgLie, AlgLieElt -> NilpOrbAlgLie`

This returns the nilpotent orbit in the simple Lie algebra $L$ having representative $e$. Here $e$ has to be a nilpotent element of the Lie algebra. This condition is not checked by the function.

<a id="example-ex-ab5b8b"></a>
#### `Example: Nilpotent Orbits by Representative (ex-ab5b8b)`

```magma
> L:= LieAlgebra( RootDatum("A2"), Rationals() );
> NilpotentOrbit( L, [2,2] );
Nilpotent orbit in Lie algebra of type A2
> NilpotentOrbit( L, L.1 );
Nilpotent orbit in Lie algebra of type A2
```

<a id="function-nilpotentorbits-alglie"></a>
#### `NilpotentOrbits(L): AlgLie -> SeqEnum`

Given a simple Lie algebra $L$, this function returns the sequence of all nilpotent orbits in the simple Lie algebra $L$.

<a id="example-ex-1ce736"></a>
#### `Example: Nilpotent Orbits of D4 (ex-1ce736)`

We compute the nilpotent orbits of the Lie algebra of type $D_4$, and observe that they are the same as those found in Example [Classifying Nilpotent Orbits](https://docs.magma-maths.org/LieTheory/LieAlgebras/nilpotent-orbits.md#example-ex-762477).

```magma
> L:= LieAlgebra( RootDatum("D4"), Rationals() );
> o:= NilpotentOrbits(L);
> [ WeightedDynkinDiagram(orb) : orb in o ];
[
    [ 2, 2, 2, 2 ],
    [ 2, 0, 2, 2 ],
    [ 2, 2, 0, 0 ],
    [ 0, 2, 0, 2 ],
    [ 0, 2, 2, 0 ],
    [ 0, 2, 0, 0 ],
    [ 1, 0, 1, 1 ],
    [ 2, 0, 0, 0 ],
    [ 0, 0, 0, 2 ],
    [ 0, 0, 2, 0 ],
    [ 0, 1, 0, 0 ]
]
```

<a id="function-partition-nilporbalglie"></a>
#### `Partition(o): NilpOrbAlgLie -> SeqEnum`

Here $o$ is a nilpotent orbit in a simple Lie algebra of classical type (i.e., of type $A_n$, $B_n$, $C_n$, or $D_n$). The nilpotent orbits for the Lie algebras of these types have been classified in terms of partitions. This function returns the partition corresponding to the orbit.

<a id="example-ex-52861d"></a>
#### `Example: Partitions of Nilpotent Orbits (ex-52861d)`

```magma
> L:= LieAlgebra( RootDatum("D4"), Rationals() );
> orbs:= NilpotentOrbits( L );
> Partition( orbs[5] );
[ 4, 4 ]
> Partition( orbs[6] );
[ 3, 3, 1, 1 ]
```

<a id="function-sl2triple-nilporbalglie"></a>
#### `SL2Triple(o): NilpOrbAlgLie -> SeqEnum`

Given a nilpotent orbit $o$ in a simple Lie algebra $L$, this function returns an $sl_2$-triple, $[f,h,e]$ of elements of $L$, such that $e$ lies in the nilpotent orbit.

<a id="function-sl2triple-alglie-alglieelt"></a>
#### `SL2Triple(L, e): AlgLie, AlgLieElt -> SeqEnum`

Given a semisimple Lie algebra $L$ of characteristic 0, and a nilpotent element $e$ of $L$, this function returns an $sl_2$-triple $[f,h,e]$ of elements of $L$. It may also work for other Lie algebras, and in other characteristics, but this is not guaranteed.

<a id="function-representative-nilporbalglie"></a>
#### `Representative(o): NilpOrbAlgLie -> AlgLieElt`

Given a nilpotent orbit $o$ for a simple Lie algebra $L$, this function returns an $e\in L$ lying in the orbit.

<a id="function-weighteddynkindiagram-nilporbalglie"></a>
#### `WeightedDynkinDiagram(o): NilpOrbAlgLie -> SeqEnum`

Given a nilpotent orbit $o$ for a simple Lie algebra $L$, this function returns its weighted Dynkin diagram.

<a id="example-ex-eb9e7c"></a>
#### `Example: Weighted Dynkin Diagram of an Orbit (ex-eb9e7c)`

We take some nilpotent element in the Lie algebra of type $E_8$ and we find the weighted Dynkin diagram of the orbit it lies in.

```magma
> L:= LieAlgebra( RootDatum("E8"), Rationals() );
> x,_,_:= ChevalleyBasis(L);
> orb:= NilpotentOrbit( L, x[1]+x[10]-x[30]+3*x[50]-2*x[100] );
> WeightedDynkinDiagram( orb );
[ 1, 0, 0, 0, 0, 0, 0, 1 ]
```

<a id="lie-alg-km"></a>
<a id="chapalgliekm"></a>
## Kac-Moody Lie Algebras

- [Introduction](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/introduction.md)
- [Generalized Cartan Matrices](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md)
  - [`IsGeneralizedCartanMatrix(C): AlgMatElt → BoolElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md#function-isgeneralizedcartanmatrix-algmatelt)
  - [`KacMoodyClass(C): AlgMatElt → MonStgElt, ModMatRngElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md#function-kacmoodyclass)
  - [`KacMoodyClasses(C): AlgMatElt → SeqEnum, SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md#function-kacmoodyclasses-algmatelt)
  - [Example: Classifying Generalized Cartan Matrices](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md#example-ex-89fcf7)
- [Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md)
  - [Constructing Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#constructing-affine-kac-moody-lie-algebras)
    - [`AffineLieAlgebra(N, F): MonStgElt, Fld → AlgKac`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-affineliealgebra-monstgelt-fld)
    - [`AffineLieAlgebra(C, F): AlgMatElt, Fld → AlgKac`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-affineliealgebra-algmatelt-fld)
    - [Example: Constructing Affine Kac-Moody Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#example-ex-055fd7)
  - [Properties of Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#properties-of-affine-kac-moody-lie-algebras)
    - [`CartanMatrix(L): AlgKac → AlgMatElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-cartanmatrix-algkac)
    - [`CartanName(L): AlgKac → MonStgElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-cartanname-algkac)
    - [`Dimension(L): AlgKac → Infty`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-dimension-algkac)
    - [`CoefficientRing(L): AlgKac → Rng`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-coefficientring-algkac)
    - [`BaseRing(L): AlgKac → Rng`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-basering-algkac)
    - [`FiniteLieAlgebra(L): AlgKac → AlgLie`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-finiteliealgebra-algkac)
    - [`LaurentSeriesRing(L): AlgKac → RngSerLaur`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-laurentseriesring-algkac)
    - [`StandardGenerators(L): AlgKac → SeqEnum[AlgKacElt], SeqEnum[AlgKacElt], SeqEnum[AlgKacElt]`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-standardgenerators-algkac)
    - [Example: Properties of an Affine Lie Algebra](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#example-ex-17cbd6)
  - [Constructing Elements of Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#constructing-elements-of-affine-kac-moody-lie-algebras)
    - [`L . i: AlgKac, RngIntElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-operation-algkac-rngintelt-algkacelt)
    - [`HasAttribute(L, "c"): AlgKac, MonStgElt → BoolElt, AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-hasattribute-algkac-monstgelt-c)
    - [`HasAttribute(L, "d"): AlgKac, MonStgElt → BoolElt, AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-hasattribute-algkac-monstgelt-d)
    - [`elt<L | {<} [ {<} p₁, y₁ {>}, ... ], λ, μ {>} >: AlgKac, Tup → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#constructor-constructor-elt-algkac-tup-algkacelt)
  - [Properties of Elements of Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#properties-of-elements-of-affine-kac-moody-lie-algebras)
    - [`EltTup(x): AlgKacElt → Tup`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-kmaff-elttup)
    - [`IsZero(x): AlgKacElt → BoolElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-iszero-algkacelt)
    - [`x eq y: AlgKacElt, AlgKacElt → BoolElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-op-eq-algkacelt-algkacelt)
    - [`x + y: AlgKacElt, AlgKacElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-op-plus-algkacelt-algkacelt)
    - [`x - y: AlgKacElt, AlgKacElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-op-minus-algkacelt-algkacelt)
    - [`x * y: AlgKacElt, AlgKacElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-op-times-algkacelt-algkacelt)
    - [`c * y: RngElt, AlgKacElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-op-times-rngelt-algkacelt)
    - [`-x: AlgKacElt → AlgKacElt`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#operation-operation-algkacelt-algkacelt)
    - [Example: Elements of an Affine Lie Algebra](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#example-ex-1599ed)
- [Bibliography](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/bibliography.md)

<a id="sectalgliekmintro"></a>
<a id="id1"></a>
### Introduction

Lie algebras of finite dimension are well understood, and numerous procedures for performing calculations with them are described in Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie). An important class of infinite dimensional Lie algebras is that of *Kac–Moody* Lie algebras. The principal text on this subject is a book by Kac [[Kac90](https://docs.magma-maths.org/references.md#cite-kac90)]. Let us briefly introduce these Lie algebras.

A *generalized Cartan matrix* is an integral matrix $A = (a_{ij})_{i,j=1}^n$ such that $a_{ii} = 2$, $a_{ij} < 0$ for $i \neq j$, and $a_{ij} = 0$ implies $a_{ji} = 0$. (Note that in particular, a Cartan matrix in the usual sense is a generalized Cartan matrix.)

To a generalized Cartan matrix we associate a Kac–Moody Lie algebra $\mathfrak{g}(A)$. This Lie algebra is generated by $3n$ elements $e_i, f_i, h_i$ ($i = 1, \ldots, n$) satisfying the following defining relations:

$$
[h_i, h_j] = 0, [e_i, f_i] = h_i, [e_i, f_j] = 0 {\rm\ if\ } i \neq j,
$$

$$
[h_i, e_j] = a_{ij} e_j, [h_i, f_j] = -a_{ij} f_j,
$$

$$
({\rm ad} e_i)^{1-a_{ij}}e_j = 0, ({\rm ad} f_i)^{1-a_{ij}}f_j = 0  {\rm\ if\ } i \neq j.
$$

The class of Kac–Moody Lie algebras breaks up into three subclasses:

**(a)**
There is a vector $\theta$ of positive integers such $A\theta$ is a positive vector. In this case the Lie algebra $\mathfrak{g}(A)$ is finite-dimensional and reductive.

**(b)**
There is a vector $\delta$ of positive integers such that $A\delta = 0$. In this case $\mathfrak{g}(A)$ is infinite-dimensional, but is of polynomial growth. These Lie algebras are called *affine Lie algebras*.

**(c)**
There is a vector $\alpha$ of positive integers such that $A\alpha$ is negative. In this case $\mathfrak{g}(A)$ is infinite-dimensional and of exponential growth.

The procedures for finite-dimensional Lie algebras are described in Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie). The affine Lie algebras are described in Section [Affine Kac–Moody Lie Algebras](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#sectalgkacaff). The Kac–Moody Lie algebras of type (c) are not yet available.

<a id="cartan"></a>
<a id="sectalgliekmcartan"></a>
### Generalized Cartan Matrices

<a id="function-isgeneralizedcartanmatrix-algmatelt"></a>
#### `IsGeneralizedCartanMatrix(C): AlgMatElt -> BoolElt`

Whether the square matrix $C$ is a generalized Cartan matrix.

<a id="function-kacmoodyclass"></a>
#### `KacMoodyClass(C): AlgMatElt -> MonStgElt, ModMatRngElt`

The class of the indecomposable generalized Cartan matrix $C$. The first return value is a string, “a”, “b”, or “c”, corresponding to the three cases described in the introduction [Introduction](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/introduction.md#sectalgliekmintro). The second is a positive integral column vector $v$ such that $Cv$ is positive, 0, or negative, respectively (so this return value corresponds to the vectors $\theta$, $\delta$, and $\alpha$ in the introduction).

<a id="function-kacmoodyclasses-algmatelt"></a>
#### `KacMoodyClasses(C): AlgMatElt -> SeqEnum, SeqEnum, SeqEnum`

The class of the possibly decomposable generalized Cartan matrix $C$. Three sequences are returned: the first is a sequence of strings “a”, “b”, or “c”, describing the class of each component; the second is a positive integral vector $v$ such that $Cv$ is positive, 0, or negative, respectively (see [`KacMoodyClass`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/cartan.md#function-kacmoodyclass)).

The third sequence $Q$ contains integral sequences $Q_i$ such that the $i$-th component is formed by taking the rows and columns with index $j$, for $j \in Q_i$.

<a id="example-ex-89fcf7"></a>
#### `Example: Classifying Generalized Cartan Matrices (ex-89fcf7)`

First, we consider an indecomposable Cartan matrix.

```magma
> C := Matrix(Integers(), 3, 3, [2,-1,0, -5,2,-1, 0,-1,2]);
> s, v := KacMoodyClass(C);
> s;
c
> v;
[2]
[5]
[1]
> C*v;
[-1]
[-1]
[-3]
```

As a second example, we consider a decomposable Cartan matrix.

```magma
> C := CartanMatrix("B2 A~3");
> S, V, Q := KacMoodyClasses(C);
> S;
[ a, b ]
> Q;
[
    [ 1, 2 ],
    [ 3, 4, 5, 6 ]
]
> C1 := Submatrix(C, Q[1], Q[1]);
> KacMoodyClass(C1);
a
> C2 := Submatrix(C, Q[2], Q[2]);
> KacMoodyClass(C2);
b
```

<a id="affine-kac-moody-lie-algebras"></a>
<a id="affine"></a>
<a id="sectalgkacaff"></a>
### 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 [[Kac90](https://docs.magma-maths.org/references.md#cite-kac90)] (Chapters 7,8)). We briefly reiterate the construction here. Suppose $A$ is an affine Cartan matrix, so that $\mathfrak{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 $\mathfrak{g}_0$ be the finite variant (i.e., a Lie algebra of Cartan type X$_n$) then

$$
\mathfrak{g}(A) \cong \mathfrak{g}_0 \tensor {\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 $\mathfrak{g}_0$.

If we fix $E_i$, $F_i$ to be canonical generators of $g_0$, then the canonical generators of $\mathfrak{g}(A)$, as described in the introduction ([Introduction](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/introduction.md#sectalgliekmintro)) are given by $e_0 = t \tensor E_0$, $f_0 = t^{-1} \tensor F_0$, and $e_i = 1 \tensor E_i$, $f_i = 1 \tensor 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.

<a id="constructing-affine-kac-moody-lie-algebras"></a>
<a id="affine-construct"></a>
<a id="subsectalgkacaffconstruct"></a>
#### Constructing Affine Kac–Moody Lie Algebras

<a id="function-affineliealgebra-monstgelt-fld"></a>
##### `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](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff) for more information on the conventions, syntax, and functions for creating and working with affine Cartan matrices.

<a id="function-affineliealgebra-algmatelt-fld"></a>
##### `AffineLieAlgebra(C, F): AlgMatElt, Fld -> AlgKac`

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

<a id="example-ex-055fd7"></a>
##### `Example: Constructing Affine Kac-Moody Algebras (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
```

<a id="properties-of-affine-kac-moody-lie-algebras"></a>
<a id="affine-properties"></a>
<a id="subsectalgkacaffprops"></a>
#### Properties of Affine Kac–Moody Lie Algebras

<a id="function-cartanmatrix-algkac"></a>
##### `CartanMatrix(L): AlgKac -> AlgMatElt`

The Cartan matrix of $L$.

<a id="function-cartanname-algkac"></a>
##### `CartanName(L): AlgKac -> MonStgElt`

The Cartan type of $L$.

<a id="function-dimension-algkac"></a>
##### `Dimension(L): AlgKac -> Infty`

Infinity.

<a id="function-coefficientring-algkac"></a>
##### `CoefficientRing(L): AlgKac -> Rng`

<a id="function-basering-algkac"></a>
##### `BaseRing(L): AlgKac -> Rng`

The coefficient ring of $L$.

<a id="function-finiteliealgebra-algkac"></a>
##### `FiniteLieAlgebra(L): AlgKac -> AlgLie`

The Lie algebra $\mathfrak{g}_0$ underlying $L$ (see the Introduction, Section [Introduction](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/introduction.md#sectalgliekmintro)).

<a id="function-laurentseriesring-algkac"></a>
##### `LaurentSeriesRing(L): AlgKac -> RngSerLaur`

The Laurent series ring ${\bf C}[t, t^{-1}]$ underlying $L$ (see the Introduction, Section [Introduction](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/introduction.md#sectalgliekmintro)).

<a id="function-standardgenerators-algkac"></a>
##### `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.

<a id="example-ex-17cbd6"></a>
##### `Example: Properties of an Affine Lie Algebra (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
```

<a id="constructing-elements-of-affine-kac-moody-lie-algebras"></a>
<a id="affine-elts-constr"></a>
<a id="subsectalgkacaffeltsconstr"></a>
#### Constructing Elements of Affine Kac–Moody Lie Algebras

<a id="operation-operation-algkac-rngintelt-algkacelt"></a>
##### `L . i: AlgKac, RngIntElt -> AlgKacElt`

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

<a id="function-hasattribute-algkac-monstgelt-c"></a>
##### `HasAttribute(L, "c"): AlgKac, MonStgElt -> BoolElt, AlgKacElt`

<a id="function-hasattribute-algkac-monstgelt-d"></a>
##### `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`.

<a id="constructor-constructor-elt-algkac-tup-algkacelt"></a>
##### `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 \mathfrak{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`](https://docs.magma-maths.org/LieTheory/KacMoodyLieAlgebras/affine.md#function-kmaff-elttup) below for the converse function.

<a id="properties-of-elements-of-affine-kac-moody-lie-algebras"></a>
<a id="affine-elts-props"></a>
<a id="subsectalgkacaffeltsprops"></a>
#### Properties of Elements of Affine Kac–Moody Lie Algebras

<a id="function-kmaff-elttup"></a>
##### `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 \mathfrak{g}_0$, $t_2$ is the coefficient of $c$ and $t_3$ is the coefficient of $d$.

<a id="function-iszero-algkacelt"></a>
##### `IsZero(x): AlgKacElt -> BoolElt`

Whether $x$ is zero.

<a id="operation-op-eq-algkacelt-algkacelt"></a>
##### `x eq y: AlgKacElt, AlgKacElt -> BoolElt`

Whether $x$ and $y$ are equal.

<a id="operation-op-plus-algkacelt-algkacelt"></a>
##### `x + y: AlgKacElt, AlgKacElt -> AlgKacElt`

<a id="operation-op-minus-algkacelt-algkacelt"></a>
##### `x - y: AlgKacElt, AlgKacElt -> AlgKacElt`

<a id="operation-op-times-algkacelt-algkacelt"></a>
##### `x * y: AlgKacElt, AlgKacElt -> AlgKacElt`

<a id="operation-op-times-rngelt-algkacelt"></a>
##### `c * y: RngElt, AlgKacElt -> AlgKacElt`

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

<a id="operation-operation-algkacelt-algkacelt"></a>
##### `-x: AlgKacElt -> AlgKacElt`

The negation of $x$.

<a id="example-ex-1599ed"></a>
##### `Example: Elements of an Affine Lie Algebra (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
```

<a id="chap-quagrps"></a>
<a id="id1"></a>
## Quantum Groups

- [Introduction](https://docs.magma-maths.org/LieTheory/QuantumGroups/introduction.md)
- [Background](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md)
  - [Gaussian Binomials](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#gaussian-binomials)
  - [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantized-enveloping-algebras)
  - [Representations of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#representations-of-u-q-l)
  - [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbw-type-bases)
  - [The ${\mathbb{Z}}$-form of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#the-mathbb-z-form-of-u-q-l)
  - [The Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#the-canonical-basis)
  - [The Path Model](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#the-path-model)
- [Gauss Numbers](https://docs.magma-maths.org/LieTheory/QuantumGroups/gauss.md)
  - [`GaussNumber(n, v): RngIntElt, RngElt → RngElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/gauss.md#function-gaussnumber-rngintelt-rngelt)
  - [`GaussianFactorial(n, v): RngIntElt, RngElt → RngElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/gauss.md#function-gaussianfactorial-rngintelt-rngelt)
  - [`GaussianBinomial(n, k, v): RngIntElt, RngIntElt, RngElt → RngElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/gauss.md#function-gaussianbinomial-rngintelt-rngintelt-rngelt)
  - [Example: Gaussian Binomial Coefficients](https://docs.magma-maths.org/LieTheory/QuantumGroups/gauss.md#example-ex-331222)
- [Construction](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md)
  - [`QuantizedUEA(R): RootDtm → AlgQUE`](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#function-quantizeduea-rootdtm)
  - [`QuantizedUEAlgebra(R): RootDtm → AlgQUE`](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#function-quantizeduealgebra-rootdtm)
  - [`QuantizedUniversalEnvelopingAlgebra(R): RootDtm → AlgQUE`](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#function-quantizeduniversalenvelopingalgebra-rootdtm)
  - [Example: Constructing a Quantum Group](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#example-ex-578e8e)
  - [`AssignNames(U, S): AlgPBW, [ MonStgElt ]`](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#procedure-assignnames-algpbw-monstgelt)
  - [`ChangeRing(U, R): AlgQUE, Rng → AlgQUE`](https://docs.magma-maths.org/LieTheory/QuantumGroups/construct.md#function-changering-algque-rng)
- [Related Structures](https://docs.magma-maths.org/LieTheory/QuantumGroups/rel-struct.md)
  - [`CoefficientRing(U): AlgQUE → Fld`](https://docs.magma-maths.org/LieTheory/QuantumGroups/rel-struct.md#function-coefficientring-algque)
  - [`RootDatum(U): AlgQUE → RootDtm`](https://docs.magma-maths.org/LieTheory/QuantumGroups/rel-struct.md#function-rootdatum-algque)
  - [`PositiveRootsPerm(U): AlgQUE → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/rel-struct.md#function-positiverootsperm-algque)
  - [Example: Structures Related to a Quantum Group](https://docs.magma-maths.org/LieTheory/QuantumGroups/rel-struct.md#example-ex-3ae424)
- [Operations on Elements](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md)
  - [`x + y: AlgQUEElt, AlgQUEElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-plus-algqueelt-algqueelt)
  - [`x - y: AlgQUEElt, AlgQUEElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-minus-algqueelt-algqueelt)
  - [`x * y: AlgQUEElt, AlgQUEElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-times-algqueelt-algqueelt)
  - [`c * x: RngElt, AlgQUEElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-times-rngelt-algqueelt)
  - [`x * c: AlgQUEElt, RngElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-times-algqueelt-rngelt)
  - [`x ^ n: AlgQUEElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-pow-algqueelt-rngintelt)
  - [`U ! 0: AlgQUE, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-algque-rngintelt)
  - [`Zero(U): AlgQUE → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-zero-algque)
  - [`U ! 1: AlgQUE, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-algque-rngintelt-2)
  - [`One(U): AlgQUE → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-one-algque)
  - [`U . i: AlgQUE, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-operation-algque-rngintelt-algqueelt)
  - [`U ! r: AlgQUE, Any → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-algque-any)
  - [`KBinomial(U, i, s): AlgQUE, RngIntElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-kbinomial-algque-rngintelt-rngintelt)
  - [`KBinomial(K, s): AlgQUEElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-kbinomial-algqueelt-rngintelt)
  - [`Monomials(u): AlgQUEElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-monomials-algqueelt)
  - [`Coefficients(u): AlgQUEElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-coefficients-algqueelt)
  - [`K ^ -1: AlgQUEElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#operation-op-pow-algqueelt-rngintelt-2)
  - [`Degree(u, i): AlgQUEElt, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-degree-algqueelt-rngintelt)
  - [`KDegree(m, i): AlgQUEElt, RngIntElt → Tup`](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#function-kdegree-algqueelt-rngintelt)
  - [Example: Monomials and Coefficients of Quantum Group Elements](https://docs.magma-maths.org/LieTheory/QuantumGroups/elts-ops.md#example-ex-a73ba4)
- [Representations](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md)
  - [`HighestWeightRepresentation(U, w): AlgQUE, SeqEnum → UserProgram`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-highestweightrepresentation-algque-seqenum)
  - [`HighestWeightModule(U, w): AlgQUE, SeqEnum → ModTupAlg`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-highestweightmodule-algque-seqenum)
  - [Example: Highest Weight Representation of a Quantum Group](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#example-ex-723df4)
  - [`WeightsAndVectors(V): ModAlg → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-weightsandvectors-modalg)
  - [`HighestWeightsAndVectors(V): ModAlg → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-highestweightsandvectors-modalg)
  - [`CanonicalBasis(V): ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-canonicalbasis-modalg)
  - [Example: Canonical Basis of a Highest Weight Module](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#example-ex-36468d)
  - [`TensorProduct(Q): SeqEnum → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#function-tensorproduct-seqenum)
  - [Example: Tensor Product of Quantum Group Modules](https://docs.magma-maths.org/LieTheory/QuantumGroups/representations.md#example-ex-e51b84)
- [Hopf Algebra Structure](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md)
  - [`UseTwistedHopfStructure(U, f, g): AlgQUE, Map, Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#procedure-usetwistedhopfstructure-algque-map-map)
  - [`HasTwistedHopfStructure(U): AlgQUE → BoolElt, List`](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#function-hastwistedhopfstructure-algque)
  - [`Counit(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#function-counit-algque)
  - [`Antipode(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#function-antipode-algque)
  - [`Comultiplication(U, d): AlgQUE, RngIntElt → UserProgram`](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#function-comultiplication-algque-rngintelt)
  - [Example: Comultiplication of a Quantized Enveloping Algebra](https://docs.magma-maths.org/LieTheory/QuantumGroups/hopf-structure.md#example-ex-a3845c)
- [Automorphisms](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md)
  - [`BarAutomorphism(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-barautomorphism-algque)
  - [`AutomorphismOmega(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-automorphismomega-algque)
  - [`AntiAutomorphismTau(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-antiautomorphismtau-algque)
  - [`AutomorphismTalpha(U, k): AlgQUE, RngIntElt → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-automorphismtalpha-algque-rngintelt)
  - [`DiagramAutomorphism(U, p): AlgQUE, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-diagramautomorphism-algque-grppermelt)
  - [`GraphAutomorphism(U, p): AlgQUE, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#function-graphautomorphism-algque-grppermelt)
  - [Example: Automorphisms of a Quantum Group](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#example-ex-f34802)
- [Kashiwara Operators](https://docs.magma-maths.org/LieTheory/QuantumGroups/kashiwara-ops.md)
  - [`Falpha(m, i): AlgQUEElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/kashiwara-ops.md#function-falpha-algqueelt-rngintelt)
  - [`Ealpha(m, i): AlgQUEElt, RngIntElt → AlgQUEElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/kashiwara-ops.md#function-ealpha-algqueelt-rngintelt)
  - [Example: Kashiwara Operators on Monomials](https://docs.magma-maths.org/LieTheory/QuantumGroups/kashiwara-ops.md#example-ex-eb13a8)
- [The Path Model](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md)
  - [`DominantLSPath(R, hw): RootDtm, SeqEnum → PathLS`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-dominantlspath-rootdtm-seqenum)
  - [`Falpha(p, i): PathLS, RngIntElt → PathLS`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-falpha-pathls-rngintelt)
  - [`Ealpha(p, i): PathLS, RngIntElt → PathLS`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-ealpha-pathls-rngintelt)
  - [`WeightSequence(p): PathLS → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-weightsequence-pathls)
  - [`RationalSequence(p): PathLS → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-rationalsequence-pathls)
  - [`EndpointWeight(p): PathLS → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-endpointweight-pathls)
  - [`Shape(p): PathLS → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-shape-pathls)
  - [`WeylWord(p): PathLS → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-weylword-pathls)
  - [`IsZero(p): PathLS → BoolElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-iszero-pathls)
  - [`p1 eq p2: PathLS, PathLS → BoolElt`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#operation-op-eq-pathls-pathls)
  - [Example: LS Paths and Root Operators](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#example-ex-cccc8c)
  - [`CrystalGraph(R, hw): RootDtm, SeqEnum → GrphDir, SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#function-crystalgraph-rootdtm-seqenum)
  - [Example: Crystal Graph of a Representation](https://docs.magma-maths.org/LieTheory/QuantumGroups/path-model.md#example-ex-3f9751)
- [Elements of the Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/canbas.md)
  - [`CanonicalElements(U, w): AlgQUE, SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/QuantumGroups/canbas.md#function-canonicalelements-algque-seqenum)
  - [Example: Canonical Basis Elements](https://docs.magma-maths.org/LieTheory/QuantumGroups/canbas.md#example-ex-60f4ee)
  - [Example: Canonical Basis and Crystal Graphs](https://docs.magma-maths.org/LieTheory/QuantumGroups/canbas.md#example-ex-7c2231)
- [Homomorphisms to the Universal Enveloping Algebra](https://docs.magma-maths.org/LieTheory/QuantumGroups/q.md)
  - [`QUAToIntegralUEAMap(U): AlgQUE → Map`](https://docs.magma-maths.org/LieTheory/QuantumGroups/q.md#function-quatointegralueamap-algque)
  - [Example: Map to the Integral Enveloping Algebra](https://docs.magma-maths.org/LieTheory/QuantumGroups/q.md#example-ex-08caa9)
- [Bibliography](https://docs.magma-maths.org/LieTheory/QuantumGroups/bibliography.md)

### Introduction

This chapter describes the functionality for quantum groups in Magma. First there are a few sections that briefly describe the theoretical background behind quantum groups (or, more precisely, quantized enveloping algebras). This fixes the notation and the terminology that we use (these vary somewhat in the literature). For this we mainly follow [[Jan96](https://docs.magma-maths.org/references.md#cite-jantzen96)]. In the remainder we describe the functions that exist in Magma for constructing and working with quantum groups and their representations.

In Magma, quantized enveloping algebras have type `AlgQUE` and their elements have type `AlgQUEElt`. These types inherit from `AlgPBW` and `AlgPBWElt` respectively, which are general types for algebras with a PBW basis and their elements and inherit from `GenMPolB`, `Alg` and `Rng` and their element types.

### Background

#### Gaussian Binomials

Let $v$ be an indeterminate over ${\mathbb{Q}}$. For a positive integer $n$ we set

$$
[n]_v = v^{n-1}+v^{n-3}+\cdots + v^{-n+3}+v^{-n+1}.
$$

We say that $[n]_v$ is the *Gaussian integer* corresponding to $n$. The *Gaussian factorial* $[n]_v!$ is defined by

$$
[0]_v! = 1, ~ [n]_v! = [n]_v[n-1]_v\cdots [1]_v {\rm ~for~ } n >0.
$$

Finally, the *Gaussian binomial* is

$$
{n \choose k}_v  = {[n]! \over [k]![n-k]!}.
$$

<a id="quantizeduea"></a>
#### Quantized Enveloping Algebras

Let $L$ be a semisimple Lie algebra with root system $\Phi$. By $\Delta=\{\alpha_1,\ldots, \alpha_l \}$ we denote a fixed set of simple roots of $\Phi$. Let $C=(C_{ij})$ be the Cartan matrix of $\Phi$ (with respect to $\Delta$, i.e., $C_{ij} = \langle \alpha_i, \alpha_j^{\vee} \rangle$). Let $d_1,\ldots, d_l$ be the unique sequence of positive integers with greatest common divisor $1$, such that $d_i C_{ji} = d_j C_{ij}$, and set $(\alpha_i,\alpha_j) = d_j C_{ij}$. (We note that this implies that $(\alpha_i,\alpha_i)$ is divisible by $2$.) By $P$ we denote the weight lattice, and we extend the form $(~,~)$ to $P$ by bilinearity.

By $W(\Phi)$ we denote the Weyl group of $\Phi$. It is generated by the simple reflections $s_i=s_{\alpha_i}$ for $1\leq i\leq l$ (where $s_{\alpha}$ is defined by $s_{\alpha}(\beta) = \beta - \langle\beta, \alpha^{\vee}\rangle \alpha$).

We work over the field ${\mathbb{Q}}(q)$. For $\alpha\in\Phi$ we set

$$
q_{\alpha} = q^{{(\alpha,\alpha)\over 2}},
$$

and for a non-negative integer $n$, $[n]_{\alpha}= [n]_{v=q_{\alpha}}$; $[n]_{\alpha}!$ and ${n \choose k }_{\alpha}$ are defined analogously.

The quantized enveloping algebra $U_q(L)$ is the associative algebra (with one) over ${\mathbb{Q}}(q)$ generated by $F_{\alpha}$, $K_{\alpha}$, $K_{\alpha}^{-1}$, $E_{\alpha}$ for $\alpha\in\Delta$, subject to the following relations

$$
\begin{aligned}K_{\alpha}K_{\alpha}^{-1} &= K_{\alpha}^{-1}K_{\alpha} = 1,~
K_{\alpha}K_{\beta} = K_{\beta}K_{\alpha}\\
E_{\beta} K_{\alpha} &= q^{-(\alpha,\beta)}K_{\alpha} E_{\beta}\\
K_{\alpha} F_{\beta} &= q^{-(\alpha,\beta)}F_{\beta}K_{\alpha}\\
E_{\alpha} F_{\beta} &= F_{\beta}E_{\alpha} +\delta_{\alpha,\beta}
{K_{\alpha}-K_{\alpha}^{-1} \over q_{\alpha}-q_{\alpha}^{-1}}\end{aligned}
$$

together with, for $\alpha\neq \beta\in\Delta$,

$$
\begin{aligned}\sum_{k=0}^{1-\langle \beta,\alpha^{\vee}\rangle }
(-1)^k {1-\langle \beta,\alpha^{\vee}\rangle \choose k}_{\alpha}
E_{\alpha}^{1-\langle \beta,\alpha^{\vee}\rangle-k}
E_{\beta} E_{\alpha}^k =0 & \\
\sum_{k=0}^{1-\langle \beta,\alpha^{\vee}\rangle } (-1)^k
{1-\langle \beta,\alpha^{\vee}\rangle \choose k}_{\alpha}
F_{\alpha}^{1-\langle \beta,\alpha^{\vee}\rangle-k}
F_{\beta} F_{\alpha}^k =0 &.\end{aligned}
$$

The quantized enveloping algebra has an automorphism $\omega$ defined by $\omega(F_{\alpha}) = E_{\alpha}$, $\omega(E_{\alpha})= F_{\alpha}$, and $\omega(K_{\alpha})=K_{\alpha}^{-1}$. Also there is an anti-automorphism $\tau$ defined by $\tau(F_{\alpha})=F_{\alpha}$, $\tau(E_{\alpha})= E_{\alpha}$ and $\tau(K_{\alpha})=K_{\alpha}^{-1}$. We have $\omega^2=1$ and $\tau^2=1$.

If the Dynkin diagram of $\Phi$ admits a diagram automorphism $\pi$, then $\pi$ induces an automorphism of $U_q(L)$ in the obvious way ($\pi$ is a permutation of the simple roots; we permute the $F_{\alpha}$, $E_{\alpha}$, $K_{\alpha}^{\pm 1}$ accordingly).

Now we view $U_q(L)$ as an algebra over ${\mathbb{Q}}$, and we let $\overline{\phantom{A}} : U_q(L)\to U_q(L)$ be the automorphism defined by $\overline{F_{\alpha}}=F_{\alpha}$, $\overline{K_{\alpha}}= K_{\alpha}^{-1}$, $\overline{E_{\alpha}}=E_{\alpha}$, $\overline{q}=q^{-1}$. This map is called the *bar-automorphism*.

<a id="representations-of-u-q-l"></a>
<a id="qgrpreps"></a>
#### Representations of $U_q(L)$

Let $\lambda\in P$ be a dominant weight. Then there is a unique irreducible highest-weight module over $U_q(L)$ with highest weight $\lambda$. We denote it by $V(\lambda)$. It has the same character as the irreducible highest-weight module over $L$ with highest weight $\lambda$. Furthermore, every finite-dimensional $U_q(L)$-module is a direct sum of irreducible highest-weight modules. In [[Gra04](https://docs.magma-maths.org/references.md#cite-graaf04)] a few algorithms for constructing $V(\lambda)$ are given. In the Magma implementation the algorithm based on Gröbner bases is used.

It is well-known that $U_q(L)$ is a Hopf algebra. The comultiplication $\Delta : U_q(L)\to U_q(L) \otimes U_q(L)$ is defined by

$$
\begin{aligned}\Delta(E_{\alpha}) &= E_{\alpha}\otimes 1 + K_{\alpha}\otimes E_{\alpha}\\
\Delta(F_{\alpha}) &= F_{\alpha}\otimes K_{\alpha}^{-1} +
1\otimes F_{\alpha}\\
\Delta(K_{\alpha}) &= K_{\alpha}\otimes K_{\alpha}.\end{aligned}
$$

(Note that we use the same symbol ($\Delta$) to denote a set of simple roots of $\Phi$; of course this does not cause confusion.) The counit $\varepsilon : U_q(L) \to {\mathbb{Q}}(q)$ is a homomorphism defined by $\varepsilon(E_{\alpha})=\varepsilon(F_{\alpha})=0$, $\varepsilon(K_{\alpha}) =1$. Finally, the antipode $S: U_q(L)\to U_q(L)$ is an anti-automorphism given by $S(E_{\alpha})=-K_{\alpha}^{-1}E_{\alpha}$, $S(F_{\alpha})=-F_{\alpha} K_{\alpha}$, $S(K_{\alpha})=K_{\alpha}^{-1}$.

Using $\Delta$ we can make the tensor product $V\otimes W$ of two $U_q(L)$-modules $V,W$ into a $U_q(L)$-module. The counit $\varepsilon$ yields a trivial $1$-dimensional $U_q(L)$-module. And with $S$ we can define a $U_q(L)$-module structure on the dual $V^*$ of a $U_q(L)$-module $V$, by $(u\cdot f)(v) = f(S(u)\cdot v)$.

The Hopf algebra structure given above is not the only one possible. For example, we can twist $\Delta,\varepsilon,S$ by an automorphism, or an anti-automorphism $f$. The twisted comultiplication is given by

$$
\Delta^f = f\otimes f \circ\Delta\circ f^{-1},
$$

the twisted antipode by

$$
S^f = f\circ S\circ f^{-1},
$$

if $f$ is an automorphism, and

$$
S^f = f\circ S^{-1}\circ f^{-1},
$$

if $f$ is an anti-automorphism. The twisted counit is given by $\varepsilon^f = \varepsilon\circ f^{-1}$.

<a id="pbwbases"></a>
#### PBW-type Bases

The first problem one has to deal with when working with $U_q(L)$ is finding a basis of it, along with an algorithm for expressing the product of two basis elements as a linear combination of basis elements. First of all we have that $U_q(L)\cong U^-\otimes U^0\otimes U^+$ (as vector spaces), where $U^-$ is the subalgebra generated by the $F_{\alpha}$, $U^0$ is the subalgebra generated by the $K_{\alpha}$, and $U^+$ is generated by the $E_{\alpha}$. So a basis of $U_q(L)$ is formed by all elements $FKE$, where $F$, $K$, $E$ run through bases of $U^-$, $U^0$, $U^+$ respectively.

Finding a basis of $U^0$ is easy: it is spanned by all $K_{\alpha_1}^{r_1} \cdots K_{\alpha_l}^{r_l}$, where $r_i\in {\mathbb{Z}}$. For $U^-$ and $U^+$ we use the so-called *PBW-type* bases. They are defined as follows. For $\alpha,\beta\in\Delta$ we set $r_{\beta,\alpha} = -\langle \beta, \alpha^{\vee}\rangle$. Then for $\alpha\in\Delta$ we have the automorphism $T_{\alpha} : U_q(L)\to U_q(L)$ defined by

$$
\begin{aligned}T_{\alpha}(E_{\alpha}) &= -F_{\alpha}K_{\alpha}\\
T_{\alpha}(E_{\beta}) &= \sum_{i=0}^{r_{\beta,\alpha}}
(-1)^i q_{\alpha}^{-i} E_{\alpha}^{(r_{\beta,\alpha}-i)}E_{\beta}
E_{\alpha}^{(i)},\ (\alpha\neq\beta)\\
T_{\alpha}(K_{\beta}) &= K_{\beta}K_{\alpha}^{r_{\beta,\alpha}}\\
T_{\alpha}(F_{\alpha}) &= -K_{\alpha}^{-1} E_{\alpha}\\
T_{\alpha}(F_{\beta}) &= \sum_{i=0}^{r_{\beta,\alpha}}
(-1)^i q_{\alpha}^{i} F_{\alpha}^{(i)}F_{\beta}F_{\alpha}^
{(r_{\beta,\alpha}-i)},\ (\alpha\neq\beta)\end{aligned}
$$

(where $E_{\alpha}^{(k)} = E_{\alpha}^k/[k]_{\alpha}!$, and likewise for $F_{\alpha}^{(k)}$).

Let $w_0=s_{i_1}\cdots s_{i_t}$ be a reduced expression for the longest element in the Weyl group $W(\Phi)$. For $1\leq k\leq t$ set $F_k = T_{\alpha_{i_1}}\cdots T_{\alpha_{i_{k-1}}}(F_{\alpha_{i_k}})$, and $E_k = T_{\alpha_{i_1}}\cdots T_{\alpha_{i_{k-1}}}(E_{\alpha_{i_k}})$. Then $F_k\in U^-$, and $E_k\in U^+$. Furthermore, the elements $F_1^{m_1} \cdots F_t^{m_t}$, $E_1^{n_1}\cdots E_t^{n_t}$ (where the $m_i$, $n_i$ are non-negative integers) form bases of $U^-$ and $U^+$ respectively.

The elements $F_{\alpha}$ and $E_{\alpha}$ are said to have weight $-\alpha$ and $\alpha$ respectively, where $\alpha$ is a simple root. Furthermore, the weight of a product $ab$ is the sum of the weights of $a$ and $b$. Now elements of $U^-$, $U^+$ that are linear combinations of elements of the same weight are said to be homogeneous. It can be shown that the elements $F_k$, and $E_k$ are homogeneous of weight $-\beta$ and $\beta$ respectively, where $\beta=s_{i_1}\cdots s_{i_{k-1}}(\alpha_{i_k})$.

In the following we use the notation $F_k^{(m)} = F_k^m/[m]_{\alpha_{i_k}}!$, and $E_k^{(n)} = E_k^n/[n]_{\alpha_{i_k}}!$.

We refer to [[Gra01](https://docs.magma-maths.org/references.md#cite-graaf01)] for an account of algorithms for expressing the product of two elements of a PBW-type basis as a linear combination of such elements. These algorithms are implemented in Magma.

<a id="the-mathbb-z-form-of-u-q-l"></a>
<a id="zform"></a>
#### The ${\mathbb{Z}}$-form of $U_q(L)$

For $\alpha\in\Delta$ set

$$
{K_{\alpha} \choose n } = \prod_{i=1}^n
{q_{\alpha}^{-i+1}K_{\alpha} - q_{\alpha}^{i-1} K_{\alpha}^{-1}\over
q_{\alpha}^i-q_{\alpha}^{-i}}.
$$

Then according to [[Lus90](https://docs.magma-maths.org/references.md#cite-lusztig90)], Theorem 6.7 the elements

$$
F_1^{(k_1)}\cdots F_t^{(k_t)} K_{\alpha_1}^{\delta_1}
{K_{\alpha_1} \choose m_1 }
\cdots K_{\alpha_l}^{\delta_l}
{K_{\alpha_l} \choose m_l }
E_1^{(n_1)}\cdots E_t^{(n_t)},
$$

(where $k_i,m_i,n_i\geq 0$, $\delta_i=0,1$) form a basis of $U_q(L)$, such that the product of any two basis elements is a linear combination of basis elements with coefficients in ${\mathbb{Z}}[q,q^{-1}]$. The quantized enveloping algebra over ${\mathbb{Z}}[q,q^{-1}]$ with this basis is called the ${\mathbb{Z}}$-form of $U_q(L)$, and denoted by $U_{{\mathbb{Z}}}$. Since $U_{{\mathbb{Z}}}$ is defined over ${\mathbb{Z}}[q,q^{-1}]$ we can specialize $q$ to any nonzero element $\epsilon$ of a field $F$, and obtain an algebra $U_{\epsilon}$ over $F$. In particular, if we take $\epsilon = 1$, then we obtain an algebra $U_1$ over ${\mathbb{Q}}$. Let $I$ be the ideal of $U_1$ generated by $K_{\alpha_1}-1,\ldots, K_{\alpha_l}-1$. Then $U_1/I$ is isomorphic to the universal enveloping algebra $U(L)$ of $L$. Also, the homomorphism $U_q(L) \to U(L)$ maps the basis above onto an integral basis of $U(L)$ ([[Lus90](https://docs.magma-maths.org/references.md#cite-lusztig90)]).

We call $q\in {\mathbb{Q}}(q)$, and $\epsilon \in F$ the quantum parameter of $U_q(L)$ and $U_{\epsilon}$ respectively.

<a id="canbas"></a>
#### The Canonical Basis

As in Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases) we let $U^-$ be the subalgebra of $U_q(L)$ generated by the $F_{\alpha}$ for $\alpha\in\Delta$. Kashiwara and Lusztig have (independently) given constructions of a basis of $U^-$ with very nice properties, called the *canonical basis*.

Let $w_0=s_{i_1}\cdots s_{i_t}$, and the elements $F_k$ be as in Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases). Then, in order to stress the dependency of the monomial

$$
F_1^{(n_1)}\cdots F_t^{(n_t)}
$$

on the choice of reduced expression for the longest element in $W(\Phi)$ we say that it is a $w_0$-monomial. The integer $n_1$ is called its first exponent.

Now we let $\overline{\phantom{a}}$ be the automorphism of $U^-$ defined in Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea). Elements that are invariant under $\overline{\phantom{a}}$ are said to be bar-invariant.

By results of Lusztig ([[Lus93](https://docs.magma-maths.org/references.md#cite-lusztig93)], Theorem 42.1.10, [[Lus96](https://docs.magma-maths.org/references.md#cite-lusztig96)], Proposition 8.2), there is a unique basis ${\bf B}$ of $U^-$ with the following properties. Firstly, all elements of ${\bf B}$ are bar-invariant. Secondly, for any choice of reduced expression $w_0$ for the longest element in the Weyl group, and any element $X\in{\bf B}$ we have that $X = x +\sum_i \zeta_i x_i$, where $x,x_i$ are $w_0$-monomials, $x\neq x_i$ for all $i$, and $\zeta_i\in q{\mathbb{Z}}[q]$. The basis ${\bf B}$ is called the canonical basis. If we work with a fixed reduced expression for the longest element in $W(\Phi)$, and write $X\in{\bf B}$ as above, then we say that $x$ is the *principal monomial* of $X$.

Let ${\cal L}$ be the ${\mathbb{Z}}[q]$-lattice in $U^-$ spanned by **B**. Then ${\cal L}$ is also spanned by all $w_0$-monomials (where $w_0$ is a fixed reduced expression for the longest element in $W(\Phi)$).

Now let $\widetilde{w}_0$ be a second reduced expression for the longest element in $W(\Phi)$. Let $x$ be a $w_0$-monomial, and let $X$ be the element of **B** with principal monomial $x$. Write $X$ as a linear combination of $\widetilde{w}_0$-monomials, and let $\widetilde{x}$ be the principal monomial of that expression. Then we write $\widetilde{x} = R_{w_0}^{\tilde{w}_0}(x)$. Note that $x = \widetilde{x} \bmod q{\cal L}$.

Now let ${\cal B}$ be the set of all $x \bmod q{\cal L}$, where $x$ runs through the set of $w_0$-monomials. Then ${\cal B}$ is a basis of the ${\mathbb{Z}}$-module ${\cal L}/q{\cal L}$. Moreover, ${\cal B}$ is independent of the choice of $w_0$. Let $\alpha\in\Delta$, and let $\widetilde{w}_0$ be a reduced expression for the longest element in $W(\Phi)$, starting with $s_{\alpha}$. The Kashiwara operators $\widetilde{F}_{ \alpha} : {\cal B}\to {\cal B}$ and $\widetilde{E}_{\alpha} : {\cal B}\to {\cal B}\cup\{0\}$ are defined as follows. Let $b\in{\cal B}$ and let $x$ be the $w_0$-monomial such that $b = x \bmod q{\cal L}$. Set $\widetilde{x} = R_{w_0}^ {\tilde{w}_0}(x)$. Let $\widetilde{x}'$ be the $\widetilde{w}_0$-monomial constructed from $\widetilde{x}$ by increasing its first exponent by $1$. Then $\widetilde{F}_{ \alpha}(b) = R_{\tilde{w}_0}^{w_0}(\widetilde{x}') \bmod q{\cal L}$. For $\widetilde{E}_{\alpha}$ we let $\widetilde{x}'$ be the $\widetilde{w}_0$-monomial constructed from $\widetilde{x}$ by decreasing its first exponent by $1$, if this exponent is $\geq 1$. Then $\widetilde{E}_{\alpha}(b) = R_{\tilde{w}_0}^{w_0}(\widetilde{x}')\bmod q{\cal L}$. Furthermore, $\widetilde{E}_{\alpha}(b) =0$ if the first exponent of $\widetilde{x}$ is $0$. It can be shown that this definition does not depend on the choice of $w_0$, $\widetilde{w}_0$. Furthermore we have $\widetilde{F}_{\alpha}\widetilde{E}_{\alpha}(b)=b$, if $\widetilde{E}_{\alpha}(b)\neq 0$, and $\widetilde{E}_{\alpha} \widetilde{F}_ {\alpha}(b)=b$ for all $b\in {\cal B}$.

Now let $V(\lambda)$ be a highest-weight module over $U_q(L)$, with highest weight $\lambda$. Let $v_{\lambda}$ be a fixed highest weight vector. Then ${\bf B}_{\lambda} = \{ X\cdot v_{\lambda}\mid X\in {\bf B}\} \setminus \{0\}$ is a basis of $V(\lambda)$, called the *canonical basis* of $V(\lambda)$. Let ${\cal L}(\lambda)$ be the ${\mathbb{Z}}[q]$-lattice in $V(\lambda)$ spanned by ${\bf B}_{\lambda}$. We let ${\cal B}({\lambda})$ be the set of all $x\cdot v_{\lambda}\bmod q{\cal L}(\lambda)$, where $x$ runs through all $w_0$-monomials, such that $X\cdot v_{\lambda} \neq 0$, where $X\in {\bf B}$ is the element with principal monomial $x$. Then the Kashiwara operators are also viewed as maps ${\cal B}(\lambda)\to {\cal B}(\lambda)\cup\{0\}$, in the following way. Let $b=x\cdot v_{\lambda}\bmod q{\cal L}(\lambda)$ be an element of ${\cal B}(\lambda)$, and let $b'=x\bmod q{\cal L}$ be the corresponding element of ${\cal B}$. Let $y$ be the $w_0$-monomial such that $\widetilde{F}_{\alpha}(b')=y\bmod q{\cal L}$. Then $\widetilde{F}_{ \alpha}(b) = y\cdot v_{\lambda} \bmod q{\cal L}(\lambda)$. The description of $\widetilde{E}_{\alpha}$ is analogous. (In [[Jan96](https://docs.magma-maths.org/references.md#cite-jantzen96)], Chapter 9 a different definition is given; however, by [[Jan96](https://docs.magma-maths.org/references.md#cite-jantzen96)], Proposition 10.9, Lemma 10.13, the two definitions agree).

The set ${\cal B}(\lambda)$ has $\dim V(\lambda)$ elements. We let $\Gamma$ be the coloured directed graph defined as follows. The points of $\Gamma$ are the elements of ${\cal B}(\lambda)$, and there is an arrow with colour $\alpha\in\Delta$ connecting $b,b'\in {\cal B}$, if $\widetilde{F}_{\alpha}(b)=b'$. The graph $\Gamma$ is called the *crystal graph* of $V(\lambda)$.

In [[Gra02](https://docs.magma-maths.org/references.md#cite-graaf02)] algorithms are given for computing the action of the Kashiwara operators on ${\cal B}$ (without computing **B** first), and for computing elements of **B**.

<a id="pathmodel"></a>
#### The Path Model

In this section we recall some basic facts on Littelmann’s path model.

From Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea) we recall that $P$ denotes the weight lattice. Let $P_{R}$ be the vector space over $R$ spanned by $P$. Let $\Pi$ be the set of all piecewise linear paths $\xi : [0,1]\to P_R$, such that $\xi(0)=0$. For $\alpha\in\Delta$ Littelmann defined *path operators* $f_{\alpha}, e_{\alpha} : \Pi \to \Pi\cup \{0\}$. Let $\lambda$ be a dominant weight and let $\xi_{\lambda}$ be the path joining $\lambda$ and the origin by a straight line. Let $\Pi_{\lambda}$ be the set of all nonzero $f_{\alpha_{i_1}}\cdots f_{\alpha_{i_m}}(\xi_{\lambda})$ for $m\geq 0$. Then $\xi(1)\in P$ for all $\xi\in \Pi_{\lambda}$. Let $\mu\in P$ be a weight, and let $V(\lambda)$ be the highest-weight module over $U_q(L)$ of highest weight $\lambda$. A theorem of Littelmann states that the number of paths $\xi\in \Pi_{\lambda}$ such that $\xi(1)=\mu$ is equal to the dimension of the weight space of weight $\mu$ in $V(\lambda)$ ([[Lit95](https://docs.magma-maths.org/references.md#cite-littelmann95)], Theorem 9.1).

All paths appearing in $\Pi_{\lambda}$ are so-called Lakshmibai–Seshadri paths (LS-paths for short). They are defined as follows. Let $\leq$ denote the Bruhat order on $W(\Phi)$. For $\mu,\nu\in W(\Phi)\cdot \lambda$ (the orbit of $\lambda$ under the action of $W(\Phi)$), write $\mu\leq \nu$ if $\tau\leq\sigma$, where $\tau,\sigma\in W(\Phi)$ are the unique elements of minimal length such that $\tau(\lambda)=\mu$, $\sigma(\lambda)= \nu$. Now a rational path of shape $\lambda$ is a pair $\pi=(\nu,a)$, where $\nu=(\nu_1,\ldots, \nu_s)$ is a sequence of elements of $W(\Phi)\cdot \lambda$, such that $\nu_i> \nu_{i+1}$ and $a=(a_0=0, a_1, \cdots ,a_s=1)$ is a sequence of rationals such that $a_i < a_{i+1}$. The path $\pi$ corresponding to these sequences is given by

$$
\pi(t) =\sum_{j=1}^{r-1} (a_j-a_{j-1})\nu_j + \nu_r(t-a_{r-1})
$$

for $a_{r-1}\leq t\leq a_r$. Now an LS-path of shape $\lambda$ is a rational path satisfying a certain integrality condition (see [[Lit94b](https://docs.magma-maths.org/references.md#cite-littelmann94)], [[Lit95](https://docs.magma-maths.org/references.md#cite-littelmann95)]). We note that the path $\xi_{\lambda} = ((\lambda), (0,1))$ joining the origin and $\lambda$ by a straight line is an LS-path of shape $\lambda$. Furthermore, all paths obtained from $\xi_{\lambda}$ by applying the path operators are LS-paths of shape $\lambda$.

From [[Lit94b](https://docs.magma-maths.org/references.md#cite-littelmann94)], [[Lit95](https://docs.magma-maths.org/references.md#cite-littelmann95)]) we transcribe the following:

**(a)**
Let $\pi$ be an LS-path. Then $f_{\alpha}\pi$ is an LS-path or $0$; and the same holds for $e_{\alpha}\pi$.

**(b)**
The action of $f_{\alpha},e_{\alpha}$ can easily be described combinatorially (see [[Lit94b](https://docs.magma-maths.org/references.md#cite-littelmann94)]).

**(c)**
The endpoint of an LS-path is an integral weight.

**(d)**
Let $\pi=(\nu,a)$ be an LS-path. Then by $\phi(\pi)$ we denote the unique element $\sigma$ of $W(\Phi)$ of shortest length such that $\sigma(\lambda)=\nu_1$.

Let $\lambda$ be a dominant weight. Then we define a labeled directed graph $\Gamma$ as follows. The points of $\Gamma$ are the paths in $\Pi_{\lambda}$. There is an edge with label $\alpha\in\Delta$ from $\pi_1$ to $\pi_2$ if $f_{\alpha}\pi_1 =\pi_2$. Now by [[Kas96](https://docs.magma-maths.org/references.md#cite-kashiwara96)] this graph $\Gamma$ is isomorphic to the crystal graph of the highest-weight module with highest weight $\lambda$. So the path model provides an efficient way of computing the crystal graph of a highest-weight module, without constructing the module first. Also we see that $f_{\alpha_{i_1}}\cdots f_{\alpha_{i_r}}\xi_{\lambda} =0$ is equivalent to $\widetilde{F}_{\alpha_{i_1}}\cdots \widetilde{F}_ {\alpha_{i_r}}v_{\lambda}=0$, where $v_{\lambda}\in V(\lambda)$ is a highest weight vector (or rather the image of it in ${\cal L}(\lambda)/ q{\cal L} (\lambda)$), and the $\widetilde{F}_{\alpha_k}$ are the Kashiwara operators on ${\cal B}(\lambda)$ (see Section [The Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#canbas)).

<a id="gauss"></a>
<a id="sectalgqeagauss"></a>
### Gauss Numbers

<a id="function-gaussnumber-rngintelt-rngelt"></a>
#### `GaussNumber(n, v): RngIntElt, RngElt -> RngElt`

Given an integer $n$ and a ring element $v$, this function returns the Gauss number corresponding to $n$ with parameter $v$, i.e., the element $[n]_v = v^{n-1}+v^{n-3}+\cdots + v^{-n+3}+v^{-n+1}$.

<a id="function-gaussianfactorial-rngintelt-rngelt"></a>
#### `GaussianFactorial(n, v): RngIntElt, RngElt -> RngElt`

Given an integer $n$ and a ring element $v$, this function returns the Gaussian factorial corresponding to $n$ with parameter $v$, i.e., the element $[n]_v! = [n]_v[n-1]_v\cdots [1]_v$.

<a id="function-gaussianbinomial-rngintelt-rngintelt-rngelt"></a>
#### `GaussianBinomial(n, k, v): RngIntElt, RngIntElt, RngElt -> RngElt`

Given an integer $n$, an integer $k$, and a ring element $v$, this function returns the Gaussian binomial $n$ choose $k$ with parameter $v$, i.e., the element $[n]_v!/([k]_v![n-k]_v!)$.

<a id="example-ex-331222"></a>
#### `Example: Gaussian Binomial Coefficients (ex-331222)`

```magma
> F<q>:= RationalFunctionField(Rationals());
> GaussianBinomial(5, 3, q^2);
(q^24 + q^20 + 2*q^16 + 2*q^12 + 2*q^8 + q^4 + 1)/q^12
```

<a id="construct"></a>
<a id="sectalgqeaconstrqgrp"></a>
### Construction

<a id="function-quantizeduea-rootdtm"></a>
#### `QuantizedUEA(R): RootDtm -> AlgQUE`

<a id="function-quantizeduealgebra-rootdtm"></a>
#### `QuantizedUEAlgebra(R): RootDtm -> AlgQUE`

<a id="function-quantizeduniversalenvelopingalgebra-rootdtm"></a>
#### `QuantizedUniversalEnvelopingAlgebra(R): RootDtm -> AlgQUE`

```magma
w0: SeqEnum                    Default: 
```

This creates the quantized enveloping algebra $U$ corresponding to the root datum $R$. The algebra $U$ will be defined over the rational function field in one variable, $q$, over the rational numbers.

Let $n$ and $r$ respectively be the number of positive roots, and the rank of $R$. Then $U$ has $2n+r$ generators, accessible as `U.1`, `U.2` and so on. The first $n$ of these are printed as `F_1`, $\ldots$ , `F_n`. They generate a PBW-type basis of the subalgebra $U^-$ (cf. Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases)). The next $r$ generators are printed as `K_1`, $\ldots$ , `K_r`; together with their inverses they generate the algebra $U^0$. The final $n$ generators are printed as `E_1`, $\ldots$ , `E_n`. They generate a PBW-type basis of $U^+$.

In $U$ we use a basis of the integral form of $U$ (Section [The ${\mathbb{Z}}$-form of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#zform)). This means that instead of $F_k^s$ and $E_k^s$ we use the divided powers $F_k^{(s)}$ and $E_k^{(s)}$. Furthermore, a general basis element of $U^0$ is a product of elements which are of the form $[ K_i ; t ]$, or $K_i[ K_i ; t ]$. Here $[ K_i ; t ]$ represents the “binomial” $K_i$ choose $t$ as described in Section [The ${\mathbb{Z}}$-form of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#zform).

It is also possible to give a reduced expression for the longest element in the Weyl group, by setting the optional parameter `w0` equal to a sequence of indices lying between $1$ and the rank of $R$. If we replace each index by the corresponding simple reflection, then a reduced expression for the longest element in the Weyl group has to be obtained. In that case the PBW-basis relative to that sequence will be created (and used in subsequent computations). If this parameter is not given, then the lexicographically smallest reduced expression will be used.

<a id="example-ex-578e8e"></a>
#### `Example: Constructing a Quantum Group (ex-578e8e)`

We construct the quantum group corresponding to the root datum of type $C_3$.

```magma
> R:= RootDatum("C3");
> U:= QuantizedUEA(R);
> U.9; U.10; U.15;
F_9
K_1
E_3
> U.21*U.14*U.10*U.9*U.1;
1/q*F_1*F_9*K_1*E_2*E_9 - 1/q*F_1*F_9*K_1*E_6 + 1/q^3*F_1*K_1*[ K_3 ; 1 ]*E_2 -
    F_9*E_3*E_9 + F_9*E_8 - 1/q^2*[ K_3 ; 1 ]*E_3
```

Now we construct the same algebra, but use the PBW-basis relative to a different reduced expression of the longest element in the Weyl group.

```magma
> U:= QuantizedUEA(R : w0:= [2,3,1,2,3,1,2,3,1]);
> U.21*U.14*U.10*U.9*U.1;
q^2*F_1*F_9*K_1*E_2*E_9 + (q^2 - 1)/q^3*F_9*K_1*[ K_2 ; 1 ]*E_6*E_9 -
    1/q^2*F_9*K_1*K_2*E_6*E_9 - q^2*F_1*F_9*K_1*E_4 + q^2*F_1*K_1[ K_1 ; 1 ]*E_2 +
    q*F_3*K_1*E_2*E_9 + (-q^2 + 1)/q^3*F_9*K_1*[ K_2 ; 1 ]*E_7 +
    1/q^2*F_9*K_1*K_2*E_7 + (q^2 - 1)/q*K_1[ K_1 ; 1 ]*[ K_2 ; 1 ]*E_6
    - K_1[ K_1 ; 1 ]*K_2*E_6 - q*F_3*K_1*E_4 + q*F_1*E_2
```

<a id="procedure-assignnames-algpbw-monstgelt"></a>
#### `AssignNames(U, S): AlgPBW, [ MonStgElt ]`

Assign the names in the sequence $S$ to the generators of the algebra $U$.

<a id="function-changering-algque-rng"></a>
#### `ChangeRing(U, R): AlgQUE, Rng -> AlgQUE`

Return the algebra identical to the algebra $U$ but having coefficient ring $R$.

<a id="rel-struct"></a>
<a id="sectalgqearelstr"></a>
### Related Structures

<a id="function-coefficientring-algque"></a>
#### `CoefficientRing(U): AlgQUE -> Fld`

This returns the ring of coefficients of the quantized enveloping algebra $U$.

<a id="function-rootdatum-algque"></a>
#### `RootDatum(U): AlgQUE -> RootDtm`

This returns the root datum corresponding to the quantized enveloping algebra $U$.

<a id="function-positiverootsperm-algque"></a>
#### `PositiveRootsPerm(U): AlgQUE -> SeqEnum`

Given a quantized universal enveloping algebra $U$ with root datum $R$ returns a sequence consisting of the integers between $1$ and the number of positive roots of $R$. If the $k$-th element of this sequence is $m$, then the generator $F_k$ of $U$ is of weight $-\beta_m$, where $\beta_m$ is the $m$-th positive root of $R$ (as returned by `PositiveRoots(R)`). (For the definition of weight of an element of $U$ see Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases).) Furthermore, the generator $E_k$ is of weight $\beta_m$.

<a id="example-ex-3ae424"></a>
#### `Example: Structures Related to a Quantum Group (ex-3ae424)`

```magma
> R:= RootDatum("D4");
> U:= QuantizedUEA(R);
> CoefficientRing(U);
Univariate rational function field over Rational Field
Variables: q
> RootDatum(U);
Adjoint root datum of type D4
> PositiveRootsPerm(U);
[ 1, 5, 2, 8, 6, 3, 12, 11, 9, 10, 7, 4 ]
```

So for instance this means that $F_6$ is of weight $-\beta_3$.

<a id="elts-ops"></a>
<a id="sectalgqeaeltops"></a>
### Operations on Elements

The generators of a quantized enveloping algebra $U$ can be constructed by using the dot operator, e.g., `U.5`. More general elements can then be constructed using the operations of scalar multiplication, addition, and multiplication.

Note that for the generators denoted $F_k$ and $E_k$ we use divided powers instead of normal powers. This means for instance that $F_k^s = [s]!F_k^{(s)}$, i.e., exponentiation causes multiplication by a scalar factor.

<a id="operation-op-plus-algqueelt-algqueelt"></a>
#### `x + y: AlgQUEElt, AlgQUEElt -> AlgQUEElt`

<a id="operation-op-minus-algqueelt-algqueelt"></a>
#### `x - y: AlgQUEElt, AlgQUEElt -> AlgQUEElt`

<a id="operation-op-times-algqueelt-algqueelt"></a>
#### `x * y: AlgQUEElt, AlgQUEElt -> AlgQUEElt`

<a id="operation-op-times-rngelt-algqueelt"></a>
#### `c * x: RngElt, AlgQUEElt -> AlgQUEElt`

<a id="operation-op-times-algqueelt-rngelt"></a>
#### `x * c: AlgQUEElt, RngElt -> AlgQUEElt`

<a id="operation-op-pow-algqueelt-rngintelt"></a>
#### `x ^ n: AlgQUEElt, RngIntElt -> AlgQUEElt`

<a id="operation-op-algque-rngintelt"></a>
#### `U ! 0: AlgQUE, RngIntElt -> AlgQUEElt`

<a id="function-zero-algque"></a>
#### `Zero(U): AlgQUE -> AlgQUEElt`

The zero element of the quantized enveloping algebra $U$.

<a id="operation-op-algque-rngintelt-2"></a>
#### `U ! 1: AlgQUE, RngIntElt -> AlgQUEElt`

<a id="function-one-algque"></a>
#### `One(U): AlgQUE -> AlgQUEElt`

The identity element of the quantized enveloping algebra $U$.

<a id="operation-operation-algque-rngintelt-algqueelt"></a>
#### `U . i: AlgQUE, RngIntElt -> AlgQUEElt`

The $i$-th generator of the quantized enveloping algebra $U$. Let the root datum have $s$ positive roots and rank $r$. If $1\leq i\leq s$ then `U.i` is $F_i$. If $s+1\leq i\leq s+r$, then `U.i` is $K_j$ where $j= i-s$. If $s+r+1\leq i\leq 2s+r$ then `U.i` is $E_j$, where $j=i-s-r$.

<a id="operation-op-algque-any"></a>
#### `U ! r: AlgQUE, Any -> AlgQUEElt`

Returns $r$ as an element of the quantized universal enveloping algebra $U$ where $r$ may be anything coercible into the coefficient ring of $U$ or an element of another quantized enveloping algebra whose coefficients may be coerced into the coefficient ring of $U$.

<a id="function-kbinomial-algque-rngintelt-rngintelt"></a>
#### `KBinomial(U, i, s): AlgQUE, RngIntElt, RngIntElt -> AlgQUEElt`

<a id="function-kbinomial-algqueelt-rngintelt"></a>
#### `KBinomial(K, s): AlgQUEElt, RngIntElt -> AlgQUEElt`

Given a quantized enveloping algebra $U$ corresponding to a root datum of rank $r$, an integer $i$ between $1$ and $r$, and a positive integer $s$, return the element $[ K_i ; s ]$. This can be used to construct general elements in the subalgebra $U^0$ (cf. Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases)).

Or given an element $K = K_i$, i.e., equal to `U.(n+i)`, where $n$ is the number of positive roots of the root datum, return $[ K ; s ]$.

<a id="function-monomials-algqueelt"></a>
#### `Monomials(u): AlgQUEElt -> SeqEnum`

Given an element $u$ of a quantized enveloping algebra, returns the sequence consisting of the monomials of $u$. This sequence corresponds exactly to the one returned by `Coefficients(u)`.

<a id="function-coefficients-algqueelt"></a>
#### `Coefficients(u): AlgQUEElt -> SeqEnum`

Given an element $u$ of a quantized enveloping algebra, returns the sequence consisting of the coefficients of the monomials that occur in $u$. This sequence corresponds exactly to the one returned by `Monomials(u)`.

<a id="operation-op-pow-algqueelt-rngintelt-2"></a>
#### `K ^ -1: AlgQUEElt, RngIntElt -> AlgQUEElt`

Given a generator $K$ of a quantized enveloping algebra $U$ of the form $K_i$, i.e., it is equal to `U.k`, for some $n+1 \leq k \leq n+r$ where $U$ corresponds to a root datum of rank $r$ with $n$ positive roots, return the inverse of $K$.

<a id="function-degree-algqueelt-rngintelt"></a>
#### `Degree(u, i): AlgQUEElt, RngIntElt -> RngIntElt`

Given an element $u$ of a quantized enveloping algebra $U$ and an integer $1 \le i \le n$ or $n + r + 1 \le i \le 2n + r$, where the root datum corresponding to $U$ has $n$ positive roots and rank $r$ (i.e., `U.i` is equal to $F_i$ or to $E_k$, where $k=i-n-r$), return the degree of $u$ in the generator $F_i$ if $1\leq i\leq n$, otherwise return the degree of $u$ in the generator $E_k$, where $k=i-n-r$.

<a id="function-kdegree-algqueelt-rngintelt"></a>
#### `KDegree(m, i): AlgQUEElt, RngIntElt -> Tup`

Given a single monomial $m$ in a quantized enveloping algebra and an integer $1 \le i \le r$, where $r$ is the rank of the corresponding root datum return a tuple of $2$ integers, where the first is $0$ or $1$, and the second is non-negative. Denote this tuple by $\langle d, k \rangle$. If $d=0$ then the factor $[ K_i ; k ]$ occurs in the monomial $m$. If $d=1$, then the factor $K_i[ K_i ; k ]$ occurs in the monomial $m$.

<a id="example-ex-a73ba4"></a>
#### `Example: Monomials and Coefficients of Quantum Group Elements (ex-a73ba4)`

```magma
> R:= RootDatum("G2");
> U:= QuantizedUEA(R);
> u:= U.10*U.7^3*U.1;
> m:= Monomials(u); m;
[
    F_1*K_1[ K_1 ; 2 ]*E_2,
    F_1*[ K_1 ; 1 ]*E_2,
    F_1*K_1*E_2,
    K_1[ K_1 ; 1 ]*E_3,
    E_3
]
> Coefficients(u);
[
    (q^6 - q^4 - q^2 + 1)/q^17,
    (q^2 - 1)/q^14,
    1/q^15,
    (-q^2 + 1)/q^9,
    -1/q^8
]
> Degree(m[1], 1);
1
> Degree(m[1], 9);
0
> Degree(m[1], 10);
1
> KDegree(m[1], 1);
<1, 2>
> U.7^-1;
(-q^2 + 1)/q*[ K_1 ; 1 ] + K_1
> U.7*U.7^-1;
1
```

<a id="sectalgqeareps"></a>
<a id="id1"></a>
### Representations

In this section we describe some functions for working with left-modules over quantized enveloping algebras. For a general introduction into algebra modules in Magma we refer to Chapter [Modules over an Algebra and Group Representations](https://docs.magma-maths.org/RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/index-modules-over-an-algebra-and-group-representations.md#chapmodalg).

<a id="function-highestweightrepresentation-algque-seqenum"></a>
#### `HighestWeightRepresentation(U, w): AlgQUE, SeqEnum -> UserProgram`

Given a quantized enveloping algebra $U$ corresponding to a root datum of rank $r$ and a sequence $w$ of non-negative integers of length $r$, returns the irreducible representation of $U$ with highest weight $w$. The object returned is a function which given an element of $U$ computes its matrix.

<a id="function-highestweightmodule-algque-seqenum"></a>
#### `HighestWeightModule(U, w): AlgQUE, SeqEnum -> ModTupAlg`

Given a quantized enveloping algebra $U$ corresponding to a root datum of rank $r$ and a sequence $w$ of non-negative integers of length $r$, returns the irreducible $U$-module with highest weight $w$. The object returned is a left module over $U$.

<a id="example-ex-723df4"></a>
#### `Example: Highest Weight Representation of a Quantum Group (ex-723df4)`

```magma
> R:= RootDatum("G2");
> U:= QuantizedUEA(R);
> f:= HighestWeightRepresentation(U, [1,1]);
> f(U.6);
[ 0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0]
[ 0  1  0  0  0  0  0]
[ 0  0  0  0  0  0  0]
[ 0  0  0  0  0  0  0]
[ 0  0  0  0 -q  0  0]
[ 0  0  0  0  0  0  0]
> M:= HighestWeightModule(U, [1,0]);
> U.6^M.5;
(0  0  0  0  0 -q  0)
```

<a id="function-weightsandvectors-modalg"></a>
#### `WeightsAndVectors(V): ModAlg -> SeqEnum, SeqEnum`

For a module $V$ over a quantized universal enveloping algebra this returns two sequences. The first sequence consists of the weights that occur in $V$. The second sequence is a sequence of sequences of elements of $V$, in bijection with the first sequence. The $i$-th element of the second sequence consists of a basis of the weight space of weight equal to the $i$-th weight of the first sequence.

<a id="function-highestweightsandvectors-modalg"></a>
#### `HighestWeightsAndVectors(V): ModAlg -> SeqEnum, SeqEnum`

This function is analogous to the previous one. Except in this case the first sequence consists of highest weights, i.e., those weights which occur as highest weights of an irreducible constituent of $V$. The second sequence consists of sequences that contain the corresponding highest weight vectors. So the submodules generated by the vectors in the second sequence form a direct sum decomposition of $V$.

<a id="function-canonicalbasis-modalg"></a>
#### `CanonicalBasis(V): ModAlg -> SeqEnum`

Given a (left-) module $V$ over a quantized universal enveloping algebra, returns the canonical basis of $V$. If $V$ is not irreducible, then the union of the canonical bases of the irreducible components of $V$ is returned.

<a id="example-ex-36468d"></a>
#### `Example: Canonical Basis of a Highest Weight Module (ex-36468d)`

```magma
> U:= QuantizedUEA(RootDatum("B2"));
> V:= HighestWeightModule(U, [1,0]);
> C:= CanonicalBasis(V); C;
[
    V: (1 0 0 0 0),
    V: (0 1 0 0 0),
    V: (0 0 1 0 0),
    V: (0 0 0 1 0),
    V: (    0      0      0      0 -1/q^2)
]
```

We can compute the action of elements of $U$ with respect to the canonical basis by using `ModuleWithBasis`:

```magma
> M:= ModuleWithBasis(C);
> ActionMatrix(M, U.1);
[0 0 0 0 0]
[1 0 0 0 0]
[0 0 0 0 0]
[0 0 0 0 0]
[0 0 0 1 0]
```

<a id="function-tensorproduct-seqenum"></a>
#### `TensorProduct(Q): SeqEnum -> ModAlg, Map`

Given a sequence $Q$ of left-modules over a quantized universal enveloping algebra, returns the module $M$ that is the tensor product of the elements of $Q$. It also returns a map from the Cartesian product of the elements of $Q$ to $M$. This maps a tuple $t$ to the element of $M$ that is formed by tensoring the elements of $t$.

<a id="example-ex-e51b84"></a>
#### `Example: Tensor Product of Quantum Group Modules (ex-e51b84)`

```magma
> U:= QuantizedUEA(RootDatum("B2"));
> v1:= HighestWeightModule(U, [1,0]);
> V1:= HighestWeightModule(U, [1,0]);
> V2:= HighestWeightModule(U, [0,1]);
> W, f:= TensorProduct([V1,V2]);
> Dimension(W);
20
> HighestWeightsAndVectors(W);
[
    (1 1),
    (0 1)
]
[
    [
        W: (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ],
    [
        W: (0   0   1   0   0   q^4   0   0   -q^7/(q^2 + 1)   0   0   0   0   0
            0   0   0   0   0   0)
    ]
]
> f(<V1.2,V2.4>);
W: (0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0)
```

So in particular we see that $V1\otimes V2$ is the direct sum of two irreducible modules, one with highest weight $(1,1)$, the other with highest weight $(0,1)$. The corresponding highest-weight vectors are also given.

<a id="hopf-structure"></a>
<a id="secthopfstructure"></a>
### Hopf Algebra Structure

In this section we describe the functions for working with the Hopf algebra structure of a quantized universal enveloping algebra (cf. Section [Representations of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#qgrpreps)).

<a id="procedure-usetwistedhopfstructure-algque-map-map"></a>
#### `UseTwistedHopfStructure(U, f, g): AlgQUE, Map, Map`

The Hopf algebra structure that is used by default is the one described in Section [Representations of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#qgrpreps). As explained in that same section, it is possible to twist this by an automorphism, or an antiautomorphism.

Given a quantized universal enveloping algebra $U$ and (anti-) automorphisms $f$ and $g$ of $U$ where $g$ is the inverse of $f$ (this is not checked by Magma) set $U$ to use the corresponding twisted Hopf algebra structure.

This command has to be given before using the Hopf algebra structure, otherwise the default structure will be used. This includes creating a tensor product.

For some (anti-) automorphisms we refer to Section [Automorphisms](https://docs.magma-maths.org/LieTheory/QuantumGroups/automorphisms.md#sectalgqeaautoms).

<a id="function-hastwistedhopfstructure-algque"></a>
#### `HasTwistedHopfStructure(U): AlgQUE -> BoolElt, List`

This function checks whether the quantized enveloping algebra $U$ has been set to use a twisted Hopf structure. If the first value returned by this function is `true`, then the (anti-) automorphism and its inverse are also returned.

<a id="function-counit-algque"></a>
#### `Counit(U): AlgQUE -> Map`

Returns the counit of the quantized enveloping algebra $U$. It is a map from $U$ into the ground field of $U$.

<a id="function-antipode-algque"></a>
#### `Antipode(U): AlgQUE -> Map`

Returns the antipode of the quantized enveloping algebra $U$. It is an antiautomorphism of $U$.

<a id="function-comultiplication-algque-rngintelt"></a>
#### `Comultiplication(U, d): AlgQUE, RngIntElt -> UserProgram`

Returns the comultiplication of degree $d$ of the quantized enveloping algebra $U$. This is a map from $U$ into the $d$-fold tensor power of $U$. The comultiplication given in Section [Representations of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#qgrpreps) is of degree 2. The comultiplications of higher degree are obtained by repeating this map. So in particular, $d$ has to be at least $2$.

An element of the $d$-fold tensor power of $U$ is represented (rather primitively) by a list of $d$-tuples, each followed by a coefficient. The $d$-tuples are $d$-tuples of basis elements of $U$. The element represented by this list is the sum of the elements obtained by multiplying the $i$-th coefficient and the tensor product of the elements in the $i$-th $d$-tuple.

<a id="example-ex-a3845c"></a>
#### `Example: Comultiplication of a Quantized Enveloping Algebra (ex-a3845c)`

```magma
> U:= QuantizedUEA(RootDatum("A3"));
> d:= Comultiplication(U, 2);
> d(U.1);
[*
<1, F_1>,
1,
<F_1, K_1>,
1,
<F_1, [ K_1 ; 1 ]>,
(-q^2 + 1)/q
*]
```

<a id="sectalgqeaautoms"></a>
<a id="id1"></a>
### Automorphisms

<a id="function-barautomorphism-algque"></a>
#### `BarAutomorphism(U): AlgQUE -> Map`

For a quantized enveloping algebra $U$ this returns the bar-automorphism of $U$ (Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea)). The map returned by this function has its inverse stored, which can be retrieved using `Inverse`.

<a id="function-automorphismomega-algque"></a>
#### `AutomorphismOmega(U): AlgQUE -> Map`

For a quantized enveloping algebra $U$ this returns the automorphism of $U$ that is denoted by $\omega$ (Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea)). The map returned by this function has its inverse stored, which can be retrieved using `Inverse`.

<a id="function-antiautomorphismtau-algque"></a>
#### `AntiAutomorphismTau(U): AlgQUE -> Map`

For a quantized enveloping algebra $U$ this returns the anti-automorphism of $U$ that is denoted by $\tau$ (Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea)). The map returned by this function has its inverse stored, which can be retrieved using `Inverse`.

<a id="function-automorphismtalpha-algque-rngintelt"></a>
#### `AutomorphismTalpha(U, k): AlgQUE, RngIntElt -> Map`

Let $U$ be a quantized enveloping algebra, and let $k$ be an integer between $1$ and the rank of the root datum. Then this function returns the automorphism $T_{\alpha_k}$ of $U$, corresponding to the $k$-th simple root (Section [PBW-type Bases](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pbwbases)). The map returned by this function has its inverse stored, which can be retrieved using `Inverse`.

<a id="function-diagramautomorphism-algque-grppermelt"></a>
#### `DiagramAutomorphism(U, p): AlgQUE, GrpPermElt -> Map`

<a id="function-graphautomorphism-algque-grppermelt"></a>
#### `GraphAutomorphism(U, p): AlgQUE, GrpPermElt -> Map`

Let $U$ be a quantized enveloping algebra, and let $p$ be a permutation of $\{ 1,\ldots, r\}$, where $r$ is the rank of the root datum. Here $p$ must represent a diagram automorphism of the root datum (i.e., it leaves the Dynkin diagram invariant). Then this function returns the corresponding automorphism of $U$ (see Section [Quantized Enveloping Algebras](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#quantizeduea)). The map returned by this function has its inverse stored, which can be retrieved using `Inverse`.

<a id="example-ex-f34802"></a>
#### `Example: Automorphisms of a Quantum Group (ex-f34802)`

```magma
> R:= RootDatum("G2");
> U:= QuantizedUEA(R);
> b:= BarAutomorphism(U);
> b(U.3);
(q^10 - q^6 - q^4 + 1)/q^4*F_1^(2)*F_6 + (q^4 - 1)/q^2*F_1*F_5 + F_3
```

A known result states that $T_{\alpha_r}^{-1} = \tau \circ T_{\alpha_r} \circ \tau$. We check that for the quantum group of type $C_3$, and the third simple root.

```magma
> U:= QuantizedUEA(RootDatum("C3"));
> t:= AntiAutomorphismTau(U);
> T:= AutomorphismTalpha(U, 3);
> Ti:= Inverse(T);
> f:= t*T*t;
> &and[ Ti(U.i) eq f(U.i) : i in [1..21] ];
true
```

A diagram automorphism maps the canonical basis into itself. We check that for the set of elements of the canonical basis of the quantized enveloping algebra of type $D_4$ of weight $\alpha_1+3\alpha_2+2\alpha_3+2\alpha_4$. (Here $\alpha_i$ is the $i$-th simple root.) The chosen diagram automorphism maps this weight to $2\alpha_1+3\alpha_2+\alpha_3+2\alpha_4$. Therefore we also compute the elements of the canonical basis of that weight.

```magma
> U:= QuantizedUEA(RootDatum("D4"));
> p:= SymmetricGroup(4)!(1,3,4);
> d:= DiagramAutomorphism(U, p);
> e1:= CanonicalElements(U, [1,3,2,2]);
> e2:= CanonicalElements(U, [2,3,1,2]);
> &and[ d(x) in e2 : x in e1 ];
true
```

<a id="kashiwara-ops"></a>
<a id="sectalgqeakashops"></a>
### Kashiwara Operators

<a id="function-falpha-algqueelt-rngintelt"></a>
#### `Falpha(m, i): AlgQUEElt, RngIntElt -> AlgQUEElt`

Given a monomial $m$ in $U^-$ for some quantized enveloping algebra $U$, i.e., $m$ must be a monomial in the first $n$ generators of $U$, where $n$ is the number of positive roots of the corresponding root datum, returns another monomial in the negative part of $U$ that is obtained by applying the $i$-th Kashiwara operator $\tilde{F}_i$ to $m$ (see Section [The Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#canbas)). Here $i$ must lie between $1$ and the rank of the root datum.

<a id="function-ealpha-algqueelt-rngintelt"></a>
#### `Ealpha(m, i): AlgQUEElt, RngIntElt -> AlgQUEElt`

Given a monomial $m$ in $U^-$ for some quantized enveloping algebra $U$, i.e., $m$ must be a monomial in the first $n$ generators of $U$, where $n$ is the number of positive roots of the corresponding root datum, return $\tilde{E}_i(m)$ (see Section [The Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#canbas)) if the $i$-th Kashiwara operator $\tilde{E}_i$ is applicable to $m$. Otherwise the zero element of $U$ is returned. Here $i$ must lie between $1$ and the rank of the root datum.

<a id="example-ex-eb13a8"></a>
#### `Example: Kashiwara Operators on Monomials (ex-eb13a8)`

```magma
> R:= RootDatum("F4");
> U:= QuantizedUEA(R);
> m:= U.1*U.5*U.10*U.18*U.24;
> m;
F_1*F_5*F_10*F_18*F_24
> Falpha(m, 3);
F_1*F_6*F_7*F_10*F_18*F_24
> Ealpha(m, 4);
F_1*F_4*F_5*F_7*F_9*F_18*F_24
> Ealpha(m, 2);
0
```

<a id="path-model"></a>
<a id="sectalgqeapathmodel"></a>
### The Path Model

In this section we describe functions for working with Littelmann’s path model (cf. Section [The Path Model](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pathmodel)). A special role is played by the zero path. The path operators cannot be applied to the zero path. However, on some occasions they do produce the zero path.

<a id="function-dominantlspath-rootdtm-seqenum"></a>
#### `DominantLSPath(R, hw): RootDtm, SeqEnum -> PathLS`

Given a root datum $R$ and a sequence $hw$ of non-negative integers returns the path that is the straight line from the origin to $hw$.

<a id="function-falpha-pathls-rngintelt"></a>
#### `Falpha(p, i): PathLS, RngIntElt -> PathLS`

Given a (non-zero) path $p$ and an integer $i$ between $1$ and the rank of the root datum returns the result of applying the path operator $f_{\alpha_i}$ to $p$ (where $\alpha_i$ is the $i$-th simple root).

<a id="function-ealpha-pathls-rngintelt"></a>
#### `Ealpha(p, i): PathLS, RngIntElt -> PathLS`

Given a (non-zero) path $p$ and an integer $i$ between $1$ and the rank of the root datum returns the result of applying the path operator $e_{\alpha_i}$ to $p$ (where $\alpha_i$ is the $i$-th simple root).

<a id="function-weightsequence-pathls"></a>
#### `WeightSequence(p): PathLS -> SeqEnum`

For a path $p$ this returns the sequence of weights that, along with the sequence of rational numbers, defines the path (cf. Section [The Path Model](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pathmodel)).

<a id="function-rationalsequence-pathls"></a>
#### `RationalSequence(p): PathLS -> SeqEnum`

For a path $p$ this returns the sequence of rational numbers that, along with the sequence of weights, defines the path (cf. Section [The Path Model](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#pathmodel)).

<a id="function-endpointweight-pathls"></a>
#### `EndpointWeight(p): PathLS -> ModTupRngElt`

Returns the weight which is the end point of the path $p$.

<a id="function-shape-pathls"></a>
#### `Shape(p): PathLS -> ModTupRngElt`

Returns the weight which is the shape of the path $p$.

<a id="function-weylword-pathls"></a>
#### `WeylWord(p): PathLS -> SeqEnum`

Returns a reduced expression for the element $\sigma$ of the Weyl group, of shortest length such that $\sigma(\lambda) = \nu_1$, where $\lambda$ is the shape of the path $p$, and $\nu_1$ is the first weight in the sequence `WeightSequence(p)`. The reduced expression is represented as a sequence of integers between $1$ and the rank of the root datum. In this sequence the index $i$ represents the $i$-th simple reflection.

<a id="function-iszero-pathls"></a>
#### `IsZero(p): PathLS -> BoolElt`

Returns `true` if the path $p$ is the zero path, `false` otherwise.

<a id="operation-op-eq-pathls-pathls"></a>
#### `p1 eq p2: PathLS, PathLS -> BoolElt`

Returns `true` if the paths $p1$ and $p2$ are equal, `false` otherwise.

<a id="example-ex-cccc8c"></a>
#### `Example: LS Paths and Root Operators (ex-cccc8c)`

```magma
> R:= RootDatum("B2");
> p:= DominantLSPath(R, [ 2, 3 ]);
> p;
LS-path of shape (2 3) ending in (2 3)

> Falpha(p, 1);
LS-path of shape (2 3) ending in (0 5)

> Ealpha(Falpha(p, 1), 1);
LS-path of shape (2 3) ending in (2 3)

> p1:= Falpha(Falpha(Falpha(p, 1), 2), 1);
> p1;
LS-path of shape (2 3) ending in (-1  5)

> WeightSequence(p1);
[
    (5 -7),
    (-2  7)
]
> RationalSequence(p1);
[ 0, 1/7, 1 ]
> WeylWord(p1);
[ 2, 1 ]
```

So $s_2s_1(2,3) = (5,-7)$.

<a id="function-crystalgraph-rootdtm-seqenum"></a>
#### `CrystalGraph(R, hw): RootDtm, SeqEnum -> GrphDir, SeqEnum`

For a root datum $R$ and a sequence of non-negative integers $hw$ (of length equal to the rank of the root datum), this function returns the corresponding crystal graph $G$, along with a sequence of paths. The graph $G$ is a directed labelled graph. The labels on the edges are integers between $1$ and the rank of the root system. If there is an edge from $i$ to $j$ with label $s$, then $f_{\alpha_s}(p_i) = p_j$, where $p_i,p_j$ are the $i$-th and $j$-th elements of the sequence of paths returned by this function (and $f_{\alpha_s}$ is the root operator corresponding to the $s$-th simple root). In other words, the $i$-th path is the $i$-th point of the graph $G$.

<a id="example-ex-3f9751"></a>
#### `Example: Crystal Graph of a Representation (ex-3f9751)`

```magma
> R:= RootDatum("G2");
> G, pp:= CrystalGraph(R, [0,1]);
> G;
Digraph
Vertex  Neighbours

1       2 ;
2       3 ;
3       4 ;
4       5 6 ;
5       7 ;
6       8 ;
7       9 ;
8       10 ;
9       11 ;
10      11 ;
11      12 ;
12      13 ;
13      14 ;
14      ;

> e:= Edges(G);
> e[10];
[9, 11]
> Label(e[10]);
1
> Falpha(pp[9], 1) eq pp[11];
true
```

<a id="canbas-2"></a>
<a id="sectalgqeacanbas"></a>
### Elements of the Canonical Basis

<a id="function-canonicalelements-algque-seqenum"></a>
#### `CanonicalElements(U, w): AlgQUE, SeqEnum -> SeqEnum`

Given a quantized enveloping algebra $U$, corresponding to a root datum $R$ of rank $r$ and a sequence $w$ of non-negative integers of length $r$ returns the sequence consisting of the elements of the canonical basis of the negative part of $U$ that are of weight $\nu$, where $\nu$ denotes the linear combination of the simple roots of $R$ defined by $w$ (i.e., $\nu = w[1]\alpha_1+ \cdots +w[r]\alpha_r$ and $\alpha_1,\ldots, \alpha_r$ denote the simple roots of $R$).

<a id="example-ex-60f4ee"></a>
#### `Example: Canonical Basis Elements (ex-60f4ee)`

```magma
> R:= RootDatum("F4");
> U:= QuantizedUEA(R);
> c:= CanonicalElements(U, [1,2,1,1]); c;
[
    F_1*F_3^(2)*F_9*F_24,
    q*F_1*F_3^(2)*F_9*F_24 + F_1*F_3^(2)*F_23,
    q^4*F_1*F_3^(2)*F_9*F_24 + F_1*F_3*F_7*F_24,
    q^5*F_1*F_3^(2)*F_9*F_24 + q^4*F_1*F_3^(2)*F_23 + q*F_1*F_3*F_7*F_24 +
        F_1*F_3*F_21,
    q^4*F_1*F_3^(2)*F_9*F_24 + F_2*F_3*F_9*F_24,
    q^5*F_1*F_3^(2)*F_9*F_24 + q^4*F_1*F_3^(2)*F_23 + q*F_2*F_3*F_9*F_24 +
        F_2*F_3*F_23,
    (q^6 + q^2)*F_1*F_3^(2)*F_9*F_24 + q^2*F_1*F_3*F_7*F_24 +
        q^2*F_2*F_3*F_9*F_24 + F_2*F_7*F_24,
    (q^7 + q^3)*F_1*F_3^(2)*F_9*F_24 + (q^6 + q^2)*F_1*F_3^(2)*F_23 +
        q^3*F_1*F_3*F_7*F_24 + q^3*F_2*F_3*F_9*F_24 + q^2*F_1*F_3*F_21 +
        q^2*F_2*F_3*F_23 + q*F_2*F_7*F_24 + F_2*F_21,
    q^8*F_1*F_3^(2)*F_9*F_24 + q^4*F_1*F_3*F_7*F_24 + q^4*F_2*F_3*F_9*F_24 +
        q^2*F_2*F_7*F_24 + F_3*F_4*F_24,
    q^9*F_1*F_3^(2)*F_9*F_24 + q^8*F_1*F_3^(2)*F_23 + q^5*F_1*F_3*F_7*F_24 +
        q^5*F_2*F_3*F_9*F_24 + q^4*F_1*F_3*F_21 + q^4*F_2*F_3*F_23 +
        q^3*F_2*F_7*F_24 + q*F_3*F_4*F_24 + q^2*F_2*F_21 + F_3*F_18
]
> b:= BarAutomorphism(U);
> [ b(u) eq u : u in c ];
[ true, true, true, true, true, true, true, true, true, true ]
```

All elements of the canonical basis are invariant under the bar-automorphism.

<a id="example-ex-7c2231"></a>
#### `Example: Canonical Basis and Crystal Graphs (ex-7c2231)`

In the next example we show how to use the crystal graph to determine whether an element of the canonical basis acting on the highest weight vector of an irreducible module gives zero or not.

```magma
> U:= QuantizedUEA(RootDatum("A2"));
> G, p:= CrystalGraph(RootDatum(U), [1,1]);
> e:= Edges(G);
> for edge in e do
> print edge, Label(edge);
> end for;
[1, 2] 1
[1, 3] 2
[2, 4] 2
[3, 5] 1
[4, 6] 2
[5, 7] 1
[6, 8] 1
[7, 8] 2
```

We see that $f_{\alpha_1}f_{\alpha_2}f_{\alpha_2}f_{\alpha_1}(p_1) = p_8$ (where $p_i$ is the $i$-th path in $p$). We apply the same sequence of Kashiwara operators to the identity element of $U$.

```magma
> Falpha(Falpha(Falpha(Falpha(One(U), 1), 2), 2), 1);
F_1*F_2*F_3
```

Now the element of the canonical basis with this principal monomial (see Section [The Canonical Basis](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#canbas)) acting on the highest weight vector of the irreducible module with highest weight `[1,1]` gives a non-zero result. The weight of this monomial is $2\alpha_1+2\alpha_2$. All other elements of the canonical basis of this weight give zero, as there is only one point of the crystal graph that gives a monomial of this weight.

```magma
> V:= HighestWeightModule(U, [1,1]);
> ce:= CanonicalElements(U, [2,2]);
> ce;
[
    F_1^(2)*F_3^(2),
    (q^3 + q)*F_1^(2)*F_3^(2) + F_1*F_2*F_3,
    q^4*F_1^(2)*F_3^(2) + q*F_1*F_2*F_3 + F_2^(2)
]
> v0:= V.1;
> ce[2]^v0;
V: (  0    0    0    0    0    0    0 -1/q)
> ce[1]^v0;
V: (0 0 0 0 0 0 0 0)
> ce[3]^v0;
V: (0 0 0 0 0 0 0 0)
```

<a id="q"></a>
<a id="sectqeatouea"></a>
### Homomorphisms to the Universal Enveloping Algebra

<a id="function-quatointegralueamap-algque"></a>
#### `QUAToIntegralUEAMap(U): AlgQUE -> Map`

Given a quantized enveloping algebra $U$ returns the map from $U$ onto the integral form of the universal enveloping algebra of the corresponding Lie algebra (cf. Section [The ${\mathbb{Z}}$-form of $U_q(L)$](https://docs.magma-maths.org/LieTheory/QuantumGroups/background.md#zform)). We refer to Section [Universal Enveloping Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/universal_enveloping_algebras.md#sectunivea) for an account of universal enveloping algebras in Magma.

<a id="example-ex-08caa9"></a>
#### `Example: Map to the Integral Enveloping Algebra (ex-08caa9)`

```magma
> U:= QuantizedUEA(RootDatum("C3"));
> f:= QUAToIntegralUEAMap(U);
> p:= CanonicalElements(U, [1,2,1]);
> [ f(u) : u in p ];
[
    y_1*y_2^(2)*y_3,
    2*y_1*y_2^(2)*y_3 + y_1*y_2*y_5,
    y_1*y_2^(2)*y_3 + y_1*y_2*y_5 + y_1*y_7,
    y_1*y_2^(2)*y_3 + y_2*y_3*y_4 - y_2*y_6,
    2*y_1*y_2^(2)*y_3 + y_1*y_2*y_5 + y_2*y_3*y_4 - y_2*y_6 + y_4*y_5,
    2*y_1*y_2^(2)*y_3 + y_1*y_2*y_5 + 2*y_2*y_3*y_4 - y_2*y_6 + y_4*y_5,
    y_1*y_2^(2)*y_3 + y_1*y_2*y_5 + y_2*y_3*y_4 + y_1*y_7 + y_4*y_5 + y_8
]
```

So this allows one to construct elements of the canonical basis of a universal enveloping algebra (of a semisimple Lie algebra).

<a id="groups-lie-type"></a>
<a id="chapgrplie"></a>
## Groups of Lie Type

- [Introduction](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md)
  - [The Steinberg Presentation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#the-steinberg-presentation)
  - [Bruhat Normalisation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#bruhat-normalisation)
  - [Twisted Groups of Lie type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#twisted-groups-of-lie-type)
- [Constructing Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md)
  - [Split Groups](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#split-groups)
    - [`GroupOfLieType(N, k): MonStgElt, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-monstgelt-rng)
    - [`GroupOfLieType(N, q): MonStgElt, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-monstgelt-rngintelt)
    - [`GroupOfLieType(W, k): GrpPermCox, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grppermcox-rng)
    - [`GroupOfLieType(W, k): GrpMat, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grpmat-rng)
    - [`GroupOfLieType(W, q): GrpPermCox, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grppermcox-rngintelt)
    - [`GroupOfLieType(W, q): GrpMat, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grpmat-rngintelt)
    - [`GroupOfLieType(R, k): RootDtm, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-rootdtm-rng)
    - [`GroupOfLieType(R, q): RootDtm, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-rootdtm-rngintelt)
    - [`GroupOfLieType(C, k): Mtrx, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-mtrx-rng)
    - [`GroupOfLieType(D, k): GrphDir, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grphdir-rng)
    - [`GroupOfLieType(C, q): Mtrx, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-mtrx-rngintelt)
    - [`GroupOfLieType(D, q): GrphDir, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-grphdir-rngintelt)
    - [`SimpleGroupOfLieType(X, n, k): MonStgElt, RngIntElt, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-simplegroupoflietype-monstgelt-rngintelt-rng)
    - [`SimpleGroupOfLieType(X, n, q): MonStgElt, RngIntElt, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-simplegroupoflietype-monstgelt-rngintelt-rngintelt)
    - [`GroupOfLieType(L): AlgLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-groupoflietype-alglie)
    - [`IsNormalising(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-isnormalising-grplie)
    - [Example: Creating a Split Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#example-ex-108927)
  - [Galois Cohomology](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#galois-cohomology)
    - [`GammaGroup(k, G): Fld, GrpLie → GGrp`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-gammagroup-fld-grplie)
    - [`GammaGroup(k, A): Fld, GrpLieAuto → GGrp`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-gammagroup-fld-grplieauto)
    - [`ActingGroup(G): GrpLie → Grp, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-actinggroup-grplie)
    - [`ActingGroup(A): GrpLieAuto → Grp, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-actinggroup-grplieauto)
    - [`ExtendGaloisCocycle(c): OneCoC → OneCoC`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-extendgaloiscocycle-onecoc)
    - [`GaloisCohomology(A): GGrp → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-galoiscohomology-ggrp)
    - [`IsInTwistedForm(x, c): GrpLieElt, OneCoC → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-isintwistedform-grplieelt-onecoc)
    - [Example: Galois Cohomology of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#example-ex-914f01)
  - [Twisted Groups](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#twisted-groups)
    - [`TwistedGroupOfLieType(c): OneCoC → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-twistedgroupoflietype-onecoc)
    - [`TwistedGroupOfLieType(R, k, K): RootDtm, Rng, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-twistedgroupoflietype-rootdtm-rng-rng)
    - [`TwistedGroupOfLieType(R, q, r): RootDtm, RngIntElt, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-twistedgroupoflietype-rootdtm-rngintelt-rngintelt)
    - [`TwistedGroupOfLieType(t, r, q): MonStgElt, RngIntElt, RngIntElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-twistedgroupoflietype-monstgelt-rngintelt-rngintelt)
    - [Example: Twisted Group of Type 3D4](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#example-ex-a0e6f9)
    - [`BaseRing(G): GrpLie → Rng`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-basering-grplie)
    - [`CoefficientRing(G): GrpLie → Rng`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-coefficientring-grplie)
    - [`DefRing(G): GrpLie → Rng`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-defring-grplie)
    - [`UntwistedOvergroup(G): GrpLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-untwistedovergroup-grplie)
    - [Example: Twisted Group 2A3 as a Subgroup](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#example-ex-61dd3f)
    - [`RelativeRootElement(G,delta,t): GrpLie, RngIntElt, [FldElt] → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#function-relativerootelement-grplie-rngintelt-fldelt)
    - [Example: Twisted Group via a Cocycle](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#example-ex-55c70c)
- [Operations on Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md)
  - [`G eq H: GrpLie, GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#operation-op-eq-grplie-grplie)
  - [`G subset H: GrpLie, GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#operation-op-subset-grplie-grplie)
  - [`IsAlgebraicallyIsomorphic(G, H): GrpLie, GrpLie → BoolElt, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-isalgebraicallyisomorphic-grplie-grplie)
  - [`IsIsogenous(G, H): GrpLie, GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-isisogenous-grplie-grplie)
  - [`IsCartanEquivalent(G, H): GrpLie, GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-iscartanequivalent-grplie-grplie)
  - [`BaseRing(G): GrpLie → Rng`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-basering-grplie-2)
  - [`CoefficientRing(G): GrpLie → Rng`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-coefficientring-grplie-2)
  - [`BaseExtend(G, K): GrpLie, Rng → GrpLie, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-baseextend-grplie-rng)
  - [`ChangeRing(G, K): GrpLie, Rng → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-changering-grplie-rng)
  - [`Generators(G): GrpLie → {}`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-generators-grplie)
  - [`NumberOfGenerators(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-numberofgenerators-grplie)
  - [`Ngens(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-ngens-grplie)
  - [`AlgebraicGenerators(G): GrpLie → {}`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-algebraicgenerators-grplie)
  - [`NumberOfAlgebraicGenerators(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-numberofalgebraicgenerators-grplie)
  - [`Nalggens(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-nalggens-grplie)
  - [Example: Generators of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#example-ex-a929c8)
  - [`Order(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-order-grplie)
  - [`# G: GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#operation-operation-grplie-rngintelt)
  - [`FactoredOrder(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-factoredorder-grplie)
  - [`Dimension(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-dimension-grplie)
  - [Example: Orders of Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#example-ex-1128fd)
  - [`CartanName(G): GrpLie → Mtrx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-cartanname-grplie)
  - [`RootDatum(G): GrpLie → RootDtm`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-rootdatum-grplie)
  - [`DynkinDiagram(G): GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#procedure-dynkindiagram-grplie)
  - [`CoxeterDiagram(G): GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#procedure-coxeterdiagram-grplie)
  - [`CoxeterMatrix(G): GrpLie → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-coxetermatrix-grplie)
  - [`CoxeterGraph(G): GrpLie → GrphUnd`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-coxetergraph-grplie)
  - [`CartanMatrix(G): GrpLie → GrphUnd`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-cartanmatrix-grplie)
  - [`DynkinDigraph(G): GrpLie → GrphUnd`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-dynkindigraph-grplie)
  - [`Rank(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-rank-grplie)
  - [`ReductiveRank(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-reductiverank-grplie)
  - [`SemisimpleRank(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-semisimplerank-grplie)
  - [`CoxeterNumber(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-coxeternumber-grplie)
  - [`WeylGroup(G): GrpLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-weylgroup-grplie)
  - [`WeylGroup(GrpPermCox, G): Cat, GrpLie → GrpPermCox`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-weylgroup-cat-grplie)
  - [`WeylGroup(GrpFPCox, G): Cat, GrpLie → GrpFPCox`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-weylgroup-cat-grplie-2)
  - [`WeylGroup(GrpMat, G): Cat, GrpLie → GrpMat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-weylgroup-cat-grplie-3)
  - [`FundamentalGroup(G): GrpLie → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-fundamentalgroup-grplie)
  - [`IsogenyGroup(G): GrpLie → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-isogenygroup-grplie)
  - [`CoisogenyGroup(G): GrpLie → GrpAb, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/operations.md#function-coisogenygroup-grplie)
- [Properties of Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md)
  - [`IsFinite(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isfinite-grplie)
  - [`IsAbelian(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isabelian-grplie)
  - [`IsSimple(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issimple-grplie)
  - [`IsSimplyLaced(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issimplylaced-grplie)
  - [`IsSemisimple(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issemisimple-grplie)
  - [`IsAdjoint(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isadjointg)
  - [`IsWeaklyAdjoint(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isweaklyadjoint-grplie)
  - [`IsSimplyConnected(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issimplyconnectedg)
  - [`IsWeaklySimplyConnected(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isweaklysimplyconnected-grplie)
  - [`IsSplit(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issplit-grplie)
  - [`IsTwisted(G): GrpLie → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-istwisted-grplie)
- [Constructing Elements](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md)
  - [`elt<G | L>: GrpLie, List → GrpMatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#constructor-constructor-elt-grplie-list-grpmatelt)
  - [`Identity(G): GrpLie → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-identity-grplie)
  - [`Id(G): GrpLie → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-id-grplie)
  - [`G ! 1: GrpLie, RngIntElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#operation-op-grplie-rngintelt)
  - [`elt< G | >: GrpLie → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#constructor-constructor-elt-grplie-grplieelt)
  - [Example: Constructing Elements of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#example-ex-749aa7)
  - [`TorusTerm(G, r, t): GrpLie, RngIntElt, RngElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-torusterm-grplie-rngintelt-rngelt)
  - [`CoxeterElement(G): GrpLie → GrpPermElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-coxeterelement-grplie)
  - [`Random(G): GrpLie → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-random-grplie)
  - [`Eltlist(g): GrpLieElt → List`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-eltlist-grplieelt)
  - [`CentrePolynomials(G): GrpLie → {}`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-centrepolynomials-grplie)
  - [`CenterPolynomials(G): GrpLie → {}`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#function-centerpolynomials-grplie)
  - [Example: Centre of a Semisimple Group](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#example-ex-1715e7)
- [Operations on Elements](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md)
  - [Basic Operations](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#basic-operations)
    - [`g * h: GrpLieElt, GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#operation-op-times-grplieelt-grplieelt)
    - [Example: Normalised and Unnormalised Products](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#example-ex-e7b37f)
    - [`g ^ -1: GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#operation-op-pow-grplieelt)
    - [`Inverse(G): GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-inverse-grplieelt)
    - [`g ^ n: GrpLieElt, RngIntElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#operation-op-pow-grplieelt-rngintelt)
    - [`g ^ h: GrpLieElt, GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#operation-op-pow-grplieelt-grplieelt)
    - [`(g,  h): GrpLieElt, GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#literal-literal-g-h-grplieelt-grplieelt-grplieelt)
    - [`Commutator(g, h): GrpLieElt, GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-commutator-grplieelt-grplieelt)
    - [`Normalise(~g): GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#procedure-normalise-grplieelt-ref)
    - [`Normalize(~g): GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#procedure-normalize-grplieelt-ref)
    - [`Normalise(g): GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-normalise-grplieelt)
    - [`Normalize(g): GrpLieElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-normalize-grplieelt)
    - [Example: Arithmetic in Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#example-ex-6ee091)
  - [Decompositions](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#decompositions)
    - [`Bruhat(g): GrpLieElt → GrpLieElt, GrpLieElt, GrpLieElt, GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-bruhat-grplieelt)
    - [Example: Bruhat Decomposition of an Element](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#example-ex-95f5c0)
    - [`MultiplicativeJordanDecomposition(x): GrpLieElt → GrpLieElt, GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-multiplicativejordandecomposition-grplieelt)
  - [Conjugacy and Cohomology](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#conjugacy-and-cohomology)
    - [`ConjugateIntoTorus(g): GrpLieElt → GrpLieElt, GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-conjugateintotorus-grplieelt)
    - [`ConjugateIntoBorel(g): GrpLieElt → GrpLieElt, GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-conjugateintoborel-grplieelt)
    - [`Lang(c, q): GrpLieElt, RngIntElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-operators.md#function-lang-grplieelt-rngintelt)
- [Properties of Elements](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/more-element-operators.md)
  - [`IsSemisimple(x): GrpLieElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/more-element-operators.md#function-issemisimple-grplieelt)
  - [`IsUnipotent(x): GrpLieElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/more-element-operators.md#function-isunipotent-grplieelt)
  - [`IsCentral(x): GrpLieElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/more-element-operators.md#function-iscentral-grplieelt)
- [Roots, Coroots, and Weights](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md)
  - [Accessing Roots and Coroots](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#accessing-roots-and-coroots)
    - [`RootSpace(G): GrpLie → Lat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-rootspace-grplie)
    - [`CorootSpace(G): GrpLie → Lat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-corootspace-grplie)
    - [`SimpleRoots(G): GrpLie → Mtrx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-simpleroots-grplie)
    - [`SimpleCoroots(G): GrpLie → Mtrx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-simplecoroots-grplie)
    - [`NumberOfPositiveRoots(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-numberofpositiveroots-grplie)
    - [`NumPosRoots(G): GrpLie → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-numposroots-grplie)
    - [`Roots(G): GrpLie → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-roots-grplie)
    - [`Coroots(G): GrpLie → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-coroots-grplie)
    - [`PositiveRoots(G): GrpLie → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-positiveroots-grplie)
    - [`PositiveCoroots(G): GrpLie → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-positivecoroots-grplie)
    - [`Root(G, r): GrpLie, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-root-grplie-rngintelt)
    - [`Coroot(G, r): GrpLie, RngIntElt → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-coroot-grplie-rngintelt)
    - [`RootPosition(G, v): GrpLie, . → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-rootposition-grplie)
    - [`CorootPosition(G, v): GrpLie, . → SetIndx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-corootposition-grplie)
    - [Example: Roots and Coroots of an Isogenous A3](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#example-ex-ac3db4)
    - [`HighestRoot(G): GrpLie → LatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-highestroot-grplie)
    - [`HighestLongRoot(G): GrpLie → LatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-highestlongroot-grplie)
    - [`HighestShortRoot(G): GrpLie → LatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-highestshortroot-grplie)
    - [Example: Highest Roots of G2](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#example-ex-69e0c7)
  - [Reflections](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#reflections)
    - [`Reflections(G): GrpLie → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-reflections-grplie)
    - [`Reflection(G, r): GrpLie, RngIntElt → GrpLieElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-reflection-grplie-rngintelt)
    - [Example: Reflections of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#example-ex-ff84ed)
  - [Operations and Properties for Root and Coroot Indices](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#operations-and-properties-for-root-and-coroot-indices)
    - [`RootHeight(G, r): GrpLie, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-rootheight-grplie-rngintelt)
    - [`CorootHeight(G, r): GrpLie, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-corootheight-grplie-rngintelt)
    - [`RootNorms(G): GrpLie → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-rootnorms-grplie)
    - [`CorootNorms(G): GrpLie → [RngIntElt]`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-corootnorms-grplie)
    - [`RootNorm(G, r): GrpLie, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-rootnorm-grplie-rngintelt)
    - [`CorootNorm(G, r): GrpLie, RngIntElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-corootnorm-grplie-rngintelt)
    - [`IsLongRoot(G, r): GrpLie, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-islongroot-grplie-rngintelt)
    - [`IsShortRoot(G, r): GrpLie, RngIntElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-isshortroot-grplie-rngintelt)
    - [`AdditiveOrder(G): GrpLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-additiveorder-grplie)
    - [Example: Additive Order of Positive Roots](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#example-ex-dabc7d)
  - [Weights](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#weights)
    - [`WeightLattice(G): GrpLie → Lat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-weightlattice-grplie)
    - [`CoweightLattice(G): GrpLie → Lat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-coweightlattice-grplie)
    - [`FundamentalWeights(G): GrpLie → Mtrx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-fundamentalweights-grplie)
    - [`FundamentalCoweights(G): GrpLie → Mtrx`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-fundamentalcoweights-grplie)
    - [`DominantWeight(G, v): GrpLie, . → ModTupFldElt, GrpFPCoxElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#function-dominantweight-grplie)
- [Building Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md)
  - [`SubsystemSubgroup(G, a): GrpLie, SetEnum → RootDtm`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-subsystemsubgroup-grplie-setenum)
  - [`SubsystemSubgroup(G, s): GrpLie, SeqEnum → RootDtm`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-subsystemsubgroup-grplie-seqenum)
  - [Example: Subsystem Subgroups via Root Subdata](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#example-ex-0494af)
  - [`DirectProduct(G1, G2): GrpLie, GrpLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-directproduct-grplie-grplie)
  - [`Dual(G): GrpLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-dual-grplie)
  - [`SolubleRadical(G): GrpLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-solubleradical-grplie)
  - [`StandardMaximalTorus(G): GrpLie → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#function-standardmaximaltorus-grplie)
  - [Example: Direct Products, Duals, and Radicals](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/create-new-root-datum.md#example-ex-c4d20b)
- [Automorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md)
  - [Basic Functionality](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#basic-functionality)
    - [`AutomorphismGroup(G): GrpLie → GrpLieAuto`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-automorphismgroup-grplie)
    - [`IdentityAutomorphism(G): GrpLie → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-identityautomorphism-grplie)
    - [`One(A): GrpLieAuto → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-one-grplieauto)
    - [`Id(A): GrpLieAuto → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-id-grplieauto)
    - [`Mapping(a): GrpLieAutoElt → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-mapping-grplieautoelt)
    - [`Automorphism(m): Map → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-automorphism-map)
    - [`h * g: GrpLieAutoElt, GrpLieAutoElt → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#operation-op-times-grplieautoelt-grplieautoelt)
    - [`h ^ n: GrpLieAutoElt, RngIntElt → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#operation-op-pow-grplieautoelt-rngintelt)
    - [`g ^ h: GrpLieAutoElt, GrpLieAutoElt → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#operation-op-pow-grplieautoelt-grplieautoelt)
    - [`Domain(A): GrpLieAuto → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-domain-grplieauto)
    - [`Codomain(A): GrpLieAuto → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-codomain-grplieauto)
    - [`Domain(h): GrpLieAutoElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-domain-grplieautoelt)
    - [`Codomain(h): GrpLieAutoElt → GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-codomain-grplieautoelt)
  - [Constructing Special Automorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#constructing-special-automorphisms)
    - [`InnerAutomorphism(G, x): GrpLie, GrpLieElt → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-innerautomorphism-grplie-grplieelt)
    - [`DiagonalAutomorphism(G, v): GrpLie, ModTupRngElt → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-diagonalautomorphism-grplie-modtuprngelt)
    - [`GraphAutomorphism(G, p): GrpLie, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-graphautomorphism-grplie-grppermelt)
    - [`DiagramAutomorphism(G, p): GrpLie, GrpPermElt → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-diagramautomorphism-grplie-grppermelt)
    - [`FieldAutomorphism(G, sigma): GrpLie, Map → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-fieldautomorphism-grplie-map)
    - [`RandomAutomorphism(G): GrpLie → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-randomautomorphism-grplie)
    - [`Random(A): GrpLieAuto → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-random-grplieauto)
    - [`DualityAutomorphism(G): GrpLie → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-dualityautomorphism-grplie)
    - [`FrobeniusMap(G,q): GrpLie, RngIntElt → GrpLieAutoElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-frobeniusmap-grplie-rngintelt)
  - [Operations and Properties of Automorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#operations-and-properties-of-automorphisms)
    - [`DecomposeAutomorphism(h): GrpLieAutoElt → GrpLieAutoElt, GrpLieAutoElt, GrpLieAutoElt, Rec`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-decomposeautomorphism-grplieautoelt)
    - [`IsAlgebraic(h): GrpLieAutoElt → BoolElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#function-isalgebraic-grplieautoelt)
    - [Example: Automorphisms of a Group of Type B2](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/automorphisms.md#example-ex-6e4baf)
- [Algebraic Homomorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/homomorphism.md)
  - [`GroupOfLieTypeHomomorphism(phi, k): Map, Rng → .`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/homomorphism.md#function-groupoflietypehomomorphism-map-rng)
  - [Example: Creating Root Data Homomorphisms](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/homomorphism.md#example-ex-42434f)
- [Twisted Tori](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md)
  - [`TwistedTorusOrder(R, w): RootDtm, GrpPermElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#function-twistedtorusorder-rootdtm-grppermelt)
  - [`TwistedToriOrders(G): GrpLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#function-twistedtoriorders-grplie)
  - [`TwistedToriOrders(R): RootDtm → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#function-twistedtoriorders-rootdtm)
  - [`TwistedTorus(G, w): GrpLie, GrpPermElt → List`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#function-twistedtorus-grplie-grppermelt)
  - [`TwistedTori(G): GrpLie → SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#function-twistedtori-grplie)
  - [Example: Twisted Tori of a Group of Type A1](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#example-ex-5e0bd4)
  - [Example: Orders of Maximal Tori in G2](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/twisted-tori.md#example-ex-bc3840)
- [Sylow Subgroups](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/sylow-subgroups.md)
  - [`PrintSylowSubgroupStructure(G): GrpLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/sylow-subgroups.md#procedure-printsylowsubgroupstructure-grplie)
  - [`SylowSubgroup(G, p): GrpLie, RngIntElt → List`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/sylow-subgroups.md#function-sylowsubgroup-grplie-rngintelt)
  - [Example: Sylow Subgroup Structure](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/sylow-subgroups.md#example-ex-dd465e)
- [Representations](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md)
  - [`StandardRepresentation(G): GrpLie → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-standardrepresentation-grplie)
  - [`AdjointRepresentation(G): GrpLie → Map, AlgLie`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-adjointrepresentation-grplie)
  - [`LieAlgebra(G): GrpLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-liealgebra-grplie)
  - [`HighestWeightRepresentation(G, v): GrpLie, . → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-highestweightrepresentation-grplie)
  - [Example: Standard Representation of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#example-ex-be5644)
  - [`ContravariantForm(ρ): Map[GrpLie,GrpMat] → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-contravariantform-map-grplie-grpmat)
  - [`GeneralisedRowReduction(ρ): Map → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-generalisedrowreduction-map)
  - [`RowReductionHomomorphism(ρ): Map → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-rowreductionhomomorphism-map)
  - [`Inverse(ρ): Map → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/representations.md#function-inverse-map)
- [Curtis–Steinberg–Tits Presentations](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md)
  - [`CST_Generators(t,r,q,w): MonStgElt, RngIntElt, RngIntElt, SeqEnum → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-cst-generators-monstgelt-rngintelt-rngintelt-seqenum)
  - [`CST_Presentation(t,r,q): MonStgElt, RngIntElt, RngIntElt → GrpSLP, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-cst-presentation-monstgelt-rngintelt-rngintelt)
  - [`CST_VerifyPresentation(t,r,q,X,Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum → BoolElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-cst-verifypresentation-monstgelt-rngintelt-rngintelt-seqenum-seqenum)
  - [Example: Checking Curtis-Steinberg-Tits Relations](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#example-ex-edd24d)
  - [`CSTtoChev(t,r,q,X,Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-csttochev-monstgelt-rngintelt-rngintelt-seqenum-seqenum)
  - [Example: Map from a CST Presentation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#example-ex-430d2a)
  - [`ExtendGeneratorList(t,r,X,Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-extendgeneratorlist-monstgelt-rngintelt-rngintelt-seqenum-seqenum)
  - [`IrreducibleHighestWeightRepresentation(G,w): GrpLie, SeqEnum → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-irreduciblehighestweightrepresentation-grplie-seqenum)
  - [`IrreducibleHighestWeightGenerators(G,w): GrpLie, SeqEnum → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-irreduciblehighestweightgenerators-grplie-seqenum)
  - [`IrreducibleHighestWeightFunction(G,w): GrpLie, SeqEnum → UserProgram`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-irreduciblehighestweightfunction-grplie-seqenum)
  - [`VermaModule(G,w): GrpLie, SeqEnum → ModGrp`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-vermamodule-grplie-seqenum)
  - [`UniversalHighWeightRepresentation(G,w): GrpLie, SeqEnum → Map, SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-universalhighweightrepresentation-grplie-seqenum)
  - [Chevalley Groups](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#chevalley-groups)
    - [`StandardLieRepresentation(t,r): MonStgElt, RngIntElt → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-standardlierepresentation-monstgelt-rngintelt)
    - [`AdjointChevalleyGroup(t,r,q): MonStgElt, RngIntElt, RngIntElt → GrpMat`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-adjointchevalleygroup-monstgelt-rngintelt-rngintelt)
    - [Example: Adjoint Chevalley Groups](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#example-ex-1c5530)
    - [`LieRootMatrix(R,α,B): RootDtm, ModTupFldElt, SetIndx → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lierootmatrix-rootdtm-modtupfldelt-setindx)
    - [`LieRootMatrix(R,r,X): RootDtm, RngIntElt, SeqEnum → AlgMatElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lierootmatrix-rootdtm-rngintelt-seqenum)
    - [`LieTypeGenerators(t,k,q): MonStgElt, RngIntElt, RngIntElt → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lietypegenerators-monstgelt-rngintelt-rngintelt)
    - [`LieTypeGenerators(t,k,K): MonStgElt, RngIntElt, FldFin → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lietypegenerators-monstgelt-rngintelt-fldfin)
    - [`LieTypeGenerators(G): GrpLie → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lietypegenerators-grplie)
    - [`SLPGeneratorList(t,r,q): MonStgElt, RngIntElt, RngIntElt → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-slpgeneratorlist-monstgelt-rngintelt-rngintelt)
  - [Morphisms and the Row Reduction Algorithm](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#morphisms-and-the-row-reduction-algorithm)
    - [`Morphism(G,X,Y): GrpLie, SeqEnum, SeqEnum → Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-morphism-grplie-seqenum-seqenum)
    - [`ChevalleyForm(ρ,A): Map[GrpLie,GrpMat], GrpMatElt → SeqEnum, FldFinElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-chevalleyform-map-grplie-grpmat-grpmatelt)
    - [Example: Chevalley Normal Form of an Element](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#example-ex-6fae1c)
    - [`PrepareRewrite(t,r,q,X,Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum → UserProgram, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-preparerewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum)
    - [`TwistedPrepareRewrite(t,r,q,X,Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum → UserProgram, Map`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-twistedpreparerewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum)
    - [`LieTypeRewrite(t,r,q,X,Y,g): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum, GrpMatElt → BoolElt, GrpSLPElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-lietyperewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum-grpmatelt)
    - [`TwistedLieTypeRewrite(t,r,q,X,Y,g): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum, GrpMatElt → BoolElt, GrpSLPElt`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-twistedlietyperewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum-grpmatelt)
    - [Example: Rewriting in a Twisted Group of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#example-ex-22cf73)
    - [`RowReductionMap(ρ): Map[GrpLie,GrpMat] → UserProgram`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-rowreductionmap-map-grplie-grpmat)
    - [`TwistedRowReductionMap(ρ): Map[GrpLie,GrpMat] → UserProgram`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/cst-presentations.md#function-twistedrowreductionmap-map-grplie-grpmat)
- [Bibliography](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/bibliography.md)

<a id="sectgrplieintro"></a>
<a id="id1"></a>
### Introduction

This chapter describes Magma functions for computing with groups of Lie type. These functions are based on [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)] for split types, and [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)] for twisted types.

Given an extended root datum and ring with a $\Gamma$-action, a group of Lie type can be constructed in Magma. Such groups include reductive Lie groups (when the ring is **R** or ${\mathbb{C}}$), reductive algebraic groups (when the ring is an algebraically closed field), and finite groups of Lie type (when the ring is a finite field).

<a id="steinberg"></a>
<a id="subsectgrpliesteinberg"></a>
#### The Steinberg Presentation

The approach to computation in split groups of Lie type described here is based on the Steinberg presentation[[Ste62a](https://docs.magma-maths.org/references.md#cite-steinberg-presentation)] Let $G$ be a split group of Lie type with root datum $R$ over the ring $k$. Suppose the roots of $R$ are $\alpha_1,\dots,\alpha_{2N}$ ordered as in Section [Roots, Coroots, and Weights](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#sectrdroot) and $n$ is the rank of $R$. Then $G$ contains *root elements* $x_r(t)=x_{\alpha_r}(t)$ for $t$ in $k$. If $R$ is semisimple, the root elements generate $G$. In the general case, it is necessary to introduce extra torus elements. Let $Y={\mathbb{Z}}^d$ be the coroot space of the root datum. The torus is taken to be the abelian group $Y\otimes k^\times$, represented as the set of vectors in $k^d$ with each component invertible, and multiplication is performed componentwise. The Weyl group of $G$ is just the Coxeter group of the root datum $R$. Redundant generators $n_r$ are also included, corresponding to the generators $s_r$ of the Weyl group.

Since the generating set is parametrised by field elements it is generally not possible to define $G$ within the category of finitely presented groups `GrpFP`, so groups of Lie type form their own category, `GrpLie`.

Note that groups of Lie type in Magma are designed primarily for fields whose elements are exact. While it is possible to define these groups over real and complex fields (Chapter [Real and Complex Fields](https://docs.magma-maths.org/BasicRings/RealAndComplexFields/index-real-and-complex-fields.md#chapfldre)), no attempt has been made to control rounding error in this case.

<a id="bruhat"></a>
<a id="subsectgrpliebruhat"></a>
#### Bruhat Normalisation

The Bruhat decomposition [[Car93](https://docs.magma-maths.org/references.md#cite-carter-big), Chapter 2] gives us a useful normal form for elements of a split group of Lie type defined over a field $k$. Every $g\in G$ can be written in the form $uh\dot{w}u'$ where

1. $u$ is a unipotent element written in the form $\prod_{r=1}^N x_r(t_r)$, with respect to a given ordering of the roots (as in Section [Constructing Elements](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-construction.md#sectgrplieconstructelt));
2. $h$ is a torus element represented as an element of $R^d$ with each entry invertible;
3. $\dot{w} = \dot{s}_{r_1}\cdots \dot{s}_{r_k}$ where $s_{r_1}\cdots s_{r_k}$ is a reduced word for $w$ in the Weyl group.
4. $u'=\prod_{r\in\Phi_w^-}x_r(t_r')$ where $\Phi_w^-= \{ r \mid \alpha_r\in\Phi^+\text{ and }\alpha_rw^{-1}\in\Phi^-\}$ and the terms are in the usual order.

#### Twisted Groups of Lie type

Let $G$ be a connected reductive linear algebraic group defined over the field $k$. We say that $H$ is a *form* of $G$ if there is a $\bar{k}$-isomorphism between $G$ and $H$, where $\bar{k}$ the algebraic closure of $k$. If some maximal torus of $G(\bar{k})$ is a $k$-split torus, we say that $G$ is *split*, otherwise $G$ is *twisted*. If $G$ has a Borel subgroup defined over $k$, we say that $G$ is *quasisplit*. There is a unique split form of every reductive linear algebraic group.

The group $\Gamma := {\operatorname{Gal}}(\bar{k}:k)$ acts on $G$ in the usual way and $G$ is a $\Gamma$-group in the sense of the Section [Finite Group Cohomology](https://docs.magma-maths.org/FiniteGroups/CohomologyAndExtensions/group-cohomology.md#sectgrpcohom). The group ${\operatorname{Aut}}(G)$ of algebraic automorphisms of $G$ is also a $\Gamma$-group. The twisted forms of $G$ are in one-to-one correspondence with the $1$-cocycles of $\Gamma$ on ${\operatorname{Aut}}(G)$ and the forms are conjugate if and only if the cocycles are cohomologous. For practical purposes it is sufficient to compute the cohomology of $\Gamma={\operatorname{Gal}}(K:k)$ on ${\operatorname{Aut}}_K(G)$ for some finite Galois extension $K$ of $k$, where ${\operatorname{Aut}}_K(G)$ is the group of $K$-algebraic automorphisms of $G$.

The action of $\Gamma$ on $G$ induces an action on the root datum of $G$, and so we get an extended root datum. If $G$ is quasisplit, then it is determined by the extended root datum and the action of $\Gamma$ on $K$. In general, a cocycle is required to fully determine $G$.

<a id="construction-2"></a>
<a id="sectgrplieconstruct"></a>
### Constructing Groups of Lie Type

<a id="grplie-normalising"></a>
<a id="construction"></a>
<a id="subsectgrpliesplit"></a>
#### Split Groups

The following optional parameters are common to most of the intrinsics described in this section:

```magma
Normalising: BoolElt                    Default: true
```

The flag `Normalising` determines whether elements will be automatically converted to Bruhat form. This flag is automatically set to `false` if the group is defined over a nonfield.

```magma
Isogeny: BoolElt                    Default: "Ad"
Signs  : Any                        Default: 1
```

The optional parameters `Isogeny` and `Signs` can take the values described in Section [Constructing Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#sectrdconstr).

```magma
Method: MonStgElt                    Default: "Default"
```

The method to be used for operations with unipotent elements. See [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps)] for more details on the algorithms. Possible values are

- `"CollectionToLeft"` uses collection to the left.
- `"CollectionFromLeft"` uses collection from left.
- `"CollectionFromOutside"` uses collection from outside.
- `"Classical"` uses formulas for classical types [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps)]. This is only available for groups defined over a sparse (classical) root datum.
- `"Collection"` will choose the best of the above methods automatically.
- `"SymbolicToLeft"` uses Hall polynomials, which are computed using collection to the left.
- `"SymbolicFromLeft"` uses Hall polynomials, which are computed using collection from left.
- `"SymbolicFromOutside"` uses Hall polynomials, which are computed using collection from outside.
- `"SymbolicClassical"` uses Hall polynomials, which are computed by formulas. This is only available for groups defined over a sparse (classical) root datum.
- `"Symbolic"` will choose the best symbolic method automatically.
- `"Default"` will choose the best of all above methods automatically.

<a id="function-groupoflietype-monstgelt-rng"></a>
##### `GroupOfLieType(N, k): MonStgElt, Rng -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)) over the ring $k$.

<a id="function-groupoflietype-monstgelt-rngintelt"></a>
##### `GroupOfLieType(N, q): MonStgElt, RngIntElt -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Cartan name given by the string $N$ (see Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)) over the finite field of order $q$.

<a id="function-groupoflietype-grppermcox-rng"></a>
##### `GroupOfLieType(W, k): GrpPermCox, Rng -> GrpLie`

<a id="function-groupoflietype-grpmat-rng"></a>
##### `GroupOfLieType(W, k): GrpMat, Rng -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Weyl group $W$ over the ring $k$. The group $W$ must be a finite Coxeter group, given either as a permutation group or as a reflection group.

<a id="function-groupoflietype-grppermcox-rngintelt"></a>
##### `GroupOfLieType(W, q): GrpPermCox, RngIntElt -> GrpLie`

<a id="function-groupoflietype-grpmat-rngintelt"></a>
##### `GroupOfLieType(W, q): GrpMat, RngIntElt -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Weyl group $W$ over the finite field of order $q$. The group $W$ must be a finite Coxeter group, given either as a permutation group or as a reflection group.

<a id="function-groupoflietype-rootdtm-rng"></a>
##### `GroupOfLieType(R, k): RootDtm, Rng -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with root datum $R$ over the ring $k$.

<a id="function-groupoflietype-rootdtm-rngintelt"></a>
##### `GroupOfLieType(R, q): RootDtm, RngIntElt -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with root datum $R$ over the finite field of order $q$.

<a id="function-groupoflietype-mtrx-rng"></a>
##### `GroupOfLieType(C, k): Mtrx, Rng -> GrpLie`

<a id="function-groupoflietype-grphdir-rng"></a>
##### `GroupOfLieType(D, k): GrphDir, Rng -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Cartan matrix $C$ or Dynkin digraph $D$, over the ring $k$.

<a id="function-groupoflietype-mtrx-rngintelt"></a>
##### `GroupOfLieType(C, q): Mtrx, RngIntElt -> GrpLie`

<a id="function-groupoflietype-grphdir-rngintelt"></a>
##### `GroupOfLieType(D, q): GrphDir, RngIntElt -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the group of Lie type with Cartan matrix $C$ or Dynkin digraph $D$, over the finite field of order $q$.

<a id="function-simplegroupoflietype-monstgelt-rngintelt-rng"></a>
##### `SimpleGroupOfLieType(X, n, k): MonStgElt, RngIntElt, Rng -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the simple group of Lie type with Cartan name $X_n$ over the ring $k$, where the Cartan name is given by the string $X$ and integer $n$ (see also Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-simplegroupoflietype-monstgelt-rngintelt-rngintelt"></a>
##### `SimpleGroupOfLieType(X, n, q): MonStgElt, RngIntElt, RngIntElt -> GrpLie`

```magma
Isogeny    : BoolElt                      Default: "Ad"
Signs      : Any                          Default: 1
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

Construct the simple group of Lie type with name $X_n$ over the finite field of order $q$, where the Cartan name is given by the string $X$ and integer $n$ (see also Section [Finite and Affine Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterSystems/finiteaffine.md#sectcartanfinaff)).

<a id="function-groupoflietype-alglie"></a>
##### `GroupOfLieType(L): AlgLie -> GrpLie`

The group of Lie type corresponding to the Lie algebra $L$. The Lie algebra must be the algebraic (i.e., it must correspond to some group), and Magma must be able to determine that it is algebraic.

<a id="function-isnormalising-grplie"></a>
##### `IsNormalising(G): GrpLie -> BoolElt`

Returns the value of the flag `Normalising` of the group of Lie type $G$.

<a id="example-ex-108927"></a>
##### `Example: Creating a Split Group of Lie Type (ex-108927)`

```magma
> G := GroupOfLieType("E8", 2);
> G;
G: Group of Lie type E8 over Finite field of size 2
```

<a id="subsectgrpliegalcohom"></a>
<a id="id3"></a>
#### Galois Cohomology

If $G$ is a linear algebraic group defined over the field $k$ and $L$ is the algebraic closure of $k$, then the group $\Gamma := {\operatorname{Gal}}(L:k)$ acts on $G$ in the usual way and $G$ becomes a $\Gamma$-group in the sense of the Section [Finite Group Cohomology](https://docs.magma-maths.org/FiniteGroups/CohomologyAndExtensions/group-cohomology.md#sectgrpcohom) and ${\operatorname{Aut}}(G)$, the group of algebraic automorphisms of $G$ also becomes a $\Gamma$-group.

Now the twisted forms of $G$ are in one-to-one correspondence to the $1$-cocycles of $\Gamma$ on ${\operatorname{Aut}}(G)$ and the forms are conjugate if and only if the cocycles are cohomologous.

For practical purposes it is sufficient to compute the cohomology of ${\operatorname{Gal}}(K:k)$ on ${\operatorname{Aut}}_K(G)$ for some finite Galois field extension of $k$, where ${\operatorname{Aut}}_K(G)$ is the group of $K$-algebraic automorphisms of $G$.

These functions are based on [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)].

<a id="function-gammagroup-fld-grplie"></a>
##### `GammaGroup(k, G): Fld, GrpLie -> GGrp`

Returns the group of Lie type $G$ as a $\Gamma$-group with $\Gamma={\operatorname{Gal}}(K:k)$, where $K$ is the base field of $G$. The field $k$ must be a subfield of $K$.

<a id="function-gammagroup-fld-grplieauto"></a>
##### `GammaGroup(k, A): Fld, GrpLieAuto -> GGrp`

Returns the group $A = {\operatorname{Aut}}_K(G)$ of automorphisms of the group of Lie type $G$ as a $\Gamma$-group with $\Gamma={\operatorname{Gal}}(K:k)$, where $K$ is the base field of $G$. The field $k$ must be a subfield of $K$.

<a id="function-actinggroup-grplie"></a>
##### `ActingGroup(G): GrpLie -> Grp, Map`

<a id="function-actinggroup-grplieauto"></a>
##### `ActingGroup(A): GrpLieAuto -> Grp, Map`

Given the group of Lie type $G$ or the group $A$ of its automorphisms as a $\Gamma$-group, return $\Gamma={\operatorname{Gal}}(K:k)$ together with the map $m$ from the abstract Galois group $\Gamma$ into the set of field automorphisms, such that $m(\gamma)$ is the actual field automorphism for every $\gamma\in\Gamma$.

<a id="function-extendgaloiscocycle-onecoc"></a>
##### `ExtendGaloisCocycle(c): OneCoC -> OneCoC`

```magma
GBAl    : MonStgElt                    Default: "Walk"
Printeqs: BoolElt                      Default: false
```

The analogue to `ExtendCocycle`. Given a cocycle $c$ in $H^1(\Gamma, A/A_0)$, where $A = {\operatorname{Aut}}_K(G)$ and $\Gamma={\operatorname{Gal}}(K:k)$, extend the cocycle to a cocycle in $H^1(\Gamma, A)$. The optional parameter `GBAl` can be used to set the algorithm used for computing the Gröbner bases. The parameter `Printeqs` may be used to print out the polynomials whose Gröbner bases are computed. The current implementation only works for finite fields.

<a id="function-galoiscohomology-ggrp"></a>
##### `GaloisCohomology(A): GGrp -> SeqEnum`

```magma
GBAl     : MonStgElt                    Default: "Walk"
Printeqs : BoolElt                      Default: false
Recompute: BoolElt                      Default: false
```

Computes the Galois cohomology $H^1(\Gamma, {\operatorname{Aut}}_K(G))$, where $A$ is the automorphism group of $G$ as a $\Gamma$-group returned by `GammaGroup` and $\Gamma={\operatorname{Gal}}(K:k)$. The optional parameter `GBAl` can be used to set the algorithm used for computing the Gröbner bases. The parameter `Printeqs` may be used to print out the polynomials whose Gröbner bases are computed. And `Recompute` may be used to recompute the Galois cohomology. The current implementation only works for finite fields.

<a id="function-isintwistedform-grplieelt-onecoc"></a>
##### `IsInTwistedForm(x, c): GrpLieElt, OneCoC -> BoolElt`

Returns `true` if and only if the element $x$ of a group of Lie type is contained in the twisted form of its parent defined by the cocycle $c$.

<a id="example-ex-914f01"></a>
##### `Example: Galois Cohomology of a Group of Lie Type (ex-914f01)`

Compute the Galois cohomology of $A_3(5^2)$:

```magma
> q := 5;
> k := GF(q);
> K := GF(q^2);
>
> G := GroupOfLieType( "A3", K : Isogeny:="SC" );
> A := AutomorphismGroup(G);
>
> AGRP := GammaGroup( k, A );
> Gamma,m := ActingGroup(AGRP);
> Gamma;
Symmetric group Gamma acting on a set of cardinality 2
Order = 2
    (1, 2)
> m;
Mapping from: GrpPerm: Gamma to Set of all maps from GF(5^2) to GF(5^2)
given by a rule [no inverse]
> action  := GammaAction(AGRP);
>
> time GaloisCohomology(AGRP);
[
    [
        One-Cocycle
        defined by [
        Automorphism of $: Group of Lie type A3 over Finite field of size 5^2
        given by: Mapping from: $: Group of Lie type  to $: Group of Lie type
        Composition of Mapping from: $: Group of Lie type  to $: Group of
        Lie type  given by a rule and
        Mapping from: $: Group of Lie type  to $: Group of Lie type
        given by a rule
        Decomposition:
          Mapping from: GF(5^2) to GF(5^2)
        Composition of Mapping from: GF(5^2) to GF(5^2) given by a rule and
        Mapping from: GF(5^2) to GF(5^2) given by a rule,
          Id($),
          1
        ]
    ],
    [
        One-Cocycle
        defined by [
        Automorphism of $: Group of Lie type A3 over Finite field of size 5^2
        given by: Mapping from: $: Group of Lie type  to $: Group of Lie type
        Composition of Mapping from: $: Group of Lie type  to $: Group of
        Lie type  given by a rule and
        Mapping from: $: Group of Lie type  to $: Group of Lie type
        given by a rule
        Decomposition:
          Mapping from: GF(5^2) to GF(5^2)
        Composition of Mapping from: GF(5^2) to GF(5^2) given by a rule and
        Mapping from: GF(5^2) to GF(5^2) given by a rule,
          (1, 3),
          1
        ]
    ]
]
Time: 0.470
```

Now create the trivial cocycle:

```magma
> TrivialOneCocycle( AGRP );
One-Cocycle
defined by [
Automorphism of $: Group of Lie type A3 over Finite field of size 5^2
given by: Mapping from: $: Group of Lie type  to $: Group of Lie type
given by a rule
Decomposition:
  Mapping from: GF(5^2) to GF(5^2) given by a rule,
  Id($),
  1
]
>
```

And now the cocycle defining the group ${}^2\!A_3(5)$ and check for two elements if they are contained in ${}^2\!A_3(5)$:

```magma
> c := OneCocycle( AGRP, [GraphAutomorphism(G, Sym(3)!(1,3))] );
>
> x := Random(G);
> IsInTwistedForm( x, c );
false
>
> x := elt< G | <1,y>, <3,y @ m(Gamma.1)> > where y is Random(K);
> IsInTwistedForm( x, c );
true
>
```

#### Twisted Groups

The description of the twisted groups of Lie type is based on the extended root data, as described in the Section [Extended Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectextrd). These functions are mainly based on [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)].

<a id="function-twistedgroupoflietype-onecoc"></a>
##### `TwistedGroupOfLieType(c): OneCoC -> GrpLie`

Given the cocycle $c$ on the group of automorphisms of a split group of Lie type $G$, return the twisted form of $G$, defined by that cocycle.

<a id="function-twistedgroupoflietype-rootdtm-rng-rng"></a>
##### `TwistedGroupOfLieType(R, k, K): RootDtm, Rng, Rng -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

The twisted group of Lie type defined over the field $k$ with coefficients in the field $K$ corresponding to the twisted root datum $R$.

<a id="function-twistedgroupoflietype-rootdtm-rngintelt-rngintelt"></a>
##### `TwistedGroupOfLieType(R, q, r): RootDtm, RngIntElt, RngIntElt -> GrpLie`

```magma
Normalising: BoolElt                      Default: true
Method     : MonStgElt                    Default: "Default"
```

The twisted group of Lie type defined over the finite field of order $q$ with coefficients in the finite field of order $r$ (where $r$ is a power of $q$) corresponding to the twisted root datum $R$.

<a id="function-twistedgroupoflietype-monstgelt-rngintelt-rngintelt"></a>
##### `TwistedGroupOfLieType(t, r, q): MonStgElt, RngIntElt, RngIntElt -> GrpLie`

The twisted simply connected group of Lie type $t$ and rank $r$ defined over the finite field of order $q$.

<a id="example-ex-a0e6f9"></a>
##### `Example: Twisted Group of Type 3D4 (ex-a0e6f9)`

The twisted group ${}^3{\rm D}_4(5)$.

```magma
> G := TwistedGroupOfLieType("3D",4,5);
> G;
G: Twisted group of Lie type 3D4,2 over GF(5) with entries over GF(5^3)
> R := RootDatum(G);
> R;
R: Twisted simply connected root datum of dimension 4 of type 3D4,2
```

<a id="function-basering-grplie"></a>
##### `BaseRing(G): GrpLie -> Rng`

<a id="function-coefficientring-grplie"></a>
##### `CoefficientRing(G): GrpLie -> Rng`

The coefficient ring of the (twisted) group of Lie type $G$, that is the base ring of the untwisted overgroup of $G$.

<a id="function-defring-grplie"></a>
##### `DefRing(G): GrpLie -> Rng`

The ring over which the (twisted) group of Lie type $G$ is defined. If $G$ is split, this is the same as the base ring of $G$.

<a id="function-untwistedovergroup-grplie"></a>
##### `UntwistedOvergroup(G): GrpLie -> GrpLie`

The untwisted overgroup, inside which the twisted group of Lie type $G$ was constructed.

<a id="example-ex-61dd3f"></a>
##### `Example: Twisted Group 2A3 as a Subgroup (ex-61dd3f)`

The twisted group ${}^2\!A_3(5)$ as a subgroup of $A_3(5^2)$.

```magma
> R := RootDatum("A3" : Twist := 2);
> G := TwistedGroupOfLieType(R,5,25);
> G;
G: Twisted group of Lie type 2A3,2 over GF(5) with entries over GF(5^2)
> BaseRing(G);
Finite field of size 5^2
> DefRing(G);
Finite field of size 5
> UntwistedOvergroup(G);
Group of Lie type A3 over GF(5^2)
```

<a id="function-relativerootelement-grplie-rngintelt-fldelt"></a>
##### `RelativeRootElement(G, delta, t): GrpLie, RngIntElt, [FldElt] -> GrpLieElt`

The relative root element corresponding to the relative root $\delta$ of the twisted group of Lie type $G$ and the field elements given by the sequence $t$. This is the element $u_\delta(t)$ in [[Hal05](https://docs.magma-maths.org/references.md#cite-sh), (4.5)].

<a id="example-ex-55c70c"></a>
##### `Example: Twisted Group via a Cocycle (ex-55c70c)`

Here we create the same group as in the previous example, but using a cocycle.

```magma
> q := 5; k := GF(q); K := GF(q^2);
>
> G := GroupOfLieType( "A3", K );
> A := AutomorphismGroup(G);
>
> AGRP := GammaGroup( k, A );
> c := OneCocycle( AGRP, [GraphAutomorphism(G, Sym(3)!(1,3))] );
>
> T := TwistedGroupOfLieType(c);
> T eq TwistedGroupOfLieType(RootDatum("A3":Twist:=2),k,K);
true
> G eq UntwistedOvergroup(T);
true
>
> x := Random(G); x in T;
false
>
> x := RelativeRootElement(T,2,[Random(K)]); x;
x1($.1^22) x3($.1^14)
> x in T;
true
```

<a id="operations"></a>
<a id="sectgrplieops"></a>
### Operations on Groups of Lie Type

Many of the basic operations for Coxeter groups are shortcuts for obtaining information about the underlying root datum (Chapter [Root Data](https://docs.magma-maths.org/LieTheory/RootData/index-root-data.md#chaprootdtm)). Such functions are listed here; see Sections [Operations on Root Data](https://docs.magma-maths.org/LieTheory/RootData/operators-root-dtm.md#sectrdop), [Properties of Root Data](https://docs.magma-maths.org/LieTheory/RootData/properties-root-datum.md#sectrdprop), [Roots, Coroots, and Weights](https://docs.magma-maths.org/LieTheory/RootData/roots-coroots-weights.md#sectrdroot), and [Operations on Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/group-op.md#sectgrppermcoxop) for more details and examples of their use.

<a id="operation-op-eq-grplie-grplie"></a>
#### `G eq H: GrpLie, GrpLie -> BoolElt`

Returns `true` iff the groups of Lie type $G$ and $H$ are equal.

<a id="operation-op-subset-grplie-grplie"></a>
#### `G subset H: GrpLie, GrpLie -> BoolElt`

Returns `true` iff the group of Lie type $G$ is a subset of $H$.

<a id="function-isalgebraicallyisomorphic-grplie-grplie"></a>
#### `IsAlgebraicallyIsomorphic(G, H): GrpLie, GrpLie -> BoolElt, Map`

Returns `true` if the semisimple groups $G$ and $H$ are isomorphic as algebraic groups (i.e. they have the same base rings and isomorphic root data). If `true`, then the second value returned is an isomorphism.

<a id="function-isisogenous-grplie-grplie"></a>
#### `IsIsogenous(G, H): GrpLie, GrpLie -> BoolElt`

Returns `true` if $G$ and $H$ are isogenous. The groups must be semisimple and defined over the same field. If `true`, the subsequent values returned are: the corresponding adjoint group $G_{ad}$, the homomorphisms $G_{ad}\to G$ and $G_{ad}\to H$, the corresponding simply connected root datum $G_{sc}$, and the homomorphisms $G\to G_{sc}$ and $H\to G_{sc}$.

<a id="function-iscartanequivalent-grplie-grplie"></a>
#### `IsCartanEquivalent(G, H): GrpLie, GrpLie -> BoolElt`

Returns `true` if, and only if, the groups of Lie type $G$ and $H$ are Cartan equivalent, i.e. they have isomorphic Dynkin diagrams and defined over the same ring.

<a id="function-basering-grplie-2"></a>
#### `BaseRing(G): GrpLie -> Rng`

<a id="function-coefficientring-grplie-2"></a>
#### `CoefficientRing(G): GrpLie -> Rng`

The base ring $k$ of the group of Lie type $G$.

<a id="function-baseextend-grplie-rng"></a>
#### `BaseExtend(G, K): GrpLie, Rng -> GrpLie, Map`

Given a group of Lie type $G$ with base ring $k$ and a larger ring $K$, return the group $G(K)$ gotten by extending the base ring and the injection $G\to G(K)$.

<a id="function-changering-grplie-rng"></a>
#### `ChangeRing(G, K): GrpLie, Rng -> GrpLie`

Given a group of Lie type $G$ and a ring $K$, return the group with the same root datum, but defined over a different ring.

<a id="function-generators-grplie"></a>
#### `Generators(G): GrpLie -> {}`

Generators for the group of Lie type $G$ as an abstract group. This is currently only implemented when the base ring is a finite field.

<a id="function-numberofgenerators-grplie"></a>
#### `NumberOfGenerators(G): GrpLie -> RngIntElt`

<a id="function-ngens-grplie"></a>
#### `Ngens(G): GrpLie -> RngIntElt`

The number of generators for the group of Lie type $G$ as an abstract group. This is currently only implemented when the base ring is a finite field.

<a id="function-algebraicgenerators-grplie"></a>
#### `AlgebraicGenerators(G): GrpLie -> {}`

A set of generators for the group of Lie type $G$ as an algebraic group.

<a id="function-numberofalgebraicgenerators-grplie"></a>
#### `NumberOfAlgebraicGenerators(G): GrpLie -> RngIntElt`

<a id="function-nalggens-grplie"></a>
#### `Nalggens(G): GrpLie -> RngIntElt`

The number of generators for the group of Lie type $G$ as an algebraic group.

<a id="example-ex-a929c8"></a>
#### `Example: Generators of a Group of Lie Type (ex-a929c8)`

```magma
> k<z> := GF(4);
> G := GroupOfLieType("A2", k : Normalising:=false);
> Generators(G);
[ x1(1) , x4(1) , x1(z) , x4(z) , x2(1) , x5(1) , x2(z) , x5(z) , ( z   1) ,
(1   z)  ]
> AlgebraicGenerators(G);
[ x1(1) , x2(1) , x4(1) , x5(1) , ( z   1) , ( 1   z)  ]
```

<a id="function-order-grplie"></a>
#### `Order(G): GrpLie -> RngIntElt`

<a id="operation-operation-grplie-rngintelt"></a>
#### `# G: GrpLie -> RngIntElt`

The order of the group of Lie type $G$.

<a id="function-factoredorder-grplie"></a>
#### `FactoredOrder(G): GrpLie -> RngIntElt`

The factored order of the group of Lie type $G$.

<a id="function-dimension-grplie"></a>
#### `Dimension(G): GrpLie -> RngIntElt`

The dimension of the group of Lie type $G$, considered as an algebraic variety.

<a id="example-ex-1128fd"></a>
#### `Example: Orders of Groups of Lie Type (ex-1128fd)`

```magma
> G := GroupOfLieType("G2", 3);
> Order(G);
4245696
> FactoredOrder(G);
[ <2, 8>, <13, 1>, <3, 6>, <7, 1> ]
> G := GroupOfLieType("G2", Rationals());
> Order(G);
Infinity
> Dimension(G);
14
```

<a id="function-cartanname-grplie"></a>
#### `CartanName(G): GrpLie -> Mtrx`

The Cartan name of the group of Lie type $G$.

<a id="function-rootdatum-grplie"></a>
#### `RootDatum(G): GrpLie -> RootDtm`

The root datum of the group of Lie type $G$.

<a id="procedure-dynkindiagram-grplie"></a>
#### `DynkinDiagram(G): GrpLie`

Print the Dynkin diagram of the group of Lie type $G$.

<a id="procedure-coxeterdiagram-grplie"></a>
#### `CoxeterDiagram(G): GrpLie`

Print the Coxeter diagram of the group of Lie type $G$.

<a id="function-coxetermatrix-grplie"></a>
#### `CoxeterMatrix(G): GrpLie -> AlgMatElt`

The Coxeter matrix of the group of Lie type $G$.

<a id="function-coxetergraph-grplie"></a>
#### `CoxeterGraph(G): GrpLie -> GrphUnd`

The Coxeter graph of the group of Lie type $G$.

<a id="function-cartanmatrix-grplie"></a>
#### `CartanMatrix(G): GrpLie -> GrphUnd`

The Cartan matrix of the group of Lie type $G$.

<a id="function-dynkindigraph-grplie"></a>
#### `DynkinDigraph(G): GrpLie -> GrphUnd`

The Dynkin digraph of the group of Lie type $G$.

<a id="function-rank-grplie"></a>
#### `Rank(G): GrpLie -> RngIntElt`

<a id="function-reductiverank-grplie"></a>
#### `ReductiveRank(G): GrpLie -> RngIntElt`

The reductive rank of the group of Lie type $G$, i.e. the dimension of the underlying root datum.

<a id="function-semisimplerank-grplie"></a>
#### `SemisimpleRank(G): GrpLie -> RngIntElt`

The semisimple rank of the group of Lie type $G$, i.e. the rank of the underlying root datum.

<a id="function-coxeternumber-grplie"></a>
#### `CoxeterNumber(G): GrpLie -> RngIntElt`

The Coxeter number of the group of Lie type $G$, i.e. the order of the Coxeter element in the Weyl group of $G$.

<a id="function-weylgroup-grplie"></a>
#### `WeylGroup(G): GrpLie -> GrpPermCox`

<a id="function-weylgroup-cat-grplie"></a>
#### `WeylGroup(GrpPermCox, G): Cat, GrpLie -> GrpPermCox`

The Weyl group of the group of Lie type $G$ as a permutation Coxeter group. This is a crystallographic Coxeter group, see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrppermcox).

<a id="function-weylgroup-cat-grplie-2"></a>
#### `WeylGroup(GrpFPCox, G): Cat, GrpLie -> GrpFPCox`

The Weyl group of the group of Lie type $G$ as a finitely presented Coxeter group. This is a crystallographic Coxeter group, see Chapter [Coxeter Groups](https://docs.magma-maths.org/LieTheory/CoxeterGroups/index-coxeter-groups.md#chapgrpfpcox).

<a id="function-weylgroup-cat-grplie-3"></a>
#### `WeylGroup(GrpMat, G): Cat, GrpLie -> GrpMat`

The Weyl group of the group of Lie type $G$ as a reflection group. This is a crystallographic Coxeter group, see Chapter [Reflection Groups](https://docs.magma-maths.org/LieTheory/ReflectionGroups/index-reflection-groups.md#chapgrprfl).

<a id="function-fundamentalgroup-grplie"></a>
#### `FundamentalGroup(G): GrpLie -> GrpAb, Map`

The fundamental group of the group of Lie type $G$, together with the projection of the weight lattice onto the fundamental group.

<a id="function-isogenygroup-grplie"></a>
#### `IsogenyGroup(G): GrpLie -> GrpAb, Map`

The isogeny group of the group of Lie type $G$, together with its injection into the fundamental group.

<a id="function-coisogenygroup-grplie"></a>
#### `CoisogenyGroup(G): GrpLie -> GrpAb, Map`

The coisogeny group of the group of Lie type $G$, together with its projection onto the fundamental group.

### Properties of Groups of Lie Type

<a id="function-isfinite-grplie"></a>
#### `IsFinite(G): GrpLie -> BoolElt`

Return `true` if and only if the group of Lie type $G$ is finite.

<a id="function-isabelian-grplie"></a>
#### `IsAbelian(G): GrpLie -> BoolElt`

Returns `true` if the group of Lie type $G$ is abelian.

<a id="function-issimple-grplie"></a>
#### `IsSimple(G): GrpLie -> BoolElt`

Returns `true` if the group of Lie type $G$ is a simple group as an algebraic group, ie, $G$ has no proper *connected* normal subgroups. This is true if, and only if, the underlying root datum is irreducible. Note that this does not usually mean that $G$ is simple as an abstract group. In previous releases of Magma this function was incorrectly called `IsIrreducible`.

<a id="function-issimplylaced-grplie"></a>
#### `IsSimplyLaced(G): GrpLie -> BoolElt`

Returns `true` if the group of Lie type $G$ is simply laced, i.e. its Dynkin diagram contains no multiple bonds.

<a id="function-issemisimple-grplie"></a>
#### `IsSemisimple(G): GrpLie -> BoolElt`

Returns `true` if the group of Lie type $G$ is semisimple.

<a id="function-isadjointg"></a>
#### `IsAdjoint(G): GrpLie -> BoolElt`

Returns `true` if, and only if, the group of Lie type $G$ is adjoint (i.e. the isogeny group is trivial).

<a id="function-isweaklyadjoint-grplie"></a>
#### `IsWeaklyAdjoint(G): GrpLie -> BoolElt`

Returns `true` if, and only if, the group of Lie type $G$ is weakly adjoint, i.e. its isogeny group is isomorphic to ${\mathbb{Z}}^n$, where $n$ is the difference between the rank and the semisimple rank of $G$. Note that if $G$ is semisimple then this function is identical to [`IsAdjoint`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-isadjointg).

<a id="function-issimplyconnectedg"></a>
#### `IsSimplyConnected(G): GrpLie -> BoolElt`

Returns `true` if, and only if, the group of Lie type $G$ is simply connected (i.e. the isogeny group is equal to the fundamental group, i.e. the coisogeny group is trivial).

<a id="function-isweaklysimplyconnected-grplie"></a>
#### `IsWeaklySimplyConnected(G): GrpLie -> BoolElt`

Returns `true` if, and only if, the group of Lie type $G$ is weakly simply connected, i.e. its coisogeny group is isomorphic to ${\mathbb{Z}}^n$, where $n$ is the difference between the rank and the semisimple rank of $G$. Note that if $G$ is semisimple then this function is identical to [`IsSimplyConnected`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/element-properties.md#function-issimplyconnectedg).

<a id="function-issplit-grplie"></a>
#### `IsSplit(G): GrpLie -> BoolElt`

Returns `true` if and only if the group of Lie type $G$ is split.

<a id="function-istwisted-grplie"></a>
#### `IsTwisted(G): GrpLie -> BoolElt`

Returns `true` if and only if the group of Lie type $G$ is twisted.

<a id="element-construction"></a>
<a id="sectgrplieconstructelt"></a>
### Constructing Elements

<a id="constructor-constructor-elt-grplie-list-grpmatelt"></a>
#### `elt<G | L>: GrpLie, List -> GrpMatElt`

Given a group of Lie type $G$ over the ring $R$ and a list $L$ of appropriate objects, construct an element of $G$. Suppose the underlying root datum has dimension $d$, rank $n$, and roots $\alpha_1,\dots,\alpha_{2N}$. Each entry in the list can be one of the following:

1. A tuple $<r,t>$ where $r=1,\dots,2N$ and $t\in R$. This corresponds to the unipotent term $x_r(t)$.
2. A sequence of tuples as in item (1).
3. A sequence $[t_1,\dots,t_N]$ of elements of $R$. This is stored internally as $[t_1,\dots,t_N]$ but it represents the unipotent element $x_{i_1}(t_{i_1})\cdots x_{i_N}(t_{i_N})$, where $i_1$, $i_2$, …, $i_N$ is either $1,2,\dots, N$ or the additive order of the positive roots of $G$. (See below for more details.)
4. An integer $r=1,\dots,2N$. This corresponds to the Weyl group representative $n_r$.
5. A Weyl group element $w$, either as a word or as a permutation. This corresponds to the Weyl group representative $\dot{w}$.
6. A vector $v\in R^d$ with each entry invertible. This corresponds to an element of the torus.
7. An element of $G$, either previously constructed or (recursively) given as a list of terms of the forms 1 to 7.

Internally a unipotent component of an element of $G$ is stored as a sequence $[t_1,\dots,t_N]$ of field (or ring) elements. This sequence represents the **sequence** $[x_1(t_1),\dots,x_N(t_N)]$ of root elements. However, its interpretation as a unipotent element depends on the collection method chosen for the multiplication. If the collection method is `SymbolicFromOutside` or `CollectionFromOutside` the sequence represents the product $x_{i_1}(t_{i_1})\cdots x_{i_N}(t_{i_N})$ where $i_1, i_2, \dots, i_N$ is `AdditiveOrder(G)` (i.e., the Papi order of the longest element of the Weyl group); for all other collection methods it represents $x_1(t_1) \cdots x_N(t_N)$.

`CollectionFromOutside` is the default for non-sparse root data.

<a id="function-identity-grplie"></a>
#### `Identity(G): GrpLie -> GrpLieElt`

<a id="function-id-grplie"></a>
#### `Id(G): GrpLie -> GrpLieElt`

<a id="operation-op-grplie-rngintelt"></a>
#### `G ! 1: GrpLie, RngIntElt -> GrpLieElt`

<a id="constructor-constructor-elt-grplie-grplieelt"></a>
#### `elt< G | >: GrpLie -> GrpLieElt`

The identity element of the group of Lie type $G$.

<a id="example-ex-749aa7"></a>
#### `Example: Constructing Elements of a Group of Lie Type (ex-749aa7)`

```magma
> G := GroupOfLieType("A5", Rationals() : Normalising := false);
> V := VectorSpace(Rationals(), 5);
> NumPosRoots(G);
15
> elt< G | <5,1/2>, 1,3,2, [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15],
>          V![6,1/3,-1,3,2/3] >;
x5(1/2) n1 n3 n2 x1(1) x6(6) x10(10) x13(13) x15(15) x2(2) x7(7) x11(11)
x14(14) x3(3) x8(8) x12(12) x4(4) x9(9) x5(5) (  6 1/3  -1   3 2/3)
```

<a id="function-torusterm-grplie-rngintelt-rngelt"></a>
#### `TorusTerm(G, r, t): GrpLie, RngIntElt, RngElt -> GrpLieElt`

The torus term $h_r(t)=\alpha_r^\star\otimes t$ in the group of Lie type $G$, where $r$ is the index of the coroot $\alpha_r^\star$ and $t$ an element of the base ring of $G$.

<a id="function-coxeterelement-grplie"></a>
#### `CoxeterElement(G): GrpLie -> GrpPermElt`

The Coxeter element of the group of Lie type $G$, i.e. the representative of the Coxeter element in the Weyl group of $G$.

<a id="function-random-grplie"></a>
#### `Random(G): GrpLie -> GrpLieElt`

```magma
Uniform: BoolElt                    Default: true
```

An element of the (twisted or untwisted) finite group of Lie type $G$ chosen at random. The base ring of $G$ must be finite. If the optional parameter `Uniform` is set to `true`, the random elements to be distributed uniformly. If the optional parameter `Uniform` is set to `false`, this function is much faster but the random elements are not distributed uniformly. Instead each double coset of the Borel subgroup occurs with equal frequency, and the elements are uniformly distributed within each double coset.

<a id="function-eltlist-grplieelt"></a>
#### `Eltlist(g): GrpLieElt -> List`

The list corresponding to the element $g$ of a group of Lie type.

<a id="function-centrepolynomials-grplie"></a>
#### `CentrePolynomials(G): GrpLie -> {}`

<a id="function-centerpolynomials-grplie"></a>
#### `CenterPolynomials(G): GrpLie -> {}`

A set of polynomials which are satisfied by the coordinates of a torus element $h$ of the group of Lie type $G$ if, and only if, $h$ is in the centre of $G$.

<a id="example-ex-1715e7"></a>
#### `Example: Centre of a Semisimple Group (ex-1715e7)`

The centre of a semisimple group is finite, so the centre polynomials can be used to find all central elements.

```magma
> G := GroupOfLieType("B3", Rationals() : Isogeny:="SC");
> pols := CentrePolynomials(G);
> pols;
{
    -h[2] + h[3]^2,
    h[1]^2 - h[2],
    -h[1]*h[3]^2 + h[2]^2
}
> S := Scheme(AffineSpace(Rationals(), 3), Setseq(pols));
> pnts := RationalPoints(S);
> pnts;
{@ (0, 0, 0), (1, 1, -1), (1, 1, 1) @}
```

The rational points of $S$ can be converted into elements of $G$, taking care to eliminate any point which has a coordinate equal to zero:

```magma
> V := VectorSpace(Rationals(), 3);
> [ elt< G | V!Eltseq(pnt) > : pnt in pnts | &*Eltseq(pnt) ne 0 ];
[ (1  1 -1) , 1 ]
```

<a id="element-operators-2"></a>
<a id="sectgrplieeltops"></a>
### Operations on Elements

<a id="element-operators"></a>
<a id="subsectgrplieeltops"></a>
#### Basic Operations

<a id="operation-op-times-grplieelt-grplieelt"></a>
##### `g * h: GrpLieElt, GrpLieElt -> GrpLieElt`

The product of two elements of a group of Lie type. If the [`Normalising`](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/construction.md#grplie-normalising) flag is set for the group, then the product is normalised using the algorithms of [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps), [CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)]. Otherwise, the words are just concatenated.

<a id="example-ex-e7b37f"></a>
##### `Example: Normalised and Unnormalised Products (ex-e7b37f)`

If the `Normalising` flag is set, the product is normalised, otherwise multiplication is just concatenation.

```magma
> G := GroupOfLieType("G2", GF(3) : Normalising:=false );
> V := VectorSpace(GF(3),2);
> g := elt< G | 1,2,1,2, V![2,2], <1,2>,<5,1> >;
> h := elt< G | <3,2>, V![1,2], 1 >;
> g*h;
n1 n2 n1 n2 (2 2) x1(2) x5(1) x3(2) (1 2) n1
> H := GroupOfLieType("G2", GF(3) : Normalising:=true  );
> g := elt< H | 1,2,1,2, V![2,2], <1,2>,<5,1> >;
> h := elt< H | <3,2>, V![1,2], 1 >;
> g*h;
x2(1) x3(1) (1 2) n1 n2 n1 n2 n1 x4(1)
```

<a id="operation-op-pow-grplieelt"></a>
##### `g ^ -1: GrpLieElt -> GrpLieElt`

<a id="function-inverse-grplieelt"></a>
##### `Inverse(G): GrpLieElt -> GrpLieElt`

The inverse of the element $g$ of a group of Lie type.

<a id="operation-op-pow-grplieelt-rngintelt"></a>
##### `g ^ n: GrpLieElt, RngIntElt -> GrpLieElt`

The $n$th power of the element $g$ of a group of Lie type.

<a id="operation-op-pow-grplieelt-grplieelt"></a>
##### `g ^ h: GrpLieElt, GrpLieElt -> GrpLieElt`

The conjugate $h^{-1}gh$, where $g$ and $h$ are elements of a group of Lie type.

<a id="literal-literal-g-h-grplieelt-grplieelt-grplieelt"></a>
##### `(g, h): GrpLieElt, GrpLieElt -> GrpLieElt`

<a id="function-commutator-grplieelt-grplieelt"></a>
##### `Commutator(g, h): GrpLieElt, GrpLieElt -> GrpLieElt`

The commutator $g^{-1}h^{-1}gh$ of $g$ and $h$, where $g$ and $h$ are elements of a group of Lie type.

<a id="procedure-normalise-grplieelt-ref"></a>
##### `Normalise(~g): GrpLieElt`

<a id="procedure-normalize-grplieelt-ref"></a>
##### `Normalize(~g): GrpLieElt`

<a id="function-normalise-grplieelt"></a>
##### `Normalise(g): GrpLieElt -> GrpLieElt`

<a id="function-normalize-grplieelt"></a>
##### `Normalize(g): GrpLieElt -> GrpLieElt`

Normalise the element $g$ of a group of Lie type $G$. The procedural form is slightly more efficient than the functional form. If the `Normalise` flag is set for $G$, this operation has no effect. This uses the algorithms of [[CHM08](https://docs.magma-maths.org/references.md#cite-computunipgrps), [CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="example-ex-6ee091"></a>
##### `Example: Arithmetic in Groups of Lie Type (ex-6ee091)`

Arithmetic in groups of Lie type.

```magma
> k<z> := GF(4);
> G := GroupOfLieType("C3", k);
> V := VectorSpace(k, 3);
> g := elt< G | 1,2,3, <3,z>,<4,z^2>, V![1,z^2,1] >;
> g;
x7(z^2) x8(z^2) (  z   1   z) n1 n2 n3 x3(z) x6(z^2)
> h := elt< G | [0,1,z,1,0,z^2,1,1,z] >;
> h;
x3(z) x7(1) x6(z^2) x8(1) x9(z) x2(1) x4(1)
> g * h^-1;
x3(z) x7(z^2) x6(z) x8(1) (  z   1   z) n1 n2 n3 x5(z) x6(z)
> g^3;
x3(z) x5(z) x7(z^2) x8(z^2) (z^2 z^2 z^2) n1 n2 n1 n3 n2 n1 n3 n2 n3
x3(z) x5(z^2) x7(z) x6(1) x8(z^2) x2(z) x4(1) x1(z)
```

<a id="subsectgrplieeltdecomp"></a>
<a id="id3"></a>
#### Decompositions

<a id="function-bruhat-grplieelt"></a>
##### `Bruhat(g): GrpLieElt -> GrpLieElt, GrpLieElt, GrpLieElt, GrpLieElt`

Given an element $g$ of a group of Lie type the Bruhat decomposition of $g$ is returned. The function returns elements $u$, $h$, $\dot{w}$, $u'$ with the properties described in Subsection [Bruhat Normalisation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#subsectgrpliebruhat) and so that $g=uh\dot{w}u'$.

<a id="example-ex-95f5c0"></a>
##### `Example: Bruhat Decomposition of an Element (ex-95f5c0)`

```magma
> k<z> := GF(4);
> G := GroupOfLieType("C3", k);
> V := VectorSpace(k, 3);
> g := elt< G | 1,2,3, <3,z>,<4,z^2>, V![1,z^2,1] >;
> Normalise(g);
x7(z^2) x8(z^2) (  z   1   z) n1 n2 n3 x3(z) x6(z^2)
> u, h, w, up := Bruhat(g);
> u; h; w; up;
x7(z^2) x8(z^2)
(  z   1   z)
n1 n2 n3
x3(z) x6(z^2)
```

<a id="function-multiplicativejordandecomposition-grplieelt"></a>
##### `MultiplicativeJordanDecomposition(x): GrpLieElt -> GrpLieElt, GrpLieElt`

The multiplicative Jordan decomposition of the element $x$ of the group of Lie type.

<a id="conjugacy-cohomology"></a>
<a id="subsectgrplieeltconj"></a>
#### Conjugacy and Cohomology

<a id="function-conjugateintotorus-grplieelt"></a>
##### `ConjugateIntoTorus(g): GrpLieElt -> GrpLieElt, GrpLieElt`

Given a semisimple element $g$ in a finite group of Lie type, return a torus element $t$ and conjugator $x$ such that $t=xgx^{-1}$. The elements returned may be defined over a larger field than the input element.

<a id="function-conjugateintoborel-grplieelt"></a>
##### `ConjugateIntoBorel(g): GrpLieElt -> GrpLieElt, GrpLieElt`

Given a semisimple element $g$ in a finite group of Lie type, return a Borel element $b$ and conjugator $x$ such that $b=xgx^{-1}$. The elements returned may be defined over a larger field that the input element. Although any element of a group of Lie type can be conjugated into the Borel subgroup, this function is currently only implemented for semisimple elements.

<a id="function-lang-grplieelt-rngintelt"></a>
##### `Lang(c, q): GrpLieElt, RngIntElt -> GrpLieElt`

Given an element $c$ in a finite group of Lie type and $q$ a power of the characteristic, return a solution $a$ of the Lang equation $c = a^{-F} a$. Here $F$ is the Frobenius automorphism gotten by taking $q$th powers in the field.

### Properties of Elements

<a id="function-issemisimple-grplieelt"></a>
#### `IsSemisimple(x): GrpLieElt -> BoolElt`

Return `true` if, and only if, the element $x$ of the group of Lie type is semisimple.

<a id="function-isunipotent-grplieelt"></a>
#### `IsUnipotent(x): GrpLieElt -> BoolElt`

Return `true` if, and only if, the element $x$ of the group of Lie type is unipotent.

<a id="function-iscentral-grplieelt"></a>
#### `IsCentral(x): GrpLieElt -> BoolElt`

Return `true` if, and only if, the element $x$ of the group of Lie type is in the centre of its parent group.

<a id="roots-coroots-weights"></a>
<a id="sectgrplieroot"></a>
### Roots, Coroots, and Weights

The roots are stored as an indexed set

$$
\{@\; \alpha_1,\dots,\alpha_N,\alpha_{N+1},\dots,\alpha_{2N} \; @\},
$$

where $\alpha_1,\dots,\alpha_N$ are the positive roots in an order compatible with height; and $\alpha_{N+1},\dots,\alpha_{2N}$ are the corresponding negative roots (i.e. $\alpha_{i+N}=-\alpha_i$). The simple roots are $\alpha_1,\dots,\alpha_n$ where $n$ is the rank.

Many of these functions have an optional argument `Basis` which may take one of the following values

1. `"Standard"`: the standard basis for the (co)root space. This is the default.
2. `"Root"`: the basis of simple (co)roots.
3. `"Weight"`: the basis of fundamental (co)weights (see Subsection [Weights](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/roots-coroots-weights.md#subsectgrplierootweight) below).

<a id="access"></a>
<a id="subsectgrplierootaccess"></a>
#### Accessing Roots and Coroots

<a id="function-rootspace-grplie"></a>
##### `RootSpace(G): GrpLie -> Lat`

<a id="function-corootspace-grplie"></a>
##### `CorootSpace(G): GrpLie -> Lat`

The lattice containing the (co)roots of the group of Lie type $G$.

<a id="function-simpleroots-grplie"></a>
##### `SimpleRoots(G): GrpLie -> Mtrx`

<a id="function-simplecoroots-grplie"></a>
##### `SimpleCoroots(G): GrpLie -> Mtrx`

The simple (co)roots of the group of Lie type $G$ as the rows of a matrix.

<a id="function-numberofpositiveroots-grplie"></a>
##### `NumberOfPositiveRoots(G): GrpLie -> RngIntElt`

<a id="function-numposroots-grplie"></a>
##### `NumPosRoots(G): GrpLie -> RngIntElt`

The number of positive roots of the group of Lie type $G$.

<a id="function-roots-grplie"></a>
##### `Roots(G): GrpLie -> SetIndx`

<a id="function-coroots-grplie"></a>
##### `Coroots(G): GrpLie -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

An indexed set containing the (co)roots of the group of Lie type $G$.

<a id="function-positiveroots-grplie"></a>
##### `PositiveRoots(G): GrpLie -> SetIndx`

<a id="function-positivecoroots-grplie"></a>
##### `PositiveCoroots(G): GrpLie -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

An indexed set containing the positive (co)roots of the group of Lie type $G$.

<a id="function-root-grplie-rngintelt"></a>
##### `Root(G, r): GrpLie, RngIntElt -> SetIndx`

<a id="function-coroot-grplie-rngintelt"></a>
##### `Coroot(G, r): GrpLie, RngIntElt -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The $r$th (co)root of the group of Lie type $G$.

<a id="function-rootposition-grplie"></a>
##### `RootPosition(G, v): GrpLie, . -> SetIndx`

<a id="function-corootposition-grplie"></a>
##### `CorootPosition(G, v): GrpLie, . -> SetIndx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

If $v$ is a (co)root of the group of Lie type $G$, this returns its position; otherwise it returns 0.

<a id="example-ex-ac3db4"></a>
##### `Example: Roots and Coroots of an Isogenous A3 (ex-ac3db4)`

```magma
> G := GroupOfLieType("A3", 25 : Isogeny := 2);
> Roots(G);
{@
    (1 0 0),
    (0 1 0),
    (1 0 2),
    (1 1 0),
    (1 1 2),
    (2 1 2),
    (-1  0  0),
    (0 -1  0),
    (-1  0 -2),
    (-1 -1  0),
    (-1 -1 -2),
    (-2 -1 -2)
@}
> PositiveCoroots(G);
{@
    (2 -1 -1),
    (-1  2  0),
    (0 -1  1),
    (1  1 -1),
    (-1  1  1),
    (1 0 0)
@}
> #Roots(G) eq 2*NumPosRoots(G);
true
> Coroot(G, 4);
(1  1 -1)
> Coroot(G, 4 : Basis := "Root");
(1 1 0)
> CorootPosition(G, [1,1,-1]);
4
> CorootPosition(G, [1,1,0] : Basis := "Root");
4
```

<a id="function-highestroot-grplie"></a>
##### `HighestRoot(G): GrpLie -> LatElt`

<a id="function-highestlongroot-grplie"></a>
##### `HighestLongRoot(G): GrpLie -> LatElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique (long) root of greatest height in the root datum of the group of Lie type $G$.

<a id="function-highestshortroot-grplie"></a>
##### `HighestShortRoot(G): GrpLie -> LatElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique short root of greatest height in the root datum of the group of Lie type $G$.

<a id="example-ex-69e0c7"></a>
##### `Example: Highest Roots of G2 (ex-69e0c7)`

```magma
> G := GroupOfLieType("G2", RealField());
> HighestRoot(G);
(3 2)
> HighestLongRoot(G);
(3 2)
> HighestShortRoot(G);
(2 1)
```

<a id="rootrefl"></a>
<a id="subectgrplierootaction"></a>
#### Reflections

The reflections in the Weyl group have representatives in the group of Lie type.

<a id="function-reflections-grplie"></a>
##### `Reflections(G): GrpLie -> GrpLieElt`

The sequence of representatives of reflections in the group of Lie type $G$.

<a id="function-reflection-grplie-rngintelt"></a>
##### `Reflection(G, r): GrpLie, RngIntElt -> GrpLieElt`

The representative of the reflections in the $r$th root in the group of Lie type $G$.

<a id="example-ex-ff84ed"></a>
##### `Example: Reflections of a Group of Lie Type (ex-ff84ed)`

```magma
> G := GroupOfLieType("A2", Rationals());
> Reflections(G);
[ n1 , n2 , n1 n2 n1  ]
```

#### Operations and Properties for Root and Coroot Indices

<a id="function-rootheight-grplie-rngintelt"></a>
##### `RootHeight(G, r): GrpLie, RngIntElt -> RngIntElt`

<a id="function-corootheight-grplie-rngintelt"></a>
##### `CorootHeight(G, r): GrpLie, RngIntElt -> RngIntElt`

The height of the $r$th (co)root of the group of Lie type $G$, i.e. the sum of the coefficients of $\alpha_r$ (resp. $\alpha_r^\star$) with respect to the simple (co)roots.

<a id="function-rootnorms-grplie"></a>
##### `RootNorms(G): GrpLie -> [RngIntElt]`

<a id="function-corootnorms-grplie"></a>
##### `CorootNorms(G): GrpLie -> [RngIntElt]`

The sequence of squares of the lengths of the (co)roots of the group of Lie type $G$.

<a id="function-rootnorm-grplie-rngintelt"></a>
##### `RootNorm(G, r): GrpLie, RngIntElt -> RngIntElt`

<a id="function-corootnorm-grplie-rngintelt"></a>
##### `CorootNorm(G, r): GrpLie, RngIntElt -> RngIntElt`

The square of the length of the $r$th (co)root of the group of Lie type $G$.

<a id="function-islongroot-grplie-rngintelt"></a>
##### `IsLongRoot(G, r): GrpLie, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the group of Lie type $G$ is long, i.e. the $r$th coroot is short.

<a id="function-isshortroot-grplie-rngintelt"></a>
##### `IsShortRoot(G, r): GrpLie, RngIntElt -> BoolElt`

Returns `true` if, and only if, the $r$th root of the group of Lie type $G$ is short, i.e. the $r$th coroot is long.

<a id="function-additiveorder-grplie"></a>
##### `AdditiveOrder(G): GrpLie -> SeqEnum`

The additive order on the positive roots of the group of Lie type $G$ equal to the Papi order of the longest word $w_0$ of the Weyl group of $G$; it corresponds to the order of roots in a reduced expression for $w_0$. If $\alpha_r$, $\alpha_s$ and $\alpha_t$ are positive roots and $\alpha_r+\alpha_s=\alpha_t$, then $t$ lies between $r$ and $s$. It is computed using the techniques of [[Pap94](https://docs.magma-maths.org/references.md#cite-papi)].

<a id="example-ex-dabc7d"></a>
##### `Example: Additive Order of Positive Roots (ex-dabc7d)`

```magma
> G := GroupOfLieType("A5", GF(3));
> a := AdditiveOrder(G);
> Position(a, 2);
6
> Position(a, 3);
10
```

<a id="subsectgrplierootweight"></a>
<a id="id2"></a>
#### Weights

<a id="function-weightlattice-grplie"></a>
##### `WeightLattice(G): GrpLie -> Lat`

<a id="function-coweightlattice-grplie"></a>
##### `CoweightLattice(G): GrpLie -> Lat`

The (co)weight lattice of the group of Lie type $G$.

<a id="function-fundamentalweights-grplie"></a>
##### `FundamentalWeights(G): GrpLie -> Mtrx`

<a id="function-fundamentalcoweights-grplie"></a>
##### `FundamentalCoweights(G): GrpLie -> Mtrx`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The fundamental (co)weights of the group of Lie type $G$ as the rows of a matrix.

<a id="function-dominantweight-grplie"></a>
##### `DominantWeight(G, v): GrpLie, . -> ModTupFldElt, GrpFPCoxElt`

```magma
Basis: MonStgElt                    Default: "Standard"
```

The unique dominant weight in the same $W$-orbit as $v$, where $W$ is the Weyl group of $G$ and $v$ is a weight given as a vector or a sequence representing a vector. The second value returned is a Weyl group element taking $v$ to the dominant weight.

<a id="create-new-root-datum"></a>
<a id="sectgrpliesub"></a>
### Building Groups of Lie Type

Currently the only subgroups of a group of Lie type that can be constructed are subsystem subgroups.

<a id="function-subsystemsubgroup-grplie-setenum"></a>
#### `SubsystemSubgroup(G, a): GrpLie, SetEnum -> RootDtm`

The subsystem subgroup of the group of Lie type $G$ generated by the standard maximal torus and the root subgroups with roots $\alpha_{a_1},\dots,\alpha_{a_k}$ where $a=\{a_1,\dots,a_k\}$ is a set of integers.

<a id="function-subsystemsubgroup-grplie-seqenum"></a>
#### `SubsystemSubgroup(G, s): GrpLie, SeqEnum -> RootDtm`

The subsystem subgroup of the group of Lie type $G$ generated by the standard maximal torus and the root subgroups with roots $\alpha_{s_1},\dots,\alpha_{s_k}$ where $s=[s_1,\dots,s_k]$ is a *sequence* of integers. In this version the roots must be simple in the root subdatum (i.e. none of them may be a summand of another) otherwise an error is signalled. The simple roots will appear in the subdatum in the given order.

<a id="example-ex-0494af"></a>
#### `Example: Subsystem Subgroups via Root Subdata (ex-0494af)`

```magma
> G := GroupOfLieType("A4",Rationals());
> PositiveRoots(G);
{@
    (1 0 0 0),
    (0 1 0 0),
    (0 0 1 0),
    (0 0 0 1),
    (1 1 0 0),
    (0 1 1 0),
    (0 0 1 1),
    (1 1 1 0),
    (0 1 1 1),
    (1 1 1 1)
@}
> H := SubsystemSubgroup(G, [6,1,4]);
> H;
H: Group of Lie type A3 over Rational Field
> PositiveRoots(H);
{@
    (0 1 1 0),
    (1 0 0 0),
    (0 0 0 1),
    (1 1 1 0),
    (0 1 1 1),
    (1 1 1 1)
@}
> h := elt<H|<2,2>,1>;
> h;  G!h;
x2(2) n1
x1(2) ( 1 -1  1 -1) n2 n3 n2
```

<a id="function-directproduct-grplie-grplie"></a>
#### `DirectProduct(G1, G2): GrpLie, GrpLie -> GrpLie`

The direct product of the groups $G_1$ and $G_2$. The two groups must have the same base ring.

<a id="function-dual-grplie"></a>
#### `Dual(G): GrpLie -> GrpLie`

The dual of the group of Lie type $G$, obtained by swapping the roots and coroots.

<a id="function-solubleradical-grplie"></a>
#### `SolubleRadical(G): GrpLie -> GrpLie`

The soluble radical of the group of Lie type $G$.

<a id="function-standardmaximaltorus-grplie"></a>
#### `StandardMaximalTorus(G): GrpLie -> GrpLie`

The standard maximal torus of the group of Lie type $G$.

<a id="example-ex-c4d20b"></a>
#### `Example: Direct Products, Duals, and Radicals (ex-c4d20b)`

```magma
> G1 := GroupOfLieType( "A5", GF(7) );
> G2 := GroupOfLieType( "B4", GF(7) );
> DirectProduct(G1, Dual(G2));
$: Group of Lie type A5 C4 over Finite field of size 7
>
> G := GroupOfLieType(StandardRootDatum("A",3), GF(17));
> SolubleRadical(G);
$: Torus group of Dimension 1 over Finite field of size 17
```

<a id="sectgrplieauto"></a>
<a id="id1"></a>
### Automorphisms

The following functions construct the standard automorphisms of a group of Lie type, as described in [[Car72b](https://docs.magma-maths.org/references.md#cite-carter-small)] (except for the graph automorphism of $G_2$). In many cases, including the finite groups, every automorphism is a product of these standard automorphisms.

<a id="automorphisms-basic"></a>
<a id="subsectgrplieautobasic"></a>
#### Basic Functionality

<a id="function-automorphismgroup-grplie"></a>
##### `AutomorphismGroup(G): GrpLie -> GrpLieAuto`

Automorphism group of a group of Lie type $G$.

<a id="function-identityautomorphism-grplie"></a>
##### `IdentityAutomorphism(G): GrpLie -> GrpLieAutoElt`

<a id="function-one-grplieauto"></a>
##### `One(A): GrpLieAuto -> GrpLieAutoElt`

<a id="function-id-grplieauto"></a>
##### `Id(A): GrpLieAuto -> GrpLieAutoElt`

The identity automorphism of the group of Lie type $G$.

<a id="function-mapping-grplieautoelt"></a>
##### `Mapping(a): GrpLieAutoElt -> Map`

The map object associated with the automorphism $a$.

<a id="function-automorphism-map"></a>
##### `Automorphism(m): Map -> GrpLieAutoElt`

Given a map object $m$ from $G$ to $G$, which is an isomorphism, returns the associated automorphism as an automorphism of a group of Lie type.

<a id="operation-op-times-grplieautoelt-grplieautoelt"></a>
##### `h * g: GrpLieAutoElt, GrpLieAutoElt -> GrpLieAutoElt`

The composition of the group of Lie type automorphisms $h$ and $g$.

<a id="operation-op-pow-grplieautoelt-rngintelt"></a>
##### `h ^ n: GrpLieAutoElt, RngIntElt -> GrpLieAutoElt`

The $n$th power of the group of Lie type automorphism $h$.

<a id="operation-op-pow-grplieautoelt-grplieautoelt"></a>
##### `g ^ h: GrpLieAutoElt, GrpLieAutoElt -> GrpLieAutoElt`

The conjugate $h^{-1}gh$, where $g$ and $h$ are group of Lie type automorphisms $g$ and $h$

<a id="function-domain-grplieauto"></a>
##### `Domain(A): GrpLieAuto -> GrpLie`

<a id="function-codomain-grplieauto"></a>
##### `Codomain(A): GrpLieAuto -> GrpLie`

<a id="function-domain-grplieautoelt"></a>
##### `Domain(h): GrpLieAutoElt -> GrpLie`

<a id="function-codomain-grplieautoelt"></a>
##### `Codomain(h): GrpLieAutoElt -> GrpLie`

Domain or codomain of an automorphism of a group of Lie type or of the group of automorphisms.

<a id="automorphisms-special"></a>
<a id="subsectgrplieautospecial"></a>
#### Constructing Special Automorphisms

<a id="function-innerautomorphism-grplie-grplieelt"></a>
##### `InnerAutomorphism(G, x): GrpLie, GrpLieElt -> Map`

The inner automorphism taking $g\in G$ to $g^x$, where $x$ is an element of the group of Lie type $G$.

<a id="function-diagonalautomorphism-grplie-modtuprngelt"></a>
##### `DiagonalAutomorphism(G, v): GrpLie, ModTupRngElt -> Map`

The diagonal automorphism of the semisimple group of Lie type $G$ given by the vector $v$. Let $n$ be the semisimple rank of $G$ and let $k$ be its base field. Then $v$ must be a vector in $k^n$ with every component nonzero. The function returns the automorphism given by the character $\chi$ defined by $\chi(\alpha_i)=v_i$, where $\alpha_i$ is the $i$th simple root. Since our groups are algebraic, a diagonal automorphism is just a special case of an inner automorphism.

<a id="function-graphautomorphism-grplie-grppermelt"></a>
##### `GraphAutomorphism(G, p): GrpLie, GrpPermElt -> Map`

<a id="function-diagramautomorphism-grplie-grppermelt"></a>
##### `DiagramAutomorphism(G, p): GrpLie, GrpPermElt -> Map`

```magma
SimpleSigns: Any                    Default: 1
```

The graph automorphism of the group of Lie type $G$ given by the permutation $p$. The permutation must act on the indices of simple roots of $G$ or the indices of all roots of $G$. The graph automorphism of the group of type $G_2$ has not been implemented yet.

The optional parameter `SimpleSigns` can be used to specify the signs corresponding to each simple root. This should either be a sequence of integers $\pm1$, or a single integer $\pm1$.

<a id="function-fieldautomorphism-grplie-map"></a>
##### `FieldAutomorphism(G, sigma): GrpLie, Map -> Map`

The field automorphism of the group of Lie type $G$ induced by $\sigma$, an element of the automorphism group of the base field of $G$

<a id="function-randomautomorphism-grplie"></a>
##### `RandomAutomorphism(G): GrpLie -> GrpLieAutoElt`

<a id="function-random-grplieauto"></a>
##### `Random(A): GrpLieAuto -> GrpLieAutoElt`

A random element in $A$, the automorphism group of the group of Lie type $G$.

<a id="function-dualityautomorphism-grplie"></a>
##### `DualityAutomorphism(G): GrpLie -> GrpLieAutoElt`

The duality automorphism of $G$. This is an automorphism that takes every unipotent term $x_r(t)$ to $x_s(\pm t)$, where $s=$ `Negative(RootDatum(G),r))`.

<a id="function-frobeniusmap-grplie-rngintelt"></a>
##### `FrobeniusMap(G, q): GrpLie, RngIntElt -> GrpLieAutoElt`

The Frobenius automorphism of the finite group of Lie type $G$ gotten by $q$th powers in the base field. The integer $q$ must be a power of the characteristic of the base field of $G$.

#### Operations and Properties of Automorphisms

<a id="function-decomposeautomorphism-grplieautoelt"></a>
##### `DecomposeAutomorphism(h): GrpLieAutoElt -> GrpLieAutoElt, GrpLieAutoElt, GrpLieAutoElt, Rec`

Given a group of Lie type automorphism $h$, this returns a field automorphism $f$, a graph automorphism $g$, and an inner automorphism $i$ such that $h=fgi$. This only works for groups defined over finite fields. The algorithm is due to Scott Murray and Sergei Haller.

<a id="function-isalgebraic-grplieautoelt"></a>
##### `IsAlgebraic(h): GrpLieAutoElt -> BoolElt`

Returns `true` if and only if the automorphism $h$ is algebraic.

<a id="example-ex-6e4baf"></a>
##### `Example: Automorphisms of a Group of Type B2 (ex-6e4baf)`

Some automorphisms of $B_2(4)$

```magma
> G := GroupOfLieType("B2", GF(4));
> A := AutomorphismGroup(G);
> A!1 eq IdentityAutomorphism(G);
true
> g := GraphAutomorphism(G, Sym(2)!(1,2));
> g;
Automorphism of Group of Lie type B2 over Finite field of size 2^2
given by: Mapping from: Group of Lie type  to Group of Lie type
given by a rule
Decomposition:
  Mapping from: GF(2^2) to GF(2^2) given by a rule,
  (1, 2),
  1
```

The automorphism of $B_2(4)$ whose stabiliser is ${}^2\!B_2(4)$ is constructed by the following code.

```magma
> sigma := iso< GF(4) -> GF(4) | x :-> x^2, x :-> x^2 >;
> h := FieldAutomorphism(G, sigma) * g;
> h in A;
true
> f,g,i := DecomposeAutomorphism(h);
> assert f*g*i eq h;
```

<a id="homomorphism"></a>
<a id="sectgrpliehom"></a>
### Algebraic Homomorphisms

<a id="function-groupoflietypehomomorphism-map-rng"></a>
#### `GroupOfLieTypeHomomorphism(phi, k): Map, Rng -> .`

The algebraic homomorphism of groups of Lie type over the ring $k$ corresponding to the root datum morphism $\phi$. See Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie).

<a id="example-ex-42434f"></a>
#### `Example: Creating Root Data Homomorphisms (ex-42434f)`

This example constructs the algebraic projection ${GL}_4({\mathbb{Q}})\to{PGL}_4({\mathbb{Q}})$.

```magma
> RGL := StandardRootDatum( "A", 3 );
> RPGL := RootDatum( "A3" );
> A := VerticalJoin( SimpleRoots(RGL), Vector([Rationals()|1,1,1,1]) )^-1 *
>   VerticalJoin( SimpleRoots(RPGL), Vector([Rationals()|0,0,0]) );
> B := VerticalJoin( SimpleCoroots(RGL), Vector([Rationals()|1,1,1,1]) )^-1 *
>   VerticalJoin( SimpleCoroots(RPGL), Vector([Rationals()|0,0,0]) );
> phi := GroupOfLieTypeHomomorphism( hom< RGL -> RPGL | A, B >, Rationals() );
> GL := Domain( phi );
> phi( elt<GL|<1,2>, Vector([Rationals()| 7,1,11,1])> );
x1(2) (   7 1/11   11)
```

<a id="sectgrplietwistedtori"></a>
<a id="id1"></a>
### Twisted Tori

The functionality presented here deals with the computation of the twisted tori of a finite group of Lie type.

Note that for a given group $G(k)$, the twisted tori are returned as subgroups of the standard torus of $G(K)$ for the smallest field extension $K$ of $k$, where this is possible.

For finite fields and an untwisted group of Lie type $G(k)$, a twisted torus $T_w(k)$ of $G(k)$ has the form

$$
T_w(k) = \{ t\in T(K) | t^{\sigma w} = t \},
$$

where $T(K)$ is the standard $K$-split torus of $G(K)$, $\sigma$ is the generator of the Galois group ${\operatorname{Gal}}(K:k)$ and $w$ is an element of the Weyl group of $G(k)$.

<a id="function-twistedtorusorder-rootdtm-grppermelt"></a>
#### `TwistedTorusOrder(R, w): RootDtm, GrpPermElt -> SeqEnum`

Given the root datum $R$ and a Weyl group element $w$, computes the orders of the cyclic components of the twisted torus $T_w(k)\subset G(R,k)$ as sequence of polynomials in $q$, the order of the field $k$.

<a id="function-twistedtoriorders-grplie"></a>
#### `TwistedToriOrders(G): GrpLie -> SeqEnum`

<a id="function-twistedtoriorders-rootdtm"></a>
#### `TwistedToriOrders(R): RootDtm -> SeqEnum`

Given a group of Lie type $G$ or a root datum $R$, takes for every conjugacy class of the Weyl group of $G$ a representative $w$, and computes `TwistedTorusOrder(R, w)`. Returns the sequence of the lists consisting of `TwistedTorusOrder(R, w)` and $w$ for every conjugacy class.

<a id="function-twistedtorus-grplie-grppermelt"></a>
#### `TwistedTorus(G, w): GrpLie, GrpPermElt -> List`

Computes the twisted torus $T_w(k)$ of the group of Lie type $G$ for the given element $w$ of the Weyl group of $G$. Returned is the list consisting of three elements, first of them being the sequence of orders of cyclic parts of the torus, the second being the sequence of generators of the respective orders and the third being $w$. See [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)] for the algorithm used.

<a id="function-twistedtori-grplie"></a>
#### `TwistedTori(G): GrpLie -> SeqEnum`

Computes one twisted torus $T_w(k)$ of the group of Lie type $G$ for each conjugacy class $w^W$ of the Weyl group $W$ of $G$. A sequence of them is returned. See [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)] for the algorithm used.

<a id="example-ex-5e0bd4"></a>
#### `Example: Twisted Tori of a Group of Type A1 (ex-5e0bd4)`

We compute all twisted tori of $A_1(5)$:

```magma
> G := GroupOfLieType("A1", 5);
> TwistedToriOrders(G);
[ [*
    [
        q - 1
    ],
    Id($)
*], [*
    [
        q + 1
    ],
    (1, 2)
*] ]
> TwistedTori(G);
[ [*
    [ 4 ],
    [ (2)  ],
    Id($)
*], [*
    [ 6 ],
    [ ( k.1^4)  ],
    (1, 2)
*] ]
```

As we may notice, the second one is contained in the group over the quadratic field extension:

```magma
> Universe($1[2][2]);
$: Group of Lie type A1 over Finite field of size 5^2
```

<a id="example-ex-bc3840"></a>
#### `Example: Orders of Maximal Tori in G2 (ex-bc3840)`

These are the orders of the decompositions of all (up to conjugacy) maximal tori of the group $G_2(q)$ as polynomials in $q$:

```magma
> R := RootDatum("G2");
> [ t[1] : t in TwistedToriOrders(R) ];
[
    [  q - 1,  q - 1  ],
    [  q + 1,  q + 1  ],
    [  q^2 - 1        ],
    [  q^2 - 1        ],
    [  q^2 + q + 1    ],
    [  q^2 - q + 1    ]
]
```

<a id="sectgrpliesylow"></a>
<a id="id1"></a>
### Sylow Subgroups

We present here the functionality which allows to compute the Sylow subgroups of finite groups of Lie type.

<a id="procedure-printsylowsubgroupstructure-grplie"></a>
#### `PrintSylowSubgroupStructure(G): GrpLie`

This procedure prints out a list of all primes $p$ dividing the order of the group of Lie type $G$ along with the “goodness” of $p$, the exponent of $p$ in the factorisation of $|G|$ and a sequence of integers. The positive integers give the orders of the decomposition of a torus $T_w$ into cyclic groups such that the Sylow subgroup is contained in $\langle T_w, C_W(w) \rangle$. The negative number indicates the $p$-part coming from $C_W(w)$. If more than one such torus exists, then one line is printed for each of them.

A prime is said to be “GOOD” if it is equal to the characteristic of the base field $k$ of $G$, “good” if the Sylow subgroup is abelian, thus contained in a torus, and “bad” if it is not abelian and thus not contained in a torus. See [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)] for the algorithm used.

<a id="function-sylowsubgroup-grplie-rngintelt"></a>
#### `SylowSubgroup(G, p): GrpLie, RngIntElt -> List`

Compute a $p$-Sylow subgroup $S$ of the group of Lie type $G$. Returned is a list of a two sequences. The second sequence contains generators of $S$. The first one is a sequence of integers giving the orders of the respective generator if the generator is a torus element and the negative of the order of $\langle g \rangle/(\langle g \rangle \cap T_w)$ in case the generator $g$ is not a torus element. See [[Hal05](https://docs.magma-maths.org/references.md#cite-sh)] for the algorithm used.

<a id="example-ex-dd465e"></a>
#### `Example: Sylow Subgroup Structure (ex-dd465e)`

Compute

```magma
> G := GroupOfLieType("G2", 5);
> PrintSylowSubgroupStructure(G);
G: Group of Lie type G2 over Finite field of size 5
Order(G) is  2^6 * 3^3 * 5^6 * 7^1 * 31^1
Order(W) is  2^2 * 3^1
...compute tori...
...compute sylows...
   2 (bad)  : 6 [ 4, 4, -4 ]
   3 (bad)  : 3 [ 6, 6, -3 ]
   5 (GOOD) : The unipotent subgroup of G
   7 (good) : 1 [ 21 ]
   31 (good) : 1 [ 31 ]
> SylowSubgroup(G,2);
[*
    [ 4, 4, -2, -2 ],
    [ (2 1) , (1 2) , n2 , n1 n2 n1 n2 n1 n2  ]
*]
```

note that the orders of the non-toral elements is not necessarily the corresponding integer in the first sequence:

```magma
> gens := $1[2];
> [ Order(g) : g in gens ];
[ 4, 4, 4, 4 ]
```

but, in this example, their squares are contained in the torus:

```magma
> gens[3]^2 eq gens[2]^2, gens[4]^2 eq gens[2]^2;
true true
```

<a id="sectgrplierepn"></a>
<a id="id1"></a>
### Representations

This section describes basic functionality for Lie algebra representations: see Chapter [Representations of Lie Groups and Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/index-representations-of-lie-groups-and-algebras.md#chapliereps) for more functions for highest weight representations and decompositions.

<a id="function-standardrepresentation-grplie"></a>
#### `StandardRepresentation(G): GrpLie -> Map`

The standard (projective) representation of the semisimple group of Lie type $G$ over an extension its base ring. In other words, the smallest dimension highest-weight representation. For the classical groups, this is the natural representation. If this is a projective representation rather than a linear representation, a warning is given. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="function-adjointrepresentation-grplie"></a>
#### `AdjointRepresentation(G): GrpLie -> Map, AlgLie`

The adjoint (projective) representation of the group of Lie type $G$ over an extension of its base ring, i.e. the representation given by the action of $G$ on its Lie algebra. The Lie algebra itself is the second returned value. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="function-liealgebra-grplie"></a>
#### `LieAlgebra(G): GrpLie -> AlgLie, Map`

The Lie algebra of the group of Lie type $G$, together with the adjoint representation. If this is a projective representation rather than a linear representation, a warning is given.

<a id="function-highestweightrepresentation-grplie"></a>
#### `HighestWeightRepresentation(G, v): GrpLie, . -> Map`

The highest weight (projective) representation with highest weight $v$ of the group of Lie type $G$ over an extension of its base ring. If this is a projective representation rather than a linear representation, a warning is given. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="example-ex-be5644"></a>
#### `Example: Standard Representation of a Group of Lie Type (ex-be5644)`

```magma
> G := GroupOfLieType("A2", Rationals() : Isogeny := "SC");
> rho := StandardRepresentation(G);
> rho(elt< G | 1 >);
[ 0 -1  0]
[ 1  0  0]
[ 0  0  1]
> rho(elt<G | <2,1/2> >);
[  1   0   0]
[  0   1   0]
[  0 1/2   1]
> rho(elt< G | VectorSpace(Rationals(),2)![3,5] >);
[  3   0   0]
[  0 5/3   0]
[  0   0 1/5]
>
> G := GroupOfLieType("A2", Rationals());
> Invariants(CoisogenyGroup(G));
[ 3 ]
> rho := StandardRepresentation(G);
Warning: Projective representation
> BaseRing(Codomain(rho));
Algebraically closed field with no variables
> rho(elt< G | VectorSpace(Rationals(),2)![3,1] >);
[r1  0  0]
[ 0 r2  0]
[ 0  0 r2]
> rho(elt< G | VectorSpace(Rationals(),2)![3,1] >)^3;
[  9   0   0]
[  0 1/3   0]
[  0   0 1/3]
```

<a id="function-contravariantform-map-grplie-grpmat"></a>
#### `ContravariantForm(ρ): Map[GrpLie,GrpMat] -> AlgMatElt`

A contravariant form for the image of the matrix representation $\rho$ of a group of Lie type.

<a id="function-generalisedrowreduction-map"></a>
#### `GeneralisedRowReduction(ρ): Map -> Map`

<a id="function-rowreductionhomomorphism-map"></a>
#### `RowReductionHomomorphism(ρ): Map -> Map`

<a id="function-inverse-map"></a>
#### `Inverse(ρ): Map -> Map`

Given a projective matrix representation $\rho:G\to {\operatorname{GL}}_m(k)$, return its inverse.

<a id="curtis-steinberg-tits-presentations"></a>
<a id="cst-presentations"></a>
<a id="sectgrpliecst"></a>
### Curtis–Steinberg–Tits Presentations

In Magma a group of Lie type over a field is defined by generators which satisfy Steinberg relations (see section [The Steinberg Presentation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#subsectgrpliesteinberg)). In particular the unipotent elements $x_\alpha(a)$ are parametrised by the field and the torus elements are parametrised by the non-zero elements of the field. However, the number of generators and relations can be reduced considerably using a form of the Curtis–Steinberg–Tits (CST) presentation [[BGK+97](https://docs.magma-maths.org/references.md#cite-babai-etal-1997)].

This section describes basic functions to compute with highest weight representations of finite groups of Lie type defined by CST presentations: see the previous section and Chapter [Representations of Lie Groups and Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/index-representations-of-lie-groups-and-algebras.md#chapliereps) for more functions for highest weight representations.

Currently this functionality is available only for algebraically simple finite reductive groups with a simply connected root datum: all untwisted types and the twisted groups of types ${}^2\hbox{A}_n$ ($n$ odd), ${}^2\hbox{D}_n$, ${}^3\hbox{D}_4$, and ${}^2\hbox{E}_6$.

Let $G(q)$ be a simply connected group defined over the field ${\mathbb{F}}_q$, let $\Delta = \{\alpha_1,\dots,\alpha_d\}$ be a base of simple roots and let $B$ be a basis for ${\mathbb{F}}_q$ regarded as a vector space over its prime field. The CST presentation can be described as follows.

For $i < j$, let $\Phi_{ij}$ be the subsystem spanned by $\alpha_i$ and $\alpha_j$, put $\Psi = \bigcup_{i,j}\Phi_{ij}$ and $\Upsilon = \bigcup_{i,j}\{\,(\alpha,\beta) \in \Phi_{ij}\times \Phi_{ij} \mid \alpha\ne \pm \beta\,\}$. Then $G(q)$ has a presentation with generators $x_\alpha(a)$ for $\alpha \in \Psi$ and $a\in B$. It is enough to require relations $x_\alpha(a)x_\alpha(b) = x_\alpha(a+b)$ for $\alpha\in \Psi$ and relations

$$
[x_\alpha(a),x_\beta(b)] =
    \prod_{i,j > 0}  x_{i\alpha+j\beta}(C_{ij\alpha\beta}a^ib^j)
$$

for $(\alpha,\beta)\in\Upsilon$ and $a,b\in B$. (If $G(q)$ were not simply connected we would need additional generators for the torus.)

In Magma, the CST generators are represented by a pair of sequences $X$, $Y$

$$
\begin{aligned}X &= [[x_\alpha(a) \mid a \in B] \mid \alpha \in \Psi ]\quad\hbox{and}\\
  Y &= [[x_{-\alpha}(a) \mid a \in B] \mid \alpha \in \Psi],\end{aligned}
$$

where $X$ (resp. $Y$) may be regarded as a matrix whose rows are indexed by positive (resp. negative) roots and whose columns are indexed by basis elements of ${\mathbb{F}}_q$.

For many functions there are optional parameters `OnlySimple` and `GS`. If `OnlySimple` is `true`, only the CST generators $x_\alpha(a)$ where $\pm\alpha$ is a simple root are used. (The function `ExtendGeneratorList` can be used to extend the simple generators to the full collection of CST generators.)

The functions generally use the default signs for the extraspecial pairs (Section [Constructing Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#sectrdconstr)). However, if `GS` is `true`, the root order and signs used by Gilkey and Seitz [[GS88](https://docs.magma-maths.org/references.md#cite-gilkey-seitz-1988)] are used; this only applies to groups of types $\hbox{F}_4$ and $\hbox{G}_2$.

<a id="function-cst-generators-monstgelt-rngintelt-rngintelt-seqenum"></a>
#### `CST_Generators(t, r, q, w): MonStgElt, RngIntElt, RngIntElt, SeqEnum -> SeqEnum, SeqEnum`

```magma
GS        : BoolElt                    Default: false
OnlySimple: BoolElt                    Default: false
Weyl      : BoolElt                    Default: false
Signs     : Any                        Default: 1
```

The Curtis–Steinberg–Tits generators for the group of Lie type $t$ and rank $r$ over the field ${\mathbb{F}}_q$ in the irreducible representation with highest weight $w$. If `OnlySimple` is `true`, only generators for the simple roots are returned. If `Weyl` is `true`, the Weyl representation of highest weight $w$ is returned. If $w$ is the empty sequence, the standard representation is used.

The parameter `Signs` can take the values described in Section [Constructing Root Data](https://docs.magma-maths.org/LieTheory/RootData/create-root-datum.md#sectrdconstr).

<a id="function-cst-presentation-monstgelt-rngintelt-rngintelt"></a>
#### `CST_Presentation(t, r, q): MonStgElt, RngIntElt, RngIntElt -> GrpSLP, SeqEnum`

```magma
GS: BoolElt                    Default: false
```

The Curtis–Steinberg–Tits relations for the simply connected group of Lie type $t$ and rank $r$ over the field ${\mathbb{F}}_q$. The function returns an SLP-group $G$ and a sequence containing the relations as straight-line programs in $G$.

If `GS` is `true`, the Gilkey–Seitz structure constants are used and the simple roots for groups of type $\hbox{G}_2$ are swapped.

<a id="function-cst-verifypresentation-monstgelt-rngintelt-rngintelt-seqenum-seqenum"></a>
#### `CST_VerifyPresentation(t, r, q, X, Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum -> BoolElt, RngIntElt`

```magma
GS: BoolElt                    Default: false
```

Given Curtis–Steinberg–Tits generators $X$, $Y$ for a simply connected group of Lie type $t$ and rank $r$ over the field ${\mathbb{F}}_q$, verify that the generators satisfy the relations. Set `GS` to `true` if the Gilkey–Seitz conventions hold for $X$ and $Y$.

<a id="example-ex-edd24d"></a>
#### `Example: Checking Curtis-Steinberg-Tits Relations (ex-edd24d)`

Verify that the CST generators for the 273-dimensional representation of ${\rm F}_4(5)$ satisfy the CST relations but not the relations for ${\rm F}_4(5)$. When the relations are not satisfied, the index of the first relation which fails is returned.

```magma
> X,Y := CST_Generators("F",4,5,[0,0,1,0]);
> CST_VerifyPresentation("F",4,5,X,Y);
true
> CST_VerifyPresentation("F",4,3,X,Y);
false 1
> G, rels := CST_Presentation("F",4,3);
> rels[1];
function(G)
    w1 := G.1^3; return w1;
end function
```

<a id="function-csttochev-monstgelt-rngintelt-rngintelt-seqenum-seqenum"></a>
#### `CSTtoChev(t, r, q, X, Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum -> Map`

```magma
GS    : BoolElt                    Default: false
UseMap: BoolElt                    Default: false
```

Given Curtis–Steinberg–Tits generators $X$, $Y$ which satisfy the presentation for a group of Lie type $t$ and rank $r$ over the field of $q$ elements, return a function $f$ from the group they generate to the standard Magma copy obtained from `ChevalleyGroup(t,r,q)`. The function $f$ will be a homomorphism up to a scalar multiple.

Set `GS` to `true` if the Gilkey–Seitz conventions hold for $X$ and $Y$. If `UseMap` is `true`, the function $f$ is returned as a Magma `Map`, otherwise the type is `UserProgram`.

<a id="example-ex-430d2a"></a>
#### `Example: Map from a CST Presentation (ex-430d2a)`

Construct a map from the 28-dimensional representation of the simply connected version of the twisted group ${}^3{\rm D}_4(3)$ to its standard 8-dimensional representation.

```magma
> X,Y := CST_Generators("3D",4,3,[0,1,0,0]);
> f := CSTtoChev("3D",4,3,X,Y : UseMap);
> G := Domain(f); G:Minimal;
MatrixGroup(28, GF(5^3))
> L := Codomain(f); L;
GL(8, GF(5, 3))
> C := ChevalleyGroup("3D",4,3);
> Order(C);
20560831566912
> forall{ x : x in Generators(G) | f(x) in C };
true
```

<a id="function-extendgeneratorlist-monstgelt-rngintelt-rngintelt-seqenum-seqenum"></a>
#### `ExtendGeneratorList(t, r, X, Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum -> SeqEnum, SeqEnum`

```magma
GS: BoolElt                    Default: false
```

Given matrix generators (for the simple roots and their negatives) for a simply connected group of Lie type $t$ and rank $k$ over the field of $q$ elements, return the Curtis–Steinberg–Tits generators.

<a id="function-irreduciblehighestweightrepresentation-grplie-seqenum"></a>
#### `IrreducibleHighestWeightRepresentation(G, w): GrpLie, SeqEnum -> Map`

The function `CST_Generators` returns the Curti–Steinberg–Tits generators either for a Weyl module of weight $w$ or its irreducible quotient. This function returns the corresponding irreducible representation as a `Map`.

<a id="function-irreduciblehighestweightgenerators-grplie-seqenum"></a>
#### `IrreducibleHighestWeightGenerators(G, w): GrpLie, SeqEnum -> SeqEnum, SeqEnum`

```magma
OnlySimple: BoolElt                    Default: false
```

For a simply connected finite group $G$ over the field of $q$ elements and a $q$-restricted weight $w$ return Curtis–Steinberg–Tits generators $X$, $Y$ for the irreducible $G$-module of weight $w$ for the group $G$. If `OnlySimple` is `true`, return generators for just the simple roots.

If $\varpi_1$, $\varpi_2$,…,$\varpi_k$ are the fundamental weights, then $w = a_1\varpi_n + a_2\varpi_2 + \cdots + a_k \varpi_k$ is $q$-restricted if $0\le a_i < q$ for $1 \le i\le k$.

<a id="function-irreduciblehighestweightfunction-grplie-seqenum"></a>
#### `IrreducibleHighestWeightFunction(G, w): GrpLie, SeqEnum -> UserProgram`

This is a version of `IrreducibleHighestWeightGenerators` which returns the homomorphism from $G$ to the matrix representation of weight $w$.

<a id="function-vermamodule-grplie-seqenum"></a>
#### `VermaModule(G, w): GrpLie, SeqEnum -> ModGrp`

For a finite group $G$ of Lie type and a weight $w$ this function returns a module $M$ of highest weight $w$ such that every highest weight module of weight $w$ is a quotient of $M$.

<a id="function-universalhighweightrepresentation-grplie-seqenum"></a>
#### `UniversalHighWeightRepresentation(G, w): GrpLie, SeqEnum -> Map, SeqEnum, SeqEnum`

This function returns a homomorphism from $G$ into ${\operatorname{GL}}(M)$ and Curtis-Steinberg–Tits generators for the image, where $M$ is the module returned by the previous function.

<a id="chevalley"></a>
<a id="subsectgrpliechev"></a>
#### Chevalley Groups

Let $\cal L$ be a complex semisimple Lie algebra with root system $\Phi$, simple roots $\Delta$, Cartan subalgebra $H$, one-dimensional root spaces ${\cal L}_\alpha$, and Cartan decomposition ${\cal L} = H\oplus \bigoplus_{\alpha \in \Phi}{\cal L}_\alpha$.

We choose basis vectors $e_\alpha\in{\cal L}_\alpha$ such that $[e_\alpha,e_\beta] = N_{\alpha,\beta}e_{\alpha+\beta}$, and the *structure constants* $N_{\alpha,\beta}$ are integers $\pm (r+1)$, where $r$ is the greatest integer such that $\beta-r\alpha$ is a root.

For all $\alpha\in\Delta$, we have $h_\alpha = [e_{-\alpha},e_\alpha]\in H$ and the *Chevalley basis* of $\cal L$ is the set $\{e_\alpha\}_{\alpha\in\Phi}\cup\{h_\alpha\}_{\alpha\in\Delta}$. The ${\mathbb{Z}}$-span of the Chevalley basis is the Lie algebra ${\cal L}_{\mathbb{Z}}$.

Given a field ${\mathbb{F}}$, define ${\cal L}_{\mathbb{F}}= {\cal L}_{\mathbb{Z}}\otimes {\mathbb{F}}$. For all roots $\alpha$ there is a homomorphism $x_\alpha$ from the additive group of ${\mathbb{F}}$ to ${\operatorname{GL}}({\cal L}_{\mathbb{F}})$ given by

$$
x_\alpha(\xi) = 1 + \xi\,\hbox{ad}\, e_\alpha +
  {\xi^2\over 2!}(\hbox{ad}\, e_\alpha)^2 + \cdots\ .
$$

Then

$$
G_{\hbox{\egtrm ad}}({\mathbb{F}}) = \langle\;x_\alpha(\xi)\mid \xi\in{\mathbb{F}},
  \ \alpha\in \Phi\;\rangle.
$$

is the *adjoint Chevalley group*. Other than a few exceptions of rank 1 or 2 over fields of at most 3 elements these groups are simple. However, $G_{\hbox{\egtrm ad}}({\mathbb{F}})$ is generally **not** the adjoint group of Lie type in the sense of linear algebraic groups (see [[Car93](https://docs.magma-maths.org/references.md#cite-carter-big), p. 39]).

More generally, given a representation $\varphi : {\cal L}_{\mathbb{Z}}\to {\operatorname{GL}}(M)$, where $M$ is a ${\mathbb{Z}}$-module, we may define *root elements*

$$
x_\alpha(\xi) = 1 + \xi\varphi(e_\alpha) +
  {\xi^2\over 2!}\varphi(e_\alpha)^2 + \cdots\ .
$$

and set

$$
G_\varphi({\mathbb{F}}) = \langle\;x_\alpha(\xi)\mid \xi\in{\mathbb{F}},\ \alpha\in \Phi\;\rangle.
$$

This is also called a *Chevalley group*.

Suppose that $\Delta = \{\alpha_1,\dots,\alpha_n\}$ and that $\Phi'$ is a root subsystem of $\Phi$ with simple roots $\Delta'\subset\Delta$ such that $\Delta\setminus\Delta' = \{\alpha_i\}$ for some $i$. The restriction of the adjoint action of ${\cal L}_{\mathbb{Z}}$ to the Lie subalgebra ${\cal L}_{\mathbb{Z}}'$ corresponding to $\Phi'$ preserves the ${\mathbb{Z}}$-submodule $V$ of ${\cal L}_{\mathbb{Z}}$ whose basis is the set $X$ of elements $e_\beta$ such that the coefficient of $\alpha_i$ is $1$ when $\beta$ is expressed as a sum of simple roots.

For root data of types A, B, C, D and rank $n$ and types ${\rm E}_6$ and ${\rm E}_7$, the embedding in the root datum of rank $n+1$ adds an extra node to the Dynkin diagram and the construction of the previous paragraph produces the “standard module” for the corresponding Chevalley group. For groups of type ${\rm E}_8$ the “standard module” is the adjoint representation.

The construction of the “standard modules” for groups of types ${\rm F}_4$ and ${\rm G}_2$ is more complicated. In order to defined them we identify the Lie algebra of type ${\rm F}_4$ with the algebra of fixed points of the graph automorphism order 2 of ${\rm E}_6$ and identify the Lie algebra of type ${\rm G}_2$ with the fixed points of a graph automorphism of order 3 of ${\rm D}_4$.

<a id="function-standardlierepresentation-monstgelt-rngintelt"></a>
##### `StandardLieRepresentation(t, r): MonStgElt, RngIntElt -> SeqEnum, SeqEnum`

This function returns two sequences of lower triangular integer matrices defining the action of the ${\mathbb{Z}}$-form ${\cal L}_{\mathbb{Z}}$ of the simple Lie algebra of type $t$ and rank $r$ on its “standard module”. The first sequence represents the simple roots and the second sequence represents the negatives of the simple roots.

<a id="function-adjointchevalleygroup-monstgelt-rngintelt-rngintelt"></a>
##### `AdjointChevalleyGroup(t, r, q): MonStgElt, RngIntElt, RngIntElt -> GrpMat`

This function returns the adjoint Chevalley group of type $t$ and rank $r$ over the field of $q$ elements as a matrix group. The generators are Curtis–Steinberg–Tits generators.

<a id="example-ex-1c5530"></a>
##### `Example: Adjoint Chevalley Groups (ex-1c5530)`

The adjoint Chevalley group of type ${\rm B}_n(q)$ is isomorphic to the permutation group ${\rm P}\Omega(2n+1,q)$.

```magma
> n := 2;
> q := 5;
> G := AdjointChevalleyGroup("B",n,q);
> Type(G),Dimension(G);
GrpMat 10
> H := POmega(2*n+1,q);
> Type(H), Degree(H);
GrpPerm 156
> flag, _ := IsIsomorphic(G,H);
> flag;
true
```

<a id="function-lierootmatrix-rootdtm-modtupfldelt-setindx"></a>
##### `LieRootMatrix(R, α, B): RootDtm, ModTupFldElt, SetIndx -> AlgMatElt`

The matrix of $\hbox{ad}\,(e_\alpha)$ acting (on the right) on the module with basis $B$, where $B$ must be a subset of the positive or the negative roots of the root datum $R$, as outlined in the construction above. The argument $\alpha$ is a vector representing a root in the root basis.

<a id="function-lierootmatrix-rootdtm-rngintelt-seqenum"></a>
##### `LieRootMatrix(R, r, X): RootDtm, RngIntElt, SeqEnum -> AlgMatElt`

```magma
Negative: BoolElt                    Default: false
```

The matrix of $\hbox{ad}\,(e_\alpha)$ where $\alpha$ is the $r$-th root acting (on the right) on the subspace of the Lie algebra of $R$ spanned by the roots indexed by $X$. The elements of $X$ are indices of positive roots unless `Negative` is `true`, in which case they are indices of negative roots.

<a id="function-lietypegenerators-monstgelt-rngintelt-rngintelt"></a>
##### `LieTypeGenerators(t, k, q): MonStgElt, RngIntElt, RngIntElt -> SeqEnum, SeqEnum`

<a id="function-lietypegenerators-monstgelt-rngintelt-fldfin"></a>
##### `LieTypeGenerators(t, k, K): MonStgElt, RngIntElt, FldFin -> SeqEnum, SeqEnum`

<a id="function-lietypegenerators-grplie"></a>
##### `LieTypeGenerators(G): GrpLie -> SeqEnum, SeqEnum`

```magma
GS: BoolElt                    Default: false
```

The Curtis–Steinberg–Tits generators of a simply connected group $G$ of Lie type or the simply connected group of Lie type $t$ and rank $r$ over the finite field $K$ or ${\mathbb{F}}_q$. This function is available for both twisted and untwisted groups. If `GS` is `true`, the Gilkey–Seitz structure constants and root order are used.

<a id="function-slpgeneratorlist-monstgelt-rngintelt-rngintelt"></a>
##### `SLPGeneratorList(t, r, q): MonStgElt, RngIntElt, RngIntElt -> SeqEnum, SeqEnum`

```magma
GS: BoolElt                    Default: false
```

The Curtis–Steinberg–Tits generators of the simply connected group of Lie type $t$ and rank $r$ over the field of $q$ elements, returned as straight-line programs. If `GS` is `true`, the Gilkey–Seitz structure constants and root order are used.

<a id="morphisms"></a>
<a id="subsectgrpliemorph"></a>
#### Morphisms and the Row Reduction Algorithm

From an irreducible quasisimple matrix group $H$ of known Lie type $t$ and rank $r$ over the field of $q$ elements, the work of [[LO16](https://docs.magma-maths.org/references.md#cite-exceptional-lob16)] produces Curtis–Steinberg–Tits generators $X$, $Y$ as part of the constructive recognition algorithm. This section describes some functions to construct homomorphisms $\rho : G \to H$ and their inverses from such generators, where $G$ is the simply connected group of Lie type $t$, rank $r$ over ${\mathbb{F}}_q$.

From the homomorphism $\rho : G\to H$ and a matrix $A\in H$, an element $g\in G$ such that $\rho(g) = A$ can be constructed using the Chevalley normal form of the Bruhat decomposition of $A$. That is, we write $g = uh\dot{w}u'$, where $u$, $h$, $\dot{w}$, and $u'$ have the properties described in Subsection [Bruhat Normalisation](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/introduction.md#subsectgrpliebruhat). This uses the “row reduction” algorithms for twisted [[CT](https://docs.magma-maths.org/references.md#cite-cohen-taylor)] and untwisted [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)] groups (a generalisation of Gaussian row reduction of matrices to groups of Lie type).

<a id="function-morphism-grplie-seqenum-seqenum"></a>
##### `Morphism(G, X, Y): GrpLie, SeqEnum, SeqEnum -> Map`

```magma
OnlySimple: BoolElt                    Default: false
GS        : BoolElt                    Default: false
Verify    : BoolElt                    Default: false
```

Given an algebraically simple, simply connected group $G$ of Lie type and Curtis–Steinberg–Tits generators for a representation, return the homomorphism from $G$ to the group generated by $X$ and $Y$. If generators $X$ and $Y$ are available only for the simple roots and their negatives, set `OnlySimple` to `true`. If the generators follow the Gilkey–Seitz conventions, set `GS` to `true`. If `Verify` is true, the function first checks that $X$ and $Y$ satisfy the appropriate CST presentation. This function applies to both twisted and untwisted groups.

<a id="function-chevalleyform-map-grplie-grpmat-grpmatelt"></a>
##### `ChevalleyForm(ρ, A): Map[GrpLie,GrpMat], GrpMatElt -> SeqEnum, FldFinElt`

Given a homomorphism $\rho : G \to H$ from a simply connected group $G$ of Lie type to a matrix group $H$ and a matrix $A$, this function returns a sequence $s$ and a field element $z$. If $A$ is not in the image of $\rho$ (modulo scalars) then $s = [\ ]$, otherwise the elements of $s = [u, h, \dot{w},u']$ are the components of the Chevalley normal form of an element $g = uh\dot{w}u'$ such that $A = z\rho(g)$.

<a id="example-ex-6fae1c"></a>
##### `Example: Chevalley Normal Form of an Element (ex-6fae1c)`

Choose a random element in a twisted group of Lie type, get a scalar multiple of its image in an irreducible highest weight representation and then check the Chevalley normal form.

```magma
> G := TwistedGroupOfLieType("2E",6,3);
> RootDatum(G);
Twisted simply connected root datum of dimension 6 of type 2E6,4
> Dimension(G);
78
> X,Y := CST_Generators("2E",6,3,[0,1,0,0,0,0]);
> rho := Morphism(G,X,Y);
> L := Codomain(rho);
> Dimension(L);
77
> F<t> := BaseRing(L);
> I := sub<L | &cat X, &cat Y>;
> g := Random(G);
> A := L!ScalarMatrix(77,t)*rho(g);
> s,z := ChevalleyForm(rho,A);
> z;
t
> &* s eq g;
true
```

<a id="function-preparerewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum"></a>
##### `PrepareRewrite(t, r, q, X, Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum -> UserProgram, Map`

<a id="function-twistedpreparerewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum"></a>
##### `TwistedPrepareRewrite(t, r, q, X, Y): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum -> UserProgram, Map`

```magma
OnlySimple: BoolElt                    Default: false
GS        : BoolElt                    Default: false
```

This function constructs the group $G$ of Lie type $t$ and rank $r$ over the field of $q$ elements and the homomorphism $f : G \to H$, where $H$ is the matrix group generated by the CST generators $X$ and $Y$. In addition to $f$ this function returns a map $\varphi : H \to G$ such that $f\circ \varphi = \hbox{id}_H$.

If generators $X$ and $Y$ are available only for the simple roots and their negatives, set `OnlySimple` to `true`. If the generators follow the Gilkey–Seitz conventions, set `GS` to `true`.

<a id="function-lietyperewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum-grpmatelt"></a>
##### `LieTypeRewrite(t, r, q, X, Y, g): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum, GrpMatElt -> BoolElt, GrpSLPElt`

<a id="function-twistedlietyperewrite-monstgelt-rngintelt-rngintelt-seqenum-seqenum-grpmatelt"></a>
##### `TwistedLieTypeRewrite(t, r, q, X, Y, g): MonStgElt, RngIntElt, RngIntElt, SeqEnum, SeqEnum, GrpMatElt -> BoolElt, GrpSLPElt`

```magma
OnlySimple: BoolElt                    Default: false
GS        : BoolElt                    Default: false
```

Given a finite (untwisted or twisted) matrix group $H$ with generators $X$, $Y$ in CST format and an element $g\in H$, return a boolean flag $b$ and, if $b$ is `true`, an SLP $\pi$ that expresses $g$ as a word in the given generators.

If the parameter `OnlySimple` is `true`, the return value $\pi$ is an SLP in the generators corresponding to the simple roots and their negatives. Set `GS` to `true` if the generators follow the Gilkey–Seitz conventions.

<a id="example-ex-22cf73"></a>
##### `Example: Rewriting in a Twisted Group of Lie Type (ex-22cf73)`

Check that the SLP returned by `TwistedLieTypeRewrite` evaluates to the correct matrix when evaluated on the CST generators.

```magma
> X,Y := CST_Generators("3D",4,5,[]);
> H := sub< Parent(X[1,1]) | &cat X, &cat Y>;
> g := Random(H);
> flag, s := TwistedLieTypeRewrite("3D",4,5,X,Y,g);
> flag;
true
> gens := &cat X cat &cat Y;
> g eq Evaluate(s,gens);
true
```

<a id="function-rowreductionmap-map-grplie-grpmat"></a>
##### `RowReductionMap(ρ): Map[GrpLie,GrpMat] -> UserProgram`

<a id="function-twistedrowreductionmap-map-grplie-grpmat"></a>
##### `TwistedRowReductionMap(ρ): Map[GrpLie,GrpMat] -> UserProgram`

Given an irreducible representation $\rho : G(q)\to {\operatorname{GL}}(M)$ of an untwisted (respectively twisted) finite group $G$ of Lie type, this function returns a function $f$ such that $\rho(f(A)) = A$ for all $A$ in the image of $A$.

More precisely, given $A$ in the codomain of $\rho$, the application of $f$ to $A$ returns two values: a sequence $w$ of length 0 or 1, and an element $z$. If $A$ is a scalar multiple of an element of the image of $\rho$, then $w[1]$ is a Steinberg word in the domain of $\rho$ and $z$ is a field element such that $z\rho(w[1]) = A$; otherwise $w$ is empty and $z$ is a message indicating the reason for failure. In particular, if $A$ is in the image of $\rho$, then $z$ is 1.

<a id="lie-reps"></a>
<a id="chapliereps"></a>
## Representations of Lie Groups and Algebras

- [Introduction](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-introduction.md)
  - [Highest Weight Modules](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-introduction.md#highest-weight-modules)
  - [Toral Elements](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-introduction.md#toral-elements)
  - [Other Highest Weight Representations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-introduction.md#other-highest-weight-representations)
- [Constructing Weight Multisets](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md)
  - [`TrivialLieRepresentationDecomposition(R): RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-triviallierepresentationdecomposition-rootdtm)
  - [`LieRepresentationDecomposition(R): RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-lierepresentationdecomposition-rootdtm)
  - [`LieRepresentationDecomposition(R, v): RootDtm, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-lierepresentationdecomposition-rootdtm-modtuprngelt)
  - [`LieRepresentationDecomposition(R, v): RootDtm, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-lierepresentationdecomposition-rootdtm-seqenum)
  - [`LieRepresentationDecomposition(R, Wt, Mp): RootDtm, SeqEnum, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-lierepresentationdecomposition-rootdtm-seqenum-seqenum)
  - [`AdjointRepresentationDecomposition(R): RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#function-adjointrepresentationdecomposition-rootdtm)
  - [Example: Adjoint Representation Decomposition](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing.md#example-ex-e0259e)
- [Constructing Representations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md)
  - [Lie Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#lie-algebras)
    - [`TrivialRepresentation(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-trivialrepresentation-alglie)
    - [`AdjointRepresentation(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-adjointrepresentation-alglie)
    - [`StandardRepresentation(L): AlgLie → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-standardrepresentation-alglie)
    - [Example: Standard Representation of a Lie Algebra](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#example-ex-b368df)
    - [`HighestWeightRepresentation(L, w): AlgLie, [ ] → UserProgram`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-highestweightrepresentation-alglie)
    - [Example: Highest Weight Representation of a Lie Algebra](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#example-ex-42d826)
    - [`HighestWeightModule(L, w): AlgLie, SeqEnum → ModTupAlg`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-highestweightmodule-alglie-seqenum)
    - [`TensorProduct(Q): SeqEnum → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-tensorproduct-seqenum)
    - [`SymmetricPower(V, n): ModAlg, RngIntElt → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-symmetricpower-modalg-rngintelt)
    - [`ExteriorPower(V, n): ModAlg, RngIntElt → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-exteriorpower-modalg-rngintelt)
    - [Example: Tensor Product of Lie Algebra Modules](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#example-ex-a477d3)
  - [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#groups-of-lie-type)
    - [`TrivialRepresentation(G): GrpLie → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-trivialrepresentation-grplie)
    - [`StandardRepresentation(G): GrpLie → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-standardrepresentation-grplie)
    - [`AdjointRepresentation(G): GrpLie → Map, AlgLie`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-adjointrepresentation-grplie)
    - [`LieAlgebra(G): GrpLie → AlgLie, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-liealgebra-grplie)
    - [`HighestWeightRepresentation(G, v): GrpLie, . → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#function-highestweightrepresentation-grplie)
    - [Example: Standard Representation of a Group of Lie Type](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-constructing-2.md#example-ex-75d620)
- [Operations on Weight Multisets](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md)
  - [Basic Operations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#basic-operations)
    - [`RootDatum(D): LieRepDec → RootDtm`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-rootdatum-lierepdec)
    - [`Weights(D): LieRepDec → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-weights-lierepdec)
    - [`WeightsAndMultiplicities(D): LieRepDec → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-weightsandmultiplicities-lierepdec)
    - [`Multiset(D): LieRepDec → SetMulti`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-multiset-lierepdec)
    - [`Multiplicity(D, v): LieRepDec, ModTupRngElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-multiplicity-lierepdec-modtuprngelt)
    - [`Multiplicity(D, v): LieRepDec, SeqEnum → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-multiplicity-lierepdec-seqenum)
    - [`D eq E: LieRepDec, LieRepDec → BoolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-eq-lierepdec-lierepdec)
    - [`D + E: LieRepDec, LieRepDec → BoolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-plus-lierepdec-lierepdec)
    - [`D +:= E: LieRepDec, LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-operation-lierepdec-lierepdec)
    - [`AddRepresentation(~D, E, c): LieRepDec, LieRepDec, RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-lierepdec-rngintelt-ref)
    - [`AddRepresentation(~D, E): LieRepDec, LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-lierepdec-ref)
    - [`D + v: LieRepDec, ModTupRngElt → BoolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-plus-lierepdec-modtuprngelt)
    - [`D + v: LieRepDec, SeqEnum → BoolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-plus-lierepdec-seqenum)
    - [`AddRepresentation(~D, v, c): LieRepDec, ModTupRngElt, RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-modtuprngelt-rngintelt-ref)
    - [`AddRepresentation(~D, v, c): LieRepDec, SeqEnum, RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-seqenum-rngintelt-ref)
    - [`AddRepresentation(~D, v): LieRepDec, ModTupRngElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-modtuprngelt-ref)
    - [`AddRepresentation(~D, v): LieRepDec, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#procedure-addrepresentation-lierepdec-seqenum-ref)
    - [`D +:= v: LieRepDec, ModTupRngElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-operation-lierepdec-modtuprngelt)
    - [`D +:= v: LieRepDec, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-operation-lierepdec-seqenum)
    - [`D * c: LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-times-lierepdec-rngintelt)
    - [`D / c: LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-div-lierepdec-rngintelt)
    - [`D *:= c: LieRepDec, RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-operation-lierepdec-rngintelt)
    - [`D /:= c: LieRepDec, RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-operation-lierepdec-rngintelt-2)
    - [`D * E: LieRepDec, LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#operation-op-times-lierepdec-lierepdec)
    - [`ProductRepresentation(D, E): LieRepDec, LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-productrepresentation-lierepdec-lierepdec)
    - [`ProductRepresentation(D, E, R): LieRepDec, LieRepDec, RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-productrepresentation-lierepdec-lierepdec-rootdtm)
    - [`SubWeights(D, Q, S): LieRepDec, SeqEnum, RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-subweights-lierepdec-seqenum-rootdtm)
    - [`PermuteWeights(D, pi, S): LieRepDec, GrpPermElt, RootDtm → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-permuteweights-lierepdec-grppermelt-rootdtm)
    - [Example: Arithmetic with Decompositions](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-122af0)
  - [Conversion Functions](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#conversion-functions)
    - [`VirtualDecomposition(C): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-virtualdecomposition-lierepdec)
    - [`VirtualDecomposition(R, v): RootDtm, Any → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-virtualdecomposition-rootdtm-any)
    - [`DecomposeCharacter(C): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-decomposecharacter-lierepdec)
    - [`DominantCharacter(D): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-dominantcharacter-lierepdec)
  - [Calculating with Representations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#calculating-with-representations)
    - [`RepresentationDimension(D): LieRepDec → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-representationdimension-lierepdec)
    - [`RepresentationDimension(R, v): RootDtm, SeqEnum → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-representationdimensionrv)
    - [`RepresentationDimension(R, v): RootDtm, ModTupRngElt → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-representationdimension-rootdtm-modtuprngelt)
    - [`CasimirValue(R, w): RootDtm, ModTupRngElt → FldRatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-casimirvalue-rootdtm-modtuprngelt)
    - [`CasimirValue(R, w): RootDtm, SeqEnum[RngIntElt] → FldRatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-casimirvalue-rootdtm-seqenum-rngintelt)
    - [`QuantumDimension(R, w): RootDtm, ModTupRngElt → SetMulti`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-quantumdimension-rootdtm-modtuprngelt)
    - [`QuantumDimension(R, w): RootDtm, SeqEnum[RngIntElt] → SetMulti`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-quantumdimension-rootdtm-seqenum-rngintelt)
    - [Example: Dimension and Quantum Dimension](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-e2320d)
    - [`Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, ModTupRngElt, AlgMatElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branchfrtovm)
    - [`Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, SeqEnum, AlgMatElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branch-rootdtm-rootdtm-seqenum-algmatelt)
    - [`Branch(ToGrp, D, M): RootDtm, LieRepDec, AlgMatElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branchtodm)
    - [`Collect(R, D, M): RootDtm, LieRepDec, AlgMatElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-collect)
    - [Example: Branch and Collect](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-e0936d)
    - [`TensorProduct(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt → .`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorrvw)
    - [`TensorProduct(R, v, w): RootDtm, SeqEnum, SeqEnum → .`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorproduct-rootdtm-seqenum-seqenum)
    - [`TensorProduct(D, E): LieRepDec, LieRepDec → .`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorde)
    - [`TensorProduct(Q): [LieRepDec] → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorde-2)
    - [`TensorPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorpower-rootdtm-rngintelt-modtuprngelt)
    - [`TensorPower(R, n, v): RootDtm, RngIntElt, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorpower-rootdtm-rngintelt-seqenum)
    - [`TensorPower(D, n): LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-tensorpower-lierepdec-rngintelt)
    - [Example: Tensor Powers of Representations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-58edc6)
    - [`AdamsOperator(R, n, v): RootDtm, RngIntElt, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-adamsoperator-rootdtm-rngintelt-modtuprngelt)
    - [`AdamsOperator(R, n, v): RootDtm, RngIntElt, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-adamsoperator-rootdtm-rngintelt-seqenum)
    - [`AdamsOperator(D, n): LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-adamsoperator-lierepdec-rngintelt)
    - [`SymmetricPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-symmetricpower-rootdtm-rngintelt-modtuprngelt)
    - [`SymmetricPower(R, n, v): RootDtm, RngIntElt, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-symmetricpower-rootdtm-rngintelt-seqenum)
    - [`SymmetricPower(D, n): LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-symmetricpower-lierepdec-rngintelt)
    - [`AlternatingPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingpower-rootdtm-rngintelt-modtuprngelt)
    - [`AlternatingPower(R, n, v): RootDtm, RngIntElt, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingpower-rootdtm-rngintelt-seqenum)
    - [`AlternatingPower(D, n): LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingpower-lierepdec-rngintelt)
    - [`Plethysm(R, lambda, v): RootDtm, SeqEnum, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-plethysm-rootdtm-seqenum-modtuprngelt)
    - [`Plethysm(R, lambda, v): RootDtm, SeqEnum, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-plethysm-rootdtm-seqenum-seqenum)
    - [`Plethysm(D, lambda): LieRepDec, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-plethysm-lierepdec-seqenum)
    - [`Spectrum(R, v, t): RootDtm, ModTupRngElt, SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-spectrumrvt)
    - [`Spectrum(R, v, t): RootDtm, SeqEnum, SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-spectrum-rootdtm-seqenum-seqenum)
    - [`Spectrum(D, t): LieRepDec, SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-spectrumdt)
    - [Example: Spectrum of a Toral Element](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-66b7b0)
    - [`Demazure(R, v, w): RootDtm, ModTupRngElt, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazurervw)
    - [`Demazure(R, v, w): RootDtm, SeqEnum, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazure-rootdtm-seqenum-grppermelt)
    - [`Demazure(D, w): LieRepDec, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazured)
    - [`Demazure(R, v): RootDtm, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazure-rootdtm-modtuprngelt)
    - [`Demazure(R, v): RootDtm, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazure-rootdtm-seqenum)
    - [`Demazure(D): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazure-lierepdec)
    - [Example: Demazure Operator](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-02a067)
    - [`LittlewoodRichardsonTensor(p, q): ModTupRngElt, ModTupRngElt → SeqEnum, SeqEnum[RngIntElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-pq)
    - [`LittlewoodRichardsonTensor(p, q): SeqEnum, SeqEnum → SeqEnum, SeqEnum[RngIntElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-seqenum-seqenum)
    - [`LittlewoodRichardsonTensor(P, M, Q, N): SeqEnum, SeqEnum[RngIntElt], SeqEnum, SeqEnum[RngIntElt] → SeqEnum, SeqEnum[RngIntElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-seqenum-seqenum-rngintelt-seqenum-seqenum-rngintelt)
    - [`LittlewoodRichardsonTensor(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-rootdtm-modtuprngelt-modtuprngelt)
    - [`LittlewoodRichardsonTensor(R, v, w): RootDtm, SeqEnum, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-rootdtm-seqenum-seqenum)
    - [`LittlewoodRichardsonTensor(D, E): LieRepDec, LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-lierepdec-lierepdec)
    - [Example: Littlewood-Richardson Tensor Product](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-32f0be)
    - [`AlternatingDominant(D, w): LieRepDec, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-altdomdw)
    - [`AlternatingDominant(R, wt, w): RootDtm, ModTupRngElt, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-altdomrwtw)
    - [`AlternatingDominant(R, wt, w): RootDtm, SeqEnum, GrpPermElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingdominant-rootdtm-seqenum-grppermelt)
    - [`AlternatingDominant(D): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingdominant-lierepdec)
    - [`AlternatingDominant(R, wt): RootDtm, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingdominant-rootdtm-modtuprngelt)
    - [`AlternatingDominant(R, wt): RootDtm, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingdominant-rootdtm-seqenum)
    - [Example: Computing the Alternating Dominant](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-96a07b)
    - [`AlternatingWeylSum(R, v): RootDtm, ModTupRngElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingweylsumrv)
    - [`AlternatingWeylSum(R, v): RootDtm, SeqEnum → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingweylsum-rootdtm-seqenum)
    - [`AlternatingWeylSum(D): LieRepDec → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingweylsumd)
- [Operations on Representations](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md)
  - [Lie Algebras](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#lie-algebras)
    - [`CharacterMultiset(V): ModAlg → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-charactermultiset-modalg)
    - [`CharacterMultiset(ρ): Map → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-charactermultiset-map)
    - [`Weights(V): ModAlg → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weights-modalg)
    - [`WeightsAndVectors(V): ModAlg → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weightsandvectors-modalg)
    - [`Weights(ρ): Map → [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weights-map)
    - [`WeightsAndVectors(ρ): Map → [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weightsandvectors-map)
    - [`HighestWeightsAndVectors(V): ModAlg → SeqEnum, SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-highestweightsandvectors-modalg)
    - [`DecompositionMultiset(V): ModAlg → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decompositionmultiset-modalg)
    - [`DecompositionMultiset(ρ): Map → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decompositionmultiset-map)
    - [`DominantWeights(R, w): RootDtm, [ ] → [ ModTupRngElt ], [ RngIntElt ]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-dominantweights-rootdtm)
    - [`WeylDimension(R, w): RootDtm, [ ] → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weyldimension-rootdtm)
    - [Example: Dominant Weights and Their Multiplicities](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#example-ex-c09ca5)
    - [`DecomposeTensorProduct(R, w, x): RootDtm, [ ], [ ] → [ ModTupRngElt ], [ RngIntElt ]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decomposetensorproduct-rootdtm)
    - [`DecomposeSymmetricPower(R, n, w): RootDtm, RngIntElt, [ ] → [ ModTupRngElt ], [ RngIn tElt ]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decomposesymmetricpower-rootdtm-rngintelt)
    - [`DecomposeExteriorPower(R, n, w): RootDtm, RngIntElt, [ ] → [ ModTupRngElt ], [ RngIn tElt ]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decomposeexteriorpower-rootdtm-rngintelt)
    - [Example: Decomposing Tensor Products](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#example-ex-06f529)
    - [`DirectSum(U, V): ModAlg, ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsum-modalg-modalg)
    - [`DirectSumDecomposition(V): ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsumdecomposition-modalg)
    - [`IndecomposableSummands(V): ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-indecomposablesummands-modalg)
    - [`DirectSum(ρ, τ): ModAlg, ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsum-modalg-modalg-2)
    - [`DirectSumDecomposition(ρ): Map[AlgLie, AlgMatLie] → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsumdecomposition-map-alglie-algmatlie)
    - [`IndecomposableSummands(ρ): Map[AlgLie, AlgMatLie] → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-indecomposablesummands-map-alglie-algmatlie)
    - [`TensorProduct(Q): SeqEnum → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-tensorproduct-seqenum-2)
    - [`SymmetricPower(V, n): ModAlg, RngIntElt → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-symmetricpower-modalg-rngintelt-2)
    - [`ExteriorPower(V, n): ModAlg, RngIntElt → ModAlg, Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-exteriorpower-modalg-rngintelt-2)
    - [Example: Tensor Product of Lie Algebra Modules](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#example-ex-c153c8)
  - [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#groups-of-lie-type)
    - [`DirectSum(ρ, τ): ModAlg, ModAlg → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsum-modalg-modalg-3)
    - [`DirectSumDecomposition(ρ): Map[GrpLie, GrpMat] → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-directsumdecomposition-map-grplie-grpmat)
    - [`IndecomposableSummands(ρ): Map[GrpLie, GrpMat] → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-indecomposablesummands-map-grplie-grpmat)
    - [`CharacterMultiset(V): ModAlg → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-charactermultiset-modalg-2)
    - [`CharacterMultiset(ρ): Map → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-charactermultiset-map-2)
    - [`Weights(ρ): Map → [LatElt], [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weights-map-2)
    - [`WeightsAndVectors(ρ): Map → [LatElt], [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weightsandvectors-map-2)
    - [`WeightVectors(ρ): Map → [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weightvectors-map)
    - [`Weight(ρ, v): Map, ModTupRngElt → LatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-weight-map-modtuprngelt)
    - [`DecompositionMultiset(V): ModAlg → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decompositionmultiset-modalg-2)
    - [`DecompositionMultiset(ρ): Map → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-decompositionmultiset-map-2)
    - [`HighestWeights(ρ): Map → [LatElt], [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-highestweights-map)
    - [`HighestWeightVectors(ρ): Map → [ModTupRngElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-highestweightvectors-map)
    - [`GeneralisedRowReduction(ρ): GrpLie, Map → Map`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-operations.md#function-generalisedrowreduction-grplie-map)
- [Other Functions for Representation Decompositions](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md)
  - [`FundamentalClosure(R, S): RootDtm, SetEnum → SetEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-fundamentalclosure-rootdtm-setenum)
  - [`Closure(R, S): RootDtm, SetEnum → SetEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-closure-rootdtm-setenum)
  - [`RestrictionMatrix(R, Q): RootDtm, SeqEnum → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-restrictionmatrix-rootdtm-seqenum)
  - [`RestrictionMatrix(R, S): RootDtm, RootDtm → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-lierepdecrestrictionmatrix)
  - [Example: Constructing a Restriction Matrix](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#example-ex-017a6f)
  - [`KLPolynomial(x, y): GrpPermElt, GrpPermElt → RngUPolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-klpolynomialxy)
  - [`RPolynomial(x, y): GrpPermElt, GrpPermElt → RngUPolElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-rpolynomialxy)
  - [Example: Kazhdan-Lusztig and R-Polynomials](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#example-ex-3fc4eb)
  - [`Exponents(R): RootDtm → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-exponents-rootdtm)
  - [Example: Exponents of a Coxeter Group](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#example-ex-9b36b7)
  - [`ToLiE(D): LieRepDec → MonStgElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-tolie-lierepdec)
  - [`FromLiE(R, p): RootDtm, MonStgElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-fromlie-rootdtm-monstgelt)
  - [Example: Conversion to and from LiE](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#example-ex-a9c639)
  - [Operations Related to the Symmetric Group](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#operations-related-to-the-symmetric-group)
    - [`ConjugationClassLength(l): SeqEnum → RngIntElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-conjugationclasslength-seqenum)
    - [`PartitionToWeight(l): SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-partitiontoweight-seqenum)
    - [`PartitionToWeight(l): ModTupRngElt → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-partitiontoweight-modtuprngelt)
    - [`WeightToPartition(v): SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-weighttopartition-seqenum)
    - [`WeightToPartition(v): ModTupRngElt → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-weighttopartition-modtuprngelt)
    - [`TransposePartition(l): SeqEnum → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-transposepartition-seqenum)
    - [`TransposePartition(l): ModTupRngElt → ModTupRngElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-transposepartition-modtuprngelt)
  - [FusionRules](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#fusionrules)
    - [`WZWFusion(R, v, w, k): RootDtm, Any, Any, RngIntElt → SetMulti`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-wzwfusion-rootdtm-any-any-rngintelt)
    - [`WZWFusion(D, E, k): LieRepDec, LieRepDec, RngIntElt → LieRepDec`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-wzwfusion-lierepdec-lierepdec-rngintelt)
    - [Example: WZW Fusion Rules](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#example-ex-fa246b)
- [Subgroups of Small Rank](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-small-database.md)
  - [`LiEMaximalSubgroups() → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-small-database.md#function-liemaximalsubgroups)
  - [`MaximalSubgroups(G): MonStgElt → SeqEnum[MonStgElt]`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-small-database.md#function-maximalsubgroups-monstgelt)
  - [`RestrictionMatrix(G, H): MonStgElt, MonStgElt → AlgMatElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-small-database.md#function-restrictionmatrix-monstgelt-monstgelt)
  - [Example: Maximal Subgroups from the Database](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-small-database.md#example-ex-23802f)
- [Subalgebras of su(d)](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md)
  - [`IrreducibleSimpleSubalgebrasOfSU(N): RngIntElt → SeqEnum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebrasofsu)
  - [`IrreducibleSimpleSubalgebraTreeSU(Q, d): SeqEnum[SeqEnum[Tup]], RngIntElt → GrphDir`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebratreesu-seqenum-seqenum-tup-rngintelt)
  - [`PrintTreesSU(Q, F): SeqEnum[SeqEnum[Tup]], MonStgElt`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#procedure-printtreessu-seqenum-seqenum-tup-monstgelt)
  - [Example: Simple Subalgebras of su(d)](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#example-ex-f4d461)
- [Bibliography](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/bibliography.md)

<a id="representations-introduction"></a>
<a id="sectrdrepsintro"></a>
### Introduction

This chapter gives functionality for direct sums of *highest weight representations* (or modules). This is an important class of representations of (almost) semisimple Lie algebras (Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie)) and connected reductive algebraic groups (Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie)). This class includes all finite dimensional representations if the base field is the complex field.

The representations we are considering are in bijection with sets of dominant weights with multiplicities. Such sets are called *decomposition multisets*. Many interesting computations in representation theory can be done combinatorially with weight multisets, without the need to construct the module itself. Examples of the things we can compute include: module dimension, the multiset of all the weights, and decomposition multisets for symmetric powers, alternating powers, and tensor products. We can also restrict a decomposition multiset to a subgroup or induce it to a supergroup.

The code for such combinatorial computations is based on the LiE software package [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)]. The algorithms for computing the actual representations are from [[dG01](https://docs.magma-maths.org/references.md#cite-wdg-lie-hwrep)] in the Lie algebra case, and from [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)] in the group case.

#### Highest Weight Modules

This introduction is inspired by the LiE manual [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

First consider connected reductive Lie groups over the complex field. If $G$ is a connected reductive complex Lie group, then it is a homomorphic image $G=\xi(G')$, where $\xi$ is a Lie-group homomorphism with finite kernel and $G'$ is the direct product of a simply connected group and a torus. Recall that a simply connected group is a direct product of *simple* simply connected groups. In particular, such groups are determined by their Cartan name and the dimension of the torus. For example, we denote the direct product of the group of type $A_4 C_3 B_2$ with a two dimensional torus by $A_4 C_3 B_2 T_2$. Most of the code ported from LiE works only for groups of this form. Similar terminology is used for the root datum corresponding to a group.

Connected reductive complex Lie groups have a very pleasing representation theory:

**–**
Every module decomposes as a direct sum of irreducible representations.

**–**
The (finite dimensional) irreducible representations correspond to dominant weights.

It follows that representations correspond to finite sets of dominant weights with multiplicity. These multisets are called *decomposition multisets*. We can use this classification to do useful computations about representations, without having to explicitly construct them.

Multisets of weights can be used for other purposes as well: The multiset of all weights occurring in a module $M$ is called the *character multiset*. Since the Weyl group permutes the weights occurring in the character of $M$, it suffices to consider only the dominant weights with their multiplicities. This is called the *dominant character multiset*. In the LiE system, multisets of weights are represented by polynomials: for example, the decomposition multiset is called a decomposition character.

When using the functions in this section, it is important to keep track of which kind of multiset you are using. For example, if you input a decomposition multiset to a function that expects a dominant character multiset, the output is meaningless.

We often abbreviate decomposition multiset to *decomposition*, and similarly for character multisets. Write $R_D$ for the root datum of the group of the decomposition $D$. Denote the irreducible module for the group with root datum $R$ with highest weight $v$ by $V^R_v$, or to $V_v$ if $R$ is clear from the context.

It is often useful to define consider *virtual* multisets, which allow weights to have negative multiplicities. We call a virtual multiset *proper* if its weights all have nonnegative multiplicities. A decomposition corresponds to an actual module if and only if it is proper.

<a id="representations-intro-toral"></a>
<a id="subsectrdrepsintrobruhat"></a>
<a id="subsectrdrepsintrotoral"></a>
#### Toral Elements

Many functions use a special syntax for finite-order elements of the torus of a Lie group $G$ (we are rarely interested in infinite-order elements). Recall that a weight is in fact a mapping from the torus $T$ to $C^\star$, and thus a weight $\lambda$ can be evaluated at an element $t \in T$. The resulting element is written $t^\lambda$. A set of fundamental weights $\omega_1, \ldots, \omega_r$ has the property that any element $t \in T$ is uniquely determined by the values $t^{\omega_1}, \ldots, t^{\omega_r}$. Therefore, we may represent $t$ as a vector $(a_1, \ldots, a_r, n)$, with the property that $t^{\omega_i} = e^{2 \pi i a_i / n} = \zeta_n^{a_i}$, where $\zeta_n = e^{2 \pi i / n}$ is the canonical $n$-th root of unity. An example of a function which uses this syntax for toral elements is [`Spectrum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-spectrumrvt). This function also provides a means to convert toral elements into a more natural form: see Example [Spectrum of a Toral Element](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#example-ex-66b7b0).

<a id="representations-other"></a>
<a id="subsectrdrepdatastr"></a>
#### Other Highest Weight Representations

Magma can also construct highest weight representations for:

**–**
(Almost) reductive Lie algebras (Chapter [Lie Algebras](https://docs.magma-maths.org/LieTheory/LieAlgebras/index-lie-algebras.md#chapalglie)); and

**–**
Split groups of Lie type (Chapter [Groups of Lie Type](https://docs.magma-maths.org/LieTheory/ChevalleyGroups/index-chevalley-groups.md#chapgrplie)).

If the base field has positive characteristic, highest weight representations are indecomposable, but not necessarily irreducible. In some cases there are irreducible representations which are not highest weight representations.

For groups of Lie type, we consider projective representations (i.e., homomorphisms to a projective general linear group). Suppose $G$ is a split group of Lie type defined over the field $k$ and $r$ is the least common multiple of the nonzero abelian-group invariants of the coisogeny group of $G$ (see Section [Isogeny of Split Reduced Root Data](https://docs.magma-maths.org/LieTheory/RootData/introduction.md#subsectrdisogeny)). Let $K$ be an extension of $k$ containing at least one $r$th root of each element of $k$ (i.e., $K$ contains a Kummer extension). Then highest weight representations are projective representations defined over $K$, and are constructed using polynomial functions and $r$th roots.

If $k$ already contains all $r$th roots, then no extension is needed and the representation will be linear rather than projective. This happens when $r=1$, i.e., the coisogeny group is torsion free. This includes direct products of a simply connected group and a torus. The general linear group also has this property. It also happens when $k$ is the complex field or field of algebraic numbers, when $k$ is the real field and $r$ is odd, and when $k$ is finite and $|k|-1$ is coprime to $r$.

The functions give a warning when the representation is not linear, but this can be avoided using the optional parameter `NoWarning`. Note that an appropriate extension $K$ can be constructed for all fields other than rational function fields, fields of Laurent series, and local fields. In these cases, as well as for nonfields, the representations can only be computed when $r=1$.

<a id="representations-constructing"></a>
<a id="sectrdrepsconstrwm"></a>
### Constructing Weight Multisets

In this section, we describe how to construct weight multisets.

<a id="function-triviallierepresentationdecomposition-rootdtm"></a>
#### `TrivialLieRepresentationDecomposition(R): RootDtm -> LieRepDec`

<a id="function-lierepresentationdecomposition-rootdtm"></a>
#### `LieRepresentationDecomposition(R): RootDtm -> LieRepDec`

The decomposition multiset of the trivial representation. The root datum $R$ must be weakly simply connected.

<a id="function-lierepresentationdecomposition-rootdtm-modtuprngelt"></a>
#### `LieRepresentationDecomposition(R, v): RootDtm, ModTupRngElt -> LieRepDec`

<a id="function-lierepresentationdecomposition-rootdtm-seqenum"></a>
#### `LieRepresentationDecomposition(R, v): RootDtm, SeqEnum -> LieRepDec`

The decomposition multiset of the highest weight representation with weight $v$, i.e., the singleton multiset. The root datum $R$ must be weakly simply connected. The weight $v$ must be a sequence of length $d$ or an element of ${\mathbb{Z}}^d$, where $d$ is the dimension of the root datum $R$.

<a id="function-lierepresentationdecomposition-rootdtm-seqenum-seqenum"></a>
#### `LieRepresentationDecomposition(R, Wt, Mp): RootDtm, SeqEnum, SeqEnum -> LieRepDec`

The decomposition multiset with weights given by the sequence $Wt$ and multiplicities given by of the sequence $Mp$. The root datum $R$ must be weakly simply connected. The weights must be a sequences of length $d$ or elements of ${\mathbb{Z}}^d$, where $d$ is the dimension of the root datum $R$.

<a id="function-adjointrepresentationdecomposition-rootdtm"></a>
#### `AdjointRepresentationDecomposition(R): RootDtm -> LieRepDec`

The decomposition multiset of the adjoint representation. This has the highest root of $R$ as its highest weight with multiplicity one. The root datum $R$ must be weakly simply connected.

<a id="example-ex-e0259e"></a>
#### `Example: Adjoint Representation Decomposition (ex-e0259e)`

The adjoint representation:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> D := AdjointRepresentationDecomposition(R);
> D:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Dimension of weight space:4
     Weights:
          [
               (0 1 0 0)
          ]
     Multiplicities:
          [ 1 ]
> HighestRoot(R : Basis := "Weight");
(0 1 0 0)
```

<a id="representations-constructing-2"></a>
<a id="sectrdrepsconstrreps"></a>
### Constructing Representations

<a id="id1"></a>
<a id="sectrdrepsconstralg"></a>
#### Lie Algebras

The functions described in this section are applicable only to almost reductive structure constant Lie algebras.

If $L$ has of large dimension, the step that calculates the information needed to compute preimages for these representations can be quite time consuming. So if there is no requirement for preimages, this step may be skipped by setting the optional argument `ComputePreImage` to `false`.

<a id="function-trivialrepresentation-alglie"></a>
##### `TrivialRepresentation(L): AlgLie -> Map`

The one-dimensional trivial representation of the Lie algebra $L$ over its base ring.

<a id="function-adjointrepresentation-alglie"></a>
##### `AdjointRepresentation(L): AlgLie -> Map`

```magma
ComputePreImage: BoolElt                    Default: true
```

The adjoint representation of the Lie algebra $L$ acting on itself.

<a id="function-standardrepresentation-alglie"></a>
##### `StandardRepresentation(L): AlgLie -> Map`

```magma
ComputePreImage: BoolElt                    Default: true
```

The standard representation of the semisimple Lie algebra $L$ over its base ring. This is the smallest dimensional faithful representation of $G$ (with a few small exceptions). The Killing form of $L$ must be nondegenerate.

<a id="example-ex-b368df"></a>
##### `Example: Standard Representation of a Lie Algebra (ex-b368df)`

```magma
> R := RootDatum("A2");
> #CoisogenyGroup(R);
3
> L := LieAlgebra(R, GF(2));
> h := StandardRepresentation(L);
> h(L.1);
[0 0 1]
[0 0 0]
[0 0 0]
> L := LieAlgebra(R, GF(3));
> h := StandardRepresentation(L);

>> h := StandardRepresentation(L);
                              ^
Runtime error in 'StandardRepresentation': Cannot compute the standard
representation in characteristic  3
```

The coisogeny group of a simply connected root datum always has order one, so we can compute the standard representation in this case.

```magma
> R := RootDatum("A2" : Isogeny:="SC");
> L := LieAlgebra(R, GF(3));
> h := StandardRepresentation(L);
```

<a id="function-highestweightrepresentation-alglie"></a>
##### `HighestWeightRepresentation(L, w): AlgLie, [ ] -> UserProgram`

The representation of the Lie algebra $L$ with highest weight $w$ (given either as a vector or as a sequence representing a vector). The result is a function, which for an element of $L$ gives the corresponding matrix. The algorithm used is described in [[dG01](https://docs.magma-maths.org/references.md#cite-wdg-lie-hwrep)].

<a id="example-ex-42d826"></a>
##### `Example: Highest Weight Representation of a Lie Algebra (ex-42d826)`

```magma
> L:= LieAlgebra("G2", RationalField());
> WeylDimension(RootDatum(L), [1,0]);
7
> rho:= HighestWeightRepresentation(L, [1,0]);
> e, f, h := ChevalleyBasis(L);
> rho(e[1]+f[1]);
[ 0  1  0  0  0  0  0]
[ 1  0  0  0  0  0  0]
[ 0  0  0 -2  0  0  0]
[ 0  0 -1  0 -1  0  0]
[ 0  0  0 -2  0  0  0]
[ 0  0  0  0  0  0  1]
[ 0  0  0  0  0  1  0]
> Codomain(rho);
Full Matrix Lie Algebra of degree 7 over Rational Field
> N := sub<Codomain(rho) | [ rho(x) : x in e ]>;
> Dimension(N);
6
> IsSolvable(N);
true
```

<a id="function-highestweightmodule-alglie-seqenum"></a>
##### `HighestWeightModule(L, w): AlgLie, SeqEnum -> ModTupAlg`

Given a semisimple Lie algebra $L$ corresponding to a root datum of rank $r$ and a sequence $w$ of non-negative integers of length $r$, this returns the irreducible $L$-module with highest weight $w$. The object returned is a left module over $L$. The algorithm used is described in [[dG01](https://docs.magma-maths.org/references.md#cite-wdg-lie-hwrep)].

<a id="function-tensorproduct-seqenum"></a>
##### `TensorProduct(Q): SeqEnum -> ModAlg, Map`

Given a sequence $Q$ of left-modules over a Lie algebra, this function returns the module $M$ that is the tensor product of the elements of $Q$. It also returns a map $\phi$ from the Cartesian product $P$ of the modules in $Q$ to $M$ as the second return value. If $t$ is a tuple whose $i$-th component is an element from the $i$-th module in $Q$ then $\phi$ maps $t$ to the element of $M$ that corresponds to the tensor product of the elements of $t$.

<a id="function-symmetricpower-modalg-rngintelt"></a>
##### `SymmetricPower(V, n): ModAlg, RngIntElt -> ModAlg, Map`

Given a left-module $V$ over a Lie algebra, and an integer $n\geq 2$, this function returns the module $M$ that is the $n$-th symmetric power of $V$. It also returns a map $f$ from the $n$-fold Cartesian product of $V$ to $M$. This map is multilinear and symmetric, i.e., if two of its arguments are interchanged then the image remains the same. Furthermore, $f$ has the universal property, i.e., any multilinear symmetric map from the $n$-fold Cartesian product into a vector space $W$ can be written as the composition of $f$ with a map from $M$ into $W$.

<a id="function-exteriorpower-modalg-rngintelt"></a>
##### `ExteriorPower(V, n): ModAlg, RngIntElt -> ModAlg, Map`

Given a left-module $V$ over a Lie algebra, and an integer $2\leq n \leq \dim(V)$, this function returns the module $M$ that is the $n$-th exterior power of $V$. It also returns a map $f$ from the $n$-fold Cartesian product of $V$ to $M$. This map is multilinear and antisymmetric, i.e., if two of its arguments are interchanged then the image is multiplied by $-1$. Furthermore, $f$ has the universal property, i.e., any multilinear antisymmetric map from the $n$-fold Cartesian product into a vector space $W$ can be written as the composition of $f$ with a map from $M$ into $W$.

<a id="example-ex-a477d3"></a>
##### `Example: Tensor Product of Lie Algebra Modules (ex-a477d3)`

```magma
> L:= LieAlgebra("G2", Rationals());
> V1:= HighestWeightModule(L, [1,0]);
> V2:= HighestWeightModule(L, [0,1]);
> T,f:= TensorProduct([V1,V2]);
> HighestWeightsAndVectors(T);
[
    (1 1),
    (2 0),
    (1 0)
]
[
    [
        T: (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ],
    [
        T: (0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ],
    [
        T: (0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0
            0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0 0 0 0 0 0
            0 0 -3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ]
]
> DecomposeTensorProduct(RootDatum(L), [1,0], [0,1]);
[
    (1 1),
    (2 0),
    (1 0)
]
[ 1, 1, 1 ]
> f(<V1.2,V2.3>);
T: (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
```

So we see that the tensor product $T$ decomposes as a direct sum of three submodules. This information can also be computed by using `DecomposeTensorProduct`. However, in the former case, the corresponding highest-weight vectors are also given.

```magma
> E,h:= ExteriorPower(V1, 3);
> h(<V1.1,V1.3,V1.4>);
E: (0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> h(<V1.1,V1.4,V1.3>);
E: (0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> DecomposeExteriorPower( RootDatum(L), 3, [1,0] );
[
    (2 0),
    (1 0),
    (0 0)
]
[ 1, 1, 1 ]
> HighestWeightsAndVectors(E);
[
    (2 0),
    (1 0),
    (0 0)
]
[
    [
        E: (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
        0)
    ],
    [
        E: (0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
        0)
    ],
    [
        E: (0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 2 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
        0)
    ]
]
```

<a id="representations-constructing-3"></a>
<a id="sectrdrepsconstrgrp"></a>
#### Groups of Lie Type

<a id="function-trivialrepresentation-grplie"></a>
##### `TrivialRepresentation(G): GrpLie -> Map`

The one-dimensional trivial representation of the group of Lie type $G$ over its base ring.

<a id="function-standardrepresentation-grplie"></a>
##### `StandardRepresentation(G): GrpLie -> Map`

The standard (projective) representation of the semisimple group of Lie type $G$ over an extension its base ring. In other words, the smallest dimension highest-weight representation. For the classical groups, this is the natural representation. If this is a projective representation rather than a linear representation, a warning is given. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="function-adjointrepresentation-grplie"></a>
##### `AdjointRepresentation(G): GrpLie -> Map, AlgLie`

The adjoint (projective) representation of the group of Lie type $G$ over an extension of its base ring, i.e. the representation given by the action of $G$ on its Lie algebra. The Lie algebra itself is the second returned value. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="function-liealgebra-grplie"></a>
##### `LieAlgebra(G): GrpLie -> AlgLie, Map`

The Lie algebra of the group of Lie type $G$, together with the adjoint representation. If this is a projective representation rather than a linear representation, a warning is given.

<a id="function-highestweightrepresentation-grplie"></a>
##### `HighestWeightRepresentation(G, v): GrpLie, . -> Map`

The highest weight (projective) representation with highest weight $v$ of the group of Lie type $G$ over an extension of its base ring. If this is a projective representation rather than a linear representation, a warning is given. This is constructed from the corresponding Lie algebra representation, using the algorithm in [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="example-ex-75d620"></a>
##### `Example: Standard Representation of a Group of Lie Type (ex-75d620)`

```magma
> G := GroupOfLieType("A2", Rationals() : Isogeny := "SC");
> rho := StandardRepresentation(G);
> rho(elt< G | 1 >);
[ 0 -1  0]
[ 1  0  0]
[ 0  0  1]
> rho(elt<G | <2,1/2> >);
[  1   0   0]
[  0   1   0]
[  0 1/2   1]
> rho(elt< G | VectorSpace(Rationals(),2)![3,5] >);
[  3   0   0]
[  0 5/3   0]
[  0   0 1/5]
>
> G := GroupOfLieType("A2", Rationals());
> Invariants(CoisogenyGroup(G));
[ 3 ]
> rho := StandardRepresentation(G);
Warning: Projective representation
> BaseRing(Codomain(rho));
Algebraically closed field with no variables
> rho(elt< G | VectorSpace(Rationals(),2)![3,1] >);
[r1  0  0]
[ 0 r2  0]
[ 0  0 r2]
> rho(elt< G | VectorSpace(Rationals(),2)![3,1] >)^3;
[  9   0   0]
[  0 1/3   0]
[  0   0 1/3]
```

<a id="representation-properties"></a>
<a id="sectrdrepsprops"></a>
### Operations on Weight Multisets

<a id="representation-operations-arithmetic"></a>
<a id="subsectrdrepsoperationsarithmetic"></a>
#### Basic Operations

In this section, basic access and arithmetic operations for weight multisets are described. Addition generally corresponds to direct sum of representations. The other arithmetic operations do not necessarily correspond to meaningful operations on the corresponding representation.

<a id="function-rootdatum-lierepdec"></a>
##### `RootDatum(D): LieRepDec -> RootDtm`

The Root datum over which the weight multiset $D$ is defined.

<a id="function-weights-lierepdec"></a>
##### `Weights(D): LieRepDec -> SeqEnum, SeqEnum`

<a id="function-weightsandmultiplicities-lierepdec"></a>
##### `WeightsAndMultiplicities(D): LieRepDec -> SeqEnum, SeqEnum`

The sequences of weights and multiplicities in the weight multiset $D$.

<a id="function-multiset-lierepdec"></a>
##### `Multiset(D): LieRepDec -> SetMulti`

The weights and multiplicities of the weight multiset $D$ as a normal multiset consisting of vectors.

<a id="function-multiplicity-lierepdec-modtuprngelt"></a>
##### `Multiplicity(D, v): LieRepDec, ModTupRngElt -> RngIntElt`

<a id="function-multiplicity-lierepdec-seqenum"></a>
##### `Multiplicity(D, v): LieRepDec, SeqEnum -> RngIntElt`

The multiplicity of the weight $v$ in the weight multiset $D$.

<a id="operation-op-eq-lierepdec-lierepdec"></a>
##### `D eq E: LieRepDec, LieRepDec -> BoolElt`

Returns `true` if, and only if, the weight multisets $D$ and $E$ are identical, i.e. they are defined over identical root data, with equal weights and multiplicities.

<a id="operation-op-plus-lierepdec-lierepdec"></a>
##### `D + E: LieRepDec, LieRepDec -> BoolElt`

The sum (union) of weight multisets $D$ and $E$, i.e. this corresponds to the direct sum of the two decomposition multisets. The underlying root data must be the same.

Add $V_v$ to $D$. The length of $v$ must be equal to $\dim(R_D)$.

<a id="operation-operation-lierepdec-lierepdec"></a>
##### `D +:= E: LieRepDec, LieRepDec`

Add the weight multiset $E$ to $D$. $R_D$ must be equal to $R_E$.

<a id="procedure-addrepresentation-lierepdec-lierepdec-rngintelt-ref"></a>
##### `AddRepresentation(~D, E, c): LieRepDec, LieRepDec, RngIntElt`

<a id="procedure-addrepresentation-lierepdec-lierepdec-ref"></a>
##### `AddRepresentation(~D, E): LieRepDec, LieRepDec`

Add $c$ times the weight multiset $E$ to $D$. The integer $c$ may be omitted, in which case it is assumed to be equal to $1$. The root data of $D$ and $E$ must be identical.

<a id="operation-op-plus-lierepdec-modtuprngelt"></a>
##### `D + v: LieRepDec, ModTupRngElt -> BoolElt`

<a id="operation-op-plus-lierepdec-seqenum"></a>
##### `D + v: LieRepDec, SeqEnum -> BoolElt`

Add the weight $v$ to the multiset $D$. The weight $v$ must be a sequence of length $d$ or an element of ${\mathbb{Z}}^d$, where $d$ is the dimension of the root datum $R$.

<a id="procedure-addrepresentation-lierepdec-modtuprngelt-rngintelt-ref"></a>
##### `AddRepresentation(~D, v, c): LieRepDec, ModTupRngElt, RngIntElt`

<a id="procedure-addrepresentation-lierepdec-seqenum-rngintelt-ref"></a>
##### `AddRepresentation(~D, v, c): LieRepDec, SeqEnum, RngIntElt`

<a id="procedure-addrepresentation-lierepdec-modtuprngelt-ref"></a>
##### `AddRepresentation(~D, v): LieRepDec, ModTupRngElt`

<a id="procedure-addrepresentation-lierepdec-seqenum-ref"></a>
##### `AddRepresentation(~D, v): LieRepDec, SeqEnum`

Add $c$ times the weight $v$ to the multiset $D$. The integer $c$ may be omitted, in which case it is assumed to be equal to $1$. The length of $v$ must be equal to the dimension of the root datum of $D$.

<a id="operation-operation-lierepdec-modtuprngelt"></a>
##### `D +:= v: LieRepDec, ModTupRngElt`

<a id="operation-operation-lierepdec-seqenum"></a>
##### `D +:= v: LieRepDec, SeqEnum`

Add the weight $v$ to the multiset $D$. The length of $v$ must be equal to the dimension of the root datum of $D$.

<a id="operation-op-times-lierepdec-rngintelt"></a>
##### `D * c: LieRepDec, RngIntElt -> LieRepDec`

The multiset whose weights are equal to those of $D$, and whose multiplicities are $c$ times the multiplicities of $D$.

<a id="operation-op-div-lierepdec-rngintelt"></a>
##### `D / c: LieRepDec, RngIntElt -> LieRepDec`

The multiset whose weights are equal to those of $D$, and whose multiplicities are the multiplicities of $D$ divided by $c$. An error is flagged if any of the multiplicities of $D$ is not divisible by $c$.

<a id="operation-operation-lierepdec-rngintelt"></a>
##### `D *:= c: LieRepDec, RngIntElt`

Multiply all multiplicities of the weight multiset $D$ by $c$.

<a id="operation-operation-lierepdec-rngintelt-2"></a>
##### `D /:= c: LieRepDec, RngIntElt`

Divide all multiplicities of the weight multiset $D$ by $c$. An error is flagged if a multiplicity of $D$ is not divisible by $c$.

<a id="operation-op-times-lierepdec-lierepdec"></a>
##### `D * E: LieRepDec, LieRepDec -> LieRepDec`

<a id="function-productrepresentation-lierepdec-lierepdec"></a>
##### `ProductRepresentation(D, E): LieRepDec, LieRepDec -> LieRepDec`

The product of the two weight multisets $D$ and $E$, viewed as polynomials as in the LiE package [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)]. The root datum of the resulting decomposition is the direct sum of the root data of $D$ and $E$. Note that this is does not correspond to the direct sum or tensor product of representations.

<a id="function-productrepresentation-lierepdec-lierepdec-rootdtm"></a>
##### `ProductRepresentation(D, E, R): LieRepDec, LieRepDec, RootDtm -> LieRepDec`

The product of the two weight multisets $D$ and $E$, viewed as polynomials as in the LiE package [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)]. The product is interpreted as a weight multiset over the root datum $R$. An error is flagged if the dimension of $R$ is not the sum of the dimensions of the root data of $D$ and $E$.

<a id="function-subweights-lierepdec-seqenum-rootdtm"></a>
##### `SubWeights(D, Q, S): LieRepDec, SeqEnum, RootDtm -> LieRepDec`

Let $k$ be the length of the sequence $Q$. The resulting decomposition $E$ has Root datum $S$, and to each highest weight of $D$ corresponds a highest weight $w'$ of $E$, with $w'_i = w_{Q[i]}$, where $i = 1, \ldots, k$. The multiplicities of $E$ are equal to the multiplicities of $D$, but one should note that $E$ might in fact have fewer unique highest weights than $D$, especially if $k < \dim(R_D)$. The dimension of the root datum $S$ must be equal to $k$.

<a id="function-permuteweights-lierepdec-grppermelt-rootdtm"></a>
##### `PermuteWeights(D, pi, S): LieRepDec, GrpPermElt, RootDtm -> LieRepDec`

Permute the components of the weights in the multiset $D$ by the permutation $\pi$ and interpret the result as a weight multiset over the root datum $S$. If the underlying root datum of $D$ has dimension $d$, then $S$ must also have dimension $d$ and $\pi$ must be an element of ${\operatorname{Sym}}(d)$.

<a id="example-ex-122af0"></a>
##### `Example: Arithmetic with Decompositions (ex-122af0)`

Arithmetic with decompositions:

```magma
> R := RootDatum("A2" : Isogeny := "SC");
> D := LieRepresentationDecomposition(R, [[2,3],[4,3]], [1,3]);
> D:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (2 3),
               (4 3)
          ]
     Multiplicities:
          [ 1, 3 ]
> E := D + [5,2];
> E:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (2 3),
               (4 3),
               (5 2)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
> PermuteWeights(E, Sym(2)!(1,2), R):Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 2 of type A2
     Dimension of weight space:2
     Weights:
          [
               (3 2),
               (3 4),
               (2 5)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
> S := RootDatum("A1" : Isogeny := "SC");
> SubWeights(E, [2], S):Maximal;
Highest weight decomposition of representation of:
     S: Simply connected root datum of dimension 1 of type A1
     Dimension of weight space:1
     Weights:
          [
               (3),
               (2)
          ]
     Multiplicities:
          [ 4, 1 ]
```

<a id="representation-operations-conversion"></a>
<a id="subsectrdrepsoperationsconversion"></a>
#### Conversion Functions

Functions for converting between different kinds of weight multiset (decomposition, character, and dominant character multisets). Note that it is the users responsibility to keep track of what kind of multiset they are using. If a function that expects one kind of set receives another, the output is likely to be meaningless.

<a id="function-virtualdecomposition-lierepdec"></a>
##### `VirtualDecomposition(C): LieRepDec -> LieRepDec`

<a id="function-virtualdecomposition-rootdtm-any"></a>
##### `VirtualDecomposition(R, v): RootDtm, Any -> LieRepDec`

The virtual decomposition multiset of the virtual module with dominant character multiset $C$. The second version is provided for convenience, and equivalent to `VirtualDecomposition(LieRepresentationDecomposition(R,v))`.

<a id="function-decomposecharacter-lierepdec"></a>
##### `DecomposeCharacter(C): LieRepDec -> LieRepDec`

The decomposition multiset of the module with dominant character multiset $C$. An error is flagged if $D$ is virtual, i.e. if dominant weights occur with negative multiplicities.

<a id="function-dominantcharacter-lierepdec"></a>
##### `DominantCharacter(D): LieRepDec -> LieRepDec`

Returns the dominant character multiset with decomposition $D$.

<a id="representation-operations-calculating"></a>
<a id="subsectrdrepsoperationscalculating"></a>
#### Calculating with Representations

As described earlier, many operations on representations carry over naturally to operations on their decompositions. This section describes the various functions for this purpose that were ported from LiE.

Note that many functions in this sections have two variants: one that takes decompositions as an argument and one that takes a root datum and a highest weight.

<a id="function-representationdimension-lierepdec"></a>
##### `RepresentationDimension(D): LieRepDec -> RngIntElt`

The dimension of the module with decomposition polynomial $D$. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-representationdimensionrv"></a>
##### `RepresentationDimension(R, v): RootDtm, SeqEnum -> RngIntElt`

<a id="function-representationdimension-rootdtm-modtuprngelt"></a>
##### `RepresentationDimension(R, v): RootDtm, ModTupRngElt -> RngIntElt`

The dimension of the module with highest weight $v$ over the root datum $R$. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-casimirvalue-rootdtm-modtuprngelt"></a>
##### `CasimirValue(R, w): RootDtm, ModTupRngElt -> FldRatElt`

<a id="function-casimirvalue-rootdtm-seqenum-rngintelt"></a>
##### `CasimirValue(R, w): RootDtm, SeqEnum[RngIntElt] -> FldRatElt`

The value of the quadratic Casimir on representation with highest weight $w$, normalised to take the value 2 on the highest weight of the adjoint representation. This function is due to Dr. Bruce Westbury, University of Warwick.

<a id="function-quantumdimension-rootdtm-modtuprngelt"></a>
##### `QuantumDimension(R, w): RootDtm, ModTupRngElt -> SetMulti`

<a id="function-quantumdimension-rootdtm-seqenum-rngintelt"></a>
##### `QuantumDimension(R, w): RootDtm, SeqEnum[RngIntElt] -> SetMulti`

Two Multisets of positive integers, $Num$ and $Den$, which should be read as follows. Take the product of the integers in $Num$ and divide by the product of the integers in $Den$ to get the ordinary dimension. Replacing each integer by the quantum integer will give the quantum dimension. This function is due to Dr. Bruce Westbury, University of Warwick.

<a id="example-ex-e2320d"></a>
##### `Example: Dimension and Quantum Dimension (ex-e2320d)`

Dimensions:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> D := AdjointRepresentationDecomposition(R);
> RepresentationDimension(D);
28
> wts, mps := WeightsAndMultiplicities(D); wts,mps;
[
    (0 1 0 0)
]
[ 1 ]
> num,den := QuantumDimension(R, wts[1]); num,den;
{* 4^^2, 7 *}
{* 1, 2^^2 *}
> &*num/&*den;
28
```

<a id="function-branchfrtovm"></a>
##### `Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, ModTupRngElt, AlgMatElt -> LieRepDec`

<a id="function-branch-rootdtm-rootdtm-seqenum-algmatelt"></a>
##### `Branch(FromGrp, ToGrp, v, M): RootDtm, RootDtm, SeqEnum, AlgMatElt -> LieRepDec`

```magma
Virtual: BoolElt                    Default: false
```

The decomposition polynomial of the restriction to ToGrp of the irreducible module $V_v$ with respect to the restriction matrix $M$. The matrix $M$ must have dim(FromGrp) rows and Dim(ToGrp) columns.

The matrix $M$ is used in such a way that any weight $v'$ (expressed on the basis of fundamental weights for $g$), when restricted to a torus of ToGrp, becomes the weight $v'M$ (expressed on the basis of fundamental weights for ToGrp). A suitable restriction matrix can often be obtained by use of [`RestrictionMatrix`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-other.md#function-lierepdecrestrictionmatrix). The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

The optional argument `Virtual` may be set to `true` to allow occurrence of virtual weights.

<a id="function-branchtodm"></a>
##### `Branch(ToGrp, D, M): RootDtm, LieRepDec, AlgMatElt -> LieRepDec`

```magma
Virtual: BoolElt                    Default: false
```

As [`Branch`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branchfrtovm)`(FromGrp, ToGrp, v, M)` but with the irreducible module $v$ replaced by the module with decomposition $D$.

<a id="function-collect"></a>
##### `Collect(R, D, M): RootDtm, LieRepDec, AlgMatElt -> LieRepDec`

This function attempts to perform the inverse operation of [`Branch`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branchtodm), namely to reconstruct an $R$-module from its restriction to $R_D$.

Please note that in LiE one must supply the inverse of the matrix used in Branch. Magma, however, is able to compute inverses itself, so one needs to provide the matrix used in Branch, and not its inverse.

$M$ must be a square matrix whose dimension is equal to the dimension of $R_D$. The dimension of $R$ must be equal to the dimension of $R_D$ as well. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="example-ex-e0936d"></a>
##### `Example: Branch and Collect (ex-e0936d)`

Branch and Collect:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> S := RootDatum("A3T1" : Isogeny := "SC");
> M := RestrictionMatrix(R, S);
> br := Branch(R, S, [1,0,0,0], M);
> br;
Highest weight decomposition of representation of:
     S: Simply connected root datum of dimension 4 of type A3
     Number of terms: 2
> cl := Collect(R, br, M);
> cl:Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Dimension of weight space:4
     Weights:
          [
               (1 0 0 0)
          ]
     Multiplicities:
          [ 1 ]
```

<a id="function-tensorrvw"></a>
##### `TensorProduct(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt -> .`

<a id="function-tensorproduct-rootdtm-seqenum-seqenum"></a>
##### `TensorProduct(R, v, w): RootDtm, SeqEnum, SeqEnum -> .`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with highest weights $v$ and $w$ over the root datum $R$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-tensorde"></a>
##### `TensorProduct(D, E): LieRepDec, LieRepDec -> .`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with decomposition multisets $D$ and $E$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-tensorde-2"></a>
##### `TensorProduct(Q): [LieRepDec] -> LieRepDec`

```magma
Goal: Any                    Default: 
```

The decomposition multiset of the tensor product of the representations with decomposition multisets in the sequence $Q$.

If the optional parameter `Goal` is set, only the multiplicity of the irreducible module with highest weight `Goal` is returned. This does not greatly speed up the process, as the same computational steps need to be made, but it will significantly reduce memory consumption. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-tensorpower-rootdtm-rngintelt-modtuprngelt"></a>
##### `TensorPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

<a id="function-tensorpower-rootdtm-rngintelt-seqenum"></a>
##### `TensorPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

<a id="function-tensorpower-lierepdec-rngintelt"></a>
##### `TensorPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition of the $n$-th tensor power of $V^R_v$ or $D$.

<a id="example-ex-58edc6"></a>
##### `Example: Tensor Powers of Representations (ex-58edc6)`

Taking tensor powers nicely shows how rapidly the complexity of representations increases, especially if we have a reasonably high weight as highest weight:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> DAd := AdjointRepresentationDecomposition(R);
> pwrs := function(D, n)
>   Q := [D];
>   for i in [2..n] do
>     Q[i] := Tensor(Q[1], Q[i-1]);
>   end for;
>   return Q;
> end function;
> time Q := pwrs(DAd, 7);
Time: 4.900
> [ #q : q in Q ];
[ 1, 7, 15, 30, 54, 91, 143 ]
> DH := LieRepresentationDecomposition(R, [2,2,0,0]);
> time Q := pwrs(DH, 4); [ #q : q in Q ];
Time: 99.070
[ 1, 105, 390, 1017 ]
```

<a id="function-adamsoperator-rootdtm-rngintelt-modtuprngelt"></a>
##### `AdamsOperator(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

<a id="function-adamsoperator-rootdtm-rngintelt-seqenum"></a>
##### `AdamsOperator(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

<a id="function-adamsoperator-lierepdec-rngintelt"></a>
##### `AdamsOperator(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of the virtual module obtained by applying the $n$-th Adams operator to $V^R_v$ or $D$. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-symmetricpower-rootdtm-rngintelt-modtuprngelt"></a>
##### `SymmetricPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

<a id="function-symmetricpower-rootdtm-rngintelt-seqenum"></a>
##### `SymmetricPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

<a id="function-symmetricpower-lierepdec-rngintelt"></a>
##### `SymmetricPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of $S^n(V^R_v)$, the $n$-th symmetric tensor power of $V^R_v$.

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-alternatingpower-rootdtm-rngintelt-modtuprngelt"></a>
##### `AlternatingPower(R, n, v): RootDtm, RngIntElt, ModTupRngElt -> LieRepDec`

<a id="function-alternatingpower-rootdtm-rngintelt-seqenum"></a>
##### `AlternatingPower(R, n, v): RootDtm, RngIntElt, SeqEnum -> LieRepDec`

<a id="function-alternatingpower-lierepdec-rngintelt"></a>
##### `AlternatingPower(D, n): LieRepDec, RngIntElt -> LieRepDec`

The decomposition polynomial of ${\rm Alt}^n(V^R_v)$, the $n$-th alternating tensor power of $V^R_v$.

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$. The algorithm used is described in [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser)].

<a id="function-plethysm-rootdtm-seqenum-modtuprngelt"></a>
##### `Plethysm(R, lambda, v): RootDtm, SeqEnum, ModTupRngElt -> LieRepDec`

<a id="function-plethysm-rootdtm-seqenum-seqenum"></a>
##### `Plethysm(R, lambda, v): RootDtm, SeqEnum, SeqEnum -> LieRepDec`

<a id="function-plethysm-lierepdec-seqenum"></a>
##### `Plethysm(D, lambda): LieRepDec, SeqEnum -> LieRepDec`

The decomposition multiset of the $R_D$-module of the plethysm of $V^R_v$ corresponding to the partition $\lambda$. Here $\lambda$ should be a partition of $d= \dim V^R_v$, i.e., a non-increasing sequence consisting of positive integers with sum $d$. The value returned is the decomposition multiset of the representation of $R_D$ that is obtained by composing the representation of $R_D$ afforded by $V^R_v$, with the representation of ${\rm GL}(V^R_v)$ corresponding to the partition $\lambda$. The classical Frobenius formula is used (see [[And77](https://docs.magma-maths.org/references.md#cite-andersen)] and [[JK81a](https://docs.magma-maths.org/references.md#cite-james-kerber)]).

In the second form the irreducible module $V^R_v$ is replaced by the module with decomposition $D$.

<a id="function-spectrumrvt"></a>
##### `Spectrum(R, v, t): RootDtm, ModTupRngElt, SeqEnum -> SeqEnum`

<a id="function-spectrum-rootdtm-seqenum-seqenum"></a>
##### `Spectrum(R, v, t): RootDtm, SeqEnum, SeqEnum -> SeqEnum`

<a id="function-spectrumdt"></a>
##### `Spectrum(D, t): LieRepDec, SeqEnum -> SeqEnum`

Let $n$ be the last entry of the sequence $t$; the toral element $t \in T$ will act in any representation of $R$ as a diagonalisable transformation, all of whose eigenvalues are $n$-th roots of unity. This function returns a sequence in which the $i$-th entry is the multiplicity of the eigenvalue $\zeta^i$ in the action of the toral element $t$ on the irreducible module $V^R_v$ (or the module with decomposition $D$, in the second case). Here $\zeta$ is the complex number $e^{2 \pi i /n}$.

See Section [Toral Elements](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representations-introduction.md#subsectrdrepsintrotoral) for a description of the format of $t$.

<a id="example-ex-66b7b0"></a>
##### `Example: Spectrum of a Toral Element (ex-66b7b0)`

Spectrum provides a means to recognise toral elements in a more natural form. [[vLCL92](https://docs.magma-maths.org/references.md#cite-leeuwen-cohen-lisser), Section 5.7.3].

```magma
> R := RootDatum("A4" : Isogeny := "SC");
> stdrep := [1,0,0,0];
> t := [1,0,0,0,2];
> stdrep := [1,0,0,0];
> Spectrum(R, stdrep, t);
[ 3, 2 ]
/* Showing that t has 3 eigenvalues 1 (1st root of unity),
   and 2 eigenvalues -1 (2nd root of unity) */
/* We may use the following function for constructing
   toral elements of A_n in the LiE format: */
> mktoral := function(b, d)
>     r := [ (i eq 1)
>               select b[i]
>               else b[i-1]+b[i] mod d
>             : i in [1..(#b-1)]
>          ];
>     r[#b] := d;
>     return r;
> end function;
> t2 := mktoral([0,0,0,1,1], 2); t2;
[ 0, 0, 0, 1, 2 ]
/* We restrict to a one parameter subgroup */
> RM := Transpose(Matrix([[0,0,0,1]]));
> T1 := RootDatum("T1" : Isogeny := "SC");
> Branch(R, T1, stdrep, RM):Maximal;
Highest weight decomposition of representation of:
     T1: Toral root datum of dimension 1
     Dimension of weight space:1
     Weights:
          [
               (1),
               (0),
               (-1)
          ]
     Multiplicities:
          [ 1, 3, 1 ]
/* Indicating that the element of that one parameter
   subgroup parametrised by some complex number z has
   one eigenvalue z^-1, three eigenvalues 1, and one
   eigenvalue z in the standard representation. */
```

<a id="function-demazurervw"></a>
##### `Demazure(R, v, w): RootDtm, ModTupRngElt, GrpPermElt -> LieRepDec`

<a id="function-demazure-rootdtm-seqenum-grppermelt"></a>
##### `Demazure(R, v, w): RootDtm, SeqEnum, GrpPermElt -> LieRepDec`

<a id="function-demazured"></a>
##### `Demazure(D, w): LieRepDec, GrpPermElt -> LieRepDec`

Starting with the highest weight $v$ of $R$, or the decomposition $D$, repeatedly apply the Demazure operator $M_{\alpha_i}$, taking for $i$ the successive entries of the Weyl word $w$ (viewed as product of simple reflections).

<a id="function-demazure-rootdtm-modtuprngelt"></a>
##### `Demazure(R, v): RootDtm, ModTupRngElt -> LieRepDec`

<a id="function-demazure-rootdtm-seqenum"></a>
##### `Demazure(R, v): RootDtm, SeqEnum -> LieRepDec`

<a id="function-demazure-lierepdec"></a>
##### `Demazure(D): LieRepDec -> LieRepDec`

Equivalent to [`Demazure`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazurervw)`(R, v, w)` or [`Demazure`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-demazured)`(D, w)` where $w$ is the longest word of the Coxeter group of $R$ or $R_D$.

If $D$ is a decomposition polynomial, then the result $E$ is the character polynomial of this decomposition. This is not the most efficient way to compute characters, but it can be very useful in checking other algorithms, since only the most elementary manipulations are involved.

<a id="example-ex-02a067"></a>
##### `Example: Demazure Operator (ex-02a067)`

The Demazure operator:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> DAd := AdjointRepresentationDecomposition(R);
> DAdCp := Demazure(DAd); DAdCp;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 25
> DAd2 := AlternatingDominant(DAdCp); DAd2;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 1
> DAd2 eq DAd;
true
```

<a id="function-littlewoodrichardsontensor-pq"></a>
##### `LittlewoodRichardsonTensor(p, q): ModTupRngElt, ModTupRngElt -> SeqEnum, SeqEnum[RngIntElt]`

<a id="function-littlewoodrichardsontensor-seqenum-seqenum"></a>
##### `LittlewoodRichardsonTensor(p, q): SeqEnum, SeqEnum -> SeqEnum, SeqEnum[RngIntElt]`

<a id="function-littlewoodrichardsontensor-seqenum-seqenum-rngintelt-seqenum-seqenum-rngintelt"></a>
##### `LittlewoodRichardsonTensor(P, M, Q, N): SeqEnum, SeqEnum[RngIntElt], SeqEnum, SeqEnum[RngIntElt] -> SeqEnum, SeqEnum[RngIntElt]`

In the first form, $p$ and $q$ are interpreted as dominant weights for the group $SL_n$ (of type $A_{n-1}$) expressed in partition coordinates. Here $n$ is the number of elements of $p$ (which must be equal to the number of elements of $q$).

The tensor product of the corresponding highest weight modules is computed using the Littlewood-Richardson rule, and the result is expressed again in partition coordinates. To be precise, two sequences P, M, are returned, meaning that the highest weight module with partition coordinates P[i] occurs in the tensor product with multiplicity M[i].

In the second form, instead of two irreducible modules, the tensor product of the module having partition coordinates P[i] with multiplicity M[i] and the module having partition coordinates Q[j] with multiplicity N[j] is computed.

<a id="function-littlewoodrichardsontensor-rootdtm-modtuprngelt-modtuprngelt"></a>
##### `LittlewoodRichardsonTensor(R, v, w): RootDtm, ModTupRngElt, ModTupRngElt -> LieRepDec`

<a id="function-littlewoodrichardsontensor-rootdtm-seqenum-seqenum"></a>
##### `LittlewoodRichardsonTensor(R, v, w): RootDtm, SeqEnum, SeqEnum -> LieRepDec`

<a id="function-littlewoodrichardsontensor-lierepdec-lierepdec"></a>
##### `LittlewoodRichardsonTensor(D, E): LieRepDec, LieRepDec -> LieRepDec`

In the first form, compute the tensor product of the irreducible $A_n$ representations with highest weights $v$ and $w$ using the Littlewood-Richardson rule. In the second form, compute the tensor product of the representations with decompositions $D$ and $E$.

This procedure converts the weights to partitions, computes the tensor product using the Littlewood-Richardson rule (as described above, see [`LittlewoodRichardsonTensor`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-littlewoodrichardsontensor-pq)), and converts the result back to a weight multiset.

<a id="example-ex-32f0be"></a>
##### `Example: Littlewood-Richardson Tensor Product (ex-32f0be)`

We compare the Littlewood-Richardson tensor and the normal tensor:

```magma
> R := RootDatum("A2" : Isogeny := "SC");
> v := [1,2];
> w := [1,1];
> D1 := Tensor(R, v, w);
> D1;
Highest weight decomposition of representation of:
    R: Simply connected root datum of dimension 2 of type A2
    Weights:
        [
            (0 1),
            (2 0),
            (0 4),
            (3 1),
            (2 3),
            (1 2)
        ]
    Multiplicities:
        [ 1, 1, 1, 1, 1, 2 ]
> D2 := LittlewoodRichardsonTensor(R, v, w);
> D2;
Highest weight decomposition of representation of:
    R: Simply connected root datum of dimension 2 of type A2
    Weights:
        [
            (1 2),
            (2 3),
            (2 0),
            (0 4),
            (0 1),
            (3 1)
        ]
    Multiplicities:
        [ 2, 1, 1, 1, 1, 1 ]
> D1 eq D2;
true
```

So the results are identical, as they should be. We could also convert the weights to partitions by hand, directly compute the Littlewood- Richardson tensor, and compare that to the previous result:

```magma
> vp := WeightToPartition(v); wp := WeightToPartition(w);
> vp, wp;
[ 3, 2, 0 ]
[ 2, 1, 0 ]
> parts, mps := LittlewoodRichardsonTensor(vp, wp);
> parts, mps;
[
    (4 4 0),
    (4 3 1),
    (3 3 2),
    (5 3 0),
    (5 2 1),
    (4 2 2)
]
[ 1, 2, 1, 1, 1, 1 ]
> [ PartitionToWeight(p) : p in parts ];
[
    (0 4),
    (1 2),
    (0 1),
    (2 3),
    (3 1),
    (2 0)
]
```

So that again gives the same representation. Finally, note that in some cases computing tensor products using the Littlewood-Richardson rule may be faster than computing them in the normal way:

```magma
> R := RootDatum("A8" : Isogeny := "SC");
> v := [0,0,2,0,1,0,1,2];
> w := [0,2,1,2,0,0,1,0];
> time _ := Tensor(R, v, w);
Time: 2.630
> time _ := LittlewoodRichardsonTensor(R, v, w);
Time: 0.210
```

<a id="function-altdomdw"></a>
##### `AlternatingDominant(D, w): LieRepDec, GrpPermElt -> LieRepDec`

<a id="function-altdomrwtw"></a>
##### `AlternatingDominant(R, wt, w): RootDtm, ModTupRngElt, GrpPermElt -> LieRepDec`

<a id="function-alternatingdominant-rootdtm-seqenum-grppermelt"></a>
##### `AlternatingDominant(R, wt, w): RootDtm, SeqEnum, GrpPermElt -> LieRepDec`

Alternating Dominant of the representation with decomposition $D$ or the irreducible representation $V_{wt}$, with respect to Weyl group element $w$. Starting with $D$, the following operation is repeatedly applied, taking for $i$ the successive entries of $w$ (viewed as reflection). For any (weight, multiplicity) pair $(v, c)$ of $D$ let $v_i = \langle v, \alpha_i \rangle$ be its coefficient of $w_i$; the term is

**–**
unaltered if $v_i \geq 0$,

**–**
removed if $v_i = -1$, and

**–**
replaced by $((v + w_i)r_i - w_i, -c)$ if $v_i = -2$. As a result of the operation for $i$, the coefficient $v_i$ is made non-negative without affecting the image $M_{\alpha_i}(D)$ under the Demazure operator, and hence also without changing the value of its alternating Weyl sum [`AlternatingWeylSum`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-alternatingweylsumrv).

<a id="function-alternatingdominant-lierepdec"></a>
##### `AlternatingDominant(D): LieRepDec -> LieRepDec`

<a id="function-alternatingdominant-rootdtm-modtuprngelt"></a>
##### `AlternatingDominant(R, wt): RootDtm, ModTupRngElt -> LieRepDec`

<a id="function-alternatingdominant-rootdtm-seqenum"></a>
##### `AlternatingDominant(R, wt): RootDtm, SeqEnum -> LieRepDec`

Equivalent to (but somewhat faster than) the previous [`AlternatingDominant`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-altdomdw)($D$, $w$) and [`AlternatingDominant`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-altdomrwtw)($R$, $wt$, $w$), with $w$ the longest element of the corresponding Weyl group. If $D$ is interpreted as dominant weights with multiplicities, then the result $E$ contains highest weights and multiplicities.

<a id="example-ex-96a07b"></a>
##### `Example: Computing the Alternating Dominant (ex-96a07b)`

Example of the alternating dominant:

```magma
> R := RootDatum("D4" : Isogeny := "SC");
> v := [1,5,2,1];
> Dec1 := LieRepresentationDecomposition(R, v);
> // First, we construct the character polynomial for the
> // module with highest weight lambda
> Dom := DominantCharacter(Dec1 : InBasis := "Weight"); Dom;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 176
> W := CoxeterGroup(R); #W; act := RootAction(W);
192
> domwts, dommps := WeightsAndMultiplicities(Dom);
> CP := LieRepresentationDecomposition(R);
> for i in [1..#domwts] do
>   wt := domwts[i]; mp := dommps[i];
>   wtor := WeightOrbit(W, wt : Basis := "Weight");
>   for wti in wtor do
>     AddRepresentation(~CP, wti, mp);
>   end for;
> end for;
> CP;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Number of terms: 17712
> time ad := AlternatingDominant(CP); ad:Maximal;
Time: 54.200
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 4 of type D4
     Dimension of weight space:4
     Weights:
          [
               (1 5 2 1)
          ]
     Multiplicities:
          [ 1 ]
> time adalt := AlternatingDominant(CP, LongestElement(W));
Time: 8.330
> ad eq adalt;
true
```

<a id="function-alternatingweylsumrv"></a>
##### `AlternatingWeylSum(R, v): RootDtm, ModTupRngElt -> LieRepDec`

<a id="function-alternatingweylsum-rootdtm-seqenum"></a>
##### `AlternatingWeylSum(R, v): RootDtm, SeqEnum -> LieRepDec`

<a id="function-alternatingweylsumd"></a>
##### `AlternatingWeylSum(D): LieRepDec -> LieRepDec`

The alternating Weyl sum of $V^R_v$ or $D$. Useful for demonstration purposes, but the fact that the number of terms in the result is a multiple of the order of the CoxeterGroup of $R$ makes it impractical for most groups.

<a id="representations-operations"></a>
<a id="sectgrplierepconstr"></a>
### Operations on Representations

<a id="representations-operations-alg"></a>
<a id="sectrdrepsopsalg"></a>
#### Lie Algebras

The functions described in this section are applicable only to modules of almost reductive structure constant Lie algebras.

<a id="function-charactermultiset-modalg"></a>
##### `CharacterMultiset(V): ModAlg -> LieRepDec`

<a id="function-charactermultiset-map"></a>
##### `CharacterMultiset(ρ): Map -> LieRepDec`

The character multiset of the Lie-algebra module $V$ or representation $\rho$.

<a id="function-weights-modalg"></a>
##### `Weights(V): ModAlg -> SeqEnum, SeqEnum`

<a id="function-weightsandvectors-modalg"></a>
##### `WeightsAndVectors(V): ModAlg -> SeqEnum, SeqEnum`

For a module $V$ over a semisimple Lie algebra this returns two sequences. The first sequence consists of the weights that occur in $V$. The second sequence is a sequence of sequences of elements of $V$, in bijection with the first sequence. The $i$-th element of the second sequence consists of a basis of the weight space of weight equal to the $i$-th weight of the first sequence.

<a id="function-weights-map"></a>
##### `Weights(ρ): Map -> [ModTupRngElt]`

<a id="function-weightsandvectors-map"></a>
##### `WeightsAndVectors(ρ): Map -> [ModTupRngElt]`

For a representation $\rho$ of a semisimple Lie algebra this returns two sequences. The first sequence consists of the weights of $\rho$. The second sequence is a sequence of sequences of elements of the underlying vector space, in bijection with the first sequence. The $i$-th element of the second sequence consists of a basis of the weight space of weight equal to the $i$-th weight of the first sequence.

<a id="function-highestweightsandvectors-modalg"></a>
##### `HighestWeightsAndVectors(V): ModAlg -> SeqEnum, SeqEnum`

This function is analogous to the previous one. Except in this case the first sequence consists of highest weights, i.e., those weights which occur as highest weights of an irreducible constituent of $V$. The second sequence consists of sequences that contain the corresponding highest weight vectors. So the submodules generated by the vectors in the second sequence form a direct sum decomposition of $V$.

<a id="function-decompositionmultiset-modalg"></a>
##### `DecompositionMultiset(V): ModAlg -> LieRepDec`

<a id="function-decompositionmultiset-map"></a>
##### `DecompositionMultiset(ρ): Map -> LieRepDec`

The decomposition multiset of the Lie-algebra module $V$ or representation $\rho$.

<a id="function-dominantweights-rootdtm"></a>
##### `DominantWeights(R, w): RootDtm, [ ] -> [ ModTupRngElt ], [ RngIntElt ]`

Given a crystallographic root datum $R$ corresponding to a semisimple Lie algebra $L$, and a dominant weight $w$ (given either as a vector or as a sequence representing a vector), let $V$ be the highest weight module of the $L$ with highest weight $w$. This function returns the sequence of dominant weights of $V$ and the sequence of their multiplicities. The complete list of weights and multiplicities of $V$ can be obtained by acting with the Weyl group on the dominant weights.

The underlying algorithm uses Moody and Patera’s fast version of Freudenthal’s formula [[MP82](https://docs.magma-maths.org/references.md#cite-moodypatera1982)].

<a id="function-weyldimension-rootdtm"></a>
##### `WeylDimension(R, w): RootDtm, [ ] -> RngIntElt`

Given a crystallographic root datum $R$ corresponding to a semisimple Lie algebra and a dominant weight $w$ (given either as a vector or as a sequence representing a vector), this function returns the dimension of the highest weight module.

This is an implementation of Weyl’s dimension formula.

<a id="example-ex-c09ca5"></a>
##### `Example: Dominant Weights and Their Multiplicities (ex-c09ca5)`

The default isogeny type of a root datum is `"Ad"` (namely adjoint) in which case the default basis of the functions which use the root datum is the `"Root"` basis. Therefore, in this example, we must specify the `"Weight"` basis for the `WeightOrbit` function.

```magma
> R := RootDatum("G2");
> wts, mults := DominantWeights(R, [1,1]);
> wts;
[
   (1 1),
   (2 0),
   (0 1),
   (1 0),
   (0 0)
]
> mults;
[ 1, 2, 2, 4, 4 ]
> WeylDimension(R, [1,1]);
64
> [ #WeightOrbit(R,mu : Basis := "Weight") : mu in wts ];
[ 12, 6, 6, 6, 1 ]
> &+[ #WeightOrbit(R,wts[i] : Basis := "Weight")*mults[i] : i in [1..#wts] ];
64
```

<a id="function-decomposetensorproduct-rootdtm"></a>
##### `DecomposeTensorProduct(R, w, x): RootDtm, [ ], [ ] -> [ ModTupRngElt ], [ RngIntElt ]`

Let $R$ be a crystallographic root datum corresponding to a semisimple Lie algebra $L$ and let $w$ and $x$ be dominant weights (given either as vectors or as sequences representing vectors). Let $W$ and $X$ be the highest weight modules for $w$ and $x$. The tensor product of $W$ and $X$ splits into a direct sum of highest weight modules. Two sequences are returned: the highest weights that occur and their multiplicities.

The algorithm uses a formula due to Klimyk (cf. [[dG00](https://docs.magma-maths.org/references.md#cite-wdg-lie-alg)], Proposition 8.12.3).

<a id="function-decomposesymmetricpower-rootdtm-rngintelt"></a>
##### `DecomposeSymmetricPower(R, n, w): RootDtm, RngIntElt, [ ] -> [ ModTupRngElt ], [ RngIn tElt ]`

This is a variant of `DecomposeTensorProduct` for the $n$th symmetric power of the highest weight representation of weight $w$ of the semisimple Lie algebra with root datum $R$.

<a id="function-decomposeexteriorpower-rootdtm-rngintelt"></a>
##### `DecomposeExteriorPower(R, n, w): RootDtm, RngIntElt, [ ] -> [ ModTupRngElt ], [ RngIn tElt ]`

This is a variant of `DecomposeTensorProduct` for the $n$th exterior power of the highest weight representation of weight $w$ of the semisimple Lie algebra with root datum $R$.

<a id="example-ex-06f529"></a>
##### `Example: Decomposing Tensor Products (ex-06f529)`

```magma
> R := RootDatum( "G2" );
> DecomposeTensorProduct( R, [1,1], [0,1] );
[
  (1 2),
  (4 0),
  (2 1),
  (3 0),
  (2 0),
  (1 0),
  (1 1)
]
[ 1, 1, 1, 1, 1, 1, 2 ]
> DecomposeExteriorPower( R, 2, [1,1] );
[
    (0 3),
    (5 0),
    (1 2),
    (2 1),
    (3 0),
    (1 0),
    (3 1),
    (1 1),
    (0 1)
]
[ 1, 1, 1, 2, 2, 1, 1, 1, 2 ]
```

<a id="function-directsum-modalg-modalg"></a>
##### `DirectSum(U, V): ModAlg, ModAlg -> SeqEnum`

The direct sum of the Lie algebra modules $U$ and $V$.

<a id="function-directsumdecomposition-modalg"></a>
##### `DirectSumDecomposition(V): ModAlg -> SeqEnum`

<a id="function-indecomposablesummands-modalg"></a>
##### `IndecomposableSummands(V): ModAlg -> SeqEnum`

Given a Lie algebra module $V$, return the direct sum decomposition of $V$ as a sequence of submodules whose sum is $V$ and each of which cannot be further decomposed into a direct sum. If the Lie algebra is semisimple over a field of characteristic zero, the summands are known to be irreducible highest weight modules.

<a id="function-directsum-modalg-modalg-2"></a>
##### `DirectSum(ρ, τ): ModAlg, ModAlg -> SeqEnum`

The direct sum of the Lie algebra representations $\rho$ and $\tau$.

<a id="function-directsumdecomposition-map-alglie-algmatlie"></a>
##### `DirectSumDecomposition(ρ): Map[AlgLie, AlgMatLie] -> SeqEnum`

<a id="function-indecomposablesummands-map-alglie-algmatlie"></a>
##### `IndecomposableSummands(ρ): Map[AlgLie, AlgMatLie] -> SeqEnum`

Given a Lie algebra representation $\rho$, return the direct sum decomposition of $\rho$ as a sequence of indecomposable subrepresentation. If the Lie algebra is semisimple over a field of characteristic zero, the summands are known to be irreducible highest weight representations.

<a id="function-tensorproduct-seqenum-2"></a>
##### `TensorProduct(Q): SeqEnum -> ModAlg, Map`

Given a sequence $Q$ of left-modules over a Lie algebra, this function returns the module $M$ that is the tensor product of the elements of $Q$. Secondly it returns a map from the Cartesian product of the elements of $Q$ to $M$. This maps a tuple $t$ to the element of $M$ that is formed by tensoring the elements of $t$.

<a id="function-symmetricpower-modalg-rngintelt-2"></a>
##### `SymmetricPower(V, n): ModAlg, RngIntElt -> ModAlg, Map`

Given a left-module $V$ over a Lie algebra, and an integer $n\geq 2$, this function returns the module $M$ that is the $n$-th symmetric power of $V$. It also returns a map $f$ from the $n$-fold Cartesian product of $V$ to $M$. This map is multilinear and symmetric, i.e., if two of its arguments are interchanged then the image remains the same. Furthermore, $f$ has the universal property, i.e., any multilinear symmetric map from the $n$-fold Cartesian product into a vector space $W$ can be written as the composition of $f$ with a map from $M$ into $W$.

<a id="function-exteriorpower-modalg-rngintelt-2"></a>
##### `ExteriorPower(V, n): ModAlg, RngIntElt -> ModAlg, Map`

Given a left-module $V$ over a Lie algebra, and an integer $2\leq n \leq \dim(V)$, this function returns the module $M$ that is the $n$-th exterior power of $V$. It also returns a map $f$ from the $n$-fold Cartesian product of $V$ to $M$. This map is multilinear and antisymmetric, i.e., if two of its arguments are interchanged then the image is multiplied by $-1$. Furthermore, $f$ has the universal property, i.e., any multilinear antisymmetric map from the $n$-fold Cartesian product into a vector space $W$ can be written as the composition of $f$ with a map from $M$ into $W$.

<a id="example-ex-c153c8"></a>
##### `Example: Tensor Product of Lie Algebra Modules (ex-c153c8)`

```magma
> L:= LieAlgebra("G2", Rationals());
> V1:= HighestWeightModule(L, [1,0]);
> V2:= HighestWeightModule(L, [0,1]);
> T,f:= TensorProduct([V1,V2]);
> HighestWeightsAndVectors(T);
[
    (1 1),
    (2 0),
    (1 0)
]
[
    [
        T: (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ],
    [
        T: (0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
            0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ],
    [
        T: (0 0 0 0 0 0 1 2 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -1 0 0
            0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -3 0 0 0 0 0 0 0 0 0 0
            0 0 -3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
    ]
]
> DecomposeTensorProduct(RootDatum(L), [1,0], [0,1]);
[
    (1 1),
    (2 0),
    (1 0)
]
[ 1, 1, 1 ]
> f(<V1.2,V2.3>);
T: (0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
    0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
```

So we see that the tensor product $T$ decomposes as a direct sum of three submodules. This information can also be computed by using `DecomposeTensorProduct`. However, in the former case, the corresponding highest-weight vectors are also given.

```magma
> E,h:= ExteriorPower(V1, 3);
> h(<V1.1,V1.3,V1.4>);
E: (0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> h(<V1.1,V1.4,V1.3>);
E: (0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
> DecomposeExteriorPower( RootDatum(L), 3, [1,0] );
[
    (2 0),
    (1 0),
    (0 0)
]
[ 1, 1, 1 ]
> HighestWeightsAndVectors(E);
[
    (2 0),
    (1 0),
    (0 0)
]
[
    [
        E: (1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
        0)
    ],
    [
        E: (0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
        0)
    ],
    [
        E: (0 0 0 0 0 0 0 0 0 0 0 1 2 0 0 0 0 0 2 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0
        0)
    ]
]
```

<a id="representations-operations-grp"></a>
<a id="sectrdrepsopsgrp"></a>
#### Groups of Lie Type

These functions apply to projective representations of groups of Lie type. Note that modules have not yet been implemented for these groups.

<a id="function-directsum-modalg-modalg-3"></a>
##### `DirectSum(ρ, τ): ModAlg, ModAlg -> SeqEnum`

The direct sum of the group of Lie type representations $\rho$ and $\tau$.

<a id="function-directsumdecomposition-map-grplie-grpmat"></a>
##### `DirectSumDecomposition(ρ): Map[GrpLie, GrpMat] -> SeqEnum`

<a id="function-indecomposablesummands-map-grplie-grpmat"></a>
##### `IndecomposableSummands(ρ): Map[GrpLie, GrpMat] -> SeqEnum`

Given a group of Lie type representation $\rho$, return the direct sum decomposition of $\rho$ as a sequence of indecomposable subrepresentation. If the base field has characteristic zero, the summands are known to be irreducible highest weight representations.

<a id="function-charactermultiset-modalg-2"></a>
##### `CharacterMultiset(V): ModAlg -> LieRepDec`

<a id="function-charactermultiset-map-2"></a>
##### `CharacterMultiset(ρ): Map -> LieRepDec`

The character weight multiset of the group of Lie type representation $\rho$.

<a id="function-weights-map-2"></a>
##### `Weights(ρ): Map -> [LatElt], [ModTupRngElt]`

<a id="function-weightsandvectors-map-2"></a>
##### `WeightsAndVectors(ρ): Map -> [LatElt], [ModTupRngElt]`

The weights of the representation $\rho$, together with the corresponding weight vectors.

<a id="function-weightvectors-map"></a>
##### `WeightVectors(ρ): Map -> [ModTupRngElt]`

A basis of weight vectors of the representation $\rho$.

<a id="function-weight-map-modtuprngelt"></a>
##### `Weight(ρ, v): Map, ModTupRngElt -> LatElt`

The weight corresponding to the weight vector $v$ of the representation $\rho$.

<a id="function-decompositionmultiset-modalg-2"></a>
##### `DecompositionMultiset(V): ModAlg -> LieRepDec`

<a id="function-decompositionmultiset-map-2"></a>
##### `DecompositionMultiset(ρ): Map -> LieRepDec`

The decomposition multiset of the group of Lie type representation $\rho$.

<a id="function-highestweights-map"></a>
##### `HighestWeights(ρ): Map -> [LatElt], [ModTupRngElt]`

The highest weights of the representation $\rho$, together with the corresponding highest weight vectors. This function may fail for small finite fields.

<a id="function-highestweightvectors-map"></a>
##### `HighestWeightVectors(ρ): Map -> [ModTupRngElt]`

The highest weight vectors of the representation $\rho$.

<a id="function-generalisedrowreduction-grplie-map"></a>
##### `GeneralisedRowReduction(ρ): GrpLie, Map -> Map`

Given a projective matrix representation $\rho:G\to {\operatorname{GL}}_m(k)$, return its inverse. This algorithm is based on [[CMT04](https://docs.magma-maths.org/references.md#cite-cohenmurraytaylor)].

<a id="representation-other"></a>
<a id="sectrdrepsother"></a>
### Other Functions for Representation Decompositions

In this section, we describe more complicated functions for dealing with representation decompositions.

<a id="function-fundamentalclosure-rootdtm-setenum"></a>
#### `FundamentalClosure(R, S): RootDtm, SetEnum -> SetEnum`

A set of fundamental roots in the minimal subsystem (not necessarily closed!) of the root system $R$ that contains all the roots in $S$. This function is equivalent to the `fundam` function in LiE.

The set $S$ should contain either roots or root indices; the returned set will then contain objects of the same type.

<a id="function-closure-rootdtm-setenum"></a>
#### `Closure(R, S): RootDtm, SetEnum -> SetEnum`

A set of fundamental roots in the minimal subsystem (not necessarily closed!) of the root system $R$ that contains all the roots in $S$. This function is equivalent to the `closure` function in LiE.

The set $S$ should contain either roots or root indices; the returned set will then contain objects of the same type.

<a id="function-restrictionmatrix-rootdtm-seqenum"></a>
#### `RestrictionMatrix(R, Q): RootDtm, SeqEnum -> AlgMatElt`

For a simply connected root datum $R$ and a sequence of roots $Q$ forming a fundamental basis for a closed subdatum $S$ of $R$, this function computes a restriction matrix for the fundamental Lie subgroup of type $S$ of the Lie group corresponding to $R$.

The sequence $Q$ may contain either integers (where $i$ corresponds to the $i$-th root of $R$) or vectors (interpreted as root vectors written in the root basis of $R$).

Note that the result is not unique. Moreover, if the result is to be used by [`Branch`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-branchfrtovm) or [`Collect`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-collect) the roots in $Q$ must be positive roots, and their mutual inner products must be non-positive.

<a id="function-lierepdecrestrictionmatrix"></a>
#### `RestrictionMatrix(R, S): RootDtm, RootDtm -> AlgMatElt`

Let $S$ be a sub root datum of $R$, constructed for example (but not necessarily) using a call to `sub<...>`. Then the matrix $M$ returned by this function maps the fundamental weights of $R$ to those of $S$. Note that, if the rank of $S$ is smaller than the rank of $R$, there will be more than one such matrix.

<a id="example-ex-017a6f"></a>
#### `Example: Constructing a Restriction Matrix (ex-017a6f)`

Constructing a restriction matrix

```magma
> R := RootDatum("D4":  Isogeny := "SC");
> sub<R | [1,3,4]>;
Root datum of dimension 4 of type A1 A1 A1
[ 1, 3, 4, 13, 15, 16 ]
> S := RootDatum("A1A1A1T1" : Isogeny := "SC");
> M := RestrictionMatrix(R, S); M;
[ 1  0  0 -1]
[ 0  1  0 -2]
[ 0  0  1 -1]
[ 0  0  0  4]
> imgR := FundamentalWeights(R)*M; imgR;
[ 1  0  0 -1]
[ 0  1  0 -2]
[ 0  0  1 -1]
[ 0  0  0  4]
> FundamentalWeights(S);
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
/* M is of the required form, since: */
> [ BasisChange(S, BasisChange(S, imgR[i]
>     : InBasis := "Standard", OutBasis := "Weight")
>     : InBasis := "Weight", OutBasis := "Standard")
>   : i in [1..4]
> ];
[
    (1 0 0 0),
    (0 1 0 0),
    (0 0 1 0),
    (0 0 0 0)
]
```

<a id="function-klpolynomialxy"></a>
#### `KLPolynomial(x, y): GrpPermElt, GrpPermElt -> RngUPolElt`

```magma
Ring: RngUPol                    Default: PolynomialRing(Integers())
```

The Kazhdan-Lusztig polynomial $P_{x,y}$. We use the recursion given originally by Kazhdan and Lusztig [[KL79](https://docs.magma-maths.org/references.md#cite-kazhdan-lusztig)].

<a id="function-rpolynomialxy"></a>
#### `RPolynomial(x, y): GrpPermElt, GrpPermElt -> RngUPolElt`

```magma
Ring: RngUPol                    Default: PolynomialRing(Integers())
```

The $R$-polynomial $R_{x,y}$.

<a id="example-ex-3fc4eb"></a>
#### `Example: Kazhdan-Lusztig and R-Polynomials (ex-3fc4eb)`

There is a relation between Kazhdan-Lusztig polynomials and $R$-polynomials. We should have, for any $x, w \in W$:

$$
X^{l(w) - l(x)} \overline{P_{x,w}} - P_{x,w} = \sum_{x < y \leq w} R_{x,w} P_{y,w},
$$

where the bar indicates a sign change of all the exponents. We need some fiddling around in order to implement this sign change, since Magma doesn’t support negative exponents at the moment, but we can make it work:

```magma
> signchange := function(pol, pwr)
>     //returns X^pwr * bar(pol)
>     deg := Degree(pol);
>     P := Parent(pol);
>     if (deg gt pwr) then return "Failed: Can't do sign change"; end if;
>     return (P.1)^(pwr-deg)*P!Reverse(Eltseq(pol));
> end function;
> testKL := function(x, w)
>     W := Parent(x);
>     rng<X> := PolynomialRing(Integers());
>     lenw := CoxeterLength(W, w);
>     lenx := CoxeterLength(W, x);
>
>     if (lenx gt lenw) then
>         return "Failed: l(x) > l(w) gives zero R and KL polynomials.";
>     end if;
>
>     /* Left hand side */
>     Pxw := KLPolynomial(x, w : Ring := rng);
>     lhs := signchange(Pxw, lenw - lenx);
>     if (Type(lhs) eq MonStgElt) then return lhs; end if;
>     lhs -:= Pxw;
>
>     /* Right hand side */
>     rhs := rng!0;
>     lvl := {w};
>     lvllen := lenw;
>     while (lvllen gt lenx and #lvl gt 0) do
>         for y in lvl do
>             rhs +:= RPolynomial(x,y : Ring := rng)*
>                         KLPolynomial(y, w : Ring := rng);
>         end for;
>         lvl := BruhatDescendants(lvl : z := x);
>         lvllen -:= 1;
>     end while;
>
>     /* Done */
>     printf "LHS: %o\\n", lhs;
>     printf "RHS: %o\\n", rhs;
>     return lhs eq rhs;
> end function;
> W := CoxeterGroup("D4");
> x := W.1*W.2*W.1;
> w := W.1*W.2*W.3*W.4*W.1*W.2;
> testKL(x,w);
LHS: X^3 + X^2 - X - 1
RHS: X^3 + X^2 - X - 1
true
```

<a id="function-exponents-rootdtm"></a>
#### `Exponents(R): RootDtm -> SeqEnum`

The exponents of a Root datum $R$ form a sequence of numbers $e_1, \ldots, e_r$, where $r$ is the rank of $R$, such that the polynomial $\sum_{w \in W} X^{l(w)}$ decomposes as a product $\prod_{i=1}^r \sum_{j=0}^{e_i} X^j$. They are given in weakly increasing order.

<a id="example-ex-9b36b7"></a>
#### `Example: Exponents of a Coxeter Group (ex-9b36b7)`

Exponents of $A_3$:

```magma
> W := CoxeterGroup("A3"); #W;
24
> P<X> := PolynomialRing(Integers());
> f := &+[ X^(CoxeterLength(W, w)) : w in W ]; f;
X^6 + 3*X^5 + 5*X^4 + 6*X^3 + 5*X^2 + 3*X + 1
> R := RootDatum("A3" : Isogeny := "SC");
> exp := Exponents(R); exp;
[ 1, 2, 3 ]
> g := [ &+[ X^j : j in [0..e] ] : e in exp ]; g;
[
     X + 1,
     X^2 + X + 1,
     X^3 + X^2 + X + 1
]
> f eq &*g;
true
```

<a id="function-tolie-lierepdec"></a>
#### `ToLiE(D): LieRepDec -> MonStgElt`

The LiE equivalent of the decomposition $D$.

<a id="function-fromlie-rootdtm-monstgelt"></a>
#### `FromLiE(R, p): RootDtm, MonStgElt -> LieRepDec`

The decomposition of the representation over $R$ that is equivalent to $p$, where $p$ is a polynomial in LiE-syntax.

<a id="example-ex-a9c639"></a>
#### `Example: Conversion to and from LiE (ex-a9c639)`

Conversion to and from LiE-syntax

```magma
> R := RootDatum("B3" : Isogeny := "SC");
> D := LieRepresentationDecomposition(R, [1,2,3]);
> s := ToLiE(D); s;
1X[1,2,3]
> FromLiE(R, s):Maximal;
Highest weight decomposition of representation of:
     R: Simply connected root datum of dimension 3 of type B3
     Dimension of weight space:3
     Weights:
          [
               (1 2 3)
          ]
     Multiplicities:
          [ 1 ]
```

<a id="representation-other-sym"></a>
<a id="sectrdrepsothersym"></a>
#### Operations Related to the Symmetric Group

In this section, we describe some functions taken from LiE for dealing with the Symmetric group.

<a id="function-conjugationclasslength-seqenum"></a>
##### `ConjugationClassLength(l): SeqEnum -> RngIntElt`

The order of the conjugation class of $S_n$ of permutations of cycle type $l$ (for $n$ the sum of the elements of $l$).

<a id="function-partitiontoweight-seqenum"></a>
##### `PartitionToWeight(l): SeqEnum -> SeqEnum`

<a id="function-partitiontoweight-modtuprngelt"></a>
##### `PartitionToWeight(l): ModTupRngElt -> ModTupRngElt`

Let $n$ be the number of parts of $l$, then the function returns the weight for a group of type $A_{n-1}$ corresponding to $\lambda$, expressed on the basis of fundamental weights.

<a id="function-weighttopartition-seqenum"></a>
##### `WeightToPartition(v): SeqEnum -> SeqEnum`

<a id="function-weighttopartition-modtuprngelt"></a>
##### `WeightToPartition(v): ModTupRngElt -> ModTupRngElt`

Let $n$ be the length of $v$, then $v$ is interpreted as a weight for a group of type $A_n$, and the expression of that weight in $n+1$ partition coordinates is returned. When $v$ is dominant, this is a partition with $n+1$ parts.

<a id="function-transposepartition-seqenum"></a>
##### `TransposePartition(l): SeqEnum -> SeqEnum`

<a id="function-transposepartition-modtuprngelt"></a>
##### `TransposePartition(l): ModTupRngElt -> ModTupRngElt`

The transpose partition of $l$.

<a id="representation-fusion"></a>
<a id="sectrdrepsfusion"></a>
#### FusionRules

In this section, we describe a function for computing fusion rules using the Kac-Walton formular, as described in Section 16.2 of [[FMS97](https://docs.magma-maths.org/references.md#cite-fms1997)].

<a id="function-wzwfusion-rootdtm-any-any-rngintelt"></a>
##### `WZWFusion(R, v, w, k): RootDtm, Any, Any, RngIntElt -> SetMulti`

```magma
ReturnForm: MonStgElt                    Default: "Auto"
```

Compute the fusion rules for weights $v \times w$ of $R$ at level $k$ using the Kac-Walton formula. The weights $v$ and $w$ may be given either as finite weights (i.e. vectors or sequences with rank($R$) entries) or as affine weights (i.e. vectors or sequences with rank($R$)$+1$ entries).

The optional argument `ReturnForm` should be “Auto” (in which case the weights returned will be finite weights or affine weights depending on what $v$ and $w$ are; the default), “Finite” (in which case the weights returned are finite weights), or “Affine” (in which case the weights returned are affine weights).

Note that $R$ should be a weakly simply connected root datum.

<a id="function-wzwfusion-lierepdec-lierepdec-rngintelt"></a>
##### `WZWFusion(D, E, k): LieRepDec, LieRepDec, RngIntElt -> LieRepDec`

Compute the fusion rules for representations $D$ and $E$ at level $k$.

<a id="example-ex-fa246b"></a>
##### `Example: WZW Fusion Rules (ex-fa246b)`

Fusion rules at level $3$ for B$_3$ (using finite weights first, affine weights second)

```magma
> R := RootDatum("B3" : Isogeny := "SC");
> WZWFusion(R, [0,0,1],[1,0,1], 3);
{*
    (2 0 0),
    (1 1 0),
    (0 0 2),
    (1 0 2),
    (1 0 0),
    (0 1 0)
*}
> WZWFusion(R, [0,0,1],[1,0,1], 3 : ReturnForm := "Affine");
{*
    (2 0 0 1),
    (1 0 2 0),
    (0 1 0 1),
    (1 0 0 2),
    (0 0 2 1),
    (1 1 0 0)
*}
```

<a id="representation-small-database"></a>
<a id="sectrdrepssmalldatabase"></a>
### Subgroups of Small Rank

LiE contains a small database with the types of the maximal proper subgroups of complex reductive simply connected Lie groups $g$, where $g$ is simple and of rank at most $8$. We copied this list into Magma, and it can be accessed using the following functions.

<a id="function-liemaximalsubgroups"></a>
#### `LiEMaximalSubgroups() -> SeqEnum`

All maximal subgroups as described above, as a sequence of pairs. Each pair consists of a string denoting the simple group at hand, and a sequence of strings denoting its maximal subgroups.

<a id="function-maximalsubgroups-monstgelt"></a>
#### `MaximalSubgroups(G): MonStgElt -> SeqEnum[MonStgElt]`

The maximal subgroups of the complex reductive simply connected simple Lie group whose Cartan type is the string $G$, represented as a sequence of strings.

<a id="function-restrictionmatrix-monstgelt-monstgelt"></a>
#### `RestrictionMatrix(G, H): MonStgElt, MonStgElt -> AlgMatElt`

```magma
Index: RngIntElt                    Default: 
```

The restriction matrix for the maximal proper subgroup of type $H$ of $G$. If more than one maximal subgroup of $G$ is of type $H$, the parameter `Index` must be set to indicate which one is required.

<a id="example-ex-23802f"></a>
#### `Example: Maximal Subgroups from the Database (ex-23802f)`

Using the subgroup database:

```magma
> MaximalSubgroups("E7");
[ A2, A1, A1, A1F4, G2C3, A1G2, A1A1, D6A1, A7, A5A2 ]
> M := RestrictionMatrix("E7", "A1" : Index := 2); M;
[26]
[37]
[50]
[72]
[57]
[40]
[21]
> R := RootDatum("E7" : Isogeny := "SC");
> S := RootDatum("A1" : Isogeny := "SC");
> D := AdjointRepresentationDecomposition(R);
> RepresentationDimension(D);
133
> E := Branch(S, D, M); #E;
8
> RepresentationDimension(E);
133
```

<a id="subalgebras-of-su-d"></a>
<a id="sub-subsu"></a>
<a id="subsectlierepssubsu"></a>
### Subalgebras of su(d)

This section describes functions for studying irreducible simple subalgebras of the Lie algebra $\mathfrak{su}(d)$ (cf. [[Dyn57](https://docs.magma-maths.org/references.md#cite-dynkin57)]). The verbose flag `"SubSU"` may be set to show details and progress of the various computations.

The algorithms and the implementation in this package are due to Robert Zeier. For more information about some of the algorithms used and the results obtained using this package we refer to [[ZSH11](https://docs.magma-maths.org/references.md#cite-zs11)].

<a id="function-irreduciblesimplesubalgebrasofsu"></a>
#### `IrreducibleSimpleSubalgebrasOfSU(N): RngIntElt -> SeqEnum`

A list of all irreducible simple subalgebras occurring in the Lie algebra $\mathfrak{su}(d)$, for $2 \leq d \leq N$.

<a id="function-irreduciblesimplesubalgebratreesu-seqenum-seqenum-tup-rngintelt"></a>
#### `IrreducibleSimpleSubalgebraTreeSU(Q, d): SeqEnum[SeqEnum[Tup]], RngIntElt -> GrphDir`

The subalgebra tree for degree $d$ as a directed graph whose vertex labels describe subalgebras, derived from the list Q of irreducible subalgebras. The vertex labels are records with three fields: `algebra`, a string containing the Cartan type of this subalgebra; `weights`, a sequence of highest weights (as sparse vectors) corresponding to irreducible representations (they are related by an outer automorphism if there is more than one highest weight); and `type`, an integer with values -1, 1, or 0 corresponding to irreducible representations of quaternionic, real, or complex type, respectively (the Frobenius-Schur indicator).

<a id="procedure-printtreessu-seqenum-seqenum-tup-monstgelt"></a>
#### `PrintTreesSU(Q, F): SeqEnum[SeqEnum[Tup]], MonStgElt`

```magma
FromDegree    : RngIntElt                    Default: 2
ToDegree      : RngIntElt                    Default: |Q|
IncludeTrivial: BoolElt                      Default: true
```

Print the tree of subalgebras in the sequence Q (as obtained by a call to [`IrreducibleSimpleSubalgebrasOfSU`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebrasofsu)) to the file with filename F. The file F will be overwritten.

The resulting file will be a LaTeX document that may be typeset using `latex` followed by `dvipdf`, for instance. If the resulting file is large, the main memory allocated to TeX may have to be increased (the `main_memory` directive in `texmf.cnf`). Contact your system administrator in case of difficulty.

The optional arguments `FromDegree` and `ToDegree` limit which degrees are output; `IncludeTrivial` may be set to `false` to remove “trivial” cases (i.e. trivial trees) from the output. For $d \geq 5$ and $d$ even, $\mathfrak{su}(d)$ is considered trivial if it contains only the (proper) irreducible simple subalgebras C$_{d/2}$ (i.e. $\mathfrak{sp}(d/2)$), D$_{d/2}$ (i.e. $\mathfrak{so}(d)$), and A$_1$ (i.e. $\mathfrak{su}(2)$); for $d \geq 5$ and $d$ is odd, $\mathfrak{su}(d)$ is considered trivial if it contains only B$_{(d-1)/2}$ (i.e. $\mathfrak{so}(d)$) and A$_1$.

The Lie algebras in the output are coloured according to type: red for -1, blue for 1, and black for 0 (see [`IrreducibleSimpleSubalgebraTreeSU`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebratreesu-seqenum-seqenum-tup-rngintelt)).

<a id="example-ex-f4d461"></a>
#### `Example: Simple Subalgebras of su(d) (ex-f4d461)`

We investigate subalgebras of $\mathfrak{su}(d)$ for $d$ up to $2^{10}$.

```magma
> Q := IrreducibleSimpleSubalgebrasOfSU(2^10);
> t := IrreducibleSimpleSubalgebraTreeSU(Q, 12);
> t;
Digraph
Vertex  Neighbours
1       2 4 ;
2       3 ;
3       ;
4       ;
> r := VertexLabel(t, 1); r`algebra;
rec<recformat<algebra: MonStgElt, weights, type: IntegerRing()> |
    algebra := A11,
    weights := [
        Sparse matrix with 1 row and 11 columns over Integer Ring,
        Sparse matrix with 1 row and 11 columns over Integer Ring
    ],
    type := 0>
> r := VertexLabel(t, 2); r;
rec<recformat<algebra: MonStgElt, weights, type: IntegerRing()> |
    algebra := C6,
    weights := [
        Sparse matrix with 1 row and 6 columns over Integer Ring
    ],
    type := -1>
> [ Matrix(w) : w in r`weights ];
[
    [1 0 0 0 0 0]
]
> RepresentationDimension(RootDatum("C6"),[1,0,0,0,0,0]);
12
> r := VertexLabel(t, 3); r`algebra;
A1
> [ Matrix(w) : w in r`weights ];
[
    [11]
]
> RepresentationDimension(RootDatum("A1"),[11]);
12
> r := VertexLabel(t, 4); r`algebra;
D6
```

In this manner we have used [`IrreducibleSimpleSubalgebraTreeSU`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebratreesu-seqenum-seqenum-tup-rngintelt) to obtain information about irreducible simple subalgebras of $\mathfrak{su}(12)$: A$_{11}$ ($\mathfrak{su}(12)$) is the root of the tree, C$_6$ corresponds to a proper subalgebra of A$_{11}$, and A$_1$ is a proper subalgebra of C$_6$. In addition, we have used [`RepresentationDimension`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-representationdimensionrv) to verify the dimensions of the representations. Let us use [`RepresentationDimension`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/representation-properties.md#function-representationdimensionrv) to see what other $\mathfrak{su}(d)$ the Lie algebra of type C$_6$ should at the very least occur in:

```magma
> V := RSpace(Integers(), 6);
> [ RepresentationDimension(RootDatum("C6"), v) : v in Basis(V) ];
[ 12, 65, 208, 429, 572, 429 ]
```

We compare that to the list of $\mathfrak{su}(d)$ it does occur in using [`IrreducibleSimpleSubalgebraTreeSU`](https://docs.magma-maths.org/LieTheory/RepresentationsOfLieGroupsAndAlgebras/sub-subsu.md#function-irreduciblesimplesubalgebratreesu-seqenum-seqenum-tup-rngintelt) and obtain the weights for the case $\mathfrak{su}(78)$.

```magma
> [ i : i in [2..2^10] | exists{r : r in VertexLabels(
>    IrreducibleSimpleSubalgebraTreeSU(Q, i)) | r`algebra eq "C6"} ];
[ 12, 65, 78, 208, 364, 429, 560, 572 ]
> t := IrreducibleSimpleSubalgebraTreeSU(Q, 78);
> l := VertexLabels(t);
> [ r`algebra : r in l ];
[ A77, C39, A1, D39, B6, C6, E6, A2, A11, A12 ]
> r := l[6];
> [ Matrix(x) : x in r`weights ];
[
    [2 0 0 0 0 0]
]
```
