  
  [1X2 [33X[0;0YRewriting Systems[133X[101X
  
  [33X[0;0YThis chapter describes functions to construct rewriting systems for finitely
  presented groups which store rewriting information. The main example used is
  a  presentation  of the quaternion group [10Xq8[110X with generators [22Xa,b[122X and relators
  [22X[a^4, b^4, abab^-1, a^2b^2][122X.[133X
  
  
  [1X2.1 [33X[0;0YIdentity Y-sequences[133X[101X
  
  [33X[0;0YA  typical input for [5XIdRel[105X is an fp-group presentation. This requires a free
  group  [10XF[110X  on  a set of generators and a set of relators [10XR[110X (words in the free
  group). The module of identities among relators for this presentation has as
  its  elements  the Peiffer equivalence classes of all products of conjugates
  of relators which represent the identity in the free group.[133X
  
  [33X[0;0YIn   this   package   the  identities  among  relators  are  represented  by
  Y-sequences,  which  are  lists [22X[[r_1, u_1],...,[r_k,u_k]][122X where [22Xr_1,...,r_k[122X
  are  the  group relators or their inverses, and [22Xu_1,...,u_k[122X are words in the
  free   group   [10XF[110X.   A   Y-sequence   is   evaluated  in  [10XF[110X  as  the  product
  [22X(u_1^-1r_1u_1)...(u_k^-1r_ku_k)[122X   and   is  an  identity  Y-sequence  if  it
  evaluates  to  the  identity  in  [10XF[110X.  An  identity  Y-sequence represents an
  identity  among the relators of the group presentation. The main function of
  the  package is to produce a set of Y-sequences which generate the module of
  identites among relators, and further, that this set be minimal in the sense
  that every element in it is needed to generate the module.[133X
  
  [33X[0;0YBefore  starting  on  the  main  example,  we  consider  a  simpler  example
  illustrating  the  use  of  [5XIdRel[105X.  All  the functions used are described in
  detail in this manual. We compute a reduced set of identities among relators
  for  the  presentation  of  the  symmetric  group [10Xs3[110X with generators [22Xa,b[122X and
  relators  [22X[a^3  ,  b^2,  (ab)^2][122X.  In  the listing below, [10Xs3_M1[110X is the first
  monoid  generator  for  [10Xs3[110X,  [10Xs3_R2[110X is the second relator, while [10Xs3_Y4[110X is the
  fourth Y-sequence for [10Xs3[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XF := FreeGroup( 2 );;[127X[104X
    [4X[25Xgap>[125X [27Xa := F.l;; b:= F.2;;[127X[104X
    [4X[25Xgap>[125X [27Xrels3 := [ a^3 , b^2, a*b*a*b];[127X[104X
    [4X[28X[ f1^3, f2^2, (f1*f2)^2 ][128X[104X
    [4X[25Xgap>[125X [27Xs3 := F/rels3;[127X[104X
    [4X[28X<fp group on the generators [ fl, f2 ]> [128X[104X
    [4X[25Xgap>[125X [27XSetName( s3, "s3" ); [127X[104X
    [4X[25Xgap>[125X [27Xidy3 := IdentityYSequences( s3 );; [127X[104X
    [4X[25Xgap>[125X [27XLength( idy3 ); [127X[104X
    [4X[28X18[128X[104X
    [4X[25Xgap>[125X [27XY4 := idy3[4]; [127X[104X
    [4X[28X[ [ s3_R1^-1, f1^-1 ], [ s3_R1, <identity ...> ] ][128X[104X
    [4X[25Xgap>[125X [27XY6 := idy3[6];[127X[104X
    [4X[28X[ [ s3_R3^-1, f1^-1 ], [ s3_R1, <identity ...> ], [ s3_R3^-1, f1 ],[128X[104X
    [4X[28X  [ s3_R2, f1^-1*f2^-1 ], [ s3_R1, f2^-1 ], [ s3_R3^-1, f1*f2^-1 ],[128X[104X
    [4X[28X  [ s3_R2, <identity ...> ], [ s3_R2, f1^-1 ] ][128X[104X
    [4X[25Xgap>[125X [27XY7 := idy3[7];[127X[104X
    [4X[28X[ [ s3_R3^-1, f1*f2^-1 ], [ s3_R2, <identity ...> ], [ s3_R3, <identity ...> ],[128X[104X
    [4X[28X  [ s3_R2^-1, <identity ...> ] ][128X[104X
    [4X[25Xgap>[125X [27XY8 := idy3[8];[127X[104X
    [4X[28X[ [ s3_R2^-1, f2^-1 ], [ s3_R2, <identity ...> ] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YOf  the  [22X18[122X  Y-sequences  formed,  [22X6[122X  are empty, and [10XY4[110X is the [13Xroot identity[113X
  [10X((a^3)^-1)^(a^-1).(a^3)[110X.  If  we  write  [22Xr=a^3,  s=b^2,  t=(ab)^2[122X then [10XY4[110X is
  [22X(r^-1)^a^-1}r[122X.  Similarly,  [10XY8[110X  is  the  second root identity [22X(s^-1)^b^-1}s[122X,
  while [10XY7[110X is the third root identity [22X(t^-1)^(ab)^-1}t[122X. The identity [10XY6[110X, which
  is  not  a root identity, is obtained by walking around the Schreier diagram
  of  the  presentation,  a  somewhat  truncated  triangular prism. Taking the
  appropriate    conjugate    of    each    face    in    turn,   we   get:   [10X
  Y6=(t^-1)^(a^-1).r.(t^-1)^a.s^(a^-1b^-1).r^(b^-1).(t^-1)^(ab^-1).s.s^(a^-1).
  [110X These four identities generate the module of identities for [10Xs3[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xidrels3 := IdentitiesAmongRelators( s3 );;[127X[104X
    [4X[25Xgap>[125X [27XDisplay( idrels3[1] );[127X[104X
    [4X[28X[ ( s3_Y4*( s3_M2*s3_M1), s3_R1*( s3_M1 - <identity ...>) ),[128X[104X
    [4X[28X  ( s3_Y8*( s3_M2*s3_M1), s3_R2*( s3_M2 - <identity ...>) ),[128X[104X
    [4X[28X  ( s3_Y7*( s3_M2*s3_M1), s3_R3*( s3_M2 - s3_M1) ),[128X[104X
    [4X[28X  ( s3_Y6*( -s3_M2*s3_M1), s3_R1*( -s3_M2*s3_M1 - s3_M1) + s3_R2*( -s3_M1*s3_M\[128X[104X
    [4X[28X2 - s3_M1 - <identity ...>) + s3_R3*( s3_M3 + s3_M2 + <identity ...>) )[128X[104X
    [4X[28X  ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.2 [33X[0;0YMonoid Presentations of FpGroups[133X[101X
  
  [1X2.2-1 FreeRelatorGroup[101X
  
  [29X[2XFreeRelatorGroup[102X( [3Xgrp[103X ) [32X attribute
  [29X[2XFreeRelatorHomomorphism[102X( [3Xgrp[103X ) [32X attribute
  
  [33X[0;0YThe function [10XFreeRelatorGroup[110X returns a free group on the set of relators of
  the  given  fp-group  [10XG[110X.  If [10XHasName(G)[110X is [10Xtrue[110X then a name is automatically
  assigned to the free group.[133X
  
  [33X[0;0YThe function [10XFreeRelatorHomomorphism[110X returns the group homomorphism from the
  free group on the relators to the free group on the generators of [10XG[110X, mapping
  each generator to the corresponding word.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27XF := FreeGroup( 2 );;[127X[104X
    [4X[25Xgap>[125X [27Xa := F.1;; b:= F.2;;[127X[104X
    [4X[25Xgap>[125X [27Xrels := [ a^4, b^4, a*b*a*b^-1, a^2*b^2];;[127X[104X
    [4X[25Xgap>[125X [27Xq8 := F/rels;;[127X[104X
    [4X[25Xgap>[125X [27XSetName( q8, "q8" );[127X[104X
    [4X[25Xgap>[125X [27Xfrq8 := FreeRelatorGroup( q8 );[127X[104X
    [4X[28Xq8_R [128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfGroup( frq8 );[127X[104X
    [4X[28X[ q8_R1, q8_R2, q8_R3, q8_R4][128X[104X
    [4X[25Xgap>[125X [27Xfrhomq8 := FreeRelatorHomomorphism( q8 );[127X[104X
    [4X[28X[ q8_R1, q8_R2, q8_R3, q8_R4] -> [ f1^4, f2^4, f1*f2*f1*f2^-1, f1^2*f2^2][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [1X2.2-2 MonoidPresentationFpGroup[101X
  
  [29X[2XMonoidPresentationFpGroup[102X( [3Xgrp[103X ) [32X attribute
  [29X[2XFreeGroupOfPresentation[102X( [3Xmon[103X ) [32X attribute
  [29X[2XGroupRelatorsOfPresentation[102X( [3Xmon[103X ) [32X attribute
  [29X[2XInverseRelatorsOfPresentation[102X( [3Xmon[103X ) [32X attribute
  [29X[2XHomomorphismOfPresentation[102X( [3Xmon[103X ) [32X attribute
  
  [33X[0;0YA  monoid  presentation  for  a  finitely  presented  group [10XG[110X has two monoid
  generators  [22Xg^+,g^-[122X  for  each group generator [22Xg[122X. The relators of the monoid
  presentation comprise the group relators, and relators [22Xg^+g^-[122X specifying the
  inverses.   The   function   [10XMonoidPresentationFpGroup[110X  returns  the  monoid
  presentation  derived  in  this  way  from  an  fp-presentation. (Note: this
  function   should   always   be   followed   by   a   double   semicolon  --
  [10XMonoidPresentationFpGroup(G);;[110X  --  because an error occurs in attempting to
  display the results on the screen: the [10XElementsFamily[110X needs to be fixed.)[133X
  
  [33X[0;0YThe  function  [10XFreeGroupOfPresentation[110X  returns the free group on the monoid
  generators.[133X
  
  [33X[0;0YThe  function  [10XGroupRelatorsOfPresentation[110X  returns  those  relators  of the
  monoid which correspond to the relators of the group. All negative powers in
  the group relators are converted to positive powers of the [22Xg^-[122X.[133X
  
  [33X[0;0YThe  function  [10XInverseRelatorsOfPresentation[110X  returns relators which specify
  the inverse pairs of the monoid generators.[133X
  
  [33X[0;0YThe  function  [10XHomomorphismOfPresentation[110X  returns the homomorphism from the
  free  group  of  the  monoid  presentation  to  the  free group of the group
  presentation.[133X
  
  [33X[0;0YIn  the  example  below,  the  four monoid generators [22Xa^+, b^+, a^-, b^-[122X are
  named [10Xq8_M1, q8_M2, q8_M3, q8_M4[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xmon := MonoidPresentationFpGroup( q8 );[127X[104X
    [4X[28Xmonoid presentation for an fp-group with homomorphism[128X[104X
    [4X[28X[ [ q8_M1, q8_M2, q8_M3, q8_M4 ], [ f1, f2, f1^-1, f2^-1 ] ][128X[104X
    [4X[25Xgap>[125X [27Xfgmon := FreeGroupOfPresentation( mon);[127X[104X
    [4X[28X<free group on the generators [ q8_Ml, q8_M2, q8_M3, q8_M4]> [128X[104X
    [4X[25Xgap>[125X [27Xgenfgmon := GeneratorsOfGroup( fgmon);[127X[104X
    [4X[28X[ q8_Ml, q8_M2, q8_M3, q8_M4] [128X[104X
    [4X[25Xgap>[125X [27Xgprels := GroupRelatorsOfPresentation( mon );[127X[104X
    [4X[28X[ q8_Ml^4, q8_M2^4, q8_Ml*q8_M2*q8_Ml*q8_M4, q8_Ml^2*q8_M2^2] [128X[104X
    [4X[25Xgap>[125X [27Xinvrels := InverseRelatorsOfPresentation( mon);[127X[104X
    [4X[28X[ q8_Ml*q8_M3, q8_M2*q8_M4, q8_M3*q8_Ml, q8_M4*q8_M2] [128X[104X
    [4X[25Xgap>[125X [27Xhompres := HomomorphismOfPresentation( mon );[127X[104X
    [4X[28X[ q8_Ml, q8_M2, q8_M3, q8_M4] -> [ fl, f2, fl^-l, f2^-1 ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.3 [33X[0;0YRewriting systems for FpGroups[133X[101X
  
  [33X[0;0YThese  functions  duplicate  the  standard  Knuth Bendix functions which are
  available  in  the  [5XGAP[105X  library.  There are two reasons for this: (1) these
  functions  were  first written before the standard functions were available;
  (2)  we  require  logged  versions  of  the  functions,  and  these are most
  conveniently extended versions of the non-logged code.[133X
  
  [1X2.3-1 RewritingSystemFpGroup[101X
  
  [29X[2XRewritingSystemFpGroup[102X( [3Xgrp[103X ) [32X attribute
  
  [33X[0;0YThis  function  attempts to return a complete rewrite system for the group [10XG[110X
  obtained  from  the  monoid  presentation [10Xmon[110X, with a length-lexicographical
  ordering  on the words in [10Xfgmon[110X, by applying Knuth-Bendix completion. Such a
  rewrite  system can be obtained for all finite groups. The rewrite rules are
  (partially)  ordered,  starting  with  the inverse relators, followed by the
  rules which reduce the word length the most.[133X
  
  [33X[0;0YIn our [10Xq8[110X example there are 16 rewrite rules.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xrws := RewritingSystemFpGroup( q8 );[127X[104X
    [4X[28X[ [q8_Ml*q8_M3, <identity ...>], [ q8_M2*q8_M4, <identity ...> ], [128X[104X
    [4X[28X  [q8_M3*q8_Ml, <identity ...>], [ q8_M4*q8_M2, <identity ...> ], [128X[104X
    [4X[28X  [q8_M1^2*q8_M4, q8_M2], [q8_Ml^2*q8_M2, q8_M4], [ q8_Ml^3, q8_M3 ], [128X[104X
    [4X[28X  [ q8_M4^2, q8_Ml^2], [ q8_M4*q8_M3, q8_Ml*q8_M4], [128X[104X
    [4X[28X  [ q8_M4*q8_Ml, q8_Ml*q8_M2], [q8_M3*q8_M4, q8_Ml*q8_M2], [128X[104X
    [4X[28X  [ q8_M3^2, q8_Ml^2], [q8_M3*q8_M2, q8_Ml*q8_M4], [128X[104X
    [4X[28X  [ q8_M2*q8_M3, q8_Ml*q8_M2], [q8_M2^2, q8_Ml^2], [128X[104X
    [4X[28X  [ q8_M2*q8_Ml, q8_Ml*q8_M4] ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe functions called by [10XRewritingSystemFpGroup[110X are as follows.[133X
  
  [1X2.3-2 OnePassReduceWord[101X
  
  [29X[2XOnePassReduceWord[102X( [3Xword[103X, [3Xrules[103X ) [32X operation
  [29X[2XReduceWordKB[102X( [3Xword[103X, [3Xrules[103X ) [32X operation
  
  [33X[0;0YAssuming  that  [10Xword[110X  is  an element of a free monoid and [10Xrules[110X is a list of
  ordered  pairs  of  such  words, the function [10XOnePassReduceWord[110X searches the
  list  of rules until it finds that the left-hand side of a [10Xrule[110X is a [10Xsubword[110X
  of  [10Xword[110X, whereupon it replaces that [10Xsubword[110X with the right-hand side of the
  matching  rule.  The  search  is  continued from the next [10Xrule[110X in [10Xrules[110X, but
  using the new [10Xword[110X. When the end of [10Xrules[110X is reached, one pass is considered
  to  have been made and the reduced [10Xword[110X is returned. If no matches are found
  then the original [10Xword[110X is returned.[133X
  
  [33X[0;0YThe  function [10XReduceWordKB[110X repeatedly applies the function [10XOnePassReduceWord[110X
  until  the [10Xword[110X remaining contains no left-hand side of a [10Xrule[110X as a [10Xsubword[110X.
  If  [10Xrules[110X  is  a  complete rewrite system, then the irreducible [10Xword[110X that is
  returned is unique, otherwise the order of the rules in [10Xrules[110X will determine
  which  irreducible  word  is  returned.  In  the  example we see that [22Xb^9a^9[122X
  reduces to [22Xba[122X, and we shall see later that this is not a normal form.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xmonrels := Concatenation( gprels, invrels );[127X[104X
    [4X[28X[ q8_Ml^4, q8_M2^4, q8_Ml*q8_M2*q8_Ml*q8_M4, q8_Ml^2*q8_M2^2, q8_Ml*q8_M3, [128X[104X
    [4X[28X  q8_M2*q8_M4, q8_M3*q8_Ml, q8_M4*q8_M2] [128X[104X
    [4X[25Xgap>[125X [27Xid := One( monrels[l] );;[127X[104X
    [4X[25Xgap>[125X [27Xr0 := List( monrels, r -> [ r, id ] );[127X[104X
    [4X[28X[ [ q8_Ml^4, <identity ...> ], [ q8_M2^4, <identity. ..> ], [128X[104X
    [4X[28X  [ q8_Ml*q8_M2*q8_Ml*q8_M4, <identity ...> ], [128X[104X
    [4X[28X  [ q8_Ml^2*q8_M2^2, <identity. ..>], [ q8_Ml*q8_M3, <identity ...> ], [128X[104X
    [4X[28X  [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity. ..>], [128X[104X
    [4X[28X  [ q8_M4*q8_M2, <identity ...> ] ] [128X[104X
    [4X[25Xgap>[125X [27Xap := genfgmon[l];; bp := genfgmon[2];;   ## p for plus[127X[104X
    [4X[25Xgap>[125X [27Xam := genfgmon[3];; bm := genfgmon[4];;   ## m for minus[127X[104X
    [4X[25Xgap>[125X [27Xw0 := bp^9 * ap^9;[127X[104X
    [4X[28Xq8_M2^9*q8_M1^9[128X[104X
    [4X[25Xgap>[125X [27Xw1 := OnePassReduceWord( w0, r0 );[127X[104X
    [4X[28Xq8_M2^5*q8_M1^5[128X[104X
    [4X[25Xgap>[125X [27Xw2 := ReduceWordKB( w0, r0 );[127X[104X
    [4X[28Xq8_M2*q8_M1[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  [1X2.3-3 OnePassKB[101X
  
  [29X[2XOnePassKB[102X( [3Xrules[103X ) [32X operation
  [29X[2XRewriteReduce[102X( [3Xrules[103X ) [32X operation
  [29X[2XKnuthBendix[102X( [3Xrules[103X ) [32X operation
  [29X[2XShorterRule[102X( [3Xrule1[103X, [3Xrule2[103X ) [32X operation
  
  [33X[0;0YThe  function  [10XOnePassKB[110X  implements  the  main  loop  of  the  Knuth-Bendix
  completion algorithm. Rules are compared with each other; all critical pairs
  are  calculated;  and  the  irreducible  critical  pairs are orientated with
  respect  to  the  length-lexicographical  ordering  and added to the rewrite
  system.[133X
  
  [33X[0;0YThe  function  [10XRewriteReduce[110X  will  remove  unnecessary rules from a rewrite
  system.  A  rule  is  deemed to be unnecessary if it is implied by the other
  rules,  i.e. if both sides can be reduced to the same thing by the remaining
  rules.[133X
  
  [33X[0;0YThe  function  [10XKnuthBendix[110X implements the Knuth-Bendix algorithm, attempting
  to  complete  a  rewrite  system  with  respect  to  a  length-lexicographic
  ordering.  It  calls  first  [10XOnePassKB[110X,  which  adds  rules,  and  then (for
  efficiency) [10XRewriteReduce[110X which removes any unnecessary ones. This procedure
  is  repeated  until  [10XOnePassKB[110X  adds  no  more  rules.  It  will  not always
  terminate,  but for many examples (all finite groups) it will be successful.
  The  rewrite system returned is complete, that is: it will rewrite any given
  word  in  the  free monoid to a unique irreducible; there is one irreducible
  for  each  element  of the quotient monoid; and any two elements of the free
  monoid which are in the same class will rewrite to the same irreducible.[133X
  
  [33X[0;0YThe  function [10XShorterRule[110X gives an ordering on rules. Rules [22X(g_lg_2,id)[122X that
  identify  two generators (or one generator with the inverse of another) come
  first  in  the  ordering.  Otherwise  one precedes another if it reduces the
  length of a word by a greater amount.[133X
  
  [33X[0;0YOne  pass  of  this  procedure  for  our  [10Xq8[110X example adds 13 relators to the
  original  8, and these 21 are then reduced to 9. A second pass and reduction
  gives  a  list  of  16  rules  which forms a complete rewrite system for the
  group. Now [22Xb^9a^9[122X reduces to [22Xab^-1[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xr1 := OnePassKB( r0 );[127X[104X
    [4X[28X[ [ q8_Ml^4, <identity ...> ], [ q8_M2^4, <identity ...> ], [128X[104X
    [4X[28X  [ q8_Ml*q8_M2*q8_Ml*q8_M4, <identity ...> ], [128X[104X
    [4X[28X  [ q8_Ml^2*q8_M2^2, <identity. ..> ], [ q8_Ml*q8_M3, <identity ...> ], [128X[104X
    [4X[28X  [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [128X[104X
    [4X[28X  [ q8_M4*q8_M2, <identity ...> ], [ q8_M2*q8_Ml*q8_M4, q8_Ml^3], [128X[104X
    [4X[28X  [ q8_Ml*q8_M2^2, q8_Ml^3 ], [ q8_M2^2, q8_Ml^2 ], [q8_Ml^3, q8_M3 ], [128X[104X
    [4X[28X  [ q8_M2^3, q8_M4 ], [ q8_Ml*q8_M2*q8_Ml, q8_M2], [128X[104X
    [4X[28X  [ q8_M2^3, q8_Ml^2*q8_M2], [ q8_M2^2, q8_Ml^2 ], [q8_Ml^2*q8_M2, q8_M4 ], [128X[104X
    [4X[28X  [ q8_Ml^3, q8_M3 ], [ q8_M2*q8_Ml*q8_M4, q8_M3 ], [q8_Ml*q8_M2^2, q8_M3 ], [128X[104X
    [4X[28X  [ q8_M2^3, q8_M4 ] ] [128X[104X
    [4X[25Xgap>[125X [27Xr1 := RewriteReduce( r1 );[127X[104X
    [4X[28X[ [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2^2, q8_Ml^2 ], [128X[104X
    [4X[28X  [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [128X[104X
    [4X[28X  [ q8_M4*q8_M2, <identity ...> ], [ q8_Ml^3, q8_M3 ], [128X[104X
    [4X[28X  [ q8_Ml^2*q8_M2, q8_M4 ], [ q8_Ml*q8_M2*q8_Ml, q8_M2 ], [128X[104X
    [4X[28X  [ q8_M2*q8_Ml*q8_M4, q8_M3 ] ] [128X[104X
    [4X[25Xgap>[125X [27Xr2 := KnuthBendix( r1 );[127X[104X
    [4X[28X[ [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2*q8_Ml, q8_Ml*q8_M4 ], [128X[104X
    [4X[28X  [ q8_M2^2, q8_Ml^2], [ q8_M2*q8_M3, q8_Ml*q8_M2 ], [128X[104X
    [4X[28X  [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [128X[104X
    [4X[28X  [ q8_M3*q8_M2, q8_Ml*q8_M4 ], [ q8_M3^2, q8_Ml^2 ], [128X[104X
    [4X[28X  [ q8_M3*q8_M4, q8_Ml*q8_M2 ], [ q8_M4*q8_Ml, q8_Ml*q8_M2 ], [128X[104X
    [4X[28X  [ q8_M4*q8_M2, <identity ...> ], [ q8_M4*q8_M3, q8_Ml*q8_M4 ], [128X[104X
    [4X[28X  [ q8_M4^2, q8_Ml^2], [ q8_Ml^3, q8_M3 ], [q8_Ml^2*q8_M2, q8_M4 ], [128X[104X
    [4X[28X  [ q8_Ml^2*q8_M4, q8_M2 ] ][128X[104X
    [4X[25Xgap>[125X [27Xw2 := ReduceWordKB( w0, r2 );[127X[104X
    [4X[28Xq8_M1*q8_M4[128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
  
  [1X2.4 [33X[0;0YEnumerating elements[133X[101X
  
  [1X2.4-1 ElementsOfMonoidPresentation[101X
  
  [29X[2XElementsOfMonoidPresentation[102X( [3Xmon[103X ) [32X attribute
  
  [33X[0;0YThe function [10XElementsOfMonoidPresentation[110X returns a list of normal forms for
  the  elements  of the group given by the monoid presentation [10Xmon[110X. The normal
  forms  are  the  least  elements  in each equivalence class (with respect to
  length-lex  order).  When  [10Xrules[110X is a complete rewrite system for [10XG[110X the list
  returned is a set of normal forms for the group elements.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X[128X[104X
    [4X[25Xgap>[125X [27Xelq8 := Elements( q8 );[127X[104X
    [4X[28X[ <identity ...>, f1, f1^3, f2, f1^2*f2, f1^2, f1*f2, f1^3*f2 ][128X[104X
    [4X[25Xgap>[125X [27Xelmonq8 := ElementsOfMonoidPresentation( monq8 );[127X[104X
    [4X[28X[ <identity. ..>, q8_Ml, q8_M2, q8_M3, q8_M4, q8_Ml^2, q8_Ml*q8_M2, [128X[104X
    [4X[28X  q8_Ml*q8_M4 ][128X[104X
    [4X[28X[128X[104X
  [4X[32X[104X
  
