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 an infinite 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 [13], groups with context-free word problem [14], pursuit-evasion problems in infinite graphs [17] and to describe accessible groups [5]. This paper follows the trend of relating geometric properties of semigroups to algebraic properties, see for example [8,16] and [11]. We consider the notions of ends for a semigroup and try to recover some basic theorems from the theory of ends of groups. In the case of a finitely generated group, the ends of the group are defined to be the ends of the Cayley graph of G with respect to the generating set A. This definition is invariant under change of finite generating set A. For a full definition for ends of graphs see [4]. In particular, the paper will focus on generalising the following theorems for semigroups.

Theorem 1.1 [9, Satz IV] Let G be an infinite finitely generated group and let H be a subgroup of finite index. Then the number of ends of H is the same as the number of ends of G.
Theorem 1.2 [9, Satz II] An infinite finitely generated group has 1, 2 or 2 ℵ 0 ends.
In this paper we consider the definition of the ends of a digraph introduced by Zuther in [21] and apply it to the left and right Cayley graphs of a semigroup.
In [10] Jackson and Kilibarda introduce a definition for the number of ends of a semigroup. Their definition is based on the number of ends of the underlying undirected Cayley graph associated with a finitely generating semigroup. Jackson and Kilibarda 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 positive integers n and m. In a follow up paper [12] some of the authors of this paper, together with Malcev, used the definition of Jackson and Kilibarda to investigate the relationship between the number of ends when considering subsemigroups of finite index. It was demonstrated that the number of ends was invariant under taking subsemigroups of finite Rees index. Also, the number of ends was shown to be invariant under taking subsemigroups of finite Green index when restricted to the class of cancellative semigroups. These notions of index are defined later in the paper.
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 our main theorems. In Sect. 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 Sect. 3, we prove an analogue of Hopf's Theorem, stating that an infinite 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.
In this paper we will use the notation N to denote the set of positive integers and N 0 to denote the set of non-negative integers.
Let be any set and let ⊆ × . We will refer to as a digraph on , the elements of as the vertices of , and the elements of as edges. A walk in is just a (finite or infinite) sequence (v 0 , v 1 , . . .) of (not necessarily distinct) vertices such that (v i , v i+1 ) ∈ for all i. An anti-walk is a sequence (v 0 , v 1 , . . .) of (not necessarily distinct) vertices such that (v i+1 , v i ) ∈ for all i. For a walk or anti-walk α = (α 0 , α 1 , . . .) in we may write {α} for the set {α 0 , α 1 , . . .} of vertices which occur in α. A path in is just a walk consisting of distinct vertices. If α = (α 0 , α 1 , . . . , α n ) is a walk in , then the length of α is n and it is straightforward to verify that α contains a path from α 0 to α n . A ray in is just an infinite path . . , α m ) and β = (β 0 , β 1 , . . . , β n ) are arbitrary finite sequences of vertices from , then we denote by α β the sequence The out-degree of a vertex α in a digraph is just |{β ∈ : (α, β) ∈ }|. A digraph is out-locally finite if every vertex has finite out-degree.
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 [21] that if is restricted to the set of rays and anti-rays on , then it is transitive, and hence a preorder. Let r and r be rays or anti-rays. If r r and r r, then we write r ≈ r . 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 and anti-rays as being equivalent if they belong to the same ≈-class; and inequivalent otherwise. We denote this poset by , and as in [21] we refer to ≈-classes of rays and anti-rays as the ends of . Note that an equivalence class can contain both rays and anti-rays.
In this paper the direction of is the reverse of that in [21]. That is, for rays r 1 and r 2 , if there are infinitely many disjoint paths with initial vertex r 1 and final vertex in r 2 then the notation in [21] would be r 1 r 2 whereas in this paper the notation would be r 2 r 1 . The reason for this alteration is to reflect that the set of vertices that can be reached by a path from r 1 contains the set of vertices that can be reached by a path from a cofinite set of vertices of r 2 . Readers should note that by reversing the direction of the properties of anti-symmetry and transitivity are preserved.
Zuther's definition is a generalisation of the definition of ends introduced by Halin in [7]. When restricted to graphs Zuther's definition and Halin's definition coincide. The definition of ends used by Hopf in [9] is given in terms of connected components of complements of ascending sequences of compact subsets of a topological space. Initially this may appear to be quite different from the definition introduced by Zuther. However, when restricted to the case of locally finite graphs there is a natural bijection between the set of ends considered by Hopf and the equivalence classes of rays under Halin's definition. In particular, for locally finite graphs and therefore for Cayley graphs of finitely generated groups the cardinality of the set of ends under the topological and graph-theoretical definitions remain the same. For a detailed proof of this correspondence see [4,Sect. 8.5].
We finish this section with some technical results which will be needed later.

