Rewriting Systems

This chapter describes functions to construct rewriting systems for finitely presented groups which store rewriting information. The example used is a presentation of the quaternion group q8 with generators a,b and relators [a^4, b^4, abab^{-1}, a^2b^2].

Identity Y-sequences

A typical input for &idrel; is an fp-group presentation. This requires a free group F on a set of generators and a set of relators R (words in the free group). The module of identities among relations 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.

In this package the identities among relations are represented by Y-sequences, which are lists [[r_1, u_1],\ldots,[r_k,u_k]] where r_1,\ldots,r_k are the group relators or their inverses, and u_1,\ldots,u_k are words in the free group F. A Y-sequence is evaluated in F as the product (u_1^{-1}r_1u_1)\ldots(u_k^{-1}r_ku_k) and is an identity Y-sequence if it evaluates to the identity in F. 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 generated the module of identites among relations, and further, that this set be minimal in the sense that every element in it is needed to generate the module.

We now give a simple example to illustrate the use of &idrel;. All the functions used are described in detail in this manual. We compute a reduced set of identities among relations for the presentation of the symmetric group s3 with generators a,b and relators [a^3 , b^2, (ab)^2].

gap> F := FreeGroup( 2 ); <free group on the generators [ fl, f2]> gap> a := F.l;; b:= F.2;; gap> rels := [ a^3 , b^2, a*b*a*b]; [ fl^3 , f2^2, fl*f2*fl*f2] gap> s3 := F/rels; <fp group on the generators [ fl, f2 ]> gap> idrels3 := IdentitiesAmongRelators( s3 );; gap> Display( idrels3 ); [ [ ( FY4*( <identity ...>, FR1*( mon1 - <identity ...> ), ( FY8*( <identity ...>, FR2*( mon2 - <identity ...> ), ( FY7*( mon2*mon1), FR3*( mon2 - mon1) ), ( FY6*( -<identity ...>, FR1*( -mon2*mon1 - mon1) + FR2*( -mon1*mon2 - mo\ nl - <identity ...> + FR3 *( mon3 + mon2 + <identity ...> ) ], [ ( FY4*( <identity ...>, FR1*( mon1 - <identity ...> ), ( FY8*( <identity ...>, FR2*( mon2 - <identity ...> ), ( FY7*( mon2*mon1), FR3 *( mon2 - mon1) ), ( FY4*( -mon2*mon1 + <identity ...> + FY6*( -<identity ...> + FY7*( -mon\ 2*mon1) + FY8*( mon3 ) , FR1*( -mon2 - <identity ...> + FR2*( -mon3 - mon1 - <i dentity ...> + FR3*( mon3 + mon1 + <identity ...>) ) ] ]
Monoid Presentations of FpGroups
The function FreeRelatorGroup returns a free group on the set of relators of the given fp-group G. If HasName(G) is true then a name is automatically assigned to the free group.

The function FreeRelatorHomomorphism returns the group homomorphism from the free group on the relators to the free group on the generators of G, mapping each generator to the corresponding word.

gap> F := FreeGroup( 2 );; gap> a := F.1;; b:= F.2;; gap> rels := [ a^4, b^4, a*b*a*b^-1, a^2*b^2]; [ f1^4, f2^4, f1*f2*f1*f2^-1, f1^2*f2^2] gap> q8 := F/rels;; gap> SetName( q8, "q8" ); gap> frq8 := FreeRelatorGroup( q8 ); q8_R gap> GeneratorsOfGroup( frq8 ); [ q8_R1, q8_R2, q8_R3, q8_R4] gap> frhomq8 := FreeRelatorHomomorphism( q8 ); [ q8_R1, q8_R2, q8_R3, q8_R4] -> [ f1^4, f2^4, f1*f2*f1*f2^-1, f1^2*f2^2]
A monoid presentation for a finitely presented group G has two monoid generators g^+,g^- for each group generator g. The relators of the monoid presentation comprise the group relators, and relators g^+g^- specifying the inverses. The function MonoidPresentationFpGroup returns the monoid presentation derived in this way from an fp-presentation. (Note: this function should always be followed by a double semicolon -- MonoidPresentationFpGroup(G);; -- because an error occurs in attempting to display the results on the screen: the ElementsFamily needs to be fixed.)

The function FreeGroupOfPresentation returns the free group on the monoid generators.

The function GroupRelatorsOfPresentation 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 g^-.

The function InverseRelatorsOfPresentation returns relators which specify the inverse pairs of the monoid generators.

The function HomomorphismOfPresentation returns the homomorphism from the free group of the monoid presentation to the free group of the group presentation.

In the example below, the four monoid generators a^+, b^+, a^-, b^- are named q8\_M1, q8\_M2, q8\_M3, q8\_M4.

gap> mon := MonoidPresentationFpgroup( q8 );; gap> fgmon := FreeGroupOfPresentation( mon); <free group on the generators [ q8_Ml, q8_M2, q8_M3, q8_M4]> gap> genfgmon := GeneratorsOfGroup( fgmon); [ q8_Ml, q8_M2, q8_M3, q8_M4] gap> gprels := GroupRelatorsOfPresentation( mon ); [ q8_Ml^4, q8_M2^4, q8_Ml*q8_M2*q8_Ml*q8_M4, q8_Ml^2*q8_M2^2] gap> invrels := InverseRelatorsOfPresentation( mon); [ q8_Ml*q8_M3, q8_M2*q8_M4, q8_M3*q8_Ml, q8_M4*q8_M2] gap> hompres := HomomorphismOfPresentation( mon ); [ q8_Ml, q8_M2, q8_M3, q8_M4] -> [ fl, f2, fl^-l, f2^-1 ]
Rewriting systems for FpGroups

These functions duplicate the standard Knuth Bendix functions which are available in the &GAP; 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.

This function attempts to return a complete rewrite system for the group G obtained from the monoid presentation mon, with a length-lexicographical ordering on the words in fgmon, 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.

In our q8 example there are 16 rewrite rules.

gap> rws := RewritingSystemFpGroup( q8 ); [ [q8_Ml*q8_M3, <identity ...>], [ q8_M2*q8_M4, <identity ...> ], [q8_M3*q8_Ml, <identity ...>], [ q8_M4*q8_M2, <identity ...> ], [q8_M1^2*q8_M4, q8_M2], [q8_Ml^2*q8_M2, q8_M4], [ q8_Ml^3, q8_M3 ], [ q8_M4^2, q8_Ml^2], [ q8_M4*q8_M3, q8_Ml*q8_M4], [ q8_M4*q8_Ml, q8_Ml*q8_M2], [q8_M3*q8_M4, q8_Ml*q8_M2], [ q8_M3^2, q8_Ml^2], [q8_M3*q8_M2, q8_Ml*q8_M4], [ q8_M2*q8_M3, q8_Ml*q8_M2], [q8_M2^2, q8_Ml^2], [ q8_M2*q8_Ml, q8_Ml*q8_M4] ]

The functions called by RewritingSystemFpGroup are as follows.

Assuming that word is an element of a free monoid and rules is a list of ordered pairs of such words, the function OnePassReduceWord searches the list of rules until it finds that the left-hand side of a rule is a subword of word, whereupon it replaces that subword with the right-hand side of the matching rule. The search is continued from the next rule in rules, but using the new word. When the end of rules is reached, one pass is considered to have been made and the reduced word is returned. If no matches are found then the original word is returned.

The function ReduceWordKB repeatedly applies the function OnePassReduceWord until the word remaining contains no left-hand side of a rule as a subword. If rules is a complete rewrite system, then the irreducible word that is returned is unique, otherwise the order of the rules in rules will determine which irreducible word is returned.

gap> monrels := Concatenation( gprels, invrels ); [ q8_Ml^4, q8_M2^4, q8_Ml*q8_M2*q8_Ml*q8_M4, q8_Ml^2*q8_M2^2, q8_Ml*q8_M3, q8_M2*q8_M4, q8_M3*q8_Ml, q8_M4*q8_M2] gap> id := One( monrels[l] );; gap> r0 := List( monrels, r -> [ r, id ] ); [ [ q8_Ml^4, <identity ...> ], [ q8_M2^4, <identity. ..> ], [ q8_Ml*q8_M2*q8_Ml*q8_M4, <identity ...> ], [ q8_Ml^2*q8_M2^2, <identity. ..>], [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity. ..>], [ q8_M4*q8_M2, <identity ...> ] ] gap> ap := genfgmon[l];; bp := genfgmon[2];; ## p for plus gap> am := genfgmon[3];; bm := genfgmon[4];; ## m for minus gap> w0 := (ap^3 * bp^3)^3; q8_Ml^3*q8_M2^3*q8_Ml^3*q8_M2^3*q8_Ml^3*q8_M2^3 gap> w1 := OnePassReduceWord( w0, r0 ); q8_Ml*q8_M2*q8_Ml^3*q8_M2^3*q8_Ml^3*q8_M2^3 gap> w2 := ReduceWordKB( w0, r0 ); q8_Ml*q8_M2*q8_Ml*q8_M2*q8_Ml*q8_M2
The function OnePassKB 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.

The function RewriteReduce 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.

The function KnuthBendix implements the Knuth-Bendix algorithm, attempting to complete a rewrite system with respect to a length-lexicographic ordering. It calls first OnePassKB, which adds rules, and then (for efficiency) RewriteReduce which removes any unnecessary ones. This procedure is repeated until OnePassKB 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.

The function ShorterRule gives an ordering on rules. Rules (g_lg_2,id) that identify two generators (or one generator with the inverse of another) are considered to be the best. Otherwise one rule is considered to be better than another if it reduces the length of a word by a greater amount.

One pass of this procedure for our q8 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.

gap> r1 := OnePassKB( r0 ); [ [ q8_Ml^4, <identity ...> ], [ q8_M2^4, <identity ...> ], [ q8_Ml*q8_M2*q8_Ml*q8_M4, <identity ...> ], [ q8_Ml^2*q8_M2^2, <identity. ..> ], [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [ q8_M4*q8_M2, <identity ...> ], [ q8_M2*q8_Ml*q8_M4, q8_Ml^3], [ q8_Ml*q8_M2^2, q8_Ml^3 ], [ q8_M2^2, q8_Ml^2 ], [q8_Ml^3, q8_M3 ], [ q8_M2^3, q8_M4 ], [ q8_Ml*q8_M2*q8_Ml, q8_M2], [ q8_M2^3, q8_Ml^2*q8_M2], [ q8_M2^2, q8_Ml^2 ], [q8_Ml^2*q8_M2, q8_M4 ], [ q8_Ml^3, q8_M3 ], [ q8_M2*q8_Ml*q8_M4, q8_M3 ], [q8_Ml*q8_M2^2, q8_M3 ], [ q8_M2^3, q8_M4 ] ] gap> r1 := RewriteReduce( r1 ); [ [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2^2, q8_Ml^2 ], [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [ q8_M4*q8_M2, <identity ...> ], [ q8_Ml^3, q8_M3 ], [ q8_Ml^2*q8_M2, q8_M4 ], [ q8_Ml*q8_M2*q8_Ml, q8_M2 ], [ q8_M2*q8_Ml*q8_M4, q8_M3 ] ] gap> Length( r1 ); 9 gap> r2 := KnuthBendix( r1 ); [ [ q8_Ml*q8_M3, <identity ...> ], [ q8_M2*q8_Ml, q8_Ml*q8_M4 ], [ q8_M2^2, q8_Ml^2], [ q8_M2*q8_M3, q8_Ml*q8_M2 ], [ q8_M2*q8_M4, <identity ...> ], [ q8_M3*q8_Ml, <identity ...> ], [ q8_M3*q8_M2, q8_Ml*q8_M4 ], [ q8_M3^2, q8_Ml^2 ], [ q8_M3*q8_M4, q8_Ml*q8_M2 ], [ q8_M4*q8_Ml, q8_Ml*q8_M2 ], [ q8_M4*q8_M2, <identity ...> ], [ q8_M4*q8_M3, q8_Ml*q8_M4 ], [ q8_M4^2, q8_Ml^2], [ q8_Ml^3, q8_M3 ], [q8_Ml^2*q8_M2, q8_M4 ], [ q8_Ml^2*q8_M4, q8_M2 ] ]
Enumerating elements
The function ElementsOfMonoidPresentation returns a list of normal forms for the elements of the group given by the monoid presentation mon. The normal forms are in fact the least elements in each equivalence class (with respect to the length-lex order). The function EnumerateKB builds up a catalogue of irreducible words in the generators of a monoid with respect to a set of rules. When rules is a complete rewrite system for G the list returned is a set of normal forms for the group elements.

gap> elq8 := Elements( q8 ); [ <identity .. .>, fl, f2, fl^2, fl*f2, fl^3*f2, fl^3, fl^2*f2 ] gap> elmonq8 := ElementsOfMonoidPresentation( monq8 ); [ <identity. ..>, q8_Ml, q8_M2, q8_M3, q8_M4, q8_Ml^2, q8_Ml*q8_M2, q8_Ml*q8_M4 ]