This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Computing finite index congruences of finitely presented semigroups and monoids

Marina Anagnostopoulou-Merkouri, Reinis Cirpons, James D. Mitchell, and Maria Tsalakou
Abstract

In this paper, we describe an algorithm for computing the left, right, or 2-sided congruences of a finitely presented semigroup or monoid with finitely many classes, and an alternative algorithm when the finitely presented semigroup or monoid is finite. We compare the two algorithms presented with existing algorithms and implementations. The first algorithm is a generalization of Sims’ low-index subgroup algorithm for finding the congruences of a monoid. The second algorithm involves determining the distinct principal congruences, and then finding all of their possible joins. Variations of this algorithm have been suggested in numerous contexts by numerous authors. We show how to utilize the theory of relative Green’s relations, and a version of Schreier’s Lemma for monoids, to reduce the number of principal congruences that must be generated as the first step of this approach. Both of the algorithms described in this paper are implemented in the GAP [29] package Semigroups [54], and the first algorithm is available in the C++ library libsemigroups [53] and in its Python bindings libsemigroups_pybind11 [52].

1 Introduction

In this paper, we are concerned with the problem of computing finite index congruences of a finitely presented semigroup or monoid. One case of particular interest is computing the entire lattice of congruences of a finite semigroup or monoid. We will present two algorithms that can perform these computations and compare them with each other and to existing algorithms and their implementations. The first algorithm is the only one of its kind, permitting the computation of finite index 1-sided and 2-sided congruences, and a host of other things (see Section 5) of infinite finitely presented semigroups and monoids. Although this first algorithm is not specifically designed to find finite index subgroups of finitely presented groups, it can be used for such computations and is sometimes faster than the existing implementations in 3Manifolds [15] and GAP [29]; see Table A.5. The second algorithm we present is, for many examples, several orders of magnitude faster than any existing method, and in many cases permits computations that were previously unfeasible. Examples where an implementation of an existing algorithm, such as that in [58], is faster are limited to those with total runtime below 1 second; see Table A.6. Some further highlights include: computing the numbers of right/left congruences of many classical examples of finite transformation and diagram monoids, see Appendix B; reproducing and extending the computations from [6] to find the number of congruences in free semigroups and monoids (see Table B.13); computational experiments with the algorithms implemented were crucial in determining the minimum transformation representation of the so-called diagram monoids in [11]; and in classifying the maximal and minimal 1-sided congruences of the full transformation monoids in [12]. In Appendix A, we present significant quantitative data exhibiting the performance of our algorithms. Appendix B provides a wealth of data generated using the implementation of the algorithms described here. For example, the sequences of numbers of minimal 1-sided congruences of a number of well-studied transformation monoids are apparent in several of the tables in Appendix B, such as Table B.12.

The question of determining the lattice of 2-sided congruences of a semigroup or monoid is classical and has been widely studied in the literature; see, for example, [47]. Somewhat more recently, this interest was rekindled by Araújo, Bentz, and Gomes in [2], Young (né Torpey) in [70], and the third author of the present article, which resulted in [23] and its numerous offshoots [7, 16, 18, 19, 20, 21, 22]. The theory of 2-sided congruences of a monoid is analogous to the theory of normal subgroups of a group, and 2-sided congruences play the same role for monoids with respect to quotients and homomorphisms. As such, it is perhaps not surprising that the theory of 2-sided congruences of semigroups and monoids is rather rich. The 2-sided congruences of certain types of semigroup are completely classified, for a small sample among many, via linked triples for regular Rees 0-matrix semigroups [35, Theorem 3.5.8], or via the kernel and trace for inverse semigroups [35, Section 5.3].

The literature relating to 1-sided congruences is less well-developed; see, for example, [7, 51]. Subgroups are to groups what 1-sided congruences are to semigroups. This accounts, at least in part, for the relative scarcity of results in the literature on 1-sided congruences. The number of such congruences can be enormous, and the structure of the corresponding lattices can be wild. For example, the full transformation monoid of degree 44 has size 256256 and possesses 22,069,82822,069,828 right congruences111This number was computed for the first time using the algorithm described in Section 4 as implemented in the C++ library libsemigroups [53] whose authors include the authors of the present paper. It was not previously known.. Another example is that of the stylic monoids from [1], which are finite quotients of the well-known plactic monoids [44, 45]. The stylic monoid with 55 generators has size 5151, while the number of left congruences is 1,431,795,0991,431,795,099\@footnotemark.

The purpose of this paper is to provide general computational tools for computing the 1- and 2-sided congruences of a finite, or finitely presented, monoid. There are a number of examples in the literature of such general algorithms; notable examples include [25][70], and [4], which describes an implementation of the algorithms from [25].

The first of the two algorithms we present is a generalization of Sims’ low-index subgroup algorithm for congruences of a finitely presented monoid; see Section 5.6 in [65] for details of Sims’ algorithm; some related algorithms and applications of the low-index subgroups algorithm can be found in [32][37][55, Section 6], and [60]. A somewhat similar algorithm for computing low-index ideals of a finitely presented monoid with decidable word problem was given by Jura in [39] and [40] (see also [61]). We will refer to the algorithm presented here as the low-index congruence algorithm. We present a unified framework for computing various special types of congruences, including: 2-sided congruences; congruences including or excluding given pairs of elements (leading to the ability to compute specific parts of a congruence lattice); solving the word problem in residually finite semigroups or monoids; congruences such that the corresponding quotient is a group; congruences arising from 1- or 2-sided ideals; and 1-sided congruences representing a faithful action of the original monoid; see Section 5 for details. This allows us to, for example, implement a method for computing the finite index ideals of a finitely presented semigroup akin to [39, 40] by implementing a single function (Algorithm 4) which determines if a finite index right congruence is a Rees congruence.

The low-index congruence algorithm takes as input a finite monoid presentation defining a monoid MM, and a positive integer nn. It permits the congruences with up to nn classes to be iterated through without repetition, while only holding a representation of a single such congruence in memory. Each congruence is represented as a certain type of directed graph, which we refer to as word graphs; see Section 2 for the definition. The space complexity of this approach is O(mn)O(mn) where mm is the number of generators of the input monoid, and nn is the input positive integer. Roughly speaking, the low-index algorithm performs a backtracking search in a tree whose nodes are word graphs. If the monoid MM is finite, then setting n=|M|n=|M| allows us to determine all of the left, right, or 2-sided congruences of MM. Finding all of the subgroups of a finite group was perhaps not the original motivation behind Sims’ low-index subgroup algorithm from [65, Section 5.6]. In particular, there are likely better ways of finding all subgroups of a finite group; see, for example, [33],  [36] and the references therein. On the other hand, in some sense, the structure of semigroups and monoids in general is less constrained than that of groups, and in some cases the low-index congruence algorithm is the best or only available means of computing congruences.

To compute the actual lattice of congruences obtained from the low-index congruences algorithm, we require a mechanism for computing the join or meet of two congruences given by word graphs. We show that two well-known algorithms for finite state automata can be used to do this. More specifically, a superficial modification of the Hopcroft-Karp Algorithm [34], for checking if two finite state automata recognise the same language, can be used to compute the join of two congruences. Similarly, a minor modification of the standard construction of an automaton recognising the intersection of two regular languages can be utilised to compute meets; see for example [68, Theorem 1.25]. For more background on automata theory, see [59].

As described in Section 5.6 of [65], one motivation of Sims’ low-index subgroup algorithm was to provide an algorithm for proving non-triviality of the group GG defined by a finite group presentation by showing that GG has a subgroup of index greater than 11. The low-index congruences algorithm presented here can similarly be used to prove the non-triviality of the monoid MM defined by a finite monoid presentation by showing that MM has a congruence with more than one class. There are a number of other possible applications: to determine small degree transformation representations of monoids (every monoid has a faithful action on the classes of a right congruence); to prove that certain relations in a presentation are irredundant; or more generally to show that the monoids defined by two presentations are not isomorphic (if the monoids defined by AR\langle A\mid R\rangle and BS\langle B\mid S\rangle have different numbers of congruences with nn classes, then they are not isomorphic). Further applications are discussed in Section 5.

The low-index congruence algorithm is implemented in the open-source C++ library libsemigroups [53], and available for use in the GAP [29] package Semigroups [54], and the Python package libsemigroups_pybind11 [52]. The low-index algorithm is almost embarrassingly parallel, and the implementation in libsemigroups [53] is parallelised using a version of the work stealing queue described in [74, Section 9.1.5]; see Section 4 and Appendix A for more details.

The second algorithm we present is more straightforward than the low-index congruence algorithm, and is a variation on a theme that has been suggested in numerous contexts, for example, in [4, 25, 70]. There are two main steps to this procedure. First, the distinct principal congruences are determined, and, second, all possible joins of the principal congruences are found. Unlike the low-index congruence algorithm, this algorithm cannot be used to compute anything about infinite finitely presented semigroups or monoids. This second algorithm is implemented in the GAP [29] package Semigroups [54].

The first step of the second algorithm, as described in, for example, [4, 25, 70], involves computing the principal congruence, of the input monoid MM, generated by every pair (x,y)M×M(x,y)\in M\times M. Of course, in practice, if (x,y)M×M(x,y)\in M\times M, then the principal congruences generated by (x,y)(x,y) and (y,x)(y,x) are the same, and so only |M|(|M|1)/2|M|(|M|-1)/2 principal congruences are actually generated. In either case, this requires the computation of O(|M|2)O(|M|^{2}) such principal congruences. We will show that certain of the results from [22] can be generalized to provide a sometimes smaller set of pairs (x,y)M×M(x,y)\in M\times M required to generate all of the principal congruences of MM. In particular, we show how to compute relative Green’s \mathscr{R}-class and 𝒥\mathscr{J}-class representatives of elements in the direct product M×MM\times M modulo its submonoid ΔM={(m,m):mM}\Delta_{M}=\{\>(m,m)\>:\>m\in M\>\}. Relative Green’s relations were introduced in [73]; see also [9, 30]. It is straightforward to verify that if (x,y),(z,t)M×M(x,y),(z,t)\in M\times M are \mathscr{R}-related modulo ΔM\Delta_{M}, then the principal right congruences generated by (x,y)(x,y) and (z,t)(z,t) coincide; see 7.1i for a proof. We will show that it is possible to reduce the problem of computing relative \mathscr{R}-class representatives to the problems of computing the right action of ΔM\Delta_{M} on a set, and membership testing in an associated (permutation) group. The relative 𝒥\mathscr{J}-class representatives correspond to strongly connected components of the action of ΔM\Delta_{M} on the relative \mathscr{R}-classes by left multiplication, and can be found whenever the relative \mathscr{R}-classes can be. In many examples, the time taken to find such relative \mathscr{R}-class and 𝒥\mathscr{J}-class representatives is negligible when compared to the overall time required to compute the lattice of congruences, and in some examples there is a dramatic reduction in the number of principal congruences that must be generated. For example, if MM is the general linear monoid of 3×33\times 3 matrices over the finite field 𝔽2\mathbb{F}_{2} of order 22, then |M|=512|M|=512 and so |M|(|M|1)/2=130,816|M|(|M|-1)/2=130,816. On the other hand, the numbers of relative 𝒥\mathscr{J}- and \mathscr{R}-classes of elements of M×MM\times M modulo ΔM\Delta_{M} are 4444 and 1,6211,621, MM has 66 and 1,6211,621 principal 2-sided and right congruences, respectively, and the total number of 2-sided congruences is 77. Another example: if NN is the monoid consisting of all 2×22\times 2 matrices over the finite field 𝔽7\mathbb{F}_{7} with 77 elements with determinant 0 or 11, then |N|=721|N|=721 and so |N|(|N|1)/2=259,560|N|(|N|-1)/2=259,560, but the numbers of relative 𝒥\mathscr{J}- and \mathscr{R}-classes are 3636 and 1,8621,862, there are 77 and 376376 principal 2-sided and right congruences, respectively, and the total number of 2-sided congruences is 1010. Of course, there are other examples where there is no reduction in the number of principal congruences that must be generated, and as such the time taken to compute the relative Green’s classes is wasted; see Appendix A for a more thorough analysis.

One question we have not yet addressed is how to compute a (principal) congruence from its generating pairs. For the purpose of computing the lattice of congruences, it suffices to be able to compare congruences by containment. There are a number of different approaches to this: such as the algorithm suggested in [25, Algorithm 2] and implemented in [4], and that suggested in [70, Chapter 2] and implemented in the GAP [29] package Semigroups [54] and the C++ library libsemigroups [53]. The former is essentially a brute force enumeration of the pairs belonging to the congruence, and congruences are represented by the well-known disjoint sets data structure. The latter involves running two instances of the Todd–Coxeter Algorithm in parallel; see [70, Chapter 2] and [13] for more details.

We conclude this introduction with some comments about the relative merits and de-merits of the different approaches outlined above, and we refer the reader to Appendix A for some justification for the claims we are about to make.

As might be expected, the runtime of the low-index congruence algorithm is highly dependent on the input presentation, and it seems difficult (or impossible) to predict what properties of a presentation reduce the runtime. We define the length of a presentation to be the sum of the lengths of the words appearing in relations plus the number of generators. On the one hand, for a fixed monoid MM, long presentations appear to have an adverse impact on the performance, but so too do very short presentations. Perhaps one explanation for this is that a long presentation increases the cost of processing each node in the search tree, while a short presentation does not make it evident that certain branches of the tree contain no solutions until many nodes in the tree have been explored. If MM is finite, then it is possible to find a presentation for MM using, for example, the Froidure-Pin Algorithm [26]. In some examples, the presentations produced mechanically (i.e. non-human presentations) qualify as long in the preceding discussion. In some examples presentations from the literature (i.e. human presentations) work better than their non-human counterparts, but in other examples they qualify as short in the preceding discussion, and are worse. It seems that in many cases some experimentation is required to find a presentation for which the low-index congruence algorithm works best. On the other hand, in examples where the number of congruences is large, say in the millions, running any implementation of the second algorithm is infeasible because it requires too much space. Having said that, there are still some relatively small examples where the low-index congruences algorithm is faster than the implementations of the second algorithm in Semigroups [54] and in CREAM [58], and others where the opposite holds; see Table A.6.

One key difference between the implementation of the low-index subgroup algorithm in, say, GAP [29], and the low-index congruence algorithm in libsemigroups [53] is that the former finds conjugacy class representatives of subgroups with index at most nn\in\mathbb{N}. As far as the authors are aware, there is no meaningful notion of conjugacy that can be applied to the low-index congruences algorithm for semigroups and monoids in general. Despite the lack of any optimizations for groups in the implementation of the low-index congruence algorithm in libsemigroups [53], its performance is often better than or comparable to that of the implementations of Sims’ low-index subgroup algorithm in [15] and GAP [29]; see Table A.5 for more details.

The present paper is organised as follows: in Section 2 we present some preliminaries required in the rest of the paper; in Section 3 we state and prove some results related to actions, word graphs, and congruences; in Section 4 we state the low-index congruence algorithm and prove that it is correct; in Section 5 we give numerous applications of the low-index congruences algorithm; in Section 6 we show how to compute the joins and meets of congruences represented by word graphs; in Section 7 we describe the algorithm based on [22] for computing relative Green’s relations. In Appendix A, we provide some benchmarks that compare the performance of the implementations in libsemigroups [53], Semigroups [54], and CREAM [58]. Finally in Appendix B we present some tables containing statistics about the lattices of congruences of some well-known families of monoids.

2 Preliminaries

In this section we introduce some notions that are required for the latter sections of the paper.

Throughout the paper we use the symbol \bot to denote an “undefined” value, and note that \bot is not an element of any set except where it is explicitly included.

Let SS be a semigroup. An equivalence relation ρS×S\rho\subseteq S\times S is a right congruence if (xs,ys)ρ(xs,ys)\in\rho for all (x,y)ρ(x,y)\in\rho and all sSs\in S. Left congruences are defined analogously, and a 2-sided congruence is both a left and a right congruence. We refer to the number of classes of a congruence as its index.

If XX is any set, and Ψ:X×SX\Psi:X\times S\longrightarrow X is a function, then Ψ\Psi is a right action of SS on XX if ((x,s)Ψ,t)Ψ=(x,st)Ψ((x,s)\Psi,t)\Psi=(x,st)\Psi for all xXx\in X and for all s,tSs,t\in S. If in addition SS has an identity element 1S1_{S} (i.e. if SS is a monoid), we require (x,1S)Ψ=x(x,1_{S})\Psi=x for all xXx\in X also. Left actions are defined dually. In this paper we will primarily be concerned with right actions of monoids.

If MM is a monoid, and Ψ0:X0×MX0\Psi_{0}:X_{0}\times M\longrightarrow X_{0} and Ψ1:X1×MX1\Psi_{1}:X_{1}\times M\longrightarrow X_{1} are right actions of MM on sets X0X_{0} and X1X_{1}, then we say that λ:X0X1\lambda:X_{0}\longrightarrow X_{1} is a homomorphism of the right actions Ψ0\Psi_{0} and Ψ1\Psi_{1} if

(x,s)Ψ0λ=((x)λ,s)Ψ1(x,s)\Psi_{0}\lambda=((x)\lambda,s)\Psi_{1}

for all xXx\in X and all sMs\in M. An isomorphism of right actions is a bijective homomorphism.

Let AA be any alphabet and let AA^{*} denote the free monoid generated by AA (consisting of all words over AA with operation juxtaposition and identity the empty word ε\varepsilon). We define a word graph Γ=(V,E)\Gamma=(V,E) over the alphabet AA to be a digraph with set of nodes VV and edges EV×A×VE\subseteq V\times A\times V. Word graphs are essentially finite state automata without initial or accept states. More specifically, if Γ=(V,E)\Gamma=(V,E) is a word graph over AA, then for any αV\alpha\in V and any Q1VQ_{1}\subseteq V, we can define a finite state automaton (V,A,α,δ,Q1)(V,A,\alpha,\delta,Q_{1}) where: the state set is VV; the alphabet is AA; the start state is α\alpha; the transition function δ:V×AV\delta:V\times A\longrightarrow V is defined by (α,a)δ=β(\alpha,a)\delta=\beta whenever (α,a,β)E(\alpha,a,\beta)\in E; and Q1Q_{1} denotes the accept states.

If (α,a,β)E(\alpha,a,\beta)\in E is an edge in a word graph Γ\Gamma, then α\alpha is the source, aa is the label, and β\beta is the target of (α,a,β)(\alpha,a,\beta). A word graph Γ\Gamma is complete if for every node α\alpha and every letter aAa\in A there is at least one edge with source α\alpha labelled by aa. A word graph Γ=(V,E)\Gamma=(V,E) is finite if the sets of nodes VV and edges EE are finite. A word graph is deterministic if for every node αV\alpha\in V and every aAa\in A there is at most one edge with source α\alpha and label aa.

If α,βV\alpha,\beta\in V, then an (α,β)(\alpha,\beta)-path is a sequence of edges (α0,a0,α1),,(αn1,an1,αn)E(\alpha_{0},a_{0},\alpha_{1}),\ldots,(\alpha_{n-1},a_{n-1},\alpha_{n})\in E where α0=α\alpha_{0}=\alpha and αn=β\alpha_{n}=\beta and a0,,an1Aa_{0},\ldots,a_{n-1}\in A; α\alpha is the source of the path; the word a0an1Aa_{0}\cdots a_{n-1}\in A^{*} labels the path; β\beta is the target of the path; and the length of the path is nn. We say that there exists an (α,α)(\alpha,\alpha)-path of length 0 labelled by ε\varepsilon for all αV\alpha\in V. For αV\alpha\in V, and uAu\in A^{\ast} we will write αΓu=βV\alpha\cdot_{\Gamma}u=\beta\in V to mean that uu labels a (α,β)(\alpha,\beta)-path in Γ\Gamma, and αΓu=\alpha\cdot_{\Gamma}u=\bot if uu does not label a path with source α\alpha in Γ\Gamma. When there are no opportunities for ambiguity we will omit the subscript Γ\Gamma from Γ\cdot_{\Gamma}. If α,βV\alpha,\beta\in V and there is an (α,β)(\alpha,\beta)-path in Γ\Gamma, then we say that β\beta is reachable from α\alpha. If α\alpha is a node in a word graph Γ\Gamma, then the strongly connected component of α\alpha is the set of all nodes β\beta such that β\beta is reachable from α\alpha and α\alpha is reachable from β\beta. If Γ=(V,E)\Gamma=(V,E) is a word graph and 𝔓(A×A)\mathfrak{P}(A^{*}\times A^{*}) denotes the power set of A×AA^{*}\times A^{*}, then the path relation of Γ\Gamma is the function πΓ:V𝔓(A×A)\pi_{\Gamma}:V\longrightarrow\mathfrak{P}(A^{*}\times A^{*}) defined by (α)πΓ={(u,v)A×A:αu and αu=αv}(\alpha)\pi_{\Gamma}=\{\>(u,v)\in A^{*}\times A^{*}\>:\>\alpha\cdot u\not=\bot\text{ and }\alpha\cdot u=\alpha\cdot v\>\}. If Γ\Gamma is a complete word graph and α\alpha is a node in Γ\Gamma, then (α)πΓ(\alpha)\pi_{\Gamma} is a right congruence on AA^{*}. If RA×AR\subseteq A^{*}\times A^{*}, Γ\Gamma is a word graph, and πΓ\pi_{\Gamma} is the path relation of Γ\Gamma, then we say that Γ\Gamma is compatible with RR if αu=αv\alpha\cdot u=\alpha\cdot v whenever αu\alpha\cdot u\neq\bot and αv\alpha\cdot v\neq\bot for all (u,v)R(u,v)\in R and for all αV\alpha\in V. Equivalently, if Γ\Gamma is complete, then Γ\Gamma is compatible with RR if and only if R(α)πΓR\subseteq(\alpha)\pi_{\Gamma} for every node α\alpha in Γ\Gamma. It is routine to verify that if a word graph Γ\Gamma is compatible with RR, then it is also compatible with the least (2-sided) congruence on AA^{*} containing RR; we denote this congruence by R#R^{\#}.

3 Word graphs and right congruences

In this section we establish some fundamental results related to word graphs and right congruences. It seems likely to the authors that the results presented in this section are well-known; similar ideas occur in  [38][42][65], and probably elsewhere. However, we did not find any suitable references that suit our purpose here, particularly in Section 3.3, and have included some of the proofs of these results for completeness.

This section has three subsections: in Section 3.1 we describe the relationship between right congruences and word graphs; in Section 3.2 we present some results about homomorphisms between word graphs; and finally in Section 3.3 we give some technical results about standard word graphs.

3.1 Right congruences

Suppose that MM is the monoid defined by the monoid presentation AR\langle A\mid R\rangle and Ψ:V×MV\Psi:V\times M\longrightarrow V is a right action of MM on a set VV. Recall that MM is isomorphic to the quotient of the free monoid AA^{*} by R#R^{\#}. If θ:AM\theta:A^{*}\longrightarrow M is the surjective homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}, then we can define a complete deterministic word graph Γ=(V,E)\Gamma=(V,E) over the alphabet AA such that (α,a,β)E(\alpha,a,\beta)\in E whenever (α,(a)θ)Ψ=β(\alpha,(a)\theta)\Psi=\beta. Conversely, if Γ=(V,E)\Gamma=(V,E) is a complete word graph that is compatible with RR, then we define Ψ:V×MV\Psi:V\times M\longrightarrow V by

(α,(w)θ)Ψ=β(\alpha,(w)\theta)\Psi=\beta (3.1)

whenever ww labels an (α,β)(\alpha,\beta)-path in Γ\Gamma. It is routine to verify that the functions just described mapping a right action to a word graph, and vice versa, are mutual inverses. For future reference, we record these observations in the next proposition.

Proposition 3.1.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle. Then there is a one-to-one correspondence between right actions of MM and complete deterministic word graphs over AA compatible with RR.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are word graphs over the same alphabet AA, then ϕ:V0V1\phi:V_{0}\longrightarrow V_{1} is a word graph homomorphism if (α,a,β)E0(\alpha,a,\beta)\in E_{0} implies ((α)ϕ,a,(β)ϕ)E1((\alpha)\phi,a,(\beta)\phi)\in E_{1}; and we write ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1}. An isomorphism of word graphs Γ0\Gamma_{0} and Γ1\Gamma_{1} is a bijection ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that both ϕ\phi and ϕ1\phi^{-1} are homomorphisms. If ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} is a word graph homomorphism and wAw\in A^{*} labels an (α,β)(\alpha,\beta)-path in Γ0\Gamma_{0}, then it is routine to verify that ww labels a ((α)ϕ,(β)ϕ)((\alpha)\phi,(\beta)\phi)-path in Γ1\Gamma_{1}.

The correspondence between right actions and word graphs given in 3.1 also preserves isomorphisms, which we record in the next proposition.

Proposition 3.2.

Let MM be a monoid generated by a set AA, let Ψ0\Psi_{0} and Ψ1\Psi_{1} be right actions of MM, and let Γ0\Gamma_{0} and Γ1\Gamma_{1} be the word graphs over AA corresponding to these actions. Then Ψ0\Psi_{0} and Ψ1\Psi_{1} are isomorphic actions if and only if Γ0\Gamma_{0} and Γ1\Gamma_{1} are isomorphic word graphs.

Proof.

Assume that Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are isomorphic word graphs. Then there exists a bijection ϕ:V0V1\phi:V_{0}\longrightarrow V_{1}. Since Γ0\Gamma_{0} and Γ1\Gamma_{1} are isomorphic word graphs, wAw\in A^{*} labels an (α,β)(\alpha,\beta)-path in Γ0\Gamma_{0} if and only if ww labels a ((α)ϕ,(β)ϕ)((\alpha)\phi,(\beta)\phi)-path in Γ1\Gamma_{1}. Hence ((α,(w)θ)Ψ0)ϕ=((α)ϕ,(w)θ)Ψ1((\alpha,(w)\theta)\Psi_{0})\phi=((\alpha)\phi,(w)\theta)\Psi_{1} for all αV0,wA\alpha\in V_{0},w\in A^{*} and so ϕ\phi is an isomorphism of the actions Ψ0\Psi_{0} and Ψ1\Psi_{1}.

Conversely, assume that Ψ0\Psi_{0} and Ψ1\Psi_{1} are isomorphic right actions of MM on sets V0V_{0} and V1V_{1}, respectively. Then there exists a bijective homomorphism of right actions λ:V0V1\lambda:V_{0}\longrightarrow V_{1} such that ((α,s)Ψ0)λ=((α)λ,s)Ψ1((\alpha,s)\Psi_{0})\lambda=((\alpha)\lambda,s)\Psi_{1} for all αV0,sM\alpha\in V_{0},s\in M. We will prove that λ:Γ0Γ1\lambda:\Gamma_{0}\longrightarrow\Gamma_{1} is a word graph isomorphism. It suffices to show that (α,a,β)E0(\alpha,a,\beta)\in E_{0} if and only if ((α)λ,a,(β)λ)E1((\alpha)\lambda,a,(\beta)\lambda)\in E_{1}. If (α,a,β)E0(\alpha,a,\beta)\in E_{0}, then (α,(a)θ)Ψ0=β(\alpha,(a)\theta)\Psi_{0}=\beta and hence ((α,(a)θ)Ψ0)λ=(β)λ((\alpha,(a)\theta)\Psi_{0})\lambda=(\beta)\lambda. Since λ\lambda is an isomorphism of right actions ((α,(a)θ)Ψ0)λ=((α)λ,(a)θ)Ψ1=(β)λ((\alpha,(a)\theta)\Psi_{0})\lambda=((\alpha)\lambda,(a)\theta)\Psi_{1}=(\beta)\lambda and so ((α)λ,a,(β)λ)E1((\alpha)\lambda,a,(\beta)\lambda)\in E_{1}. Similarly, it can be shown that if ((α)λ,a,(β)λ)E1((\alpha)\lambda,a,(\beta)\lambda)\in E_{1}, then (α,a,β)E0(\alpha,a,\beta)\in E_{0} and hence λ\lambda defines a word graph isomorphism. ∎

In Section 4 we are concerned with enumerating the right congruences of a monoid MM subject to certain restrictions, such as those containing a given set BM×MB\subseteq M\times M or those with a given number of equivalence classes. If MM is the monoid defined by the presentation AR\langle A\mid R\rangle and ρ\rho is a right congruence on MM, then the function Ψ:M/ρ×MM/ρ\Psi:M/\rho\times M\longrightarrow M/\rho defined by (x/ρ,y)Ψ=xy/ρ(x/\rho,y)\Psi=xy/\rho is a right action of MM on M/ρM/\rho where x/ρx/\rho is the equivalence class of xx in ρ\rho and M/ρ={x/ρ:xM}M/\rho=\{\>x/\rho\>:\>x\in M\>\}. It follows by 3.1 that ρ\rho corresponds to a complete deterministic word graph Γ\Gamma over AA compatible with RR. In particular, the nodes of Γ\Gamma are the classes M/ρM/\rho, and the edges are {(x/ρ,a,(x,a)Ψ):xM,aA}\{(x/\rho,a,(x,a)\Psi):x\in M,\ a\in A\}.

On the other hand, not every right action of a monoid is an action on the classes of a right congruence. For example, if S1S^{1} is a 4×44\times 4 rectangular band with an adjoined identity, then two faithful right actions of S1S^{1} are depicted in Fig. 3.1 with respect to the generating set {a:=(1,1),b:=(2,2),c:=(3,3),d:=(4,4)}{1S1}\{a:=(1,1),b:=(2,2),c:=(3,3),d:=(4,4)\}\cup\{1_{S^{1}}\}. It can be shown that the action of S1S^{1} on {0,,6}\{0,\ldots,6\} shown in Fig. 3.1 corresponds to a right congruence of S1S^{1} but that the action of S1S^{1} on {0,,5}\{0,\ldots,5\} does not.

01122334455
0112233445566
Figure 3.1: Two faithful right actions of a 4×44\times 4 rectangular band with identity adjoined; ( a=(1,1)a=(1,1), b=(2,2)b=(2,2), c=(3,3)c=(3,3), d=(4,4)d=(4,4) and for the adjoined identity).

In a word graph Γ\Gamma corresponding to the action of a monoid MM on a right congruence ρ\rho, if mMm\in M, then there exist a0,,an1Aa_{0},\ldots,a_{n-1}\in A such that m=a0an1m=a_{0}\cdots a_{n-1}, and so mm labels the path from 1M1_{M} to m/ρm/\rho in Γ\Gamma. In particular, every node in Γ\Gamma is reachable from the node 1M/ρ1_{M}/\rho. The converse statement, that every complete deterministic word graph compatible with RR where every node is reachable from 1M/ρ1_{M}/\rho corresponds to a right congruence on MM is established in the next proposition.

If SS and TT are semigroups, RS×SR\subseteq S\times S is a binary relation and θ:ST\theta:S\longrightarrow T is a homomorphism. Then abusing our notation somewhat we write

(R)θ={((u)θ,(v)θ)T×T:(u,v)R}.(R)\theta=\left\{((u)\theta,(v)\theta)\in T\times T:(u,v)\in R\right\}.
Proposition 3.3.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, let θ:AM\theta:A^{*}\longrightarrow M be the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}, and let Γ=(V,E)\Gamma=(V,E) be a word graph over AA that is complete, deterministic, compatible with RR and where every node is reachable from some αV\alpha\in V. Then ρ=((α)πΓ)θ\rho=((\alpha)\pi_{\Gamma})\theta is a right congruence on MM, where (α)πΓ(\alpha)\pi_{\Gamma} is the path relation on Γ\Gamma.

Proof.

Suppose that ((u)θ,(v)θ)ρ((u)\theta,(v)\theta)\in\rho for some (u,v)(α)πΓ(u,v)\in(\alpha)\pi_{\Gamma} and that wAw\in A^{*} is arbitrary. Then αu\alpha\cdot u\neq\bot and αu=αv\alpha\cdot u=\alpha\cdot v. Hence αuw=(αu)w=(αv)w=αvw\alpha\cdot uw=(\alpha\cdot u)\cdot w=(\alpha\cdot v)\cdot w=\alpha\cdot vw. Since Γ\Gamma is complete, αuw\alpha\cdot uw\neq\bot, and so (uw,vw)(α)πΓ(uw,vw)\in(\alpha)\pi_{\Gamma}. Therefore ((uw)θ,(vw)θ)ρ((uw)\theta,(vw)\theta)\in\rho, and ρ\rho is a right congruence. ∎

It follows from 3.3 that in order to enumerate the right congruences of MM it suffices to enumerate the word graphs over AA that are complete, deterministic, compatible with RR and where every node is reachable from a node 0. Of course, we only want to obtain every right congruence of SS once, for which we require the next proposition. Henceforth we will suppose that if Γ=(V,E)\Gamma=(V,E) is a word graph over AA, then V={0,,n1}V=\{0,\ldots,n-1\} for some n1n\geq 1 and so, in particular, 0 is always a node in Γ\Gamma. Moreover, we will assume that the node 0 corresponds to the equivalence class 1M/ρ1_{M}/\rho of the identity 1M1_{M} of MM.

Proposition 3.4.

Let Γ0\Gamma_{0} and Γ1\Gamma_{1} be word graphs over AA corresponding to right congruences of a monoid MM generated by AA. Then Γ0\Gamma_{0} and Γ1\Gamma_{1} represent the same right congruence of MM if and only if there exists a word graph isomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that (0)ϕ=0(0)\phi=0.

Proof.

We denote the right congruences associated to Γ0\Gamma_{0} and Γ1\Gamma_{1} by ρ0\rho_{0} and ρ1\rho_{1}, respectively.

Suppose that there exists a word graph isomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that (0)ϕ=0(0)\phi=0 and that the words x,yAx,y\in A^{*} label (0,α)(0,\alpha)-paths in Γ0\Gamma_{0}. Then xx and yy label (0,(α)ϕ)(0,(\alpha)\phi)-paths Γ1\Gamma_{1} and so ρ0ρ1\rho_{0}\subseteq\rho_{1}. Since ϕ1:Γ1Γ0\phi^{-1}:\Gamma_{1}\longrightarrow\Gamma_{0} is a word graph isomorphism satisfying (0)ϕ1=0(0)\phi^{-1}=0, it follows that ρ1ρ0\rho_{1}\subseteq\rho_{0}, and so ρ0=ρ1\rho_{0}=\rho_{1}, as required.

Conversely, assume that Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) represent the same right congruence of MM. We define a word graph homomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} as follows. For every αV0\alpha\in V_{0}, fix a word wαAw_{\alpha}\in A^{*} that labels a (0,α)(0,\alpha)-path in Γ0\Gamma_{0}. We define (α)ϕ(\alpha)\phi to be the target of the path with source 0 labelled by wαw_{\alpha} in Γ1\Gamma_{1}. If (α,a,β)E0(\alpha,a,\beta)\in E_{0}, then both wαaw_{\alpha}a and wβw_{\beta} label (0,β)(0,\beta)-paths in Γ0\Gamma_{0}, and so (wαa,wβ)(0)πΓ0=ρ0=ρ1=(0)πΓ1(w_{\alpha}a,w_{\beta})\in(0)\pi_{\Gamma_{0}}=\rho_{0}=\rho_{1}=(0)\pi_{\Gamma_{1}}. Hence ((α)ϕ,a,(β)ϕ)((\alpha)\phi,a,(\beta)\phi) is an edge of Γ1\Gamma_{1}. In addition, |V0|=|V1||V_{0}|=|V_{1}| and it is clear that if αβ\alpha\neq\beta, then (α)ϕ(β)ϕ(\alpha)\phi\neq(\beta)\phi and hence ϕ\phi is a bijection. ∎

It follows from 3.4 that to enumerate the right congruences of a monoid MM defined by the presentation AR\langle A\mid R\rangle it suffices to enumerate the complete deterministic word graphs over AA compatible with RR where every node is reachable from 0 up to isomorphism. On the face of it, this is not much of an improvement because, in general, graph isomorphism is a difficult problem. However, word graph isomorphism, in the context of 3.4, is trivial by comparison.

