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

Better inverses #1021

Open
wants to merge 46 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
5065769
Stub
james-d-mitchell Jun 25, 2024
56b10cb
Add possibly better method for InversesOfSemigroupElementNC
james-d-mitchell Jun 28, 2024
e874b8f
delete Nambooripad Method for Transformation Semigroup
Tianrun-Y Jul 1, 2024
d42b687
change inverses to a set
Tianrun-Y Jul 2, 2024
073e25a
change filter into IsMultiplicativeElementWithOne as it is required f…
Tianrun-Y Jul 2, 2024
d8dd7e1
add the AsSet to the test rather than the method
Tianrun-Y Jul 2, 2024
f40c494
fix consecutive empty lines
Tianrun-Y Jul 3, 2024
a7ab1d3
fix RightGreensMultiplierNC does not work on fp semigroups where ther…
Tianrun-Y Jul 4, 2024
1f5b58f
fix comment
Tianrun-Y Jul 4, 2024
99c1fc6
add OneInverseOfSemigroupElement and fix small issues
Tianrun-Y Jul 4, 2024
b86b177
fix declaration and filter problem
Tianrun-Y Jul 26, 2024
1849da6
Update gap/attributes/attr.gi
Tianrun-Y Jul 29, 2024
377d20d
Update gap/attributes/attr.gi
Tianrun-Y Jul 29, 2024
793bd63
fix formatting for gaplint
Tianrun-Y Jul 29, 2024
91309d0
Merge branch 'better-inverses' of github.com:/Tianrun-Y/Semigroups in…
Tianrun-Y Jul 29, 2024
479991a
fix issue
Tianrun-Y Jul 29, 2024
b760696
Update gap/attributes/attr.gi
Tianrun-Y Jul 29, 2024
b7327f1
Update gap/attributes/attr.gi
Tianrun-Y Jul 29, 2024
c967c92
fix issue
Tianrun-Y Jul 30, 2024
ee7cef2
Update gap/attributes/attr.gi
Tianrun-Y Jul 30, 2024
fff144c
Merge branch 'main' into better-inverses
Tianrun-Y Jul 30, 2024
ece58f0
addnon-no-check version of OneInverse, and a NC version for cannot us…
Tianrun-Y Jul 30, 2024
81a7cd3
fix small issues in the previous commit
Tianrun-Y Jul 30, 2024
aefbad1
Update gap/attributes/attr.gi
Tianrun-Y Jul 30, 2024
abc2e85
add declaration of OneInverseOfSemigroupElement
Tianrun-Y Jul 30, 2024
7149d71
Merge branch 'better-inverses' of github.com:/Tianrun-Y/Semigroups in…
Tianrun-Y Jul 30, 2024
7b23dbb
add documentation of OneInverseOfSemigroupElement
Tianrun-Y Jul 30, 2024
c969b11
fix formatting for gaplint
Tianrun-Y Jul 31, 2024
7cccf7c
fix syntax error
Tianrun-Y Jul 31, 2024
80b17ec
add test for OneInverseOfSemigroupElement
Tianrun-Y Jul 31, 2024
60ed671
addMultiplicativeNeutralElement as a return
Tianrun-Y Jul 31, 2024
a695534
addMultiplicativeNeutralElement as a return for the other one
Tianrun-Y Jul 31, 2024
0367685
update documentation for LeftGreensMultiplier
Tianrun-Y Jul 31, 2024
554e0dd
fix filter problem
Tianrun-Y Jul 31, 2024
513712b
fix filter problem and also add test
Tianrun-Y Jul 31, 2024
82d81bd
fix test problems
Tianrun-Y Jul 31, 2024
428e039
fix gaplint
Tianrun-Y Jul 31, 2024
1707bf6
fix test
Tianrun-Y Jul 31, 2024
f276972
add example in documentation
Tianrun-Y Aug 1, 2024
29eab45
Update doc/attr.xml
Tianrun-Y Aug 7, 2024
3f93d05
if there is no inverse
Tianrun-Y Aug 7, 2024
6508fc6
merge
Tianrun-Y Aug 7, 2024
54e651a
delete merge remnants
Tianrun-Y Aug 7, 2024
bf02a27
add to chapter
Tianrun-Y Aug 7, 2024
2b441e0
fix small issue
Tianrun-Y Aug 7, 2024
7f989c0
fix example format
Tianrun-Y Aug 7, 2024
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/attr.gd
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ DeclareAttribute("UnderlyingSemigroupOfSemigroupWithAdjoinedZero",

DeclareOperation("InversesOfSemigroupElementNC",
[IsSemigroup, IsMultiplicativeElement]);
DeclareOperation("OneInverseOfSemigroupElementNC",
[CanUseFroidurePin, IsMultiplicativeElement]);

DeclareAttribute("IndecomposableElements", IsSemigroup);
DeclareAttribute("NambooripadLeqRegularSemigroup", IsSemigroup);
Expand Down
36 changes: 34 additions & 2 deletions gap/attributes/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -777,12 +777,44 @@ InstallMethod(InversesOfSemigroupElementNC,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement],
function(S, x)
if not IsFinite(S) then
TryNextMethod();
if not IsFinite(S) then
TryNextMethod();
fi;
return Filtered(EnumeratorSorted(S), y -> x * y * x = x and y * x * y = y);
end);

