Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind
 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 

52 Finitely Presented Semigroups and Monoids
 52.1 IsSubsemigroupFpSemigroup (Filter)
 52.2 Creating Finitely Presented Semigroups and Monoids
 52.3 Comparison of Elements of Finitely Presented Semigroups

  52.3-1 \=
 52.4 Preimages in the Free Semigroup or Monoid
 52.5 Rewriting Systems and the Knuth-Bendix Procedure
 52.6 Todd-Coxeter Procedure

52 Finitely Presented Semigroups and Monoids

A finitely presented semigroup (resp. finitely presented monoid) is a quotient of a free semigroup (resp. free monoid) on a finite number of generators over a finitely generated congruence on the free semigroup (resp. free monoid).

Finitely presented semigroups are obtained by factoring a free semigroup by a set of relations (a generating set for the congruence), i.e., a set of pairs of words in the free semigroup.

gap> f := FreeSemigroup( "a", "b" );;
gap> x := GeneratorsOfSemigroup( f );;
gap> s := f / [ [ x[1] * x[2], x[2] * x[1] ] ];
<fp semigroup on the generators [ a, b ]>
gap> GeneratorsOfSemigroup( s );
[ a, b ]
gap> RelationsOfFpSemigroup( s );
[ [ a*b, b*a ] ]

Finitely presented monoids are obtained by factoring a free monoid by a set of relations, i.e. a set of pairs of words in the free monoid.

gap> f := FreeMonoid( "a", "b" );;
gap> x := GeneratorsOfMonoid( f );
[ a, b ]
gap> e := Identity( f );
<identity ...>
gap> m := f / [ [ x[1] * x[2], e ] ];
<fp monoid on the generators [ a, b ]>
gap> RelationsOfFpMonoid( m );
[ [ a*b, <identity ...> ] ]

Notice that for GAP a finitely presented monoid is not a finitely presented semigroup.

gap> IsFpSemigroup( m );
false

However, one can build a finitely presented semigroup isomorphic to that finitely presented monoid (see IsomorphismFpSemigroup (52.2-3)).

Also note that is not possible to refer to the generators by their names. These names are not variables, but just display figures. So, if one wants to access the generators by their names, one first has to introduce the respective variables and to assign the generators to them.

gap> Unbind( a );
gap> f := FreeSemigroup( "a", "b" );;
gap> s := f / [ [ f.1 * f.2, f.2 * f.1 ] ];;
gap> a;
Error, Variable: 'a' must have a value
gap> a := s.1;
a
gap> a in f;
false
gap> a in s;
true

The generators of the free semigroup (resp. free monoid) are different from the generators of the finitely presented semigroup (resp. finitely presented monoid) (even though they are displayed by the same names). This means that words in the generators of the free semigroup (resp. free monoid) are not elements of the finitely presented semigroup (resp. finitely presented monoid). Conversely elements of the finitely presented semigroup (resp. finitely presented monoid) are not words of the free semigroup (resp. free monoid).

Calculations comparing elements of a finitely presented semigroup may run into problems: there are finitely presented semigroups for which no algorithm exists (it is known that no such algorithm can exist) that will tell for two arbitrary words in the generators whether the corresponding elements in the finitely presented semigroup are equal. Therefore the methods used by GAP to compute in finitely presented semigroups may run into warning errors, run out of memory or run forever. If the finitely presented semigroup is (by theory) known to be finite the algorithms are guaranteed to terminate (if there is sufficient memory available), but the time needed for the calculation cannot be bounded a priori. The same can be said for monoids. (See 52.5.)

gap> b := s.2;;
gap> a*b = a^5;
false
gap> a^5 * b^2 * a = a^6 * b^2;
true

Note that elements of a finitely presented semigroup (or monoid) are not printed in a unique way:

gap> a^5 * b^2 * a;
a^5*b^2*a
gap> a^6 * b^2;
a^6*b^2

52.1 IsSubsemigroupFpSemigroup (Filter)

52.1-1 IsSubsemigroupFpSemigroup
‣ IsSubsemigroupFpSemigroup( t )( filter )
‣ IsSubmonoidFpMonoid( t )( filter )

The first function returns true if t is a finitely presented semigroup or a subsemigroup of a finitely presented semigroup. The second function does the equivalent thing for monoids. (Generally speaking, such a subsemigroup or monoid can be constructed with Semigroup(gens) or Monoid(gens), where gens is a list of elements of a finitely presented semigroup or monoid.)

A submonoid of a monoid has the same identity as the monoid.

52.1-2 IsFpSemigroup
‣ IsFpSemigroup( s )( filter )
‣ IsFpMonoid( m )( filter )

