# Lattices from Matrix Groups

In Magma a $G$-lattice $L$ is a lattice upon which a finite integral matrix group $G$ acts by right multiplication. Each $G$-lattice $L$ has references to both the original (“natural”) group $G$ which acts on the standard lattice in which $L$ is embedded and also the reduced group of $L$ which is the reduced representation of $G$ on the basis of $L$.

## Creation of $G$-Lattices

The following functions create $G$-lattices. Note that the group $G$ must be a finite integral matrix group.

### `Lattice(G): GrpMat -> Lat`

Given a finite integral matrix group $G$, return the standard $G$-lattice (with standard basis and rank equal to the degree of $G$).

### `LatticeWithBasis(G, B): GrpMat, ModMatRngElt -> Lat`

Given a finite integral matrix group $G$ and a non-singular matrix $B$ whose row space is invariant under $G$ (i.e., $Bg = T_gB$ for each $g\in G$ where $T_g$ is a unimodular integral matrix depending on $g$), return the $G$-lattice with basis matrix $B$. (The number of columns of $B$ must equal the degree of $G$; $G$ acts naturally on the lattice spanned by $B$.)

### `LatticeWithBasis(G, B, M): GrpMat, ModMatRngElt, AlgMatElt -> Lat`

Given a finite integral matrix group $G$, a non-singular matrix $B$ whose row space is invariant under $G$ (i.e., $Bg = T_gB$ for all $g\in G$ where $T_g$ is a unimodular integral matrix depending on $g$) and a positive definite matrix $M$ invariant under $G$ (i.e., $gMg^{tr}=M$ for all $g\in G$) return the $G$-lattice with basis matrix $B$ and inner product matrix $M$. (The number of columns of $B$ must equal the degree of $G$ and both the number of rows and the number of columns of $M$ must equal the degree of $G$; $G$ acts naturally on the lattice spanned by $B$ and fixes the Gram matrix of the lattice).

### `LatticeWithGram(G, F): GrpMat, AlgMatElt -> Lat`

Given a finite integral matrix group $G$ and a positive definite matrix $F$ invariant under $G$ (i.e., $gFg^{tr}=F$ for all $g\in G$) return the $G$-lattice with standard basis and inner product matrix $F$ (and thus Gram matrix $F$). (Both the number of rows and the number of columns of $M$ must equal the degree of $G$; $G$ fixes the Gram matrix of the returned lattice).

## Operations on $G$-Lattices

The following functions provide basic operations on $G$-lattices.

### `IsGLattice(L): Lat -> GrpMat`

Given a lattice $L$, return whether $L$ is a $G$-lattice (i.e., there is a group associated with $L$).

### `Group(L): Lat -> GrpMat`

Given a $G$-lattice $L$, return the matrix group of the (reduced) action of $G$ on $L$. The resulting group thus acts on the coordinate lattice of $L$ (like the automorphism group).

### `NumberOfActionGenerators(L): Lat -> RngIntElt`

### `Nagens(L): Lat -> RngIntElt`

Given a $G$-lattice $L$, return the number of generators of $G$.

### `ActionGenerator(L, i): Lat, RngIntElt -> GrpMat`

Given a $G$-lattice $L$, return the $i$-th generator of the (reduced) action of $G$ on $L$. This is the reduced action of the $i$-th generator of the original group $G$ (which may be the identity matrix).

### `NaturalGroup(L): Lat -> GrpMat`

Given a $G$-lattice $L$, return the matrix group of the (natural) action of $G$ on $L$. The resulting group thus acts on $L$ naturally.

### `NaturalActionGenerator(L, i): Lat, RngIntElt -> GrpMat`

Given a $G$-lattice $L$, return the $i$-th generator of the natural action of $G$ on $L$. This is simply the $i$-th generator of the original group $G$.

## Invariant Forms

The functions in this section compute invariant forms for $G$-lattices.

### `InvariantForms(L): Lat -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a basis for the space of invariant bilinear forms for $G$ (represented by their Gram matrices) as a sequence of matrices. The first entry of the sequence is a positive definite symmetric form for $G$.

