Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 6 additions & 6 deletions doc/cong.xml
Original file line number Diff line number Diff line change
Expand Up @@ -556,17 +556,17 @@ gap> cong := SemigroupCongruence(S, [Transformation([1, 2, 1]),
> Transformation([2, 1, 2])]);;
gap> classes := NonTrivialEquivalenceClasses(cong);;
gap> Set(classes);
[ <2-sided congruence class of Transformation( [ 1, 2, 2 ] )>,
<2-sided congruence class of Transformation( [ 3, 1, 1 ] )>,
<2-sided congruence class of Transformation( [ 3, 1, 3 ] )>,
[ <2-sided congruence class of Transformation( [ 3, 3, 3 ] )>,
<2-sided congruence class of Transformation( [ 2, 1, 2 ] )>,
<2-sided congruence class of Transformation( [ 3, 3, 3 ] )> ]
<2-sided congruence class of Transformation( [ 1, 2, 2 ] )>,
<2-sided congruence class of Transformation( [ 3, 1, 3 ] )>,
<2-sided congruence class of Transformation( [ 3, 1, 1 ] )> ]
gap> cong := RightSemigroupCongruence(S, [Transformation([1, 2, 1]),
> Transformation([2, 1, 2])]);;
gap> classes := NonTrivialEquivalenceClasses(cong);;
gap> Set(classes);
[ <right congruence class of Transformation( [ 3, 1, 3 ] )>,
<right congruence class of Transformation( [ 2, 1, 2 ] )> ]]]></Example>
[ <right congruence class of Transformation( [ 2, 1, 2 ] )>,
<right congruence class of Transformation( [ 3, 1, 3 ] )> ] ]]></Example>
</Description>
</ManSection>
<#/GAPDoc>
Expand Down
22 changes: 1 addition & 21 deletions gap/libsemigroups/cong.gi
Original file line number Diff line number Diff line change
Expand Up @@ -292,27 +292,6 @@ end);

# Methods for congruence classes

InstallMethod(\<,
"for congruence classes of CanUseLibsemigroupsCongruence", IsIdenticalObj,
[IsLeftRightOrTwoSidedCongruenceClass, IsLeftRightOrTwoSidedCongruenceClass],
1, # to beat the method in congruences/cong.gi for
# IsLeftRightOrTwoSidedCongruenceClass
function(class1, class2)
local C, word1, word2;

C := EquivalenceClassRelation(class1);
if not CanUseLibsemigroupsCongruence(C)
or not HasGeneratingPairsOfLeftRightOrTwoSidedCongruence(C) then
TryNextMethod();
elif C <> EquivalenceClassRelation(class2) then
return false;
fi;

word1 := Factorization(Range(C), Representative(class1));
word2 := Factorization(Range(C), Representative(class2));
return CongruenceReduce(C, word1) < CongruenceReduce(C, word2);
end);

InstallMethod(EquivalenceClasses,
"for CanUseLibsemigroupsCongruence with known generating pairs",
[CanUseLibsemigroupsCongruence and
Expand Down Expand Up @@ -405,3 +384,4 @@ function(cong, elm)
# Shouldn't be able to reach here
Assert(0, false);
end);

4 changes: 3 additions & 1 deletion gap/libsemigroups/froidure-pin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

DeclareGlobalFunction("LibsemigroupsFroidurePin");

DeclareProperty("CanUseLibsemigroupsFroidurePin", IsSemigroup);
# We increment the rank below so that CanUseLibsemigroupsFroidurePin is used in
# preference to CanUseGapFroidurePin, because o/w they have equal rank.
DeclareProperty("CanUseLibsemigroupsFroidurePin", IsSemigroup, 2);
DeclareOperation("HasLibsemigroupsFroidurePin", [IsSemigroup]);

DeclareOperation("FroidurePinMemFnRec", [IsSemigroup]);
Expand Down
30 changes: 16 additions & 14 deletions gap/libsemigroups/froidure-pin.gi
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,9 @@ end);
InstallMethod(Size, "for a semigroup with CanUseLibsemigroupsFroidurePin",
[IsSemigroup and CanUseLibsemigroupsFroidurePin],
function(S)
if not IsFinite(S) then
if IsFpSemigroup(S) or IsFpMonoid(S) or IsQuotientSemigroup(S) then
TryNextMethod();
elif not IsFinite(S) then
return infinity;
fi;
return FroidurePinMemFnRec(S).size(LibsemigroupsFroidurePin(S));
Expand All @@ -264,7 +266,7 @@ end);
###########################################################################

