[1X2 Double Coset Rewriting Systems[0X The [5Xkan[0m package provides functions for the computation of normal forms for double coset representatives of finitely presented groups. The first version of the package was released to support the paper [BGHW06], which describes the algorithms used in this package. [1X2.1 Rewriting Systems[0X [1X2.1-1 KnuthBendixRewritingSystem[0m [2X> KnuthBendixRewritingSystem( [0X[3Xgrp, gensorder, ordering, alph[0X[2X ) ____[0Xoperation [2X> ReducedConfluentRewritingSystem( [0X[3Xgrp, gensorder, ordering, limit[0X[2X ) [0Xoperation [2X> DisplayRwsRules( [0X[3Xrws[0X[2X ) __________________________________________[0Xoperation Methods for [10XKnuthBendixRewritingSystem[0m and [10XReducedConfluentRewritingSystem[0m are supplied which apply to a finitely presented group. These start by calling [10XIsomorphismFpMonoid[0m and then work with the resulting monoid. The parameter [10Xgensorder[0m will normally be [10X"shortlex"[0m or [10X"wreath"[0m, while [10Xordering[0m is an integer list for reordering the generators, and [10Xalph[0m is an alphabet string used when printing words. A [13Xpartial[0m rewriting system may be obtained by giving a [10Xlimit[0m to the number of rules calculated. As usual, A,B denote the inverses of a,b. In the example the generators are by default ordered [A,a,B,b], so the list [10XL1[0m is used to specify the order [10X[a,A,b,B][0m to be used with the shortlex ordering. Specifying a limit [10X0[0m means that no limit is prescribed. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> G1 := FreeGroup( 2 );;[0X [4Xgap> L1 := [2,1,4,3];;[0X [4Xgap> order := "shortlex";;[0X [4Xgap> alph1 := "AaBb";;[0X [4Xgap> rws1 := ReducedConfluentRewritingSystem( G1, L1, order, 0, alph1 );[0X [4XRewriting System for Monoid( [ f1^-1, f1, f2^-1, f2 ], ... ) with rules[0X [4X[ [ f1^-1*f1, <identity ...> ], [ f1*f1^-1, <identity ...> ],[0X [4X [ f2^-1*f2, <identity ...> ], [ f2*f2^-1, <identity ...> ] ][0X [4Xgap> DisplayRwsRules( rws1 );;[0X [4X[ [ Aa, id ], [ aA, id ], [ Bb, id ], [ bB, id ] ][0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.2 Example 1 -- free product of two cyclic groups[0X [1X2.2-1 DoubleCosetRewritingSystem[0m [2X> DoubleCosetRewritingSystem( [0X[3Xgrp, genH, genK, rws[0X[2X ) _______________[0Xfunction [2X> IsDoubleCosetRewritingSystem( [0X[3Xdcrws[0X[2X ) ____________________________[0Xproperty A [13Xdouble coset rewriting system[0m for the double cosets H backslash G / K requires as data a finitely presented group G =[10Xgrp[0m, generators [10XgenH, genK[0m for subgroups H, K, and a rewriting system [10Xrws[0m for G. A simple example is given by taking G to be the free group on two generators a,b, a cyclic subgroup H with generator a^6, and a second cyclic subgroup K with generator a^4. (Similar examples using different powers of a are easily constructed.) Since [10Xgcd(6,4)=2[0m, we have Ha^2K=HK, so the double cosets have representatives [HK, HaK, Ha^iba^jK, Ha^ibwba^jK] where i in [0..5], j in [0..3], and w is any word in a,b. In the example the free group G is converted to a four generator monoid with relations defining the inverse of each generator, [10X[[Aa,id],[aA,id],[Bb,id],[bB,id]][0m, where [10Xid[0m is the empty word. The initial rules for the double coset rewriting system comprise those of G plus those given by the generators of H,K, which are [[Ha^6,H],[a^4K,K]]. In the complete rewrite system new rules involving H or K may arise, and there may also be rules involving both H and K. For this example, -- there are two H-rules, [[Ha^4,HA^2],[HA^3,Ha^3]], -- there are two K-rules, [[a^3K,AK],[A^2K,a^2K]], -- and there are two H-K-rules, [[Ha^2K,HK],[HAK,HaK]]. Here is how the computation may be performed. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> genG1 := GeneratorsOfGroup( G1 );;[0X [4Xgap> genH1 := [ genG1[1]^6 ];;[0X [4Xgap> genK1 := [ genG1[1]^4 ];;[0X [4Xgap> dcrws1 := DoubleCosetRewritingSystem( G1, genH1, genK1, rws1 );;[0X [4Xgap> IsDoubleCosetRewritingSystem( dcrws1 );[0X [4Xtrue[0X [4Xgap> DisplayRwsRules( dcrws1 );;[0X [4XG-rules:[0X [4X[ [ Aa, id ], [ aA, id ], [ Bb, id ], [ bB, id ] ][0X [4XH-rules:[0X [4X[ [ Haaaa, HAA ],[0X [4X [ HAAA, Haaa ] ][0X [4XK-rules:[0X [4X[ [ aaaK, AK ],[0X [4X [ AAK, aaK ] ][0X [4XH-K-rules:[0X [4X[ [ HaaK, HK ],[0X [4X [ HAK, HaK ] ][0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.2-2 WordAcceptorOfReducedRws[0m [2X> WordAcceptorOfReducedRws( [0X[3Xrws[0X[2X ) _________________________________[0Xattribute [2X> WordAcceptorOfDoubleCosetRws( [0X[3Xrws[0X[2X ) _____________________________[0Xattribute [2X> IsWordAcceptorOfDoubleCosetRws( [0X[3Xaut[0X[2X ) ____________________________[0Xproperty Using functions from the [5Xautomata[0m package, we may -- compute a [13Xword acceptor[0m for the rewriting system of G; -- compute a [13Xword acceptor[0m for the double coset rewriting system; -- test a list of words to see whether they are recognised by the automaton; -- obtain a rational expression for the language of the automaton. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> waG1 := WordAcceptorOfReducedRws( rws1 );[0X [4XAutomaton("nondet",6,"aAbB",[ [ [ 1 ], [ 4 ], [ 1 ], [ 4 ], [ 4 ], [ 4 ] ], [ \[0X [4X[ 1 ], [ 3 ], [ 3 ], [ 1 ], [ 3 ], [ 3 ] ], [ [ 1 ], [ 6 ], [ 6 ], [ 6 ], [ 1 \[0X [4X], [ 6 ] ], [ [ 1 ], [ 5 ], [ 5 ], [ 5 ], [ 5 ], [ 1 ] ] ],[ 2 ],[ 1 ]);;[0X [4Xgap> wadc1 := WordAcceptorOfDoubleCosetRws( dcrws1 );[0X [4X< deterministic automaton on 6 letters with 15 states >[0X [4Xgap> Print( wadc1 );[0X [4XAutomaton("det",15,"HKaAbB",[ [ 2, 2, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ],\[0X [4X [ 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 2 ], [ 2, 2, 13, 2, 10, 5, 2, 13,\[0X [4X 2, 7, 11, 11, 12, 2, 2 ], [ 2, 2, 9, 2, 2, 14, 2, 9, 15, 2, 2, 2, 2, 7, 15 ],\[0X [4X [ 2, 2, 2, 2, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 ], [ 2, 2, 3, 2, 3, 3, 3, 2, 3,\[0X [4X 3, 3, 3, 3, 3, 3 ] ],[ 4 ],[ 1 ]);;[0X [4Xgap> words1 := [ "HK","HaK","HbK","HAK","HaaK","HbbK","HabK","HbaK","HbaabK"];;[0X [4Xgap> valid1 := List( words1, w -> IsRecognizedByAutomaton( wadc1, w ) );[0X [4X[ true, true, true, false, false, true, true, true, true ][0X [4Xgap> lang1 := FAtoRatExp( wadc1 );[0X [4X((H(aaaUAA)BUH(a(aBUB)UABUB))(a(a(aa*BUB)UB)UA(AA*BUB)UB)*(a(a(aa*bUb)Ub)UA(AA\[0X [4X*bUb))UH(aaaUAA)bUH(a(abUb)UAbUb))((a(a(aa*BUB)UB)UA(AA*BUB))(a(a(aa*BUB)UB)UA\[0X [4X(AA*BUB)UB)*(a(a(aa*bUb)Ub)UA(AA*bUb))Ua(a(aa*bUb)Ub)UA(AA*bUb)Ub)*((a(a(aa*BU\[0X [4XB)UB)UA(AA*BUB))(a(a(aa*BUB)UB)UA(AA*BUB)UB)*(a(aKUK)UAKUK)Ua(aKUK)UAKUK)U(H(a\[0X [4XaaUAA)BUH(a(aBUB)UABUB))(a(a(aa*BUB)UB)UA(AA*BUB)UB)*(a(aKUK)UAKUK)UH(aKUK)[0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.3 Example 2 -- the trefoil group[0X [1X2.3-1 PartialDoubleCosetRewritingSystem[0m [2X> PartialDoubleCosetRewritingSystem( [0X[3Xgrp, Hgens, Kgens, rws, limit[0X[2X ) [0Xoperation [2X> WordAcceptorOfPartialDoubleCosetRws( [0X[3Xgrp, prws[0X[2X ) ________________[0Xattribute It may happen that, even when G has a finite rewriting system, the double coset rewriting system is infinite. This is the case with the trefoil group T with generators [x,y] and relator [x^3 = y^2] if the wreath product ordering is used with X > x > Y > y. The group itself has a rewriting system with just 6 rules. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> FT := FreeGroup( 2 );;[0X [4Xgap> relsT := [ FT.1^3*FT.2^-2 ];;[0X [4Xgap> T := FT/relsT;;[0X [4Xgap> genT := GeneratorsOfGroup( T );;[0X [4Xgap> x := genT[1]; y := genT[2];[0X [4Xgap> alphT := "XxYy";;[0X [4Xgap> ordT := [4,3,2,1];;[0X [4Xgap> orderT := "wreath";;[0X [4Xgap> rwsT := ReducedConfluentRewritingSystem( T, ordT, orderT, 0, alphT );[0X [4Xgap> DisplayRwsRules( rwsT );;[0X [4X[ [ Yy, id ], [ yY, id ], [ X, xxYY ], [ xxx, yy ], [ yyx, xyy ], [ Yx, yxYY ]\[0X [4X ][0X [4Xgap> accT := WordAcceptorOfReducedRws( rwsT );[0X [4X< deterministic automaton on 4 letters with 7 states >[0X [4Xgap> Print( accT );[0X [4XAutomaton("nondet",7,"yYxX",[ [ [ 1 ], [ 4 ], [ 1 ], [ 4, 7 ], [ 4 ], [ 4 ], [\[0X [4X 4, 7 ] ], [ [ 1 ], [ 3 ], [ 3 ], [ 1 ], [ 3 ], [ 3 ], [ 1 ] ], [ [ 1 ], [ 5 ]\[0X [4X, [ 1 ], [ 5 ], [ 5, 6 ], [ 1 ], [ 1 ] ], [ [ 1 ], [ 1 ], [ 1 ], [ 1 ], [ 1 ],\[0X [4X [ 1 ], [ 1 ] ] ],[ 2 ],[ 1 ]);;[0X [4Xgap> langT := FAtoRatExp( accT );[0X [4X(xx*(xyUy)Uy)(xx*(xyUy)Uyy*yUy)*(xx*((xYUY)Y*(yUxUX)Ux(xUX)UX)(yUYUxUX)*U(yy*(\[0X [4XYUxUX)UYUX)(yUYUxUX)*)Uxx*((xYUY)Y*(yUxUX)Ux(xUX)UX)(yUYUxUX)*U(YY*(yUxUX)UX)(\[0X [4XyUYUxUX)*(yxUx)((xyUy)x)*[0X [4Xgap> r := RationalExpression( "((xyUy)y*UxY*UY*)Uyy*UY*" ); [0X [4X(xyUy)y*UxY*UY*Uyy*UY*[0X [4Xgap> AreEqualLang( langT, r );[0X [4XThe given languages are not over the same alphabet[0X [4Xfalse[0X [4X[0X [4X------------------------------------------------------------------[0X In a previous version the expression [10Xr[0m, which does not involve the letter [10XX[0m, was returned as the language [10XlangT[0m. This discrepancy should be investigated. Taking subgroups H, K to be generated by x and y respectively, the double coset rewriting system has an infinite number of H-rules. It turns out that only a finite number of these are needed to produce the required automaton. The function [10XPartialDoubleCosetRewritingSystem[0m allows a limit to be specified on the number of rules to be computed. In the listing below a limit of 20 is used, but in fact 10 is sufficient. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> prwsT := PartialDoubleCosetRewritingSystem( T, [x], [y], rwsT, 20 );;[0X [4X#I WARNING: reached supplied limit 20 on number of rules[0X [4Xgap> DisplayRwsRules( prwsT );[0X [4XG-rules:[0X [4X[ [ X, xxYY ], [ Yx, yxYY ], [ Yy, id ], [ yY, id ], [ xxx, yy ], [ yyx, xyy ]\[0X [4X ][0X [4XH-rules:[0X [4X[ [ Hx, H ],[0X [4X [ HY, Hy ],[0X [4X [ Hyy, H ],[0X [4X [ Hyxyy, Hyx ],[0X [4X [ HyxY, Hyxy ],[0X [4X [ Hyxyxyy, Hyxyx ],[0X [4X [ Hyxxyy, Hyxx ],[0X [4X [ HyxxY, Hyxxy ],[0X [4X [ HyxyxY, Hyxyxy ],[0X [4X [ Hyxyxyxyy, Hyxyxyx ],[0X [4X [ Hyxyxxyy, Hyxyxx ],[0X [4X [ Hyxxyxyy, Hyxxyx ],[0X [4X [ HyxxyxYY, Hyxxyx ] ][0X [4XK-rules:[0X [4X[ [ YK, K ],[0X [4X [ yK, K ] ][0X [4X[0X [4X------------------------------------------------------------------[0X This list of partial rules is then used by a modified word acceptor function. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> paccT := WordAcceptorOfPartialDoubleCosetRws( T, prwsT );;[0X [4X< deterministic automaton on 6 letters with 6 states >[0X [4Xgap> Print( paccT, "\n" );[0X [4XAutomaton("det",6,"HKyYxX",[ [ 2, 2, 2, 6, 2, 2 ], [ 2, 2, 1, 2, 2, 1 ], [ 2, \[0X [4X2, 5, 2, 2, 5 ], [ 2, 2, 2, 2, 2, 2 ], [ 2, 2, 6, 2, 3, 2 ], [ 2, 2, 2, 2, 2, \[0X [4X2 ] ],[ 4 ],[ 1 ]);;[0X [4Xgap> plangT := FAtoRatExp( paccT );[0X [4XH(yx(yx)*x)*(yx(yx)*KUK)[0X [4Xgap> wordsT := ["HK", "HxK", "HyK", "HYK", "HyxK", "HyxxK", "HyyH", "HyxYK"];;[0X [4Xgap> validT := List( wordsT, w -> IsRecognizedByAutomaton( paccT, w ) );[0X [4X[ true, false, false, false, true, true, false, false ][0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.4 Example 3 -- an infinite rewriting system[0X [1X2.4-1 KBMagRewritingSystem[0m [2X> KBMagRewritingSystem( [0X[3Xfpgrp[0X[2X ) ___________________________________[0Xattribute [2X> KBMagWordAcceptor( [0X[3Xfpgrp[0X[2X ) ______________________________________[0Xattribute [2X> KBMagFSAtoAutomataDFA( [0X[3Xfsa, alph[0X[2X ) ______________________________[0Xoperation [2X> WordAcceptorByKBMag( [0X[3Xgrp, alph[0X[2X ) ________________________________[0Xoperation [2X> WordAcceptorByKBMagOfDoubleCosetRws( [0X[3Xgrp, dcrws[0X[2X ) _______________[0Xoperation When the group G has an infinite rewriting system, the double coset rewriting system will also be infinite. In this case we try the function [10XKBMagWordAcceptor[0m which calls the package [5XKBMAG[0m to compute a word acceptor for G, and [10XKBMagFSAtoAutomataDFA[0m to convert this to a deterministic automaton as used by the [5Xautomata[0m package. The resulting [10Xdfa[0m forms part of the double coset automaton, together with sufficient H-rules, K-rules and H-K-rules found by the function [10XPartialDoubleCosetRewritingSystem[0m. (Note that these five attributes and operations will not be available if the [5Xkbmag[0m package has not been loaded.) In the following example we take a two generator group G3 with relators [a^3,b^3,(a*b)^3], the normal forms of whose elements are some of the strings with a or a^-1 alternating with b or b^-1. The automatic structure computed by [5XKBMAG[0m has a word acceptor with 17 states. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> F3 := FreeGroup("a","b");;[0X [4Xgap> rels3 := [ F3.1^3, F3.2^3, (F3.1*F3.2)^3 ];;[0X [4Xgap> G3 := F3/rels3;;[0X [4Xgap> alph3 := "AaBb";;[0X [4Xgap> waG3 := WordAcceptorByKBMag( G3, alph3 );;[0X [4Xgap> Print( waG3, "\n");[0X [4XAutomaton("det",18,"aAbB",[ [ 2, 18, 18, 8, 10, 12, 13, 18, 18, 18, 18, 18, 18\[0X [4X, 8, 17, 12, 18, 18 ], [ 3, 18, 18, 9, 11, 9, 12, 18, 18, 18, 18, 18, 18, 11, \[0X [4X18, 11, 18, 18 ], [ 4, 6, 6, 18, 18, 18, 18, 18, 6, 12, 16, 18, 12, 18, 18, 18\[0X [4X, 12, 18 ], [ 5, 5, 7, 18, 18, 18, 18, 14, 15, 5, 18, 18, 7, 18, 18, 18, 15, 1\[0X [4X8 ] ],[ 1 ],[ 1 .. 17 ]);;[0X [4Xgap> langG3 := FAtoRatExp( waG3 );[0X [4X((abUAb)AUbA)(bA)*(b(aU@)UB(aB)*(a(bU@)U@)U@)U(abUAb)(aU@)U((aBUB)(aB)*AUba(Ba\[0X [4X)*BA)(bA)*(b(aU@)U@)U(aBUB)(aB)*(a(bU@)U@)Uba(Ba)*(BU@)UbUaUA(B(aB)*(a(bU@)UAU\[0X [4X@)U@)U@[0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.4-2 DCrules[0m [2X> DCrules( [0X[3Xdcrws[0X[2X ) ________________________________________________[0Xoperation [2X> Hrules( [0X[3Xdcrws[0X[2X ) _________________________________________________[0Xattribute [2X> Krules( [0X[3Xdcrws[0X[2X ) _________________________________________________[0Xattribute [2X> HKrules( [0X[3Xdcrws[0X[2X ) ________________________________________________[0Xattribute We now take H to be generated by ab and K to be generated by ba. If we specify a limits of 50, 75, 100, 200 for the number of rules in a partial double coset rewrite system, we obtain lists of H-rules, K-rules and H-K-rules of increasing length. The numbers of states in the resulting automata also increase. We may deduce by hand (but not computationally -- see [BGHW06]) three infinite sets of rules and a limit for the automata. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> lim := 100;;[0X [4Xgap> genG3 := GeneratorsOfGroup( G3 );;[0X [4Xgap> a := genG3[1];; b := genG3[2];; [0X [4Xgap> gH3 := [ a*b ];; gK3 := [ b*a ];;[0X [4Xgap> rwsG3 := KnuthBendixRewritingSystem( G3, "shortlex", [2,1,4,3], alph3 );;[0X [4Xgap> dcrws3 := PartialDoubleCosetRewritingSystem( G3, gH3, gK3, rwsG3, lim );;[0X [4X#I using PartialDoubleCosetRewritingSystem with limit 100[0X [4X#I 51 rules, and 1039 pairs[0X [4X#I WARNING: reached supplied limit 100 on number of rules[0X [4Xgap> Print( Length( Rules( dcrws3 ) ), " rules found.\n" );[0X [4X101 rules found.[0X [4Xgap> dcaut3 := WordAcceptorByKBMagOfDoubleCosetRws( G3, dcrws3 );;[0X [4Xgap> Print( "Double Coset Minimalized automaton:\n", dcaut3 );[0X [4XDouble Coset Minimalized automaton:[0X [4XAutomaton("det",40,"HKaAbB",[ [ 2, 2, 2, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2\[0X [4X, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ], [ \[0X [4X2, 2, 1, 2, 1, 2, 1, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 2, 1, 2, 1, \[0X [4X1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 2, 1 ], [ 2, 2, 2, 2, 3, 22, 2, 2, 2, 2, 2\[0X [4X, 2, 2, 2, 2, 2, 2, 2, 39, 2, 39, 2, 25, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2\[0X [4X, 2, 2, 2, 2 ], [ 2, 2, 2, 2, 40, 3, 27, 2, 8, 2, 10, 2, 12, 2, 14, 2, 16, 2, \[0X [4X18, 2, 20, 2, 2, 2, 2, 24, 2, 27, 2, 29, 2, 31, 2, 33, 2, 35, 2, 37, 2, 2 ], [\[0X [4X 2, 2, 2, 2, 19, 2, 2, 26, 2, 9, 2, 11, 2, 13, 2, 15, 2, 17, 2, 38, 2, 3, 2, 2\[0X [4X6, 3, 2, 7, 2, 28, 2, 30, 2, 32, 2, 34, 2, 36, 2, 2, 26 ], [ 2, 2, 2, 2, 2, 2,\[0X [4X 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 23, 23, 2, 2, 2, 2, 2, 2, \[0X [4X2, 2, 2, 2, 2, 2, 2, 21, 6 ] ],[ 4 ],[ 1 ]);;[0X [4Xgap> dclang3 := FAtoRatExp( dcaut3 );;[0X [4Xgap> Print( "Double Coset language of acceptor:\n", dclang3, "\n" );[0X [4XDouble Coset language of acceptor:[0X [4X(HbAbAbAbAbAbAbUHAb)(Ab)*(A(Ba(Ba)*bKUK)UK)UHbAbA(bA(bA(bA(bAKUK)UK)UK)UK)UH(A\[0X [4X(B(aB)*(abUA)KUK)UaKUb(a(Ba)*BA(bA(bA(bA(bA(bA(bA(bA)*(bKUK)UK)UK)UK)UK)UK)UK)\[0X [4XUAK)UK)[0X [4Xgap> ok := DCrules(dcrws3);;[0X [4Xgap> alph3e := dcrws3!.alphabet;;[0X [4Xgap> Print("H-rules:\n"); DisplayAsString( Hrules(dcrws3), alph3e, true );[0X [4XH-rules:[0X [4X[ HB, Ha ][0X [4X[ HaB, Hb ][0X [4X[ Hab, H ][0X [4X[ HbAB, HAba ][0X [4X[ HbAbAB, HAbAba ][0X [4X[ HbAbAbAB, HAbAbAba ][0X [4X[ HbAbAbAbAB, HAbAbAbAba ][0X [4X[ HbAbAbAbAbAB, HAbAbAbAbAba ][0X [4X[ HbAbAbAbAbAbAB, HAbAbAbAbAbAba ][0X [4Xgap> Print("K-rules:\n"); DisplayAsString( Krules(dcrws3), alph3e, true );[0X [4XK-rules:[0X [4X[ BK, aK ][0X [4X[ BaK, bK ][0X [4X[ baK, K ][0X [4X[ BAbK, abAK ][0X [4X[ BAbAbK, abAbAK ][0X [4X[ BAbAbAbK, abAbAbAK ][0X [4X[ BAbAbAbAbK, abAbAbAbAK ][0X [4X[ BAbAbAbAbAbK, abAbAbAbAbAK ][0X [4X[ BAbAbAbAbAbAbK, abAbAbAbAbAbAK ][0X [4Xgap> Print("HK-rules:\n"); DisplayAsString( HKrules(dcrws3), alph3e, true );[0X [4XHK-rules:[0X [4X[ HbK, HAK ][0X [4X[ HbAbK, HAbAK ][0X [4X[ HbAbAbK, HAbAbAK ][0X [4X[ HbAbAbAbK, HAbAbAbAK ][0X [4X[ HbAbAbAbAbK, HAbAbAbAbAK ][0X [4X[ HbAbAbAbAbAbK, HAbAbAbAbAbAK ][0X [4X[0X [4X------------------------------------------------------------------[0X [1X2.4-3 NextWord[0m [2X> NextWord( [0X[3Xdcrws, word[0X[2X ) _________________________________________[0Xoperation [2X> WordToString( [0X[3Xword, alph[0X[2X ) ______________________________________[0Xoperation [2X> DisplayAsString( [0X[3Xword, alph[0X[2X ) ___________________________________[0Xoperation [2X> IdentityDoubleCoset( [0X[3Xdcrws[0X[2X ) ____________________________________[0Xoperation These functions may be used to find normal forms of increasing length for double coset representatives. [4X--------------------------- Example ----------------------------[0X [4X[0X [4Xgap> len := 30;;[0X [4Xgap> L3 := 0*[1..len];;[0X [4Xgap> L3[1] := IdentityDoubleCoset( dcrws3 );;[0X [4Xgap> for i in [2..len] do[0X [4Xgap> L3[i] := NextWord( dcrws3, L3[i-1] );[0X [4Xgap> od;[0X [4Xgap> ## List of 30 normal forms for double cosets:[0X [4Xgap> DisplayAsString( L3, alph3e, true );[0X [4X[ HK, HAK, HaK, HAbK, HbAK, HABAK, HAbAK, HABabK, HAbAbK, HbAbAK, HbaBAK, HABa\[0X [4XBAK, HAbAbAK, HABaBabK, HAbABabK, HAbAbAbK, HbAbAbAK, HbaBAbAK, HbaBaBAK, HABa\[0X [4XBaBAK, HAbAbAbAK, HABaBaBabK, HAbABaBabK, HAbAbABabK, HAbAbAbAbK, HbAbAbAbAK, \[0X [4XHbaBAbAbAK, HbaBaBAbAK, HbaBaBaBAK, HABaBaBaBAK ][0X [4Xgap> w := NextWord( dcrws3, L3[30] );[0X [4Xm1*m3*m6*m3*m6*m3*m6*m3*m6*m3*m2[0X [4Xgap> s := WordToString( w, alph3e );[0X [4X"HAbAbAbAbAK"[0X [4X[0X [4X------------------------------------------------------------------[0X