  
  [1m[4m[31m3. Morphisms of Groupoids[0m
  
  A  [22m[36mmorphism[0m  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].
  
  
  [1m[4m[31m3.1 Morphisms to a connected groupoid[0m
  
  [1m[4m[31m3.1-1 MorphismOfConnectedGroupoids[0m
  
  [1m[34m> MorphismOfConnectedGroupoids( [0m[22m[34mG, H, imobs, hom[0m[1m[34m ) _________________[0mfunction
  [1m[34m> Source( [0m[22m[34mmor[0m[1m[34m ) ___________________________________________________[0mattribute
  [1m[34m> Range( [0m[22m[34mmor[0m[1m[34m ) ____________________________________________________[0mattribute
  [1m[34m> ComponentImages( [0m[22m[34mmor[0m[1m[34m ) __________________________________________[0mattribute
  
  As   usual,  there  are  a  variety  of  morphism  constructors.  The  basic
  construction  is a morphism G -> H with H connected, which is implemented as
  [22m[32mIsMorphismToConnectedGroupoidRep[0m   with   attributes   [22m[32mSource[0m,   [22m[32mRange[0m   and
  [22m[32mComponentImages[0m.    If    G    is    also    connected,    we    may   apply
  [22m[32mMorphismOfConnectedGroupoids[0m, requiring:
  
  --    a list [22m[32mimobs[0m of the images of the objects of G;
  
  --    a homomorphism [22m[32mhom[0m from the group of G to the group of H.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> d12 := Group( (15,16,17,18,19,20, (15,20)(16,19)(17,18) );;[0m
    [22m[35mgap> Gd12 := ConnectedGroupoid( [-37,-36,-35,-34], d12 );;[0m
    [22m[35mgap> SetName( d12, "d12" );  SetName( Gd12, "Gd12" );[0m
    [22m[35mgap> s3d := Subgroup( d12, [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ] );[0m
    [22m[35mgap> Gs3d := SubgroupoidByComponents( Gd12, [ [[-36,-35,-34], s3d] ] );;[0m
    [22m[35mgap> SetName( s3d, "s3d" );  SetName( Gs3d, "Gs3d" );[0m
    [22m[35mgap> gend8 := GeneratorsOfGroup( d8 );;[0m
    [22m[35mgap> imhd8 := [ ( ), (15,20)(16,19)(17,18) ];;[0m
    [22m[35mgap> hd8 := GroupHomomorphismByImages( d8, s3d, gend8, imhd8 );[0m
    [22m[35mgap> md8 := MorphismOfConnectedGroupoids( Gd8, Gs3d, [-34,-35,-36], hd8 );[0m
    [22m[35mGroupoid morphism : Gd8 -> Gs3d [0m
    [22m[35mgap> IsBijectiveOnObjects( md8 );[0m
    [22m[35mtrue[0m
    [22m[35mgap> Display( md8 );[0m
    [22m[35mMorphism to connected groupoid:[0m
    [22m[35m[ Gd8 ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.1-2 MorphismToConnectedGroupoid[0m
  
  [1m[34m> MorphismToConnectedGroupoid( [0m[22m[34mG, H, obhoms[0m[1m[34m ) ______________________[0mfunction
  [1m[34m> GroupoidMorphismWithCommonRange( [0m[22m[34mG, H, mors[0m[1m[34m ) ____________________[0mfunction
  [1m[34m> GroupoidMorphism( [0m[22m[34margs[0m[1m[34m ) _________________________________________[0mfunction
  
  When    G    is    not    connected    the    appropriate    operation    is
  [22m[32mMorphismToConnectedGroupoid(  G, H, obhoms )[0m, where the third parameter is a
  list [22m[32mComponentImages( mor )[0m of [22m[32m[imobs,hom][0m pairs.
  
  The   operation   [22m[32mGroupoidMorphismWithCommonRange[0m  combines  into  a  single
  morphism  two or more morphisms, in the list [22m[32mmors[0m, with range H and source a
  subgroupoid of G.
  
  The  global  function  [22m[32mGroupoidMorphism[0m  will  normally find the appropriate
  operation to call.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> hc6 := GroupHomomorphismByImages( c6, s3d, [(5,6,7)(8,9)], [(15,19)(16,18)] );;[0m
    [22m[35mgap> mc6 := GroupoidMorphism( Gc6, Gs3d, [ -36 ], hc6 );;[0m
    [22m[35mgap> md8c6 := MorphismToConnectedGroupoid( Gd8c6, Gs3d, [0m
    [22m[35m              [ [[-34,-35,-36], hd8], [[-36], hc6] ] );[0m
    [22m[35mGroupoid morphism : Gd8+Gc6 -> Gs3d[0m
    [22m[35mgap> Display( md8c6 );[0m
    [22m[35mMorphism to connected groupoid with components:[0m
    [22m[35m[ Gd8 ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0m
    [22m[35m[ Gc6 ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -6 ], [ -36 ] ][0m
    [22m[35mhomomorphism = [ [ (5,6,7)(8,9) ], [ (15,19)(16,18) ] ][0m
    [22m[35mgap> [0m
    [22m[35mgap> gens3d := GeneratorsOfGroup( s3d );;[0m
    [22m[35mgap> imas3d := [ (15,17,19)(16,18,20), (15,16)(17,20)(18,19) ];;[0m
    [22m[35mgap> as3d := GroupHomomorphismByImages( s3d, s3d, gens3d, imas3d );;[0m
    [22m[35mgap> aGs3d := MorphismOfConnectedGroupoids( Gs3d, Gs3d, [-35,-34,-36], as3d );;[0m
    [22m[35mgap> IsGroupoidAutomorphism( aGs3d );[0m
    [22m[35mtrue[0m
    [22m[35mgap> Order( aGs3d );[0m
    [22m[35m3[0m
    [22m[35mgap> Gs3dd8 := GroupoidByUnion( [ Gd8, Gs3d ] );;[0m
    [22m[35mgap> SetName( Gs3dd8, "Gs3d+Gd8" );;[0m
    [22m[35mgap> common := GroupoidMorphismWithCommonRange( Gs3dd8, Gs3d, [ aGs3d, md8 ] );;[0m
    [22m[35mgap> Display( common );[0m
    [22m[35mMorphism to connected groupoid with components:[0m
    [22m[35m[ Gs3d ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -36, -35, -34 ], [ -35, -34, -36 ] ][0m
    [22m[35mhomomorphism = [ [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ],[0m
    [22m[35m  [ (15,17,19)(16,18,20), (15,16)(17,20)(18,19) ] ][0m
    [22m[35m[ Gd8 ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -9, -8, -7 ], [ -34, -35, -36 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (), (15,20)(16,19)(17,18) ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.1-3 IsomorphismNewObjects[0m
  
  [1m[34m> IsomorphismNewObjects( [0m[22m[34mgpd, obs[0m[1m[34m ) _______________________________[0moperation
  [1m[34m> IdentityMapping( [0m[22m[34mgpd[0m[1m[34m ) __________________________________________[0mattribute
  
  The  function [22m[32mIsomorphismNewObjects[0m provides an isomorphism to an isomorphic
  groupoid  with  a  new set of objects. The function [22m[32mIdentityMapping[0m, already
  provided for groups, is also implemented for groupoids.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> idGd8 := IdentityMapping( Gd8 );[0m
    [22m[35mGroupoid morphism: [ Gd8 ] -> [ Gd8 ][0m
    [22m[35mgap> copys3d := IsomorphismNewObjects( Gs3d, [-24,-25,-26] );;[0m
    [22m[35mgap> Hs3d := Range( copys3d );;[0m
    [22m[35mgap> SetName( Hs3, "Hs3" );[0m
    [22m[35mgap> Display( copys3d );[0m
    [22m[35mMorphism to connected groupoid:[0m
    [22m[35m[ Gs3d ] -> [ Hs3d ][0m
    [22m[35m  object map = [ [ -36, -35, -34 ], [ -32, -31, -30 ] ][0m
    [22m[35mhomomorphism = [ [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ],[0m
    [22m[35m  [ (15,17,19)(16,18,20), (15,20)(16,19)(17,18) ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.1-4 InclusionMappingGroupoids[0m
  
  [1m[34m> InclusionMappingGroupoids( [0m[22m[34mG, U[0m[1m[34m ) _______________________________[0moperation
  [1m[34m> RestrictionMappingGroupoids( [0m[22m[34mhom, src, rng[0m[1m[34m ) ____________________[0moperation
  
  We      have      added      functions     [22m[32mInclusionMappingGroupoids[0m     and
  [22m[32mRestrictionMappingGroupoids[0m,  corresponding  to  [22m[32mInclusionMappingGroups[0m  and
  [22m[32mRestrictionMappingGroups[0m  for groups. At present [22m[32mRestrictionMappingGroups[0m is
  only implemented for the case where the source and range of the morphism are
  connected.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> SetName( ComponentsOfGroupoid(Ud8)[1], "Ud8a" );[0m
    [22m[35mgap> SetName( ComponentsOfGroupoid(Ud8)[2], "Ud8b" );[0m
    [22m[35mgap> inc := InclusionMappingGroupoids( Gd8, Ud8 );;[0m
    [22m[35mgap> Display( inc );[0m
    [22m[35mMorphism to connected groupoid with components:[0m
    [22m[35m[ Ud8a ] -> [ Gd8 ][0m
    [22m[35m  object map = [ [ -9 ], [ -9 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2)(3,4), (1,3)(2,4) ], [ (1,2)(3,4), (1,3)(2,4) ] ][0m
    [22m[35m[ Ud8b ] -> [ Gd8 ][0m
    [22m[35m  object map = [ [ -8, -7 ], [ -8, -7 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4) ], [ (1,2,3,4) ] ][0m
    [22m[35mgap> res := RestrictionMappingGroupoids( md8, Ud8, Gs3d );[0m
    [22m[35mgap> Display( res );[0m
    [22m[35mMorphism to connected groupoid with components:[0m
    [22m[35m[ Ud8a ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -9 ], [ -34 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2)(3,4), (1,3)(2,4) ], [ (15,20)(16,19)(17,18), () ] ][0m
    [22m[35m[ Ud8b ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -8, -7 ], [ -35, -36 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4) ], [ () ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  
  [1m[4m[31m3.2 General Morphisms and composites[0m
  
  [1m[4m[31m3.2-1 GroupoidMorphismByComponents[0m
  
  [1m[34m> GroupoidMorphismByComponents( [0m[22m[34mG, H, mors[0m[1m[34m ) ______________________[0moperation
  [1m[34m> GroupoidMorphismByUnion( [0m[22m[34mmors[0m[1m[34m ) __________________________________[0mfunction
  
  When  H  is  not  connected, a groupoid morphism from G to H is a union of a
  list [22m[32mmors[0m of morphisms of connected groupoids.
  
  There  are  two  ways of combining [22m[32mm1 : G1->H1[0m and [22m[32mm2 : G2->H2[0m into a single
  morphism.  The  operation  [22m[32mGroupoidMorphismByUnion( [m1,m2] );[0m constucts the
  groupoid  unions  [22m[32mG12,H12[0m  of [22m[32mG1[0m with [22m[32mG2[0m and [22m[32mH1[0m with [22m[32mH2[0m, and then a morphism
  [22m[32mm12  :  G12->H12[0m.  If  [22m[32mG12,H12[0m  have already been constructed, the operation
  [22m[32mGroupoidMorphismByComponents( G12, H12, [m1,m2] );[0m may be more appropriate.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> imad8 := [ (1,2,3,4), (2,4) ];;[0m
    [22m[35mgap> ad8 := GroupHomomorphismByImages( d8, d8, [(1,2,3,4),(1,3)], imad8 );;[0m
    [22m[35mgap> aGd8 := MorphismOfConnectedGroupoids( Gd8, Gd8, [-8,-7,-9], ad8 );;[0m
    [22m[35mgap> mor1 := GroupoidMorphismByUnion( [ aGd8, mc6 ] );;[0m
    [22m[35mgap> mor2 := GroupoidMorphismByComponents( Gd8c6, Gs3dd8, [ aGd8, mc6 ] );;[0m
    [22m[35mgap> Display( mor2 );[0m
    [22m[35mGroupoid Morphism: Gd8+Gc6 -> Gs3d+Gd8 with components :[0m
    [22m[35m[ Gc6 ] -> [ Gs3d ][0m
    [22m[35m  object map = [ [ -6 ], [ -36 ] ][0m
    [22m[35mhomomorphism = [ [ (5,6,7)(8,9) ], [ (15,19)(16,18) ] ][0m
    [22m[35m[ Gd8 ] -> [ Gd8 ][0m
    [22m[35m  object map = [ [ -9, -8, -7 ], [ -8, -7, -9 ] ][0m
    [22m[35mhomomorphism = [ [ (1,2,3,4), (1,3) ], [ (1,2,3,4), (2,4) ] ][0m
    [22m[35mgap> mor1 = mor2;[0m
    [22m[35mtrue[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.2-2 IsGroupoidMorphism[0m
  
  [1m[34m> IsGroupoidMorphism( [0m[22m[34mmor[0m[1m[34m ) ________________________________________[0mproperty
  [1m[34m> IsInjectiveOnObjects( [0m[22m[34mmor[0m[1m[34m ) ______________________________________[0mproperty
  [1m[34m> IsSurjectiveOnObjects( [0m[22m[34mmor[0m[1m[34m ) _____________________________________[0mproperty
  [1m[34m> IsBijectiveOnObjects( [0m[22m[34mmor[0m[1m[34m ) ______________________________________[0mproperty
  [1m[34m> IsGroupoidAutomorphism( [0m[22m[34mmor[0m[1m[34m ) ____________________________________[0mproperty
  
  Here are some of the basic properties of groupoid morphisms.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> IsGroupoidMorphism( res );[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsInjectiveOnObjects( res );[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsInjective( res );[0m
    [22m[35mfalse[0m
    [22m[35mgap> IsSurjectiveOnObjects( inc );[0m
    [22m[35mtrue[0m
    [22m[35mgap> IsSurjective( inc );[0m
    [22m[35mfalse[0m
    [22m[35mgap> IsGroupoidAutomorphism( aGd8 );[0m
    [22m[35mtrue[0m
    [22m[35mgap> eGd8 := MorphismOfConnectedGroupoids( Gd8, Gd8, [-7,-7,-9], ad8 );;[0m
    [22m[35mgap> IsGroupoidEndomorphism( eGd8 );[0m
    [22m[35mtrue[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.2-3 ImagesOfObjects[0m
  
  [1m[34m> ImagesOfObjects( [0m[22m[34mmor[0m[1m[34m ) __________________________________________[0mattribute
  [1m[34m> ImagesSource( [0m[22m[34mmor[0m[1m[34m ) _____________________________________________[0mattribute
  [1m[34m> ImageElm( [0m[22m[34mmor, elt[0m[1m[34m ) ____________________________________________[0moperation
  
  Here  are  some  of examples of operations that return images. These are not
  yet  fully  implemented:  for example, [22m[32mImageElm[0m and [22m[32mImagesSource[0m require the
  range of [22m[32mmor[0m to be connected.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> ImagesOfObjects( md8 );[0m
    [22m[35m[ [ -34, -35, -36, -36 ] ][0m
    [22m[35mgap> ImagesSource(md8);[0m
    [22m[35mPerm Connected Groupoid:[0m
    [22m[35m< [ -36, -35, -34 ], Group( [ (), (15,20)(16,19)(17,18) ] ) >[0m
    [22m[35mgap> e1;[0m
    [22m[35m[(1,2)(3,4) : -9 -> -8][0m
    [22m[35mgap> ImageElm( md8c6, e1 );[0m
    [22m[35m[(15,20)(16,19)(17,18) : -34 -> -35][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.2-4 Product[0m
  
  [1m[34m> Product( [0m[22m[34mmors[0m[1m[34m ) _________________________________________________[0moperation
  
  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.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> Hk4d := SubgroupoidByComponents( Gd8, [ [[-9,-8,-7], k4d] ] );;[0m
    [22m[35mgap> genq8 := GeneratorsOfGroup(q8);;[0m
    [22m[35mgap> hq8 := GroupHomomorphismByImages( q8,k4d,genq8,[(1,2)(3,4),(1,3)(2,4),()]);;[0m
    [22m[35mgap> mq8 := GroupoidMorphism( Gq8, Hk4d, [-7,-9], hq8 );;[0m
    [22m[35mgap> iHk4d := InclusionMappingGroupoids( Gd8, Hk4d );;[0m
    [22m[35mgap> mor3 := mq8*iHk4d;;[0m
    [22m[35mgap> Display( mor3 );[0m
    [22m[35mMorphism to connected groupoid:[0m
    [22m[35m[ Gq8 ] -> [ Gd8 ][0m
    [22m[35m  object map = [ [ -28, -27 ], [ -7, -9 ] ][0m
    [22m[35mhomomorphism = [ Pcgs([ f1, f2, f3 ]), [ (1,2)(3,4), (1,3)(2,4), () ] ][0m
    [22m[35mgap> mor4 := mor1*aGd8;;[0m
    [22m[35mgap> Display( mor4 );[0m
    [22m[35mMorphism to connected groupoid:[0m
    [22m[35m[ Gq8 ] -> [ Gd8 ][0m
    [22m[35m  object map = [ [ -28, -27 ], [ -9, -8 ] ][0m
    [22m[35mhomomorphism = [ Pcgs([ f1, f2, f3 ]), [ (1,4)(2,3), (1,3)(2,4), () ] ][0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
  [1m[4m[31m3.2-5 InverseMorphism[0m
  
  [1m[34m> InverseMorphism( [0m[22m[34mmor[0m[1m[34m ) __________________________________________[0mattribute
  [1m[34m> Order( [0m[22m[34mmor[0m[1m[34m ) ____________________________________________________[0mattribute
  
  The [22m[36minverse[0m of a morphism m is defined when m is bijective on objects and on
  elements.    The    operation    [22m[32mInverseMorphism[0m    is    a    synonym   for
  [22m[32mInverseGeneralMapping[0m.  The  [22m[36morder[0m  of an automorphism is the smallest power
  which returns the identity morphism of G.
  
  [22m[35m---------------------------  Example  ----------------------------[0m
    [22m[35m[0m
    [22m[35mgap> genq8 := GeneratorsOfGroup( q8 );;[0m
    [22m[35mgap> imq8 := [ q8.2, q8.1*q8.2, q8.3 ];[0m
    [22m[35m[ f2, f1*f2, f3 ][0m
    [22m[35mgap> autq8 := GroupHomomorphismByImages( q8, q8, genq8, imq8 );;[0m
    [22m[35mgap> autGq8 := GroupoidMorphism( Gq8, Gq8, [-27,-28], autq8 );;[0m
    [22m[35mgap> Display( InverseMorphism( autGq8 ) );[0m
    [22m[35mMorphism to connected groupoid:[0m
    [22m[35m[ Gq8 ] -> [ Gq8 ][0m
    [22m[35m  object map = [ [ -28, -27 ], [ -27, -28 ] ][0m
    [22m[35mhomomorphism = [ [ f2, f1*f2, f3 ], [ f1, f2, f3 ] ][0m
    [22m[35mgap> Order( autGq8 );[0m
    [22m[35m6[0m
    [22m[35m[0m
  [22m[35m------------------------------------------------------------------[0m
  