InstallMethod(AsSet, "for a semigroup with CanUseLibsemigroupsFroidurePin",
[IsSemigroup and CanUseLibsemigroupsFroidurePin],
[CanUseLibsemigroupsFroidurePin and HasGeneratorsOfSemigroup],
function(S)
local result, sorted_at, T, i;
if not IsFinite(S) then
Expand All @@ -288,7 +290,7 @@ end);

InstallMethod(AsListCanonical,
"for a semigroup with CanUseLibsemigroupsFroidurePin",
[IsSemigroup and CanUseLibsemigroupsFroidurePin],
[CanUseLibsemigroupsFroidurePin and HasGeneratorsOfSemigroup],
function(S)
local result, at, T, i;
if not IsFinite(S) then
Expand All @@ -309,7 +311,8 @@ end);

InstallMethod(AsList,
"for a semigroup with CanUseLibsemigroupsFroidurePin",
[IsSemigroup and CanUseLibsemigroupsFroidurePin], AsListCanonical);
[CanUseLibsemigroupsFroidurePin and HasGeneratorsOfSemigroup],
AsListCanonical);

###########################################################################
## Position etc
Expand Down Expand Up @@ -685,7 +688,7 @@ function(S)
or IsQuotientSemigroup(S) then
# Special case required because < for libsemigroups ParialPerms and < for
# GAP partial perms are different.
return AsSet(S);
return Set(AsList(S));
fi;

sorted_at := FroidurePinMemFnRec(S).sorted_at;
Expand Down Expand Up @@ -726,6 +729,7 @@ function(S)

T := LibsemigroupsFroidurePin(S);

# TODO shouldn't S be stored in enum?
enum := rec();

enum.NumberElement := {enum, x} -> PositionCanonical(S, x);
Expand All @@ -739,6 +743,7 @@ function(S)
return EvaluateWord(GeneratorsOfSemigroup(S),
factorisation(T, nr - 1) + 1);
end;
enum.Length := _ -> Size(S);
else
at := FroidurePinMemFnRec(S).at;
enum.ElementNumber := function(enum, nr)
Expand All @@ -748,16 +753,13 @@ function(S)
return at(T, nr - 1);
fi;
end;
fi;

# TODO shouldn't S be stored in enum?
enum.Length := function(_)
if not IsFinite(S) then
return infinity;
else
enum.Length := function(_)
if not IsFinite(S) then
return infinity;
fi;
return Size(S);
fi;
end;
end;
fi;

enum.Membership := {x, enum} -> PositionCanonical(S, x) <> fail;

Expand Down
4 changes: 3 additions & 1 deletion gap/semigroups/semifp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,9 @@ end);

InstallMethod(ViewObj, "for an f.p. monoid with known generators",
[IsFpMonoid and HasGeneratorsOfMonoid],
4, # to beat the library method
RankFilter(IsSubmonoidFpMonoid and IsWholeFamily and IsMonoid
and HasGeneratorsOfMagma) - RankFilter(IsFpMonoid and HasGeneratorsOfMonoid)
+ 1, # to beat the library method
function(M)
if UserPreference("semigroups", "ViewObj") <> "semigroups-pkg" then
TryNextMethod();
Expand Down
4 changes: 4 additions & 0 deletions gap/semigroups/semiquo.gi
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ function(cong)
fi;
return QuotientSemigroupHomomorphism(Q);
end);

