The aim of this package is to provide operations for finite groupoids. A *groupoid* is constructed from a group and a set of objects. In order to provide a sequence of categories, with increasing structure, mimicing those for groups, we introduce in this chapter the notions of *magma with objects*; *semigroup with objects* and *monoid with objects*. The next chapter introduces morphisms of these structures. At a first reading of this manual, the user is advised to skip quickly through these first two chapters, and then move on to groupoids in Chapter 3.

For the definitions of the standard properties of groupoids we refer to P. Higgins' book ``Categories and Groupoids'' [Hig05] (originally published in 1971, reprinted by TAC in 2005), and to R. Brown's book ``Topology'' [Bro88], recently revised and reissued as ``Topology and Groupoids'' [Bro06].

A *magma with objects* \(M\) consists of a set of *objects* Ob\((M)\), and a set of *arrows* Arr\((M)\) together with *tail* and *head* maps \(t,h :\) Arr\((M) \to\) Ob\((M)\), and a *partial multiplication* \(* :\) Arr\((M) \to \) 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 \to v)\).

When this multiplication is associative we obtain a *semigroup with objects*.

A *loop* is an arrow whose tail and head are the same object. An *identity arrow* at object \(u\) is a loop \((1_u : u \to 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 *monoid with objects*, which is just the usual notion of mathematical category.

An arrow \((a : u \to v)\) in a monoid with objects has *inverse* \((a^{-1} : v \to 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 *group with objects*, usually called a *groupoid*.

`‣ MagmaWithObjects` ( args ) | ( function ) |

`‣ SinglePieceMagmaWithObjects` ( magma, obs ) | ( operation ) |

`‣ ObjectList` ( mwo ) | ( attribute ) |

`‣ RootObject` ( mwo ) | ( attribute ) |

The simplest construction for a magma with objects \(M\) is to take a magma \(m\) and an ordered set \(s\), and form arrows \((u,a,v)\) for every \(a\) in \(m\) and \(u,v\) in \(s\). Multiplication is defined by \((u,a,v)*(v,b,w) = (u,a*b,w)\). In this package we prefer to write \((u,a,v)\) as \((a : u \to v)\), so that the multiplication rule becomes \((a : u \to v)*(b : v \to w) = (a*b : u \to w)\).

Any finite, ordered set is in principle acceptable as the object list of \(M\), but most of the time we find it convenient to restrict ourselves to sets of non-positive integers.

This is the only construction implemented here for magmas, semigroups, and monoids with objects, and these all have the property `IsDirectProductWithCompleteDigraph`

. There are other constructions implemented for groupoids.

The *root object* of \(M\) is the first element in \(s\).

gap> tm := [[1,2,4,3],[1,2,4,3],[3,4,2,1],[3,4,2,1]];; gap> Display( tm ); [ [ 1, 2, 4, 3 ], [ 1, 2, 4, 3 ], [ 3, 4, 2, 1 ], [ 3, 4, 2, 1 ] ] gap> m := MagmaByMultiplicationTable( tm );; SetName( m, "m" ); gap> m1 := MagmaElement(m,1);; m2 := MagmaElement(m,2);; gap> m3 := MagmaElement(m,3);; m4 := MagmaElement(m,4);; gap> M78 := MagmaWithObjects( m, [-8,-7] ); magma with objects :- magma = m objects = [ -8, -7 ] gap> SetName( M78, "M78" ); gap> [ IsAssociative(M78), IsCommutative(M78) ]; [ false, false ] gap> [ RootObject( M78 ), ObjectList( M78 ) ]; [ -8, [ -8, -7 ] ]

`‣ IsDomainWithObjects` ( obj ) | ( filter ) |

`‣ IsMagmaWithObjects` ( obj ) | ( filter ) |

The output from function `MagmaWithObjects`

lies in the categories `IsDomainWithObjects`

, `IsMagmaWithObjects`

and `CategoryCollections(IsMultiplicativeElementWithObjects)`

. As composition is only partial, the output does *not* lie in the category `IsMagma`

.

gap> [ IsDomainWithObjects(M78), IsMagmaWithObjects(M78), IsMagma(M78) ]; [ true, true, false ]

`‣ Arrow` ( mwo, elt, tail, head ) | ( operation ) |

`‣ ElementOfArrow` ( arr ) | ( operation ) |

`‣ TailOfArrow` ( arr ) | ( operation ) |

`‣ HeadOfArrow` ( arr ) | ( operation ) |

Arrows in a magma with objects lie in the category `IsMultiplicativeElementWithObjects`

. An attempt to multiply two arrows which do not compose resuts in `fail`

being returned. Each arrow \(arr = (a : u \to v)\) has three components. The magma *element* \(a \in m\) may be accessed by `ElementOfArrow(arr)`

. Similarly, the *tail* object \(u\) and the *head* object \(v\) may be obtained using `TailOfArrow(arr)`

and `HeadOfArrow(arr)`

respectively. The operation `MultiplicativeElementWithObjects`

is a synonym for `Arrow`

since this was used in older versions of the package.

gap> a78 := Arrow( M78, m2, -7, -8 ); [m2 : -7 -> -8] gap> a78 in M78; true gap> b87 := Arrow( M78, m4, -8, -7 );; gap> [ ElementOfArrow( b87 ), TailOfArrow( b87 ), HeadOfArrow( b87 ) ]; [ m4, -8, -7 ] gap> ba := b87*a78;; ab := a78*b87;; [ ba, ab ]; [ [m4 : -8 -> -8], [m3 : -7 -> -7] ] gap> [ a78^2, ba^2, ba^3 ]; [ fail, [m1 : -8 -> -8], [m3 : -8 -> -8] ] gap> ## this demonstrates non-associativity: gap> [ a78*ba, ab*a78, a78*ba=ab*a78 ]; [ [m3 : -7 -> -8], [m4 : -7 -> -8], false ]

`‣ IsSinglePieceDomain` ( mwo ) | ( property ) |

`‣ IsSinglePiece` ( mwo ) | ( property ) |

`‣ IsDirectProductWithCompleteDigraph` ( mwo ) | ( property ) |

`‣ IsDiscreteMagmaWithObjects` ( mwo ) | ( property ) |

If the partial composition is forgotten, then what remains is a digraph (usually with multiple edges and loops). Thus the notion of *connected component* may be inherited by magmas with objects from digraphs. Unfortunately the terms `Component`

and `Constituent`

are already in considerable use elsewhere in **GAP**, so (and this may change if a more suitable word is suggested) we use the term `IsSinglePieceDomain`

to describe an object with an underlying connected digraph. The property `IsSinglePiece`

is a synonym for `IsSinglePieceDomain and IsMagmaWithObjects`

. When each connected component has a single object, and there is more than one component, the magma with objects is *discrete*.

gap> IsSinglePiece( M78 ); true gap> IsDirectProductWithCompleteDigraph( M78 ); true gap> IsDiscreteMagmaWithObjects( M78 ); false

`‣ SemigroupWithObjects` ( args ) | ( function ) |

`‣ SinglePieceSemigroupWithObjects` ( sgp, obs ) | ( operation ) |

`‣ DomainWithSingleObject` ( dom, obj ) | ( operation ) |

The constructions in section 2.1 give a `SinglePieceSemigroupWithObjects`

when the magma is a semigroup. In the example we use a transformation semigroup and \(3\) objects.

gap> t := Transformation( [1,1,2,3] );; gap> s := Transformation( [2,2,3,3] );; gap> r := Transformation( [2,3,4,4] );; gap> sgp := Semigroup( t, s, r );; gap> SetName( sgp, "sgp<t,s,r>" ); gap> S123 := SemigroupWithObjects( sgp, [-3,-2,-1] ); semigroup with objects :- magma = sgp<t,s,r> objects = [ -3, -2, -1 ] gap> [ IsAssociative(S123), IsCommutative(S123) ]; [ true, false ] gap> t12 := Arrow( S123, t, -1, -2 ); [Transformation( [ 1, 1, 2, 3 ] ) : -1 -> -2] gap> s23 := Arrow( S123, s, -2, -3 ); [Transformation( [ 2, 2, 3, 3 ] ) : -2 -> -3] gap> r31 := Arrow( S123, r, -3, -1 ); [Transformation( [ 2, 3, 4, 4 ] ) : -3 -> -1] gap> ts13 := t12 * s23; [Transformation( [ 2, 2, 2, 3 ] ) : -1 -> -3] gap> sr21 := s23 * r31; [Transformation( [ 3, 3, 4, 4 ] ) : -2 -> -1] gap> rt32 := r31 * t12; [Transformation( [ 1, 2, 3, 3 ] ) : -3 -> -2] gap> tsr1 := ts13 * r31; [Transformation( [ 3, 3, 3 ] ) : -1 -> -1]

A magma, semigroup, monoid, or group can be made into a magma with objects by the addition of a single object. The two are algebraically isomorphic, and there is one arrow (a loop) for each element in \(dom\). In the example we take the semigroup `sgp`

of size \(17\) at the object \(0\).

gap> S0 := DomainWithSingleObject( sgp, 0 ); semigroup with objects :- magma = sgp<t,s,r> objects = [ 0 ] gap> t0 := Arrow( S0, t, 0, 0 ); [Transformation( [ 1, 1, 2, 3 ] ) : 0 -> 0] gap> Size( S0 ); 17

`‣ MonoidWithObjects` ( args ) | ( function ) |

`‣ SinglePieceMonoidWithObjects` ( mon, obs ) | ( operation ) |

The constructions in section 2.1 give a `SinglePieceMonoidWithObjects`

when the magma is a monoid. The example uses a finitely presented monoid with \(2\) generators and \(2\) objects.

gap> fm := FreeMonoid( 2, "f" );; gap> em := One( fm );; gap> gm := GeneratorsOfMonoid( fm );; gap> mon := fm/[ [gm[1]^3,em], [gm[1]*gm[2],gm[2]] ];; gap> M49 := MonoidWithObjects( mon, [-9,-4] ); monoid with objects :- magma = Monoid( [ f1, f2 ] ) objects = [ -9, -4 ] gap> ktpo := KnownTruePropertiesOfObject( M49 ); [ "IsDuplicateFree", "IsAssociative", "IsSinglePieceDomain", "IsDirectProductWithCompleteDigraphDomain" ] gap> catobj := CategoriesOfObject( M49 );; [ "IsListOrCollection", "IsCollection", "IsExtLElement", "CategoryCollections(IsExtLElement)", "IsExtRElement", "CategoryCollections(IsExtRElement)", "CategoryCollections(IsMultiplicativeElement)", "IsGeneralizedDomain", "IsDomainWithObjects", "CategoryCollections(IsMultiplicativeElementWithObjects)", "CategoryCollections(IsMultiplicativeElementWithObjectsAndOnes)", "CategoryCollections(IsMultiplicativeElementWithObjectsAndInverses)", "IsMagmaWithObjects", "IsSemigroupWithObjects", "IsMonoidWithObjects" ]

`‣ GeneratorsOfMagmaWithObjects` ( mwo ) | ( operation ) |

`‣ GeneratorsOfSemigroupWithObjects` ( swo ) | ( operation ) |

`‣ GeneratorsOfMonoidWithObjects` ( mwo ) | ( operation ) |

For a magma or semigroup with objects, the generating set consists of arrows \((g : u \to v)\) for every pair of objects \(u,v\) and every generating element for the magma or semigroup.

For a monoid with objects, the generating set consists of two parts. Firstly, there is a loop at the root object \(r\) for each generator of the monoid. Secondly, for each object \(u\) distinct from \(r\), there are arrows \((1 : r \to u)\) and \((1 : u \to r)\). (Perhaps only one of each pair is required?) Then

\[ (e : u \to v ) = (1 : u \to r)*(e : r \to r)*(1 : r \to v). \]

gap> GeneratorsOfMagmaWithObjects( M78 ); [ [m1 : -8 -> -8], [m2 : -8 -> -8], [m3 : -8 -> -8], [m4 : -8 -> -8], [m1 : -8 -> -7], [m2 : -8 -> -7], [m3 : -8 -> -7], [m4 : -8 -> -7], [m1 : -7 -> -8], [m2 : -7 -> -8], [m3 : -7 -> -8], [m4 : -7 -> -8], [m1 : -7 -> -7], [m2 : -7 -> -7], [m3 : -7 -> -7], [m4 : -7 -> -7] ] gap> genS := GeneratorsOfSemigroupWithObjects( S123 );; gap> Length( genS ); 27 gap> genM := GeneratorsOfMonoidWithObjects( M49 ); [ [f1 : -9 -> -9], [f2 : -9 -> -9], [<identity ...> : -9 -> -4], [<identity ...> : -4 -> -9] ] gap> g1:=genM[2];; g2:=genM[3];; g3:=genM[4];; g4:=genM[5];; gap> [g4,g2,g1,g3]; [ [<identity ...> : -4 -> -9], [f2 : -9 -> -9], [f1 : -9 -> -9], [<identity ...> : -9 -> -4] ] gap> g4*g2*g1*g3; [f2*f1 : -4 -> -4]

`‣ UnionOfPieces` ( pieces ) | ( operation ) |

`‣ Pieces` ( mwo ) | ( attribute ) |

`‣ PieceOfObject` ( mwo, obj ) | ( operation ) |

A magma with objects whose underlying digraph has two or more connected components can be constructed by taking the union of two or more connected structures. These, in turn, can be combined together. The only requirement is that all the object lists should be disjoint. The pieces are ordered by the order of their root objects.

gap> N1 := UnionOfPieces( [ M78, S123 ] ); magma with objects having 2 pieces :- 1: M78 2: semigroup with objects :- magma = sgp<t,s,r> objects = [ -3, -2, -1 ] gap> ObjectList( N1 ); [ -8, -7, -3, -2, -1 ] gap> Pieces(N1); [ M78, semigroup with objects :- magma = sgp<t,s,r> objects = [ -3, -2, -1 ] ] gap> PieceOfObject( N1, -7 ); M78 gap> N2 := UnionOfPieces( [ M49, S0 ] ); semigroup with objects having 2 pieces :- 1: monoid with objects :- magma = Monoid( [ f1, f2 ] ) objects = [ -9, -4 ] 2: semigroup with objects :- magma = sgp<t,s,r> objects = [ 0 ] gap> ObjectList( N2 ); [ -9, -4, 0 ] gap> N3 := UnionOfPieces( [ N1, N2] ); magma with objects having 4 pieces :- 1: monoid with objects :- magma = Monoid( [ f1, f2 ] ) objects = [ -9, -4 ] 2: M78 3: semigroup with objects :- magma = sgp<t,s,r> objects = [ -3, -2, -1 ] 4: semigroup with objects :- magma = sgp<t,s,r> objects = [ 0 ] gap> ObjectList( N3 ); [ -9, -8, -7, -4, -3, -2, -1, 0 ] gap> Length( GeneratorsOfMagmaWithObjects( N3 ) ); 50 gap> ## the next command returns fail since the object sets are not disjoint: gap> N4 := UnionOfPieces( [ S123, DomainWithSingleObject( sgp, -2 ) ] ); fail

generated by GAPDoc2HTML