  
  [1X3. Morphisms of Groupoids[0X
  
  A  [13Xmorphism[0X  m  from a groupoid G to a groupoid H consists of a map from the
  objects  of  G  to  those of H together with a map from the elements of G to
  those  of  H  which  is  compatible  with  tail and head and which preserves
  multiplication:
  
  
       m(g1 : o1 \to o2)*m(g2 : o2 \to o3) ~=~ m(g1*g2 : o1 \to o3).
  
  
  Note  that  when  a  morphism  is not injective on objects, the image of the
  source  need not be a subgroupoid of the range. The simplest example of this
  is  given  by mapping the two-object groupoid with trivial group to the free
  group < a > on one generator, when the image is [1,a,a^-1].
  
  
  [1X3.1 Morphisms to a connected groupoid[0X
  
  [1X3.1-1 MorphismOfConnectedGroupoids[0X
  
  [2X> MorphismOfConnectedGroupoids( [0X[3XG, H, imobs, hom[0X[2X ) _________________[0Xfunction
  [2X> Source( [0X[3Xmor[0X[2X ) ___________________________________________________[0Xattribute
  [2X> Range( [0X[3Xmor[0X[2X ) ____________________________________________________[0Xattribute
  [2X> ComponentImages( [0X[3Xmor[0X[2X ) __________________________________________[0Xattribute
  
  As   usual,  there  are  a  variety  of  morphism  constructors.  The  basic
  construction  is a morphism G -> H with H connected, which is implemented as
  [10XIsMorphismToConnectedGroupoidRep[0X   with   attributes   [10XSource[0X,   [10XRange[0X   and
  [10XComponentImages[0X.    If    G    is    also    connected,    we    may   apply
  [10XMorphismOfConnectedGroupoids[0X, requiring:
  
  --    a list [10Ximobs[0X of the images of the objects of G;
  
  --    a homomorphism [10Xhom[0X from the group of G to the group of H.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> d12 := Group( (15,16,17,18,19,20, (15,20)(16,19)(17,18) );;[0X
    [4Xgap> Gd12 := ConnectedGroupoid( [-37,-36,-35,-34], d12 );;[0X
    [4Xgap> SetName( d12, "d12" );  SetName( Gd12, "Gd12" );[0X
    [4Xgap> s3d := Subgroup( d12, [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ] );[0X
    [4Xgap> Gs3d := SubgroupoidByComponents( Gd12, [ [[-36,-35,-34], s3d] ] );;[0X
    [4Xgap> SetName( s3d, "s3d" );  SetName( Gs3d, "Gs3d" );[0X
    [4Xgap> gend8 := GeneratorsOfGroup( d8 );;[0X
    [4Xgap> imhd8 := [ ( ), (15,20)(16,19)(17,18) ];;[0X
    [4Xgap> hd8 := GroupHomomorphismByImages( d8, s3d, gend8, imhd8 );[0X
    [4Xgap> md8 := MorphismOfConnectedGroupoids( Gd8, Gs3d, [-34,-35,-36], hd8 );[0X
    [4XGroupoid morphism : Gd8 -> Gs3d [0X
    [4Xgap> IsBijectiveOnObjects( md8 );[0X
    [4Xtrue[0X
    [4Xgap> Display( md8 );[0X
    [4XMorphism to connected groupoid:[0X
    [4X[ Gd8 ] -> [ Gs3d ][0X
    [4X  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.1-2 MorphismToConnectedGroupoid[0X
  
  [2X> MorphismToConnectedGroupoid( [0X[3XG, H, obhoms[0X[2X ) ______________________[0Xfunction
  [2X> GroupoidMorphismWithCommonRange( [0X[3XG, H, mors[0X[2X ) ____________________[0Xfunction
  [2X> GroupoidMorphism( [0X[3Xargs[0X[2X ) _________________________________________[0Xfunction
  
  When    G    is    not    connected    the    appropriate    operation    is
  [10XMorphismToConnectedGroupoid(  G, H, obhoms )[0X, where the third parameter is a
  list [10XComponentImages( mor )[0X of [10X[imobs,hom][0X pairs.
  
  The   operation   [10XGroupoidMorphismWithCommonRange[0X  combines  into  a  single
  morphism  two or more morphisms, in the list [10Xmors[0X, with range H and source a
  subgroupoid of G.
  
  The  global  function  [10XGroupoidMorphism[0X  will  normally find the appropriate
  operation to call.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> hc6 := GroupHomomorphismByImages( c6, s3d, [(5,6,7)(8,9)], [(15,19)(16,18)] );;[0X
    [4Xgap> mc6 := GroupoidMorphism( Gc6, Gs3d, [ -36 ], hc6 );;[0X
    [4Xgap> md8c6 := MorphismToConnectedGroupoid( Gd8c6, Gs3d, [0X
    [4X              [ [[-34,-35,-36], hd8], [[-36], hc6] ] );[0X
    [4XGroupoid morphism : Gd8+Gc6 -> Gs3d[0X
    [4Xgap> Display( md8c6 );[0X
    [4XMorphism to connected groupoid with components:[0X
    [4X[ Gd8 ] -> [ Gs3d ][0X
    [4X  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0X
    [4X[ Gc6 ] -> [ Gs3d ][0X
    [4X  object map = [ [ -6 ], [ -36 ] ][0X
    [4Xhomomorphism = [ [ (5,6,7)(8,9) ], [ (15,19)(16,18) ] ][0X
    [4Xgap> [0X
    [4Xgap> gens3d := GeneratorsOfGroup( s3d );;[0X
    [4Xgap> imas3d := [ (15,17,19)(16,18,20), (15,16)(17,20)(18,19) ];;[0X
    [4Xgap> as3d := GroupHomomorphismByImages( s3d, s3d, gens3d, imas3d );;[0X
    [4Xgap> aGs3d := MorphismOfConnectedGroupoids( Gs3d, Gs3d, [-35,-34,-36], as3d );;[0X
    [4Xgap> IsGroupoidAutomorphism( aGs3d );[0X
    [4Xtrue[0X
    [4Xgap> Order( aGs3d );[0X
    [4X3[0X
    [4Xgap> Gs3dd8 := GroupoidByUnion( [ Gd8, Gs3d ] );;[0X
    [4Xgap> SetName( Gs3dd8, "Gs3d+Gd8" );;[0X
    [4Xgap> common := GroupoidMorphismWithCommonRange( Gs3dd8, Gs3d, [ aGs3d, md8 ] );;[0X
    [4Xgap> Display( common );[0X
    [4XMorphism to connected groupoid with components:[0X
    [4X[ Gs3d ] -> [ Gs3d ][0X
    [4X  object map = [ [ -36, -35, -34 ], [ -35, -34, -36 ] ][0X
    [4Xhomomorphism = [ [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ],[0X
    [4X  [ (15,17,19)(16,18,20), (15,16)(17,20)(18,19) ] ][0X
    [4X[ Gd8 ] -> [ Gs3d ][0X
    [4X  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.1-3 IsomorphismNewObjects[0X
  
  [2X> IsomorphismNewObjects( [0X[3Xgpd, obs[0X[2X ) _______________________________[0Xoperation
  [2X> IdentityMapping( [0X[3Xgpd[0X[2X ) __________________________________________[0Xattribute
  
  The  function [10XIsomorphismNewObjects[0X provides an isomorphism to an isomorphic
  groupoid  with  a  new set of objects. The function [10XIdentityMapping[0X, already
  provided for groups, is also implemented for groupoids.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> idGd8 := IdentityMapping( Gd8 );[0X
    [4XGroupoid morphism: [ Gd8 ] -> [ Gd8 ][0X
    [4Xgap> copys3d := IsomorphismNewObjects( Gs3d, [-24,-25,-26] );;[0X
    [4Xgap> Hs3d := Range( copys3d );;[0X
    [4Xgap> SetName( Hs3, "Hs3" );[0X
    [4Xgap> Display( copys3d );[0X
    [4XMorphism to connected groupoid:[0X
    [4X[ Gs3d ] -> [ Hs3d ][0X
    [4X  object map = [ [ -36, -35, -34 ], [ -32, -31, -30 ] ][0X
    [4Xhomomorphism = [ [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ],[0X
    [4X  [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.1-4 InclusionMappingGroupoids[0X
  
  [2X> InclusionMappingGroupoids( [0X[3XG, U[0X[2X ) _______________________________[0Xoperation
  [2X> RestrictionMappingGroupoids( [0X[3Xhom, src, rng[0X[2X ) ____________________[0Xoperation
  
  We      have      added      functions     [10XInclusionMappingGroupoids[0X     and
  [10XRestrictionMappingGroupoids[0X,  corresponding  to  [10XInclusionMappingGroups[0X  and
  [10XRestrictionMappingGroups[0X  for groups. At present [10XRestrictionMappingGroups[0X is
  only implemented for the case where the source and range of the morphism are
  connected.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> SetName( ComponentsOfGroupoid(Ud8)[1], "Ud8a" );[0X
    [4Xgap> SetName( ComponentsOfGroupoid(Ud8)[2], "Ud8b" );[0X
    [4Xgap> inc := InclusionMappingGroupoids( Gd8, Ud8 );;[0X
    [4Xgap> Display( inc );[0X
    [4XMorphism to connected groupoid with components:[0X
    [4X[ Ud8a ] -> [ Gd8 ][0X
    [4X  object map = [ [ -9 ], [ -9 ] ][0X
    [4Xhomomorphism = [ [ (1,2)(3,4), (1,3)(2,4) ], [ (1,2)(3,4), (1,3)(2,4) ] ][0X
    [4X[ Ud8b ] -> [ Gd8 ][0X
    [4X  object map = [ [ -8, -7 ], [ -8, -7 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4) ], [ (1,2,3,4) ] ][0X
    [4Xgap> res := RestrictionMappingGroupoids( md8, Ud8, Gs3d );[0X
    [4Xgap> Display( res );[0X
    [4XMorphism to connected groupoid with components:[0X
    [4X[ Ud8a ] -> [ Gs3d ][0X
    [4X  object map = [ [ -9 ], [ -34 ] ][0X
    [4Xhomomorphism = [ [ (1,2)(3,4), (1,3)(2,4) ], [ (15,20)(16,19)(17,18), () ] ][0X
    [4X[ Ud8b ] -> [ Gs3d ][0X
    [4X  object map = [ [ -8, -7 ], [ -35, -36 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4) ], [ () ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  
  [1X3.2 General Morphisms and composites[0X
  
  [1X3.2-1 GroupoidMorphismByComponents[0X
  
  [2X> GroupoidMorphismByComponents( [0X[3XG, H, mors[0X[2X ) ______________________[0Xoperation
  [2X> GroupoidMorphismByUnion( [0X[3Xmors[0X[2X ) __________________________________[0Xfunction
  
  When  H  is  not  connected, a groupoid morphism from G to H is a union of a
  list [10Xmors[0X of morphisms of connected groupoids.
  
  There  are  two  ways of combining [10Xm1 : G1->H1[0X and [10Xm2 : G2->H2[0X into a single
  morphism.  The  operation  [10XGroupoidMorphismByUnion( [m1,m2] );[0X constucts the
  groupoid  unions  [10XG12,H12[0X  of [10XG1[0X with [10XG2[0X and [10XH1[0X with [10XH2[0X, and then a morphism
  [10Xm12  :  G12->H12[0X.  If  [10XG12,H12[0X  have already been constructed, the operation
  [10XGroupoidMorphismByComponents( G12, H12, [m1,m2] );[0X may be more appropriate.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> imad8 := [ (1,2,3,4), (2,4) ];;[0X
    [4Xgap> ad8 := GroupHomomorphismByImages( d8, d8, [(1,2,3,4),(1,3)], imad8 );;[0X
    [4Xgap> aGd8 := MorphismOfConnectedGroupoids( Gd8, Gd8, [-8,-7,-9], ad8 );;[0X
    [4Xgap> mor1 := GroupoidMorphismByUnion( [ aGd8, mc6 ] );;[0X
    [4Xgap> mor2 := GroupoidMorphismByComponents( Gd8c6, Gs3dd8, [ aGd8, mc6 ] );;[0X
    [4Xgap> Display( mor2 );[0X
    [4XGroupoid Morphism: Gd8+Gc6 -> Gs3d+Gd8 with components :[0X
    [4X[ Gc6 ] -> [ Gs3d ][0X
    [4X  object map = [ [ -6 ], [ -36 ] ][0X
    [4Xhomomorphism = [ [ (5,6,7)(8,9) ], [ (15,19)(16,18) ] ][0X
    [4X[ Gd8 ] -> [ Gd8 ][0X
    [4X  object map = [ [ -9, -8, -7 ], [ -8, -7, -9 ] ][0X
    [4Xhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (1,2,3,4), (2,4) ] ][0X
    [4Xgap> mor1 = mor2;[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.2-2 IsGroupoidMorphism[0X
  
  [2X> IsGroupoidMorphism( [0X[3Xmor[0X[2X ) ________________________________________[0Xproperty
  [2X> IsInjectiveOnObjects( [0X[3Xmor[0X[2X ) ______________________________________[0Xproperty
  [2X> IsSurjectiveOnObjects( [0X[3Xmor[0X[2X ) _____________________________________[0Xproperty
  [2X> IsBijectiveOnObjects( [0X[3Xmor[0X[2X ) ______________________________________[0Xproperty
  [2X> IsGroupoidAutomorphism( [0X[3Xmor[0X[2X ) ____________________________________[0Xproperty
  
  Here are some of the basic properties of groupoid morphisms.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> IsGroupoidMorphism( res );[0X
    [4Xtrue[0X
    [4Xgap> IsInjectiveOnObjects( res );[0X
    [4Xtrue[0X
    [4Xgap> IsInjective( res );[0X
    [4Xfalse[0X
    [4Xgap> IsSurjectiveOnObjects( inc );[0X
    [4Xtrue[0X
    [4Xgap> IsSurjective( inc );[0X
    [4Xfalse[0X
    [4Xgap> IsGroupoidAutomorphism( aGd8 );[0X
    [4Xtrue[0X
    [4Xgap> eGd8 := MorphismOfConnectedGroupoids( Gd8, Gd8, [-7,-7,-9], ad8 );;[0X
    [4Xgap> IsGroupoidEndomorphism( eGd8 );[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.2-3 ImagesOfObjects[0X
  
  [2X> ImagesOfObjects( [0X[3Xmor[0X[2X ) __________________________________________[0Xattribute
  [2X> ImagesSource( [0X[3Xmor[0X[2X ) _____________________________________________[0Xattribute
  [2X> ImageElm( [0X[3Xmor, elt[0X[2X ) ____________________________________________[0Xoperation
  
  Here  are  some  of examples of operations that return images. These are not
  yet  fully  implemented:  for example, [10XImageElm[0X and [10XImagesSource[0X require the
  range of [10Xmor[0X to be connected.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> ImagesOfObjects( md8 );[0X
    [4X[ [ -34, -35, -36, -36 ] ][0X
    [4Xgap> ImagesSource(md8);[0X
    [4XPerm Connected Groupoid:[0X
    [4X< [ -36, -35, -34 ], Group( [ (), (15,20)(16,19)(17,18) ] ) >[0X
    [4Xgap> e1;[0X
    [4X[(1,2)(3,4) : -9 -> -8][0X
    [4Xgap> ImageElm( md8c6, e1 );[0X
    [4X[(15,20)(16,19)(17,18) : -34 -> -35][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.2-4 Product[0X
  
  [2X> Product( [0X[3Xmors[0X[2X ) _________________________________________________[0Xoperation
  
  Morphisms  m_1,  m_2 can be composed if the image of m_1 is contained in the
  domain  of  m_2.  Currently  composition  is  only  defined for morphisms of
  connected groupoids.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> Hk4d := SubgroupoidByComponents( Gd8, [ [[-9,-8,-7], k4d] ] );;[0X
    [4Xgap> genq8 := GeneratorsOfGroup(q8);;[0X
    [4Xgap> hq8 := GroupHomomorphismByImages( q8,k4d,genq8,[(1,2)(3,4),(1,3)(2,4),()]);;[0X
    [4Xgap> mq8 := GroupoidMorphism( Gq8, Hk4d, [-7,-9], hq8 );;[0X
    [4Xgap> iHk4d := InclusionMappingGroupoids( Gd8, Hk4d );;[0X
    [4Xgap> mor3 := mq8*iHk4d;;[0X
    [4Xgap> Display( mor3 );[0X
    [4XMorphism to connected groupoid:[0X
    [4X[ Gq8 ] -> [ Gd8 ][0X
    [4X  object map = [ [ -28, -27 ], [ -7, -9 ] ][0X
    [4Xhomomorphism = [ Pcgs([ f1, f2, f3 ]), [ (1,2)(3,4), (1,3)(2,4), () ] ][0X
    [4Xgap> mor4 := mor1*aGd8;;[0X
    [4Xgap> Display( mor4 );[0X
    [4XMorphism to connected groupoid:[0X
    [4X[ Gq8 ] -> [ Gd8 ][0X
    [4X  object map = [ [ -28, -27 ], [ -9, -8 ] ][0X
    [4Xhomomorphism = [ Pcgs([ f1, f2, f3 ]), [ (1,4)(2,3), (1,3)(2,4), () ] ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X3.2-5 InverseMorphism[0X
  
  [2X> InverseMorphism( [0X[3Xmor[0X[2X ) __________________________________________[0Xattribute
  [2X> Order( [0X[3Xmor[0X[2X ) ____________________________________________________[0Xattribute
  
  The [13Xinverse[0X of a morphism m is defined when m is bijective on objects and on
  elements.    The    operation    [10XInverseMorphism[0X    is    a    synonym   for
  [10XInverseGeneralMapping[0X.  The  [13Xorder[0X  of an automorphism is the smallest power
  which returns the identity morphism of G.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> genq8 := GeneratorsOfGroup( q8 );;[0X
    [4Xgap> imq8 := [ q8.2, q8.1*q8.2, q8.3 ];[0X
    [4X[ f2, f1*f2, f3 ][0X
    [4Xgap> autq8 := GroupHomomorphismByImages( q8, q8, genq8, imq8 );;[0X
    [4Xgap> autGq8 := GroupoidMorphism( Gq8, Gq8, [-27,-28], autq8 );;[0X
    [4Xgap> Display( InverseMorphism( autGq8 ) );[0X
    [4XMorphism to connected groupoid:[0X
    [4X[ Gq8 ] -> [ Gq8 ][0X
    [4X  object map = [ [ -28, -27 ], [ -27, -28 ] ][0X
    [4Xhomomorphism = [ [ f2, f1*f2, f3 ], [ f1, f2, f3 ] ][0X
    [4Xgap> Order( autGq8 );[0X
    [4X6[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
