Skip to content

Commit

Permalink
semigrp: remove 2 unnec. methods after semigroups#841
Browse files Browse the repository at this point in the history
  • Loading branch information
james-d-mitchell committed Jun 15, 2022
1 parent 51df63a commit 478c365
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
22 changes: 4 additions & 18 deletions gap/semigroups/semigrp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ function(S, coll, opts)
# coll is copied here to avoid doing it repeatedly in
# ClosureSemigroupOrMonoidNC

if IsSemigroup(coll) then
if IsEmpty(coll) then
return S;
elif IsSemigroup(coll) then
coll := GeneratorsOfSemigroup(coll);
elif not IsList(coll) then
coll := AsList(coll);
Expand All @@ -437,7 +439,7 @@ function(S, coll, opts)
or not IsGeneratorsOfSemigroup(Concatenation(GeneratorsOfSemigroup(S),
coll)) then
ErrorNoReturn("the 1st argument (a semigroup) and the 2nd argument ",
"(a mult. elt. coll.) cannot be used to ",
"(a list or coll.) cannot be used to ",
"generate a semigroup");
fi;

Expand Down Expand Up @@ -518,22 +520,6 @@ function(Constructor, S, coll, opts)
return Constructor(S, coll, opts);
end);

# Both of these methods are required for ClosureSemigroup(NC) and an empty list
# because ClosureSemigroup might be called with an empty list, it might be that
# all of the elements in the collection passed to ClosureSemigroup already
# belong to the semigroup, in which case we call ClosureSemigroupNC with an
# empty list.

InstallMethod(ClosureSemigroup,
"for a semigroup, empty list or collection, and record",
[IsSemigroup, IsListOrCollection and IsEmpty, IsRecord],
{S, coll, opts} -> S);

InstallMethod(ClosureSemigroupOrMonoidNC,
"for a function, a semigroup, empty list, and record",
[IsFunction, IsSemigroup, IsList and IsEmpty, IsRecord],
{Construction, S, coll, opts} -> S);

#############################################################################
## 5. ClosureInverseSemigroup
#############################################################################
Expand Down
12 changes: 6 additions & 6 deletions tst/standard/semigroups/semigrp.tst
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ gap> x := Matrix(IsBooleanMat, [[1, 0, 0, 0], [1, 0, 0, 0], [1, 0, 1, 0],
gap> S := Semigroup(gens);
<semigroup of 5x5 boolean matrices with 5 generators>
gap> ClosureSemigroup(S, [x], SEMIGROUPS.OptionsRec(S));
Error, the 1st argument (a semigroup) and the 2nd argument (a mult. elt. coll.\
) cannot be used to generate a semigroup
Error, the 1st argument (a semigroup) and the 2nd argument (a list or coll.) c\
annot be used to generate a semigroup
gap> ClosureSemigroup(S, [IdentityTransformation],
> SEMIGROUPS.OptionsRec(S));
Error, the 1st argument (a semigroup) and the 2nd argument (a mult. elt. coll.\
) cannot be used to generate a semigroup
Error, the 1st argument (a semigroup) and the 2nd argument (a list or coll.) c\
annot be used to generate a semigroup

# ClosureSemigroup 2
gap> S := Semigroup(Transformation([2, 4, 3, 4]),
Expand Down Expand Up @@ -670,8 +670,8 @@ true
gap> S := Semigroup(Bipartition([[1, 3, -3], [2], [-1, -2]]),
> Bipartition([[1, -3], [2, 3, -1], [-2]]));;
gap> T := ClosureSemigroup(S, IdentityBipartition(4));
Error, the 1st argument (a semigroup) and the 2nd argument (a mult. elt. coll.\
) cannot be used to generate a semigroup
Error, the 1st argument (a semigroup) and the 2nd argument (a list or coll.) c\
annot be used to generate a semigroup

# ClosureSemigroup 4
gap> S := Semigroup(Bipartition([[1, 3, -3], [2], [-1, -2]]),
Expand Down

0 comments on commit 478c365

Please sign in to comment.