# Polycyclic groups

`PcGroup`

— Type`PcGroup`

Polycyclic group, a group that is defined by a finite presentation of a special kind, a so-called polycyclic presentation. Contrary to arbitrary finitely presented groups (see Finitely presented groups), this presentation allows for efficient computations with the group elements.

For a group `G`

of type `PcGroup`

, the elements in `gens(G)`

satisfy the relators of the underlying presentation.

Functions that compute subgroups of `G`

return groups of type `SubPcGroup`

.

**Examples**

`cyclic_group(n::Int)`

: cyclic group of order`n`

`abelian_group(PcGroup, v::Vector{Int})`

: direct product of cyclic groups of the orders`v[1]`

,`v[2]`

, ...,`v[length(v)]`

`PcGroupElem`

— Type`PcGroupElem`

Element of a polycyclic group.

The generators of a polycyclic group are displayed as `f1`

, `f2`

, `f3`

, etc., and every element of a polycyclic group is displayed as product of the generators.

**Examples**

```
julia> G = abelian_group(PcGroup, [2, 3]);
julia> G[1], G[2]
(f1, f2)
julia> G[2]*G[1]
f1*f2
```

Note that this does not define Julia variables named `f1`

, `f2`

, etc.! To get the generators of the group `G`

, use `gens(G)`

; for convenience they can also be accessed as `G[1]`

, `G[2]`

, as shown in Section Elements of groups.

`map_word`

— Method`map_word(g::PcGroupElem, genimgs::Vector; genimgs_inv::Vector = Vector(undef, length(genimgs)), init = nothing)`

Return the product $R_1 R_2 \cdots R_n$ that is described by `g`

, which is a product of the form $g_{i_1}^{e_1} g_{i_2}^{e_2} \cdots g_{i_n}^{e_n}$ where $g_i$ is the $i$-th entry in the defining polycyclic generating sequence of $G$ and the $e_i$ are nonzero integers, and $R_j =$ `imgs[`

$i_j$`]`

$^{e_j}$.

**Examples**

```
julia> G = dihedral_group(10)
Pc group of order 10
julia> x, y = gens(G); g = x * y^4
f1*f2^4
julia> map_word(g, gens(free_group(:x, :y)))
x*y^4
```

Julia has the following functions that allow to generate polycyclic groups:

`abelian_group`

— Method`abelian_group(::Type{T} = PcGroup, v::Vector{S}) where T <: Group where S <: IntegerUnion`

Return the direct product of cyclic groups of the orders `v[1]`

, `v[2]`

, $\ldots$, `v[n]`

, as an instance of `T`

. Here, `T`

must be one of `PermGroup`

, `FPGroup`

, `SubFPGroup`

, `PcGroup`

, or `SubPcGroup`

.

The `gens`

value of the returned group corresponds to `v`

, that is, the number of generators is equal to `length(v)`

and the order of the `i`

-th generator is `v[i]`

.

The type need to be specified in the input of the function `abelian_group`

, otherwise a group of type `FinGenAbGroup`

is returned, which is not a GAP group type. In future versions of Oscar, this may change.

`cyclic_group`

— Function```
cyclic_group(::Type{T} = PcGroup, n::IntegerUnion)
cyclic_group(::Type{T} = PcGroup, n::PosInf)
```

Return the cyclic group of order `n`

, as an instance of type `T`

.

**Examples**

```
julia> G = cyclic_group(5)
Pc group of order 5
julia> G = cyclic_group(PermGroup, 5)
Permutation group of degree 5 and order 5
julia> G = cyclic_group(PosInf())
Pc group of infinite order
```

`dihedral_group`

— Function`dihedral_group(::Type{T} = PcGroup, n::Union{IntegerUnion,PosInf})`

Return the dihedral group of order `n`

, as an instance of `T`

, where `T`

is in {`PcGroup`

, `SubPcGroup`

, `PermGroup`

, `FPGroup`

, `SubFPGroup`

}.

There are two competing conventions for interpreting the argument `n`

: In the one we use, the returned group has order `n`

, and thus `n`

must always be even. In the other, `n`

indicates that the group describes the symmetry of an `n`

-gon, and thus the group has order `2n`

.

**Examples**

```
julia> dihedral_group(6)
Pc group of order 6
julia> dihedral_group(PermGroup, 6)
Permutation group of degree 3
julia> dihedral_group(PosInf())
Pc group of infinite order
julia> dihedral_group(7)
ERROR: ArgumentError: n must be a positive even integer or infinity
```

`quaternion_group`

— Function`quaternion_group(::Type{T} = PcGroup, n::IntegerUnion)`

Return the (generalized) quaternion group of order `n`

, as an instance of `T`

, where `n`

is a power of 2 and `T`

is in {`PcGroup`

, `SubPcGroup`

, `PermGroup`

,`FPGroup`

, `SubFPGroup`

}.

**Examples**

```
julia> g = quaternion_group(8)
Pc group of order 8
julia> quaternion_group(PermGroup, 8)
Permutation group of degree 8
julia> g = quaternion_group(FPGroup, 8)
Finitely presented group of order 8
julia> relators(g)
3-element Vector{FPGroupElem}:
r^2*s^-2
s^4
r^-1*s*r*s
```