consolidate code for those opposites and propagate finiteness

This commit is contained in:
Glen Whitney 2017-10-23 03:34:13 +02:00
parent 68d20cf850
commit 85f37ad774

View File

@ -463,56 +463,43 @@ end);
# Group, so let's leave those methods out for now, and move on to quasigroups,
# racks, and quandles.
OppHelper@ := function(Q, whichgens, cnstr)
local fam, elts, opp;
elts := List(whichgen(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
opp := cnstr(fam, elts);
if HasIsFinite(Q) then SetIsFinite(opp, IsFinite(Q)); fi;
return opp;
end;
InstallMethod(Opposite, "for a left quasigroup",
[IsLeftQuasigroup and HasGeneratorsOfLeftQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfLeftQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return RightQuasigroupNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfLeftQuasigroup, RightQuasigroupNC)
);
InstallMethod(Opposite, "for a left rack",
[IsLeftRack and HasGeneratorsOfLeftQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfLeftQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return RightRackNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfLeftQuasigroup, RightRackNC)
);
InstallMethod(Opposite, "for a left quandle",
[IsLeftQuandle and HasGeneratorsOfLeftQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfLeftQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return RightQuandleNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfLeftQuasigroup, RightQuandleNC)
);
InstallMethod(Opposite, "for a right quasigroup",
[IsRightQuasigroup and HasGeneratorsOfRightQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfRightQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return LeftQuasigroupNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfRightQuasigroup, LeftQuasigroupNC)
);
InstallMethod(Opposite, "for a right rack",
[IsRightRack and HasGeneratorsOfRightQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfRightQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return LeftRackNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfRightQuasigroup, LeftRackNC)
);
InstallMethod(Opposite, "for a right quandle",
[IsRightQuandle and HasGeneratorsOfRightQuasigroup],
function (Q)
local fam, elts;
elts := List(GeneratorsOfRightQuasigroup(Q), q -> OppositeObj(q));
fam := CollectionsFamily(OppositeFamily(ElementsFamily(FamilyObj(Q))));
return LeftQuandleNC(fam, elts);
end);
Q -> OppHelper@(Q, GeneratorsOfRightQuasigroup, LeftQuandleNC)
);