Lemma 1.3
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 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. Let a(0) = 1 and for every i ≥ 1 define a(i) = max{ j ∈ N : α j = α a(i−1) } + 1, i.e. α a(i)−1 is the last appearance of α a(i−1) in α. We will show that Hence r is an infinite walk where α a(i) = α a( j) for all i, j ∈ N such that i = j and so r is a ray.
Let be any infinite subset of {α 0 , α 1 , . . .}. If infinitely many elements in are vertices of r, then r and r. If only finitely many elements of belong to r, then \ {r} and \ {r} and so we may assume without loss of generality that contains no elements in {α a(0) , α a(1) , . . .}.
Suppose that we have defined the values b(0), . . . , b(i −1), k(0), . . . , k(i −1) ∈ N and finite walks β 0 , β 1 , . . . , β i−1 for some i ≥ 1. Choose k(i), b(i) ∈ N so that b(i) > a(k(i)), α j does not equal any vertex in any of β 0 , β 1 , . . . , β i−1 for all j > a(k(i)), and α b(i) ∈ . Then we define 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. Proof Let K ∈ N be a 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.5
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 β 1 ∈ 1 be fixed and also fix a path 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 . For each β ∈ 1 we have 2 ≤ i(β) ≤ n. If {β ∈ 1 : i(β) = m} is finite for all 2 ≤ m ≤ n then 1 would be finite. Hence, there exists m ∈ N such that 2 ≤ m ≤ n and 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.
We may repeat the above process ad infinitum to obtain for all i > 0: β i+1 ∈ 2i+1 and a path p i+1 ∈ P 2i+1 from α i to β i+1 , an α i+1 in p i+1 , an infinite 2i+2 ⊆ 2i+1 and an infinite set P 2i+2 of paths from α i+1 to every element of 2i+2 such that the only vertex in p i+1 and any path in P 2i+2 is α i+1 .
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 a 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 semigroups, 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
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 . . a j , as required.

Proposition 2.2 Let S be a semigroup, let T be a subsemigroup of S generated by a finite set A, and let s ∈ S. If T, s \ T is finite, then r (T, A) is isomorphic (as a partially ordered set) to r ( T, s , A ∪ {s}).
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 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.4 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.3 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 paths of length at most N from t to infinitely many vertices in the original paths, which contradicts the out-local finiteness of .

