  
  [1X6. The Algorithms Implemented in RCWA[0X
  
  This  chapter lists brief descriptions of many of the algorithms and methods
  implemented  in  this package. These descriptions are kept very informal and
  short,  and  some  of  them  provide  only rudimentary information. They are
  listed in alphabetical order. The word "trivial" as a description means that
  essentially  nothing  is  done except of storing or recalling one or several
  values, and "straightforward" means that no sophisticated algorithm is used.
  Note  that  "trivial" and "straightforward" are to be read as [13Xmathematically[0X
  trivial  respectively  straightforward,  and  that the code of a function or
  method  attributed in this way can still be reasonably long and complicated.
  Longer  and better descriptions of many of the algorithms and methods can be
  found in [Koh07b].
  
  [8X
      [10XActionOnRespectedPartition([3XG[0X)[0X
    [0X
        "Straightforward"  after  having  computed  a  respected  partition by
        [10XRespectedPartition[0X.  One  only  needs to know how to compute images of
        residue classes under affine mappings.
  
  [8X
      [10XBall([3XG[0X,[3Xg[0X,[3Xr[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XBall([3XG[0X,[3Xp[0X,[3Xr[0X,[3Xact[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XClassPairs[0X
    [0X
        Run  over  all  4-tuples,  and  filter  by divisibility criteria, size
        comparisons, ordering of the entries etc.
  
  [8X
      [10XClassReflection([3Xr[0X,[3Xm[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XClassRotation([3Xr[0X,[3Xm[0X,[3Xu[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XClassShift([3Xr[0X,[3Xm[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XClassTransposition([3Xr1[0X,[3Xm1[0X,[3Xr2[0X,[3Xm2[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XClassWiseOrderPreservingOn([3Xf[0X)[0X, etc.
    [0X
        Forms  the  union  of  the  residue classes modulo the modulus of [3Xf[0X in
        whose  corresponding  coefficient  triple the first entry is positive,
        zero or negative, respectively.
  
  [8X
      [10XCoefficients([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XCommonRightInverse([3Xl[0X,[3Xr[0X)[0X
    [0X
        (See [10XRightInverse[0X.)
  
  [8X
      [10XCT([3XR[0X)[0X
    [0X
        Attributes and properties are set according to [Koh06a].
  
  [8X
      [10XDecreasingOn([3Xf[0X)[0X
    [0X
        Forms  the  union  of  the residue classes which are determined by the
        coefficients as indicated.
  
  [8X
      [10XDerivedSubgroup([3XG[0X)[0X
    [0X
        No genuine method -- [5XGAP[0X Library methods already work for tame groups.
  
  [8X
      [10XDeterminant([3Xg[0X)[0X
    [0X
        Evaluation  of  the  given  expression.  For  the mathematical meaning
        (epimorphism!), see Theorem 2.11.9 in [Koh05].
  
  [8X
      [10XDirectProduct([3XG1[0X,[3XG2[0X, ... )[0X
    [0X
        Restricts  the  groups  [3XG1[0X,  [3XG2[0X,  ... to disjoint residue classes. See
        [10XRestriction[0X and Corollary 2.3.3 in [Koh05].
  
  [8X
      [10XDisplay([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XDivisor([3Xf[0X)[0X
    [0X
        Lcm of coefficients, as indicated.
  
  [8X
      [10XDrawOrbitPicture[0X
    [0X
        Compute spheres of radius 1, dots, r around the given point(s). Choose
        the  origin  either  in  the  lower left corner of the picture (if all
        points  lie in the first quadrant) or in the middle of the picture (if
        they  don't).  Mark  points of the ball with black pixels in case of a
        monochrome  picture. Choose colors from the given palette depending on
        the distance from the starting points in case of a colored picture.
  
  [8X
      [10XEpimorphismFromFpGroup([3XG[0X,[3Xr[0X)[0X
    [0X
        If   the   package   [5XFR[0X [Bar07]  is  loaded,  then  use  its  function
        [10XFindGroupRelations[0X  to  find  relations. Otherwise proceed as follows:
        First  compute  the  ball of radius [3Xr[0X around 1 in the free group whose
        rank  is the number of stored generators of [3XG[0X. Then compute the images
        of  the  elements  of  that ball under the natural projection onto the
        group [3XG[0X. Take pairs of elements of the ball whose images coincide, and
        add  their  quotients  to the set of known relations. For images which
        have  finite  order,  add  the corresponding power relations. Finally,
        regardless  of  whether  [5XFR[0X  is  present or not, simplify the finitely
        presented  group  with  the  determined  relations  by  the  operation
        [10XIsomorphismSimplifiedFpGroup[0X  from  the  [5XGAP[0X  Library,  and return the
        natural epimorphism from it to [3XG[0X.
  
  [8X
      [10XExponent([3XG[0X)[0X
    [0X
        Check  whether [3XG[0X is finite. If it is, then use the [5XGAP[0X Library method,
        applied to [10XImage(IsomorphismPermGroup([3XG[0X))[0X. Check whether [3XG[0X is tame. If
        yes,  return  [10Xinfinity[0X.  If  not,  run  a loop over [3XG[0X until finding an
        element of infinite order. Once one is found, return [10Xinfinity[0X.
  
        The  final  loop  to find a non-torsion element can be left away under
        the  assumption that any finitely generated wild rcwa group has a wild
        element.  It  looks  likely  that this holds, but currently the author
        does not know a proof.
  
  [8X
      [10XFactorizationIntoCSCRCT([3Xg[0X)[0X
    [0X
        This uses a rather sophisticated method which will likely some time be
        published  elsewhere. At the moment termination is not guaranteed, but
        in  case of termination the result is certain. The strategy is roughly
        first  to  make  the mapping class-wise order-preserving and balanced,
        and  then  to remove all prime factors from multiplier and divisor one
        after  the  other in decreasing order by dividing by appropriate class
        transpositions.  The remaining integral mapping can be factored almost
        similarly easily as a permutation of a finite set can be factored into
        transpositions.
  
  [8X
      [10XFactorizationOnConnectedComponents([3Xf[0X,[3Xm[0X)[0X
    [0X
        Calls  [5XGRAPE[0X  to get the connected components of the transition graph,
        and  then  computes a partition of the suitably "blown up" coefficient
        list corresponding to the connected components.
  
  [8X
      [10XFixedPointsOfAffinePartialMappings([3Xf[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XGluckTaylorInvariant([3Xa[0X([0X
    [0X
        Evaluation of the given expression.
  
  [8X
      [10XGuessedDivergence([3Xf[0X)[0X
    [0X
        Numerical  computation  of  the  limit  of some series, which seems to
        converge "often". Caution!!!
  
  [8X
      [10XImage([3Xf[0X)[0X, [10XImage([3Xf[0X,[3XS[0X)[0X
    [0X
        "Straightforward"  if  one can compute images of residue classes under
        affine  mappings  and  unite  and  intersect  residue classes (Chinese
        Remainder Theorem). See Lemma 1.2.1 in [Koh05].
  
  [8X
      [10XImageDensity([3Xf[0X)[0X
    [0X
        Evaluation of the given expression.
  
  [8X
      [10X[3Xg[0X in [3XG[0X[0X (membership test for rcwa groups)
    [0X
        Test whether the mapping [3Xg[0X or its inverse is in the list of generators
        of [3XG[0X. If it is, return [10Xtrue[0X. Test whether its prime set is a subset of
        the  prime set of [3XG[0X. If not, return [10Xfalse[0X. Test whether the multiplier
        or  the  divisor  of [3Xg[0X  has  a  prime factor which does not divide the
        multiplier  of [3XG[0X.  If  yes,  return  [10Xfalse[0X.  Test  if  [3XG[0X is class-wise
        order-preserving,  and [3Xg[0X is not. If so, return [10Xfalse[0X. Test if the sign
        of  [3Xg[0X is -1 and all generators of [3XG[0X have sign 1. If yes, return [10Xfalse[0X.
        Test  if  [3XG[0X  is  class-wise order-preserving, all generators of [3XG[0X have
        determinant 0  and  [3Xg[0X has determinant <> 0. If yes, return [10Xfalse[0X. Test
        whether  the  support  of [3Xg[0X  is  a subset of the support of [3XG[0X. If not,
        return  [10Xfalse[0X.  Test whether [3XG[0X fixes the nonnegative integers setwise,
        but [3Xg[0X does not. If yes, return [10Xfalse[0X.
  
        If  [3XG[0X  is  tame,  proceed  as  follows:  Test whether the modulus of [3Xg[0X
        divides  the  modulus  of  [3XG[0X.  If not, return [10Xfalse[0X. Test whether [3XG[0X is
        finite  and  [3Xg[0X has infinite order. If so, return [10Xfalse[0X. Test whether [3Xg[0X
        is  tame.  If  not, return [10Xfalse[0X. Compute a respected partition [10XP[0X of [3XG[0X
        and   the  finite  permutation  group  [10XH[0X  induced  by  [3XG[0X  on  it  (see
        [10XRespectedPartition[0X). Check whether [3Xg[0X permutes [10XP[0X. If not, return [10Xfalse[0X.
        Let [10Xh[0X be the permutation induced by [3Xg[0X on [10XP[0X. Check whether [10Xh[0X lies in [10XH[0X.
        If  not,  return  [10Xfalse[0X.  Compute  an  element [10Xg1[0X of [3XG[0X which acts on [10XP[0X
        like [3Xg[0X.  For  this  purpose,  factor  [3Xh[0X  into  generators  of [10XH[0X  using
        [10XPreImagesRepresentative[0X,  and  compute  the  corresponding  product of
        generators  of [3XG[0X.  Let  [10Xk  :=  g/g1[0X. The mapping [10Xk[0X is always integral.
        Compute    the    kernel [10XK[0X   of   the   action   of   [3XG[0X   on [10XP[0X   using
        [10XKernelOfActionOnRespectedPartition[0X. Check whether [10Xk[0X lies in [10XK[0X. This is
        done using the package [5XPolycyclic[0X [EN06], and uses an isomorphism from
        a  supergroup of  [10XK[0X which is isomorphic to the [10X|P|[0X-fold direct product
        of  the  infinite  dihedral  group  and  which  always contains [10Xk[0X to a
        polycyclically presented group. If [10Xk[0X lies in [10XK[0X, return [10Xtrue[0X, otherwise
        return [10Xfalse[0X.
  
        If  [3XG[0X is not tame, proceed as follows: Look for finite orbits of [3XG[0X. If
        some  are  found, test whether [3Xg[0X acts on them, and whether the induced
        permutations lie in the permutation groups induced by [3XG[0X. If for one of
        the  examined  orbits  one  of the latter two questions has a negative
        answer,  then  return [10Xfalse[0X. Look for a positive integer m such that [3Xg[0X
        does not leave a partition of Z into unions of residue classes (mod m)
        invariant  which  is  fixed by [3XG[0X. If successful, return [10Xfalse[0X. If not,
        try to factor [3Xg[0X into generators of [3XG[0X using [10XPreImagesRepresentative[0X. If
        successful,  return [10Xtrue[0X. If [3Xg[0X is in [3XG[0X, this terminates after a finite
        number  of steps. Both runtime and memory requirements are exponential
        in  the  word  length. If [3Xg[0X is not in [3XG[0X at this stage, the method runs
        into an infinite loop.
  
  [8X
      [10X[3Xf[0X in [3XM[0X[0X (membership test for rcwa monoids)
    [0X
        Test  whether  the  mapping [3Xf[0X is in the list of generators of [3XG[0X. If it
        is,  return  [10Xtrue[0X.  Test  whether the multiplier of [3Xf[0X is zero, but all
        generators of [3XM[0X have nonzero multiplier. If yes, return [10Xfalse[0X. Test if
        neither [3Xf[0X  nor  any  generator  of [3XM[0X has multiplier zero. If so, check
        whether  the  prime  set  of [3Xf[0X  is a subset of the prime set of [3XM[0X, and
        whether the set of prime factors of the multiplier of [3Xf[0X is a subset of
        the  union  of  the  sets  of  prime factors of the multipliers of the
        generators  of [3XM[0X. If one of these is not the case, return [10Xfalse[0X. Check
        whether  the  set  of prime factors of the divisor of [3Xf[0X is a subset of
        the  union  of  the  sets  of  prime  factors  of  the divisors of the
        generators  of [3XM[0X. If not, return [10Xfalse[0X. If the underlying ring is Z or
        a  semilocalization  thereof,  then  check whether [3Xf[0X is not class-wise
        order-preserving, but [3XM[0X is. If so, return [10Xfalse[0X.
  
        If [3Xf[0X is not injective, but all generators of [3XM[0X are, then return [10Xfalse[0X.
        If  [3Xf[0X  is  not  surjective,  but  all generators of [3XM[0X are, then return
        [10Xfalse[0X.  If  the support of [3Xf[0X is not a subset of the support of [3XM[0X, then
        return  [10Xfalse[0X.  If  [3Xf[0X  is  not  sign-preserving, but [3XM[0X is, then return
        [10Xfalse[0X. Check whether [3XM[0X is tame. If so, then return [10Xfalse[0X provided that
        one  of  the following three conditions hold: 1. The modulus of [3Xf[0X does
        not  divide  the modulus of [3XM[0X. 2. [3Xf[0X is not tame. 3. [3XM[0X is finite, and [3Xf[0X
        is  bijective and has infinite order. If membership has still not been
        decided,  use  [10XShortOrbits[0X  to  look for finite orbits of [3XM[0X, and check
        whether  [3Xf[0X fixes all of them setwise. If a finite orbit is found which
        [3Xf[0X does not map to itself, then return [10Xfalse[0X.
  
        Finally  compute  balls of increasing radius around 1 until [3Xf[0X is found
        to  lie  in  one  of  them.  If  that happens, return [10Xtrue[0X. If [3Xf[0X is an
        element  of [3XM[0X,  this will eventually terminate, but if at this stage [3Xf[0X
        is not an element of [3XM[0X, this will run into an infinite loop.
  
  [8X
      [10X[3Xpoint[0X in [3Xorbit[0X[0X (membership test for orbits)
    [0X
        Uses  the  equality  test for orbits: The orbit equality test computes
        balls of increasing radius around the orbit representatives until they
        intersect  nontrivially. Once they do so, it returns [10Xtrue[0X. If it finds
        that  one  or  both  of  the  orbits  are finite, it makes use of that
        information,  and returns [10Xfalse[0X if appropriate. In between, i.e. after
        having  computed balls to a certain extent depending on the properties
        of  the  group,  it  chooses  a suitable modulus m and computes orbits
        (modulo m). If the representatives of the orbits to be compared belong
        to different orbits (mod m), it returns [10Xfalse[0X. If this is not the case
        although  the  orbits  are  different,  the equality test runs into an
        infinite loop.
  
  [8X
      [10XIncreasingOn([3Xf[0X)[0X
    [0X
        Forms  the  union  of  the residue classes which are determined by the
        coefficients as indicated.
  
  [8X
      [10XIndex([3XG[0X,[3XH[0X)[0X
    [0X
        In  general, i.e. if the underlying ring is not Z, proceed as follows:
        If  both  groups  [3XG[0X  and [3XH[0X  are  finite,  return the quotient of their
        orders.  If [3XG[0X is infinite, but [3XH[0X is finite, return [10Xinfinity[0X. Otherwise
        return  the  number  of  right  cosets  of [3XH[0X in [3XG[0X, computed by the [5XGAP[0X
        Library function [10XRightCosets[0X.
  
        If  the  underlying  ring  is Z,  do additionally the following before
        attempting  to  compute  the  list  of right cosets: If the group [3XG[0X is
        class-wise  order-preserving,  check whether one of its generators has
        nonzero   determinant,   and   whether   all   generators   of [3XH[0X  have
        determinant zero.  If  so,  then  return  [10Xinfinity[0X. Check whether [3XH[0X is
        tame,  but  [3XG[0X  is not. If so, then return [10Xinfinity[0X. If [3XG[0X is tame, then
        check  whether  the  rank  of the largest free abelian subgroup of the
        kernel  of the action of [3XG[0X on a respected partition is higher than the
        corresponding      rank     for [3XH[0X.     For     this     check,     use
        [10XRankOfKernelOfActionOnRespectedPartition[0X.   If   it  is,  then  return
        [10Xinfinity[0X.
  
  [8X
      [10XInduction([3Xg[0X,[3Xf[0X)[0X
    [0X
        Computes [10Xf * g * RightInverse([3Xf[0X)[0X.
  
  [8X
      [10XInduction([3XG[0X,[3Xf[0X)[0X
    [0X
        Gets  a set of generators by applying [10XInduction([3Xg[0X,[3Xf[0X)[0X to the generators
        [3Xg[0X of [3XG[0X.
  
  [8X
      [10XInjectiveAsMappingFrom([3Xf[0X)[0X
    [0X
        The  function starts with the entire source of [3Xf[0X as "preimage" [10Xpre[0X and
        the  empty  set  as  "image" [10Xim[0X.  It  loops  over  the residue classes
        (mod [10XMod([3Xf[0X)[0X).  For  any  such  residue class [10Xcl[0X the following is done:
        Firstly,  the  image  of  [10Xcl[0X  under [3Xf[0X  is  added  to [10Xim[0X. Secondly, the
        intersection  of  the  preimage of the intersection of the image of [10Xcl[0X
        under [3Xf[0X and [10Xim[0X under [3Xf[0X and [10Xcl[0X is subtracted from [10Xpre[0X.
  
  [8X
      [10XIntegralConjugate([3Xf[0X)[0X, 
      [10XIntegralConjugate([3XG[0X)[0X
    [0X
        Uses   the   algorithm   described  in  the  proof  of  Theorem 2.5.14
        in [Koh05].
  
  [8X
      [10XIntegralizingConjugator([3Xf[0X)[0X, 
      [10XIntegralizingConjugator([3XG[0X)[0X
    [0X
        Uses   the   algorithm   described  in  the  proof  of  Theorem 2.5.14
        in [Koh05].
  
  [8X
      [10XInverse([3Xf[0X)[0X
    [0X
        Essentially  inversion  of  affine mappings. See Lemma 1.3.1, Part (b)
        in [Koh05].
  
  [8X
      [10XIsBalanced([3Xf[0X)[0X
    [0X
        Checks  whether  the  sets  of prime factors of the multiplier and the
        divisor of [3Xf[0X are the same.
  
  [8X
      [10XIsClassReflection([3Xg[0X)[0X
    [0X
        Computes the support of [3Xg[0X, and compares [3Xg[0X with the corresponding class
        reflection.
  
  [8X
      [10XIsClassRotation([3Xg[0X)[0X
    [0X
        Computes  the support of [3Xg[0X, extracts the possible rotation factor from
        the coefficients and compares [3Xg[0X with the corresponding class rotation.
  
  [8X
      [10XIsClassShift([3Xg[0X)[0X
    [0X
        Computes the support of [3Xg[0X, and compares [3Xg[0X with the corresponding class
        shift.
  
  [8X
      [10XIsClassTransposition([3Xg[0X)[0X
    [0X
        Computes  the  support  of [3Xg[0X,  writes  it  as  a disjoint union of two
        residue  classes  and  compares [3Xg[0X  with  the class transposition which
        interchanges them.
  
  [8X
      [10XIsClassWiseOrderPreserving([3Xf[0X)[0X
    [0X
        Tests whether the first entry of all coefficient triples is positive.
  
  [8X
      [10XIsConjugate(RCWA(Integers),[3Xf[0X,[3Xg[0X)[0X
    [0X
        Test  whether  [3Xf[0X and [3Xg[0X have the same order, and whether either both or
        none of them is tame. If not, return [10Xfalse[0X.
  
        If  the mappings are wild, use [10XShortCycles[0X to search for finite cycles
        not  belonging  to  an  infinite  series,  until  their  numbers for a
        particular  length  differ.  This may run into an infinite loop. If it
        terminates, return [10Xfalse[0X.
  
        If  the  mappings  are  tame, use the method described in the proof of
        Theorem 2.5.14 in [Koh05] to construct integral conjugates of [3Xf[0X and [3Xg[0X.
        Then   essentially  use  the  algorithm  described  in  the  proof  of
        Theorem 2.6.7  in [Koh05] to compute "standard representatives" of the
        conjugacy  classes which the integral conjugates of [3Xf[0X and [3Xg[0X belong to.
        Finally  compare  these  standard  representatives, and return [10Xtrue[0X if
        they are equal and [10Xfalse[0X if not.
  
  [8X
      [10XIsInjective([3Xf[0X)[0X
    [0X
        See [10XImage[0X.
  
  [8X
      [10XIsIntegral([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XIsomorphismMatrixGroup([3XG[0X)[0X
    [0X
        Uses the algorithm described in the proof of Theorem 2.6.3 in [Koh05].
  
  [8X
      [10XIsomorphismPermGroup([3XG[0X)[0X
    [0X
        If  the  group  [3XG[0X  is  finite  and  class-wise  order-preserving,  use
        [10XActionOnRespectedPartition[0X.   If  [3XG[0X  is  finite,  but  not  class-wise
        order-preserving,  compute the action on the respected partition which
        is    obtained    by    splitting    any   residue   class   r(m)   in
        [10XRespectedPartition([3XG[0X[0X   into  three  residue  classes  r(3m),  r+m(3m),
        r+2m(3m).  If  [3XG[0X  is  infinite,  there  is  no isomorphism to a finite
        permutation group, thus return [10Xfail[0X.
  
  [8X
      [10XIsomorphismRcwaGroup([3XG[0X)[0X
    [0X
        The method for finite groups uses [10XRcwaMapping[0X, Part (d).
  
        The  method  for  free products of finite groups uses the Table-Tennis
        Lemma  (which is also known as [13XPing-Pong Lemma[0X, cp. e.g. Section II.B.
        in [dlH00]).  It  uses  regular  permutation  representations  of  the
        factors  G_r (r = 0, dots ,m-1) of the free product on residue classes
        modulo n_r := |G_r|. The basic idea is that since point stabilizers in
        regular  permutation groups are trivial, all non-identity elements map
        any  of  the  permuted  residue classes into their complements. To get
        into  a  situation  where  the  Table-Tennis  Lemma is applicable, the
        method  computes conjugates of the images of the mentioned permutation
        representations  under  bijective  rcwa mappings sigma_r which satisfy
        0(n_r)^sigma_r = Z \ r(m).
  
        The  method  for  free  groups  uses an adaptation of the construction
        given on page 27 in [dlH00] from PSL(2,C) to RCWA(Z). As an equivalent
        for  the closed discs used there, the method takes the residue classes
        modulo two times the rank of the free group.
  
  [8X
      [10XIsPerfect([3XG[0X)[0X
    [0X
        If  the  group  [3XG[0X  is  trivial,  then  return [10Xtrue[0X. Otherwise if it is
        abelian, then return [10Xfalse[0X.
  
        If  the  underlying  ring  is Z,  then do the following: If one of the
        generators  of [3XG[0X  has  sign -1,  then return [10Xfalse[0X. If [3XG[0X is class-wise
        order-preserving  and  one  of the generators has nonzero determinant,
        then return [10Xfalse[0X.
  
        If  [3XG[0X  is wild, and perfectness has not been decided so far, then give
        up.  If  [3XG[0X  is finite, then check the image of [10XIsomorphismPermGroup([3XG[0X)[0X
        for perfectness, and return [10Xtrue[0X or [10Xfalse[0X accordingly.
  
        If  the  group [3XG[0X  is  tame  and  if it acts transitively on its stored
        respected  partition,  then  return [10Xtrue[0X or [10Xfalse[0X depending on whether
        the  finite permutation group [10XActionOnRespectedPartition([3XG[0X)[0X is perfect
        or  not.  If [3XG[0X  does  not  act  transitively  on  its stored respected
        partition, then give up.
  
  [8X
      [10XIsPrimeSwitch([3Xg[0X)[0X
    [0X
        Checks  whether  the  multiplier  of [3Xg[0X is an odd prime, and compares [3Xg[0X
        with the corresponding prime switch.
  
  [8X
      [10XIsSignPreserving([3Xf[0X)[0X
    [0X
        If  [3Xf[0X is not class-wise order-preserving, then return [10Xfalse[0X. Otherwise
        let  c  >=  1  be greater than or equal to the maximum of the absolute
        values of the coefficients b_r(m) of the affine partial mappings of [3Xf[0X,
        and  check  whether  the minimum of the image of 0, dots, c under [3Xf[0X is
        nonnegative  and  whether  the  maximum  of  the image of -c, dots, -1
        under [3Xf[0X  is negative. If both is the case, then return [10Xtrue[0X, otherwise
        return [10Xfalse[0X.
  
  [8X
      [10XIsSolvable([3XG[0X)[0X
    [0X
        If  [3XG[0X  is abelian, then return [10Xtrue[0X. If [3XG[0X is tame, then return [10Xtrue[0X or
        [10Xfalse[0X  depending  on whether [10XActionOnRespectedPartition([3XG[0X)[0X is solvable
        or not. If [3XG[0X is wild, then give up.
  
  [8X
      [10XIsSubset([3XG[0X,[3XH[0X)[0X (checking for a subgroup relation)
    [0X
        Check whether the set of stored generators of [3XH[0X is a subset of the set
        of stored generators of [3XG[0X. If so, return [10Xtrue[0X. Check whether the prime
        set  of [3XH[0X  is  a  subset  of the prime set of [3XG[0X. If not, return [10Xfalse[0X.
        Check  whether  the  support  of [3XH[0X is a subset of the support of [3XG[0X. If
        not,  return  [10Xfalse[0X.  Check  whether  [3XG[0X is tame, but [3XH[0X is wild. If so,
        return [10Xfalse[0X.
  
        If  [3XG[0X  and [3XH[0X are both tame, then proceed as follows: If the multiplier
        of [3XH[0X does not divide the multiplier of [3XG[0X, then return [10Xfalse[0X. If [3XH[0X does
        not  respect  the  stored respected partition of [3XG[0X, then return [10Xfalse[0X.
        Check   whether   the   finite  permutation  group  induced  by  [3XH[0X  on
        [10XRespectedPartition([3XG[0X)[0X  is a subgroup of [10XActionOnRespectedPartition([3XG[0X)[0X.
        If  yes, return [10Xtrue[0X. Check whether the order of [3XH[0X is greater than the
        order of [3XG[0X. If so, return [10Xfalse[0X.
  
        Finally  use  the membership test to check whether all generators of [3XH[0X
        lie in [3XG[0X, and return [10Xtrue[0X or [10Xfalse[0X accordingly.
  
  [8X
      [10XIsSurjective([3Xf[0X)[0X
    [0X
        See [10XImage[0X.
  
  [8X
      [10XIsTame([3XG[0X)[0X
    [0X
        Checks whether the modulus of the group is nonzero.
  
  [8X
      [10XIsTame([3Xf[0X)[0X
    [0X
        Application  of  the criteria given in Corollary 2.5.10 and 2.5.12 and
        Theorem A.8  and A.11  in [Koh05],  as  well  as of the criteria given
        in [Koh07a].  The criterion "surjective, but not injective means wild"
        (Theorem A.8 in [Koh05]) is the subject of [Koh06b]. The package [5XGRAPE[0X
        is needed for the application of the criterion which says that an rcwa
        permutation  is  wild  if  a  transition  graph has a weakly-connected
        component   which   is   not   strongly-connected   (cp.  Theorem A.11
        in [Koh05]).
  
  [8X
      [10XIsTransitive([3XG[0X,Integers)[0X
    [0X
        Look for finite orbits, using [10XShortOrbits[0X on a couple of intervals. If
        a  finite  orbit  is found, return [10Xfalse[0X. Test if [3XG[0X is finite. If yes,
        return [10Xfalse[0X.
  
        Search  for  an  element  [10Xg[0X  and  a  residue  class r(m) such that the
        restriction of [10Xg[0X to r(m) is given by n -> n + m. Then the cyclic group
        generated  by  [10Xg[0X  acts transitively on r(m). The element [10Xg[0X is searched
        among  the generators of [3XG[0X, its powers, its commutators, powers of its
        commutators  and  products of few different generators. The search for
        such  an  element  may  run  into  an  infinite  loop,  as there is no
        guarantee that the group has a suitable element.
  
        If suitable [10Xg[0X and r(m) are found, proceed as follows:
  
        Put  S  :=  r(m).  Put  S  := S cup S^g for all generators g of [3XG[0X, and
        repeat  this  until  S remains constant. This may run into an infinite
        loop.
  
        If it terminates: If S = Z, return [10Xtrue[0X, otherwise return [10Xfalse[0X.
  
  [8X
      [10XKernelOfActionOnRespectedPartition([3XG[0X)[0X
    [0X
        First  determine  the  abelian  invariants  of the kernel [10XK[0X. For this,
        compute  sufficiently  many  quotients of orders of permutation groups
        induced by [3XG[0X on refinements of the stored respected partition [10XP[0X by the
        order  of  the  permutation group induced by [3XG[0X on [10XP[0X itself. Then use a
        random   walk   through  the  group  [3XG[0X.  Compute  powers  of  elements
        encountered along the way which fix [10XP[0X. Translate these kernel elements
        into  elements  of  a polycyclically presented group isomorphic to the
        [10X|P|[0X-fold  direct  product  of the infinite dihedral group ([10XK[0X certainly
        embeds  into this group). Use [5XPolycyclic[0X [EN06] to collect independent
        "nice"  generators  of [10XK[0X. Proceed until the permutation groups induced
        by [10XK[0X  on  the  refined  respected  partitions  all equal the initially
        stored quotients.
  
  [8X
      [10XLargestSourcesOfAffineMappings([3Xf[0X)[0X
    [0X
        Forms  unions  of  residue  classes modulo the modulus of the mapping,
        whose corresponding coefficient triples are equal.
  
  [8X
      [10XLaTeXObj([3Xf[0X)[0X
    [0X
        Collects  residue  classes those corresponding coefficient triples are
        equal.
  
  [8X
      [10XLikelyContractionCentre([3Xf[0X,[3Xmaxn[0X,[3Xbound[0X)[0X
    [0X
        Computes  trajectories  with  starting  values  from a given interval,
        until  a  cycle  is  reached.  Aborts  if  the  trajectory exceeds the
        prescribed bound. Form the union of the detected cycles.
  
  [8X
      [10XLocalizedRcwaMapping([3Xf[0X,[3Xp[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XLoops([3Xf[0X)[0X
    [0X
        Runs  over  the  residue  classes modulo the modulus of [3Xf[0X, and selects
        those  of them which [3Xf[0X does not map to themselves, but which intersect
        nontrivially with their images under [3Xf[0X.
  
  [8X
      [10XmKnot([3Xm[0X)[0X
    [0X
        "Straightforward", following the definition given in [Kel99].
  
  [8X
      [10XModulus([3XG[0X)[0X
    [0X
        Searches  for  a  wild element in the group. If unsuccessful, tries to
        construct a respected partition (see [10XRespectedPartition[0X).
  
  [8X
      [10XModulus([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XMovedPoints([3XG[0X)[0X
    [0X
        Needs  only  forming  unions  of residue classes and determining fixed
        points of affine mappings.
  
  [8X
      [10XMultiplier([3Xf[0X)[0X
    [0X
        Lcm of coefficients, as indicated.
  
  [8X
      [10XMultpk([3Xf[0X,[3Xp[0X,[3Xk[0X)[0X
    [0X
        Forms  the  union  of  the  residue  classes modulo the modulus of the
        mapping,  which  are determined by the given divisibility criteria for
        the coefficients of the corresponding affine mapping.
  
  [8X
      [10XNrConjugacyClassesOfRCWAZOfOrder([3Xord[0X)[0X
    [0X
        The class numbers are taken from Corollary 2.7.1 in [Koh05].
  
  [8X
      [10XOrbit([3XG[0X,[3Xpnt[0X,[3Xgens[0X,[3Xacts[0X,[3Xact[0X)[0X
    [0X
        Check  if  the orbit has length less than a certain bound. If so, then
        return  it  as  a  list. Otherwise test whether the group [3XG[0X is tame or
        wild.
  
        If  [3XG[0X is tame, then test whether [3XG[0X is finite. If yes, then compute the
        orbit by the [5XGAP[0X Library method. Otherwise proceed as follows: Compute
        a  respected  partition mathcalP  of [3XG[0X. Use mathcalP to find a residue
        class r(m)  which is a subset of the orbit to be computed. In general,
        r(m)  will not be one of the residue classes in mathcalP, but a subset
        of one of them. Put Omega := r(m). Unite the set Omega with its images
        under  all  the  generators of [3XG[0X and their inverses. Repeat that until
        Omega does not change any more. Return Omega.
  
        If  [3XG[0X  is  wild, then return an orbit object which stores the group [3XG[0X,
        the representative [3Xrep[0X and the action [3Xact[0X.
  
  [8X
      [10XOrbitsModulo([3Xf[0X,[3Xm[0X)[0X
    [0X
        Uses  [5XGRAPE[0X  to  compute  the  connected  components of the transition
        graph.
  
  [8X
      [10XOrbitsModulo([3XG[0X,[3Xm[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XOrder([3Xf[0X)[0X
    [0X
        Test  for  [10XIsTame[0X.  If  the mapping is not tame, then return [10Xinfinity[0X.
        Otherwise use Corollary 2.5.10 in [Koh05].
  
  [8X
      [10XPreImage([3Xf[0X,[3XS[0X)[0X
    [0X
        See [10XImage[0X.
  
  [8X
      [10XPreImagesRepresentative([3Xphi[0X,[3Xg[0X)[0X,
      [10XPreImagesRepresentatives([3Xphi[0X,[3Xg[0X)[0X
    [0X
        As  indicated  in  the  documentation of these methods. The underlying
        idea  to  successively  compute  two  balls  around 1 and [3Xg[0X until they
        intersect non-trivially is standard in computational group theory. For
        rcwa  groups it would mean wasting both memory and runtime to actually
        compute  group  elements.  Thus  only  images  of tuples of points are
        computed and stored.
  
  [8X
      [10XPrimeSet([3Xf[0X)[0X,
      [10XPrimeSet([3XG[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XPrimeSwitch([3Xp[0X)[0X
    [0X
        Multiplication of rcwa mappings as indicated.
  
  [8X
      [10XPrint([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10X[3Xf[0X*[3Xg[0X[0X
    [0X
        Essentially  composition of affine mappings. See Lemma 1.3.1, Part (a)
        in [Koh05].
  
  [8X
      [10XProjections([3XG[0X,[3Xm[0X)[0X
    [0X
        Use  [10XOrbitsModulo[0X  to  determine  the  supports  of  the images of the
        epimorphisms  to  be determined, and use [10XRestrictedPerm[0X to compute the
        images of the generators of [3XG[0X under these epimorphisms.
  
  [8X
      [10XRandom(RCWA(Integers))[0X
    [0X
        Computes   a   product   of  "randomly"  chosen  class  shifts,  class
        reflections  and  class  transpositions. This seems to be suitable for
        generating reasonably good examples.
  
  [8X
      [10XRankOfKernelOfActionOnRespectedPartition([3XG[0X)[0X
    [0X
        This  performs  basically  the  first part of the computations done by
        [10XKernelOfActionOnRespectedPartition[0X.
  
  [8X
      [10XRCWA([3XR[0X)[0X
    [0X
        Attributes   and   properties  are  set  according  to  Theorem 2.1.1,
        Theorem 2.1.2, Corollary 2.1.6 and Theorem 2.12.8 in [Koh05].
  
  [8X
      [10XRcwaGroupByPermGroup([3XG[0X)[0X
    [0X
        Uses [10XRcwaMapping[0X, Part (d).
  
  [8X
      [10XRcwaMapping[0X
    [0X
        (a)-(c):  "trivial", (d): [10Xn^perm - n[0X for determining the coefficients,
        (e):  "affine  mappings  by  values at two given points", (f) and (g):
        "trivial", (h) and (i): correspond to Lemma 2.1.4 in [Koh05].
  
  [8X
      [10XRepresentativeAction([3XG[0X,[3Xsrc[0X,[3Xdest[0X,[3Xact[0X)[0X,
      [10XRepresentativeActionPreImage[0X
    [0X
        As  indicated  in  the  documentation of these methods. The underlying
        idea  to successively compute two balls around [3Xsrc[0X and [3Xdest[0X until they
        intersect  non-trivially  is  standard  in computational group theory.
        Words  standing  for  products  of  generators of [3XG[0X are stored for any
        image of [3Xsrc[0X or [3Xdest[0X.
  
  [8X
      [10XRepresentativeAction(RCWA(Integers),[3XP1[0X,[3XP2[0X)[0X
    [0X
        Arbitrary mapping: see Lemma 2.1.4 in [Koh05]. Tame mapping: see proof
        of  Theorem 2.8.9  in [Koh05]. The former is almost trivial, while the
        latter is a bit complicated and takes usually also much more time.
  
  [8X
      [10XRepresentativeAction(RCWA(Integers),[3Xf[0X,[3Xg[0X)[0X
    [0X
        The  algorithm used by [10XIsConjugate[0X constructs actually also an element
        [10Xx[0X such that [10X[3Xf[0X^x = [3Xg[0X[0X.
  
  [8X
      [10XRespectedPartition([3Xf[0X)[0X,
      [10XRespectedPartition([3XG[0X)[0X
    [0X
        Uses the algorithm described in the proof of Theorem 2.5.8 in [Koh05].
  
  [8X
      [10XRespectsPartition([3XG[0X,[3XP[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XRestrictedPerm([3Xg[0X,[3XS[0X[0X
    [0X
        "Straightforward".
  
  [8X
      [10XRestriction([3Xg[0X,[3Xf[0X)[0X
    [0X
        Computes the action of [10XRightInverse([3Xf[0X) * g * f[0X on the image of [3Xf[0X.
  
  [8X
      [10XRestriction([3XG[0X,[3Xf[0X)[0X
    [0X
        Gets   a  set  of  generators  by  applying  [10XRestriction([3Xg[0X,[3Xf[0X)[0X  to  the
        generators [3Xg[0X of [3XG[0X.
  
  [8X
      [10XRightInverse([3Xf[0X)[0X
    [0X
        "Straightforward"  if  one  knows  how  to  compute  images of residue
        classes  under  affine mappings, and how to compute inverses of affine
        mappings.
  
  [8X
      [10XRoot([3Xf[0X,[3Xk[0X)[0X
    [0X
        If [3Xf[0X is bijective, class-wise order-preserving and has finite order:
  
        Find  a  conjugate  of  [3Xf[0X  which is a product of class transpositions.
        Slice   cycles   prod_i=2^l  tau_r_1(m_1),r_i(m_i)  of [3Xf[0X  a  respected
        partition     mathcalP    into    cycles    prod_i=1^l    prod_j=0^k-1
        tau_r_1(km_1),r_i+jm_i(km_i)  of  the  [3Xk[0X-fold  length  on  the refined
        partition  which one gets from mathcalP by decomposing any r_i(m_i) in
        mathcalP  into  residue  classes  (mod km_i).  Finally  conjugate  the
        resulting permutation back.
  
        Other cases seem to be more difficult and are currently not covered.
  
  [8X
      [10XRotationFactor([3Xg[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XSemilocalizedRcwaMapping([3Xf[0X,[3Xpi[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XShortCycles([3Xf[0X,[3Xmaxlng[0X)[0X
    [0X
        Looks for fixed points of affine partial mappings of powers of [3Xf[0X.
  
  [8X
      [10XShortOrbits([3XG[0X,[3XS[0X,[3Xmaxlng[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XSign([3Xg[0X)[0X
    [0X
        Evaluation  of  the  given  expression.  For  the mathematical meaning
        (epimorphism!), see Theorem 2.12.8 in [Koh05].
  
  [8X
      [10XSinks([3Xf[0X)[0X
    [0X
        Computes  the strongly connected components of the transition graph by
        the  function [10XSTRONGLY_CONNECTED_COMPONENTS_DIGRAPH[0X, and selects those
        which  are  proper  subsets of their preimages and proper supersets of
        their images under [3Xf[0X.
  
  [8X
      [10XSize([3XG[0X)[0X (order of an rcwa group)
    [0X
        Test  whether one of the generators of the group [3XG[0X has infinite order.
        If  so,  return  [10Xinfinity[0X.  Test  whether the group [3XG[0X is tame. If not,
        return               [10Xinfinity[0X.               Test              whether
        [10XRankOfKernelOfActionOnRespectedPartition([3XG[0X)[0X  is nonzero. If so, return
        [10Xinfinity[0X.  Otherwise  if  [3XG[0X is class-wise order-preserving, return the
        size  of  the  permutation  group  induced  on  the  stored  respected
        partition. If [3XG[0X is not class-wise order-preserving, return the size of
        the  permutation  group  induced  on  the  refinement  of  the  stored
        respected  partition which is obtained by splitting each residue class
        into three residue classes with equal moduli.
  
  [8X
      [10XSize([3XM[0X)[0X (order of an rcwa monoid)
    [0X
        Check  whether  [3XM[0X  is in fact an rcwa group. If so, use the method for
        rcwa  groups  instead.  Check  whether  one  of the generators of [3XM[0X is
        surjective,  but  not injective. If so, return [10Xinfinity[0X. Check whether
        for  all  generators f  of [3XM[0X, the image of the union of the loops of f
        under f  is  finite. If not, return [10Xinfinity[0X. Check whether one of the
        generators  of [3XM[0X  is  bijective  and has infinite order. If so, return
        [10Xinfinity[0X.  Check  whether  one  of the generators of [3XM[0X is wild. If so,
        return  [10Xinfinity[0X. Apply the above criteria to the elements of the ball
        of  radius 2  around 1,  and  return  [10Xinfinity[0X if appropriate. Finally
        attempt  to  compute the list of elements of [3XM[0X. If this is successful,
        return the length of the resulting list.
  
  [8X
      [10XSources([3Xf[0X)[0X
    [0X
        Computes  the strongly connected components of the transition graph by
        the  function [10XSTRONGLY_CONNECTED_COMPONENTS_DIGRAPH[0X, and selects those
        which  are  proper  supersets of their preimages and proper subsets of
        their images under [3Xf[0X.
  
  [8X
      [10XSplittedClassTransposition([3Xct[0X,[3Xk[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XStructureDescription([3XG[0X)[0X
    [0X
        This  method  uses  a  combination  of techniques to obtain some basic
        information   on   the  structure  of  an  rcwa  group.  The  returned
        description  reflects the way the group has been built ([10XDirectProduct[0X,
        [10XWreathProduct[0X, etc.).
  
  [8X
      [10X[3Xf[0X+[3Xg[0X[0X
    [0X
        Pointwise addition of affine mappings.
  
  [8X
      [10XSupport([3XG[0X)[0X
    [0X
        "Straightforward".
  
  [8X
      [10XTrajectory([3Xf[0X,[3Xn[0X,...)[0X
    [0X
        Iterated  application  of  an  rcwa  mapping. In the methods computing
        "accumulated   coefficients",   additionally   composition  of  affine
        mappings.
  
  [8X
      [10XTransitionGraph([3Xf[0X,[3Xm[0X)[0X
    [0X
        "Straightforward" -- just check a sufficiently long interval.
  
  [8X
      [10XTransitionMatrix([3Xf[0X,[3Xm[0X)[0X
    [0X
        Evaluation of the given expression.
  
  [8X
      [10XTransposedClasses([3Xg[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XView([3Xf[0X)[0X
    [0X
        "Trivial".
  
  [8X
      [10XWreathProduct([3XG[0X,[3XP[0X)[0X
    [0X
        Uses  [10XDirectProduct[0X  to embed the [10XDegreeAction([3XP[0X)[0Xth direct power of [3XG[0X,
        and [10XRcwaMapping[0X, Part (d) to embed the finite permutation group [3XP[0X.
  
  [8X
      [10XWreathProduct([3XG[0X,[3XZ[0X)[0X
    [0X
        Restricts  [3XG[0X to the residue class 3(4), and encodes the generator of [3XZ[0X
        as  tau_0(2),1(2)  * tau_0(2),1(4). It is used that the images of 3(4)
        under powers of this mapping are pairwise disjoint residue classes.
  
