Ends of Semigroups

We define the notion of the partial order of ends of the Cayley graph of a semigroup. We prove that the structure of the ends of a semigroup is invariant under change of finite generating set and at the same time is inherited by subsemigroups and extensions of finite Rees index. We prove an analogue of Hopf's Theorem, stating that a group has 1, 2 or infinitely many ends, for left cancellative semigroups and that the cardinality of the set of ends is invariant in subsemigroups and extension of finite Green index in left cancellative semigroups.


Introduction
The study of ends in group theory has been extensive and has had widespread influence. Stallings' Theorem characterising groups with more than one end has been used in such varied topics as distance-transitive graphs [9], groups with context-free word problem [10], pursuit-evasion problems in infinite graphs [13] and to describe accessible groups [3]. This paper follows the trend of relating geometric properties of Cayley graphs of semigroups to algebraic properties, see for example [5], [12] and [8]. We consider the notions of ends for a semigroup and try to recover some basic theorems from the theory of ends of groups.
In this paper we consider a definition for ends of digraphs introduced by Zuther in [16] and apply it to the left and right Cayley graphs of a semigroup. In [7] Jackson and Kilibarda introduce a notion of ends for semigroups which is based on the ends of the underlying undirected graph of the Cayley graph. They prove that the number of ends of a semigroup is invariant under change of finite generating set and provide examples of semigroups with n ends in the left Cayley graph and m ends in the right Cayley graph for any prescribed n, m ∈ N. We argue that although there are many ways to generalise the notion of ends to a semigroup; by preserving the notion of direction there is a greater chance of interrelating the algebraic structure and the ends.
In the remainder of this section we introduce the relevant definitions and technical results required to prove the main theorems of this paper. In Section 2, we prove that the structure of the ends of a semigroup is invariant under change of finite generating set and at the same time is inherited by subsemigroups and extensions of finite Rees index. In Section 3, we prove an analogue of Hopf's Theorem, stating that a group has 1, 2 or infinitely many ends, for left cancellative semigroups and that the cardinality of the set of ends is invariant in subsemigroups and extensions of finite Green index in left cancellative semigroups.
If Σ ⊆ Ω, then Γ ∩ (Σ × Σ) is the induced subdigraph of Γ on Σ. If Σ and Σ ′ are infinite subsets of Ω, then we write Σ ′ Σ if there exist infinitely many disjoint paths (including paths of length 0) in Γ with initial vertex belonging to Σ ′ and final vertex belonging to Σ. It is straightforward to verify that is reflexive on infinite subsets of Ω but not necessarily transitive, symmetric, or anti-symmetric. However, it was shown in [16] that if is restricted to the set of rays and anti-rays on Γ, then it is transitive, and hence a preorder. If Σ ′ Σ and Σ Σ ′ , then we write Σ ≈ Σ ′ . It follows that ≈ is an equivalence relation and induces a partial order on ≈-classes of rays and anti-rays. As such we refer to rays as being equivalent if they belong to the same ≈-class; and inequivalent otherwise. We denote this poset by ΩΓ, and we refer to ≈-classes of rays as the ends of Γ. Lemma 1.1. Let Γ be a digraph on Ω and let α = (α 0 , α 1 , . . .) be an infinite walk (or anti-walk) in Γ such that every vertex of α occurs only finitely many times. Then α contains a ray r (or anti-ray, respectively) such that r is has infinitely many disjoint paths to every infinite subset of {α 0 , α 1 , . . .} and every infinite subset of {α 0 , α 1 , . . .} has infinitely many disjoint paths to r.
Proof. We prove that α contains a ray in the case that α is a walk; an analogous argument proves that α contains an anti-ray in the case that it is an anti-walk.
By construction, if i = j, then β i and β j are disjoint and so we have infinitely many disjoint paths (contained in the β i ) from r to Σ and back, as required. Lemma 1.2. Let Γ be an out-locally finite digraph on a set X and let w 0 , w 1 , . . . be finite walks of bounded length in Γ with distinct final vertices. Then every vertex in the sequence w 0 w 1 · · · occurs only finitely many times.
Proof. Let K ∈ N be bound on the lengths of w 0 , w 1 , . . .. If a vertex v occurs in infinitely many of w 0 , w 1 , . . ., then the set B of vertices that can be reached from v by a path of length at most K contains the final vertex of w i for infinitely many i ∈ N. But the final vertices of the w i are distinct and so B is infinite, contradicting the assumption that Γ is out-locally finite. Lemma 1.3. Let Γ be an out-locally finite digraph on Ω, let Σ ⊆ Ω be infinite and let α 0 ∈ Ω such that there is a path from α 0 to every β ∈ Σ. Then there exists a ray r in Γ starting at α 0 such that Σ r.
Proof. We construct r recursively. Start by setting Σ 0 := Σ and let P 0 be a set containing precisely one path q β from α 0 to β for all β ∈ Σ 0 . Then, since α 0 has finite out-degree and there is a path in P 0 from α 0 to every β ∈ Σ 0 , there exists a vertex γ 0 such that (α 0 , γ 0 ) ∈ Γ and there is a path q β ∈ P 0 from α 0 via γ 0 to every β in the infinite subset Σ 1 ⊆ Σ 0 .
Let P 1 = {q β ∈ P 0 : β ∈ Σ 1 }. If β ∈ Σ 1 is arbitrary and q β ∈ P 1 , then there exists i(β) ∈ N such that δ i(β) is the last vertex belonging to both the paths p 1 and q β . The number i(β) exists since, in particular, both paths go through γ 0 . By the pigeonhole principle, there exists m ∈ N such that 2 ≤ m ≤ n and Σ 2 = {β ∈ Σ 1 : i(β) = m} is infinite. Set α 1 = δ m . Since m ≥ 2, α 1 = α 0 and, by construction, there is a path from α 1 to every element β of the infinite set Σ 2 (consisting of the vertices between α 1 and β in q β ∈ P 1 ) such that the only vertex in p 1 and this path is α 1 . Set P 2 to the set of paths from α to β ∈ Σ 2 from the previous sentence.
Hence there is a walk r containing {α i : i ∈ N} consisting of the vertices on the paths p i+1 between α i and α i+1 . In fact, by construction, the only vertex on both p i and p i+1 is α i+1 , and so the walk r is a ray. Moreover, there are infinitely many paths from r to Σ consisting of the remaining vertices on p i+1 between α i+1 and β i+1 . Again by construction the only vertex on both p i and p i+1 is α i+1 and so the paths from α i+1 ∈ r to β i+1 ∈ Σ are disjoint.

