# Construction of a General Group

## The General Group Constructors

The chapters on the individual group categories describe several methods for constructing groups; this section indicates one approach only.

### `PermutationGroup< X | L >: Set, List -> GrpPerm, Hom`

### `PermutationGroup< n | L >: RngIntElt, List -> GrpPerm, Hom`

### `MatrixGroup< n, R | L >: RngIntElt, Rng, List -> GrpMat, Hom`

These expressions construct, respectively: a permutation group $G$ acting on the set $X$; a permutation group $G$ acting on the set $X=\{ 1, \dots, n\rbrace$; or a matrix group $G$ of degree $n$ over the ring $R$. The generic group $U$ of which $G$ is a subgroup will be ${\operatorname{Sym}}(X)$ in the permutation case or ${\operatorname{GL}}(n, R)$ in the matrix case. There are two return values: $G$, and the inclusion homomorphism from $G$ to $U$. The generators of $G$ are defined by the list $L$. Each term of $L$ must be an object of one of the following types:

**(a)**
Either (permutation case) a sequence of $n$ elements of $X$, or (matrix case) a sequence of $n^2$ elements of $R$, defining an element of $U$;

**(b)**
A set or sequence of sequences of type (a);

**(c)**
An element of $U$;

**(d)**
A set or sequence of elements of $U$;

**(e)**
A subgroup of $U$;

**(f)**
A set or sequence of subgroups of $U$.

Each element or group specified by the list must belong to the *same* generic group. The group $G$ will be constructed as a subgroup of some group which contains each of the elements and groups specified in the list. The generators of $G$ consist of the elements specified by the terms of the list $L$ together with the stored generators for groups specified by terms of the list. Repetitions of an element and occurrences of the identity element are removed (unless $G$ is trivial). The `PermutationGroup` constructor is shorthand for the two statements:

```
   U := SymmetricGroup(X);

   G := sub< U | L >;

```

and the `MatrixGroup` constructor is shorthand for the two statements:

```
   U := GeneralLinearGroup(n, R);

   G := sub< U | L >;

```

where `sub< ... >` is the subgroup constructor described in the next subsection.

### `Group< X | R >: List(Identifiers), List(GrpFPRel) -> GrpFP, Hom(Grp)`

### `PolycyclicGroup< X | R >: List(Identifiers), List(GrpFPRel) -> GrpPC, Hom`

### `AbelianGroup< X | R >: List(Identifiers), List(GrpAbRel) -> GrpAb, Hom(GrpAb)`

These expressions construct, respectively, a finitely presented group, a finite soluble group given by a power-conjugate presentation or a polycyclic group, and an abelian group, in the categories `GrpFP`, `GrpPC` or `GrpGPC`, and `GrpAb`. Given a list $X$ of identifier names $x_1, \ldots, x_r$, and a list of relations $R$ over them, first construct the free group $F$ (in `GrpFP` or `GrpAb`) on the generators $x_1, \cdots, x_r$, and then construct the quotient $G$ of $F$ corresponding to the normal subgroup of $F$ defined by the relations $R$. There are two return values: $G$, and the natural homomorphism from $F$ to $G$. The relations of $G$ are defined by the list $R$. Each term of $R$ must be an object of one of the following types:

**(a)**
A word $w$ of $F$, interpreted as the relator $w={\rm identity}$ of $F$;

**(b)**
A relation $w_1=w_2$, where $w_1$ and $w_2$ are words of $F$;

**(c)**
A relation list $w_1 = w_2 = \cdots = w_r$, where the $w_i$ are words of $F$, interpreted as the set of relations $w_1 = w_r, \ldots, w_{r-1} = w_r$.

Within $R$, the identity element of $F$ may be represented by the digit `1` for `Group` or `PolycyclicGroup`, and `0` for `AbelianGroup`. The construct $x_1, \ldots, x_n$ defines names for the generators of $G$ that are local to the constructor, i.e., they are used when writing down the relations to the right of the bar. However, no assignment of *values* to these identifiers is made. If the user wants to refer to the generators by these (or other) names, then the *generators assignment* construct must be used on the left hand side of an assignment statement. The constructor `PolycyclicGroup` returns either a finite soluble group given by a power-conjugate presentation (category `GrpPC`) or a general polycyclic group (category `GrpGPC`), depending on the arguments. $R$ must be either a valid power-conjugate presentation for a finite soluble group or a consistent polycyclic presentation. If $R$ is a valid power-conjugate presentation for a finite soluble group, a group in the category `GrpPC` is returned, unless the parameter `Class` is set to `"GrpGPC"`. If the parameter `Class` is set to `"GrpGPC"` or if $R$ is not a valid power-conjugate presentation for a finite soluble group and the parameter `Class` is not set to `"GrpPC"`, a general polycyclic group in the category `GrpGPC` is returned. In any case, the free group $F$ is in the category `GrpFP`. If $R$ is neither a valid power-conjugate presentation for a finite soluble group nor a consistent polycyclic presentation, or if $R$ does not match the value of the parameter `Class`, a runtime error is caused.

For a detailed description of this constructor and in particular for a description of power-conjugate presentations and consistent polycyclic presentations, we refer to Chapter [Finite Soluble Groups](../FiniteSolubleGroups/index-finite-soluble-groups.md#chapgrppc) and Chapter [Polycyclic Groups](../../FinitelyPresentedGroups/PolycyclicGroups/index-polycyclic-groups.md#chapgrpgpc), respectively.

### `Example: Group Constructors (ex-b4177f)`

The permutation group of degree 8 generated by the permutations $(1,7,2,8)(3,6,4,5)$ and $(1,4,2,3)(5,7,6,8)$:

```magma
> G := PermutationGroup< 8 |
>     (1, 7, 2, 8)(3, 6, 4, 5), (1, 4, 2, 3)(5, 7, 6, 8) >;
> G;
Permutation group G acting on a set of cardinality 8
    (1, 7, 2, 8)(3, 6, 4, 5)
    (1, 4, 2, 3)(5, 7, 6, 8)

```

A matrix group of degree 2 over ${\bf F}_{9}$:

```magma
> K<w> := GF(9);
> M := MatrixGroup< 2, K | [w,w,1,2*w], [0,2*w,1,1], [1,0,1,2] >;
> M;
MatrixGroup(2, GF(3^2))
Generators:
    [  w   w]
    [  1 w^5]

    [  0 w^5]
    [  1   1]

    [  1   0]
    [  1   2]
> Order(M);
5760

```

The finitely presented group $Q$ defined by the presentation

$$
< s, t, u  \  |  \  t^2, u^{17}, s^2 = t^s = t, u^s = u^{16}, u^t = u >,
$$

together with the natural homomorphism from the free group to $Q$:

```magma
> Q<s,t,u>, h := Group< s, t, u |
>     t^2, u^17, s^2 = t^s = t, u^s = u^16, u^t = u >;
> Q;
Finitely presented group Q on 3 generators
Relations
    t^2 = Id(Q)
    u^17 = Id(Q)
    s^2 = t
    t^s = t
    u^s = u^16
    u^t = u
> Domain(h);
Finitely presented group on 3 generators (free)

```

The soluble group of order 70 defined by the presentation $< a, b, c  \  |  \  a^2 = b, b^5 = c, c^7 >$:

```magma
> G<a,b,c> := PolycyclicGroup< a, b, c | a^2 = b, b^5 = c, c^7 >;
> G;
GrpPC : G of order 70 = 2 * 5 * 7
PC-Relations:
a^2 = b,
b^5 = c,
c^7 = Id(G)

```

A finite abelian group on 4 generators:

```magma
> G := AbelianGroup< h, i, j, k | 5*h, 4*i, 7*j, 2*k - h >;
> G;
Abelian Group isomorphic to Z/2 + Z/140
Defined on 4 generators
Relations:
    G.1 + 8*G.4 = 0
    4*G.2 = 0
    7*G.3 = 0
    10*G.4 = 0
> Order(G);
280

```

### `Example: Polycyclic Group (ex-327598)`

Using the constructor `PolycyclicGroup` with different values of the parameter `Class`, we construct the dihedral group of order 10 first as a finite soluble group given by a power-conjugate presentation (`GrpPC`) and next as a general polycyclic group (`GrpGPC`). Note that the presentation $\langle a,b \,|\, a^2, b^5, b^a=b^4 \rangle$ is both a valid power-conjugate presentation and a consistent polycyclic presentation, so we have to set the parameter `Class` to `"GrpGPC"` if we want to construct a group in the category `GrpGPC`.

```magma
> G1<a,b> := PolycyclicGroup< a,b | a^2, b^5, b^a=b^4 >;
> G1;
GrpPC : G1 of order 10 = 2 * 5
PC-Relations:
    a^2 = Id(G1),
    b^5 = Id(G1),
    b^a = b^4
> G2<a,b> := PolycyclicGroup< a,b | a^2, b^5, b^a=b^4 : Class := "GrpGPC">;
> G2;
GrpGPC : G2 of order 10 = 2 * 5 on 2 PC-generators
PC-Relations:
    a^2 = Id(G2),
    b^5 = Id(G2),
    b^a = b^4

```

We construct the infinite dihedral group as a group in the category `GrpGPC` from a consistent polycyclic presentation. We do not have to use the parameter `Class` in this case.

```magma
> G3<a,b> := PolycyclicGroup< a,b | a^2, b^a=b^-1>;
> G3;
GrpGPC : G3 of infinite order on 2 PC-generators
PC-Relations:
    a^2 = Id(G3),
    b^a = b^-1

```

The presentation $\langle a,b \,|\, a^2, b^4, b^a=b^3 \rangle$ is not a valid power-conjugate presentation for the dihedral group of order 8, since the exponent of $b$ is not prime. However, it is a consistent polycyclic presentation. Consequently, the constructor `PolycyclicGroup` without specifying a value for the parameter `Class` returns a group in the category `GrpGPC`.

```magma
> G4<a,b> := PolycyclicGroup< a,b | a^2, b^4, b^a=b^3 >;
> G4;
GrpGPC : G4 of order 2^3 on 2 PC-generators
PC-Relations:
    a^2 = Id(G3),
    b^4 = Id(G3),
    b^a = b^3

```

## Construction of Subgroups

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

Given the group $G$, construct the subgroup $H$ of $G$, generated by the elements specified by the list $L$, where $L$ is a list of one or more items of the following types:

**(a)**
A Magma object which may be coerced into $G$;

**(b)**
A set or sequence of sequences of type (a);

**(c)**
An element of $G$;

**(d)**
A set or sequence of elements of $G$;

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

**(f)**
A set or sequence of subgroups of $G$.

Each element or group specified by the list must belong to the *same* generic group. The subgroup $H$ will be constructed as a subgroup of some group which contains each of the elements and groups specified in the list. The generators of $H$ consist of the elements specified by the terms of the list $L$ together with the stored generators for groups specified by terms of the list. Repetitions of an element and occurrences of the identity element are removed (unless $H$ is trivial).

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

Given the group $G$, construct the subgroup $H$ of $G$ that is the *normal closure* of the subgroup $H$ generated by the elements specified by the list $L$, where the possibilities for $L$ are the same as for the `sub`-constructor.

### `Example: Subgroup (ex-2c1c5d)`

Let $Q$ be the finitely presented group in generators $s,t,u$ constructed in an earlier example. We construct the subgroup $S$ of $Q$ generated by $ts^2$ and $u^4$:

```magma
> Q<s,t,u>, h := Group< s, t, u |
>     t^2, u^17, s^2 = t^s = t, u^s = u^16, u^t = u >;
> S := sub< Q | t*s^2, u^4 >;
> S;
Finitely presented group S on 2 generators
Generators as words
    S.1 = $.2 * $.1^2
    S.2 = $.3^4

```

## Construction of Quotient Groups

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

Given the group $G$, construct the quotient group $Q = G/N$, where $N$ is the normal closure of the subgroup of $G$ generated by the elements specified by $L$. The clause $L$ is a list of one or more items of the following types:

**(a)**
A Magma object which can be coerced into $G$;

**(b)**
A set or sequence of sequences of type (a);

**(c)**
An element of $G$;

**(d)**
A set or sequence of elements of $G$;

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

**(f)**
A set or sequence of subgroups of $G$.

Each element or group specified by the list must belong to the *same* generic group. The function returns

**(a)**
the quotient group $Q$, and

**(b)**
the natural homomorphism $f: G\rightarrow Q$.

Arbitrary quotients may be readily constructed in the case of the categories `GrpFP`, `GrpGPC`, `GrpPC` and `GrpAb`. However, in the case of permutation and matrix groups, currently the quotient group is constructed via its regular representation, so that the application of this operator is restricted to the case where the index of $N$ in $G$ is less than $2^{30}$.

The second return value is the epimorphism from $G$ to the resulting quotient group.

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

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

If $G$ is in category `GrpFP`, $N$ is not checked to be normal in $G$. In fact, the returned group is the quotient of $G$ by the normal closure of $N$ in $G$. For all other categories of groups, passing a subgroup which fails to be normal causes a runtime error.

If $G$ is a permutation or matrix group, the quotient group is constructed via its regular representation, so that the application of this operator is restricted to the case where the index of $N$ in $G$ is at most a million. The result returned need not be regular, as an attempt is made to reduce the degree of the result.

### `Example: Quotient (ex-8f51d1)`

Construction of the quotient of an abelian group, with a demonstration of the use of the natural homomorphism:

```magma
> G<[x]>, f := AbelianGroup< h, i, j, k | 8*h, 4*i, 6*j, 2*k - h >;
> T, n := quo< G | x[1] + 2*x[2] + 24*x[3], 16*x[3] >;
> T;
Abelian Group isomorphic to Z/2 + Z/16
Defined on 2 generators
Relations:
    4*T.1 = 0
    16*T.2 = 0
> n(x);
[
    2*T.1,
    T.1 + 12*T.2,
    T.2
]
> n(sub< G | x[1] + x[2] + x[3] >);
Abelian Group isomorphic to Z/16
Defined on 1 generator in supergroup T:
    $.1 = 3*T.1 + T.2
Relations:
    16*$.1 = 0

```
