  
  [1X43 [33X[0;0YPermutation Groups[133X[101X
  
  
  [1X43.1 [33X[0;0YIsPermGroup (Filter)[133X[101X
  
  [1X43.1-1 IsPermGroup[101X
  
  [33X[1;0Y[29X[2XIsPermGroup[102X( [3Xobj[103X ) [32X Category[133X
  
  [33X[0;0YA permutation group is a group of permutations on a finite set [22XΩ[122X of positive
  integers.  [5XGAP[105X  does  [13Xnot[113X require the user to specify the operation domain [22XΩ[122X
  when a permutation group is defined.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=Group((1,2,3,4),(1,2));[127X[104X
    [4X[28XGroup([ (1,2,3,4), (1,2) ])[128X[104X
  [4X[32X[104X
  
  [33X[0;0YPermutation  groups  are groups and therefore all operations for groups (see
  Chapter [14X39[114X)  can  be  applied  to  them.  In  many cases special methods are
  installed for permutation groups that make computations more effective.[133X
  
  
  [1X43.2 [33X[0;0YThe Natural Action[133X[101X
  
  [33X[0;0YThe     functions     [2XMovedPoints[102X    ([14X42.3-3[114X),    [2XNrMovedPoints[102X    ([14X42.3-4[114X),
  [2XLargestMovedPoint[102X  ([14X42.3-2[114X), and [2XSmallestMovedPoint[102X ([14X42.3-1[114X) are defined for
  arbitrary  collections of permutations (see [14X42.3[114X), in particular they can be
  applied to permutation groups.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:= Group( (2,3,5,6), (2,3) );;[127X[104X
    [4X[25Xgap>[125X [27XMovedPoints( g );  NrMovedPoints( g );[127X[104X
    [4X[28X[ 2, 3, 5, 6 ][128X[104X
    [4X[28X4[128X[104X
    [4X[25Xgap>[125X [27XLargestMovedPoint( g );  SmallestMovedPoint( g );[127X[104X
    [4X[28X6[128X[104X
    [4X[28X2[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe action of a permutation group on the positive integers is a group action
  (via  the acting function [2XOnPoints[102X ([14X41.2-1[114X)). Therefore all action functions
  can  be applied (see the Chapter [14X41[114X), for example [2XOrbit[102X ([14X41.4-1[114X), [2XStabilizer[102X
  ([14X41.5-2[114X), [2XBlocks[102X ([14X41.11-1[114X), [2XIsTransitive[102X ([14X41.10-1[114X), [2XIsPrimitive[102X ([14X41.10-7[114X).[133X
  
  [33X[0;0YIf  one has a list of group generators and is interested in the moved points
  (see  above)  or orbits, it may be useful to avoid the explicit construction
  of  the  group for efficiency reasons. For the special case of the action of
  permutations  on  positive integers via [10X^[110X, the functions [2XOrbitPerms[102X ([14X43.2-1[114X)
  and [2XOrbitsPerms[102X ([14X43.2-2[114X) are provided for this purpose.[133X
  
  [33X[0;0YSimilarly,  several  functions  concerning the natural action of permutation
  groups  address  stabilizer chains (see [14X43.6[114X) rather than permutation groups
  themselves, for example [2XBaseStabChain[102X ([14X43.10-1[114X).[133X
  
  [1X43.2-1 OrbitPerms[101X
  
  [33X[1;0Y[29X[2XOrbitPerms[102X( [3Xperms[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Yreturns  the  orbit of the positive integer [3Xpnt[103X under the group generated by
  the permutations in the list [3Xperms[103X.[133X
  
  [1X43.2-2 OrbitsPerms[101X
  
  [33X[1;0Y[29X[2XOrbitsPerms[102X( [3Xperms[103X, [3XD[103X ) [32X function[133X
  
  [33X[0;0Yreturns  the list of orbits of the positive integers in the list [3XD[103X under the
  group generated by the permutations in the list [3Xperms[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XOrbitPerms( [ (1,2,3)(4,5), (3,6) ], 1 );[127X[104X
    [4X[28X[ 1, 2, 3, 6 ][128X[104X
    [4X[25Xgap>[125X [27XOrbitsPerms( [ (1,2,3)(4,5), (3,6) ], [ 1 .. 6 ] );[127X[104X
    [4X[28X[ [ 1, 2, 3, 6 ], [ 4, 5 ] ][128X[104X
  [4X[32X[104X
  
  
  [1X43.3 [33X[0;0YComputing a Permutation Representation[133X[101X
  
  [1X43.3-1 IsomorphismPermGroup[101X
  
  [33X[1;0Y[29X[2XIsomorphismPermGroup[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yreturns  an  isomorphism  from the group [3XG[103X onto a permutation group which is
  isomorphic   to   [3XG[103X.   The   method   will  select  a  suitable  permutation
  representation.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=SmallGroup(24,12);[127X[104X
    [4X[28X<pc group of size 24 with 4 generators>[128X[104X
    [4X[25Xgap>[125X [27Xiso:=IsomorphismPermGroup(g);[127X[104X
    [4X[28X[ f1, f2, f3, f4 ] -> [ (2,3), (2,3,4), (1,2)(3,4), (1,3)(2,4) ][128X[104X
    [4X[25Xgap>[125X [27XImage(iso,g.3*g.4);[127X[104X
    [4X[28X(1,4)(2,3)[128X[104X
  [4X[32X[104X
  
  [33X[0;0YIn    many    cases    the   permutation   representation   constructed   by
  [2XIsomorphismPermGroup[102X is regular.[133X
  
  [1X43.3-2 SmallerDegreePermutationRepresentation[101X
  
  [33X[1;0Y[29X[2XSmallerDegreePermutationRepresentation[102X( [3XG[103X ) [32X function[133X
  
  [33X[0;0YLet  [3XG[103X  be a permutation group. [2XSmallerDegreePermutationRepresentation[102X tries
  to  find a faithful permutation representation of smaller degree. The result
  is  a group homomorphism onto a permutation group, in the worst case this is
  the identity mapping on [3XG[103X.[133X
  
  [33X[0;0YIf the [10Xcheap[110X option is given, the function only tries to reduce to orbits or
  actions  on blocks, otherwise also actions on cosets of random subgroups are
  tried.[133X
  
  [33X[0;0YNote  that  the  result  is  not  guaranteed  to  be  a faithful permutation
  representation   of  smallest  degree,  or  of  smallest  degree  among  the
  transitive  permutation  representations  of [3XG[103X. Using [5XGAP[105X interactively, one
  might  be  able  to  choose  subgroups  of  small  index for which the cores
  intersect  trivially;  in  this  case,  the  actions  on the cosets of these
  subgroups give rise to an intransitive permutation representation the degree
  of which may be smaller than the original degree.[133X
  
  [33X[0;0YThe  methods  used  might  involve  the  use  of  random  elements  and  the
  permutation representation (or even the degree of the representation) is not
  guaranteed     to     be     the     same    for    different    calls    of
  [2XSmallerDegreePermutationRepresentation[102X.[133X
  
  [33X[0;0YIf  the  option  cheap  is given less work is spent on trying to get a small
  degree  representation,  if  the  value  of this option is set to the string
  "skip"  the  identity  mapping  is  returned.  (This is useful if a function
  called internally might try a degree reduction.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xiso:=RegularActionHomomorphism(SymmetricGroup(4));;[127X[104X
    [4X[25Xgap>[125X [27Ximage:= Image( iso );;  NrMovedPoints( image );[127X[104X
    [4X[28X24[128X[104X
    [4X[25Xgap>[125X [27Xsmall:= SmallerDegreePermutationRepresentation( image );;[127X[104X
    [4X[25Xgap>[125X [27XImage( small );[127X[104X
    [4X[28XGroup([ (2,5,4,3), (1,4)(2,6)(3,5) ])[128X[104X
    [4X[25Xgap>[125X [27Xg:=Image(IsomorphismPermGroup(GL(4,5)));;[127X[104X
    [4X[25Xgap>[125X [27Xsm:=SmallerDegreePermutationRepresentation(g:cheap);;[127X[104X
    [4X[25Xgap>[125X [27XNrMovedPoints(Range(sm));[127X[104X
    [4X[28X624[128X[104X
  [4X[32X[104X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xp:=Group((1,2,3,4,5,6),(1,2));;p:=Action(p,AsList(p),OnRight);;[127X[104X
    [4X[25Xgap>[125X [27XLength(MovedPoints(p));[127X[104X
    [4X[28X720[128X[104X
    [4X[25Xgap>[125X [27Xq:=SmallerDegreePermutationRepresentation(p);;[127X[104X
    [4X[25Xgap>[125X [27XNrMovedPoints(Image(q));[127X[104X
    [4X[28X6[128X[104X
  [4X[32X[104X
  
  
  [1X43.4 [33X[0;0YSymmetric and Alternating Groups[133X[101X
  
  [33X[0;0YThe  commands  [2XSymmetricGroup[102X  ([14X50.1-12[114X) and [2XAlternatingGroup[102X ([14X50.1-11[114X) (see
  Section [14X50.1[114X)  construct  symmetric  and alternating permutation groups. [5XGAP[105X
  can  also  detect  whether  a  given  permutation  group  is  a symmetric or
  alternating  group  on  the set of its moved points; if so then the group is
  called a [13Xnatural[113X symmetric or alternating group, respectively.[133X
  
  [33X[0;0YThe  functions [2XIsSymmetricGroup[102X ([14X43.4-2[114X) and [2XIsAlternatingGroup[102X ([14X43.4-3[114X) can
  be used to check whether a given group (not necessarily a permutation group)
  is isomorphic to a symmetric or alternating group.[133X
  
  [1X43.4-1 IsNaturalSymmetricGroup[101X
  
  [33X[1;0Y[29X[2XIsNaturalSymmetricGroup[102X( [3Xgroup[103X ) [32X property[133X
  [33X[1;0Y[29X[2XIsNaturalAlternatingGroup[102X( [3Xgroup[103X ) [32X property[133X
  
  [33X[0;0YA  group  is a natural symmetric or alternating group if it is a permutation
  group  acting  as symmetric or alternating group, respectively, on its moved
  points.[133X
  
  [33X[0;0YFor  groups  that  are  known to be natural symmetric or natural alternating
  groups,  very efficient methods for computing membership, conjugacy classes,
  Sylow subgroups etc. are used.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=Group((1,5,7,8,99),(1,99,13,72));;[127X[104X
    [4X[25Xgap>[125X [27XIsNaturalSymmetricGroup(g);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xg;[127X[104X
    [4X[28XSym( [ 1, 5, 7, 8, 13, 72, 99 ] )[128X[104X
    [4X[25Xgap>[125X [27XIsNaturalSymmetricGroup( Group( (1,2)(4,5), (1,2,3)(4,5,6) ) );[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X43.4-2 IsSymmetricGroup[101X
  
  [33X[1;0Y[29X[2XIsSymmetricGroup[102X( [3Xgroup[103X ) [32X property[133X
  
  [33X[0;0Yis [9Xtrue[109X if the group [3Xgroup[103X is isomorphic to a symmetric group.[133X
  
  [1X43.4-3 IsAlternatingGroup[101X
  
  [33X[1;0Y[29X[2XIsAlternatingGroup[102X( [3Xgroup[103X ) [32X property[133X
  
  [33X[0;0Yis [9Xtrue[109X if the group [3Xgroup[103X is isomorphic to an alternating group.[133X
  
  [1X43.4-4 SymmetricParentGroup[101X
  
  [33X[1;0Y[29X[2XSymmetricParentGroup[102X( [3Xgrp[103X ) [32X attribute[133X
  
  [33X[0;0YFor  a  permutation group [3Xgrp[103X this function returns the symmetric group that
  moves the same points as [3Xgrp[103X does.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XSymmetricParentGroup( Group( (1,2), (4,5), (7,8,9) ) );[127X[104X
    [4X[28XSym( [ 1, 2, 4, 5, 7, 8, 9 ] )[128X[104X
  [4X[32X[104X
  
  
  [1X43.5 [33X[0;0YPrimitive Groups[133X[101X
  
  [1X43.5-1 ONanScottType[101X
  
  [33X[1;0Y[29X[2XONanScottType[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yreturns  the  type  of  a  primitive  permutation  group [3XG[103X, according to the
  O'Nan-Scott  classification.  The  labelling  of  the different types is not
  consistent  in  the  literature,  we  use the following identifications. The
  two-letter code given is the name of the type as used by Praeger.[133X
  
  [8X1[108X
        [33X[0;6YAffine. (HA)[133X
  
  [8X2[108X
        [33X[0;6YAlmost simple. (AS)[133X
  
  [8X3a[108X
        [33X[0;6YDiagonal, Socle consists of two normal subgroups. (HS)[133X
  
  [8X3b[108X
        [33X[0;6YDiagonal, Socle is minimal normal. (SD)[133X
  
  [8X4a[108X
        [33X[0;6YProduct action with the first factor primitive of type 3a. (HC)[133X
  
  [8X4b[108X
        [33X[0;6YProduct action with the first factor primitive of type 3b. (CD)[133X
  
  [8X4c[108X
        [33X[0;6YProduct action with the first factor primitive of type 2. (PA)[133X
  
  [8X5[108X
        [33X[0;6YTwisted wreath product (TW)[133X
  
  [33X[0;0YSee [EH01] for correspondence to other labellings used in the literature. As
  it can contain letters, the type is returned as a string.[133X
  
  [33X[0;0YIf  [3XG[103X  is  not a permutation group or does not act primitively on the points
  moved by it, the result is undefined.[133X
  
  [1X43.5-2 SocleTypePrimitiveGroup[101X
  
  [33X[1;0Y[29X[2XSocleTypePrimitiveGroup[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yreturns  the socle type of the primitive permutation group [3XG[103X. The socle of a
  primitive group is the direct product of isomorphic simple groups, therefore
  the type is indicated by a record with components [10Xseries[110X, [10Xparameter[110X (both as
  described  under [2XIsomorphismTypeInfoFiniteSimpleGroup[102X ([14X39.15-13[114X)), and [10Xwidth[110X
  for the number of direct factors.[133X
  
  [33X[0;0YIf [3XG[103X does not act primitively on its moved points, an error is returned.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=AlternatingGroup(5);;[127X[104X
    [4X[25Xgap>[125X [27Xh:=DirectProduct(g,g);;[127X[104X
    [4X[25Xgap>[125X [27Xp:=List([1,2],i->Projection(h,i));;[127X[104X
    [4X[25Xgap>[125X [27Xac:=Action(h,AsList(g),[127X[104X
    [4X[25X>[125X [27Xfunction(g,h) return Image(p[1],h)^-1*g*Image(p[2],h);end);;[127X[104X
    [4X[25Xgap>[125X [27XSize(ac);NrMovedPoints(ac);IsPrimitive(ac,[1..60]);[127X[104X
    [4X[28X3600[128X[104X
    [4X[28X60[128X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XONanScottType(ac);[127X[104X
    [4X[28X"3a"[128X[104X
    [4X[25Xgap>[125X [27XSocleTypePrimitiveGroup(ac);[127X[104X
    [4X[28Xrec([128X[104X
    [4X[28X  name := "A(5) ~ A(1,4) = L(2,4) ~ B(1,4) = O(3,4) ~ C(1,4) = S(2,4) \[128X[104X
    [4X[28X~ 2A(1,4) = U(2,4) ~ A(1,5) = L(2,5) ~ B(1,5) = O(3,5) ~ C(1,5) = S(2,\[128X[104X
    [4X[28X5) ~ 2A(1,5) = U(2,5)", parameter := 5, series := "A", width := 2 )[128X[104X
  [4X[32X[104X
  
  
  [1X43.6 [33X[0;0YStabilizer Chains[133X[101X
  
  [33X[0;0YMany  of the algorithms for permutation groups use a [13Xstabilizer chain[113X of the
  group.  The concepts of stabilizer chains, [13Xbases[113X, and [13Xstrong generating sets[113X
  were  introduced  by  Charles Sims in [Sim70]. An extensive account of basic
  algorithms  together  with  asymptotic  runtime  analysis  can  be  found in
  reference [Ser03,  Chapter  4]. A further discussion of base change is given
  in section [14X87.1[114X.[133X
  
  [33X[0;0YLet  [22XB  =  [  b_1, ..., b_n ][122X be a list of points, [22XG^(1) = G[122X and [22XG^{(i+1)} =
  Stab_{G^(i)}(b_i)[122X, such that [22XG^(n+1) = { () }[122X. Then the list [22X[ b_1, ..., b_n
  ][122X  is  called a [13Xbase[113X of [22XG[122X, the points [22Xb_i[122X are called [13Xbase points[113X. A set [22XS[122X of
  generators for [22XG[122X satisfying the condition [22X⟨ S ∩ G^(i) ⟩ = G^(i)[122X for each [22X1 ≤
  i  ≤  n[122X,  is  called  a [13Xstrong generating set[113X (SGS) of [22XG[122X. (More precisely we
  ought  to  say  that it is a SGS of [22XG[122X [13Xrelative[113X to [22XB[122X). The chain of subgroups
  [22XG^(i)[122X of [22XG[122X itself is called the [13Xstabilizer chain[113X of [22XG[122X relative to [22XB[122X.[133X
  
  [33X[0;0YSince  [22X[  b_1,  ..., b_n ][122X, where [22Xn[122X is the degree of [22XG[122X and [22Xb_i[122X are the moved
  points  of  [22XG[122X,  certainly  is  a  base  for  [22XG[122X  there exists a base for each
  permutation  group.  The  number of points in a base is called the [13Xlength[113X of
  the  base. A base [22XB[122X is called [13Xreduced[113X if there exists no [22Xi[122X such that [22XG^(i) =
  G^(i+1)[122X.  (This  however does not imply that no subset of [22XB[122X could also serve
  as  a  base.)  Note that different reduced bases for one permutation group [22XG[122X
  may  have  different  lengths.  For  example,  the  irreducible  degree  [22X416[122X
  permutation  representation  of the Chevalley Group [22XG_2(4)[122X possesses reduced
  bases of lengths [22X5[122X and [22X7[122X.[133X
  
  [33X[0;0YLet  [22XR^(i)[122X  be  a right transversal of [22XG^(i+1)[122X in [22XG^(i)[122X, i.e. a set of right
  coset representatives of the cosets of [22XG^(i+1)[122X in [22XG^(i)[122X. Then each element [22Xg[122X
  of  [22XG[122X  has  a unique representation as a product of the form [22Xg = r_n ... r_1[122X
  with  [22Xr_i  ∈  R^(i)[122X.  The  cosets  of  [22XG^(i+1)[122X  in  [22XG^(i)[122X  are  in bijective
  correspondence  with  the  points  in  [22XO^(i)  :=  b_i^{G^(i)}[122X.  So  we could
  represent  a  transversal  as a list [22XT[122X such that [22XT[p][122X is a representative of
  the  coset  corresponding  to the point [22Xp ∈ O^(i)[122X, i.e., an element of [22XG^(i)[122X
  that  takes  [22Xb_i[122X  to  [22Xp[122X.  (Note  that such a list has holes in all positions
  corresponding to points not contained in [22XO^(i)[122X.)[133X
  
  [33X[0;0YThis  approach  however  will  store  many  different  permutations as coset
  representatives which can be a problem if the degree [22Xn[122X gets bigger. Our goal
  therefore is to store as few different permutations as possible such that we
  can  still  reconstruct  each  representative  in  [22XR^(i)[122X,  and from them the
  elements  in [22XG[122X. A [13Xfactorized inverse transversal[113X [22XT[122X is a list where [22XT[p][122X is a
  generator  of [22XG^(i)[122X such that [22Xp^{T[p]}[122X is a point that lies earlier in [22XO^(i)[122X
  than  [22Xp[122X  (note that we consider [22XO^(i)[122X as a list, not as a set). If we assume
  inductively  that  we  know an element [22Xr ∈ G^(i)[122X that takes [22Xb_i[122X to [22Xp^{T[p]}[122X,
  then  [22Xr  T[p]^{-1}[122X is an element in [22XG^(i)[122X that takes [22Xb_i[122X to [22Xp[122X. [5XGAP[105X uses such
  factorized inverse transversals.[133X
  
  [33X[0;0YAnother  name  for  a factorized inverse transversal is a [13XSchreier tree[113X. The
  vertices  of  the  tree are the points in [22XO^(i)[122X, and the root of the tree is
  [22Xb_i[122X. The edges are defined as the ordered pairs [22X(p, p^{T[p]})[122X, for [22Xp ∈ O^(i)
  ∖  {  b_i }[122X. The edge [22X(p, p^{T[p]})[122X is labelled with the generator [22XT[p][122X, and
  the  product  of  edge  labels  along  the  unique path from [22Xp[122X to [22Xb_i[122X is the
  inverse of the transversal element carrying [22Xb_i[122X to [22Xp[122X.[133X
  
  [33X[0;0YBefore we describe the construction of stabilizer chains in [14X43.8[114X, we explain
  in [14X43.7[114X  the  idea  of using non-deterministic algorithms; this is necessary
  for  understanding  the options available for the construction of stabilizer
  chains. After that, in [14X43.9[114X it is explained how a stabilizer chain is stored
  in  [5XGAP[105X,  [14X43.10[114X  lists operations for stabilizer chains, and [14X43.11[114X lists low
  level routines for manipulating stabilizer chains.[133X
  
  
  [1X43.7 [33X[0;0YRandomized Methods for Permutation Groups[133X[101X
  
  [33X[0;0YFor  most  computations  with permutation groups, it is crucial to construct
  stabilizer  chains  efficiently.  Sims's original construction in [Sim70] is
  deterministic,  and  is  called  the  Schreier-Sims algorithm, because it is
  based  on  Schreier's  Lemma  ([{Hal}59,  p.  96]):  given  [22XK  = ⟨ S ⟩[122X and a
  transversal  [22XT[122X  for  [22XK[122X  mod  [22XL[122X, one can obtain [22X|S||T|[122X generators for [22XL[122X. This
  lemma  is  applied recursively, with consecutive point stabilizers [22XG^(i)[122X and
  [22XG^(i+1)[122X playing the role of [22XK[122X and [22XL[122X.[133X
  
  [33X[0;0YIn  permutation groups of large degree, the number of Schreier generators to
  be   processed  becomes  too  large,  and  the  deterministic  Schreier-Sims
  algorithm  becomes  impractical.  Therefore, [5XGAP[105X uses randomized algorithms.
  The method selection process, which is quite different from Version 3, works
  the following way.[133X
  
  [33X[0;0YIf  a  group  acts  on  not  more  than  a  hundred  points, Sims's original
  deterministic  algorithm  is  applied.  In  groups  of  degree  greater than
  hundred,  a  heuristic  algorithm  based  on  ideas in [BCFS91] constructs a
  stabilizer chain. This construction is complemented by a verify-routine that
  either  proves  the  correctness  of  the  stabilizer  chain  or  causes the
  extension  of  the  chain  to  a  correct  one.  The  user can influence the
  verification  process  by  setting  the value of the record component [10Xrandom[110X
  (cf. [14X43.8[114X).[133X
  
  [33X[0;0YIf  the  [10Xrandom[110X  value equals [22X1000[122X then a slight extension of an unpublished
  method  of  Sims is used. The outcome of this verification process is always
  correct. The user also can prescribe any integer [22Xx[122X, [22X1 ≤ x ≤ 999[122X as the value
  of  [10Xrandom[110X. In this case, a randomized verification process from [BCFS91] is
  applied,  and  the result of the stabilizer chain construction is guaranteed
  to be correct with probability at least [22Xx/1000[122X. The practical performance of
  the algorithm is much better than the theoretical guarantee.[133X
  
  [33X[0;0YIf  the  stabilizer chain is not correct then the elements in the product of
  transversals [22XR^(m) R^(m-1) ⋯ R^(1)[122X constitute a proper subset of the group [22XG[122X
  in  question.  This  means that a membership test with this stabilizer chain
  returns  [9Xfalse[109X  for  all  elements that are not in [22XG[122X, but it may also return
  [9Xfalse[109X  for  some  elements  of  [22XG[122X;  in  other  words,  the  result [9Xtrue[109X of a
  membership  test  is  always  correct,  whereas  the  result  [9Xfalse[109X  may  be
  incorrect.[133X
  
  [33X[0;0YThe  construction  and  verification  phases are separated because there are
  situations  where  the  verification  step can be omitted; if one happens to
  know  the  order of the group in advance then the randomized construction of
  the  stabilizer  chain  stops  as  soon as the product of the lengths of the
  basic  orbits  of  the  chain  equals the group order, and the chain will be
  correct (see the [10Xsize[110X option of the [2XStabChain[102X ([14X43.8-1[114X) command).[133X
  
  [33X[0;0YAlthough  the  worst  case  running  time  is  roughly  quadratic for Sims's
  verification and roughly linear for the randomized one, in most examples the
  running  time  of  the  stabilizer chain construction with [10Xrandom[110X value [22X1000[122X
  (i.e.,  guaranteed  correct output) is about the same as the running time of
  randomized  verification  with guarantee of at least [22X90[122X percent correctness.
  Therefore,  we suggest to use the default value [10Xrandom[110X [22X= 1000[122X. Possible uses
  of  [10Xrandom[110X  values  less  than  [22X1000[122X are when one has to run through a large
  collection of subgroups, and a low value of random is used to choose quickly
  a  candidate  for  more  thorough  examination; another use is when the user
  suspects   that   the   quadratic   bottleneck  of  the  guaranteed  correct
  verification is hit.[133X
  
  [33X[0;0YWe will give two examples to illustrate these ideas.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xh:= SL(4,7);;[127X[104X
    [4X[25Xgap>[125X [27Xo:= Orbit( h, [1,0,0,0]*Z(7)^0, OnLines );;[127X[104X
    [4X[25Xgap>[125X [27Xop:= Action( h, o, OnLines );;[127X[104X
    [4X[25Xgap>[125X [27XNrMovedPoints( op );[127X[104X
    [4X[28X400[128X[104X
  [4X[32X[104X
  
  [33X[0;0YWe  created a permutation group on [22X400[122X points. First we compute a guaranteed
  correct stabilizer chain (see [2XStabChain[102X ([14X43.8-1[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xh:= Group( GeneratorsOfGroup( op ) );;[127X[104X
    [4X[25Xgap>[125X [27XStabChain( h );;  time;[127X[104X
    [4X[28X1120[128X[104X
    [4X[25Xgap>[125X [27XSize( h );[127X[104X
    [4X[28X2317591180800[128X[104X
  [4X[32X[104X
  
  [33X[0;0YNow  randomized  verification  will  be  used. We require that the result is
  guaranteed  correct with probability [22X90[122X percent. This means that if we would
  do  this  calculation  many times over, [5XGAP[105X would [13Xguarantee[113X that in least [22X90[122X
  percent  of  all calculations the result is correct. In fact the results are
  much  better than the guarantee, but we cannot promise that this will really
  happen.  (For  the meaning of the [10Xrandom[110X component in the second argument of
  [2XStabChain[102X ([14X43.8-1[114X).)[133X
  
  [33X[0;0YFirst the group is created anew.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xh:= Group( GeneratorsOfGroup( op ) );;[127X[104X
    [4X[25Xgap>[125X [27XStabChain( h, rec( random:= 900 ) );;  time;[127X[104X
    [4X[28X1410[128X[104X
    [4X[25Xgap>[125X [27XSize( h );[127X[104X
    [4X[28X2317591180800[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  result  is  still  correct,  and  the running time is actually somewhat
  slower.  If you give the algorithm the order of the group, then it can check
  its  result,  and so things become faster and the result is guaranteed to be
  correct.  This can be done with the [10Xsize[110X option (see [2XStabChain[102X ([14X43.8-1[114X)), or
  by setting the size of the group beforehand with [10XSetSize[110X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xh:=Group( GeneratorsOfGroup( op ) );;[127X[104X
    [4X[25Xgap>[125X [27XSetSize( h, 2317591180800 );[127X[104X
    [4X[25Xgap>[125X [27XStabChain( h );;  time;[127X[104X
    [4X[28X170[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe  second  example gives a typical group when the verification with [10Xrandom[110X
  value  [22X1000[122X is slow. The problem is that the group has a stabilizer subgroup
  [22XG^(i)[122X  such  that  the fundamental orbit [22XO^(i)[122X is split into a lot of orbits
  when we stabilize [22Xb_i[122X and one additional point of [22XO^(i)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xp1:=PermList(Concatenation([401],[1..400]));;[127X[104X
    [4X[25Xgap>[125X [27Xp2:=PermList(List([1..400],i->(i*20 mod 401)));;[127X[104X
    [4X[25Xgap>[125X [27Xd:=DirectProduct(Group(p1,p2),SymmetricGroup(5));;[127X[104X
    [4X[25Xgap>[125X [27Xh:=Group(GeneratorsOfGroup(d));;[127X[104X
    [4X[25Xgap>[125X [27XStabChain(h);;time;Size(h);[127X[104X
    [4X[28X1030[128X[104X
    [4X[28X192480[128X[104X
    [4X[25Xgap>[125X [27Xh:=Group(GeneratorsOfGroup(d));;[127X[104X
    [4X[25Xgap>[125X [27XStabChain(h,rec(random:=900));;time;Size(h);[127X[104X
    [4X[28X570[128X[104X
    [4X[28X192480[128X[104X
  [4X[32X[104X
  
  [33X[0;0YWhen  stabilizer chains of a group [22XG[122X are created with [10Xrandom[110X value less than
  [22X1000[122X,  this  is  noted  in  the  group [22XG[122X, by setting of the record component
  [10Xrandom[110X  in  the  value  of the attribute [2XStabChainOptions[102X ([14X43.8-2[114X) for [22XG[122X. As
  errors  induced  by  the  random  methods  might  propagate,  any  group  or
  homomorphism   created   from   [22XG[122X   inherits   a  [10Xrandom[110X  component  in  its
  [2XStabChainOptions[102X ([14X43.8-2[114X) value from the corresponding component for [22XG[122X.[133X
  
  [33X[0;0YA  lot of algorithms dealing with permutation groups use randomized methods;
  however,  if  the  initial  stabilizer  chain  construction  for  a group is
  correct, these further methods will provide guaranteed correct output.[133X
  
  
  [1X43.8 [33X[0;0YConstruction of Stabilizer Chains[133X[101X
  
  [1X43.8-1 StabChain[101X
  
  [33X[1;0Y[29X[2XStabChain[102X( [3XG[103X[, [3Xoptions[103X] ) [32X function[133X
  [33X[1;0Y[29X[2XStabChain[102X( [3XG[103X, [3Xbase[103X ) [32X function[133X
  [33X[1;0Y[29X[2XStabChainOp[102X( [3XG[103X, [3Xoptions[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XStabChainMutable[102X( [3XG[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XStabChainMutable[102X( [3Xpermhomom[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XStabChainImmutable[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0YThese  commands  compute  a  stabilizer  chain  for the permutation group [3XG[103X;
  additionally,   [2XStabChainMutable[102X   is   also  an  attribute  for  the  group
  homomorphism [3Xpermhomom[103X whose source is a permutation group.[133X
  
  [33X[0;0Y(The  mathematical background of stabilizer chains is sketched in [14X43.6[114X, more
  information  about  the objects representing stabilizer chains in [5XGAP[105X can be
  found in [14X43.9[114X.)[133X
  
  [33X[0;0Y[2XStabChainOp[102X  is  an  operation  with two arguments [3XG[103X and [3Xoptions[103X, the latter
  being  a  record  which  controls  some  aspects  of  the  computation  of a
  stabilizer  chain  (see  below);  [2XStabChainOp[102X  returns  a [13Xmutable[113X stabilizer
  chain.  [2XStabChainMutable[102X is a [13Xmutable[113X attribute for groups or homomorphisms,
  its  default  method  for  groups  is to call [2XStabChainOp[102X with empty options
  record.  [2XStabChainImmutable[102X  is  an  attribute  with  [13Ximmutable[113X  values; its
  default method dispatches to [2XStabChainMutable[102X.[133X
  
  [33X[0;0Y[2XStabChain[102X  is  a  function  with  first  argument a permutation group [3XG[103X, and
  optionally   a   record   [3Xoptions[103X  as  second  argument.  If  the  value  of
  [2XStabChainImmutable[102X  for  [3XG[103X  is  already  known  and if this stabilizer chain
  matches  the  requirements  of [3Xoptions[103X, [2XStabChain[102X simply returns this stored
  stabilizer  chain.  Otherwise  [2XStabChain[102X  calls  [2XStabChainOp[102X  and returns an
  immutable  copy  of  the  result;  additionally,  this  chain  is  stored as
  [2XStabChainImmutable[102X  value  for  [3XG[103X.  If  no  [3Xoptions[103X  argument  is given, its
  components  default to the global variable [2XDefaultStabChainOptions[102X ([14X43.8-3[114X).
  If  [3Xbase[103X  is  a  list of positive integers, the version [10XStabChain( [3XG[103X[10X, [3Xbase[103X[10X )[110X
  defaults to [10XStabChain( [3XG[103X[10X, rec( base:= [3Xbase[103X[10X ) )[110X.[133X
  
  [33X[0;0YIf  given,  [3Xoptions[103X  is  a record whose components specify properties of the
  desired stabilizer chain or which may help the algorithm. Default values for
  all  of  them  can  be  given in the global variable [2XDefaultStabChainOptions[102X
  ([14X43.8-3[114X). The following options are supported.[133X
  
  [8X[10Xbase[110X[8X (default an empty list)[108X
        [33X[0;6YA  list  of points, through which the resulting stabilizer chain shall
        run. For the base [22XB[122X of the resulting stabilizer chain [3XS[103X this means the
        following.  If  the  [10Xreduced[110X  component  of [3Xoptions[103X is [9Xtrue[109X then those
        points  of  [10Xbase[110X with nontrivial basic orbits form the initial segment
        of  [22XB[122X,  if  the  [10Xreduced[110X  component  is  [9Xfalse[109X then [10Xbase[110X itself is the
        initial  segment  of  [22XB[122X.  Repeated  occurrences  of points in [10Xbase[110X are
        ignored.  If  a  stabilizer  chain  for  [3XG[103X  is  already known then the
        stabilizer chain is computed via a base change.[133X
  
  [8X[10XknownBase[110X[8X (no default value)[108X
        [33X[0;6YA  list  of  points  which is known to be a base for the group. Such a
        known  base  makes  it easier to test whether a permutation given as a
        word  in  terms  of  a  set  of  generators  is the identity, since it
        suffices  to map the known base with each factor consecutively, rather
        than multiplying the whole permutations (which would mean to map every
        point).  This speeds up the Schreier-Sims algorithm which is used when
        a  new  stabilizer  chain  is  constructed;  it will not affect a base
        change, however. The component [10XknownBase[110X bears no relation to the [10Xbase[110X
        component,  you  may specify a known base [10XknownBase[110X and a desired base
        [10Xbase[110X independently.[133X
  
  [8X[10Xreduced[110X[8X (default [9Xtrue[109X)[108X
        [33X[0;6YIf this is [9Xtrue[109X the resulting stabilizer chain [3XS[103X is reduced, i.e., the
        case  [22XG^(i)  =  G^(i+1)[122X does not occur. Setting [10Xreduced[110X to [9Xfalse[109X makes
        sense only if the component [10Xbase[110X (see above) is also set; in this case
        all  points  of  [10Xbase[110X will occur in the base [22XB[122X of [3XS[103X, even if they have
        trivial  basic orbits. Note that if [10Xbase[110X is just an initial segment of
        [22XB[122X, the basic orbits of the points in [22XB ∖[122X[10Xbase[110X are always nontrivial.[133X
  
  [8X[10XtryPcgs[110X[8X (default [9Xtrue[109X)[108X
        [33X[0;6YIf  this  is [9Xtrue[109X and either the degree is at most [22X100[122X or the group is
        known  to  be  solvable,  [5XGAP[105X  will first try to construct a pcgs (see
        Chapter [14X45[114X)  for  [3XG[103X  which  will  succeed  and  implicitly construct a
        stabilizer chain if [3XG[103X is solvable. If [3XG[103X turns out non-solvable, one of
        the   other   methods   will   be  used.  This  solvability  check  is
        comparatively fast, even if it fails, and it can save a lot of time if
        [3XG[103X is solvable.[133X
  
  [8X[10Xrandom[110X[8X (default [10X1000[110X[8X)[108X
        [33X[0;6YIf  the  value  is less than [22X1000[122X, the resulting chain is correct with
        probability  at  least [10Xrandom[110X[22X/ 1000[122X. The [10Xrandom[110X option is explained in
        more detail in [14X43.7[114X.[133X
  
  [8X[10Xsize[110X[8X (default [10XSize([3XG[103X[8X[10X)[110X[8X if this is known, i.e., if [10XHasSize([3XG[103X[8X[10X)[110X[8X is [9Xtrue[109X)[108X
        [33X[0;6YIf  this component is present, its value is assumed to be the order of
        the   group   [3XG[103X.  This  information  can  be  used  to  prove  that  a
        non-deterministically constructed stabilizer chain is correct. In this
        case,  [5XGAP[105X  does  a  non-deterministic  construction until the size is
        correct.[133X
  
  [8X[10Xlimit[110X[8X (default [10XSize(Parent([3XG[103X[8X[10X))[110X[8X or [10XStabChainOptions(Parent([3XG[103X[8X[10X)).limit[110X[8X if it is present)[108X
        [33X[0;6YIf  this component is present, it must be greater than or equal to the
        order  of  [3XG[103X. The stabilizer chain construction stops if size [10Xlimit[110X is
        reached.[133X
  
  [1X43.8-2 StabChainOptions[101X
  
  [33X[1;0Y[29X[2XStabChainOptions[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yis  a  record that stores the options with which the stabilizer chain stored
  in [2XStabChainImmutable[102X ([14X43.8-1[114X) has been computed (see [2XStabChain[102X ([14X43.8-1[114X) for
  the options that are supported).[133X
  
  [1X43.8-3 DefaultStabChainOptions[101X
  
  [33X[1;0Y[29X[2XDefaultStabChainOptions[102X [32X global variable[133X
  
  [33X[0;0Yare the options for [2XStabChain[102X ([14X43.8-1[114X) which are set as default.[133X
  
  [1X43.8-4 StabChainBaseStrongGenerators[101X
  
  [33X[1;0Y[29X[2XStabChainBaseStrongGenerators[102X( [3Xbase[103X, [3Xsgs[103X[, [3Xone[103X] ) [32X function[133X
  
  [33X[0;0YLet  [3Xbase[103X  be  a  base  for  a  permutation group [22XG[122X, and let [3Xsgs[103X be a strong
  generating  set  for  [22XG[122X  with  respect  to [3Xbase[103X; [3Xone[103X must be the appropriate
  identity  element  of  [22XG[122X (see [2XOne[102X ([14X31.10-2[114X), in most cases this will be [10X()[110X).
  This  function constructs a stabilizer chain corresponding to the given base
  and  strong  generating set without the need to find Schreier generators; so
  this is much faster than the other algorithms.[133X
  
  [33X[0;0YIf  [3Xsgs[103X  is  nonempty, then the argument [3Xone[103X is optional; if not given, then
  the [2XOne[102X ([14X31.10-2[114X) of [10X[3Xsgs[103X[10X[1][110X is taken as the identity element.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xsc := StabChainBaseStrongGenerators([1,2], [(1,3,4), (2,3,4)], ());[127X[104X
    [4X[28X<stabilizer chain record, Base [ 1, 2 ], Orbit length 4, Size: 12>[128X[104X
    [4X[25Xgap>[125X [27XGroupStabChain(sc) = AlternatingGroup(4);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XStabChainBaseStrongGenerators([1,3], [(1,2),(3,4)]);[127X[104X
    [4X[28X<stabilizer chain record, Base [ 1, 3 ], Orbit length 2, Size: 4>[128X[104X
  [4X[32X[104X
  
  [1X43.8-5 MinimalStabChain[101X
  
  [33X[1;0Y[29X[2XMinimalStabChain[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yreturns the reduced stabilizer chain corresponding to the base [22X[ 1, 2, 3, 4,
  ... ][122X.[133X
  
  
  [1X43.9 [33X[0;0YStabilizer Chain Records[133X[101X
  
  [33X[0;0YIf a permutation group has a stabilizer chain, this is stored as a recursive
  structure. This structure is itself a record [3XS[103X and it has[133X
  
  [8X(1)[108X
        [33X[0;6Ycomponents  that  provide  information  about  one  level [22XG^(i)[122X of the
        stabilizer chain (which we call the [21Xcurrent stabilizer[121X) and[133X
  
  [8X(2)[108X
        [33X[0;6Ya  component  [10Xstabilizer[110X  that  holds  another such record, namely the
        stabilizer chain of the next stabilizer [22XG^(i+1)[122X.[133X
  
  [33X[0;0YThis gives a recursive structure where the [21Xoutermost[121X record representing the
  [21Xtopmost[121X  stabilizer is bound to the group record component [10XstabChain[110X and has
  the  components  explained  below.  Note:  Since the structure is recursive,
  [13Xnever  print  a stabilizer chain![113X (Unless you want to exercise the scrolling
  capabilities of your terminal.)[133X
  
  [8X[10Xidentity[110X[8X [108X
        [33X[0;6Ythe identity element of the current stabilizer.[133X
  
  [8X[10Xlabels[110X[8X [108X
        [33X[0;6Ya  list of permutations which contains labels for the Schreier tree of
        the  current stabilizer, i.e., it contains elements for the factorized
        inverse  transversal.  The  first  entry  in  this  list is always the
        [10Xidentity[110X.  Note  that  [5XGAP[105X  tries to arrange things so that the [10Xlabels[110X
        components  are  identical  (i.e.,  the  same  [5XGAP[105X  object)  in  every
        stabilizer  of  the  chain;  thus  the  [10Xlabels[110X  of a stabilizer do not
        necessarily all lie in the this stabilizer (but see [10Xgenlabels[110X below).[133X
  
  [8X[10Xgenlabels[110X[8X [108X
        [33X[0;6Ya  list  of  integers  indexing some of the permutations in the [10Xlabels[110X
        component.  The [10Xlabels[110X addressed in this way form a generating set for
        the  current stabilizer. If the [10Xgenlabels[110X component is empty, the rest
        of  the  stabilizer  chain represents the trivial subgroup, and can be
        ignored, e.g., when calculating the size.[133X
  
  [8X[10Xgenerators[110X[8X [108X
        [33X[0;6Ya  list  of  generators  for  the  current  stabilizer. Usually, it is
        [10Xlabels{ genlabels }[110X.[133X
  
  [8X[10Xorbit[110X[8X [108X
        [33X[0;6Ythe  vertices  of  the  Schreier  tree,  which  form  the  basic orbit
        [22Xb_i^{G^(i)}[122X,  ordered  in such a way that the base point [22Xb_i[122X is in the
        first position in the orbit.[133X
  
  [8X[10Xtransversal[110X[8X[108X
        [33X[0;6YThe  factorized  inverse transversal found during the orbit algorithm.
        The  element  [22Xg[122X stored at [10Xtransversal[110X[22X[i][122X will map [22Xi[122X to another point [22Xj[122X
        that  in  the  Schreier  tree is closer to the base point. By iterated
        application  ([10Xtransversal[110X[22X[j][122X  and  so on) eventually the base point is
        reached and an element that maps [22Xi[122X to the base point found as product.[133X
  
  [8X[10Xtranslabels[110X[8X[108X
        [33X[0;6YAn  index  list  such  that [10Xtransversal[110X[22X[j] =[122X [10Xlabels[110X[22X[[122X [10Xtranslabels[110X[22X[j] ][122X.
        This list takes up comparatively little memory and is used to speed up
        base changes.[133X
  
  [8X[10Xstabilizer[110X[8X [108X
        [33X[0;6YIf the current stabilizer is not yet the trivial group, the stabilizer
        chain  continues  with the stabilizer of the current base point, which
        is  again  represented  as  a record with components [10Xlabels[110X, [10Xidentity[110X,
        [10Xgenlabels[110X,  [10Xgenerators[110X,  [10Xorbit[110X,  [10Xtranslabels[110X, [10Xtransversal[110X (and perhaps
        [10Xstabilizer[110X).  This  record is bound to the [10Xstabilizer[110X component of the
        current   stabilizer.  The  last  member  of  a  stabilizer  chain  is
        recognized by the fact that it has no [10Xstabilizer[110X component bound.[133X
  
  [33X[0;0YIt is possible that different stabilizer chains share the same record as one
  of their iterated [10Xstabilizer[110X components.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=Group((1,2,3,4),(1,2));;[127X[104X
    [4X[25Xgap>[125X [27XStabChain(g);[127X[104X
    [4X[28X<stabilizer chain record, Base [ 1, 2, 3 ], Orbit length 4, Size: 24>[128X[104X
    [4X[25Xgap>[125X [27XBaseOfGroup(g);[127X[104X
    [4X[28X[ 1, 2, 3 ][128X[104X
    [4X[25Xgap>[125X [27XStabChainOptions(g);[127X[104X
    [4X[28Xrec( random := 1000 )[128X[104X
    [4X[25Xgap>[125X [27XDefaultStabChainOptions;[127X[104X
    [4X[28Xrec( random := 1000, reduced := true, tryPcgs := true )[128X[104X
  [4X[32X[104X
  
  
  [1X43.10 [33X[0;0YOperations for Stabilizer Chains[133X[101X
  
  [1X43.10-1 BaseStabChain[101X
  
  [33X[1;0Y[29X[2XBaseStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns the base belonging to the stabilizer chain [3XS[103X.[133X
  
  [1X43.10-2 BaseOfGroup[101X
  
  [33X[1;0Y[29X[2XBaseOfGroup[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0Yreturns  a  base  of  the  permutation group [3XG[103X. There is [13Xno[113X guarantee that a
  stabilizer chain stored in [3XG[103X corresponds to this base![133X
  
  [1X43.10-3 SizeStabChain[101X
  
  [33X[1;0Y[29X[2XSizeStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns the product of the orbit lengths in the stabilizer chain [3XS[103X, that is,
  the order of the group described by [3XS[103X.[133X
  
  [1X43.10-4 StrongGeneratorsStabChain[101X
  
  [33X[1;0Y[29X[2XStrongGeneratorsStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns a strong generating set corresponding to the stabilizer chain [3XS[103X.[133X
  
  [1X43.10-5 GroupStabChain[101X
  
  [33X[1;0Y[29X[2XGroupStabChain[102X( [[3XG[103X, ][3XS[103X ) [32X function[133X
  
  [33X[0;0Yconstructs  a  permutation group with stabilizer chain [3XS[103X, i.e., a group with
  generators [10XGenerators( [3XS[103X[10X )[110X to which [3XS[103X is assigned as component [10XstabChain[110X. If
  the optional argument [3XG[103X is given, the result will have the parent [3XG[103X.[133X
  
  [1X43.10-6 OrbitStabChain[101X
  
  [33X[1;0Y[29X[2XOrbitStabChain[102X( [3XS[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Yreturns  the  orbit of [3Xpnt[103X under the group described by the stabilizer chain
  [3XS[103X.[133X
  
  [1X43.10-7 IndicesStabChain[101X
  
  [33X[1;0Y[29X[2XIndicesStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns a list of the indices of the stabilizers in the stabilizer chain [3XS[103X.[133X
  
  [1X43.10-8 ListStabChain[101X
  
  [33X[1;0Y[29X[2XListStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns  a  list that contains at position [22Xi[122X the stabilizer of the first [22Xi-1[122X
  base points in the stabilizer chain [3XS[103X.[133X
  
  [1X43.10-9 ElementsStabChain[101X
  
  [33X[1;0Y[29X[2XElementsStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns  a  list  of  all  elements of the group described by the stabilizer
  chain [3XS[103X. The list is duplicate free but may be unsorted.[133X
  
  [1X43.10-10 IteratorStabChain[101X
  
  [33X[1;0Y[29X[2XIteratorStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Yreturns  an  iterator  for  the  elements  of  the  group  described  by the
  stabilizer  chain  [3XS[103X.  The elements of the group [3XG[103X are produced by iterating
  through  all  base  images in turn, and in the ordering induced by the base.
  For more details see [14X43.6[114X[133X
  
  [1X43.10-11 InverseRepresentative[101X
  
  [33X[1;0Y[29X[2XInverseRepresentative[102X( [3XS[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Ycalculates  the transversal element which maps [3Xpnt[103X back to the base point of
  [3XS[103X.  It  just  runs  back  through the Schreier tree from [3Xpnt[103X to the root and
  multiplies the labels along the way.[133X
  
  [1X43.10-12 SiftedPermutation[101X
  
  [33X[1;0Y[29X[2XSiftedPermutation[102X( [3XS[103X, [3Xg[103X ) [32X function[133X
  
  [33X[0;0Ysifts  the  permutation  [3Xg[103X  through  the  stabilizer chain [3XS[103X and returns the
  result after the last step.[133X
  
  [33X[0;0YThe   element   [3Xg[103X   is   sifted   as   follows:   [3Xg[103X   is  replaced  by  [10X[3Xg[103X[10X  *
  InverseRepresentative( [3XS[103X[10X, [3XS[103X[10X.orbit[1]^[3Xg[103X[10X )[110X, then [3XS[103X is replaced by [10X[3XS[103X[10X.stabilizer[110X
  and  this  process  is repeated until [3XS[103X is trivial or [10X[3XS[103X[10X.orbit[1]^[3Xg[103X[10X[110X is not in
  the  basic  orbit  [10X[3XS[103X[10X.orbit[110X.  The remainder [3Xg[103X is returned, it is the identity
  permutation if and only if the original [3Xg[103X is in the group [22XG[122X described by the
  original [3XS[103X.[133X
  
  [1X43.10-13 MinimalElementCosetStabChain[101X
  
  [33X[1;0Y[29X[2XMinimalElementCosetStabChain[102X( [3XS[103X, [3Xg[103X ) [32X function[133X
  
  [33X[0;0YLet  [22XG[122X  be  the  group  described  by  the stabilizer chain [3XS[103X. This function
  returns  a  permutation  [22Xh[122X such that [22XG [3Xg[103X = G h[122X (that is, [22X[3Xg[103X / h ∈ G[122X) and with
  the  additional  property  that  the  list  of  images  under  [22Xh[122X of the base
  belonging to [3XS[103X is minimal w.r.t. lexicographical ordering.[133X
  
  [1X43.10-14 LargestElementStabChain[101X
  
  [33X[1;0Y[29X[2XLargestElementStabChain[102X( [3XS[103X, [3Xid[103X ) [32X function[133X
  
  [33X[0;0YLet  [22XG[122X  be  the  group  described  by  the stabilizer chain [3XS[103X. This function
  returns  the element [22Xh ∈ G[122X with the property that the list of images under [22Xh[122X
  of  the  base belonging to [3XS[103X is maximal w.r.t. lexicographical ordering. The
  second argument must be an identity element (used to start the recursion).[133X
  
  [1X43.10-15 ApproximateSuborbitsStabilizerPermGroup[101X
  
  [33X[1;0Y[29X[2XApproximateSuborbitsStabilizerPermGroup[102X( [3XG[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Yreturns an approximation of the orbits of [10XStabilizer( [3XG[103X[10X, [3Xpnt[103X[10X )[110X on all points
  of  the  orbit [10XOrbit( [3XG[103X[10X, [3Xpnt[103X[10X )[110X, without computing the full point stabilizer;
  As not all Schreier generators are used, the result may represent the orbits
  of only a subgroup of the point stabilizer.[133X
  
  
  [1X43.11 [33X[0;0YLow Level Routines to Modify and Create Stabilizer Chains[133X[101X
  
  [33X[0;0YThese  operations  modify  a  stabilizer  chain  or  obtain  new chains with
  specific  properties.  They  are rather technical and should only be used if
  such  low-level  routines  are  deliberately required. (For all functions in
  this section the parameter [3XS[103X is a stabilizer chain.)[133X
  
  [1X43.11-1 CopyStabChain[101X
  
  [33X[1;0Y[29X[2XCopyStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0YThis  function  returns a mutable copy of the stabilizer chain [3XS[103X that has no
  mutable  object  (list or record) in common with [3XS[103X. The [10Xlabels[110X components of
  the result are possibly shared by several levels, but superfluous labels are
  removed.  (An  entry in [10Xlabels[110X is superfluous if it does not occur among the
  [10Xgenlabels[110X  or  [10Xtranslabels[110X  on  any  of  the  levels which share that [10Xlabels[110X
  component.)[133X
  
  [33X[0;0YThis  is  useful  for  stabiliser  sub-chains that have been obtained as the
  (iterated) [10Xstabilizer[110X component of a bigger chain.[133X
  
  [1X43.11-2 CopyOptionsDefaults[101X
  
  [33X[1;0Y[29X[2XCopyOptionsDefaults[102X( [3XG[103X, [3Xoptions[103X ) [32X function[133X
  
  [33X[0;0Ysets  components  in  a stabilizer chain options record [3Xoptions[103X according to
  what is known about the group [3XG[103X. This can be used to obtain a new stabilizer
  chain for [3XG[103X quickly.[133X
  
  [1X43.11-3 ChangeStabChain[101X
  
  [33X[1;0Y[29X[2XChangeStabChain[102X( [3XS[103X, [3Xbase[103X[, [3Xreduced[103X] ) [32X function[133X
  
  [33X[0;0Ychanges  or reduces a stabilizer chain [3XS[103X to be adapted to the base [3Xbase[103X. The
  optional argument [3Xreduced[103X is interpreted as follows.[133X
  
  [8X[10Xreduced = [110X[8X[9Xfalse[109X : [108X
        [33X[0;6Ychange the stabilizer chain, do not reduce it,[133X
  
  [8X[10Xreduced = [110X[8X[9Xtrue[109X : [108X
        [33X[0;6Ychange the stabilizer chain, reduce it.[133X
  
  [1X43.11-4 ExtendStabChain[101X
  
  [33X[1;0Y[29X[2XExtendStabChain[102X( [3XS[103X, [3Xbase[103X ) [32X function[133X
  
  [33X[0;0Yextends  the  stabilizer  chain  [3XS[103X  so that it corresponds to base [3Xbase[103X. The
  original base of [3XS[103X must be a subset of [3Xbase[103X.[133X
  
  [1X43.11-5 ReduceStabChain[101X
  
  [33X[1;0Y[29X[2XReduceStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Ychanges  the stabilizer chain [3XS[103X to a reduced stabilizer chain by eliminating
  trivial steps.[133X
  
  [1X43.11-6 RemoveStabChain[101X
  
  [33X[1;0Y[29X[2XRemoveStabChain[102X( [3XS[103X ) [32X function[133X
  
  [33X[0;0Y[3XS[103X  must be a stabilizer record in a stabilizer chain. This chain then is cut
  off  at  [3XS[103X by changing the entries in [3XS[103X. This can be used to remove trailing
  trivial steps.[133X
  
  [1X43.11-7 EmptyStabChain[101X
  
  [33X[1;0Y[29X[2XEmptyStabChain[102X( [3Xlabels[103X, [3Xid[103X[, [3Xpnt[103X] ) [32X function[133X
  
  [33X[0;0Yconstructs  a  stabilizer  chain  for  the trivial group with [10Xidentity[110X value
  equal  to[3Xid[103X  and  [10Xlabels = [110X[22X{ [3Xid[103X } ∪[122X [3Xlabels[103X (but of course with [10Xgenlabels[110X and
  [10Xgenerators[110X  values  an  empty  list).  If the optional third argument [3Xpnt[103X is
  present,  the only stabilizer of the chain is initialized with the one-point
  basic orbit [10X[ [3Xpnt[103X[10X ][110X and with [10Xtranslabels[110X and [10Xtransversal[110X components.[133X
  
  [1X43.11-8 InsertTrivialStabilizer[101X
  
  [33X[1;0Y[29X[2XInsertTrivialStabilizer[102X( [3XS[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Y[2XInsertTrivialStabilizer[102X  initializes  the  current  stabilizer  with  [3Xpnt[103X as
  [2XEmptyStabChain[102X  ([14X43.11-7[114X)  did,  but  assigns  the  original  [3XS[103X  to  the new
  [10X[3XS[103X[10X.stabilizer[110X  component, such that a new level with trivial basic orbit (but
  identical  [10Xlabels[110X  and  [10XShallowCopy[110Xed [10Xgenlabels[110X and [10Xgenerators[110X) is inserted.
  This  function  should be used only if [3Xpnt[103X really is fixed by the generators
  of [3XS[103X, because then new generators can be added and the orbit and transversal
  at the same time extended with [2XAddGeneratorsExtendSchreierTree[102X ([14X43.11-10[114X).[133X
  
  [1X43.11-9 IsFixedStabilizer[101X
  
  [33X[1;0Y[29X[2XIsFixedStabilizer[102X( [3XS[103X, [3Xpnt[103X ) [32X function[133X
  
  [33X[0;0Yreturns [9Xtrue[109X if [3Xpnt[103X is fixed by all generators of [3XS[103X and [9Xfalse[109X otherwise.[133X
  
  [1X43.11-10 AddGeneratorsExtendSchreierTree[101X
  
  [33X[1;0Y[29X[2XAddGeneratorsExtendSchreierTree[102X( [3XS[103X, [3Xnew[103X ) [32X function[133X
  
  [33X[0;0Yadds the elements in [3Xnew[103X to the list of generators of [3XS[103X and at the same time
  extends  the  orbit  and transversal. This is the only legal way to extend a
  Schreier   tree   (because  this  involves  careful  handling  of  the  tree
  components).[133X
  
  
  [1X43.12 [33X[0;0YBacktrack[133X[101X
  
  [33X[0;0YA  main use for stabilizer chains is in backtrack algorithms for permutation
  groups.  [5XGAP[105X  implements  a  partition-backtrack  algorithm  as described in
  [Leo91] and refined in [The97].[133X
  
  [1X43.12-1 SubgroupProperty[101X
  
  [33X[1;0Y[29X[2XSubgroupProperty[102X( [3XG[103X, [3XPr[103X[, [3XL[103X] ) [32X function[133X
  
  [33X[0;0Y[3XPr[103X  must  be a one-argument function that returns [9Xtrue[109X or [9Xfalse[109X for elements
  of  the permutation group [3XG[103X, and the subset of elements of [3XG[103X that fulfill [3XPr[103X
  must  be a subgroup. ([13XIf the latter is not true the result of this operation
  is  unpredictable![113X)  This  command  computes  this  subgroup.  The  optional
  argument  [3XL[103X must be a subgroup of the set of all elements in [3XG[103X fulfilling [3XPr[103X
  and can be given if known in order to speed up the calculation.[133X
  
  [1X43.12-2 ElementProperty[101X
  
  [33X[1;0Y[29X[2XElementProperty[102X( [3XG[103X, [3XPr[103X[, [3XL[103X[, [3XR[103X]] ) [32X function[133X
  
  [33X[0;0Y[2XElementProperty[102X  returns  an  element [22Xπ[122X of the permutation group [3XG[103X such that
  the  one-argument function [3XPr[103X returns [9Xtrue[109X for [22Xπ[122X. It returns [9Xfail[109X if no such
  element  exists in [3XG[103X. The optional arguments [3XL[103X and [3XR[103X are subgroups of [3XG[103X such
  that  the  property [3XPr[103X has the same value for all elements in the cosets [3XL[103X [22Xg[122X
  and [22Xg[122X [3XR[103X, respectively, with [22Xg ∈ [3XG[103X[122X.[133X
  
  [33X[0;0YA  typical  example of using the optional subgroups [3XL[103X and [3XR[103X is the conjugacy
  test for elements [22Xa[122X and [22Xb[122X for which one can set [3XL[103X[22X:= C_[3XG[103X(a)[122X and [3XR[103X[22X:= C_[3XG[103X(b)[122X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xpropfun:= el -> (1,2,3)^el in [ (1,2,3), (1,3,2) ];;[127X[104X
    [4X[25Xgap>[125X [27XSubgroupProperty( g, propfun, Subgroup( g, [ (1,2,3) ] ) );[127X[104X
    [4X[28XGroup([ (1,2,3), (2,3) ])[128X[104X
    [4X[25Xgap>[125X [27XElementProperty( g, el -> Order( el ) = 2 );[127X[104X
    [4X[28X(2,4)[128X[104X
  [4X[32X[104X
  
  [33X[0;0YChapter [14X42[114X  describes  special  operations  to construct permutations in the
  symmetric group without using backtrack constructions.[133X
  
  [33X[0;0YBacktrack  routines  are  also  called by the methods for permutation groups
  that  compute centralizers, normalizers, intersections, conjugating elements
  as  well  as  stabilizers  for  the  operations  of  a permutation group via
  [2XOnPoints[102X   ([14X41.2-1[114X),  [2XOnSets[102X  ([14X41.2-4[114X),  [2XOnTuples[102X  ([14X41.2-5[114X)  and  [2XOnSetsSets[102X
  ([14X41.2-7[114X).   Some  of  these  methods  use  more  specific  refinements  than
  [2XSubgroupProperty[102X   ([14X43.12-1[114X)  or  [2XElementProperty[102X.  For  the  definition  of
  refinements, and how one can define refinements, see Section [14X87.2[114X.[133X
  
  [1X43.12-3 TwoClosure[101X
  
  [33X[1;0Y[29X[2XTwoClosure[102X( [3XG[103X ) [32X attribute[133X
  
  [33X[0;0YThe [13X2-closure[113X of a transitive permutation group [3XG[103X on [22Xn[122X points is the largest
  subgroup  of  the  symmetric  group [22XS_n[122X which has the same orbits on sets of
  ordered  pairs  of  points as the group [3XG[103X has. It also can be interpreted as
  the stabilizer of the orbital graphs of [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XTwoClosure(Group((1,2,3),(2,3,4)));[127X[104X
    [4X[28XSym( [ 1 .. 4 ] )[128X[104X
  [4X[32X[104X
  
  [1X43.12-4 InfoBckt[101X
  
  [33X[1;0Y[29X[2XInfoBckt[102X [32X info class[133X
  
  [33X[0;0Yis the info class for the partition backtrack routines.[133X
  
  
  [1X43.13 [33X[0;0YWorking with large degree permutation groups[133X[101X
  
  [33X[0;0YPermutation groups of large degree (usually at least a few [22X10000[122X) can pose a
  challenge  to  the heuristics used in the algorithms for permutation groups.
  This  section  lists a few useful tricks that may speed up calculations with
  such large groups enormously.[133X
  
  [33X[0;0YThe  first aspect concerns solvable groups: A lot of calculations (including
  an  initial  stabilizer  chain  computation  thanks  to  the  algorithm from
  [Sim90])  are  faster if a permutation group is known to be solvable. On the
  other  hand,  proving  nonsolvability  can  be expensive for higher degrees.
  Therefore  [5XGAP[105X  will automatically test a permutation group for solvability,
  only  if the degree is not exceeding [22X100[122X. (See also the [10XtryPcgs[110X component of
  [2XStabChainOptions[102X  ([14X43.8-2[114X).)  It  is therefore beneficial to tell a group of
  larger   degree,   which  is  known  to  be  solvable,  that  it  is,  using
  [10XSetIsSolvableGroup([3XG[103X[10X,true)[110X.[133X
  
  [33X[0;0YThe  second  aspect  concerns memory usage. A permutation on more than [22X65536[122X
  points  requires  [22X4[122X  bytes  per point for storing. So permutations on [22X256000[122X
  points  require  roughly  1MB  of  storage per permutation. Just storing the
  permutations  required  for  a  stabilizer chain might already go beyond the
  available  memory,  in  particular  if the base is not very short. In such a
  situation  it  can  be  useful, to replace the permutations by straight line
  program elements (see [14X37.9[114X).[133X
  
  [33X[0;0YThe  following  code  gives an example of usage: We create a group of degree
  [22X231000[122X.  Using  straight line program elements, one can compute a stabilizer
  chain in about [22X200[122X MB of memory.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XRead("largeperms"); # read generators from file[127X[104X
    [4X[25Xgap>[125X [27Xgens:=StraightLineProgGens(permutationlist);;[127X[104X
    [4X[25Xgap>[125X [27Xg:=Group(gens);[127X[104X
    [4X[28X<permutation group with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27X# use random algorithm (faster, but result is monte carlo)[127X[104X
    [4X[25Xgap>[125X [27XStabChainOptions(g).random:=1;;[127X[104X
    [4X[25Xgap>[125X [27XSize(g); # enforce computation of a stabilizer chain[127X[104X
    [4X[28X3529698298145066075557232833758234188056080273649172207877011796336000[128X[104X
  [4X[32X[104X
  
  [33X[0;0YWithout  straight  line  program  elements,  the  same calculation runs into
  memory problems after a while even with 512MB of workspace:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xh:=Group(permutationlist);[127X[104X
    [4X[28X<permutation group with 5 generators>[128X[104X
    [4X[25Xgap>[125X [27XStabChainOptions(h).random:=1;;[127X[104X
    [4X[25Xgap>[125X [27XSize(h);[127X[104X
    [4X[28Xexceeded the permitted memory (`-o' command line option)[128X[104X
    [4X[28X...[128X[104X
  [4X[32X[104X
  
  [33X[0;0YThe advantage in memory usage however is paid for in runtime: Comparisons of
  elements  become  much  more  expensive.  One  can avoid some of the related
  problems by registering a known base with the straight line program elements
  (see [2XStraightLineProgGens[102X  ([14X37.9-3[114X)).  In  this case element comparison will
  only  compare  the images of the given base points. If we are planning to do
  extensive  calculations  with the group, it can even be worth to recreate it
  with straight line program elements knowing a previously computed base:[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27X# get the base we computed already[127X[104X
    [4X[25Xgap>[125X [27Xbas:=BaseStabChain(StabChainMutable(g));[127X[104X
    [4X[28X[ 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55,[128X[104X
    [4X[28X...[128X[104X
    [4X[28X  2530, 2533, 2554, 2563, 2569 ][128X[104X
    [4X[25Xgap>[125X [27Xgens:=StraightLineProgGens(permutationlist,bas);;[127X[104X
    [4X[25Xgap>[125X [27Xg:=Group(gens);;[127X[104X
    [4X[25Xgap>[125X [27XSetSize(g,[127X[104X
    [4X[25X>[125X [27X3529698298145066075557232833758234188056080273649172207877011796336000);[127X[104X
    [4X[25Xgap>[125X [27XRandom(g);; # enforce computation of a stabilizer chain[127X[104X
  [4X[32X[104X
  
  [33X[0;0YAs  we  know already base and size, this second stabilizer chain calculation
  is much faster than the first one and takes less memory.[133X
  
