RAQ/lib/constructions.gi

144 lines
4.4 KiB
Plaintext

## constructions.gi RAQ Implementations of other quandle constructions
## Inert objects with which to build trivial quandles.
DeclareCategory("IsLRInertum", IsMultiplicativeElement);
DeclareCategory("IsLInertum", IsLRInertum and IsLeftQuotientElement);
DeclareCategory("IsRInertum", IsLRInertum and IsRightQuotientElement);
DeclareCategoryCollections("IsLInertum");
DeclareCategoryCollections("IsRInertum");
LInertumFamily@ := NewFamily("LeftInertFamily", IsLInertum,
IsLSelfDistElement and IsIdempotent);
SetMultiplicationTable(LInertumFamily@, []);
RInertumFamily@ := NewFamily("RightInertFamily", IsRInertum,
IsRSelfDistElement and IsIdempotent);
SetMultiplicationTable(RInertumFamily@, []);
LInertumType@ := NewType(LInertumFamily@,
IsLInertum and IsPositionalObjectOneSlotRep);
RInertumType@ := NewType(RInertumFamily@,
IsRInertum and IsPositionalObjectOneSlotRep);
LInertum@ := i -> Objectify(LInertumType@, [i]);
RInertum@ := i -> Objectify(RInertumType@, [i]);
WhichI@ := obj -> obj![1];
InstallMethod(String, "for left inert objects",
[IsLInertum],
obj -> Concatenation("LInertum@raq(", String(WhichI@(obj)), ")")
);
InstallMethod(String, "for rightt inert objects",
[IsRInertum],
obj -> Concatenation("RInertum@raq(", String(WhichI@(obj)), ")")
);
InstallMethod(ViewString, "for left inert objects",
[IsLInertum],
obj -> Concatenation("i", String(WhichI@(obj)), ">")
);
InstallMethod(ViewString, "for right inert objects",
[IsRInertum],
obj -> Concatenation("<i", String(WhichI@(obj)))
);
InstallMethod(\=, "for two inert objects",
IsIdenticalObj,
[IsLRInertum, IsLRInertum],
function(l,r) return l![1] = r![1]; end
);
InstallMethod(\<, "for two inert objects",
IsIdenticalObj,
[IsLRInertum, IsLRInertum],
function(l,r) return l![1] < r![1]; end
);
InstallMethod(\*, "for a left inert object and anything",
[IsLInertum, IsExtLElement],
function(l,r) return r; end
);
InstallMethod(\*, "for anything and a right inert object",
[IsExtRElement, IsRInertum], ReturnFirst
);
InstallOtherMethod(LeftQuotient, "for a left inert object and anything",
[IsLInertum, IsExtLElement],
function(l,r) return r; end
);
InstallOtherMethod(\/, "for anything and a right inert object",
[IsExtRElement, IsRInertum], ReturnFirst
);
LeftTrivs@ := [];
RightTrivs@ := [];
InstallGlobalFunction(TrivialLeftQuandle,
function(n)
local trivs, I;
if not IsBound(LeftTrivs@[n]) then
trivs := List([1..n], LInertum@);
I := LeftQuandleNC(CollectionsFamily(LInertumFamily@), trivs);
SetIsTrivial(I, true);
SetAsSSortedList(I, trivs);
SetMultiplicationTable(I, ListWithIdenticalEntries(n, [1..n]));
LeftTrivs@[n] := I;
fi;
return LeftTrivs@[n];
end);
InstallGlobalFunction(TrivialRightQuandle,
function(n)
local trivs, I;
if not IsBound(RightTrivs@[n]) then
trivs := List([1..n], RInertum@);
I := RightQuandleNC(CollectionsFamily(RInertumFamily@), trivs);
SetIsTrivial(I, true);
SetAsSSortedList(I, trivs);
SetMultiplicationTable(I,
List([1..n], i -> ListWithIdenticalEntries(n, i)));
RightTrivs@[n] := I;
fi;
return RightTrivs@[n];
end);
# The below needs to be immediate because otherwise it
# is pre-empted by the immediate method that all collections of size
# larger than one are non-trivial.
InstallImmediateMethod(IsTrivial, "for a left quasigroup",
IsLeftQuasigroup and HasSize, 1,
function(Q)
local gens;
gens := GeneratorsOfLeftQuasigroup(Q);
return ForAll(gens, x -> ForAll(gens, y -> x*y = y));
end);
InstallImmediateMethod(IsTrivial, "for a right quasigroup",
IsRightQuasigroup and HasSize, 1,
function(Q)
local gens;
gens := GeneratorsOfRightQuasigroup(Q);
return ForAll(gens, x -> ForAll(gens, y -> y*x = y));
end);
## Convenience functions
InstallGlobalFunction(Quandle,
function(arg)
if Length(arg) = 0 then
return LeftQuandleNC(CollectionsFamily(LInertumFamily@),[]);
fi;
if Length(arg) = 1 and IsInt(arg[1]) then
return TrivialLeftQuandle(arg[1]);
fi;
## Will put more stuff here, but for now, just a convenient wrapper for
## perms
return LeftQuandleByPerms(arg);
end);
InstallGlobalFunction(Rack,
function(arg)
## Will put more stuff here, but for now, just a convenient wrapper for
## perms
return LeftRackByPerms(arg);
end);