The ends of a semigroup
Throughout this section, we let S be a finitely generated semigroup and let A be any finite generating set for S. The right Cayley graph Γ r (S, A) of S with respect to A is the directed graph with vertex set S and edges (s, sa) ∈ Γ r (S, A) for all s ∈ S and for all a ∈ A. We refer to a as the label of the edge (s, sa). The left Cayley graph Γ l (S, A) is defined dually.
If S is a semigroup, then the dual S * of S is just the set S with multiplication * defined by x * y = yx for all x, y ∈ S. It follows directly from the definition that Γ l (S, A) = Γ r (S * , A). Therefore to understand the end structure of a semigroup it suffices to study right Cayley graphs only.
We require the following lemma to prove the results in this section.
Lemma 2.1. Let S be a semigroup, let T be a subsemigroup of S generated by a finite set A, and let s ∈ S. Suppose that | T, s \ T | = n ∈ N. Then there exists N ∈ N such that for all b 1 , b 2 , . . . , b n ∈ A ∪ {s} if s, sb 1 , . . . , sb 1 · · · b n are distinct, then there exists i ≤ n and a 1 , a 2 , . . . , a j ∈ A such that j ≤ N and sb 1 · · · b i = a 1 · · · a j .
Proof. Let X := {sc 1 c 2 . . . c i ∈ T : c j ∈ A ∪ {s}, 1 ≤ i ≤ n}. Then X is finite and so there exists N ∈ N such that every element of X can be given as a product of elements of A of length at most N . By the pigeonhole principle, there exists i such that sb 1 · · · b i ∈ T and hence sb 1 · · · b i ∈ X. It follows that there exist a 1 , . . . , a j ∈ A such that j ≤ N and sb 1 · · · b i = a 1 · · · a j , as required.

