# Constructing Distinct Extensions

The functions below compute the distinct extensions of one group by another.

## `DistinctExtensions(CM): ModCoho -> SeqEnum`

Given the cohomology module ${\rm CM}$ for the group $G$ acting on the module $M$, this function returns a sequence containing all of the distinct extensions of the module $M$ by $G$, each in the form returned by `Extension(CM, s)`. Two such extensions $E_1$, $E_2$ are regarded as being distinct if there is no group isomorphism from one to the other that maps the subgroup of $E_1$ corresponding to $M$ to the subgroup of $E_2$ corresponding to $M$.

This function may only be applied when the module $M$ used to define ${\rm CM}$ is defined over a finite field of prime order, the integers, or as an abelian group in a call of `CohomologyModule(G, Q, T)`.

## `Example: Distinct Extensions (ex-a94c9d)`

We consider the extensions of the trivial module over $GF(2)$ by the group $Z_2 \times Z_2$.

```magma
> G := DirectProduct(CyclicGroup(2),CyclicGroup(2));
> M := TrivialModule(G,GF(2));
> C := CohomologyModule(G,M);
> CohomologicalDimension(C,2);
3
> D := DistinctExtensions(C);
> #D;
4

```

So there are $2^3 = 8$ equivalence classes of extensions. But only four are distinct up to an isomorphism fixing the module. To examine them, we form permutation representations:

```magma
> DP := [ CosetImage(g,sub<g|>) : g in D ];
> [IsAbelian(d): d in DP];
[ true, true, false, false ]
// the first two are abelian
> [IsIsomorphic(d,DihedralGroup(4)) : d in DP];
[ false, false, true, false ]
// The third one is dihedral
> #[g : g in DP[4] | Order(g) eq 4];
6

```

So the fourth group must be the quaternion group.

## `ExtensionsOfElementaryAbelianGroup(p, d, G): RngIntElt, RngIntElt, GrpPerm -> SeqEnum`

Given a prime $p$, a positive integer $d$, and a permutation group $G$, this function returns a list of finitely presented groups which are isomorphic to the distinct extensions of an elementary abelian group $N$ of order $p^d$ by $G$. Two such extensions $E_1$ and $E_2$ with normal subgroups $N_1$ and $N_2$ isomorphic to $N$ are considered to be distinct if there is no group isomorphism $G_1 \rightarrow G_2$ that maps $N_1$ to $N_2$. Each extension $E$ is defined on $d + r$ generators, where $r$ is the number of generators of $G$. The last $d$ of these generators generate the normal subgroup $N$, and the quotient of $E$ by $N$ is a presentation of $G$ on its own generators.

## `Example: Extensions Abelian (ex-e97a7d)`

We form the distinct extensions of the elementary abelian group $Z_2 \times Z_2$ by the alternating group $A_4$.

```magma
> E := ExtensionsOfElementaryAbelianGroup(2,2,Alt(4));
> #E;
4

```

So there are four distinct extensions of an elementary group of order $4$ by $A_4$

```magma
> EP := [ CosetImage(g,sub<g|>) : g in E ];
> [#Centre(e): e in EP];
[ 1, 1, 4, 4 ]

```

The first two have nontrivial action on the module. The module generators in the extensions come last, so these will be $e.3$ and $e.4$. We can use this to test which of the extensions are non-split.

```magma
> [ Complements(e,sub<e|e.3,e.4>) eq [] : e in EP];
[ false, true, false, true ]
> AbelianInvariants(Sylow(EP[2],2));
[ 4, 4 ]

```

So the first and fourth extensions split and the second and third do not. $EP[2]$ has a normal abelian subgroup of type $[4,4]$.

## `ExtensionsOfSolubleGroup(H, G): GrpPerm, GrpPerm -> SeqEnum`

Given permutation groups $G$ and $H$, where $H$ is soluble, this function returns a sequence of finitely presented groups, the terms of which are isomorphic to the distinct extensions of $H$ by $G$. Two such extensions $E_1$ and $E_2$ with normal subgroups $H_1$ and $H_2$ isomorphic to $H$ are considered to be distinct if there is no group isomorphism $G_1 \rightarrow G_2$ that maps $H_1$ to $H_2$. Each extension $E$ is defined on $d + r$ generators, where the last $d$ generators generate the normal subgroup $H$, and the quotient of $E$ by $H$ is a presentation for $G$ on its own generators. (The last $d$ generators of $E$ do not correspond to the original generators of $H$, but to a PC-generating sequence for $H$.)

## `Example: Extensions Soluble (ex-334528)`

How many extensions are there of a dihedral group of order $8$ by itself? This calculation is currently rather slow.

```magma
> D4 := DihedralGroup(4);
> time S := ExtensionsOfSolubleGroup(D4, D4);
Time: 120.210
> #S;
20
> ES := [CosetImage(g,sub<g|>) : g in S ];
> [#Centre(g): g in ES];
[ 4, 2, 4, 2, 4, 2, 2, 4, 2, 4, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2 ]
> [NilpotencyClass(g) : g in ES ];
[ 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 ]
> [Exponent(g): g in ES];
[ 4, 8, 4, 8, 4, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ]

```

