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 27 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
11 changes: 11 additions & 0 deletions doc/attr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,17 @@ gap> GeneratorsSmallest(T);
</ManSection>
<#/GAPDoc>

<#GAPDoc Label="OneInverseOfSemigroupElement">
<ManSection>
<Attr Name="OneInverseOfSemigroupElement" Arg="S, x"/>
<Returns> One inverse of an element of a semigroup.</Returns>
<Description>
<C>OneInverseOfSemigroupElement</C> returns one inverse of the element
<C>x</C> in the semigroup <A>S</A>.
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if there is no inverse?

Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
</Description>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Example please!

</ManSection>
<#/GAPDoc>

<#GAPDoc Label="IndecomposableElements">
<ManSection>
<Attr Name="IndecomposableElements" Arg="S"/>
Expand Down
4 changes: 4 additions & 0 deletions gap/attributes/attr.gd
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ DeclareAttribute("UnderlyingSemigroupOfSemigroupWithAdjoinedZero",

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

DeclareAttribute("IndecomposableElements", IsSemigroup);
DeclareAttribute("NambooripadLeqRegularSemigroup", IsSemigroup);
Expand Down
69 changes: 65 additions & 4 deletions gap/attributes/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -777,10 +777,29 @@ InstallMethod(InversesOfSemigroupElementNC,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement],
function(S, x)
if not IsFinite(S) then
TryNextMethod();
fi;
return Filtered(EnumeratorSorted(S), y -> x * y * x = x and y * x * y = y);
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 := EmptyPlist(NrIdempotents(R) * NrIdempotents(L));

for e in Idempotents(R) do
s := RightGreensMultiplierNC(S, a, e) * e;
for f in Idempotents(L) do
Add(inverses, f * s);
od;
od;
return inverses;
end);

InstallMethod(InversesOfSemigroupElement,
Expand All @@ -796,6 +815,48 @@ function(S, x)
return InversesOfSemigroupElementNC(S, x);
end);

InstallMethod(OneInverseOfSemigroupElementNC,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement],
function(S, x)
if not IsFinite(S) then
TryNextMethod();
fi;
return First(EnumeratorSorted(S),
y -> x * y * x = x and y * x * y = y);
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, e, f, s;
R := RClass(S, a);
L := LClass(S, a);
e := Idempotents(R);
if IsEmpty(e) then
return fail;
fi;
e := e[1];
s := RightGreensMultiplierNC(S, a, e);
f := Idempotents(L)[1];
return f * s * e;
end);

InstallMethod(OneInverseOfSemigroupElement,
"for CanUseFroidurePin and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement],
function(S, x)
if not IsFinite(S) then
Tianrun-Y marked this conversation as resolved.
Show resolved Hide resolved
TryNextMethod();
elif not x in S then
ErrorNoReturn("the 2nd argument (a mult. element) must belong to the 1st ",
"argument (a semigroup)");
fi;
return OneInverseOfSemigroupElementNC(S, x);
end);


InstallMethod(UnderlyingSemigroupOfSemigroupWithAdjoinedZero,
"for a semigroup",
[IsSemigroup],
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 IsMultiplicativeElementWithOne(a) and IsMultiplicativeElementWithOne(b) then
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 IsMultiplicativeElementWithOne(a) and IsMultiplicativeElementWithOne(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
Loading