Proposition 2.2. Let S be a semigroup, let T be a subsemigroup of S generated by a finite set
Proof. For the sake of brevity, we denote Γ r ( T, s , A∪{s}) by Γ. We use to denote the preorder defined above on the rays and anti-rays of Γ. We prove the proposition in two steps. The first step is to show that every ray or anti-ray in Γ is equivalent to a ray or anti-ray with vertices in T and edges labelled by elements of A. The second step is to show that if r and r ′ are rays or anti-rays with vertices in T , edges labelled by elements of A, and r r ′ , then there exist infinitely many disjoint paths from r ′ to r with edges labelled by elements of A. So, the first step ensures that every end ω of Γ, contains a ray or anti-ray r ω with vertices in T and edges labelled by elements of A. The second step implies that the mapping Ψ : ΩΓ −→ ΩΓ r (T, A) defined so that Ψ(ω) equals the end of ΩΓ r (T, A) containing r ω is an isomorphism. We only give the proof of these steps for rays, an analogous argument can be used for anti-rays.
Let U = T, s \ T , let n = |U |, and let r = (x, xb 1 , xb 1 b 2 , . . .) be a ray in Γ for some b 1 , b 2 , . . . ∈ A ∪ {s} and x ∈ T, s . Since U is finite, only finitely many elements of r can lie in U , and so we may assume without loss of generality that x, xb 1 , xb 1 b 2 , . . . ∈ T . If b i = s for all i, then there is nothing to prove.
If b k is the first occurrence of s in {b 1 , b 2 , . . .}, then since the vertices of r are distinct so are the elements b k , b k b k+1 , . . . , b k b k+1 · · · b k+n . Hence by Lemma 2.1 there exist i, N ∈ N and a 1 , a 2 , . . . , a j ∈ A such that j ≤ N and b k b k+1 · · · b k+i = sb k+1 · · · b k+i = a 1 · · · a j . Hence is a walk in Γ with vertices in T and edges labelled by elements of A. We repeatedly apply Lemma 2.1 to successive occurrences of s in {b 1 , b 2 , . . .} to obtain finite walks w 1 , w 2 , . . . with vertices in T and edges labelled by elements of A. The length of w i is bounded by N for all i ∈ N and the final vertices are distinct, and hence by Lemma 1.2 every vertex in the sequence w 0 w 1 · · · occurs only finitely many times. Let w be the walk obtained by replacing the subpaths of r by the w i . Every vertex of w not in some w i occurs only once, since r is a ray. Hence every vertex of w occurs only finitely many times, and so by Lemma 1.1 there is a subray r ′ of w such that r ≈ r ′ , as required.
For the second step of the proof, let r and r ′ be rays in Γ with vertices in T , edges labelled by elements of A, and r r ′ . Since r r ′ , there exist infinitely many disjoint paths in Γ from r ′ to r. We may assume without loss of generality that there are at least n vertices in each of these paths after the last occurrence of s as an edge label. Hence, by repeatedly applying Lemma 2.1, there exists N ∈ N and infinitely many paths from r ′ to r labelled by elements of A. Moreover, there is a path of length at most N from every element in one of the new paths to some element in the original path it was obtained from by applying Lemma 2.1. If infinitely many of these new paths are disjoint, then there is nothing to prove. Otherwise infinitely many of these paths have non-empty intersection with a finite subset of T , and so infinitely many paths contain some fixed element t ∈ T . Hence there are path of length at most N from t to infinitely many vertices in the original paths, which contradicts the out-local finiteness of Γ. Proof. It suffices to show that ΩΓ r (S, A) is isomorphic to ΩΓ r (S, A∪{s}) for any s ∈ S, since then ΩΓ r (S, A) is isomorphic to ΩΓ r (S, A ∪ B) is isomorphic to ΩΓ r (S, B), as required. Certainly S is a finitely generated subsemigroup of S such that S, s \ S is finite, and so it follows by Proposition 2.2 that ΩΓ r (S, A) is isomorphic to ΩΓ r (S, A ∪ {s}), as required.
Following from Corollary 2.3 we define ΩS = ΩΓ r (S, A) for any finite generating set A of S. We refer to ΩS as the ends of S.
Note that if S is a finitely generated group, then it follows by Hopf's Theorem [6, Satz II ] that the ends of S form an anti-chain with 1, 2, or 2 ℵ0 elements.
In section 5 we give examples of finitely generated semigroups with any finite number or ℵ 0 ends (Examples 5.5, 5.3). Any group with 2 ℵ0 group ends will also have 2 ℵ0 ends as a semigroup. It is easy to see that the free monoid on two generators will have 2 ℵ0 ends as all pairs of rays are incomparable. It is not known whether, in the absence of the Continuum Hypothesis, there exists a finitely generated semigroup S such that ΩS has κ elements where ℵ 0 < κ < 2 ℵ0 . The question of which posets can occur as the partial order of ends ΩS of some finitely generated semigroup S is unresolved.
If S is a semigroup and T is a subsemigroup of S, then the Rees index of T in S is just |S \T |+1. Proof. Since S is finitely generated, it follows by [14, Theorem 1.1], that T is finitely generated. Let A be any finite generating set for T and let s ∈ S \T be arbitrary. Then T, s \T ⊆ S \T and so T, s \T is finite. It follows from Proposition 2.2 that ΩΓ r (T, A) is isomorphic ΩΓ r ( T, s , A∪{s}), and hence ΩT is isomorphic to Ω T, s . Since T T, s ≤ S, by repeating this process (at most |S \ T | times) we have shown that ΩS is isomorphic to ΩT .