### `InvariantForms(L, n): Lat, RngIntElt -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a sequence consisting of $n\geq 0$ invariant bilinear forms for $G$.

### `SymmetricForms(L): Lat -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a basis for the space of symmetric invariant bilinear forms for $G$. The first entry of the sequence is a positive definite symmetric form of $G$.

### `SymmetricForms(L, n): Lat, RngIntElt -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a sequence of $n\geq 0$ independent symmetric invariant bilinear forms for $G$. The first entry of the first sequence (if $n>0$) is a positive definite symmetric form for $G$.

### `AntisymmetricForms(L): Lat -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a basis for the space of antisymmetric invariant bilinear forms for $G$.

### `AntisymmetricForms(L, n): Lat, RngIntElt -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a sequence of $n\geq 0$ independent antisymmetric invariant bilinear forms for $G$.

### `NumberOfInvariantForms(L): Lat -> RngIntElt, RngIntElt`

For a $G$-lattice $L$, return the dimension of the space of (symmetric and anti-symmetric) invariant bilinear forms for $G$. The algorithm uses a modular method which is always correct and is faster than the actual computation of the forms.

### `NumberOfSymmetricForms(L): Lat -> RngIntElt`

For a $G$-lattice $L$, return the dimension of the space of symmetric invariant bilinear forms for $G$.

### `NumberOfAntisymmetricForms(L): Lat -> RngIntElt`

For a $G$-lattice $L$, return the dimension of the space of antisymmetric invariant bilinear forms for $G$.

### `PositiveDefiniteForm(L): Lat -> AlgMatElt`

For a $G$-lattice $L$, return a positive definite symmetric form for $G$. This is a positive definite matrix $F$ such that $gFg^{tr}=F$ for all $g\in G$.

## Endomorphisms

The functions in this subsection compute endomorphisms of $G$-lattices. This is done by approximating the averaging operator over the group and applying it to random elements.

### `EndomorphismRing(L): Lat -> AlgMat`

For a $G$-lattice $L$, return the endomorphism ring of $L$ as a matrix algebra over ${\mathbb{Q}}$.

### `Endomorphisms(L, n): Lat, RngIntElt -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a sequence containing $n$ independent endomorphisms of $L$ as elements of the corresponding matrix algebra over ${\mathbb{Q}}$. $n$ must be in the range $[0 .. d]$, where $d$ is the dimension of the endomorphism ring of $L$. This function may be useful in situations where the full endomorphism algebra is not required, e.g., to split a reducible lattice.

### `DimensionOfEndomorphismRing(L): Lat -> RngIntElt`

Return the dimension of the endomorphism algebra of the $G$-lattice $L$ by a modular method (which always yields a correct answer).

### `CentreOfEndomorphismRing(L): Lat -> AlgMat`

For a $G$-lattice $L$, return the centre of the endomorphism ring of $L$ as a matrix algebra over ${\mathbb{Q}}$.

This function can be used to split a reducible lattice into its homogeneous components.

### `CentralEndomorphisms(L, n): Lat, RngIntElt -> [ AlgMatElt ]`

For a $G$-lattice $L$, return a sequence containing $n$ independent central endomorphisms of $L$ as elements of the corresponding matrix algebra over ${\mathbb{Q}}$. $n$ must be in the range $[0 .. d]$, where $d$ is the dimension of the centre of the endomorphism ring of $L$.

### `DimensionOfCentreOfEndomorphismRing(L): Lat -> RngIntElt`

Return the dimension of the centre of the endomorphism algebra of the $G$-lattice $L$ by a modular method (which always yields a correct answer).

## $G$-invariant Sublattices

The functions in this section compute $G$-invariant sublattices of a given $G$-lattice $L$.

