2017-10-18 10:46:13 +00:00
|
|
|
## structure.gi RAQ Implementation of definitiions, reps, and elt operations
|
|
|
|
|
|
|
|
## Create structures with generators
|
2017-10-18 11:19:57 +00:00
|
|
|
InstallGlobalFunction(CloneOfTypeByGenerators,
|
2017-10-18 10:46:13 +00:00
|
|
|
function(cat, fam, gens, genAttrib)
|
|
|
|
local M;
|
|
|
|
if not(IsEmpty(gens) or IsIdenticalObj(FamilyObj(gens), fam)) then
|
|
|
|
Error("<fam> and family of <gens> do not match");
|
|
|
|
fi;
|
|
|
|
M := Objectify(NewType( fam, cat and IsAttributeStoringRep), rec());
|
|
|
|
Setter(genAttrib)(M, AsList(gens));
|
|
|
|
return M;
|
|
|
|
end);
|
|
|
|
|
|
|
|
## Functions for each of the magma categories here
|
|
|
|
InstallGlobalFunction(LeftQuasigroup, function(arg)
|
|
|
|
local fam;
|
|
|
|
if Length(arg) = 0 then
|
|
|
|
Error("usage: LeftQuasigroup([<family>], <gens>)");
|
|
|
|
fi;
|
|
|
|
# Extract the family
|
|
|
|
if IsFamily(arg[1]) then
|
2017-10-18 11:25:13 +00:00
|
|
|
fam := arg[1];
|
2017-10-18 10:46:13 +00:00
|
|
|
Remove(arg, 1);
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
2017-10-18 10:46:13 +00:00
|
|
|
else
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
|
|
|
fam := FamilyObj(arg[1]);
|
2017-10-18 10:46:13 +00:00
|
|
|
fi;
|
|
|
|
return CloneOfTypeByGenerators(IsLeftQuasigroup, fam, arg,
|
|
|
|
GeneratorsOfLeftQuasigroup);
|
|
|
|
end);
|
|
|
|
|
|
|
|
InstallGlobalFunction(LeftRack, function(arg)
|
|
|
|
local fam;
|
|
|
|
if Length(arg) = 0 then
|
|
|
|
Error("usage: LeftRack([<family>], <gens>)");
|
|
|
|
fi;
|
|
|
|
# Extract the family
|
|
|
|
if IsFamily(arg[1]) then
|
2017-10-18 11:25:13 +00:00
|
|
|
fam := arg[1];
|
2017-10-18 10:46:13 +00:00
|
|
|
Remove(arg, 1);
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
2017-10-18 10:46:13 +00:00
|
|
|
else
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
|
|
|
fam := FamilyObj(arg[1]);
|
2017-10-18 10:46:13 +00:00
|
|
|
fi;
|
|
|
|
return CloneOfTypeByGenerators(IsLeftRack, fam, arg,
|
|
|
|
GeneratorsOfLeftQuasigroup);
|
|
|
|
end);
|
|
|
|
|
|
|
|
InstallGlobalFunction(RightQuasigroup, function(arg)
|
|
|
|
local fam;
|
|
|
|
if Length(arg) = 0 then
|
|
|
|
Error("usage: RightQuasigroup([<family>], <gens>)");
|
|
|
|
fi;
|
|
|
|
# Extract the family
|
|
|
|
if IsFamily(arg[1]) then
|
2017-10-18 11:25:13 +00:00
|
|
|
fam := arg[1];
|
2017-10-18 10:46:13 +00:00
|
|
|
Remove(arg, 1);
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
2017-10-18 10:46:13 +00:00
|
|
|
else
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
|
|
|
fam := FamilyObj(arg[1]);
|
2017-10-18 10:46:13 +00:00
|
|
|
fi;
|
|
|
|
return CloneOfTypeByGenerators(IsRightQuasigroup, fam, arg,
|
|
|
|
GeneratorsOfRightQuasigroup);
|
|
|
|
end);
|
|
|
|
|
|
|
|
InstallGlobalFunction(RightRack, function(arg)
|
|
|
|
local fam;
|
|
|
|
if Length(arg) = 0 then
|
|
|
|
Error("usage: RightRack([<family>], <gens>)");
|
|
|
|
fi;
|
|
|
|
# Extract the family
|
|
|
|
if IsFamily(arg[1]) then
|
2017-10-18 11:25:13 +00:00
|
|
|
fam := arg[1];
|
2017-10-18 10:46:13 +00:00
|
|
|
Remove(arg, 1);
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
2017-10-18 10:46:13 +00:00
|
|
|
else
|
2017-10-18 11:25:13 +00:00
|
|
|
arg := Flat(arg);
|
|
|
|
fam := FamilyObj(arg[1]);
|
2017-10-18 10:46:13 +00:00
|
|
|
fi;
|
|
|
|
return CloneOfTypeByGenerators(IsRightRack, fam, arg,
|
|
|
|
GeneratorsOfRightQuasigroup);
|
|
|
|
end);
|
|
|
|
|
|
|
|
## And now create them from multiplication tables
|
|
|
|
InstallGlobalFunction(LeftQuasigroupByMultiplicationTable,
|
|
|
|
function(T)
|
|
|
|
if not IsLeftQuasigroupTable(T) then
|
|
|
|
Error("Multiplication table <T> must have each row a permutation of ",
|
|
|
|
"the same entries.");
|
|
|
|
fi;
|
|
|
|
return MagmaByMultiplicationTableCreatorNC(
|
|
|
|
CanonicalCayleyTableOfLeftQuasigroupTable(T),
|
|
|
|
LeftQuasigroup,
|
|
|
|
IsLeftQuotientElement and IsMagmaByMultiplicationTableObj
|
|
|
|
);
|
|
|
|
end);
|
|
|
|
|
|
|
|
## And define the operation
|
|
|
|
|
|
|
|
InstallOtherMethod(LeftQuotient,
|
|
|
|
"for two elts in magma by mult table, when left has left quotients",
|
|
|
|
IsIdenticalObj,
|
|
|
|
[IsLeftQuotientElement, IsMagmaByMultiplicationTableObj],
|
|
|
|
function (l,r)
|
2017-10-18 11:28:36 +00:00
|
|
|
return LeftDivisionTable(FamilyObj(l))[l![1],r![1]];
|
2017-10-18 10:46:13 +00:00
|
|
|
end);
|
|
|
|
|
|
|
|
## Create division tables as needed
|
|
|
|
InstallMethod(LeftDivisionTable,
|
|
|
|
"for a family with a multiplication table",
|
|
|
|
[IsFamily and HasMultiplicationTable],
|
|
|
|
function(fam)
|
|
|
|
local LS, n;
|
|
|
|
LS := LeftSectionList(fam);
|
2017-10-18 11:32:42 +00:00
|
|
|
n := Size(LS);
|
|
|
|
return List(LS, x->ListPerm(Inverse(x), n));
|
2017-10-18 10:46:13 +00:00
|
|
|
end);
|
|
|
|
|
|
|
|
## Create section lists as needed
|
|
|
|
InstallMethod(LeftSectionList,
|
|
|
|
"for a family with a multiplication table",
|
|
|
|
[IsFamily and HasMultiplicationTable],
|
|
|
|
function(fam)
|
|
|
|
return List(MultiplicationTable(fam), x->PermList(x));
|
|
|
|
end);
|
|
|
|
|
|
|
|
|
|
|
|
|