# Finite FP-Groups

Finite fp-groups are often of interest and so a small number of intrinsics are provided for such groups.

**Intrinsics:**

`IsFinite` $(G)$ : Returns true if $G$ is proved to be finite, false if unknown. If $G$ is found to be finite, its order is also returned.

`Order` $(G)$ : Given a finite fp-group $G$ return the order of $G$. If the order cannot be determined or is found to be infinite, then the value zero or `Infinity`, respectively, is returned.

`PermutationGroup` $(G)$ : Given a finite fp-group $G$ return a permutation group $P$ that is isomorphic to $G$ together with the isomorphism $\phi: G \rightarrow P$.

`CayleyGraph` $(G)$ : If $G$ is an fp-group with generating set $X$ return the Cayley graph $CG$ of $G$ with respect to the generating set $X$. The Cayley graph is returned as a Magma directed graph with its vertices and edges labelled. A parameter `Labelled` can be set to *false* to prevent the edges and vertices being labelled.

**Notes:**

Note that the intrinsics `IsFinite`, `Order`, `PermutationGroup`, and `CayleyGraph` may need to construct the coset table of $G$ over the identity and hence are generally restricted to groups of order less than a million. The exact limit is determined by the amount of memory available.

## `Example: Order Group (ex-fb0cc3)`

The intrinsic `Order` is invoked without any parameter settings to compute the order of the group

$$
G =\,\, \langle a, b\ |\ a^8, b^7, (ab)^2, (ab^{-1})^3 \rangle
$$

```magma
> G<a, b> := FPGroup<a,b | a^8, b^7, (a*b)^2, (a*b^-1)^3>;
> G;
Finitely presented group G on 2 generators
Relations
    a^8 = Id(G)
    b^7 = Id(G)
    (a * b)^2 = Id(G)
    (a * b^-1)^3 = Id(G)
> Order(G);
10752

```

## `Example: C Graph (ex-19bd36)`

Now the Cayley graph of the group defined in the previous example is constructed. Next the greatest distance between any pair of vertices (the diameter) is found.

```magma
> G<a, b> := FPGroup<a, b | a^8, b^7, (a*b)^2, (a*b^-1)^3>;
> CG := CayleyGraph(G);
> Diameter(CG);
22

```

Finally, something more sophisticated is demonstrated. First the shortest path $g$ (geodesic) between vertex 1 and vertex $1000$ is found. Then the labels on the edges of this path are multiplied together yielding the element of $G$ corresponding to vertex $1000$.

```magma
> V := Vertices(CG);
> E := Edges(CG);
> g := Geodesic(V!1, V!1000);
> g;
[ 1, 2, 6, 16, 38, 33, 73, 82, 163, 309, 168, 318, 579, 999, 1642, 1000 ]
> w := &*[ Label(E![g[i], g[i+1]]) : i in [1.. #g-1] ];
> w;
a^5 * b * a^3 * b^4 * a * b

```