Corollary 2.3 Let S be a finitely generated semigroup and let A and B be any finite generating sets for S. Then r (S, A) is isomorphic (as a partially ordered set) to r (S, B).
Proof It suffices to show that , 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.
It is easy to see that adjoining an identity to a semigroup will not change the cardinality of the set of ends, ie | S| = | S 1 |. For a formal proof of this see Corollary 2.4. Hence, when considering the cardinality of the set of ends of a semigroup we may always assume that the semigroup is a monoid. In addition when considering the ends of an infinite finitely generated group G (under Zuther's definition) we have from Corollary 2.3 that for any finite semigroup generating set A for G the set of ends of Also, as the degree of each vertex in the graph is at most 2|A| the graph is locally finite. Hence, when considering the cardinality of the set of ends of a group we are justified in using Hopf's theorems.
Note that if S is an infinite finitely generated group, then it follows by Hopf's Theorem [9, Satz II] that the ends of S form an anti-chain with 1, 2, or 2 ℵ 0 elements.
In Sect. 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.

Corollary 2.4 Let S be a finitely generated semigroup and let T be a subsemigroup of S of finite Rees index. Then the partial order S of the ends of S is isomorphic to the partial order T of the ends of T .
Proof Since S is finitely generated, it follows by [18,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 the right Cayley graph of a left cancellative semigroup 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 [15]). 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 [19] 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. Proof Let x, y ∈ S and assume that x y is a regular element. It follows that there exists z ∈ S such that x yzx y = x y. By cancelling we see that yzx y = y and hence y must be a regular element. From yzx y = y we must have yzx yzx = yzx, again by cancelling we see x yzx = 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 = e f and f 2 e = f e and so, by cancelling, e f = f and f e = e. Thus eR f 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 x x x = x and, since yRx , there exists z ∈ S such that yz = x . Hence x yzx y = x x x y = x y and so x y 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 prove 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 .

Lemma 3.3 A left cancellative semigroup S has either one R-class or infinitely many R-classes.
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 [3, 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 2 j−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.

Lemma 3.6 Let S be a finitely generated left cancellative semigroup with no infinite R-classes. If the Cayley graph of S with respect to a 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 a finite generating set for S, let r = (r 0 , r 1 , . . .) be a ray in r (S, A) and let s ∈ S such that there are infinitely many paths from r to s. 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.

Theorem 3.7 Let S be an infinite finitely generated left cancellative semigroup. Then
Proof If S has only one R-class, then by [3, 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 Corollary 3.5, | S| = | G| and by Hopf's Theorem [9, 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. As S is finitely generated every vertex has finite out-degree. Let r be an element of an infinite R-class R. Then there exists a path from r to infinitely many elements of R. By Lemma 1.5, there exists a ray starting at r that has paths to infinitely many elements of R. As r ∈ R, it follows that all the elements of the ray must also be in R and hence each infinite R-class contains a ray. Furthermore, 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 graph 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.5 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.

Corollary 3.8 Let S be an infinite finitely generated cancellative semigroup that is not a group. Then
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 [3,Theorem 1.23]) states that if a cancellative semigroup S satisfies the condition that sS ∩ t S = ∅ for all s, t ∈ S then S can be embedded in a group. Theorem 3.9 A finitely generated 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 group-embeddable there exists s, t ∈ S such that sS ∩t S = ∅. 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 t x = v t x ∈ 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 ∩ t S = ∅ 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 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
In [20] Wallace introduced a generalisation of Green's relations involving subsemigroups. Let S be a semigroup, let T be a subsemigroup of S and let x, y ∈ S. We say x is R T -related to y, denoted xR T y if there exists s, t ∈ T 1 such that xs = y and yt = x. We may define L T , H T and D T analogously. As with Green's R, L, H and D relations R T , L T , H T and D T are all equivalence relations on S.
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 S. We say T is of finite Green index in S if S \ T has finitely many H T -classes. We say the Green index of T in S is the number of H T -classes in S \ T plus one.
Let S be a semigroup and let T be a subsemigroup of finite Green index. It was shown in [2] 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 of the group of units 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 = K × E is a right group where K 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 Tclass 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 ) = (k, e) as T contains no elements of the form (g, e).
For each e ∈ E we let K e be those elements g ∈ G such that (g, e) ∈ T . We now show each K e contains 1 G . Let e ∈ E. One can see K e is a subsemigroup of G as in particular (g, f )(h, e) = (gh, e) so K f K e ⊆ K e . It is easy to see that a subsemigroup of finite Rees index in G is equal to G so we may assume G \ K e is infinite. As H T -classes are contained in H S -classes and as G \ K e is infinite we must have at least one non-trivial H T -class containing distinct elements (g, e), (g , e) with g, g / ∈ K 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 K e . Hence, K e ⊆ K f for all e, f ∈ E so K e = K f for all e, f ∈ E. We call this semigroup K .
As K × E has finite Green index in G × E it must follow that K has finite Green index in G. It was shown in [6, Corollary 34] that if K is a subsemigroup of finite Green index in a group G then K is a subgroup of G with finite group index. 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 .

Theorem 4.3 Let S be an infinite finitely generated left cancellative semigroup and let T be a subsemigroup of S of finite Green index. Then | S| = | T |.
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 by Corollary 3.5 | T | = | H | and | S| = | G|. From Hopf's theorem [9, Satz IV] we know | G| = | H |, hence, | S| = | T |.
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 R-classes. 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 [21,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 strongly 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 S -classes. 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 Tclasses 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 non-empty intersection with infinitely many R T -classes and so every vertex of w occurs only finitely many times. Hence, by Lemma 1.3, 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 Mon a, b|aba = b . It is easy to check that aba −→ b and b 2 a −→ ab 2 is a complete rewriting system. For more details on rewriting systems see [1,Chapter 1]. In a similar way to Example 5.1 we can show that this monoid has ℵ 0 ends. For a diagram of a portion of the right Cayley graph see Fig. 1.  The following example demonstrates that in general a subsemigroup of finite Green index may have a different number of ends from the original semigroup.  Either by inspection or by Theorem 4.3 we see that T also has ℵ 0 ends. However, there 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 .

Proposition 5.5 If S is the Rees matrix semigroup
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 , λ j 0 ), (i, g 1 , λ j 1 ) . . .) 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 or equal to 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.3, 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, 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 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 .
Open Access This article is distributed under the terms of the Creative Commons Attribution 4.0 International License (http://creativecommons.org/licenses/by/4.0/), which permits unrestricted use, distribution, and reproduction in any medium, provided you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made.