2017-10-16 19:43:09 +00:00
|
|
|
#############################################################################
|
|
|
|
##
|
|
|
|
#W quasigroups.gd Representing, creating and displaying quasigroups [loops]
|
|
|
|
##
|
|
|
|
#H @(#)$Id: quasigroups.gd, v 3.2.0 2016/05/02 gap Exp $
|
|
|
|
##
|
|
|
|
#Y Copyright (C) 2004, G. P. Nagy (University of Szeged, Hungary),
|
|
|
|
#Y P. Vojtechovsky (University of Denver, USA)
|
|
|
|
##
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## GAP CATEGORIES AND REPRESENTATIONS
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
2017-10-17 19:42:47 +00:00
|
|
|
## Categories convenient for defining quasigroups
|
|
|
|
|
|
|
|
## element which is an admissible argument for the right argument of /
|
|
|
|
DeclareCategory( "IsRightQuotientElement", IsExtLElement);
|
|
|
|
DeclareCategoryCollections("IsRightQuotientElement");
|
|
|
|
DeclareCategoryCollections("IsRightQuotientElementCollection");
|
|
|
|
|
|
|
|
## Every element with an inverse can form right quotients
|
|
|
|
## (in fact, in some sense it might be enough to have just a left inverse,
|
|
|
|
## but there doesn't seem to be any benefit to delving to that level of
|
|
|
|
## detail at this point.)
|
|
|
|
InstallTrueMethod(IsRightQuotientElement, IsMultiplicativeElementWithInverse);
|
|
|
|
|
|
|
|
## Now what we would like to do is re-declare
|
|
|
|
## DeclareOperation( "/", [IsExtRElement, IsRightQuotientElement] );
|
|
|
|
## but we can't since "/" is in the kernel, so we will have to content
|
|
|
|
## ourselves with InstallOtherMethod() calls on /. (I am not actually sure what
|
|
|
|
## the practical upshot of that is, i.e. if it has any shortcomings as compared
|
|
|
|
## to if we could declare "/" more generally.)
|
|
|
|
|
|
|
|
## Element which is admissible for the left argument of LeftQuotient()
|
|
|
|
DeclareCategory( "IsLeftQuotientElement", IsExtRElement);
|
|
|
|
DeclareCategoryCollections("IsLeftQuotientElement");
|
|
|
|
DeclareCategoryCollections("IsLeftQuotientElementCollection");
|
|
|
|
|
|
|
|
## Every element with an inverse can form left quotients
|
|
|
|
InstallTrueMethod(IsLeftQuotientElement, IsMultiplicativeElementWithInverse);
|
|
|
|
|
|
|
|
## Again, ideally (in some sense) we'd like to redeclare
|
|
|
|
## DeclareOperation("LeftQuotient", [IsLeftQuotientElement,IsExtLElement]);
|
|
|
|
|
2017-10-16 19:43:09 +00:00
|
|
|
## element of a quasigroup
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareCategory( "IsQuasigroupElement",
|
2017-10-17 20:28:41 +00:00
|
|
|
IsMultiplicativeElement and
|
2017-10-17 19:42:47 +00:00
|
|
|
IsLeftQuotientElement and IsRightQuotientElement );
|
2017-10-16 19:43:09 +00:00
|
|
|
DeclareRepresentation( "IsQuasigroupElmRep",
|
|
|
|
IsPositionalObjectRep and IsMultiplicativeElement, [1] );
|
|
|
|
|
|
|
|
## element of a loop
|
|
|
|
DeclareCategory( "IsLoopElement",
|
|
|
|
IsQuasigroupElement and IsMultiplicativeElementWithInverse );
|
|
|
|
DeclareRepresentation( "IsLoopElmRep",
|
|
|
|
IsPositionalObjectRep and IsMultiplicativeElementWithInverse, [1] );
|
|
|
|
|
2017-10-17 19:42:47 +00:00
|
|
|
## Right quasigroup
|
|
|
|
DeclareCategory("IsRightQuasigroup",
|
|
|
|
IsMagma and IsRightQuotientElementCollection);
|
|
|
|
|
|
|
|
## Left quasigroup
|
|
|
|
DeclareCategory("IsLeftQuasigroup",
|
|
|
|
IsMagma and IsLeftQuotientElementCollection);
|
|
|
|
|
|
|
|
|
2017-10-16 19:43:09 +00:00
|
|
|
## latin (auxiliary category for GAP to tell apart IsMagma and IsQuasigroup)
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareSynonym( "IsLatin",
|
|
|
|
IsRightQuotientElementCollection and
|
|
|
|
IsLeftQuotientElementCollection );
|
2017-10-16 19:43:09 +00:00
|
|
|
|
|
|
|
## quasigroup
|
|
|
|
DeclareCategory( "IsQuasigroup", IsMagma and IsLatin );
|
|
|
|
|
|
|
|
## loop
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareCategory( "IsLoop", IsQuasigroup and IsMagmaWithOne and
|
|
|
|
IsMultiplicativeElementWithInverseCollection);
|
2017-10-16 19:43:09 +00:00
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## TESTING MULTIPLICATION TABLES
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
2017-10-17 19:56:00 +00:00
|
|
|
DeclareProperty( "IsLeftQuasigroupTable", IsMatrix );
|
|
|
|
DeclareProperty( "IsRightQuasigroupTable", IsMatrix );
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareSynonym( "IsQuasigroupTable",
|
|
|
|
IsLeftQuasigroupTable and IsRightQuasigroupTable );
|
2017-10-16 19:43:09 +00:00
|
|
|
DeclareSynonym( "IsQuasigroupCayleyTable", IsQuasigroupTable );
|
2017-10-17 19:56:00 +00:00
|
|
|
DeclareProperty( "IsLoopTable", IsMatrix );
|
2017-10-16 19:43:09 +00:00
|
|
|
DeclareSynonym( "IsLoopCayleyTable", IsLoopTable );
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareGlobalFunction("CanonicalCayleyTableOfLeftQuasigroupTable");
|
2017-10-16 19:43:09 +00:00
|
|
|
DeclareOperation( "CanonicalCayleyTable", [ IsMatrix ] );
|
|
|
|
DeclareOperation( "NormalizedQuasigroupTable", [ IsMatrix ] );
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## CREATING QUASIGROUPS AND LOOPS MANUALLY
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
2017-10-18 19:36:03 +00:00
|
|
|
DeclareAttribute( "CayleyTable", IsMagma );
|
2017-10-16 19:43:09 +00:00
|
|
|
DeclareOperation( "QuasigroupByCayleyTable", [ IsMatrix ] );
|
|
|
|
DeclareOperation( "LoopByCayleyTable", [ IsMatrix ] );
|
|
|
|
DeclareOperation( "SetQuasigroupElmName", [ IsQuasigroup, IsString ] );
|
|
|
|
DeclareSynonym( "SetLoopElmName", SetQuasigroupElmName );
|
2017-10-18 19:36:03 +00:00
|
|
|
DeclareAttribute( "ConstructorFromTable", IsMagma );
|
2017-10-17 19:42:47 +00:00
|
|
|
DeclareOperation( "CanonicalCopy", [ IsMagma ] );
|
2017-10-16 19:43:09 +00:00
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## CREATING QUASIGROUPS AND LOOPS FROM A FILE
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DeclareOperation( "QuasigroupFromFile", [ IsString, IsString ] );
|
|
|
|
DeclareOperation( "LoopFromFile", [ IsString, IsString ] );
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## CREATING QUASIGROUPS AND LOOPS BY SECTIONS
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DeclareOperation( "CayleyTableByPerms", [ IsPermCollection ] );
|
|
|
|
DeclareOperation( "QuasigroupByLeftSection", [ IsPermCollection ] );
|
|
|
|
DeclareOperation( "LoopByLeftSection", [ IsPermCollection ] );
|
|
|
|
DeclareOperation( "QuasigroupByRightSection", [ IsPermCollection ] );
|
|
|
|
DeclareOperation( "LoopByRightSection", [ IsPermCollection ] );
|
|
|
|
DeclareOperation( "QuasigroupByRightFolder", [ IsGroup, IsGroup, IsMultiplicativeElementCollection ] );
|
|
|
|
DeclareOperation( "LoopByRightFolder", [ IsGroup, IsGroup, IsMultiplicativeElementCollection ] );
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## CONVERSIONS
|
|
|
|
## -------------------------------------------------------------------------
|
|
|
|
|
|
|
|
DeclareOperation( "IntoQuasigroup", [ IsMagma ] );
|
|
|
|
DeclareOperation( "PrincipalLoopIsotope",
|
|
|
|
[ IsQuasigroup, IsQuasigroupElement, IsQuasigroupElement ] );
|
|
|
|
DeclareOperation( "IntoLoop", [ IsMagma ] );
|
|
|
|
DeclareOperation( "IntoGroup", [ IsMagma ] );
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## PRODUCTS OF QUASIGROUPS AND LOOPS
|
|
|
|
## --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#DirectProduct already declared for groups.
|
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## OPPOSITE QUASIGROUPS AND LOOPS
|
|
|
|
## --------------------------------------------------------------------------
|
|
|
|
|
2017-10-18 19:36:03 +00:00
|
|
|
DeclareGlobalFunction( "OppositeQuasigroup");
|
|
|
|
DeclareGlobalFunction( "OppositeLoop");
|
|
|
|
DeclareAttribute( "Opposite", IsMagma );
|
2017-10-16 19:43:09 +00:00
|
|
|
|
|
|
|
#############################################################################
|
|
|
|
## AUXILIARY
|
|
|
|
## --------------------------------------------------------------------------
|
|
|
|
DeclareGlobalFunction( "LOOPS_ReadCayleyTableFromFile" );
|
|
|
|
DeclareGlobalFunction( "LOOPS_CayleyTableByRightFolder" );
|