InstallMethod(Size, "for a quotient semigroup with known congruence",
[IsQuotientSemigroup and HasQuotientSemigroupCongruence],
Q -> NrEquivalenceClasses(QuotientSemigroupCongruence(Q)));
12 changes: 6 additions & 6 deletions tst/extreme/cong.tst
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@ gap> v := SemigroupCongruence(s, [gens[1], gens[1]]); # trivial congruence
<2-sided semigroup congruence over <commutative non-regular transformation
semigroup of size 5, degree 10 with 1 generator> with 0 generating pairs>
gap> classes := Set(EquivalenceClasses(v));
[ <2-sided congruence class of Transformation( [ 2, 6, 7, 2, 6, 9, 9, 1, 1,
5 ] )>, <2-sided congruence class of Transformation( [ 6, 9, 9, 6, 9, 1,
1, 2, 2, 6 ] )>, <2-sided congruence class of Transformation( [ 9, 1, 1,
9, 1, 2, 2, 6, 6, 9 ] )>,
<2-sided congruence class of Transformation( [ 1, 2, 2, 1, 2, 6, 6, 9, 9,
[ <2-sided congruence class of Transformation( [ 1, 2, 2, 1, 2, 6, 6, 9, 9,
1 ] )>, <2-sided congruence class of Transformation( [ 2, 6, 6, 2, 6, 9,
9, 1, 1, 2 ] )> ]
9, 1, 1, 2 ] )>, <2-sided congruence class of Transformation( [ 2, 6, 7,
2, 6, 9, 9, 1, 1, 5 ] )>,
<2-sided congruence class of Transformation( [ 6, 9, 9, 6, 9, 1, 1, 2, 2,
6 ] )>, <2-sided congruence class of Transformation( [ 9, 1, 1, 9, 1, 2,
2, 6, 6, 9 ] )> ]
gap> ForAny(EquivalenceClasses(u), x -> x in classes);
false
gap> classes[1] * EquivalenceClasses(u)[1];
Expand Down
6 changes: 3 additions & 3 deletions tst/standard/congruences/cong.tst
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ false
gap> class1c < class1a;
true
gap> class1a < class2;
false
true

