Skip to content

Commit

Permalink
attrinv: fix NaturalPartialOrder method
Browse files Browse the repository at this point in the history
Previously we pre-sorted the elements of the inverse semigroup
by a Greens D > function, but we should use a Greens D < function.

Resolves semigroups#389.
  • Loading branch information
wilfwilson committed Oct 2, 2017
1 parent 5f85778 commit 6bed8d9
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
16 changes: 10 additions & 6 deletions gap/attributes/attrinv.gi
Expand Up @@ -36,25 +36,29 @@ function(S)
if not IsFinite(S) then
ErrorNoReturn("Semigroups: NaturalPartialOrder: usage,\n",
"the argument is not a finite semigroup,");
fi;

if not IsInverseSemigroup(S) then
elif not IsInverseSemigroup(S) then
ErrorNoReturn("Semigroups: NaturalPartialOrder: usage,\n",
"the argument is not an inverse semigroup,");
elif IsPartialPermSemigroup(S) then
# Use the library method for partial perm inverse semigroups.
return NaturalPartialOrder(S);
fi;

Info(InfoWarning, 2, "NaturalPartialOrder: this method ",
"fully enumerates its argument!");

elts := ShallowCopy(Elements(S));
p := Sortex(elts, IsGreensDGreaterThanFunc(S)) ^ -1;
p := Sortex(elts, {x, y} -> IsGreensDGreaterThanFunc(S)(y, x)) ^ -1;
func := NaturalLeqInverseSemigroup(S);
out := List([1 .. Size(S)], x -> []);

# <elts> is sorted so that D_elts[i] < D_elts[j] => i < j.
# Thus NaturalLeqInverseSemigroup(S)(i, j) => i <= j.

for i in [1 .. Size(S)] do
for j in [i + 1 .. Size(S)] do
if func(elts[j], elts[i]) then
AddSet(out[i ^ p], j ^ p);
if func(elts[i], elts[j]) then
AddSet(out[j ^ p], i ^ p);
fi;
od;
od;
Expand Down
52 changes: 51 additions & 1 deletion tst/standard/attrinv.tst
Expand Up @@ -582,11 +582,61 @@ gap> CharacterTableOfInverseSemigroup(S[10]);
gap> S := InverseSemigroup([Bipartition([[1, -3], [2, -1], [3, 4, -2, -4]]),
> Bipartition([[1, -1], [2, -3], [3, -2], [4, -4]])]);
<inverse block bijection semigroup of degree 4 with 2 generators>
gap> NaturalPartialOrder(AsSemigroup(IsTransformationSemigroup, S));
gap> S := AsSemigroup(IsTransformationSemigroup, S);
<transformation semigroup of size 20, degree 20 with 3 generators>
gap> n := Size(S);;
gap> elts := Elements(S);;
gap> NaturalPartialOrder(S);
[ [ 2, 8, 9, 15, 16, 19 ], [ 9, 16, 19 ], [ 4, 9, 11 ], [ 9 ], [ 9, 16, 18 ],
[ 5, 9, 10, 14, 16, 18 ], [ 9, 13, 20 ], [ 9 ], [ ], [ 9 ], [ 9 ],
[ 9, 11, 13 ], [ 9 ], [ 9, 10, 16 ], [ 8, 9, 16 ], [ 9 ], [ 4, 9, 20 ],
[ 9 ], [ 9 ], [ 9 ] ]
gap> List([1 .. n],
> i -> Filtered([1 .. n],
> j -> i <> j and ForAny(Idempotents(S),
> e -> e * elts[i] = elts[j])));
[ [ 2, 8, 9, 15, 16, 19 ], [ 9, 16, 19 ], [ 4, 9, 11 ], [ 9 ], [ 9, 16, 18 ],
[ 5, 9, 10, 14, 16, 18 ], [ 9, 13, 20 ], [ 9 ], [ ], [ 9 ], [ 9 ],
[ 9, 11, 13 ], [ 9 ], [ 9, 10, 16 ], [ 8, 9, 16 ], [ 9 ], [ 4, 9, 20 ],
[ 9 ], [ 9 ], [ 9 ] ]
gap> last = last2;
true