The first function is a synonym for IsSubsemigroupFpSemigroup(s) and IsWholeFamily(s) (this is because a subsemigroup of a finitely presented semigroup is not necessarily finitely presented).

Similarly, the second function is a synonym for IsSubmonoidFpMonoid(m) and IsWholeFamily(m).

52.1-3 IsElementOfFpSemigroup
‣ IsElementOfFpSemigroup( elm )( category )
‣ IsElementOfFpMonoid( elm )( category )

returns true if elm is an element of a finitely presented semigroup or monoid.

gap> f := FreeSemigroup( "a", "b" );;
gap> IsFpSemigroup( f );
false
gap> s := f / [ [ f.1^2, f.2^2 ] ];;
gap> IsFpSemigroup( s );
true
gap> t := Semigroup( [ s.1^2 ] );
<commutative semigroup with 1 generator>
gap> IsSubsemigroupFpSemigroup( t );
true
gap> IsSubsemigroupFpSemigroup( s );
true
gap> IsSubsemigroupFpSemigroup( f );
false
gap> IsElementOfFpSemigroup( t.1^3 );
true

52.1-4 FpGrpMonSmgOfFpGrpMonSmgElement
‣ FpGrpMonSmgOfFpGrpMonSmgElement( elm )( operation )

returns the finitely presented group, monoid or semigroup to which elm belongs.

gap> s = FpGrpMonSmgOfFpGrpMonSmgElement( s.1 );
true
gap> s = FpGrpMonSmgOfFpGrpMonSmgElement( t.1 );
true
gap> f := FreeMonoid( 2 );;
gap> m := f / [ [ f.1^2, f.2^2 ] ];
<fp monoid on the generators [ m1, m2 ]>
gap> m = FpGrpMonSmgOfFpGrpMonSmgElement( m.1 * m.2 );
true

52.2 Creating Finitely Presented Semigroups and Monoids

52.2-1 \/
‣ \/( F, rels )( method )

creates a finitely presented semigroup or monoid given by the presentation \(\langle \textit{gens} \mid \textit{rels} \rangle\) where gens are the generators of the free semigroup or free monoid F, and the relations rels are entered as pairs of words in the generators of the free semigroup or free monoid.

The same result is obtained with the infix operator /, i.e. as F / rels.

gap> fs := FreeSemigroup( 3 );;
gap> x := GeneratorsOfSemigroup( fs );;
gap> s := fs / [ [ x[1] * x[2] * x[1], x[1] ], [ x[2]^4, x[1] ] ];
<fp semigroup on the generators [ s1, s2, s3 ]>

52.2-2 FactorFreeSemigroupByRelations
‣ FactorFreeSemigroupByRelations( f, rels )( function )
‣ FactorFreeMonoidByRelations( f, rels )( function )

for a free semigroup or free monoid f and a list rels of pairs of elements of f. Returns the finitely presented semigroup or monoid which is the quotient of f by the least congruence on f generated by the pairs in rels.

Users should be aware that much of the code described in this chapter is in need of substantial revision. In particular, the two functions described here are not called by the operation \/ of the previous subsection, and so are liable to be removed in due course.

gap> fm := FreeMonoid( 3 );;
gap> y := GeneratorsOfMonoid( fm );;
gap> m := FactorFreeMonoidByRelations( fm,
>           [ [ y[1] * y[2] * y[1], y[1] ],[ y[2]^4, y[1] ] ] );
<fp monoid on the generators [ m1, m2, m3 ]>

52.2-3 IsomorphismFpSemigroup
‣ IsomorphismFpSemigroup( m )( attribute )
‣ IsomorphismFpMonoid( g )( attribute )

for a finitely presented monoid m or a finitely presented group g. Returns an isomorphism from m or g to a finitely presented semigroup or monoid.

gap> phis := IsomorphismFpSemigroup( m );
MappingByFunction( <fp monoid on the generators
[ m1, m2, m3 ]>, <fp semigroup on the generators [ <identity ...>, m1, m2, m3
 ]>, function( x ) ... end, function( x ) ... end )
gap> fg := FreeGroup( 2 );;
gap> g := fg / [ fg.1^4, fg.2^5 ];
<fp group on the generators [ f1, f2 ]>
gap> phim := IsomorphismFpMonoid( g );
MappingByFunction( <fp group on the generators
[ f1, f2 ]>, <fp monoid on the generators [ f1, f1^-1, f2, f2^-1
 ]>, function( x ) ... end, function( x ) ... end )

52.3 Comparison of Elements of Finitely Presented Semigroups

52.3-1 \=
‣ \=( a, b )( method )

