  
  [1X7 [33X[0;0YSelf-similar groups, monoids and semigroups[133X[101X
  
  [33X[0;0YSelf-similar groups, monoids and semigroups (below [13XFR semigroups[113X) are simply
  groups,  monoids  and  semigroups  whose  elements  are  FR  machines.  They
  naturally  act on the alphabet of their elements, and on sequences over that
  alphabet.[133X
  
  [33X[0;0YMost  non-trivial  calculations  in  FR groups are performed as follows: [5XGAP[105X
  searches  through  words of short length in the generating set of a FR group
  to  find  a  solution  to  a  group-theoretic question, and at the same time
  searches  through  the  finite  quotients  to  prove  the  inexistence  of a
  solution.  Often the calculation ends with the answer [9Xfail[109X, which means that
  no  definite answer, neither positive nor negative, could be found; however,
  the cases where the calculation actually terminates have been most useful.[133X
  
  [33X[0;0YThe  maximal  length of words to consider in the search is controlled by the
  variable  [10XFR_SEARCH.radius[110X (initially 10), and the maximal depth of the tree
  in  which to search is controlled by the variable [10XFR_SEARCH.depth[110X (initially
  6).  These  limits  can be modified in any function call using [5XGAP[105X's options
  mechanism, e.g. in [10XIndex(G,H:FRdepth:=5,FRradius:=5)[110X.[133X
  
  
  [1X7.1 [33X[0;0YCreators for FR semigroups[133X[101X
  
  [33X[0;0YThe  most  straightforward creation method for FR groups is [10XGroup()[110X, applied
  with  FR elements as arguments. There are shortcuts to this somewhat tedious
  method:[133X
  
  [1X7.1-1 FRGroup[101X
  
  [33X[1;0Y[29X[2XFRGroup[102X( [3X{definition[103X, [3X}[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XFRMonoid[102X( [3X{definition[103X, [3X}[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XFRSemigroup[102X( [3X{definition[103X, [3X}[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA new self-similar group/monoid/semigroup.[133X
  
  [33X[0;0YThis function constructs a new FR group/monoid/semigroup, generated by group
  FR  elements.  It  receives as argument any number of strings, each of which
  represents a generator of the object to be constructed.[133X
  
  [33X[0;0YEach  [3Xdefinition[103X  is  of  the  form [10X"name=projtrans"[110X, where each of [10Xproj[110X and
  [10Xtrans[110X  is  optional.  [10Xproj[110X  is  of  the form [10X<w1,...,wd>[110X, where each [10Xwi[110X is a
  (possibly empty) word in the [10Xname[110Xs or is 1. [10Xtrans[110X is either a permutation in
  disjoint   cycle   notation,  or  a  list,  representing  the  images  of  a
  permutation.[133X
  
  [33X[0;0YThe last argument may be one of the filters [10XIsMealyElement[110X, [10XIsFRMealyElement[110X
  or  [10XIsFRElement[110X.  By  default,  if  each  of  the  states of generators is a
  generator  or  1, the elements of the created object will be Mealy elements;
  otherwise,  they will be FR elements. Specifying such a filter requires them
  to be in the appropriate category; e.g., [10XFRGroup("a=(1,2)",IsFRMealyElement)[110X
  asks  for  the  resulting  group  to  be generated by FR-Mealy elements. The
  generators must of course be finite-state.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFRGroup("a=(1,2)","b=(1,2,3,4,5)"); Size(last);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 5 ] with 2 generators>[128X[104X
    [4X[28X120[128X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(Dinfinity);[127X[104X
    [4X[28X#I  Assigned the global variables [ a, b ][128X[104X
    [4X[25Xgap>[125X [27XOrder(a); Order(b); Order(a*b);[127X[104X
    [4X[28X2[128X[104X
    [4X[28X2[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27XZZ := FRGroup("t=<,t>[2,1]");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[28Xtau := FRElement([[[b,1],[1]]],[()],[1]);[128X[104X
    [4X[28X<2|f3>[128X[104X
    [4X[25Xgap>[125X [27XIsSubgroup(Dinfinity,ZZ);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsSubgroup(Dinfinity^tau,ZZ);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIndex(Dinfinity^tau,ZZ);[127X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi4 := FRMonoid("s=(1,2)","f=<s,f>[1,1]");[127X[104X
    [4X[28X<self-similar monoid over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xf := GeneratorsOfMonoid(i4){[1,2]};;[127X[104X
    [4X[25Xgap>[125X [27Xfor i in [1..10] do Add(f,f[i]*f[i+1]); od;[127X[104X
    [4X[25Xgap>[125X [27Xf[1]^2=One(m);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[2]^3=f[2];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[11]*f[10]^2=f[1]*Product(f{[5,7..11]})*f[10];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[12]*f[11]^2=f[2]*Product(f{[6,8..12]})*f[11];[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi2 := FRSemigroup("f0=<f0,f0>(1,2)","f1=<f1,f0>[2,2]");[127X[104X
    [4X[28X<self-similar semigroup over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(i2);[127X[104X
    [4X[28X#I  Assigned the global variables [ "f0", "f1" ][128X[104X
    [4X[25Xgap>[125X [27Xf0^2=One(i2);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XForAll([0..10],p->(f0*f1)^p*(f1*f0)^p*f1=f1^2*(f0*f1)^p*(f1*f0)^p*f1);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.1-2 NewSemigroupFRMachine[101X
  
  [33X[1;0Y[29X[2XNewSemigroupFRMachine[102X( [3X...[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XNewMonoidFRMachine[102X( [3X...[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XNewGroupFRMachine[102X( [3X...[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA new FR machine, based on string descriptions.[133X
  
  [33X[0;0YThis  command  constructs  a  new FR machine, in a format similar to [2XFRGroup[102X
  ([14X7.1-1[114X);    namely,    the    arguments    are    strings    of   the   form
  "gen=<word-1,...,word-d>perm";  each [10Xword-i[110X is a word in the generators; and
  [10Xperm[110X  is  a  transformation,  either  written in disjoint cycle or in images
  notation.[133X
  
  [33X[0;0YExcept  in the semigroup case, [10Xword-i[110X is allowed to be the empty string; and
  the "<...>" may be skipped altogether. In the group or IMG case, each [10Xword-i[110X
  may also contain inverses.[133X
  
  [33X[0;0YThe following example constructs the "universal Grigorchuk machine".[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm := NewGroupFRMachine("a=(1,2)(3,4)(5,6)","b=<a,b,a,b,,b>",[127X[104X
    [4X[28X     "c=<a,c,,c,a,c>","d=<,d,a,d,a,d>");[128X[104X
    [4X[25Xgap>[125X [27X<FR machine with alphabet [ 1, 2, 3, 4, 5, 6 ] on Group( [ a, b, c, d ] )>[127X[104X
  [4X[32X[104X
  
  [1X7.1-3 SCGroup[101X
  
  [33X[1;0Y[29X[2XSCGroup[102X( [3Xm[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSCGroupNC[102X( [3Xm[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSCMonoid[102X( [3Xm[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSCMonoidNC[102X( [3Xm[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSCSemigroup[102X( [3Xm[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XSCSemigroupNC[102X( [3Xm[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe  state-closed  group/monoid/semigroup generated by the machine
            [3Xm[103X.[133X
  
  [33X[0;0YThis function constructs a new FR group/monoid/semigroup [10Xg[110X, generated by all
  the  states of the FR machine [3Xm[103X. There is a bijective correspondence between
  [10XGeneratorsOfFRMachine(m)[110X  and  the  generators of [10Xg[110X, which is accessible via
  [10XCorrespondence(g)[110X  (See  [2XCorrespondence[102X  ([14X7.1-4[114X)); it is a homomorphism from
  the  stateset  of  [3Xm[103X  to  [10Xg[110X,  or  a  list  indicating  for each state of [3Xm[103X a
  corresponding  generator  index  in  the generators of [10Xg[110X (with negatives for
  inverses, and 0 for identity).[133X
  
  [33X[0;0YIn  the  non-[10XNC[110X forms, redundant (equal, trivial or mutually inverse) states
  are removed from the generating set of [10Xg[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xb := MealyMachine([[3,2],[3,1],[3,3]],[(1,2),(),()]);; g := SCGroupNC(b);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XSize(g);[127X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27XIsOne(Comm(g.2,g.2^g.1));[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi4machine := MealyMachine([[3,3],[1,2],[3,3]],[(1,2),[1,1],()]);[127X[104X
    [4X[28X<Mealy machine on alphabet [ 1, 2 ] with 3 states>[128X[104X
    [4X[25Xgap>[125X [27XIsInvertible(i4machine);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27Xi4 := SCMonoidNC(i4machine);[127X[104X
    [4X[28X<self-similar monoid over [ 1 .. 2 ] with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xf := GeneratorsOfMonoid(i4){[1,2]};;[127X[104X
    [4X[25Xgap>[125X [27Xfor i in [1..10] do Add(f,f[i]*f[i+1]); od;[127X[104X
    [4X[25Xgap>[125X [27Xf[1]^2=One(m);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[2]^3=f[2];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[11]*f[10]^2=f[1]*Product(f{[5,7..11]})*f[10];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xf[12]*f[11]^2=f[2]*Product(f{[6,8..12]})*f[11];[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi2machine := MealyMachine([[1,1],[2,1]],[(1,2),[2,2]]);[127X[104X
    [4X[28X<Mealy machine on alphabet [ 1, 2 ] with 2 states>[128X[104X
    [4X[25Xgap>[125X [27Xi2 := SCSemigroupNC(i2machine);[127X[104X
    [4X[28X<self-similar semigroup over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xf0 := GeneratorsOfSemigroup(i2)[1];; f1 := GeneratorsOfSemigroup(i2)[2];;[127X[104X
    [4X[25Xgap>[125X [27Xf0^2=One(i2);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XForAll([0..10],p->(f0*f1)^p*(f1*f0)^p*f1=f1^2*(f0*f1)^p*(f1*f0)^p*f1);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.1-4 Correspondence[101X
  
  [33X[1;0Y[29X[2XCorrespondence[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA  correspondence  between  the  generators  of  the underlying FR
            machine of [3Xg[103X and [3Xg[103X.[133X
  
  [33X[0;0YIf  [3Xg[103X  was  created  as the state closure of an FR machine [10Xm[110X, this attribute
  records the correspondence between [10Xm[110X and [3Xg[103X.[133X
  
  [33X[0;0YIf  [10Xm[110X is a group/monoid/semigroup/algebra FR machine, then [10XCorrespondence(g)[110X
  is a homomorphism from the stateset of [10Xm[110X to [3Xg[103X.[133X
  
  [33X[0;0YIf [10Xm[110X is a Mealy or vector machine, then [10XCorrespondence(g)[110X is a list, with in
  position  [22Xi[122X  the  index  in  the generating set of [3Xg[103X of state number [22Xi[122X. This
  index  is  0  if  there  is  no corresponding generator because the state is
  trivial,  and is negative if there is no corresponding generator because the
  inverse of state number [22Xi[122X is a generator.[133X
  
  [33X[0;0YSee   [2XSCGroupNC[102X  ([14X7.1-3[114X),  [2XSCGroup[102X  ([14X7.1-3[114X),  [2XSCMonoidNC[102X  ([14X7.1-3[114X),  [2XSCMonoid[102X
  ([14X7.1-3[114X),  [2XSCSemigroupNC[102X  ([14X7.1-3[114X),  [2XSCSemigroup[102X ([14X7.1-3[114X), [2XSCAlgebraNC[102X ([14X8.1-2[114X),
  [2XSCAlgebra[102X  ([14X8.1-2[114X), [2XSCAlgebraWithOneNC[102X ([14X8.1-2[114X), and [2XSCAlgebraWithOne[102X ([14X8.1-2[114X)
  for examples.[133X
  
  [1X7.1-5 FullSCGroup[101X
  
  [33X[1;0Y[29X[2XFullSCGroup[102X( [3X...[103X ) [32X function[133X
  [33X[1;0Y[29X[2XFullSCMonoid[102X( [3X...[103X ) [32X function[133X
  [33X[1;0Y[29X[2XFullSCSemigroup[102X( [3X...[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA maximal state-closed group/monoid/semigroup on the alphabet [3Xa[103X.[133X
  
  [33X[0;0YThis function constructs a new FR group, monoid or semigroup, which contains
  all transformations with given properties of the tree with given alphabet.[133X
  
  [33X[0;0YThe  arguments  can  be,  in any order: a semigroup, specifying which vertex
  actions  are  allowed; a set or domain, specifying the alphabet of the tree;
  an  integer,  specifying  the  maximal depth of elements; and a filter among
  [2XIsFinitaryFRElement[102X       ([14X5.2-10[114X),       [2XIsBoundedFRElement[102X       ([14X5.2-12[114X),
  [2XIsPolynomialGrowthFRElement[102X ([14X5.2-13[114X) and [2XIsFiniteStateFRElement[102X ([14X4.2-12[114X).[133X
  
  [33X[0;0YThis  object  serves  as  a  container  for all FR elements with alphabet [3Xa[103X.
  Random  elements can be drawn from it; they are Mealy elements with a random
  number of states, and with the required properties.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg := FullSCGroup([1..3]);[127X[104X
    [4X[28XFullSCGroup([ 1 .. 3 ]);[128X[104X
    [4X[25Xgap>[125X [27XIsSubgroup(g,GuptaSidkiGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xg := FullSCGroup([1..3],Group((1,2,3)));[127X[104X
    [4X[28XFullSCGroup([ 1 .. 3 ], Group( [ (1,2,3) ] ))[128X[104X
    [4X[25Xgap>[125X [27XIsSubgroup(g,GuptaSidkiGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsSubgroup(g,GrigorchukGroup);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XRandom(g);[127X[104X
    [4X[28X<Mealy element on alphabet [ 1, 2, 3 ] with 2 states, initial state 1>[128X[104X
    [4X[25Xgap>[125X [27XSize(FullSCGroup([1,2],3));[127X[104X
    [4X[28X128[128X[104X
    [4X[25Xgap>[125X [27Xg := FullSCMonoid([1..2]);[127X[104X
    [4X[28XFullSCMonoid([ 1 .. 2 ])[128X[104X
    [4X[25Xgap>[125X [27XIsSubset(g,AsTransformation(FullSCGroup([1..2])));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsSubset(g,AsTransformation(GrigorchukGroup));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xg := FullSCSemigroup([1..3]);[127X[104X
    [4X[28XFullSCSemigroup([ 1 .. 3 ])[128X[104X
    [4X[25Xgap>[125X [27Xh := FullSCSemigroup([1..3],Semigroup(Transformation([1,1,1])));[127X[104X
    [4X[28XFullSCSemigroup([ 1 .. 3 ], Semigroup( [ [ 1, 1, 1 ] ] ))[128X[104X
    [4X[25Xgap>[125X [27XSize(h);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XIsSubset(g,h);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xg=FullSCMonoid([1..3]);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.1-6 FRMachineFRGroup[101X
  
  [33X[1;0Y[29X[2XFRMachineFRGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XFRMachineFRMonoid[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XFRMachineFRSemigroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMealyMachineFRGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMealyMachineFRMonoid[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMealyMachineFRSemigroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA machine describing all generators of [3Xg[103X.[133X
  
  [33X[0;0YThis function constructs a new group/monoid/semigroup/Mealy FR machine, with
  (at  least)  one  generator  per  generator of [3Xg[103X. This is done by adding all
  machines of all generators of [3Xg[103X, and minimizing.[133X
  
  [33X[0;0YIn particular, if [3Xg[103X is state-closed, then [10XSCGroup(FRMachineFRGroup(g))[110X gives
  a group isomorphic to [3Xg[103X, and similarly for monoids and semigroups.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFRMachineFRGroup(GuptaSidkiGroup);[127X[104X
    [4X[28X<FR machine with alphabet [ 1 .. 3 ] on Group( [ f11, f12 ] )>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(last);[127X[104X
    [4X[28X G   |     1          2        3[128X[104X
    [4X[28X-----+--------+----------+--------+[128X[104X
    [4X[28X f11 | <id>,2     <id>,3   <id>,1[128X[104X
    [4X[28X f12 |  f11,1   f11^-1,2    f12,3[128X[104X
    [4X[28X-----+--------+----------+--------+[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFRMachineFRMonoid(I4Monoid);[127X[104X
    [4X[28X<FR machine with alphabet [ 1 .. 2 ] on Monoid( [ m11, m12 ], ... )>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(last);[127X[104X
    [4X[28X M   |     1        2[128X[104X
    [4X[28X-----+--------+--------+[128X[104X
    [4X[28X m11 | <id>,2   <id>,1[128X[104X
    [4X[28X m12 |  m11,1    m12,1[128X[104X
    [4X[28X-----+--------+--------+[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFRMachineFRSemigroup(I2Monoid);[127X[104X
    [4X[28X<FR machine with alphabet [ 1 .. 2 ] on Semigroup( [ s11, s12, s1 ] )>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(last);[127X[104X
    [4X[28X S   |    1       2[128X[104X
    [4X[28X-----+-------+-------+[128X[104X
    [4X[28X s11 | s11,1   s11,2[128X[104X
    [4X[28X s12 | s12,2   s12,1[128X[104X
    [4X[28X  s1 |  s1,2   s12,2[128X[104X
    [4X[28X-----+-------+-------+[128X[104X
  [4X[32X[104X
  
  [1X7.1-7 IsomorphismFRGroup[101X
  
  [33X[1;0Y[29X[2XIsomorphismFRGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIsomorphismFRMonoid[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIsomorphismFRSemigroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn  isomorphism  towards  a  group/monoid/semigroup on a single FR
            machine.[133X
  
  [33X[0;0YThis  function  constructs  a  new  FR group/monoid/semigroup, such that all
  elements    of    the    resulting   object   have   the   same   underlying
  group/monoid/semigroup FR machine.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xphi := IsomorphismFRGroup(GuptaSidkiGroup);[127X[104X
    [4X[28X[ <Mealy element on alphabet [ 1, 2, 3 ] with 2 states, initial state 1>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1, 2, 3 ] with 4 states, initial state 1> ] ->[128X[104X
    [4X[28X[ <3|identity ...>, <3|f1>, <3|f1^-1>, <3|f2> ][128X[104X
    [4X[25Xgap>[125X [27XDisplay(GuptaSidkiGroup.2);[127X[104X
    [4X[28X   |  1     2     3[128X[104X
    [4X[28X---+-----+-----+-----+[128X[104X
    [4X[28X a | a,1   a,2   a,3[128X[104X
    [4X[28X b | a,2   a,3   a,1[128X[104X
    [4X[28X c | a,3   a,1   a,2[128X[104X
    [4X[28X d | b,1   c,2   d,3[128X[104X
    [4X[28X---+-----+-----+-----+[128X[104X
    [4X[28XInitial state: d[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GuptaSidkiGroup.2^phi);[127X[104X
    [4X[28X    |     1         2        3[128X[104X
    [4X[28X----+--------+---------+--------+[128X[104X
    [4X[28X f1 | <id>,2    <id>,3   <id>,1[128X[104X
    [4X[28X f2 |   f1,1   f1^-1,2     f2,3[128X[104X
    [4X[28X----+--------+---------+--------+[128X[104X
    [4X[28XInitial state: f2[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xphi := IsomorphismFRSemigroup(I2Monoid);[127X[104X
    [4X[28XMappingByFunction( I2, <self-similar semigroup over [ 1 .. 2 ] with[128X[104X
    [4X[28X3 generators>, <Operation "AsSemigroupFRElement"> )[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GeneratorsOfSemigroup(I2Monoid)[3]);[127X[104X
    [4X[28X   |  1     2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28X a | a,2   b,2[128X[104X
    [4X[28X b | b,2   b,1[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28XInitial state: a[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GeneratorsOfSemigroup(I2Monoid)[3]^phi);[127X[104X
    [4X[28X S  |   1      2[128X[104X
    [4X[28X----+------+------+[128X[104X
    [4X[28X s1 | s1,2   s2,2[128X[104X
    [4X[28X s2 | s2,2   s2,1[128X[104X
    [4X[28X----+------+------+[128X[104X
    [4X[28XInitial state: s1[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xphi := IsomorphismFRMonoid(I4Monoid);[127X[104X
    [4X[28XMappingByFunction( I4, <self-similar monoid over [ 1 .. 2 ] with[128X[104X
    [4X[28X2 generators>, <Operation "AsMonoidFRElement"> )[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GeneratorsOfMonoid(I4Monoid)[1]);[127X[104X
    [4X[28X   |  1     2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28X a | b,2   b,1[128X[104X
    [4X[28X b | b,1   b,2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28XInitial state: a[128X[104X
    [4X[25Xgap>[125X [27XDisplay(GeneratorsOfMonoid(I4Monoid)[1]^phi);[127X[104X
    [4X[28X M  |     1        2[128X[104X
    [4X[28X----+--------+--------+[128X[104X
    [4X[28X m1 | <id>,2   <id>,1[128X[104X
    [4X[28X----+--------+--------+[128X[104X
    [4X[28XInitial state: m1[128X[104X
  [4X[32X[104X
  
  [1X7.1-8 IsomorphismMealyGroup[101X
  
  [33X[1;0Y[29X[2XIsomorphismMealyGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIsomorphismMealyMonoid[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIsomorphismMealySemigroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn  isomorphism  towards  a  group/monoid/semigroup  all  of whose
            elements are Mealy machines.[133X
  
  [33X[0;0YThis  function  constructs  a  new  FR group/monoid/semigroup, such that all
  elements of the resulting object are Mealy machines.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FRGroup("a=(1,2)","b=<a,b>","c=<c,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xphi := IsomorphismMealyGroup(G);[127X[104X
    [4X[28X[ <2|a>, <2|b>, <2|c> ] ->[128X[104X
    [4X[28X[ <Mealy element on alphabet [ 1, 2 ] with 2 states, initial state 1>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1, 2 ] with 3 states, initial state 1>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1, 2 ] with 4 states, initial state 1> ][128X[104X
    [4X[25Xgap>[125X [27XDisplay(G.3);[127X[104X
    [4X[28X   |     1        2[128X[104X
    [4X[28X---+--------+--------+[128X[104X
    [4X[28X a | <id>,2   <id>,1[128X[104X
    [4X[28X b |    a,1      b,2[128X[104X
    [4X[28X c |    c,1      b,2[128X[104X
    [4X[28X---+--------+--------+[128X[104X
    [4X[28XInitial state: c[128X[104X
    [4X[25Xgap>[125X [27XDisplay(G.3^phi);[127X[104X
    [4X[28X   |  1     2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28X a | a,1   b,2[128X[104X
    [4X[28X b | c,1   b,2[128X[104X
    [4X[28X c | d,2   d,1[128X[104X
    [4X[28X d | d,1   d,2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28XInitial state: a[128X[104X
  [4X[32X[104X
  
  [1X7.1-9 FRGroupByVirtualEndomorphism[101X
  
  [33X[1;0Y[29X[2XFRGroupByVirtualEndomorphism[102X( [3Xhom[103X[, [3Xtransversal[103X] ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA new self-similar group.[133X
  
  [33X[0;0YThis  function  constructs a new FR group [10XP[110X, generated by group FR elements.
  Its  first  argument  is  a  virtual  endomorphism  of  a  group  [10XG[110X,  i.e. a
  homomorphism from a subgroup [10XH[110X to [10XG[110X. The constructed FR group acts on a tree
  with  alphabet  a  transversal  of  [10XH[110X in [10XG[110X (represented as [10X[1..d][110X), and is a
  homomorphic   image   of   [10XG[110X.  The  stabilizer  of  the  first-level  vertex
  corresponding  to  the  trivial  coset  is  the image of [10XH[110X. This function is
  loosely speaking an inverse of [2XVirtualEndomorphism[102X ([14X7.2-29[114X).[133X
  
  [33X[0;0YThe  optional  second  argument  is  a transversal of [10XH[110X in [10XG[110X, either of type
  [10XIsRightTransversal[110X or a list.[133X
  
  [33X[0;0YFurthermore,  an  option  "MealyElement"  can  be passed to the function, as
  [10XFRGroupByVirtualEndomorphism(f:MealyElement)[110X, to require the resulting group
  to  be  generated  by  Mealy  elements  and  not  FR elements. The call will
  succeed, of course, only if the representation of [10XG[110X is finite-state.[133X
  
  [33X[0;0YThe  resulting  FR  group  has an attribute [10XCorrespondence(P)[110X that records a
  homomorphism from [10XG[110X to [10XP[110X.[133X
  
  [33X[0;0YThe  example  below constructs the binary adding machine, and a non-standard
  representation of it.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FreeGroup(1);[127X[104X
    [4X[28X<free group on the generators [ f1 ]>[128X[104X
    [4X[25Xgap>[125X [27Xf := GroupHomomorphismByImages(Group(G.1^2),G,[G.1^2],[G.1]);[127X[104X
    [4X[28X[ f1^2 ] -> [ f1 ][128X[104X
    [4X[25Xgap>[125X [27XH := FRGroupByVirtualEndomorphism(f);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(H.1);[127X[104X
    [4X[28X    |     1      2[128X[104X
    [4X[28X----+--------+------+[128X[104X
    [4X[28X x1 | <id>,2   x1,1[128X[104X
    [4X[28X----+--------+------+[128X[104X
    [4X[28XInitial state: x1[128X[104X
    [4X[25Xgap>[125X [27XCorrespondence(H);[127X[104X
    [4X[28X[ f1 ] -> [ <2|x1> ][128X[104X
    [4X[25Xgap>[125X [27XH := FRGroupByVirtualEndomorphism(f,[G.1^0,G.1^3]);;[127X[104X
    [4X[25Xgap>[125X [27XDisplay(H.1);[127X[104X
    [4X[28X    |      1        2[128X[104X
    [4X[28X----+---------+--------+[128X[104X
    [4X[28X x1 | x1^-1,2   x1^2,1[128X[104X
    [4X[28X----+---------+--------+[128X[104X
    [4X[28XInitial state: x1[128X[104X
    [4X[25Xgap>[125X [27XH := FRGroupByVirtualEndomorphism(f:MealyElement);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(H.1);[127X[104X
    [4X[28X   |  1     2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28X a | b,2   a,1[128X[104X
    [4X[28X b | b,1   b,2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28XInitial state: a[128X[104X
  [4X[32X[104X
  
  [1X7.1-10 TreeWreathProduct[101X
  
  [33X[1;0Y[29X[2XTreeWreathProduct[102X( [3Xg[103X, [3Xh[103X, [3Xx0[103X, [3Xy0[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe tree-wreath product of groups [3Xg,h[103X.[133X
  
  [33X[0;0YThe tree-wreath product of two FR groups is a group generated by a copy of [3Xg[103X
  and of [3Xh[103X, in such a way that many conjugates of [3Xg[103X commute.[133X
  
  [33X[0;0YMore  formally,  assume  without loss of generality that all generators of [3Xg[103X
  are  states  of  a  machine  [10Xm[110X, and that all generators of [3Xh[103X are states of a
  machine  [10Xn[110X.  Then  the  tree-wreath  product  is  generated by the images of
  generators of [3Xg,h[103X in [10XTreeWreathProduct(m,n,x0,y0)[110X.[133X
  
  [33X[0;0YFor  the  operation  on  FR  machines  see [2XTreeWreathProduct[102X ([14X3.5-8[114X)). It is
  described  (with small variations, and in lesser generality) in [Sid05]. For
  example, in[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xw := TreeWreathProduct(AddingGroup(2),AddingGroup(2),1,1);[127X[104X
    [4X[28X<recursive group over [ 1 .. 4 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xa := w.1; b := w.2;[127X[104X
    [4X[28X<Mealy element on alphabet [ 1 .. 4 ] with 3 states>[128X[104X
    [4X[28X<Mealy element on alphabet [ 1 .. 4 ] with 2 states>[128X[104X
    [4X[25Xgap>[125X [27XOrder(a); Order(b);[127X[104X
    [4X[28Xinfinity[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27XForAll([-100..100],i->IsOne(Comm(a,a^(b^i))));[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [33X[0;0Ythe group [10Xw[110X is the wreath product [22XZ≀ Z[122X.[133X
  
  [1X7.1-11 WeaklyBranchedEmbedding[101X
  
  [33X[1;0Y[29X[2XWeaklyBranchedEmbedding[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA embedding of [3Xg[103X in a weakly branched group.[133X
  
  [33X[0;0YThis  function  constructs  a  new  FR  group, on alphabet the square of the
  alphabet  of  [3Xg[103X.  It  is  generated  by  the  canonical copy of [3Xg[103X and by the
  tree-wreath  product  of  [3Xg[103X with an adding machine on the same alphabet as [3Xg[103X
  (see  [2XTreeWreathProduct[102X ([14X7.1-10[114X)). The function returns a group homomorphism
  into this new FR group.[133X
  
  [33X[0;0YThe  main result of [SW03] is that the resulting group [22Xh[122X is weakly branched.
  More   precisely,   [22Xh'[122X   contains  [22X|X|^2[122X  copies  of  itself.  [10X  gap>  f  :=
  WeaklyBranchedEmbedding(BabyAleshinGroup);;  gap> Range(f); <recursive group
  over [ 1 .. 4 ] with 8 generators> [110X constructs a finitely generated branched
  group containing a free subgroup.[133X
  
  
  [1X7.2 [33X[0;0YOperations for FR semigroups[133X[101X
  
  [1X7.2-1 PermGroup[101X
  
  [33X[1;0Y[29X[2XPermGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XEpimorphismPermGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Y[An  epimorphism  to] the permutation group of [3Xg[103X's action on level
            [3Xl[103X.[133X
  
  [33X[0;0YThe first function returns a permutation group on [22Xd^l[122X points, where [22Xd[122X is the
  size  of  [3Xg[103X's  alphabet.  It has as many generators as [3Xg[103X, and represents the
  action of [3Xg[103X on the [3Xl[103Xth layer of the tree.[133X
  
  [33X[0;0YThe second function returns a homomorphism from [3Xg[103X to this permutation group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg := FRGroup("a=(1,2)","b=<a,>"); Size(g);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[28X8[128X[104X
    [4X[25Xgap>[125X [27XPermGroup(g,2);[127X[104X
    [4X[28XGroup([ (1,3)(2,4), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27XPermGroup(g,3);[127X[104X
    [4X[28XGroup([ (1,5)(2,6)(3,7)(4,8), (1,3)(2,4) ])[128X[104X
    [4X[25Xgap>[125X [27XList([1..6],i->LogInt(Size(PermGroup(GrigorchukGroup,i)),2));[127X[104X
    [4X[28X[ 1, 3, 7, 12, 22, 42 ][128X[104X
    [4X[25Xgap>[125X [27Xg := FRGroup("t=<,t>(1,2)"); Size(g);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27Xpi := EpimorphismPermGroup(g,5);[127X[104X
    [4X[28XMappingByFunction( <self-similar group over [ 1 .. 2 ] with 1 generator,[128X[104X
    [4X[28Xof size infinity>, Group([ (1,17,9,25,5,21,13,29,3,19,11,27,7,23,15,31,[128X[104X
    [4X[28X2,18,10,26,6,22,14,30,4,20,12,28,8,24,16,32) ]), function( w ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XOrder(g.1);[127X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27XOrder(g.1^pi);[127X[104X
    [4X[28X32[128X[104X
  [4X[32X[104X
  
  [1X7.2-2 PcGroup[101X
  
  [33X[1;0Y[29X[2XPcGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XEpimorphismPcGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Y[An epimorphism to] the pc group of [3Xg[103X's action on level [3Xl[103X.[133X
  
  [33X[0;0YThe  first  function returns a polycyclic group representing the action of [3Xg[103X
  on   the   [3Xl[103Xth  layer  of  the  tree.  It  converts  the  permutation  group
  [10XPermGroup(g,l)[110X to a Pc group, in which computations are often faster.[133X
  
  [33X[0;0YThe second function returns a homomorphism from [3Xg[103X to this pc group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg := PcGroup(GrigorchukGroup,7); time;[127X[104X
    [4X[28X<pc group with 5 generators>[128X[104X
    [4X[28X3370[128X[104X
    [4X[25Xgap>[125X [27XNormalClosure(g,Group(g.3)); time;[127X[104X
    [4X[28X<pc group with 79 generators>[128X[104X
    [4X[28X240[128X[104X
    [4X[25Xgap>[125X [27Xg := PermGroup(GrigorchukGroup,7); time;[127X[104X
    [4X[28X<permutation group with 5 generators>[128X[104X
    [4X[28X3[128X[104X
    [4X[25Xgap>[125X [27XNormalClosure(g,Group(g.3)); time;[127X[104X
    [4X[28X<permutation group with 5 generators>[128X[104X
    [4X[28X5344[128X[104X
    [4X[25Xgap>[125X [27Xg := FRGroup("t=<,t>(1,2)"); Size(g);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27Xpi := EpimorphismPcGroup(g,5);[127X[104X
    [4X[28XMappingByFunction( <self-similar group over [ 1 .. 2 ] with[128X[104X
    [4X[28X1 generator, of size infinity>, Group([ f1, f2, f3, f4, f5 ]), function( w ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XOrder(g.1);[127X[104X
    [4X[28Xinfinity[128X[104X
    [4X[25Xgap>[125X [27XOrder(g.1^pi);[127X[104X
    [4X[28X32[128X[104X
  [4X[32X[104X
  
  [1X7.2-3 TransformationMonoid[101X
  
  [33X[1;0Y[29X[2XTransformationMonoid[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XEpimorphismTransformationMonoid[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Y[An  epimorphism  to]  the  transformation monoid of [3Xg[103X's action on
            level [3Xl[103X.[133X
  
  [33X[0;0YThe first function returns a transformation monoid on [22Xd^l[122X points, where [22Xd[122X is
  the size of [3Xg[103X's alphabet. It has as many generators as [3Xg[103X, and represents the
  action of [3Xg[103X on the [3Xl[103Xth layer of the tree.[133X
  
  [33X[0;0YThe  second  function  returns  a homomorphism from [3Xg[103X to this transformation
  monoid.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi4 := SCMonoid(MealyMachine([[3,3],[1,2],[3,3]],[(1,2),[1,1],()]));[127X[104X
    [4X[28X<self-similar monoid over [ 1 .. 2 ] with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27Xg := TransformationMonoid(i4,6);[127X[104X
    [4X[28X<monoid with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XList([1..6],i->Size(TransformationMonoid(i4,i)));[127X[104X
    [4X[28X[ 4, 14, 50, 170, 570, 1882 ][128X[104X
    [4X[25Xgap>[125X [27XCollected(List(g,RankOfTransformation));[127X[104X
    [4X[28X[ [ 1, 64 ], [ 2, 1280 ], [ 4, 384 ], [ 8, 112 ], [ 16, 32 ], [ 32, 8 ], [ 64, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27Xpi := EpimorphismTransformationMonoid(i4,9);[127X[104X
    [4X[28XMappingByFunction( <self-similar monoid over [ 1 .. 2 ] with 3 generators>,[128X[104X
    [4X[28X<monoid with 3 generators>, function( w ) ... end )[128X[104X
    [4X[25Xgap>[125X [27Xf := GeneratorsOfMonoid(i4){[1,2]};;[127X[104X
    [4X[25Xgap>[125X [27Xfor i in [1..10] do Add(f,f[i]*f[i+1]); od;[127X[104X
    [4X[25Xgap>[125X [27XProduct(f{[3,5,7,9,11]})=f[11]*f[10];[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XProduct(f{[3,5,7,9,11]})^pi=(f[11]*f[10])^pi;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-4 TransformationSemigroup[101X
  
  [33X[1;0Y[29X[2XTransformationSemigroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XEpimorphismTransformationSemigroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Y[An  epimorphism to] the transformation semigroup of [3Xg[103X's action on
            level [3Xl[103X.[133X
  
  [33X[0;0YThe first function returns a transformation semigroup on [22Xd^l[122X points, where [22Xd[122X
  is  the size of [3Xg[103X's alphabet. It has as many generators as [3Xg[103X, and represents
  the action of [3Xg[103X on the [3Xl[103Xth layer of the tree.[133X
  
  [33X[0;0YThe  second  function  returns  a homomorphism from [3Xg[103X to this transformation
  semigroup.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xi2 := SCSemigroup(MealyMachine([[1,1],[2,1]],[(1,2),[2,2]]));[127X[104X
    [4X[28X<self-similar semigroup over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xg := TransformationSemigroup(i2,6);[127X[104X
    [4X[28X<semigroup with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XList([1..6],i->Size(TransformationSemigroup(i2,i)));[127X[104X
    [4X[28X[ 4, 14, 42, 114, 290, 706 ][128X[104X
    [4X[25Xgap>[125X [27XCollected(List(g,RankOfTransformation));[127X[104X
    [4X[28X[ [ 1, 64 ], [ 2, 384 ], [ 4, 160 ], [ 8, 64 ], [ 16, 24 ], [ 32, 8 ], [ 64, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27Xf0 := GeneratorsOfSemigroup(i2)[1];; f1 := GeneratorsOfSemigroup(i2)[2];;[127X[104X
    [4X[25Xgap>[125X [27Xpi := EpimorphismTransformationSemigroup(i2,10);[127X[104X
    [4X[28XMappingByFunction( <self-similar semigroup over [ 1 .. 2 ] with[128X[104X
    [4X[28X2 generators>, <semigroup with 2 generators>, function( w ) ... end )[128X[104X
    [4X[25Xgap>[125X [27X(f1*(f1*f0)^10)=((f1*f0)^10);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27X(f1*(f1*f0)^10)^pi=((f1*f0)^10)^pi;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-5 EpimorphismGermGroup[101X
  
  [33X[1;0Y[29X[2XEpimorphismGermGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XEpimorphismGermGroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA homomorphism to a polycyclic group.[133X
  
  [33X[0;0YThis  function  returns  an  epimorphism to a polycyclic group, encoding the
  action  on  the  first  [3Xl[103X levels of the tree and on the germs below. If [3Xl[103X is
  omitted, it is assumed to be [22X0[122X.[133X
  
  [33X[0;0YSince  the elements of [3Xg[103X are finite automata, they map periodic sequences to
  periodic sequences. The action on the periods, and in the immediate vicinity
  of  them,  is called the [13Xgerm action[113X of [3Xg[103X. This function returns the natural
  homomorphism  from  [3Xg[103X  to  the  wreath  product  of this germ group with the
  quotient of [3Xg[103X acting on the [3Xl[103Xth layer of the tree.[133X
  
  [33X[0;0YThe  germ  group,  by  default,  is  abelian. If it is finite, this function
  returns  a  homomorphism  to  a  Pc  group;  otherwise,  a homomorphism to a
  polycyclic group.[133X
  
  [33X[0;0YThe  [2XGrigorchukTwistedTwin[102X  ([14X9.1-12[114X)  is,  for  now, the only example with a
  hand-coded, non-abelian germ group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XEpimorphismGermGroup(GrigorchukGroup,0);[127X[104X
    [4X[28XMappingByFunction( GrigorchukGroup, <pc group of size 4 with 2 generators>,[128X[104X
    [4X[28X  function( g ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XList(GeneratorsOfGroup(GrigorchukGroup),x->x^last);[127X[104X
    [4X[28X[ <identity> of ..., f1, f1*f2, f2 ][128X[104X
    [4X[25Xgap>[125X [27XStructureDescription(Image(last2));[127X[104X
    [4X[28X"C2 x C2"[128X[104X
    [4X[25Xgap>[125X [27Xg := FRGroup("t=<,t>(1,2)","m=<,m^-1>(1,2)");;[127X[104X
    [4X[25Xgap>[125X [27XEpimorphismGermGroup(g,0);[127X[104X
    [4X[28XMappingByFunction( <state-closed, bounded group over [ 1, 2 ] with 2[128X[104X
    [4X[28X  generators>, Pcp-group with orders [ 0, 0 ], function( x ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XEpimorphismGermGroup(g,1);; Range(last); Image(last2);[127X[104X
    [4X[28XPcp-group with orders [ 2, 0, 0, 0, 0 ][128X[104X
    [4X[28XPcp-group with orders [ 2, 0, 0, 0 ][128X[104X
  [4X[32X[104X
  
  [1X7.2-6 GermData[101X
  
  [33X[1;0Y[29X[2XGermData[102X( [3Xgroup[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XGermValue[102X( [3Xelement[103X, [3Xdata[103X ) [32X operation[133X
  
  [33X[0;0YThe first command computes some data useful to determine the germ value of a
  group  element;  the  second  command  computes  these germ values. For more
  information on germs, see [2XGerms[102X ([14X5.2-24[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xdata := GermData(GrigorchukGroup);[127X[104X
    [4X[28Xrec( endo := [ f1, f2 ] -> [ f1*f2, f1 ], group := <pc group of size 4 with 2 generators>,[128X[104X
    [4X[28X  machines := [  ], map := [ <identity> of ..., f2, f1, f1*f2, <identity> of ... ],[128X[104X
    [4X[28X  nucleus := [ <Trivial Mealy element on alphabet [ 1 .. 2 ]>, d, c, b, a ],[128X[104X
    [4X[28X  nucleusmachine := <Mealy machine on alphabet [ 1 .. 2 ] with 5 states> )[128X[104X
    [4X[25Xgap>[125X [27XList(GeneratorsOfGroup(GrigorchukGroup),x->GermValue(x,data));[127X[104X
    [4X[28X[ <identity> of ..., f1*f2, f1, f2 ][128X[104X
  [4X[32X[104X
  
  [1X7.2-7 StabilizerImage[101X
  
  [33X[1;0Y[29X[2XStabilizerImage[102X( [3Xg[103X, [3Xv[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe group of all states at [3Xv[103X of elements of [3Xg[103X fixing [3Xv[103X.[133X
  
  [33X[0;0YThis  function constructs a new FR group, consisting of all states at vertex
  [3Xv[103X (which can be an integer or a list) of the stabilizer of [3Xv[103X in [3Xg[103X.[133X
  
  [33X[0;0YThe    result   is   [3Xg[103X   itself   precisely   if   [3Xg[103X   is   recurrent   (see
  [2XIsRecurrentFRSemigroup[102X ([14X7.2-11[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FRGroup("t=<,t>(1,2)","u=<,u^-1>(1,2)","b=<u,t>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XStabilizer(G,1);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfGroup(last);[127X[104X
    [4X[28X[ <2|u*t^-1>, <2|b>, <2|t^2>, <2|t*u>, <2|t*b*t^-1> ][128X[104X
    [4X[25Xgap>[125X [27XStabilizerImage(G,1);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfGroup(last);[127X[104X
    [4X[28X[ <2|identity ...>, <2|u>, <2|t>, <2|u^-1>, <2|t> ][128X[104X
  [4X[32X[104X
  
  [1X7.2-8 LevelStabilizer[101X
  
  [33X[1;0Y[29X[2XLevelStabilizer[102X( [3Xg[103X, [3Xn[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe fixator of the [3Xn[103Xth level of the tree.[133X
  
  [33X[0;0YThis  function  constructs the normal subgroup of [3Xg[103X that fixes the [3Xn[103Xth level
  of the tree.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FRGroup("t=<,t>(1,2)","a=(1,2)");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XLevelStabilizer(G,2);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 9 generators>[128X[104X
    [4X[25Xgap>[125X [27XIndex(G,last);[127X[104X
    [4X[28X8[128X[104X
    [4X[25Xgap>[125X [27XIsNormal(G,last2);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-9 IsStateClosed[101X
  
  [33X[1;0Y[29X[2XIsStateClosed[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if all states of elements of [3Xg[103X belong to [3Xg[103X.[133X
  
  [33X[0;0YThis  function  tests  whether  [3Xg[103X is a [13Xstate-closed[113X group, i.e. a group such
  that all states of all elements of [3Xg[103X belong to [3Xg[103X.[133X
  
  [33X[0;0YThe  smallest  state-closed group containing [3Xg[103X is computed with [2XStateClosure[102X
  ([14X7.2-10[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(Dinfinity);[127X[104X
    [4X[28X#I  Assigned the global variables [ a, b ][128X[104X
    [4X[25Xgap>[125X [27XIsStateClosed(Group(a));[127X[104X
    [4X[28X     IsStateClosed(Group(b));[128X[104X
    [4X[28X     IsStateClosed(Dinfinity);[128X[104X
    [4X[28Xtrue[128X[104X
    [4X[28Xfalse[128X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-10 StateClosure[101X
  
  [33X[1;0Y[29X[2XStateClosure[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe smallest state-closed group containing [3Xg[103X.[133X
  
  [33X[0;0YThis  function  computes  the  smallest  group  containing all states of all
  elements  of  [3Xg[103X,  i.e.  the  smallest  group  containing  [3Xg[103X  and  for  which
  [2XIsStateClosed[102X ([14X7.2-9[114X) returns [9Xtrue[109X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(Dinfinity);[127X[104X
    [4X[28X#I  Assigned the global variables [ a, b ][128X[104X
    [4X[25Xgap>[125X [27XStateStateClosure(Group(a))=Dinfinity; StateClosure(Group(b))=Dinfinity;[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-11 IsRecurrentFRSemigroup[101X
  
  [33X[1;0Y[29X[2XIsRecurrentFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is a recurrent group.[133X
  
  [33X[0;0YThis  function  returns  [9Xtrue[109X  if [3Xg[103X is a [13Xrecurrent[113X group, i.e. if, for every
  vertex [10Xv[110X, all elements of [3Xg[103X appear as states at [10Xv[110X of elements fixing [10Xv[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(Dinfinity);[127X[104X
    [4X[28X#I  Assigned the global variables [ a, b ][128X[104X
    [4X[25Xgap>[125X [27XIsRecurrentFRSemigroup(Group(a)); IsRecurrentFRSemigroup(Group(b));[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsRecurrentFRSemigroup(Dinfinity);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-12 IsLevelTransitiveFRGroup[101X
  
  [33X[1;0Y[29X[2XIsLevelTransitiveFRGroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is a level-transitive group.[133X
  
  [33X[0;0YThis  function  returns  [9Xtrue[109X  if [3Xg[103X is a [13Xlevel-transitive[113X group, i.e. if the
  action of [3Xg[103X is transitive at every level of the tree on which it acts.[133X
  
  [33X[0;0YThis function can be abbreviated as [10XIsLevelTransitive[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XAssignGeneratorVariables(Dinfinity);[127X[104X
    [4X[28X#I  Assigned the global variables [ a, b ][128X[104X
    [4X[25Xgap>[125X [27XIsLevelTransitiveFRGroup(Group(a)); IsLevelTransitiveFRGroup(Group(b));[127X[104X
    [4X[28X     IsLevelTransitiveFRGroup(Dinfinity);[128X[104X
    [4X[28Xfalse[128X[104X
    [4X[28Xfalse[128X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-13 IsInfinitelyTransitive[101X
  
  [33X[1;0Y[29X[2XIsInfinitelyTransitive[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsLevelTransitiveOnPatterns[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is infinitely transitive.[133X
  
  [33X[0;0YThis  function  returns  [9Xtrue[109X  if  [3Xg[103X is an [13Xinfinitely transitive[113X group. This
  means  that [3Xg[103X is the state-closed group of a bireversible Mealy machine (see
  [2XIsBireversible[102X  ([14X5.2-7[114X)), and that the action of the set of reduced words of
  any  given  length  over  the  alphabet (where "reduced" means no successive
  letters related by the involution) is transitive.[133X
  
  [33X[0;0YReduced  words  are defined as follows: if the underlying Mealy machine of [3Xg[103X
  has  an  involution  on  its alphabet (see [2XAlphabetInvolution[102X ([14X5.2-6[114X)), then
  reduced  words  are words in which two consecutive letters are not images of
  each other under the involution. If no involution is defined, then all words
  are   considered   reduced;   the   command   then   becomes  synonymous  to
  [2XIsLevelTransitiveFRGroup[102X ([14X7.2-12[114X).[133X
  
  [33X[0;0YThis  notion  is  of  fundamental  importance for the study of lattices in a
  product  of  trees; it implies under appropriate circumstances that the dual
  group is free.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsInfinitelyTransitive(BabyAleshinGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsLevelTransitiveFRGroup(BabyAleshinGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xs := DualMachine(BabyAleshinMachine);[127X[104X
    [4X[28X<Mealy machine on alphabet [ 1 .. 3 ] with 2 states>[128X[104X
    [4X[25Xgap>[125X [27XAlphabetInvolution(s); # set attribute[127X[104X
    [4X[28X[ 1, 2, 3 ][128X[104X
    [4X[25Xgap>[125X [27Xg := SCGroup(s);[127X[104X
    [4X[28X<state-closed group over [ 1 .. 3 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsInfinitelyTransitive(g);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsLevelTransitiveFRGroup(g);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X7.2-14 IsFinitaryFRSemigroup[101X
  
  [33X[1;0Y[29X[2XIsFinitaryFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsWeaklyFinitaryFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsBoundedFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsPolynomialGrowthFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsFiniteStateFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if all elements of [3Xg[103X have the required property.[133X
  
  [33X[0;0YThis  function returns [9Xtrue[109X if all elements of [3Xg[103X have the required property,
  as  FR elements; see [2XIsFinitaryFRElement[102X ([14X5.2-10[114X), [2XIsWeaklyFinitaryFRElement[102X
  ([14X5.2-23[114X),  [2XIsBoundedFRElement[102X ([14X5.2-12[114X), [2XIsPolynomialGrowthFRElement[102X ([14X5.2-13[114X)
  and [2XIsFiniteStateFRElement[102X ([14X4.2-12[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FRGroup("a=(1,2)","b=<a,b>","c=<c,b>","d=<d,d>(1,2)");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27XL := [Group(G.1),Group(G.1,G.2),Group(G.1,G.2,G.3),G];;[127X[104X
    [4X[25Xgap>[125X [27XList(L,IsFinitaryFRSemigroup);[127X[104X
    [4X[28X[ true, false, false, false ][128X[104X
    [4X[25Xgap>[125X [27XList(L,IsBoundedFRSemigroup);[127X[104X
    [4X[28X[ true, true, false, false ][128X[104X
    [4X[25Xgap>[125X [27XList(L,IsPolynomialGrowthFRSemigroup);[127X[104X
    [4X[28X[ true, true, true, false ][128X[104X
    [4X[25Xgap>[125X [27XList(L,IsFiniteStateFRSemigroup);[127X[104X
    [4X[28X[ true, true, true, true ][128X[104X
  [4X[32X[104X
  
  [1X7.2-15 Degree[101X
  
  [33X[1;0Y[29X[2XDegree[102X( [3Xg[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XDegreeOfFRSemigroup[102X( [3Xg[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XDepth[102X( [3Xg[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XDepthOfFRSemigroup[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YThe maximal degree/depth of elements of [3Xg[103X.[133X
  
  [33X[0;0YThis  function returns the maximal degree/depth of elements of [3Xg[103X; see [2XDegree[102X
  ([14X5.2-9[114X) and [2XDepth[102X ([14X5.2-11[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := FRGroup("a=(1,2)","b=<a,b>","c=<c,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XDegree(Group(G.1)); Degree(Group(G.1,G.2)); Degree(G);[127X[104X
    [4X[28X0[128X[104X
    [4X[28X1[128X[104X
    [4X[28X2[128X[104X
    [4X[25Xgap>[125X [27XDepth(Group(G.1)); Depth(Group(G.1,G.2)); Depth(G);[127X[104X
    [4X[28X1[128X[104X
    [4X[28Xinfinity[128X[104X
    [4X[28Xinfinity[128X[104X
  [4X[32X[104X
  
  [1X7.2-16 HasOpenSetConditionFRSemigroup[101X
  
  [33X[1;0Y[29X[2XHasOpenSetConditionFRSemigroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X has the open set condition.[133X
  
  [33X[0;0YThis function returns [9Xtrue[109X if all elements of [3Xg[103X have the [13Xopen set condition[113X,
  see [2XHasOpenSetConditionFRElement[102X ([14X5.2-25[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XHasOpenSetConditionFRSemigroup(GrigorchukGroup);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XHasOpenSetConditionFRSemigroup(BinaryAddingGroup);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-17 HasCongruenceProperty[101X
  
  [33X[1;0Y[29X[2XHasCongruenceProperty[102X( [3XG[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3XG[103X has the congruence property.[133X
  
  [33X[0;0YThis  function  returns  [9Xtrue[109X  if  the  transformation (semi)group [3XG[103X has the
  [13Xcongruence property[113X, namely if every homomorphism [22XG-> Q[122X to a finite quotient
  factors as [22XG-> H-> Q[122X via an action of [22XG[122X on a finite set.[133X
  
  [33X[0;0YThis command is not guaranteed to terminate.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XHasCongruenceProperty(GrigorchukGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XHasCongruenceProperty(GrigorchukTwistedTwin);[127X[104X
    [4X[28X...runs forever...[128X[104X
  [4X[32X[104X
  
  [1X7.2-18 IsContracting[101X
  
  [33X[1;0Y[29X[2XIsContracting[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is a contracting semigroup.[133X
  
  [33X[0;0YThis  function  returns  [9Xtrue[109X if [3Xg[103X is a [13Xcontracting[113X semigroup, i.e. if there
  exists  a  finite  subset [10XN[110X of [3Xg[103X such that the [2XLimitStates[102X ([14X4.2-11[114X) of every
  element of [3Xg[103X belong to [10XN[110X.[133X
  
  [33X[0;0YThe minimal such [10XN[110X can be computed with [2XNucleusOfFRSemigroup[102X ([14X7.2-19[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsContracting(Dinfinity);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-19 NucleusOfFRSemigroup[101X
  
  [33X[1;0Y[29X[2XNucleusOfFRSemigroup[102X( [3Xg[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XNucleus[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe nucleus of the contracting semigroup [3Xg[103X.[133X
  
  [33X[0;0YThis  function  returns the [13Xnucleus[113X of the contracting semigroup [3Xg[103X, i.e. the
  smallest  subset  [10XN[110X of [3Xg[103X such that the [2XLimitStates[102X ([14X4.2-11[114X) of every element
  of [3Xg[103X belong to [10XN[110X.[133X
  
  [33X[0;0YThis  function  returns  [9Xfail[109X if no such [10XN[110X exists. Usually, it loops forever
  without  being  able  to decide whether [10XN[110X is finite or infinite. It succeeds
  precisely when [10XIsContracting(g)[110X succeeds.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XNucleusOfFRSemigroup(Dinfinity);[127X[104X
    [4X[28X[ <2|identity ...>, <2|b>, <2|a> ][128X[104X
  [4X[32X[104X
  
  [1X7.2-20 NucleusMachine[101X
  
  [33X[1;0Y[29X[2XNucleusMachine[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YThe nucleus machine of the contracting semigroup [3Xg[103X.[133X
  
  [33X[0;0YThis  function  returns  the  [13Xnucleus[113X  of  the  contracting semigroup [3Xg[103X, see
  [2XNucleusOfFRSemigroup[102X ([14X7.2-19[114X), in the form of a Mealy machine.[133X
  
  [33X[0;0YSince  all states of the nucleus are elements of the nucleus, the transition
  and  output  function  may  be  restricted  to the nucleus, defining a Mealy
  machine.  Finitely generated recurrent groups are generated by their nucleus
  machine.[133X
  
  [33X[0;0YThis  function  returns  [9Xfail[109X if no such [10Xn[110X exists. Usually, it loops forever
  without  being  able  to decide whether [10Xn[110X is finite or infinite. It succeeds
  precisely when [10XIsContracting(g)[110X succeeds.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>");[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XM := NucleusMachine(Dinfinity);[127X[104X
    [4X[28X<Mealy machine on alphabet [ 1, 2 ] with 3 states>[128X[104X
    [4X[25Xgap>[125X [27XDisplay(M);[127X[104X
    [4X[28X   |  1     2[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[28X a | a,1   a,2[128X[104X
    [4X[28X b | c,1   b,2[128X[104X
    [4X[28X c | a,2   a,1[128X[104X
    [4X[28X---+-----+-----+[128X[104X
    [4X[25Xgap>[125X [27XDinfinity=SCGroup(M);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-21 AdjacencyBasesWithOne[101X
  
  [33X[1;0Y[29X[2XAdjacencyBasesWithOne[102X( [3Xg[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XAdjacencyPoset[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YThe bases, or the poset, of the simplicial model of [3Xg[103X.[133X
  
  [33X[0;0YFor these arguments, [3Xg[103X can be either the nucleus of an FR semigroup, or that
  semigroup itself, in which case its nucleus is first computed.[133X
  
  [33X[0;0YThe  first  function  computes  those maximal (for inclusion) subsets of the
  nucleus    that    are    recurrent,    namely    subsets    [10XB[110X   such   that
  [10XSet(B,x->States(x,v))=B[110X for a string [10Xv[110X.[133X
  
  [33X[0;0YThe second function then computes the poset of intersections of these bases,
  and returns it as a binary relation.[133X
  
  [33X[0;0YFor more details on these concepts, see [Nek08a].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xn := NucleusOfFRSemigroup(BasilicaGroup);[127X[104X
    [4X[28X[ <Trivial Mealy element on alphabet [ 1 .. 2 ]>, b,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X  <Mealy element on alphabet [ 1 .. 2 ] with 3 states> ][128X[104X
    [4X[25Xgap>[125X [27XAdjacencyBasesWithOne(n);[127X[104X
    [4X[28X[ [ <Trivial Mealy element on alphabet [ 1 .. 2 ]>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states> ],[128X[104X
    [4X[28X  [ <Trivial Mealy element on alphabet [ 1 .. 2 ]>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states> ],[128X[104X
    [4X[28X  [ <Trivial Mealy element on alphabet [ 1 .. 2 ]>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states>,[128X[104X
    [4X[28X      <Mealy element on alphabet [ 1 .. 2 ] with 3 states> ] ][128X[104X
    [4X[25Xgap>[125X [27XAdjacencyPoset(n);[127X[104X
    [4X[28X<general mapping: <object> -> <object> >[128X[104X
    [4X[25Xgap>[125X [27XDraw(HasseDiagramBinaryRelation(last));[127X[104X
  [4X[32X[104X
  
  [33X[0;0YThis produces (in a new window) the following picture:[133X
  
  [1X7.2-22 BranchingSubgroup[101X
  
  [33X[1;0Y[29X[2XBranchingSubgroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA branching subgroup of [3Xg[103X.[133X
  
  [33X[0;0YThis  function  searches for a subgroup [22Xk[122X of [3Xg[103X, such that [22Xk[122X contains [22Xk × ⋯ ×
  k[122X.[133X
  
  [33X[0;0YIt  searches  for  elements  in  larger  and  larger  balls  in  [3Xg[103X,  calling
  [2XFindBranchingSubgroup[102X ([14X7.2-23[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK := BranchingSubgroup(GrigorchukGroup);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 9 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsBranchingSubgroup(K);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsBranched(GrigorchukGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,K);[127X[104X
    [4X[28X16[128X[104X
  [4X[32X[104X
  
  [1X7.2-23 FindBranchingSubgroup[101X
  
  [33X[1;0Y[29X[2XFindBranchingSubgroup[102X( [3Xg[103X, [3Xl[103X, [3Xr[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA branching subgroup of [3Xg[103X.[133X
  
  [33X[0;0YThis  function  searches for a subgroup [22Xk[122X of [3Xg[103X, such that [22Xk[122X contains [22Xk × ⋯ ×
  k[122X.[133X
  
  [33X[0;0YThe  second  argument  [3Xl[103X  specifies the level at which branching must occur;
  i.e.  asks  to search for a subgroup [22Xk[122X such that [3Xg[103X contains [22Xk^d^l[122X where [22Xd[122X is
  the size of the alphabet. If [10Xl=infinity[110X, the resulting [22Xk[122X will be a regularly
  branched subgroup.[133X
  
  [33X[0;0YThe  third argument [3Xr[103X specifies the radius to explore in [3Xg[103X and all branching
  subgroups  at  levels  smaller  than  [3Xl[103X for elements with all level-1 states
  trivial except one.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XFindBranchingSubgroup(GrigorchukGroup,1,4);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 8 generators>[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,last);[127X[104X
    [4X[28X8[128X[104X
    [4X[25Xgap>[125X [27XFindBranchingSubgroup(GrigorchukGroup,2,4);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 6 generators>[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,last);[127X[104X
    [4X[28X16[128X[104X
    [4X[25Xgap>[125X [27XFindBranchingSubgroup(GrigorchukGroup,3,4);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 9 generators>[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,last);[127X[104X
    [4X[28X16[128X[104X
  [4X[32X[104X
  
  [1X7.2-24 IsBranched[101X
  
  [33X[1;0Y[29X[2XIsBranched[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X has a finite-index branching subgroup.[133X
  
  [33X[0;0YThis  function  returns [9Xtrue[109X if [3Xg[103X has a finite-index subgroup [22Xk[122X, such that [22Xk[122X
  contains [22Xk × ⋯ × k[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[28X<Example><![CDATA[[128X[104X
    [4X[25Xgap>[125X [27XK := BranchingSubgroup(GrigorchukGroup);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 9 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsBranchingSubgroup(K);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsBranched(GrigorchukGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,K);[127X[104X
    [4X[28X16[128X[104X
  [4X[32X[104X
  
  [1X7.2-25 IsBranchingSubgroup[101X
  
  [33X[1;0Y[29X[2XIsBranchingSubgroup[102X( [3Xk[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xk[103X is a branching subgroup.[133X
  
  [33X[0;0YThis function returns [9Xtrue[109X if [3Xk[103X contains [22Xk × ⋯ × k[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XK := BranchingSubgroup(GrigorchukGroup);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 9 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsBranchingSubgroup(K);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsBranched(GrigorchukGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIndex(GrigorchukGroup,K);[127X[104X
    [4X[28X16[128X[104X
  [4X[32X[104X
  
  [1X7.2-26 BranchStructure[101X
  
  [33X[1;0Y[29X[2XBranchStructure[102X( [3XG[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA record describing the branching of [3XG[103X.[133X
  
  [33X[0;0YThis  function  constructs a record with fields [10Xgroup,quo,set,top,wreath,epi[110X
  giving  respectively  a  group isomorphic to [10XG/K[110X, the quotient map from [10XG[110X to
  it, the alphabet of [10XG[110X, the group of permutations of the alphabet, the wreath
  product  of  [10Xgroup[110X  with  its  top  permutations,  and an epimorphism from a
  subgroup of [10Xwreath[110X to [10Xgroup[110X.[133X
  
  [33X[0;0YThis information is used as essential data on the branch group, and are used
  to construct e.g. its Zeta function.[133X
  
  [1X7.2-27 TopVertexTransformations[101X
  
  [33X[1;0Y[29X[2XTopVertexTransformations[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YThe transformations at the root under the action of [3Xg[103X.[133X
  
  [33X[0;0YThis   function   returns  the  permutation  group,  or  the  transformation
  group/semigroup/monoid,  of  all  activities  of all elements under the root
  vertex of the tree on which [3Xg[103X acts.[133X
  
  [33X[0;0YIt   is   a  synonym  for  [10XPermGroup(g,1)[110X  or  [10XTransformationMonoid(g,1)[110X  or
  [10XTransformationSemigroup(g,1)[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XTopVertexTransformations(GrigorchukGroup);[127X[104X
    [4X[28XGroup([ (), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27XIsTransitive(last,AlphabetOfFRSemigroup(GrigorchukGroup));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XTopVertexTransformations(FullSCMonoid([1..3]));[127X[104X
    [4X[28X<monoid with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XSize(last);[127X[104X
    [4X[28X27[128X[104X
  [4X[32X[104X
  
  [1X7.2-28 VertexTransformations[101X
  
  [33X[1;0Y[29X[2XVertexTransformations[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YThe transformations at all vertices under the action of [3Xg[103X.[133X
  
  [33X[0;0YThis   function   returns  the  permutation  group,  or  the  transformation
  group/monoid/semigroup, of all activities of all elements under all vertices
  of the tree on which [3Xg[103X acts.[133X
  
  [33X[0;0YThis  is  the  smallest  group/monoid/semigroup [10XP[110X such that [3Xg[103X is a subset of
  [10XFullSCGroup(AlphabetOfFRSemigroup(g),P)[110X                                   or
  [10XFullSCMonoid(AlphabetOfFRSemigroup(g),P)[110X                                  or
  [10XFullSCSemigroup(AlphabetOfFRSemigroup(g),P)[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XVertexTransformations(GuptaSidkiGroup);[127X[104X
    [4X[28XGroup([ (), (1,2,3), (1,3,2) ])[128X[104X
    [4X[25Xgap>[125X [27XTopVertexTransformations(Group(GuptaSidkiGroup.2));[127X[104X
    [4X[28XGroup(())[128X[104X
    [4X[25Xgap>[125X [27XVertexTransformations(Group(GuptaSidkiGroup.2));[127X[104X
    [4X[28XGroup([ (), (1,2,3), (1,3,2) ])[128X[104X
  [4X[32X[104X
  
  [1X7.2-29 VirtualEndomorphism[101X
  
  [33X[1;0Y[29X[2XVirtualEndomorphism[102X( [3Xg/m[103X, [3Xv[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe virtual endomorphism at vertex [3Xv[103X.[133X
  
  [33X[0;0YThis function returns the homomorphism from [10XStabilizer(g,v)[110X to [3Xg[103X, defined by
  computing   the   state   at  [3Xv[103X.  It  is  loosely  speaking  an  inverse  of
  [2XFRGroupByVirtualEndomorphism[102X ([14X7.1-9[114X).[133X
  
  [33X[0;0YThe first argument [3Xm[103X may also be an FR machine.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XA := SCGroup(MealyMachine([[2,1],[2,2]],[(1,2),()]));[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[25Xgap>[125X [27Xf := VirtualEndomorphism(A,1);[127X[104X
    [4X[28XMappingByFunction( <self-similar group over [ 1 .. 2 ] with[128X[104X
    [4X[28X1 generator>, <self-similar group over [ 1 .. 2 ] with[128X[104X
    [4X[28X1 generator>, function( g ) ... end )[128X[104X
    [4X[25Xgap>[125X [27X((A.1)^2)^f=A.1;[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XB := FRGroupByVirtualEndomorphism(f);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 1 generator>[128X[104X
    [4X[25Xgap>[125X [27XA=B;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-30 EpimorphismFromFpGroup[101X
  
  [33X[1;0Y[29X[2XEpimorphismFromFpGroup[102X( [3Xg[103X, [3Xl[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn epimorphism from a finitely presented group to [3Xg[103X.[133X
  
  [33X[0;0YFor  some  examples  of self-similar groups, a recursive presentation of the
  group  is coded into [5XFR[105X, and an approximate presentation is returned by this
  command,  together with a map onto the group [3Xg[103X. The argument [3Xl[103X roughly means
  the  number  of  iterates of an endomorphism were applied to a finite set of
  relators.  An  isomorphic group would be obtained by setting [10Xl=infinity[110X; for
  that purpose, see [2XIsomorphismSubgroupFpGroup[102X ([14X7.2-31[114X).[133X
  
  [33X[0;0YPreimages  can be computed, with [10XPreImagesRepresentativeNC[110X. They are usually
  reasonably  short  words,  though  by  no  means guaranteed to be of minimal
  length.[133X
  
  [33X[0;0YCurrently  this  command  is  implemented  through  an  ad  hoc  method  for
  [2XBinaryKneadingGroup[102X      ([14X9.1-2[114X),      [2XGrigorchukGroup[102X      ([14X9.1-10[114X)     and
  [2XGrigorchukOverGroup[102X ([14X9.1-11[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xf := EpimorphismFromFpGroup(GrigorchukGroup,1);[127X[104X
    [4X[28XMappingByFunction( <fp group on the generators[128X[104X
    [4X[28X[ a, b, c, d ]>, GrigorchukGroup, function( w ) ... end )[128X[104X
    [4X[28X4 gap> RelatorsOfFpGroup(Source(f));[128X[104X
    [4X[28X[ a^2, b^2, c^2, d^2, b*c*d, a*d*a*d*a*d*a*d, a^-1*c*a*c*a^-1*c*a*c*a^-1*c*a*c*a^[128X[104X
    [4X[28X    -1*c*a*c, a^-1*c^-1*a*b*a^-1*c*a*b*a^-1*c^-1*a*b*a^-1*c*a*b*a^-1*c^-1*a*b*a^-1*[128X[104X
    [4X[28X    c*a*b*a^-1*c^-1*a*b*a^-1*c*a*b, a*d*a*c*a*c*a*d*a*c*a*c*a*d*a*c*a*c*a*d*a*c*a*c,[128X[104X
    [4X[28X  a^-1*c*a*c*a^-1*c*a*b*a^-1*c*a*b*a^-1*c*a*c*a^-1*c*a*b*a^-1*c*a*b*a^-1*c*a*c*a^[128X[104X
    [4X[28X    -1*c*a*b*a^-1*c*a*b*a^-1*c*a*c*a^-1*c*a*b*a^-1*c*a*b ][128X[104X
    [4X[25Xgap>[125X [27XPreImagesRepresentativeNC(f,Comm(GrigorchukGroup.1,GrigorchukGroup.2));[127X[104X
    [4X[28Xa*c*a*d*a*d*a*c[128X[104X
    [4X[25Xgap>[125X [27XSource(f).4^f=GrigorchukGroup.4;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.2-31 IsomorphismSubgroupFpGroup[101X
  
  [33X[1;0Y[29X[2XIsomorphismSubgroupFpGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XAsSubgroupFpGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIsomorphismLpGroup[102X( [3Xg[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XAsLpGroup[102X( [3Xg[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn  isomorphism to a subgroup of a finitely presented group, or an
            L-presented group.[133X
  
  [33X[0;0YFor  some  examples  of self-similar groups, a recursive presentation of the
  group  is coded into [5XFR[105X, and is returned by this command. The group [3Xg[103X itself
  sits  as  a  subgroup  of  a  finitely presented group. To obtain a finitely
  presented   group  approximating  [3Xg[103X,  see  [2XEpimorphismFromFpGroup[102X  ([14X7.2-30[114X).
  PreImages  can  also  be  computed; it is usually better to use [10XPreImageElm[110X,
  since the word problem may not be solvable by [5XGAP[105X in the f.p. group.[133X
  
  [33X[0;0YCurrently  this  command  is  implemented  through  an  ad  hoc  method  for
  [2XBinaryKneadingGroup[102X  ([14X9.1-2[114X),  [2XGrigorchukGroup[102X ([14X9.1-10[114X), [2XGrigorchukOverGroup[102X
  ([14X9.1-11[114X),    generalized    [2XGuptaSidkiGroups[102X    ([14X9.1-18[114X)   and   generalized
  [2XFabrykowskiGuptaGroups[102X ([14X9.1-21[114X).[133X
  
  [33X[0;0YThe second form returns an isomorphism to an L-presented group (see [Bar03a]
  and [BEH08]. It requires the package [5XNQL[105X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xf := IsomorphismSubgroupFpGroup(BasilicaGroup);[127X[104X
    [4X[28XMappingByFunction( BasilicaGroup, Group([ a^-1, a*t^-1*a^-1*t*a^-1[128X[104X
    [4X[28X ]), function( g ) ... end, function( w ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XRange(f);[127X[104X
    [4X[28XGroup([ a^-1, a*t^-1*a^-1*t*a^-1 ])[128X[104X
    [4X[25Xgap>[125X [27Xc := Comm(BasilicaGroup.1,BasilicaGroup.2);[127X[104X
    [4X[28X<Mealy element on alphabet [ 1, 2 ] with 9 states, initial state 1>[128X[104X
    [4X[25Xgap>[125X [27Xc^f;[127X[104X
    [4X[28Xt^-2*a*t^-1*a*t*a^-2*t*a*t^-2*a*t^-1*a*t*a^-1*t*a*t^-1*a*t^-2*[128X[104X
    [4X[28Xa^-1*t*a*t^-1*a*t^-1*a^-1*t*a^-1*t^5*a*t^-1*a^-1*t*a^-1[128X[104X
    [4X[25Xgap>[125X [27XPreImageElm(f,last);[127X[104X
    [4X[28X<Mealy element on alphabet [ 1, 2 ] with 9 states, initial state 1>[128X[104X
    [4X[25Xgap>[125X [27Xlast=c;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X7.3 [33X[0;0YProperties for infinite groups[133X[101X
  
  [1X7.3-1 IsTorsionGroup[101X
  
  [33X[1;0Y[29X[2XIsTorsionGroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is a torsion group.[133X
  
  [33X[0;0YThis function returns [9Xtrue[109X if [3Xg[103X is a torsion group, i.e. if every element in
  [3Xg[103X has finite order; and [9Xfalse[109X if [3Xg[103X contains an element of infinite order.[133X
  
  [33X[0;0YThis method is quite rudimentary, and is not guaranteed to terminate. At the
  minimum,  [3Xg[103X should be a group in which [10XOrder()[110X succeeds in computing element
  orders; e.g. a bounded group in Mealy machine format.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>":IsMealyElement);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsTorsionGroup(Dinfinity);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsTorsionGroup(GrigorchukGroup); IsTorsionGroup(GuptaSidkiGroup);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsTorsionGroup(FabrykowskiGuptaGroup);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X7.3-2 IsTorsionFreeGroup[101X
  
  [33X[1;0Y[29X[2XIsTorsionFreeGroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is a torsion-free group.[133X
  
  [33X[0;0YThis  function returns [9Xtrue[109X if [3Xg[103X is a torsion-free group, i.e. if no element
  in [3Xg[103X has finite order; and [9Xfalse[109X if [3Xg[103X contains an element of finite order.[133X
  
  [33X[0;0YThis method is quite rudimentary, and is not guaranteed to terminate. At the
  minimum,  [3Xg[103X should be a group in which [10XOrder()[110X succeeds in computing element
  orders; e.g. a bounded group in Mealy machine format.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XDinfinity := FRGroup("a=(1,2)","b=<a,b>":IsMealyElement);[127X[104X
    [4X[28X<self-similar group over [ 1 .. 2 ] with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27XIsTorsionFreeGroup(Dinfinity);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsTorsionFreeGroup(BasilicaGroup);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.3-3 IsAmenableGroup[101X
  
  [33X[1;0Y[29X[2XIsAmenableGroup[102X( [3Xg[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X is an amenable group.[133X
  
  [33X[0;0YAmenable  groups,  introduced  by  von Neumann [vN29], are those groups that
  admit a finitely additive, translation-invariant measure.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsAmenableGroup(FreeGroup(2));[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsAmenableGroup(BasilicaGroup);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.3-4 IsVirtuallySimpleGroup[101X
  
  [33X[1;0Y[29X[2XIsVirtuallySimpleGroup[102X( [3Xg[103X ) [32X property[133X
  [33X[1;0Y[29X[2XLambdaElementVHGroup[102X( [3Xg[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xg[103X admits a finite-index simple subgroup.[133X
  
  [33X[0;0YThis  function  attempts  to prove that the VH group [3Xg[103X admits a finite-index
  simple subgroup.[133X
  
  [33X[0;0YIt  is  based  on  the  following  test:  let  [10XD[110X be a direction (vertical or
  horizontal) such that the corresponding action is infinitely transitive (see
  [2XIsInfinitelyTransitive[102X   ([14X7.2-13[114X)).  If  the  corresponding  subgroup  of  [3Xg[103X
  contains  a  non-trivial  element [22Xλ[122X that acts trivially in the corresponding
  action, then every normal subgroup contains [22Xλ[122X. It then remains to check that
  the  normal  closure of [22Xλ[122X has finite index. This element [22Xλ[122X is then stored as
  the attribute [10XLambdaElementVHGroup(g)[110X.[133X
  
  [33X[0;0YThe  current  implementation is based on results in [BM00a] and [BM00b], and
  does not work for the Rattaggi examples (see [2XRattaggiGroup[102X ([14X9.1-24[114X)).[133X
  
  [1X7.3-5 IsResiduallyFinite[101X
  
  [33X[1;0Y[29X[2XIsResiduallyFinite[102X( [3Xobj[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xobj[103X is residually finite.[133X
  
  [33X[0;0YAn object is [13Xresidually finite[113X if it can be approximated arbitrarily well by
  finite  quotients;  i.e. if for every [22Xg≠ h∈ X[122X there exists a finite quotient
  [22Xπ:X-> Q[122X such that [22Xg^π≠ h^π[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsResiduallyFinite(FreeGroup(2));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsResiduallyFinite(BasilicaGroup);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.3-6 IsSQUniversal[101X
  
  [33X[1;0Y[29X[2XIsSQUniversal[102X( [3Xobj[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xobj[103X is SQ-universal.[133X
  
  [33X[0;0YAn object [3Xobj[103X is [13XSQ-universal[113X if every countable object of the same category
  as [3Xobj[103X is a subobject of a quotient of [3Xobj[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsSQUniversal(FreeGroup(2));[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X7.3-7 IsJustInfinite[101X
  
  [33X[1;0Y[29X[2XIsJustInfinite[102X( [3Xobj[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X if [3Xobj[103X is just-infinite.[133X
  
  [33X[0;0YAn object [3Xobj[103X is [13Xjust-infinite[113X if [3Xobj[103X is infinite, but every quotient of [3Xobj[103X
  is finite.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XIsJustInfinite(FreeGroup(2));[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsJustInfinite(FreeGroup(1));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsJustInfinite(GrigorchukGroup); time[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[28X8284[128X[104X
  [4X[32X[104X
  