For a fixed prime $p$, the algorithm constructs the maximal $G$-invariant sublattices of $L$ as kernels of ${\mathbb{F}}_p G$-epimorphisms $L/pL \to S$ for some simple ${\mathbb{F}}_pG$-module $S$ as described in [[Plesken, 1974](../../references.md#cite-plesken-thesis)].

Iterating this process yields all $G$-invariant sublattices of $L$ whose index in $L$ is a $p$-power. Finally, intersecting lattices of coprime index yields all sublattices of $L$.

### `Sublattices(G, Q): GrpMat, [ RngIntElt ] -> [ Lat ], BoolElt`

### `Sublattices(G, Q): [ Mtrx ], [ RngIntElt ] -> [ Lat ], BoolElt`

### `Sublattices(L, Q): Lat, [ RngIntElt ] -> [ Lat ], BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [Mtrx]                       Default: []
```

Given either

**(a)**
an integral matrix group $G$ with natural lattice $L={\mathbb{Z}}^n$

**(b)**
a sequence $G$ of integral matrices generating a ${\mathbb{Z}}$-order in ${\mathbb{Q}}^{n\times n}$ with natural lattice $L= {\mathbb{Z}}^n$

**(c)**
a $G$-lattice $L$ in ${\mathbb{Q}}^n$.

together with a set or sequence $Q$ of primes, compute the $G$-invariant sublattices of L (as a sequence) which are not contained in $p L$ for any $p \in Q$ and whose index in $L$ is a product of elements of $Q$.

This set of $G$-invariant sublattices of $L$ is finite if and only if ${\mathbb{Q}}_p \otimes L$ is irreducible as a ${\mathbb{Q}}_p G$-module for all $p\in Q$.

Setting the parameter `Limit := n` will terminate the computation after $n$ sublattices have been found.

Setting the parameter `Levels := n` will only compute sublattices $M$ such that $L/M$ has at most $n$ composition factors.

The optional parameter `Projections` can be a sequence of $n$ by $n$ matrices that describe projections on ${\mathbb{Q}}^{n}$ that map $L$ to itself. In this case, Magma will only compute those sublattices of $L$ which have the same images under the projections as $L$ does.

The second return value indicates whether the returned sequence contains all such sublattices or not.

### `Sublattices(G, p): GrpMat, RngIntElt -> [ Lat ], BoolElt`

### `Sublattices(L, p): Lat, RngIntElt -> [ Lat ], BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [Mtrx]                       Default: []
```

The same as the above where the set $Q$ consists only of the given ptime $p$.

### `Sublattices(G): GrpMat -> [ Lat ], BoolElt`

### `Sublattices(L): Lat -> [ Lat ], BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [Mtrx]                       Default: []
```

For an integral matrix group $G$ or a $G$-lattice $L$ this intrinsic equals the one above with $Q$ taken to be the prime divisors of the order of $G$.

### `SublatticeClasses(G): GrpMat -> [ Lat ]`

```magma
MaximalOrders: BoolElt                    Default: false
```

For an integral matrix group $G$ returns representatives for the isomorphism classes of $G$-invariant lattices (i.e. the orbits under the unit group of the endomorphism ring $E$ of $G$).

If `MaximalOrders` is set to `true`, only sublattice classes which are invariant under some maximal order of $E$ are considered.

Currently the function requires $E$ to be a field.

### `Example: Sublattices (ex-ecd505)`

We construct sublattices of the standard $G$-lattice where $G$ is an absolutely irreducible degree-8 integral matrix representation of the group ${\operatorname{GL}}(2,3)\times\rm{S}_3$.

We first define the group $G$.

```magma
> G := MatrixGroup<8, IntegerRing() |
>    [-1,  0,  0,  0,  0,  0,  0,  0,
>      0,  0, -1,  0,  0,  0,  0,  0,
>      0,  0,  0,  1,  0,  0,  0,  0,
>      0,  1,  0,  0,  0,  0,  0,  0,
>     -1,  0,  0,  0,  1,  0,  0,  0,
>      0,  0, -1,  0,  0,  0,  1,  0,
>      0,  0,  0,  1,  0,  0,  0, -1,
>      0,  1,  0,  0,  0, -1,  0,  0],
>
>    [ 0,  0,  0,  0,  0,  0,  0,  1,
>      0,  0,  0,  0,  0,  0,  1,  0,
>      0,  0,  0,  0, -1,  0,  0,  0,
>      0,  0,  0,  0,  0,  1,  0,  0,
>      0,  0,  0, -1,  0,  0,  0,  1,
>      0,  0, -1,  0,  0,  0,  1,  0,
>      1,  0,  0,  0, -1,  0,  0,  0,
>      0, -1,  0,  0,  0,  1,  0,  0]>;

```

We next compute the unique positive definite form $F$ fixed by $G$.

```magma
> time F := PositiveDefiniteForm(G);
Time: 0.050
> F;
[2 0 0 0 1 0 0 0]
[0 2 0 0 0 1 0 0]
[0 0 2 0 0 0 1 0]
[0 0 0 2 0 0 0 1]
[1 0 0 0 2 0 0 0]
[0 1 0 0 0 2 0 0]
[0 0 1 0 0 0 2 0]
[0 0 0 1 0 0 0 2]

```

We now compute all sublattices of the standard $G$-lattice.

```magma
> time Sub := Sublattices(G);
Time: 0.370
> #Sub;
18

```

For each sublattice we compute the invariant positive definite form for the group given by the action of $G$ on the sublattice.

```magma
> PrimitiveMatrix := func<X |
>     P ! ((ChangeRing(P, RationalField()) ! X) / GCD(Eltseq(X)))
>         where P is Parent(X)>;
> FF := [PrimitiveMatrix(B * F * Transpose(B))
>             where B is BasisMatrix(L): L in Sub];

```

We next create the sequence of all the lattices whose Gram matrices are given by the (LLL-reduced) forms.

```magma
> Sub := [LatticeWithGram(LLLGram(F)) : F in FF];
> #Sub;
18

```

We now compute representatives for the ${\mathbb{Z}}$-isomorphism classes of the sequence of lattices.

```magma
> Rep := [];
> for L in Sub do
>     if forall{LL: LL in Rep | not IsIsometric(L, LL)} then
>         Append(~Rep, L);
>     end if;
> end for;
> #Rep;
4

```

Thus there are 4 non-isomorphic sublattices. We note the size of the automorphism group, the determinant, the minimum and the kissing number of each lattice. (In fact, the automorphism groups of these 4 lattices happen to be maximal finite subgroups of ${\operatorname{GL}}(8, {\mathbb{Q}})$ and all have ${\operatorname{GL}}(2,3)\times\rm{S}_3$ as a common irreducible subgroup.)

```magma
> time A := [AutomorphismGroup(L) : L in Rep];
Time: 0.240
> [#G: G in A];
[ 497664, 6912, 696729600, 2654208 ]
> [Determinant(L): L in Rep];
[ 81, 1296, 1, 16 ]
> [Minimum(L): L in Rep];
[ 2, 4, 2, 2 ]
> [KissingNumber(L): L in Rep];
[ 24, 72, 240, 48 ]

```

Finally, we note that each lattice is isomorphic to a standard construction based on root lattices.

```magma
> l := IsIsometric(Rep[1],
>        TensorProduct(Lattice("A", 2), StandardLattice(4))); l;
true
> l := IsIsometric(Rep[2],
>        TensorProduct(Lattice("A", 2), Lattice("F", 4))); l;
true
> l := IsIsometric(Rep[3], Lattice("E", 8)); l;
true
> l := IsIsometric(Rep[4],
>        TensorProduct(Lattice("F", 4), StandardLattice(2))); l;

```

### `Example: Sublattices2 (ex-e8ccf0)`

This example illustrates the optional argument `Projections`.

```magma
> G := MatrixGroup<4, IntegerRing() |
> [ -1, 0, 1, 0, 0, -1, 1, -3, -1, 0, 0, 0, 0, 0, 0, 1 ],
> [ -1, 0, 0, 0, -3, 2, 0, 3, 0, 0, -1, 0, 1, -1, 0, -1 ] >;
> E := EndomorphismRing(G);
> I := CentralIdempotents(ChangeRing(E, RationalField())); I;
[
    [ 0  0  0  0]
    [-1  1  0  0]
    [ 0  0  0  0]
    [ 0  0  0  1],

    [1 0 0 0]
    [1 0 0 0]
    [0 0 1 0]
    [0 0 0 0]
]

```

Since the central idempotents are all integral, they map the standard lattice ${\mathbb{Z}}^n$ to itself. Even though this group $G$ fixes infinitely many sublattices of $Z^n$ (even up to scalar multiples), there can only be finitely many which have the same images under the central idempotents as ${\mathbb{Z}}^n$.

```magma
> S := Sublattices(G : Projections:= I); #S;
3

```

So in this case there are only three such lattices. To check that the lattices do project correctly, we can use

```magma
> I := [ Matrix(Integers(), i) : i in I ];
> Images := [ [Image(BasisMatrix(s) * i) : i in I] : s in S ];
> #Set(Images) eq 1;
true

```

## Lattice of Sublattices

Magma can construct the lattice $V$ of all $G$-invariant sublattices of the standard lattice $L = {\mathbb{Z}}^n$. Various properties of the lattice $V$ may then be examined. Magma only stores the primitive sublattices of $L$, i.e. those sublattices that are not contained in $kL$ for some $k > 1$.

In general, $G$ fixes infinitely many primitive lattices. Thus one has to limit the number of sublattices to be constructed just as in the `Sublattice` intrinsic. In this case, all operations on $V$ like coercions, intersections, sums etc. assume that the result of the operation is again is a scalar multiple of some element stored in $V$.

The lattice $V$ has type `LatLat` and elements of $V$ have type `LatLatElt` and are numbered from 1 to $n$ where $n$ is the number of primitive sublattices of $L$ that have been constructed in the beginning.

### Creating the Lattice of Sublattices

#### `SublatticeLattice(G, Q): GrpMat, [ RngIntElt ] -> LatLat, BoolElt`

#### `SublatticeLattice(G, Q): [ Mtrx ], [ RngIntElt ] -> LatLat, BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [ Mtrx ]                     Default: []
```

Given either an integral matrix group $G$ of degree $n$ or a sequence $G$ of integral matrices generating a ${\mathbb{Z}}$-order in ${\mathbb{Q}}^{n\times n}$ together with a set or sequence $Q$ of primes, compute the $G$-invariant sublattices of ${\mathbb{Z}}^n$ (as a sequence) which are not contained in $p {\mathbb{Z}}^n$ for any $p \in Q$ and whose index in ${\mathbb{Z}}^n$ is a product of elements of $Q$.

The second return value indicates whether all $G$-invariant lattices have been constructed.

The optional parameters are the same as for the `Sublattices` intrinsic.

#### `SublatticeLattice(G, p): GrpMat, RngIntElt -> LatLat, BoolElt`

#### `SublatticeLattice(G, p): [ Mtrx ], RngIntElt -> LatLat, BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [ Mtrx ]                     Default: []
```

Same as above where the set $Q$ consists only of the given prime $p$.

#### `SublatticeLattice(G): GrpMat -> LatLat, BoolElt`

```magma
Limit      : RngIntElt                    Default: Infinity()
Levels     : RngIntElt                    Default: Infinity()
Projections: [ Mtrx ]                     Default: []
```

Same as above where the set $Q$ is taken to be set of prime divisors of the order of the group $G$.

#### `Example: Sublattice Lattice Create (ex-bee7b0)`

This example shows how to create a lattice of sublattices.

```magma
> G:= sub< GL(2, Integers()) | [0,1,-1,0] >;
> V:= SublatticeLattice(G); V;
Lattice of 2 sublattices

```

### Operations on the Lattice of Sublattices

In the following, $V$ is a lattice of $G$-invariant lattices for some group or ${\mathbb{Z}}$-order $G$ and $Q$ denotes the set of primes that where used to create $V$.

#### `# V: LatLat -> RngIntElt`

The number of (primitive) lattices stored in $V$.

#### `V ! i: LatLat, RngIntElt -> LatLatElt`

The $i$-th element of the lattice $V$ with respect to the internal labeling.

#### `V ! M: LatLat, Lat -> LatLatElt`

#### `V ! M: LatLat, Mtrx -> LatLatElt`

Given a (basis matrix of some) $G$-invariant lattice $M$, create the element of the lattice $V$ corresponding to $M$.

#### `NumberOfLevels(V): LatLat -> RngIntElt`

The number of different levels (layers) stored in $V$. Note that levels are counted starting from $0$.

#### `Level(V, i): LatLat, RngIntElt -> [ LatLatElt ]`

The primitive lattices stored at the $i$-th level (layer). Note that levels are counted starting from $0$.

#### `Levels(v): LatLat -> [ [LatLatElt] ]`

The $i$-th entry of the result is a sequence of the primitive lattice elements lying on the $i-1$-th level.

#### `Primes(V): LatLat -> [ RngIntElt ]`

The primes that where used to create $V$.

#### `Constituents(V): LatLat -> SeqEnum`

A sequence containing the constituents (simple ${\mathbb{F}}_p G$ - modules) that where used during the construction of the $G$-lattices in $V$.

#### `IntegerRing() ! e: RngInt, LatLatElt -> RngIntElt`

The integer corresponding to lattice element $e$.

#### `e + f: LatLatElt, LatLatElt -> LatLatElt`

The sum of the lattice elements $e$ and $f$.

#### `e meet f: LatLatElt, LatLatElt -> LatLatElt`

The intersection of the lattice elements $e$ and $f$.

#### `e eq f: LatLatElt, LatLatElt -> BoolElt`

Tests whether $e$ and $f$ are equal.

#### `MaximalSublattices(e): LatLatElt -> [ LatLatElt ], [ RngIntElt ]`

The sequence $S$ of maximal sublattices of $e$ having index $p$ for some $p \in Q$. The second return value is a list $C$ of integers such that $S[i]/e$ is isomorphic to the $C[i]$-th constituent of $V$. The ordering of the constituents is the same as in the `Constituents` intrinsic.

#### `MinimalSuperlattices(e): LatLatElt -> [ LatLatElt ], [ RngIntElt ]`

The sequence $S$ of minimal superlattices of $e$ in which $e$ has index $p$ for some $p \in Q$. The second return value is a list $C$ of integers such that $e/S[i]$ is isomorphic to the $C[i]$-th constituent of $V$. The ordering of the constituents is the same as in the `Constituents` intrinsic.

#### `Lattice(e): SubModLatElt -> Lat`

The $G$-lattice corresponding to $e$.

#### `BasisMatrix(e): SubModLatElt -> Mtrx`

#### `Morphism(e): SubModLatElt -> Mtrx`

The basis matrix of the $G$-lattice corresponding to $e$.

#### `Example: Sublattice Lattice (ex-f3a5a3)`

Let $G$ be the automorphism group of the root lattice $A_5$. Since $G$ is absolutely irreducible, it fixes only finitely many lattices up to scalars. We explore them.

```magma
> G:= AutomorphismGroup(Lattice("A", 5));
> FactoredOrder(G);
[ <2, 5>, <3, 2>, <5, 1> ]
> #SublatticeLattice(G, 5);
1

```

Hence there are no primitive sublattices between $L$ and $5L$. Hence it suffices to check only the lattices at $2$ and $3$ the two remaining prime divisors of the order of $G$.

```magma
> V:= SublatticeLattice(G, {2,3}); #V;
4
> M:= MaximalSublattices(V ! 1); M;
[
    sublattice number 2,
    sublattice number 3
]
> V ! 2 meet V ! 3;
sublattice number 4

```

Moreover, the second and third lattice are (up to rescaling) dual to each other with respect to some $G$-invariant form.

```magma
> F:= PositiveDefiniteForm(G);
> L:= Dual(Lattice(BasisMatrix(V ! 2), F) : Rescale:= false);
> V ! L;
sublattice number 3 times 1/6

```

In particular, every $G$-invariant lattice can be constructed from lattice number $2$ by taking scalar multiples, duals, sums and intersections. For example the standard lattice can be written as:

```magma
> (V ! 2) + (V ! (6*L));
sublattice number 1

```

#### `Example: Sublattice Lattice2 (ex-573832)`

Let $G$ be the $8$-dimensional (faithful) rational representation of ${\operatorname{SL}}(2,7)$. Its endomorphism ring $E$ is isomorphic to ${\mathbb{Q}}(\sqrt{-7})$. We find all $G$-invariant lattices of $G$ that are invariant under the maximal order $M$ of $E$ up to multiplication with elements in $E$. After this is done, we quickly obtain all finite subgroups of ${\operatorname{GL}}(8, {\mathbb{Q}})$ (up to conjugacy) that include a normal subgroup conjugate to $G$.

To shorten the example, we choose $G$ such that the standard lattice $L$ is already invariant under $M$.

```magma
> SetSeed(1);
> G:= MatrixGroup<8, IntegerRing() |
>    [ 0, 1, 0, 0, 0, 0, -1, 0, -1, 0, 0, 0, 0, 0, -1, 1,
>      0, 0, 0, 1, 0, 0, -1, 0, 0, 0, -1, 0, 0, 0, -1, 1,
>      0, 0, 0, 0, 0, 1, -1, 0, 0, 0, 0, 0, -1, 0, -1, 1,
>      0, 0, 0, 0, 0, 0, -1, 1, 0, 0, 0, 0, 0, 0, -2, 1 ],
>    [ 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0,
>     -1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, -1, 1,
>      0, 0, 0, -1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
>      0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 ] >; #G;
336
> E:= EndomorphismRing(G);
> M:= MaximalOrder(ChangeRing(E, RationalField()));
> ok, M:= CanChangeUniverse(Basis(M), MatrixRing(Integers(), 8)); ok;
true

```

So $L$ is $M$-invariant. The lattices at the primes $3$ and $7$ are multiples of $L$ as we can see as follows:

```magma
> w7:= IntegralMatrix(E.2 - Trace(E.2)/8);
> w7 div:= GCD( Eltseq(w7) );                   // a square root of 7
> V:= SublatticeLattice([ Matrix(G.i) : i in [1..Ngens(G)] ] cat M, [3,7]); #V;
2
> V ! w7;
sublattice number 2

```

So it remains to check the lattices at $2$. The two prime ideals in $M$ over $2$ are generated by `p` and `q` where

```magma
> p:= 1 - (w7+1) div 2;
> q:= (w7+1) div 2;
> Gens:= [ Matrix(G.i) : i in [1..Ngens(G)] ];
> V:= SublatticeLattice(Gens cat M, 2: Levels:= 3);
> Levels(V);
[
    [
        sublattice number 1
    ],
    [
        sublattice number 2,
        sublattice number 3
    ],
    [
        sublattice number 4,
        sublattice number 5,
        sublattice number 6
    ],
    [
        sublattice number 7,
        sublattice number 8,
        sublattice number 9,
        sublattice number 10
    ]
]
> [ V | BasisMatrix(V ! i)*x : i in [1..3], x in [p,q] ];
[
    sublattice number 4,
    sublattice number 7,
    sublattice number 8,
    sublattice number 6,
    sublattice number 9,
    sublattice number 10
]

```

So the lattice numbers $1,2,3$ and $5$ represent the orbits of the action of $E$ on the set of all $MG$-invariant lattices. Moreover, every matrix group $N$ normalizing $G$ acts on the $MG$-invariant lattices and (up to conjugacy) thus fixes one of these four lattices. If it fixes $L$, it also fixes $V!2$ + $V!3$ = $V!5$ and vice versa. Similarly, it fixes $V!2$ if and only if it fixes $V!3$.

```magma
> F:= PositiveDefiniteForm(G);
> N1:= Normalizer(AutomorphismGroup(LatticeWithGram(F)), G); #N1;
672
> A:= AutomorphismGroup(Lattice(BasisMatrix(V ! 2), F) : NaturalAction);
> N2:= Normalizer(A, ChangeRing(G, Rationals())); #N2;
336

```

So `N1` (which is isomorphic to $2.L(2,7):2$) is up to conjugacy the only proper finite extension of $G$ in ${\operatorname{GL}}(8, {\mathbb{Q}})$.
