  
  [1X2 Many-object structures[0X
  
  A  [13Xmagma  with  objects[0m  M  consists of a set of [13Xobjects[0m Ob(M), and a set of
  [13Xarrows[0m  Arr(M) together with [13Xtail[0m and [13Xhead[0m maps t,h : Arr(M) -> Ob(M), and a
  [13Xpartial multiplication[0m * : Arr(M) -> Arr(M), with a*b defined precisely when
  the  head of a coincides with the tail of b. We write an arrow a with tail u
  and head v as (a : u -> v).
  
  When this multiplication is associative we obtain a [13Xsemigroup with objects[0m.
  
  A  [13Xloop[0m  is  an  arrow  whose tail and head are the same object. An [13Xidentity
  arrow[0m  at  object  u  is a loop (1_u : u -> u) such that a*1_u=a and 1_u*b=b
  whenever  u  is  the head of a and the tail of b. When M is a semigroup with
  objects  and  every  object  has  an identity arrow, we obtain a [13Xmonoid with
  objects[0m, which is just the usual notion of mathematical category.
  
  An  arrow  (a : u -> v) in a monoid with objects has [13Xinverse[0m (a^-1 : v -> u)
  provided a*a^-1 = 1_u and a^-1*a = 1_v. A monoid with objects in which every
  arrow has an inverse is a [13Xgroup with objects[0m, usually called a [13Xgroupoid[0m.
  
  For  the  definitions of the standard properties of groupoids we refer to R.
  Brown's   book  ``Topology''  [Bro88],  recently  revised  and  reissued  as
  ``Topology and Groupoids'' [Bro06].
  
  
  [1X2.1 Magmas with objects[0X
  
  [1X2.1-1 MagmaWithObjects[0m
  
  [2X> MagmaWithObjects( [0X[3Xargs[0X[2X ) _________________________________________[0Xfunction
  [2X> ObjectList( [0X[3Xmwo[0X[2X ) _______________________________________________[0Xattribute
  [2X> SemigroupithObjects( [0X[3Xargs[0X[2X ) ______________________________________[0Xfunction
  [2X> MonoidWithObjects( [0X[3Xargs[0X[2X ) ________________________________________[0Xfunction
  
  The  simplest construction for a magma with objects is to take a magma m and
  form  arrows  (u,x,v)  for  every  x  in  m and every pair of objects (u,v).
  Multiplication is defined by (u,x,v)*(v,y,w) = (u,x*y,w).
  
  Any  finite, ordered set is in principle acceptable as the objects of M, but
  we will restrict ourselves to sets of negative integers here.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> tm := [[1,2,4,3],[1,2,4,3],[3,4,2,1],[3,4,2,1]];;  Display( tm );[0X
    [4X[ [  1,  2,  4,  3 ],[0X
    [4X  [  1,  2,  4,  3 ],[0X
    [4X  [  3,  4,  2,  1 ],[0X
    [4X  [  3,  4,  2,  1 ] ][0X
    [4Xgap> m := MagmaByMultiplicationTable( tm ); [0X
    [4X<magma with 4 generators>[0X
    [4Xgap> SetName( m, "m" ); [0X
    [4Xgap> m1 := MagmaElement(m,1);; [0X
    [4Xgap> m2 := MagmaElement(m,2);; [0X
    [4Xgap> m3 := MagmaElement(m,3);; [0X
    [4Xgap> m4 := MagmaElement(m,4);; [0X
    [4Xgap> One(m); [0X
    [4Xfail[0X
    [4Xgap> M78 := MagmaWithObjects( [-8,-7], m ); [0X
    [4XMagma with objects :-[0X
    [4X  objects = [ -8, -7 ][0X
    [4X    magma = m[0X
    [4Xgap> [ IsAssociative(M78), IsCommutative(M78) ]; [0X
    [4X[ false, false ][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X2.1-2 MultiplicativeElementWithObjects[0m
  
  [2X> MultiplicativeElementWithObjects( [0X[3Xmwo, elt, tail, head[0X[2X ) ________[0Xoperation
  
  Elements    in    a    magma    with    objects    lie   in   the   category
  [10XIsMultiplicativeElementWithObjects[0m.  An attempt to multiply two arrows which
  do not compose resuts in [10Xfail[0m being returned.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> a78 := MultiplicativeElementWithObjects( M78, m4, -7, -8 ); [0X
    [4X[m2 : -7 -> -8][0X
    [4Xgap> b87 := MultiplicativeElementWithObjects( M78, m3, -8, -7 ); [0X
    [4X[m3 : -8 -> -7][0X
    [4Xgap> ba := b87*a78; [0X
    [4X[m4 : -8 -> -8][0X
    [4Xgap> ab := a78*b87;[0X
    [4X[m4 : -7 -> -7][0X
    [4Xgap> a78^2; [0X
    [4Xfail[0X
    [4Xgap> ba^2;[0X
    [4X[m1 : -8 -> -8][0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
  [1X2.1-3 IsSinglePiece[0m
  
  [2X> IsSinglePiece( [0X[3Xmwo[0X[2X ) _____________________________________________[0Xproperty
  [2X> IsDirectProductWithCompleteGraph( [0X[3Xmwo[0X[2X ) __________________________[0Xproperty
  
  If  the  partial  composition  is forgotten, then a digraph is left (usually
  with  multiple  edges and loops). Thus the notion of [13Xconnected component[0m may
  be  inherited  by magmas with objects from digraphs. Unfortunately the terms
  [10XComponent[0m  and  [10XConstituent[0m  are already in considerably use in [5XGAP[0m, so (for
  now?)  we  use  the  term  [10XIsSinglePiece[0m  to describe a connected magma with
  objects.
  
  [4X---------------------------  Example  ----------------------------[0X
    [4X[0X
    [4Xgap> IsSinglePiece( M78 ); [0X
    [4Xtrue[0X
    [4Xgap> IsDirectProductWithCompleteGraph( M78 );[0X
    [4Xtrue[0X
    [4X[0X
  [4X------------------------------------------------------------------[0X
  
