  
  [1X40 [33X[0;0YGroup Homomorphisms[133X[101X
  
  [33X[0;0YA  group  homomorphism  is a mapping from one group to another that respects
  multiplication  and  inverses.  They  are  implemented as a special class of
  mappings,  so  in  particular  all  operations  for  mappings, such as [2XImage[102X
  ([14X32.4-6[114X),     [2XPreImage[102X     ([14X32.5-6[114X),    [2XPreImagesRepresentative[102X    ([14X32.5-4[114X),
  [2XKernelOfMultiplicativeGeneralMapping[102X   ([14X32.9-5[114X),   [2XSource[102X   ([14X32.3-8[114X),  [2XRange[102X
  ([14X32.3-7[114X), [2XIsInjective[102X ([14X32.3-4[114X) and [2XIsSurjective[102X ([14X32.3-5[114X) (see chapter [14X32[114X, in
  particular section [14X32.9[114X) are applicable to them.[133X
  
  [33X[0;0YHomomorphisms can be used to transfer calculations into isomorphic groups in
  another   representation,   for   which  better  algorithms  are  available.
  Section [14X40.5[114X explains a technique how to enforce this automatically.[133X
  
  [33X[0;0YHomomorphisms  are  also  used to represent group automorphisms, and section
  [14X40.6[114X explains explains [5XGAP[105X's facilities to work with automorphism groups.[133X
  
  [33X[0;0YSection  [14X40.9[114X  explains  how  to  make  [5XGAP[105X  to search for all homomorphisms
  between two groups which fulfill certain specifications.[133X
  
  
  [1X40.1 [33X[0;0YCreating Group Homomorphisms[133X[101X
  
  [33X[0;0YThe most important way of creating group homomorphisms is to give images for
  a set of group generators and to extend it to the group generated by them by
  the homomorphism property.[133X
  
  [33X[0;0Y[13XA second[113X way to create homomorphisms is to give functions that compute image
  and  preimage.  (A  similar  case  are  homomorphisms  that  are  induced by
  conjugation.  Special  constructors  for  such  mappings  are  described  in
  section [14X40.6[114X).[133X
  
  [33X[0;0Y[13XThe  third[113X  class  are epimorphisms from a group onto its factor group. Such
  homomorphisms  can  be  constructed  by  [2XNaturalHomomorphismByNormalSubgroup[102X
  ([14X39.18-1[114X).[133X
  
  [33X[0;0Y[13XThe fourth[113X class is homomorphisms in a permutation group that are induced by
  an action on a set. Such homomorphisms are described in the context of group
  actions, see chapter [14X41[114X and in particular [2XActionHomomorphism[102X ([14X41.7-1[114X).[133X
  
  [1X40.1-1 GroupHomomorphismByImages[101X
  
  [29X[2XGroupHomomorphismByImages[102X( [3XG[103X, [3XH[103X[[, [3Xgens[103X], [3Ximgs[103X] ) [32X function
  
  [33X[0;0Y[2XGroupHomomorphismByImages[102X  returns  the group homomorphism with source [3XG[103X and
  range  [3XH[103X  that is defined by mapping the list [3Xgens[103X of generators of [3XG[103X to the
  list [3Ximgs[103X of images in [3XH[103X.[133X
  
  [33X[0;0YIf  omitted,  the  arguments  [3Xgens[103X and [3Ximgs[103X default to the [2XGeneratorsOfGroup[102X
  ([14X39.2-4[114X)  value  of [3XG[103X and [3XH[103X, respectively. If [3XH[103X is not given the maopping is
  automatically considered as surjective.[133X
  
  [33X[0;0YIf  [3Xgens[103X  does  not  generate [3XG[103X or if the mapping of the generators does not
  extend  to  a homomorphism (i.e., if mapping the generators describes only a
  multi-valued mapping) then [9Xfail[109X is returned.[133X
  
  [33X[0;0YThis  test can be quite expensive. If one is certain that the mapping of the
  generators  extends  to  a homomorphism, one can avoid the checks by calling
  [2XGroupHomomorphismByImagesNC[102X  ([14X40.1-2[114X).  (There  also  is  the possibility to
  construct potentially multi-valued mappings with [2XGroupGeneralMappingByImages[102X
  ([14X40.1-3[114X)  and  to  test  with  [2XIsMapping[102X  ([14X32.3-3[114X)  whether  they are indeed
  homomorphisms.)[133X
  
  [1X40.1-2 GroupHomomorphismByImagesNC[101X
  
  [29X[2XGroupHomomorphismByImagesNC[102X( [3XG[103X, [3XH[103X[[, [3Xgens[103X], [3Ximgs[103X] ) [32X operation
  
  [33X[0;0Y[2XGroupHomomorphismByImagesNC[102X       creates       a       homomorphism      as
  [2XGroupHomomorphismByImages[102X  ([14X40.1-1[114X)  does,  however it does not test whether
  [3Xgens[103X generates [3XG[103X and that the mapping of [3Xgens[103X to [3Ximgs[103X indeed defines a group
  homomorphism.  Because  these tests can be expensive it can be substantially
  faster than [2XGroupHomomorphismByImages[102X ([14X40.1-1[114X). Results are unpredictable if
  the conditions do not hold.[133X
  
  [33X[0;0YIf  omitted,  the  arguments  [3Xgens[103X and [3Ximgs[103X default to the [2XGeneratorsOfGroup[102X
  ([14X39.2-4[114X) value of [3XG[103X and [3XH[103X, respectively.[133X
  
  [33X[0;0Y(For  creating  a  possibly  multi-valued  mapping from [3XG[103X to [3XH[103X that respects
  multiplication  and  inverses,  [2XGroupGeneralMappingByImages[102X  ([14X40.1-3[114X) can be
  used.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xgens:=[(1,2,3,4),(1,2)];[127X[104X
    [4X[28X[ (1,2,3,4), (1,2) ][128X[104X
    [4X[25Xgap>[125X [27Xg:=Group(gens);[127X[104X
    [4X[28XGroup([ (1,2,3,4), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27Xh:=Group((1,2,3),(1,2));[127X[104X
    [4X[28XGroup([ (1,2,3), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27Xhom:=GroupHomomorphismByImages(g,h,gens,[(1,2),(1,3)]);[127X[104X
    [4X[28X[ (1,2,3,4), (1,2) ] -> [ (1,2), (1,3) ][128X[104X
    [4X[25Xgap>[125X [27XImage(hom,(1,4));[127X[104X
    [4X[28X(2,3)[128X[104X
    [4X[25Xgap>[125X [27Xmap:=GroupHomomorphismByImages(g,h,gens,[(1,2,3),(1,2)]);[127X[104X
    [4X[28Xfail[128X[104X
  [4X[32X[104X
  
  [1X40.1-3 GroupGeneralMappingByImages[101X
  
  [29X[2XGroupGeneralMappingByImages[102X( [3XG[103X, [3XH[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  [29X[2XGroupGeneralMappingByImages[102X( [3XG[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  [29X[2XGroupGeneralMappingByImagesNC[102X( [3XG[103X, [3XH[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  [29X[2XGroupGeneralMappingByImagesNC[102X( [3XG[103X, [3Xgens[103X, [3Ximgs[103X ) [32X operation
  
  [33X[0;0Yreturns a general mapping defined by extending the mapping from [3Xgens[103X to [3Ximgs[103X
  homomorphically.  If  the  range  [3XH[103X  is  not  given the mapping will be made
  automatically  surjective.  The  NC  version  does not test whether [3Xgens[103X are
  contained  in  [3XG[103X  or  [3Ximgs[103X  are  contained  in [3XH[103X. ([2XGroupHomomorphismByImages[102X
  ([14X40.1-1[114X)  creates  a group general mapping by images and tests whether it is
  in [2XIsMapping[102X ([14X32.3-3[114X).)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xmap:=GroupGeneralMappingByImages(g,h,gens,[(1,2,3),(1,2)]);[127X[104X
    [4X[28X[ (1,2,3,4), (1,2) ] -> [ (1,2,3), (1,2) ][128X[104X
    [4X[25Xgap>[125X [27XIsMapping(map);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  
  [1X40.1-4 [33X[0;0YGroupHomomorphismByFunction[133X[101X
  
  [29X[2XGroupHomomorphismByFunction[102X( [3XS[103X, [3XR[103X, [3Xfun[103X[, [3Xinvfun[103X] ) [32X function
  [29X[2XGroupHomomorphismByFunction[102X( [3XS[103X, [3XR[103X, [3Xfun[103X, [3Xfalse[103X, [3Xprefun[103X ) [32X function
  
  [33X[0;0Y[2XGroupHomomorphismByFunction[102X  returns  a group homomorphism [10Xhom[110X with source [3XS[103X
  and  range  [3XR[103X, such that each element [10Xs[110X of [3XS[103X is mapped to the element [3Xfun[103X[10X( s
  )[110X, where [3Xfun[103X is a [5XGAP[105X function.[133X
  
  [33X[0;0YIf the argument [3Xinvfun[103X is bound then [3Xhom[103X is a bijection between [3XS[103X and [3XR[103X, and
  the preimage of each element [10Xr[110X of [3XR[103X is given by [3Xinvfun[103X[10X( r )[110X, where [3Xinvfun[103X is
  a [5XGAP[105X function.[133X
  
  [33X[0;0YIf  five  arguments  are given and the fourth argument is [9Xfalse[109X then the [5XGAP[105X
  function  [3Xprefun[103X can be used to compute a single preimage also if [10Xhom[110X is not
  bijective.[133X
  
  [33X[0;0YNo  test is performed on whether the functions actually give an homomorphism
  between   both   groups   because   this  would  require  testing  the  full
  multiplication table.[133X
  
  [33X[0;0Y[2XGroupHomomorphismByFunction[102X    creates    a    mapping    which    lies   in
  [2XIsSPGeneralMapping[102X ([14X32.14-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xhom:=GroupHomomorphismByFunction(g,h,[127X[104X
    [4X[25X>[125X [27Xfunction(x) if SignPerm(x)=-1 then return (1,2); else return ();fi;end);[127X[104X
    [4X[28XMappingByFunction( Group([ (1,2,3,4), (1,2) ]), Group([128X[104X
    [4X[28X[ (1,2,3), (1,2) ]), function( x ) ... end )[128X[104X
    [4X[25Xgap>[125X [27XImagesSource(hom);[127X[104X
    [4X[28XGroup([ (1,2), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27XImage(hom,(1,2,3,4));[127X[104X
    [4X[28X(1,2)[128X[104X
  [4X[32X[104X
  
  [1X40.1-5 AsGroupGeneralMappingByImages[101X
  
  [29X[2XAsGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X attribute
  
  [33X[0;0YIf [3Xmap[103X is a mapping from one group to another this attribute returns a group
  general  mapping  that  which  implements  the  same abstract mapping. (Some
  operations  can  be  performed  more  effective  in this representation, see
  also [2XIsGroupGeneralMappingByAsGroupGeneralMappingByImages[102X ([14X40.10-3[114X).)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XAsGroupGeneralMappingByImages(hom);[127X[104X
    [4X[28X[ (1,2,3,4), (1,2) ] -> [ (1,2), (1,2) ][128X[104X
  [4X[32X[104X
  
  
  [1X40.2 [33X[0;0YOperations for Group Homomorphisms[133X[101X
  
  [33X[0;0YGroup  homomorphisms  are mappings, so all the operations and properties for
  mappings described in chapter [14X32[114X are applicable to them. (However often much
  better methods, than for general mappings are available.)[133X
  
  [33X[0;0YGroup  homomorphisms  will  map  groups to groups by just mapping the set of
  generators.[133X
  
  [33X[0;0Y[2XKernelOfMultiplicativeGeneralMapping[102X  ([14X32.9-5[114X)  can  be  used to compute the
  kernel of a group homomorphism.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xhom:=GroupHomomorphismByImages(g,h,gens,[(1,2),(1,3)]);;[127X[104X
    [4X[25Xgap>[125X [27XKernel(hom);[127X[104X
    [4X[28XGroup([ (1,4)(2,3), (1,2)(3,4) ])[128X[104X
  [4X[32X[104X
  
  [33X[0;0YHomomorphisms  can  map  between groups in different representations and are
  also used to get isomorphic groups in a different representation.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xm1:=[[0,-1],[1,0]];;m2:=[[0,-1],[1,1]];;[127X[104X
    [4X[25Xgap>[125X [27Xsl2z:=Group(m1,m2);; # SL(2,Integers) as matrix group[127X[104X
    [4X[25Xgap>[125X [27XF:=FreeGroup(2);;[127X[104X
    [4X[25Xgap>[125X [27Xpsl2z:=F/[F.1^2,F.2^3]; #PSL(2,Z) as FP group[127X[104X
    [4X[28X<fp group on the generators [ f1, f2 ]>[128X[104X
    [4X[25Xgap>[125X [27Xphom:=GroupHomomorphismByImagesNC(sl2z,psl2z,[m1,m2],[127X[104X
    [4X[25X>[125X [27XGeneratorsOfGroup(psl2z)); # the non NC-version would be expensive[127X[104X
    [4X[28X[ [ [ 0, -1 ], [ 1, 0 ] ], [ [ 0, -1 ], [ 1, 1 ] ] ] -> [ f1, f2 ][128X[104X
    [4X[25Xgap>[125X [27XKernel(phom); # the diagonal matrices[127X[104X
    [4X[28XGroup([ [ [ -1, 0 ], [ 0, -1 ] ], [ [ -1, 0 ], [ 0, -1 ] ] ])[128X[104X
    [4X[25Xgap>[125X [27Xp1:=(1,2)(3,4);;p2:=(2,4,5);;a5:=Group(p1,p2);;[127X[104X
    [4X[25Xgap>[125X [27Xahom:=GroupHomomorphismByImages(psl2z,a5,[127X[104X
    [4X[25X>[125X [27XGeneratorsOfGroup(psl2z),[p1,p2]); # here homomorphism test is cheap.[127X[104X
    [4X[28X[ f1, f2 ] -> [ (1,2)(3,4), (2,4,5) ][128X[104X
    [4X[25Xgap>[125X [27Xu:=PreImage(ahom,Group((1,2,3),(1,2)(4,5)));[127X[104X
    [4X[28XGroup(<fp, no generators known>)[128X[104X
    [4X[25Xgap>[125X [27XIndex(psl2z,u);[127X[104X
    [4X[28X10[128X[104X
    [4X[25Xgap>[125X [27Xisofp:=IsomorphismFpGroup(u);; Image(isofp);[127X[104X
    [4X[28X<fp group of size infinity on the generators [ F1, F2, F3, F4 ]>[128X[104X
    [4X[25Xgap>[125X [27XRelatorsOfFpGroup(Image(isofp));[127X[104X
    [4X[28X[ F1^2, F4^2, F3^3 ][128X[104X
    [4X[25Xgap>[125X [27Xup:=PreImage(phom,u);;[127X[104X
    [4X[25Xgap>[125X [27XList(GeneratorsOfGroup(up),TraceMat);[127X[104X
    [4X[28X[ -2, -2, 0, -4, 1, 0 ][128X[104X
  [4X[32X[104X
  
  [33X[0;0YFor  an automorphism [3Xaut[103X, [2XInverse[102X ([14X31.10-8[114X) returns the inverse automorphism
  [22X[3Xaut[103X^{-1}[122X.  However  if  [3Xhom[103X  is  a  bijective homomorphism between different
  groups,  or  if  [3Xhom[103X  is  injective  and considered to be a bijection to its
  image,  the operation [2XInverseGeneralMapping[102X ([14X32.2-3[114X) should be used instead.
  (See [2XInverse[102X ([14X31.10-8[114X) for a further discussion of this problem.)[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xiso:=IsomorphismPcGroup(g);[127X[104X
    [4X[28XPcgs([ (3,4), (2,4,3), (1,4)(2,3), (1,3)(2,4) ]) -> [ f1, f2, f3, f4 ][128X[104X
    [4X[25Xgap>[125X [27XInverse(iso);[127X[104X
    [4X[28X#I  The mapping must be bijective and have source=range[128X[104X
    [4X[28X#I  You might want to use `InverseGeneralMapping'[128X[104X
    [4X[28Xfail[128X[104X
    [4X[25Xgap>[125X [27XInverseGeneralMapping(iso);[127X[104X
    [4X[28X[ f1, f2, f3, f4 ] -> Pcgs([ (3,4), (2,4,3), (1,4)(2,3), (1,3)(2,4) ])[128X[104X
  [4X[32X[104X
  
  
  [1X40.3 [33X[0;0YEfficiency of Homomorphisms[133X[101X
  
  [33X[0;0Y[5XGAP[105X  permits  to create homomorphisms between arbitrary groups. This section
  considers  the efficiency of the implementation and shows ways how to choose
  suitable  representations.  For  permutation  groups  (see [14X43[114X)  or Pc groups
  (see [14X46[114X)  this  is  normally  nothing  to worry about, unless the groups get
  extremely  large.  For  other  groups  however certain calculations might be
  expensive  and  some  precaution  might  be  needed  to  avoid unnecessarily
  expensive calculations.[133X
  
  [33X[0;0YIn  short,  it  is  always worth to tell a mapping that it is a homomorphism
  (this  can  be  done by calling [10XSetIsMapping[110X) (or to create it directly with
  [2XGroupHomomorphismByImagesNC[102X ([14X40.1-2[114X)).[133X
  
  [33X[0;0YThe  basic operations required are to compute image and preimage of elements
  and  to  test  whether  a  mapping is a homomorphism. Their cost will differ
  depending on the type of the mapping.[133X
  
  
  [1X40.3-1 [33X[0;0YMappings given on generators[133X[101X
  
  [33X[0;0YSee   [2XGroupHomomorphismByImages[102X   ([14X40.1-1[114X)  and  [2XGroupGeneralMappingByImages[102X
  ([14X40.1-3[114X).[133X
  
  [33X[0;0YComputing images requires to express an element of the source as word in the
  generators.  If  it  cannot  be  done  effectively  (this  is  determined by
  [2XKnowsHowToDecompose[102X  ([14X39.25-7[114X)  which returns [9Xtrue[109X for example for arbitrary
  permutation  groups, for Pc groups or for finitely presented groups with the
  images of the free generators) the span of the generators has to be computed
  elementwise which can be very expensive and memory consuming.[133X
  
  [33X[0;0YComputing  preimages  adheres  to  the  same  rules  with  swapped  rôles of
  generators and their images.[133X
  
  [33X[0;0YThe  test  whether a mapping is a homomorphism requires the computation of a
  presentation  for the source and evaluation of its relators in the images of
  its   generators.   For   larger   groups   this   can   be   expensive  and
  [2XGroupHomomorphismByImagesNC[102X  ([14X40.1-2[114X) should be used if the mapping is known
  to be a homomorphism.[133X
  
  
  [1X40.3-2 [33X[0;0YAction homomorphisms[133X[101X
  
  [33X[0;0YSee [2XActionHomomorphism[102X ([14X41.7-1[114X).[133X
  
  [33X[0;0YThe calculation of images is determined by the acting function used and –for
  large domains– is often dominated by the search for the position of an image
  in  a list of the domain elements. This can be improved by sorting this list
  if an efficient method for [2X\<[102X ([14X31.11-1[114X) to compare elements of the domain is
  available.[133X
  
  [33X[0;0YOnce the images of a generating set are computed, computing preimages (which
  is done via [2XAsGroupGeneralMappingByImages[102X ([14X40.1-5[114X)) and computing the kernel
  behaves     the    same    as    for    a    homomorphism    created    with
  [2XGroupHomomorphismByImages[102X ([14X40.1-1[114X) from a permutation group.[133X
  
  [33X[0;0Y[5XGAP[105X will always assume that the acting function provided implements a proper
  group action and thus that the mapping is indeed a homomorphism.[133X
  
  
  [1X40.3-3 [33X[0;0YMappings given by functions[133X[101X
  
  [33X[0;0YSee [2XGroupHomomorphismByFunction[102X ([14X40.1-4[114X).[133X
  
  [33X[0;0YComputing  images  is  wholly  determined  by the function that performs the
  image  calculation.  If no function to compute preimages is given, computing
  preimages  requires  mapping  every element of the source to find an element
  that maps to the requested image. This is time and memory consuming.[133X
  
  
  [1X40.3-4 [33X[0;0YOther operations[133X[101X
  
  [33X[0;0YTo  compute  the kernel of a homomorphism (unless the mapping is known to be
  injective)  requires  the  capability to compute a presentation of the image
  and  to  evaluate  the  relators  of  this  presentation in preimages of the
  presentations generators.[133X
  
  [33X[0;0YThe  calculation  of the [2XImage[102X ([14X32.4-6[114X) (respectively [2XImagesSource[102X ([14X32.4-1[114X))
  value  requires  to map a generating set of the source, testing surjectivity
  is a comparison for equality with the range.[133X
  
  [33X[0;0YTesting injectivity is a test for triviality of the kernel.[133X
  
  [33X[0;0YThe  comparison  of  mappings  is  based  on a lexicographic comparison of a
  sorted  element  list  of  the  source. For group homomorphisms, this can be
  simplified, using [2XImagesSmallestGenerators[102X ([14X40.3-5[114X)[133X
  
  [1X40.3-5 ImagesSmallestGenerators[101X
  
  [29X[2XImagesSmallestGenerators[102X( [3Xmap[103X ) [32X attribute
  
  [33X[0;0Yreturns the list of images of [10XGeneratorsSmallest(Source([3Xmap[103X[10X))[110X. This list can
  be  used  to  compare  group  homomorphisms.  (The standard comparison is to
  compare  the  image lists on the set of elements of the source. If however x
  and y have the same images under a and b, certainly all their products have.
  Therefore  it  is  sufficient  to  test  this  on the images of the smallest
  generators.)[133X
  
  
  [1X40.4 [33X[0;0YHomomorphism for very large groups[133X[101X
  
  [33X[0;0YSome  homomorphisms  (notably particular actions) transfer known information
  about  the  source  group (such as a stabilizer chain) to the image group if
  this  is  substantially cheaper than to compute the information in the image
  group  anew.  In most cases this is no problem and in fact speeds up further
  calculations notably.[133X
  
  [33X[0;0YFor  a huge source group, however this can be time consuming or take a large
  amount  of extra memory for storage. In this case it can be helpful to avoid
  as much automatism as possible.[133X
  
  [33X[0;0YThe  following  list  of tricks might be useful in such a case. (However you
  will  lose  much automatic deduction. So please restrict the use of these to
  cases where the standard approach does not work.)[133X
  
  [30X    [33X[0;6YCompute only images (or the [2XPreImagesRepresentative[102X ([14X32.5-4[114X)) of group
        elements.  Do  not  compute  the  images  of  (sub)groups  or the full
        preimage of a subgroup.[133X
  
  [30X    [33X[0;6YCreate  action  homomorphisms  as  [21Xsurjective[121X  (see [2XActionHomomorphism[102X
        ([14X41.7-1[114X)),  otherwise the range is set to be the full symmetric group.
        However  do  not  compute [2XRange[102X ([14X32.3-7[114X) or [2XImage[102X ([14X32.4-6[114X) values, but
        only the images of a generator set.[133X
  
  [30X    [33X[0;6YIf  you  suspect  an  action  homomorphism  to do too much internally,
        replace  the  action function with a function that does the same; i.e.
        replace  [2XOnPoints[102X  ([14X41.2-1[114X)  by [10Xfunction( p, g ) return p^g; end;[110X. The
        action  will  be  the same, but as the action function is not [2XOnPoints[102X
        ([14X41.2-1[114X), the extra processing for special cases is not triggered.[133X
  
  
  [1X40.5 [33X[0;0YNice Monomorphisms[133X[101X
  
  [33X[0;0Y[5XGAP[105X  contains  very efficient algorithms for some special representations of
  groups  (for  example  pc  groups  or  permutation  groups)  while for other
  representations only slow generic methods are available. In this case it can
  be  worthwhile  to  do all calculations rather in an isomorphic image of the
  group,  which  is in a [21Xbetter[121X representation. The way to achieve this in [5XGAP[105X
  is via [13Xnice monomorphisms[113X.[133X
  
  [33X[0;0YFor  this  mechanism  to  work, of course there must be effective methods to
  evaluate  the  [2XNiceMonomorphism[102X  ([14X40.5-2[114X)  value  on  elements  and  to take
  preimages under it. As by definition no good algorithms exist for the source
  group,  normally this can only be achieved by using the the result of a call
  to  [2XActionHomomorphism[102X ([14X41.7-1[114X) or [2XGroupHomomorphismByFunction[102X ([14X40.1-4[114X) (see
  also section [14X40.3[114X).[133X
  
  [1X40.5-1 IsHandledByNiceMonomorphism[101X
  
  [29X[2XIsHandledByNiceMonomorphism[102X( [3Xobj[103X ) [32X property
  
  [33X[0;0YIf   this   property   is  [9Xtrue[109X,  high-valued  methods  that  translate  all
  calculations  in  [3Xobj[103X in the image under the [2XNiceMonomorphism[102X ([14X40.5-2[114X) value
  of [3Xobj[103X become available for [3Xobj[103X.[133X
  
  [1X40.5-2 NiceMonomorphism[101X
  
  [29X[2XNiceMonomorphism[102X( [3Xobj[103X ) [32X attribute
  
  [33X[0;0Yis  a  homomorphism that is defined (at least) on the whole of [3Xobj[103X and whose
  restriction  to  [3Xobj[103X is injective. The concrete morphism (and also the image
  group) will depend on the representation of [3Xobj[103X.[133X
  
  [1X40.5-3 NiceObject[101X
  
  [29X[2XNiceObject[102X( [3Xobj[103X ) [32X attribute
  
  [33X[0;0YThe  [2XNiceObject[102X value of [3Xobj[103X is the image of [3Xobj[103X under the mapping stored as
  the value of [2XNiceMonomorphism[102X ([14X40.5-2[114X) for [3Xobj[103X.[133X
  
  [33X[0;0YA  typical  example are finite matrix groups, which use a faithful action on
  vectors to translate all calculations in a permutation group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xgl:=GL(3,2);[127X[104X
    [4X[28XSL(3,2)[128X[104X
    [4X[25Xgap>[125X [27XIsHandledByNiceMonomorphism(gl);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XNiceObject(gl);[127X[104X
    [4X[28XGroup([ (5,7)(6,8), (2,3,5)(4,7,6) ])[128X[104X
    [4X[25Xgap>[125X [27XImage(NiceMonomorphism(gl),Z(2)*[[1,0,0],[0,1,1],[1,0,1]]);[127X[104X
    [4X[28X(2,6)(3,4,7,8)[128X[104X
  [4X[32X[104X
  
  [1X40.5-4 IsCanonicalNiceMonomorphism[101X
  
  [29X[2XIsCanonicalNiceMonomorphism[102X( [3Xnhom[103X ) [32X property
  
  [33X[0;0YA  nice monomorphism (see [2XNiceMonomorphism[102X ([14X40.5-2[114X) [3Xnhom[103X is canonical if the
  image  set  will  only  depend  on  the set of group elements but not on the
  generating  set  and  [2X\<[102X  ([14X31.11-1[114X)  comparison of group elements translates
  through  the  nice monomorphism. This implies that equal objects will always
  have  equal  [2XNiceObject[102X  ([14X40.5-3[114X)  values.  In  some situations however this
  condition  would be expensive to achieve, therefore it is not guaranteed for
  every nice monomorphism.[133X
  
  
  [1X40.6 [33X[0;0YGroup Automorphisms[133X[101X
  
  [33X[0;0YGroup  automorphisms are bijective homomorphism from a group onto itself. An
  important subclass are automorphisms which are induced by conjugation of the
  group itself or a supergroup.[133X
  
  [1X40.6-1 ConjugatorIsomorphism[101X
  
  [29X[2XConjugatorIsomorphism[102X( [3XG[103X, [3Xg[103X ) [32X operation
  
  [33X[0;0YLet  [3XG[103X be a group, and [3Xg[103X an element in the same family as the elements of [3XG[103X.
  [2XConjugatorIsomorphism[102X  returns  the isomorphism from [3XG[103X to [10X[3XG[103X[10X^[3Xg[103X[10X[110X defined by [22Xh ↦
  h^[3Xg[103X[122X for all [22Xh ∈ [3XG[103X[122X.[133X
  
  [33X[0;0YIf   [3Xg[103X   normalizes   [3XG[103X   then   [2XConjugatorIsomorphism[102X   does  the  same  as
  [2XConjugatorAutomorphismNC[102X ([14X40.6-2[114X).[133X
  
  [1X40.6-2 ConjugatorAutomorphism[101X
  
  [29X[2XConjugatorAutomorphism[102X( [3XG[103X, [3Xg[103X ) [32X function
  [29X[2XConjugatorAutomorphismNC[102X( [3XG[103X, [3Xg[103X ) [32X operation
  
  [33X[0;0YLet  [3XG[103X  be a group, and [3Xg[103X an element in the same family as the elements of [3XG[103X
  such that [3Xg[103X normalizes [3XG[103X. [2XConjugatorAutomorphism[102X returns the automorphism of
  [3XG[103X defined by [22Xh ↦ h^[3Xg[103X[122X for all [22Xh ∈ [3XG[103X[122X.[133X
  
  [33X[0;0YIf  conjugation  by  [3Xg[103X  does  [13Xnot[113X  leave [3XG[103X invariant, [2XConjugatorAutomorphism[102X
  returns  [9Xfail[109X;  in  this  case,  the  isomorphism  from  [3XG[103X to [10X[3XG[103X[10X^[3Xg[103X[10X[110X induced by
  conjugation with [3Xg[103X can be constructed with [2XConjugatorIsomorphism[102X ([14X40.6-1[114X).[133X
  
  [33X[0;0Y[2XConjugatorAutomorphismNC[102X  does  the  same  as [2XConjugatorAutomorphism[102X, except
  that the check is omitted whether [3Xg[103X normalizes [3XG[103X and it is assumed that [3Xg[103X is
  chosen to be in [3XG[103X if possible.[133X
  
  [1X40.6-3 InnerAutomorphism[101X
  
  [29X[2XInnerAutomorphism[102X( [3XG[103X, [3Xg[103X ) [32X function
  [29X[2XInnerAutomorphismNC[102X( [3XG[103X, [3Xg[103X ) [32X operation
  
  [33X[0;0YLet [3XG[103X be a group, and [22X[3Xg[103X ∈ [3XG[103X[122X. [2XInnerAutomorphism[102X returns the automorphism of [3XG[103X
  defined by [22Xh ↦ h^[3Xg[103X[122X for all [22Xh ∈ [3XG[103X[122X.[133X
  
  [33X[0;0YIf  [3Xg[103X  is [13Xnot[113X an element of [3XG[103X, [2XInnerAutomorphism[102X returns [9Xfail[109X; in this case,
  the  isomorphism  from  [3XG[103X  to  [10X[3XG[103X[10X^[3Xg[103X[10X[110X  induced  by  conjugation  with  [3Xg[103X can be
  constructed      with     [2XConjugatorIsomorphism[102X     ([14X40.6-1[114X)     or     with
  [2XConjugatorAutomorphism[102X ([14X40.6-2[114X).[133X
  
  [33X[0;0Y[2XInnerAutomorphismNC[102X  does  the  same  as  [2XInnerAutomorphism[102X, except that the
  check is omitted whether [22X[3Xg[103X ∈ [3XG[103X[122X.[133X
  
  [1X40.6-4 IsConjugatorIsomorphism[101X
  
  [29X[2XIsConjugatorIsomorphism[102X( [3Xhom[103X ) [32X property
  [29X[2XIsConjugatorAutomorphism[102X( [3Xhom[103X ) [32X property
  [29X[2XIsInnerAutomorphism[102X( [3Xhom[103X ) [32X property
  
  [33X[0;0YLet [3Xhom[103X be a group general mapping (see [2XIsGroupGeneralMapping[102X ([14X32.9-4[114X)) with
  source  [22XG[122X,  say.  [2XIsConjugatorIsomorphism[102X  returns [9Xtrue[109X if [3Xhom[103X is induced by
  conjugation  of  [22XG[122X by an element [22Xg[122X that lies in [22XG[122X or in a group into which [22XG[122X
  is naturally embedded in the sense described below, and [9Xfalse[109X otherwise.[133X
  
  [33X[0;0YNatural  embeddings are dealt with in the case that [22XG[122X is a permutation group
  (see  Chapter [14X43[114X),  a  matrix  group  (see Chapter [14X44[114X), a finitely presented
  group  (see  Chapter [14X47[114X),  or a group given w.r.t. a polycyclic presentation
  (see  Chapter [14X46[114X).  In  all  other cases, [2XIsConjugatorIsomorphism[102X may return
  [9Xfalse[109X if [3Xhom[103X is induced by conjugation but is not an inner automorphism.[133X
  
  [33X[0;0YIf  [2XIsConjugatorIsomorphism[102X  returns  [9Xtrue[109X  for  [3Xhom[103X  then an element [22Xg[122X that
  induces    [3Xhom[103X    can    be    accessed    as   value   of   the   attribute
  [2XConjugatorOfConjugatorIsomorphism[102X ([14X40.6-5[114X).[133X
  
  [33X[0;0Y[2XIsConjugatorAutomorphism[102X   returns   [9Xtrue[109X   if   [3Xhom[103X   is   an  automorphism
  (see [2XIsEndoGeneralMapping[102X  ([14X32.13-3[114X))  that  is  regarded  as  a  conjugator
  isomorphism by [2XIsConjugatorIsomorphism[102X, and [9Xfalse[109X otherwise.[133X
  
  [33X[0;0Y[2XIsInnerAutomorphism[102X  returns  [9Xtrue[109X  if [3Xhom[103X is a conjugator automorphism such
  that an element [22Xg[122X inducing [3Xhom[103X can be chosen in [22XG[122X, and [9Xfalse[109X otherwise.[133X
  
  [1X40.6-5 ConjugatorOfConjugatorIsomorphism[101X
  
  [29X[2XConjugatorOfConjugatorIsomorphism[102X( [3Xhom[103X ) [32X attribute
  
  [33X[0;0YFor  a  conjugator  isomorphism  [3Xhom[103X  (see [2XConjugatorIsomorphism[102X  ([14X40.6-1[114X)),
  [2XConjugatorOfConjugatorIsomorphism[102X  returns  an  element  [22Xg[122X such that mapping
  under [3Xhom[103X is induced by conjugation with [22Xg[122X.[133X
  
  [33X[0;0YTo  avoid  problems with [2XIsInnerAutomorphism[102X ([14X40.6-4[114X), it is guaranteed that
  the conjugator is taken from the source of [3Xhom[103X if possible.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xhgens:=[(1,2,3),(1,2,4)];;h:=Group(hgens);;[127X[104X
    [4X[25Xgap>[125X [27Xhom:=GroupHomomorphismByImages(h,h,hgens,[(1,2,3),(2,3,4)]);;[127X[104X
    [4X[25Xgap>[125X [27XIsInnerAutomorphism(hom);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XConjugatorOfConjugatorIsomorphism(hom);[127X[104X
    [4X[28X(1,2,3)[128X[104X
    [4X[25Xgap>[125X [27Xhom:=GroupHomomorphismByImages(h,h,hgens,[(1,3,2),(1,4,2)]);[127X[104X
    [4X[28X[ (1,2,3), (1,2,4) ] -> [ (1,3,2), (1,4,2) ][128X[104X
    [4X[25Xgap>[125X [27XIsInnerAutomorphism(hom);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsConjugatorAutomorphism(hom);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XConjugatorOfConjugatorIsomorphism(hom);[127X[104X
    [4X[28X(1,2)[128X[104X
  [4X[32X[104X
  
  
  [1X40.7 [33X[0;0YGroups of Automorphisms[133X[101X
  
  [33X[0;0YGroup automorphism can be multiplied and inverted and thus it is possible to
  form groups of automorphisms.[133X
  
  [1X40.7-1 AutomorphismGroup[101X
  
  [29X[2XAutomorphismGroup[102X( [3XG[103X ) [32X attribute
  
  [33X[0;0Yreturns the full automorphism group of the group [3XG[103X. The automorphisms act on
  [3XG[103X   by  the  caret  operator  [10X^[110X.  The  automorphism  group  often  stores  a
  [2XNiceMonomorphism[102X ([14X40.5-2[114X) value whose image is a permutation group, obtained
  by the action on a subset of [3XG[103X.[133X
  
  [33X[0;0YNote that current methods for the calculation of the automorphism group of a
  group  [22XG[122X  require [22XG[122X to be a permutation group or a pc group to be efficient.
  For groups in other representations the calculation is likely very slow.[133X
  
  [33X[0;0YAlso,  the  [5XAutPGrp[105X  package installs enhanced methods for [2XAutomorphismGroup[102X
  for  finite [22Xp[122X-groups, and the [5XFGA[105X package - for finitely generated subgroups
  of free groups.[133X
  
  [33X[0;0YMethods  may  be  installed for [2XAutomorphismGroup[102X for other domains, such as
  e.g.  for  linear codes in the [5XGUAVA[105X package, loops in the [5Xloops[105X package and
  nilpotent  Lie algebras in the [5XSophus[105X package (see package manuals for their
  descriptions).[133X
  
  [1X40.7-2 IsGroupOfAutomorphisms[101X
  
  [29X[2XIsGroupOfAutomorphisms[102X( [3XG[103X ) [32X property
  
  [33X[0;0Yindicates  whether  [3XG[103X consists of automorphisms of another group [22XH[122X, say. The
  group  [22XH[122X  can  be  obtained  from  [3XG[103X  via  the  attribute [2XAutomorphismDomain[102X
  ([14X40.7-3[114X).[133X
  
  [1X40.7-3 AutomorphismDomain[101X
  
  [29X[2XAutomorphismDomain[102X( [3XG[103X ) [32X attribute
  
  [33X[0;0YIf [3XG[103X consists of automorphisms of [22XH[122X, this attribute returns [22XH[122X.[133X
  
  [1X40.7-4 IsAutomorphismGroup[101X
  
  [29X[2XIsAutomorphismGroup[102X( [3XG[103X ) [32X property
  
  [33X[0;0Yindicates  whether [3XG[103X is the full automorphism group of another group [22XH[122X, this
  group is given as [2XAutomorphismDomain[102X ([14X40.7-3[114X) value of [3XG[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=Group((1,2,3,4),(1,3));[127X[104X
    [4X[28XGroup([ (1,2,3,4), (1,3) ])[128X[104X
    [4X[25Xgap>[125X [27Xau:=AutomorphismGroup(g);[127X[104X
    [4X[28X<group of size 8 with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XGeneratorsOfGroup(au);[127X[104X
    [4X[28X[ Pcgs([ (2,4), (1,2,3,4), (1,3)(2,4) ]) -> [128X[104X
    [4X[28X    [ (1,2)(3,4), (1,2,3,4), (1,3)(2,4) ], [128X[104X
    [4X[28X  Pcgs([ (2,4), (1,2,3,4), (1,3)(2,4) ]) -> [128X[104X
    [4X[28X    [ (1,3), (1,2,3,4), (1,3)(2,4) ], [128X[104X
    [4X[28X  Pcgs([ (2,4), (1,2,3,4), (1,3)(2,4) ]) -> [128X[104X
    [4X[28X    [ (2,4), (1,4,3,2), (1,3)(2,4) ] ][128X[104X
    [4X[25Xgap>[125X [27XNiceObject(au);[127X[104X
    [4X[28XGroup([ (1,2,3,4), (1,3)(2,4), (2,4) ])[128X[104X
  [4X[32X[104X
  
  [1X40.7-5 InnerAutomorphismsAutomorphismGroup[101X
  
  [29X[2XInnerAutomorphismsAutomorphismGroup[102X( [3Xautgroup[103X ) [32X attribute
  
  [33X[0;0YFor  an  automorphism  group  [3Xautgroup[103X  of a group this attribute stores the
  subgroup  of  inner  automorphisms (automorphisms induced by conjugation) of
  the original group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XInnerAutomorphismsAutomorphismGroup(au);[127X[104X
    [4X[28X<group with 2 generators>[128X[104X
  [4X[32X[104X
  
  [1X40.7-6 InducedAutomorphism[101X
  
  [29X[2XInducedAutomorphism[102X( [3Xepi[103X, [3Xaut[103X ) [32X operation
  
  [33X[0;0YLet  [3Xaut[103X be an automorphism of a group [22XG[122X and [3Xepi[103X be a homomorphism from [22XG[122X to
  a group [22XH[122X such that the kernel of [3Xepi[103X is fixed under [3Xaut[103X. Let [22XU[122X be the image
  of  [3Xepi[103X.  This command returns the automorphism of [22XU[122X induced by [3Xaut[103X via [3Xepi[103X,
  that is, the automorphism of [22XU[122X which maps [22Xg[122X[10X^[3Xepi[103X[10X[110X to [10X([110X[22Xg[122X[10X^[3Xaut[103X[10X)^[3Xepi[103X[10X[110X, for [22Xg ∈ G[122X.[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[25Xgap>[125X [27Xn:=Subgroup(g,[(1,2)(3,4),(1,3)(2,4)]);[127X[104X
    [4X[28XGroup([ (1,2)(3,4), (1,3)(2,4) ])[128X[104X
    [4X[25Xgap>[125X [27Xepi:=NaturalHomomorphismByNormalSubgroup(g,n);[127X[104X
    [4X[28X[ (1,2,3,4), (1,2) ] -> [ f1*f2, f1 ][128X[104X
    [4X[25Xgap>[125X [27Xaut:=InnerAutomorphism(g,(1,2,3));[127X[104X
    [4X[28X^(1,2,3)[128X[104X
    [4X[25Xgap>[125X [27XInducedAutomorphism(epi,aut);[127X[104X
    [4X[28X^f2[128X[104X
  [4X[32X[104X
  
  
  [1X40.8 [33X[0;0YCalculating with Group Automorphisms[133X[101X
  
  [33X[0;0YUsually  the  best  way  to  calculate  in  a  group  of automorphisms is to
  translate  all  calculations to an isomorphic group in a representation, for
  which  better  algorithms  are  available,  say  a  permutation  group. This
  translation can be done automatically using [2XNiceMonomorphism[102X ([14X40.5-2[114X).[133X
  
  [33X[0;0YOnce  a  group knows to be a group of automorphisms (this can be achieved by
  testing  or  setting the property [2XIsGroupOfAutomorphisms[102X ([14X40.7-2[114X)), [5XGAP[105X will
  try  itself  to  find  such  a  nice  monomorphism  once calculations in the
  automorphism group are done.[133X
  
  [33X[0;0YNote   that  nice  homomorphisms  inherit  down  to  subgroups,  but  cannot
  necessarily  be  extended  from  a  subgroup  to  the whole group. Thus when
  working  with  a  group  of  automorphisms,  it can be beneficial to enforce
  calculation  of  the  nice  monomorphism for the whole group (for example by
  explicitly  calling  [2XRandom[102X  ([14X30.7-1[114X)  and  ignoring  the result –it will be
  stored  internally)  at  the  start  of the calculation. Otherwise [5XGAP[105X might
  first  calculate  a nice monomorphism for the subgroup, only to be forced to
  calculate a new nice monomorphism for the whole group later on.[133X
  
  [33X[0;0YIf  a  good  domain  for  a  faithful permutation action is known already, a
  homomorphism    for    the    action    on   it   can   be   created   using
  [2XNiceMonomorphismAutomGroup[102X    ([14X40.8-2[114X).    It    might    be    stored    by
  [10XSetNiceMonomorphism[110X (see [2XNiceMonomorphism[102X ([14X40.5-2[114X)).[133X
  
  [33X[0;0YAnother  nice  way  of  representing  automorphisms as permutations has been
  described  in  [ACM].  It is not yet available in [5XGAP[105X, a description however
  can be found in section  [14X87.3[114X.[133X
  
  [1X40.8-1 AssignNiceMonomorphismAutomorphismGroup[101X
  
  [29X[2XAssignNiceMonomorphismAutomorphismGroup[102X( [3Xautgrp[103X, [3Xgroup[103X ) [32X function
  
  [33X[0;0Ycomputes  a  nice monomorphism for [3Xautgroup[103X acting on [3Xgroup[103X and stores it as
  [2XNiceMonomorphism[102X ([14X40.5-2[114X) value of [3Xautgrp[103X.[133X
  
  [33X[0;0YIf  the  centre  of  [2XAutomorphismDomain[102X  ([14X40.7-3[114X)  of [3Xautgrp[103X is trivial, the
  operation  will  first try to represent all automorphisms by conjugation (in
  [3Xgroup[103X or in a natural parent of [3Xgroup[103X).[133X
  
  [33X[0;0YIf  this  fails the operation tries to find a small subset of [3Xgroup[103X on which
  the action will be faithful.[133X
  
  [33X[0;0YThe  operation  sets  the  attribute  [2XNiceMonomorphism[102X ([14X40.5-2[114X) and does not
  return a value.[133X
  
  [1X40.8-2 NiceMonomorphismAutomGroup[101X
  
  [29X[2XNiceMonomorphismAutomGroup[102X( [3Xautgrp[103X, [3Xelms[103X, [3Xelmsgens[103X ) [32X function
  
  [33X[0;0YThis  function  creates a monomorphism for an automorphism group [3Xautgrp[103X of a
  group  by  permuting  the group elements in the list [3Xelms[103X. This list must be
  chosen  to yield a faithful representation. [3Xelmsgens[103X is a list of generators
  which  are  a  subset  of  [3Xelms[103X.  (They can differ from the group's original
  generators.) It does not yet assign it as [2XNiceMonomorphism[102X ([14X40.5-2[114X) value.[133X
  
  
  [1X40.9 [33X[0;0YSearching for Homomorphisms[133X[101X
  
  [1X40.9-1 IsomorphismGroups[101X
  
  [29X[2XIsomorphismGroups[102X( [3XG[103X, [3XH[103X ) [32X function
  
  [33X[0;0Ycomputes  an  isomorphism  between the groups [3XG[103X and [3XH[103X if they are isomorphic
  and returns [9Xfail[109X otherwise.[133X
  
  [33X[0;0YWith the existing methods the amount of time needed grows with the size of a
  generating system of [3XG[103X. (Thus in particular for [22Xp[122X-groups calculations can be
  slow.)  If you do only need to know whether groups are isomorphic, you might
  want  to  consider  [2XIdSmallGroup[102X  ([14X50.7-5[114X)  or  the  random isomorphism test
  (see [2XRandomIsomorphismTest[102X ([14X46.10-1[114X)).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27Xg:=Group((1,2,3,4),(1,3));;[127X[104X
    [4X[25Xgap>[125X [27Xh:=Group((1,4,6,7)(2,3,5,8), (1,5)(2,6)(3,4)(7,8));;[127X[104X
    [4X[25Xgap>[125X [27XIsomorphismGroups(g,h);[127X[104X
    [4X[28X[ (1,2,3,4), (1,3) ] -> [ (1,4,6,7)(2,3,5,8), (1,2)(3,7)(4,8)(5,6) ][128X[104X
    [4X[25Xgap>[125X [27XIsomorphismGroups(g,Group((1,2,3,4),(1,2)));[127X[104X
    [4X[28Xfail[128X[104X
  [4X[32X[104X
  
  [1X40.9-2 AllHomomorphismClasses[101X
  
  [29X[2XAllHomomorphismClasses[102X( [3XG[103X, [3XH[103X ) [32X function
  
  [33X[0;0YFor  two  groups  [3XG[103X  and  [3XH[103X,  this  function  returns representatives of all
  homomorphisms [22X[3XG[103X to [3XH[103X[122X up to [3XH[103X-conjugacy.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XAllHomomorphismClasses(SymmetricGroup(4),SymmetricGroup(3)); [127X[104X
    [4X[28X[ [ (1,3,4,2), (1,2,4) ] -> [ (), () ], [128X[104X
    [4X[28X  [ (1,3,4,2), (1,2,4) ] -> [ (1,2), () ], [128X[104X
    [4X[28X  [ (1,3,4,2), (1,2,4) ] -> [ (2,3), (1,2,3) ] ][128X[104X
  [4X[32X[104X
  
  [1X40.9-3 AllHomomorphisms[101X
  
  [29X[2XAllHomomorphisms[102X( [3XG[103X, [3XH[103X ) [32X function
  [29X[2XAllEndomorphisms[102X( [3XG[103X ) [32X function
  [29X[2XAllAutomorphisms[102X( [3XG[103X ) [32X function
  
  [33X[0;0YFor  two  groups  [3XG[103X  and  [3XH[103X, this function returns all homomorphisms [22X[3XG[103X to [3XH[103X[122X.
  Since  this number will grow quickly, [2XAllHomomorphismClasses[102X ([14X40.9-2[114X) should
  be  used in most cases. [2XAllEndomorphisms[102X returns all homomorphisms from [3XG[103X to
  itself, [2XAllAutomorphisms[102X returns all bijective endomorphisms.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XAllHomomorphisms(SymmetricGroup(3),SymmetricGroup(3));[127X[104X
    [4X[28X[ [ (1,2,3), (1,2) ] -> [ (), () ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (), (1,2) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (), (2,3) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (), (1,3) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,2,3), (1,2) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,2,3), (2,3) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,3,2), (1,2) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,2,3), (1,3) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,3,2), (1,3) ], [128X[104X
    [4X[28X  [ (1,2,3), (1,2) ] -> [ (1,3,2), (2,3) ] ][128X[104X
  [4X[32X[104X
  
  [1X40.9-4 GQuotients[101X
  
  [29X[2XGQuotients[102X( [3XF[103X, [3XG[103X ) [32X operation
  
  [33X[0;0Ycomputes  all  epimorphisms  from  [3XF[103X  onto  [3XG[103X up to automorphisms of [3XG[103X. This
  classifies all factor groups of [3XF[103X which are isomorphic to [3XG[103X.[133X
  
  [33X[0;0YWith the existing methods the amount of time needed grows with the size of a
  generating system of [3XG[103X. (Thus in particular for [22Xp[122X-groups calculations can be
  slow.)[133X
  
  [33X[0;0YIf  the  [10Xfindall[110X  option  is  set to [9Xfalse[109X, the algorithm will stop once one
  homomorphism  has  been found (this can be faster and might be sufficient if
  not all homomorphisms are needed).[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[25Xgap>[125X [27Xh:=Group((1,2,3),(1,2));[127X[104X
    [4X[28XGroup([ (1,2,3), (1,2) ])[128X[104X
    [4X[25Xgap>[125X [27Xquo:=GQuotients(g,h);[127X[104X
    [4X[28X[ [ (1,2,4,3), (1,2,3) ] -> [ (2,3), (1,2,3) ] ][128X[104X
  [4X[32X[104X
  
  [1X40.9-5 IsomorphicSubgroups[101X
  
  [29X[2XIsomorphicSubgroups[102X( [3XG[103X, [3XH[103X ) [32X operation
  
  [33X[0;0Ycomputes  all  monomorphisms  from  [3XH[103X  into [3XG[103X up to [3XG[103X-conjugacy of the image
  groups. This classifies all [3XG[103X-classes of subgroups of [3XG[103X which are isomorphic
  to [3XH[103X.[133X
  
  [33X[0;0YWith  the existing methods, the amount of time needed grows with the size of
  a  generating system of [3XG[103X. (Thus in particular for [22Xp[122X-groups calculations can
  be slow.) A main use of [2XIsomorphicSubgroups[102X therefore is to find nonsolvable
  subgroups (which often can be generated by 2 elements).[133X
  
  [33X[0;0Y(To  find  [22Xp[122X-subgroups it is often faster to compute the subgroup lattice of
  the  Sylow  subgroup and to use [2XIdGroup[102X ([14X50.7-5[114X) to identify the type of the
  subgroups.)[133X
  
  [33X[0;0YIf  the  [10Xfindall[110X  option  is  set to [9Xfalse[109X, the algorithm will stop once one
  homomorphism  has  been found (this can be faster and might be sufficient if
  not all homomorphisms are needed).[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[25Xgap>[125X [27Xh:=Group((3,4),(1,2));;[127X[104X
    [4X[25Xgap>[125X [27Xemb:=IsomorphicSubgroups(g,h);[127X[104X
    [4X[28X[ [ (3,4), (1,2) ] -> [ (1,2), (3,4) ], [128X[104X
    [4X[28X  [ (3,4), (1,2) ] -> [ (1,3)(2,4), (1,2)(3,4) ] ][128X[104X
  [4X[32X[104X
  
  [1X40.9-6 MorClassLoop[101X
  
  [29X[2XMorClassLoop[102X( [3Xrange[103X, [3Xclasses[103X, [3Xparams[103X, [3Xaction[103X ) [32X function
  
  [33X[0;0YThis  function loops over element tuples taken from [3Xclasses[103X and checks these
  for  properties  such  as generating a given group, or fulfilling relations.
  This  can  be  used to find small generating sets or all types of Morphisms.
  The  element  tuples  are  used  only up to up to inner automorphisms as all
  images can be obtained easily from them by conjugation while running through
  all of them usually would take too long.[133X
  
  [33X[0;0Y[3Xrange[103X  is a group from which these elements are taken. The classes are given
  in a list [3Xclasses[103X which is a list of records with the following components.[133X
  
  [8X[10Xclasses[110X[108X
        [33X[0;6Ylist of conjugacy classes[133X
  
  [8X[10Xrepresentative[110X[108X
        [33X[0;6YOne element in the union of these classes[133X
  
  [8X[10Xsize[110X[108X
        [33X[0;6YThe sum of the sizes of these classes[133X
  
  [33X[0;0Y[3Xparams[103X is a record containing the following optional components.[133X
  
  [8X[10Xgens[110X[108X
        [33X[0;6Ygenerators  that  are to be mapped (for testing morphisms). The length
        of this list determines the length of element tuples considered.[133X
  
  [8X[10Xfrom[110X[108X
        [33X[0;6Ya preimage group (that contains [10Xgens[110X)[133X
  
  [8X[10Xto[110X[108X
        [33X[0;6Yimage group (which might be smaller than [10Xrange[110X)[133X
  
  [8X[10Xfree[110X[108X
        [33X[0;6Yfree generators, a list of the same length than the generators [10Xgens[110X.[133X
  
  [8X[10Xrels[110X[108X
        [33X[0;6Ysome  relations that hold among the generators [10Xgens[110X. They are given as
        a  list  [10X[  word,  order ][110X where [10Xword[110X is a word in the free generators
        [10Xfree[110X.[133X
  
  [8X[10Xdom[110X[108X
        [33X[0;6Ya  set  of  elements on which automorphisms act faithfully (used to do
        element tests in partial automorphism groups).[133X
  
  [8X[10Xaut[110X[108X
        [33X[0;6YSubgroup of already known automorphisms.[133X
  
  [8X[10Xcondition[110X[108X
        [33X[0;6YA  function  that  will be applied to the homomorphism and must return
        [10Xtrue[110X for the homomorphism to be accepted.[133X
  
  [33X[0;0Y[3Xaction[103X is a number whose bit-representation indicates the requirements which
  are enforced on the element tuples found, as follows.[133X
  
  [8X1[108X
        [33X[0;6Yhomomorphism[133X
  
  [8X2[108X
        [33X[0;6Yinjective[133X
  
  [8X4[108X
        [33X[0;6Ysurjective[133X
  
  [8X8[108X
        [33X[0;6Yfind all (otherwise stops after the first find)[133X
  
  [33X[0;0YIf  the  search  is  for  homomorphisms,  the function returns homomorphisms
  obtained by mapping the given generators [10Xgens[110X instead of element tuples.[133X
  
  [33X[0;0YThe  [21XMorpheus[121X  algorithm  used to find homomorphisms is described in [Hul96,
  Section V.5].[133X
  
  
  [1X40.10 [33X[0;0YRepresentations for Group Homomorphisms[133X[101X
  
  [33X[0;0YThe  different  representations  of group homomorphisms are used to indicate
  from  what  type  of group to what type of group they map and thus determine
  which methods are used to compute images and preimages.[133X
  
  [33X[0;0YThe  information  in  this  section  is mainly relevant for implementing new
  methods and not for using homomorphisms.[133X
  
  [1X40.10-1 IsGroupGeneralMappingByImages[101X
  
  [29X[2XIsGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0YRepresentation  for  mappings  from one group to another that are defined by
  extending  a  mapping of group generators homomorphically. Instead of record
  components, the attribute [2XMappingGeneratorsImages[102X ([14X40.10-2[114X) is used to store
  generators and their images.[133X
  
  [1X40.10-2 MappingGeneratorsImages[101X
  
  [29X[2XMappingGeneratorsImages[102X( [3Xmap[103X ) [32X attribute
  
  [33X[0;0YThis  attribute contains a list of length 2, the first entry being a list of
  generators of the source of [3Xmap[103X and the second entry a list of their images.
  This  attribute  is used, for example, by [2XGroupHomomorphismByImages[102X ([14X40.1-1[114X)
  to store generators and images.[133X
  
  [1X40.10-3 IsGroupGeneralMappingByAsGroupGeneralMappingByImages[101X
  
  [29X[2XIsGroupGeneralMappingByAsGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0YRepresentation     for     mappings     that     delegate    work    on    a
  [2XGroupHomomorphismByImages[102X ([14X40.1-1[114X).[133X
  
  [1X40.10-4 IsPreimagesByAsGroupGeneralMappingByImages[101X
  
  [29X[2XIsPreimagesByAsGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0YRepresentation  for  mappings  that delegate work for preimages to a mapping
  created with [2XGroupHomomorphismByImages[102X ([14X40.1-1[114X).[133X
  
  [1X40.10-5 IsPermGroupGeneralMapping[101X
  
  [29X[2XIsPermGroupGeneralMapping[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsPermGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsPermGroupHomomorphism[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsPermGroupHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yare the representations for mappings that map from a perm group[133X
  
  [1X40.10-6 IsToPermGroupGeneralMappingByImages[101X
  
  [29X[2XIsToPermGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsToPermGroupHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis the representation for mappings that map to a perm group[133X
  
  [1X40.10-7 IsGroupGeneralMappingByPcgs[101X
  
  [29X[2XIsGroupGeneralMappingByPcgs[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis  the  representations for mappings that map a pcgs to images and thus may
  use exponents to decompose generators.[133X
  
  [1X40.10-8 IsPcGroupGeneralMappingByImages[101X
  
  [29X[2XIsPcGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsPcGroupHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis the representation for mappings from a pc group[133X
  
  [1X40.10-9 IsToPcGroupGeneralMappingByImages[101X
  
  [29X[2XIsToPcGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsToPcGroupHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis the representation for mappings to a pc group[133X
  
  [1X40.10-10 IsFromFpGroupGeneralMappingByImages[101X
  
  [29X[2XIsFromFpGroupGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsFromFpGroupHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis the representation of mappings from an fp group.[133X
  
  [1X40.10-11 IsFromFpGroupStdGensGeneralMappingByImages[101X
  
  [29X[2XIsFromFpGroupStdGensGeneralMappingByImages[102X( [3Xmap[103X ) [32X Representation
  [29X[2XIsFromFpGroupStdGensHomomorphismByImages[102X( [3Xmap[103X ) [32X Representation
  
  [33X[0;0Yis the representation of total mappings from an fp group that give images of
  the standard generators.[133X
  
