# Elementary Operators for Words

## Multiplication and Exponentiation

The word operations defined here may be applied either to the words of a free semigroup or the words of a semigroup with non-trivial relations.

### `u * v: SgpFPElt, SgpFPElt -> SgpFPElt`

Given words $u$ and $v$ belonging to the same fp-semigroup $S$, return the product of $u$ and $v$.

### `u ^ n: SgpFPElt, RngIntElt -> SgpFPElt`

The $n$-th power of the word $u$, where $n$ is a positive integer.

### `G ! Q: SgpFP, [  SgpFPElt ] -> SgpFPElt`

Given a sequence $Q$ of words belonging to the fp-semigroup $G$, return the product $Q[1] Q[2] \cdots Q[n]$ of the terms of $Q$ as a word in $G$.

## The Length of a Word

### `# u: SgpFPElt -> RngIntElt`

The length of the word $u$.

## Equality and Comparison

The words of an fp-semigroup $S$ are ordered first by length and then lexicographically. The lexicographic ordering is determined by the following ordering on the generators:

$$
S.1  <  S.2 < S.3 < S.4 < \cdots
$$

Here, $u$ and $v$ are words belonging to some common fp-semigroup.

### `u eq v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the words $u$ and $v$ are identical (as elements of the appropriate free semigroup), `false` otherwise.

### `u ne v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the words $u$ and $v$ are not identical (as elements of the appropriate free semigroup), `false` otherwise.

### `u lt v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the word $u$ precedes the word $v$, with respect to the ordering defined above for elements of an fp-semigroup, `false` otherwise.

### `u le v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the word $u$ either precedes, or is equal to, the word $v$, with respect to the ordering defined above for elements of an fp-semigroup, `false` otherwise.

### `u ge v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the word $u$ either follows, or is equal to, the word $v$, with respect to the ordering defined above for elements of an fp-semigroup, `false` otherwise.

### `u gt v: SgpFPElt, SgpFPElt -> BoolElt`

Returns `true` if the word $u$ follows the word $v$, with respect to the ordering defined above for elements of an fp-semigroup.

### `IsOne(u): MonFPElt -> BoolElt`

Returns `true` if the word $u$, belonging to the monoid $M$, is the identity word, `false` otherwise.