## `Example: Distinct Extensions (ex-ff8afd)`

We determine the distinct extensions of the abelian group with invariants $[2,4,4]$ by the cyclic group of order $4$.

```magma
> Z := Integers();
> G := PermutationGroup<4 | (1,2,4,3)>;
> Q := [2, 4, 4];
> T := [ Matrix(Z,3,3,[1,2,0,0,0,1,0,1,2]) ];
> CM := CohomologyModule(G, Q, T);
> extns := DistinctExtensions(CM);
> extns;
[
    Finitely presented group on 4 generators
    Relations
        $.2^2 = Id($)
        $.3^4 = Id($)
        $.4^4 = Id($)
        ($.2, $.3) = Id($)
        ($.2, $.4) = Id($)
        ($.3, $.4) = Id($)
        $.1^-1 * $.2 * $.1 * $.3^-2 * $.2^-1 = Id($)
        $.1^-1 * $.3 * $.1 * $.4^-1 = Id($)
        $.1^-1 * $.4 * $.1 * $.4^-2 * $.3^-1 = Id($)
        $.1^4 = Id($),

    Finitely presented group on 4 generators
    Relations
        $.2^2 = Id($)
        $.3^4 = Id($)
        $.4^4 = Id($)
        ($.2, $.3) = Id($)
        ($.2, $.4) = Id($)
        ($.3, $.4) = Id($)
        $.1^-1 * $.2 * $.1 * $.3^-2 * $.2^-1 = Id($)
        $.1^-1 * $.3 * $.1 * $.4^-1 = Id($)
        $.1^-1 * $.4 * $.1 * $.4^-2 * $.3^-1 = Id($)
        $.1^4 * $.2^-1 * $.3^-1 * $.4^-3 = Id($),

    Finitely presented group on 4 generators
    Relations
        $.2^2 = Id($)
        $.3^4 = Id($)
        $.4^4 = Id($)
        ($.2, $.3) = Id($)
        ($.2, $.4) = Id($)
        ($.3, $.4) = Id($)
        $.1^-1 * $.2 * $.1 * $.3^-2 * $.2^-1 = Id($)
        $.1^-1 * $.3 * $.1 * $.4^-1 = Id($)
        $.1^-1 * $.4 * $.1 * $.4^-2 * $.3^-1 = Id($)
        $.1^4 * $.3^-2 * $.4^-2 = Id($)
]

```

Since the extensions are soluble groups, we construct pc-presentations of each and verify that no two of the groups are isomorphic.

```magma
> E1 := SolubleQuotient(extns[1]);
> E2 := SolubleQuotient(extns[2]);
> E3 := SolubleQuotient(extns[3]);
> IsIsomorphic(E1, E2);
false
> IsIsomorphic(E1, E3);
false
> IsIsomorphic(E2, E3);
false

```

## `IsExtensionOf(G): GrpPerm -> [], {}`

```magma
Degree     : RngInt                    Default: 0
MaxId      : RngInt                    Default: 15
DegreeBound: RngInt                    Default: Infinity()
```

For a given permutation group $G$, find normal abelian subgroup $A<G$ such that $G$ can be obtained by extending $G/A$ by $A$. The function returns a sequence of tuples $T$ containing

- the cohomology module of $G/A$ acting on $A$

- the $2$-cocycle as an element in $H^2(G/A, A)$ corresponding to $G$

- the actual $2$-cocycle as a user defined function

- a pair $\langle a, b\rangle$ giving the degree $a$ of the transitive group $G/A$ and the number $b$ identifying the group in the data base. If $b$ is larger than 20 (or `MaxId`) the hash value of the group is returned instead.

- the abelian invariants of $A$

- a set containing all pairs $\langle a, b\rangle$ such that $_aT_b$ can be obtained through this extension process.

If `DegreeBound` is given, only subgroups $A$ are considered such that $G/A$ has less than `DegreeBound` many elements. The list considered contains only subgroups that are maximal under the restrictions. If `Degree` is given, $G/A$ must have exactly `Degree` many elements.

## `IsExtensionOf(L): [GrpPerm] -> [], []`

```magma
Degree     : RngInt                    Default: 0
MaxId      : RngInt                    Default: 15
DegreeBound: RngInt                    Default: Infinity()
```

For all groups $G$ in $L$, [`IsExtensionOf`](#function-grpcoh-isextensionof) is called. The first sequence returned contains tuples as in [`IsExtensionOf`](#function-grpcoh-isextensionof) above. The sequence is minimal such that all groups in $L$ can be generated using the cohomology modules in the sequence. The second return value contains a set of pairs $\langle a, b\rangle$ describing all transitive groups that can be obtained through the processes.
