# Subgroups, Quotient Groups, Homomorphisms and Extensions

## Construction of Subgroups

### `sub<G | L>: GrpGPC, List -> GrpGPC, Map`

Construct the subgroup $H$ of the polycyclic group $G$ generated by the elements specified by the terms of the *generator list* $L$.

A term $L[i]$ of the generator list may consist of any of the following objects:

**(a)**
An element liftable to $G$;

**(b)**
A sequence of integers representing an element of $G$;

**(c)**
A subgroup of $G$;

**(d)**
A set or sequence of (a), (b), or (c).

The collection of words and groups specified by the list must all belong to the group $G$ and $H$ will be constructed as a subgroup of $G$.

The generators of $H$ consist of the words specified directly by terms of $L[i]$ together with the stored generating words for any groups specified by terms of $L[i]$. Repetitions of an element and occurrences of the identity element are removed.

The inclusion map from $H$ to $G$ is returned as a second value.

### `ncl<G | L>: GrpGPC, List -> GrpGPC, Map`

Construct the subgroup $N$ of the polycyclic group $G$ as the normal closure of the subgroup generated by the elements specified by the terms of the *generator list* $L$.

The possible forms of a term $L[i]$ of the generator list are the same as for the [`sub<G | L>`](#constructor-grpgpc-sub)-constructor.

The inclusion map from $N$ to $G$ is returned as a second value.

## Coercions Between Groups and Subgroups

### `G ! g: GrpGPC, GrpGPCElt -> GrpGPCElt`

Given an element $g$ belonging to the subgroup $H$ of the group $G$, rewrite $g$ as an element of $G$.

### `H ! g: GrpGPC, GrpGPCElt -> GrpGPCElt`

Given an element $g$ belonging to the group $G$, and given a subgroup $H$ of $G$ containing $g$, rewrite $g$ as an element of $H$.

### `K ! g: GrpGPC, GrpGPCElt -> GrpGPCElt`

Given an element $g$ belonging to the group $H$, and a group $K$, such that $H$ and $K$ are subgroups of $G$, and both $H$ and $K$ contain $g$, rewrite $g$ as an element of $K$.

### `InclusionMap(G, H): GrpGPC, GrpGPC -> Map`

The map from the subgroup $H$ of $G$ to $G$.

### `Example: Subgroup (ex-49b53c)`

Consider again the infinite polycyclic group $G$ defined by the polycyclic presentation

$$
< a, b, c\  |\ b^a = b*c, (a,c), (b,c) >.
$$

```magma
> F<a,b,c> := FreeGroup(3);
> rels := [ b^a = b*c, b^(a^-1) = b*c^-1 ];
> G<a,b,c> := quo< GrpGPC : F | rels >;
> G;
GrpGPC : G of infinite order on 3 PC-generators
PC-Relations:
    b^a = b * c,
    b^(a^-1) = b * c^-1

```

Using the function [`PCGenerators`](access.md#function-grpgpc-pcgenerators) which is described later, the groups $G_1,\ldots,G_4$ and the corresponding inclusion maps can be defined as follows:

```magma
> G_ := []; incl_ := [ PowerStructure(Map) | ];
> for i := 1 to #PCGenerators(G)+1 do
>   G_[i], incl_[i] := sub< G | [ g : g in PCGenerators(G) |
>                                        Depth(g) ge i ] >;
> end for;
> for i := 1 to #G_ do
>   printf "G_%o = <%o>", i, {@ G!x : x in
>                   PCGenerators(G_[i]) @}; print "";
> end for;
G_1 = <{@ a, b, c @}>
G_2 = <{@ b, c @}>
G_3 = <{@ c @}>
G_4 = <{@ @}>

```

Note that we must set the universe of the sequence `incl_` to `PowerStructure(Map)` manually, since we want to store maps which do not have a common domain. If we failed to do this, the universe would be chosen automatically to be the set of all maps from $G_1$ to $G$ when the first map is inserted into the sequence. Inserting the second map, which does not have the domain $G_1$, would then cause a runtime error.

## Construction of Quotient Groups

### `quo<G | L>: GrpGPC, List -> GrpGPC, Map`

Construct the quotient $Q$ of the polycyclic group $G$ by the normal subgroup $N$, where $N$ is the smallest normal subgroup of $G$ containing the elements specified by the terms of the *generator list* $L$.

The possible forms of a term $L[i]$ of the generator list are the same as for the [`sub<G | L>`](#constructor-grpgpc-sub)-constructor.

The quotient group $Q$ and the corresponding natural homomorphism $f : G \rightarrow Q$ are returned.

### `G / N: GrpGPC, GrpGPC -> GrpGPC`

Given a normal subgroup $N$ of the polycyclic group $G$, construct the quotient of $G$ by $N$.

## Homomorphisms

For a general description of homomorphisms, we refer to Chapter [Mappings](../../SetsSequencesMappings/Mappings/index-mappings.md#chapmap). This section describes some special aspects of homomorphisms the domain of which is a polycyclic group.

### General remarks

The kernel of a homomorphism with a domain of type `GrpGPC` can be computed using the function [`Kernel`](../../SetsSequencesMappings/Mappings/operation.md#function-map-kernel), if the codomain is of one of the types `GrpGPC`, `GrpPC` (cf. Chapter [Finite Soluble Groups](../../FiniteGroups/FiniteSolubleGroups/index-finite-soluble-groups.md#chapgrppc)), `GrpAb` (cf. Chapter [Abelian Groups](../AbelianGroups/index-abelian-groups.md#chapgrpab)), `GrpPerm` (cf. Chapter [Permutation Groups](../../FiniteGroups/PermutationGroups/index-permutation-groups.md#chapgrpperm)), `ModAlg` or `ModGrp` (cf. Chapter [Modules over an Algebra and Group Representations](../../RepresentationTheory/ModulesOverAnAlgebraAndGroupRepresentations/index-modules-over-an-algebra-and-group-representations.md#chapmodalg)) or if the codomain is of the type `GrpMat` (cf. Chapter [Matrix Groups over General Rings](../../FiniteGroups/MatrixGroupsOverGeneralRings/index-matrix-groups-over-general-rings.md#chapgrpmat)) and the image is finite.

In particular, preimages of substructures can be computed in these situations. The kernel of a map will be computed automatically, if the preimage of a substructure of the codomain is to be computed.

The kernel (and hence preimages of substructures) may also be computable, if the codomain is of the type `GrpFP` (cf. Chapter [Finitely Presented Groups](../FPGroups/index-fpgroups.md#chapgrpfp)) and the domain is nilpotent.

### Construction of Homomorphisms

#### `hom< P -> G | S : parameters>: Struct, Struct -> Map`

```magma
Check: BoolElt                    Default: true
```

Returns the homomorphism from the polycyclic group $P$ to the group $G$ defined by the assignment $S$. $S$ can be the one of the following:

**(i)**
A list, sequence or indexed set containing the images of the $n$ polycyclic generators $P.1,\ldots,P.n$ of $P$. Here, the $i$-th element of $S$ is interpreted as the image of $P.i$, i.e. the order of the elements in $S$ is important.

**(ii)**
A list, sequence, enumerated set or indexed set, containing $r$ tuples $<x_i,y_i>$ or arrow pairs $x_i \;-\!\!> y_i$, where $x_i\in P$, $y_i\in G$ ($i=1,\ldots,r$) and the set $\{x_1,\ldots,x_r\}$ is a generating set for $P$. In this case, $y_i$ is assigned as the image of $x_i$, hence the order of the elements in $S$ is not important. Note that the preimages $x_i$ need not be the polycyclic generators of $P$.

If the data type of the codomain supports element arithmetic and element comparison, by default the constructed homomorphism is checked by verifying that the would-be images of the polycyclic generators satisfy the defining relations of $P$ and that this assignment is consistent with the assignments made by the user. In this case, it is assured that the returned map is a well-defined homomorphism with the desired images. The most important situation in which it is not possible to perform checking is the case in which the domain is a finitely presented group (`FPGroup`; cf. Chapter [Finitely Presented Groups](../FPGroups/index-fpgroups.md#chapgrpfp)) which is not free. Checking may be disabled using the parameter `Check`.

If `Check` is set to `false`, checking of the homomorphism is disabled.

## Construction of Extensions

### `DirectProduct(G, H): GrpGPC, GrpGPC -> GrpGPC, [Map], [Map]`

The direct product $K$ of the polycyclic groups $G$ and $H$. The second value returned is a sequence containing the inclusion maps $I_G\colon G \rightarrow K$ and $I_H\colon H \rightarrow K$. The third value returned is a sequence containing the projection maps $P_G\colon K \rightarrow G$ and $P_H\colon K \rightarrow H$.

## Construction of Standard Groups

A number of functions are provided which construct polycyclic presentations for various standard groups.

### `AbelianGroup(GrpGPC, Q): Cat, [RngIntElt] -> GrpGPC`

Construct the abelian group defined by the sequence $Q = [n_1,\ldots,n_r]$ as a polycyclic group. The entries $n_i$ may be either zero, indicating an infinite cyclic factor, or integers greater than 1. The function returns the polycyclic group which is the direct product of the cyclic groups $Z_1 \times \cdots \times Z_r$, where $Z_i$ is a cyclic group of infinite order if $n_i = 0,$ or a cyclic group of order $n_i$ if $n_i > 1$.

### `CyclicGroup(GrpGPC, n): Cat, RngIntElt -> GrpGPC`

For $n>0$, the cyclic group of order $n$ is returned, while for $n=0$, the infinite cyclic group is returned as a polycyclic group.

### `DihedralGroup(GrpGPC, n): Cat, RngIntElt -> GrpGPC`

For $n\ge 3$, the dihedral group of order $2n$ is returned, while for $n=0$, the infinite dihedral group is returned as a polycyclic group.

### `ElementaryAbelianGroup(GrpGPC, p, n): Cat, RngIntElt, RngIntElt -> GrpGPC`

Given a prime $p$ and a positive integer $n$, construct the elementary abelian group of order $p^n$ as a polycyclic group.

### `ExtraSpecialGroup(GrpGPC, p, n : parameters): Cat, RngIntElt, RngIntElt -> GrpGPC`

```magma
Type: MonStgElt                    Default: "+"
```

Given a prime $p$ and a small positive integer $n$, construct an extra-special group $G$ of order $p^{2n+1}$ as a polycyclic group. The isomorphism type of $G$ can be selected using the parameter `Type`.

Possible values for this parameter are “$+$” (default) and “$-$“.

If `Type` is set to “$+$”, the function returns for $p = 2$ the central product of $n$ copies of the dihedral group of order 8, and for $p > 2$ it returns the unique extra-special group of order $p^{2n+1}$ and exponent $p$.

If `Type` is set to “$-$”, the function returns for $p = 2$ the central product of a quaternion group of order 8 and $n-1$ copies of the dihedral group of order 8, and for $p > 2$ it returns the unique extra-special group of order $p^{2n+1}$ and exponent $p^2$.

### `FreeAbelianGroup(GrpGPC, n): Cat, RngIntElt -> GrpGPC`

Given a positive integer $n$, construct the free abelian group of rank $n$ as a polycyclic group.

### `FreeNilpotentGroup(r, e): RngIntElt, RngIntElt -> GrpGPC`

The free nilpotent group of rank $r$ and class $e$ is returned as a polycyclic group.

### `Example: Homomorphism (ex-5a225f)`

Consider the dihedral group $D_4$.

```magma
> G<a,b> := DihedralGroup(GrpGPC, 4);

```

We obtain a well-defined homomorphism $f$ of $G$ onto a group $A = {\bf Z}_2 \times {\bf Z}_2$, by assigning two generators of $A$ as the images of $a$ and $ab$, respectively. Note that in the definition of $f$ we can use the generating set $\{a, ab\}$ of $G$, instead of the defining polycyclic generating sequence of $G$.

```magma
> A<u,v> := AbelianGroup([2,2]);
> f := hom< G->A | a->u, a*b->v >;

```

We compute the kernel $K$ of $f$ and express the generators of $K$ as elements of $G$, using the function [`PCGenerators`](access.md#function-grpgpc-pcgenerators-2) described later.

```magma
> K := Kernel(f);
> PCGenerators(K, G);
{@ b^2 @}

```

### `Example: Symmetric2 (ex-f4c433)`

A polycyclic representation for the group $D_3 \times D_\infty$ may be obtained as follows:

```magma
> G1<a,b> := DihedralGroup(GrpGPC, 3);
> G2<u,v> := DihedralGroup(GrpGPC, 0);
> D, incl, proj := DirectProduct(G1, G2);
> D;
GrpGPC : D of infinite order on 4 PC-generators
PC-Relations:
    D.1^2 = Id(D),
    D.2^3 = Id(D),
    D.3^2 = Id(D),
    D.2^D.1 = D.2^2,
    D.4^D.3 = D.-4

```

Using the inclusion maps returned by [`DirectProduct`](#function-grpgpc-directproduct), we define a subgroup and compute the quotient by its normal closure:

```magma
> S := sub<D| incl[1](a)*incl[2](u), incl[1](b)*incl[2](v)>;
> S;
GrpGPC : S of infinite order on 3 PC-generators
PC-Relations:
    S.1^2 = Id(S),
    S.2^3 = S.3,
    S.2^S.1 = S.2^2 * S.-3,
    S.3^S.1 = S.-3
> Q, pi := quo<D|S>;
> Q;
GrpGPC : Q of order 2 on 1 PC-generators
PC-Relations:
    Q.1^2 = Id(Q)
> Q.1 @@ pi;
D.3

```
