Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add generators method #9

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gap/attributes/sandwich.gd
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ DeclareSynonym("IsSandwichSubsemigroup",
IsSemigroup and IsSandwichSemigroupElementCollection);

InstallTrueMethod(CanUseGapFroidurePin, IsSandwichSubsemigroup);
DeclareAttribute("InverseBijectionSandwichSemigroup",
IsSandwichSemigroup);
53 changes: 48 additions & 5 deletions gap/attributes/sandwich.gi
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
InstallMethod(SandwichSemigroup, "for a semigroup and an element",
[IsSemigroup, IsAssociativeElement],
function(S, a)
local fam, sandwich, filts, type;
local fam, sandwich, filts, type, forward, backward, map;

if not a in S then
ErrorNoReturn("expected 2nd argument to be an element of 1st argument");
fi;

fam := NewFamily("SandwichSemigroupElementsFamily",
IsSandwichSemigroupElement);
IsSandwichSemigroupElement, CanEasilyCompareElements);
sandwich := rec();
Objectify(NewType(CollectionsFamily(fam),
IsSandwichSemigroup and
Expand All @@ -37,12 +37,19 @@ function(S, a)
SetSandwichSemigroupOfFamily(fam, sandwich);
SetElementsFamily(FamilyObj(sandwich), fam);

# TODO(MTW) set the bijection from the original semigroup into the sandwich
SetSandwichElement(sandwich, a);
SetSandwichElement(fam, a);

SetUnderlyingSemigroup(sandwich, S);
SetUnderlyingSemigroup(fam, S);

forward := s -> SEMIGROUPS.SandwichSemigroupElementNC(sandwich, s);
backward := s -> s![1];

map := MappingByFunction(sandwich, S, backward, forward);
SetInverseBijectionSandwichSemigroup(sandwich, map);

return sandwich;
end);

Expand All @@ -69,9 +76,6 @@ IsIdenticalObj,
[IsSandwichSemigroupElement, IsSandwichSemigroupElement],
{x, y} -> Objectify(FamilyObj(x)!.type, [x![1] * SandwichElement(FamilyObj(x)) * y![1]]));

a :=2;
ba :=3;

InstallMethod(\=, "for sandwich semigroup elements",
IsIdenticalObj,
[IsSandwichSemigroupElement, IsSandwichSemigroupElement],
Expand Down Expand Up @@ -122,3 +126,42 @@ function(x)

InstallMethod(ViewObj, "for a sandwich semigroup element",
[IsSandwichSemigroupElement], PrintObj);

InstallMethod(GeneratorsOfSemigroup, "for a sandwich semigroup",
[IsSandwichSemigroup],
function(S)
local T, a, i, P, A, B, map, gens, U, D, y, j, layer, x;

T := UnderlyingSemigroup(S);
a := SandwichElement(S);
i := Position(DClasses(T), DClass(T, a));
P := PartialOrderOfDClasses(T);
A := VerticesReachableFrom(P, i);
AddSet(A, i);
B := Difference(DigraphVertices(P), A);

map := InverseGeneralMapping(InverseBijectionSandwichSemigroup(S));

gens := [];
for j in B do
Append(gens, List(DClasses(T)[j], x -> x ^ map));
od;

U := Semigroup(gens);

while Size(U) < Size(S) do
for layer in DigraphLayers(P, i) do
for j in layer do
D := DClasses(T)[j];
for x in D do
y := x ^ map;
if not y in U then
Add(gens, y);
U := Semigroup(gens);
fi;
od;
od;
od;
od;
return gens;
end);