  
  [1m[4m[31m2. Basics[0m
  
  We  give some examples of semigroups to be used later. We also describe some
  basic functions that are not directly available from [1mGAP[0m, but are useful for
  the purposes of this package.
  
  
  [1m[4m[31m2.1 Examples[0m
  
  These are some examples of semigroups that will be used through this manual
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> f := FreeMonoid("a","b"); [0m
    [22m[35m<free monoid on the generators [ a, b ]> [0m
    [22m[35mgap> a := GeneratorsOfMonoid( f )[   1 ];; [0m
    [22m[35mgap> b := GeneratorsOfMonoid( f )[ 2 ];; [0m
    [22m[35mgap> r:=[[a^3,a^2],   [0m
    [22m[35m> [a^2*b,a^2], [0m
    [22m[35m> [b*a^2,a^2], [0m
    [22m[35m> [b^2,a^2], [0m
    [22m[35m> [a*b*a,a], [0m
    [22m[35m> [b*a*b,b] ]; [0m
    [22m[35m[ [ a^3, a^2 ], [ a^2*b, a^2 ], [ b*a^2, a^2 ], [ b^2, a^2 ], [ a*b*a, a ], [0m
    [22m[35m[ b*a*b, b ] ] [0m
    [22m[35mgap> b21:= f/r; [0m
    [22m[35m<fp semigroup on the generators [<identity ... >, a, b ]> [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> f := FreeSemigroup("a","b"); [0m
    [22m[35m<free semigroup on the generators [ a, b ]>   [0m
    [22m[35mgap> a := GeneratorsOfSemigroup( f )[ 1 ];; [0m
    [22m[35mgap> b :=   GeneratorsOfSemigroup( f )[ 2 ];; [0m
    [22m[35mgap> r:=[[a^3,a^2], [0m
    [22m[35m> [a^2*b,a^2],   [0m
    [22m[35m> [b*a^2,a^2], [0m
    [22m[35m> [b^2,a^2], [0m
    [22m[35m> [a*b*a,a], [0m
    [22m[35m> [b*a*b,b] ]; [0m
    [22m[35m[ [ a^3, a^2 ], [ a^2*b, a^2 ], [ b*a^2, a^2 ], [ b^2, a^2 ], [ a*b*a, a ], [0m
    [22m[35m[ b*a*b, b ] ] [0m
    [22m[35mgap> b2:= f/r; [0m
    [22m[35m<fp semigroup on the generators [ a, b ]> [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> g0:=Transformation([4,1,2,4]);;[0m
    [22m[35mgap> g1:=Transformation([1,3,4,4]);;[0m
    [22m[35mgap> g2:=Transformation([2,4,3,4]);;[0m
    [22m[35mgap> poi3:= Monoid(g0,g1,g2);[0m
    [22m[35m<monoid with 3 generators>[0m
    [22m[35m     [0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m2.2 Some attributes[0m
  
  These functions are semigroup attributes that get stored once computed.
  
  [1m[4m[31m2.2-1 HasCommutingIdempotents[0m
  
  [1m[34m> HasCommutingIdempotents( [0m[22m[34mM[0m[1m[34m ) ____________________________________[0mattribute
  
  Tests whether the idempotents of the semigroup [22m[34mM [0mcommute.
  
  [1m[4m[31m2.2-2 IsInverseSemigroup[0m
  
  [1m[34m> IsInverseSemigroup( [0m[22m[34mS[0m[1m[34m ) _________________________________________[0mattribute
  
  Tests  whether  a  finite  semigroup  [22m[34mS [0mis inverse. It is well-known that it
  suffices  to test whether the idempotents of [22m[34mS [0mcommute and [22m[34mS [0mis regular. The
  function [22m[32mIsRegularSemigroup [0mis part of [1mGAP[0m.
  
  
  [1m[4m[31m2.3 Some basic functions[0m
  
  [1m[4m[31m2.3-1 PartialTransformation[0m
  
  [1m[34m> PartialTransformation( [0m[22m[34mL[0m[1m[34m ) _______________________________________[0mfunction
  
  A  partial  transformation is a partial function of a set of integers of the
  form  {1,  ...,  n}.  It  is given by means of the list of images [22m[34mL[0m. When an
  element  has  no  image,  we write 0. Returns a full transformation on a set
  with one more element that acts like a zero.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> PartialTransformation([2,0,4,0]);[0m
    [22m[35mTransformation( [ 2, 5, 4, 5, 5 ] )[0m
    [22m[35m      [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m2.3-2 ReduceNumberOfGenerators[0m
  
  [1m[34m> ReduceNumberOfGenerators( [0m[22m[34mL[0m[1m[34m ) ____________________________________[0mfunction
  
  Given  a  subset  [22m[34mL[0m  of  the  generators  of  a semigroup, returns a list of
  generators of the same semigroup but possibly with less elements than [22m[34mL[0m.
  
  [1m[4m[31m2.3-3 SemigroupFactorization[0m
  
  [1m[34m> SemigroupFactorization( [0m[22m[34mS, L[0m[1m[34m ) ___________________________________[0mfunction
  
  [22m[34mL[0m  is an element (or list of elements) of the semigroup [22m[34mS[0m. Returns a minimal
  factorization  on the generators of [22m[34mS[0m of the element(s) of [22m[34mL[0m. Works only for
  transformation semigroups.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> el1 := Transformation( [ 2, 3, 4, 4 ] );;[0m
    [22m[35mgap> el2 := Transformation( [ 2, 4, 3, 4 ] );;[0m
    [22m[35mgap> f1 := SemigroupFactorization(poi3,el1);[0m
    [22m[35m[ [ Transformation( [ 1, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] ) ] ][0m
    [22m[35mgap> f1[1][1] * f1[1][2] = el1;[0m
    [22m[35mtrue[0m
    [22m[35mgap> SemigroupFactorization(poi3,[el1,el2]);[0m
    [22m[35m[ [ Transformation( [ 1, 3, 4, 4 ] ), Transformation( [ 2, 4, 3, 4 ] ) ],[0m
    [22m[35m  [ Transformation( [ 2, 4, 3, 4 ] ) ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m2.3-4 GrahamBlocks[0m
  
  [1m[34m> GrahamBlocks( [0m[22m[34mmat[0m[1m[34m ) ______________________________________________[0mfunction
  
  [22m[34mmat[0m  is  a  matrix  as  displayed  by [22m[32mDisplayEggBoxOfDClass(D);[0m of a regular
  D-class  [22m[32mD[0m.  This  function  outputs a list [22m[32m[gmat, phi][0m where [22m[32mgmat[0m is [22m[34mmat[0m in
  Graham's  blocks  form  and  [22m[32mphi[0m maps H-classes of [22m[32mgmat[0m to the corresponding
  ones  of  [22m[34mmat[0m,  i.e., [22m[32mphi[i][j] = [i',j'][0m where [22m[32mmat[i'][j'] = gmat[i][j][0m. If
  the  argument  to  this  function is not a matrix corresponding to a regular
  D-class, the function may abort in error.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> p1 := PartialTransformation([6,2,0,0,2,6,0,0,10,10,0,0]);;[0m
    [22m[35mgap> p2 := PartialTransformation([0,0,1,5,0,0,5,9,0,0,9,1]);;[0m
    [22m[35mgap> p3 := PartialTransformation([0,0,3,3,0,0,7,7,0,0,11,11]);;[0m
    [22m[35mgap> p4 := PartialTransformation([4,4,0,0,8,8,0,0,12,12,0,0]);;[0m
    [22m[35mgap> css3:=Semigroup(p1,p2,p3,p4);[0m
    [22m[35m<semigroup with 4 generators>[0m
    [22m[35mgap> el := Elements(css3)[8];;[0m
    [22m[35mgap> D := GreensDClassOfElement(css3, el);;[0m
    [22m[35mgap> IsRegularDClass(D);[0m
    [22m[35mtrue[0m
    [22m[35mgap> DisplayEggBoxOfDClass(D);[0m
    [22m[35m[ [  1,  0,  1,  0 ],[0m
    [22m[35m  [  0,  1,  0,  1 ],[0m
    [22m[35m  [  0,  1,  0,  1 ],[0m
    [22m[35m  [  1,  0,  1,  0 ] ][0m
    [22m[35mgap> mat := [ [  1,  0,  1,  0 ],[0m
    [22m[35m>   [  0,  1,  0,  1 ],[0m
    [22m[35m>   [  0,  1,  0,  1 ],[0m
    [22m[35m>   [  1,  0,  1,  0 ] ];;[0m
    [22m[35mgap> res := GrahamBlocks(mat);;[0m
    [22m[35mgap> PrintArray(res[1]);[0m
    [22m[35m[ [  1,  1,  0,  0 ],[0m
    [22m[35m  [  1,  1,  0,  0 ],[0m
    [22m[35m  [  0,  0,  1,  1 ],[0m
    [22m[35m  [  0,  0,  1,  1 ] ][0m
    [22m[35mgap> PrintArray(res[2]);[0m
    [22m[35m[ [  [ 1, 1 ],  [ 1, 3 ],  [ 1, 2 ],  [ 1, 4 ] ],[0m
    [22m[35m  [  [ 4, 1 ],  [ 4, 3 ],  [ 4, 2 ],  [ 4, 4 ] ],[0m
    [22m[35m  [  [ 2, 1 ],  [ 2, 3 ],  [ 2, 2 ],  [ 2, 4 ] ],[0m
    [22m[35m  [  [ 3, 1 ],  [ 3, 3 ],  [ 3, 2 ],  [ 3, 4 ] ] ][0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m2.4 Cayley graphs[0m
  
  [1m[4m[31m2.4-1 RightCayleyGraphAsAutomaton[0m
  
  [1m[34m> RightCayleyGraphAsAutomaton( [0m[22m[34mS[0m[1m[34m ) _________________________________[0mfunction
  
  Computes  the  right Cayley graph of a finite monoid or semigroup [22m[34mS[0m. It uses
  the  [1mGAP[0m  buit-in  function [22m[32mCayleyGraphSemigroup[0m to compute the Cayley Graph
  and  returns  it  as  an  automaton  without  initial  and final states. The
  [1mAutomata[0m is used to this effect
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35mgap> rcg := RightCayleyGraphAsAutomaton(b21);[0m
    [22m[35m< deterministic automaton on 2 letters with 6 states >[0m
    [22m[35mgap> Display(rcg);[0m
    [22m[35m   |  1  2  3  4  5  6[0m
    [22m[35m-----------------------[0m
    [22m[35m a |  2  4  6  4  2  4[0m
    [22m[35m b |  3  5  4  4  4  3[0m
    [22m[35mInitial state:   [ ][0m
    [22m[35mAccepting state: [ ][0m
    [22m[35m      [0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m2.4-2 RightCayleyGraphMonoidAsAutomaton[0m
  
  [1m[34m> RightCayleyGraphMonoidAsAutomaton( [0m[22m[34mS[0m[1m[34m ) ___________________________[0mfunction
  
  This function is a synonym of [1m[34mRightCayleyGraphAsAutomaton[0m ([1m2.4-1[0m).
  
