@@ -69,21 +69,22 @@ InstallMethod( ViewString,
6969InstallOtherMethod(MonoidByGenerators, " for a collection" ,
7070[ IsCollection] ,
7171function (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
0 commit comments