Two elements a, b of a finitely presented semigroup are equal if they are equal in the semigroup. Nevertheless they may be represented as different words in the generators. Because of the fundamental problems mentioned in the introduction to this chapter such a test may take a very long time and cannot be guaranteed to finish (see 52.5).

52.4 Preimages in the Free Semigroup or Monoid

Elements of a finitely presented semigroup or monoid are not words, but are represented using a word from the free semigroup or free monoid as representative.

52.4-1 UnderlyingElement
‣ UnderlyingElement( elm )( operation )

for an element elm of a finitely presented semigroup or monoid. Returns the word from the free semigroup or free monoid that is used as a representative for elm.

gap> genm := GeneratorsOfMonoid( m );;
gap> e := genm[2]^4;
m2^4
gap> IsWord( e );
false
gap> ue := UnderlyingElement( e );
m2^4
gap> IsWord( ue );
true

52.4-2 ElementOfFpSemigroup
‣ ElementOfFpSemigroup( fam, word )( operation )
‣ ElementOfFpMonoid( fam, word )( operation )

for a family fam of elements of a finitely presented semigroup or monoid and a word word in the free generators underlying this finitely presented semigroup or monoid. Returns the element of the finitely presented semigroup or monoid with the representative word in the free semigroup or free monoid. These operations are inverse to UnderlyingElement.

gap> fam := FamilyObj( genm[1] );;
gap> w := y[1]^3 * y[2]^4 * y[3]^5;
m1^3*m2^4*m3^5
gap> ew := ElementOfFpMonoid( fam, w );
m1^3*m2^4*m3^5
gap> ew in fm;
false
gap> ew in m;
true
gap> w = UnderlyingElement( ew );
true

52.4-3 FreeSemigroupOfFpSemigroup
‣ FreeSemigroupOfFpSemigroup( s )( attribute )
‣ FreeMonoidOfFpMonoid( m )( attribute )

returns the underlying free semigroup or free monoid for the finitely presented semigroup s or monoid m, i.e. the free semigroup or free monoid over which s or m is defined as a quotient. (This is the free semigroup or free monoid generated by the free generators provided by FreeGeneratorsOfFpSemigroup(s) or FreeGeneratorsOfFpMonoid(m)).

52.4-4 FreeGeneratorsOfFpSemigroup
‣ FreeGeneratorsOfFpSemigroup( s )( attribute )
‣ FreeGeneratorsOfFpMonoid( m )( attribute )

returns the underlying free generators corresponding to the generators of the finitely presented semigroup s or monoid m.

52.4-5 RelationsOfFpSemigroup
‣ RelationsOfFpSemigroup( s )( attribute )
‣ RelationsOfFpMonoid( m )( attribute )

returns the relations of the finitely presented semigroup s or monoid m as pairs of words in the free generators provided by FreeGeneratorsOfFpSemigroup(s) or FreeGeneratorsOfFpMonoid(m).

gap> fs = FreeSemigroupOfFpSemigroup( s );
true
gap> FreeGeneratorsOfFpMonoid( m );
[ m1, m2, m3 ]
gap> RelationsOfFpSemigroup( s );
[ [ s1*s2*s1, s1 ], [ s2^4, s1 ] ]

52.5 Rewriting Systems and the Knuth-Bendix Procedure

If a finitely presented semigroup (or monoid) has a confluent rewriting system then it has a solvable word problem, that is, there is an algorithm to decide when two words in the free underlying semigroup represent the same element of the finitely presented semigroup. Indeed, once we have a confluent rewriting system, it is possible to successfully test that two words represent the same element in the semigroup, by reducing both words using the rewriting system rules. This is, at the moment, the method that GAP uses to check equality in finitely presented semigroups and monoids.

52.5-1 ReducedConfluentRewritingSystem
‣ ReducedConfluentRewritingSystem( S[, ordering] )( attribute )

returns a reduced confluent rewriting system of the finitely presented semigroup or monoid S with respect to the reduction ordering ordering (see 34).

The default for ordering is the length plus lexicographic ordering on words, also called the shortlex ordering; for the definition see for example [Sim94].

Notice that this might not terminate. In particular, if the semigroup or monoid S does not have a solvable word problem then it this will certainly never end. Also, in this case, the object returned is an immutable rewriting system, because once we have a confluent rewriting system for a finitely presented semigroup or monoid we do not want to allow it to change (as it was most probably very time consuming to get it in the first place). Furthermore, this is also an attribute storing object (see 13.4).

