# Specification of a Presentation

## Relations

### `w₁ = w₂: SgpFPElt, SgpFPElt -> Rel`

Given words $w_1$ and $w_2$ over the generators of an fp-semigroup $S$, create the relation $w_1 = w_2$. Note that this relation is not automatically added to the existing set of defining relations $R$ for $S$. It may be added to $R$, for example, through use of the `quo`-constructor (see below).

### `LHS(r): Rel -> SgpFPElt`

Given a relation $r$ over the generators of $S$, return the left hand side of the relation $r$. The object returned is a word over the generators of $S$.

### `RHS(r): Rel -> SgpFPElt`

Given a relation $r$ over the generators of $S$, return the right hand side of the relation $r$. The object returned is a word over the generators of $S$.

## Presentations

A semigroup with non-trivial relations is constructed as a quotient of an existing semigroup, possibly a free semigroup.

### `Semigroup< generators | relations >: SgpFPElt, ..., SgpFPElt, Rel, ...Rel -> SgpFP`

Given a clause consisting of a list of variables $x_1, \cdots, x_r$, and a set of relations over these generators, first construct the free semigroup $F$ on the generators $x_1, \cdots, x_r$ and then construct the quotient of $F$ corresponding to the ideal of $F$ defined by . The syntax for the clause is the same as for the `quo`-constructor. The function returns:

**(a)**
The quotient semigroup $S$;

**(b)**
The natural homomorphism $\phi : F \rightarrow S$.

Thus, the statement

```
    S< y₁, ..., yᵣ > := Semigroup< x₁, ..., xᵣ | w₁, ..., wₛ >;

```

is an abbreviation for

```
   F< x₁, ..., xᵣ > := FreeSemigroup(r);

   S< y₁, ..., yᵣ > := quo< F | w₁, ..., wₛ >;

```

### `Monoid< generators | relations >: MonFPElt, ..., MonFPElt, Rel, ..., Rel -> MonFP`

Given a clause consisting of a list of variables $x_1, \cdots, x_r$, and a set of relations over these generators, first construct the free monoid $F$ on the generators $x_1, \cdots, x_r$ and then construct the quotient of $F$ corresponding to the ideal of $F$ defined by . The syntax for the clause is the same as for the `quo`-constructor. The function returns:

**(a)**
The quotient monoid $M$;

**(b)**
The natural homomorphism $\phi : F \rightarrow M$.

Thus, the statement

```
    M< y1, ..., yr > := Monoid< x1, ..., xr | w1, ..., ws >;

```

is an abbreviation for

```
   F< x₁, ..., xᵣ > := FreeMonoid(r);

   M< y₁, ..., yᵣ > := quo< F | w₁, ..., wₛ >;

```

### `Example: Monoid (ex-a36e1d)`

We create the monoid defined by the presentation $< x, y\ |\ x^2, y^2, (xy)^2 >$.

```magma
> M<x,y> := Monoid< x, y | x^2, y^2, (x*y)^2 >;
> M;
Finitely presented monoid
Relations:
    x^2 = Id(M)
    y^2 = Id(M)
    (x * y)^2 = Id(M)

```

## Accessing the Defining Generators and Relations

The functions in this group provide access to basic information stored for a finitely-presented semigroup $G$.

### `S . i: SgpFP, RngIntElt -> SgpFPElt`

The $i$-th defining generator for $S$.

### `Generators(S): SgpFP -> { SgpFPElt}`

A set containing the generators for $S$.

### `NumberOfGenerators(S): SgpFP -> RngIntElt`

### `Ngens(S): SgpFP -> RngIntElt`

The number of generators for $S$.

### `Parent(u): SgpFPElt -> SgpFP`

The parent semigroup $S$ of the word $u$.

### `Relations(S): SgpFP -> [ Rel ]`

A sequence containing the defining relations for $S$.
