# Homomorphisms

For a general description of homomorphisms, we refer to Chapter [Mappings](../../SetsSequencesMappings/Mappings/index-mappings.md#chapmap). This section describes some special aspects of homomorphisms whose domain is a rewrite monoid.

## General Remarks

Monoids in the category `MonRWS` currently are accepted as codomains only for monoid homomorphisms, whose codomain is a rewrite monoid as well.

## Construction of Homomorphisms

### `hom< M -> N | S >: Struct, Struct -> Map`

Returns the homomorphism from the rewrite group $M$ to the monoid $N$ defined by the expression $S$ which must be the one of the following:

**(i)**
A list, sequence or indexed set containing the images of the $n$ generators $M.1,\ldots,M.n$ of $M$. Here, the $i$-th element of $S$ is interpreted as the image of $M.i$, i.e. the order of the elements in $S$ is important.

**(ii)**
A list, sequence, enumerated set or indexed set, containing $n$ tuples $<x_i,y_i>$ or arrow pairs $x_i \;-\!\!> y_i$, where $x_i$ is a generator of $M$ and $y_i\in N$ ($i=1,\ldots,n$) and the set $\{x_1,\ldots,x_n\}$ is the full set of generators of $M$. In this case, $y_i$ is assigned as the image of $x_i$, hence the order of the elements in $S$ is not important.

It is the user’s responsibility to ensure that the provided generator images actually give rise to a well-defined homomorphism. No checking is performed by the constructor. Presently, $N$ must be either a rewrite monoid or a group, and it is not possible to define a homomorphism by assigning images to the elements of an arbitrary generating set of $M$.
