<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %A  semigrp.msk                GAP documentation                Thomas Breuer -->
<!-- %% -->
<!-- %A  @(#)<M>Id: semigrp.msk,v 1.23 2003/10/24 16:52:42 gap Exp </M> -->
<!-- %% -->
<!-- %Y  (C) 1998 School Math and Comp. Sci., University of St Andrews, Scotland -->
<!-- %Y  Copyright (C) 2002 The GAP Group -->
<!-- %% -->

<Chapter Label="Semigroups">
<Heading>Semigroups and Monoids</Heading>

This chapter describes functions for creating semigroups and monoids
and determining information about them.

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="sect:IsSemigroup">
<Heading>Semigroups</Heading>

<#Include Label="IsSemigroup">
<#Include Label="Semigroup">
<#Include Label="Subsemigroup">

<ManSection>
  <Oper Name="IsSubsemigroup"  Arg="S, T"/>
  <Returns><K>true</K> or <K>false</K>.</Returns>
  <Description>
    This operation returns <K>true</K> if the semigroup <A>T</A> is a
    subsemigroup of the semigroup <A>S</A> and <K>false</K> if it is not. 
    <Example>
gap> f:=Transformation( [ 5, 6, 7, 1, 4, 3, 2, 7 ] );
Transformation( [ 5, 6, 7, 1, 4, 3, 2, 7 ] )
gap> T:=Semigroup(f);;
gap> IsSubsemigroup(FullTransformationSemigroup(4), T);
false
gap> S:=Semigroup(f);; T:=Semigroup(f^2);;
gap> IsSubsemigroup(S, T);                             
true</Example>
</Description>
</ManSection>
 
<#Include Label="SemigroupByGenerators">
<#Include Label="AsSemigroup">
<#Include Label="AsSubsemigroup">
<#Include Label="GeneratorsOfSemigroup">
<#Include Label="IsGeneratorsOfSemigroup">
<#Include Label="FreeSemigroup">
<#Include Label="SemigroupByMultiplicationTable">

</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->

<Section Label="sect:IsMonoid">
<Heading>Monoids</Heading>

<#Include Label="IsMonoid">
<#Include Label="Monoid">
<#Include Label="Submonoid">
<#Include Label="MonoidByGenerators">
<#Include Label="AsMonoid">
<#Include Label="AsSubmonoid">
<#Include Label="GeneratorsOfMonoid">
<#Include Label="TrivialSubmonoid">
<#Include Label="FreeMonoid">
<#Include Label="MonoidByMultiplicationTable">

</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->

<#Include SYSTEM "invsgp.xml">

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Properties of Semigroups">
<Heading>Properties of Semigroups</Heading>

The following functions determine information
about semigroups.

<#Include Label="IsRegularSemigroup">
<#Include Label="IsRegularSemigroupElement">

<ManSection>
  <Oper Name="InversesOfSemigroupElement" Arg="S, x"/>
  <Returns>The inverses of an element of a semigroup.</Returns>
  <Description>
    <C>InversesOfSemigroupElement</C> returns a list of the inverses of the 
    element <A>x</A> in the semigroup <A>S</A>.<P/>
     
    An element <A>y</A> in <A>S</A> is an <E>inverse</E> of <A>x</A> if      
    <C><A>x</A>*y*<A>x</A>=<A>x</A></C> and <C>y*<A>x</A>*y=y</C>.
    The element <A>x</A> has an inverse if and only if <A>x</A> is a regular  
    element of <A>S</A>.
    <Example>
gap> S:=Semigroup([ Transformation( [ 3, 1, 4, 2, 5, 2, 1, 6, 1 ] ), 
>  Transformation( [ 5, 7, 8, 8, 7, 5, 9, 1, 9 ] ), 
>  Transformation( [ 7, 6, 2, 8, 4, 7, 5, 8, 3 ] ) ]);;
gap> x:=Transformation( [ 3, 1, 4, 2, 5, 2, 1, 6, 1 ] );;
gap> InversesOfSemigroupElement(S, x);
[  ]
gap> IsRegularSemigroupElement(S, x);
false
gap> x:=Transformation( [ 1, 9, 7, 5, 5, 1, 9, 5, 1 ] );;
gap> Set(InversesOfSemigroupElement(S, x));
[ Transformation( [ 1, 2, 3, 5, 5, 1, 3, 5, 2 ] ), 
  Transformation( [ 1, 5, 1, 1, 5, 1, 3, 1, 2 ] ), 
  Transformation( [ 1, 5, 1, 2, 5, 1, 3, 2, 2 ] ) ]
gap> IsRegularSemigroupElement(S, x);
true
gap> S:=ReesZeroMatrixSemigroup(Group((1,2,3)), 
> [ [ (), () ], [ (), 0 ], [ (), (1,2,3) ] ]);;
gap> x:=ReesZeroMatrixSemigroupElement(S, 2, (1,2,3), 3);;
gap> InversesOfSemigroupElement(S, x);
[ (1,(1,2,3),3), (1,(1,3,2),1), (2,(),3), (2,(1,2,3),1) ]</Example>
  </Description>
</ManSection>

<#Include Label="IsSimpleSemigroup">
<#Include Label="IsZeroSimpleSemigroup">
<#Include Label="IsZeroGroup">
<#Include Label="IsReesCongruenceSemigroup">

<ManSection>
  <Prop Name="IsInverseSemigroup" Arg="S"/>
  <Prop Name="IsInverseMonoid" Arg="S"/>
  <Returns><K>true</K> or <K>false</K>.</Returns>
  <Description>
    A semigroup is an <E>inverse semigroup</E> if every element
    <C>x</C> has a unique semigroup inverse, that is, a unique
    element <C>y</C> such that <C>x*y*x=x</C> and <C>y*x*y=y</C>.<P/>

    A monoid that happens to be an inverse semigroup is called an <E>inverse
      monoid</E>. 
    <Example>
gap> S:=Semigroup( Transformation( [ 1, 2, 4, 5, 6, 3, 7, 8 ] ),
> Transformation( [ 3, 3, 4, 5, 6, 2, 7, 8 ] ),
> Transformation( [ 1, 2, 5, 3, 6, 8, 4, 4 ] ) );;
gap> IsInverseSemigroup(S);
true</Example>
  </Description>
</ManSection>

</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Ideals of semigroups">
<Heading>Ideals of semigroups</Heading>

Ideals of semigroups are the same as ideals of the semigroup when 
considered as a magma.
For documentation on ideals for magmas, see <Ref Func="Magma"/>.

<#Include Label="SemigroupIdealByGenerators">
<#Include Label="ReesCongruenceOfSemigroupIdeal">
<#Include Label="IsLeftSemigroupIdeal">
</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Congruences for semigroups">
<Heading>Congruences for semigroups</Heading>

An equivalence or a congruence on a semigroup is the
equivalence or congruence on the semigroup considered as a magma.
So, to deal with equivalences and congruences on semigroups,
magma functions are used.
For documentation on equivalences and congruences for magmas,
see <Ref Func="Magma"/>.

<#Include Label="IsSemigroupCongruence">
<#Include Label="IsReesCongruence">

</Section>

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Quotients">
<Heading>Quotients</Heading>

Given a semigroup and a congruence on the semigroup, one
can construct a new semigroup: the quotient semigroup.
The following functions deal with quotient semigroups in &GAP;.

<#Include Label="[1]{semiquo}">
<#Include Label="IsQuotientSemigroup">
<#Include Label="HomomorphismQuotientSemigroup">
<#Include Label="QuotientSemigroupPreimage">

</Section>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<Section Label="Green's Relations">
<Heading>Green's Relations</Heading>

<#Include Label="[1]{semirel}">
<#Include Label="GreensRRelation">
<#Include Label="IsGreensRelation">
<#Include Label="IsGreensClass">
<#Include Label="IsGreensLessThanOrEqual">
<#Include Label="RClassOfHClass">
<#Include Label="EggBoxOfDClass">
<#Include Label="DisplayEggBoxOfDClass">
<#Include Label="GreensRClassOfElement">
<#Include Label="GreensRClasses">
<#Include Label="GroupHClassOfGreensDClass">
<#Include Label="IsGroupHClass">
<#Include Label="IsRegularDClass">

</Section>

<#Include SYSTEM "reesmat.xml">

<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
</Chapter>


<!-- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -->
<!-- %% -->
<!-- %E -->

