# IsRegularSemigroup for a RZMS

Issue #108 resolved
wilfwilson
created an issue

IsRegularSemigroup is returning the wrong answer for a RZMS:

```gap> t1 := Transformation( [ 4, 3, 1, 3 ] );;
gap> t2 := Transformation( [ 3, 3, 2, 2 ] );;
gap> T := Semigroup([ t1, t2 ]);;
gap> IsRegularSemigroup(T);
true
gap> IsGroup(T);
false
gap> mat := [ [ t2, t1 ], [ t1, t2 ] ];;
gap> R := ReesZeroMatrixSemigroup(T, mat);;
gap> IsRegularSemigroup(R);
false
gap> S := Range(IsomorphismTransformationSemigroup(R));;
gap> IsRegularSemigroup(S);
true
```

1. repo owner

This comes down to a bug in the library code for `IsIdempotent` for an element of Rees 0-matrix semigroup, there was the assumption that the RZMS was defined over a group. The following method fixes your example:

```IInstallMethod(IsIdempotent, "for a Rees 0-matrix semigroup element",
[IsReesZeroMatrixSemigroupElement],
function(x)
local R;

R:=ReesMatrixSemigroupOfFamily(FamilyObj(x));
if IsGroup(UnderlyingSemigroup(R)) then
# only for RZMS over groups!
return x![1]=0 or x![2]^-1=x![4][x![3]][x![1]];
else
return x ^ 2 = x;
fi;
end);
```
2. repo owner

It might also be worth noting that it takes nearly 3 seconds to return the answer `IsRegularSemigroup`. All the more reason we require a proper arbitrary semigroup enumerator!!

3. repo owner
• edited description

Making it more copy paste friendly

4. repo owner
• removed milestone

Removing milestone: 2.3 (automated comment)

5. reporter
• changed status to open

"This doesn't work in the semigroupe branch, and it should - JDM."