From 191658929383c9d1d5551537a9317ddc85169396 Mon Sep 17 00:00:00 2001 From: Wilf Wilson Date: Tue, 24 Jan 2017 18:15:45 +0000 Subject: [PATCH 1/2] attr: add IdempotentGeneratedSubsemigroup methods for RMS & RZMS --- gap/attributes/attr.gi | 73 ++++++++++++ tst/standard/attr.tst | 262 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 335 insertions(+) diff --git a/gap/attributes/attr.gi b/gap/attributes/attr.gi index acd428875..e7b6fdbf6 100644 --- a/gap/attributes/attr.gi +++ b/gap/attributes/attr.gi @@ -555,6 +555,79 @@ function(S) return out; end); +InstallMethod(IdempotentGeneratedSubsemigroup, +"for a Rees matrix subsemigroup", +[IsReesMatrixSubsemigroup], +function(R) + local mat, I, J, nrrows, nrcols, min, max, gens, out, i; + + if not IsFinite(R) or not IsReesMatrixSemigroup(R) + or not IsGroup(UnderlyingSemigroup(R)) then + TryNextMethod(); + fi; + + mat := Matrix(R); + I := Rows(R); + J := Columns(R); + nrrows := Length(I); + nrcols := Length(J); + + min := Minimum(nrrows, nrcols); + max := Maximum(nrrows, nrcols); + gens := EmptyPlist(max); + for i in [1 .. min] do + Add(gens, RMSElement(R, I[i], mat[J[i]][I[i]] ^ -1, J[i])); + od; + for i in [min + 1 .. nrrows] do + Add(gens, RMSElement(R, I[i], mat[J[1]][I[i]] ^ -1, J[1])); + od; + for i in [min + 1 .. nrcols] do + Add(gens, RMSElement(R, I[1], mat[J[i]][I[1]] ^ -1, J[i])); + od; + out := Semigroup(gens); + SetIsRegularSemigroup(out, true); + SetIsIdempotentGenerated(out, true); + SetIsSimpleSemigroup(out, true); + return out; +end); + +InstallMethod(IdempotentGeneratedSubsemigroup, +"for a Rees 0-matrix subsemigroup", +[IsReesZeroMatrixSubsemigroup], +function(R) + local mat, gr, gens, I, J, nrrows, k, out, i, j; + + if not IsFinite(R) or not IsReesZeroMatrixSemigroup(R) + or not IsGroup(UnderlyingSemigroup(R)) then + TryNextMethod(); + fi; + + mat := Matrix(R); + gr := RZMSDigraph(R); + gens := []; + + if IsCompleteBipartiteDigraph(ReducedDigraph(gr)) or IsEmptyDigraph(gr) then + Add(gens, MultiplicativeZero(R)); + fi; + + gr := OutNeighbours(UndirectedSpanningForest(gr)); + I := Rows(R); + J := Columns(R); + nrrows := Length(I); + + for i in [1 .. nrrows] do + for j in gr[i] do + k := J[j - nrrows]; + Add(gens, RMSElement(R, I[i], mat[k][I[i]] ^ -1, k)); + od; + od; + + out := Semigroup(gens); + SetIsRegularSemigroup(out, true); + SetIsIdempotentGenerated(out, true); + return out; +end); + InstallMethod(InjectionPrincipalFactor, "for a Green's D-class (Semigroups)", [IsGreensDClass], function(D) diff --git a/tst/standard/attr.tst b/tst/standard/attr.tst index 5f68a65db..0f498578e 100644 --- a/tst/standard/attr.tst +++ b/tst/standard/attr.tst @@ -1400,6 +1400,268 @@ Error, no method found! For debugging hints type ?Recovery from NoMethodFound Error, no 2nd choice method found for `InversesOfSemigroupElementNC' on 2 argu\ ments +#T# attr: IdempotentGeneratedSubsemigroup, 2 +gap> S := FullTransformationMonoid(3);; +gap> I := IdempotentGeneratedSubsemigroup(S);; +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true + +#T# attr: IdempotentGeneratedSubsemigroup, for an Rees matrix semigroup, 1 +# TryNextMethod() + +# Error: infinite +gap> S := FreeSemigroup(1); + +gap> R := ReesMatrixSemigroup(S, [[S.1]]); +> +gap> IdempotentGeneratedSubsemigroup(R); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 4th choice method found for `IdempotentGeneratedSubsemigroup' on 1 a\ +rguments + +# not a Rees matrix semigroup +gap> x := Transformation([2, 2]);; +gap> R := ReesMatrixSemigroup(FullTransformationMonoid(2), +> [[IdentityTransformation, x], +> [x, x]]); +> +gap> S := Semigroup(RMSElement(R, 1, IdentityTransformation, 1), +> RMSElement(R, 2, IdentityTransformation, 2)); + +gap> IsReesMatrixSubsemigroup(S); +true +gap> IsReesMatrixSemigroup(S); +false +gap> I := IdempotentGeneratedSubsemigroup(S);; +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> Size(I) = 5; +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +# not over a group +gap> x := Transformation([2, 2]);; +gap> R := ReesMatrixSemigroup(FullTransformationMonoid(2), +> [[IdentityTransformation, x], +> [x, x]]); +> +gap> I := IdempotentGeneratedSubsemigroup(R);; +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> Size(I) = 9; +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +#T# attr: IdempotentGeneratedSubsemigroup, for an Rees matrix semigroup, 2 + +# Rectangular bands +gap> R := RectangularBand(IsReesMatrixSemigroup, 1, 1); + +gap> I := IdempotentGeneratedSubsemigroup(R); + +gap> I = R; +true +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> R := RectangularBand(IsReesMatrixSemigroup, 3, 1); + +gap> I := IdempotentGeneratedSubsemigroup(R); + +gap> I = R; +true +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> R := RectangularBand(IsReesMatrixSemigroup, 1, 3); + +gap> I := IdempotentGeneratedSubsemigroup(R); + +gap> I = R; +true +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> R := RectangularBand(IsReesMatrixSemigroup, 2, 2); + +gap> I := IdempotentGeneratedSubsemigroup(R); + +gap> I = R; +true +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +# Subsemigroup, giving non-standard matrix +gap> x := [[(2, 3, 5), (1, 2, 4)(3, 5), (1, 3, 5, 2, 4)], +> [(1, 3, 5, 4), (2, 3, 5, 4), (1, 3, 5)(2, 4)], +> [(2, 3, 5), (1, 5, 4, 3, 2), ()], +> [(1, 4, 2, 5), (1, 2)(3, 5), (1, 5, 3, 2, 4)], +> [(1, 4)(2, 3, 5), (1, 2)(4, 5), (1, 3, 4, 2, 5)]];; +gap> G := SymmetricGroup(5);; +gap> R := ReesMatrixSemigroup(G, x); + +gap> S := ReesMatrixSubsemigroup(R, [2], G, [4]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> GeneratorsOfSemigroup(I); +[ (2,(1,2)(3,5),4) ] +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> S := ReesMatrixSubsemigroup(R, [2], G, [3, 4, 5]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> GeneratorsOfSemigroup(I); +[ (2,(1,2,3,4,5),3), (2,(1,2)(3,5),4), (2,(1,2)(4,5),5) ] +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> S := ReesMatrixSubsemigroup(R, [2, 3], G, [4]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> GeneratorsOfSemigroup(I); +[ (2,(1,2)(3,5),4), (3,(1,4,2,3,5),4) ] +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> S := ReesMatrixSubsemigroup(R, [2, 3], G, [4, 5]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> GeneratorsOfSemigroup(I); +[ (2,(1,2)(3,5),4), (3,(1,5,2,4,3),5) ] +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +#T# attr: IdempotentGeneratedSubsemigroup, for an Rees 0-matrix semigroup, 1 +# TryNextMethod() + +# Error: infinite +gap> S := FreeSemigroup(1); + +gap> R := ReesZeroMatrixSemigroup(S, [[S.1]]); +> +gap> IdempotentGeneratedSubsemigroup(R); +Error, no method found! For debugging hints type ?Recovery from NoMethodFound +Error, no 4th choice method found for `IdempotentGeneratedSubsemigroup' on 1 a\ +rguments + +# not a Rees matrix semigroup +gap> x := Transformation([2, 2]);; +gap> R := ReesZeroMatrixSemigroup(FullTransformationMonoid(2), +> [[IdentityTransformation, 0], +> [0, x]]); +> +gap> S := Semigroup(RMSElement(R, 1, IdentityTransformation, 1), +> RMSElement(R, 2, IdentityTransformation, 2)); + +gap> IsReesZeroMatrixSubsemigroup(S); +true +gap> IsReesZeroMatrixSemigroup(S); +false +gap> I := IdempotentGeneratedSubsemigroup(S);; +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> Size(I) = 3; +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +# not over a group +gap> x := Transformation([2, 2]);; +gap> R := ReesZeroMatrixSemigroup(FullTransformationMonoid(2), +> [[IdentityTransformation, 0], +> [x, x]]); +> +gap> I := IdempotentGeneratedSubsemigroup(R);; +gap> HasIsIdempotentGenerated(I); +true +gap> IsIdempotentGenerated(I); +true +gap> Size(I) = 10; +true +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true + +#T# attr: IdempotentGeneratedSubsemigroup, for an Rees 0-matrix semigroup, 2 + +# Subsemigroup, giving non-standard matrix, 1 +gap> R := ReesZeroMatrixSemigroup(Group(()), [[(), ()], [(), ()]]); + +gap> S := Semigroup(RMSElement(R, 2, (), 2), MultiplicativeZero(R)); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> I = S; +true +gap> Elements(I); +[ 0, (2,(),2) ] + +# Subsemigroup, giving non-standard matrix, 2 +gap> x := [[(1, 3, 5)(2, 4), (1, 4, 3, 2, 5), (1, 3, 5)(2, 4)], +> [(2, 4, 5, 3), 0, (1, 4, 5, 3)], +> [(3, 5, 4), 0, (1, 4, 5)(2, 3)], +> [0, 0, (1, 3, 4, 2)], +> [(2, 3, 4), (1, 2, 5, 4, 3), (1, 5, 3)(2, 4)]];; +gap> G := SymmetricGroup(5);; +gap> R := ReesZeroMatrixSemigroup(G, x); + +gap> S := ReesZeroMatrixSubsemigroup(R, [2], G, [4]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> I = Semigroup(Idempotents(S)); +true +gap> S := ReesZeroMatrixSubsemigroup(R, [2], G, [3, 4, 5]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> I = Semigroup(Idempotents(S)); +true +gap> S := ReesZeroMatrixSubsemigroup(R, [2, 3], G, [4]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> I = Semigroup(Idempotents(S)); +true +gap> S := ReesZeroMatrixSubsemigroup(R, [2, 3], G, [4, 5]); + +gap> I := IdempotentGeneratedSubsemigroup(S); + +gap> ForAll(GeneratorsOfSemigroup(I), IsIdempotent); +true +gap> I = Semigroup(Idempotents(S)); +true + #T# SEMIGROUPS_UnbindVariables gap> Unbind(D); gap> Unbind(G); From 4d17f8211606a30d2879d79ca2187e5ba1dfbe22 Mon Sep 17 00:00:00 2001 From: Wilf Wilson Date: Tue, 24 Jan 2017 18:36:31 +0000 Subject: [PATCH 2/2] maximal: Use IdempotentGeneratedSubsemigroup to improve maximals code --- gap/attributes/maximal.gi | 9 ++++++--- tst/extreme/maximal.tst | 2 +- tst/standard/maximal.tst | 20 ++++++++++++++------ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/gap/attributes/maximal.gi b/gap/attributes/maximal.gi index f195a23a9..0513aeac8 100644 --- a/gap/attributes/maximal.gi +++ b/gap/attributes/maximal.gi @@ -1061,10 +1061,13 @@ function(R, opts) if not failed and not opts.number then Info(InfoSemigroups, 2, "...creating these maximal subsemigroups."); - # TODO only need generating set for idempotents - don't not *every* idem - idems := ShallowCopy(Idempotents(R)); + idems := GeneratorsOfSemigroup(IdempotentGeneratedSubsemigroup(R)); + idems := ShallowCopy(idems); if not opts.zero or not IsCompleteBipartiteDigraph(RZMSDigraph(R_n)) then - Remove(idems, Position(idems, zero)); + x := Position(idems, zero); + if x <> fail then + Remove(idems, x); + fi; fi; # Max subsemigroup arising from <--> Transversal of diff --git a/tst/extreme/maximal.tst b/tst/extreme/maximal.tst index 376d3ad77..6826efe0f 100644 --- a/tst/extreme/maximal.tst +++ b/tst/extreme/maximal.tst @@ -281,7 +281,7 @@ gap> max := MaximalSubsemigroups(R1); , , , - ] + ] gap> NrMaximalSubsemigroups(R1); 26 diff --git a/tst/standard/maximal.tst b/tst/standard/maximal.tst index c2c0963e5..ee1acbf80 100644 --- a/tst/standard/maximal.tst +++ b/tst/standard/maximal.tst @@ -348,10 +348,10 @@ gap> MaximalSubsemigroups(R); , , , - , - , - , - ] + , + , + , + ] # Easy example, 1x1 gap> R := ReesZeroMatrixSemigroup(SymmetricGroup(2), [[()]]); @@ -524,7 +524,7 @@ gap> MaximalSubsemigroups(R, rec(contain := [x])); [ , , , - ] + ] gap> MaximalSubsemigroups(R, rec(D := DClass(R, x), number := true)); 7 gap> MaximalSubsemigroups(R, rec(D := DClass(R, MultiplicativeZero(R)), @@ -558,6 +558,14 @@ gap> MaximalSubsemigroups(R, rec(types := [5, 6], [ , ] +#T# maximal: MaximalSubsemigroups, for a Rees 0-matrix semigroup, 13 +gap> R := ReesZeroMatrixSemigroup(SymmetricGroup(2), [[(), 0], [0, ()]]); + +gap> SetIdempotentGeneratedSubsemigroup(R, Semigroup(Idempotents(R))); +gap> MaximalSubsemigroups(R, rec(types := [6])); +[ , + ] + #T# maximal: MaximalSubsemigroups, for Rees 0-matrix subsemigroup, 1 gap> R := ReesZeroMatrixSemigroup(SymmetricGroup(2), [[0, 0]]); @@ -590,7 +598,7 @@ gap> MaximalSubsemigroups(U); , , , - ] + ] #T# maximal: MaximalSubsemigroups, for a permutation group, 1 gap> MaximalSubsemigroups(SymmetricGroup(3));