If the alphabet A={a0,a1,,an1}A=\{a_{0},a_{1},\ldots,a_{n-1}\} and u,vAu,v\in A^{*}, then we define uvu\leq v if |u|<|v||u|<|v| or |u|=|v||u|=|v| and uu is less than or equal to vv in the usual lexicographic order on AA^{*} arising from the linear order a0<a1<<an1a_{0}<a_{1}<\cdots<a_{n-1} on AA. The order \leq is called the short-lex ordering on AA^{*}. If uvu\neq v and uvu\leq v, then we write u<vu<v. If α\alpha is a node in a word graph Γ\Gamma and α\alpha is reachable from 0, then there is a \leq-minimum word labelling a (0,α)(0,\alpha)-path; we denote this path by wαw_{\alpha}.

The following definition is central to the algorithm presented in Section 4.

Definition 3.5.

A complete word graph Γ=(V,E)\Gamma=(V,E) over AA is standard if the following hold:

  1. (i)

    Γ\Gamma is deterministic;

  2. (ii)

    every node is reachable from 0V={0,,|V|1}0\in V=\{0,\ldots,|V|-1\};

  3. (iii)

    for all α,βV\alpha,\beta\in V, α<β\alpha<\beta if and only if wα<wβw_{\alpha}<w_{\beta}.

Proposition 3.6.

[cf. Proposition 8.1 in [65]] Let Γ0\Gamma_{0} and Γ1\Gamma_{1} be standard complete word graphs over the same alphabet. Then there exists a word graph isomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that (0)ϕ=0(0)\phi=0 if and only if Γ0=Γ1\Gamma_{0}=\Gamma_{1}.

By 3.6, every complete deterministic word graph Γ\Gamma in which every node is reachable from 0 is isomorphic to a unique standard complete word graph. It is straightforward to compute this standard word graph from the original graph by relabelling the nodes, for example, using the procedure SWITCH from [65, Section 4.7]. We refer to this process as standardizing Γ\Gamma.

Another consequence of 3.4 and 3.6 is that enumerating the right congruences of a monoid MM defined by a presentation AR\langle A\mid R\rangle is equivalent to enumerating the standard complete word graphs over AA that are compatible with RR. As mentioned above, the right action of MM on the classes of a right congruence is isomorphic to the right action represented by the corresponding word graph Γ\Gamma. We record this in the following theorem.

Theorem 3.7.

Let MM be a monoid defined by a monoid presentation AR\langle A\mid R\rangle. Then there is a one-to-one correspondence between the right congruences of MM and the standard complete word graphs over AA compatible with RR.

If ρ\rho is a right congruence on MM and Γ\Gamma is the corresponding word graph, then the right actions of MM on M/ρM/\rho and on Γ\Gamma are isomorphic; and ρ=((0)πΓ)θ\rho=((0)\pi_{\Gamma})\theta where θ:AM\theta:A^{*}\longrightarrow M is the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#} and (0)πΓ(0)\pi_{\Gamma} is the path relation on Γ\Gamma.

It is possible to determine a one-to-one correspondence between the right congruences of a semigroup SS and certain word graphs arising from S1S^{1}, as a consequence of 3.7.

Corollary 3.8.

Let SS be a semigroup defined by a semigroup presentation AR\langle A\mid R\rangle. Then there is a one-to-one correspondence between the right congruences of SS and the complete word graphs Γ=(V,E)\Gamma=(V,E) for S1S^{1} over AA compatible with RR such that (v,a,0)E(v,a,0)\not\in E for all vVv\in V and all aAa\in A.

If ρ\rho is a right congruence of SS and Γ\Gamma is the corresponding word graph for S1S^{1}, then the right actions of SS on S/ρS/\rho and on Γ{0}\Gamma\setminus\{0\} are isomorphic.

Proof.

By 3.7 it follows that there is a one-to-one correspondence between the right congruences of S1S^{1} and the complete word graphs Γ=(V,E)\Gamma=(V,E) for S1S^{1} over AA compatible with RR. In addition, there is a one-to-one correspondence between the right congruences of SS and the right congruences ρ\rho of S1S^{1} such that 1M/ρ=x/ρ1_{M}/\rho=x/\rho if and only if x=1Mx=1_{M}. Since ρ\rho and (0)πΓ(0)\pi_{\Gamma} coincide it follows that there is a one-to-one correspondence between the right congruences ρ\rho of S1S^{1} such that 1M/ρ=x/ρ1_{M}/\rho=x/\rho if and only if x=1Mx=1_{M} and the complete word graphs Γ=(V,E)\Gamma=(V,E) for S1S^{1} over AA compatible with RR such that (v,a,0)E(v,a,0)\not\in E for all vVv\in V and all aAa\in A. The argument to prove that the right actions of SS on S/ρS/\rho and on Γ{0}\Gamma\setminus\{0\} are isomorphic is identical to the argument in the proof of 3.7. ∎

Given 3.7, we will refer to the standard complete word graph over AA compatible with RR corresponding to a given right congruence ρ\rho as the word graph of ρ\rho.

We require the following lemma.

Lemma 3.9.

Let SS and TT be semigroup, let RS×SR\subseteq S\times S, and let θ:ST\theta:S\longrightarrow T be a homomorphism. Then the following hold:

  1. (i)

    if ker(θ)R\ker(\theta)\subseteq R, RR is transitive and u,vSu,v\in S are such that (u)θ=(u)θ(u)\theta=(u^{\prime})\theta and (v)θ=(v)θ(v)\theta=(v^{\prime})\theta for some (u,v)R(u^{\prime},v^{\prime})\in R, then (u,v)R(u,v)\in R;

  2. (ii)

    if θ\theta is surjective and ker(θ)\ker(\theta) is contained in the least (left, right, or 2-sided) congruence ρ\rho on SS containing RR, then the least (left, right, or 2-sided) congruence on TT containing (R)θ(R)\theta is (ρ)θ(\rho)\theta.

Lemma 3.9(i) can be reformulated as follows.

Corollary 3.10.

If ker(θ)R\ker(\theta)\subseteq R and RR is transitive, then ((u)θ,(v)θ)(R)θ((u)\theta,(v)\theta)\in(R)\theta if and only if (u,v)R(u,v)\in R for all u,vSu,v\in S.

A convenient consequence of the correspondence between right congruences ρ\rho and their word graphs Γ\Gamma allows us to determine a set of generating pairs for ρ\rho from Γ\Gamma. This method is similar to Stalling’s method for finding a generating set of a subgroup of a free group from its associated coset graph, see, for example, [41, Proposition 6.7].

Lemma 3.11.

Let MM be a monoid defined by a monoid presentation AR\langle A\mid R\rangle, let ρ\rho be a right congruence of MM, and let Γ=(V,E)\Gamma=(V,E) be the word graph of ρ\rho. Then {(wαa,wβ)A×A:(α,a,β)E}\left\{(w_{\alpha}a,w_{\beta})\in A^{*}\times A^{*}:(\alpha,a,\beta)\in E\right\} generates the path relation (0)πΓ(0)\pi_{\Gamma} as a right congruence.

In particular, if θ:AM\theta:A^{*}\longrightarrow M is the natural homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}, then

{((wαa)θ,(wβ)θ)M×M:(α,a,β)E}\left\{((w_{\alpha}a)\theta,(w_{\beta})\theta)\in M\times M:(\alpha,a,\beta)\in E\right\}

generates ρ\rho as a right congruence.

Proof.

We set W={wα:αV}W=\{\>w_{\alpha}\>:\>\alpha\in V\>\} where wαw_{\alpha} is the short-lex minimum word labelling any (0,α)(0,\alpha)-path in Γ\Gamma for every αV\alpha\in V.

We denote by σ\sigma the right congruence on AA^{*} generated by S:={(wαa,wβ)A×A:(α,a,β)E}S:=\left\{(w_{\alpha}a,w_{\beta})\in A^{*}\times A^{*}:(\alpha,a,\beta)\in E\right\}. If (wαa,wβ)S(w_{\alpha}a,w_{\beta})\in S, then since (α,a,β)E(\alpha,a,\beta)\in E, it follows that both wαaw_{\alpha}a and wβw_{\beta} label (0,β)(0,\beta)-paths in Γ\Gamma. In particular, S(0)πΓS\subseteq(0)\pi_{\Gamma} and so, since σ\sigma is the least right congruence containing SS and (0)πΓ(0)\pi_{\Gamma} is a right congruence, σ(0)πΓ\sigma\subseteq(0)\pi_{\Gamma} also.

For the converse inclusion, we will show that (u,wα)σ(u,w_{\alpha})\in\sigma for every uAu\in A^{\ast} that labels a (0,α)(0,\alpha)-path in Γ\Gamma. It will follow from this that (0)πΓσ(0)\pi_{\Gamma}\subseteq\sigma.

Suppose that uAu\in A^{\ast} labels a (0,α)(0,\alpha)-path in Γ\Gamma. We write u=wβvu=w_{\beta}v where wβw_{\beta} is the longest prefix of uu belonging to WW. We proceed by induction on |v||v|. If |v|=0|v|=0, then u=wβu=w_{\beta}, and so β=α\beta=\alpha. Hence u=wαu=w_{\alpha} and so (u,wα)σ(u,w_{\alpha})\in\sigma by reflexivity. This establishes the base case.

Suppose that for some k0k\geq 0, (u,wα)σ(u,w_{\alpha})\in\sigma for all uAu\in A^{*} such that uu labels a (0,α)(0,\alpha)-path and u=wβvu=w_{\beta}v where |v|k|v|\leq k. Let u=wβvu=w_{\beta}v for some vAv\in A^{*} with |v|=k+1>0|v|=k+1>0. Then we may write v=av0v=av_{0} for some aAa\in A and v0Av_{0}\in A^{\ast} with |v0|=k|v_{0}|=k. Since Γ\Gamma is complete, there is an edge (β,a,γ)E(\beta,a,\gamma)\in E for some γV\gamma\in V. Hence (wβa,wγ)S(w_{\beta}a,w_{\gamma})\in S by definition.

If we set u0=wγv0u_{0}=w_{\gamma}v_{0}, then u0u_{0} also labels a (0,α)(0,\alpha)-path in Γ\Gamma. Again we write u0=wδv1u_{0}=w_{\delta}v_{1} where wδw_{\delta} is the maximal prefix of u0u_{0} in WW and v1Av_{1}\in A^{*}. Since wγw_{\gamma} is a prefix of u0u_{0} and wδw_{\delta} is maximal, wγw_{\gamma} is a (not necessarily proper) prefix of wδw_{\delta}. In particular, |wδ||wγ||w_{\delta}|\geq|w_{\gamma}| and so |v1||v0|=k|v_{1}|\leq|v_{0}|=k. Hence by induction (u0,wα)σ(u_{0},w_{\alpha})\in\sigma. In addition (u,u0)=(wβav0,wγv0)σ(u,u_{0})=(w_{\beta}av_{0},w_{\gamma}v_{0})\in\sigma, since (wβa,wγ)Sσ(w_{\beta}a,w_{\gamma})\in S\subseteq\sigma and σ\sigma is a right congruence. Therefore by transitivity (u,wα)σ(u,w_{\alpha})\in\sigma, as required.

Since R#=ker(θ)(0)πΓ=σR^{\#}=\ker(\theta)\subseteq(0)\pi_{\Gamma}=\sigma (we have that R#(0)πΓR^{\#}\subseteq(0)\pi_{\Gamma} since Γ\Gamma is complete and compatible with RR), we can apply Lemma 3.9ii to show that (S)θ={((wαa)θ,(wβ)θ)M×M:(α,a,β)E}(S)\theta=\left\{((w_{\alpha}a)\theta,(w_{\beta})\theta)\in M\times M:(\alpha,a,\beta)\in E\right\} generates ρ\rho as a right congruence. It follows that (σ)θ=((0)πΓ)θ=ρ(\sigma)\theta=((0)\pi_{\Gamma})\theta=\rho is generated by (S)θ(S)\theta. ∎

From this point in the paper onwards, for the purposes of describing the time or space complexity of some claims, we assume that we are using the RAM model of computation. The following corollary is probably well-known.

Corollary 3.12.

Let MM be a monoid defined by a monoid presentation AR\langle A\mid R\rangle, and let ρ\rho be a right congruence on MM. If ρ\rho has finite index nn\in\mathbb{N}, then ρ\rho is finitely generated as a right congruence and a set of generating pairs for ρ\rho can be determined in O(n2|A|)O(n^{2}|A|) time from the word graph associated to ρ\rho.

Proof.

This follows immediately since the generating set for ρ\rho given in Lemma 3.11 has size n|A|n|A|, and it can be found by a breadth first traversal of the word graph. The breadth first traversal of the word graph has time complexity O(n|A|)O(n|A|). To store the generating pairs (u,v)A×A(u,v)\in A^{*}\times A^{*} for ρ\rho requires at most O(n2|A|)O(n^{2}|A|) space and time, yielding the stated time complexity. ∎

3.2 Homomorphisms of word graphs

In this section we state some results relating homomorphisms of word graphs and containment of the associated congruences.

Lemma 3.13.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are deterministic word graphs on the same alphabet AA such that every node in Γ0\Gamma_{0} and Γ1\Gamma_{1} is reachable from 0V00\in V_{0} and 0V10\in V_{1}, respectively, then there exists at most one word graph homomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that (0)ϕ=0(0)\phi=0.

Proof.

Suppose that ϕ0,ϕ1:Γ0Γ1\phi_{0},\phi_{1}:\Gamma_{0}\longrightarrow\Gamma_{1} are word graph homomorphisms such that (0)ϕ0=(0)ϕ1=0(0)\phi_{0}=(0)\phi_{1}=0 and ϕ0ϕ1\phi_{0}\neq\phi_{1}. Then there exists a node αV0\alpha\in V_{0} such that (α)ϕ0(α)ϕ1(\alpha)\phi_{0}\neq(\alpha)\phi_{1}. If ww is any word labelling a (0,α)(0,\alpha)-path, then, since word graph homomorphisms preserve paths, ww labels (0,(α)ϕ0)(0,(\alpha)\phi_{0})- and (0,(α)ϕ1)(0,(\alpha)\phi_{1})-paths in Γ1\Gamma_{1}, which contradicts the assumption that Γ1\Gamma_{1} is deterministic. ∎

Suppose that Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are word graphs. At various points in the paper it will be useful to consider the disjoint union Γ0Γ1\Gamma_{0}\sqcup\Gamma_{1} of Γ0\Gamma_{0} and Γ1\Gamma_{1}, which has set of nodes, after appropriate relabelling, V0V1V_{0}\sqcup V_{1} and edges E0E1E_{0}\sqcup E_{1}. If αVi\alpha\in V_{i}, then we will write αΓiV0V1\alpha_{\Gamma_{i}}\in V_{0}\sqcup V_{1} if it is necessary to distinguish which graph the node belongs to. We will also abuse notation by assuming that V0,V1V0V1V_{0},V_{1}\subseteq V_{0}\sqcup V_{1} and E0,E1E0E1E_{0},E_{1}\subseteq E_{0}\sqcup E_{1}.

Corollary 3.14.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}), Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}), and Γ2=(V2,E2)\Gamma_{2}=(V_{2},E_{2}) are word graphs over the same alphabet, and every node in each word graph Γi\Gamma_{i} is reachable from 0ΓiVi0_{\Gamma_{i}}\in V_{i} for i{0,1,2}i\in\{0,1,2\}, then there is at most one word graph homomorphism ϕ:Γ0Γ1Γ2\phi:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow\Gamma_{2} such that (0Γ0)ϕ=(0Γ1)ϕ=0Γ2(0_{\Gamma_{0}})\phi=(0_{\Gamma_{1}})\phi=0_{\Gamma_{2}}.

Proof.

Suppose that ϕ0,ϕ1:Γ0Γ1Γ2\phi_{0},\phi_{1}:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow\Gamma_{2} are word graph homomorphisms such that (0Γ0)ϕ=(0Γ1)ϕ=0Γ2(0_{\Gamma_{0}})\phi=(0_{\Gamma_{1}})\phi=0_{\Gamma_{2}}. Then ϕi|Γj:ΓjΓ2\phi_{i}|_{\Gamma_{j}}:\Gamma_{j}\longrightarrow\Gamma_{2} is a word graph homomorphism for i=0,1i=0,1 and j=0,1j=0,1. Hence, by Lemma 3.13, ϕ0|Γ0=ϕ1|Γ0\phi_{0}|_{\Gamma_{0}}=\phi_{1}|_{\Gamma_{0}} and ϕ0|Γ1=ϕ1|Γ1\phi_{0}|_{\Gamma_{1}}=\phi_{1}|_{\Gamma_{1}}, and so ϕ0=ϕ1\phi_{0}=\phi_{1}. ∎

The final lemma in this subsection relates word graph homomorphisms and containment of the associated congruences.

Lemma 3.15.

Let Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) be word graphs over an alphabet AA representing congruences ρ\rho and σ\sigma on a monoid M=AM=\langle\>A\>\rangle. Then there exists a word graph homomorphism ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} such that (0Γ0)ϕ=0Γ1(0_{\Gamma_{0}})\phi=0_{\Gamma_{1}} if and only if ρσ\rho\subseteq\sigma.

Proof.

(\Rightarrow) If ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} is a word graph homomorphism such that (0Γ0)ϕ=0Γ1(0_{\Gamma_{0}})\phi=0_{\Gamma_{1}}, and wAw\in A^{*} labels a (0,α)(0,\alpha)-path in Γ0\Gamma_{0}, then ww labels a (0,(α)ϕ)(0,(\alpha)\phi)-path in Γ1\Gamma_{1}. If (x,y)ρ(x,y)\in\rho, then xx and yy label (0,α)(0,\alpha)-paths in Γ0\Gamma_{0} and so xx and yy label (0,(α)ϕ)(0,(\alpha)\phi)-paths in Γ1\Gamma_{1}. Hence (x,y)σ(x,y)\in\sigma and so ρσ\rho\subseteq\sigma.

(\Leftarrow) Conversely, assume that ρσ\rho\subseteq\sigma. We define ϕ:Γ0Γ1\phi:\Gamma_{0}\longrightarrow\Gamma_{1} as follows. For every αV0\alpha\in V_{0}, we fix a word vαAv_{\alpha}\in A^{*} labelling a (0,α)(0,\alpha)-path. Such a path exists for every αV0\alpha\in V_{0} because every node is reachable from 0. We define (α)ϕ=0Γ1vα(\alpha)\phi=0\cdot_{\Gamma_{1}}v_{\alpha} for all αV0\alpha\in V_{0}. If (α,a,β)E0(\alpha,a,\beta)\in E_{0}, then vαav_{\alpha}a and vβv_{\beta} both label (0,β)(0,\beta)-paths, and so (vαa,vβ)ρ(v_{\alpha}a,v_{\beta})\in\rho. Since ρσ\rho\subseteq\sigma, it follows that (vαa,vβ)σ(v_{\alpha}a,v_{\beta})\in\sigma and so vαav_{\alpha}a and vβv_{\beta} both label (0,(β)ϕ)(0,(\beta)\phi)-paths in Γ1\Gamma_{1}. In particular, ((α)ϕ,a,(β)ϕ)((\alpha)\phi,a,(\beta)\phi) is an edge of Γ1\Gamma_{1}, and ϕ\phi is a homomorphism. ∎

3.3 Standard word graphs

In this section we prove some essential results about standard word graphs.

Suppose that Γ=(V,E)\Gamma=(V,E) is a word graph where V={0,,m1}V=\{0,\ldots,m-1\} for some nn\in\mathbb{N} and EV×A×VE\subseteq V\times A\times V where A={a0<<ak1}A=\{a_{0}<\cdots<a_{k-1}\}. The ordering on VV and AA induces the lexicographic ordering on V×AV\times A and V×A×VV\times A\times V, and the latter orders the edges of any word graph Γ=(V,E)\Gamma=(V,E). We write << for any and all of these orders.

We defined standard complete word graphs in 3.5, we now extend this definition to incomplete word graphs Γ=(V,E)\Gamma=(V,E) by adding the following requirement:

  1. (iv)

    if (α,a)V×A(\alpha,a)\in V\times A is a missing edge in Γ\Gamma, (α,a)<(β,b)(\alpha,a)<(\beta,b) for some (β,b)V×A(\beta,b)\in V\times A, and there exists γV\gamma\in V such that (β,b,γ)E(\beta,b,\gamma)\in E, then wγwβbw_{\gamma}\neq w_{\beta}b.

An edge (α,a,β)E(\alpha,a,\beta)\in E is a short-lex defining edge in Γ\Gamma if wβ=wαaw_{\beta}=w_{\alpha}a.

Lemma 3.16.

Let Γ=(V,E)\Gamma=(V,E) be a deterministic word graph over an alphabet AA, let α,βV\alpha,\beta\in V, and let

(0,b0,α1)=(α0,b0,α1),,(αn1,bn1,αn)=(αn1,bn1,α)(0,b_{0},\alpha_{1})=(\alpha_{0},b_{0},\alpha_{1}),\ldots,(\alpha_{n-1},b_{n-1},\alpha_{n})=(\alpha_{n-1},b_{n-1},\alpha)

be an (α,β)(\alpha,\beta)-path labelled by w=b0bn1Aw=b_{0}\cdots b_{n-1}\in A^{*}. If ww is the short-lex least word labelling any (α,β)(\alpha,\beta)-path in Γ\Gamma, then the following hold:

  1. (i)

    αi=αj\alpha_{i}=\alpha_{j} if and only if i=ji=j, hence the (α,β)(\alpha,\beta)-path labelled by ww does not contain duplicate edges;

  2. (ii)

    bibj1b_{i}\cdots b_{j-1} is the short-lex least word labelling any (αi,αj)(\alpha_{i},\alpha_{j})-path for all i,j{0,,n}i,j\in\{0,\ldots,n\} such that i<ji<j.

Lemma 3.17.

Let Γ=(V,E)\Gamma=(V,E) be a standard word graph over the alphabet AA, let αV\alpha\in V, and let

(0,b0,α1)=(α0,b0,α1),,(αn1,bn1,αn)=(αn1,bn1,α)(0,b_{0},\alpha_{1})=(\alpha_{0},b_{0},\alpha_{1}),\ldots,(\alpha_{n-1},b_{n-1},\alpha_{n})=(\alpha_{n-1},b_{n-1},\alpha)

be a (0,α)(0,\alpha)-path labelled by w=b0bn1Aw=b_{0}\cdots b_{n-1}\in A^{*}. If ww is the short-lex least word labelling any (0,α)(0,\alpha)-path in Γ\Gamma, then:

  1. (i)

    every edge (αi,bi,αi+1)(\alpha_{i},b_{i},\alpha_{i+1}) is a short-lex defining edge;

  2. (ii)

    α0<α1<<αn\alpha_{0}<\alpha_{1}<\cdots<\alpha_{n}.

Proof.

For (i), let wαiw_{\alpha_{i}} be the short-lex least word labelling a (0,αi)(0,\alpha_{i})-path for each i{0,,n}i\in\{0,\ldots,n\}. By Lemma 3.16(ii), wαi=b0bi1w_{\alpha_{i}}=b_{0}\cdots b_{i-1}. Hence wαi+1=wαibiw_{\alpha_{i+1}}=w_{\alpha_{i}}b_{i} and so (αi,bi,αi+1)(\alpha_{i},b_{i},\alpha_{i+1}) is a short-lex defining edge as required.

For (ii), since |wαi|<|wαi+1||w_{\alpha_{i}}|<|w_{\alpha_{i+1}}|, it follows that wαi<wαi+1w_{\alpha_{i}}<w_{\alpha_{i+1}} and so by 3.5(iii), αi<αi+1\alpha_{i}<\alpha_{i+1} for every ii. ∎

If Γ=(V,E)\Gamma=(V,E) is an incomplete word graph over AA, then we refer to (α,a)V×A(\alpha,a)\in V\times A as a missing edge if (α,a,β)E(\alpha,a,\beta)\not\in E for all βV\beta\in V. Recall that the missing edges are ordered lexicographically according to the orders on VV and AA as defined at the start of Section 3.3.

Lemma 3.18.

Let Γ=(V,E)\Gamma=(V,E) be an incomplete standard word graph over the alphabet AA, and let (α,a)V×A(\alpha,a)\in V\times A be a missing edge. Then wγ<wαaw_{\gamma}<w_{\alpha}a for all γV\gamma\in V.

Proof.

If γ=0\gamma=0, then wγ=ε<wαaw_{\gamma}=\varepsilon<w_{\alpha}a as required. Assume that γ>0\gamma>0. Then |wγ|1|w_{\gamma}|\geq 1 and, in particular, there is at least one edge on the (0,γ)(0,\gamma)-path labelled by wγw_{\gamma}. Let (β,b,γ)(\beta,b,\gamma) be the last such edge. By Lemma 3.16(ii), wγ=wβbw_{\gamma}=w_{\beta}b, and, by 3.5(iv), (β,b)(α,a)(\beta,b)\leq(\alpha,a). If (β,b)=(α,a)(\beta,b)=(\alpha,a), then (α,a)(\alpha,a) is not a missing edge. Hence (β,b)<(α,a)(\beta,b)<(\alpha,a), and so, either β<α\beta<\alpha; or α=β\alpha=\beta and a<ba<b. If β<α\beta<\alpha, then, by 3.5(iii), wβ<wαw_{\beta}<w_{\alpha} and so wγ=wβb<wαaw_{\gamma}=w_{\beta}b<w_{\alpha}a, as required. If β=α\beta=\alpha and b<ab<a, then wγ=wβb=wαb<wαaw_{\gamma}=w_{\beta}b=w_{\alpha}b<w_{\alpha}a. ∎

Lemma 3.19.

Let Γ=(V,E)\Gamma=(V,E) be an incomplete standard word graph over the alphabet AA, let (α,a)(\alpha,a) be a missing edge, let βV\beta\in V, and let e=(α,a,β)e=(\alpha,a,\beta). If Γ=(V,E{e})\Gamma^{\prime}=(V,E\cup\{e\}), then the following hold:

  1. (i)

    wγ=wγw_{\gamma}=w_{\gamma}^{\prime} for all γV\gamma\in V where wγw_{\gamma}^{\prime} is the short-lex least word labelling any (0,γ)(0,\gamma)-path in Γ\Gamma^{\prime};

  2. (ii)

    Γ\Gamma^{\prime} is standard.

Proof.

(i). Since every path in Γ\Gamma is also a path in Γ\Gamma^{\prime}, wγwγw^{\prime}_{\gamma}\leq w_{\gamma} for all γV\gamma\in V. Let γV\gamma\in V be arbitrary. If the (0,γ)(0,\gamma)-path labelled by wγw^{\prime}_{\gamma} in Γ\Gamma^{\prime} does not contain the newly added edge ee, then wγw^{\prime}_{\gamma} also labels a (0,γ)(0,\gamma)-path in Γ\Gamma and so wγ=wγw_{\gamma}=w^{\prime}_{\gamma}.

Seeking a contradiction suppose that (0,γ)(0,\gamma)-path labelled by wγw^{\prime}_{\gamma} in Γ\Gamma contains the newly added edge ee. Then we can write wγ=uavw^{\prime}_{\gamma}=uav where uu labels a (0,α)(0,\alpha)-path and vv labels a (β,γ)(\beta,\gamma)-path in Γ\Gamma^{\prime}. By Lemma 3.16(ii), uu labels the short-lex least (0,α)(0,\alpha)-path in Γ\Gamma^{\prime} and so u=wαu=w^{\prime}_{\alpha}. Since (α,a)(\alpha,a) was a missing edge, Γ\Gamma^{\prime} is deterministic, so by Lemma 3.16(i) in Γ\Gamma^{\prime}, the (0,α)(0,\alpha)-path labelled by uu does not contain the edge ee. Hence wαw^{\prime}_{\alpha} also labels a (0,α)(0,\alpha)-path in Γ\Gamma and so wα=wαw^{\prime}_{\alpha}=w_{\alpha}. By Lemma 3.16(ii) again, wβ=wαaw_{\beta}^{\prime}=w_{\alpha}a. But now by Lemma 3.18 in Γ\Gamma, wβ=wαa>wβw_{\beta}^{\prime}=w_{\alpha}a>w_{\beta}, which is a contradiction.

Hence the (0,γ)(0,\gamma)-path labelled by wγw^{\prime}_{\gamma} in Γ\Gamma does not contain ee for any γV\gamma\in V, and so wγ=wγw_{\gamma}=w^{\prime}_{\gamma}.

(ii). Clearly, parts (i) and (ii) of 3.5 hold in Γ\Gamma^{\prime}. Part (iii) of 3.5 holds by part (i) of this lemma.

To show that 3.5(iv) holds, suppose that (γ,c)(\gamma,c) is a missing edge of Γ\Gamma^{\prime} and (δ,d,ζ)E{e}(\delta,d,\zeta)\in E\cup\{e\} for some γ,δ,ζV\gamma,\delta,\zeta\in V and c,dAc,d\in A such that (γ,c)<(δ,d)(\gamma,c)<(\delta,d). Note that every missing edge of Γ\Gamma^{\prime} is a missing edge of Γ\Gamma also. In particular, (γ,c)(\gamma,c) is a missing edge of Γ\Gamma.

If (δ,d,ζ)e(\delta,d,\zeta)\neq e, then, by 3.5(iv) applied to Γ\Gamma, wζwδdw_{\zeta}\neq w_{\delta}d. But part (i) implies that wζ=wζw_{\zeta}^{\prime}=w_{\zeta} and wδ=wδw_{\delta}^{\prime}=w_{\delta}, and so wζwδdw_{\zeta}^{\prime}\neq w_{\delta}^{\prime}d also. In particular, Γ\Gamma^{\prime} satisfies 3.5(iv) in this case.

Applying Lemma 3.18 to Γ\Gamma and (α,a)(\alpha,a) yields wβ<wαaw_{\beta}<w_{\alpha}a. So, if (δ,d,ζ)=e=(α,a,β)(\delta,d,\zeta)=e=(\alpha,a,\beta), then wζ=wβ<wαa=wδdw_{\zeta}=w_{\beta}<w_{\alpha}a=w_{\delta}d. Applying part (i) as in the previous case implies that wζ<wδdw_{\zeta}^{\prime}<w_{\delta}^{\prime}d. ∎

The final lemma in this section shows that the analogue of Lemma 3.19(ii) holds when the target of the missing edge is defined to be a new node.

Lemma 3.20.

Let Γ=(V,E)\Gamma=(V,E) be an incomplete standard word graph over the alphabet AA, let (α,a)V×A(\alpha,a)\in V\times A be the shortlex least missing edge in Γ\Gamma, and let e=(α,a,|V|)e=(\alpha,a,|V|). Then Γ=(V{|V|},E{e})\Gamma^{\prime}=(V\cup\{|V|\},E\cup\{e\}) is standard.

Proof.

The word graph Γ\Gamma^{\prime} is deterministic since (α,a)(\alpha,a) is a missing edge in Γ\Gamma. Hence Γ\Gamma^{\prime} satisfies 3.5(i). Since Γ\Gamma is standard, every node in VV is reachable from 0 in Γ\Gamma and Γ\Gamma^{\prime}. In particular, α\alpha is reachable from 0 in Γ\Gamma^{\prime} and hence so too is |V||V|. Thus 3.5(ii) holds for Γ\Gamma^{\prime}.

We set V=V{|V|}V^{\prime}=V\cup\{|V|\} and E=E{e}E^{\prime}=E\cup\{e\}, so that Γ=(V,E)\Gamma^{\prime}=(V^{\prime},E^{\prime}). As in Lemma 3.19(i), for every γV\gamma\in V^{\prime}, we denote by wγw^{\prime}_{\gamma} the short-lex least word labelling any (0,γ)(0,\gamma)-path in Γ\Gamma^{\prime}. There are no edges in EE^{\prime} with source |V||V| and |V|V|V|\not\in V, and so if γV\gamma\in V, then no (0,γ)(0,\gamma)-path in Γ\Gamma^{\prime} contains the newly added edge ee. Therefore wγ=wγw_{\gamma}=w^{\prime}_{\gamma} for each γV\gamma\in V. Since (α,a,|V|)(\alpha,a,|V|) is the only edge with target |V||V|, and from Lemma 3.16(ii), w|V|=wαa=wαaw^{\prime}_{|V|}=w_{\alpha}^{\prime}a=w_{\alpha}a. But then Lemma 3.18 implies that wγ=wγ<wαa=w|V|w_{\gamma}^{\prime}=w_{\gamma}<w_{\alpha}a=w_{|V|}^{\prime} for all γV\gamma\in V. So, if γ,δV\gamma,\delta\in V^{\prime} and γ<δ\gamma<\delta, then either γ,δV\gamma,\delta\in V or δ=|V|\delta=|V|. In both cases, wγ<wδw_{\gamma}^{\prime}<w_{\delta}^{\prime} and so 3.5(iii) holds for Γ\Gamma^{\prime}.

To establish that 3.5(iv) holds for Γ\Gamma^{\prime}, suppose that (γ,c)(\gamma,c) is a missing edge of Γ\Gamma^{\prime} and (δ,d,ζ)E(\delta,d,\zeta)\in E^{\prime} for some γ,δ,ζV\gamma,\delta,\zeta\in V and c,dAc,d\in A with (γ,c)<(δ,d)(\gamma,c)<(\delta,d). There are three cases to consider:

  1. (a)

    (γ,c)(\gamma,c) is a missing edge in Γ\Gamma and (δ,d,ζ)E(\delta,d,\zeta)\in E;

  2. (b)

    (γ,c)(\gamma,c) is a missing edge in Γ\Gamma and (δ,d,ζ)E(\delta,d,\zeta)\notin E;

  3. (c)

    (γ,c)(\gamma,c) is not a missing edge in Γ\Gamma.

If (a) holds, then wζwδdw_{\zeta}\neq w_{\delta}d by 3.5(iv) applied to Γ\Gamma. But Lemma 3.19 implies that wζ=wζw_{\zeta}^{\prime}=w_{\zeta} and wδwδw_{\delta}^{\prime}\neq w_{\delta} and so wζwδdw_{\zeta}^{\prime}\neq w_{\delta}^{\prime}d in this case.

We conclude the proof by showing that neither (b) nor (c) holds.

If (b) holds, then (δ,d,ζ)=e=(α,a,|V|)(\delta,d,\zeta)=e=(\alpha,a,|V|). But (α,a)(\alpha,a) is the least missing edge of Γ\Gamma, so (δ,d)=(α,a)(γ,c)(\delta,d)=(\alpha,a)\leq(\gamma,c), which contradicts the assumption that (γ,c)<(δ,d)(\gamma,c)<(\delta,d). Hence (b) does not hold.

If (c) holds, then γ=|V|\gamma=|V|. Since there are no edges with source |V||V| in Γ\Gamma^{\prime}, it follows that δV\delta\in V and so δ<|V|\delta<|V|. But then (γ,c)=(|V|,c)>(δ,d)(\gamma,c)=(|V|,c)>(\delta,d), which again contradicts the assumption that (δ,d)>(γ,c)(\delta,d)>(\gamma,c). ∎

Combining Lemma 3.19(ii) and Lemma 3.20 we obtain the following corollary.

Corollary 3.21.

Let Γ=(V,E)\Gamma=(V,E) be an incomplete standard word graph over the alphabet AA, let (α,a)(\alpha,a) be the short-lex least missing edge in Γ\Gamma, and let βV{|V|}\beta\in V\cup\{|V|\}. Then Γ=(V{β},E{(α,a,β)})\Gamma^{\prime}=(V\cup\{\beta\},E\cup\{(\alpha,a,\beta)\}) is also standard.

4 Algorithm 1: the low-index right congruences algorithm

Throughout this section we suppose that: AR\langle A\mid R\rangle is a fixed finite monoid presentation defining a monoid MM; and that n+n\in\mathbb{Z}^{+} is fixed. The purpose of this section is to describe a procedure for iterating through the right congruences of MM with at most nn congruence classes. This procedure is based on the Todd–Coxeter Algorithm (see for example [13][38] or [69]) and is related to Sims’ “low-index” algorithm for computing subgroups of finitely presented groups described in Chapter 5.6 of [65].

As shown in 3.7, there is a bijective correspondence between complete standard word graphs with at most nn nodes that are compatible with RR, and the right congruences of MM with index at most nn. As we hope to demonstrate, the key advantage of this correspondence is that word graphs are inherently combinatorial objects which lend themselves nicely to various enumeration methods. The algorithm we describe in this section is a more or less classical backtracking algorithm, or depth-first search.

