In a precedent chapter, we constructed the following permutation group:

```
h1 = [2 1 3 4];
h2 = [3 4 1 2];
H = replab.PermutationGroup.of(h1, h2)
```

```
H =
Permutation group acting on 4 elements of order 8
identity: [1, 2, 3, 4]
generator(1 or 'x1'): [2, 1, 3, 4]
generator(2 or 'x2'): [3, 4, 1, 2]
recognize.source: Dihedral group of order 8
```

…which is recognized by RepLAB as the dihedral group of order 8. And indeed, both groups are isomorphic:

```
D = replab.D(4);
H.isIsomorphicTo(D)
```

```
warning: -largeArrayDims and -compatibleArrayDims are accepted for compatibility, but ignored
ans = 1
```

RepLAB provides abstract groups to define groups in a way that is independent from a particular realization (permutation group, matrix group, etc). If we look at the page describing our dihedral group, the following presentation is given:

\[
\left \langle x,a \middle | a^4 = x^2 = 1, x a x^{-1} = a^{-1} \right \rangle
\]

Informally, a *presentation* provides a list of generators, here \(x\) and \(a\), then a list of relations that those
generators satisfy. In RepLAB, the identity is written \(1\), but other sources will use either \(e\) or id.
The dihedral group of degree 4 and order 8 is the symmetry group of the square. The element \(a\) is the rotation
by \(90^\circ\), and of course applying it four times puts the square back in its original position (\(a^4 = 1\)).
The second generator \(x\) is the mirror symmetry, and applying it twice produces the identity (\(x^2 = 1\)).
The last relation explains that doing a \(90^\circ\) rotation sandwiched between two mirror operations is the same
as rotating in the other direction.

How do we construct such a group in RepLAB? The easiest way is by providing the presentation itself.

```
A = replab.AbstractGroup.fromPresentation('< x, a | a^4 = x^2 = 1, x a x^-1 = a^-1 >')
```

```
A =
Abstract group
identity: '1'
name: 'Abstract group'
generator(1 or 'x'): 'x'
generator(2 or 'a'): 'a'
recognize.source: Dihedral group of order 8
relatorsWord: {'a^4', 'x^2', 'x a x^-1 a'}
```