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 37 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
2 changes: 1 addition & 1 deletion doc/greens-generic.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,7 @@ gap> List(DClasses(S), SchutzenbergerGroup);
element <C>s</C> is of the same type as the elements of <A>S</A> but may
or may not be an element of <A>S</A>. In particular, if <A>S</A> is not a
monoid and <C><A>a</A> = <A>b</A></C>, then
<C>One(GeneratorsOfSemigroup(S))</C> may be returned. Even if <C><A>a</A> &lt;>
<C>One(GeneratorsOfSemigroup(S))</C> or an adjoined identity may be returned. Even if <C><A>a</A> &lt;>
<A>b</A></C>, then it is not guaranteed that the returned element <C>s</C>
will belong to <A>S</A>. It is guaranteed that the left action of <C>s</C> on
the elements of the &L;-class of <A>a</A> is the same as the left action of
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
65 changes: 57 additions & 8 deletions gap/attributes/attr.gi
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ end);

InstallMethod(InversesOfSemigroupElementNC,
"for a group as semigroup and a multiplicative element",
[IsGroupAsSemigroup, IsMultiplicativeElement],
[IsGroupAsSemigroup and CanUseFroidurePin, IsMultiplicativeElement],
function(G, x)
local i, iso, inv;
if IsMultiplicativeElementWithInverse(x) then
Expand All @@ -774,26 +774,75 @@ function(G, x)
end);

InstallMethod(InversesOfSemigroupElementNC,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement],
"for a semigroup that can use froidure-pin 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,
"for a semigroup that can use froidure-pin and a multiplicative element",
[CanUseFroidurePin, IsMultiplicativeElement], # to beat the library method
function(S, x)
if not IsFinite(S) then
TryNextMethod();
elif not x in S then
ErrorNoReturn("the 2nd argument (a mult. element) must belong to the 1st ",
"argument (a semigroup)");
fi;
return Filtered(EnumeratorSorted(S), y -> x * y * x = x and y * x * y = y);
return InversesOfSemigroupElementNC(S, x);
end);

InstallMethod(InversesOfSemigroupElement,
InstallMethod(OneInverseOfSemigroupElementNC,
"for a semigroup and a multiplicative element",
[IsSemigroup, IsMultiplicativeElement], 1, # to beat the library method
[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 a semigroup 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();
ErrorNoReturn("the semigroup is not finite");
elif not x in S then
ErrorNoReturn("the 2nd argument (a mult. element) must belong to the 1st ",
"argument (a semigroup)");
fi;
return InversesOfSemigroupElementNC(S, x);
return OneInverseOfSemigroupElementNC(S, x);
end);

InstallMethod(UnderlyingSemigroupOfSemigroupWithAdjoinedZero,
Expand Down
46 changes: 30 additions & 16 deletions gap/greens/froidure-pin.gi
Original file line number Diff line number Diff line change
Expand Up @@ -606,39 +606,53 @@ 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);
elif MultiplicativeNeutralElement(S) <> fail then
return MultiplicativeNeutralElement(S);
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);
elif MultiplicativeNeutralElement(S) <> fail then
return MultiplicativeNeutralElement(S);
else
return SEMIGROUPS.UniversalFakeOne;
fi;
fi;
return EvaluateWord(gens, path[2]);
end);
Expand Down
2 changes: 1 addition & 1 deletion gap/semigroups/grpperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ end);

# fall back method, same method for ideals

InstallMethod(IsomorphismPermGroup, "for a semigroup", [IsSemigroup],
InstallMethod(IsomorphismPermGroup, "for a semigroup", [CanUseFroidurePin],
function(S)
local cay, deg, G, gen1, gen2, next, pos, iso, inv, i;
if not IsFinite(S) then
Expand Down
30 changes: 30 additions & 0 deletions tst/standard/attributes/attr.tst
Original file line number Diff line number Diff line change
Expand Up @@ -1477,6 +1477,36 @@ Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 2nd choice method found for `InversesOfSemigroupElementNC' on 2 argu\
ments

# attr: OneInverseOfSemigroupElement, for a semigroup
gap> S := Semigroup([
> Matrix(IsMaxPlusMatrix, [[-2, 2, 0], [-1, 0, 0], [1, -3, 1]]),
> Matrix(IsMaxPlusMatrix, [[- infinity, 0, 0], [0, 1, 0], [1, -1, 0]])]);;
gap> OneInverseOfSemigroupElement(S, S.1);
Error, the semigroup is not finite
gap> S := Semigroup(Transformation([2, 3, 1, 3, 3]));;
gap> OneInverseOfSemigroupElement(S, Transformation([1, 3, 2]));
Error, the 2nd argument (a mult. element) must belong to the 1st argument (a s\
emigroup)
gap> S := Semigroup([Matrix(IsBooleanMat, [[0, 0, 1], [0, 1, 1], [1, 0, 0]]),
> Matrix(IsBooleanMat, [[1, 0, 0], [1, 0, 1], [1, 1, 1]])]);;
gap> OneInverseOfSemigroupElement(S, S.1);
fail
gap> OneInverseOfSemigroupElement(S, S.1 * S.2 * S.1);
Matrix(IsBooleanMat, [[1, 1, 1], [1, 1, 1], [0, 0, 1]])

# OneInverseOfSemigroupElement, for a semigroup that cannot use Froidure-Pin
gap> S := Semigroup(SEMIGROUPS.UniversalFakeOne);;
gap> OneInverseOfSemigroupElement(S, S.1);
<universal fake one>

# OneInverseOfSemigroupElement, for an infinite semigroup, 1
gap> S := FreeSemigroup(1);
<free semigroup on the generators [ s1 ]>
gap> OneInverseOfSemigroupElementNC(S, S.1);
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `OneInverseOfSemigroupElementNC' on 2 ar\
guments

# attr: IdempotentGeneratedSubsemigroup, 2
gap> S := FullTransformationMonoid(3);;
gap> I := IdempotentGeneratedSubsemigroup(S);;
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
2 changes: 1 addition & 1 deletion tst/standard/semigroups/grpperm.tst
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ Group([ (1,3)(2,5)(4,6), (1,4,5)(2,6,3) ])
# IsomorphismPermGroup, infinite 1 / 1
gap> IsomorphismPermGroup(FreeMonoid(3));
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 3rd choice method found for `IsomorphismPermGroup' on 1 arguments
Error, no 2nd choice method found for `IsomorphismPermGroup' on 1 arguments

# IsomorphismPermGroup, for a block bijection semigroup
gap> S := Semigroup(Bipartition([[1, 2, -3, -4], [3, 4, -1, -2]]));;
Expand Down
3 changes: 1 addition & 2 deletions tst/standard/semigroups/semirms.tst
Original file line number Diff line number Diff line change
Expand Up @@ -2629,8 +2629,7 @@ gap> R := ReesZeroMatrixSemigroup(SymmetricGroup(4),
> [(), (2, 4, 3), (1, 2)]]);
<Rees 0-matrix semigroup 3x4 over Sym( [ 1 .. 4 ] )>
gap> IsomorphismPermGroup(R);
Error, the underlying semigroup of the argument (a subsemigroup of a Rees 0-m\
atrix semigroup) does not satisfy IsGroupAsSemigroup
Error, the argument (a semigroup) does not satisfy IsGroupAsSemigroup
gap> S := Semigroup(MultiplicativeZero(R));;
gap> IsomorphismPermGroup(S);
<subsemigroup of 3x4 Rees 0-matrix semigroup with 1 generator> -> Group(())
Expand Down
Loading