Check that putative generators of a structure at least satisfy the structure axioms

This commit is contained in:
Glen Whitney 2017-10-20 15:25:22 +02:00
parent 3c4eb2582a
commit 7d1ff6c683
3 changed files with 144 additions and 106 deletions

View File

@ -36,7 +36,7 @@ InstallGlobalFunction(LeftQuasigroupByMultiplicationTable,
end); end);
InstallGlobalFunction(LeftQuasigroupByMultiplicationTableNC, InstallGlobalFunction(LeftQuasigroupByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, LeftQuasigroup, T -> MagmaByMultiplicationTableCreatorNC(T, LeftQuasigroupNC,
IsLeftQuotientElement and IsMagmaByMultiplicationTableObj) IsLeftQuotientElement and IsMagmaByMultiplicationTableObj)
); );
@ -50,7 +50,7 @@ InstallGlobalFunction(RightQuasigroupByMultiplicationTable,
end); end);
InstallGlobalFunction(RightQuasigroupByMultiplicationTableNC, InstallGlobalFunction(RightQuasigroupByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, RightQuasigroup, T -> MagmaByMultiplicationTableCreatorNC(T, RightQuasigroupNC,
IsRightQuotientElement and IsMagmaByMultiplicationTableObj) IsRightQuotientElement and IsMagmaByMultiplicationTableObj)
); );
@ -68,7 +68,7 @@ InstallGlobalFunction(LeftRackByMultiplicationTable,
end); end);
InstallGlobalFunction(LeftRackByMultiplicationTableNC, InstallGlobalFunction(LeftRackByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, LeftRack, T -> MagmaByMultiplicationTableCreatorNC(T, LeftRackNC,
IsLeftQuotientElement and IsLSelfDistElement and IsLeftQuotientElement and IsLSelfDistElement and
IsMagmaByMultiplicationTableObj IsMagmaByMultiplicationTableObj
) )
@ -89,7 +89,7 @@ InstallGlobalFunction(LeftQuandleByMultiplicationTable,
end); end);
InstallGlobalFunction(LeftQuandleByMultiplicationTableNC, InstallGlobalFunction(LeftQuandleByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, LeftQuandle, T -> MagmaByMultiplicationTableCreatorNC(T, LeftQuandleNC,
IsLeftQuotientElement and IsLSelfDistElement and IsIdempotent and IsLeftQuotientElement and IsLSelfDistElement and IsIdempotent and
IsMagmaByMultiplicationTableObj IsMagmaByMultiplicationTableObj
) )
@ -109,7 +109,7 @@ InstallGlobalFunction(RightRackByMultiplicationTable,
end); end);
InstallGlobalFunction(RightRackByMultiplicationTableNC, InstallGlobalFunction(RightRackByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, RightRack, T -> MagmaByMultiplicationTableCreatorNC(T, RightRackNC,
IsRightQuotientElement and IsRSelfDistElement and IsRightQuotientElement and IsRSelfDistElement and
IsMagmaByMultiplicationTableObj IsMagmaByMultiplicationTableObj
) )
@ -130,7 +130,7 @@ InstallGlobalFunction(RightQuandleByMultiplicationTable,
end); end);
InstallGlobalFunction(RightQuandleByMultiplicationTableNC, InstallGlobalFunction(RightQuandleByMultiplicationTableNC,
T -> MagmaByMultiplicationTableCreatorNC(T, RightQuandle, T -> MagmaByMultiplicationTableCreatorNC(T, RightQuandleNC,
IsRightQuotientElement and IsRSelfDistElement and IsIdempotent and IsRightQuotientElement and IsRSelfDistElement and IsIdempotent and
IsMagmaByMultiplicationTableObj IsMagmaByMultiplicationTableObj
) )
@ -197,21 +197,16 @@ InstallMethod(RightPerms,
end); end);
## Distributivity/idempotence checkers for when need be ## Distributivity/idempotence checkers for when need be
InstallMethod(IsLSelfDistributive, "for magma", InstallMethod(IsLSelfDistributive, "for collections with multiplication tables",
[IsMagma and IsFinite], [HasMultiplicationTable],
M -> IsLeftSelfDistributiveTable(MultiplicationTable(M)) M -> IsLeftSelfDistributiveTable(MultiplicationTable(M))
); );
InstallMethod(IsRSelfDistributive, "for magma", InstallMethod(IsRSelfDistributive, "for collections with multiplication table",
[IsMagma and IsFinite], [HasMultiplicationTable],
M -> IsRightSelfDistributiveTable(MultiplicationTable(M)) M -> IsRightSelfDistributiveTable(MultiplicationTable(M))
); );
InstallMethod(IsElementwiseIdempotent, "for magma",
[IsMagma and IsFinite],
M -> ForAll(Elements(M), m->IsIdempotent(m))
);
## Patch View/Print/Display for magma by mult objects ## Patch View/Print/Display for magma by mult objects
InstallMethod(String, "for an element of magma by multiplication table", InstallMethod(String, "for an element of magma by multiplication table",
[IsMagmaByMultiplicationTableObj], [IsMagmaByMultiplicationTableObj],

View File

@ -21,15 +21,13 @@ DeclareCategoryCollections("IsLSelfDistElement");
DeclareCategory("IsRSelfDistElement", IsMultiplicativeElement); DeclareCategory("IsRSelfDistElement", IsMultiplicativeElement);
DeclareCategoryCollections("IsRSelfDistElement"); DeclareCategoryCollections("IsRSelfDistElement");
# Left self-distributive magmas: # Left self-distributive collections of elements:
DeclareProperty("IsLSelfDistributive", IsMagma); DeclareProperty("IsLSelfDistributive", IsMultiplicativeElementCollection);
InstallTrueMethod(IsLSelfDistributive, InstallTrueMethod(IsLSelfDistributive, IsLSelfDistElementCollection);
IsMagma and IsLSelfDistElementCollection);
# Right self-distributive magmas: # Right self-distributive collections of elements:
DeclareProperty("IsRSelfDistributive", IsMagma); DeclareProperty("IsRSelfDistributive", IsMultiplicativeElementCollection);
InstallTrueMethod(IsRSelfDistributive, InstallTrueMethod(IsRSelfDistributive, IsRSelfDistElementCollection);
IsMagma and IsRSelfDistElementCollection);
## Idempotence ## Idempotence
# There is already a property IsIdempotent on elements, but to definw # There is already a property IsIdempotent on elements, but to definw
@ -37,9 +35,9 @@ InstallTrueMethod(IsRSelfDistributive,
# collections category: # collections category:
DeclareCategoryCollections("IsIdempotent"); DeclareCategoryCollections("IsIdempotent");
# Idempotent magmas, i.e. magmas in which every element is idempotent # Collections in which every element is idempotent
DeclareProperty("IsElementwiseIdempotent", IsMagma); DeclareProperty("IsElementwiseIdempotent", IsMultiplicativeElementCollection);
InstallTrueMethod(IsElementwiseIdempotent, IsMagma and IsIdempotentCollection); InstallTrueMethod(IsElementwiseIdempotent, IsIdempotentCollection);
## Left and right racks and quandles ## Left and right racks and quandles
DeclareSynonym("IsLeftRack", IsLeftQuasigroup and IsLSelfDistributive); DeclareSynonym("IsLeftRack", IsLeftQuasigroup and IsLSelfDistributive);
@ -54,11 +52,17 @@ DeclareSynonym("IsRightQuandle", IsLeftRack and IsElementwiseIdempotent);
# the family of elements of M may be specified, and must be if <gens> # the family of elements of M may be specified, and must be if <gens>
# is empty (in which case M will be empty as well). # is empty (in which case M will be empty as well).
DeclareGlobalFunction("LeftQuasigroup"); DeclareGlobalFunction("LeftQuasigroup");
DeclareGlobalFunction("LeftQuasigroupNC");
DeclareGlobalFunction("RightQuasigroup"); DeclareGlobalFunction("RightQuasigroup");
DeclareGlobalFunction("RightQuasigroupNC");
DeclareGlobalFunction("LeftRack"); DeclareGlobalFunction("LeftRack");
DeclareGlobalFunction("LeftRackNC");
DeclareGlobalFunction("RightRack"); DeclareGlobalFunction("RightRack");
DeclareGlobalFunction("RightRackNC");
DeclareGlobalFunction("LeftQuandle"); DeclareGlobalFunction("LeftQuandle");
DeclareGlobalFunction("LeftQuandleNC");
DeclareGlobalFunction("RightQuandle"); DeclareGlobalFunction("RightQuandle");
DeclareGlobalFunction("RightQuandleNC");
# Underlying operation # Underlying operation
DeclareGlobalFunction("CloneOfTypeByGenerators"); DeclareGlobalFunction("CloneOfTypeByGenerators");

View File

@ -1,6 +1,36 @@
## structure.gi RAQ Implementation of definitiions, reps, and elt operations ## structure.gi RAQ Implementation of definitiions, reps, and elt operations
## Testing properties of collections the hard way if we have to
InstallMethod(IsElementwiseIdempotent, "for finite collections",
[IsMultiplicativeElementCollection and IsFinite],
M -> ForAll(Elements(M), m->IsIdempotent(m))
);
InstallMethod(IsLSelfDistributive,
"for arbitrary multiplicative collections, the hard way",
[IsMultiplicativeElementCollection],
function (C)
local a,b,d;
for a in C do for b in C do for d in C do
if d*(a*b) <> (d*a)*(d*b) then return false; fi;
od; od; od;
return true;
end);
InstallMethod(IsRSelfDistributive,
"for arbitrary multiplicative collections, the hard way",
[IsMultiplicativeElementCollection],
function (C)
local a,b,d;
for a in C do for b in C do for d in C do
if (a*b)*d <> (a*d)*(b*d) then return false; fi;
od; od; od;
return true;
end);
## Create structures with generators ## Create structures with generators
InstallGlobalFunction(CloneOfTypeByGenerators, InstallGlobalFunction(CloneOfTypeByGenerators,
function(cat, fam, gens, genAttrib, tableCstr) function(cat, fam, gens, genAttrib, tableCstr)
local M; local M;
@ -13,122 +43,131 @@ InstallGlobalFunction(CloneOfTypeByGenerators,
return M; return M;
end); end);
## Helpers for the constructors below:
ArgHelper@ := function(parmlist)
# returns a list of the family and the flat list of elements of parmlist
if Length(parmlist) = 0 then
Error("usage: RAQ constructors take an optional family, followed by gens");
fi;
if IsFamily(parmlist[1]) then return [Remove(parmlist,1), Flat(parmlist)]; fi;
parmlist := Flat(parmlist);
return [FamilyObj(parmlist), parmlist];
end;
CheckLQGprop@ := function(gens)
local g, h;
# Make sure all elements in gens have left quotient property pairwise
for g in gens do for h in gens do
if g*LeftQuotient(g,h) <> h or LeftQuotient(g,g*h) <> h then
Error("left quasigroup property of left quotients violated");
fi;
od; od;
return;
end;
CheckRQGprop@ := function(gens)
local g, h;
# Make sure all elements in gens have right quotient property pairwise
for g in gens do for h in gens do
if (h*g)/g <> h or (h/g)*g <> h then
Error("right quasigroup property of / violated");
fi;
od; od;
return;
end;
## Functions for each of the magma categories here ## Functions for each of the magma categories here
InstallGlobalFunction(LeftQuasigroup, function(arg) InstallGlobalFunction(LeftQuasigroup, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckLQGprop@(arg[2]);
Error("usage: LeftQuasigroup([<family>], <gens>)"); return LeftQuasigroupNC(arg[1], arg[2]);
fi; end);
# Extract the family
if IsFamily(arg[1]) then InstallGlobalFunction(LeftQuasigroupNC, function(fam, gens)
fam := arg[1]; return CloneOfTypeByGenerators(IsLeftQuasigroup, fam, gens,
Remove(arg, 1);
arg := Flat(arg);
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi;
return CloneOfTypeByGenerators(IsLeftQuasigroup, fam, arg,
GeneratorsOfLeftQuasigroup, GeneratorsOfLeftQuasigroup,
LeftQuasigroupByMultiplicationTableNC); LeftQuasigroupByMultiplicationTableNC);
end); end);
InstallGlobalFunction(LeftRack, function(arg) InstallGlobalFunction(LeftRack, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckLQGprop@(arg[2]);
Error("usage: LeftRack([<family>], <gens>)"); if not IsLSelfDistributive(arg[2]) then
Error("Left rack must have left distributive generators");
fi; fi;
# Extract the family return LeftRackNC(arg[1], arg[2]);
if IsFamily(arg[1]) then end);
fam := arg[1];
Remove(arg, 1); IntallGlobalFunction(LeftRackNC, function(fam, gens)
arg := Flat(arg); return CloneOfTypeByGenerators(IsLeftRack, fam, gens,
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi;
return CloneOfTypeByGenerators(IsLeftRack, fam, arg,
GeneratorsOfLeftQuasigroup, GeneratorsOfLeftQuasigroup,
LeftRackByMultiplicationTableNC); LeftRackByMultiplicationTableNC);
end); end);
InstallGlobalFunction(LeftQuandle, function(arg) InstallGlobalFunction(LeftQuandle, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckLQGprop@(arg[2]);
Error("usage: LeftQuandle([<family>], <gens>)"); if not IsLSelfDistributive(arg[2]) then
Error("Left quandle must have left distributive generators");
fi; fi;
# Extract the family if not IsElementwiseIdempotent(arg[2]) then
if IsFamily(arg[1]) then Error("Quandles must contain only idempotent elements");
fam := arg[1];
Remove(arg, 1);
arg := Flat(arg);
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi; fi;
return CloneOfTypeByGenerators(IsLeftQuandle, fam, arg, return LeftQuandleNC(arg[1], arg[2]);
end);
InstallGlobalFunction(LeftQuandleNC, function(fam, gens)
return CloneOfTypeByGenerators(IsLeftQuandle, fam, gens,
GeneratorsOfLeftQuasigroup, GeneratorsOfLeftQuasigroup,
LeftQuandleByMultiplicationTableNC); LeftQuandleByMultiplicationTableNC);
end); end);
InstallGlobalFunction(RightQuasigroup, function(arg) InstallGlobalFunction(RightQuasigroup, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckRQGprop@(arg[2]);
Error("usage: RightQuasigroup([<family>], <gens>)"); return RightQuasigroupNC(arg[1], arg[2]);
fi; end);
# Extract the family
if IsFamily(arg[1]) then InstallGlobalFunction(RightQuasigroupNC, function(fam, gens)
fam := arg[1]; return CloneOfTypeByGenerators(IsRightQuasigroup, fam, gens,
Remove(arg, 1);
arg := Flat(arg);
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi;
return CloneOfTypeByGenerators(IsRightQuasigroup, fam, arg,
GeneratorsOfRightQuasigroup, GeneratorsOfRightQuasigroup,
RightQuasigroupByMultiplicationTableNC); RightQuasigroupByMultiplicationTableNC);
end); end);
InstallGlobalFunction(RightRack, function(arg) InstallGlobalFunction(RightRack, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckRQGprop@(arg[2]);
Error("usage: RightRack([<family>], <gens>)"); if not IsRSelfDistributive(arg[2]) then
Error("Right rack must have right distributive generators");
fi; fi;
# Extract the family return RightRackNC(arg[1], arg[2]);
if IsFamily(arg[1]) then end);
fam := arg[1];
Remove(arg, 1); IntallGlobalFunction(RightRackNC, function(fam, gens)
arg := Flat(arg); return CloneOfTypeByGenerators(IsRightRack, fam, gens,
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi;
return CloneOfTypeByGenerators(IsRightRack, fam, arg,
GeneratorsOfRightQuasigroup, GeneratorsOfRightQuasigroup,
RightRackByMultiplicationTableNC); RightRackByMultiplicationTableNC);
end); end);
InstallGlobalFunction(RightQuandle, function(arg) InstallGlobalFunction(RightQuandle, function(arg)
local fam; arg := ArgHelper@(arg);
if Length(arg) = 0 then CheckLQGprop@(arg[2]);
Error("usage: RightQuandle([<family>], <gens>)"); if not IsRSelfDistributive(arg[2]) then
Error("Right quandle must have right distributive generators");
fi; fi;
# Extract the family if not IsElementwiseIdempotent(arg[2]) then
if IsFamily(arg[1]) then Error("Quandles must contain only idempotent elements");
fam := arg[1];
Remove(arg, 1);
arg := Flat(arg);
else
arg := Flat(arg);
fam := FamilyObj(arg);
fi; fi;
return CloneOfTypeByGenerators(IsRightQuandle, fam, arg, return RightQuandleNC(arg[1], arg[2]);
end);
InstallGlobalFunction(RightQuandleNC, function(fam, gens)
return CloneOfTypeByGenerators(IsRightQuandle, fam, gens,
GeneratorsOfRightQuasigroup, GeneratorsOfRightQuasigroup,
RightQuandleByMultiplicationTableNC); RightQuandleByMultiplicationTableNC);
end); end);
## View and print and such ## View and print and such
LeftObjString@ := function(Q) LeftObjString@ := function(Q)
# Don't test distributivity if we haven't already # Don't test distributivity if we haven't already