RAQ/lib/constructions.gi

144 lines
4.4 KiB
Plaintext
Raw Normal View History

2017-10-29 22:11:33 +00:00
## 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@, []);
2017-10-29 22:11:33 +00:00
RInertumFamily@ := NewFamily("RightInertFamily", IsRInertum,
IsRSelfDistElement and IsIdempotent);
SetMultiplicationTable(RInertumFamily@, []);
2017-10-29 23:08:30 +00:00
LInertumType@ := NewType(LInertumFamily@,
2017-10-29 22:11:33 +00:00
IsLInertum and IsPositionalObjectOneSlotRep);
2017-10-29 23:08:30 +00:00
RInertumType@ := NewType(RInertumFamily@,
2017-10-29 22:11:33 +00:00
IsRInertum and IsPositionalObjectOneSlotRep);
2017-10-29 23:08:30 +00:00
LInertum@ := i -> Objectify(LInertumType@, [i]);
RInertum@ := i -> Objectify(RInertumType@, [i]);
2017-10-29 22:11:33 +00:00
WhichI@ := obj -> obj![1];
InstallMethod(String, "for left inert objects",
[IsLInertum],
obj -> Concatenation("LInertum@RAQ(", String(WhichI@(obj)), ")")
2017-10-29 22:11:33 +00:00
);
InstallMethod(String, "for rightt inert objects",
[IsRInertum],
obj -> Concatenation("RInertum@RAQ(", String(WhichI@(obj)), ")")
2017-10-29 22:11:33 +00:00
);
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
);
2017-10-29 23:10:11 +00:00
InstallOtherMethod(LeftQuotient, "for a left inert object and anything",
2017-10-29 22:11:33 +00:00
[IsLInertum, IsExtLElement],
function(l,r) return r; end
);
2017-10-29 23:10:11 +00:00
InstallOtherMethod(\/, "for anything and a right inert object",
2017-10-29 22:11:33 +00:00
[IsExtRElement, IsRInertum], ReturnFirst
);
LeftTrivs@ := [];
2017-10-30 00:04:19 +00:00
RightTrivs@ := [];
2017-10-29 22:11:33 +00:00
InstallGlobalFunction(TrivialLeftQuandle,
function(n)
local trivs, I;
2017-10-29 22:11:33 +00:00
if not IsBound(LeftTrivs@[n]) then
trivs := List([1..n], LInertum@);
I := LeftQuandleNC(CollectionsFamily(LInertumFamily@), trivs);
2017-10-29 22:11:33 +00:00
SetIsTrivial(I, true);
2017-10-30 00:03:16 +00:00
SetAsSSortedList(I, trivs);
2017-10-29 22:11:33 +00:00
SetMultiplicationTable(I, ListWithIdenticalEntries(n, [1..n]));
LeftTrivs@[n] := I;
fi;
return LeftTrivs@[n];
end);
InstallGlobalFunction(TrivialRightQuandle,
function(n)
2017-10-30 00:54:12 +00:00
local trivs, I;
2017-10-29 22:11:33 +00:00
if not IsBound(RightTrivs@[n]) then
2017-10-30 00:54:12 +00:00
trivs := List([1..n], RInertum@);
I := RightQuandleNC(CollectionsFamily(RInertumFamily@), trivs);
2017-10-29 22:11:33 +00:00
SetIsTrivial(I, true);
2017-10-30 00:54:12 +00:00
SetAsSSortedList(I, trivs);
2017-10-29 22:11:33 +00:00
SetMultiplicationTable(I,
List([1..n], i -> ListWithIdenticalEntries(n, i)));
RightTrivs@[n] := I;
fi;
return RightTrivs@[n];
end);
2017-10-30 00:54:12 +00:00
# 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",
2017-10-30 01:33:02 +00:00
IsLeftQuasigroup and HasSize, 1,
function(Q)
local gens;
gens := GeneratorsOfLeftQuasigroup(Q);
return ForAll(gens, x -> ForAll(gens, y -> x*y = y));
end);
2017-10-29 22:11:33 +00:00
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);
2017-10-29 22:11:33 +00:00
## 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
2017-10-30 00:56:42 +00:00
return LeftRackByPerms(arg);
2017-10-29 22:11:33 +00:00
end);