# IsSuperrelation
gap> S := Semigroup(
Expand Down Expand Up @@ -393,8 +393,8 @@ gap> S := FullTransformationMonoid(3);;
gap> I := SemigroupIdeal(S, Transformation([1, 1, 2]));;
gap> cong := ReesCongruenceOfSemigroupIdeal(I);;
gap> EquivalenceRelationLookup(cong);
[ 1, 2, 3, 11, 5, 6, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11 ]
[ 1, 2, 3, 4, 5, 6, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4 ]
gap> EquivalenceRelationCanonicalLookup(cong);
[ 1, 2, 3, 4, 5, 6, 4, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4 ]
Expand Down
14 changes: 7 additions & 7 deletions tst/standard/congruences/congpairs.tst
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ true
gap> Size(GeneratingPairsOfSemigroupCongruence(v));
0
gap> classes := Set(EquivalenceClasses(v));
[ <2-sided congruence class of Transformation( [ 2, 6, 7, 2, 6, 9, 9, 1, 1,
5 ] )>, <2-sided congruence class of Transformation( [ 6, 9, 9, 6, 9, 1,
1, 2, 2, 6 ] )>, <2-sided congruence class of Transformation( [ 9, 1, 1,
9, 1, 2, 2, 6, 6, 9 ] )>,
<2-sided congruence class of Transformation( [ 1, 2, 2, 1, 2, 6, 6, 9, 9,
[ <2-sided congruence class of Transformation( [ 1, 2, 2, 1, 2, 6, 6, 9, 9,
1 ] )>, <2-sided congruence class of Transformation( [ 2, 6, 6, 2, 6, 9,
9, 1, 1, 2 ] )> ]
9, 1, 1, 2 ] )>, <2-sided congruence class of Transformation( [ 2, 6, 7,
2, 6, 9, 9, 1, 1, 5 ] )>,
<2-sided congruence class of Transformation( [ 6, 9, 9, 6, 9, 1, 1, 2, 2,
6 ] )>, <2-sided congruence class of Transformation( [ 9, 1, 1, 9, 1, 2,
2, 6, 6, 9 ] )> ]
gap> EquivalenceClasses(u)[1] in classes;
false
gap> classes[1] * EquivalenceClasses(u)[1];
Expand All @@ -128,7 +128,7 @@ true
gap> classes[2] = classes[3];
false
gap> AsList(classes[4]);
[ Transformation( [ 1, 2, 2, 1, 2, 6, 6, 9, 9, 1 ] ) ]
[ Transformation( [ 6, 9, 9, 6, 9, 1, 1, 2, 2, 6 ] ) ]
gap> Size(classes[4]);
1

Expand Down
4 changes: 2 additions & 2 deletions tst/standard/congruences/congrees.tst
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ gap> cong := ReesCongruenceOfSemigroupIdeal(I);
<Rees congruence of <regular transformation semigroup ideal of degree 3 with
1 generator> over <full transformation monoid of degree 3>>
gap> EquivalenceRelationLookup(cong);
[ 1, 2, 3, 11, 5, 6, 11, 8, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11 ]
[ 1, 2, 3, 4, 5, 6, 4, 8, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4 ]
gap> EquivalenceRelationCanonicalLookup(cong);
[ 1, 2, 3, 4, 5, 6, 4, 7, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4 ]
Expand Down
8 changes: 4 additions & 4 deletions tst/standard/libsemigroups/cong.tst
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,9 @@ gap> C := LeftSemigroupCongruence(S, [[S.1, S.1 ^ 10]]);
<left semigroup congruence over <free band on the generators [ x1, x2 ]> with
0 generating pairs>
gap> AsSSortedList(EquivalenceClasses(C));
[ <left congruence class of x1>, <left congruence class of x2x1>,
<left congruence class of x1x2x1>, <left congruence class of x2>,
<left congruence class of x1x2>, <left congruence class of x2x1x2> ]
[ <left congruence class of x1>, <left congruence class of x2x1x2>,
<left congruence class of x2x1>, <left congruence class of x2>,
<left congruence class of x1x2>, <left congruence class of x1x2x1> ]
gap> D := LeftSemigroupCongruence(S, [[S.1, S.2 ^ 10]]);
<left semigroup congruence over <free band on the generators [ x1, x2 ]> with
1 generating pairs>
Expand All @@ -218,7 +218,7 @@ gap> u := Image(hom, Transformation([1, 1, 1, 1]));
gap> t := Image(hom, Transformation([2, 1, 2, 3]));
<2-sided congruence class of Transformation( [ 2, 1, 2, 3 ] )>
gap> t < u;
true
false

# EquivalenceClasses for a congruence with infinitely many classes
gap> S := FreeSemigroup(2);
Expand Down
46 changes: 23 additions & 23 deletions tst/standard/semigroups/semiquo.tst
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ gap> IrredundantGeneratingSubset(S / cong);
[20,17][29,32][30,31](1,4)(2,3)(5,8)(6,7)> ]
gap> SmallSemigroupGeneratingSet(S / cong);
[ <2-sided congruence class of <identity partial perm on [ 1, 2, 3, 4 ]>>,
<2-sided congruence class of (1,3)(2,4)(21,23)(22,24)(25,27)(26,28)(33,35)
(34,36)>, <2-sided congruence class of (1,2)(3,4)(5,6)(7,8)(11,12)(13,14)
(19,20)(29,30)> ]
<2-sided congruence class of (1,2)(3,4)(5,6)(7,8)(11,12)(13,14)(19,20)
(29,30)>, <2-sided congruence class of (1,3)(2,4)(21,23)(22,24)(25,27)
(26,28)(33,35)(34,36)> ]
gap> GeneratorsSmallest(S / cong);
[ <2-sided congruence class of <identity partial perm on [ 1, 2, 3, 4 ]>>,
<2-sided congruence class of (1,2)(3,4)(5,6)(7,8)(11,12)(13,14)(19,20)
(29,30)>, <2-sided congruence class of [11,10][12,9][13,16][14,15][19,18]
[20,17][29,32][30,31](1,4)(2,3)(5,8)(6,7)> ]
(29,30)>, <2-sided congruence class of (1,3)(2,4)(21,23)(22,24)(25,27)
(26,28)(33,35)(34,36)> ]

