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) -> Ob(M), and a *partial multiplication* * : 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 *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 -> 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 -> v) in a monoid with objects has *inverse* (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 *group with objects*, usually called a *groupoid*.

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

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

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

`‣ RootObject` ( mwo ) | ( operation ) |

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 -> v), so that the multiplication rule becomes (a : u -> v)*(b : v -> w) = (a*b : u -> 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 `IsDirectProductWithCompleteGraph`

. There are other constructions implemented for groupoids.

The output from function `MagmaWithObjects`

lies in the categories `IsDomainWithObjects`

, `IsMagmaWithObjects`

, `CategoryCollections(IsMultiplicativeElementWithObjects)`

and `IsMagma`

. 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), IsDomainWithObjects(M78) ]; [ false, false, true ] gap> [ RootObject( M78 ), ObjectList( M78 ) ]; [ -8, [ -8, -7 ] ]

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

`‣ ElementOfArrow` ( arr ) | ( attribute ) |

`‣ TailOfArrow` ( arr ) | ( attribute ) |

`‣ HeadOfArrow` ( arr ) | ( attribute ) |

`‣ IsArrowIn` ( arr, mwo ) | ( 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 -> v) has three components. The magma *element* a ∈ 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 `IsArrowIn`

is added due to difficulties found when attempting to write a method for `\in`

.

gap> a78 := Arrow( M78, m2, -7, -8 ); [m2 : -7 -> -8] gap> [ a78 in M78, IsArrowIn( a78, M78 ) ]; [ false, 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 ]

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

`‣ IsDirectProductWithCompleteGraph` ( mwo ) | ( property ) |

`‣ IsDiscrete` ( 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 `IsSinglePiece`

to describe a connected magma with objects. 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> IsDirectProductWithCompleteGraph( M78 ); true gap> IsDiscrete( M78 ); false

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

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

When the magma is a semigroup the construction gives a `SinglePieceSemigroupWithObjects`

. In the example we use a transformation semigroup and 3 objects.

gap> t := Transformation( [1,1,2,3] );; s := Transformation( [2,2,3,3] );; gap> r := Transformation( [2,3,4,4] );; 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]

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

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

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

When the semigroup is a monoid the construction gives a `SinglePieceMonoidWithObjects`

. The example uses a finitely presented monoid with 2 generators and 2 objects.

When the construction is the direct product of a monoid and the complete graph on the objects, the generating set consists of two parts. Firstly, there is a loop at the root object for each generator of the monoid. Secondly, for each pair of objects u,v, there are arrows (1 : u -> v) and (1 : v -> u).

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 ); [ "CanEasilyCompareElements", "CanEasilySortElements", "IsDuplicateFree", "IsAssociative", "IsSinglePieceDomain", "IsDirectProductWithCompleteGraphDomain" ] gap> genM := GeneratorsOfMagmaWithObjects( M49 ); [ [<identity ...> : -9 -> -9], [f1 : -9 -> -9], [f2 : -9 -> -9], [<identity ...> : -9 -> -4], [<identity ...> : -4 -> -9] ] gap> g2:=genM[2];; g3:=genM[3];; g4:=genM[4];; g5:=genM[5];; gap> [g5,g3,g2,g4]; [ [<identity ...> : -4 -> -9], [f2 : -9 -> -9], [f1 : -9 -> -9], [<identity ...> : -9 -> -4] ] gap> g5*g3*g2*g4; [f2*f1 : -4 -> -4]

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

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 the group. In the example we take the dihedral group of size 8 at the object 0.

gap> d8 := Group( (1,2,3,4), (1,3) );; gap> SetName( d8, "d8" ); gap> D0 := DomainWithSingleObject( d8, 0 ); single piece groupoid: < d8, [ 0 ] > gap> GeneratorsOfMagmaWithInverses( D0 ); [ [(1,2,3,4) : 0 -> 0], [(1,3) : 0 -> 0] ] gap> Size( D0 ); 8

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

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

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.

Structures `S123, M49, D0`

generated above have, respectively, `GeneratorsOfMagma`

, `GeneratorsOfMagmaWithOne`

and `GeneratorsOfMagmaWithInverses`

. The generators of a structure with several pieces is the union of the generators of the individual pieces.

gap> N1 := UnionOfPieces( [ M78, S123 ] );; ObjectList( N1 ); [ -8, -7, -3, -2, -1 ] gap> N2 := UnionOfPieces( [ M49, D0 ] );; Pieces( N2 ); [ monoid with objects :- magma = Monoid( [ f1, f2 ] ) objects = [ -9, -4 ] , single piece groupoid: < d8, [ 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: single piece groupoid: < d8, [ 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( d8, -2 ) ] ); fail

generated by GAPDoc2HTML