  
  [1X4 Group Recognition[0X
  
  This  chapter describes a generic framework for group recognition. The basic
  problem  is, we want to solve the constructive membership problem: given any
  g  in  G,  G = < X >, write a straight line program (SLP) from X to g, for g
  notin  G  (in  the  situation  that G is naturally embedded into some bigger
  group), the algorithm should fail. This is usually done by constructing some
  nice  generators  (and then writing an SLP from the nice generators to g and
  concatenating  with  an  SLP  from  X  to  the  nice generators). Often, for
  efficiency  reasons, we will just store the nice generators and then only be
  interested  in  the  SLP from those to g. The framework presented here deals
  with exactly this process.
  
  The   generic  framework  was  designed  having  four  situations  in  mind:
  permutation  groups,  matrix groups, projective groups and black box groups.
  Although the methods used are quite different for those four cases, there is
  a  common  pattern in the procedure of recognition. Namely, first we have to
  find  a  homomorphism, solve the constructive membership problem recursively
  in  image  and  kernel,  then  put it together. The recursion ends in groups
  where we can solve the constructive membership problem directly. The general
  framework  reflects  this  idea  and  separates  it  from  the  rest  of the
  recognition methods.
  
  Solution of the constructive membership problem comes in two stages: first a
  "recognition  phase"  and then a "verification phase". The recognition phase
  usually  consists  of  randomised  algorithms  with certain error or failure
  probabilities.  The  result  is  some kind of "recognition information" that
  will describe the group already very well, but which is not yet proven to be
  correct.  However,  one can already write arbitrary elements in the group as
  product of the given generators. In the verification phase a presentation of
  the  group  is  calculated,  thereby proving that the group generated by the
  given  generators  is  in  fact  isomorphic  to  the  group described by the
  recognition  information.  In many cases the verification phase will be much
  more expensive than the recognition phase.
  
  In  the following sections, we describe the generic framework. We begin with
  a technical description of the recursive procedure and describe then the way
  methods  to  find homomorphism have to be implemented. Finally, we have four
  sections  in  which  we collect conventions for the recognition of different
  types of groups.
  
  No actual recognition methods are implemented in this package. See the [5Xrecog[0m
  package for an implementation and description of them.
  
  
  [1X4.1 The recursive procedure[0X
  
  As  explained at the beginning of this section, the heart of the recognition
  procedure  is  a  function  called [2XRecogniseGeneric[0m ([14X4.1-1[0m) which gets a [5XGAP[0m
  group  object  and  returns  a  so-called  "recognition  info  record"  (see
  Subsection  [14X4.2[0m  for  details). Success or failure will be indicated by this
  record being in the filter [2XIsReady[0m ([14X4.2-4[0m) or not.
  
  To  know  how  to find homomorphisms the function gets as another argument a
  database  of  methods  (see  Section  [14X4.3[0m for a description of the setup for
  methods  for  finding homomorphisms and Section [14X3.1[0m in Chapter [14X3[0m for details
  about  method  databases).  This database will be different according to the
  type of group in question.
  
  To  describe  the  algorithm  executed  by [2XRecogniseGeneric[0m ([14X4.1-1[0m) we first
  summarise it in steps:
  
  (1)   Create a new, empty recognition info record.
  
  (2)   Use  the database of [10XFindHomomorphism[0m methods and the method selection
        procedure  described in Chapter [14X3[0m to try to find a homomorphism onto a
        smaller  group  or  an isomorphism onto another known group. Terminate
        with failure if this does not work.
  
  (3)   If  an  isomorphism  is  found or a method somehow else recognises the
        group  in  question,  such that we can write elements as straight line
        programs in the generators from now on, then make the recognition info
        record a leaf of the recognition tree and return success.
  
  (4)   Otherwise  the  function sets up all the data for the homomorphism and
        calls  itself with the image of the homomorphism. Note that this might
        use  another  database of recognition methods because the homomorphism
        might change the representation of the group.
  
  (5)   After  successful recognition of the factor group the procedure has to
        recognise  the  kernel of the homomorphism. The first step for this is
        to   find   generators.  If  they  are  not  already  known  from  the
        [10XFindHomomorphism[0m method, they are created by producing random elements
        in the group, mapping them through the homomorphism, writing them as a
        straight  line  program  in  the images of the generators and applying
        this straight line program to the original generators. The quotient of
        the random element and the result of the straight line program lies in
        the kernel of the homomorphism. After creating 20 random generators of
        the kernel we assume for the moment that they generate the kernel.
  
  (6)   The  function  [2XRecogniseGeneric[0m  ([14X4.1-1[0m)  can  now call itself for the
        kernel.  After  successful  recognition of the kernel all the data for
        the node is completed and success is returned.
  
  (7)   The  function  [2XRecogniseGeneric[0m  ([14X4.1-1[0m) now acquires preimages of the
        nice   generators   behind  the  homomorphism  and  appends  the  nice
        generators  of  the kernel. This list of generators is now the list of
        nice generators for the current node.
  
  Note  that  with  the collected data one can write arbitrary elements of the
  group as a straight line program in the generators as follows:
  
  (1)   Map the element through the homomorphism.
  
  (2)   Write  the  element  in  the  factor  group  as  a product of the nice
        generators in the factor group.
  
  (3)   Apply  the  resulting  straight line program to the preimages of those
        nice  generators and calculate the quotient, which will now lie in the
        kernel.
  
  (4)   Write  the  kernel  element  as  a straight line program in the kernel
        generators.
  
  (5)   Assemble  both  straight  line  programs  to  one bigger straight line
        program  (which is now in terms of our own nice generators) and return
        it.
  
  If  this  procedure fails in the fourth step, this indicates that our random
  generators  for  the  kernel  did not yet generate the full kernel and makes
  further recognition steps necessary. This will not happen after a successful
  verification phase.
  
  The  latter  procedure  to  write  elements as straight line programs in the
  generators is implemented in the function [2XSLPforElementGeneric[0m ([14X4.3-2[0m) which
  will  be  called  automatically  if  one  calls  the  [2XSLPforElement[0m ([14X4.2-14[0m)
  function  of  the  resulting  recognition  info  record  (see  [2Xslpforelement[0m
  ([14X4.2-13[0m)).
  
  It  is  now  high time to give you the calling details of the main recursive
  recognition function:
  
  [1X4.1-1 RecogniseGeneric[0m
  
  [2X> RecogniseGeneric( [0X[3XH, methoddb, depth[, knowledge][0X[2X ) ______________[0Xfunction
  [2X> RecognizeGeneric( [0X[3XH, methoddb, depth[, knowledge][0X[2X ) ______________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m  must  be  a  [5XGAP[0m  group object, [3Xmethoddb[0m must be a method database in the
  sense  of  Section  [14X3.1[0m  containing [10XFindHomomorphism[0m methods in the sense of
  Section [14X4.3[0m. [3Xdepth[0m is an integer which measures the depth in the recognition
  tree. It will be increased by one for each step we go into the tree. The top
  level  has  depth 0. [3Xknowledge[0m is an optional record the components of which
  are  copied  into  the  new recognition info record which is created for the
  group  [3XH[0m.  Especially  the  component [10Xhints[0m can contain a list of additional
  find  homomorphism methods (described by records as in Section [14X3.1[0m) which is
  prepended  to the method database in [3Xmethoddb[0m before the recognition starts.
  This  feature  is  intended  to give hints about prior knowledge about which
  find homomorphism method might succeed.
  
  The  function performs the algorithm described above and returns either [10Xfail[0m
  in  case of failure or a recognition info record in case of success. For the
  content and definition of recognition info records see Section [14X4.2[0m.
  
  The  user  will  usually  not  call this function directly, but will use the
  following convenience functions:
  
  [1X4.1-2 RecognisePermGroup[0m
  
  [2X> RecognisePermGroup( [0X[3XH[0X[2X ) __________________________________________[0Xfunction
  [2X> RecognizePermGroup( [0X[3XH[0X[2X ) __________________________________________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m   must   be   a   [5XGAP[0m   permutation  group  object.  This  function  calls
  [2XRecogniseGeneric[0m  ([14X4.1-1[0m)  with  the  method  database  used for permutation
  groups, which is stored in the global variable [2XFindHomDbPerm[0m ([14X4.1-7[0m), and no
  prior knowledge.
  
  [1X4.1-3 RecogniseMatrixGroup[0m
  
  [2X> RecogniseMatrixGroup( [0X[3XH[0X[2X ) ________________________________________[0Xfunction
  [2X> RecognizeMatrixGroup( [0X[3XH[0X[2X ) ________________________________________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m  must  be  a [5XGAP[0m matrix group object. This function calls [2XRecogniseGeneric[0m
  ([14X4.1-1[0m)  with the method database used for matrix groups, which is stored in
  the global variable [2XFindHomDbMatrix[0m ([14X4.1-10[0m), and no prior knowledge.
  
  [1X4.1-4 RecogniseProjectiveGroup[0m
  
  [2X> RecogniseProjectiveGroup( [0X[3XH[0X[2X ) ____________________________________[0Xfunction
  [2X> RecognizeProjectiveGroup( [0X[3XH[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m  must  be  a [5XGAP[0m matrix group object. Since as of now no actual projective
  groups  are implemented in the [5XGAP[0m library we use matrix groups instead. The
  recognition  will  however  view the group as the projective group, i.e. the
  matrix   group   modulo   its   scalar   matrices.   This   function   calls
  [2XRecogniseGeneric[0m  ([14X4.1-1[0m)  with  the  method  database  used  for projective
  groups, which is stored in the global variable [2XFindHomDbProjective[0m ([14X4.1-13[0m),
  and no prior knowledge.
  
  [1X4.1-5 RecogniseBBGroup[0m
  
  [2X> RecogniseBBGroup( [0X[3XH[0X[2X ) ____________________________________________[0Xfunction
  [2X> RecognizeBBGroup( [0X[3XH[0X[2X ) ____________________________________________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m must be a [5XGAP[0m black box group object. This function calls [2XRecogniseGeneric[0m
  ([14X4.1-1[0m)  with the method database used for black box groups, which is stored
  in the global variable [2XFindHomDbBB[0m ([14X4.1-16[0m), and no prior knowledge.
  
  [1X4.1-6 RecogniseGroup[0m
  
  [2X> RecogniseGroup( [0X[3XH[0X[2X ) ______________________________________________[0Xfunction
  [2X> RecognizeGroup( [0X[3XH[0X[2X ) ______________________________________________[0Xfunction
  [6XReturns:[0X  [10Xfail[0m for failure or a recognition info record.
  
  [3XH[0m  must be a [5XGAP[0m group object. This function automatically dispatches to one
  of    the    three    previous    functions    [2XRecognisePermGroup[0m   ([14X4.1-2[0m),
  [2XRecogniseMatrixGroup[0m  ([14X4.1-3[0m), or [2XRecogniseBBGroup[0m ([14X4.1-5[0m), according to the
  type of the group [3XH[0m. Note that since currently there is no implementation of
  projective  groups in the [5XGAP[0m library, one cannot recognise a matrix group [3XH[0m
  as a projective group using this function.
  
  [1X4.1-7 FindHomDbPerm[0m
  
  [2X> FindHomDbPerm______________________________________________[0Xglobal variable
  
  This  list  contains  the  methods for finding homomorphisms for permutation
  group  recognition that are stored in the record [2XFindHomMethodsPerm[0m ([14X4.1-8[0m).
  As  described  in Section [14X3.1[0m each method is described by a record. The list
  is  always  sorted  with respect to decreasing ranks. The order in this list
  tells in which order the methods should be applied. Use [2XAddMethod[0m ([14X3.1-1[0m) to
  add methods to this database.
  
  [1X4.1-8 FindHomMethodsPerm[0m
  
  [2X> FindHomMethodsPerm_________________________________________[0Xglobal variable
  
  In   this   global  record  the  functions  that  are  methods  for  finding
  homomorphisms  for permutation group recognition are stored. We collect them
  all  in  this  record  such  that  we do not use up too many global variable
  names.
  
  [1X4.1-9 SLPforElementFuncsPerm[0m
  
  [2X> SLPforElementFuncsPerm_____________________________________[0Xglobal variable
  
  This  global  record  holds the functions that are methods for writing group
  elements  as  straight line programs (SLPs) in terms of the generators after
  successful permutation group recognition. We collect them all in this record
  such that we do not use up too many global variable names.
  
  [1X4.1-10 FindHomDbMatrix[0m
  
  [2X> FindHomDbMatrix____________________________________________[0Xglobal variable
  
  This  list  contains  the methods for finding homomorphisms for matrix group
  recognition  that are stored in the record [2XFindHomMethodsMatrix[0m ([14X4.1-11[0m). As
  described  in  Section [14X3.1[0m each method is described by a record. The list is
  always sorted with respect to decreasing ranks. The order in this list tells
  in  which  order the methods should be applied. Use [2XAddMethod[0m ([14X3.1-1[0m) to add
  methods to this database.
  
  [1X4.1-11 FindHomMethodsMatrix[0m
  
  [2X> FindHomMethodsMatrix_______________________________________[0Xglobal variable
  
  In   this   global  record  the  functions  that  are  methods  for  finding
  homomorphisms  for  matrix group recognition are stored. We collect them all
  in this record such that we do not use up too many global variable names.
  
  [1X4.1-12 SLPforElementFuncsMatrix[0m
  
  [2X> SLPforElementFuncsMatrix___________________________________[0Xglobal variable
  
  This  global  record  holds the functions that are methods for writing group
  elements  as  straight line programs (SLPs) in terms of the generators after
  successful matrix group recognition. We collect them all in this record such
  that we do not use up too many global variable names.
  
  [1X4.1-13 FindHomDbProjective[0m
  
  [2X> FindHomDbProjective________________________________________[0Xglobal variable
  
  This  list  contains  the  methods  for finding homomorphisms for projective
  group  recognition  that  are  stored in the record [2XFindHomMethodsProjective[0m
  ([14X4.1-14[0m).  As described in Section [14X3.1[0m each method is described by a record.
  The  list  is  always  sorted with respect to decreasing ranks. The order in
  this  list tells in which order the methods should be applied. Use [2XAddMethod[0m
  ([14X3.1-1[0m) to add methods to this database.
  
  [1X4.1-14 FindHomMethodsProjective[0m
  
  [2X> FindHomMethodsProjective___________________________________[0Xglobal variable
  
  In   this   global  record  the  functions  that  are  methods  for  finding
  homomorphisms  for  projective group recognition are stored. We collect them
  all  in  this  record  such  that  we do not use up too many global variable
  names.
  
  [1X4.1-15 SLPforElementFuncsProjective[0m
  
  [2X> SLPforElementFuncsProjective_______________________________[0Xglobal variable
  
  This  global  record  holds the functions that are methods for writing group
  elements  as  straight line programs (SLPs) in terms of the generators after
  successful  projective group recognition. We collect them all in this record
  such that we do not use up too many global variable names.
  
  [1X4.1-16 FindHomDbBB[0m
  
  [2X> FindHomDbBB________________________________________________[0Xglobal variable
  
  This list contains the methods for finding homomorphisms for black box group
  recognition  that  are  stored  in  the record [2XFindHomMethodsBB[0m ([14X4.1-17[0m). As
  described  in  Section [14X3.1[0m each method is described by a record. The list is
  always sorted with respect to decreasing ranks. The order in this list tells
  in  which  order the methods should be applied. Use [2XAddMethod[0m ([14X3.1-1[0m) to add
  methods to this database.
  
  [1X4.1-17 FindHomMethodsBB[0m
  
  [2X> FindHomMethodsBB___________________________________________[0Xglobal variable
  
  In   this   global  record  the  functions  that  are  methods  for  finding
  homomorphisms  for  black  box group recognition are stored. We collect them
  all  in  this  record  such  that  we do not use up too many global variable
  names.
  
  [1X4.1-18 SLPforElementFuncsBB[0m
  
  [2X> SLPforElementFuncsBB_______________________________________[0Xglobal variable
  
  This  global  record  holds the functions that are methods for writing group
  elements  as  straight line programs (SLPs) in terms of the generators after
  successful  black  box group recognition. We collect them all in this record
  such that we do not use up too many global variable names.
  
  
  [1X4.2 Recognition info records[0X
  
  A  recognition info record is a [5XGAP[0m positional object. It is a member of the
  family
  
  [1X4.2-1 RecognitionInfoFamily[0m
  
  [2X> RecognitionInfoFamily_______________________________________________[0Xfamily
  and is in the category
  
  [1X4.2-2 IsRecognitionInfo[0m
  
  [2X> IsRecognitionInfo_________________________________________________[0XCategory
  and  is  [2XIsAttributeStoringRep[0m  ([14XPrg  Tutorial: IsAttributeStoringRep[0m), such
  that  we  can  define attributes for it, the values of which are stored once
  they  are  known. A recognition info record always represents a whole binary
  tree  of  such  records, see the attributes [2XRIFac[0m ([14X4.2-9[0m) and [2XRIKer[0m ([14X4.2-10[0m)
  below.
  
  The following filters are defined for recognition info records:
  
  [1X4.2-3 IsLeaf[0m
  
  [2X> IsLeaf________________________________________________________________[0XFlag
  
  This  flag  indicates, whether or not a recognition info record represents a
  leaf  in  the  recognition tree. If it is not set, one finds at least one of
  the  attributes  [2XRIFac[0m  ([14X4.2-9[0m) and [2XRIKer[0m ([14X4.2-10[0m) set for the corresponding
  node.  This  flag is normally reset and has to be set by a find homomorphism
  method to indicate a leaf.
  
  [1X4.2-4 IsReady[0m
  
  [2X> IsReady_______________________________________________________________[0XFlag
  
  This  flag indicates during the recognition procedure, whether a node in the
  recognition tree is already completed or not. It is mainly set for debugging
  purposes during the recognition. However, if the recognition fails somewhere
  in  a leaf, this flag is not set and all nodes above will also not have this
  flag  set.  In this way one can see whether the recognition failed and where
  the  problem  was.  If  a  find  homomorphism  method uses [10Xdonotrecurse[0m (see
  [14X4.2-33[0m) to avoid further recursion it acquires thereby responsibility to set
  the [2XIsReady[0m flag in the corresponding subtree upon completion.
  
  The following attributes are defined for recognition info records:
  
  [1X4.2-5 Grp[0m
  
  [2X> Grp( [0X[3Xri[0X[2X ) _______________________________________________________[0Xattribute
  
  The  value  of  this attribute is the group that is to be recognised by this
  recognition  info  record  [3Xri[0m.  This  attribute  is  always  present  during
  recognition  and  after  completion.  Note  that the generators of the group
  object stored here always have a memory attached to them, such that elements
  that are generated from them remember, how they were acquired.
  
  [1X4.2-6 Homom[0m
  
  [2X> Homom( [0X[3Xri[0X[2X ) _____________________________________________________[0Xattribute
  
  The  value  of  this  attribute  is the homomorphism that was found from the
  group described by the recognition info record [3Xri[0m as a [5XGAP[0m object. It is set
  by  a  find  homomorphism  method  that succeeded to find a homomorphism (or
  isomorphism).  It  does  not have to be set in leaf nodes of the recognition
  tree.
  
  [1X4.2-7 NiceGens[0m
  
  [2X> NiceGens( [0X[3Xri[0X[2X ) __________________________________________________[0Xattribute
  
  The  value of this attribute must be set for all nodes and contains the nice
  generators.  The  [2XSLPforElement[0m ([14X4.2-14[0m) function of the node will write its
  straight line program in terms of these nice generators. For leaf nodes, the
  find  homomorphism  method  is  responsible to set the value of [2XNiceGens[0m. By
  default,  the original generators of the group at this node are taken. For a
  homomorphism  (or  isomorphism),  the  [2XNiceGens[0m will be the concatenation of
  preimages  of  the [2XNiceGens[0m of the factor group (see [2Xpregensfac[0m ([14X4.2-8[0m)) and
  the  [2XNiceGens[0m of the kernel. A find homomorphism method does not have to set
  [2XNiceGens[0m  if  it  finds  a  homomorphism.  Note  however,  that  such a find
  homomorphism method has to ensure somehow, that preimages of the [2XNiceGens[0m of
  the  factor  group  can be acquired. See [2Xcalcnicegens[0m ([14X4.2-17[0m), [2XCalcNiceGens[0m
  ([14X4.2-20[0m) and [2Xslptonice[0m ([14X4.2-21[0m) for instructions.
  
  [1X4.2-8 pregensfac[0m
  
  [2X> pregensfac( [0X[3Xri[0X[2X ) ________________________________________________[0Xattribute
  
  The value of this attribute is only set for homomorphism nodes. In that case
  it  contains  preimages  of  the  nice  generators in the factor group. This
  attribute is set automatically by the generic recursive recognition function
  using  the  mechanism  described  with  the  attribute [2Xcalcnicegens[0m ([14X4.2-17[0m)
  below. A find homomorphism does not have to touch this attribute.
  
  [1X4.2-9 RIFac[0m
  
  [2X> RIFac( [0X[3Xri[0X[2X ) _____________________________________________________[0Xattribute
  
  The  value  of this attribute is the recognition info record of the image of
  the  homomorphism that was found from the group described by the recognition
  info  record  [3Xri[0m.  It is set by the generic recursive procedure after a find
  homomorphism  method  has succeeded to find a homomorphism (or isomorphism).
  It  does  not  have  to  be  set in leaf nodes of the recognition tree. This
  attribute value provides the link to the "factor" subtree of the recognition
  tree.
  
  [1X4.2-10 RIKer[0m
  
  [2X> RIKer( [0X[3Xri[0X[2X ) _____________________________________________________[0Xattribute
  
  The  value of this attribute is the recognition info record of the kernel of
  the  homomorphism that was found from the group described by the recognition
  info  record  [3Xri[0m.  It is set by the generic recursive procedure after a find
  homomorphism  method  has succeeded to find a homomorphism (or isomorphism).
  It  does  not have to be set in leaf nodes of the recognition tree or if the
  homomorphism  is known to be an isomorphism. In the latter case the value of
  the  attribute is set to [10Xfail[0m. This attribute value provides the link to the
  "kernel" subtree of the recognition tree.
  
  [1X4.2-11 RIParent[0m
  
  [2X> RIParent( [0X[3Xri[0X[2X ) __________________________________________________[0Xattribute
  
  The  value of this attribute is the recognition info record of the parent of
  this node in the recognition tree. The top node does not have this attribute
  set.
  
  [1X4.2-12 fhmethsel[0m
  
  [2X> fhmethsel( [0X[3Xri[0X[2X ) _________________________________________________[0Xattribute
  
  The  value  of this attribute is the record returned by the method selection
  (see  Section  [14X3.2[0m) after it ran to find a homomorphism (or isomorphism). It
  is there to be able to see which methods were tried until the recognition of
  the node was completed.
  
  [1X4.2-13 slpforelement[0m
  
  [2X> slpforelement( [0X[3Xri[0X[2X ) _____________________________________________[0Xattribute
  
  After  the  recognition  phase  is  completed  for  the  node  [3Xri[0m, we are by
  definition  able  to write arbitrary elements in the group described by this
  node as a straight line program (SLP) in terms of the nice generators stored
  in  [2XNiceGens[0m  ([14X4.2-7[0m). This attribute value is a function taking the node [3Xri[0m
  and  a  group  element  as  its  arguments and returning the above mentioned
  straight line program. For the case that a find homomorphism method succeeds
  in  finding  a  homomorphism,  the  generic  recursive  function  sets  this
  attribute  to  the  function [2XSLPforElementGeneric[0m ([14X4.3-2[0m) which does the job
  for  the  generic  homomorphism situation. In all other cases the successful
  find  homomorphism  method has to set this attribute to a function doing the
  job.  The  find  homomorphism method is free to store additional data in the
  recognition  info  record  or  the  group object such that the [2XSLPforElement[0m
  ([14X4.2-14[0m) function can work.
  
  [1X4.2-14 SLPforElement[0m
  
  [2X> SLPforElement( [0X[3Xri, x[0X[2X ) ___________________________________________[0Xfunction
  [6XReturns:[0X  a straight line program expressing [3Xx[0m in the nice generators.
  
  This  is  a  wrapper  function  which  extracts  the  value of the attribute
  [2Xslpforelement[0m ([14X4.2-13[0m) and calls that function with the arguments [3Xri[0m and [3Xx[0m.
  
  [1X4.2-15 StdPresentation[0m
  
  [2X> StdPresentation( [0X[3Xri[0X[2X ) ___________________________________________[0Xattribute
  
  After  the verification phase, the presentation is stored here. Details have
  still to be decided upon.
  
  [1X4.2-16 methodsforfactor[0m
  
  [2X> methodsforfactor( [0X[3Xri[0X[2X ) __________________________________________[0Xattribute
  
  This  attribute is initialised at the beginning of the recursive recognition
  function  with  the  database  of find homomorphism methods that was used to
  recognise  the group corresponding to the recognition info record [3Xri[0m. If the
  found  homomorphism  changes  the  representation  of  the  group (going for
  example  from  a matrix group to a permutation group), the find homomorphism
  method  can  report  this  by  exchanging  the database of find homomorphism
  methods  to  be  used in the recognition of the image of the homomorphism by
  setting  the  value of this attribute to something different. It lies in the
  responsibility   of   the   find  homomorphism  method  to  do  so,  if  the
  representation changes through the homomorphism.
  
  The  following  two  attributes  are concerned with the relation between the
  original  generators  and  the  nice generators for a node. They are used to
  transport  this information from a successful find homomorphism method up to
  the recursive recognition function:
  
  [1X4.2-17 calcnicegens[0m
  
  [2X> calcnicegens( [0X[3Xri[0X[2X ) ______________________________________________[0Xattribute
  
  To  make  the  recursion  work,  we  have  to  acquire preimages of the nice
  generators  in  factor  groups  under the homomorphism found. But we want to
  keep  the  information,  how  the nice generators were found, locally at the
  node  where they were found. This attribute solves this problem of acquiring
  preimages  in  the  following  way: Its value must be a function, taking the
  recognition  info  record  [3Xri[0m  as  first  argument,  and  a list [3Xoriggens[0m of
  preimages  of the original generators of the current node, and has to return
  corresponding  preimages  of  the  nice generators. Usually this task can be
  done by storing a straight line program writing the nice generators in terms
  of  the  original  generators  and  executing  this  with  inputs  [3Xoriggens[0m.
  Therefore   the   default   value   of   this   attribute  is  the  function
  [2XCalcNiceGensGeneric[0m ([14X4.2-18[0m) described below.
  
  [1X4.2-18 CalcNiceGensGeneric[0m
  
  [2X> CalcNiceGensGeneric( [0X[3Xri, origgens[0X[2X ) ______________________________[0Xfunction
  [6XReturns:[0X  a list of preimages of the nice generators
  
  This  is  the default function for leaf nodes for the attribute [2Xcalcnicegens[0m
  ([14X4.2-17[0m)  described  above.  It  does  the  following:  If  the value of the
  attribute [2Xslptonice[0m ([14X4.2-21[0m) is set, then it must be a straight line program
  expressing  the  nice generators in terms of the original generators of this
  node.  In that case, this straight line program is executed with [3Xoriggens[0m as
  inputs  and  the  result is returned. Otherwise, [3Xoriggens[0m is returned as is.
  Therefore  a  leaf  node  just  has to do nothing if the nice generators are
  equal  to  the  original  generators, or can simply store the right straight
  line program into the attribute [2Xslptonice[0m ([14X4.2-21[0m) to fulfill its duties.
  
  [1X4.2-19 CalcNiceGensHomNode[0m
  
  [2X> CalcNiceGensHomNode( [0X[3Xri, origgens[0X[2X ) ______________________________[0Xfunction
  [6XReturns:[0X  a list of preimages of the nice generators
  
  This  is  the  default  function  for  homomorphism  node  for the attribute
  [2Xcalcnicegens[0m  ([14X4.2-17[0m).  It  just  delegates  to  factor  and  kernel of the
  homomorphism, as the nice generators of a homomorphism (or isomorphism) node
  are  just  the  concatenation  of  the nice generators of the factor and the
  kernel.  A  find  homomorphism  method finding a homomorphism or isomorphism
  does not have to do anything with respect to nice generators.
  
  [1X4.2-20 CalcNiceGens[0m
  
  [2X> CalcNiceGens( [0X[3Xri, origgens[0X[2X ) _____________________________________[0Xfunction
  [6XReturns:[0X  a list of preimages of the nice generators
  
  This  is  a  wrapper  function  which  extracts  the  value of the attribute
  [2Xcalcnicegens[0m  ([14X4.2-17[0m)  and  calls  that  function with the arguments [3Xri[0m and
  [3Xoriggens[0m.
  
  [1X4.2-21 slptonice[0m
  
  [2X> slptonice( [0X[3Xri[0X[2X ) _________________________________________________[0Xattribute
  
  As  described  above,  the  value,  if  set, must be a straight line program
  expressing  the  nice  generators  at  this  node  in  terms of the original
  generators.  This is for leaf nodes, that choose to use the default function
  [2XCalcNiceGensGeneric[0m   ([14X4.2-18[0m)   installed   in  the  [2Xcalcnicegens[0m  ([14X4.2-17[0m)
  attribute.
  
  The  following three attributes are concerned with the administration of the
  kernel of a found homomorphism. Find homomorphism methods use them to report
  to the main recursive recognition function their knowledge about the kernel:
  
  [1X4.2-22 gensN[0m
  
  [2X> gensN( [0X[3Xri[0X[2X ) _____________________________________________________[0Xattribute
  
  The value of this mutable attribute is a list of generators of the kernel of
  the  homomorphism  found  at the node [3Xri[0m. It is initialised as an empty list
  when the recursive recognition function starts. Successful find homomorphism
  methods  may  append generators of the kernel to this list if they happen to
  stumble   on  them.  After  successful  recognition  of  the  image  of  the
  homomorphism  the  main  recursive recognition function will try to create a
  few  more  generators of the kernel and append them to the list which is the
  value  of  the  attribute [2XgensN[0m. The exact behaviour depends on the value of
  the  attribute  [2XfindgensNmeth[0m  ([14X4.2-23[0m)  below. The list of generators after
  that step is used to recognise the kernel. Note that the generators in [2XgensN[0m
  have  a  memory  attached  to  them,  how they were obtained in terms of the
  original generators of the current node.
  
  [1X4.2-23 findgensNmeth[0m
  
  [2X> findgensNmeth( [0X[3Xri[0X[2X ) _____________________________________________[0Xattribute
  
  This  attribute  decides  about  how  generators  of  the  kernel of a found
  homomorphism  are  produced.  Its value has to be a record with at least two
  components bound. The first is [10Xmethod[0m which holds a function taking at least
  one  argument [3Xri[0m and possibly more, and does not return anything. The second
  is  [10Xargs[0m  which  holds a list of arguments for the above mentioned function.
  The  real  list  of  arguments is derived by prepending the recognition info
  record to the list of arguments in [10Xargs[0m. That is, the following code is used
  to call the method:
  
  [4X------------------------------------------------------------------[0X
    [4X    methgensN := findmethgensN(ri);[0X
    [4X    CallFuncList(methgensN(ri).method,Concatenation([ri],methgensN.args));[0X
  [4X------------------------------------------------------------------[0X
  
  The  record  is  initialised upon creation of the recognition info record to
  calling  [2XFindKernelRandom[0m  ([14X4.2-24[0m)  with one argument of 20 (in addition to
  the  first  argument  [3Xri[0m).  See  below  for a choice of possible find kernel
  methods.
  
  [1X4.2-24 FindKernelRandom[0m
  
  [2X> FindKernelRandom( [0X[3Xri, n[0X[2X ) ________________________________________[0Xfunction
  [6XReturns:[0X  nothing
  
  [3Xn[0m random elements are generated, mapped through the homomorphism, written as
  a straight line program in the generators. Then the straight line program is
  executed with the original generators thereby producing elements in the same
  coset.  The  quotients  are then elements of the kernel. The kernel elements
  created are stored in the attribute [2XgensN[0m ([14X4.2-22[0m).
  
  [1X4.2-25 FindKernelDoNothing[0m
  
  [2X> FindKernelDoNothing( [0X[3Xri, n[0X[2X ) _____________________________________[0Xfunction
  [6XReturns:[0X  nothing
  
  Does  nothing.  This  function is intended to be set as method for producing
  kernel  elements  if the kernel is known to be trivial or if one knows, that
  the  attribute  [2XgensN[0m ([14X4.2-22[0m) already contains a complete set of generators
  for the kernel.
  
  [1X4.2-26 FindKernelFastNormalClosure[0m
  
  [2X> FindKernelFastNormalClosure( [0X[3Xri, nr[0X[2X ) ____________________________[0Xfunction
  [6XReturns:[0X  a probable generating set for the normal closure
  
  This  function  takes the group G in the [2XGrp[0m ([14X4.2-5[0m) attribute in [3Xri[0m and the
  list  of  generators  gens  of the kernel in [2XgensN[0m ([14X4.2-22[0m) and the positive
  integer  [3Xnr[0m.  This function computes a probable generating set of the normal
  closure  in  [3XG[0m of the group generated by the generators in [3Xgens[0m. The integer
  [3Xnr[0m indicates how hard it should try.
  
  [1X4.2-27 gensNslp[0m
  
  [2X> gensNslp( [0X[3Xri[0X[2X ) __________________________________________________[0Xattribute
  
  The  recursive  recognition function calculates a straight line program that
  computes  the  generators of the kernel stored in [2XgensN[0m ([14X4.2-22[0m) in terms of
  the  generators of the group recognised by [3Xri[0m. This straight line program is
  stored  in  the  value  of this mutable attribute. It is used by the generic
  function [2XSLPforElementGeneric[0m ([14X4.3-2[0m).
  
  [1X4.2-28 immediateverification[0m
  
  [2X> immediateverification( [0X[3Xri[0X[2X ) _____________________________________[0Xattribute
  
  Sometimes  a  find homomorphism has information that it will be difficult to
  create generators for the kernel, for example if it is known that the kernel
  will  need  lots of generators. In that case this attribute with the default
  boolean  value [10Xfalse[0m can be set to [10Xtrue[0m. In that case, the generic recursive
  recognition  function will perform an immediate verification phase after the
  kernel  has  been recognised. This is done as follows: A few random elements
  are  created,  mapped  through the homomorphism and written as an SLP in the
  nice  generators  there.  Then  this SLP is executed with preimages of those
  nice  generators.  The quotient lies then in the kernel and is written as an
  SLP  in  terms of the nice generators of the would be kernel. If this is not
  possible,  then  probably the creation of kernel generators was not complete
  and  a  few  more kernel elements are produced and recognition in the kernel
  starts all over again. This is for example done in case of the "Imprimitive"
  method  which  maps  onto  the  action  on a block system. In that case, the
  kernel often needs lots of generators.
  
  The  following  attributes  are  used to give a successful find homomorphism
  method   further  possibilities  to  transport  knowledge  about  the  group
  recognised by the current recognition info record to the factor or kernel of
  the found homomorphism:
  
  [1X4.2-29 forkernel[0m
  
  [2X> forkernel( [0X[3Xri[0X[2X ) _________________________________________________[0Xattribute
  
  This  attribute  is  initialised  to  a record with only the component [10Xhints[0m
  bound  to  an  empty  list  at  the  beginning  of the recursive recognition
  function.  Find  homomorphism  methods  can put acquired knowledge about the
  group  to  be recognised (like for example an invariant subspace of a matrix
  group)  into  this record. When a homomorphism is found and recognition goes
  on  in  its  kernel,  the value of this attribute is taken as initialisation
  data  for  the  newly  created recognition info record for the kernel. Thus,
  information  is  transported down to the recognition process for the kernel.
  The  component  [10Xhints[0m  is  special  insofar  as  it  has  to contain records
  describing find homomorphism methods which might be particularly successful.
  They  are  prepended to the find homomorphism method database such that they
  are  called  before  any other methods. This is a means to give hints to the
  recognition  procedure  in the kernel, because often during the finding of a
  homomorphism  knowledge  is acquired which might help the recognition of the
  kernel.
  
  [1X4.2-30 forfactor[0m
  
  [2X> forfactor( [0X[3Xri[0X[2X ) _________________________________________________[0Xattribute
  
  This  attribute  is  initialised  to  a record with only the component [10Xhints[0m
  bound  to  an  empty  list  at  the  beginning  of the recursive recognition
  function.  Find  homomorphism  methods  can put acquired knowledge about the
  group  to  be recognised (like for example an invariant subspace of a matrix
  group)  into  this record. When a homomorphism is found and recognition goes
  on in its image, the value of this attribute is taken as initialisation data
  for  the  newly  created  recognition  info  record  for  the  factor. Thus,
  information  is  transported down to the recognition process for the factor.
  The  component  [10Xhints[0m  is  special  insofar  as  it  has  to contain records
  describing find homomorphism methods which might be particularly successful.
  They  are  prepended to the find homomorphism method database such that they
  are  called  before  any other methods. This is a means to give hints to the
  recognition  procedure  in the factor, because often during the finding of a
  homomorphism  knowledge  is acquired which might help the recognition of the
  factor.
  
  [1X4.2-31 isone[0m
  
  [2X> isone( [0X[3Xri[0X[2X ) _____________________________________________________[0Xattribute
  
  This  attribute  returns a function that tests, whether or not an element of
  the  group  is  equal  to  the  identity  or  not.  Usually this is just the
  operation [2XIsOne[0m ([14XReference: IsOne[0m) but for projective groups it is a special
  function  returning  [10Xtrue[0m  for  scalar matrices. In generic code, one should
  always  use  the  result  of  this  attribute  to  compare an element to the
  identity  such  that  the  code  works  also  for  projective  groups.  Find
  homomorphism methods usually do not have to set this attribute.
  
  [1X4.2-32 isequal[0m
  
  [2X> isequal( [0X[3Xri[0X[2X ) ___________________________________________________[0Xattribute
  
  This  attribute  returns  a function that compares two elements of the group
  being recognised. Usually this is just the operation [2XEQ[0m ([14XReference: Equality
  and  Comparison  of  Domains[0m)  but  for  projective  groups  it is a special
  function  checking  for equality up to a scalar factor. In generic code, one
  should  always use the result of this attribute to compare two elements such
  that  the  code  works also for projective groups. Find homomorphism methods
  usually do not have to set this attribute.
  
  
  [1X4.2-33 Other components of recognition info records[0X
  
  In  this  subsection  we  describe a few more components of recognition info
  records  that can be queried or set by find homomorphism methods. Not all of
  these  components  are  bound  in all cases. See the individual descriptions
  about  the  conventions.  Remember  to  use  the [10X!.[0m notation to access these
  components of a recognition info record.
  
  [8X[10Xdonotrecurse[0m[8X[0m
        This  component  can  be  set to [10Xtrue[0m by a find homomorphism method to
        indicate  that  the  generic  recursive  procedure  should not recurse
        further down, even if the corresponding node is not a leaf. It is then
        the  responsibility  of  the  find homomorphism method to complete the
        tree below.
  
  [8X[10XleavegensNuntouched[0m[8X[0m
        If  this component is bound to [10Xtrue[0m by a find homomorphism method or a
        find  kernel  generators  method,  the  generic  mechanism  to  remove
        duplicates and identities in the generator for the kernel is not used.
        This  is  important  if your methods rely on the generating set of the
        kernel being exactly as it was when found.
  
  
  [1X4.3 Methods to find homomorphisms[0X
  
  A  "find  homomorphism method" has the objective to, given a group G, either
  find  a  homomorphism  from G onto a group, or to find an isomorphism, or to
  solve the constructive membership problem directly for G, or to fail.
  
  In  case a homomorphism is found, it has to report that homomorphism back to
  the calling recursive recognition function together with as much information
  about the kernel as possible.
  
  If  a  find  homomorphism  method  determines that the node is a leaf in the
  recognition  tree (by solving the constructive membership problem directly),
  then  it  has  to ensure, that arbitrary elements can be written in terms of
  the  nice  generators of G. It does so by returning a function together with
  possible extra data, that can perform this job.
  
  Of  course,  the  find  homomorphism method also has to report, how the nice
  generators were acquired in terms of the original generators.
  
  If  the  find  homomorphism  method  fails, it has to report, whether it has
  failed  forever  or  if  it  possibly makes sense to try to call this method
  again later.
  
  Find  homomorphism  methods  have  to  fit  into  the  framework  for method
  selection  described  in  Chapter  [14X3[0m. We now begin to describe the technical
  details  of  how a find homomorphism method has to look like and what it has
  to  do  and  what  it  is  not  allowed  to do. We first explain the calling
  convention by means of a hypothetical function:
  
  [1X4.3-1 FindHomomorphism[0m
  
  [2X> FindHomomorphism( [0X[3Xri, G[0X[2X ) ________________________________________[0Xfunction
  [6XReturns:[0X  One of the values [10Xtrue[0m, [10Xfalse[0m, [10Xfail[0m, or [10XNotApplicable[0m.
  
  Find  homomorphism  methods  take  two  arguments [3Xri[0m and [3XG[0m, of which [3Xri[0m is a
  recognition info record and [3XG[0m is a [5XGAP[0m group object. The return value is one
  of  the four possible values in the framework for method selection described
  in  Chapter [14X3[0m indicating success, failure, or (temporary) non-applicability.
  The  above  mentioned  additional  information  in  case  of success are all
  returned  by  changing  the  recognition info record [3Xri[0m. For the conventions
  about what a find homomorphism method has to do and return see below.
  
  A  failed or not applicable find homomorphism method does not have to report
  or  do  anything  in the recognition info record [3Xri[0m. However, it can collect
  information  and  store  it either in the group object or in the recognition
  info  record.  Note  that  for  example  it  might  be  that  a  failed find
  homomorphism method acquires additional information that allows another find
  homomorphism method to become applicable.
  
  A  not  applicable  find  homomorphism  method should find out so relatively
  quickly, because otherwise the whole process might be slowed down, because a
  find homomorphism method repeatedly ponders about its applicability. Usually
  no big calculations should be triggered just to decide applicability.
  
  A successful find homomorphism method has the following duties:
  
  [8Xfor leaves:[0m
        First  it  has  to report whether the current node is a leaf or not in
        the recognition tree. That is, in case a leaf was found the method has
        to  do  [10XSetFilterObj(ri,IsLeaf);[0m  thereby  setting  the [2XIsLeaf[0m ([14X4.2-3[0m)
        flag.
  
        If  the  method  for  some reason chooses to finish the tree below the
        current node on its own, it can set the component [10Xdonotrecurse[0m to [10Xtrue[0m
        (see  [14X4.2-33[0m)  to  indicate  that no further action is required by the
        generic  recognition  function.  The  method  is  then responsible for
        correctly  setting the [2XIsLeaf[0m ([14X4.2-3[0m) and [2XIsReady[0m ([14X4.2-4[0m) flags in the
        whole subtree.
  
        A  method finding a homomorphism which is not an isomorphism indicates
        so by not touching the flags.
  
  [8Xfor leaves: [2XSLPforElement[0m[8X ([14X4.2-14[0m[8X) function[0m
        If  a  find homomorphism method has produced a leaf in the recognition
        tree  or has set the [10Xdonotrecurse[0m component to [10Xtrue[0m (see [14X4.2-33[0m), then
        it  has to set the attribute [2Xslpforelement[0m ([14X4.2-13[0m) to a function like
        [2XSLPforElementGeneric[0m  ([14X4.3-2[0m) that can write an arbitrary element in [3XG[0m
        as a straight line program in the nice generators of [3XG[0m. The method may
        store  additional  data  into  the recognition info record for this to
        work. It does not have to set any other value in [3Xri[0m.
  
  [8Xfor leaves: information about nice generators[0m
        If  a  find homomorphism method has produced a leaf in the recognition
        tree,  then it has to report what are the nice generators of the group
        described  by  the  leaf.  To  this  end,  it has three possibilities:
        Firstly  to  do nothing, which means, that the original generators are
        the  nice  generators.  Secondly  to  store  a  straight  line program
        expressing  the  nice  generators  in terms of the original generators
        into the attribute [2Xslptonice[0m ([14X4.2-21[0m). In that case, the generic frame
        work  takes  care  of  the  rest.  The third possibility is to store a
        function  into  the value of the attribute [2Xcalcnicegens[0m ([14X4.2-17[0m) which
        can  calculate  preimages of the nice generators in terms of preimages
        of  the  original  generators.  See  the  function [2XCalcNiceGensGeneric[0m
        ([14X4.2-18[0m) for an example of such a function.
  
  [8Xfor non-leaves: the homomorphism itself[0m
        If  a  find  homomorphism  method  has found a homomorphism, it has to
        store it as a [5XGAP[0m homomorphism object from [3XG[0m to the image group in the
        attribute  [2XHomom[0m  ([14X4.2-6[0m).  Note that if your homomorphism changes the
        representation  (for  example  going from matrix groups to permutation
        groups),  you will have to set the attribute [2Xmethodsforfactor[0m ([14X4.2-16[0m)
        accordingly.
  
  [8Xfor non-leaves: kernel generators[0m
        If  a  find  homomorphism  method  has found a homomorphism, it has to
        provide information about already known generators of the kernel. This
        is  done  firstly  by  appending known generators of the kernel to the
        attribute  value of [2XgensN[0m ([14X4.2-22[0m) and secondly by leaving or changing
        the attribute [2XfindgensNmeth[0m ([14X4.2-23[0m) to a record describing the method
        that  should  be used (for details see [2XfindgensNmeth[0m ([14X4.2-23[0m)). If one
        does  not change the default value, the recursive recognition function
        will generate 20 random elements in [3XG[0m and produce random generators of
        the   kernel  by  dividing  by  a  preimage  of  an  image  under  the
        homomorphism.  Note  that  generators in [2XgensN[0m ([14X4.2-22[0m) have to have a
        memory  attached  to them that stores, how they were acquired from the
        generators of [3XG[0m.
  
  [8Xadditional information[0m
        A  find  homomorphism  method  may  store any data into the attributes
        [2Xforkernel[0m  ([14X4.2-29[0m)  and  [2Xforfactor[0m  ([14X4.2-30[0m), which both are records.
        Components  in these record that are bound during the recognition will
        be  copied  into  the recognition info record of the kernel and factor
        respectively  of  a  found  homomorphism  upon  creation  and thus are
        available  to  all find homomorphism methods called for the kernel and
        factor.  This  feature  might  be interesting to transport information
        that  is  relevant for the recognition of the kernel or factor and was
        acquired during the recognition of [3XG[0m itself.
  
        A  special  role is played by the component [10Xhints[0m in both of the above
        records, which can hold a list of records describing find homomorphism
        methods  that  shall  be  tried  first  when recognising the kernel or
        factor.
  
        In  addition,  a  find  homomorphism  method  might  set the attribute
        [2Ximmediateverification[0m ([14X4.2-28[0m) to true, if it considers the problem of
        finding kernel generators particularly difficult.
  
  To  explain the calling conventions for [2XSLPforElement[0m ([14X4.2-14[0m) functions and
  for    the    sake   of   completeness   we   present   now   the   function
  [2XSLPforElementGeneric[0m  ([14X4.3-2[0m)  which is used for the case of a "homomorphism
  node":
  
  [1X4.3-2 SLPforElementGeneric[0m
  
  [2X> SLPforElementGeneric( [0X[3Xri, x[0X[2X ) ____________________________________[0Xfunction
  [6XReturns:[0X  a [5XGAP[0m straight line program
  
  This  function  takes  as arguments a recognition info record [3Xri[0m and a group
  element [3Xx[0m. It returns a [5XGAP[0m straight line program that expresses the element
  [3Xx[0m in terms of the nice generators of the group G recognised by [3Xri[0m.
  
  This  generic  function here does exactly this job for the generic situation
  that we found a homomorphism from G to some other group say H with kernel N.
  It  first  maps  [3Xx[0m  via  the  homomorphism  to  H  and  uses the recognition
  information  there  to  write  it as a straight line program in terms of the
  nice  generators  of  H.  Then  it applies this straight line program to the
  preimages  of those nice generators (see [2Xpregensfac[0m ([14X4.2-8[0m)) thereby finding
  an element y of G with x * y^-1 lying in the kernel N.
  
  Then the function writes this element as a straight line program in the nice
  generators  of N again using the recursively acquired recognition info about
  N.  In the end a concatenated straight line program for x is built, which is
  in terms of the nice generators of the current node.
  
  
  [1X4.4 Conventions for the recognition of permutation groups[0X
  
  No conventions so far.
  
  
  [1X4.5 Conventions for the recognition of matrix groups[0X
  
  We are considering only the case of matrix groups over finite fields.
  
  No conventions so far.
  
  
  [1X4.6 Conventions for the recognition of projective groups[0X
  
  We are considering only the case of projective groups over finite fields.
  
  No conventions so far.
  
  
  [1X4.7 Conventions for the recognition of black box groups[0X
  
  No conventions so far.
  
