Skip to content

Commit

Permalink
Merge pull request #9 from james-d-mitchell/add-sandwich-semigroup
Browse files Browse the repository at this point in the history
Add generators method
  • Loading branch information
MTWhyte authored Oct 18, 2024
2 parents 29bfc25 + 09982ef commit bd3c975
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
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);

0 comments on commit bd3c975

Please sign in to comment.