The number of ends of a left cancellative semigroup
In this section we prove that left cancellative semigroups can only have a restricted number of ends, unlike the general case (See Proposition 5.5).
A semigroup S is left cancellative if x = y whenever ax = ay where a, x, y ∈ S. Right cancellative is defined analogously. A semigroup is cancellative if it is both left and right cancellative.
A left or right cancellative monoid contains only one idempotent (the identity). A left cancellative semigroup contains at most one idempotent in every L-class, and the analogous statement holds for right cancellative semigroups. The structure of a cancellative semigroup S is straightforward to describe: either S is Rtrivial or S is a monoid with group of units G, every R-class is of the form xG, and every L-class is of the form Gx for some x ∈ S (see for example [11]). We start this section by giving an analogous description of the structure of a left cancellative semigroup. It is possible to deduce these results from [15] although they are not couched in this notation, and so we include a proof for the sake of completeness.
A right group is the direct product of a group G and right zero semigroup E. (iii) if x ∈ S has non-trivial R-class R x , then R x = xU ; (iv) if x ∈ S is arbitrary and U is non-empty, then xU is an R-class of S (not necessarily containing x).
Proof. Let x, y ∈ S and assume that xy is a regular element. It follows that there exists z ∈ S such that xyzxy = xy. By cancelling we see that yzxy = y and hence y must be a regular element. From yzxy = y we must have yzxyzx = yzx, again by cancelling we see xyzx = x and hence x is also a regular element. This means that S \ U is an ideal of S.
For the second part we assume that U is non-empty. If S contains a regular element then it contains an idempotent. Let e and f be idempotents in S. Then e 2 f = ef and f 2 e = f e and so, by cancelling, ef = f and f e = e. Thus eRf and, since every regular element is R-related to an idempotent, the regular elements of S are contained in a single R-class of S. If x and y are regular, then there exists x ′ ∈ S such that xx ′ x = x and, since yRx ′ , there exists z ∈ S such that yz = x ′ . Hence xyzxy = xx ′ xy = xy and so xy is regular. Hence, U is a subsemigroup of S and by part one S \ U is an ideal and so U is R-simple. It follows from Theorem 3.1 that U is a right group We now proof parts three and four together. Let x ∈ S and assume U is non-empty. Let e ∈ U be an idempotent. Then as all elements in U are R related xU is contained within an R-class, say R. Let y be an element of R distinct from xe. Then there exists s, t ∈ S such that xes = y and yt = xe. It follows that xest = xe and hence xestst = xest. By cancelling (st) 2 = st is an idempotent and as S \ U is an ideal s, t ∈ U . This means that R = xU . If x lies in a non-trivial R-class then there exists yRx such that y = x and there exists s, t ∈ S such that xs = y and yt = x. Then as before we see that st is an idempotent and x = xst so x ∈ xU . Proof. We show that either S is regular or (x, x 2 ) ∈ R for some x ∈ S. Suppose that (x, x 2 ) ∈ R for all x ∈ S. Then there exists s ∈ S 1 such that x 2 s = x. Hence x 2 st = xt and so (xs)t = t for all t ∈ S. Hence xs is a left identity for S and so xs is an idempotent and xRxs. Thus S is regular and so by [2, Exercise 1.11.4] has only one R-class. If there exists x ∈ S such that (x, x 2 ) ∈ R, then (x i , x j ) ∈ R for all i, j ∈ N such that i = j. Hence S has infinitely many R-classes.
Corollary 3.4. If S has infinitely many R-classes at least one of which is infinite, then it has infinitely many infinite R-classes.
Proof. Since there is at least one infinite R-class in S, that R-class is of the form yU for some y ∈ S, and |yU | = |U | by left cancellativity, it follows that U is infinite. From the proof of Lemma 3.3, there exists x ∈ S such that (x i , x j ) ∈ R for all i, j ∈ N such that i = j. By Proposition 3.2, x i U is an R-class of S for all i ∈ N and |x i U | = |U | and, in particular, x i U is infinite for all i ∈ N. It suffices to show that the sets x i U are disjoint. Suppose to the contrary that x i U ∩ x j U = ∅ for some i, j ∈ N with i < j. Then, by left cancellativity, x j−i U ∩ U = ∅ and so x j−i ∈ U since S \ U is an ideal. Therefore infinitely many powers of x, namely, x j−i , x 2j−2i , . . ., are R-related, contradicting our assumption.
Right groups are a special case of Rees matrix semigroups where |I| = 1 and the multiplication matrix P consists of identity elements. Hence as a corollary to Proposition 5.5 below we have.  If the Cayley graph of S with respect to any finite generating set contains a ray r and there is an s ∈ S such that there are paths from infinitely many points in r to s, then ΩS is infinite.
Proof. Let A be any finite generating set for S and let r = (r 0 , r 1 , . . .) be a ray in Γ r (S, A). We may write r 0 as a product a 1 · · · a n of generators in A.
Assume, seeking a contradiction, that S has finitely many ends. Since S is left cancellative, r i = (s i , s i a 1 , . . . , s i a 1 · · · a n = s i r 0 , s i r 1 , . . .) is a ray for all i ∈ N. Thus, by assumption, there exist i, j ∈ N such that i < j and r i ≈ r j . Again using the left cancellativity of S, it follows that r j−i ≈ r and so there is a path from s j−i r k to r l for some k, l ∈ N. There is a path from s to s j−i r k and hence to r l . But in this case, r l Rr l+1 R · · · and so S has an infinite R-class, which is a contradiction.
The main results of this section are given below. Proof. If S has only one R-class, then by [2, Theorem 1.27] it follows that S ∼ = G × E where G is a group and E is a right zero semigroup. Since S is finitely generated, it follows that G is finitely generated and E is finite. Hence, by Proposition 3.5, |ΩS| = |ΩG| and by Hopf's Theorem [6, Satz I], |ΩG| = 1, 2 or 2 ℵ0 .
Suppose that S has more than one R-class. Then Lemma 3.3 implies that S has infinitely many R-classes. If S contains an infinite R-class then then by Corollary 3.4 S contains infinitely many infinite R-classes. By Konig's lemma each infinite R-class contains a ray, none of these rays can be equivalent as the R-classes are distinct. Thus |ΩS| ≥ ℵ 0 .
Assume that S has no infinite R-class. Let Γ denote the Cayley group of S with respect to some finite generating set A for S. If Γ contains a ray r and there is an s ∈ S such that there are paths from infinitely many points in r to s, then ΩS is infinite by Lemma 3.6. If Γ contains an anti-ray r, then there exists a ∈ A such that infinitely many of the elements in r are of the form at for some t ∈ S. In particular, there is a path from a to every at in r and so by Lemma 1.3 there exists a ray r ′ such that r r ′ . But then there are paths from infinitely many of the vertices in r ′ to any fixed element in r, and so ΩS is infinite by Lemma 3.6.
Suppose that the Cayley graph of S does not have the property of Lemma 3.6. Seeking a contradiction assume that S has finitely many ends, and let r 1 , r 2 , . . . , r n be rays belonging in distinct ends such that the end containing r 1 is minimal with respect to . Since r i r 1 , there exists a finite F ⊆ S such that all paths from r 1 to every r i pass through F . By assumption there exists element s in r 1 such that there are no paths from s to any element of F and hence to any element in any r i . Since S is left cancellative, sr 1 and sr 2 are rays. If sr 1 ≈ r i or sr 2 ≈ r i , then there is a path from s to r i and so i = 1. In particular, sr 1 ≈ sr 2 and so, since S is left cancellative, r 1 ≈ r 2 , a contradiction. We have shown that S either has 1 or infinitely many ends.
Proof. Since S is cancellative, it is certainly left cancellative and so |ΩS| = 1, 2, or |ΩS| ≥ ℵ 0 by Theorem 3.7. If |ΩS| = 2, then from the proof of Theorem 3.7, S has only one R-class and hence is a group.
As mentioned above, it is not known what cardinalities ΩS can have, even for restricted types of semigroups such as those which are left cancellative. We prove that ΩS has cardinality 2 ℵ0 for a particular type of cancellative semigroup. Ore's Theorem (see for instance [2, Theorem 1.23]) states that if a cancellative semigroup S satisfies the condition that sS ∩ tS = ∅ for all s, t ∈ S then S can be embedded in a group. Theorem 3.9. A cancellative semigroup which cannot be embedded in a group has 2 ℵ0 ends.
Proof. Let S be a cancellative semigroup that cannot be embedded in a group. As S is not groupembeddable there exists s, t ∈ S such that sS ∩ tS = ∅. Firstly we show that all elements of {s, t} * are distinct. Let u = u 1 u 2 . . . u n , v = v 1 , v 2 . . . v m ∈ {s, t} * and assume u = S v, without loss of generality we assume the length of u is less than or equal to the length of v. If u is a prefix of v then u = v = uv ′ . It follows that v ′ is a left identity for all elements of S. The first letter of v ′ is (without loss of generality) s and hence tx = v ′ tx ∈ sS for all x ∈ S. If u is not a prefix of v then there exists a position i ≤ n such that u j = v j for all j < i but u i = v j . As u j = v j for all j < i and u = S v it follows by left-cancellativity that u i . . . u n = v i . . . v m and u i = v j , however, sS ∩ tS = ∅ a contradiction.
We now show that for u, v ∈ {s, t} * we have v ∈ uS if and only if u is a prefix of v. Clearly if u is a prefix of v then v ∈ uS. With the aim of getting a contradiction assume that u = u 1 u 2 . . . u n is not a prefix of v = v 1 v 2 . . . v m but v ∈ uS. This means there exists x ∈ S such that ux = v. As u is not a prefix of v there exists 1 ≤ i ≤ n such that u j = v j for all j < i but u i = v j . But then by left-cancellativity u i . . . u n x = S v i . . . v m . Then as {u i , v i } = {s, t} it follows that sS ∩ tS = ∅.
Combining these facts gives a copy of the free semigroup on two generators as a subsemigroup of S and there can be no paths between elements, this means S has at least 2 ℵ0 ends. This is also the maximum possible number of ends so |ΩS| = 2 ℵ0 .

