<Section Label="Rees Matrix Semigroups">
  <Heading>Rees Matrix Semigroups</Heading>
    
  In this section, we describe the functions in &GAP; for Rees matrix
  and 0-matrix semigroups and their subsemigroups.  The importance of these
  semigroups lies in the fact that Rees matrix semigroups over groups are
  exactly the completely simple semigroups, and Rees 0-matrix semigroups over
  groups are the completely 0-simple semigroups.  <P/>

  Let <M>I</M> and <M>J</M> be sets, let <M>S</M> be a semigroup, and let
  <M>P=(p_{ji})_{j\in J, i\in I}</M> be a <M>|J|\times |I|</M> matrix with
  entries in <M>S</M>. Then the <E>Rees matrix semigroup</E> with underlying
  semigroup <M>S</M> and matrix <M>P</M> is just the direct product 
  <M>I\times S \times J</M> with multiplication defined by 
  <Display>(i, s, j)(k, t, l)=(i,s\cdot p_{j,k}\cdot t, l).</Display>

  Rees 0-matrix semigroups are defined as follows. If <M>I</M>, <M>J</M>,
  <M>S</M>, and <M>P</M> are as above and <M>0</M> denotes a new element, then
  the <E>Rees 0-matrix semigroup</E> with underlying semigroup <M>S</M> and
  matrix <M>P</M> is <M>(I\times S\times J)\cup \{0\}</M> with multiplication
  defined by 
  <Display>(i, s, j)(k, t, l)=(i, s\cdot p_{j,k}\cdot t, l)</Display> 
  when <M>p_{j,k}</M> is not <M>0</M> and <M>0</M> if <M>p_{j,k}</M> is 0.<P/>

  If <M>R</M> is a Rees matrix or 0-matrix semigroup, then the <E>rows</E> of
  <M>R</M> is the index set <M>I</M>, the <E>columns</E> of <M>R</M> is the
  index set <M>J</M>, the semigroup <M>S</M> is the <E>underlying semigroup</E>
  of <M>R</M>, and the <E>matrix</E> <M>P</M> is the matrix of <M>S</M>. <P/>

  Thoroughout this section, wherever the distinction is unimportant, we will
  refer to Rees matrix or 0-matrix semigroups collectively as Rees matrix
  semigroups.<P/>

  Multiplication of elements of a Rees matrix semigroup obviously depends on
  the matrix used to create the semigroup. Hence elements of a Rees matrix
  semigroup can only be created with reference to the semigroup to which they
  belong. More specifically, every collection or semigroup of Rees matrix
  semigroup elements is created from a specific Rees matrix semigroup, which
  contains the whole family of its elements.  So, it is not possible to
  multiply or compare elements belonging to distinct Rees matrix semigroups, 
  since they belong to different families. This situation is similar to, say,
  free groups, and different to, say, permutations, which belong to a single
  family, and where arbitrary permutations can be compared and multiplied
  without reference to any group containing them. <P/>

  A subsemigroup of a Rees matrix semigroup is not necessarily a Rees matrix
  semigroup.  Every semigroup consisting of elements of a Rees matrix semigroup
  satisfies the property <Ref Attr="IsReesMatrixSubsemigroup"/> and every
  semigroup of Rees 0-matrix semigroup elements satisfies 
  <Ref Attr="IsReesZeroMatrixSubsemigroup"/>. <P/>
    
  Rees matrix and 0-matrix semigroups can be created using the operations 
  <Ref Oper="ReesMatrixSemigroup"/> and <Ref Oper="ReesZeroMatrixSemigroup"/>,
  respectively, from an underlying semigroup and a matrix. Rees matrix
  semigroups created in this way contain the whole family of their elements.
  Every element of a Rees matrix semigroup belongs to a unique semigroup
  created in this way; every subsemigroup of a Rees matrix semigroup
  is a subsemigroup of a unique semigroup created in this way.<P/>

  Subsemigroups of Rees matrix semigroups can also be created by specifying
  generators. A subsemigroup of a Rees matrix semigroup <M>I\times U\times J</M>
  satisfies <Ref Prop="IsReesMatrixSemigroup"/> if and only if it is equal to 
  <M>I'\times U'\times J'</M> where <M>I'\subseteq I</M>, <M>J'\subseteq J</M>,
      and <M>U'</M> is a subsemigroup of <M>U</M>.
  The analogous statements holds for Rees 0-matrix semigroups. <P/>

  It is not necessarily the case that a simple subsemigroups of Rees matrix
  semigroups satisfies <Ref Prop="IsReesMatrixSemigroup"/>. A Rees matrix semigroup is
  simple if and only if its underlying semigroup is simple. 
  A finite semigroup is simple if and only if it is isomorphic to a Rees matrix
  semigroup over a group; this isomorphism can be obtained explicitly using 
  <Ref Attr="IsomorphismReesMatrixSemigroup"/>.<P/>

  Similarly, 0-simple subsemigroups of Rees 0-matrix semigroups do not have to
  satisfy <Ref Prop="IsReesZeroMatrixSemigroup"/>.  A Rees 0-matrix semigroup
  with more than 2 elements is 0-simple if and only if every row and every
  column of its matrix contains a non-zero entry, and its underlying semigroup
  is simple. A finite semigroup is 0-simple if and only if it is isomorphic to a
  Rees 0-matrix semigroup over a group; again this isomorphism can be found by
  using <Ref Attr="IsomorphismReesZeroMatrixSemigroup"/>.<P/>

  Elements of a Rees matrix or 0-matrix semigroup belong to the categories 
  <Ref Filt="IsReesMatrixSemigroupElement"/> and 
  <Ref Filt="IsReesZeroMatrixSemigroupElement"/>, respectively. 
  Such elements can be created directly using the functions 
  <Ref Func="ReesMatrixSemigroupElement"/> and 
  <Ref Func="ReesZeroMatrixSemigroupElement"/>. <P/>

  A semigroup in &GAP; can either satisfies <Ref Prop="IsReesMatrixSemigroup"/>
  or <Ref Prop="IsReesZeroMatrixSemigroup"/> but not both.

  <ManSection>
    <Oper Name="ReesMatrixSemigroup" Arg="S, mat"/>
    <Oper Name="ReesZeroMatrixSemigroup" Arg="S, mat"/>
    <Returns>A Rees matrix or 0-matrix semigroup.</Returns>
    <Description>
      When <A>S</A> is a semigroup and <A>mat</A> is an <C>m</C> by <C>n</C>
      matrix with entries in <A>S</A>, the function <C>ReesMatrixSemigroup</C>
      returns the <C>n</C> by <C>m</C> Rees matrix semigroup over <A>S</A> with
      multiplication defined by <A>mat</A>. <P/>

      The arguments of <C>ReesZeroMatrixSemigroup</C> should be a semigroup
      <A>S</A> and an <C>m</C> by <C>n</C> matrix <A>mat</A> with entries in
      <A>S</A> or equal to the integer <C>0</C>. <C>ReesZeroMatrixSemigroup</C>
      returns the <C>n</C> by <C>m</C> Rees 0-matrix semigroup over <A>S</A>
      with multiplication defined by <A>mat</A>. In &GAP; a Rees 0-matrix
      semigroup always contains a multiplicative zero element, regardless of
      whether there are any entries in <A>mat</A> which are equal to <C>0</C>.
      
      <Example><![CDATA[
gap> G:=Random(AllGroups(Size, 32));;
gap> mat:=List([1..5], x-> List([1..3], y-> Random(G)));;
gap> S:=ReesMatrixSemigroup(G, mat);
<Rees matrix semigroup 3x5 over <pc group of size 32 with 
 5 generators>>
gap> mat:=[[(), 0, (), ()], [0, 0, 0, 0]];;
gap> S:=ReesZeroMatrixSemigroup(DihedralGroup(IsPermGroup, 8), mat);
<Rees 0-matrix semigroup 4x2 over Group([ (1,2,3,4), (2,4) ])>
]]></Example>
    </Description>
  </ManSection>

  <ManSection>
    <Oper Name="ReesMatrixSubsemigroup" Arg="R, I, U, J"/>
    <Oper Name="ReesZeroMatrixSubsemigroup" Arg="R, I, U, J"/>
    <Returns>A Rees matrix or 0-matrix subsemigroup.</Returns>
    <Description>
      The arguments of <C>ReesMatrixSubsemigroup</C> should be a Rees matrix
      semigroup <A>R</A>, subsets <A>I</A> and <A>J</A> of the rows and columns
      of <A>R</A>, respectively, and a subsemigroup <A>S</A> of the underlying
      semigroup of <A>R</A>. <C>ReesMatrixSubsemigroup</C>
      returns the subsemigroup of <A>R</A> generated by the direct product of
      <A>I</A>, <A>U</A>, and <A>J</A>. <P/>      

      The usage and returned value of <C>ReesZeroMatrixSubsemigroup</C> is
      analogous when <A>R</A> is a Rees 0-matrix semigroup. 
      <Example><![CDATA[
gap> G:=CyclicGroup(IsPermGroup, 1007);;
gap> mat:=[[(), 0, 0], [0, (), 0], [0, 0, ()], 
> [(), (), ()], [0, 0, ()]];;
gap> R:=ReesZeroMatrixSemigroup(G, mat);
<Rees 0-matrix semigroup 3x5 over 
  <permutation group of size 1007 with 1 generators>>
gap> ReesZeroMatrixSubsemigroup(R, [1,3], G, [1..5]);
<Rees 0-matrix semigroup 2x5 over 
  <permutation group of size 1007 with 1 generators>>
]]></Example>
    </Description>
  </ManSection>
  
  <ManSection>
    <Attr Name="IsomorphismReesMatrixSemigroup" Arg="S"/>
    <Attr Name="IsomorphismReesZeroMatrixSemigroup" Arg="S"/>
    <Returns>An isomorphism.</Returns>
    <Description>
      Every finite simple semigroup is isomorphic to a Rees matrix semigroup
      over a group, and every finite 0-simple semigroup is isomorphic to a Rees
      0-matrix semigroup over a group.
      <P/>

      If the argument <A>S</A> is a simple semigroup, then
      <C>IsomorphismReesMatrixSemigroup</C> returns an isomorphism to a Rees
      matrix semigroup over a group. If <A>S</A> is not simple, then
      <C>IsomorphismReesMatrixSemigroup</C> returns an error.
      <P/>
      
      If the argument <A>S</A> is a 0-simple semigroup, then
      <C>IsomorphismReesZeroMatrixSemigroup</C> returns an isomorphism to a
      Rees 0-matrix semigroup over a group. If <A>S</A> is not 0-simple, then
      <C>IsomorphismReesMatrixSemigroup</C> returns an error.
      <P/>
      
      See <Ref Prop="IsSimpleSemigroup"/> and 
      <Ref Prop="IsZeroSimpleSemigroup"/>.
      <Example><![CDATA[
gap> S := Semigroup(Transformation([2, 1, 1, 2, 1]), 
>                   Transformation([3, 4, 3, 4, 4]), 
>                   Transformation([3, 4, 3, 4, 3]),  
>                   Transformation([4, 3, 3, 4, 4]));;
gap> IsSimpleSemigroup(S);
true
gap> Range(IsomorphismReesMatrixSemigroup(S));
<Rees matrix semigroup 4x2 over Group([ (1,2) ])>
gap> mat := [[(), 0, 0], 
>            [0, (), 0], 
>            [0, 0, ()]];;
gap> R := ReesZeroMatrixSemigroup(Group((1,2,4,5,6)), mat);
<Rees 0-matrix semigroup 3x3 over Group([ (1,2,4,5,6) ])>
gap> U := ReesZeroMatrixSubsemigroup(R, [1, 2], Group(()), [2, 3]);
<subsemigroup of 3x3 Rees 0-matrix semigroup with 4 generators>
gap> IsZeroSimpleSemigroup(U);
false
gap> U := ReesZeroMatrixSubsemigroup(R, [2, 3], Group(()), [2, 3]);
<subsemigroup of 3x3 Rees 0-matrix semigroup with 3 generators>
gap> IsZeroSimpleSemigroup(U);
true
gap> Rows(U); Columns(U);
[ 2, 3 ]
[ 2, 3 ]
gap> V := Range(IsomorphismReesZeroMatrixSemigroup(U));
<Rees 0-matrix semigroup 2x2 over Group(())>
gap> Rows(V); Columns(V); 
[ 1, 2 ]
[ 1, 2 ]]]></Example>
    </Description>
  </ManSection>

  <ManSection>
  <Filt Name="IsReesMatrixSemigroupElement" Arg="elt" Type="Category"/>
  <Filt Name="IsReesZeroMatrixSemigroupElement" Arg="elt" Type="Category"/>
  <Returns><K>true</K> or <K>false</K>.</Returns>
  <Description>
    Every element of a Rees matrix semigroup belongs to the category
    <C>IsReesMatrixSemigroupElement</C>, and every element of a Rees 0-matrix
    semigroup belongs to the category <C>IsReesZeroMatrixSemigroupElement</C>.
    <Example><![CDATA[
gap> G:=Group((1,2,3));;
gap> mat:=[ [ (), (1,3,2) ], [ (1,3,2), () ] ];;
gap> R:=ReesMatrixSemigroup(G, mat);
<Rees matrix semigroup 2x2 over Group([ (1,2,3) ])>
gap> GeneratorsOfSemigroup(R);
[ (1,(1,2,3),1), (2,(),2) ]
gap> IsReesMatrixSemigroupElement(last[1]);
true
gap> IsReesZeroMatrixSemigroupElement(last2[1]);
false]]></Example>
    </Description>
  </ManSection>

  <ManSection>
    <Func Name="ReesMatrixSemigroupElement" Arg="R, i, x, j"/>
    <Func Name="ReesZeroMatrixSemigroupElement" Arg="R, i, x, j"/>
    <Returns>An element of a Rees matrix or <C>0</C>-matrix semigroup.</Returns>
    <Description>
      The arguments of <A>ReesMatrixSemigroupElement</A> should be a
      Rees matrix subsemigroup <A>R</A>, elements <A>i</A> and <A>j</A> of the 
      the rows and columns of <A>R</A>, respectively, and an element <A>x</A> 
      of the underlying semigroup of <A>R</A>.
      <C>ReesMatrixSemigroupElement</C> returns the element of <A>R</A> with row
      index <A>i</A>, underlying element <A>x</A> in the underlying semigroup of
      <A>R</A>, and column index <A>j</A>, if such an element exist, if such an
      element exists.<P/>

      The usage of <C>ReesZeroMatrixSemigroupElement</C> is analogous to that
      of <C>ReesMatrixSemigroupElement</C>, when <A>R</A> is a Rees 0-matrix
      semigroup. <P/>

      The  row <A>i</A>, underlying element <A>x</A>, and column <A>j</A> of an
      element <C>y</C> of a Rees matrix (or 0-matrix) semigroup can be
      recovered from <C>y</C> using <C>y[1]</C>, <C>y[2]</C>, and <C>y[3]</C>,
      respectively.<P/>

      <Example><![CDATA[
gap> G:=Group((1,2,3));;
gap> mat:=[ [ 0, () ], [ (1,3,2), (1,3,2) ] ];;
gap> R:=ReesZeroMatrixSemigroup(G, mat);
<Rees 0-matrix semigroup 2x2 over Group([ (1,2,3) ])>
gap> ReesZeroMatrixSemigroupElement(R, 1, (1,2,3), 2);
(1,(1,2,3),2)
gap> MultiplicativeZero(R);
0]]></Example>
  </Description>
  </ManSection>

  <ManSection>
    <Filt Name="IsReesMatrixSubsemigroup" Arg="R" Type="Synonym" />
    <Filt Name="IsReesZeroMatrixSubsemigroup" Arg="R" Type="Synonym"/>
    <Returns><K>true</K> or <K>false</K>.</Returns>
    <Description>
    Every semigroup consisting of elements of a Rees matrix
    semigroup satisfies the property <Ref Attr="IsReesMatrixSubsemigroup"/> and
    every semigroup of Rees 0-matrix semigroup elements satisfies 
    <Ref Attr="IsReesZeroMatrixSubsemigroup"/>.   <P/>
    Note that a subsemigroup of a Rees matrix semigroup is not necessarily a
    Rees matrix semigroup.  
   
    <Example><![CDATA[
gap> G:=DihedralGroup(32);;
gap> mat:=List([1..2], x-> List([1..10], x-> Random(G)));;
gap> R:=ReesMatrixSemigroup(G, mat);
<Rees matrix semigroup 10x2 over <pc group of size 32 with 
 5 generators>>
gap> S:=Semigroup(GeneratorsOfSemigroup(R));      
<subsemigroup of 10x2 Rees matrix semigroup with 14 generators>
gap> IsReesMatrixSubsemigroup(S); 
true
gap> S:=Semigroup(GeneratorsOfSemigroup(R)[1]);
<subsemigroup of 10x2 Rees matrix semigroup with 1 generator>
gap> IsReesMatrixSubsemigroup(S);
true]]></Example> 
    </Description>
  </ManSection>

  <ManSection>
    <Prop Name="IsReesMatrixSemigroup" Arg="R"/>
    <Prop Name="IsReesZeroMatrixSemigroup" Arg="R"/>
    <Returns><K>true</K> or <K>false</K>.</Returns>
    <Description>
      A subsemigroup of a Rees matrix semigroup <M>I\times U\times J</M>
      satisfies <Ref Prop="IsReesMatrixSemigroup"/> if and only if it is equal to
      <M>I'\times U'\times J'</M> where <M>I'\subseteq I</M>, <M>J'\subseteq J</M>,
      and <M>U'</M> is a subsemigroup of <M>U</M>. 
      It can be costly to check that a subsemigroup defined by generators satisfies
      <C>IsReesMatrixSemigroup</C>.
      The  analogous statements holds for Rees 0-matrix semigroups. <P/>

      It is not necessarily the case that a simple subsemigroups of Rees matrix
      semigroups satisfies <Ref Prop="IsReesMatrixSemigroup"/>. A Rees matrix
      semigroup is simple if and only if its underlying semigroup is simple. 
      A finite semigroup is simple if and only if it is isomorphic to a Rees matrix
      semigroup over a group; this isomorphism can be obtained explicitly using 
      <Ref Attr="IsomorphismReesMatrixSemigroup"/>.<P/>

      Similarly, 0-simple subsemigroups of Rees 0-matrix semigroups do not have to
      satisfy <Ref Prop="IsReesZeroMatrixSemigroup"/>.  A Rees 0-matrix
      semigroup with more than 2 elements is 0-simple if and only if every row
      and every column of its matrix contains a non-zero entry, and its
      underlying semigroup is simple. A finite semigroup is 0-simple if and only
      if it is isomorphic to a Rees 0-matrix semigroup over a group; again this
      isomorphism can be found by using <Ref Attr="IsomorphismReesMatrixSemigroup"/>.