InstallMethod(InversesOfSemigroupElementNC,
"for CanUseFroidurePin and a multiplicative element",
[CanUseFroidurePin, IsMultiplicativeElement],
function(S, a)
local R, L, inverses, e, f, s;
R := RClass(S, a);
L := LClass(S, a);
inverses := [];
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved

for e in Idempotents(R) do
s := RightGreensMultiplierNC(S, a, e);
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
for f in Idempotents(L) do
Add(inverses, f * s * e);
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
od;
od;
return inverses;
end);

InstallMethod(OneInverseOfSemigroupElementNC,
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
"for CanUseFroidurePin and a multiplicative element",
[CanUseFroidurePin, IsMultiplicativeElement],
function(S, a)
local R, L, inverse, e, f, s;
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
R := RClass(S, a);
L := LClass(S, a);
e := Idempotents(R)[1];
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
s := RightGreensMultiplierNC(S, a, e);
f := Idempotents(L)[1];
inverse := f * s * e;
return inverse;
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
end);

InstallMethod(InversesOfSemigroupElement,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement], 1, # to beat the library method
Expand Down
40 changes: 24 additions & 16 deletions gap/greens/froidure-pin.gi
Original file line number Diff line number Diff line change
Expand Up @@ -606,39 +606,47 @@ function(S)
end);

InstallMethod(LeftGreensMultiplierNC,
"for a semigroup that can use Froidure-Pin and L-related elements with one",
"for a semigroup that can use Froidure-Pin and L-related elements",
[IsSemigroup and CanUseFroidurePin,
IsMultiplicativeElementWithOne,
IsMultiplicativeElementWithOne],
IsMultiplicativeElement,
IsMultiplicativeElement],
function(S, a, b)
local gens, D, path;
local gens, D, path, a1, b1;
gens := GeneratorsOfSemigroup(S);
D := LeftCayleyDigraph(S);
a := PositionCanonical(S, a);
b := PositionCanonical(S, b);
path := NextIterator(IteratorOfPaths(D, a, b));
a1 := PositionCanonical(S, a);
b1 := PositionCanonical(S, b);
path := NextIterator(IteratorOfPaths(D, a1, b1));
if path = fail then
# This can occur when, for example, a = b and S is not a monoid.
return One(gens);
if IsMultiplicativeElement(a) and IsMultiplicativeElement(b) then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this does exactly what you want it to, maybe you meant not IsMultiplicativeElementWithOne(a) and similar for b?

This comment was marked as resolved.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still missing, and the documentation for Left/RightGreensMultiplier should be updated to include:

If S is a semigroup but not a monoid, then the return value is either of the same type as the elements of S or an adjoined identity.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing "WithOne" fixed. The documentation is possibly more delicate than that, as an fp semigroup can be a monoid but GAP cannot recognise it as one. One example is < s1, s2 | s1^2=s1, s2^2=s2, s1s2=s2, s2s1=s2>. s1 is a "one" but GAP does not know that.

return One(gens);
else
return SEMIGROUPS.UniversalFakeOne;
fi;
fi;
return EvaluateWord(gens, Reversed(path[2]));
end);

InstallMethod(RightGreensMultiplierNC,
"for a semigroup that can use Froidure-Pin and R-related elements with one",
"for a semigroup that can use Froidure-Pin and R-related elements",
[IsSemigroup and CanUseFroidurePin,
IsMultiplicativeElementWithOne,
IsMultiplicativeElementWithOne],
IsMultiplicativeElement,
IsMultiplicativeElement],
function(S, a, b)
local gens, D, path;
local gens, D, path, a1, b1;
gens := GeneratorsOfSemigroup(S);
D := RightCayleyDigraph(S);
a := PositionCanonical(S, a);
b := PositionCanonical(S, b);
path := NextIterator(IteratorOfPaths(D, a, b));
a1 := PositionCanonical(S, a);
b1 := PositionCanonical(S, b);
path := NextIterator(IteratorOfPaths(D, a1, b1));
if path = fail then
# This can occur when, for example, a = b and S is not a monoid.
return One(gens);
if IsMultiplicativeElement(a) and IsMultiplicativeElement(b) then
return One(gens);
else
return SEMIGROUPS.UniversalFakeOne;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add some tests for this too?

fi;
fi;
return EvaluateWord(gens, path[2]);
end);
Expand Down
2 changes: 1 addition & 1 deletion tst/standard/ideals/ideals.tst
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ gap> I := SemigroupIdeal(S,
> Matrix(IsBooleanMat, [[1, 0, 1], [0, 0, 0], [0, 1, 0]]),
> Matrix(IsBooleanMat, [[0, 1, 1], [0, 1, 1], [1, 0, 1]]));;
gap> x := Matrix(IsBooleanMat, [[1, 0, 1], [0, 1, 0], [1, 0, 1]]);;
gap> InversesOfSemigroupElement(I, x);
gap> AsSet(InversesOfSemigroupElement(I, x));
[ Matrix(IsBooleanMat, [[0, 0, 0], [0, 1, 0], [0, 0, 1]]),
Matrix(IsBooleanMat, [[0, 0, 0], [0, 1, 0], [1, 0, 0]]),
Matrix(IsBooleanMat, [[0, 0, 0], [0, 1, 0], [1, 0, 1]]),
Expand Down