Subsemigroups of finite Green index
It follows from Proposition 3.2 that if T is a subsemigroup of a left cancellative semigroup S, then R T = R V where V is the right group of regular elements of T .
Let S be a semigroup and let T be a subsemigroup of finite Green index. It was shown in [1] that S is finitely generated if and only if T is finitely generated. If T is a submonoid of a left-cancellative monoid S and T has finite Green index in S, then, since the complement is an ideal, the group of units of T has finite index in the group of units of S.

Lemma 4.1. If S = G × E is a right group, G is infinite and T is a subsemigroup of finite Green index then T = H × E is a right group where H is of finite index in G.
Proof. One can see S has only one R S -class, therefore the H S -classes of S are the L S -classes of S. As (g, e) · (h, f ) = (gh, f ) we see that L S -classes are of the form G × {e} for each e ∈ E.
If T contains no elements of the form (g, e) for some fixed e ∈ E then the R T -class of each (h, e) must be trivial. This follows as (h, e)(g, f ) can only be of the form (hg, f ) where f = e and then there exists no element (g ′ , f ′ ) ∈ T such that (hg, f )(g ′ , f ′ ) = (h, e) as T contains no elements of the form (g, e).
For each e ∈ E we let H e be those elements h ∈ G such that (h, e) ∈ T . We now show each H e contains 1 G . Let e ∈ E. One can see H e is a subsemigroup of G as in particular (g, f )(h, e) = (gh, e) so H f H e ⊆ H e . It is easy to see that a subsemigroup of finite Rees index in G is equal to G so we may assume G \ H e is infinite. As H T -classes are contained in H S -classes and as G \ H e is infinite we must have at least one non-trivial H T -class containing distinct elements (g, e), (g ′ , e) with g, g ′ ∈ H e . As these elements are H T -related they are R T -related and hence there exists (h, f ), (h ′ , f, ) ∈ T such that (g, e)(h, f ) = (g ′ , e) and (g ′ , e)(h ′ , f ′ ) = (g, e). This means f = f ′ = e and furthermore that ghh ′ = g. It follows hh ′ = 1 G is an element of H e . Hence, H e ⊆ H f for all e, f ∈ E so H e = H f for all e, f ∈ E. We call this semigroup H.
As H × E has finite Green index in G × E it must follow that H has finite Green index in G. It was shown in [4,Corollary 34] that if H is a subsemigroup of finite index in a group G then H is a subgroup of G with finite group index.
Lemma 4.2. Let S be a semigroup generated by A and let T be a subsemigroup of S generated by B with Green index n ∈ N. If s ∈ S and a 1 , a 2 , . . . , a m+k ∈ A such that the number of R T -classes containing any of sa 1 a 2 · · · a m+1 , sa 1 a 2 · · · a m+2 , . . . , sa 1 a 2 · · · a m+k is at least n, then there exist i > m and b 1 , b 2 , . . . , b j ∈ B such that sa 1 · · · a i = b 1 · · · b j .
Proof. If sa 1 a 2 · · · a m+1 , sa 1 a 2 · · · a m+2 , . . . , sa 1 a 2 · · · a m+k contains elements from n R T -classes then sa 1 a 2 · · · a m+i is an element of T for some i. Any element of T can be expressed over B and hence there exists b 1 , b 2 . . . b j ∈ B such that sa 1 a 2 · · · a m+i = b 1 b 2 · · · b j . Proof. If S is right simple, then S ∼ = G × E for some finitely generated group G and E is a finite right zero semigroup. Since T has finite Green index in S, it follows that T ∼ = H × E where H is a subgroup of finite index in G. In other words, T is a right group and so |ΩT | = |ΩH| = |ΩG| = |ΩS| by Lemma 3.5.
Let U be the right group of regular elements in S. Since S is finitely generated, it follows that T is finitely generated. Let A and B be finite generating sets for S and T , respectively, such that B ⊆ A. Since S \ U is an ideal, U is also finitely generated. Hence, as T is also left cancellative, the right group of regular elements V of T is finitely generated. It follows by Proposition 3.2 that R T = R V , and so V has finite Green index in U .
Suppose that S has more than one R-class. Then, by Lemma 3.3, S has infinitely many Rclasses. If S has no infinite R-classes, then since R T -classes are contained in R S -classes, it follows that T has finite Rees index in S and so by Corollary 2.4, the theorem follows. We now consider the case that S has infinitely many infinite R-classes. By Proposition 3.5, U either has 1, 2, or 2 ℵ0 ends.
If U has 2 ℵ0 ends, then, since S \ U is an ideal, S has 2 ℵ0 ends. Since V has finite Green index in U and U is a right group, V has 2 ℵ0 ends and so T has 2 ℵ0 ends also.
Suppose that U has 1 or 2 ends. Then S and T have at least ℵ 0 ends, since every pair of infinite R-classes contain a pair of inequivalent rays. Let Σ(S) be the set of ends of S containing a ray that has non-empty intersection with infinitely many R S -classes. By [16,Lemma 2.8], if ω is an end of Γ r (S, A), then every ray in ω is contained in a strongly connected component or intersects infinitely many strongly connected components (but not both). Since connected components of Γ r (S, A) are precisely R S -classes, it follows that |ΩS| = max{ℵ 0 , |Σ(S)|} and |ΩT | = max{ℵ 0 , |Σ(T )|}. We conclude the proof by showing that |Σ(S)| = |Σ(T )|.
Let r be a ray or anti-ray in Γ r (S, A) that has non-empty intersection with infinitely many R Sclasses. Since every R S -class is a union of R T -classes, r has non-empty intersection with infinitely many R T -classes. Since there are only finitely many R T -classes in S \ T , we may assume without loss of generality that the elements in r are in T . Let n be the number of R T -classes in S \ T and let (xc 1 , xc 1 c 2 , . . . , xc 1 · · · c m ) be a subpath of r that has non-empty intersection with n + 1, R T -classes. By left cancellativity, the path (c 1 , c 1 c 2 , . . . , c 1 · · · c m ) has non-empty intersection with at least n + 1 R T -classes also. It follows that there exists i such that c 1 · · · c i ∈ T . Hence c 1 · · · c i is a product b 1 b 2 · · · b j of elements in the generating set B for T . Recursively replacing every such path (xc 1 , xc 1 c 2 , . . . , xc 1 · · · c i ) by the corresponding walk (xb 1 , xb 1 b 2 , . . . , xb 1 · · · b j ) we obtain a walk w = (w 0 , w 1 , . . .) in Γ r (T, B) that has non-empty intersection with infinitely many R T -classes contained in T . If i < j and w i R T w j , then w i R T w i+1 R T · · · R T w j . But w has nonempty intersection with infinitely many R T -classes and so every vertex of w occurs only finitely many times. Hence, by Lemma 1.1, w is equivalent to a ray or anti-ray in Γ r (T, B).
Let r 1 be a ray or anti-ray and let r 2 be a ray or anti-ray in Γ r (T, B) such that r 1 and r 2 have non-empty intersection with infinitely many R S -classes. If r 1 is equivalent to r 2 in Γ r (T, B), then clearly r 1 is equivalent to r 2 in Γ r (S, A). Suppose that r 1 is equivalent to r 2 in Γ r (S, A). In this case, there are infinitely many disjoint paths from r 1 to r 2 and vice versa. By repeatedly applying Lemma 4.2, there exist infinitely many paths from r 1 to r 2 labelled by elements of B. If infinitely many of these paths are disjoint, then the proof is complete. Otherwise infinitely many of these paths have non-empty intersection with a finite subset of S, and so infinitely many paths contain some fixed element s ∈ S. But then there exists a path from s to element in r 2 and a path from that vertex to an element in r 1 , and so infinitely many elements in r 1 are R S -related, a contradiction. We have shown that for all rays or anti-rays r 1 and r 2 in Γ r (T, B) such that r 1 and r 2 have non-empty intersection with infinitely many R S -classes, r 1 is equivalent to r 2 in Γ r (T, B) if and only if they are equivalent in Γ r (S, A). Therefore |Σ(S)| = |Σ(T )|, as required.

