3 How the Package Works The package consists of three complementary components:  the core algorithms for quasigroup theoretical notions (see Chapters 4, 5, 6 and 7),  algorithms for specific varieties of loops, mostly for Moufang loops (see Chapter 8),  the library of small loops (see Chapter 9). Although we do not explain the algorithms in detail here, we describe the general philosophy so that users can anticipate the capabilities and behavior of LOOPS. 3.1 Representing Quasigroups Since permutation representation in the usual sense is impossible for nonassociative structures, and since the theory of nonassociative presentations is not well understood, we resorted to multiplication tables to represent quasigroups in GAP. (In order to save storage space, we sometimes use one multiplication table to represent several quasigroups, for instance when a quasigroup is a subquasigroup of another quasigroup. See Section 4.1 for more details.) Consequently, the package is intended primarily for quasigroups and loops of small order, say up to 1000. The GAP categories IsQuasigroupElement, IsLoopElement, IsQuasigroup and IsLoop are declared in LOOPS as follows: DeclareCategory( "IsQuasigroupElement", IsMultiplicativeElement ); DeclareRepresentation( "IsQuasigroupElmRep", IsPositionalObjectRep and IsMultiplicativeElement, [1] ); DeclareCategory( "IsLoopElement", IsQuasigroupElement and IsMultiplicativeElementWithInverse ); DeclareRepresentation( "IsLoopElmRep", IsPositionalObjectRep and IsMultiplicativeElementWithInverse, [1] ); ## latin (auxiliary category for GAP to tell apart IsMagma and IsQuasigroup) DeclareCategory( "IsLatinMagma", IsObject ); DeclareCategory( "IsQuasigroup", IsMagma and IsLatinMagma ); DeclareCategory( "IsLoop", IsQuasigroup and IsMultiplicativeElementWithInverseCollection); 3.2 Conversions between magmas, quasigroups, loops and groups Whether an object is considered a magma, quasigroup, loop or group is a matter of declaration in LOOPS. Loops are automatically quasigroups, and both groups and quasigroups are automatically magmas. All standard GAP commands for magmas are therefore available for quasigroups and loops. In GAP, functions of the type AsSomething(X) convert the domain X into Something, if possible, without changing the underlying domain X. For example, if X is declared as magma but is associative and has neutral element and inverses, AsGroup(X) returns the corresponding group with the underlying domain X. We have opted for a more general kind of conversions in LOOPS (starting with version 2.1.0), using functions of the type IntoSomething(X). The two main features that distinguish IntoSomething from AsSomething are:  The function IntoSomething(X) does not necessarily return the same domain as X. The reason is that X can be a group, for instance, defined on one of many possible domains, while IntoLoop(X) must result in a loop, and hence be defined on a subset of some interval 1, dots, n (see Section 6.1).  In some special situations, the function IntoSomething(X) allows to convert X into Something even though X does not have all the properties of Something. For instance, every quasigroup is isotopic to a loop, so it makes sense to allow the conversion IntoLoop(Q) even if the quasigroup Q does not posses a neutral element. Details of all conversions in LOOPS can be found in Section 4.10. 3.3 Calculating with Quasigroups Although the quasigroups are ultimately represented by multiplication tables, the algorithms are efficient because nearly all calculations are delegated to groups. The connection between quasigroups and groups is facilitated via translations (see Section 2.2), and we illustrate it with a few examples: Example: This example shows how properties of quasigroups can be translated into properties of translations in a straightforward way. Let Q be a quasigroup. We ask if Q is associative. We can either test if (xy)z=x(yz) for every x, y, z in Q, or we can ask if L_xy=L_xL_y for every x, y in Q. Note that since L_xy, L_x and L_y are elements of a permutation group, we do not have to refer directly to the multiplication table once the left translations of Q are known. Example: This example shows how properties of loops can be translated into properties of translations in a way that requires some theory. A left Bol loop is a loop satisfying x(y(xz)) = (x(yx))z. We claim (without proof) that a loop Q is left Bol if and only if L_xL_yL_x is a left translation for every x, y in Q. Example: This example shows that many properties of loops become purely group-theoretical once they are expressed in terms of translations. A loop is simple if it has no nontrivial congruences. It is possible to show that a loop is simple if and only if its multiplication group is a primitive permutation group. The main idea of the package is therefore to:  calculate the translations and the associated permutation groups when they are needed,  store them as attributes,  use them in algorithms as often as possible. 3.4 Naming, Viewing and Printing Quasigroups and their Elements GAP displays information about objects in two modes: the View mode (default, short), and the Print mode (longer). Moreover, when the name of an object is set, the name is always shown, no matter which display mode is used. Only loops contained in the libraries of LOOPS are named. For instance, the loop obtained via MoufangLoop(32,4), the 4th Moufang loop of order 32, is named "Moufang loop 32/4'' and is shown as . A generic quasigroup of order n is displayed as . Similarly, a loop of order n appears as . The displayed information of a generic loop is enhanced if more information about the loop becomes available. For instance, when it is established that a loop of order 12 has the left alternative property, the loop will be shown as  until a stronger property is obtained. Which property is diplayed is governed by the filters built into LOOPS (see Appendix B). 3.4-1 SetQuasigroupElmName and SetLoopElmName SetQuasigroupElmName( Q, name )  function SetLoopElmName( Q, name )  function The above functions change the names of elements of a quasigroup (resp. loop) Q to name. By default, elements of a quasigroup appear as qi and elements of a loop appear as li in both display modes, where i is a positive integer. The neutral element of a loop is always indexed by 1. For quasigroups and loops in the Print mode, we display the multiplication table (if it is known), otherwise we display the elements. In the following example, L is a loop with two elements.  Example  gap> L;    gap> Print( L );    gap> Elements( L );  [ l1, l2 ]  gap> SetLoopElmName( L, "loop_element" );; Elements( L );  [ loop_element1, loop_element2 ]