<Example><![CDATA[
gap> G:=PSL(2,5);;
gap> mat:=[ [ 0, (), 0, (2,6,3,5,4) ], 
> [ (), 0, (), 0 ], [ 0, 0, 0, () ] ];;
gap> R:=ReesZeroMatrixSemigroup(G, mat);
<Rees 0-matrix semigroup 4x3 over Group([ (3,5)(4,6), (1,2,5)
(3,4,6) ])>
gap> IsReesZeroMatrixSemigroup(R);
true
gap> U:=ReesZeroMatrixSubsemigroup(R, [1..3], Group(()), [1..2]);
<subsemigroup of 4x3 Rees 0-matrix semigroup with 4 generators>
gap> IsReesZeroMatrixSemigroup(U);
true
gap> V:=Semigroup(GeneratorsOfSemigroup(U));
<subsemigroup of 4x3 Rees 0-matrix semigroup with 4 generators>
gap> IsReesZeroMatrixSemigroup(V);
true
gap> S:=Semigroup(Transformation([1,1]), Transformation([1,2]));
<commutative transformation monoid of degree 2 with 1 generator>
gap> IsSimpleSemigroup(S);
false
gap> mat:=[[0, One(S), 0, One(S)], [One(S), 0, One(S), 0], 
> [0, 0, 0, One(S)]];;
gap> R:=ReesZeroMatrixSemigroup(S, mat);;
gap> U:=ReesZeroMatrixSubsemigroup(R, [1..3], 
> Semigroup(Transformation([1,1])), [1..2]);
<subsemigroup of 4x3 Rees 0-matrix semigroup with 6 generators>
gap> V:=Semigroup(GeneratorsOfSemigroup(U));
<subsemigroup of 4x3 Rees 0-matrix semigroup with 6 generators>
gap> IsReesZeroMatrixSemigroup(V);
true
gap> T:=Semigroup(
> ReesZeroMatrixSemigroupElement(R, 3, Transformation( [ 1, 1 ] ), 3), 
> ReesZeroMatrixSemigroupElement(R, 2, Transformation( [ 1, 1 ] ), 2));
<subsemigroup of 4x3 Rees 0-matrix semigroup with 2 generators>
gap> IsReesZeroMatrixSemigroup(T);
false]]></Example>
  </Description>  