Examples
In this section we give several examples of finitely generated semigroups S and describe ΩS for these examples.
The following example shows that unlike in the groups case it is possible for a left cancellative semigroup to have ℵ 0 ends. for each i ∈ N 0 . We first note that there are no anti-rays in Γ. Any ray either contains finitely many elements in the first component of its vertices, finitely many elements in the second component of its vertices or infinitely many distinct elements in both components. In the first case as elements are eventually of the form (i, j) for some fixed i the ray is equivalent to ((i, 0), (i, 1), (i, 2), . . .). Equivalently if the ray has finitely many elements in the second component of its vertices then it will be equivalent to some ((0, i), (1, i), (2, i), . . .). In the case that the ray has infinitely many distinct elements in both components then for any element (i, j) where i < j there is a path from (i, i) to (i, j) to (j, j) and we see that the ray is equivalent to ((0, 0), (1, 0), (1, 1), (2, 1), (2, 2), . . .).
The following example demonstrates the existence of anti-rays which are not equivalent to any ray. It also shows that it is possible to have anti-rays in a semigroup with trivial R-classes.
Example 5.2. Let M be the monoid a, b|aba = b . It is easy to check that aba −→ b and b 2 a −→ ab 2 is a complete rewriting system. In a similar way to Example 5.1 we can show that this monoid has ℵ 0 ends.
The following example demonstrates that in general a subsemigroup of finite Green index may have a different number of ends from the original semigroup.   In the poset of ends of S any two elements are comparable. Either by inspection or by Theorem 4.3 we see that T also has ℵ 0 ends. However, the are no paths from Z × Z × {2} to Z × Z × {3} or vice versa and hence the ends in these components cannot be comparable.
The following proposition describes the left and right end posets of Rees matrix semigroups. As a corollary we see that for any n, m ∈ N there exists a semigroup with n left ends and m right ends.
Recall a Rees matrix semigroup M[G; I, Λ; P ] has elements I × G × Λ where G is a group and I and Λ are index sets. Multiplication is defined by (i, g, λ)(j, h, µ) = (i, gp λj h, µ) where P = (p λj ) λ∈Λ,j∈I is a |Λ| × |I| matrix over G. Proof. Let X be a finite semigroup generating set for G containing 1 G and let A = {(i, p −1 µ,j x, λ)|x ∈ X, λ, µ ∈ Λ, i, j ∈ I}. Clearly A is a finite generating set for S.
Let Γ i be the induced subgraph of Γ r (S, A) on the vertices {i} × G × Λ and let Γ i,λ be the subgraph of Γ i with vertices {i} × G × {λ} and edges with labels (i, p −1 λ,i x, λ). As (i, g, λ)(j, h, µ) = (i, gp λ,j h, µ) note that Γ r (S, A) is the disjoint union of the Γ i . This means that ΩΓ r (S, A) is n incomparable copies of ΩΓ i . As all ends in ΩG are incomparable it suffices to show that ΩΓ i is isomorphic to ΩG for all i ∈ I.
We first note that for a fixed λ ∈ Λ, Γ i,λ is isomorphic to Γ r (G, X). We now prove that any ray in Γ i is equivalent to a ray in Γ i,λ , the proof for anti-rays is analogous. Let r = ((i, g 0 , λ j0 ), (i, g 1 , λ j1 ) . . .) be a ray and let r ′ = ((i, g 0 , λ), (i, g 1 , λ) . . .) be a sequence in Γ i,λ . We show that there is an infinite walk w in Γ i,λ containing r ′ in which every vertex appears finitely often.
We construct w by concatenating the shortest paths in Γ i,λ between each (i, g k , λ) and (i, g k+1 , λ), these shortest paths exist because Γ i,λ is isomorphic to Γ(G, X). Next we show that there is a global bound on the lengths of these shortest paths. If (i, g, µ) = (i, h, ν)(j, p −1 ξ,k x, π) then it follows µ = π and g = hp ν,j p −1 ξ,k x. This means the shortest path in Γ i,λ between any consecutive elements of r ′ is of length less than K = max{|p j,µ p −1 k,ν | X : j, k ∈ I, µ, ν ∈ Λ} + 1. As r is a ray it follows there are at most |Λ| repetitions of vertices in r ′ . Every vertex of w has a path of length less than K to a vertex of r ′ and as Γ i,λ is out-locally finite this means that if some vertex v appears infinitely often in w then infinitely many elements of r ′ can be reached from v by a path of length less than or equal to K. But each vertex in r ′ appears at most |Λ| times so any infinite set of elements of r ′ contains infinitely many vertices, a contradiction. By Lemma 1.1, w contains a ray s with infinitely many disjoint paths from s to and from r ′ and hence to and from r.
This means any ray in Γ i is equivalent to a ray in Γ i,λ , to complete the proof we must now verify that if we have rays r 1 and r 2 in Γ i,λ such that r 1 r 2 then r 1 r 2 in Γ i . Let r 1 and r 2 be incomparable rays in Γ i,λ , as the rays are incomparable in Γ i,λ there exists a finite set F = {(i, f 1 , λ), . . . , (i, f m , λ)} such that all paths from r 1 to r 2 in Γ i,λ pass through F . For any edge ((i, g, µ), (i, gp µ,j p −1 ν,k x, ξ)) we have a word w = x 1 x 2 . . . x p over X of minimal length such that w = G p µ,j p −1 ν,k x and a corresponding path ((i, g, µ), (i, g, λ), (i, gx 1 , λ), . . . , (i, gx 1 x 2 · · · x p , λ), (i, gp µ,j p −1 ν,k x, ξ)). This means that any path in Γ i has a corresponding walk in Γ i,λ such that any point on the walk has a path of length less than K + 2 to a vertex on the path in Γ i . This means any path π from r 1 to r 2 in Γ i has a corresponding walk in Γ i,λ and this must pass through F and hence π must be contain an element that can be reached from F by a path of length less than or equal to K + 2. As Γ i is out-locally finite there are only finitely many such elements so r 1 r 2 .