#############################################################################
##
#W  semiex.xml
#Y  Copyright (C) 2011-17                                James D. Mitchell
##
##  Licensing information can be found in the README file of this package.
##
#############################################################################
##

<#GAPDoc Label="EndomorphismsPartition">
   <ManSection>
    <Oper Name = "EndomorphismsPartition" Arg = "list"/>
    <Returns>A transformation monoid.</Returns>
    <Description>
      If <A>list</A> is a list of positive integers, then
      <C>EndomorphismsPartition</C> returns a monoid of endomorphisms preserving
      a partition of <C>[1 .. Sum(<A>list</A>)]</C> with
      a part of length <C><A>list</A>[i]</C> for
      every <C>i</C>. For example, if <C><A>list</A> = [1, 2, 3]</C>, then
      <C>EndomorphismsPartition</C> returns the monoid of endomorphisms of the
      partition <C>[[1], [2, 3], [4, 5, 6]]</C>. <P/>

      If <C>f</C> is a transformation of <C>[1 .. n]</C>, then it is an
      <B>endomorphism</B> of a partition <C>P</C> on <C>[1 .. n]</C> if
      <C>(i, j)</C> in <C>P</C> implies that <C>(i ^ f, j ^ f)</C> is in
      <C>P</C>.
      <P/>

      <C>EndomorphismsPartition</C> returns a monoid with a minimal size
      generating set, as described in <Cite Key = "Araujo2015aa"/>.

      <Example><![CDATA[
gap> S := EndomorphismsPartition([3, 3, 3]);
<transformation semigroup of degree 9 with 4 generators>
gap> Size(S);
531441]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="AnnularJonesMonoid">
   <ManSection>
    <Oper Name = "AnnularJonesMonoid" Arg = "n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then <C>AnnularJonesMonoid</C>
      returns the annular Jones monoid of degree <A>n</A>.  The <E>annular Jones
        monoid</E> is the subsemigroup of the partition monoid consisting of all
      annular bipartitions whose blocks have size 2 (annular bipartitions are
      defined in Chapter <Ref Chap="Bipartitions and blocks"/>). See <Ref
        Oper="BrauerMonoid" />.

      <Example><![CDATA[
gap> S := AnnularJonesMonoid(4);
<regular bipartition *-monoid of degree 4 with 2 generators>]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="PartialJonesMonoid">
   <ManSection>
    <Oper Name = "PartialJonesMonoid" Arg = "n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then <C>PartialJonesMonoid</C>
      returns the partial Jones monoid of degree <A>n</A>.  The <E>partial Jones
        monoid</E> is a subsemigroup of the partial Brauer monoid. An element of
      the partial Brauer monoid is contained in the partial Jones monoid if the
      partition that it defines is finer than the partition defined by some
      element of the Jones monoid. In other words, an element of the partial
      Jones monoid can be formed from some element <C>x</C> of the Jones monoid
      by replacing some blocks <C>[a, b]</C> of <C>x</C> by singleton blocks
      <C>[a], [b]</C>.  <P/>

      Note that, in general, the partial Jones monoid of degree <A>n</A> is
      strictly contained in the Motzkin monoid of the same degree. <P/>

      See <Ref Oper="PartialBrauerMonoid"/>, <Ref Oper="JonesMonoid" />, and
      <Ref Oper="MotzkinMonoid"/>.

      <Example><![CDATA[
gap> S := PartialJonesMonoid(4);
<regular bipartition *-monoid of degree 4 with 7 generators>
gap> T := JonesMonoid(4);
<regular bipartition *-monoid of degree 4 with 3 generators>
gap> U := MotzkinMonoid(4);
<regular bipartition *-monoid of degree 4 with 8 generators>
gap> IsSubsemigroup(U, S);
true
gap> IsSubsemigroup(S, T);
true
gap> Size(U);
323
gap> Size(S);
143
gap> Size(T);
14]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="JonesMonoid">
   <ManSection>
    <Oper Name = "JonesMonoid" Arg = "n"/>
    <Oper Name = "TemperleyLiebMonoid" Arg = "n"/>
    <Oper Name = "SingularJonesMonoid" Arg = "n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then this operation returns the
      Jones monoid of degree <A>n</A>. The <E>Jones monoid</E> is the
      subsemigroup of the Brauer monoid consisting of those bipartitions that
      are planar; see <Ref Oper="PlanarPartitionMonoid" />.  The Jones monoid is
      sometimes referred to as the <B>Temperley-Lieb monoid</B>. <P/>

      <C>SingularJonesMonoid</C> returns the ideal of the Jones monoid
      consisting of the non-invertible elements (i.e. those not in the group of
      units), when <A>n</A> is at least 2.

      <Example><![CDATA[
gap> S := JonesMonoid(4);
<regular bipartition *-monoid of degree 4 with 3 generators>
gap> S = TemperleyLiebMonoid(4);
true
gap> SingularJonesMonoid(8);
<regular bipartition *-semigroup ideal of degree 8 with 1 generator>]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="MotzkinMonoid">
   <ManSection>
    <Oper Name = "MotzkinMonoid" Arg = "n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then this operation returns the
      Motzkin monoid of degree <A>n</A>. The <E>Motzkin monoid</E> is the
      subsemigroup of the partial Brauer monoid consisting of those bipartitions
      that are planar (planar bipartitions are defined in Chapter <Ref
        Chap="Bipartitions and blocks"/>).  <P/>

      Note that the Motzkin monoid of degree <A>n</A> contains the partial Jones
      monoid of degree <A>n</A>, but in general, these monoids are not equal;
      see <Ref Oper="PartialJonesMonoid"/>.

      <Example><![CDATA[
gap> S := MotzkinMonoid(4);
<regular bipartition *-monoid of degree 4 with 8 generators>
gap> T := PartialJonesMonoid(4);
<regular bipartition *-monoid of degree 4 with 7 generators>
gap> IsSubsemigroup(S, T);
true
gap> Size(S);
323
gap> Size(T);
143]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="BrauerMonoid">
   <ManSection>
    <Oper Name="BrauerMonoid" Arg="n"/>
    <Oper Name="PartialBrauerMonoid" Arg="n"/>
    <Oper Name="SingularBrauerMonoid" Arg="n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then this operation returns the
      Brauer monoid of degree <A>n</A>. The <E>Brauer monoid</E> is the
      submonoid of the partition monoid consisting of those bipartitions where
      the size of every block is 2. <P/>

      <C>PartialBrauerMonoid</C> returns the partial Brauer monoid, which is the
      submonoid of the partition monoid consisting of those bipartitions where
      the size of every block is <E>at most</E> 2. The partial Brauer monoid
      contains the Brauer monoid as a submonoid. <P/>

      <C>SingularBrauerMonoid</C> returns the ideal of the Brauer monoid
      consisting of the non-invertible elements (i.e. those not in the group of
      units), when <A>n</A> is at least 2.

      <Example><![CDATA[
gap> S := BrauerMonoid(4);
<regular bipartition *-monoid of degree 4 with 3 generators>
gap> IsSubsemigroup(S, JonesMonoid(4));
true
gap> Size(S);
105
gap> SingularBrauerMonoid(8);
<regular bipartition *-semigroup ideal of degree 8 with 1 generator>
gap> S := PartialBrauerMonoid(3);
<regular bipartition *-monoid of degree 3 with 8 generators>
gap> IsSubsemigroup(S, BrauerMonoid(3));
true
gap> Size(S);
76]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="PartitionMonoid">
   <ManSection>
    <Oper Name="PartitionMonoid" Arg="n"/>
    <Oper Name="RookPartitionMonoid" Arg="n"/>
    <Oper Name="SingularPartitionMonoid" Arg="n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a non-negative integer, then this operation returns the
      partition monoid of degree <A>n</A>. The <E>partition monoid of degree
        <A>n</A></E> is the monoid consisting of all the bipartitions of degree
      <A>n</A>.
      <P/>

      <C>SingularPartitionMonoid</C> returns the ideal of the partition monoid
      consisting of the non-invertible elements (i.e. those not in the group of
      units), when <A>n</A> is positive.
      <P/>

      If <A>n</A> is positive, then <C>RookPartitionMonoid</C> returns submonoid
      of the partition monoid of degree <C><A>n</A> + 1</C> consisting of those
      bipartitions with <C><A>n</A> + 1</C> and <C>-<A>n</A> - 1</C> in the same
      block; see <Cite Key="Halverson2005PartitionAlgebras"/>, <Cite
        Key="Grood2006aa"/>, and <Cite Key="East2019aa"/>.

      <Example><![CDATA[
gap> S := PartitionMonoid(4);
<regular bipartition *-monoid of size 4140, degree 4 with 4
 generators>
gap> Size(S);
4140
gap> T := SingularPartitionMonoid(4);
<regular bipartition *-semigroup ideal of degree 4 with 1 generator>
gap> Size(S) - Size(T) = Factorial(4);
true
gap> S := RookPartitionMonoid(4);
<regular bipartition *-monoid of degree 5 with 5 generators>
gap> Size(S);
21147]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="PlanarPartitionMonoid">
   <ManSection>
    <Oper Name="PlanarPartitionMonoid" Arg="n"/>
    <Oper Name="SingularPlanarPartitionMonoid" Arg="n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a positive integer, then this operation returns the planar
      partition monoid of degree <A>n</A> which is the monoid consisting of all
      the planar bipartitions of degree <A>n</A> (planar bipartitions are defined
      in Chapter <Ref Chap="Bipartitions and blocks"/>). <P/>

      <C>SingularPlanarPartitionMonoid</C> returns the ideal of the planar
      partition monoid consisting of the non-invertible elements
      (i.e. those not in the group of units). <P/>

      <Example><![CDATA[
gap> S := PlanarPartitionMonoid(3);
<regular bipartition *-monoid of degree 3 with 5 generators>
gap> Size(S);
132
gap> T := SingularPlanarPartitionMonoid(3);
<regular bipartition *-semigroup ideal of degree 3 with 1 generator>
gap> Size(T);
131
gap> Difference(S, T);
[ <block bijection: [ 1, -1 ], [ 2, -2 ], [ 3, -3 ]> ]
]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="UniformBlockBijectionMonoid">
   <ManSection>
    <Oper Name="UniformBlockBijectionMonoid" Arg="n"/>
    <Oper Name="FactorisableDualSymmetricInverseMonoid" Arg="n"/>
    <Oper Name="SingularUniformBlockBijectionMonoid" Arg="n"/>
    <Oper Name="PartialUniformBlockBijectionMonoid" Arg="n"/>
    <Oper Name="SingularFactorisableDualSymmetricInverseMonoid" Arg="n"/>
    <Oper Name="PlanarUniformBlockBijectionMonoid" Arg="n"/>
    <Oper Name="SingularPlanarUniformBlockBijectionMonoid" Arg="n"/>
    <Returns>An inverse bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a positive integer, then this operation returns the uniform
      block bijection monoid of degree <A>n</A>. The <E>uniform block bijection
      monoid</E> is the submonoid of the partition monoid consisting of the
      block bijections of degree &n; where the number of positive integers in a
      block equals the number of negative integers in that block.
      The uniform block bijection monoid is also referred to as the
      <E>factorisable dual symmetric inverse monoid</E>. <P/>

      <C>SingularUniformBlockBijectionMonoid</C> returns the ideal of the
      uniform block bijection monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when <A>n</A> is at least 2. <P/>

      <C>PlanarUniformBlockBijectionMonoid</C> returns the submonoid of the
      uniform block bijection monoid consisting of the planar elements
      (i.e. those in the planar partition monoid, see <Ref
        Oper="PlanarPartitionMonoid"/>). <P/>

      <C>SingularPlanarUniformBlockBijectionMonoid</C> returns the ideal of the
      planar uniform block bijection monoid consisting of the non-invertible
      elements (i.e. those not in the group of units), when <A>n</A> is
      at least 2. <P/>
      <!-- TODO(later) reference -->

      <C>PartialUniformBlockBijectionMonoid</C> returns the submonoid of the
      uniform block bijection monoid of degree <C><A>n</A> + 1</C> consisting
      of those uniform block bijection with  <C><A>n</A> + 1</C> and
      <C>-<A>n</A> - 1</C> in the same block. <P/>

      See <Ref Prop="IsUniformBlockBijection"/>.
      <Example><![CDATA[
gap> S := UniformBlockBijectionMonoid(4);
<inverse block bijection monoid of degree 4 with 3 generators>
gap> Size(PlanarUniformBlockBijectionMonoid(8));
128
gap> S := DualSymmetricInverseMonoid(4);
<inverse block bijection monoid of degree 4 with 3 generators>
gap> IsFactorisableInverseMonoid(S);
false
gap> S := UniformBlockBijectionMonoid(4);
<inverse block bijection monoid of degree 4 with 3 generators>
gap> IsFactorisableInverseMonoid(S);
true
gap> S := AsSemigroup(IsBipartitionSemigroup,
>                     SymmetricInverseMonoid(5));
<inverse bipartition monoid of degree 5 with 3 generators>
gap> IsFactorisableInverseMonoid(S);
true
gap> S := PartialUniformBlockBijectionMonoid(5);
<inverse block bijection monoid of degree 6 with 4 generators>
gap> NrIdempotents(S);
203
gap> IsFactorisableInverseMonoid(S);
true]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="DualSymmetricInverseSemigroup">
   <ManSection>
    <Oper Name = "DualSymmetricInverseSemigroup" Arg = "n"/>
    <Oper Name = "DualSymmetricInverseMonoid" Arg = "n"/>
    <Oper Name = "SingularDualSymmetricInverseMonoid" Arg = "n"/>
    <Oper Name = "PartialDualSymmetricInverseMonoid" Arg = "n"/>
    <Returns>An inverse bipartition monoid.</Returns>
    <Description>
      If <A>n</A> is a positive integer, then the operations
      <C>DualSymmetricInverseSemigroup</C> and <C>DualSymmetricInverseMonoid</C>
      return the dual symmetric inverse monoid of degree <A>n</A>, which is the
      subsemigroup of the partition monoid consisting of the block bijections of
      degree <A>n</A>.<P/>

      <C>SingularDualSymmetricInverseMonoid</C> returns the ideal of the
      dual symmetric inverse monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when <A>n</A> is at least 2.<P/>

      <C>PartialDualSymmetricInverseMonoid</C> returns the submonoid of the
      dual symmetric inverse monoid of degree <C><A>n</A> + 1</C> consisting of
      those block bijections with <C><A>n</A> + 1</C> and  <C>-<A>n</A> - 1</C> in
      the same block; see <Cite Key="Kudryavtseva2011aa"/> and
      <Cite Key="Kudryavtseva2015aa"/>. <P/>

      See <Ref Prop = "IsBlockBijection"/>.

      <Example><![CDATA[
gap> Number(PartitionMonoid(3), IsBlockBijection);
25
gap> S := DualSymmetricInverseSemigroup(3);
<inverse block bijection monoid of degree 3 with 3 generators>
gap> Size(S);
25
gap> S := PartialDualSymmetricInverseMonoid(5);
<inverse block bijection monoid of degree 6 with 4 generators>
gap> Size(S);
29072]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="ApsisMonoid">
   <ManSection>
    <Oper Name="ApsisMonoid" Arg="m, n"/>
    <Oper Name="SingularApsisMonoid" Arg="m, n"/>
    <Oper Name="CrossedApsisMonoid" Arg="m, n"/>
    <Oper Name="SingularCrossedApsisMonoid" Arg="m, n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>m</A> and <A>n</A> are positive integers, then this operation
      returns the <A>m</A>-apsis monoid of degree <A>n</A>. The
      <A>m</A><E>-apsis monoid</E> is the monoid of bipartitions generated when
      the diapses in generators of the Jones monoid are replaced
      with <A>m</A>-apses. Note that an <A>m</A><E>-apsis</E> is a block that
      contains precisely <A>m</A> consecutive integers. <P/>

      <C>SingularApsisMonoid</C> returns the ideal of the
      apsis monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when <A>m</A> <M>\leq</M>
      <A>n</A>.  <P/>

      <C>CrossedApsisGeneratedMonoid</C> returns the semigroup generated by the
      symmetric group of degree <A>n</A> and the <A>m</A>-apsis monoid of
      degree <A>n</A>. <P/>

      <C>SingularCrossedApsisMonoid</C> returns the ideal of the
      crossed apsis monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when <A>m &lt;= n</A>.
      <!-- TODO(later) reference and/or definition -->

      <Example><![CDATA[
gap> S := ApsisMonoid(3, 7);
<regular bipartition *-monoid of degree 7 with 5 generators>
gap> Size(S);
320
gap> T := SingularApsisMonoid(3, 7);
<regular bipartition *-semigroup ideal of degree 7 with 1 generator>
gap> Difference(S, T) = [One(S)];
true
gap> Size(CrossedApsisMonoid(2, 5));
945
gap> SingularCrossedApsisMonoid(4, 6);
<regular bipartition *-semigroup ideal of degree 6 with 1 generator>]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="PartialTransformationMonoid">
   <ManSection>
    <Oper Name = "PartialTransformationMonoid" Arg = "n"/>
    <Returns>A transformation monoid.</Returns>
    <Description>
      If <A>n</A> is a positive integer, then this function returns a
      semigroup of transformations on <C><A>n</A> + 1</C> points which is
      isomorphic to the semigroup consisting of all partial transformation on
      <A>n</A> points. This monoid has <C>(<A>n</A> + 1) ^ <A>n</A></C> elements.
      <!--TODO(later) add generators-->
      <Example><![CDATA[
gap> S := PartialTransformationMonoid(5);
<regular transformation monoid of degree 6 with 4 generators>
gap> Size(S);
7776]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="ModularPartitionMonoid">
   <ManSection>
    <Oper Name="ModularPartitionMonoid" Arg="m, n"/>
    <Oper Name="SingularModularPartitionMonoid" Arg="m, n"/>
    <Oper Name="PlanarModularPartitionMonoid" Arg="m, n"/>
    <Oper Name="SingularPlanarModularPartitionMonoid" Arg="m, n"/>
    <Returns>A bipartition monoid.</Returns>
    <Description>
      If <A>m</A> and <A>n</A> are positive integers, then this operation
      returns the modular-<A>m</A> partition monoid of degree <A>n</A>. The
      <E>modular-</E><A>m</A> <E>partition monoid</E> is the submonoid of the
      partition monoid such that the numbers of positive and negative
      integers contained in each block are congruent mod <A>m</A>. <P/>

      <C>SingularModularPartitionMonoid</C> returns the ideal of the
      modular partition monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when either
      <A>m = n = 1</A> or <A>m, n &gt; 1</A>. <P/>

      <C>PlanarModularPartitionMonoid</C> returns the submonoid of the
      modular-<A>m</A> partition monoid consisting of the planar elements
      (i.e. those in the planar partition monoid, see <Ref
        Oper="PlanarPartitionMonoid" />). <P/>

      <C>SingularPlanarModularPartitionMonoid</C> returns the ideal of the
      planar modular partition monoid consisting of the non-invertible elements
      (i.e. those not in the group of units), when either
      <A>m = n = 1</A> or <A>m, n &gt; 1</A>.
      <!-- TODO(later) reference -->

      <Example><![CDATA[
gap> S := ModularPartitionMonoid(3, 6);
<regular bipartition *-monoid of degree 6 with 4 generators>
gap> Size(S);
36243
gap> S := SingularModularPartitionMonoid(1, 1);
<commutative inverse bipartition semigroup ideal of degree 1 with
  1 generator>
gap> Size(SingularModularPartitionMonoid(2, 4));
355
gap> S := PlanarModularPartitionMonoid(4, 9);
<regular bipartition *-monoid of degree 9 with 14 generators>
gap> Size(S);
1795
gap> S := SingularPlanarModularPartitionMonoid(3, 5);
<regular bipartition *-semigroup ideal of degree 5 with 1 generator>
gap> Size(SingularPlanarModularPartitionMonoid(1, 2));
13]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="GeneralLinearMonoid">
   <ManSection>
    <Oper Name="FullMatrixMonoid" Arg="d, q"/>
    <Oper Name="GeneralLinearMonoid" Arg="d, q"/>
    <Oper Name="GLM" Arg="d, q"/>
    <Returns>A matrix monoid.</Returns>
    <Description>
      These operations return the full matrix monoid of <A>d</A> by <A>d</A>
      matrices over the field with <A>q</A> elements. The <E>full matrix
        monoid</E>, also known as the <E>general linear monoid</E>, with these
      parameters, is the monoid consisting of all <A>d</A> by <A>d</A> matrices
      with entries from the field <C>GF(<A>q</A>)</C>. This
      monoid has <C><A>q</A> ^ (<A>d</A> ^ 2)</C> elements.

      <Example><![CDATA[
gap> S := FullMatrixMonoid(2, 4);
<general linear monoid 2x2 over GF(2^2)>
gap> Size(S);
256
gap> S = GeneralLinearMonoid(2, 4);
true
gap> GLM(2, 2);
<general linear monoid 2x2 over GF(2)>]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="SpecialLinearMonoid">
<ManSection>
  <Oper Name="SpecialLinearMonoid" Arg="d, q"/>
  <Oper Name="SLM" Arg="d, q"/>
  <Returns>A matrix monoid.</Returns>
    <Description>
      These operations return the special linear monoid of <A>d</A> by <A>d</A>
      matrices over the field with <A>q</A> elements. The <E>special linear
        monoid</E> is the monoid consisting of all <A>d</A> by <A>d</A> matrices
      with entries from the field <C>GF(<A>q</A>)</C> that have determinant
      <C>0</C> or <C>1</C>. In other words, the special linear monoid is formed
      from the general linear monoid of the same parameters by replacing its
      group of units (the general linear group) by the special linear group.

      <Example><![CDATA[
gap> S := SpecialLinearMonoid(2, 4);
<regular monoid of 2x2 matrices over GF(2^2) with 3 generators>
gap> S = SLM(2, 4);
true
gap> Size(S);
136]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="RookMonoid">
   <ManSection>
    <Oper Name="RookMonoid" Arg="n"/>
    <Returns>An inverse monoid of partial permutations.</Returns>
    <Description>
      <C>RookMonoid</C> is a synonym for <Ref Oper="SymmetricInverseMonoid"
        BookName="ref" />.

      <Example><![CDATA[
gap> S := RookMonoid(4);
<symmetric inverse monoid of degree 4>
gap> S = SymmetricInverseMonoid(4);
true]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="MunnSemigroup">
    <ManSection>
      <Attr Name = "MunnSemigroup" Arg = "S"/>
      <Returns>The Munn semigroup of a semilattice.</Returns>
      <Description>
        If <A>S</A> is a semilattice, then <C>MunnSemigroup</C> returns the
        inverse semigroup of partial permutations of isomorphisms of principal
        ideals of <A>S</A>; called the <E>Munn semigroup</E> of <A>S</A>.<P/>

        This function was written jointly by J. D. Mitchell, Yann P&#233;resse
        (St Andrews), Yanhui Wang (York).

        <Example><![CDATA[
gap> S := InverseSemigroup([
> PartialPerm([1, 2, 3, 4, 5, 6, 7, 10], [4, 6, 7, 3, 8, 2, 9, 5]),
> PartialPerm([1, 2, 7, 9], [5, 6, 4, 3])]);
<inverse partial perm semigroup of rank 10 with 2 generators>
gap> T := IdempotentGeneratedSubsemigroup(S);;
gap> M := MunnSemigroup(T);
<inverse partial perm semigroup of rank 60 with 7 generators>
gap> NrIdempotents(M);
60
gap> NrIdempotents(S);
60]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="OrderPreserving">
  <ManSection>
    <Heading>Semigroups of order-preserving transformations</Heading>
    <Oper Name = "OrderEndomorphisms" Arg = "n"
      Label = "monoid of order preserving transformations"/>
    <Oper Name = "SingularOrderEndomorphisms" Arg = "n"/>
    <Oper Name = "OrderAntiEndomorphisms" Arg = "n"/>
    <Oper Name = "PartialOrderEndomorphisms" Arg = "n"/>
    <Oper Name = "PartialOrderAntiEndomorphisms" Arg = "n"/>
    <Returns>
      A semigroup of transformations related to a linear order.
    </Returns>
    <Description>
      <List>
        <Mark><C>OrderEndomorphisms(<A>n</A>)</C></Mark>
        <Item>
          <C>OrderEndomorphisms(<A>n</A>)</C> returns the monoid of
          transformations that preserve the usual order on <M>\{1, 2, \ldots,
            n\}</M>, where <A>n</A> is a positive integer.
          <Alt Not = "Text">
            <C>OrderEndomorphisms(<A>n</A>)</C> is generated by the
            <M><A>n + 1</A></M> transformations:
            <Display>
              \left(
              \begin{array}{ccccccccc}
              1&amp;2&amp;3&amp;\cdots&amp;n-1&amp; n\\
              1&amp;1&amp;2&amp;\cdots&amp;n-2&amp;n-1
              \end{array}\right), \qquad
              \left(
              \begin{array}{ccccccccc}
              1&amp;2&amp;\cdots&amp;i-1&amp; i&amp; i+1&amp;i+2&amp;\cdots
              &amp;n\\
              1&amp;2&amp;\cdots&amp;i-1&amp; i+1&amp;i+1&amp;i+2&amp;\cdots
              &amp;n\\
              \end{array}\right)
            </Display>
            where <M>i=0,\ldots,n-1</M>, and has <M>{2n-1\choose n-1}</M>
            elements.
          </Alt>
      </Item>
      <Mark><C>SingularOrderEndomorphisms(<A>n</A>)</C></Mark>
      <Item>
        <C>SingularOrderEndomorphisms(<A>n</A>)</C> returns the ideal of
        <C>OrderEndomorphisms(<A>n</A>)</C> consisting of the non-invertible
        elements, when <A>n</A> is at least <C>2</C>. The only invertible
        element in <C>OrderEndomorphisms(<A>n</A>)</C> is the identity
        transformation.
        <Alt Not="Text">
          Therefore <C>SingularOrderEndomorphisms(<A>n</A>)</C> has
          <M>{2n-1\choose n-1} - 1</M> elements.
        </Alt>
      </Item>
      <Mark><C>OrderAntiEndomorphisms(<A>n</A>)</C></Mark>
      <Item>
        <C>OrderAntiEndomorphisms(<A>n</A>)</C> returns the monoid of
        transformations that preserve or reverse the usual order on <M>\{1, 2,
          \ldots, n\}</M>, where <A>n</A> is a positive integer.
        <C>OrderAntiEndomorphisms(<A>n</A>)</C> is generated by the generators
        of <C>OrderEndomorphisms(<A>n</A>)</C> along with the bijective
        transformation that reverses the order on <M>\{1, 2, \ldots, n\}</M>.
        <Alt Not = "text">
          The monoid <C>OrderAntiEndomorphisms(<A>n</A>)</C> has <M>{2n-1\choose
            n-1} - n</M> elements.
        </Alt>
      </Item>
      <Mark><C>PartialOrderEndomorphisms(<A>n</A>)</C></Mark>
      <Item>
        <C>PartialOrderEndomorphisms(<A>n</A>)</C> returns a monoid of
        transformations on <C><A>n</A> + 1</C> points that is isomorphic to the
        monoid consisting of all partial transformations that preserve the usual
        order on <M>\{1, 2, \ldots, n\}</M>.
      </Item>
      <Mark><C>PartialOrderAntiEndomorphisms(<A>n</A>)</C></Mark>
      <Item>
        <C>PartialAntiOrderEndomorphisms(<A>n</A>)</C> returns a monoid of
        transformations on <C><A>n</A> + 1</C> points that is isomorphic to the
        monoid consisting of all partial transformations that preserve or
        reverse the usual order on <M>\{1, 2, \ldots, n\}</M>.
      </Item>
      </List>
      <Example><![CDATA[
gap> S := OrderEndomorphisms(5);
<regular transformation monoid of degree 5 with 5 generators>
gap> IsIdempotentGenerated(S);
true
gap> Size(S) = Binomial(2 * 5 - 1, 5 - 1);
true
gap> Difference(S, SingularOrderEndomorphisms(5));
[ IdentityTransformation ]
gap> SingularOrderEndomorphisms(10);
<regular transformation semigroup ideal of degree 10 with 1 generator>
gap> T := OrderAntiEndomorphisms(4);
<regular transformation monoid of degree 4 with 5 generators>
gap> Transformation([4, 2, 2, 1]) in T;
true
gap> U := PartialOrderEndomorphisms(6);
<regular transformation monoid of degree 7 with 12 generators>
gap> V := PartialOrderAntiEndomorphisms(6);
<regular transformation monoid of degree 7 with 13 generators>
gap> IsSubsemigroup(V, U);
true]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="POIPODIPOPIPORI">
  <ManSection>
  <Heading>Inverse monoids of order-preserving partial permutations</Heading>
    <Oper Name = "POI" Arg = "n"
      Label = "monoid of order preserving partial perms"/>
    <Oper Name = "PODI" Arg = "n"
      Label = "monoid of order preserving or reversing partial perms"/>
    <Oper Name = "POPI" Arg = "n"
      Label = "monoid of orientation preserving partial perms"/>
    <Oper Name = "PORI" Arg = "n"
      Label = "monoid of orientation preserving or reversing partial perms"/>
    <Returns>
      An inverse monoid of partial permutations related to a linear order.
    </Returns>
    <Description>
      <List>
      <Mark><C>POI(<A>n</A>)</C></Mark>
      <Item>
      <C>POI(<A>n</A>)</C> returns the inverse
      monoid of partial permutations that preserve the usual order
      on <M>\{1, 2, \ldots, n\}</M>, where <A>n</A> is a positive integer.
      <Alt Not="Text">
      <C>POI(<A>n</A>)</C> is generated by the <M><A>n</A></M>
      partial permutations:
      <Display>
        \left(
        \begin{array}{ccccc}
        1&amp;2&amp;3&amp;\cdots&amp;n\\
        -&amp;1&amp;2&amp;\cdots&amp;n-1
        \end{array}\right), \qquad
        \left(
        \begin{array}{ccccccccc}
        1&amp;2&amp;\cdots&amp;i-1&amp; i&amp; i+1&amp;i+2&amp;\cdots
        &amp;n\\
        1&amp;2&amp;\cdots&amp;i-1&amp; i+1&amp;-&amp;i+2&amp;\cdots&amp;n\\
        \end{array}\right)
      </Display>
      where <M>i = 1, \ldots, n - 1</M>,
      and has <M>{2n\choose n}</M> elements. </Alt>
    </Item>
    <Mark><C>PODI(<A>n</A>)</C></Mark>
    <Item>
      <C>PODI(<A>n</A>)</C> returns the inverse monoid of partial permutations
      that preserve or reverse the usual order on <M>\{1, 2, \ldots, n\}</M>,
      where <A>n</A> is a positive integer.  <C>PODI(<A>n</A>)</C> is generated
      by the generators of <C>POI(<A>n</A>)</C>, along with the
      permutation that reverses the usual order on <M>\{1, 2, \ldots, n\}</M>.
      <Alt Not="Text">
        <C>PODI(<A>n</A>)</C> has <M>{2n\choose n} - n^{2} - 1</M> elements.
      </Alt>
    </Item>
    <Mark><C>POPI(<A>n</A>)</C></Mark>
    <Item>
      <C>POPI(<A>n</A>)</C> returns the inverse monoid of partial permutations
      that preserve the orientation of <M>\{1,2,\ldots, n\}</M>, where
      <M>n</M> is a positive integer.
      <Alt Not="Text">

      <C>POPI(<A>n</A>)</C> is generated by the partial permutations:
      <Display>
      \left(
      \begin{array}{ccccc}
1&amp;2&amp;\cdots&amp;n-1&amp;n\\
2&amp;3&amp;\cdots&amp;n&amp;1
\end{array}\right),\qquad
\left(
\begin{array}{cccccc}
1&amp;2&amp;\cdots&amp;n-2&amp;n-1&amp;n\\
1&amp;2&amp;\cdots&amp;n-2&amp;n&amp;-
\end{array}\right),
      </Display>
      and has <M>1+\frac{n}{2}{2n\choose n}</M> elements.
      </Alt>
    </Item>
    <Mark><C>PORI(<A>n</A>)</C></Mark>
    <Item>
      <C>PORI(<A>n</A>)</C> returns the inverse monoid of partial permutations
      that preserve or reverse the orientation of <M>\{1, 2, \ldots, n\}</M>,
      where <M>n</M> is a positive integer. <C>PORI(<A>n</A>)</C> is generated
      by the generators of <C>POPI(<A>n</A>)</C>, along with the
      permutation that reverses the usual order on <M>\{1, 2, \ldots, n\}</M>.
      <Alt Not="Text">
        <C>PORI(<A>n</A>)</C> has <M>\frac{n}{2}{2n\choose n} - n(n + 1)</M>
        elements.
      </Alt>
    </Item>
  </List>
      <Example><![CDATA[
gap> S := PORI(10);
<inverse partial perm monoid of rank 10 with 3 generators>
gap> S := POPI(10);
<inverse partial perm monoid of rank 10 with 2 generators>
gap> Size(S) = 1 + 5 * Binomial(20, 10);
true
gap> S := PODI(10);
<inverse partial perm monoid of rank 10 with 11 generators>
gap> S := POI(10);
<inverse partial perm monoid of rank 10 with 10 generators>
gap> Size(S) = Binomial(20, 10);
true
gap> IsSubsemigroup(PORI(10), PODI(10))
> and IsSubsemigroup(PORI(10), POPI(10))
> and IsSubsemigroup(PODI(10), POI(10))
> and IsSubsemigroup(POPI(10), POI(10));
true]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="CatalanMonoid">
   <ManSection>
    <Oper Name = "CatalanMonoid" Arg = "n"/>
    <Returns>A transformation monoid.</Returns>
    <Description>
      If <A>n</A> is a positive integer, then this operation returns the Catalan
      monoid of degree <A>n</A>. The <E>Catalan monoid</E> is the semigroup of
      the order-preserving and order-decreasing transformations of <C>[1 ..
        n]</C> with the usual ordering. <P/>

      <Alt Not = "Text">
        The Catalan monoid is generated by the <M><A>n - 1</A></M>
        transformations <M>f_i</M>:
        <Display>
          \left(
          \begin{array}{cccccccccc}
          1&amp;2&amp;3&amp;\cdots&amp; i &amp;i + 1&amp; i + 2 &amp; \cdots &amp; n\\
          1&amp;2&amp;3&amp;\cdots&amp; i &amp;i    &amp; i + 2 &amp; \cdots &amp; n
          \end{array}\right), \qquad
        </Display>
        where <M>i = 1, \ldots, n - 1</M> and has size equal to the <M>n</M>th
        Catalan number.
      </Alt>
      <Example><![CDATA[
gap> S := CatalanMonoid(6);
<transformation monoid of degree 6 with 5 generators>
gap> Size(S);
132]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="SingularTransformationSemigroup">
    <ManSection>
      <Oper Name="SingularTransformationSemigroup" Arg="n"/>
      <Oper Name="SingularTransformationMonoid" Arg="n"/>
      <Returns>The semigroup of non-invertible transformations.</Returns>
      <Description>
        If <A>n</A> is a integer greater than 1, then this function
        returns the semigroup of non-invertible transformations, which is
        generated by the <C><A>n</A>(<A>n</A> - 1)</C> idempotents of degree
        <A>n</A> and rank <C><A>n</A> - 1</C> and has <M>n ^ n - n!</M> elements.

        <Example><![CDATA[
gap> S := SingularTransformationSemigroup(4);
<regular transformation semigroup ideal of degree 4 with 1 generator>
gap> Size(S);
232]]></Example>
      </Description>
    </ManSection>
<#/GAPDoc>

<#GAPDoc Label="FullTropicalMaxPlusMonoid">
   <ManSection>
    <Oper Name="FullTropicalMaxPlusMonoid" Arg="d, t"/>
    <Returns>A monoid of tropical max plus matrices.</Returns>
    <Description>
      If <C><A>d</A> = 2</C> and <A>t</A> is a positive integer, then
      <C>FullTropicalMaxPlusMonoid</C> returns the monoid consisting of all
      <A>d</A> by <A>d</A> matrices with entries from the tropical max-plus
      semiring with threshold <A>t</A>. A small generating set for larger values
      of <A>d</A> is not currently known. <P/>

      This monoid contains <C>(<A>t</A> + 2) ^ (<A>d</A> ^ 2)</C>
      elements.

      <Example><![CDATA[
gap> S := FullTropicalMaxPlusMonoid(2, 5);
<monoid of 2x2 tropical max-plus matrices with 24 generators>
gap> Size(S);
2401
gap> (5 + 2) ^ (2 ^ 2);
2401]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>

<#GAPDoc Label="FullTropicalMinPlusMonoid">
   <ManSection>
    <Oper Name="FullTropicalMinPlusMonoid" Arg="d, t"/>
    <Returns>A monoid of tropical min plus matrices.</Returns>
    <Description>
      If <A>d</A> is equal to <C>2</C> or <C>3</C>, and <A>t</A> is a positive
      integer, then <C>FullTropicalMinPlusMonoid</C> returns the monoid
      consisting of all <A>d</A> by <A>d</A> matrices with entries from the
      tropical min-plus semiring with threshold <A>t</A>.  A small generating
      set for larger values of <A>d</A> is not currently known. <P/>

      This monoid contains <C>(<A>t</A> + 2) ^ (<A>d</A> ^ 2)</C> elements.

      <Example><![CDATA[
gap> S := FullTropicalMinPlusMonoid(2, 3);
<monoid of 2x2 tropical min-plus matrices with 7 generators>
gap> Size(S);
625
gap> (3 + 2) ^ (2 ^ 2);
625]]></Example>
    </Description>
  </ManSection>
<#/GAPDoc>