This section is organised as follows. We begin with a brief general description of backtracking algorithms and refining functions in Section 4.1. For a more detailed overview of backtracking search methods see [43, Section 7.2.2]. In Section 4.2 we construct a specific search tree for the problem at hand, whose nodes are standard word graphs; in Section 4.3 we introduce various refining functions that improve the performance of finding right congruences.

4.1 Backtracking search and refining functions

We start with the definition of the search space where we are performing the backtracking search. To do so we require the notion of a digraph 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}) where 𝕍\mathbb{V} is the set of nodes, and 𝔼𝕍×𝕍\mathbb{E}\subseteq\mathbb{V}\times\mathbb{V} is the set of edges. We denote such digraphs using blackboard fonts to distinguish them from the word graphs defined above.

A multitree is a digraph 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}) such that for all 𝕧,𝕨𝕍\mathbb{v},\mathbb{w}\in\mathbb{V} there exists at most one directed path from 𝕧\mathbb{v} to 𝕨\mathbb{w} in 𝕋\mathbb{T}. For a node 𝕧𝕍\mathbb{v}\in\mathbb{V} we write Desc(𝕋,𝕧)\operatorname{Desc}(\mathbb{T},\mathbb{v}) to denote the set of all nodes reachable from 𝕧\mathbb{v} in 𝕋\mathbb{T}.

Given a multitree 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}) and a (possibly infinite) set 𝕏𝕍\mathbb{X}\subseteq\mathbb{V}, we say that 𝕋\mathbb{T} is a search multitree for 𝕏\mathbb{X} if there exists 𝕧𝕍\mathbb{v}\in\mathbb{V} such that 𝕏Desc(𝕧)\mathbb{X}\subseteq\operatorname{Desc}(\mathbb{v}). We refer to any such node 𝕧\mathbb{v} as a root node of (𝕋,𝕏)(\mathbb{T},\mathbb{X}). Recall that the symbol \bot is used to mean “undefined” and does not belong to 𝕍\mathbb{V}.

Definition 4.1.

A function f:𝕍{}𝕍{}f:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} is a refining function for 𝕏\mathbb{X} if the following hold for all 𝕧𝕍\mathbb{v}\in\mathbb{V}:

  1. (i)

    f()=f(\bot)=\bot,

  2. (ii)

    if f(𝕧)=f(\mathbb{v})=\bot, then Desc(𝕧)𝕏=\operatorname{Desc}(\mathbb{v})\cap\mathbb{X}=\varnothing,

  3. (iii)

    if f(𝕧)f(\mathbb{v})\neq\bot, then Desc(𝕧)𝕏=Desc(f(𝕧))𝕏\operatorname{Desc}(\mathbb{v})\cap\mathbb{X}=\operatorname{Desc}(f(\mathbb{v}))\cap\mathbb{X}.

For example, the identity function id:𝕍{}𝕍{}\mbox{\rm id}:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} is a refining function for subset of 𝕍\mathbb{V}.

If 𝕧𝕍\mathbb{v}\in\mathbb{V}, then we refer to the set

Kids(𝕧)={𝕨𝕍:(𝕧,𝕨)𝔼}\operatorname{Kids}(\mathbb{v})=\{\mathbb{w}\in\mathbb{V}:(\mathbb{v},\mathbb{w})\in\mathbb{E}\}

as the children of 𝕧\mathbb{v} in 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}). Given algorithms for computing the refining function ff, testing membership in 𝕏\mathbb{X}, and determining the children Kids(𝕧)\operatorname{Kids}(\mathbb{v}) of any 𝕧𝕍\mathbb{v}\in\mathbb{V}, the backtracking algorithm BacktrackingSearch𝕏(f,𝕧)\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\mathbb{v}) outputs the set Desc(𝕧)𝕏\operatorname{Desc}(\mathbb{v})\cap\mathbb{X} for any 𝕧𝕍\mathbb{v}\in\mathbb{V}. As a consequence BacktrackingSearch𝕏(f,𝕧)=𝕏\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\mathbb{v})=\mathbb{X} if 𝕧\mathbb{v} is any root node of (𝕋,𝕏)(\mathbb{T},\mathbb{X}). Pseudocode for the algorithm BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} is given in Algorithm 1.

Algorithm 1 - BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}}

Input: A refining function f:𝕍{}𝕍{}f:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} for 𝕏\mathbb{X} and a node 𝕧𝕍\mathbb{v}\in\mathbb{V}.
Output: Desc(𝕧)𝕏\operatorname{Desc}(\mathbb{v})\cap\mathbb{X}.

1:SS\leftarrow\varnothing
2:𝕧f(𝕧)\mathbb{v}\leftarrow f(\mathbb{v})
3:if 𝕧\mathbb{v}\not=\bot then
4:  if 𝕧𝕏\mathbb{v}\in\mathbb{X} then
5:   SS{𝕧}S\leftarrow S\cup\{\mathbb{v}\}
6:  end if
7:  for 𝕨Kids(𝕧)\mathbb{w}\in\operatorname{Kids}(\mathbb{v}) do
8:   SSBacktrackingSearch𝕏(f,𝕨)S\leftarrow S\cup\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\mathbb{w}) [Due to the multitree property, this is a disjoint union.]
9:  end for
10:end if
11:return SS

Of course, if 𝕏\mathbb{X} is infinite, then BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} will not terminate. In practice, if 𝕏\mathbb{X} is finite but 𝕋\mathbb{T} is infinite, some care is required when choosing a refining function f:𝕍{}𝕍{}f:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} to ensure that BacktrackingSearch𝕏(f,𝕧)\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\mathbb{v}) terminates. On the other hand if f(𝕧)f(\mathbb{v})\neq\bot for only finitely many 𝕧𝕍\mathbb{v}\in\mathbb{V}, then clearly, BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} will terminate.

BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} can be modified to simply count the number of elements in 𝕏\mathbb{X}, to apply any function to each element of 𝕏\mathbb{X} as it is discovered, or to search for an element of 𝕏\mathbb{X} with a particular property by modifying line 5 and 8.

The following properties of search multitrees and refining functions will be useful later:

Proposition 4.2.

Let 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}) be a search multitree for 𝕏𝕍\mathbb{X}\subseteq\mathbb{V}. Then

  1. (i)

    If 𝕐𝕏\mathbb{Y}\subseteq\mathbb{X}, then 𝕋\mathbb{T} is also a search multitree for 𝕐\mathbb{Y};

  2. (ii)

    If 𝕐,𝕏\mathbb{Y},\mathbb{Z}\subseteq\mathbb{X} and f𝕐f_{\mathbb{Y}} and ff_{\mathbb{Z}} are refining functions for 𝕐\mathbb{Y} and \mathbb{Z} respectively, then f𝕐ff_{\mathbb{Y}}\circ f_{\mathbb{Z}} is a refining function for 𝕐\mathbb{Y}\cap\mathbb{Z}.

4.2 The search multitree of standard word graphs

In this section, we describe the specific search multitree 𝕋=(𝕍,𝔼)\mathbb{T}=(\mathbb{V},\mathbb{E}) required for the low-index congruences algorithm.

We define 𝕍\mathbb{V} to be the set of all standard word graphs over a fixed finite alphabet AA and we define 𝔼𝕍×𝕍\mathbb{E}\subseteq\mathbb{V}\times\mathbb{V} to consist of the edges (Γ,Γ)𝔼(\Gamma,\Gamma^{\prime})\in\mathbb{E} if and only if Γ=(V,E)\Gamma=(V,E), βV{|V|}\beta\in V\cup\{|V|\}, (α,a)(\alpha,a) is the short-lex least missing edge in Γ\Gamma, and Γ=(V{β},E{(α,a,β)})\Gamma^{\prime}=(V\cup\{\beta\},E\cup\{(\alpha,a,\beta)\}). Since every word graph over AA is finite by definition, the set 𝕍\mathbb{V} is countably infinite.

We write Γ=(V,E)Γ=(V,E)\Gamma=(V,E)\subseteq\Gamma^{\prime}=(V^{\prime},E^{\prime}) if VVV\subseteq V^{\prime} and EEE\subseteq E^{\prime}.

Lemma 4.3.

The digraph 𝕋\mathbb{T} is a multitree.

Proof.

Suppose that Γ0,,Γm\Gamma_{0},\ldots,\Gamma_{m} and Γ0,,Γn\Gamma_{0}^{\prime},\ldots,\Gamma_{n}^{\prime} are paths in 𝕋\mathbb{T} such that Γ0=Γ0\Gamma_{0}=\Gamma_{0}^{\prime} and Γm=Γn\Gamma_{m}=\Gamma_{n}^{\prime}. From the definition of 𝕋\mathbb{T} it follows that Γ0Γm\Gamma_{0}\subseteq\cdots\subseteq\Gamma_{m} and Γ0Γn\Gamma_{0}^{\prime}\subseteq\cdots\subseteq\Gamma_{n}^{\prime}. Seeking a contradiction suppose that ii\in\mathbb{N} is the least value such that Γi+1Γi+1\Gamma_{i+1}\neq\Gamma_{i+1}^{\prime}. If (α,a)(\alpha,a) is the least missing edge in Γi=(Vi,Ei)=Γi\Gamma_{i}=(V_{i},E_{i})=\Gamma_{i}^{\prime}, then Γi+1=(Vi{β},Ei{(α,a,β)})\Gamma_{i+1}=(V_{i}\cup\{\beta\},E_{i}\cup\{(\alpha,a,\beta)\}) and Γi+1=(Vi{β},Ei{(α,a,β)})\Gamma_{i+1}^{\prime}=(V_{i}\cup\{\beta^{\prime}\},E_{i}\cup\{(\alpha,a,\beta^{\prime})\}) for some β,βVi{|Vi|}\beta,\beta^{\prime}\in V_{i}\cup\{|V_{i}|\} with ββ\beta\neq\beta^{\prime}. It follows that (α,a,β),(α,a,β)Γm=Γn(\alpha,a,\beta),(\alpha,a,\beta^{\prime})\in\Gamma_{m}=\Gamma_{n}^{\prime}, and so Γm\Gamma_{m} is not deterministic, and hence not standard, which is a contradiction. ∎

We denote the set of all complete standard word graphs over AA by 𝕏\mathbb{X}. Note that, by 3.7, the word graphs in 𝕏\mathbb{X} are in bijective correspondence with the right congruences of the free monoid AA^{*}; see Appendix B. We do not use this correspondence explicitly.

We will now show that every Γ𝕏\Gamma\in\mathbb{X} is reachable from the trivial word graph Ξ=({0},)\Xi=(\{0\},\varnothing) in 𝕋\mathbb{T}, so that 𝕋\mathbb{T} is a search multitree for 𝕏\mathbb{X}.

Lemma 4.4.

Let Γ=(V,E)𝕏\Gamma=(V,E)\in\mathbb{X} be any complete standard word graph over AA. Then there exists a sequence of standard word graphs

Ξ=Γ0,Γ1,,Γn=Γ\Xi=\Gamma_{0},\Gamma_{1},\ldots,\Gamma_{n}=\Gamma

such that (Γi,Γi+1)(\Gamma_{i},\Gamma_{i+1}) is an edge in 𝕋\mathbb{T} for every i{0,,n1}i\in\{0,\ldots,n-1\}. In particular, 𝕏Desc(Ξ)\mathbb{X}\subseteq\operatorname{Desc}(\Xi), and so 𝕋\mathbb{T} is a search multitree for 𝕏\mathbb{X}.

Proof.

Suppose that we have defined Γ0,,Γi\Gamma_{0},\ldots,\Gamma_{i} for some 0i<n0\leq i<n such that Γ0ΓiΓ\Gamma_{0}\subsetneq\cdots\subsetneq\Gamma_{i}\subseteq\Gamma and (Γj,Γj+1)(\Gamma_{j},\Gamma_{j+1}) is an edge in 𝕋\mathbb{T} for every j{0,,i1}j\in\{0,\ldots,i-1\}. Let (α,a)V×A(\alpha,a)\in V\times A be the least missing edge in Γi=(Vi,Ei)\Gamma_{i}=(V_{i},E_{i}). Since Γ\Gamma is deterministic, there exists βV\beta\in V such that (α,a,β)E(\alpha,a,\beta)\in E. We define Γi+1=(Vi{β},Ei{(α,a,β)})\Gamma_{i+1}=(V_{i}\cup\{\beta\},E_{i}\cup\{(\alpha,a,\beta)\}). Clearly, (Γi,Γi+1)𝔼(\Gamma_{i},\Gamma_{i+1})\in\mathbb{E} by definition and ΓiΓi+1Γ\Gamma_{i}\subsetneq\Gamma_{i+1}\subseteq\Gamma.

Since Γ\Gamma is finite, and the Γi\Gamma_{i} form a strictly increasing sequence of subsets of Γ\Gamma, it follows that the sequence of Γi\Gamma_{i} is finite. ∎

If Γ=(V,E)\Gamma=(V,E) is an incomplete standard word graph with least missing edge (α,a)V×A(\alpha,a)\in V\times A, then the children of Γ\Gamma in 𝕋\mathbb{T} are:

Kids(Γ)={(V{β},E{(α,a,β)}):β{0,,|V|}}.\operatorname{Kids}(\Gamma)=\{\>(V\cup\{\beta\},E\cup\{(\alpha,a,\beta)\})\>:\>\beta\in\{0,\ldots,|V|\}\>\}.

Clearly, since Kids(Γ)\operatorname{Kids}(\Gamma) is finite, it can be computed in linear time in |V||V|. Also it is possible to check if Γ\Gamma is complete in constant time by checking whether |E|=|A||V||E|=|A||V|. Hence we can check whether Γ\Gamma belongs to 𝕏\mathbb{X} in constant time.

We conclude this subsection with some comments about the implementational issues related to BacktrackingSearch𝕏(f,Γ)\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\Gamma) for some refining function ff of 𝕏\mathbb{X} and word graph Γ𝕍\Gamma\in\mathbb{V}. It might appear that to iterate over Kids(Γ)\operatorname{Kids}(\Gamma) in line 7 of Algorithm 1, it is necessary to copy Γ\Gamma with the appropriate edge added, so that the recursive call to BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} in line 8 does not modify Γ\Gamma. However, this approach is extremely memory inefficient, requiring memory proportional to the size of the search tree. This is especially bad when BacktrackingSearch𝕏\texttt{BacktrackingSearch}_{\mathbb{X}} is used to count the word graphs satisfying certain criteria or used to find a word graph satisfying a particular property. We briefly outline how to iterate over Kids(Γ)\operatorname{Kids}(\Gamma) by modifying Γ\Gamma inplace, which requires no extra memory (other than that needed to store the additional edge). If the maximum number of nodes in any word graph Γ\Gamma that will be encountered during the search is known beforehand, then counting and random sampling of 𝕏\mathbb{X} within the search multitree 𝕋\mathbb{T} can be performed with constant space.

To do this, the underlying datastructure used to store Γ\Gamma must support the following operations: retrieving the total number of edges, adding an edge (with a potentially new node as its target), removing the most recently added edge (and any incident nodes that become isolated). It is possible to implement a datastructure where each of these operations takes constant time and space, this is the approach used in libsemigroups [53]. Of course, the refining functions ff may also modify Γ\Gamma inplace.

Given such a datastructure and refining functions, we can then perform the loop in lines 7-9 of Algorithm 1 as follows:

  1. (1)

    Let k=|E|k=|E| be the total number of edges of Γ\Gamma, let (α,a)(\alpha,a) be the least missing edge of Γ\Gamma and let β=0\beta=0.

  2. (2)

    Add the edge (α,a,β)(\alpha,a,\beta) to Γ\Gamma.

  3. (3)

    Set SSBacktrackingSearch𝕏(f,Γ)S\leftarrow S\cup\texttt{BacktrackingSearch}_{\mathbb{X}}(f,\Gamma), noting that the recursive call takes the modified Γ\Gamma as input.

  4. (4)

    If |E|>k|E|>k, then repeatedly remove the most recently added edge from Γ\Gamma until |E|=k|E|=k.

  5. (5)

    Increment β\beta. If β>|V|\beta>|V|, then terminate. Otherwise go to Step 2.

The word graph Γ\Gamma is equal to one of its children after the edge is added in Step 2. After Step 4, Γ\Gamma is restored to its original state before the recursive call was made. Note that we cannot just remove the last added edge, as the refining function ff may have added extra edges to Γ\Gamma in the recursive call, and these extra edges are not removed in the recursive call.

4.3 Refining functions for standard word graphs

We denote the set of complete standard word graphs over AA

  • with at most nn nodes by 𝕏n\mathbb{X}_{n};

  • compatible with RA×AR\subseteq A^{*}\times A^{*} by 𝕏R\mathbb{X}_{R}.

By 3.7, the word graphs in 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R} are precisely the word graphs of the right congruences of the monoid defined by AR\langle A\mid R\rangle with index at most nn.

In this section we define the refining functions AtMostn\texttt{AtMost}_{n} and IsCompatibleR\texttt{IsCompatible}_{R} for 𝕏n\mathbb{X}_{n} and 𝕏R\mathbb{X}_{R}, respectively. It follows from 4.2(ii) that AtMostnIsCompatibleR\texttt{AtMost}_{n}\circ\texttt{IsCompatible}_{R} is a refining function for 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R}. We also define two further refining functions for 𝕏R\mathbb{X}_{R} that try to reduce the number of word graphs (or equivalently nodes in the search multitree) visited by BacktrackingSearch𝕏R\texttt{BacktrackingSearch}_{\mathbb{X}_{R}}; we will say more about this later.

The first refining function is AtMostn:𝕍{}𝕍{}\texttt{AtMost}_{n}:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} for any nn\in\mathbb{N} defined by

AtMostn(Γ)={Γif Γ=(V,E) and |V|notherwise\texttt{AtMost}_{n}(\Gamma)=\begin{cases}\Gamma&\text{if }\Gamma=(V,E)\text{ and }|V|\leq n\\ \bot&\text{otherwise}\end{cases}

for every Γ𝕍{}\Gamma\in\mathbb{V}\cup\{\bot\} (the set of standard word graphs over AA and \bot). It is routine to verify that AtMostn\texttt{AtMost}_{n} is a refining function for 𝕏n\mathbb{X}_{n}.

If Γ=(V,E)\Gamma=(V,E) is a standard word graph, then checking whether Γ𝕏\Gamma\in\mathbb{X} (i.e. Γ\Gamma is complete) can be done in constant time, and checking that Γ𝕏n\Gamma\in\mathbb{X}_{n} (i.e. that |V|n|V|\leq n) also has constant time complexity. Moreover, AtMostn(Γ)\texttt{AtMost}_{n}(\Gamma)\neq\bot for only finitely many standard word graphs Γ\Gamma over AA, and thus BacktrackingSearch𝕏n(AtMostn,𝕧)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}}(\texttt{AtMost}_{n},\mathbb{v}) terminates and outputs 𝕏n\mathbb{X}_{n}.

It is possible to check if a, not necessarily standard, word graph Γ\Gamma belongs to 𝕏n,R\mathbb{X}_{n,R} in linear time in the length of the presentation AR\langle A\mid R\rangle. Again since 𝕏n𝕏R𝕏\mathbb{X}_{n}\cap\mathbb{X}_{R}\subseteq\mathbb{X}, 𝕋\mathbb{T} is a multisearch tree for 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R}. This gives us an immediate, if rather inefficient, method for computing all the right congruences with index at most nn of a given finitely presented monoid: simply run BacktrackingSearch𝕏n(AtMostn,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}}(\texttt{AtMost}_{n},\Xi) to obtain 𝕏n\mathbb{X}_{n}, and then check each word graph in 𝕏n\mathbb{X}_{n} for compatibility with RR.

This method would explore just as many nodes of the search tree 𝕋\mathbb{T} for the free monoid a,b\langle a,b\mid\rangle as it would for the trivial monoid a,ba=1,b=1\langle a,b\mid a=1,b=1\rangle. On the other hand, when considering the trivial monoid, as soon as we define an edge leading to a node other than 0, both of the relations a=1a=1 and b=1b=1 are violated and hence there is no need to consider any of the descendants of the current node in the multitree. So that we can take advantage of this observation, we define the function IsCompatibleR:𝕍{}𝕍{}\texttt{IsCompatible}_{R}:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} by

IsCompatibleR(Γ)={Γif Γ𝕍 and Γ is compatible with Rotherwise\texttt{IsCompatible}_{R}(\Gamma)=\begin{cases}\Gamma&\text{if }\Gamma\in\mathbb{V}\text{ and }\Gamma\text{ is compatible with }R\\ \bot&\text{otherwise}\end{cases}

Recall from the definition, if (u,v)R(u,v)\in R, then Γ=(V,E)\Gamma=(V,E) is compatible with (u,v)(u,v) if αu=αv\alpha\cdot u=\alpha\cdot v for every αV\alpha\in V such that αu\alpha\cdot u\neq\bot and αv\alpha\cdot v\neq\bot. The non-existence of a path with source α\alpha labelled by uu or vv, however, does not make Γ\Gamma incompatible with (u,v)(u,v). So it may be possible to extend Γ\Gamma so that uu and vv do label paths with source α\alpha and common target β\beta. Hence IsCompatibleR\texttt{IsCompatible}_{R} does not return \bot just because some relation word does not label a path from some node in Γ\Gamma. It is straightforward to verify that IsCompatibleR\texttt{IsCompatible}_{R} is a refining function for 𝕏R\mathbb{X}_{R}.

By 4.2(ii), IsCompatibleRAtMostn\texttt{IsCompatible}_{R}\circ\texttt{AtMost}_{n} is a refining function for 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R}. Therefore the output of BacktrackingSearch𝕏n𝕏R(IsCompatibleRAtMostn,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}\cap\mathbb{X}_{R}}(\texttt{IsCompatible}_{R}\circ\texttt{AtMost}_{n},\Xi) is 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R}. For comparison, the number of standard word graphs visited by BacktrackingSearch𝕏n𝕏R(AtMostn,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}\cap\mathbb{X}_{R}}(\texttt{AtMost}_{n},\Xi) where n=4n=4, for the 33-generated plactic monoid (with the standard presentation, see [44, 45]) is 3,556,1693,556,169. On the other hand, the number for BacktrackingSearch𝕏n𝕏R(IsCompatibleRAtMostn,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}\cap\mathbb{X}_{R}}(\texttt{IsCompatible}_{R}\circ\texttt{AtMost}_{n},\Xi) is 29,80029,800. This example illustrates that it can be significantly faster to check for compatibility with RR at every node in the search multitree 𝕋\mathbb{T} rather than first finding 𝕏n\mathbb{X}_{n} and then checking for compatibility. The extra time spent per word graph (or node in the search multitree) checking compatibility with RR is negligible in comparison to the saving achieved in this example.

The refiner IsCompatibleR\texttt{IsCompatible}_{R} can be improved. Consider the situation where (u,v)R(u,v)\in R with v=v1bv=v_{1}b for some word v1Av_{1}\in A^{\ast} and letter bAb\in A. If there is a node αV\alpha\in V such that αu\alpha\cdot u\neq\bot and αv1\alpha\cdot v_{1}\neq\bot, but αv=\alpha\cdot v=\bot, then (αv1,b)(\alpha\cdot v_{1},b) is a missing edge in Γ\Gamma. There is only one choice αu\alpha\cdot u for the target of this missing edge which will not break compatibility with RR. This situation is shown diagrammatically in Fig. 4.1.

α\alphaαu\alpha\cdot uαv1\alpha\cdot v_{1}uuv1v_{1}bbα=αv1\alpha=\alpha\cdot v_{1}αu\alpha\cdot uuubbα=αu\alpha=\alpha\cdot uαv1\alpha\cdot v_{1}v1v_{1}bbα=αu=αv1\alpha=\alpha\cdot u=\alpha\cdot v_{1}bb
Figure 4.1: Illustration of a node α\alpha being one letter away from being compatible with the relation (u,v1b)(u,v_{1}b), including degenerate cases when one or both of u,v1u,v_{1} are empty words.

So, if ΓDesc(Γ)𝕏n𝕏R\Gamma^{\prime}\in\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{n}\cap\mathbb{X}_{R}, then (γ,b,β)(\gamma,b,\beta) must be an edge in Γ\Gamma^{\prime}. Of course, it is not guaranteed that (γ,b,β)(\gamma,b,\beta) is such that (γ,b)(\gamma,b) is the least missing edge of any descendent of Γ\Gamma in the search multitree 𝕋\mathbb{T}. However by Lemma 3.19ii, if Γ=(V,E)\Gamma=(V,E), then βV\beta\in V and so Γ=(V,E{(γ,b,β)})\Gamma^{\prime}=(V,E\cup\{(\gamma,b,\beta)\}) is standard.

We now improve the refining function IsCompatibleR\texttt{IsCompatible}_{R} by adding the ability to define edges along paths that are one letter away from fully labelling a relation word in the manner described above. We denote this new refining function for 𝕏R\mathbb{X}_{R} by MakeCompatibleR\texttt{MakeCompatible}_{R} and define it in Algorithm 2.

Algorithm 2 - MakeCompatibleR\texttt{MakeCompatible}_{R}

Input: A standard word graph Γ=(V,E)𝕍\Gamma=(V,E)\in\mathbb{V} or Γ=\Gamma=\bot.
Output: A standard word graph ΓDesc(Γ)\Gamma^{\prime}\in\operatorname{Desc}(\Gamma) or \bot.

1:if Γ=\Gamma=\bot then
2:  return \bot
3:end if
4:E:=EE^{\prime}:=E
5:for αV\alpha\in V and (u,v)R(u,v)\in R do
6:  if u=u1au=u_{1}a, αu1=βV\alpha\cdot u_{1}=\beta\in V, βa=\beta\cdot a=\bot, and αv=γV\alpha\cdot v=\gamma\in V then
7:   EE{(β,a,γ)}E^{\prime}\leftarrow E^{\prime}\cup\{(\beta,a,\gamma)\}
8:  else if v=v1bv=v_{1}b, αv1=βV\alpha\cdot v_{1}=\beta\in V, βb=\beta\cdot b=\bot, and αu=γV\alpha\cdot u=\gamma\in V then
9:   EE{(β,b,γ)}E^{\prime}\leftarrow E^{\prime}\cup\{(\beta,b,\gamma)\}
10:  else if αuαv\alpha\cdot u\neq\alpha\cdot v then
11:   return \bot
12:  end if
13:end for
14:return Γ=(V,E)\Gamma^{\prime}=(V,E^{\prime})
Lemma 4.5.

MakeCompatibleR\texttt{MakeCompatible}_{R} is a refining function for 𝕏R\mathbb{X}_{R}.

Proof.

We verify the conditions in 4.1.

Clearly, MakeCompatibleR()=\texttt{MakeCompatible}_{R}(\bot)=\bot and so 4.1(i) holds. Let Γ=(V,E)𝕍\Gamma=(V,E)\in\mathbb{V}. If Γ\Gamma\neq\bot, then the execution of the algorithm constructs a sequence of word graphs Γ=Γ0,Γ1,,Γn=Γ\Gamma=\Gamma_{0},\Gamma_{1},\ldots,\Gamma_{n}=\Gamma^{\prime} such that Γi\Gamma_{i} is obtained from Γi1\Gamma_{i-1} by adding an edge in line 7 or line 9 of Algorithm 2, where Γ\Gamma^{\prime} is the final word graph constructed before returning in either line 11 or 14. In the final iteration of the for loop in line 5, Γ\Gamma^{\prime} is the output word graph, and so the conditions in lines 6 and 8 do not hold because no more edges are added to Γ\Gamma^{\prime}. The condition in line 10 will only hold if Γ\Gamma^{\prime} is not compatible with RR. Therefore MakeCompatibleR(Γ)=\texttt{MakeCompatible}_{R}(\Gamma)=\bot if and only if IsCompatibleR(Γ)=\texttt{IsCompatible}_{R}(\Gamma^{\prime})=\bot and MakeCompatibleR(Γ)=Γ\texttt{MakeCompatible}_{R}(\Gamma)=\Gamma^{\prime} otherwise. If Desc(Γ)𝕏R=Desc(Γ)𝕏R\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{R}=\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{X}_{R}, then 4.1(ii) and (iii) both hold since IsCompatibleR\texttt{IsCompatible}_{R} is a refining function for 𝕏R\mathbb{X}_{R}.

It suffices to establish that Desc(Γ)𝕏R=Desc(Γ)𝕏R\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{R}=\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{X}_{R} when n=1n=1. The claim can then be established for n>1n>1 by straightforward induction. We may also assume without loss of generality Γ\Gamma^{\prime} is obtained from Γ\Gamma in line 9 of Algorithm 2. The other case when an edge is added in line 7 of Algorithm 2 is dual.

If we add an edge to Γ\Gamma in line 9, then the condition in line 8 of Algorithm 2 holds. Therefore, there exist (u,v)R(u,v)\in R, v1Av_{1}\in A^{\ast}, bAb\in A, and α,β,γV\alpha,\beta,\gamma\in V such that the following hold: αv=\alpha\cdot v=\bot; αv1=γ\alpha\cdot v_{1}=\gamma for some γV\gamma\in V; αu=β\alpha\cdot u=\beta for some βV\beta\in V; and Γ=(V,E{(γ,b,β)})\Gamma^{\prime}=(V,E\cup\{(\gamma,b,\beta)\}).

We must show that Desc(Γ)𝕏R=Desc(Γ)𝕏R\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{R}=\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{X}_{R}. Since Γ\Gamma^{\prime} contains Γ\Gamma, it is clear that Desc(Γ)𝕏RDesc(Γ)𝕏R\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{R}\supseteq\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{X}_{R}.

Let Γ′′Desc(Γ)𝕏R\Gamma^{\prime\prime}\in\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{R}. It suffices to show that Γ′′Desc(Γ)\Gamma^{\prime\prime}\in\operatorname{Desc}(\Gamma^{\prime}). Since Γ′′\Gamma^{\prime\prime} is complete, there exists δV′′\delta\in V^{\prime\prime} such that (γ,b,δ)E′′(\gamma,b,\delta)\in E^{\prime\prime}. Since uu labels an (α,β)(\alpha,\beta)-path in Γ\Gamma, uu also labels such a path in Γ′′\Gamma^{\prime\prime}. Likewise, v1v_{1} labels an (α,γ)(\alpha,\gamma)-path in Γ′′\Gamma^{\prime\prime}. Hence v=v1bv=v_{1}b labels an (α,δ)(\alpha,\delta)-path in Γ′′\Gamma^{\prime\prime}. Since (u,v)R(u,v)\in R and Γ′′\Gamma^{\prime\prime} is compatible with RR, it follows that β=δ\beta=\delta and so (γ,b,β)E′′(\gamma,b,\beta)\in E^{\prime\prime}.

By the definition of Desc(Γ)\operatorname{Desc}(\Gamma) there exists a sequence of word graphs

Γ=Γ0,Γ1,,Γm=Γ′′\Gamma=\Gamma_{0},\Gamma_{1},\ldots,\Gamma_{m}=\Gamma^{\prime\prime}

and of edges e1=(α1,a1,β1),e2=(α2,a2,β2),,em=(αm,am,βm)e_{1}=(\alpha_{1},a_{1},\beta_{1}),e_{2}=(\alpha_{2},a_{2},\beta_{2}),\ldots,e_{m}=(\alpha_{m},a_{m},\beta_{m}) such that (αi,ai)(\alpha_{i},a_{i}) is the least missing edge of Γi1\Gamma_{i-1} and Γi=(V{β1,,βi},E{e1,,ei})\Gamma_{i}=(V\cup\{\beta_{1},\ldots,\beta_{i}\},E\cup\{e_{1},\ldots,e_{i}\}) for every i{1,,m}i\in\{1,\ldots,m\}.

If j{1,,m}j\in\{1,\ldots,m\} is such that ej=(αj,aj,βj)=(γ,b,β)e_{j}=(\alpha_{j},a_{j},\beta_{j})=(\gamma,b,\beta), then we consider the sequence of word graphs

Γ0\displaystyle\Gamma_{0}^{\prime} =(V{βj},E{ej})=Γ,\displaystyle=(V\cup\{\beta_{j}\},E\cup\{e_{j}\})=\Gamma^{\prime},
Γ1\displaystyle\Gamma_{1}^{\prime} =(V{βj,β1},E{ej,e1}),\displaystyle=(V\cup\{\beta_{j},\beta_{1}\},E\cup\{e_{j},e_{1}\}),
\displaystyle\vdots
Γj1\displaystyle\Gamma_{j-1}^{\prime} =(V{βj,β1,,βj1},E{ej,e1,,ej1})=Γj,\displaystyle=(V\cup\{\beta_{j},\beta_{1},\ldots,\beta_{j-1}\},E\cup\{e_{j},e_{1},\ldots,e_{j-1}\})=\Gamma_{j},

Suppose the least missing edge in Γ0=Γ\Gamma_{0}^{\prime}=\Gamma^{\prime} is (α1,a1)(\alpha^{\prime}_{1},a_{1}^{\prime}). Every missing edge of Γ0\Gamma_{0}^{\prime} is also a missing edge of Γ\Gamma, and so (α1,a1)(α1,a1)(\alpha^{\prime}_{1},a_{1}^{\prime})\geq(\alpha_{1},a_{1}), since (α1,a1)(\alpha_{1},a_{1}) is the least missing edge in Γ\Gamma. Since Γ\Gamma and Γ0\Gamma_{0}^{\prime} differ by the single edge eje_{j}, it follows that either j=1j=1 and (α1,a1)>(α1,a1)=ej(\alpha^{\prime}_{1},a_{1}^{\prime})>(\alpha_{1},a_{1})=e_{j}; or j>1j>1 and (α1,a1)=(α1,a1)(\alpha^{\prime}_{1},a_{1}^{\prime})=(\alpha_{1},a_{1}). Similarly, if i<ji<j, then by the same argument, the least missing edge in Γi\Gamma_{i}^{\prime} is (αi,ai)(\alpha_{i},a_{i}) for every ii. Therefore

Γ=Γ0,,Γj1=Γj,Γj+1,,Γm=Γ′′\Gamma^{\prime}=\Gamma_{0}^{\prime},\ldots,\Gamma_{j-1}^{\prime}=\Gamma_{j},\Gamma_{j+1},\ldots,\Gamma_{m}=\Gamma^{\prime\prime}

is a path in 𝕋\mathbb{T} and so Γ′′Desc(Γ)\Gamma^{\prime\prime}\in\operatorname{Desc}(\Gamma^{\prime}), as required. ∎

It is possible that MakeCompatibleR2(Γ)MakeCompatibleR(Γ)\texttt{MakeCompatible}_{R}^{2}(\Gamma)\neq\texttt{MakeCompatible}_{R}(\Gamma). To ensure that we add as many edges to Γ\Gamma as possible we could keep track of whether MakeCompatibleR\texttt{MakeCompatible}_{R} adds any edges to its input, and run Algorithm 2 again until no more edges are added. We denote this algorithm by MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R}; see Algorithm 3 for pseudocode.

Algorithm 3 - MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R}

Input: A word graph Γ=(V,E)𝕍\Gamma=(V,E)\in\mathbb{V} or Γ=\Gamma=\bot.
Output: A word graph or \bot.

1:if Γ=\Gamma=\bot then
2:  return \bot
3:end if
4:EdgesAdded:=True\texttt{EdgesAdded}:=\textrm{True}
5:while EdgesAdded do
6:  EdgesAddedFalse\texttt{EdgesAdded}\leftarrow\textrm{False}
7:  ΓMakeCompatibleR(Γ)\Gamma^{\prime}\leftarrow\texttt{MakeCompatible}_{R}(\Gamma)
8:  if Γ\Gamma\neq\bot and ΓΓ\Gamma^{\prime}\neq\Gamma then
9:   EdgesAddedTrue\texttt{EdgesAdded}\leftarrow\textrm{True}
10:  end if
11:  ΓΓ\Gamma\leftarrow\Gamma^{\prime}
12:end while
13:return Γ\Gamma

That MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R} is a refining function for 𝕏R\mathbb{X}_{R} follows by repeatedly applying 4.2(ii). Therefore both MakeCompatibleRAtMostn\texttt{MakeCompatible}_{R}\circ\texttt{AtMost}_{n} and MakeCompatibleRepeatedlyRAtMostn\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n} are refining functions for 𝕏R𝕏n\mathbb{X}_{R}\cap\mathbb{X}_{n}.

While MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R} is more computationally expensive than MakeCompatibleR\texttt{MakeCompatible}_{R}, every edge added to Γ\Gamma by MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R} reduces the number of nodes in 𝕋\mathbb{T} that must be traversed in BacktrackingSearch𝕏R(f,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{R}}(f,\Xi) where ff is MakeCompatibleRepeatedlyR\texttt{MakeCompatibleRepeatedly}_{R} by a factor of at least |V|+1|V|+1. This tradeoff seems quite useful in practice as can be seen in Appendix A.

Although in line 5 of MakeCompatibleR\texttt{MakeCompatible}_{R} we loop over all nodes α\alpha and all relations in RR, in practice this is not necessary. Clearly, if the word graph (V,E)(V,E) is compatible with RR, then we only need to follow those paths labelled by relations that include any new edges. A technique for doing just this is given in [13, Section 7.2], and it is this that is implemented in libsemigroups [53]. A comparison of the refining functions for 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R} presented in this section is given in Table 4.1

nn 1 2 3 4
AtMostn\texttt{AtMost}_{n} 6 165 15,989 3,556,169
IsCompatibleRAtMostn\texttt{IsCompatible}_{R}\circ\texttt{AtMost}_{n} 6 120 1,680 29,800
MakeCompatibleRAtMostn\texttt{MakeCompatible}_{R}\circ\texttt{AtMost}_{n} 6 75 723 6,403
MakeCompatibleRepeatedlyRAtMostn\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n} 6 75 695 6,145
Table 4.1: Number of word graphs visited by BacktrackingSearch𝕏n𝕏R(f,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}\cap\mathbb{X}_{R}}(f,\Xi) for the 33-generated plactic monoid where ff ranges over the refining functions of 𝕏n𝕏R\mathbb{X}_{n}\cap\mathbb{X}_{R} presented in Section 4.3.

5 Applications of Algorithm 1

In this section we describe a number of applications of the low-index right congruences algorithm. Recall that MM is a monoid defined by the presentation AR\langle A\mid R\rangle. Each application essentially consists of defining a refining function ff so that BacktrackingSearch𝕏R𝕏n(f,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{R}\cap\mathbb{X}_{n}}(f,\Xi) returns a particular subset of right congruences. In brief these subsets are:

  1. (a)

    left congruences;

  2. (b)

    2-sided congruences;

  3. (c)

    right congruences including, or excluding, a given subset of A×AA^{*}\times A^{*};

  4. (d)

    2-sided congruences ρ\rho such that the quotient M/ρM/\rho is a finite group;

  5. (e)

    non-trivial right Rees congruences when MM has decidable word problem; and

  6. (f)

    right congruences ρ\rho where the right action of MM on the nodes of the word graph of ρ\rho is faithful.

with index up to nn\in\mathbb{N}. A further application of (c) provides a practical algorithm for solving the word problem in finitely presented residually finite monoids; this is described in Section 5.4. Each application enumerated above is described in a separate subsection below.

A further application of the implementations of the algorithms described in this section is to reproduce, and extend, some of the results from [6].

5.1 Left congruences

In Sections 3 and 4, we only considered right congruences, and, in some sense, word graphs are inherently “right handed”. It is possible to state an analogue of 3.7 for left congruences, for which we require the following notation. If w=b0bm1Aw=b_{0}\cdots b_{m-1}\in A^{*}, then we write w~\tilde{w} to denote the reverse bm1b0b_{m-1}\cdots b_{0} of ww. If RA×AR\subseteq A^{*}\times A^{*} is arbitrary, then we denote by R~\tilde{R} the set of relations containing (u~,v~)(\tilde{u},\tilde{v}) for all (u,v)R(u,v)\in R.

An analogue of 3.1 holds for left actions. More specifically, if Ψ:M×VV\Psi:M\times V\longrightarrow V is a left action of a monoid MM on a set VV, and θ:AM\theta:A^{*}\longrightarrow M is as above, then the corresponding word graph is Γ=(V,E)\Gamma=(V,E) where (α,a,β)E(\alpha,a,\beta)\in E whenever ((a)θ,α)Ψ=β((a)\theta,\alpha)\Psi=\beta. Conversely, if Γ=(V,E)\Gamma=(V,E) is a word graph, then we define a left action Ψ:M×VV\Psi:M\times V\longrightarrow V by

((w)θ,α)Ψ=β((w)\theta,\alpha)\Psi=\beta

whenever w~\tilde{w} labels an (α,β)(\alpha,\beta)-path in Γ\Gamma.

Theorem 5.1.

Let MM be a monoid defined by a monoid presentation AR\langle A\mid R\rangle. Then there is a one-to-one correspondence between the left congruences of MM and the standard complete word graphs over AA compatible with R~\tilde{R}.

If ρ\rho is a left congruence on MM and Γ\Gamma is the corresponding word graph, then the left actions of MM on M/ρM/\rho (by left multiplication) and on Γ\Gamma are isomorphic; and ρ=({(u~,v~):(u,v)(0)πΓ})θ\rho=(\{(\tilde{u},\tilde{v}):(u,v)\in(0)\pi_{\Gamma}\})\theta where θ:AM\theta:A^{*}\longrightarrow M is the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#} and (0)πΓ(0)\pi_{\Gamma} is the path relation on Γ\Gamma.

It follows from 5.1 that the left congruences of a monoid can be enumerated using the same method for enumerating right congruences applied to R~\tilde{R}. Some care is required here, in particular, since the corresponding word graphs are associated to right congruences on the dual of the original monoid (defined by the presentation AR~\langle A\mid\tilde{R}\rangle), rather than to left congruences on MM.

5.2 2-sided congruences

The word graph corresponding to a 2-sided congruence ρ\rho of MM is just the right Cayley graph of M/ρM/\rho with respect to AA. Therefore characterizing 22-sided congruences is equivalent to characterizing Cayley graphs. The corresponding question for groups — given a word graph Γ=(V,E)\Gamma=(V,E), determine whether Γ\Gamma is the Cayley graph of a group — was investigated in [41, Theorem 8.14]. An important necessary condition, in our notation, is that (0)πΓ=(α)πΓ(0)\pi_{\Gamma}=(\alpha)\pi_{\Gamma} for all αV\alpha\in V. In some sense, this condition states that the automorphism group of Γ\Gamma is transitive. We will next show that the corresponding condition for monoids is that (0)πΓ(α)πΓ(0)\pi_{\Gamma}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V. This condition for monoids is, in the same sense as for groups, equivalent to the statement that for every node of the Cayley word graph there is an endomorphism mapping the identity to that node.

Lemma 5.2.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, and let ρ\rho be a right congruence on MM with word graph Γ=(V,E)\Gamma=(V,E). Then ρ\rho is a 2-sided congruence if and only if (0)πΓ(α)πΓ(0)\pi_{\Gamma}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V.

Proof.

For every αV\alpha\in V, we denote by wαw_{\alpha} the short-lex minimum word labelling any (0,α)(0,\alpha)-path in Γ\Gamma. We also denote by θ:AM\theta:A^{\ast}\longrightarrow M the unique surjective homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}. Recall that, since Γ\Gamma is compatible with RR, ker(θ)(0)πΓ\ker(\theta)\subseteq(0)\pi_{\Gamma} and so, by 3.10, (u,v)(0)πΓ(u,v)\in(0)\pi_{\Gamma} if and only if ((u)θ,(v)θ)((0)πΓ)θ((u)\theta,(v)\theta)\in((0)\pi_{\Gamma})\theta. Also, by 3.7, ((0)πΓ)θ=ρ((0)\pi_{\Gamma})\theta=\rho.

For the forward implication, suppose that ρ\rho is a 2-sided congruence and that (u,v)(0)πΓ(u,v)\in(0)\pi_{\Gamma}. Then ((u)θ,(v)θ)((0)πΓ)θ=ρ((u)\theta,(v)\theta)\in((0)\pi_{\Gamma})\theta=\rho. Since ρ\rho is a 2-sided congruence,

((wα)θ(u)θ,(wα)θ(v)θ)=((wαu)θ,(wαv)θ)ρ((w_{\alpha})\theta\cdot(u)\theta,(w_{\alpha})\theta\cdot(v)\theta)=((w_{\alpha}u)\theta,(w_{\alpha}v)\theta)\in\rho

for all αV\alpha\in V. In particular, again by 3.10, (wαu,wαv)(0)πΓ(w_{\alpha}u,w_{\alpha}v)\in(0)\pi_{\Gamma}. Thus 0wαu=0wα0\cdot w_{\alpha}u=0\cdot w_{\alpha}\neq\bot. Since 0wα=α0\cdot w_{\alpha}=\alpha, it follows that αu=αv\alpha\cdot u=\alpha\cdot v and so (u,v)(α)πΓ(u,v)\in(\alpha)\pi_{\Gamma} as required.

For the converse implication, assume that (0)πΓ(α)πΓ(0)\pi_{\Gamma}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V. This implies that Γ\Gamma is compatible with (0)πΓ(0)\pi_{\Gamma} and so (0)πΓ#(α)πΓ(0)\pi_{\Gamma}^{\#}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V. Therefore (0)πΓ=(0)πΓ#(0)\pi_{\Gamma}=(0)\pi_{\Gamma}^{\#} is a 2-sided congruence. Since Γ\Gamma is also compatible with RR, ker(θ)=R#(0)πΓ=(0)πΓ#\ker(\theta)=R^{\#}\subseteq(0)\pi_{\Gamma}=(0)\pi_{\Gamma}^{\#}. So applying Lemma 3.9ii yields:

ρ=(0)πΓθ=((0)πΓ#)θ=(((0)πΓ)θ)#=ρ#,\rho=(0)\pi_{\Gamma}\theta=\left((0)\pi_{\Gamma}^{\#}\right)\theta=\left(((0)\pi_{\Gamma})\theta\right)^{\#}=\rho^{\#},

and so ρ\rho is a 2-sided congruence. ∎

We can further refine Lemma 5.2 by using the generating pairs of Lemma 3.11 to yield a computationally testable condition as follows.

Theorem 5.3.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, and let ρ\rho be a right congruence on MM with word graph Γ=(V,E)\Gamma=(V,E). Then ρ\rho is a 2-sided congruence if and only if Γ\Gamma is compatible with {(wαa,wβ):(α,a,β)E}\left\{(w_{\alpha}a,w_{\beta}):(\alpha,a,\beta)\in E\right\} where wαAw_{\alpha}\in A^{*} is the short-lex minimum word labelling any (0,α)(0,\alpha)-path in Γ\Gamma.

Proof.

Let θ:AM\theta:A^{\ast}\longrightarrow M be the unique surjective homomorphism with ker(θ)=R#\ker(\theta)=R^{\#} and let XΓX_{\Gamma} denote the set

{(wαa,wβ):(α,a,β)E}.\left\{(w_{\alpha}a,w_{\beta}):(\alpha,a,\beta)\in E\right\}.

(\Rightarrow) If ρ\rho is a 2-sided congruence, then by Lemma 5.2, (0)πΓ(α)πΓ(0)\pi_{\Gamma}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V. The relation XΓX_{\Gamma} is contained in (0)πΓ(0)\pi_{\Gamma} by definition. Therefore XΓ(0)πΓ(α)πΓX_{\Gamma}\subseteq(0)\pi_{\Gamma}\subseteq(\alpha)\pi_{\Gamma} for all αV\alpha\in V. Hence Γ\Gamma is compatible with XΓX_{\Gamma} as required.

(\Leftarrow) Assume that Γ\Gamma is compatible with XΓX_{\Gamma}. Then XΓ#(0)πΓX_{\Gamma}^{\#}\subseteq(0)\pi_{\Gamma} and so (XΓ#)θ((0)πΓ)θ=ρ(X_{\Gamma}^{\#})\theta\subseteq((0)\pi_{\Gamma})\theta=\rho. Since ker(θ)=R#(0)πΓ\ker(\theta)=R^{\#}\subseteq(0)\pi_{\Gamma} and (0)πΓ(0)\pi_{\Gamma} is the least right congruence containing XΓX_{\Gamma}, it follows that ker(θ)XΓ#\ker(\theta)\subseteq X_{\Gamma}^{\#}. Hence (XΓ#)θ=((XΓ)θ)#(X_{\Gamma}^{\#})\theta=((X_{\Gamma})\theta)^{\#} by Lemma 3.9ii. Therefore ((XΓ)θ)#=(XΓ#)θρ((X_{\Gamma})\theta)^{\#}=(X_{\Gamma}^{\#})\theta\subseteq\rho. But ρ\rho is generated as a right congruence by (XΓ)θ(X_{\Gamma})\theta by Lemma 3.11 and so ((XΓ)θ)#ρ((XΓ)θ)#((X_{\Gamma})\theta)^{\#}\subseteq\rho\subseteq((X_{\Gamma})\theta)^{\#} giving equality throughout. In particular, ρ\rho is a 2-sided congruence, as required. ∎

In 5.3 we showed there is a bijection between the 2-sided congruences of the monoid MM defined by AR\langle A\mid R\rangle and the complete standard word graphs Γ\Gamma compatible with both RR and the set XΓ={(wαa,β):(α,a,β)E}X_{\Gamma}=\{(w_{\alpha}a,\beta):(\alpha,a,\beta)\in E\}. We denote by 𝕐R\mathbb{Y}_{R} the set of complete standard word graphs corresponding to 2-sided congruences of MM. Recall from 3.12 that we can compute XΓX_{\Gamma} from Γ=(V,E)\Gamma=(V,E) in O(|V|2|A|)O(|V|^{2}|A|) time. We can also verify that a given word graph is compatible with XΓX_{\Gamma} in O(m|V|)O(m\cdot|V|) where mm is the sum of the lengths of the words occurring in XΓX_{\Gamma}, using, for example, IsCompatibleXΓ\texttt{IsCompatible}_{X_{\Gamma}}.

We define the function TwoSidedMakeCompatibleRepeatedlyR:𝕍{}𝕍{}\texttt{TwoSidedMakeCompatibleRepeatedly}_{R}:\mathbb{V}\cup\{\bot\}\longrightarrow\mathbb{V}\cup\{\bot\} by

TwoSidedMakeCompatibleRepeatedly(Γ)={Γ=MakeCompatibleRepeatedlyXΓ(Γ)otherwise\texttt{TwoSidedMakeCompatibleRepeatedly}(\Gamma)=\begin{cases}\bot&\Gamma=\bot\\ \texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}}(\Gamma)&\text{otherwise}\end{cases}

for all Γ𝕍{}\Gamma\in\mathbb{V}\cup\{\bot\}.

Lemma 5.4.

TwoSidedMakeCompatibleRepeatedly is a refining function for 𝕐R\mathbb{Y}_{R}.

Proof.

On superficial inspection, it might seem that TwoSidedMakeCompatibleRepeatedly is a refining function because MakeCompatibleRepeatedlyXΓ\texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}} is a refining function. However, this does not follow immediately because the set XΓX_{\Gamma} is dependent on the input word graph Γ\Gamma.

Clearly, TwoSidedMakeCompatibleRepeatedly()=\texttt{TwoSidedMakeCompatibleRepeatedly}(\bot)=\bot so 4.1(i) holds.

If ΓΓ\Gamma\subseteq\Gamma^{\prime} are deterministic word graphs, then XΓXΓX_{\Gamma}\subseteq X_{\Gamma^{\prime}} and so 𝕏XΓ𝕏XΓ\mathbb{X}_{X_{\Gamma}}\supseteq\mathbb{X}_{X_{\Gamma^{\prime}}}. If additionally Γ𝕐R\Gamma^{\prime}\in\mathbb{Y}_{R}, then Γ𝕏XΓ𝕏XΓ\Gamma^{\prime}\in\mathbb{X}_{X_{\Gamma^{\prime}}}\subseteq\mathbb{X}_{X_{\Gamma}} by 5.3. Hence, Desc(Γ)𝕐RDesc(Γ)𝕏XΓ\operatorname{Desc}(\Gamma)\cap\mathbb{Y}_{R}\subseteq\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{X_{\Gamma}}. If MakeCompatibleRepeatedlyXΓ(Γ)=\texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}}(\Gamma)=\bot, then Desc(Γ)𝕏XΓ=\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{X_{\Gamma}}=\varnothing by 4.1(ii) applied to MakeCompatibleRepeatedlyXΓ\texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}}. Hence Desc(Γ)𝕐R=\operatorname{Desc}(\Gamma)\cap\mathbb{Y}_{R}=\varnothing also and so 4.1(ii) holds.

If MakeCompatibleRepeatedlyXΓ(Γ)=Γ\texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}}(\Gamma)=\Gamma^{\prime}\neq\bot, then Desc(Γ)𝕏XΓ=Desc(Γ)𝕏XΓ\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{X_{\Gamma}}=\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{X}_{X_{\Gamma}} by 4.1(iii) applied to MakeCompatibleRepeatedlyXΓ\texttt{MakeCompatibleRepeatedly}_{X_{\Gamma}}. Since Desc(Γ)Desc(Γ)\operatorname{Desc}(\Gamma^{\prime})\subseteq\operatorname{Desc}(\Gamma) and Desc(Γ)𝕐RDesc(Γ)𝕏XΓ\operatorname{Desc}(\Gamma)\cap\mathbb{Y}_{R}\subseteq\operatorname{Desc}(\Gamma)\cap\mathbb{X}_{X_{\Gamma}}, it follows that Desc(Γ)𝕐R=Desc(Γ)𝕐R\operatorname{Desc}(\Gamma)\cap\mathbb{Y}_{R}=\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{Y}_{R}, and so 4.1(iii) holds. ∎

It follows that BacktrackingSearch𝕐R𝕏n(f,Ξ)\texttt{BacktrackingSearch}_{\mathbb{Y}_{R}\cap\mathbb{X}_{n}}(f,\Xi) where ff is the refining function TwoSidedMakeCompatibleRepeatedlyMakeCompatibleRepeatedlyRAtMostn\texttt{TwoSidedMakeCompatibleRepeatedly}\circ\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n} returns 𝕐R𝕏n\mathbb{Y}_{R}\cap\mathbb{X}_{n} the set of word graphs of the 2-sided congruences of the monoid defined by AR\langle A\mid R\rangle with index at most nn. As a practical comparison, the number of word graphs visited by BacktrackingSearch𝕏n𝕐R(f,Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{n}\cap\mathbb{Y}_{R}}(f,\Xi) where n=6n=6 and f=MakeCompatibleRepeatedlyRAtMostnf=\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n} for the 33-generated plactic monoid is 662,550662,550. On the other hand, the number of word graphs visited when using the refining function f=TwoSidedMakeCompatibleRepeatedlyMakeCompatibleRepeatedlyRAtMostnf=\texttt{TwoSidedMakeCompatibleRepeatedly}\circ\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n} is only 37,95137,951.

As an example, in Table B.13 we compute the number of 2-sided congruences with index at most nn of the free monoid AA^{*} when nn and |A||A| are not too large. For example, we compute the number of 2-sided congruences of AA^{*} up to index 2222, 1414, 1010 and 99, when |A|=2,3,4|A|=2,3,4, and 55, respectively.

5.3 Congruences including or excluding a relation

Given two elements xx and yy of the monoid MM defined by the finite presentation AR\langle A\mid R\rangle, we might be interested in finding finite index right congruences containing (x,y)(x,y) or not containing (x,y)(x,y). Suppose that x,yMx,y\in M and u,vAu,v\in A^{\ast} are such that (u)θ=x,(v)θ=y(u)\theta=x,(v)\theta=y where θ:AM\theta:A^{*}\longrightarrow M is the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}. By 3.7, if ρ\rho is a right congruence of MM, then (x,y)ρ(x,y)\in\rho if and only if αu=aαv\alpha\cdot u=a\alpha\cdot v\neq\bot in the word graph Γ\Gamma of ρ\rho.

For u,vAu,v\in A^{*}, we denote by 𝕏(u,v)\mathbb{X}_{(u,v)} the set of complete standard word graphs such that 0u=0v0\cdot u=0\cdot v. Similarly, we denote by 𝕏(u,v)¯\mathbb{X}_{\overline{(u,v)}} the set of complete standard word graphs such that 0u0v0\cdot u\neq 0\cdot v.

We also define refining functions Include(u,v)\texttt{Include}_{(u,v)} and Exclude(u,v)\texttt{Exclude}_{(u,v)} by

Include(u,v)(Γ)\displaystyle\texttt{Include}_{(u,v)}(\Gamma) ={ if Γ= or 0u,0v and 0u0vΓ otherwise\displaystyle=\begin{cases}\bot&\textrm{ if }\Gamma=\bot\text{ or }0\cdot u\neq\bot,0\cdot v\neq\bot\text{ and }0\cdot u\neq 0\cdot v\\ \Gamma&\text{ otherwise}\end{cases}
Exclude(u,v)(Γ)\displaystyle\texttt{Exclude}_{(u,v)}(\Gamma) ={ if Γ= or 0u,0v and 0u=0vΓ otherwise\displaystyle=\begin{cases}\bot&\text{ if }\Gamma=\bot\text{ or }0\cdot u\neq\bot,0\cdot v\neq\bot\text{ and }0\cdot u=0\cdot v\\ \Gamma&\text{ otherwise}\end{cases}

It is routine to verify that Include(u,v)\texttt{Include}_{(u,v)} and Exclude(u,v)\texttt{Exclude}_{(u,v)} are refining functions for 𝕏(u,v)\mathbb{X}_{(u,v)} and 𝕏(u,v)¯\mathbb{X}_{\overline{(u,v)}}, respectively.

Composing these refining functions with AtMostn\texttt{AtMost}_{n} and any of the refining functions for one or 2-sided congruences from Section 4 and Section 5.2 allows us to find one or 2-sided congruences of AR\langle A\mid R\rangle with index at most nn that include or exclude a given relation.

5.4 McKinsey’s algorithm

A monoid MM is residually finite if for all s,tMs,t\in M with sts\neq t there exists a finite monoid MM^{\prime} and homomorphism ϕ:MM\phi:M\longrightarrow M^{\prime} such that (s)ϕ(t)ϕ(s)\phi\neq(t)\phi. In  [50], McKinsey gave an algorithm for deciding the word problem in finitely presented residually finite monoids. McKinsey’s Algorithm in [50] is, in fact, more general, and can be applied to residually finite universal algebras.

McKinsey’s algorithm relies on two semidecision procedures — one for testing equality in a finitely presented monoid and the other for testing inequality in a finitely generated residually finite monoid. It is well-known (and easy to show) that testing equality is semidecidable for every finitely presented monoid.

Suppose that MM is finitely presented by AR\langle A\mid R\rangle and that MM is residually finite. There are only finitely many finite monoids MM^{\prime} of every size, and only finitely many possible functions from AA to MM^{\prime}. If f:AMf:A\longrightarrow M^{\prime} is any such function, then it is possible to verify that ff extends to a homomorphism ϕ:MM\phi:M\longrightarrow M^{\prime} by checking that MM^{\prime} satisfies the (finite set of) relation RR. Clearly, if s,tMs,t\in M and (s)ϕ(t)ϕ(s)\phi\neq(t)\phi for some ϕ\phi, then, since ϕ\phi is a function, sts\neq t. It follows that it is theoretically possible to verify that sts\neq t by looping over the finite monoids MM^{\prime}, the functions f:AMf:A\longrightarrow M^{\prime}, and for every ff that extends to a homomorphism ϕ:MM\phi:M\longrightarrow M^{\prime}, testing whether (s)ϕ(t)ϕ(s)\phi\neq(t)\phi. Thus testing inequality in a finitely presented residually finite monoid MM is also semidecidable.

McKinsey’s algorithm proceeds by running semidecision algorithms for testing equality and inequality in parallel; this is guaranteed to terminate, and so the word problem for finitely presented residually finite monoids MM is decidable in theory. In practice, checking for equality in a finitely presented monoid MM with presentation AR\langle A\mid R\rangle can be done somewhat efficiently by performing a backtracking search in the space of all elementary sequences over RR. On the other hand, the semidecision procedure given above for checking inequality is extremely inefficient. For example, the number of monoids of size at most 1010 up to isomorphism and anti-isomorphism is 52,993,098,927,71252,993,098,927,712; see [17].

The low-index congruences algorithm provides a more efficient algorithm for deciding inequality in a finitely presented residually finite monoid by utilizing the Exclude(u,v)\texttt{Exclude}_{(u,v)} refining function for some u,vAu,v\in A^{*}. The set 𝕏(u,v)¯𝕐R,n\mathbb{X}_{\overline{(u,v)}}\cap\mathbb{Y}_{R,n} consists of exactly the 2-sided congruences on AR\langle A\mid R\rangle with index at most nn such that (u)θ(v)θ(u)\theta\neq(v)\theta (where θ:AM\theta:A^{*}\longrightarrow M is the natural homomorphism). Hence (u)θ(v)θ(u)\theta\neq(v)\theta in MM if and only if 𝕏(u,v)¯𝕐R,n{}\mathbb{X}_{\overline{(u,v)}}\cap\mathbb{Y}_{R,n}\neq\{\bot\} for some nn. Therefore BacktrackingSearch𝕏(u,v)¯𝕐R,n(Exclude(u,v),Ξ)\texttt{BacktrackingSearch}_{\mathbb{X}_{\overline{(u,v)}}\cap\mathbb{Y}_{R,n}}(\texttt{Exclude}_{(u,v)},\Xi) can be used to implement McKinsey’s algorithm with a higher degree of practicality.

5.5 Congruences defining groups

We say that a 2-sided congruence ρ\rho on MM is a group congruence if the quotient monoid M/ρM/\rho is a group. A 2-sided congruence ρ\rho is a group congruence if and only if for every xMx\in M there exists yMy\in M such that (xy,1M)ρ(xy,1_{M})\in\rho and (yx,1M)ρ(yx,1_{M})\in\rho where 1MM1_{M}\in M is the identity element. If MM is generated by AA, then ρ\rho is a group congruence if and only if for every xAx\in A there exists yMy\in M such that (xy,1M)ρ(xy,1_{M})\in\rho and (yx,1M)ρ(yx,1_{M})\in\rho. We say that a word graph Γ\Gamma is injective if for all βV\beta\in V and aAa\in A there is at most one edge in EE with target β\beta and label aa. This is the dual of the definition of determinism. We can decide if a finite word graph Γ\Gamma corresponds to a group congruence as follows.

Theorem 5.5.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, and let ρ\rho be a finite index 2-sided congruence on MM with word graph Γ=(V,E)\Gamma=(V,E). Then ρ\rho is a group congruence if and only if Γ\Gamma is injective.

Proof.

Let θ:AM\theta:A^{\ast}\longrightarrow M be the unique surjective homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}.

()(\Rightarrow) Let (β,a,α),(γ,a,α)E(\beta,a,\alpha),(\gamma,a,\alpha)\in E for some α,β,γV\alpha,\beta,\gamma\in V and aAa\in A. Since ρ\rho defines a group there exists yMy\in M such that ((a)θy,1M)ρ((a)\theta\cdot y,1_{M})\in\rho. Since ρ\rho is a 2-sided congruence, ((wβ)θ(a)θy,(wβ)θ)ρ((w_{\beta})\theta\cdot(a)\theta\cdot y,(w_{\beta})\theta)\in\rho and so ((wβa)θy,(wβ)θ)ρ((w_{\beta}a)\theta\cdot y,(w_{\beta})\theta)\in\rho and similarly ((wγa)θy,(wγ)θ)ρ((w_{\gamma}a)\theta\cdot y,(w_{\gamma})\theta)\in\rho. But wβaw_{\beta}a and wγaw_{\gamma}a both label (0,α)(0,\alpha)-paths in Γ\Gamma, and so ((wβa)θ,(wγa)θ)ρ((w_{\beta}a)\theta,(w_{\gamma}a)\theta)\in\rho. Hence by transitivity ((wβ)θ,(wγ)θ)ρ((w_{\beta})\theta,(w_{\gamma})\theta)\in\rho. Then, by 3.10 and 3.7, (wβ,wγ)(0)πΓ(w_{\beta},w_{\gamma})\in(0)\pi_{\Gamma} and so β=γ\beta=\gamma. We have shown that Γ\Gamma is injective.

()(\Leftarrow) Suppose that aAa\in A. Since the set {an:n0}\{a^{n}:n\in\mathbb{N}_{0}\} is infinite but Γ\Gamma has only finitely many nodes, it follows from the pigeonhole principle that there exists αV\alpha\in V and i,j0i,j\in\mathbb{N}_{0} with i<ji<j such that aia^{i} and aja^{j} both label (0,α)(0,\alpha)-paths in Γ\Gamma. Assume that ii is the least such value. If i>0i>0, then there exist β,γV\beta,\gamma\in V such that ai1a^{i-1} and aj1a^{j-1} label (0,β)(0,\beta)- and (0,γ)(0,\gamma)-paths respectively. It follows that (β,a,α),(γ,a,α)E(\beta,a,\alpha),(\gamma,a,\alpha)\in E and so by injectivity β=γ\beta=\gamma. In particular, ai1a^{i-1} and aj1a^{j-1} both label (0,β)(0,\beta)-paths, and this contradicts the minimality of ii.

Therefore i=0i=0 and so (ε,aj)(0)πΓ(\varepsilon,a^{j})\in(0)\pi_{\Gamma}. Hence, by 3.7, (1M,(a)θj)ρ(1_{M},(a)\theta^{j})\in\rho. In particular, if y=(a)θj1y=(a)\theta^{j-1}, then ((a)θy,1M),(y(a)θ,1M)ρ((a)\theta\cdot y,1_{M}),(y\cdot(a)\theta,1_{M})\in\rho. Since θ\theta is surjective, and aAa\in A was arbitrary, it follows that ρ\rho is a group congruence. ∎

It is possible to verify if a given word graph over AA is injective, or not. In particular, in the representation used in libsemigroups [53], this can be verified in time linear in |A||V||A||V|. Furthermore, if Γ\Gamma is not injective, then neither is any descendent of Γ\Gamma in the search multitree 𝕋\mathbb{T}. Hence the following function is a refining function for the set of all word graphs corresponding to group congruences:

IsInjective(Γ)={Γ if Γ is an injective word graph otherwise.\texttt{IsInjective}(\Gamma)=\begin{cases}\Gamma&\text{ if }\Gamma\text{ is an injective word graph}\\ \bot&\text{ otherwise.}\end{cases}

Composing IsInjective, AtMostn\texttt{AtMost}_{n}, and any of the refining functions for 𝕐R\mathbb{Y}_{R} of word graphs corresponding to 2-sided congruences of AR\langle A\mid R\rangle, this gives us a method for computing all group congruences with index at most nn of the monoid presented by AR\langle A\mid R\rangle.

5.6 Rees congruences

In this section we describe how to use the low-index right congruences algorithm to compute Rees congruences, i.e. those arising from ideals. A related algorithm for finding low-index Rees congruences is given in [39] and [40]. Like the low-index congruences algorithm, Jura’s Algorithm in [39] and [40] also uses some aspects of the Todd–Coxeter Algorithm. The algorithm presented in this section is distinct from Jura’s Algorithm. In general, the problem of computing the finite index ideals of a finitely presented monoid is undecidable; see [40] and [61, Theorem 5.5]. However, if the word problem happens to be decidable for a finitely presented monoid, then so too is the problem of computing the finite index ideals of that monoid.

Given a right ideal II of a monoid MM, the right Rees congruence of II is ρI={(x,y)M×M:x=y or x,yI}\rho_{I}=\{(x,y)\in M\times M:x=y\textrm{ or }x,y\in I\}. The trivial congruence ΔM\Delta_{M} is a right Rees congruence if and only if MM has a right zero; and the trivial congruence has finite index if and only if MM is finite. As such, we will restrict ourselves, in this section, to considering only non-trivial finite index right Rees congruence.

Let Γ=(V,E)\Gamma=(V,E) be a standard word graph of a right congruence of MM and let θ:AM\theta:A^{\ast}\longrightarrow M be the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}. We call a node ωV\omega\in V a sink if (ω,a,ω)E(\omega,a,\omega)\in E for all aAa\in A. We say that a sink ω\omega is non-trivial if there exists an edge (α,a,ω)E(\alpha,a,\omega)\in E such that (wαa)θ(wω)θ(w_{\alpha}a)\theta\neq(w_{\omega})\theta, where as usual wαAw_{\alpha}\in A^{*} is the short-lex least word labelling a (0,α)(0,\alpha)-path in Γ\Gamma.

If Γ\Gamma is compatible with the relations RR defining MM, ρ\rho is the right congruence of any complete standard word graph compatible with RR that contains Γ\Gamma, and αV\alpha\in V is a non-trivial sink, then the equivalence class of ρ\rho on MM corresponding to α\alpha contains at least 2 elements: (wαa)θ(w_{\alpha}a)\theta and (wω)θ(w_{\omega})\theta. In particular, ρ\rho is non-trivial, which explains why we called α\alpha a non-trivial sink.

We give a criterion for deciding if a complete standard word graph corresponds to a non-trivial right Rees congruence in the next theorem.

Theorem 5.6.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, let ρ\rho be a right congruence on MM with word graph Γ=(V,E)\Gamma=(V,E), and let θ:AM\theta:A^{\ast}\longrightarrow M be the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}. Then ρ\rho is a non-trivial right Rees congruence if and only if the following conditions hold:

  1. (i)

    there exists a unique non-trivial sink ωV\omega\in V;

  2. (ii)

    if (α,a,β)E(\alpha,a,\beta)\in E and βω\beta\neq\omega, then (wαa)θ=(wβ)θ(w_{\alpha}a)\theta=(w_{\beta})\theta.

Proof.

(\Rightarrow) Let II be a right ideal of MM such that 1<|I|1<|I| and IMI\neq M, and let ρ=ρI\rho=\rho_{I} be the corresponding non-trivial right Rees congruence with complete standard word graph Γ=(V,E)\Gamma=(V,E). If uAu\in A^{\ast} is such that (u)θI(u)\theta\in I, then since Γ\Gamma is complete, 0u=ω0\cdot u=\omega for some ωV\omega\in V.

If (v)θI(v)\theta\in I for some vAv\in A^{\ast}, then ((u)θ,(v)θ)ρ((u)\theta,(v)\theta)\in\rho since ρ\rho is a right Rees congruence. By 3.10, it follows that (u,v)(0)πΓ(u,v)\in(0)\pi_{\Gamma}, and so 0v=ω0\cdot v=\omega also. Conversely, if (u,v)(0)πΓ(u,v)\in(0)\pi_{\Gamma}, then ((u)θ,(v)θ)ρ((u)\theta,(v)\theta)\in\rho and hence (v)θI(v)\theta\in I. Hence wAw\in A^{\ast} labels a (0,ω)(0,\omega)-path in Γ\Gamma if and only if (w)θI(w)\theta\in I.

In particular (wω)θI(w_{\omega})\theta\in I and if aAa\in A is arbitrary, then (wω)θ(a)θ=(wωa)θI(w_{\omega})\theta\cdot(a)\theta=(w_{\omega}a)\theta\in I, and so wωaw_{\omega}a also labels a (0,ω)(0,\omega)-path in Γ\Gamma. It follows that (ω,a,ω)E(\omega,a,\omega)\in E for all aAa\in A and ω\omega is a sink. To show that (i) holds, it remains to show that ω\omega is non-trivial and unique.

To show that ω\omega is non-trivial, consider the set

W={wA:(w)θI and (w)θ(wω)θ}.W=\{\>w\in A^{*}\>:\>(w)\theta\in I\text{ and }(w)\theta\neq(w_{\omega})\theta\>\}.

