  
  [1X13 [33X[0;0YCongruences[133X[101X
  
  [33X[0;0YCongruences in [5XSemigroups[105X can be described in several different ways:[133X
  
  [30X    [33X[0;6YGenerating pairs -- the minimal congruence which contains these pairs[133X
  
  [30X    [33X[0;6YRees congruences -- the congruence specified by a given ideal[133X
  
  [30X    [33X[0;6YUniversal congruences -- the unique congruence with only one class[133X
  
  [30X    [33X[0;6YLinked triples -- only for simple or 0-simple semigroups (see below)[133X
  
  [30X    [33X[0;6YKernel and trace -- only for inverse semigroups[133X
  
  [30X    [33X[0;6YWord     graph     --     only    for    congruences    created    via
        [2XIteratorOfLeftCongruences[102X   ([14X13.4-15[114X)   or  [2XIteratorOfRightCongruences[102X
        ([14X13.4-15[114X)[133X
  
  [30X    [33X[0;6YWang pairs -- only for graph inverse semigroup[133X
  
  [33X[0;0YThe  operation  [2XSemigroupCongruence[102X  ([14X13.2-1[114X)  can  be used to create any of
  these,  interpreting  the  arguments  in  a  smart  way.  The  usual  way of
  specifying  a  congruence will be by giving a set of generating pairs, but a
  user  with  an  ideal  could  instead  create a Rees congruence or universal
  congruence.[133X
  
  [33X[0;0YIf  a  congruence is specified by generating pairs on a simple, 0-simple, or
  inverse semigroup, then the congruence may be converted automatically to one
  of  the  last  two  items in the above list, to reduce the complexity of any
  calculations to be performed. The user need not manually specify, or even be
  aware of, the congruence's linked triple or kernel and trace.[133X
  
  [33X[0;0YWe  can  also  create  left  congruences  and  right  congruences, using the
  [2XLeftSemigroupCongruence[102X   ([14X13.2-2[114X)   and  [2XRightSemigroupCongruence[102X  ([14X13.2-3[114X)
  functions.[133X
  
  [33X[0;0YPlease  note  that  congruence  objects  made  in  [5XGAP[105X  before  loading  the
  [5XSemigroups[105X  package  may not behave correctly after [5XSemigroups[105X is loaded. If
  [5XSemigroups[105X  is  loaded  at  the  beginning  of  the  session,  or before any
  congruence work is done, then the objects should behave correctly.[133X
  
  
  [1X13.1 [33X[0;0YSemigroup congruence objects[133X[101X
  
  [1X13.1-1 IsSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XIsSemigroupCongruence[102X( [3Xobj[103X ) [32X property[133X
  
  [33X[0;0YA  semigroup  congruence  [10Xcong[110X  is  an equivalence relation on a semigroup [10XS[110X
  which respects left and right multiplication.[133X
  
  [33X[0;0YThat  is, if [22X(a,b)[122X is a pair in [10Xcong[110X, and [22Xx[122X is an element of [10XS[110X, then [22X(ax,bx)[122X
  and [22X(xa,xb)[122X are both in [10Xcong[110X.[133X
  
  [33X[0;0YThe  simplest  way  of  creating  a  congruence in [5XSemigroups[105X is by a set of
  [13Xgenerating pairs[113X. See [2XSemigroupCongruence[102X ([14X13.2-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<semigroup congruence over <simple transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with linked triple (2,4,1)>[128X[104X
    [4X[25Xgap>[125X [27XIsSemigroupCongruence(cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.1-2 IsLeftSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XIsLeftSemigroupCongruence[102X( [3Xobj[103X ) [32X property[133X
  
  [33X[0;0YA left semigroup congruence [10Xcong[110X is an equivalence relation on a semigroup [10XS[110X
  which respects left multiplication.[133X
  
  [33X[0;0YThat  is, if [22X(a,b)[122X is a pair in [10Xcong[110X, and [22Xx[122X is an element of [10XS[110X, then [22X(xa,xb)[122X
  is also in [10Xcong[110X.[133X
  
  [33X[0;0YThe  simplest way of creating a left congruence in [5XSemigroups[105X is by a set of
  [13Xgenerating pairs[113X. See [2XLeftSemigroupCongruence[102X ([14X13.2-2[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := LeftSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<left semigroup congruence over <transformation semigroup of degree 5[128X[104X
    [4X[28X with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XIsLeftSemigroupCongruence(cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.1-3 IsRightSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XIsRightSemigroupCongruence[102X( [3Xobj[103X ) [32X property[133X
  
  [33X[0;0YA  right semigroup congruence [10Xcong[110X is an equivalence relation on a semigroup
  [10XS[110X which respects right multiplication.[133X
  
  [33X[0;0YThat  is, if [22X(a,b)[122X is a pair in [10Xcong[110X, and [22Xx[122X is an element of [10XS[110X, then [22X(ax,bx)[122X
  is also in [10Xcong[110X.[133X
  
  [33X[0;0YThe simplest way of creating a right congruence in [5XSemigroups[105X is by a set of
  [13Xgenerating pairs[113X. See [2XRightSemigroupCongruence[102X ([14X13.2-3[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27XRightSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<right semigroup congruence over <transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XIsRightSemigroupCongruence(cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X13.2 [33X[0;0YCreating congruences[133X[101X
  
  [1X13.2-1 SemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XSemigroupCongruence[102X( [3XS[103X, [3Xpairs[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA semigroup congruence.[133X
  
  [33X[0;0YThis function returns a semigroup congruence over the semigroup [3XS[103X.[133X
  
  [33X[0;0YIf  [3Xpairs[103X  is  a  list  of  lists  of size 2 with elements from [3XS[103X, then this
  function  will  return  the semigroup congruence defined by these generating
  pairs. The individual pairs may instead be given as separate arguments.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27XSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<semigroup congruence over <simple transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with linked triple (2,4,1)>[128X[104X
    [4X[25Xgap>[125X [27XSemigroupCongruence(S, pair1, pair2);[127X[104X
    [4X[28X<semigroup congruence over <simple transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with linked triple (2,4,1)>[128X[104X
  [4X[32X[104X
  
  [1X13.2-2 LeftSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XLeftSemigroupCongruence[102X( [3XS[103X, [3Xpairs[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA left semigroup congruence.[133X
  
  [33X[0;0YThis function returns a left semigroup congruence over the semigroup [3XS[103X.[133X
  
  [33X[0;0YIf  [3Xpairs[103X  is  a  list  of  lists  of size 2 with elements from [3XS[103X, then this
  function will return the least left semigroup congruence on [3XS[103X which contains
  these  generating  pairs.  The  individual  pairs  may  instead  be given as
  separate arguments.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27XLeftSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<left semigroup congruence over <transformation semigroup of degree 5[128X[104X
    [4X[28X with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XLeftSemigroupCongruence(S, pair1, pair2);[127X[104X
    [4X[28X<left semigroup congruence over <transformation semigroup of degree 5[128X[104X
    [4X[28X with 4 generators> with 2 generating pairs>[128X[104X
  [4X[32X[104X
  
  [1X13.2-3 RightSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XRightSemigroupCongruence[102X( [3XS[103X, [3Xpairs[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA right semigroup congruence.[133X
  
  [33X[0;0YThis function returns a right semigroup congruence over the semigroup [3XS[103X.[133X
  
  [33X[0;0YIf  [3Xpairs[103X  is  a  list  of  lists  of size 2 with elements from [3XS[103X, then this
  function  will  return  the  least  right  semigroup  congruence  on [3XS[103X which
  contains  these  generating pairs. The individual pairs may instead be given
  as separate arguments.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27XRightSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<right semigroup congruence over <transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XRightSemigroupCongruence(S, pair1, pair2);[127X[104X
    [4X[28X<right semigroup congruence over <transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with 2 generating pairs>[128X[104X
  [4X[32X[104X
  
  
  [1X13.3 [33X[0;0YCongruence classes[133X[101X
  
  [33X[0;0YThe main operations and attributes for congruences in the [5XGAP[105X library are:[133X
  
  [30X    [33X[0;6Y[2XEquivalenceClasses[102X ([14XReference: EquivalenceClasses attribute[114X)[133X
  
  [30X    [33X[0;6Y[10XNrEquivalenceClasses[110X[133X
  
  [30X    [33X[0;6Y[2XEquivalenceClassOfElement[102X ([14XReference: EquivalenceClassOfElement[114X)[133X
  
  [1X13.3-1 IsCongruenceClass[101X
  
  [33X[1;0Y[29X[2XIsCongruenceClass[102X( [3Xobj[103X ) [32X category[133X
  
  [33X[0;0YThis  category  contains  any  object  which  is  an  equivalence class of a
  semigroup  congruence  (see  [2XIsSemigroupCongruence[102X ([14X13.1-1[114X)). An object will
  only  be  in  this  category  if  the  relation  is  known to be a semigroup
  congruence when the congruence class is created.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([[127X[104X
    [4X[25X>[125X [27X Transformation([1, 2, 2]), Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, [Transformation([1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X                                   Transformation([2, 1, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong,[127X[104X
    [4X[25X>[125X [27X                                      Transformation([3, 1, 1]));[127X[104X
    [4X[28X<2-sided congruence class of Transformation( [ 3, 1, 1 ] )>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruenceClass(class);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.3-2 IsLeftCongruenceClass[101X
  
  [33X[1;0Y[29X[2XIsLeftCongruenceClass[102X( [3Xobj[103X ) [32X category[133X
  
  [33X[0;0YThis  category  contains  any object which is an equivalence class of a left
  semigroup  congruence  (see  [2XIsLeftSemigroupCongruence[102X  ([14X13.1-2[114X)). An object
  will  only  be  in  this  category  if  the  relation  is known to be a left
  semigroup congruence when the class is created.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([[127X[104X
    [4X[25X>[125X [27X Transformation([1, 2, 2]), Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpairs := [Transformation([1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X             Transformation([2, 1, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := LeftSemigroupCongruence(S, pairs);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong,[127X[104X
    [4X[25X>[125X [27X                                      Transformation([3, 1, 1]));[127X[104X
    [4X[28X<left congruence class of Transformation( [ 3, 1, 1 ] )>[128X[104X
    [4X[25Xgap>[125X [27XIsLeftCongruenceClass(class);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.3-3 IsRightCongruenceClass[101X
  
  [33X[1;0Y[29X[2XIsRightCongruenceClass[102X( [3Xobj[103X ) [32X category[133X
  
  [33X[0;0YThis  category  contains any object which is an equivalence class of a right
  semigroup  congruence  (see  [2XIsRightSemigroupCongruence[102X ([14X13.1-3[114X)). An object
  will  only  be  in  this  category  if  the  relation is known to be a right
  semigroup congruence when the class is created.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([[127X[104X
    [4X[25X>[125X [27X Transformation([1, 2, 2]), Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpairs := [Transformation([1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X             Transformation([2, 1, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RightSemigroupCongruence(S, pairs);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong,[127X[104X
    [4X[25X>[125X [27X                                      Transformation([3, 1, 1]));[127X[104X
    [4X[28X<right congruence class of Transformation( [ 3, 1, 1 ] )>[128X[104X
    [4X[25Xgap>[125X [27XIsRightCongruenceClass(class);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.3-4 NonTrivialEquivalenceClasses[101X
  
  [33X[1;0Y[29X[2XNonTrivialEquivalenceClasses[102X( [3Xeq[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of equivalence classes.[133X
  
  [33X[0;0YIf  [3Xeq[103X is an equivalence relation, then this attribute returns a list of all
  equivalence classes of [3Xeq[103X which contain more than one element.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([Transformation([1, 2, 2]),[127X[104X
    [4X[25X>[125X [27X                Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, [Transformation([1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X                                   Transformation([2, 1, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xclasses := NonTrivialEquivalenceClasses(cong);;[127X[104X
    [4X[25Xgap>[125X [27XSet(classes);[127X[104X
    [4X[28X[ <2-sided congruence class of Transformation( [ 1, 2, 2 ] )>,[128X[104X
    [4X[28X  <2-sided congruence class of Transformation( [ 3, 1, 3 ] )>,[128X[104X
    [4X[28X  <2-sided congruence class of Transformation( [ 3, 1, 1 ] )>,[128X[104X
    [4X[28X  <2-sided congruence class of Transformation( [ 2, 1, 2 ] )>,[128X[104X
    [4X[28X  <2-sided congruence class of Transformation( [ 3, 3, 3 ] )> ][128X[104X
    [4X[25Xgap>[125X [27Xcong := RightSemigroupCongruence(S, [Transformation([1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X                                        Transformation([2, 1, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xclasses := NonTrivialEquivalenceClasses(cong);;[127X[104X
    [4X[25Xgap>[125X [27XSet(classes);[127X[104X
    [4X[28X[ <right congruence class of Transformation( [ 3, 1, 3 ] )>,[128X[104X
    [4X[28X  <right congruence class of Transformation( [ 2, 1, 2 ] )> ][128X[104X
  [4X[32X[104X
  
  [1X13.3-5 EquivalenceRelationLookup[101X
  
  [33X[1;0Y[29X[2XEquivalenceRelationLookup[102X( [3Xequiv[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list.[133X
  
  [33X[0;0YThis  attribute  describes  the  equivalence  relation [3Xequiv[103X, defined over a
  finite  semigroup,  as a list of positive integers of length the size of the
  finite semigroup over which [3Xequiv[103X is defined.[133X
  
  [33X[0;0YEach  position  in the list corresponds to an element of the semigroup (in a
  consistent  canonical  order)  and  the integer at that position is a unique
  identifier for that element's equivalence class under [3Xequiv[103X. Two elements of
  the  semigroup  on  which  the  equivalence  is  defined  are related in the
  equivalence  if  and  only  if they have the same number at their respective
  positions in the lookup.[133X
  
  [33X[0;0YNote   that   the   order   in   which   numbers   appear  in  the  list  is
  non-deterministic,   and  two  equivalence  relations  describing  the  same
  mathematical relation might therefore have different lookups. Note also that
  the maximum value of the list may not be the number of classes of [3Xequiv[103X, and
  that    any    integer    might    not    be    included.    However,    see
  [2XEquivalenceRelationCanonicalLookup[102X ([14X13.3-6[114X).[133X
  
  [33X[0;0YSee          also          [2XEquivalenceRelationPartition[102X          ([14XReference:
  EquivalenceRelationPartition[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([[127X[104X
    [4X[25X>[125X [27X Transformation([1, 2, 2]), Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S,[127X[104X
    [4X[25X>[125X [27X[Transformation([1, 2, 1]), Transformation([2, 1, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xlookup := EquivalenceRelationLookup(cong);;[127X[104X
    [4X[25Xgap>[125X [27Xlookup[3] = lookup[8];[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xlookup[2] = lookup[9];[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X13.3-6 EquivalenceRelationCanonicalLookup[101X
  
  [33X[1;0Y[29X[2XEquivalenceRelationCanonicalLookup[102X( [3Xequiv[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list.[133X
  
  [33X[0;0YThis  attribute  describes  the  equivalence  relation [3Xequiv[103X, defined over a
  finite  semigroup,  as a list of positive integers of length the size of the
  semigroup.[133X
  
  [33X[0;0YEach  position  in the list corresponds to an element of the semigroup (in a
  consistent canonical order as defined by [2XPositionCanonical[102X ([14X11.1-2[114X)) and the
  integer  at  that  position  is  a  unique  identifier  for  that  element's
  equivalence       class       under       [3Xequiv[103X.      The      value      of
  [10XEquivalenceRelationCanonicalLookup[110X   has   the   property   that  the  first
  appearance  of  the  value  [10Xi[110X is strictly later than the first appearance of
  [10Xi-1[110X,  and  that  all  entries  in  the  list  will  be  from the range [10X[1 ..
  NrEquivalenceClasses([3Xequiv[103X[10X)][110X.  As such, two equivalence relations on a given
  semigroup are equal if and only if their canonical lookups are equal.[133X
  
  [33X[0;0YTwo  elements  of the semigroup on which the equivalence relation is defined
  are  related  in  the equivalence relation if and only if they have the same
  number at their respective positions in the lookup.[133X
  
  [33X[0;0YSee also [2XEquivalenceRelationLookup[102X ([14X13.3-5[114X) and [2XEquivalenceRelationPartition[102X
  ([14XReference: EquivalenceRelationPartition[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Monoid([[127X[104X
    [4X[25X>[125X [27X Transformation([1, 2, 2]), Transformation([3, 1, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S,[127X[104X
    [4X[25X>[125X [27X[Transformation([1, 2, 1]), Transformation([2, 1, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27XEquivalenceRelationCanonicalLookup(cong);[127X[104X
    [4X[28X[ 1, 2, 3, 4, 5, 6, 2, 3, 6, 4, 5, 6 ][128X[104X
  [4X[32X[104X
  
  [1X13.3-7 EquivalenceRelationCanonicalPartition[101X
  
  [33X[1;0Y[29X[2XEquivalenceRelationCanonicalPartition[102X( [3Xcong[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of lists.[133X
  
  [33X[0;0YThis  attribute returns a list of lists of elements of the underlying set of
  the  semigroup  congruence  [3Xcong[103X.  These  lists are precisely the nontrivial
  equivalence  classes  of  [3Xcong[103X.  The  order  in  which the classes appear is
  deterministic,  and  the  order  of  the  elements inside each class is also
  deterministic.    Hence,    two    congruence    objects   have   the   same
  [10XEquivalenceRelationCanonicalPartition[110X  if and only if they describe the same
  relation.[133X
  
  [33X[0;0YSee          also          [2XEquivalenceRelationPartition[102X          ([14XReference:
  EquivalenceRelationPartition[114X),  a  similar  attribute  which  does  not have
  canonical ordering, but which is likely to be faster.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup(Transformation([1, 4, 3, 3]),[127X[104X
    [4X[25X>[125X [27X                  Transformation([2, 4, 3, 3]));;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, [Transformation([1, 4, 3, 3]),[127X[104X
    [4X[25X>[125X [27X                                   Transformation([1, 3, 3, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27XEquivalenceRelationCanonicalPartition(cong);[127X[104X
    [4X[28X[ [ Transformation( [ 1, 4, 3, 3 ] ),[128X[104X
    [4X[28X      Transformation( [ 1, 3, 3, 3 ] ) ],[128X[104X
    [4X[28X  [ Transformation( [ 4, 3, 3, 3 ] ),[128X[104X
    [4X[28X      Transformation( [ 3, 3, 3, 3 ] ) ] ][128X[104X
  [4X[32X[104X
  
  [1X13.3-8 OnLeftCongruenceClasses[101X
  
  [33X[1;0Y[29X[2XOnLeftCongruenceClasses[102X( [3Xclass[103X, [3Xelm[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA left congruence class.[133X
  
  [33X[0;0YIf  [3Xclass[103X  is  an equivalence class of the left semigroup congruence [10Xcong[110X on
  the semigroup [10XS[110X, and [3Xelm[103X is an element of [10XS[110X, then this operation returns the
  equivalence  class  of  [10Xcong[110X  containing the element [10X[3Xelm[103X[10X * x[110X, where [10Xx[110X is any
  element  of  [3Xclass[103X.  The  result is well-defined by the definition of a left
  congruence.[133X
  
  [33X[0;0YSee [2XIsLeftSemigroupCongruence[102X ([14X13.1-2[114X) and [2XIsLeftCongruenceClass[102X ([14X13.3-2[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := LeftSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<left semigroup congruence over <transformation semigroup of degree 5[128X[104X
    [4X[28X with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27Xx := Transformation([3, 4, 3, 4, 3]);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong, x);[127X[104X
    [4X[28X<left congruence class of Transformation( [ 3, 4, 3, 4, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27Xelm := Transformation([1, 2, 2, 1, 2]);;[127X[104X
    [4X[25Xgap>[125X [27XOnLeftCongruenceClasses(class, elm);[127X[104X
    [4X[28X<left congruence class of Transformation( [ 3, 4, 4, 3, 4 ] )>[128X[104X
  [4X[32X[104X
  
  [1X13.3-9 OnRightCongruenceClasses[101X
  
  [33X[1;0Y[29X[2XOnRightCongruenceClasses[102X( [3Xclass[103X, [3Xelm[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA right congruence class.[133X
  
  [33X[0;0YIf  [3Xclass[103X  is an equivalence class of the right semigroup congruence [10Xcong[110X on
  the semigroup [10XS[110X, and [3Xelm[103X is an element of [10XS[110X, then this operation returns the
  equivalence  class  of  [10Xcong[110X  containing the element [10Xx * [3Xelm[103X[10X[110X, where [10Xx[110X is any
  element  of  [3Xclass[103X.  The result is well-defined by the definition of a right
  congruence.[133X
  
  [33X[0;0YSee [2XIsRightSemigroupCongruence[102X ([14X13.1-3[114X) and [2XIsRightCongruenceClass[102X ([14X13.3-3[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27X  Transformation([2, 1, 1, 2, 1]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 4]),[127X[104X
    [4X[25X>[125X [27X  Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X  Transformation([4, 3, 3, 4, 4])]);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([3, 4, 3, 4, 3]),[127X[104X
    [4X[25X>[125X [27X             Transformation([1, 2, 1, 2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [Transformation([4, 3, 4, 3, 4]),[127X[104X
    [4X[25X>[125X [27X             Transformation([3, 4, 3, 4, 3])];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RightSemigroupCongruence(S, [pair1, pair2]);[127X[104X
    [4X[28X<right semigroup congruence over <transformation semigroup of[128X[104X
    [4X[28X degree 5 with 4 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27Xx := Transformation([3, 4, 3, 4, 3]);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong, x);[127X[104X
    [4X[28X<right congruence class of Transformation( [ 3, 4, 3, 4, 3 ] )>[128X[104X
    [4X[25Xgap>[125X [27Xelm := Transformation([1, 2, 2, 1, 2]);;[127X[104X
    [4X[25Xgap>[125X [27XOnRightCongruenceClasses(class, elm);[127X[104X
    [4X[28X<right congruence class of Transformation( [ 2, 1, 2, 1, 2 ] )>[128X[104X
  [4X[32X[104X
  
  
  [1X13.4 [33X[0;0YFinding the congruences of a semigroup[133X[101X
  
  [1X13.4-1 CongruencesOfSemigroup[101X
  
  [33X[1;0Y[29X[2XCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XLeftCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XRightCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XLeftCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XRightCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe congruences of a semigroup.[133X
  
  [33X[0;0YThis  attribute  gives  a list of the left, right, or 2-sided congruences of
  the semigroup [3XS[103X.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  congruences generated by pairs of elements from
  [3Xrestriction[103X. Otherwise, all congruences will be calculated.[133X
  
  [33X[0;0YSee also [2XLatticeOfCongruences[102X ([14X13.4-5[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X                                [[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcongs := CongruencesOfSemigroup(S);;[127X[104X
    [4X[25Xgap>[125X [27XLength(congs);[127X[104X
    [4X[28X4[128X[104X
    [4X[25Xgap>[125X [27XSet(congs, NrEquivalenceClasses);[127X[104X
    [4X[28X[ 1, 5, 9, 25 ][128X[104X
    [4X[25Xgap>[125X [27Xpos := Position(congs, UniversalSemigroupCongruence(S));;[127X[104X
    [4X[25Xgap>[125X [27Xcongs[pos];[127X[104X
    [4X[28X<universal semigroup congruence over[128X[104X
    [4X[28X<Rees 0-matrix semigroup 2x2 over Sym( [ 1 .. 3 ] )>>[128X[104X
  [4X[32X[104X
  
  [1X13.4-2 MinimalCongruencesOfSemigroup[101X
  
  [33X[1;0Y[29X[2XMinimalCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XMinimalLeftCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XMinimalRightCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XMinimalCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMinimalLeftCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMinimalRightCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YThe congruences of a semigroup.[133X
  
  [33X[0;0YIf  [3XS[103X is a semigroup, then the attribute [10XMinimalCongruencesOfSemigroup[110X gives
  a  list  of  all  the  congruences  on  [3XS[103X which are [13Xminimal[113X. A congruence is
  minimal  iff  it  is  non-trivial  and  contains  no  other  congruences  as
  subrelations (apart from the trivial congruence).[133X
  
  [33X[0;0Y[10XMinimalLeftCongruencesOfSemigroup[110X  and [10XMinimalRightCongruencesOfSemigroup[110X do
  the same thing, but for left congruences and right congruences respectively.
  Note  that  any  congruence  is  also  a left congruence, but that a minimal
  congruence may not be a minimal left congruence.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  congruences generated by pairs of elements from
  [3Xrestriction[103X. Otherwise, all congruences will be calculated.[133X
  
  [33X[0;0YSee also [2XCongruencesOfSemigroup[102X ([14X13.4-1[114X) and [2XPrincipalCongruencesOfSemigroup[102X
  ([14X13.4-3[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup(Transformation([1, 3, 2]),[127X[104X
    [4X[25X>[125X [27X                  Transformation([3, 1, 3]));;[127X[104X
    [4X[25Xgap>[125X [27Xmin := MinimalCongruencesOfSemigroup(S);[127X[104X
    [4X[28X[ <2-sided semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>[128X[104X
    [4X[28X ][128X[104X
    [4X[25Xgap>[125X [27Xminl := MinimalLeftCongruencesOfSemigroup(S);[127X[104X
    [4X[28X[ <left semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <left semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <left semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>[128X[104X
    [4X[28X ][128X[104X
  [4X[32X[104X
  
  [1X13.4-3 PrincipalCongruencesOfSemigroup[101X
  
  [33X[1;0Y[29X[2XPrincipalCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPrincipalLeftCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPrincipalRightCongruencesOfSemigroup[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPrincipalCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XPrincipalLeftCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XPrincipalRightCongruencesOfSemigroup[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA list.[133X
  
  [33X[0;0YIf  [3XS[103X  is  a  semigroup,  then the attribute [10XPrincipalCongruencesOfSemigroup[110X
  gives  a  list of all the congruences on [3XS[103X which are [13Xprincipal[113X. A congruence
  is principal if and only if it is non-trivial and can be defined by a single
  generating pair.[133X
  
  [33X[0;0Y[10XPrincipalLeftCongruencesOfSemigroup[110X and [10XPrincipalRightCongruencesOfSemigroup[110X
  do   the  same  thing,  but  for  left  congruences  and  right  congruences
  respectively.  Note  that  any  congruence  is a left congruence and a right
  congruence,  but  that  a  principal  congruence may not be a principal left
  congruence or a principal right congruence.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  congruences generated by pairs of elements from
  [3Xrestriction[103X. Otherwise, all congruences will be calculated.[133X
  
  [33X[0;0YSee  also  [2XCongruencesOfSemigroup[102X ([14X13.4-1[114X) and [2XMinimalCongruencesOfSemigroup[102X
  ([14X13.4-2[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup(Transformation([1, 3, 2]),[127X[104X
    [4X[25X>[125X [27X                  Transformation([3, 1, 3]));;[127X[104X
    [4X[25Xgap>[125X [27Xcongs := PrincipalCongruencesOfSemigroup(S);[127X[104X
    [4X[28X[ <universal semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators>>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <transformation semigroup[128X[104X
    [4X[28X     of size 13, degree 3 with 2 generators> with 1 generating pairs>[128X[104X
    [4X[28X ][128X[104X
  [4X[32X[104X
  
  [1X13.4-4 IsCongruencePoset[101X
  
  [33X[1;0Y[29X[2XIsCongruencePoset[102X( [3Xposet[103X ) [32X Category[133X
  [33X[1;0Y[29X[2XIsCayleyDigraphOfCongruences[102X( [3Xposet[103X ) [32X Category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  category  contains  all  congruence  posets.  A  [13Xcongruence poset[113X is a
  partially  ordered  set  of congruences over a specific semigroup, where the
  ordering  is  defined  by  containment  according to [2XIsSubrelation[102X ([14X13.5-1[114X):
  given two congruences [10Xcong1[110X and [10Xcong2[110X, we say that [10Xcong1[110X < [10Xcong2[110X if and only
  if  [10Xcong1[110X  is  a  subrelation  (a refinement) of [10Xcong2[110X. The congruences in a
  congruence poset can be left, right, or two-sided.[133X
  
  [33X[0;0YA congruence poset is a digraph (see [2XIsDigraph[102X ([14XDigraphs: IsDigraph[114X)) with a
  vertex  for  each  congruence, and an edge from vertex [10Xi[110X to vertex [10Xj[110X only if
  the  congruence numbered [10Xi[110X is a subrelation of the congruence numbered [10Xj[110X. To
  avoid  using  an  unnecessarily  large  amount  of  memory  in some cases, a
  congruence  poset  does  not  necessarily  belong  to  [2XIsPartialOrderDigraph[102X
  ([14XDigraphs: IsPartialOrderDigraph[114X). In other words, although every congruence
  poset  represents  a partial order it is not necessarily the case that there
  is  an edge from vertex [10Xi[110X to vertex [10Xj[110X if and only if the congruence numbered
  [10Xi[110X is a subrelation of the congruence numbered [10Xj[110X.[133X
  
  [33X[0;0YThe  list  of congruences can be obtained using [2XCongruencesOfPoset[102X ([14X13.4-8[114X);
  and   the   underlying   semigroup  of  the  poset  can  be  obtained  using
  [2XUnderlyingSemigroupOfCongruencePoset[102X ([14X13.4-9[114X).[133X
  
  [33X[0;0YCongruence posets can be created using any of:[133X
  
  [30X    [33X[0;6Y[2XPosetOfCongruences[102X ([14X13.4-10[114X),[133X
  
  [30X    [33X[0;6Y[2XJoinSemilatticeOfCongruences[102X ([14X13.4-11[114X)[133X
  
  [30X    [33X[0;6Y[2XLatticeOfCongruences[102X  ([14X13.4-5[114X),  [2XLatticeOfLeftCongruences[102X ([14X13.4-5[114X), or
        [2XLatticeOfRightCongruences[102X ([14X13.4-5[114X)[133X
  
  [30X    [33X[0;6Y[2XCayleyDigraphOfCongruences[102X   ([14X13.4-6[114X),  [2XCayleyDigraphOfLeftCongruences[102X
        ([14X13.4-6[114X), or [2XCayleyDigraphOfRightCongruences[102X ([14X13.4-6[114X).[133X
  
  [33X[0;0Y[10XIsCayleyDigraphOfCongruences[110X    only    applies    to    the    output    of
  [2XJoinSemilatticeOfCongruences[102X ([14X13.4-11[114X), [2XCayleyDigraphOfCongruences[102X ([14X13.4-6[114X),
  [2XCayleyDigraphOfLeftCongruences[102X ([14X13.4-6[114X), and [2XCayleyDigraphOfRightCongruences[102X
  ([14X13.4-6[114X).  The  congruences  used as the generating set for these operations
  can be obtained using [2XGeneratingCongruencesOfJoinSemilattice[102X ([14X13.4-12[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := SymmetricInverseMonoid(2);;[127X[104X
    [4X[25Xgap>[125X [27Xposet := LatticeOfCongruences(S);[127X[104X
    [4X[28X<lattice of 4 two-sided congruences over[128X[104X
    [4X[28X <symmetric inverse monoid of degree 2>>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruencePoset(poset);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsDigraph(poset);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphicDigraph(poset,[127X[104X
    [4X[25X>[125X [27XDigraph([[1, 2, 3, 4], [2], [2, 3], [2, 3, 4]]));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XT := FullTransformationMonoid(3);;[127X[104X
    [4X[25Xgap>[125X [27Xcongs := PrincipalCongruencesOfSemigroup(T);;[127X[104X
    [4X[25Xgap>[125X [27Xposet := JoinSemilatticeOfCongruences(PosetOfCongruences(congs));[127X[104X
    [4X[28X<lattice of 6 two-sided congruences over[128X[104X
    [4X[28X <full transformation monoid of degree 3>>[128X[104X
    [4X[25Xgap>[125X [27XIsCayleyDigraphOfCongruences(poset);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsCongruencePoset(poset);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XDigraphNrVertices(poset);[127X[104X
    [4X[28X6[128X[104X
    [4X[25Xgap>[125X [27Xposet := CayleyDigraphOfCongruences(T);[127X[104X
    [4X[28X<poset of 7 two-sided congruences over[128X[104X
    [4X[28X <full transformation monoid of degree 3>>[128X[104X
    [4X[25Xgap>[125X [27XIsCayleyDigraphOfCongruences(poset);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.4-5 LatticeOfCongruences[101X
  
  [33X[1;0Y[29X[2XLatticeOfCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XLatticeOfLeftCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XLatticeOfRightCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XLatticeOfCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XLatticeOfLeftCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XLatticeOfRightCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA lattice digraph.[133X
  
  [33X[0;0YIf  [3XS[103X  is  a semigroup, then [10XLatticeOfCongruences[110X returns a congruence poset
  object  containing  all  the congruences of [3XS[103X and information about how they
  are  contained  in  each  other.  See  [2XIsCongruencePoset[102X  ([14X13.4-4[114X)  for more
  details.[133X
  
  [33X[0;0Y[10XLatticeOfLeftCongruences[110X and [10XLatticeOfRightCongruences[110X do the same thing for
  left and right congruences, respectively.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  congruences generated by pairs of elements from
  [3Xrestriction[103X. Otherwise, all congruences will be calculated.[133X
  
  [33X[0;0YSee [2XCongruencesOfSemigroup[102X ([14X13.4-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(2);;[127X[104X
    [4X[25Xgap>[125X [27XLatticeOfCongruences(S);[127X[104X
    [4X[28X<lattice of 3 two-sided congruences over <regular transformation[128X[104X
    [4X[28X monoid of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XLatticeOfLeftCongruences(S);[127X[104X
    [4X[28X<lattice of 3 left congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XLatticeOfRightCongruences(S);[127X[104X
    [4X[28X<lattice of 5 right congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphicDigraph(LatticeOfRightCongruences(S),[127X[104X
    [4X[25X>[125X [27XDigraph([[1, 2, 3, 4, 5], [2], [2, 3], [2, 4], [2, 5]]));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XS := FullTransformationMonoid(4);;[127X[104X
    [4X[25Xgap>[125X [27Xrestriction := [Transformation([1, 1, 1, 1]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([1, 1, 1, 2]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([1, 1, 1, 3])];;[127X[104X
    [4X[25Xgap>[125X [27Xlatt := LatticeOfCongruences(S, Combinations(restriction, 2));[127X[104X
    [4X[28X<lattice of 2 two-sided congruences over[128X[104X
    [4X[28X <full transformation monoid of degree 4>>[128X[104X
  [4X[32X[104X
  
  [1X13.4-6 CayleyDigraphOfCongruences[101X
  
  [33X[1;0Y[29X[2XCayleyDigraphOfCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XCayleyDigraphOfLeftCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XCayleyDigraphOfRightCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XCayleyDigraphOfCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XCayleyDigraphOfLeftCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XCayleyDigraphOfRightCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA digraph.[133X
  
  [33X[0;0YIf  [3XS[103X  is  a  semigroup,  then  [10XCayleyDigraphOfCongruences[110X returns the right
  Cayley  graph  of  the  semilattice  of congruences of [3XS[103X with respect to the
  generating set consisting of the principal congruences congruence poset. See
  [2XIsCayleyDigraphOfCongruences[102X ([14X13.4-4[114X) for more details.[133X
  
  [33X[0;0Y[10XCayleyDigraphOfLeftCongruences[110X  and  [10XCayleyDigraphOfRightCongruences[110X  do the
  same thing for left and right congruences, respectively.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  congruences generated by pairs of elements from
  [3Xrestriction[103X. Otherwise, all congruences will be calculated.[133X
  
  [33X[0;0YNote  that  [2XLatticeOfCongruences[102X  ([14X13.4-5[114X),  and its analogues for right and
  left  congruences,  return  the  reflexive transitive closure of the digraph
  returned  by this function (with any multiple edges removed). If there are a
  large  number  of  congruences,  then  it might be the case that forming the
  reflexive  transitive  closure takes a significant amount of time, and so it
  might be desirable to use this function instead.[133X
  
  [33X[0;0YSee [2XCongruencesOfSemigroup[102X ([14X13.4-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(2);;[127X[104X
    [4X[25Xgap>[125X [27XCayleyDigraphOfCongruences(S);[127X[104X
    [4X[28X<poset of 3 two-sided congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XCayleyDigraphOfLeftCongruences(S);[127X[104X
    [4X[28X<poset of 3 left congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XCayleyDigraphOfRightCongruences(S);[127X[104X
    [4X[28X<poset of 5 right congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XIsIsomorphicDigraph(CayleyDigraphOfRightCongruences(S),[127X[104X
    [4X[25X>[125X [27XDigraph([[2, 3, 4], [2, 5, 5], [5, 3, 5], [5, 5, 4], [5, 5, 5]]));[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XS := FullTransformationMonoid(4);;[127X[104X
    [4X[25Xgap>[125X [27Xrestriction := [Transformation([1, 1, 1, 1]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([1, 1, 1, 2]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([1, 1, 1, 3])];;[127X[104X
    [4X[25Xgap>[125X [27XCayleyDigraphOfCongruences(S, Combinations(restriction, 2));[127X[104X
    [4X[28X<poset of 2 two-sided congruences over[128X[104X
    [4X[28X <full transformation monoid of degree 4>>[128X[104X
  [4X[32X[104X
  
  [1X13.4-7 PosetOfPrincipalCongruences[101X
  
  [33X[1;0Y[29X[2XPosetOfPrincipalCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPosetOfPrincipalLeftCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPosetOfPrincipalRightCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XPosetOfPrincipalCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XPosetOfPrincipalLeftCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XPosetOfPrincipalRightCongruences[102X( [3XS[103X, [3Xrestriction[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA congruence poset.[133X
  
  [33X[0;0YIf  [3XS[103X  is a semigroup, then [10XPosetOfPrincipalCongruences[110X returns a congruence
  poset  object  which contains all the principal congruences of [3XS[103X, ordered by
  containment  according  to [2XIsSubrelation[102X ([14X13.5-1[114X). A congruence is [13Xprincipal[113X
  if    it    can    be    defined    by    a    single    generating    pair.
  [10XPosetOfPrincipalLeftCongruences[110X  and [10XPosetOfPrincipalRightCongruences[110X do the
  same thing for left and right congruences respectively.[133X
  
  [33X[0;0YIf [3Xrestriction[103X is specified and is a collection of elements from [3XS[103X, then the
  result  will  only  include  principal  congruences  generated  by  pairs of
  elements  from  [3Xrestriction[103X.  Otherwise,  all  principal congruences will be
  calculated.[133X
  
  [33X[0;0YSee  also  [2XLatticeOfCongruences[102X ([14X13.4-5[114X) and [2XPrincipalCongruencesOfSemigroup[102X
  ([14X13.4-3[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup(Transformation([1, 3, 1]),[127X[104X
    [4X[25X>[125X [27X                  Transformation([2, 3, 3]));;[127X[104X
    [4X[25Xgap>[125X [27XPosetOfPrincipalLeftCongruences(S);[127X[104X
    [4X[28X<poset of 12 left congruences over <transformation semigroup[128X[104X
    [4X[28X of size 11, degree 3 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XPosetOfPrincipalCongruences(S);[127X[104X
    [4X[28X<lattice of 3 two-sided congruences over <transformation semigroup[128X[104X
    [4X[28X of size 11, degree 3 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27Xrestriction := [Transformation([3, 2, 3]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([3, 1, 3]),[127X[104X
    [4X[25X>[125X [27X                   Transformation([2, 2, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xposet := PosetOfPrincipalRightCongruences(S,[127X[104X
    [4X[25X>[125X [27XCombinations(restriction, 2));[127X[104X
    [4X[28X<poset of 3 right congruences over <transformation semigroup[128X[104X
    [4X[28X of size 11, degree 3 with 2 generators>>[128X[104X
  [4X[32X[104X
  
  [1X13.4-8 CongruencesOfPoset[101X
  
  [33X[1;0Y[29X[2XCongruencesOfPoset[102X( [3Xposet[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list.[133X
  
  [33X[0;0YIf [3Xposet[103X is a congruence poset object, then this attribute returns a list of
  all  the  congruence  objects  in  the  poset  (these may be left, right, or
  two-sided).  The  order of this list corresponds to the order of the entries
  in the poset.[133X
  
  [33X[0;0YSee also [2XLatticeOfCongruences[102X ([14X13.4-5[114X) and [2XCongruencesOfSemigroup[102X ([14X13.4-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(2);;[127X[104X
    [4X[25Xgap>[125X [27Xlatt := LatticeOfRightCongruences(S);[127X[104X
    [4X[28X<lattice of 5 right congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XCongruencesOfPoset(latt);[127X[104X
    [4X[28X[ <2-sided semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 3, degree 2 with 2 generators> with 0 generating pairs>,[128X[104X
    [4X[28X  <right semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 3, degree 2 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <right semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 3, degree 2 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <right semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 3, degree 2 with 2 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <right semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 3, degree 2 with 2 generators> with 2 generating pairs> ][128X[104X
  [4X[32X[104X
  
  [1X13.4-9 UnderlyingSemigroupOfCongruencePoset[101X
  
  [33X[1;0Y[29X[2XUnderlyingSemigroupOfCongruencePoset[102X( [3Xposet[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA semigroup.[133X
  
  [33X[0;0YIf  [3Xposet[103X  is  a  congruence  poset  object, then this attribute returns the
  semigroup on which all its congruences are defined.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(2);[127X[104X
    [4X[28X<regular transformation monoid of degree 2 with 2 generators>[128X[104X
    [4X[25Xgap>[125X [27Xlatt := LatticeOfRightCongruences(S);[127X[104X
    [4X[28X<lattice of 5 right congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XUnderlyingSemigroupOfCongruencePoset(latt) = S;[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.4-10 PosetOfCongruences[101X
  
  [33X[1;0Y[29X[2XPosetOfCongruences[102X( [3Xcoll[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA congruence poset.[133X
  
  [33X[0;0YIf [3Xcoll[103X is a list or collection of semigroup congruences (which may be left,
  right, or two-sided) then this operation returns the congruence poset formed
  by these congruences partially ordered by containment.[133X
  
  [33X[0;0YThis  operation  does  not create any new congruences or take any joins. See
  also [2XJoinSemilatticeOfCongruences[102X ([14X13.4-11[114X), [2XIsCongruencePoset[102X ([14X13.4-4[114X), and
  [2XLatticeOfCongruences[102X ([14X13.4-5[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(2);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [Transformation([1, 1]), IdentityTransformation];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [IdentityTransformation, Transformation([2, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xcoll := [RightSemigroupCongruence(S, pair1),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, pair2),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, [])];;[127X[104X
    [4X[25Xgap>[125X [27Xposet := PosetOfCongruences(coll);[127X[104X
    [4X[28X<poset of 3 right congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 3, degree 2 with 2 generators>>[128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(poset);[127X[104X
    [4X[28X[ [ 1 ], [ 2 ], [ 1, 2, 3 ] ][128X[104X
  [4X[32X[104X
  
  [1X13.4-11 JoinSemilatticeOfCongruences[101X
  
  [33X[1;0Y[29X[2XJoinSemilatticeOfCongruences[102X( [3Xposet[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA congruence poset.[133X
  
  [33X[0;0YIf  [3Xposet[103X  is  a  congruence  poset  (i.e.  it  satisfies  [2XIsCongruencePoset[102X
  ([14X13.4-4[114X)),  then  this function returns the congruence poset formed by these
  congruences  partially  ordered  by containment, along with all their joins.
  This includes the empty join which equals the trivial congruence.[133X
  
  [33X[0;0YThe  digraph  returned  by  this function represents the Cayley graph of the
  semilattice generated by [2XCongruencesOfPoset[102X ([14X13.4-8[114X) with identity adjoined.
  The  reflexive  transitive  closure of this digraph is a join semillatice in
  the sense of [2XIsJoinSemilatticeDigraph[102X ([14XDigraphs: IsJoinSemilatticeDigraph[114X).[133X
  
  [33X[0;0YSee also [2XIsCongruencePoset[102X ([14X13.4-4[114X) and [2XPosetOfCongruences[102X ([14X13.4-10[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := SymmetricInverseMonoid(2);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [PartialPerm([1], [1]), PartialPerm([2], [1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [PartialPerm([1], [1]), PartialPerm([1, 2], [1, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair3 := [PartialPerm([1, 2], [1, 2]),[127X[104X
    [4X[25X>[125X [27X             PartialPerm([1, 2], [2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xcoll := [RightSemigroupCongruence(S, pair1),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, pair2),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, pair3)];;[127X[104X
    [4X[25Xgap>[125X [27XD := JoinSemilatticeOfCongruences(PosetOfCongruences(coll));[127X[104X
    [4X[28X<poset of 4 right congruences over[128X[104X
    [4X[28X <symmetric inverse monoid of degree 2>>[128X[104X
    [4X[25Xgap>[125X [27XIsJoinSemilatticeDigraph(DigraphReflexiveTransitiveClosure(D));[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.4-12 GeneratingCongruencesOfJoinSemilattice[101X
  
  [33X[1;0Y[29X[2XGeneratingCongruencesOfJoinSemilattice[102X( [3Xposet[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of congruences.[133X
  
  [33X[0;0YIf   [3Xposet[103X   satisfies   [2XIsCayleyDigraphOfCongruences[102X  ([14X13.4-4[114X),  then  this
  attribute holds the generating set for the semilattice of congruences (where
  the operation is join).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := OrderEndomorphisms(3);;[127X[104X
    [4X[25Xgap>[125X [27XD := CayleyDigraphOfCongruences(S);[127X[104X
    [4X[28X<poset of 4 two-sided congruences over <regular transformation monoid[128X[104X
    [4X[28X of size 10, degree 3 with 3 generators>>[128X[104X
    [4X[25Xgap>[125X [27XGeneratingCongruencesOfJoinSemilattice(D);[127X[104X
    [4X[28X[ <universal semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 10, degree 3 with 3 generators>>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 10, degree 3 with 3 generators> with 1 generating pairs>,[128X[104X
    [4X[28X  <2-sided semigroup congruence over <regular transformation monoid[128X[104X
    [4X[28X     of size 10, degree 3 with 3 generators> with 1 generating pairs>[128X[104X
    [4X[28X ][128X[104X
  [4X[32X[104X
  
  [1X13.4-13 MinimalCongruences[101X
  
  [33X[1;0Y[29X[2XMinimalCongruences[102X( [3Xcoll[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XMinimalCongruences[102X( [3Xposet[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list.[133X
  
  [33X[0;0YIf [3Xcoll[103X is a list or collection of semigroup congruences (which may be left,
  right,  or  two-sided)  then  this  attribute  returns  a  list  of  all the
  congruences   from   [3Xcoll[103X  which  do  not  contain  any  of  the  others  as
  subrelations.[133X
  
  [33X[0;0YAlternatively,  a congruence poset [3Xposet[103X can be specified; in this case, the
  congruences  contained  in  [3Xposet[103X  will  be  used  in  place  of  [3Xcoll[103X,  and
  information already known about their containments will be used.[133X
  
  [33X[0;0YThis  function  should  not  be  confused with [2XMinimalCongruencesOfSemigroup[102X
  ([14X13.4-2[114X).   See   also  [2XIsCongruencePoset[102X  ([14X13.4-4[114X)  and  [2XPosetOfCongruences[102X
  ([14X13.4-10[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := SymmetricInverseMonoid(2);;[127X[104X
    [4X[25Xgap>[125X [27Xpair1 := [PartialPerm([1], [1]), PartialPerm([2], [1])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair2 := [PartialPerm([1], [1]), PartialPerm([1, 2], [1, 2])];;[127X[104X
    [4X[25Xgap>[125X [27Xpair3 := [PartialPerm([1, 2], [1, 2]),[127X[104X
    [4X[25X>[125X [27X             PartialPerm([1, 2], [2, 1])];;[127X[104X
    [4X[25Xgap>[125X [27Xcoll := [RightSemigroupCongruence(S, pair1),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, pair2),[127X[104X
    [4X[25X>[125X [27X            RightSemigroupCongruence(S, pair3)];;[127X[104X
    [4X[25Xgap>[125X [27XMinimalCongruences(PosetOfCongruences(coll));[127X[104X
    [4X[28X[ <right semigroup congruence over <symmetric inverse monoid of degree\[128X[104X
    [4X[28X 2> with 1 generating pairs>,[128X[104X
    [4X[28X  <right semigroup congruence over <symmetric inverse monoid of degree\[128X[104X
    [4X[28X 2> with 1 generating pairs> ][128X[104X
    [4X[25Xgap>[125X [27Xposet := LatticeOfCongruences(S);[127X[104X
    [4X[28X<lattice of 4 two-sided congruences over[128X[104X
    [4X[28X <symmetric inverse monoid of degree 2>>[128X[104X
    [4X[25Xgap>[125X [27XMinimalCongruences(poset);[127X[104X
    [4X[28X[ <2-sided semigroup congruence over <symmetric inverse monoid of degr\[128X[104X
    [4X[28Xee 2> with 0 generating pairs> ][128X[104X
  [4X[32X[104X
  
  [1X13.4-14 NumberOfRightCongruences[101X
  
  [33X[1;0Y[29X[2XNumberOfRightCongruences[102X( [3XS[103X, [3Xn[103X, [3Xextra[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XNumberOfLeftCongruences[102X( [3XS[103X, [3Xn[103X, [3Xextra[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XNumberOfRightCongruences[102X( [3XS[103X, [3Xn[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XNumberOfLeftCongruences[102X( [3XS[103X, [3Xn[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XNumberOfRightCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XNumberOfLeftCongruences[102X( [3XS[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA non-negative integer.[133X
  
  [33X[0;0Y[10XNumberOfRightCongruences[110X  returns  the  number  of  right congruences of the
  semigroup  [3XS[103X  with  at  most  [3Xn[103X  classes  that  contain  the pairs in [3Xextra[103X;
  [10XNumberOfLeftCongruences[110X  is  defined dually for left congruences rather than
  right congruences.[133X
  
  [33X[0;0YIf    the   optional   third   argument   [3Xextra[103X   is   not   present,   then
  [10XNumberOfRightCongruences[110X  returns  the number of right congruences of [3XS[103X with
  at most [3Xn[103X classes.[133X
  
  [33X[0;0YIf    the    optional    second    argument   [3Xn[103X   is   not   present,   then
  [10XNumberOfRightCongruences[110X returns the number of right congruences of [3XS[103X.[133X
  
  [33X[0;0YNote  that  the 2 and 3 argument variants of this function can be applied to
  infinite semigroups, but the 1 argument variant cannot.[133X
  
  [33X[0;0YIf the lattice of right or left congruences of [3XS[103X is known, then that is used
  by  [10XNumberOfRightCongruences[110X.  If  this lattice is not known, then Sim's low
  index congruence algorithm is used.[133X
  
  [33X[0;0YSee  [2XIteratorOfRightCongruences[102X ([14X13.4-15[114X) to actually obtain the congruences
  counted by this function.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := PartitionMonoid(2);[127X[104X
    [4X[28X<regular bipartition *-monoid of size 15, degree 2 with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XNumberOfRightCongruences(S, 10);[127X[104X
    [4X[28X86[128X[104X
    [4X[25Xgap>[125X [27XNumberOfLeftCongruences(S, 10);[127X[104X
    [4X[28X86[128X[104X
    [4X[25Xgap>[125X [27XNumberOfRightCongruences(S, Size(S), [[S.1, S.2], [S.1, S.3]]);[127X[104X
    [4X[28X1[128X[104X
    [4X[25Xgap>[125X [27XNumberOfLeftCongruences(S, Size(S), [[S.1, S.2], [S.1, S.3]]);[127X[104X
    [4X[28X1[128X[104X
  [4X[32X[104X
  
  [1X13.4-15 IteratorOfRightCongruences[101X
  
  [33X[1;0Y[29X[2XIteratorOfRightCongruences[102X( [3XS[103X, [3Xn[103X, [3Xextra[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIteratorOfLeftCongruences[102X( [3XS[103X, [3Xn[103X, [3Xextra[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIteratorOfRightCongruences[102X( [3XS[103X, [3Xn[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIteratorOfLeftCongruences[102X( [3XS[103X, [3Xn[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XIteratorOfRightCongruences[102X( [3XS[103X ) [32X attribute[133X
  [33X[1;0Y[29X[2XIteratorOfLeftCongruences[102X( [3XS[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YAn iterator.[133X
  
  [33X[0;0Y[10XIteratorOfRightCongruences[110X  returns  an  iterator where calling [2XNextIterator[102X
  ([14XReference: NextIterator[114X) returns the next right congruence of the semigroup
  [3XS[103X   with   at   most   [3Xn[103X   classes   that   contain   the  pairs  in  [3Xextra[103X;
  [10XIteratorOfLeftCongruences[110X is defined dually for left congruences rather than
  right congruences.[133X
  
  [33X[0;0YIf    the   optional   third   argument   [3Xextra[103X   is   not   present,   then
  [10XIteratorOfRightCongruences[110X uses an empty list by default.[133X
  
  [33X[0;0YIf    the    optional    second    argument   [3Xn[103X   is   not   present,   then
  [10XIteratorOfRightCongruences[110X uses [10XSize([3XS[103X[10X)[110X by default.[133X
  
  [33X[0;0YNote  that  the 2 and 3 argument variants of this function can be applied to
  infinite semigroups, but the 1 argument variant cannot.[133X
  
  [33X[0;0YIf the lattice of right or left congruences of [3XS[103X is known, then that is used
  by  [10XIteratorOfRightCongruences[110X. If this lattice is not known, then Sim's low
  index congruence algorithm is used.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XF := FreeMonoidAndAssignGeneratorVars("a", "b");[127X[104X
    [4X[28X<free monoid on the generators [ a, b ]>[128X[104X
    [4X[25Xgap>[125X [27XR := [[a ^ 3, a], [b ^ 2, b], [(a * b) ^ 2, a]];[127X[104X
    [4X[28X[ [ a^3, a ], [ b^2, b ], [ (a*b)^2, a ] ][128X[104X
    [4X[25Xgap>[125X [27XS := F / R;[127X[104X
    [4X[28X<fp monoid with 2 generators and 3 relations of length 14>[128X[104X
    [4X[25Xgap>[125X [27XNumberOfRightCongruences(S);[127X[104X
    [4X[28X6[128X[104X
    [4X[25Xgap>[125X [27Xit := IteratorOfRightCongruences(S);[127X[104X
    [4X[28X<iterator>[128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 1, 1 ] ][128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 2, 1 ], [ 2, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 2, 2 ], [ 2, 2 ] ][128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 2, 3 ], [ 2, 2 ], [ 2, 3 ] ][128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 2, 3 ], [ 2, 2 ], [ 3, 3 ] ][128X[104X
    [4X[25Xgap>[125X [27XOutNeighbours(WordGraph(NextIterator(it)));[127X[104X
    [4X[28X[ [ 2, 3 ], [ 2, 2 ], [ 4, 3 ], [ 4, 4 ] ][128X[104X
    [4X[25Xgap>[125X [27XNextIterator(it);[127X[104X
    [4X[28Xfail[128X[104X
  [4X[32X[104X
  
  
  [1X13.5 [33X[0;0YComparing congruences[133X[101X
  
  [1X13.5-1 IsSubrelation[101X
  
  [33X[1;0Y[29X[2XIsSubrelation[102X( [3Xcong1[103X, [3Xcong2[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YIf  [3Xcong1[103X  and  [3Xcong2[103X  are  congruences  over  the same semigroup, then this
  operation returns whether [3Xcong2[103X is a refinement of [3Xcong1[103X, i.e. whether every
  pair in [3Xcong2[103X is contained in [3Xcong1[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong1 := SemigroupCongruence(S, [RMSElement(S, 1, (1, 2, 3), 1),[127X[104X
    [4X[25X>[125X [27X                                    RMSElement(S, 1, (), 1)]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong2 := SemigroupCongruence(S, []);;[127X[104X
    [4X[25Xgap>[125X [27XIsSubrelation(cong1, cong2);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27XIsSubrelation(cong2, cong1);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X13.5-2 IsSuperrelation[101X
  
  [33X[1;0Y[29X[2XIsSuperrelation[102X( [3Xcong1[103X, [3Xcong2[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YTrue or false.[133X
  
  [33X[0;0YIf  [3Xcong1[103X  and  [3Xcong2[103X  are  congruences  over  the same semigroup, then this
  operation returns whether [3Xcong1[103X is a refinement of [3Xcong2[103X, i.e. whether every
  pair in [3Xcong1[103X is contained in [3Xcong2[103X.[133X
  
  [33X[0;0YSee [2XIsSubrelation[102X ([14X13.5-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong1 := SemigroupCongruence(S, [RMSElement(S, 1, (1, 2, 3), 1),[127X[104X
    [4X[25X>[125X [27X                                    RMSElement(S, 1, (), 1)]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong2 := SemigroupCongruence(S, []);;[127X[104X
    [4X[25Xgap>[125X [27XIsSuperrelation(cong1, cong2);[127X[104X
    [4X[28Xfalse[128X[104X
    [4X[25Xgap>[125X [27XIsSuperrelation(cong2, cong1);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.5-3 MeetSemigroupCongruences[101X
  
  [33X[1;0Y[29X[2XMeetSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMeetLeftSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XMeetRightSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA semigroup congruence.[133X
  
  [33X[0;0YThis  operation  returns the [13Xmeet[113X of the two semigroup congruences [3Xc1[103X and [3Xc2[103X
  -- that is, the largest semigroup congruence contained in both [3Xc1[103X and [3Xc2[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong1 := SemigroupCongruence(S, [RMSElement(S, 1, (1, 2, 3), 1),[127X[104X
    [4X[25X>[125X [27X                                    RMSElement(S, 1, (), 1)]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong2 := SemigroupCongruence(S, []);;[127X[104X
    [4X[25Xgap>[125X [27XMeetSemigroupCongruences(cong1, cong2);[127X[104X
    [4X[28X<semigroup congruence over <Rees 0-matrix semigroup 2x2 over[128X[104X
    [4X[28X  Sym( [ 1 .. 3 ] )> with linked triple (1,2,2)>[128X[104X
  [4X[32X[104X
  
  [1X13.5-4 JoinSemigroupCongruences[101X
  
  [33X[1;0Y[29X[2XJoinSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XJoinLeftSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XJoinRightSemigroupCongruences[102X( [3Xc1[103X, [3Xc2[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA semigroup congruence.[133X
  
  [33X[0;0YThis  operation  returns the [13Xjoin[113X of the two semigroup congruences [3Xc1[103X and [3Xc2[103X
  --  that  is, the smallest semigroup congruence containing all the relations
  in both [3Xc1[103X and [3Xc2[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong1 := SemigroupCongruence(S, [RMSElement(S, 1, (1, 2, 3), 1),[127X[104X
    [4X[25X>[125X [27X                                    RMSElement(S, 1, (), 1)]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong2 := SemigroupCongruence(S, []);;[127X[104X
    [4X[25Xgap>[125X [27XJoinSemigroupCongruences(cong1, cong2);[127X[104X
    [4X[28X<semigroup congruence over <Rees 0-matrix semigroup 2x2 over[128X[104X
    [4X[28X  Sym( [ 1 .. 3 ] )> with linked triple (3,2,2)>[128X[104X
  [4X[32X[104X
  
  
  [1X13.6 [33X[0;0YCongruences on Rees matrix semigroups[133X[101X
  
  [33X[0;0YThis  section  describes  the  implementation  of  congruences of simple and
  0-simple  semigroups in the [5XSemigroups[105X package, and the functions associated
  with  them.  This  code  and this part of the manual were written by Michael
  Young.  Most  of  the  theorems used in this chapter are from Section 3.5 of
  [How95].[133X
  
  [33X[0;0YBy  the  Rees  Theorem,  any  0-simple  semigroup  [22XS[122X is isomorphic to a [13XRees
  0-matrix  semigroup[113X  (see [14X'Reference: Rees Matrix Semigroups'[114X) over a group,
  with a regular sandwich matrix.[133X
  
  [33X[0;0YThat  is,  [10XS[110X  is isomorphic to [10XM ^ 0[G; I, L; P][110X where [10XG[110X is a group, [10XL[110X and [10XI[110X
  are  non-empty  sets and the matrix [10XP[110X is regular in the sense that it has no
  rows or columns consisting solely of zeroes.[133X
  
  [33X[0;0YThe  congruences of a Rees 0-matrix semigroup are in 1-1 correspondence with
  the [13Xlinked triple[113X, which is a triple of the form [10X[N, S, T][110X where:[133X
  
  [30X    [33X[0;6Y[10XN[110X is a normal subgroup of the underlying group [10XG[110X,[133X
  
  [30X    [33X[0;6Y[10XS[110X is an equivalence relation on the columns of [10XP[110X,[133X
  
  [30X    [33X[0;6Y[10XT[110X is an equivalence relation on the rows of [10XP[110X,[133X
  
  [33X[0;0Ysatisfying the following conditions:[133X
  
  [30X    [33X[0;6Ya  pair of [10XS[110X-related columns must contain zeroes in precisely the same
        rows,[133X
  
  [30X    [33X[0;6Ya  pair  of  [10XT[110X-related  rows must contain zeroes in precisely the same
        columns,[133X
  
  [30X    [33X[0;6Yif [10Xi[110X and [10Xj[110X are [10XS[110X-related, [10Xk[110X and [10Xl[110X are [10XT[110X-related and the matrix entries
        [22Xp_k, i, p_k, j, p_l, i, p_l, j ≠ 0[122X, then [22Xq_k, l, i, j ∈ N[122X, where[133X
  
  
  [24X      [33X[0;6Yq_{k, l, i, j} = p_{k, i} p_{l, i} ^ {-1} p_{l, j} p_{k, j} ^ {-1}.[133X
  
  [124X
  
  [33X[0;0YBy  Theorem  3.5.9  in  [How95],  for  any  finite  0-simple  Rees  0-matrix
  semigroup,  there  is  a bijection between its non-universal congruences and
  its  linked triples. In this way, we can internally represent any congruence
  of such a semigroup by storing its associated linked triple instead of a set
  of  generating  pairs,  and  thus  perform  many  calculations  on  it  more
  efficiently.[133X
  
  [33X[0;0YIf a congruence is defined by a linked triple [10X(N, S, T)[110X, then a single class
  of  that  congruence can be defined by a triple [10X(Nx, i / S, k / S)[110X, where [10XNx[110X
  is  a  right coset of [10XN[110X, [10Xi / S[110X is the equivalence class of [10Xi[110X in [10XS[110X, and [10Xk / S[110X
  is  the  equivalence  class  of [10Xk[110X in [10XT[110X. Thus we can internally represent any
  class  of  such  a congruence as a triple simply consisting of a right coset
  and two positive integers.[133X
  
  [33X[0;0YAn  analogous  condition  exists  for  finite  simple Rees matrix semigroups
  without zero.[133X
  
  [1X13.6-1 IsRMSCongruenceByLinkedTriple[101X
  
  [33X[1;0Y[29X[2XIsRMSCongruenceByLinkedTriple[102X( [3Xobj[103X ) [32X category[133X
  [33X[1;0Y[29X[2XIsRZMSCongruenceByLinkedTriple[102X( [3Xobj[103X ) [32X category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThese  categories describe a type of semigroup congruence over a Rees matrix
  or 0-matrix semigroup. Externally, an object of this type may be used in the
  same   way  as  any  other  object  in  the  category  [2XIsSemigroupCongruence[102X
  ([14XReference:  IsSemigroupCongruence[114X)  but it is represented internally by its
  [13Xlinked  triple[113X, and certain functions may take advantage of this information
  to reduce computation times.[133X
  
  [33X[0;0YAn  object  of this type may be constructed with [10XRMSCongruenceByLinkedTriple[110X
  or  [10XRZMSCongruenceByLinkedTriple[110X,  or  this  representation  may be selected
  automatically by [2XSemigroupCongruence[102X ([14X13.2-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := Group([(1, 4, 5), (1, 5, 3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27Xmat := [[0, 0, (1, 4, 5), 0, 0, (1, 4, 3, 5)],[127X[104X
    [4X[25X>[125X [27X           [0, (), 0, 0, (3, 5), 0],[127X[104X
    [4X[25X>[125X [27X           [(), 0, 0, (3, 5), 0, 0]];;[127X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(G, mat);;[127X[104X
    [4X[25Xgap>[125X [27XN := Group([(1, 4)(3, 5), (1, 5)(3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27XcolBlocks := [[1], [2, 5], [3, 6], [4]];;[127X[104X
    [4X[25Xgap>[125X [27XrowBlocks := [[1], [2], [3]];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RZMSCongruenceByLinkedTriple(S, N, colBlocks, rowBlocks);;[127X[104X
    [4X[25Xgap>[125X [27XIsRZMSCongruenceByLinkedTriple(cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.6-2 RMSCongruenceByLinkedTriple[101X
  
  [33X[1;0Y[29X[2XRMSCongruenceByLinkedTriple[102X( [3XS[103X, [3XN[103X, [3XcolBlocks[103X, [3XrowBlocks[103X ) [32X function[133X
  [33X[1;0Y[29X[2XRZMSCongruenceByLinkedTriple[102X( [3XS[103X, [3XN[103X, [3XcolBlocks[103X, [3XrowBlocks[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA Rees matrix or 0-matrix semigroup congruence by linked triple.[133X
  
  [33X[0;0YThis  function  returns  a  semigroup  congruence  over  the  Rees matrix or
  0-matrix  semigroup  [3XS[103X  corresponding  to  the  linked triple ([3XN[103X, [3XcolBlocks[103X,
  [3XrowBlocks[103X).  The  argument  [3XN[103X  should be a normal subgroup of the underlying
  semigroup of [3XS[103X; [3XcolBlocks[103X should be a partition of the columns of the matrix
  of  [3XS[103X;  and  [3XrowBlocks[103X should be a partition of the rows of the matrix of [3XS[103X.
  For  example,  if  the  matrix  has 5 rows, then a possibility for [3XrowBlocks[103X
  might be [10X[[1, 3], [2, 5], [4]][110X.[133X
  
  [33X[0;0YIf  the arguments describe a valid linked triple on [3XS[103X, then an object in the
  category [10XIsRZMSCongruenceByLinkedTriple[110X is returned. This object can be used
  like any other semigroup congruence in [5XGAP[105X.[133X
  
  [33X[0;0YIf  the  arguments  describe  a  triple  which  is  not  [13Xlinked[113X in the sense
  described above, then this function returns an error.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := Group([(1, 4, 5), (1, 5, 3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27Xmat := [[0, 0, (1, 4, 5), 0, 0, (1, 4, 3, 5)],[127X[104X
    [4X[25X>[125X [27X           [0, (), 0, 0, (3, 5), 0],[127X[104X
    [4X[25X>[125X [27X           [(), 0, 0, (3, 5), 0, 0]];;[127X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(G, mat);;[127X[104X
    [4X[25Xgap>[125X [27XN := Group([(1, 4)(3, 5), (1, 5)(3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27XcolBlocks := [[1], [2, 5], [3, 6], [4]];;[127X[104X
    [4X[25Xgap>[125X [27XrowBlocks := [[1], [2], [3]];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RZMSCongruenceByLinkedTriple(S, N, colBlocks, rowBlocks);;[127X[104X
  [4X[32X[104X
  
  [1X13.6-3 IsRMSCongruenceClassByLinkedTriple[101X
  
  [33X[1;0Y[29X[2XIsRMSCongruenceClassByLinkedTriple[102X( [3Xobj[103X ) [32X category[133X
  [33X[1;0Y[29X[2XIsRZMSCongruenceClassByLinkedTriple[102X( [3Xobj[103X ) [32X category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThese categories contain the congruence classes of a semigroup congruence of
  the      categories      [2XIsRMSCongruenceByLinkedTriple[102X      ([14X13.6-1[114X)     and
  [2XIsRZMSCongruenceByLinkedTriple[102X ([14X13.6-1[114X) respectively.[133X
  
  [33X[0;0YAn  object  of  one  of these types may be used in the same way as any other
  object  in  the  category  [2XIsCongruenceClass[102X  ([14X13.3-1[114X),  but  the  class  is
  represented  internally  by  information  related to the congruence's [13Xlinked
  triple[113X,  and  certain  functions  may  take advantage of this information to
  reduce computation times.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := Group([(1, 4, 5), (1, 5, 3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27Xmat := [[0, 0, (1, 4, 5), 0, 0, (1, 4, 3, 5)],[127X[104X
    [4X[25X>[125X [27X           [0, (), 0, 0, (3, 5), 0],[127X[104X
    [4X[25X>[125X [27X           [(), 0, 0, (3, 5), 0, 0]];;[127X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(G, mat);;[127X[104X
    [4X[25Xgap>[125X [27XN := Group([(1, 4)(3, 5), (1, 5)(3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27XcolBlocks := [[1], [2, 5], [3, 6], [4]];;[127X[104X
    [4X[25Xgap>[125X [27XrowBlocks := [[1], [2], [3]];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RZMSCongruenceByLinkedTriple(S, N, colBlocks, rowBlocks);;[127X[104X
    [4X[25Xgap>[125X [27Xclasses := EquivalenceClasses(cong);;[127X[104X
    [4X[25Xgap>[125X [27XIsRZMSCongruenceClassByLinkedTriple(classes[1]);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.6-4 RMSCongruenceClassByLinkedTriple[101X
  
  [33X[1;0Y[29X[2XRMSCongruenceClassByLinkedTriple[102X( [3Xcong[103X, [3XnCoset[103X, [3XcolClass[103X, [3XrowClass[103X ) [32X operation[133X
  [33X[1;0Y[29X[2XRZMSCongruenceClassByLinkedTriple[102X( [3Xcong[103X, [3XnCoset[103X, [3XcolClass[103X, [3XrowClass[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA  Rees  matrix  or  0-matrix semigroup congruence class by linked
            triple.[133X
  
  [33X[0;0YThis  operation  returns  one  congruence  class  of the congruence [3Xcong[103X, as
  defined by the other three parameters.[133X
  
  [33X[0;0YThe  argument [3Xcong[103X must be a Rees matrix or 0-matrix semigroup congruence by
  linked  triple.  If  the  linked  triple consists of the three parameters [10XN[110X,
  [10XcolBlocks[110X  and  [10XrowBlocks[110X,  then [3XnCoset[103X must be a right coset of [10XN[110X, [3XcolClass[103X
  must  be  a  positive  integer  corresponding  to  a  position  in  the list
  [10XcolBlocks[110X,  and  [3XrowClass[103X  must  be  a  positive  integer corresponding to a
  position in the list [10XrowBlocks[110X.[133X
  
  [33X[0;0YIf   the  arguments  are  valid,  an  [10XIsRMSCongruenceClassByLinkedTriple[110X  or
  [10XIsRZMSCongruenceClassByLinkedTriple[110X  object  is  returned, which can be used
  like any other equivalence class in [5XGAP[105X. Otherwise, an error is returned.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := Group([(1, 4, 5), (1, 5, 3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27Xmat := [[0, 0, (1, 4, 5), 0, 0, (1, 4, 3, 5)],[127X[104X
    [4X[25X>[125X [27X           [0, (), 0, 0, (3, 5), 0],[127X[104X
    [4X[25X>[125X [27X           [(), 0, 0, (3, 5), 0, 0]];;[127X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(G, mat);;[127X[104X
    [4X[25Xgap>[125X [27XN := Group([(1, 4)(3, 5), (1, 5)(3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27XcolBlocks := [[1], [2, 5], [3, 6], [4]];;[127X[104X
    [4X[25Xgap>[125X [27XrowBlocks := [[1], [2], [3]];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := RZMSCongruenceByLinkedTriple(S, N, colBlocks, rowBlocks);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := RZMSCongruenceClassByLinkedTriple(cong,[127X[104X
    [4X[25X>[125X [27XRightCoset(N, (1, 5)), 2, 3);[127X[104X
    [4X[28X<2-sided congruence class of (2,(3,4),3)>[128X[104X
  [4X[32X[104X
  
  [1X13.6-5 IsLinkedTriple[101X
  
  [33X[1;0Y[29X[2XIsLinkedTriple[102X( [3XS[103X, [3XN[103X, [3XcolBlocks[103X, [3XrowBlocks[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  operation  returns  true  if  and only if the arguments ([3XN[103X, [3XcolBlocks[103X,
  [3XrowBlocks[103X) describe a linked triple of the Rees matrix or 0-matrix semigroup
  [3XS[103X, as described above.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XG := Group([(1, 4, 5), (1, 5, 3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27Xmat := [[0, 0, (1, 4, 5), 0, 0, (1, 4, 3, 5)],[127X[104X
    [4X[25X>[125X [27X           [0, (), 0, 0, (3, 5), 0],[127X[104X
    [4X[25X>[125X [27X           [(), 0, 0, (3, 5), 0, 0]];;[127X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(G, mat);;[127X[104X
    [4X[25Xgap>[125X [27XN := Group([(1, 4)(3, 5), (1, 5)(3, 4)]);;[127X[104X
    [4X[25Xgap>[125X [27XcolBlocks := [[1], [2, 5], [3, 6], [4]];;[127X[104X
    [4X[25Xgap>[125X [27XrowBlocks := [[1], [2], [3]];;[127X[104X
    [4X[25Xgap>[125X [27XIsLinkedTriple(S, N, colBlocks, rowBlocks);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.6-6 AsSemigroupCongruenceByGeneratingPairs[101X
  
  [33X[1;0Y[29X[2XAsSemigroupCongruenceByGeneratingPairs[102X( [3Xcong[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA semigroup congruence.[133X
  
  [33X[0;0YThis  operation  takes  [3Xcong[103X,  a  semigroup congruence, and returns the same
  congruence  relation,  but  described  by  [5XGAP[105X's  default method of defining
  semigroup congruences: a set of generating pairs for the congruence.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X                                [[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := CongruencesOfSemigroup(S)[3];;[127X[104X
    [4X[25Xgap>[125X [27XAsSemigroupCongruenceByGeneratingPairs(cong);[127X[104X
    [4X[28X<semigroup congruence over <Rees 0-matrix semigroup 2x2 over[128X[104X
    [4X[28X  Sym( [ 1 .. 3 ] )> with linked triple (3,2,2)>[128X[104X
  [4X[32X[104X
  
  
  [1X13.7 [33X[0;0YCongruences on inverse semigroups[133X[101X
  
  [33X[0;0YThis   section  describes  the  implementation  of  congruences  of  inverse
  semigroups  in  the  [5XSemigroups[105X  package,  and the functions associated with
  them.  This  code and this part of the manual were written by Michael Young.
  Most of the theorems used in this chapter are from Section 5.3 of [How95].[133X
  
  [33X[0;0YThe  congruences  of an inverse semigroup are in 1-1 correspondence with its
  [13Xcongruence pairs[113X. A congruence pair is a pair [10X(N, t)[110X such that:[133X
  
  [30X    [33X[0;6Y[10XN[110X  is  a  normal  subsemigroup  of  [10XS[110X  --  that  is,  a self-conjugate
        subsemigroup which contains all the idempotents of [10XS[110X,[133X
  
  [30X    [33X[0;6Y[10Xt[110X  is a normal congruence on [10XE[110X, the subsemigroup of all idempotents in
        [10XS[110X  --  that  is, a congruence on [10XE[110X such that if [22X(e, f)[122X is a pair in [10Xt[110X,
        then the pair [22X(a ^ -1 e a, a ^ -1 f a)[122X is also in [10Xt[110X,[133X
  
  [33X[0;0Ysatisfying the following conditions:[133X
  
  [30X    [33X[0;6YIf [22Xae ∈ N[122X and [22X(e, a ^ -1 a) ∈ t[122X, then [22Xa ∈ N[122X,[133X
  
  [30X    [33X[0;6YIf [22Xa ∈ N[122X, then [22X(aa ^ -1 , a ^ -1 a) ∈ t[122X.[133X
  
  [33X[0;0YBy Theorem 5.3.3 in [How95], for any inverse semigroup, there is a bijection
  between  its  congruences  and  its  congruence  pairs.  In this way, we can
  internally  represent  any  congruence  of  such  a semigroup by storing its
  associated  congruence  pair  instead of a set of generating pairs, and thus
  perform many calculations on it more efficiently.[133X
  
  [33X[0;0YIf  we  have a congruence [10XC[110X with congruence pair [10X(N, t)[110X, it turns out that [10XN[110X
  is  its [13Xkernel[113X (that is, the set of all elements congruent to an idempotent)
  and  that [10Xt[110X is its [13Xtrace[113X (that is, the restriction of [10XC[110X to the idempotents).
  Hence,  we  refer  to a congruence stored in this format as a "congruence by
  kernel and trace".[133X
  
  [33X[0;0YSee  [10Xcong_by_ker_trace_threshold[110X  in  Section  [14X6.3[114X  for details on when this
  method is used.[133X
  
  [1X13.7-1 IsInverseSemigroupCongruenceByKernelTrace[101X
  
  [33X[1;0Y[29X[2XIsInverseSemigroupCongruenceByKernelTrace[102X( [3Xcong[103X ) [32X Category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  category  contains  any  inverse  semigroup  congruence  [3Xcong[103X which is
  represented  internally  by  its  kernel  and trace. The [2XSemigroupCongruence[102X
  ([14X13.2-1[114X)  function  may  create  an  object  of  this  category if its first
  argument  [3XS[103X  is an inverse semigroup and has sufficiently large size. It can
  be treated like any other semigroup congruence object.[133X
  
  [33X[0;0YSee     [How95]     Section    5.3    for    more    details.    See    also
  [2XInverseSemigroupCongruenceByKernelTrace[102X ([14X13.7-2[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X PartialPerm([4, 3, 1, 2]),[127X[104X
    [4X[25X>[125X [27X PartialPerm([1, 4, 2, 0, 3])],[127X[104X
    [4X[25X>[125X [27X rec(cong_by_ker_trace_threshold := 0));;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, []);[127X[104X
    [4X[28X<semigroup congruence over <inverse partial perm semigroup[128X[104X
    [4X[28X of size 351, rank 5 with 2 generators> with congruence pair (24,24)>[128X[104X
    [4X[25Xgap>[125X [27XIsInverseSemigroupCongruenceByKernelTrace(cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.7-2 InverseSemigroupCongruenceByKernelTrace[101X
  
  [33X[1;0Y[29X[2XInverseSemigroupCongruenceByKernelTrace[102X( [3XS[103X, [3Xkernel[103X, [3XtraceBlocks[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YAn inverse semigroup congruence by kernel and trace.[133X
  
  [33X[0;0YIf  [3XS[103X is an inverse semigroup, [3Xkernel[103X is a subsemigroup of [3XS[103X, [3XtraceBlocks[103X is
  a  list  of  lists  describing  a  congruence  on  the idempotents of [3XS[103X, and
  [22X([3Xkernel[103X, [3Xtrace[103X)[122X describes a valid congruence pair for [3XS[103X (see [How95] Section
  5.3)  then  this  function  returns the semigroup congruence defined by that
  congruence pair.[133X
  
  [33X[0;0YSee also [2XKernelOfSemigroupCongruence[102X ([14X13.7-4[114X) and [2XTraceOfSemigroupCongruence[102X
  ([14X13.7-5[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X  PartialPerm([2, 3]), PartialPerm([2, 0, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xkernel := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X  PartialPerm([1, 0, 3]), PartialPerm([0, 2, 3]),[127X[104X
    [4X[25X>[125X [27X  PartialPerm([1, 2]), PartialPerm([3]),[127X[104X
    [4X[25X>[125X [27X  PartialPerm([2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xtrace := [[127X[104X
    [4X[25X>[125X [27X [PartialPerm([0, 2, 3])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([1, 2])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([1, 0, 3])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([0, 0, 3]), PartialPerm([0, 2]),[127X[104X
    [4X[25X>[125X [27X  PartialPerm([1]), PartialPerm([], [])]];;[127X[104X
    [4X[25Xgap>[125X [27Xcong := InverseSemigroupCongruenceByKernelTrace(S, kernel, trace);[127X[104X
    [4X[28X<semigroup congruence over <inverse partial perm semigroup of rank 3[128X[104X
    [4X[28X with 2 generators> with congruence pair (13,4)>[128X[104X
  [4X[32X[104X
  
  [1X13.7-3 AsInverseSemigroupCongruenceByKernelTrace[101X
  
  [33X[1;0Y[29X[2XAsInverseSemigroupCongruenceByKernelTrace[102X( [3Xcong[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YAn inverse semigroup congruence by kernel and trace.[133X
  
  [33X[0;0YIf  [3Xcong[103X  is  a  semigroup  congruence  over an inverse semigroup, then this
  attribute returns an object which describes the same congruence, but with an
  internal representation defined by that congruence's kernel and trace.[133X
  
  [33X[0;0YSee [How95] section 5.3 for more details.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XI := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X PartialPerm([2, 3]), PartialPerm([2, 0, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruenceByGeneratingPairs(I,[127X[104X
    [4X[25X>[125X [27X[[PartialPerm([0, 1, 3]), PartialPerm([0, 1])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([]), PartialPerm([1, 2])]]);[127X[104X
    [4X[28X<2-sided semigroup congruence over <inverse partial perm semigroup of[128X[104X
    [4X[28X rank 3 with 2 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27Xcong2 := AsInverseSemigroupCongruenceByKernelTrace(cong);[127X[104X
    [4X[28X<semigroup congruence over <inverse partial perm semigroup[128X[104X
    [4X[28X of size 19, rank 3 with 2 generators> with congruence pair (19,1)>[128X[104X
  [4X[32X[104X
  
  [1X13.7-4 KernelOfSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XKernelOfSemigroupCongruence[102X( [3Xcong[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YAn inverse semigroup.[133X
  
  [33X[0;0YIf  [3Xcong[103X  is  a  congruence  over  a  semigroup  with  inverse op, then this
  attribute  returns  the  [13Xkernel[113X  of  that  congruence;  that is, the inverse
  subsemigroup  consisting  of all elements which are related to an idempotent
  by [3Xcong[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XI := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X PartialPerm([2, 3]), PartialPerm([2, 0, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(I,[127X[104X
    [4X[25X>[125X [27X[[PartialPerm([0, 1, 3]), PartialPerm([0, 1])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([]), PartialPerm([1, 2])]]);[127X[104X
    [4X[28X<2-sided semigroup congruence over <inverse partial perm semigroup[128X[104X
    [4X[28X of size 19, rank 3 with 2 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XKernelOfSemigroupCongruence(cong);[127X[104X
    [4X[28X<inverse partial perm semigroup of size 19, rank 3 with 5 generators>[128X[104X
  [4X[32X[104X
  
  [1X13.7-5 TraceOfSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XTraceOfSemigroupCongruence[102X( [3Xcong[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA list of lists.[133X
  
  [33X[0;0YIf  [3Xcong[103X  is  an inverse semigroup congruence by kernel and trace, then this
  attribute  returns  the  restriction  of  [3Xcong[103X  to  the  idempotents  of the
  semigroup.  This  is in block form: each idempotent will appear in precisely
  one  list,  and two idempotents will be in the same list if and only if they
  are related by [3Xcong[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XI := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X PartialPerm([2, 3]), PartialPerm([2, 0, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(I,[127X[104X
    [4X[25X>[125X [27X[[PartialPerm([0, 1, 3]), PartialPerm([0, 1])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([]), PartialPerm([1, 2])]]);[127X[104X
    [4X[28X<2-sided semigroup congruence over <inverse partial perm semigroup[128X[104X
    [4X[28X of size 19, rank 3 with 2 generators> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XTraceOfSemigroupCongruence(cong);[127X[104X
    [4X[28X[ [ <empty partial perm>, <identity partial perm on [ 1 ]>,[128X[104X
    [4X[28X      <identity partial perm on [ 2 ]>,[128X[104X
    [4X[28X      <identity partial perm on [ 1, 2 ]>,[128X[104X
    [4X[28X      <identity partial perm on [ 3 ]>,[128X[104X
    [4X[28X      <identity partial perm on [ 2, 3 ]>,[128X[104X
    [4X[28X      <identity partial perm on [ 1, 3 ]> ] ][128X[104X
  [4X[32X[104X
  
  [1X13.7-6 IsInverseSemigroupCongruenceClassByKernelTrace[101X
  
  [33X[1;0Y[29X[2XIsInverseSemigroupCongruenceClassByKernelTrace[102X( [3Xobj[103X ) [32X Category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  category  contains  any congruence class which belongs to a congruence
  which   is   represented   internally   by   its   kernel   and  trace.  See
  [2XInverseSemigroupCongruenceByKernelTrace[102X ([14X13.7-2[114X).[133X
  
  [33X[0;0YSee [How95] Section 5.3 for more details.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XI := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X PartialPerm([2, 3]), PartialPerm([2, 0, 3])],[127X[104X
    [4X[25X>[125X [27Xrec(cong_by_ker_trace_threshold := 0));;[127X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(I,[127X[104X
    [4X[25X>[125X [27X[[PartialPerm([0, 1, 3]), PartialPerm([0, 1])],[127X[104X
    [4X[25X>[125X [27X [PartialPerm([]), PartialPerm([1, 2])]]);;[127X[104X
    [4X[25Xgap>[125X [27Xclass := EquivalenceClassOfElement(cong,[127X[104X
    [4X[25X>[125X [27X                                     PartialPerm([1, 2], [2, 3]));;[127X[104X
    [4X[25Xgap>[125X [27XIsInverseSemigroupCongruenceClassByKernelTrace(class);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.7-7 MinimumGroupCongruence[101X
  
  [33X[1;0Y[29X[2XMinimumGroupCongruence[102X( [3XS[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YAn inverse semigroup congruence by kernel and trace.[133X
  
  [33X[0;0YIf  [3XS[103X  is  an  inverse  semigroup,  then  this  function  returns  the least
  congruence on [3XS[103X whose quotient is a group.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := InverseSemigroup([[127X[104X
    [4X[25X>[125X [27X  PartialPerm([5, 2, 0, 0, 1, 4]),[127X[104X
    [4X[25X>[125X [27X  PartialPerm([1, 4, 6, 3, 5, 0, 2])]);;[127X[104X
    [4X[25Xgap>[125X [27Xcong := MinimumGroupCongruence(S);[127X[104X
    [4X[28X<semigroup congruence over <inverse partial perm semigroup[128X[104X
    [4X[28X of size 101, rank 7 with 2 generators> with congruence pair (59,1)>[128X[104X
    [4X[25Xgap>[125X [27XIsGroupAsSemigroup(S / cong);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X13.8 [33X[0;0YCongruences on graph inverse semigroups[133X[101X
  
  [1X13.8-1 IsCongruenceByWangPair[101X
  
  [33X[1;0Y[29X[2XIsCongruenceByWangPair[102X( [3Xcong[103X ) [32X property[133X
  
  [33X[0;0YA  congruence by Wang pair [10Xcong[110X is a congruence of a graph inverse semigroup
  [10XS[110X  which  is  expressed  in  terms  of  two  sets [3XH[103X and [3XW[103X of vertices of the
  corresponding  graph  of  [3XS[103X.  The  set [3XH[103X must be a hereditary subset (closed
  under  reachability)  and  all  vertices in [3XW[103X must have all but one of their
  out-neighbours  in  [3XH[103X.  For  more  information on Wang pairs see [Wan19] and
  [AMMM23].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XD := Digraph([[3, 4], [3, 4], [4], []]);[127X[104X
    [4X[28X<immutable digraph with 4 vertices, 5 edges>[128X[104X
    [4X[25Xgap>[125X [27XS := GraphInverseSemigroup(D);[127X[104X
    [4X[28X<finite graph inverse semigroup with 4 vertices, 5 edges>[128X[104X
    [4X[25Xgap>[125X [27Xcong := CongruenceByWangPair(S, [3, 4], []);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [  ]>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruenceByWangPair(cong);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xcong := CongruenceByWangPair(S, [4], [2]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruenceByWangPair(cong);[127X[104X
    [4X[28Xtrue[128X[104X
    [4X[25Xgap>[125X [27Xe_1 := S.1;[127X[104X
    [4X[28Xe_1[128X[104X
    [4X[25Xgap>[125X [27Xe_3 := S.3;[127X[104X
    [4X[28Xe_3[128X[104X
    [4X[25Xgap>[125X [27Xcong := SemigroupCongruence(S, [[e_1, e_3]]);[127X[104X
    [4X[28X<2-sided semigroup congruence over <finite graph inverse semigroup wit\[128X[104X
    [4X[28Xh 4 vertices, 5 edges> with 1 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XIsCongruenceByWangPair(cong);[127X[104X
    [4X[28Xfalse[128X[104X
  [4X[32X[104X
  
  [1X13.8-2 CongruenceByWangPair[101X
  
  [33X[1;0Y[29X[2XCongruenceByWangPair[102X( [3XS[103X, [3XH[103X, [3XW[103X ) [32X function[133X
  [6XReturns:[106X  [33X[0;10YA semigroup congruence.[133X
  
  [33X[0;0YThis  function  returns  a  semigroup  congruence  over  the  graph  inverse
  semigroup [3XS[103X in the form of a Wang pair.[133X
  
  [33X[0;0YIf  [3XS[103X  is a finite graph inverse semigroup [3XH[103X and [3XW[103X are two lists of vertices
  in  the  graph  of  [3XS[103X  representing  a  valid  hereditary subset and a W-set
  respectively,  then  this  function  will  return  the  semigroup congruence
  defined   by   this   Wang   pair.   For   the   definition   of  Wang  pair
  [2XIsCongruenceByWangPair[102X ([14X13.8-1[114X).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XD := Digraph([[3, 4], [3, 4], [4], []]);[127X[104X
    [4X[28X<immutable digraph with 4 vertices, 5 edges>[128X[104X
    [4X[25Xgap>[125X [27XS := GraphInverseSemigroup(D);[127X[104X
    [4X[28X<finite graph inverse semigroup with 4 vertices, 5 edges>[128X[104X
    [4X[25Xgap>[125X [27Xcong := CongruenceByWangPair(S, [3, 4], []);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [  ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := CongruenceByWangPair(S, [4], [2]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := CongruenceByWangPair(S, [3, 4], []);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [  ]>[128X[104X
  [4X[32X[104X
  
  [1X13.8-3 AsCongruenceByWangPair[101X
  
  [33X[1;0Y[29X[2XAsCongruenceByWangPair[102X( [3Xcong[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA congruence by Wang pair.[133X
  
  [33X[0;0YThis  operation takes [3Xcong[103X, a finite graph inverse semigroup congruence, and
  returns  an  object  representing  the  same  congruence, but described as a
  congruence  by Wang pairs: a pair of sets [3XH[103X and [3XW[103X of the corresponding graph
  of  [3XS[103X  that  are  a  hereditary  subset  and  a  W-set  of  the  graph  of [3XS[103X
  respectively.  For  more  information  about  Wang  pairs  see  [Wan19]  and
  [AMMM23].[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XD := Digraph([[2, 3], [3], [4], []]);[127X[104X
    [4X[28X<immutable digraph with 4 vertices, 4 edges>[128X[104X
    [4X[25Xgap>[125X [27XS := GraphInverseSemigroup(D);[127X[104X
    [4X[28X<finite graph inverse semigroup with 4 vertices, 4 edges>[128X[104X
    [4X[25Xgap>[125X [27XCongruenceByWangPair(S, [4], [2]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := AsSemigroupCongruenceByGeneratingPairs(last);[127X[104X
    [4X[28X<2-sided semigroup congruence over <finite graph inverse semigroup wit\[128X[104X
    [4X[28Xh 4 vertices, 4 edges> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XAsCongruenceByWangPair(cong);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27XCongruenceByWangPair(S, [3, 4], [1]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ 1 ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := AsSemigroupCongruenceByGeneratingPairs(last);[127X[104X
    [4X[28X<2-sided semigroup congruence over <finite graph inverse semigroup wit\[128X[104X
    [4X[28Xh 4 vertices, 4 edges> with 3 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XAsCongruenceByWangPair(cong);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ 1 ]>[128X[104X
  [4X[32X[104X
  
  [1X13.8-4 GeneratingCongruencesOfLattice[101X
  
  [33X[1;0Y[29X[2XGeneratingCongruencesOfLattice[102X( [3XS[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA semigroup.[133X
  
  [33X[0;0YThis  attribute  takes  a  finite  graph  inverse  semigroup [3XS[103X and returns a
  minimal  generating set for the lattice of congruences of [3XS[103X, as described in
  [AMMM23].  This  operation  works  only  if the corresponding digraph of the
  graph  inverse semigroup is simple. If there are multiple edges, an error is
  returned.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XD := Digraph([[2, 3], [3], [4], []]);[127X[104X
    [4X[28X<immutable digraph with 4 vertices, 4 edges>[128X[104X
    [4X[25Xgap>[125X [27XS := GraphInverseSemigroup(D);[127X[104X
    [4X[28X<finite graph inverse semigroup with 4 vertices, 4 edges>[128X[104X
    [4X[25Xgap>[125X [27XCongruenceByWangPair(S, [4], [2]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := AsSemigroupCongruenceByGeneratingPairs(last);[127X[104X
    [4X[28X<2-sided semigroup congruence over <finite graph inverse semigroup wit\[128X[104X
    [4X[28Xh 4 vertices, 4 edges> with 2 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XAsCongruenceByWangPair(cong);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 4 ] and W = [ 2 ]>[128X[104X
    [4X[25Xgap>[125X [27XCongruenceByWangPair(S, [3, 4], [1]);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ 1 ]>[128X[104X
    [4X[25Xgap>[125X [27Xcong := AsSemigroupCongruenceByGeneratingPairs(last);[127X[104X
    [4X[28X<2-sided semigroup congruence over <finite graph inverse semigroup wit\[128X[104X
    [4X[28Xh 4 vertices, 4 edges> with 3 generating pairs>[128X[104X
    [4X[25Xgap>[125X [27XAsCongruenceByWangPair(cong);[127X[104X
    [4X[28X<graph inverse semigroup congruence with H = [ 3, 4 ] and W = [ 1 ]>[128X[104X
  [4X[32X[104X
  
  
  [1X13.9 [33X[0;0YRees congruences[133X[101X
  
  [33X[0;0YA  Rees  congruence is defined by a semigroup ideal. It is a congruence on a
  semigroup  [10XS[110X  which has one congruence class equal to a semigroup ideal [10XI[110X of
  [10XS[110X, and every other congruence class being a singleton.[133X
  
  [1X13.9-1 SemigroupIdealOfReesCongruence[101X
  
  [33X[1;0Y[29X[2XSemigroupIdealOfReesCongruence[102X( [3Xcong[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA semigroup ideal.[133X
  
  [33X[0;0YIf   [3Xcong[103X   is   a   rees   congruence   (see  [2XIsReesCongruence[102X  ([14XReference:
  IsReesCongruence[114X))  then this attribute returns the two-sided ideal that was
  used  to  define  it,  i.e.~the  ideal  of  elements in the only non-trivial
  congruence class of [3Xcong[103X.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([[127X[104X
    [4X[25X>[125X [27XTransformation([2, 3, 4, 3, 1, 1]),[127X[104X
    [4X[25X>[125X [27XTransformation([6, 4, 4, 4, 6, 1])]);;[127X[104X
    [4X[25Xgap>[125X [27XI := SemigroupIdeal(S,[127X[104X
    [4X[25X>[125X [27XTransformation([4, 4, 4, 4, 4, 2]),[127X[104X
    [4X[25X>[125X [27XTransformation([3, 3, 3, 3, 3, 2]));;[127X[104X
    [4X[25Xgap>[125X [27Xcong := ReesCongruenceOfSemigroupIdeal(I);;[127X[104X
    [4X[25Xgap>[125X [27XSemigroupIdealOfReesCongruence(cong);[127X[104X
    [4X[28X<non-regular transformation semigroup ideal of degree 6 with[128X[104X
    [4X[28X  2 generators>[128X[104X
  [4X[32X[104X
  
  [1X13.9-2 IsReesCongruenceClass[101X
  
  [33X[1;0Y[29X[2XIsReesCongruenceClass[102X( [3Xobj[103X ) [32X category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  category  describes  a  congruence  class  of  a  Rees  congruence.  A
  congruence class of a Rees congruence either contains all the elements of an
  ideal,    or    is    a    singleton   (see   [2XIsReesCongruence[102X   ([14XReference:
  IsReesCongruence[114X)).[133X
  
  [33X[0;0YAn  object  of this type may be used in the same way as any other congruence
  class object.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([127X[104X
    [4X[25X>[125X [27XTransformation([2, 3, 4, 3, 1, 1]),[127X[104X
    [4X[25X>[125X [27XTransformation([6, 4, 4, 4, 6, 1]));;[127X[104X
    [4X[25Xgap>[125X [27XI := SemigroupIdeal(S,[127X[104X
    [4X[25X>[125X [27XTransformation([4, 4, 4, 4, 4, 2]),[127X[104X
    [4X[25X>[125X [27XTransformation([3, 3, 3, 3, 3, 2]));;[127X[104X
    [4X[25Xgap>[125X [27Xcong := ReesCongruenceOfSemigroupIdeal(I);;[127X[104X
    [4X[25Xgap>[125X [27Xclasses := EquivalenceClasses(cong);;[127X[104X
    [4X[25Xgap>[125X [27XIsReesCongruenceClass(classes[1]);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  
  [1X13.10 [33X[0;0YUniversal and trivial congruences[133X[101X
  
  [33X[0;0YThe linked triples of a completely 0-simple Rees 0-matrix semigroup describe
  only its non-universal congruences. In any one of these, the zero element of
  the  semigroup  is  related only to itself. However, for any semigroup [22XS[122X the
  universal  relation  [22XS  xS[122X is a congruence; called the [13Xuniversal congruence[113X.
  The universal congruence on a semigroup has its own unique representation.[133X
  
  [33X[0;0YSince  many things we want to calculate about congruences are trivial in the
  case   of  the  universal  congruence,  this  package  contains  a  category
  specifically designed for it, [10XIsUniversalSemigroupCongruence[110X. We also define
  [10XIsUniversalSemigroupCongruenceClass[110X,  which represents the single congruence
  class of the universal congruence.[133X
  
  [1X13.10-1 IsUniversalSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XIsUniversalSemigroupCongruence[102X( [3Xobj[103X ) [32X property[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  property describes a type of semigroup congruence, which must refer to
  the [13Xuniversal semigroup congruence[113X [22XS × S[122X. Externally, an object of this type
  may  be  used  in  the  same  way  as  any  other  object  in  the  category
  [2XIsSemigroupCongruence[102X ([14XReference: IsSemigroupCongruence[114X).[133X
  
  [33X[0;0YAn  object of this type may be constructed with [10XUniversalSemigroupCongruence[110X
  or this representation may be selected automatically as an alternative to an
  [10XIsRZMSCongruenceByLinkedTriple[110X object (since the universal congruence cannot
  be represented by a linked triple).[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([Transformation([3, 2, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27XU := UniversalSemigroupCongruence(S);;[127X[104X
    [4X[25Xgap>[125X [27XIsUniversalSemigroupCongruence(U);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.10-2 IsUniversalSemigroupCongruenceClass[101X
  
  [33X[1;0Y[29X[2XIsUniversalSemigroupCongruenceClass[102X( [3Xobj[103X ) [32X category[133X
  [6XReturns:[106X  [33X[0;10Y[9Xtrue[109X or [9Xfalse[109X.[133X
  
  [33X[0;0YThis  category  describes a class of the universal semigroup congruence (see
  [2XIsUniversalSemigroupCongruence[102X  ([14X13.10-1[114X)). A universal semigroup congruence
  by  definition has precisely one congruence class, which contains all of the
  elements of the semigroup in question.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := Semigroup([Transformation([3, 2, 3])]);;[127X[104X
    [4X[25Xgap>[125X [27XU := UniversalSemigroupCongruence(S);;[127X[104X
    [4X[25Xgap>[125X [27Xclasses := EquivalenceClasses(U);;[127X[104X
    [4X[25Xgap>[125X [27XIsUniversalSemigroupCongruenceClass(classes[1]);[127X[104X
    [4X[28Xtrue[128X[104X
  [4X[32X[104X
  
  [1X13.10-3 UniversalSemigroupCongruence[101X
  
  [33X[1;0Y[29X[2XUniversalSemigroupCongruence[102X( [3XS[103X ) [32X operation[133X
  [6XReturns:[106X  [33X[0;10YA universal semigroup congruence.[133X
  
  [33X[0;0YThis  operation returns the universal semigroup congruence for the semigroup
  [3XS[103X. It can be used in the same way as any other semigroup congruence object.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27XUniversalSemigroupCongruence(S);[127X[104X
    [4X[28X<universal semigroup congruence over[128X[104X
    [4X[28X<Rees 0-matrix semigroup 2x2 over Sym( [ 1 .. 3 ] )>>[128X[104X
  [4X[32X[104X
  
  [1X13.10-4 TrivialCongruence[101X
  
  [33X[1;0Y[29X[2XTrivialCongruence[102X( [3XS[103X ) [32X attribute[133X
  [6XReturns:[106X  [33X[0;10YA trivial semigroup congruence.[133X
  
  [33X[0;0YThis operation returns the trivial semigroup congruence for the semigroup [3XS[103X.
  It can be used in the same way as any other semigroup congruence object.[133X
  
  [4X[32X  Example  [32X[104X
    [4X[25Xgap>[125X [27XS := ReesZeroMatrixSemigroup(SymmetricGroup(3),[127X[104X
    [4X[25X>[125X [27X[[(), (1, 3, 2)], [(1, 2), 0]]);;[127X[104X
    [4X[25Xgap>[125X [27XTrivialCongruence(S);[127X[104X
    [4X[28X<semigroup congruence over <Rees 0-matrix semigroup 2x2 over[128X[104X
    [4X[28X  Sym( [ 1 .. 3 ] )> with linked triple (1,2,2)>[128X[104X
    [4X[25Xgap>[125X [27XS := PartitionMonoid(2);[127X[104X
    [4X[28X<regular bipartition *-monoid of size 15, degree 2 with 3 generators>[128X[104X
    [4X[25Xgap>[125X [27XTrivialCongruence(S);[127X[104X
    [4X[28X<2-sided semigroup congruence over <regular bipartition *-monoid[128X[104X
    [4X[28X of size 15, degree 2 with 3 generators> with 0 generating pairs>[128X[104X
  [4X[32X[104X
  