# Issue 816 - Subsemigroups of quotient semigroups
gap> S := Semigroup(Transformation([2, 1, 5, 1, 5]),
Expand Down Expand Up @@ -211,8 +211,8 @@ true
gap> Factorization(H, images[2]);
[ 2 ]
gap> map := IsomorphismFpSemigroup(T);
<quotient of <2-sided semigroup congruence over <transformation semigroup of
degree 5 with 3 generators> with 1 generating pairs>> ->
<quotient of <2-sided semigroup congruence over <transformation semigroup
of size 59, degree 5 with 3 generators> with 1 generating pairs>> ->
<fp semigroup with 3 generators and 8 relations of length 33>
gap> map := IsomorphismFpSemigroup(Q);
<semigroup of size 4, with 3 generators> ->
Expand All @@ -234,42 +234,42 @@ gap> Q := S / cong;
degree 5 with 3 generators> with 1 generating pairs>>
gap> CongruencesOfSemigroup(Q);
[ <2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <transformation semigroup of degree 5 with 3 generators> with
e over <transformation semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 0 generating pairs>,
<universal semigroup congruence over <quotient of <2-sided semigroup congrue\
nce over <transformation semigroup of degree 5 with 3 generators> with
1 generating pairs>>>,
nce over <transformation semigroup of size 59, degree 5 with 3 generators>
with 1 generating pairs>>>,
<2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <transformation semigroup of degree 5 with 3 generators> with
e over <transformation semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs>,
<2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <transformation semigroup of degree 5 with 3 generators> with
e over <transformation semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs>,
<2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <transformation semigroup of degree 5 with 3 generators> with
e over <transformation semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs>,
<2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <transformation semigroup of degree 5 with 3 generators> with
e over <transformation semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs> ]
gap> map := QuotientSemigroupHomomorphism(Q);
<transformation semigroup of degree 5 with 3 generators> ->
<quotient of <2-sided semigroup congruence over <transformation semigroup of
degree 5 with 3 generators> with 1 generating pairs>>
<transformation semigroup of size 59, degree 5 with 3 generators> ->
<quotient of <2-sided semigroup congruence over <transformation semigroup
of size 59, degree 5 with 3 generators> with 1 generating pairs>>
gap> Q := Q / SemigroupCongruence(Q,
> [[Transformation([2, 1, 5, 1, 5]) ^ map,
> Transformation([2, 5, 3, 5, 3]) ^ map]]);
<quotient of <2-sided semigroup congruence over <quotient of <2-sided semigrou\
p congruence over <transformation semigroup of degree 5 with 3 generators>
with 1 generating pairs>> with 1 generating pairs>>
p congruence over <transformation semigroup of size 59, degree 5 with 3
generators> with 1 generating pairs>> with 1 generating pairs>>
gap> CongruencesOfSemigroup(Q);
[ <2-sided semigroup congruence over <quotient of <2-sided semigroup congruenc\
e over <quotient of <2-sided semigroup congruence over <transformation
semigroup of degree 5 with 3 generators> with 1 generating pairs>> with
1 generating pairs>> with 0 generating pairs>,
semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs>> with 0 generating pairs>,
<universal semigroup congruence over <quotient of <2-sided semigroup congrue\
nce over <quotient of <2-sided semigroup congruence over <transformation
semigroup of degree 5 with 3 generators> with 1 generating pairs>> with
1 generating pairs>>> ]
semigroup of size 59, degree 5 with 3 generators> with
1 generating pairs>> with 1 generating pairs>>> ]
gap> Size(Q);
2

Expand Down
2 changes: 1 addition & 1 deletion tst/testinstall.tst
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,7 @@ gap> x := ReesZeroMatrixSemigroupElement(R, 1, (1, 3), 1);;
gap> y := ReesZeroMatrixSemigroupElement(R, 1, (), 1);;
gap> cong := SemigroupCongruenceByGeneratingPairs(R, [[x, y]]);;
gap> c := Set(EquivalenceClasses(cong));
[ <2-sided congruence class of (1,(),1)>, <2-sided congruence class of 0>,
[ <2-sided congruence class of 0>, <2-sided congruence class of (1,(),1)>,
<2-sided congruence class of (1,(),2)>,
<2-sided congruence class of (1,(),3)>,
<2-sided congruence class of (1,(),4)>,
Expand Down
Loading