Since |I|>1|I|>1 and θ\theta is surjective, this set is non-empty. We set vv to be the short-lex least word in WW. Since 0v=0wω=ω0\cdot v=0\cdot w_{\omega}=\omega, and wωw_{\omega} is the short-lex least such word, and vwωv\neq w_{\omega}, it follows that v>wωεv>w_{\omega}\geq\varepsilon. Hence v=v1av=v_{1}a for some v1Av_{1}\in A^{\ast} and some aAa\in A. If v1v_{1} labels a (0,α)(0,\alpha)-path in Γ\Gamma for some αV\alpha\in V, then (α,a,ω)E(\alpha,a,\omega)\in E and so it suffices to show that (wαa)θ(wω)θ(w_{\alpha}a)\theta\neq(w_{\omega})\theta. If (v1)θ=(wα)θ(v_{1})\theta=(w_{\alpha})\theta, then (wαa)θ=(v1a)θ=(v)θ(w_{\alpha}a)\theta=(v_{1}a)\theta=(v)\theta. Since vWv\in W, it would follow that (wαa)θ=(v)θ(wω)θ(w_{\alpha}a)\theta=(v)\theta\not=(w_{\omega})\theta and ω\omega is non-trivial. Hence it suffices to show that (v1)θ=(wα)θ(v_{1})\theta=(w_{\alpha})\theta.

If αω\alpha\neq\omega, then 0wαω0\cdot w_{\alpha}\neq\omega, and so (wα)θI(w_{\alpha})\theta\not\in I. But (wα,v1)(0)πΓ(w_{\alpha},v_{1})\in(0)\pi_{\Gamma} implies that ((wα)θ,(v1)θ)ρ((w_{\alpha})\theta,(v_{1})\theta)\in\rho and so (wα)θ=(v1)θ(w_{\alpha})\theta=(v_{1})\theta since ρ\rho is a Rees congruence, as required. If α=ω\alpha=\omega, then 0v1=ω0\cdot v_{1}=\omega and so (v1)θI(v_{1})\theta\in I. Since v1<vv_{1}<v and vv is the least element of WW, it follows that v1Wv_{1}\not\in W and so (v1)θ=(wω)θ=(wα)θ(v_{1})\theta=(w_{\omega})\theta=(w_{\alpha})\theta, as required. We have shown that ω\omega is non-trivial.

To establish the uniqueness of ω\omega, let ωV\omega^{\prime}\in V be a non-trivial sink. By the definition of non-trivial sinks, there exists (α,a,ω)E(\alpha,a,\omega^{\prime})\in E such that (wαa)θ(wω)θ(w_{\alpha}a)\theta\neq(w_{\omega^{\prime}})\theta. Since 0wαa=0wω=ω0\cdot w_{\alpha}a=0\cdot w_{\omega^{\prime}}=\omega^{\prime}, it follows that ((wαa)θ,(wω)θ)ρ((w_{\alpha}a)\theta,(w_{\omega^{\prime}})\theta)\in\rho. If (wω)θI(w_{\omega^{\prime}})\theta\not\in I or (wαa)θI(w_{\alpha}a)\theta\not\in I, then, since ρ\rho is a Rees congruence, (wαa)θ=(wω)(w_{\alpha}a)\theta=(w_{\omega^{\prime}}), which is a contradiction. Hence wωθIw_{\omega^{\prime}}\theta\in I and so ω=ω\omega=\omega^{\prime}.

To show that (ii) holds, let (α,a,β)E(\alpha,a,\beta)\in E and βω\beta\neq\omega. It follows that neither 0wαa,0wβω0\cdot w_{\alpha}a,0\cdot w_{\beta}\neq\omega, and so (wαa)θ,(wβ)θI(w_{\alpha}a)\theta,(w_{\beta})\theta\not\in I. On the other hand (wαa,wβ)(0)πΓ(w_{\alpha}a,w_{\beta})\in(0)\pi_{\Gamma} implies ((wαa)θ,(wβ)θ)ρ((w_{\alpha}a)\theta,(w_{\beta})\theta)\in\rho and so (wαa)θ=(wβ)θ(w_{\alpha}a)\theta=(w_{\beta})\theta again since ρ\rho is a right Rees congruence.

(\Leftarrow) Let ω\omega be the unique node satisfying condition (i) and let

I={(u)θM:uA, 0u=ω}.I=\{(u)\theta\in M\ :\ u\in A^{*},\ 0\cdot u=\omega\}.

If ω=0\omega=0, then I=MI=M, and ρI=M×M\rho_{I}=M\times M is a non-trivial Rees congruence. Hence we may suppose that ω0\omega\neq 0.

By assumption (ω,a,ω)E(\omega,a,\omega)\in E for all aAa\in A and so (ε,v)(ω)πΓ(\varepsilon,v)\in(\omega)\pi_{\Gamma} for all vAv\in A^{\ast}. Hence if uAu\in A^{*} labels a (0,ω)(0,\omega)-path in Γ\Gamma, then so does uvuv for all vAv\in A^{\ast} and so (uv)θ=(u)θ(v)θI(uv)\theta=(u)\theta\cdot(v)\theta\in I for all (u)ϕI(u)\phi\in I and vAv\in A^{\ast}. Since θ\theta is surjective, this implies that II is a right ideal of MM. It suffices by 3.7 to show that ρI=((0)πΓ)θ\rho_{I}=((0)\pi_{\Gamma})\theta.

Suppose that (x,y)ρI(x,y)\in\rho_{I}. If x,yIx,y\in I, then there exist u,vAu,v\in A^{\ast} such that x=(u)θx=(u)\theta and y=(v)θy=(v)\theta. Hence by the definition of II, both uu and vv label (0,ω)(0,\omega)-paths in Γ\Gamma. This implies (u,v)(0)πΓ(u,v)\in(0)\pi_{\Gamma} and so (x,y)((0)πΓ)θ(x,y)\in((0)\pi_{\Gamma})\theta. Otherwise, if x=yx=y, then (x,y)((0)ϕΓ)θ(x,y)\in((0)\phi_{\Gamma})\theta by reflexivity since ((0)πΓ)θ((0)\pi_{\Gamma})\theta is a right congruence. Hence ρI((0)πΓ)θ\rho_{I}\subseteq((0)\pi_{\Gamma})\theta.

For the converse, suppose that ((u)θ,(v)θ)(0)πΓθ((u)\theta,(v)\theta)\in(0)\pi_{\Gamma}\theta for some u,vAu,v\in A^{*} such that (u)θ,(v)θI(u)\theta,(v)\theta\not\in I. We proceed by induction on max{|u|,|v|}\max\{|u|,|v|\}. If max{|u|,|v|}=0\max\{|u|,|v|\}=0, then u=v=εu=v=\varepsilon and so ((u)θ,(v)θ)ρI((u)\theta,(v)\theta)\in\rho_{I} by reflexivity.

Suppose that for some n1n\geq 1 and for all u,vAu,v\in A^{*} with |u|,|v|<n|u|,|v|<n, ((u)θ,(v)θ)(0)πΓθ((u)\theta,(v)\theta)\in(0)\pi_{\Gamma}\theta implies ((u)θ,(v)θ)ρI((u)\theta,(v)\theta)\in\rho_{I}. Let u,vAu,v\in A^{*} be such that max{|u|,|v|}=n>0\max\{|u|,|v|\}=n>0 and ((u)θ,(v)θ)(0)πΓθ((u)\theta,(v)\theta)\in(0)\pi_{\Gamma}\theta. Without loss of generality there are two cases to consider: when v=εv=\varepsilon; and when uεu\neq\varepsilon and vεv\neq\varepsilon.

If v=εv=\varepsilon, then uεu\neq\varepsilon by assumption. Hence we can write u=u1au=u_{1}a for some u1Au_{1}\in A^{*} and aAa\in A. If 0u1=αV0\cdot u_{1}=\alpha\in V, then (u1,wα)(0)πΓ(u_{1},w_{\alpha})\in(0)\pi_{\Gamma} and so |u1||wα||u_{1}|\geq|w_{\alpha}|. In particular, |u1|,|wα||u1|<|u|=n|u_{1}|,|w_{\alpha}|\leq|u_{1}|<|u|=n and so by induction ((u1)θ,(wα)θ)ρI((u_{1})\theta,(w_{\alpha})\theta)\in\rho_{I}. Thus ((u)θ,(wαa)θ)ρI((u)\theta,(w_{\alpha}a)\theta)\in\rho_{I}. Since (α,a,0)E(\alpha,a,0)\in E and 0ω0\neq\omega, it follows by (ii) that ((wαa)θ,(w0)θ)=((wαa)θ,(ε)θ)ρ((w_{\alpha}a)\theta,(w_{0})\theta)=((w_{\alpha}a)\theta,(\varepsilon)\theta)\in\rho. Hence ((u)θ,(v)θ)=((u)θ,(ε)θ)ρI((u)\theta,(v)\theta)=((u)\theta,(\varepsilon)\theta)\in\rho_{I} by transitivity.

If uεu\neq\varepsilon and vεv\neq\varepsilon, then we can write u=u1au=u_{1}a and v=v1bv=v_{1}b for some u1,v1Au_{1},v_{1}\in A^{*} and a,bAa,b\in A. If 0u1=α0\cdot u_{1}=\alpha and 0v1=β0\cdot v_{1}=\beta, then (u1,wα),(v1,wβ)(0)πΓ(u_{1},w_{\alpha}),(v_{1},w_{\beta})\in(0)\pi_{\Gamma}. Since u1wαu_{1}\geq w_{\alpha}, it follows that |u1|,|wα|<|u|n|u_{1}|,|w_{\alpha}|<|u|\leq n. Similarly |v1|,|wβ|<|v|n|v_{1}|,|w_{\beta}|<|v|\leq n. Hence, by induction, ((u1)θ,(wα)θ),((v1)θ,(wβ)θ)ρI((u_{1})\theta,(w_{\alpha})\theta),((v_{1})\theta,(w_{\beta})\theta)\in\rho_{I} and so ((u)θ,(wαa)θ),((v)θ,(wβb)θ)ρI((u)\theta,(w_{\alpha}a)\theta),((v)\theta,(w_{\beta}b)\theta)\in\rho_{I}. If 0u=γ=0v0\cdot u=\gamma=0\cdot v, then by (ii) applied to (α,a,γ),(β,b,γ)E(\alpha,a,\gamma),(\beta,b,\gamma)\in E, it follows that (wαa)θ=(wγ)θ=(wβb)θ(w_{\alpha}a)\theta=(w_{\gamma})\theta=(w_{\beta}b)\theta. Thus, by transitivity, ((u)θ,(v)θ)ρI((u)\theta,(v)\theta)\in\rho_{I}, and the proof is complete. ∎

Unlike in the previous subsections, the conditions of 5.6 can only be tested if a method for solving the word problem in the monoid AR\langle A\mid R\rangle is known. Given an algorithm for solving the word problem, the non-triviality of a sink in 5.6(i) and the condition (wαa)θ=(wβ)θ(w_{\alpha}a)\theta=(w_{\beta})\theta in 5.6(ii) can both be verified computationally.

Let R\mathbb{Z}_{R} be the set of all standard complete word graphs corresponding to non-trivial right Rees congruences on the monoid presented by AR\langle A\mid R\rangle. The function IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} is defined in Algorithm 4. We will show that the function IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R}, is a refining function for R\mathbb{Z}_{R} in Lemma 5.7.

Algorithm 4 - IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R}

Input: A word graph Γ=(V,E)𝕍\Gamma=(V,E)\in\mathbb{V} or Γ=\Gamma=\bot.
Output: A word graph or \bot.

1:if Γ=\Gamma=\bot then
2:  return \bot
3:end if
4:ω:=\omega:=\bot
5:for (α,a,β)E(\alpha,a,\beta)\in E do
6:  if (wαa)θ(wβ)θ(w_{\alpha}a)\theta\neq(w_{\beta})\theta then [Since β\beta violates condition (ii) of 5.6, it must be the case that β=ω\beta=\omega]
7:   if ω=\omega=\bot then
8:     ωβ\omega\leftarrow\beta
9:   else if ωβ\omega\neq\beta then
10:     return \bot [Multiple possibilities for ω\omega detected, contradicting uniqueness]
11:   end if
12:  end if
13:end for
14:E:=EE^{\prime}:=E
15:if ω\omega\neq\bot then
16:  for aAa\in A do
17:   if ωa=\omega\cdot a=\bot then
18:     EE{(ω,a,ω)}E^{\prime}\leftarrow E^{\prime}\cup\{(\omega,a,\omega)\}
19:   else if ωaω\omega\cdot a\neq\omega then
20:     return \bot [ω\omega is not a sink, so cannot satisfy condition (i) of 5.6]
21:   end if
22:  end for
23:end if
24:return Γ=(V,E)\Gamma^{\prime}=(V,E^{\prime})
Lemma 5.7.

IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} is a refining function for R\mathbb{Z}_{R}.

Proof.

We verify 4.1. Clearly, IsRightReesCongruenceR()=\texttt{IsRightReesCongruence}_{R}(\bot)=\bot and so 4.1(i) holds.

Suppose that Γ\Gamma\neq\bot and IsRightReesCongruenceR(Γ)=\texttt{IsRightReesCongruence}_{R}(\Gamma)=\bot. Then IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} returns in line 10 or line 20 of Algorithm 4. If IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} returns \bot in line 10, then there exist (α,a,β),(α,a,β)E(\alpha,a,\beta),(\alpha^{\prime},a^{\prime},\beta^{\prime})\in E such that (wαa)θ(wβ)θ(w_{\alpha}a)\theta\neq(w_{\beta})\theta and (wαa)θ(wβ)θ(w_{\alpha^{\prime}}a^{\prime})\theta\neq(w_{\beta})\theta. If any descendent of Γ\Gamma has a unique non-trivial sink ω\omega, then ωβ\omega\neq\beta or ωβ\omega\neq\beta^{\prime}. In particular, 5.6(ii) does not hold, and so Desc(Γ)R=\operatorname{Desc}(\Gamma)\cap\mathbb{Z}_{R}=\varnothing, and so 4.1(ii) holds.

If IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} returns \bot in line 20, then there exists a unique ωV\omega\in V and (α,a,ω)E(\alpha,a,\omega)\in E such that (wαa)θ(wω)θ(w_{\alpha}a)\theta\neq(w_{\omega})\theta. The node ω\omega is the unique node with this property for every descendent of Γ\Gamma also. But, by the condition of line 19, ω\omega is not a sink in Γ\Gamma, and hence no descendent of Γ\Gamma contains a unique non-trivial sink. In other words, Desc(Γ)R=\operatorname{Desc}(\Gamma)\cap\mathbb{Z}_{R}=\varnothing, and so 4.1(ii) holds.

Finally assume that IsRightReesCongruenceR\texttt{IsRightReesCongruence}_{R} returns Γ=(V,E)\Gamma^{\prime}=(V,E^{\prime}) in line 24 of Algorithm 4. We must show that Desc(Γ)R=Desc(Γ)R\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{Z}_{R}=\operatorname{Desc}(\Gamma)\cap\mathbb{Z}_{R}. Since ΓDesc(Γ)\Gamma^{\prime}\in\operatorname{Desc}(\Gamma), certainly Desc(Γ)RDesc(Γ)R\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{Z}_{R}\subseteq\operatorname{Desc}(\Gamma)\cap\mathbb{Z}_{R}. Suppose that Γ′′Desc(Γ)R\Gamma^{\prime\prime}\in\operatorname{Desc}(\Gamma)\cap\mathbb{Z}_{R}. The if statement in line 15 implies that ω\omega has been assigned a value in Γ\Gamma and therefore it is the unique non-trivial sink of every descendent of Γ\Gamma in R\mathbb{Z}_{R} including Γ′′\Gamma^{\prime\prime}. Since edges are only added to EE^{\prime} in line 18, it follows that Γ′′Desc(Γ)R\Gamma^{\prime\prime}\in\operatorname{Desc}(\Gamma^{\prime})\cap\mathbb{Z}_{R} and so 4.1(iii) holds. ∎

It follows from Lemma 5.7 that BacktrackingSearchR𝕏n(f,Ξ)=R𝕏n\texttt{BacktrackingSearch}_{\mathbb{Z}_{R}\cap\mathbb{X}_{n}}(f,\Xi)=\mathbb{Z}_{R}\cap\mathbb{X}_{n} where ff is IsRightReesCongruenceRMakeCompatibleRepeatedlyRAtMostn\texttt{IsRightReesCongruence}_{R}\circ\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n}.

If II is a right ideal of MM, then the Rees congruence ρI\rho_{I} is a 2-sided congruence if and only if II is a 2-sided ideal of MM. Hence R𝕐R\mathbb{Z}_{R}\cap\mathbb{Y}_{R} is the set of all standard complete word graphs corresponding to Rees congruences by 2-sided ideals. Combining the criteria of 5.6 and 5.3 we can computationally check if a word graph belongs to R𝕐R\mathbb{Z}_{R}\cap\mathbb{Y}_{R}. Therefore BacktrackingSearchR𝕐R𝕏n(f,Ξ)=R𝕐R𝕏n\texttt{BacktrackingSearch}_{\mathbb{Z}_{R}\cap\mathbb{Y}_{R}\cap\mathbb{X}_{n}}(f,\Xi)=\mathbb{Z}_{R}\cap\mathbb{Y}_{R}\cap\mathbb{X}_{n} where ff is IsRightReesCongruenceRTwoSidedMakeCompatibleRepeatedlyMakeCompatibleRepeatedlyRAtMostn\texttt{IsRightReesCongruence}_{R}\circ\texttt{TwoSidedMakeCompatibleRepeatedly}\circ\texttt{MakeCompatibleRepeatedly}_{R}\circ\texttt{AtMost}_{n}.

5.7 Congruences representing faithful actions

If Ψ:X×MX\Psi:X\times M\longrightarrow X is a (right) monoid action, then every sMs\in M induces a transformation Ψs:XX\Psi_{s}:X\longrightarrow X defined by x(x,s)Ψx\mapsto(x,s)\Psi. We say that Ψ\Psi is faithful if Ψs=Ψt\Psi_{s}=\Psi_{t} implies that s=ts=t for all s,tMs,t\in M. Of course, if Ψ\Psi is a faithful right action of M=AM=\langle\>A\>\rangle, then MM and ΨaaA\langle\>\Psi_{a}\mid a\in A\>\rangle are isomorphic monoids. Several recent papers have studied transformation representations of various classes of semigroups and monoids; see [3][10][11], and [49] and the references therein. The implementations of the algorithms in this paper were crucial in [11] and can be used to verify, in finitely many cases, some of the results in [49].

Recall that to every complete deterministic word graph Γ=(V,E)\Gamma=(V,E) compatible with RR we associate the right action Ψ:V×MV\Psi:V\times M\longrightarrow V given by (α,(w)θ)Ψ=αw(\alpha,(w)\theta)\Psi=\alpha\cdot w for all αV,wA\alpha\in V,w\in A^{\ast}, where θ:AM\theta:A^{\ast}\longrightarrow M is the unique homomorphism with ker(θ)=R#\ker(\theta)=R^{\#}.

We require the following theorem.

Theorem 5.8 (cf. Proposition 1.2 in [71] or Chapter I, Proposition 5.24 in [42]).

Let MM be a monoid and let ρ\rho be a right congruence on MM. Then the action of MM on M/ρM/\rho by right multiplication is faithful if and only if the only 2-sided congruence contained in ρ\rho is trivial.

A 2-sided congruence ρ\rho on a monoid MM is principal if there exists (s,t)M×M(s,t)\in M\times M such that sts\neq t and ρ\rho is the least 2-sided congruence containing (s,t)(s,t), i.e. ρ={(s,t)}#\rho=\{(s,t)\}^{\#}. We also refer to the pair (s,t)(s,t) in the preceding sentence as the generating pair of the principal congruence ρ\rho. Note that if ρ\rho is a principal 2-sided congruence, then ρΔM\rho\neq\Delta_{M} by definition.

Clearly, every non-trivial 2-sided congruence contains a principal 2-sided congruence. If ρ\rho is a right congruence not containing any principal 2-sided congruences, then ρ\rho contains no non-trivial 2-sided congruences. Hence, by 5.8, MM acts faithfully on M/ρM/\rho by right multiplication. This argument establishes one implication of the next theorem.

Theorem 5.9.

Let MM be the monoid defined by the monoid presentation AR\langle A\mid R\rangle, let θ:AM\theta:A^{*}\longrightarrow M be the natural surjective homomorphism, let ρ\rho be a right congruence on MM, let Γ=(V,E)\Gamma=(V,E) be the word graph of ρ\rho, and let Ψ:V×MV\Psi:V\times M\longrightarrow V be the associated right action. If PA×AP\subseteq A^{*}\times A^{*} is such that (P)θ(P)\theta contains a generating pair for every principal 2-sided congruence of MM, then Ψ\Psi is faithful if and only if for all (u,v)P(u,v)\in P there exists some αV\alpha\in V with αuαv\alpha\cdot u\neq\alpha\cdot v.

Proof.

(\Leftarrow) If (u,v)P(u,v)\in P is arbitrary, then by assumption there exists some αV\alpha\in V such that αuαv\alpha\cdot u\neq\alpha\cdot v. If {(u)θ,(v)θ)}#ρ\{(u)\theta,(v)\theta)\}^{\#}\subseteq\rho, then ((wαu)θ,(wαv)θ)ρ((w_{\alpha}u)\theta,(w_{\alpha}v)\theta)\in\rho and by 3.10 we have that (wαu,wαv)(0)πΓ(w_{\alpha}u,w_{\alpha}v)\in(0)\pi_{\Gamma}. But then αu=0wαu=0wαv=αv\alpha\cdot u=0\cdot w_{\alpha}u=0\cdot w_{\alpha}v=\alpha\cdot v, a contradiction. Hence ρ\rho contains no principal 2-sided congruences, and this implication follows by the argument before the theorem.

(\Rightarrow) We prove the contrapositive. Assume that there exists (u,v)P(u,v)\in P such that αu=αv\alpha\cdot u=\alpha\cdot v for all αV\alpha\in V. Then by definition (α,(u)θ)Ψ=(α,(v)θ)Ψ(\alpha,(u)\theta)\Psi=(\alpha,(v)\theta)\Psi for all αV\alpha\in V. In other words, Ψ(u)θ=Ψ(v)θ\Psi_{(u)\theta}=\Psi_{(v)\theta}, and since (u)θ(v)θ(u)\theta\neq(v)\theta, Ψ\Psi is not faithful. ∎

The condition of 5.9 can only be tested if it is possible to compute PP. On the other hand, only finite monoids can have a faithful action on a finite set. Therefore it is only meaningful to look for faithful finite index congruences of finite monoids, in which case if the set PP can be computed, then the condition of 5.9 can be tested. In practice there are two ways of computing a set PP of generating pairs for the principal congruences of MM. The first is computational (such as the approach described in Section 7); the second is mathematical: if a description of the lattice of congruences of a particular monoid MM is known (such as those given in [22]), then we can obtain a set PP from this description directly.

Let IsFaithfulRightCongruenceP:𝕍{}𝕍{}\texttt{IsFaithfulRightCongruence}_{P}:\mathbb{V}\cup\{\bot\}\rightarrow\mathbb{V}\cup\{\bot\} be given by

IsFaithfulRightCongruenceP(Γ)={if Γ=if Γ=(V,E) and there exists (u,v)P such that αu=αv for all αVΓotherwise\texttt{IsFaithfulRightCongruence}_{P}(\Gamma)=\begin{cases}\bot&\text{if }\Gamma=\bot\\ \bot&\text{if }\Gamma=(V,E)\text{ and there exists }(u,v)\in P\\ &\text{ such that }\alpha\cdot u=\alpha\cdot v\neq\bot\text{ for all }\alpha\in V\\ \Gamma&\text{otherwise}\end{cases}

where PP is a set of generating pairs for the principal congruences of MM. That IsFaithfulRightCongruenceP\texttt{IsFaithfulRightCongruence}_{P} is a refining function for the set of standard word graphs corresponding to faithful right congruences can be easily verified.

The primary application of faithful right congruences is in finding small transformation representations of finite monoids. Of course, every such monoid MM has a transformation representation of degree |M||M|; we refer to this as the right regular representation of MM. However, computing this representation requires computing the action of MM on itself by right multiplication, which requires all of the elements of MM to be stored in memory. This is only feasible when |M||M| is relatively small; see [22, Section 1] for a more detailed discussion. If a presentation for MM is known, then iterating through the faithful right congruences of index at most |M||M| using BacktrackingSearch we can find the smallest transformation representation arising from a right congruence. This is often quite slow in practice especially when |M||M| is large. This method can be improved by modifying BacktrackingSearch to return the first faithful right congruence with index at most |M||M|. If a faithful right congruence of index nn is known, then we call BacktrackingSearch to find the first faithful right congruence with index at most n1n-1. If no such faithful right congruence exists, then nn is the minimum index of any faithful right congruence on MM. Otherwise, if a faithful right congruence with index m<nm<n is found, then we repeat this process. This is implemented in libsemigroups [53], and has been successfully employed to find transformation representations of relatively small degree for several classes of monoids where the best previous known bounds were |M||M|; see [11] for more details.

We provide two examples where the algorithm presented in this section returns minimal transformation representations.

Example 5.10.

Let SσS_{\sigma} be the Rees matrix semigroup over the symmetric group of degree 44 with matrix:

[σididid],\begin{bmatrix}\sigma&\mbox{\rm id}\\ \mbox{\rm id}&\mbox{\rm id}\end{bmatrix},

where id is the identity permutation, and σ{(1 2),(1 2 3),(1 2 3 4)}\sigma\in\{(1\ 2),(1\ 2\ 3),(1\ 2\ 3\ 4)\}. Then the minimum degree transformation representation of S(1 2)S_{(1\ 2)}, S(1 2 3)S_{(1\ 2\ 3)}, and S(1 2 3 4)S_{(1\ 2\ 3\ 4)} found by the algorithm described in this section are 66, 77, and 88. This agrees with the minimum degree transformation representation from [49, Theorem 2.19].

Example 5.11.

The opposite SopS^{op} of a semigroup SS has multiplication * defined by

xy=yxx*y=yx

where the multiplication on the right hand side of the equality is the multiplication in SS. It is shown in [49, Theorem 2.2] that the minimum degree transformation of the opposite TnopT_{n}^{op} of the full transformation monoids TnT_{n} of degree nn is 2n2^{n}; and this agrees with the output of the algorithm in this section.

As expected, the algorithm in this section does not always return the minimum degree transformation representation, since such a representation does not always correspond to an action on the classes of a right congruence; see, for example, Fig. 3.1 and [10, Table 3.1 and Theorem 3.9].

In [63], the minimal degree partial permutation representation of an arbitrary inverse semigroup SS is given in terms of the minimal degrees of certain subgroups of SS. This is implemented in the Semigroups [54] package for GAP [29]. In the example of the dual symmetric inverse monoid InI_{n}^{*}, the output of the algorithm described in this section as an application of the low-index congruences algorithm when n6n\leq 6 agrees with the theoretical minimum found in [48] of 2n12^{n}-1, and with the output of Schein’s algorithm from [63].

Of course, as a consequence of 3.1 and 3.7, not every faithful action arises from a faithful right congruence. However, since 3.1 does give a bijection between word graphs and right actions, it may be possible to extend the backtracking search over standard word graphs given in this paper to cover a wider class of word graphs, and adapt the criterion given in 5.6 to word graphs representing faithful actions in general. This would give an algorithm for finding minimal transformation representations of finite monoids.

6 Meets and joins for congruences represented by word graphs

Although AllRightCongruences can be used to find all of the 1-sided congruences of a monoid, to compute the lattice of such congruences we require a mechanism for computing joins or meets of congruences represented by word graphs. In this section we will show that the Hopcroft-Karp Algorithm [34], for checking whether two finite state automata recognise the same language, can be used to determine the join of two congruences represented by word graphs. We will also show that the standard construction of an automaton recognising the union of two regular languages can be used to compute the meet of two congruences represented by word graphs.

6.1 The Hopcroft-Karp Algorithm for joins

In this section we present Algorithm 5 which can be used to compute the join of two congruences represented by word graphs. This is a slightly modified version of the Hopcroft-Karp Algorithm for checking whether two finite state automata recognise the same language. The key difference between Algorithm 5 and the Hopcroft-Karp Algorithm is that the inputs are word graphs rather than automata. As mentioned in the introduction a word graph is essentially an automaton without initial or accept states. The initial states of the automata that form the input to the Hopcroft-Karp Algorithm are only used at the beginning of the algorithm (when the pair consisting of the start states of the two automata are pushed into the stack). In our context, the node 0 will play the role of the start state. Similarly the accept states are only used at the last step of the algorithm. As such the only difference between the Hopcroft-Karp Algorithm described in [34] (and [56]) and the version here are: the inputs, the values used to initialise the stack, and the return value. The time complexity of JoinWordGraphs is O(|A|n)O(|A|n) where n=max{|V0|,|V1|}n=\max\{|V_{0}|,|V_{1}|\}.

Algorithm 5 makes use of the well-known disjoint sets data structure (originating in [27], see also [14, Chapter 21]) which provides an efficient representation of a partition of V0V1V_{0}\sqcup V_{1}. We identify the disjoint sets data structure for a partition κ\kappa of V0V1V_{0}\sqcup V_{1} and the partition itself. If κ\kappa denotes a disjoint sets data structure, then we require the following related functions:

Union(κ,α,β)(\kappa,\alpha,\beta):

unites the parts of the partition κ\kappa containing α,βV0V1\alpha,\beta\in V_{0}\sqcup V_{1};

Find(κ,α)(\kappa,\alpha):

returns a canonical representative of the part of the partition κ\kappa containing α\alpha.

Note that α,βV0V1\alpha,\beta\in V_{0}\sqcup V_{1} belong to the same part of the partition represented by our disjoint sets data structure if and only if Find(α)=Find(β)\texttt{Find}(\alpha)=\texttt{Find}(\beta). If κ\kappa is an equivalence relation on the nodes of a word graph Γ=(V,E)\Gamma=(V,E), then we define the quotient Γ/κ\Gamma/\kappa of Γ\Gamma by κ\kappa to be the word graph (after an appropriate relabelling) with nodes {α/κ:αV}\{\>\alpha/\kappa\>:\>\alpha\in V\>\} and edges {(α/κ,a,β/κ):(α,a,β)E}\{\>(\alpha/\kappa,a,\beta/\kappa)\>:\>(\alpha,a,\beta)\in E\>\}. Note that Γ/κ\Gamma/\kappa is not necessarily deterministic.

Algorithm 5 - JoinWordGraphs

Input: Word graph Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) representing right congruences ρ0\rho_{0} and ρ1\rho_{1} of the monoid MM.
Output: The word graph of the join ρ0ρ1\rho_{0}\vee\rho_{1} of ρ0\rho_{0} and ρ1\rho_{1}.