gap> f := FreeSemigroup( "a", "b" );;
gap> a := f.1;;  b := f.2;;
gap> s := f / [ [ a*b*a, b ], [ b*a*b, a ] ];;
gap> rws := ReducedConfluentRewritingSystem( s );
Rewriting System for Semigroup( [ a, b ] ) with rules
[ [ a*b*a, b ], [ b*a*b, a ], [ b*a^2, a^2*b ], [ b^2, a^2 ],
  [ a^5, a ], [ a^3*b, b*a ] ]
gap> c := s.1;;  d := s.2;;
gap> e := (c*d^2)^3;
(a*b^2)^3
gap> ## ReducedForm( rws, e );  gives an error!
gap> w := UnderlyingElement( e );
(a*b^2)^3
gap> ReducedForm( rws, w );
a

The creation of a reduced confluent rewriting system for a semigroup or for a monoid, in GAP, uses the Knuth-Bendix procedure for strings, which manipulates a rewriting system of the semigroup or monoid and attempts to make it confluent, (see Chapter 38 and also Sims [Sim94]). (Since the word problem for semigroups/monoids is not solvable in general, the Knuth-Bendix procedure cannot always terminate).

In order to apply this procedure we will build a rewriting system for the semigroup or monoid, which we will call a Knuth-Bendix Rewriting System (we need to define this because we need the rewriting system to store some information needed for the implementation of the Knuth-Bendix procedure).

Actually, Knuth-Bendix Rewriting Systems do not only serve this purpose. Indeed these are objects which are mutable and which can be manipulated (see 38).

Note that the implemented version of the Knuth-Bendix procedure, in GAP returns, if it terminates, a confluent rewriting system which is reduced. Also, a reduction ordering has to be specified when building a rewriting system. If none is specified, the shortlex ordering is assumed (note that the procedure may terminate with a certain ordering and not with another one).

On Unix systems it is possible to replace the built-in Knuth-Bendix by other routines, for example the package kbmag offers such a possibility.

52.5-2 KB_REW
‣ KB_REW( global variable )
‣ GAPKB_REW( global variable )

KB_REW is a global record variable whose components contain functions used for Knuth-Bendix. By default KB_REW is assigned to GAPKB_REW, which contains the KB functions provided by the GAP library.

52.5-3 KnuthBendixRewritingSystem
‣ KnuthBendixRewritingSystem( s, wordord )( operation )
‣ KnuthBendixRewritingSystem( m, wordord )( operation )

in the first form, for a semigroup s and a reduction ordering for the underlying free semigroup, it returns the Knuth-Bendix rewriting system of the finitely presented semigroup s using the reduction ordering wordord. In the second form, for a monoid m and a reduction ordering for the underlying free monoid, it returns the Knuth-Bendix rewriting system of the finitely presented monoid m using the reduction ordering wordord.

52.5-4 SemigroupOfRewritingSystem
‣ SemigroupOfRewritingSystem( rws )( attribute )
‣ MonoidOfRewritingSystem( rws )( attribute )

returns the semigroup or monoid over which rws is a rewriting system.

52.5-5 FreeSemigroupOfRewritingSystem
‣ FreeSemigroupOfRewritingSystem( rws )( attribute )
‣ FreeMonoidOfRewritingSystem( rws )( attribute )

returns the free semigroup or monoid over which rws is a rewriting system.

gap> f1 := FreeSemigroupOfRewritingSystem( rws );
<free semigroup on the generators [ a, b ]>
gap> f1 = f;
true
gap> s1 := SemigroupOfRewritingSystem( rws );
<fp semigroup on the generators [ a, b ]>
gap> s1 = s;
true

As mentioned before, having a confluent rewriting system, one can decide whether two words represent the same element of a finitely presented semigroup (or finitely presented monoid).

gap> d^6 = c^2;
true
gap> ReducedForm( rws, UnderlyingElement( d^6 ) );
a^2
gap> ReducedForm( rws, UnderlyingElement( c^2 ) );
a^2

52.6 Todd-Coxeter Procedure

This procedure gives a standard way of finding a transformation representation of a finitely presented semigroup. Usually one does not explicitly call this procedure but uses IsomorphismTransformationSemigroup (53.7-5).

52.6-1 CosetTableOfFpSemigroup
‣ CosetTableOfFpSemigroup( r )( attribute )

r is a right congruence of an fp-semigroup S. This attribute is the coset table of FP semigroup S on a right congruence r. Given a right congruence r we represent S as a set of transformations of the congruence classes of r.

The images of the cosets under the generators are compiled in a list table such that table[i][s] contains the image of coset s under generator i.

 [Top of Book]  [Contents]   [Previous Chapter]   [Next Chapter] 
Goto Chapter: Top 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 Bib Ind

generated by GAPDoc2HTML