### 52 Monoids

This chapter describes functions for monoids. Currently there are only few of them. More general functions for magmas and semigroups can be found in Chapters 35 and 51.

#### 52.1 Functions for Monoids

##### 52.1-1 IsMonoid
 ‣ IsMonoid( D ) ( property )

A monoid is a magma-with-one (see 35) with associative multiplication.

##### 52.1-2 Monoid
 ‣ Monoid( gen1, gen2, ... ) ( function )
 ‣ Monoid( gens[, id] ) ( function )

In the first form, Monoid returns the monoid generated by the arguments gen1, gen2, ..., that is, the closure of these elements under multiplication and taking the 0-th power. In the second form, Monoid returns the monoid generated by the elements in the homogeneous list gens; a square matrix as only argument is treated as one generator, not as a list of generators. In the second form, the identity element id may be given as the second argument.

It is not checked whether the underlying multiplication is associative, use MagmaWithOne (35.2-2) and IsAssociative (35.4-7) if you want to check whether a magma-with-one is in fact a monoid.

##### 52.1-3 Submonoid
 ‣ Submonoid( M, gens ) ( function )
 ‣ SubmonoidNC( M, gens ) ( function )

are just synonyms of SubmagmaWithOne (35.2-8) and SubmagmaWithOneNC (35.2-8), respectively.

##### 52.1-4 MonoidByGenerators
 ‣ MonoidByGenerators( gens[, one] ) ( operation )

is the underlying operation of Monoid (52.1-2).

##### 52.1-5 AsMonoid
 ‣ AsMonoid( C ) ( attribute )

If C is a collection whose elements form a monoid (see IsMonoid (52.1-1)) then AsMonoid returns this monoid. Otherwise fail is returned.

##### 52.1-6 AsSubmonoid
 ‣ AsSubmonoid( D, C ) ( operation )

Let D be a domain and C a collection. If C is a subset of D that forms a monoid then AsSubmonoid returns this monoid, with parent D. Otherwise fail is returned.

##### 52.1-7 GeneratorsOfMonoid
 ‣ GeneratorsOfMonoid( M ) ( attribute )

Monoid generators of a monoid M are the same as magma-with-one generators (see GeneratorsOfMagmaWithOne (35.4-2)).

##### 52.1-8 TrivialSubmonoid
 ‣ TrivialSubmonoid( M ) ( attribute )

is just a synonym for TrivialSubmagmaWithOne (35.4-14).

##### 52.1-9 FreeMonoid
 ‣ FreeMonoid( [wfilt, ]rank[, name] ) ( function )
 ‣ FreeMonoid( [wfilt, ]name1, name2, ... ) ( function )
 ‣ FreeMonoid( [wfilt, ]names ) ( function )
 ‣ FreeMonoid( [wfilt, ]infinity, name, init ) ( function )

Called with a positive integer rank, FreeMonoid returns a free monoid on rank generators. If the optional argument name is given then the generators are printed as name1, name2 etc., that is, each name is the concatenation of the string name and an integer from 1 to range. The default for name is the string "m".

Called in the second form, FreeMonoid returns a free monoid on as many generators as arguments, printed as name1, name2 etc.

Called in the third form, FreeMonoid returns a free monoid on as many generators as the length of the list names, the i-th generator being printed as names[i].

Called in the fourth form, FreeMonoid returns a free monoid on infinitely many generators, where the first generators are printed by the names in the list init, and the other generators by name and an appended number.

If the extra argument wfilt is given, it must be either IsSyllableWordsFamily (37.6-6) or IsLetterWordsFamily (37.6-2) or IsWLetterWordsFamily (37.6-4) or IsBLetterWordsFamily (37.6-4). This filter then specifies the representation used for the elements of the free monoid (see 37.6). If no such filter is given, a letter representation is used.

Also see Chapter 52.

##### 52.1-10 MonoidByMultiplicationTable
 ‣ MonoidByMultiplicationTable( A ) ( function )

returns the monoid whose multiplication is defined by the square matrix A (see MagmaByMultiplicationTable (35.3-1)) if such a monoid exists. Otherwise fail is returned.

generated by GAPDoc2HTML