1:Let κ\kappa be the disjoint sets data structure for ΔV0V1={(α,α):αV0V1}\Delta_{V_{0}\sqcup V_{1}}=\{\>(\alpha,\alpha)\>:\>\alpha\in V_{0}\sqcup V_{1}\>\}
2:Push (0Γ0,0Γ1)(0_{\Gamma_{0}},0_{\Gamma_{1}}) onto the stack SS
3:Union(κ,0Γ0,0Γ1)(\kappa,0_{\Gamma_{0}},0_{\Gamma_{1}})
4:while SS\neq\varnothing do
5:  Pop (α0,α1)V0×V1(\alpha_{0},\alpha_{1})\in V_{0}\times V_{1} from the stack
6:  for aAa\in A do
7:   Let α0V0\alpha_{0}^{\prime}\in V_{0} and α1V1\alpha_{1}^{\prime}\in V_{1} be such that (α0,a,α0)E0(\alpha_{0},a,\alpha_{0}^{\prime})\in E_{0} and (α1,a,α1)E1(\alpha_{1},a,\alpha_{1}^{\prime})\in E_{1}.
8:   Let γ0=Find(κ,α0)\gamma_{0}=\texttt{Find}(\kappa,\alpha_{0}^{\prime}) and γ1=Find(κ,α1)\gamma_{1}=\texttt{Find}(\kappa,\alpha_{1}^{\prime})
9:   if γ0γ1\gamma_{0}\neq\gamma_{1} then
10:     Push (γ0,γ1)(\gamma_{0},\gamma_{1}) onto the stack SS
11:     Union(κ,γ0,γ1)(\kappa,\gamma_{0},\gamma_{1})
12:   end if
13:  end for
14:end while
15:return (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa.

In order to prove the correctness of JoinWordGraphs we need the following definition. An equivalence relation κ\kappa over V0V0V_{0}\sqcup V_{0} is called right invariant if for all aAa\in A, (α,β)κ(\alpha,\beta)\in\kappa implies (α,β)κ(\alpha^{\prime},\beta^{\prime})\in\kappa, where αV0\alpha^{\prime}\in V_{0} and βV1\beta^{\prime}\in V_{1} are such that (α,a,α)E0(\alpha,a,\alpha^{\prime})\in E_{0} and (β,a,β)E1(\beta,a,\beta^{\prime})\in E_{1}. The following result is Lemma 1 in [34].

Lemma 6.1.

Let κ\kappa be the equivalence relation on V0V1V_{0}\sqcup V_{1} in line 15 of JoinWordGraphs. Then κ\kappa is the least right invariant equivalence relation on V0V1V_{0}\sqcup V_{1} containing (0Γ0,0Γ1)(0_{\Gamma_{0}},0_{\Gamma_{1}}).

The next result relates right invariant equivalences on a word graph to its deterministic quotients.

Lemma 6.2.

If Γ=(V,E)\Gamma=(V,E) is a complete word graph and κ\kappa is an equivalence relation on VV, then Γ/κ\Gamma/\kappa is deterministic if and only if κ\kappa is right invariant.

Proof.

(\Rightarrow) Suppose that κ\kappa is an equivalence relation on VV such that Γ/κ\Gamma/\kappa is deterministic. Suppose that aAa\in A and that α,βV\alpha,\beta\in V are arbitrary. We will prove that (α,β)κ(\alpha,\beta)\in\kappa implies that (α,β)κ(\alpha^{\prime},\beta^{\prime})\in\kappa where (α,a,α),(β,a,β)E(\alpha,a,\alpha^{\prime}),(\beta,a,\beta^{\prime})\in E are the unique edges labelled by aa with sources α\alpha and β\beta.

Assume that α,βV\alpha,\beta\in V are such that (α,β)κ(\alpha,\beta)\in\kappa. By the definition, (α/κ,a,α/κ)(\alpha/\kappa,a,\alpha^{\prime}/\kappa) and (β/κ,a,β/κ)(\beta/\kappa,a,\beta^{\prime}/\kappa) are edges in Γ/κ\Gamma/\kappa. Since Γ/κ\Gamma/\kappa is deterministic and α/κ=β/κ\alpha/\kappa=\beta/\kappa, it follows that α/κ=β/κ\alpha^{\prime}/\kappa=\beta^{\prime}/\kappa and so (α,β)κ(\alpha^{\prime},\beta^{\prime})\in\kappa, as required.

(\Leftarrow) Conversely, let κ\kappa be a right invariant equivalence relation on VV. The word graph Γ/κ\Gamma/\kappa is complete by definition. If (α0/κ,a,β0/κ)(\alpha_{0}/\kappa,a,\beta_{0}/\kappa) and (α1/κ,a,β1/κ)(\alpha_{1}/\kappa,a,\beta_{1}/\kappa) are edges in Γ/κ\Gamma/\kappa such that (α0,α1)κ(\alpha_{0},\alpha_{1})\in\kappa, then, since κ\kappa is right invariant (β0,β1)κ(\beta_{0},\beta_{1})\in\kappa. It follows that Γ/κ\Gamma/\kappa is deterministic. ∎

We can now show that the quotient word graph returned by JoinWordGraphs represents the join of the congruences represented by the input word graphs.

Proposition 6.3.

The word graph (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa returned by JoinWordGraphs in Algorithm 5 is the graph of the join ρ0ρ1\rho_{0}\vee\rho_{1} of congruences ρ0\rho_{0} and ρ1\rho_{1} represented by Γ0\Gamma_{0} and Γ1\Gamma_{1} respectively.

Proof.

Let Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}). We start by showing that if κ\kappa is a right invariant equivalence relation on V0V1V_{0}\sqcup V_{1} containing (0Γ0,0Γ1)(0_{\Gamma_{0}},0_{\Gamma_{1}}), then the quotient graph (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa represents a right congruence τ\tau of MM containing both ρ0\rho_{0} and ρ1\rho_{1}. To show that (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa represents a right congruence of the monoid MM defined by the presentation AR\langle A\mid R\rangle it suffices by 3.7 to show that (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is complete, deterministic, compatible with RR, and every node is reachable from 0Γ0/κ0_{\Gamma_{0}}/\kappa.

Since Γ0\Gamma_{0} and Γ1\Gamma_{1} are complete graphs, any quotient of Γ0Γ1\Gamma_{0}\sqcup\Gamma_{1} is also complete. By Lemma 6.2, (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is deterministic. Since both Γ0\Gamma_{0} and Γ1\Gamma_{1} are compatible with RR, it follows that Γ0Γ1\Gamma_{0}\sqcup\Gamma_{1} is also compatible with RR. Suppose that ϕ:Γ0Γ1(Γ0Γ1)/κ\phi:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is the natural word graph homomorphism with ker(ϕ)=κ\ker(\phi)=\kappa. Then, since word graph homomorphisms preserve paths, it follows that imϕ=(Γ0Γ1)/κ\operatorname{im}\phi=(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is compatible with RR too. By assumption, every node in V0V_{0} is reachable from 0Γ00_{\Gamma_{0}} and every node in V1V_{1} is reachable from 0Γ10_{\Gamma_{1}} in Γ0Γ1{\Gamma_{0}\sqcup\Gamma_{1}}, and (0Γ1,0Γ2)κ(0_{\Gamma_{1}},0_{\Gamma_{2}})\in\kappa. Thus every node in (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is reachable from 0Γ1/κ0_{\Gamma_{1}}/\kappa. It follows that (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa represents a right congruence τ\tau on MM. Again, since the homomorphism ϕ:Γ0Γ1(Γ0Γ1)/κ\phi:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow(\Gamma_{0}\sqcup\Gamma_{1})/\kappa preserves paths, and by 3.7, the path relations ρ0=(0Γ0)πΓ0\rho_{0}=(0_{\Gamma_{0}})\pi_{\Gamma_{0}} and ρ1=(0Γ1)πΓ1\rho_{1}=(0_{\Gamma_{1}})\pi_{\Gamma_{1}} on Γ0\Gamma_{0} and Γ1\Gamma_{1}, respectively, are contained in the path relation τ=(0Γ0/κ)π(Γ0Γ1)/κ\tau=(0_{\Gamma_{0}}/\kappa)\pi_{(\Gamma_{0}\sqcup\Gamma_{1})/\kappa}.

Suppose that Γ2\Gamma_{2} is the word graph of ρ0ρ1\rho_{0}\vee\rho_{1}. Then, since ρ0ρ0ρ1\rho_{0}\subseteq\rho_{0}\vee\rho_{1} and ρ1ρ0ρ1\rho_{1}\subseteq\rho_{0}\vee\rho_{1}, by Lemma 3.15, there exist unique word graph homomorphisms θ0:Γ0Γ2\theta_{0}:\Gamma_{0}\longrightarrow\Gamma_{2}, and θ1:Γ1Γ2\theta_{1}:\Gamma_{1}\longrightarrow\Gamma_{2} such that (0Γ0)θ0=(0Γ1)θ1=0Γ2(0_{\Gamma_{0}})\theta_{0}=(0_{\Gamma_{1}})\theta_{1}=0_{\Gamma_{2}}. Clearly, θ01:Γ0Γ1Γ2\theta_{01}:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow\Gamma_{2} defined by (αΓi)θ01=(αΓi)θi(\alpha_{\Gamma_{i}})\theta_{01}=(\alpha_{\Gamma_{i}})\theta_{i} for i{0,1}i\in\{0,1\} is a word graph homomorphism where (0Γ0)θ01=(0Γ1)θ01=0Γ2(0_{\Gamma_{0}})\theta_{01}=(0_{\Gamma_{1}})\theta_{01}=0_{\Gamma_{2}}, and this homomorphism is unique by 3.14. Since ρ0τ\rho_{0}\subseteq\tau and ρ1τ\rho_{1}\subseteq\tau, and τ\tau is a right congruence, it follows that ρ0ρ1τ\rho_{0}\vee\rho_{1}\subseteq\tau. Hence, again by Lemma 3.15, there exist a unique word graph homomorphism θ2:Γ2(Γ0Γ1)/κ\theta_{2}:\Gamma_{2}\longrightarrow(\Gamma_{0}\sqcup\Gamma_{1})/\kappa such that (0Γ2)θ2=0Γ0/κ(0_{\Gamma_{2}})\theta_{2}=0_{\Gamma_{0}}/\kappa; see Fig. 6.1. We will show that θ01=ϕ\theta_{01}=\phi.

Γ0Γ1{\Gamma_{0}\sqcup\Gamma_{1}}(Γ0Γ1)/κ{(\Gamma_{0}\sqcup\Gamma_{1})/\kappa}Γ2{\Gamma_{2}}ϕ\scriptstyle{\phi}θ01\scriptstyle{\theta_{01}}θ2\scriptstyle{\theta_{2}}
Figure 6.1: The commutative diagram from the proof of 6.3.

Since the composition of word graph homomorphisms is a word graph homomorphism, it follows that θ01θ2:Γ0Γ1(Γ0Γ1)/κ\theta_{01}\circ\theta_{2}:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is a word graph homomorphism and

(0Γ0)θ01θ2=(0Γ1)θ01θ2=(0Γ2)θ2=0Γ0/κ.(0_{\Gamma_{0}})\theta_{01}\theta_{2}=(0_{\Gamma_{1}})\theta_{01}\theta_{2}=(0_{\Gamma_{2}})\theta_{2}=0_{\Gamma_{0}}/\kappa.

But ϕ:Γ0Γ1(Γ0Γ1)/κ\phi:\Gamma_{0}\sqcup\Gamma_{1}\longrightarrow(\Gamma_{0}\sqcup\Gamma_{1})/\kappa is also a word graph homomorphism with (0Γ0)ϕ=(0Γ1)ϕ=0Γ0/κ(0_{\Gamma_{0}})\phi=(0_{\Gamma_{1}})\phi=0_{\Gamma_{0}}/\kappa, and so ϕ=θ01θ2\phi=\theta_{01}\circ\theta_{2} by 3.14. In particular, ker(θ01)ker(ϕ)=κ\ker(\theta_{01})\subseteq\ker(\phi)=\kappa. Since Γ2=(Γ0Γ1)/ker(θ01)\Gamma_{2}=(\Gamma_{0}\sqcup\Gamma_{1})/\ker(\theta_{01}) is a word graph representing a right congruence, it is deterministic. Hence, by Lemma 6.2, it follows that ker(θ01)\ker(\theta_{01}) is right invariant. Also (0Γ0)θ01=(0Γ1)θ01(0_{\Gamma_{0}})\theta_{01}=(0_{\Gamma_{1}})\theta_{01} implies that (0Γ0,0Γ1)ker(θ01)(0_{\Gamma_{0}},0_{\Gamma_{1}})\in\ker(\theta_{01}). But κ\kappa is the least right invariant equivalence relation on V0V1V_{0}\sqcup V_{1} containing (0Γ0,0Γ1)(0_{\Gamma_{0}},0_{\Gamma_{1}}), by Lemma 6.1, and so ker(θ01)=ker(ϕ)=κ\ker(\theta_{01})=\ker(\phi)=\kappa. It follows that Γ2\Gamma_{2} and (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa coincide, and so (Γ0Γ1)/κ(\Gamma_{0}\sqcup\Gamma_{1})/\kappa represents ρ0ρ1\rho_{0}\vee\rho_{1}, as required. ∎

6.2 Automata intersection for meets

In this section we present a slightly modified version of a standard algorithm from automata theory for finding an automaton recognising the intersection of two regular languages. As in the previous section the key difference is that we use word graphs rather than automata.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are word graphs over the same alphabet AA, then we define a word graph Γ2=(V2,E2)\Gamma_{2}=(V_{2},E_{2}) where V2V_{2} is the largest subset of V0×V1V_{0}\times V_{1} such that every node in V2V_{2} is reachable from (0,0)(0,0) in Γ2\Gamma_{2} and ((α0,α1),a,(β0,β1))E2((\alpha_{0},\alpha_{1}),a,(\beta_{0},\beta_{1}))\in E_{2} if and only if (α0,a,β0)E0(\alpha_{0},a,\beta_{0})\in E_{0} and (α1,a,β1)E1(\alpha_{1},a,\beta_{1})\in E_{1}; we will refer to Γ2\Gamma_{2} as the meet word graph of Γ0\Gamma_{0} and Γ1\Gamma_{1}. This is directly analogous to the corresponding construction for automata; for more details see the comments following the proof of Theorem 1.25 in [68].

Proposition 6.4.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are word graphs representing congruences of the monoid MM defined by the presentation AR\langle A\mid R\rangle, then the meet word graph Γ2\Gamma_{2} of Γ0\Gamma_{0} and Γ1\Gamma_{1} is a complete deterministic word graph which is compatible with RR and each node of Γ2\Gamma_{2} is reachable from (0,0)(0,0).

Proof.

The word graph Γ2\Gamma_{2} is complete and deterministic since Γ0\Gamma_{0} and Γ1\Gamma_{1} are, and Γ2\Gamma_{2} was constructed so that every node is reachable from (0,0)(0,0).

It remains to prove that Γ2\Gamma_{2} is compatible with the set of relations RR. If wAw\in A^{*}, then, since Γ0\Gamma_{0} and Γ1\Gamma_{1} are complete, then for i{0,1}i\in\{0,1\} and each node α\alpha in Γi\Gamma_{i}, there is a unique path in Γi\Gamma_{i} labeled by ww with source α\alpha. If wAw\in A^{*} labels a (α0,β0)(\alpha_{0},\beta_{0})-path in Γ0\Gamma_{0} and an (α1,β1)(\alpha_{1},\beta_{1})-path in Γ1\Gamma_{1}, then ww labels a ((α0,α1),(β0,β1))((\alpha_{0},\alpha_{1}),(\beta_{0},\beta_{1}))-path in Γ2\Gamma_{2}. Since Γ0\Gamma_{0} is compatible with RR, for every (u,v)R(u,v)\in R and for every α0V0\alpha_{0}\in V_{0} there exists a β0V0\beta_{0}\in V_{0} such that both uu and vv label (α0,β0)(\alpha_{0},\beta_{0})-paths in Γ0\Gamma_{0}. Similarly, for every α1V1\alpha_{1}\in V_{1} there is β1V1\beta_{1}\in V_{1} such that uu and vv both label (α1,β1)(\alpha_{1},\beta_{1})-paths in Γ1\Gamma_{1}. Hence for every (u,v)R(u,v)\in R and every (α0,α1)V2(\alpha_{0},\alpha_{1})\in V_{2} there exists (β0,β1)V2(\beta_{0},\beta_{1})\in V_{2} such that both uu and vv label ((α0,α1),(β0,β1))((\alpha_{0},\alpha_{1}),(\beta_{0},\beta_{1}))-paths in Γ2\Gamma_{2}, and so Γ2\Gamma_{2} is compatible with RR also. ∎

Corollary 6.5.

If Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) are word graphs representing congruences ρ0\rho_{0} and ρ1\rho_{1}, respectively, of the monoid MM defined by the presentation AR\langle A\mid R\rangle, then the meet word graph Γ2\Gamma_{2} of Γ0\Gamma_{0} and Γ1\Gamma_{1} represents the meet ρ0ρ1\rho_{0}\wedge\rho_{1} of ρ0\rho_{0} and ρ1\rho_{1}.

Proof.

By 6.4, Γ2\Gamma_{2} represents a right congruence τ\tau on MM. If (α,β)V2(\alpha,\beta)\in V_{2}, then by the comments after [68, Theorem 1.25] a word wAw\in A^{*} labels a ((0,0),(α,β))((0,0),(\alpha,\beta))-path in Γ2\Gamma_{2} if and only if ww labels a (0,α)(0,\alpha)-path in Γ0\Gamma_{0} and a (0,β)(0,\beta)-path in Γ1\Gamma_{1}. In other words, if πΓi\pi_{\Gamma_{i}} denotes the path relation on Γi\Gamma_{i} for i{0,1,2}i\in\{0,1,2\} and u,vAu,v\in A^{*} are arbitrary, then (u,v)(0)πΓ2(u,v)\in(0)\pi_{\Gamma_{2}} if and only if (u,v)(0)πΓ0(0)πΓ1(u,v)\in(0)\pi_{\Gamma_{0}}\cap(0)\pi_{\Gamma_{1}} if and only if (u/R#,v/R#)ρ0ρ1(u/R^{\#},v/R^{\#})\in\rho_{0}\wedge\rho_{1}, as required. ∎

The algorithm MeetWordGraphs in Algorithm 6 can be used to construct the meet word graph Γ2\Gamma_{2} from the input word graphs Γ0\Gamma_{0} and Γ1\Gamma_{1}. Algorithm 6 starts by constructing a graph with nodes that have the form (α,β,γ)(\alpha,\beta,\gamma) for α,β,γ\alpha,\beta,\gamma\in\mathbb{N}. These nodes get relabeled at the last step of the procedure and a standard word graph is returned by MeetWordGraphs. The triples (α,β,γ)(\alpha,\beta,\gamma) belonging to VV in MeetWordGraphs, then the first component corresponds to a node in Γ0\Gamma_{0}, the second component to a node in Γ1\Gamma_{1}, and the third component labels the corresponding node in the meet word graph returned by Algorithm 6.

Algorithm 6 - MeetWordGraphs

Input: Word graphs Γ0=(V0,E0)\Gamma_{0}=(V_{0},E_{0}) and Γ1=(V1,E1)\Gamma_{1}=(V_{1},E_{1}) corresponding to the right congruences ρ0\rho_{0} and ρ1\rho_{1} of the monoid MM.
Output: The word graph of the meet ρ0ρ1\rho_{0}\wedge\rho_{1} of ρ0\rho_{0} and ρ1\rho_{1}

1:V={(0,0,0)},E=,n=0V=\{(0,0,0)\},E=\varnothing,n=0
2:for (α0,α1,β)V(\alpha_{0},\alpha_{1},\beta)\in V do
3:  for aAa\in A do
4:   Let α0V0,α1V1\alpha_{0}^{\prime}\in V_{0},\alpha_{1}^{\prime}\in V_{1} be such that (α0,a,α0)E0(\alpha_{0},a,\alpha_{0}^{\prime})\in E_{0} and (α1,a,α1)E1(\alpha_{1},a,\alpha_{1}^{\prime})\in E_{1}
5:   if there exists β\beta^{\prime} such that (α0,α1,β)V(\alpha_{0}^{\prime},\alpha_{1}^{\prime},\beta^{\prime})\in V then
6:     EE((α0,α1,β),a,(α0,α1,β))E\leftarrow E\cup((\alpha_{0},\alpha_{1},\beta),a,(\alpha_{0}^{\prime},\alpha_{1}^{\prime},\beta^{\prime}))
7:   else
8:     nn+1n\leftarrow n+1
9:     VV(α0,α1,n)V\leftarrow V\cup(\alpha_{0}^{\prime},\alpha_{1}^{\prime},n)
10:     EE((α0,α1,β),a,(α0,α1,n))E\leftarrow E\cup((\alpha_{0},\alpha_{1},\beta),a,(\alpha_{0}^{\prime},\alpha_{1}^{\prime},n))
11:   end if
12:  end for
13:end for
14:Relabel every (α0,α1,β)V(\alpha_{0},\alpha_{1},\beta)\in V to β\beta
15:return (V,E)(V,E)

In comparison to the procedure for the construction of the intersection automaton in [68, Theorem 1.25], MeetWordGraphs includes a few extra steps so that the output word graph is standard.

Proposition 6.6.

The output of MeetWordGraphs in Algorithm 6 is a complete deterministic standard word graph which is compatible with RR and each node of this word graph is reachable from 0.

Proof.

Let Γ2\Gamma_{2} denote the word graph obtained in Algorithm 6 before the relabelling of the nodes in line 14. It is clear that this word graph is isomorphic to the meet word graph of Γ0\Gamma_{0} and Γ1\Gamma_{1} and hence it follows by 6.4 that it is complete, deterministic, compatible with RR and each node in Γ2\Gamma_{2} is reachable from 0. For every node (α,β,γ)(\alpha,\beta,\gamma) the edge leaving (α,β,γ)(\alpha,\beta,\gamma) labelled by aa is defined before the edge labelled by bb whenever a<ba<b. In addition, all edges with source (α0,β0,γ)(\alpha_{0},\beta_{0},\gamma) have been defined before any edge with source (α1,β1,γ+1)(\alpha_{1},\beta_{1},\gamma+1) is defined. It follows that the output word graph after the relabelling in line 14 is standard. ∎

7 Algorithm 2: principal congruences and joins

In the preceding sections we described algorithms that permit the computation of the lattice of right or left congruences of a finitely presented semigroup or monoid. In this section we consider an alternative method for computing the lattice of 1-sided or 2-sided congruences of a finite monoid.

If MM is a finite monoid, then the basic outline of the method considered in this section is: to compute the set of all principal congruences of MM; and then compute all possible joins of the principal congruences. This approach has been considered by several authors; particularly relevant here are [4, 25, 70]. To compute the set of all principal congruences of a monoid MM, it suffices to compute the principal congruence generated by (x,y)(x,y) for every (x,y)M×M(x,y)\in M\times M, and to find those pairs generating distinct congruences. This requires the computation of O(|M|2)O(|M|^{2}) principal congruences. In this part of the paper, we describe a technique based on [22] for reducing the number of pairs (x,y)M×M(x,y)\in M\times M that must be considered. More specifically, we perform a preprocessing step where some pairs that generate the same congruence are eliminated. The time taken by this preprocessing step is often insignificant when compared to the total time required to compute the lattice, as mentioned above, in many cases results in a significant reduction in the number of principal congruences that must be computed, and in the overall time to compute the lattice; see Appendix A for more details. Of course, there are also examples where the preprocessing step produces little or no reduction in the number of principal congruences that must be computed, and so increases the total time required to compute the lattice (the Gossip monoids [8] are class of such examples).

Recall that a submonoid NN of a monoid MM is a subset of MM, which is a monoid under the same operation as MM with the same identity element; we denote this by NMN\leq M. If XMX\subseteq M, then the least submonoid of MM containing XX is called the submonoid generated by XX and is denoted by X\langle X\rangle.

For the remainder of the paper, we suppose that UU is a monoid, MM is a submonoid of UU, and NN is a submonoid of MM. We also denote the identity element of any of these 3 monoids by 11. Recall that MM is regular if for every xMx\in M there exists some xMx^{\prime}\in M such that xxx=xxx^{\prime}x=x.

In the case that UU is regular, in [22], it was shown, roughly speaking, how to utilise the Green’s structure of UU to determine the Green’s structure of MM. The idea being that the structure of UU is “known”, in some sense. The prototypical example is when MM is the full transformation monoid TnT_{n} (see [46]), consisting of all transformations on the set {0,,n1}\{0,\ldots,n-1\} for some nn. In this case, the Green’s structure of UU is known and can be used to compute the Green’s structure of any submonoid of UU. In this part of the paper, we will show that certain results from [22] hold in greater generality, for the so-called, relative Green’s relations.

We say that x,yMx,y\in M are M,N\mathscr{L}^{M,N}-related if the sets Nx={nx:nN}Nx=\{\>nx\>:\>n\in N\>\} and NyNy coincide; and we refer to M,N\mathscr{L}^{M,N} as the relative Green’s M,N\mathscr{L}^{M,N}-relation on MM. The relative Green’s M,N\mathscr{R}^{M,N}-relation on MM is defined dually. We say that x,yMx,y\in M are 𝒥M,N\mathscr{J}^{M,N}-related if the sets NxN={nxn:nN}NxN=\{\>nxn\>:\>n\in N\>\} and NyNNyN coincide; and we refer to 𝒥M,N\mathscr{J}^{M,N} as the relative Green’s 𝒥M,N\mathscr{J}^{M,N}-relation on MM. When N=MN=M, we recover the classical definition of Green’s relations, which are ubiquitous in the study of semigroups and monoids. For further information about Green’s relations see [35]. Relative Green’s relations were first introduced in [72, 73] and further studied in [9, 30]. It is routine to show that each of M,N\mathscr{L}^{M,N}, M,N\mathscr{R}^{M,N}, and 𝒥M,N\mathscr{J}^{M,N} is an equivalence relation on MM; and that M,N\mathscr{L}^{M,N} is a right congruence, and M,N\mathscr{R}^{M,N} a left congruence. We denote the M,N\mathscr{L}^{M,N}-, M,N\mathscr{R}^{M,N}-, or 𝒥M,N\mathscr{J}^{M,N}-class of an element xMx\in M by LxM,NL_{x}^{M,N}, RxM,NR_{x}^{M,N} and JxM,NJ_{x}^{M,N}, respectively.

It may be reasonable to ask, at this point, what any of this has to do with determining the principal congruences of a monoid? This is addressed in the next proposition.

Proposition 7.1.

Let MM be a monoid and let ΔM={(m,m):mM}M×M\Delta_{M}=\{(m,m):m\in M\}\leq M\times M. Then the following hold:

  1. (i)

    If (x0,y0)M×M,ΔM(x1,y1)(x_{0},y_{0})\mathscr{R}^{M\times M,\Delta_{M}}(x_{1},y_{1}), then the right congruences generated by (x0,y0)(x_{0},y_{0}) and (x1,y1)(x_{1},y_{1}) coincide;

  2. (ii)

    If (x0,y0)M×M,ΔM(x1,y1)(x_{0},y_{0})\mathscr{L}^{M\times M,\Delta_{M}}(x_{1},y_{1}), then the left congruences generated by (x0,y0)(x_{0},y_{0}) and (x1,y1)(x_{1},y_{1}) coincide;

  3. (iii)

    If (x0,y0)𝒥M×M,ΔM(x1,y1)(x_{0},y_{0})\mathscr{J}^{M\times M,\Delta_{M}}(x_{1},y_{1}), then the 2-sided congruences generated by (x0,y0)(x_{0},y_{0}) and (x1,y1)(x_{1},y_{1}) coincide.

Proof.

We only prove part i, the proofs in the other cases are similar. If (x0,y0)M×M,ΔM(x1,y1)(x_{0},y_{0})\mathscr{R}^{M\times M,\Delta_{M}}(x_{1},y_{1}), then there exists (m,m)ΔM(m,m)\in\Delta_{M} such that (x0m,y0m)=(x0,y0)(m,m)=(x1,y1)(x_{0}m,y_{0}m)=(x_{0},y_{0})(m,m)=(x_{1},y_{1}). In particular, (x1,y1)(x_{1},y_{1}) belongs to the right congruence generated by (x0,y0)(x_{0},y_{0}). By symmetry (x0,y0)(x_{0},y_{0}) also belongs to the right congruence generated by (x1,y1)(x_{1},y_{1}) and so these two congruences coincide. ∎

A corollary of 7.1 is: if XX is a set of M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-class representatives in M×MM\times M, then every principal right congruence on MM is generated by a pair in XX. So, knowing M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-class representatives in M×MM\times M, will allow us to compute the set of all principal right congruences of MM. By doing this we hope for two things: that we can compute the representatives efficiently and that the number of such representatives is relatively small compared to |M×M||M\times M|. Analogous statements hold for principal left congruences and M×M,ΔM\mathscr{L}^{M\times M,\Delta_{M}}; and for 2-sided congruences and 𝒥M×M,ΔM\mathscr{J}^{M\times M,\Delta_{M}}.

The rest of this section is dedicated to showing how to can compute M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-, and 𝒥M×M,ΔM\mathscr{J}^{M\times M,\Delta_{M}}-class representatives in M×MM\times M. We will not discuss M×M,ΔM\mathscr{L}^{M\times M,\Delta_{M}}-classes beyond the following comments. Suppose that we can compute relative M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-class representatives in M×MM\times M for any arbitrary monoid MM. Relative M×M,ΔM\mathscr{L}^{M\times M,\Delta_{M}}-classes can be computed in one of two ways: by performing the dual of what is described in this section for computing relative M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-classes; or by computing an anti-isomorphism from ϕ:MM\phi:M\longrightarrow M^{\dagger} from MM to its dual MM^{\dagger}, and computing relative M×M,ΔM\mathscr{R}^{M^{\dagger}\times M^{\dagger},\Delta_{M^{\dagger}}}-class representatives in M×MM^{\dagger}\times M^{\dagger}. For the sake of simplicity, we opt for the second approach. An anti-isomorphism into a transformation monoid can be found from the left Cayley graph of MM. The lattice of congruences of a monoid MM is generally several orders of magnitude harder to determine than the left Cayley graph, and as such computing an anti-isomorphism from MM to a transformation monoid is an insignificant step in this process. The degree of the transformation representation of MM^{\dagger} obtained from the left Cayley graph of MM is |M||M|. If |M||M| is large, this can have an adverse impact on the computation of relative M×M,ΔM\mathscr{R}^{M^{\dagger}\times M^{\dagger},\Delta_{M^{\dagger}}}-class representatives. However, it is possible to reduce the degree of this representation by finding a right congruence of MM^{\dagger} on which MM^{\dagger} acts faithfully using the algorithms given in Section 4.

If UU is a fixed regular monoid, MM is an arbitrary submonoid of UU, and NN an arbitrary submonoid of NN, then we show how to compute M,N\mathscr{R}^{M,N}-class representatives for MM using the structure of UU. Algorithm 11 in [22] describes how to obtain the M,M\mathscr{R}^{M,M}-class representatives for MM. We will show that, with minimal changes, Algorithm 11 from [22] can be used to compute M,N\mathscr{R}^{M,N}-class representatives for MM. We will then show how, as a by-product of the algorithm used to compute M,N\mathscr{R}^{M,N}-class representatives, to compute 𝒥M,N\mathscr{J}^{M,N}-class representatives.

The essential idea is to represent an M,N\mathscr{R}^{M,N}-class by a group and a strongly connected component of the action of NN on the U,U\mathscr{L}^{U,U}-class containing elements of MM. We will show (in 7.8) that this representation reduces the problem of checking membership in an M,N\mathscr{R}^{M,N}-class to checking membership in the corresponding group. Starting with the M,N\mathscr{R}^{M,N}-class of the identity, new M,N\mathscr{R}^{M,N}-class representatives are computed by left multiplying the existing representatives by the generators of NN, and testing whether these multiples are M,N\mathscr{R}^{M,N}-related to an existing representative.

Before we can describe the algorithm and prove the results showing that it is valid, we require the following. If Ψ:X×MX\Psi:X\times M\longrightarrow X is a right action of MM on a finite set XX, YY is any subset of XX, and mMm\in M, then we define

(Y,m)Ψ={(y,m)Ψ:yY}(Y,m)\Psi=\{\>(y,m)\Psi\>:\>y\in Y\>\}

and we define m|Y:Y(Y,m)Ψm|_{Y}:Y\longrightarrow(Y,m)\Psi by

(y)m|Y=(y,m)Ψ(y)m|_{Y}=(y,m)\Psi

for all yYy\in Y and all mMm\in M. When Ψ\Psi is clear from the context, we may write xmx\cdot m and YmY\cdot m instead of (x,m)Ψ(x,m)\Psi and (Y,m)Ψ(Y,m)\Psi, respectively. We define the stabiliser of YY to be

StabM(Y)={mM:(Y,m)Ψ=Y}.\operatorname{Stab}_{M}(Y)=\{\>m\in M\>:\>(Y,m)\Psi=Y\>\}.

Clearly, if mStabM(Y)m\in\operatorname{Stab}_{M}(Y), then m|Y:YYm|_{Y}:Y\longrightarrow Y is a permutation of YY. The quotient of the stabiliser by the kernel of its action on YY, i.e. the congruence

ker(Ψ)={(m,n)M×M:m,nStabM(Y),m|Y=n|Y},\ker(\Psi)=\{\>(m,n)\in M\times M\>:\>m,n\in\operatorname{Stab}_{M}(Y),\ m|_{Y}=n|_{Y}\>\},

is isomorphic to {m|Y:mStabM(Y)}\{\>m|_{Y}\>:\>m\in\operatorname{Stab}_{M}(Y)\>\} which is a subgroup of the symmetric group Sym(Y)\operatorname{Sym}(Y) on YY. When using the \cdot notation for actions we write ker()\ker(\cdot) to denote the kernel of the action \cdot. We denote the equivalence class of an element mStabM(Y)m\in\operatorname{Stab}_{M}(Y) with respect to ker(Ψ)\ker(\Psi) by [m][m]. Clearly, since NN is a submonoid of MM, StabN(Y)/ker(Ψ)\operatorname{Stab}_{N}(Y)/\ker(\Psi) is a subgroup of StabM(Y)/ker(Ψ)\operatorname{Stab}_{M}(Y)/\ker(\Psi).

We denote the right action of the monoid UU on UU by right multiplication by Φ:U×UU\Phi:U\times U\longrightarrow U. If LL is a U,U\mathscr{L}^{U,U}-class of UU, then the group StabU(L)/ker(Φ)\operatorname{Stab}_{U}(L)/\ker(\Phi), and its subgroup StabM(L)/ker(Φ)\operatorname{Stab}_{M}(L)/\ker(\Phi), act faithfully by permutations on LL. The algorithms described in this part of the paper involve computing with these permutation groups using standard algorithms from computational group theory, such as the Schreier-Sims Algorithm [64, 66, 67]. The U,U\mathscr{L}^{U,U}-classes are often too large themselves for it to be practical to compute with permutations of \mathscr{L}-classes directly. For many well-studied classes of monoids UU, such as the full transformation monoid, the symmetric inverse monoid, or the partition monoid, there are natural faithful representations of the action of StabU(L)/ker(Φ)\operatorname{Stab}_{U}(L)/\ker(\Phi) on the U,U\mathscr{L}^{U,U}-class LL in a symmetric group of relatively low degree. To avoid duplication we refer the reader to [22, Section 4] for details. Throughout the rest of this paper, we will abuse notation by writing StabN(L)/ker(Φ)\operatorname{Stab}_{N}(L)/\ker(\Phi), to mean a faithful low-degree representation of StabN(L)/ker(Φ)\operatorname{Stab}_{N}(L)/\ker(\Phi) when one is readily computable.

It might be worth noting that we are interested in computing M×M,ΔM\mathscr{R}^{M\times M,\Delta_{M}}-class representatives, but the results in [22] apply to submonoids of MM when UU is the full transformation monoid TnT_{n}, the partition monoid PnP_{n}, or the symmetric inverse monoid InI_{n}, for example, rather than to submonoids of U×UU\times U. If a monoid UU is regular, then so too is U×UU\times U, and hence we may apply the techniques from [22] to compute submonoids of U×UU\times U. The missing ingredients, however, are the analogues for U×UU\times U of the results in [22, Section 4], that provide efficient faithful representations of the right action of NN on the U,U\mathscr{L}^{U,U}-classes containing elements of MUM\leq U. It is possible to prove such analogues for U×UU\times U. However, in the case that U=UnU=U_{n} is one of TnT_{n}, PnP_{n}, and InI_{n}, at least, this is not necessary, since Un×UnU_{n}\times U_{n} embeds into U2nU_{2n}. As such we may directly reuse the methods described in [22, Section 4].

In order to make practical use of StabM(L)/ker(Φ)\operatorname{Stab}_{M}(L)/\ker(\Phi), it is necessary that we can efficiently obtain a generating set. The following analogue of Schreier’s Lemma for monoids provides a method for doing so. If XX is any set and YXY\subseteq X, then we denote the identity function from YY to YY by idY\mbox{\rm id}_{Y}.

Proposition 7.2 (cf. Proposition 2.3 in [22]).

Let M=AM=\langle A\rangle be a monoid, let Ψ:X×MX\Psi:X\times M\longrightarrow X be a right action of MM, and let Y0,,Yn1XY_{0},\ldots,Y_{n-1}\subseteq X be the elements of a strongly connected component of the right action of MM on 𝒫(X)\mathcal{P}(X) induced by Ψ\Psi. Then the following hold:

  1. (i)

    if (Y0,ui)Ψ=Yi(Y_{0},u_{i})\Psi=Y_{i} for some uiMu_{i}\in M, then there exists ui¯M\overline{u_{i}}\in M such that (Yi,ui¯)Ψ=Y0(Y_{i},\overline{u_{i}})\Psi=Y_{0}, (uiui¯)|Y0=idY0(u_{i}\overline{u_{i}})|_{Y_{0}}=\mbox{\rm id}_{Y_{0}}, and (ui¯ui)|Y0=idYi(\overline{u_{i}}u_{i})|_{Y_{0}}=\mbox{\rm id}_{Y_{i}};

  2. (ii)

    StabM(Yi)/ker(Ψ)\operatorname{Stab}_{M}(Y_{i})/\ker(\Psi) and StabM(Yj)/ker(Ψ)\operatorname{Stab}_{M}(Y_{j})/\ker(\Psi) are conjugate subgroups of Sym(X)\operatorname{Sym}(X) for all i,j{0,,n1}i,j\in\{0,\ldots,n-1\};

  3. (iii)

    if u0=u0¯=1Mu_{0}=\overline{u_{0}}=1_{M} and ui,ui¯Mu_{i},\overline{u_{i}}\in M are as in part i for i>0i>0, then StabM(Y0)/ker(Ψ)\operatorname{Stab}_{M}(Y_{0})/\ker(\Psi) is generated by

    {(uiauj¯)|Y0: 0i,j<n,aA,Yia=Yj}.\{\>(u_{i}a\overline{u_{j}})|_{Y_{0}}\>:\>0\leq i,j<n,\ a\in A,\ Y_{i}\cdot a=Y_{j}\>\}.

We require the following two right actions of NN. One is the action on 𝒫(U)\mathcal{P}(U) induced by right multiplication, i.e. for nNn\in N and X𝒫(U)X\in\mathcal{P}(U):

(X,n)Φ={xn:xX}.(X,n)\Phi=\{xn:x\in X\}. (7.1)

The second right action of NN is that on U,U\mathscr{L}^{U,U}-classes:

(LxU,U,n)Ψ=LxnU,U.(L^{U,U}_{x},n)\Psi=L^{U,U}_{xn}. (7.2)

where nNn\in N and xMx\in M. The latter is an action because U,U\mathscr{L}^{U,U} is a right congruence on UU. The actions given in (7.1) and (7.2) coincide in the case described by the following lemma.

Lemma 7.3 (cf. Lemma 3.3 in [22]).

Let x,yUx,y\in U be arbitrary. Then the U,U\mathscr{L}^{U,U}-classes LxU,UL_{x}^{U,U} and LyU,UL_{y}^{U,U} belong to the same strongly connected component of the right action Φ\Phi of NN defined in (7.1) if and only if they belong to the same strongly connected component of the right action Ψ\Psi of NN defined in (7.2).

Lemma 7.3 allows us use the actions defined in (7.1) and (7.2) interchangeably within a strongly connected component of either action. We will denote both of the right actions in (7.1) and (7.2) by \cdot. Although the actions in (7.1) and (7.2) are interchangeable the corresponding stabilisers are not. Indeed, the stabiliser of any U,U\mathscr{L}^{U,U}-class with respect to the action given in (7.2) is always trivial, but the stabiliser with respect to (7.1) is not. When we write StabN(X)\operatorname{Stab}_{N}(X) or StabU(X)\operatorname{Stab}_{U}(X) for some subset XX of UU, we will always mean the stabiliser with respect to (7.1).

We require the following result from [22] which relate to non-relative Green’s relations and classes.

Lemma 7.4 (cf. Lemma 3.6 in [22]).

Let xUx\in U and s,tStabU(LxU,U)s,t\in\operatorname{Stab}_{U}(L_{x}^{U,U}) be arbitrary. Then ys=ytys=yt for all yLxU,Uy\in L_{x}^{U,U} if and only if there exists yLxU,Uy\in L_{x}^{U,U} such that ys=ytys=yt.

We also require the following results, which are modifications of the corresponding results in [22] for relative Green’s relations and classes.

If x,yUx,y\in U, then we write LxU,ULyU,UL_{x}^{U,U}\sim L_{y}^{U,U} to denote that the U,U\mathscr{L}^{U,U}-classes LxU,UL_{x}^{U,U} and LyU,UL_{y}^{U,U} belong to the same strongly connected component of either of the right actions of NN defined in (7.1) or (7.2). Similarly, we write RxU,URyU,UR_{x}^{U,U}\sim R_{y}^{U,U} for the analogous statement for U,U\mathscr{R}^{U,U}-classes.

Recall that we do not propose acting on the U,U\mathscr{L}^{U,U}-classes directly but rather we use a more convenient isomorphic action when available. For example, if UU is the full transformation monoid, then the action of any submonoid MM of UU on U,U\mathscr{L}^{U,U}-classes of elements in MM is isomorphic to the natural right action of MM on the set {im(m):mM}\{\operatorname{im}(m):m\in M\}; for more examples and details see [22, Section 4]. In [22, Algorithm 1] a (simple brute force) algorithm is stated that can be used to compute the word graph corresponding to the right action of MM on {LxU,U:xM}\{L_{x}^{U,U}:x\in M\}. In the present paper we must compute the word graph for the right action of NN on {LxU,U:xM}\{L_{x}^{U,U}:x\in M\}[22, Algorithm 1] relies on the fact that L1U,UM={LxU,U:xM}L_{1}^{U,U}\cdot M=\{L_{x}^{U,U}:x\in M\}. Clearly, L1UU,UNL_{1_{U}}^{U,U}\cdot N is not equal to {LxU,U:xM}\{L_{x}^{U,U}:x\in M\} in general. As such we cannot use  [22, Algorithm 1] directly to compute {LxU,U:xM}\{L_{x}^{U,U}:x\in M\}. However, we can apply [22, Algorithm 1] to compute the set {LxU,U:xM}\{L_{x}^{U,U}:x\in M\} and subsequently compute the word graph of the action of NN on this set. The latter can be accomplished by repeating [22, Algorithm 1] with the generating set AA for NN, setting C:={LxU,U:xM}C:=\{L_{x}^{U,U}:x\in M\} in line 1. Since NN is a submonoid of MM, the condition in line 3 never holds, and the condition in line 6 always holds.

The next result states some properties of relative Green’s relations that are required to prove the main propositions in this section.

Lemma 7.5 (cf. Lemma 3.4, Corollaries 3.8 and 3.13 in [22]).

Let x,yMx,y\in M and let sNs\in N. Then the following hold:

  1. (i)

    LxU,ULxsU,UL_{x}^{U,U}\sim L_{xs}^{U,U} if and only if xM,Nxsx\mathscr{R}^{M,N}xs;

  2. (ii)

    if xM,Nyx\mathscr{R}^{M,N}y and xsU,Uyxs\mathscr{L}^{U,U}y, then xsM,Nyxs\mathscr{R}^{M,N}y;

  3. (iii)

    if xM,Nyx\mathscr{R}^{M,N}y and xsU,Uyxs\mathscr{L}^{U,U}y, then f:LxU,URxM,NLyU,URxM,Nf:L_{x}^{U,U}\cap R_{x}^{M,N}\longrightarrow L_{y}^{U,U}\cap R_{x}^{M,N} defined by ttst\mapsto ts is a bijection.

Proof.

(i). (\Rightarrow) By assumption, LxsU,UL_{xs}^{U,U} and LxU,UL_{x}^{U,U} belong to the same strongly connected component of the action of NN on U/U,UU/\mathscr{L}^{U,U} by right multiplication. Hence, by 7.2i, there exists s¯N\overline{s}\in N such that LxsU,Us¯=LxU,UL_{xs}^{U,U}\overline{s}=L_{x}^{U,U} and ss¯s\overline{s} acts on LxU,UL_{x}^{U,U} as the identity. Hence, in particular, xss¯=xxs\overline{s}=x and so xsM,Nxxs\mathscr{R}^{M,N}x.

(\Leftarrow) Suppose xM,Nxsx\mathscr{R}^{M,N}xs. Then there exists tNt\in N such that xst=xxst=x. It follows that LxU,Us=LxsU,UL_{x}^{U,U}\cdot s=L_{xs}^{U,U} and LxsU,Ut=LxU,UL_{xs}^{U,U}\cdot t=L_{x}^{U,U}. Hence LxU,ULxsU,UL_{x}^{U,U}\sim L_{xs}^{U,U}.

(ii). Since xM,Nyx\mathscr{R}^{M,N}y there exists tNt\in N such that yt=xyt=x. Hence LxU,Us=LxsU,UL_{x}^{U,U}\cdot s=L_{xs}^{U,U} and LxsU,Ut=LyU,Ut=LytU,U=LxU,UL_{xs}^{U,U}\cdot t=L_{y}^{U,U}\cdot t=L_{yt}^{U,U}=L_{x}^{U,U}. In particular, LxU,ULxsU,UL_{x}^{U,U}\sim L_{xs}^{U,U} and so, by part i, yM,NxM,Nxsy\mathscr{R}^{M,N}x\mathscr{R}^{M,N}xs, as required.

(iii). Let tLxU,URxM,Nt\in L_{x}^{U,U}\cap R_{x}^{M,N} be arbitrary. Then tM,NxM,Nyt\mathscr{R}^{M,N}x\mathscr{R}^{M,N}y and tsU,UxsU,Uyts\mathscr{L}^{U,U}xs\mathscr{L}^{U,U}y and so, by part ii, tsM,NyM,Nxts\mathscr{R}^{M,N}y\mathscr{R}^{M,N}x. In other words, tsLyU,URxM,Nts\in L_{y}^{U,U}\cap R_{x}^{M,N} for all tLxU,URxM,Nt\in L_{x}^{U,U}\cap R_{x}^{M,N}. In particular, xM,Nxsx\mathscr{R}^{M,N}xs and so, by part i, LxU,ULxsU,U=LyU,UL_{x}^{U,U}\sim L_{xs}^{U,U}=L_{y}^{U,U}. Hence, by 7.2i, there exists s¯N\overline{s}\in N such that tss¯=tts\overline{s}=t for all tLxU,URxM,Nt\in L_{x}^{U,U}\cap R_{x}^{M,N}. Therefore ttst\mapsto ts and uus¯u\mapsto u\overline{s} are mutually inverse bijections from LxU,URxM,NL_{x}^{U,U}\cap R_{x}^{M,N} to LyU,URxM,NL_{y}^{U,U}\cap R_{x}^{M,N} and back. ∎

The next proposition allows us to decompose the M,N\mathscr{R}^{M,N}-class of xMx\in M into the sets RxM,NLyU,UR_{x}^{M,N}\cap L_{y}^{U,U} where the LyU,UL_{y}^{U,U} form a {\sim}-strongly connected component with respect to NN.

Proposition 7.6 (cf. Proposition 3.7(a) in [22]).

Suppose that x,yMx,y\in M are arbitrary. If xM,Nyx\mathscr{R}^{M,N}y, then LxU,ULyU,UL_{x}^{U,U}\sim L_{y}^{U,U}. Conversely, if LxU,ULyU,UL_{x}^{U,U}\sim L_{y}^{U,U}, then there exists zMz\in M such that zM,Nxz\mathscr{R}^{M,N}x and LzU,U=LyU,UL_{z}^{U,U}=L_{y}^{U,U}.

Proof.

Suppose that yMy\in M is such that xyx\neq y. Then yM,Nxy\mathscr{R}^{M,N}x implies that there exists s,tNs,t\in N such that xs=yxs=y and yt=xyt=x. In particular, xsM,Nxxs\mathscr{R}^{M,N}x and so LxU,ULxsU,U=LyU,UL_{x}^{U,U}\sim L_{xs}^{U,U}=L_{y}^{U,U}, by Lemma 7.5i(\Leftarrow).

If yMy\in M is such that LxU,ULyU,UL_{x}^{U,U}\sim L_{y}^{U,U}, then there exists sNs\in N such that LyU,U=LxsU,UL_{y}^{U,U}=L_{xs}^{U,U} and so, by Lemma 7.5i(\Rightarrow), xM,Nxsx\mathscr{R}^{M,N}xs. ∎

The next result, when combined with 7.6, completes the decomposition of the M,N\mathscr{R}^{M,N}-class of xMx\in M into {\sim}-strongly connected component with respect to NN and a group, by showing that LxU,URxM,NL_{x}^{U,U}\cap R_{x}^{M,N} is a group with the operation defined in part i of the next proposition.

Proposition 7.7 (cf. Proposition 3.9 in [22]).

Suppose that xMx\in M and there exists xUx^{\prime}\in U where xxx=xxx^{\prime}x=x (i.e. xx is regular in UU). Then the following hold:

  1. (i)

    LxU,URxM,NL_{x}^{U,U}\cap R_{x}^{M,N} is a group under the multiplication * defined by st=sxts\ast t=sx^{\prime}t for all s,tLxU,URxM,Ns,t\in L_{x}^{U,U}\cap R_{x}^{M,N} and its identity is xx;

  2. (ii)

    ϕ:StabN(LxU,U)/ker()LxU,URxM,N\phi:\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot)\longrightarrow L_{x}^{U,U}\cap R_{x}^{M,N} defined by ([s])ϕ=xs([s])\phi=xs, for all sStabN(LxU,U)s\in\operatorname{Stab}_{N}(L_{x}^{U,U}), is an isomorphism;

  3. (iii)

    ϕ1:LxU,URxM,NStabN(LxU,U)/ker()\phi^{-1}:L_{x}^{U,U}\cap R_{x}^{M,N}\longrightarrow\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot) is defined by (s)ϕ1=[xs](s)\phi^{-1}=[x^{\prime}s] for all sLxU,URxM,Ns\in L_{x}^{U,U}\cap R_{x}^{M,N}.

Proof.

We begin by showing that xx is an identity under the multiplication * of LxU,URxM,NL_{x}^{U,U}\cap R_{x}^{M,N}. Since xxLxU,Ux^{\prime}x\in L_{x}^{U,U} and xxRxU,Uxx^{\prime}\in R_{x}^{U,U} are idempotents, it follows that xxx^{\prime}x is a right identity for LxU,UL_{x}^{U,U} and xxxx^{\prime} is a left identity for RxM,NRxU,UR_{x}^{M,N}\subseteq R_{x}^{U,U}. So, if sLxU,URxM,Ns\in L_{x}^{U,U}\cap R_{x}^{M,N} is arbitrary, then

xs=xxs=s=sxx=sx,x*s=xx^{\prime}s=s=sx^{\prime}x=s*x,

as required.

We will prove that part (b) holds, which implies part (a).

ϕ\phi is well-defined. If sMs\in M and sStabN(LxU,U)s\in\operatorname{Stab}_{N}(L_{x}^{U,U}), then xsU,Uxxs\mathscr{L}^{U,U}x. Hence, by Lemma 7.5ii, xsM,Nxxs\mathscr{R}^{M,N}x and so (s)ϕ=xsLxU,URxM,N(s)\phi=xs\in L_{x}^{U,U}\cap R_{x}^{M,N}. If tStabN(LxU,U)t\in\operatorname{Stab}_{N}(L_{x}^{U,U}) is such that [t]=[s][t]=[s], then, by Lemma 7.4, xt=xsxt=xs.

ϕ\phi is surjective. Let sLxU,URxM,Ns\in L_{x}^{U,U}\cap R_{x}^{M,N} be arbitrary. Then xxs=xs=sxx^{\prime}s=x*s=s since xx is the identity of LxU,URxM,NL_{x}^{U,U}\cap R_{x}^{M,N}. It follows that

LxU,Uxs=LsU,U=LxU,UL_{x}^{U,U}\cdot x^{\prime}s=L^{U,U}_{s}=L^{U,U}_{x}

and so xsStabU(LxU,U)x^{\prime}s\in\operatorname{Stab}_{U}(L_{x}^{U,U}). Since xM,Nsx\mathscr{R}^{M,N}s, there exists uNu\in N such that xu=s=xxsxu=s=xx^{\prime}s. It follows that uStabN(LxU,U)u\in\operatorname{Stab}_{N}(L_{x}^{U,U}) and, by Lemma 7.4, [u]=[xs][u]=[x^{\prime}s]. Thus (u)ϕ=xu=s(u)\phi=xu=s and ϕ\phi is surjective.

ϕ\phi is a homomorphism. Let s,tStabN(LxU,U)s,t\in\operatorname{Stab}_{N}(L_{x}^{U,U}). Then, since xsLxU,Uxs\in L_{x}^{U,U} and xxx^{\prime}x is a right identity for LxU,UL_{x}^{U,U},

([s])ϕ([t])ϕ=xsxt=xsxxt=xst=([st])ϕ=([s][t])ϕ,([s])\phi*([t])\phi=xs*xt=xsx^{\prime}xt=xst=([st])\phi=([s][t])\phi,

as required.

ϕ\phi is injective. Let θ:LxU,URxM,NStabN(LxU,U)/ker()\theta:L_{x}^{U,U}\cap R_{x}^{M,N}\longrightarrow\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot) be defined by (y)θ=[xy](y)\theta=[x^{\prime}y] for all yLxURxSy\in L_{x}^{U}\cap R_{x}^{S}. We will show that ϕθ\phi\theta is the identity mapping on StabN(LxU,U)/ker()\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot), which implies that ϕ\phi is injective, that (y)θStabN(LxU,U)/ker()(y)\theta\in\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot) for all yLxU,URxM,Ny\in L_{x}^{U,U}\cap R_{x}^{M,N} (since ϕ\phi is surjective), and also proves part (c) of the proposition. If sStabN(LxU,U)s\in\operatorname{Stab}_{N}(L_{x}^{U,U}), then ([s])ϕθ=(xs)θ=[xxs]([s])\phi\theta=(xs)\theta=[x^{\prime}xs]. But xxxs=xsxx^{\prime}xs=xs and so [xxs]=[s][x^{\prime}xs]=[s] by Lemma 7.4. Therefore, ([s])ϕθ=[s]([s])\phi\theta=[s], as required. ∎

Finally, we combine the preceding results to test membership in an M,N\mathscr{R}^{M,N}-class.

Proposition 7.8.

Suppose that xMx\in M and there is xUx^{\prime}\in U with xxx=xxx^{\prime}x=x. If yUy\in U is arbitrary, then yM,Nxy\mathscr{R}^{M,N}x if and only if yU,Uxy\mathscr{R}^{U,U}x, LyU,ULxU,UL_{y}^{U,U}\sim L_{x}^{U,U}, and [xyv]StabN(LxU,U)/ker()[x^{\prime}yv]\in\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot) where vNv\in N is any element such that LyUv=LxUL_{y}^{U}\cdot v=L_{x}^{U}.

Proof.

(\Rightarrow) Since RxM,NRxU,UR_{x}^{M,N}\subseteq R_{x}^{U,U}, yU,Uxy\mathscr{R}^{U,U}x and from 7.6, LyU,ULxU,UL_{y}^{U,U}\sim L_{x}^{U,U}. Suppose that vNv\in N is such that LyUv=LxUL_{y}^{U}\cdot v=L_{x}^{U}. Then, by Lemma 7.5iii, yvLxU,URxM,Nyv\in L_{x}^{U,U}\cap R_{x}^{M,N} and so, by 7.7iii, [xyv]StabN(LxU,U)/ker()[x^{\prime}yv]\in\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot).

(\Leftarrow) Since yRxU,Uy\in R_{x}^{U,U} and xxxx^{\prime} is a left identity in its U,U\mathscr{R}^{U,U}-class, it follows that xxy=yxx^{\prime}y=y. Suppose that vNv\in N is any element such that LyUv=LxUL_{y}^{U}\cdot v=L_{x}^{U} (such an element exists by the assumption that LyU,ULxU,UL_{y}^{U,U}\sim L_{x}^{U,U}). Then, by assumption, [xyv]StabN(LxU,U)/ker()[x^{\prime}yv]\in\operatorname{Stab}_{N}(L_{x}^{U,U})/\ker(\cdot) and so by 7.7ii, yv=xxyvLxU,URxM,Nyv=x\cdot x^{\prime}yv\in L_{x}^{U,U}\cap R_{x}^{M,N}. But LyU,ULyvU,UL_{y}^{U,U}\sim L_{yv}^{U,U}, and so, by Lemma 7.5i, yM,Nyvy\mathscr{R}^{M,N}yv, and so xM,NyvM,Nyx\mathscr{R}^{M,N}yv\mathscr{R}^{M,N}y, as required. ∎

We have shown that analogues of all the results required to prove the correctness of [22, Algorithm 11] hold for relative Green’s relations in addition to their non-relative counterparts. For the sake of completeness, we state a version of Algorithm 11 from [22] that computes the set \mathfrak{R} of M,N\mathscr{R}^{M,N}-class representatives and the word graph Γ\Gamma of the left action (by left multiplication) of NN on \mathfrak{R}; see Algorithm 7. We require the word graph Γ\Gamma to compute 𝒥M,N\mathscr{J}^{M,N}-class representatives in the next section, it is not required for finding the M,N\mathscr{R}^{M,N}-class representatives. The algorithm presented in Algorithm 7 is simplified somewhat from Algorithm 11 from [22] because we only require the representatives and the word graph, and not the associated data structures.

Algorithm 7 (cf. Algorithm 11 in [22]) Enumerate M,N\mathscr{R}^{M,N}-class representatives
1:A monoid MM and a submonoid N:=AN:=\langle\>A\>\rangle where A:={a0,,am1}A:=\{a_{0},\ldots,a_{m-1}\}
2:The set \mathfrak{R} of M,N\mathscr{R}^{M,N}-classes representatives of elements in MM and the word graph Γ\Gamma of the action of NN on \mathfrak{R}.
3:set :=(r0:=1M)\mathfrak{R}:=(r_{0}:=1_{M}) where 1MM1_{M}\in M is the identity of MM [initialise the list of M,N\mathscr{R}^{M,N}-class representatives]
4:Γ:=(V,E)\Gamma:=(V,E) where V:={0}V:=\{0\} and E:=E:=\varnothing [initialise the word graph of the action of NN on \mathfrak{R}]
5:find (L1MU,U)M={LxU,U:xM}(L_{1_{M}}^{U,U})\cdot M=\{\>L_{x}^{U,U}\>:\>x\in M\>\} [Algorithm 1 from [22]]
6:compute the action of NN on (L1MU,U)M(L_{1_{M}}^{U,U})\cdot M [use the modified version of Algorithm 1 from [22] discussed above]
7:find the strongly connected components of (L1MU,U)M(L_{1_{M}}^{U,U})\cdot M [standard graph theory algorithm]
8:set z0,,zk1Mz_{0},\ldots,z_{k-1}\in M to be representatives of U,U\mathscr{L}^{U,U}-classes in each strongly connected component
9:find generating sets for the groups StabN(LznU,U)/ker()\operatorname{Stab}_{N}(L_{z_{n}}^{U,U})/\ker(\cdot), n{0,,k1}n\in\{0,\ldots,k-1\} [Algorithm 4 in [22]]
10:i:=0i:=0
11:while i<||i<|\mathfrak{R}| do [loop over: existing \mathscr{R}-representatives]
12:  j:=0j:=0
13:  while j<mj<m do [loop over: generators of NN]
14:   find n{0,,k1}n\in\{0,\ldots,k-1\} such that LznU,ULajriU,UL_{z_{n}}^{U,U}\sim L_{a_{j}r_{i}}^{U,U}
15:   find uNu\in N such that LznU,Uu=LajriU,UL_{z_{n}}^{U,U}\cdot u=L_{a_{j}r_{i}}^{U,U} [Algorithm 2 in [22]]
16:   find u¯U1\overline{u}\in U^{1} such that LajriU,Uu¯=LznU,UL_{a_{j}r_{i}}^{U,U}\cdot\overline{u}=L_{z_{n}}^{U,U} and znuu¯=znz_{n}u\overline{u}=z_{n}
17:   for rlr_{l}\in\mathfrak{R} with (rl,ajri)U,U(r_{l},a_{j}r_{i})\in\mathscr{R}^{U,U} and (rl,zn)U,U(r_{l},z_{n})\in\mathscr{L}^{U,U} do
18:     if [rlajriu¯]StabN(LrlU,U)/ker()=StabN(LznU,U)/ker()[r_{l}^{\prime}a_{j}r_{i}\overline{u}]\in\operatorname{Stab}_{N}(L_{r_{l}}^{U,U})/\ker(\cdot)=\operatorname{Stab}_{N}(L_{z_{n}}^{U,U})/\ker(\cdot) then[ajriM,Nrla_{j}r_{i}\mathscr{R}^{M,N}r_{l} by 7.8]
19:      Γ(V,E{(i,aj,l)})\Gamma\leftarrow(V,E\cup\{(i,a_{j},l)\}) [update the word graph for the action of NN on \mathfrak{R}]
20:      go to line 9
21:     end if
22:   end for[ajriu¯a_{j}r_{i}\overline{u} is a new M,N\mathscr{R}^{M,N}-representative]
23:   Γ(V{||},E{(i,aj,||)})\Gamma\leftarrow(V\cup\{|\mathfrak{R}|\},E\cup\{(i,a_{j},|\mathfrak{R}|)\}) [update the word graph]
24:   Append r||:=ajriu¯r_{|\mathfrak{R}|}:=a_{j}r_{i}\overline{u} to \mathfrak{R} [update the set of M,N\mathscr{R}^{M,N}-representatives]
25:   j:=j+1j:=j+1
26:  end while
27:  i:=i+1i:=i+1
28:end while
29:return \mathfrak{R}, Γ\Gamma

The next proposition shows that relative 𝒥M,N\mathscr{J}^{M,N}-classes correspond to strongly connected components of the word graph output by Algorithm 7.

Proposition 7.9.

Let x,yMx,y\in M. Then x𝒥M,Nyx\mathscr{J}^{M,N}y if and only if RxM,NR_{x}^{M,N} and RyM,NR_{y}^{M,N} belong to the same strongly connected component of the action of NN on the M,N\mathscr{R}^{M,N}-classes of MM by left multiplication.

Proof.

This follows almost immediately since 𝒟M,N=M,NM,N=𝒥M,N\mathscr{D}^{M,N}=\mathscr{L}^{M,N}\circ\mathscr{R}^{M,N}=\mathscr{J}^{M,N}, because MM and NN are finite. ∎

It follows from 7.9 that we can compute 𝒥M,N\mathscr{J}^{M,N}-class representatives by using Algorithm 7 to find the word graph Γ\Gamma, and then using one of the standard algorithms from graph theory to compute the strongly connected components of Γ\Gamma.

References

  • [1] A. Abram and C. Reutenauer “The stylic monoid” In Semigroup Forum 105.1 Springer ScienceBusiness Media LLC, 2022, pp. 1–45 DOI: 10.1007/s00233-022-10285-3
  • [2] João Araújo, Wolfram Bentz and Gracinda M.. Gomes “Congruences on direct products of transformation and matrix monoids” In Semigroup Forum Springer Nature, 2018 DOI: 10.1007/s00233-018-9931-8
  • [3] João Araújo and Friedrich Wehrung “Embedding properties of endomorphism semigroups” In Fundamenta Mathematicae 202.2, 2009, pp. 125–146 URL: http://eudml.org/doc/286492
  • [4] João Araújo et al. “CREAM: a Package to Compute [Auto, Endo, Iso, Mono, Epi]-morphisms, Congruences, Divisors and More for Algebras of Type (2n,1n)(2^{n},1^{n})”, 2022 eprint: arXiv:2202.00613
  • [5] Robert E. Arthur and N. Ruškuc “Presentations for Two Extensions of the Monoid of Order-Preserving Mappings on a Finite Chain” In Southeast Asian Bulletin of Mathematics 24.1 Springer ScienceBusiness Media LLC, 2000, pp. 1–7 DOI: 10.1007/s10012-000-0001-1
  • [6] Alex Bailey, Martin Finn-Sell and Robert Snocken “Subsemigroup, ideal and congruence growth of free semigroups” In Israel Journal of Mathematics 215.1, 2016, pp. 459–501 DOI: 10.1007/s11856-016-1384-8
  • [7] Matthew David George Kenworthy Brookes “Lattices of congruence relations for inverse semigroups”, 2020 URL: https://etheses.whiterose.ac.uk/29077/
  • [8] Andries E. Brouwer, Jan Draisma and Bart J. Frenk “Lossy Gossip and Composition of Metrics” In Discrete & Computational Geometry 53.4 Springer ScienceBusiness Media LLC, 2015, pp. 890–913 DOI: 10.1007/s00454-015-9666-1
  • [9] Alan J. Cain, Robert Gray and Nik Ruškuc “Green index in semigroups: generators, presentations, and automatic structures” In Semigroup Forum 85.3 Springer ScienceBusiness Media LLC, 2012, pp. 448–476 DOI: 10.1007/s00233-012-9406-2
  • [10] Peter J. Cameron et al. “Minimum degrees of finite rectangular bands, null semigroups, and variants of full transformation semigroups” In Combinatorial Theory 3.3 California Digital Library (CDL), 2023 DOI: 10.5070/c63362799
  • [11] Reinis Cirpons, James East and James D. Mitchell “Transformation representations of diagram monoids”, 2024 eprint: arXiv:2411.14693
  • [12] Reinis Cirpons, James D. Mitchell and Yann Péresse “Maximal and minimal one sided congruences of the full transformation monoid”, 2025
  • [13] T… Coleman, J.. Mitchell, F.. Smith and M. Tsalakou “The Todd–Coxeter algorithm for semigroups and monoids” In Semigroup Forum 108.3 Springer ScienceBusiness Media LLC, 2024, pp. 536–593 DOI: 10.1007/s00233-024-10431-z
  • [14] Thomas H Cormen, Charles E Leiserson, Ronald L Rivest and Clifford Stein “Introduction to Algorithms”, The MIT Press London, England: MIT Press, 2009
  • [15] Marc Culler, Matthias Goerner and Nathan Dunfield “3manifolds/low_index”, 2025 URL: https://github.com/3-manifolds/low_index
  • [16] Yang Dandan, Victoria Gould, Thomas Quinn-Gregson and Rida-E Zenab “Semigroups with finitely generated universal left congruence” In Monatshefte für Mathematik 190.4 Springer ScienceBusiness Media LLC, 2019, pp. 689–724 DOI: 10.1007/s00605-019-01274-w
  • [17] Andreas Distler and Tom Kelsey “The monoids of orders eight, nine & ten” In Annals of Mathematics and Artificial Intelligence 56.1 Springer ScienceBusiness Media LLC, 2009, pp. 3–21 DOI: 10.1007/s10472-009-9140-y
  • [18] James East and Nik Ruškuc “Classification of congruences of twisted partition monoids” In Advances in Mathematics 395 Elsevier BV, 2022, pp. 108097 DOI: 10.1016/j.aim.2021.108097
  • [19] James East and Nik Ruškuc “Congruence Lattices of Ideals in Categories and (Partial) Semigroups” In Memoirs of the American Mathematical Society 284.1408 American Mathematical Society (AMS), 2023 DOI: 10.1090/memo/1408
  • [20] James East and Nik Ruškuc “Congruences on Infinite Partition and Partial Brauer Monoids” In Moscow Mathematical Journal 22.2 National Research University, Higher School of Economics (HSE), 2022, pp. 295–372 DOI: 10.17323/1609-4514-2022-22-2-295-372
  • [21] James East and Nik Ruškuc “Properties of congruences of twisted partition monoids and their lattices” In Journal of the London Mathematical Society 106.1 Wiley, 2022, pp. 311–357 DOI: 10.1112/jlms.12574
  • [22] James East, Attila Egri-Nagy, James D. Mitchell and Yann Péresse “Computing finite semigroups” In Journal of Symbolic Computation 92 Elsevier BV, 2019, pp. 110–155 DOI: 10.1016/j.jsc.2018.01.002
  • [23] James East, James D. Mitchell, Nik Ruškuc and Michael Torpey “Congruence lattices of finite diagram monoids” In Advances in Mathematics 333 Elsevier BV, 2018, pp. 931–1003 DOI: 10.1016/j.aim.2018.05.016
  • [24] Vitor H Fernandes “On the cyclic inverse monoid on a finite set” In Asian-Eur. J. Math. World Scientific Pub Co Pte Ltd, 2024
  • [25] Ralph Freese “Computing congruences efficiently” In Algebra universalis 59.3-4 Springer ScienceBusiness Media LLC, 2008, pp. 337–343 DOI: 10.1007/s00012-008-2073-1
  • [26] Véronique Froidure and Jean-Éric Pin “Algorithms for computing finite semigroups” In Foundations of computational mathematics (Rio de Janeiro, 1997) Berlin: Springer, 1997, pp. 112–126
  • [27] Bernard A. Galler and Michael J. Fisher “An improved equivalence algorithm” In Communications of the ACM 7.5 Association for Computing Machinery (ACM), 1964, pp. 301–303 DOI: 10.1145/364099.364331
  • [28] Olexandr Ganyushkin and Volodymyr Mazorchuk “Classical Finite Transformation Semigroups” Springer London, 2009 DOI: 10.1007/978-1-84800-281-4
  • [29] “GAP – Groups, Algorithms, and Programming, Version 4.14.0”, 2024 The GAP Group URL: https://www.gap-system.org
  • [30] R. Gray and N. Ruškuc “Green index and finiteness conditions for semigroups” In Journal of Algebra 320.8 Elsevier BV, 2008, pp. 3145–3164 DOI: 10.1016/j.jalgebra.2008.07.008
  • [31] Peter M. Higgins “Combinatorial results for semigroups of order-preserving mappings” In Mathematical Proceedings of the Cambridge Philosophical Society 113.2 Cambridge University Press (CUP), 1993, pp. 281–296 DOI: 10.1017/s0305004100075964
  • [32] D.F. Holt and Sarah Rees “Testing for isomorphism between finitely presented groups” In Groups, Combinatorics and Geometry, London Mathematical Society Lecture Note Series Cambridge University Press, 1992, pp. 459–475
  • [33] Derek F Holt, Bettina Eick and Eamonn A O’Brien “Handbook of computational group theory”, Discrete Mathematics and Its Applications Philadelphia, PA: Chapman & Hall/CRC, 2005
  • [34] J. Hopcroft and R. Karp “A Linear Algorithm for Testing Equivalence of Finite Automata”, 1971
  • [35] John M. Howie “Fundamentals of semigroup theory” Oxford Science Publications 12, London Mathematical Society Monographs. New Series New York: The Clarendon Press Oxford University Press, 1995, pp. x+351
  • [36] Alexander Hulpke “Calculating Subgroups with GAP” In Group Theory and Computation Springer Singapore, 2018, pp. 91–106 DOI: 10.1007/978-981-13-2047-7˙5
  • [37] Alexander Hulpke “Representing Subgroups of Finitely Presented Groups by Quotient Subgroups” In Experimental Mathematics 10.3 A K Peters, Ltd., 2001, pp. 369–382
  • [38] Andrzej Jura “Coset enumeration in a finitely presented semigroup” In Canad. Math. Bull. 21.1, 1978, pp. 37–46
  • [39] Andrzej Jura “Determining ideals of a given finite index in a finitely presented semigroup” In Demonstratio Mathematica 11.3 De Gruyter Open, 1978, pp. 813–828
  • [40] Andrzej Jura “Some remarks on non-existence of an algorithm for finding all ideals of a given finite index in a finitely presented semigroup” In Demonstratio Mathematica 13 De Gruyter Open, 1980, pp. 573–578
  • [41] Ilya Kapovich and Alexei Myasnikov “Stallings Foldings and Subgroups of Free Groups” In Journal of Algebra 248.2, 2002, pp. 608–668 DOI: 10.1006/jabr.2001.9033
  • [42] Mati Kilp, Ulrich Knauer and Alexander V. Mikhalev “Monoids, Acts and Categories: With Applications to Wreath Products and Graphs. A Handbook for Students and Researchers” DE GRUYTER, 2000 DOI: 10.1515/9783110812909
  • [43] Donald Knuth “The Art of Computer Programming: Combinatorial Algorithms, Volume 4B” Addison-Wesley Professional, 2022
  • [44] Donald E. Knuth “Permutations, matrices, and generalized Young tableaux” In Pacific J. Math. 34, 1970, pp. 709–727 URL: http://projecteuclid.org.ezproxy.st-andrews.ac.uk/euclid.pjm/1102971948
  • [45] Alain Lascoux and Marcel-P. Schützenberger “Le monoïde plaxique” In Noncommutative structures in algebra and geometric combinatorics (Naples, 1978) 109, Quad. “Ricerca Sci.” CNR, Rome, 1981, pp. 129–156
  • [46] S.A. Linton, G. Pfeiffer, E.F. Robertson and N. Ruškuc “Groups and actions in transformation semigroups” In Mathematische Zeitschrift 228.3 Springer ScienceBusiness Media LLC, 1998, pp. 435–450 DOI: 10.1007/pl00004628
  • [47] Anatolii Ivanovich Mal’tsev “Symmetric groupoids” In Matematicheskii Sbornik 73.1 Russian Academy of Sciences, Steklov Mathematical Institute of Russian …, 1952, pp. 136–151
  • [48] Victor Maltcev “On a new approach to the dual symmetric inverse monoid X\mathscr{I}_{X}^{*} In Internat. J. Algebra Comput. 17.3, 2007, pp. 567–591 DOI: 10.1142/S0218196707003792
  • [49] Stuart Margolis and Benjamin Steinberg “On the minimal faithful degree of Rhodes semisimple semigroups” In Journal of Algebra 633 Elsevier BV, 2023, pp. 788–813 DOI: 10.1016/j.jalgebra.2023.06.032
  • [50] J… McKinsey “The Decision Problem for Some Classes of Sentences Without Quantifiers” In The Journal of Symbolic Logic 8.2 Association for Symbolic Logic, 1943, pp. 61–76 URL: http://www.jstor.org/stable/2268172
  • [51] John Meakin “One-sided congruences on inverse semigroups” In Transactions of the American Mathematical Society 206 American Mathematical Society (AMS), 1975, pp. 67–67 DOI: 10.1090/s0002-9947-1975-0369580-9
  • [52] James Mitchell and Chinmaya Nagpal and Maria Tsalakou “libsemigroups_pybind11 v0.10.1” Zenodo, 2023 DOI: 10.5281/ZENODO.7307278
  • [53] James Mitchell et al. “libsemigroups C++ library for semigroups and monoids” Zenodo, 2025 DOI: 10.5281/zenodo.1437752
  • [54] James Mitchell et al. “Semigroups package for GAP” Zenodo, 2023 DOI: 10.5281/zenodo.592893
  • [55] J. Neubüser “An elementary introduction to coset table methods in computational group theory” In Groups - St Andrews 1981, London Mathematical Society Lecture Notes Series Cambridge University Press, 1982, pp. 1–45 DOI: 10.1017/CBO9780511661884.004
  • [56] Daphne Norton “Algorithms for testing equivalence of finite automata, with a grading tool for JFLAP”, 2009
  • [57] OEIS Foundation Inc. “The On-Line Encyclopedia of Integer Sequences” Published electronically at http://oeis.org, 2024
  • [58] Rui Barradas Pereira “The CREAM GAP Package - Algebra CongRuences, Endomorphisms and AutomorphisMs”, 2022 URL: https://gitlab.com/rmbper/cream
  • [59] Jean-Éric Pin “Mathematical Foundations of Automata Theory” Université Paris Laboratoire d’Informatique Algorithmique: Fondements et Applications, 2022 URL: https://www.irif.fr/~jep/PDF/MPRI/MPRI.pdf
  • [60] Emmanuel Rauzy “Computability of finite quotients of finitely generated groups” In Journal of Group Theory 25.2 Walter de Gruyter GmbH, 2021, pp. 217–246 DOI: 10.1515/jgth-2020-0029
  • [61] N. Ruškuc and R.M. Thomas “Syntactic and Rees Indices of Subsemigroups” In Journal of Algebra 205.2, 1998, pp. 435–450 DOI: https://doi.org/10.1006/jabr.1997.7392
  • [62] Nikola Ruškuc “Semigroup presentations”, 1995 URL: https://hdl.handle.net/10023/2821
  • [63] Boris M. Schein “The Minimal Degree of a Finite Inverse Semigroup” In Transactions of the American Mathematical Society 333.2 American Mathematical Society, 1992, pp. 877–888 URL: http://www.jstor.org/stable/2154068
  • [64] Ákos Seress “Permutation group algorithms” 152, Cambridge Tracts in Mathematics Cambridge: Cambridge University Press, 2003, pp. x+264 DOI: 10.1017/CBO9780511546549
  • [65] Charles C. Sims “Computation with Finitely Presented Groups”, Encyclopedia of Mathematics and its Applications Cambridge University Press, 1994 DOI: 10.1017/CBO9780511574702
  • [66] Charles C. Sims “Computation with permutation groups” In Proceedings of the second ACM symposium on Symbolic and algebraic manipulation - SYMSAC ’71 ACM Press, 1971 DOI: 10.1145/800204.806264
  • [67] Charles C. Sims “Computational methods in the study of permutation groups” In Computational Problems in Abstract Algebra Elsevier, 1970, pp. 169–183 DOI: 10.1016/b978-0-08-012975-4.50020-5
  • [68] Michael Sipser “Introduction to the Theory of Computation” Boston, MA: Course Technology, 2013
  • [69] J.. Todd and H… Coxeter “A practical method for enumerating cosets of a finite abstract group” In Proceedings of the Edinburgh Mathematical Society 5.01 Cambridge University Press (CUP), 1936, pp. 26–34 DOI: 10.1017/s0013091500008221
  • [70] Michael Torpey “Semigroup congruences : computational techniques and theoretical applications” University of St Andrews, 2019 DOI: 10.17630/10023-17350
  • [71] E.. Tully “Representation of a semigroup by transformations acting transitively on a set” In Amer. J. Math. 83, 1961, pp. 533–541
  • [72] A. Wallace “Relative ideals in semigroups, I (Faucett’s Theorem)” In Colloquium Mathematicum 9.1 Institute of Mathematics, Polish Academy of Sciences, 1962, pp. 55–61 DOI: 10.4064/cm-9-1-55-61
  • [73] A.. Wallace “Relative Ideals in Semigroups. II” In Acta Mathematica Academiae Scientiarum Hungaricae 14.1-2 Springer ScienceBusiness Media LLC, 1963, pp. 137–148 DOI: 10.1007/bf01901936
  • [74] Anthony Williams “C++ Concurrency in Action, 2E” New York, NY: Manning Publications, 2019

Appendix A Performance comparison

In this section we present some data related to the performance of the low-index congruences algorithm as implemented in libsemigroups [53] and Algorithm 7 as implemented in version 5.3.0 of Semigroups [54] for GAP [29] by the authors. We compare the performance of our implementations in libsemigroups [53] and Semigroups [54] with the algorithm from [25] implemented in CREAM [58] and with earlier versions of Semigroups [54] which do not contain the optimizations described in Section 7. It may be worth bearing in mind that the input to the algorithms implemented in CREAM [58] is the multiplication table of a semigroup or monoid, and that these multiplication tables were computed using the methods in the Semigroups [54] package. The input to the low-index algorithm is the presentation of a semigroup or monoid and the input for Algorithm 7 is a black-box multiplication monoid and a set of generators of a submonoid.

A.1 A parallel implementation of the low-index congruences algorithm

In Fig. A.1 we present some data related to the performance of the parallel implementation of the low-index congruences algorithm in libsemigroups [53]. It can be seen in Fig. A.1 that, in these examples, doubling the number of threads, more or less, halves the execution time up to 4 threads (out of 8) on the left, and 16 threads (out of 64) on the right. Although the performance continues to improve after these numbers of threads, it does not continue to halve the runtime. The degradation in performance might be a consequence of using too many resources on the host computer, or due to there being insufficient work for the threads in the chosen examples.

Refer to caption
Refer to caption
Figure A.1: Comparison of the performance of the parallel implementation of low-index congruences algorithm in libsemigroups [53] for 128 randomly chosen 2-generated 1-relation monoid presentations where the lengths of the relation words is 1010. The times, indicated by crosses, are the means of the times taken in 100 trials to compute the right congruences with up to 55 classes (inclusive). For comparison, the solid lines indicate half the time taken for corresponding computation written using the same colour. The mean number of congruences computed per presentation was 189,589189,589 (left) and 204,739204,739 (right). The graph on the left was produced using a 2021 MacBook Air with 4 cores (each with 2 threads of execution) and on the right using a cluster of 64 2.3GHz AMD Opteron 6376 cores with 512GB of RAM.

A.2 The impact of presentation length on the low-index congruences algorithm

In this section we present some experimental evidence about how the length of a presentation impacts the performance of the low-index congruences algorithm. If 𝒫=AR\mathcal{P}=\langle A\mid R\rangle is a monoid presentation, then we refer to the sum (u,v)R|u|+|v|\sum_{(u,v)\in R}|u|+|v| of the lengths of the relation words in RR as the length of 𝒫\mathcal{P}. In Fig. A.2, a comparison of the length of a presentation for the full transformation monoid T4T_{4} versus the runtime of the implementation of the low-index congruences algorithm in libsemigroups [53] is given. In Fig. 2(a), the initial input presentations were Iwahori’s presentation from [28, Theorem 9.3.1] for the full transformation monoid T4T_{4}, and a complete rewriting system for T4T_{4} output from the Froidure-Pin Algorithm [26]. Both initial presentations contain many redundant relations, these were removed 55 at a time, and the time to compute the number of left congruences of T4T_{4} with at most 1616 classes is plotted for each resulting presentation. We also attempted to perform the same computation with input Aizenstat’s presentation from [62, Ch. 3, Prop 1.7] (which has length 162162), but the computation was extremely slow.

In Fig. 2(b) and Fig. 2(c), a similar approach is taken. The initial input presentations in Fig. 2(b) and Fig. 2(c) were Fernandes’ presentations from [24, Theorems 2.6 and 2.7], respectively, and the outputs of the Froidure-Pin Algorithm [26] with the corresponding generating sets.

Refer to caption
(a) Full transformation monoid T4T_{4}.
Refer to caption
(b) Cyclic inverse monoid 𝒞10\mathcal{CI}_{10}.
Refer to caption
(c) The singular part B4S4B_{4}\setminus S_{4} of the Brauer monoid B4B_{4}.
Figure A.2: Comparison of the runtime of low-index congruences algorithm for computing the right congruences on the full transformation monoid T4T_{4} with up to 16 classes in Fig. 2(a); the right congruences on the cyclic inverse monoid 𝒞10\mathcal{CI}_{10} with at most 44 classes in Fig. 2(b) and the singular part of the Brauer monoid B4B_{4} Fig. 2(c) with index up to 66. Each value is the mean of 100100 trials.

The outcome is mixed: in all of these examples the “human” presentations provide better performance than their “non-human” counterparts; for TnT_{n} shorter means faster up to a point; for the first presentation for 𝒞n\mathcal{CI}_{n} shorter means slower; for the second presentation for 𝒞n\mathcal{CI}_{n} shorter means faster. There is only a single value for the computer generated presentation for 𝒞n\mathcal{CI}_{n} with the second generating set because it was not straightforward to find redundant relations in this presentation. It might be worth noting that although the length of this presentation is 16,000{\sim}16,000, the time taken is still considerably less than the fastest time using the first presentation.

A.3 1-sided congruences on finite monoids

In this section we present some data about the relative performance of the implementation of low-index congruences algorithm, Algorithm 7, and [25] in libsemigroups [53], Semigroups [54], and CREAM [58], respectively; see Tables B.1A.1A.2A.3, and A.4.

Again, the outcome is somewhat mixed. Generally in the examples presented in this section, the low-index congruence algorithm as implemented in libsemigroups [53] is fastest for finding all right congruences, followed by CREAM [58] for the small examples, and Algorithm 7 from Semigroups [54] for larger values. For finding only principal congruences, again CREAM [58] is faster for smaller examples, and Semigroups [54] is faster for larger examples.

Given that CREAM [58] is tool for arbitrary finite algebras of type (2m,1n)(2^{m},1^{n}) (i.e. with a finite number of binary and unary operations), it might be expected that specialised algorithms (such as those in this article) for semigroups and monoids would always perform better. There are two possible reasons for this. Firstly, as mentioned above, for some examples, the number of pairs output by Algorithm 7 is more or less the same as the maximum possible number; see Fig. A.3(a), Fig. A.4(a) and Fig. A.5(a). As such running Algorithm 7 prior to finding principal congruences, and then computing the joins, can increase the overall runtime. Secondly, the implementation in CREAM [58] is written almost entirely in C, and the main loop of the corresponding implementation in Semigroups [54] is written in the interpreted GAP [29] language. Specifically, the main loops in the implementation of Algorithm 7 in Semigroups [54], and the code for determining the set of principal congruences are written in GAP [29]. The code for forming all joins in Semigroups [54] is written in C++. Interpreted languages typically incur a performance penalty when compared to compiled languages.

nn low-index Algorithm 7 Algorithm 7 + joins
mean s.d. mean s.d. mean s.d.
1 2.2×1062.2\times 10^{-6} 1.8×1061.8\times 10^{-6} 5.0×1045.0\times 10^{-4} 2.0×1042.0\times 10^{-4} 8.0×1048.0\times 10^{-4} 4.0×1044.0\times 10^{-4}
2 4.39×1064.39\times 10^{-6} 0.14×1060.14\times 10^{-6} 1.6×1041.6\times 10^{-4} 0.3×1040.3\times 10^{-4} 2.2×1042.2\times 10^{-4} 1.1×1041.1\times 10^{-4}
3 1.3×1051.3\times 10^{-5} 0.2×1050.2\times 10^{-5} 5.8×1045.8\times 10^{-4} 0.7×1040.7\times 10^{-4} 1.0×1031.0\times 10^{-3} 0.4×1030.4\times 10^{-3}
4 9.20×1049.20\times 10^{-4} 0.10×1040.10\times 10^{-4} 5.5×1035.5\times 10^{-3} 0.8×1030.8\times 10^{-3} 1.1×1021.1\times 10^{-2} 0.2×1020.2\times 10^{-2}
5 22.500×10022.500\times 10^{0} 0.012×1000.012\times 10^{0} 7.0×1027.0\times 10^{-2} 0.6×1020.6\times 10^{-2} Exceeded available memory
6 Exceeded available time 1.23×1001.23\times 10^{0} 0.11×1000.11\times 10^{0} Exceeded available memory
7 Exceeded available time 3.0×1013.0\times 10^{1} 0.2×1010.2\times 10^{1} Exceeded available memory
Table A.1: Runtimes in seconds for the low-index congruence algorithm (1 thread); Algorithm 7; and Algorithm 7 and all joins of principal right congruences of the Catalan monoids. For the low-index congruences algorithm, the values are the means of 100100 trials using the presentation output by the Froidure-Pin Algorithm[26]. The values for Algorithm 7 (and all joins) are the means of 200200 trials.
nn principal all
mean s.d. mean s.d.
1 6×1056\times 10^{-5} 4×1054\times 10^{-5} 9.7×1059.7\times 10^{-5} 3.0×1043.0\times 10^{-4}
2 7×1057\times 10^{-5} 3×1053\times 10^{-5} 6.0×1056.0\times 10^{-5} 4.0×1054.0\times 10^{-5}
3 9×1059\times 10^{-5} 6×1056\times 10^{-5} 9.8×1059.8\times 10^{-5} 6.0×1056.0\times 10^{-5}
4 2.2×1042.2\times 10^{-4} 1.1×1041.1\times 10^{-4} 4.5×1034.5\times 10^{-3} 1.0×1031.0\times 10^{-3}
5 2.0×1032.0\times 10^{-3} 0.7×1030.7\times 10^{-3} Exceeded available memory
6 Seg. fault Seg. fault
7 Seg. fault Seg. fault
Table A.2: The means of runtimes (in seconds) for 200200 trials of CreamPrincipalCongruences and CreamAllCongruences from CREAM [58] applied to the Catalan monoids (1 thread).
nn low-index Algorithm 7 Algorithm 7 + joins
mean s.d. mean s.d. mean s.d.
1 2.2×1062.2\times 10^{-6} 1.8×1061.8\times 10^{-6} 5.0×1045.0\times 10^{-4} 2.0×1042.0\times 10^{-4} 8.0×1048.0\times 10^{-4} 4.0×1044.0\times 10^{-4}
2 5.6×1065.6\times 10^{-6} 0.8×1060.8\times 10^{-6} 1.0×1031.0\times 10^{-3} 0.2×1030.2\times 10^{-3} 1.0×1031.0\times 10^{-3} 0.2×1030.2\times 10^{-3}
3 4.9×1054.9\times 10^{-5} 0.1×1050.1\times 10^{-5} 4.31×1034.31\times 10^{-3} 0.09×1030.09\times 10^{-3} 4.6×1034.6\times 10^{-3} 0.3×1030.3\times 10^{-3}
4 3.555×1023.555\times 10^{-2} 0.009×1020.009\times 10^{-2} 3.9×1023.9\times 10^{-2} 0.5×1020.5\times 10^{-2} 5.1×1025.1\times 10^{-2} 0.5×1020.5\times 10^{-2}
5 3.364×1013.364\times 10^{1} 0.004×1010.004\times 10^{1} 5.33×1015.33\times 10^{-1} 0.08×1010.08\times 10^{-1} 2.763×1012.763\times 10^{1} 0.012×1010.012\times 10^{1}
6 Exceeded available time 9.39×1009.39\times 10^{0} 0.19×1000.19\times 10^{0} Exceeded available memory
7 Exceeded available time 2.95×1022.95\times 10^{2} - Exceeded available memory
Table A.3: Runtimes in seconds for low-index congruences algorithm (1 thread); Algorithm 7; and Algorithm 7 and all joins of principal right congruences of the monoids OnO_{n} of order preserving transformations on {1,,n}\{1,\ldots,n\}. For the low-index congruences algorithm, the values are the means of 100100 trials using the presentation from [5, Section 2] for n3n\geq 3 and using the output of the Froidure-Pin Algorithm [26] for n<3n<3. The values for Algorithm 7 (and all joins) are the means of 200200 trials.
nn principal all
mean s.d. mean s.d.
1 6×1056\times 10^{-5} 4×1054\times 10^{-5} 9.7×1059.7\times 10^{-5} 3.0×1043.0\times 10^{-4}
2 2.7×1042.7\times 10^{-4} 0.6×1040.6\times 10^{-4} 1.2×1041.2\times 10^{-4} 0.1×1040.1\times 10^{-4}
3 1.72×1041.72\times 10^{-4} 0.06×1040.06\times 10^{-4} 2.05×1042.05\times 10^{-4} 0.05×1040.05\times 10^{-4}
4 1.475×1031.475\times 10^{-3} 0.015×1030.015\times 10^{-3} 1.435×1021.435\times 10^{-2} 0.007×1020.007\times 10^{-2}
5 1.112×1011.112\times 10^{-1} 0.011×1010.011\times 10^{-1} 3.08×1013.08\times 10^{1} 0.14×1010.14\times 10^{1}
6 1.6×1011.6\times 10^{1} 0.1×1010.1\times 10^{1} Exceeded available memory
7 Seg. fault Seg. fault
Table A.4: The means of runtimes (in seconds) for 200200 trials of CreamAllPrincipalCongruences and CreamAllCongruences from CREAM [58] applied to the monoids OnO_{n} of order preserving transformations of {1,,n}\{1,\ldots,n\} (1 thread).

A.4 Low index subgroups

In this section, we compare the performance of: the implementation of the low-index congruences algorithm in libsemigroups [53]; the function LowIndexSubgroups in GAP [29]; the function permutation_reps from the C++ library 3Manifolds [15]; see Table A.5. The authors thank Derek Holt for suggesting the examples in this section. It is important to note that the implementation in libsemigroups [53] has no optimizations for groups, and that the inputs to libsemigroups [53] are monoid presentations; while the input to [15] and GAP [29] are group presentations. For details of the particular presentations used please see https://github.com/libsemigroups/libsemigroups/tree/main/benchmarks/sims.

group index subgroups 3manifolds [15] GAP [29] libsemigroups [53]
(2,3,7)(2,3,7)-triangle 5050 1,7471,747 8.94×1028.94\times 10^{-2} 4.20×1014.20\times 10^{1} 1.76×1011.76\times 10^{-1}
4-generated braid group 1212 2121 9.87×1019.87\times 10^{-1} 1.11×1001.11\times 10^{0} 2.02×1012.02\times 10^{-1}
modular group 2323 109,859109,859 3.79×1013.79\times 10^{-1} 1.26×1021.26\times 10^{2} 4.39×1014.39\times 10^{-1}
fundamental group of K11n34 77 5252 7.01×1017.01\times 10^{-1} 1.50×1001.50\times 10^{0} 1.06×1001.06\times 10^{0}
Heineken 88 33 2.26×1002.26\times 10^{0} 9.5×1019.5\times 10^{-1} 1.81×1001.81\times 10^{0}
fundamental group of K15n12345 77 4040 4.47×1014.47\times 10^{-1} 2.12×1002.12\times 10^{0} 6.33×1016.33\times 10^{-1}
fundamental group of o915405\mbox{}_{15405} 99 3838 2.10×1002.10\times 10^{0} 1.65×1001.65\times 10^{0} 1.68×1001.68\times 10^{0}
Table A.5: The time to determine subgroups up to some index for some groups. All times are in seconds. The indicated times are the mean values of between 1010 and 100100 trials. Standard deviations not included due to lack of space. Note that both 3manifolds [15] and libsemigroups [53] can be multithreaded with a corresponding decrease in the runtime. The fastest times are highlighted in green, the next fastest in orange, and the slowest in red.

A.5 2-sided congruences of finite monoids

In this section we present a comparison of the performance of computing the distinct 2-sided principal congruences of a selection of finite monoids. We compare several different versions of Semigroups [54] for GAP [29] that contain different optimisations. Semigroups [54] v3.4.1 contains none of the optimisations from the present paper, v4.0.2 uses Algorithm 7 where possible, and v5.3.0 uses Algorithm 7 and some further improvements to the code for finding distinct principal congruences. All computations in this section are single-threaded. We would have liked to include a comparison with CREAM [58] also, but unfortunately CREAM [58] suffers a segmentation fault (i.e. abnormal termination of the entire GAP [29] programme) on almost every input with more than approximately 400400 elements. This could have been circumvented, but due to time limitations, it was not. See Fig. A.3, Fig. A.4, Fig. A.5, and Table A.6.

Refer to caption
(a) The number of pairs in total and output by Algorithm 7.
Refer to caption
(b) Relative times to find distinct principal 22-sided congruences.
Figure A.3: Comparison of the performance with and without the use of Algorithm 7 for 3030 sporadic examples of semigroups and monoids with size at most 1000{\sim}1000 (1 thread).
Refer to caption
(a) The number of pairs in total and output by Algorithm 7.
Refer to caption
(b) Relative times to find distinct principal 22-sided congruences.
Figure A.4: Comparison of the performance with and without the use of Algorithm 7 for 100 random 2-generated transformation semigroups of degree 55 (1 thread).
Refer to caption
(a) The number of pairs in total and output by Algorithm 7.
Refer to caption
(b) Relative times to find distinct principal 22-sided congruences.
Figure A.5: Comparison of the performance with and without the use of Algorithm 7 for selected endomorphism monoids of graphs with 6 nodes (1 thread).
Monoid = MnM_{n} nn |Mn||M_{n}| |||\mathcal{L}| CREAM [58] Semigroups [54] libsemigroups [53]
mean s.d. mean s.d. mean s.d.
Gossip 33 1111 8484 6.0×1046.0\times 10^{-4} 1.0×1041.0\times 10^{-4} 5.2×1035.2\times 10^{-3} 0.2×1030.2\times 10^{-3} 1.87×1041.87\times 10^{-4} 0.08×1040.08\times 10^{-4}
Jones 44 1414 99 5.0×1045.0\times 10^{-4} 1.0×1041.0\times 10^{-4} 1.2×1021.2\times 10^{-2} 0.2×1020.2\times 10^{-2} 3.5×1053.5\times 10^{-5} 0.2×1050.2\times 10^{-5}
Brauer 22 33 33 3.7×1043.7\times 10^{-4} 0.6×1040.6\times 10^{-4} 2.1×1032.1\times 10^{-3} 0.4×1030.4\times 10^{-3} 3.8×1063.8\times 10^{-6} 0.4×1060.4\times 10^{-6}
Partition 22 1515 1313 4.5×1044.5\times 10^{-4} 0.8×1040.8\times 10^{-4} 6.9×1036.9\times 10^{-3} 0.9×1030.9\times 10^{-3} 3.4×1053.4\times 10^{-5} 0.5×1050.5\times 10^{-5}
Full PBR 11 1616 167167 1.4×1031.4\times 10^{-3} 0.2×1030.2\times 10^{-3} 1.2×1021.2\times 10^{-2} 0.2×1020.2\times 10^{-2} 2.73×1042.73\times 10^{-4} 0.07×1040.07\times 10^{-4}
Symmetric group 44 2424 44 1.4×1031.4\times 10^{-3} 0.3×1030.3\times 10^{-3} 4.0×1034.0\times 10^{-3} 0.3×1030.3\times 10^{-3} 5.5×1055.5\times 10^{-5} 0.8×1050.8\times 10^{-5}
Full transformation 33 2727 77 1.6×1031.6\times 10^{-3} 0.3×1030.3\times 10^{-3} 5.3×1035.3\times 10^{-3} 0.6×1030.6\times 10^{-3} 8.6×1058.6\times 10^{-5} 0.9×1050.9\times 10^{-5}
Symmetric inverse 33 3434 77 3.8×1033.8\times 10^{-3} 0.4×1030.4\times 10^{-3} 8.7×1038.7\times 10^{-3} 0.9×10 30.9\times 10^{-\ 3} 9.6×1059.6\times 10^{-5} 0.4×1050.4\times 10^{-5}
Jones 55 4242 66 7.5×1037.5\times 10^{-3} 0.2×1030.2\times 10^{-3} 9.0×1029.0\times 10^{-2} 8.0×1028.0\times 10^{-2} 3.8×1043.8\times 10^{-4} 0.1×1040.1\times 10^{-4}
Motzkin 33 5151 1010 1.5×1021.5\times 10^{-2} 0.1×1020.1\times 10^{-2} 1.4×1011.4\times 10^{-1} 0.9×1010.9\times 10^{-1} 8.2×1038.2\times 10^{-3} 0.05×1030.05\times 10^{-3}
Partial transformation 33 6464 77 3.8×1023.8\times 10^{-2} 0.1×1020.1\times 10^{-2} 2.0×1022.0\times 10^{-2} 1.0×1021.0\times 10^{-2} 1.96×1031.96\times 10^{-3} 0.02×1030.02\times 10^{-3}
Partial brauer 33 7676 1616 6.8×1026.8\times 10^{-2} 0.5×1020.5\times 10^{-2} 5.4×1025.4\times 10^{-2} 0.3×1020.3\times 10^{-2} 5.06×1035.06\times 10^{-3} 0.05×1030.05\times 10^{-3}
Brauer 44 105105 1919 2.52×1012.52\times 10^{-1} 0.06×1010.06\times 10^{-1} 2.0×1022.0\times 10^{-2} 0.1×1020.1\times 10^{-2} 4.3×1034.3\times 10^{-3} 0.1×1030.1\times 10^{-3}
Symmetric group 55 120120 33 4.60×1014.60\times 10^{-1} 0.08×1010.08\times 10^{-1} 2.9×1022.9\times 10^{-2} 0.3×1020.3\times 10^{-2} 1.27×1021.27\times 10^{-2} 0.01×1020.01\times 10^{-2}
Jones 66 132132 1010 7.14×1017.14\times 10^{-1} 0.08×1010.08\times 10^{-1} 1.001×1001.001\times 10^{0} 0.007×1000.007\times 10^{0} 6.22×1036.22\times 10^{-3} 0.03×1030.03\times 10^{-3}
Partition 33 203203 1616 4.08×1004.08\times 10^{0} 0.02×1000.02\times 10^{0} 2.7×1012.7\times 10^{-1} 0.2×1010.2\times 10^{-1} 2.82×1022.82\times 10^{-2} 0.02×1020.02\times 10^{-2}
Symmetric inverse 44 209209 1111 4.65×1004.65\times 10^{0} 0.02×1000.02\times 10^{0} 7.0×1027.0\times 10^{-2} 0.5×1020.5\times 10^{-2} 4.34×1034.34\times 10^{-3} 0.04×1030.04\times 10^{-3}
Full transformation 44 256256 1111 9.65×1009.65\times 10^{0} 0.05×1000.05\times 10^{0} 7.7×1027.7\times 10^{-2} 0.4×1020.4\times 10^{-2} 1.007×1011.007\times 10^{-1} 0.006×1010.006\times 10^{-1}
Motzkin 44 323323 1111 2.54×1012.54\times 10^{1} 0.01×1010.01\times 10^{1} 8.9×1008.9\times 10^{0} 0.1×1000.1\times 10^{0} 3.38×1013.38\times 10^{1} 0.03×1010.03\times 10^{1}
Jones 77 429429 77 8.56×1018.56\times 10^{1} 0.02×1010.02\times 10^{1} 1.72×1011.72\times 10^{1} 0.02×1010.02\times 10^{1} 1.54×1011.54\times 10^{-1} 0.02×1010.02\times 10^{-1}
Table A.6: Performance comparison of CREAM [58], the algorithm described in Section 7 as implemented in the Semigroups [54] package for GAP [29], and the algorithm described in Section 5.2 as implemented in libsemigroups [53] for computing all 2-sided congruences (1 thread). All times are in seconds, and the fastest times are highlighted in green, the next fastest in orange, and the slowest in red.

Appendix B Congruence statistics

In this appendix we provide the numbers of finite index congruences of some well-known finite and infinite finitely presented monoids in a number of tables. By searching for these numbers in the [57] and in the literature, it appears that many of them were not previously known.

nn |Cn||C_{n}| principal minimal all
1 1 0 0 1
2 2 1 0 2
3 5 8 3 11
4 14 67 6 575
5 42 641 10 5,295,135
6 132 6,790 15 ?
7 429 76,568 21 ?
nn (2n)!/(n!(n+1)!)(2n)!/(n!(n+1)!) ? (n+1)(n+2)/2(n+1)(n+2)/2? ?
A000108 OEIS OEIS OEIS
Table B.1: The numbers of principal, minimal, and all right congruences of the Catalan monoids CnC_{n} [31] for some small values of nn.
left congruences
nn |On||O_{n}| principal minimal all
1 1 0 0 1
2 3 2 1 3
3 10 18 3 31
4 35 138 6 2,634
5 126 1,055 10 6,964,196
6 462 8,234 15 ?
7 1,716 ? ? ?
nn (2n+1n+1)\binom{2n+1}{n+1} ? n(n+1)/2n(n+1)/2? ?
A001700 OEIS A253145 OEIS
right congruences
principal minimal all
0 0 1
3 3 5
18 6 25
116 10 385
853 15 37,951
6,707 21
54,494 28 ?
? n(n+1)/2n(n+1)/2? ?
OEIS A253145 OEIS
Table B.2: The numbers of principal, minimal, and all left and right congruences of the monoids OnO_{n} of order-preserving transformations of an nn-chain for some small values of nn.
left congruences
nn |ORn||OR_{n}| principal minimal all
1 1 0 0 1
2 4 3 1 4
3 17 27 3 94
4 66 222 6 32,571
5 247 1,831 10 ?
6 918 15,137 15 ?
nn (2nn)\binom{2n}{n} ? n(n+1)/2n(n+1)/2? -
A045992 OEIS OEIS OEIS
right congruences
principal minimal all
0 0 1
4 4 7
25 9 54
176 16 1,335
1,382 25 ?
11,575 36 ?
? n2n^{2}? ?
OEIS OEIS
Table B.3: The numbers of principal, minimal, and all left and right congruences of the monoids ORnOR_{n} of order-preserving or -reversing transformations of an nn-chain for some small values of nn.
left congruences
nn |POn||PO_{n}| principal minimal all
1 2 1 0 2
2 8 8 3 9
3 38 67 6 142
4 192 653 10 16,239
5 1,002 7,314 15 ?
nn 2k=0n1(n1k)(n+kk)2\sum_{k=0}^{n-1}\binom{n-1}{k}\binom{n+k}{k} ? ? ?
A002003 OEIS OEIS OEIS
right congruences
principal minimal all
1 0 2
12 6 18
172 28 10,036
2,612 120 ?
40,074 496 ?
? ? ?
OEIS OEIS OEIS
Table B.4: The numbers of principal, minimal, and all left and right congruences of the monoids POnPO_{n} of partial order-preserving transformations of an nn-chain for some small values of nn.
left congruences
nn |PORn||POR_{n}| principal minimal all
1 2 1 0 2
2 9 9 3 11
3 54 79 6 306
4 323 874 10 104,400
5 1,848 ? ? ?
nn 2|POn|(1+k=1n(nk)n)2|PO_{n}|-(1+\sum_{k=1}^{n}\binom{n}{k}n) ? ? ?
OEIS OEIS OEIS OEIS
right congruences
principal minimal all
1 0 2
13 6 23
191 28 35,598
3,195 120 ?
54,785 496 ?
? ? ?
OEIS OEIS OEIS
Table B.5: The numbers of principal, minimal, and all left and right congruences of the monoids PORnPOR_{n} of partial order-preserving or -reversing transformations of an nn-chain for some small values of nn.
nn |POIn||POI_{n}| principal minimal all
1 2 1 0 2
2 6 7 3 8
3 20 46 6 99
4 70 330 10 8,146
5 252 2,602 15 18,732,669
6 924 21,900 21 ?
nn (2nn)\binom{2n}{n} ? (n+1)(n+2)/2(n+1)(n+2)/2 -
A000984 OEIS A253145 OEIS
nn |PODIn||PODI_{n}| principal minimal all
1 2 1 0 2
2 7 8 3 10
3 30 56 6 232
4 123 453 10 64,520
5 478 4,032 15 ?
6 1,811 37,410 21 ?
nn ? (n+1)(n+2)/2(n+1)(n+2)/2 ?
OEIS OEIS OEIS OEIS
Table B.6: The numbers of principal, minimal, and all left/right congruences of the monoids POInPOI_{n} and PODInPODI_{n} of order-preserving, and order-preserving and -reversing, respectively, partial permutations of an nn-chain for some small values of nn.
nn |POPIn||POPI_{n}| principal minimal all
1 2 1 0 2
2 7 8 3 10
3 31 56 6 220
4 141 460 10 57,357
5 631 4,322 15 ?
nn ? (n+1)(n+2)/2(n+1)(n+2)/2? ?
A289719 OEIS OEIS OEIS
nn |PORIn||PORI_{n}| principal minimal all
1 2 1 0 2
2 7 8 3 10
3 34 59 6 274
4 193 506 10 188,740
5 1,036 5,347 15 ?
nn ? (n+1)(n+2)/2(n+1)(n+2)/2? ?
A289720 OEIS OEIS ?
Table B.7: The numbers of principal, minimal, and all left/right congruences of the monoids POPInPOPI_{n} and PORInPORI_{n} of orientation-preserving, and orientation-preserving or -reversing, respectively, partial permutations of an nn-chain for some small values of nn.
left congruences
nn |PTn||PT_{n}| principal minimal all
1 2 1 1 2
2 9 9 3 11
3 64 84 6 371
4 625 1,086 10 335,497
nn (n+1)n(n+1)^{n} ? n(n+1)/2n(n+1)/2? ?
A289720 OEIS OEIS ?
right congruences
principal minimal all
1 1 2
13 6 23
237 28 92,703
6,398 120 ?
? ? ?
OEIS OEIS OEIS
Table B.8: The numbers of principal, minimal, and all left and right congruences of the monoids PTnPT_{n} of all partial transformations on an nn-set.
left congruences
nn |Tn||T_{n}| principal minimal all
1 1 0 0 1
2 4 3 1 4
3 27 32 3 120
4 256 370 6 120,121
5 3,125 5,892 10 ?
nn nnn^{n} ? n(n+1)/2n(n+1)/2? ?
A000312 OEIS OEIS OEIS
right congruences
principal minimal all
0 0 1
4 4 7
44 16 287
900 64 22,069,828
28,647 256 ?
? 22n22^{2n-2} ?
OEIS OEIS OEIS
Table B.9: The numbers of principal, minimal, and all left and right congruences of the monoids TnT_{n} of all transformations on an nn-set.
nn |In||I_{n}| principal minimal all
1 2 1 1 2
2 7 8 3 10
3 34 59 6 274
4 209 516 10 195,709
5 1,546 5,667 15 ?
nn k=0n(nk)2k!\sum_{k=0}^{n}\binom{n}{k}^{2}k! ? n(n+1)/2n(n+1)/2? ?
A002720 OEIS OEIS OEIS
Table B.10: The numbers of principal, minimal, and all left and right congruences of the symmetric inverse monoids InI_{n} of all partial permutations on an nn-set.
nn |Jn||J_{n}| principal minimal all
1 1 0 0 1
2 2 1 1 2
3 5 6 3 9
4 14 30 7 79
5 42 118 15 2,157
6 132 602 29 4,326,459
7 429 2,858 105 ?
nn (2n)!/(n!(n+1)!)(2n)!/(n!(n+1)!) ? ? ?
A002720 OEIS OEIS OEIS
nn |Bn||B_{n}| principal minimal all
1 1 0 0 1
2 3 2 1 3
3 15 16 6 48
4 105 142 18 103,406
5 945 1,636 120 ?
nn (2n1)!!(2n-1)!! ? ? ?
A001147 OEIS OEIS OEIS
Table B.11: The numbers of principal, minimal, and all left and right congruences of the Jones (or Temperley-Lieb) monoids JnJ_{n} and the Brauer monoids BnB_{n} of degree nn.
nn |Mn||M_{n}| principal minimal all
1 2 1 1 2
2 9 18 6 37
3 51 188 18 15,367
4 323 2,332 66 ?
nn (2n)!/(n!(n+1)!)k=0n(2n2k)(2n)!/(n!(n+1)!)\sum_{k=0}^{n}\binom{2n}{2k} ? ? ?
A026945 OEIS OEIS OEIS
nn |In||I_{n}^{*}| principal minimal all
1 1 0 0 1
2 3 2 1 3
3 25 26 9 108
4 339 627 49 ?
nn ? ? (2n1)2(2^{n}-1)^{2}? ?
A026945 OEIS OEIS ?
Table B.12: The numbers of principal, minimal, and all left and right congruences of the Motzkin monoids MnM_{n} and the dual symmetric inverse monoids InI_{n}^{*} of degree nn.
2 3 4 5 6 7 8 9 10 11 12
1 1 1 1 1 1 1 1 1 1 1 1
2 7 15 31 63 127 255 511 1023 2047 4095 8191
3 27 102 351 1146 3627 11262 34511 105186 318627 962022 2898351
4 94 616 3346 16360 75034 330256 1414066 5940760 24627274 101123296 412378786
5 275 3126 26483 189420 1220045 7335126 42061343 233221440 1261948865 6705793626 35151482003
6 833 16914 222425 2289148 20263055 162391586 1214730797 8646767880 59332761467 396002654398
7 2307 91072 1927625 28829987 349842816 3703956326 35686022019 321211486801
8 6488 491767 36892600 995133667 17898782992 257691084789 3222193441904
9 18207 2583262 955309568 457189474269
10 52960 14222001 12834025602
11 156100 87797807
12 462271 676179934
13 1387117 7373636081
14 4330708 120976491573
15 14361633
16 51895901
17 209067418
18 955165194
19 4777286691
20 24434867465
21 114830826032
22 499062448513
Table B.13: Numbers of 2-sided congruences of the free monoids; see also [6, Appendix C] for the corresponding results in the free semigroup. The columns correspond to the number of generators and the rows to the index of the congruences, so that the value in row ii and column jj is the number of 2-sided congruences with index at most ii of the free monoid with jj-generators.
nn index 2\leq 2 index 3\leq 3 index 4\leq 4 index 5\leq 5 index 6\leq 6 index 7\leq 7 index 8\leq 8
3 29 484 6,896 103,204 1,773,360 35,874,182 849,953,461
4 67 2,794 106,264 4,795,980 278,253,841 20,855,970,290 -
5 145 14,851 1,496,113 198,996,912 37,585,675,984 - -
6 303 77,409 20,526,128 7,778,840,717 - - -
7 621 408,024 281,600,130 - - - -
8 1,259 2,201,564 - - - - -
ana_{n} 2an1+2n+32a_{n-1}+2n+3 ? ? ? ? ? ?
Table B.14: The number of left and right congruences of the Plactic monoid with nn-generators for some small values of nn.