Skip to content

Commit

Permalink
semigrp: fix DisplaySemigroup
Browse files Browse the repository at this point in the history
The documentation for `DisplaySemigroup` was not linked.
Furthermore, there was an unexpected error for certain
types of transformation semigroup when using `DisplaySemigroup`:
in particular, the method did not take into account the degree
of the semigroup when trying to calculate the rank of an
element. For example, in any monoid of transformations of degree `n`,
`IdentityTransformation` has rank `n`. So you need to know the
degree of the semigroup to get the rank.
  • Loading branch information
wilfwilson authored and markuspf committed Oct 27, 2017
1 parent 6a721f7 commit d768f44
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 20 deletions.
1 change: 1 addition & 0 deletions doc/ref/semigrp.xml
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ The following functions deal with quotient semigroups in ⪆.
<#Include Label="GroupHClassOfGreensDClass">
<#Include Label="IsGroupHClass">
<#Include Label="IsRegularDClass">
<#Include Label="DisplaySemigroup">

</Section>

Expand Down
20 changes: 11 additions & 9 deletions lib/semigrp.gd
Original file line number Diff line number Diff line change
Expand Up @@ -595,24 +595,26 @@ DeclareProperty("IsInverseSemigroup", IsSemigroup);
##
#O DisplaySemigroup( <S> )
##
## <#GAPDoc Label="DisplaySemigroup">
## <ManSection>
## <Oper Name="DisplaySemigroup" Arg='S'/>
##
## <Description>
## Produces a convenient display of a semigroup's DClass
## structure. Let <A>S</A> have degree <M>n</M>. Then for each <M>r\leq n</M>, we
## show all D classes of rank <M>n</M>.
## Produces a convenient display of a transformation semigroup's D-Class
## structure. Let <A>S</A> be a transformation semigroup of degree
## <M>n</M>. Then for each <M>r\leq n</M>, we show all D-classes of
## rank <M>r</M>.
## <P/>
## A regular D class with a single H class of size 120 appears as
## <Example><![CDATA[
## *[H size = 120, 1 L classes, 1 R classes]
## ]]></Example>
## A regular D-class with a single H-class of size 120 appears as
## <Log><![CDATA[
## *[H size = 120, 1 L-class, 1 R-class]
## ]]></Log>
## (the <C>*</C> denoting regularity).
## </Description>
## </ManSection>
## <#/GAPDoc>
##
DeclareOperation("DisplaySemigroup",
[IsSemigroup]);
DeclareOperation("DisplaySemigroup", [IsSemigroup]);

# Everything from here...

Expand Down
40 changes: 29 additions & 11 deletions lib/semigrp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -422,20 +422,29 @@ InstallMethod(DisplaySemigroup, "for finite semigroups",
[IsTransformationSemigroup],
function(S)

local dc, i, len, sh, D, layer, displayDClass;
local dc, i, len, sh, D, layer, displayDClass, n;

displayDClass:= function(D)
local h, sh;
local h, nrL, nrR;
h:= GreensHClassOfElement(AssociatedSemigroup(D),Representative(D));
if IsRegularDClass(D) then
Print("*");
else
Print(" ");
fi;
nrL := Size(GreensRClassOfElement(AssociatedSemigroup(D),
Representative(h))) / Size(h);
nrR := Size(GreensLClassOfElement(AssociatedSemigroup(D),
Representative(h))) / Size(h);
Print("[H size = ", Size(h), ", ", nrL, " L-class");
if nrL > 1 then
Print("es");
fi;
Print(", ", nrR, " R-class");
if nrR > 1 then
Print("es");
fi;
Print("[H size = ", Size(h),", ",
Size(GreensRClassOfElement(AssociatedSemigroup(D),
Representative(h)))/Size(h), " L classes, ",
Size(GreensLClassOfElement(AssociatedSemigroup(D),
Representative(h)))/Size(h)," R classes]");
Print("\n");
Print("]\n");
end;

#########################################################################
Expand All @@ -446,13 +455,22 @@ function(S)

# check finiteness
if not IsFinite(S) then
TryNextMethod();
TryNextMethod();
fi;

# determine D classes and sort according to rank.
layer:= List([1..DegreeOfTransformationSemigroup(S)], x->[]);
n := DegreeOfTransformationSemigroup(S);

if n = 0 then
# special case for the full transformation monoid on one point
Print("Rank 0: ");
displayDClass(GreensDClasses(S)[1]);
return;
fi;

layer:= List([1 .. n], x->[]);
for D in GreensDClasses(S) do
Add(layer[RankOfTransformation(Representative(D))], D);
Add(layer[RankOfTransformation(Representative(D), n)], D);
od;

# loop over the layers.
Expand Down
18 changes: 18 additions & 0 deletions tst/testinstall/semigrp.tst
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,24 @@ s3*s1
gap> Random(GlobalRandomSource, S);
s3*s2^2

#T# Test DisplaySemigroup
gap> DisplaySemigroup(FullTransformationSemigroup(1));
Rank 0: *[H size = 1, 1 L-class, 1 R-class]
gap> DisplaySemigroup(FullTransformationSemigroup(2));
Rank 2: *[H size = 2, 1 L-class, 1 R-class]
Rank 1: *[H size = 1, 2 L-classes, 1 R-class]
gap> DisplaySemigroup(FullTransformationSemigroup(3));
Rank 3: *[H size = 6, 1 L-class, 1 R-class]
Rank 2: *[H size = 2, 3 L-classes, 3 R-classes]
Rank 1: *[H size = 1, 3 L-classes, 1 R-class]
gap> S := Semigroup([
> Transformation([1, 1, 1, 2]),
> Transformation([1, 1, 2, 1])]);;
gap> DisplaySemigroup(S);
Rank 2: [H size = 1, 1 L-class, 1 R-class]
Rank 2: [H size = 1, 1 L-class, 1 R-class]
Rank 1: *[H size = 1, 1 L-class, 1 R-class]

#
gap> STOP_TEST( "semigrp.tst", 1);

Expand Down

0 comments on commit d768f44

Please sign in to comment.