</ManSection>

  <ManSection>
    <Attr Name="Matrix" Arg="R"/>
    <Returns>A matrix.</Returns>
    <Description>
      If <A>R</A> is a Rees matrix or 0-matrix semigroup, then 
      <C>Matrix</C> returns the matrix used to define multiplication in
      <A>R</A>. <P/>

      More specifically, if <A>R</A> is a Rees matrix or 0-matrix semigroup,
      which is a proper subsemigroup of another such semigroup, then 
      <C>Matrix</C> returns the matrix used to define the Rees matrix (or
      0-matrix) semigroup consisting of the whole family to which the elements
      of <A>R</A> belong. Thus, for example, a <C>1</C> by <C>1</C> Rees matrix
      semigroup can have a <C>65</C> by <C>15</C> matrix. <P/>

      Arbitrary subsemigroups of Rees matrix or 0-matrix semigroups do not have
      a matrix. Such a subsemigroup <A>R</A> has a matrix if and
      only if it satisfies <Ref Attr="IsReesMatrixSemigroup"/> or <Ref
        Attr="IsReesZeroMatrixSemigroup"/>.
      <Example><![CDATA[
gap> G:=AlternatingGroup(5);;
gap> mat:=[[(), (), ()], [(), (), ()]];;
gap> R:=ReesMatrixSemigroup(G, mat);
<Rees matrix semigroup 3x2 over Alt( [ 1 .. 5 ] )>
gap> Matrix(R); 
[ [ (), (), () ], [ (), (), () ] ]
gap> R:=ReesMatrixSubsemigroup(R, [1,2], Group(()), [2]);
<subsemigroup of 3x2 Rees matrix semigroup with 2 generators>
gap> Matrix(R);
[ [ (), (), () ], [ (), (), () ] ]
]]></Example>
    </Description>
  </ManSection>

  <ManSection><Heading>Rows and columns</Heading>
    <Attr Name="Rows" Arg="R"/>
    <Attr Name="Columns" Arg="R"/>
    <Returns>The rows or columns of <A>R</A>.</Returns>
    <Description>
      <C>Rows</C> returns the rows of the Rees matrix or 0-matrix semigroup
      <A>R</A>. Note that the rows of the semigroup correspond to the columns of
      the matrix used to define multiplication in <A>R</A>.<P/>

      <C>Columns</C> returns the columns of the Rees matrix or 0-matrix
      semigroup <A>R</A>. Note that the columns of the semigroup correspond to
      the rows of the matrix used to define multiplication in <A>R</A>.<P/>

      Arbitrary subsemigroups of Rees matrix or 0-matrix semigroups do not have
      rows or columns. Such a subsemigroup <A>R</A> has rows and columns  if and
      only if it satisfies <Ref Attr="IsReesMatrixSemigroup"/> or <Ref
        Attr="IsReesZeroMatrixSemigroup"/>.
    <Example><![CDATA[
gap> G:=Group((1,2,3));;                      
gap> mat:=List([1..100], x-> List([1..200], x->Random(G)));;
gap> R:=ReesZeroMatrixSemigroup(G, mat); 
<Rees 0-matrix semigroup 200x100 over Group([ (1,2,3) ])>
gap> Rows(R);
[ 1 .. 200 ]
gap> Columns(R);
[ 1 .. 100 ]
]]></Example>
    </Description>
  </ManSection>

  <ManSection>
    <Attr Name="UnderlyingSemigroup" Arg="R" 
      Label="for a Rees matrix semigroup"/>
    <Attr Name="UnderlyingSemigroup" Arg="R" 
      Label="for a Rees 0-matrix semigroup"/>
    <Returns>A semigroup.</Returns>
    <Description>
      <C>UnderlyingSemigroup</C> returns the underlying semigroup of the Rees
      matrix or 0-matrix semigroup <A>R</A>. <P/>
      
      Arbitrary subsemigroups of Rees matrix or 0-matrix semigroups do not have
      an underlying semigroup. Such a subsemigroup <A>R</A> has an underlying
      semigroup if and only if it satisfies <Ref Attr="IsReesMatrixSemigroup"/>
      or <Ref Attr="IsReesZeroMatrixSemigroup"/>.
    <Example><![CDATA[
gap> S:=Semigroup(Transformation( [ 2, 1, 1, 2, 1 ] ), 
> Transformation( [ 3, 4, 3, 4, 4 ] ), Transformation([ 3, 4, 3, 4, 3 ] ),
> Transformation([ 4, 3, 3, 4, 4 ] ) );;
gap> R:=Range(IsomorphismReesMatrixSemigroup(S));    
<Rees matrix semigroup 4x2 over Group([ (1,2) ])>
gap> UnderlyingSemigroup(R);
Group([ (1,2) ])
]]></Example>
    </Description>
  </ManSection>

  <ManSection>
    <Attr Name="AssociatedReesMatrixSemigroupOfDClass" Arg="D"/>
    <Returns>A Rees matrix or 0-matrix semigroup.</Returns>
    <Description>
      If <A>D</A> is a regular &D;-class of a finite semigroup <C>S</C>, then
      there is a standard way of associating a Rees matrix semigroup to
      <A>D</A>.  If <A>D</A> is a subsemigroup of <C>S</C>, then <A>D</A> is
      simple and hence is isomorphic to a Rees matrix semigroup. In this case,
      the associated Rees matrix semigroup of <A>D</A> is just the Rees matrix
      semigroup isomorphic to <A>D</A>. <P/>
      
      If <A>D</A> is not a subsemigroup of <C>S</C>, then we define a semigroup
      with elements <A>D</A> and a new element <C>0</C> with multiplication of
      <M>x,y\in D</M> defined by:
      <Alt Not="Text">
        <Display>
          xy=\left\{\begin{array}{ll}
          x*y\ (\textrm{in }S)&amp;\textrm{if }x*y\in D\\
          0&amp;\textrm{if }xy\not\in D.
          \end{array}\right.
        </Display>
      </Alt>
      <Alt Only="Text">
        <C>xy</C> equals the product of <C>x</C> and <C>y</C> if it belongs to
        <A>D</A> and <C>0</C> if it does not. <P/>
      </Alt>
      The semigroup thus defined is 0-simple and hence is isomorphic to a Rees
      0-matrix semigroup. This semigroup can also be described as the Rees
      quotient of the ideal generated by <A>D</A> by it maximal subideal. The
      associated Rees matrix semigroup of <A>D</A> is just the Rees 0-matrix
      semigroup isomorphic to the semigroup defined above.
    <Log><![CDATA[
gap> S:=FullTransformationSemigroup(5);;
gap> D:=GreensDClasses(S)[3];
{Transformation( [ 1, 1, 1, 2, 3 ] )}
gap> AssociatedReesMatrixSemigroupOfDClass(D);
<Rees 0-matrix semigroup 25x10 over Group([ (1,2)(3,5)(4,6), (1,3)
(2,4)(5,6) ])>
]]></Log>
    </Description>
  </ManSection>
</Section>

