Skip to content

Commit 1b12a0e

Browse files
committed
Don't use One on collections that are not domains
1 parent ab576a6 commit 1b12a0e

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/monoid.gi

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,22 @@ InstallMethod( ViewString,
6969
InstallOtherMethod(MonoidByGenerators, "for a collection",
7070
[IsCollection],
7171
function(gens)
72-
local M, pos;
72+
local M, pos, one;
7373

7474
M := Objectify(NewType(FamilyObj(gens), IsMonoid
7575
and IsAttributeStoringRep), rec());
7676
gens := AsList(gens);
7777

7878
if CanEasilyCompareElements(gens) and IsFinite(gens)
7979
and IsMultiplicativeElementWithOneCollection(gens) then
80-
SetOne(M, One(gens));
81-
pos := Position(gens, One(gens));
80+
one := One(Representative(gens));
81+
SetOne(M, one);
82+
pos := Position(gens, one);
8283
if pos <> fail then
8384
SetGeneratorsOfMagma(M, gens);
84-
if Length(gens) = 1 then # Length(gens) <> 0 since One(gens) in gens
85+
if Length(gens) = 1 then # Length(gens) <> 0 since one in gens
8586
SetIsTrivial(M, true);
86-
elif not IsPartialPermCollection(gens) or One(gens) =
87+
elif not IsPartialPermCollection(gens) or one =
8788
One(gens{Concatenation([1 .. pos - 1], [pos + 1 .. Length(gens)])}) then
8889
# if gens = [PartialPerm([1,2]), PartialPerm([1])], then removing the One
8990
# = gens[1] from this, it is not possible to recreate the semigroup using
@@ -93,7 +94,7 @@ function(gens)
9394
Remove(gens, pos);
9495
fi;
9596
else
96-
SetGeneratorsOfMagma(M, Concatenation([One(gens)], gens));
97+
SetGeneratorsOfMagma(M, Concatenation([one], gens));
9798
fi;
9899
fi;
99100

lib/semigrp.gi

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ InstallMethod(SemigroupByGenerators,
492492
"for a collection",
493493
[IsCollection],
494494
function(gens)
495-
local S, pos;
495+
local S, pos, one;
496496

497497
S := Objectify(NewType(FamilyObj(gens), IsSemigroup
498498
and IsAttributeStoringRep), rec());
@@ -502,12 +502,13 @@ function(gens)
502502
if IsMultiplicativeElementWithOneCollection(gens)
503503
and CanEasilyCompareElements(gens)
504504
and IsFinite(gens) then
505-
pos := Position(gens, One(gens));
505+
one := One(Representative(gens));
506+
pos := Position(gens, one);
506507
if pos <> fail then
507508
SetFilterObj(S, IsMonoid);
508-
if Length(gens) = 1 then # Length(gens) <> 0 since One(gens) in gens
509+
if Length(gens) = 1 then # Length(gens) <> 0 since one in gens
509510
SetIsTrivial(S, true);
510-
elif not IsPartialPermCollection(gens) or One(gens) =
511+
elif not IsPartialPermCollection(gens) or one =
511512
One(gens{Concatenation([1 .. pos - 1], [pos + 1 .. Length(gens)])}) then
512513
# if gens = [PartialPerm([1, 2]), PartialPerm([1])], then removing the One
513514
# = gens[1] from this, it is not possible to recreate the semigroup using

0 commit comments

Comments
 (0)