#T# attrinv: NaturalPartialOrder (for a semigroup), works, 2
gap> S := Semigroup(SymmetricInverseMonoid(3), rec(acting := true));;
gap> es := IdempotentGeneratedSubsemigroup(S);;
gap> n := Size(es);;
gap> elts := Elements(es);
[ <empty partial perm>, <identity partial perm on [ 1 ]>,
<identity partial perm on [ 2 ]>, <identity partial perm on [ 1, 2 ]>,
<identity partial perm on [ 3 ]>, <identity partial perm on [ 2, 3 ]>,
<identity partial perm on [ 1, 3 ]>, <identity partial perm on [ 1, 2, 3 ]>
]
gap> NaturalPartialOrder(es);
[ [ ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1 ], [ 1, 3, 5 ], [ 1, 2, 5 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]
gap> List([1 .. n],
> i -> Filtered([1 .. n], j -> elts[j] = elts[j] * elts[i] and i <> j));
[ [ ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1 ], [ 1, 3, 5 ], [ 1, 2, 5 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]
gap> last = last2;
true

#T# attrinv: NaturalPartialOrder (for a semigroup), works, 3
gap> S := Semigroup(SymmetricInverseMonoid(3), rec(acting := true));;
gap> es := IdempotentGeneratedSubsemigroup(S);;
gap> es := AsSemigroup(IsBlockBijectionSemigroup, es);;
gap> n := Size(es);;
gap> elts := Elements(es);;
gap> NaturalPartialOrder(es);
[ [ ], [ 1 ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1, 2, 4 ], [ 1, 3, 4 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]
gap> List([1 .. n],
> i -> Filtered([1 .. n], j -> elts[j] = elts[j] * elts[i] and i <> j));
[ [ ], [ 1 ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1, 2, 4 ], [ 1, 3, 4 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]
gap> last = last2;
true

#T# attrinv: NaturalPartialOrder (for a semigroup), error, 1/2
gap> S := Semigroup(
Expand Down
2 changes: 1 addition & 1 deletion tst/standard/display.tst
Expand Up @@ -693,7 +693,7 @@ TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLPADDING=\"10\" CELLSPACING=\"0\" PORT=\
BGCOLOR=\"gray\" PORT=\"e1\">*</TD></TR>\n</TABLE>>];\n1 -> 2\n2 -> 3\n3 -> 4\
\nedge [color=blue,arrowhead=none,style=dashed]\n3:e2 -> 4:e1\n3:e3 -> 4:e1\n2\
:e4 -> 3:e2\n2:e4 -> 3:e3\n3:e5 -> 4:e1\n2:e6 -> 3:e3\n2:e6 -> 3:e5\n2:e7 -> 3\
:e5\n1:e8 -> 2:e4\n1:e8 -> 2:e6\n1:e8 -> 2:e7\n }"
:e2\n2:e7 -> 3:e5\n1:e8 -> 2:e4\n1:e8 -> 2:e6\n1:e8 -> 2:e7\n }"

# DotSemilatticeOfIdempotents
gap> S := Semigroup(SymmetricInverseMonoid(3), rec(acting := true));;
Expand Down
11 changes: 11 additions & 0 deletions tst/testinstall.tst
Expand Up @@ -1684,6 +1684,17 @@ gap> Size(S);
gap> Elements(S);
[ ONE, (1,(),1) ]

#T# Issue 389: NaturalPartialOrder
gap> S := Semigroup(SymmetricInverseMonoid(3), rec(acting := true));;
gap> es := IdempotentGeneratedSubsemigroup(S);;
gap> NaturalPartialOrder(es);
[ [ ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1 ], [ 1, 3, 5 ], [ 1, 2, 5 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]
gap> es := AsSemigroup(IsBlockBijectionSemigroup, es);;
gap> NaturalPartialOrder(es);
[ [ ], [ 1 ], [ 1 ], [ 1 ], [ 1, 2, 3 ], [ 1, 2, 4 ], [ 1, 3, 4 ],
[ 1, 2, 3, 4, 5, 6, 7 ] ]

#T# SEMIGROUPS_UnbindVariables
gap> Unbind(B);
gap> Unbind(D);
Expand Down

0 comments on commit 6bed8d9

Please sign in to comment.