1 Introduction and Preliminaries

In the same way that automorphisms of graphs allow to establish natural connections between graph theory and group theory, endomorphisms of graphs do the same between graph theory and semigroup theory. For this reason, it is not surprising that monoids of endomorphisms of graphs have been attracting the attention of several authors over the last decades. In fact, from combinatorial properties to more algebraic concepts have been extensively studied. Regularity, in the sense of semigroup theory, is one of the most studied notions. Regular semigroups constitute a very important class in semigroup theory. A general solution to the problem, posed in 1988 by Márki [29], of which graphs have a regular monoid of endomorphisms seems to be very difficult to obtain. Nevertheless, for some special classes of graphs, various authors studied and solved this question (for instance, see [7,8,9, 16,17,18, 20, 21, 25,26,28, 31, 32]).

In this paper, we focus our attention on a very important invariant of a semigroup or a monoid, which has been the subject of intensive research in semigroup theory. We are referring to the rank, i.e., to the least number of generators of a semigroup or a monoid S, denoted by \(\mathop {\mathrm {rank}}\nolimits (S)\).

Let \(\Omega \) be a finite set with at least 2 elements. It is well known that the full symmetric group of \(\Omega \) has rank 2 (as a semigroup, monoid or group). Furthermore, the monoid of all transformations and the monoid of all partial transformations of \(\Omega \) have ranks 3 and 4, respectively. The survey [10] presents these results and similar ones for other classes of transformation monoids, in particular, for monoids of order-preserving transformations and for some of their extensions. More recently, for instance, the papers [1,2,3, 6, 11,12,13,14,15, 23, 33, 34] are dedicated to the computation of the ranks of certain (classes of transformation) semigroups or monoids.

Now, let \(G=(V,E)\) be a simple graph (i.e., undirected, without loops and without multiple edges). Let \(\alpha \) be a full transformation of V. We say that \(\alpha \) is:

  • an endomorphism of G if \(\{u,v\}\in E\) implies \(\{u\alpha ,v\alpha \}\in E\), for all \(u,v\in V\);

  • a weak endomorphism of G if \(\{u,v\}\in E\) and \(u\alpha \ne v\alpha \) imply \(\{u\alpha ,v\alpha \}\in E\), for all \(u,v\in V\);

  • a strong endomorphism of G if \(\{u,v\}\in E\) if and only if \(\{u\alpha ,v\alpha \}\in E\), for all \(u,v\in V\);

  • a strong weak endomorphism of G if \(\{u,v\}\in E\) and \(u\alpha \ne v\alpha \) if and only if \(\{u\alpha ,v\alpha \}\in E\), for all \(u,v\in V\);

  • an automorphism of G if \(\alpha \) is a bijective strong endomorphism (i.e., \(\alpha \) is bijective and \(\alpha \) and \(\alpha ^{-1}\) are both endomorphisms). For finite graphs, any bijective endomorphism is an automorphism.

Denote by:

  • \(\mathrm {End}G\) the set of all endomorphisms of G;

  • \(\mathrm {wEnd}G\) the set of all weak endomorphisms of G;

  • \(\mathrm {sEnd}G\) the set of all strong endomorphisms of G;

  • \(\mathrm {swEnd}G\) the set of all strong weak endomorphisms of G;

  • \(\mathrm {Aut}G\) the set of all automorphisms of G.

Clearly, \(\mathrm {End}G\), \(\mathrm {wEnd}G\), \(\mathrm {sEnd}G\), \(\mathrm {swEnd}G\) and \(\mathrm {Aut}G\) are monoids under composition of maps. Moreover, \(\mathrm {Aut}G\) is also a group. It is also clear that \(\mathrm {Aut}G\subseteq \mathrm {sEnd}G\subseteq \mathrm {End}G, [\text {respectively}, \mathrm {swEnd}G] \subseteq \mathrm {wEnd}G\)

figure a

(these inclusions may not be strict).

Let \(P_n\) be the undirected path with n vertices. The number of endomorphisms of \(P_n\) has been determined by Arworn [4] (see also the paper [30] by Michels and Knauer). In addition, several other combinatorial and algebraic properties of \(P_n\) were also studied in these two papers and, for instance, in [5, 19].

Let \({\mathbb {N}}\) be the set of all natural numbers greater than zero and let

$$\begin{aligned} P_n=\left( \{1,\ldots ,n\},\{\{i,i+1\}\mid i=1,\ldots ,n-1\}\right) , \end{aligned}$$

for each \(n \in {\mathbb {N}}\). The paper deals with sets \(\{S_{in}\mid n\in {\mathbb {N}}\}\), \(i\in \{1,\ldots , 5\}\) with \(S_{1n}=\mathrm {wEnd}P_n\), \(S_{2n}=\mathrm {swEnd}P_n\), \(S_{3n}=\mathrm {End}P_n\), \(S_{4n}=\mathrm {sEnd}P_n\) and \(S_{5n}=\mathrm {Aut}P_n\). It is the aim of the present paper to determine, for each \(i \in \{1,\ldots , 5\}\), an effectively computable function \(F_{i}\) on \({\mathbb {N}}\) such that \(\mathop {\mathrm {rank}}\nolimits (S_{in})=F_{i}(n)\) for each \(n\in {\mathbb {N}}\). The main results are

  • \(\mathop {\mathrm {rank}}\nolimits (\mathrm {wEnd}P_n)=n+\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \),

  • \(\mathop {\mathrm {rank}}\nolimits (\mathrm {swEnd}P_n)=\lceil \frac{n}{2}\rceil +1\),

  • \(\mathop {\mathrm {rank}}\nolimits (\mathrm {End}P_n)=1+\lfloor \frac{n-1}{2}\rfloor +\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \),

  • \(\mathop {\mathrm {rank}}\nolimits (\mathrm {sEnd}P_n)=1\) for \(n\ne 3\), \(\mathop {\mathrm {rank}}\nolimits (\mathrm {sEnd}P_3)=3\),

  • \(\mathop {\mathrm {rank}}\nolimits (\mathrm {Aut}P_n)=1\),

for each \(n\in {\mathbb {N}}\), \(n\ge 2\).

Notice that \(P_{1}=(\{1\}, \emptyset )\). Thus, for \(n=1\), all this monoids naturally have rank equal to zero. Thereof, in what follows, we consider \(n\in {\mathbb {N}}\setminus \{1\}\).

For general background on semigroup theory and standard notation, we refer the reader to Howie’s book [22]. On the other hand, regarding algebraic graph theory, our main reference is Knauer’s book [24].

2 Basic Properties and Ranks of \(\mathbf {\mathrm {swEnd}} P_n\), \(\mathbf {\mathrm {sEnd}} P_n\) and \(\mathbf {\mathrm {Aut}} P_n\)

For integer numbers a and b, let [ab] be the set of all integers x such that \(a\le x\) and \(x\le b\). Let \({\mathcal {T}}_{n}\) be the set of all full transformations of the set [1, n].

Proposition 2.1

For each \(n\in {\mathbb {N}}\setminus \{1\}\), there hold the statements:

  1. 1.

    \(\mathrm {wEnd}P_n\) is the set of all \(\alpha \in {\mathcal {T}}_{n}\) such that \((i+1)\alpha \in \{i\alpha -1, i\alpha , i\alpha +1\}\) for each \(i\in [1,n-1]\).

  2. 2.

    \(\mathrm {End}P_n\) is the set of all \(\alpha \in {\mathcal {T}}_{n}\) such that \((i+1)\alpha \in \{i\alpha -1, i\alpha +1\}\) for each \(i\in [1,n-1]\).

Proposition 2.2

For each \(n\in {\mathbb {N}}\setminus \{1\}\), there holds the statement: If \(\alpha \in \mathrm {wEnd}P_n\) and \(u,v\in [1,n]\) then \([u,v]\alpha =[a,b]\) for some \(a,b\in [1,n]\).

Proof

Let \(\alpha \in \mathrm {wEnd}P_n\) and \(u,v \in [1,n]\). If \([u,v]=\emptyset \), then the statement holds because \([u,v]\alpha =\emptyset \), too. Now, let \([u,v]\ne \emptyset \). We define sets \(I_{k}\) with \(k\in [u,v]\), recursively: \(I_{u}={u\alpha }\), \(I_{k+1}=I_{k}\cup \{(k+1)\alpha \}\) for \(k\in [u,v-1]\). Then, \(I_{u}=[a_{u},b_{u}]\) with \(a_{u}=b_{u}=u\alpha \) and from \(I_{k}=[a_{k},b_{k}]\) (induction hypothesis) it follows that \(I_{k+1}=[a_{k+1},b_{k+1}]\) for \(k\in [u, v-1]\) as a consequence of Proposition 2.1, 1.:

  • If \((k+1)\alpha <a_{k}\), then \(I_{k+1}=[a_{k+1},b_{k+1}]\) with \(a_{k+1}=a_{k}-1\) and \(b_{k+1}=b_{k}\).

  • If \((k+1)\alpha \in [a_{k},b_{k}]\), then \(I_{k+1}=[a_{k+1},b_{k+1}]\) with \(a_{k+1}=a_{k}\) and \(b_{k+1}=b_{k}\).

  • If \(b_{k}<(k+1)\alpha \), then \(I_{k+1}=[a_{k+1},b_{k+1}]\) with \(a_{k+1}=a_{k}\) and \(b_{k+1}=b_{k}+1\).

Finally, \([u,v]\alpha =[a,b]\) with \(a=a_{v}\) and \(b=b_{v}\). \(\square \)

Next, we consider strong endomorphisms.

Theorem 2.3

\(\mathrm {Aut}P_n=\{ {1\cdots n\atopwithdelims ()1\cdots n},{1\cdots n\atopwithdelims ()n\cdots 1}\}\)(a cyclic group of order two, for each \(n\in {\mathbb {N}}\setminus \{1\}\)).

Proof

Let \(\alpha \in \mathrm {Aut}P_n\). Let \(i=1\alpha \). Then \(2\alpha \in \{i-1,i+1\}\). Since \(\alpha \) is a permutation of [1, n], if \(2\alpha =i+1\) then \(3\alpha =i+2, \ldots , (n-i+1)\alpha =n\) and so \(n-i+1=n\) (otherwise \((n-i+2)\alpha =n-1=(n-i)\alpha \), which is a contradiction), i.e., \(i=1\), whence \(\alpha ={1\cdots n\atopwithdelims ()1\cdots n}\). On the other hand, if \(2\alpha =i-1\) then \(3\alpha =i-2, \ldots , i\alpha =1\) and so \(i=n\) (otherwise \((i+1)\alpha =2=(i-1)\alpha \), which is a contradiction), whence \(\alpha ={1\cdots n\atopwithdelims ()n\cdots 1}\). \(\square \)

Theorem 2.4

\(\mathop {\mathrm {rank}}\nolimits (\mathrm {Aut}P_n)=1\) for each \(n\in {\mathbb {N}}\setminus \{1\}\).

Proof

As an outcome of Theorem 2.3, we have that \(\mathrm {Aut}P_n\) is generated by the transformation \({1\cdots n\atopwithdelims ()n\cdots 1}\). Therefore, \(\mathop {\mathrm {rank}}\nolimits (\mathrm {Aut}P_n)=1\). \(\square \)

Define \(N(u)=\{v\in V\mid \{u,v\}\in E\}\) (the neighbors of u), for all \(u\in V\), and a binary relation \(R_G\) on V by \((u,v)\in R_G\) if and only if \(N(u)=N(v)\), for all \(u,v\in V\).

Theorem 2.5

\(\mathrm {sEnd}P_n=\mathrm {Aut}P_n\), for each \(n\in {\mathbb {N}}\setminus \{1,3\}\).

Proof

For \(n\in {\mathbb {N}}\setminus \{1,3\}\), it is easy to check that the relation \(R_{P_n}\) is the identity. Hence, the assertion is as an immediate consequence of [24, Proposition 1.7.15]. \(\square \)

Observe that \(\mathrm {sEnd}P_3=\{{123\atopwithdelims ()123},{123\atopwithdelims ()321},{123\atopwithdelims ()121},{123\atopwithdelims ()212},{123\atopwithdelims ()232},{123\atopwithdelims ()323}\}\), whence \(\mathrm {Aut}P_3\subsetneq \mathrm {sEnd}P_3\).

Theorem 2.6

\(\mathop {\mathrm {rank}}\nolimits (\mathrm {sEnd}P_n)=1\) for each \(n\in {\mathbb {N}}\setminus \{1, 3\}\), \(\mathop {\mathrm {rank}}\nolimits (\mathrm {sEnd}P_3)=3\).

Proof

The first part of the statement is deduced from Theorems 2.4 and 2.5. By the observation above and some routine calculations, we have that \(\mathrm {sEnd}P_3\) can be generated by \(\{{123\atopwithdelims ()321},{123\atopwithdelims ()121},{123\atopwithdelims ()232}\}\). It is also easy to check that this set of generators have minimal cardinality. Whence, \(\mathop {\mathrm {rank}}\nolimits (\mathrm {sEnd}P_3)=3\). \(\square \)

For strong weak endomorphisms of \(P_n\), we have:

Theorem 2.7

\(\mathrm {swEnd}P_n=\{ {1\cdots n\atopwithdelims ()1\cdots n},{1\cdots n\atopwithdelims ()n\cdots 1},{1\cdots n\atopwithdelims ()1\cdots 1},\ldots ,{1\cdots n\atopwithdelims ()n\cdots n}\}\)(the automorphisms together with the constants), for each \(n\in {\mathbb {N}}\setminus \{1,3\}\).

Proof

The equality is obvious for \(n= 2\). Then, suppose that \(n\ge 4\) and let \(\alpha \in \mathrm {swEnd}P_n\setminus \mathrm {Aut}P_n\).

Let \(i,j\in [1,n]\) be such that \(i<j\) and \(i\alpha =j\alpha \) (notice that, as \(\alpha \in \mathrm {swEnd}P_n\setminus \mathrm {Aut}P_n\), such a pair of integers always exists). Let k be the largest integer such that \(0\le k\le i-1\) and \([i-k,i]\alpha =\{i\alpha \}\). If \(k<i-1\) then \(i-k-1\ge 1\) and \((i-k-1)\alpha =i\alpha \pm 1=j\alpha \pm 1\), whence \(\{(i-k-1)\alpha ,j\alpha \}\) is an edge of \(P_n\) and so \(\{i-k-1,j\}\) is also an edge of \(P_n\), which is a contradiction since \(i-k-1<j-1\). Hence, \(k=i-1\) and so \([1,i]\alpha =\{i\alpha \}\). A similar reasoning also allow us to deduce that \([j,n]\alpha =\{i\alpha \}\).

Now, take the largest integer i such that there exist an integer j such that \(1\le i<j\le n\) and \(i\alpha =j\alpha \). Then, we have \([1,i]\alpha =\{i\alpha \}=[j,n]\alpha \).

If \(i>1\) then we get \(1\le i-1<i\) and \((i-1)\alpha =i\alpha \), whence \([1,i-1]\alpha =\{i\alpha \}=[i,n]\alpha \) and so \(\alpha \) is a constant transformation.

Thus, suppose that \(i=1\). If \(j>2\) then, given the choice of i, we must have \(2\alpha =1\alpha \pm 1=n\alpha \pm 1\), whence \(\{2\alpha ,n\alpha \}\) is an edge of \(P_n\) and so \(\{2,n\}\) is also an edge of \(P_n\), which is a contradiction since \(n\ge 4\). Therefore, \(j=2\) and so \(\alpha \) is also a constant transformation, as required. \(\square \)

Theorem 2.8

\(\mathop {\mathrm {rank}}\nolimits (\mathrm {swEnd}P_n)=\lceil \frac{n}{2}\rceil +1\), for each \(n\in {\mathbb {N}}\setminus \{1\}\).

Proof

We start by noting that \(\mathrm {swEnd}P_3=\{{123\atopwithdelims ()123},{123\atopwithdelims ()321},{123\atopwithdelims ()121},{123\atopwithdelims ()212},{123\atopwithdelims ()232},{123\atopwithdelims ()323},{123\atopwithdelims ()111},{123\atopwithdelims ()222},{123\atopwithdelims ()333}\}\).

It is a routine matter to show that \(\mathrm {swEnd}P_3\) is generated by \(\left\{ {123\atopwithdelims ()321},{123\atopwithdelims ()212},{123\atopwithdelims ()111}\right\} \), and \(\mathrm {swEnd}P_n\) is generated by \(\left\{ {1\cdots n\atopwithdelims ()n\cdots 1},{1\cdots n\atopwithdelims ()1\cdots 1},\ldots , {1\;\;\cdots \;\;n\atopwithdelims ()\lceil \frac{n}{2}\rceil \cdots \lceil \frac{n}{2}\rceil }\right\} \), for \(n\ne 3\). Furthermore, it is easy to deduce that these sets of generators have minimal cardinality. \(\square \)

2.1 Regularity

Recall that an element s of a semigroup S is called regular if there exists \(x\in S\) such that \(s=sxs\). A semigroup is said to be regular if all its elements are regular.

Since \(\mathrm {Aut}G\) is a group, for any graph G, then it is, trivially, a regular monoid. By the above properties and observations, it is clear that \(\mathrm {sEnd}P_n\) and \(\mathrm {swEnd}P_n\) are also regular monoids. Regarding \(\mathrm {End}P_n\) and \(\mathrm {wEnd}P_n\), we have:

Proposition 2.9

Let \(\alpha \in \mathrm {wEnd}P_n\)[respectively, \(\alpha \in \mathrm {End}P_n\)]. Then \(\alpha \) is regular in \(\mathrm {wEnd}P_n\)[respectively, in \(\mathrm {End}P_n\)] if and only if there exists a subinterval I of [1, n] such that \(I\alpha =\mathop {\mathrm {Im}}\nolimits (\alpha )\) and \(|I|=|\mathop {\mathrm {Im}}\nolimits (\alpha )|\).

Proof

First, we suppose that \(\alpha \) is regular in \(\mathrm {wEnd}P_n\) [respectively, in \(\mathrm {End}P_n\)]. Then, there exists \(\beta \in \mathrm {wEnd}P_n\) [respectively, \(\beta \in \mathrm {End}P_n\)] such that \(\alpha =\alpha \beta \alpha \). Let \(I=\mathop {\mathrm {Im}}\nolimits (\alpha \beta )\). Then, by Proposition 2.2, I is a subinterval of [1, n]. Moreover, \(I\alpha =(\mathop {\mathrm {Im}}\nolimits (\alpha \beta ))\alpha =\mathop {\mathrm {Im}}\nolimits (\alpha \beta \alpha )=\mathop {\mathrm {Im}}\nolimits (\alpha )\). On the other hand, since \(\alpha \) and \(\alpha \beta \) are \({\mathcal {R}}\)-related, then \(\alpha \) and \(\alpha \beta \) are \({\mathcal {J}}\)-related, whence \(|\mathop {\mathrm {Im}}\nolimits (\alpha )|=|\mathop {\mathrm {Im}}\nolimits (\alpha \beta )|\) and so \(|I|=|\mathop {\mathrm {Im}}\nolimits (\alpha )|\).

Conversely, admit that there exists a subinterval I of [1, n] such that \(I\alpha =\mathop {\mathrm {Im}}\nolimits (\alpha )\) and \(|I|=|\mathop {\mathrm {Im}}\nolimits (\alpha )|\). If \(|I|=1\) then \(\alpha \) is a constant transformation (this case does not occur if \(\alpha \in \mathrm {End}P_n\)), whence \(\alpha \) is an idempotent and so \(\alpha \) is a regular element (of \(\mathrm {wEnd}P_n\)). Thus, suppose that \(|I|\ge 2\). Then \(I=[i,j]\), for some \(1\le i< j\le n\), and the restriction of the transformation \(\alpha \) to I is injective. Hence, we have \(i\alpha<\cdots <j\alpha \) or \(i\alpha>\cdots >j\alpha \) (by a reasoning similar to the proof of Theorem 2.3). Let \(\beta \) be the transformation of [1, n] defined as follows:

  1. 1.

    The restriction of \(\beta \) to \(\mathop {\mathrm {Im}}\nolimits (\alpha )\) is the inverse of the restriction of \(\alpha \) to I, i.e., \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )} = \left( \begin{array}{ccc} i\alpha &{}\cdots &{}j\alpha \\ i&{} \cdots &{} j \end{array} \right) . \)

  2. 2.

    Suppose \(i\alpha<\cdots <j\alpha \) and let \(\mathop {\mathrm {Im}}\nolimits (\alpha )^-=[1,i\alpha -1]\) and \(\mathop {\mathrm {Im}}\nolimits (\alpha )^+=[j\alpha +1,n]\).

    1. (a)

      If \(i\alpha \) is odd (and \(i\alpha \ge 3\)) then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^-}=\left( \begin{array}{ccccc} 1&{}2&{}\cdots &{}i\alpha -2&{}i\alpha -1\\ i&{}i+1&{}\cdots &{}i&{}i+1 \end{array} \right) . \)

    2. (b)

      If \(i\alpha \) is even then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^-}=\left( \begin{array}{ccccc} 1&{}2&{}\cdots &{}i\alpha -2&{}i\alpha -1\\ i+1&{}i&{}\cdots &{}i&{}i+1 \end{array} \right) . \)

    3. (c)

      If \(n-j\alpha \) is odd then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^+}=\left( \begin{array}{ccccc} j\alpha +1&{}j\alpha +2&{}\cdots &{}n-1&{}n\\ j-1&{}j&{}\cdots &{}j&{}j-1 \end{array} \right) . \)

    4. (d)

      If \(n{-}j\alpha \) is even (and \(n-j\alpha \ge 2\)) then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^+}{=}\left( \begin{array}{ccccc} j\alpha {+}1&{}j\alpha {+}2&{}\cdots &{}n{-}1&{}n\\ j{-}1&{}j&{}\cdots &{}j{-}1&{}j \end{array} \right) . \)

  3. 3.

    Suppose \(i\alpha>\cdots >j\alpha \) and let \(\mathop {\mathrm {Im}}\nolimits (\alpha )^-=[1,j\alpha -1]\) and \(\mathop {\mathrm {Im}}\nolimits (\alpha )^+=[i\alpha +1,n]\).

    1. (a)

      If \(j\alpha \) is odd (and \(j\alpha \ge 3\)) then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^-}=\left( \begin{array}{ccccc} 1&{}2&{}\cdots &{}j\alpha -2&{}j\alpha -1\\ j&{}j-1&{}\cdots &{}j&{}j-1 \end{array} \right) . \)

    2. (b)

      If \(j\alpha \) is even then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^-}=\left( \begin{array}{ccccc} 1&{}2&{}\cdots &{}j\alpha -2&{}j\alpha -1\\ j-1&{}j&{}\cdots &{}j&{}j-1 \end{array} \right) . \)

    3. (c)

      If \(n-i\alpha \) is odd then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^+}=\left( \begin{array}{ccccc} i\alpha +1&{}i\alpha +2&{}\cdots &{}n-1&{}n\\ i+1&{}i&{}\cdots &{}i&{}i+1 \end{array} \right) . \)

    4. (d)

      If \(n-i\alpha \) is even (and \(n{-}i\alpha {\ge }2\)) then \( \beta |_{\mathop {\mathrm {Im}}\nolimits (\alpha )^+}{=}\left( \begin{array}{ccccc} i\alpha +1&{}i\alpha +2&{}\cdots &{}n-1&{}n\\ i+1&{}i&{}\cdots &{}i+1&{}i \end{array} \right) . \)

It is clear that \(\beta \in \mathrm {End}P_n\) (and so \(\beta \in \mathrm {wEnd}P_n\)) and \(\alpha =\alpha \beta \alpha \). Hence, \(\alpha \) is regular, as required. \(\square \)

It is a routine matter to check that \(\mathrm {End}P_n\) is regular for \(n\le 5\), and that \(\mathrm {wEnd}P_n\) is regular for \(n\le 3\). On the other hand, by Proposition 2.9, it is clear that

$$\begin{aligned} \left( \begin{array}{cccccccc} 1&{}2&{}3&{}4&{}5&{}6&{}\cdots &{}n\\ 1&{}2&{}3&{}2&{}3&{}4&{}\cdots &{}n-2 \end{array} \right) \end{aligned}$$

is not a regular element of \(\mathrm {End}P_n\) for \(n\ge 6\), and

$$\begin{aligned} \left( \begin{array}{cccccc} 1&{}2&{}3&{}4&{}\cdots &{}n\\ 1&{}2&{}2&{}3&{}\cdots &{}n-1 \end{array} \right) \end{aligned}$$

is not a regular element of \(\mathrm {wEnd}P_n\) for \(n\ge 4\). Thus, we have:

Corollary 2.10

The monoid \(\mathrm {wEnd}P_n\)[respectively, \(\mathrm {End}P_n\)] is regular if and only if \(n\le 3\)[respectively, \(n\le 5\)].

2.2 Cardinality

It is clear that \(|\mathrm {Aut}P_1|=|\mathrm {sEnd}P_1|=|\mathrm {swEnd}P_1|=|\mathrm {End}P_1|=|\mathrm {wEnd}P_1|=1\); \(|\mathrm {Aut}P_n|=|\mathrm {sEnd}P_n|=2\), for \(n=2\) and \(n\ge 4\); \(|\mathrm {swEnd}P_n|=n+2\), for \(n=2\) and \(n\ge 4\); \(|\mathrm {Aut}P_3|=2\), \(|\mathrm {sEnd}P_3|=6\) and \(|\mathrm {swEnd}P_3|=9\).

A formula for \(|\mathrm {End}P_n|\) was given by Arworn [4] in 2009. Regarding \(|\mathrm {wEnd}P_n|\), we give a formula below.

First, we recursively define a family a(ri), with \(1\le r\le n-2\) and \(1\le i\le n-1\), of integers:

  • \(a(1,1)=a(1,2)=1\);

  • \(a(1,p)=0\), for \(3\le p\le n-1\);

  • For \(2\le k\le n-2\),

    • \(a(k,1)=a(k-1,1)+a(k-1,2)\), and

    • \(a(k,p)=a(k-1,p-1)+a(k-1,p)+a(k-1,p+1)\), for \(2\le p\le n-2\);

  • \(a(k,n-1)=0\), for \(2\le k\le n-3\);

  • \(a(n-2,n-1)=1\).

Next, let \( b(r)=2\sum _{i=1}^{n-1}a(r,i), \) for \(1\le r\le n-2\).

Then, we have:

Theorem 2.11

\(\displaystyle |\mathrm {wEnd}P_n| = 3^{n-2}(3n-2)-\sum _{r=1}^{n-2}3^{n-r-2}b(r)\) for each \(n\in {\mathbb {N}}\setminus \{1\}\), \(\displaystyle |\mathrm {wEnd}P_1|=1\).

Proof

Let \(\alpha \in \mathrm {wEnd}P_{n}\). We will mainly use the fact that \((i+1)\alpha \in \{i\alpha ,i\alpha +1\}\) if \(i\alpha =1\), \((i+1)\alpha \in \{i\alpha -1,i\alpha ,i\alpha +1\}\) if \(i\alpha \in [2,n-1]\), and \((i+1)\alpha \in \{i\alpha ,i\alpha -1\}\) if \(i\alpha =n\), for \(i\in [1 ,n-1]\). For \(i\in [1,n-1]\), let c(i) be the number of possibilities for \( \alpha |_{[1,i+1]}\). Observe that \(c(n-1)=|\mathrm {wEnd}P_n|\).

First, we calculate c(1). If \(1\alpha \in [2,n-1]\) then we have three possibilities for \(2\alpha \). On the other hand, if \(1\alpha \in \{1,n\}\) then we only have two possibilities for \(2\alpha \). This shows that \(c(1)=3(n-2)+2\cdot 2=3n-2\). Now, let \(i\in [1,n-2]\) and suppose that c(i) is known. We will show that \(c(i+1)=3c(i)-b(i)\), where b(i) denotes the number of possibilities for \((i+1)\alpha \in \{1,n\}\). In fact, if \((i+1)\alpha \in [2,n-1]\) then we have three possibilities for \((i+2)\alpha \) and, on the other hand, if \((i+1)\alpha \in \{1,n\}\) then we have only two possibilities for \((i+2)\alpha \). This shows that \(c(i+1)=3(c(i)-b(i))+2b(i)=3c(i)-b(i)\). In this setting, we deduce that \(c(n-1)=3^{n-2}(3n-2)-\sum _{r=1}^{n-2}3^{n-r-2}b(r)\), by performing successive replacements.

It remains to calculate b(r), for \(r\in [1,n-2]\).

For \(k,p\in [1,n-1]\), let a(kp) denote the number of possibilities for \((k+1)\alpha =1\) and \(1\alpha =p\). We will prove that a(kp) can be defined as above. Clearly, \(a(1,1)=a(1,2)=1\) and \(a(1,p)=0\), for \(p\in [3,n-1]\). Now, let \(k\in [2,n-2]\) and suppose that \(a(k-1,p)\) is known, for \(p\in [2,n-2]\). If \(1\alpha =1\) then \(2\alpha \in \{1,2\}\) and a(k, 1) is the number of all possibilities for \(k\alpha =1\), whenever \(1\alpha =\) 1 or \(1\alpha =2\), i.e., \(a(k,1)=a(k-1,1)+a(k-1,2)\). If \(1\alpha \in [2,n-2]\) then \(2\alpha \in \{1\alpha -1,1\alpha ,1\alpha +1\}\) and a(kp) is the number of possibilities that \(k\alpha =1\), whenever \(1\alpha =p-1\) or \(1\alpha =p\) or \(1\alpha =p+1\), i.e., \(a(k,p)=a(k-1,p-1)+a(k-1,p)+a(k-1,p+1)\). Clearly, \(a(k,n-1)=0\), whenever \(k<n-2\). Notice that \(1\alpha =n-1\) and \((n-1)\alpha =1\) implies \(r\alpha =n-1-r+1\), for \(1\le r\le n-1\). Hence, there is only one possibility for \(1\alpha =n-1\) and \((n-1)\alpha =1\), i.e., \(a(n-2,n-1)=1\). Moreover, it is clear that \(k\alpha \ne 1\), whenever \(1\alpha =n\) and \(k<n\).

Hence, for a(ri) as defined above, we have that \(\sum _{i=1}^{n-1}a(r,i)\) is the number of possibilities for \((r+1)\alpha =1\). Dually, \(\sum _{i=1}^{n-1}a(r,i)\) is also the number of possibilities for \((r+1)\alpha =n\). Therefore, \(b(r)=2\sum _{i=1}^{n-1}a(r,i)\), as required. \(\square \)

The table below gives us an idea of the size of \(\mathrm {wEnd}P_n\).

n

\(|\mathrm {wEnd}P_n|\)

1

1

2

4

3

17

4

68

5

259

6

950

7

3387

8

11814

9

40503

10

136946

11

457795

12

1515926

13

4979777

14

16246924

15

52694573

16

170028792

The formula given by Theorem 2.11 allows us to calculate the cardinal of \(\mathrm {wEnd}P_n\), even for larger n. For instance, we have \(|\mathrm {wEnd}P_{100}|=15116889835751504709361077940682197429012095346416\).

3 The Ranks of \(\mathrm {End}P_n\) and \(\mathbf {\mathrm {wEnd}} P_n\)

Let

$$\begin{aligned} \tau= & {} \left( \begin{array}{ccccc} 1&{}2&{}\cdots &{}n-1&{}n\\ n&{}n-1&{}\cdots &{}2&{}1 \end{array} \right) ,\\ \alpha _i= & {} \left( \begin{array}{ccccccccccc} 1&{}\quad 2&{}\quad \cdots &{}\quad i-1&{}\quad i&{}\quad i+1&{}\quad i+2&{}\quad \cdots &{}\quad n-1&{}\quad n\\ i+1&{}\quad i&{}\quad \cdots &{}\quad 3&{}\quad 2&{}\quad 1&{}\quad 2&{}\quad \cdots &{}\quad n-i-1&{}\quad n-i \end{array} \right) , \end{aligned}$$

for \(i=1,\ldots ,n-2\), and

$$\begin{aligned} \beta _{j,i}{=}\left( \begin{array}{ccccccccccccccc} 1&{}\;\, 2&{}\;\, \cdots &{}\;\, i&{}\;\, i+1&{}\;\, \cdots &{}\;\, i+j&{}\;\, i+j+1&{}\;\, i+j+2&{}\;\, \cdots &{}\;\, i+2j&{}\;\, i+2j+1&{}\;\, i+2j+2&{}\;\, \cdots &{}\;\, n\\ 1&{}\;\, 2&{}\;\, \cdots &{}\;\, i&{}\;\, i+1&{}\;\, \cdots &{}\;\, i+j&{}\;\, i+j+1&{}\;\, i+j&{}\;\, \cdots &{}\;\, i+2&{}\;\, i+1&{}\;\, i+2&{}\;\, \cdots &{}\;\, n-2j\end{array} \right) , \end{aligned}$$

for \(j=1,\ldots ,\lfloor \frac{n-3}{3}\rfloor \) and \(i=1,\ldots ,n-3j-2\). Let

$$\begin{aligned} A'&=\{\tau \}\cup \left\{ \alpha _i\mid i=1,\ldots ,n-2\right\} \\&\cup \left\{ \beta _{j,i}\mid j=1,\ldots ,\left\lfloor \frac{n-3}{3}\right\rfloor ,\, i=1,\ldots ,n-3j-2\right\} . \end{aligned}$$

Also, let

$$\begin{aligned} A''=\{\tau \}\cup \left\{ \alpha _i\mid i=1,\ldots ,n-2\right\} . \end{aligned}$$

Lemma 3.1

Let \(\alpha \in \mathrm {End}P_n\). Then, \(\{\alpha ' \in \mathrm {End}P_n \mid \mathop {\mathrm {Ker}}\nolimits (\alpha ') = \mathop {\mathrm {Ker}}\nolimits (\alpha )\} \subseteq \langle A'', \alpha \rangle \).

Proof

Let us suppose that

$$\begin{aligned} \alpha =\left( \begin{array}{cccc} X_1 &{}X_2&{}\cdots &{}X_k\\ i_1&{}i_2&{}\cdots &{}i_k \end{array} \right) , \end{aligned}$$

with \(\mathop {\mathrm {Im}}\nolimits (\alpha )=\{i_1<i_2<\cdots <i_k\}\) and \(X_t=i_t\alpha ^{-1}\), for \(t=1,\ldots ,k\), for some \(1<k\le n\). Since \(\mathop {\mathrm {Im}}\nolimits (\alpha )\) is a subinterval of [1, n], by Proposition 2.2, then we have \(i_t=i_1+t-1\), for \(t=2,\ldots ,k\).

Since \(x\alpha _i = x-i\), for all \(x \in [i+1, n]\), we obtain

$$\begin{aligned} \alpha \alpha _i=\left( \begin{array}{cccc} X_1&{}X_2&{}\cdots &{}X_k\\ i_1-i &{}i_2-i&{}\cdots &{}i_k-i \end{array} \right) \in \langle A'', \alpha \rangle , \end{aligned}$$

with \(\mathop {\mathrm {Im}}\nolimits (\alpha \alpha _i)=\{i_1-i<i_2-i<\cdots <i_k-i\}\), for \(i = 1,2,\ldots ,i_1-1\). Next, consider the transformation

$$\begin{aligned} \tau \alpha _i\tau =\left( \begin{array}{ccccccccc} 1&{}\quad 2&{}\quad \cdots &{}\quad n-i-1&{}\quad n-i&{}\quad n-i+1&{}\quad \cdots &{}\quad n\\ 1+i&{}\quad 2+i&{}\quad \cdots &{}\quad n-1&{}\quad n&{}\quad n-1&{}\quad \cdots &{}\quad n-i \end{array} \right) \in \langle A'' \rangle , \end{aligned}$$

for \(i = 1,2,\ldots ,n-2\). As \(x(\tau \alpha _i\tau ) = x+i\), for all \(x \in [1, n-i]\), we also get

$$\begin{aligned} \alpha \tau \alpha _i\tau =\left( \begin{array}{cccc} X_1&{}X_2&{}\cdots &{}X_k\\ i_1+i &{}i_2+i&{}\cdots &{}i_k+i \end{array} \right) \in \langle A'', \alpha \rangle , \end{aligned}$$

with \(\mathop {\mathrm {Im}}\nolimits (\alpha \tau \alpha _i\tau )=\{i_1+i<i_2+i<\cdots <i_k+i\}\), for \( i = 1,2,\ldots ,n-i_k\).

Thus, so far we proved that \(\alpha '\in \langle A'', \alpha \rangle \), for all

$$\begin{aligned} \alpha '=\left( \begin{array}{cccc} X_1 &{}X_2&{}\cdots &{}X_k\\ j_1&{}j_2&{}\cdots &{}j_k \end{array} \right) \in \mathrm {End}P_n \end{aligned}$$

such that \(\mathop {\mathrm {Im}}\nolimits (\alpha )=\{j_1<j_2<\cdots <j_k\}\) (and \(X_t=j_t\alpha ^{-1}\), for \(t=1,\ldots ,k\)).

Now, take

$$\begin{aligned} \alpha '=\left( \begin{array}{cccc} X_1 &{}X_2&{}\cdots &{}X_k\\ j_1&{}j_2&{}\cdots &{}j_k \end{array} \right) \in \mathrm {End}P_n \end{aligned}$$

such that \(\mathop {\mathrm {Ker}}\nolimits (\alpha ')=\mathop {\mathrm {Ker}}\nolimits (\alpha )\) (with \(X_t=j_t\alpha ^{-1}\), for \(t=1,\ldots ,k\)).

Suppose there exists \(p\in [1,k-1]\) such that \(| j_{p}-j_{p+1} | >1\). Let \(X^{-}=\bigcup \left\{ X_{j}\mid j\le p\right\} \). Then, as \(p<k\), we have \(X^- \subsetneq [1,n]\) and so there exists \(x\in X^{-}\) such that \(x+1\in [1,n]\setminus X^{-}\) or \(x-1\in [1,n]\setminus X^{-}\). Let us admit, without loss of generality, that \(x+1\in [1,n]\setminus X^{-}\). Let \(j\in [1,p]\) be such that \(x\in X_{j}\). Since \(\alpha \in \mathrm {End}P_{n}\) is such that \(X_t=i_t\alpha ^{-1}\) and \(i_t=i_1+t-1\), for \(t=1,\ldots ,k\), we can conclude that \(x+1\in X_{j-1}\cup X_{j+1}\) (with \(X_{j-1}=\emptyset \), if \(j=1\)). As \(x+1\not \in X^{-}\), it follows that \(x+1\in X_{j+1}\) and \(j+1>p\). Therefore \(j=p\) and so, by Proposition 2.1, we have \(1< | j_{p}-j_{p+1} | = | x\alpha '-(x+1)\alpha ' | =1\), which is a contradiction.

Thus, \(| j_{t}-j_{t+1}| =1\), for all \(t\in [1,k-1]\). This provides \(j_{1}<j_{2}<\cdots <j_{k}\) or \(j_{k}<j_{k-1}<\cdots <j_{1}\). If \(j_{1}<j_{2}<\cdots <j_{k}\) then, as proved above, we have \(\alpha '\in \left\langle A'',\alpha \right\rangle \). On the other hand, suppose that \(j_{k}<j_{k-1}<\cdots <j_{1}\) and consider

$$\begin{aligned} \alpha '\tau =\left( \begin{array}{ccccccc} X_1&{} X_2 &{}\cdots &{}X_k\\ j_1\tau &{}j_2\tau &{}\cdots &{}j_k\tau \end{array} \right) \in \mathrm {End}P_n. \end{aligned}$$

Then, as \(\tau \) is a permutation of [1, n], we obtain \(\mathop {\mathrm {Ker}}\nolimits (\alpha '\tau )=\mathop {\mathrm {Ker}}\nolimits (\alpha ')=\mathop {\mathrm {Ker}}\nolimits (\alpha )\). Furthermore, we also have \(\mathop {\mathrm {Im}}\nolimits (\alpha '\tau )=\{j_1\tau<j_2\tau<\cdots <j_k\tau \}\). Hence, again as proved above, we have \(\alpha '\tau \in \langle A'', \alpha \rangle \). Since \(\alpha '=(\alpha '\tau )\tau \), it follows that \(\alpha '\in \langle A'', \alpha \rangle \).

Thus, we proved that \(\{\alpha ' \in \mathrm {End}P_n \mid \mathop {\mathrm {Ker}}\nolimits (\alpha ') = \mathop {\mathrm {Ker}}\nolimits (\alpha )\} \subseteq \langle A'', \alpha \rangle \), as required. \(\square \)

Let \(\alpha \in \mathrm {wEnd}P_n\). We say that \(i\in [2,n-1]\) is an inversion of \(\alpha \) if \((i-1)\alpha =(i+1)\alpha \ne i\alpha \). Denote by \( \mathop {\mathrm {Inv}}\nolimits (\alpha ) \) the set of all inversions of \(\alpha \) and by \(\mathop {\mathrm {inv}}\nolimits (\alpha )\) the number of elements of \(\mathop {\mathrm {Inv}}\nolimits (\alpha )\). Notice that, if \(\alpha \in \mathrm {End}P_n\) then \(i\in [2,n-1]\) is an inversion of \(\alpha \) if and only if \((i-1)\alpha =(i+1)\alpha \).

For elements of \(\mathrm {End}P_n\), we have:

Lemma 3.2

Let \(\alpha ,\beta \in \mathrm {End}P_n\). Then \(\mathop {\mathrm {Ker}}\nolimits (\alpha )=\mathop {\mathrm {Ker}}\nolimits (\beta )\) if and only if \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\).

Proof

Clearly, \(\mathop {\mathrm {Ker}}\nolimits (\alpha ) = \mathop {\mathrm {Ker}}\nolimits (\beta ) \) implies \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\). Conversely, admit that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\). If \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )=\emptyset \) then \(\alpha , \beta \in \{1,\tau \}\) and so \(\mathop {\mathrm {Ker}}\nolimits (\alpha ) = \mathop {\mathrm {Ker}}\nolimits (\beta )\). Otherwise, let \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\{i_{1}<\cdots <i_{k}\}\), for some \(k\in [1,n-2]\), and define \(i_{0}=1\) and \(i_{k+1}=n\). For any \(x\in [1,n]\), let \(p(x)\in [0,k]\) and \(r(x)\in [0,i_{p(x)+1}-i_{p(x)}-1]\) be such that \(x=i_{p(x)}+r(x)\). Since \(\left| x\alpha -(x+1)\alpha \right| =\left| x\beta -(x+1)\beta \right| =1\), for all \(x\in [1,n-1]\), and \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\), there exist \(a_{\alpha },a_{\beta }\in \{1,2\}\) such that

$$\begin{aligned} x\alpha = 1\alpha +\underset{j=0}{\overset{p(x)-1}{\sum }}(-1)^{j+a_{\alpha }}(i_{j+1}-i_{j})+(-1)^{p(x)+a_{\alpha }}r(x) \end{aligned}$$

and

$$\begin{aligned} x\beta = 1\beta +\underset{j=0}{\overset{p(x)-1}{\sum }}(-1)^{j+a_{\beta }}(i_{j+1}-i_{j})+(-1)^{p(x)+a_{\beta }}r(x). \end{aligned}$$

Therefore, \((x,y)\in \mathop {\mathrm {Ker}}\nolimits (\alpha )\) if and only if \(x\alpha =y\alpha \) if and only if

$$\begin{aligned}&1\alpha +\underset{j=0}{\overset{p(x)-1}{\sum }}(-1)^{j+a_{\alpha }}(i_{j+1}-i_{j})+(-1)^{p(x)+a_{\alpha }}r(x) \\&\quad = 1\alpha + \underset{j=0}{\overset{p(y)-1}{\sum }}(-1)^{j+a_{\alpha }}(i_{j+1}-i_{j})+(-1)^{p(y)+a_{\alpha }}r(y) \end{aligned}$$

if and only if (by multiplication with \((-1)^{\left| a_{\alpha }-a_{\beta }\right| }\) and addition of \(1\beta {-} (1\alpha )({-}1)^{\left| a_{\alpha }{-}a_{\beta }\right| }\))

$$\begin{aligned}&1\beta + \underset{j=0}{\overset{p(x)-1}{\sum }}(-1)^{j+a_{\beta }}(i_{j+1}-i_{j})+(-1)^{p(x)+a_{\beta }}r(x) \\&\quad = 1\beta + \underset{j=0}{\overset{p(y)-1}{\sum }}(-1)^{j+a_{\beta }}(i_{j+1}-i_{j})+(-1)^{p(y)+a_{\beta }}r(y) \end{aligned}$$

if and only if \(x\beta =y\beta \) if and only if \((x,y)\in \mathop {\mathrm {Ker}}\nolimits (\beta )\). Thus, \(\mathop {\mathrm {Ker}}\nolimits (\alpha ) = \mathop {\mathrm {Ker}}\nolimits (\beta )\), as required. \(\square \)

Lemma 3.3

Let \(\alpha , \beta \in \mathrm {End}P_{n}\) be such that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\). Then \(\alpha \in \langle A''\rangle \) if and only if \(\beta \in \langle A''\rangle \). Moreover, \(\alpha \in \langle A'\rangle \) if and only if \(\beta \in \langle A'\rangle \).

Proof

Let \(\alpha , \beta \in \mathrm {End}P_{n}\) be such that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\beta )\). By Lemma 3.2, we have \(\mathop {\mathrm {Ker}}\nolimits (\alpha ) = \mathop {\mathrm {Ker}}\nolimits (\beta )\). Using Lemma 3.1, we deduce \(\beta \in \langle A'', \alpha \rangle \) and \(\alpha \in \langle A'', \beta \rangle \). Therefore, \(\alpha \in \langle A''\rangle \) if and only if \(\beta \in \langle A''\rangle \). Moreover, if \(\beta \in \langle A'\rangle \) then \(\alpha \in \langle A'', \beta \rangle \subseteq \langle A'\rangle \) and so \(\alpha \in \langle A'\rangle \). The same reasoning can be applied if \(\alpha \in \langle A'\rangle \). \(\square \)

Now, we can prove:

Lemma 3.4

\(\mathrm {End}P_n = \langle A' \rangle \).

Proof

Let \(\alpha \in \mathrm {End}P_n\). We will proceed by induction on \(\mathop {\mathrm {inv}}\nolimits (\alpha )\).

If \(\mathop {\mathrm {inv}}\nolimits (\alpha ) = 0\) then \(\alpha = \tau \in A'\) or \(\alpha = 1 = \tau ^2 \in \langle A' \rangle \).

If \(\mathop {\mathrm {inv}}\nolimits (\alpha ) = 1\) then \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\alpha _{i})\), for some \(i\in [1,n-2]\), and so \(\alpha \in \left\langle A' \right\rangle \), by Lemma 3.3.

Now, let \(r \ge 1\) and suppose, by induction hypothesis, that \(\alpha \in \langle A' \rangle \), for all \(\alpha \in \mathrm {End}P_n\) with \(\mathop {\mathrm {inv}}\nolimits (\alpha ) \le r\).

Let \(\alpha \in \mathrm {End}P_n\) be such that \(\mathop {\mathrm {inv}}\nolimits (\alpha ) = r+1\). By (the proof of) Lemma 3.1, we can assume, without loss of generality, that \(1 \in \mathop {\mathrm {Im}}\nolimits (\alpha )\). Let \(\mathop {\mathrm {Inv}}\nolimits (\alpha ) = \{i_1< i_2< \cdots < i_{r+1}\}\) and define \(i_0 = 1\) and \(i_{r+2} = n\). Let \(b = \max \mathop {\mathrm {Im}}\nolimits (\alpha )\). Notice that \(b \ge 2\) and, as \(\mathop {\mathrm {Im}}\nolimits (\alpha ) = [1, b]\) (by Proposition 2.2) and \(\mathop {\mathrm {inv}}\nolimits (\alpha ) = r + 1 \ge 2\), we get \(b \le n-2\). Clearly, we have \(1\alpha ^{-1}, b\alpha ^{-1} \subseteq \{i_\ell \mid \ell \in [0,r+2]\}\).

We will consider three cases: (1) there exists \(k \in [1,r+1]\) such that \(i_k\alpha = 1\); (2) there exists \(k \in [1,r+1]\) such that \(i_k\alpha = b\); (3) \(1\alpha = 1\) and \(n\alpha = b\) (or \(1\alpha = b\) and \(n\alpha = 1\)) and \(x\alpha \not \in \{1,b\}\), for all \(x \in [2,n-1]\).

Case 1 Suppose that there exists \(k \in [1,r+1]\) such that \(i_k\alpha = 1\). Let \(a = \max \{x\alpha \mid i_k \le x \le n\}\) and define a transformation \(\beta \) of [1, n] by

$$\begin{aligned} x\beta = \left\{ \begin{array}{ll} x\alpha +a-1,&{} \quad x < i_k\\ a+1-x\alpha , &{} \quad x \ge i_k. \end{array} \right. \end{aligned}$$

Then \(\beta \in \mathrm {End}P_n\). In fact, since \(\alpha \in \mathrm {End}P_n\), we have \(|x\beta - (x+1)\beta | = 1\), for all \(x \in [1,n-1]\setminus \{i_k-1\}\). Moreover, from \((i_k-1)\beta = (i_k-1)\alpha +a-1 = i_k\alpha \pm 1+a-1 = 1 \pm 1+a-1 = a\pm 1\) and \(i_k\beta = a+1-i_k\alpha = a+1-1 = a\) (since \(i_k\alpha = 1\)), it follows that \(|(i_k-1)\beta - i_k\beta | = 1\).

Next, we show that \(\mathop {\mathrm {Inv}}\nolimits (\beta ) = \mathop {\mathrm {Inv}}\nolimits (\alpha )\setminus \{i_{k}\}\). Clearly, if \(x\in [1,i_{k}-2] \cup [i_{k}+1,n]\) then \(x\in \mathop {\mathrm {Inv}}\nolimits (\beta )\) if and only if \(x\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\). Also

$$\begin{aligned} \begin{array}{rcl} i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\beta ) &{} \Leftrightarrow &{} (i_{k}-2)\beta =(i_{k})\beta \\ &{} \Leftrightarrow &{} (i_{k}-2)\alpha +a-1=a+1-i_{k}\alpha \\ &{} \Leftrightarrow &{} (i_{k}-2)\alpha =1=i_{k}\alpha \\ &{} \Leftrightarrow &{} i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\alpha ). \end{array} \end{aligned}$$

On the other hand, since \(i_k\alpha = 1\), we have \((i_k-1)\alpha = (i_k+1)\alpha = 2\). Then

$$\begin{aligned} (i_k-1)\beta= & {} (i_k-1)\alpha +a-1 = 2+a-1 = a+1,\\ i_k\beta= & {} a+1-i_k\alpha = a+1-1 = a \end{aligned}$$

and

$$\begin{aligned} (i_k+1)\beta = a+1-(i_k+1)\alpha = a+1-2 = a-1, \end{aligned}$$

whence \(i_k \notin \mathop {\mathrm {Inv}}\nolimits (\beta )\). Therefore, \(\mathop {\mathrm {inv}}\nolimits (\beta ) = r\) and so, by induction, we have \(\beta \in \langle A' \rangle \).

Finally, within this case, we prove that \(\mathop {\mathrm {Inv}}\nolimits (\alpha ) = \mathop {\mathrm {Inv}}\nolimits (\beta \alpha _{a-1})\). Let \(i \in \mathop {\mathrm {Inv}}\nolimits (\alpha )\cap [1,i_k-2]\). Then

$$\begin{aligned} \begin{array}{rcl} (i-1)\beta \alpha _{a-1}=(i+1)\beta \alpha _{a-1} &{} \Leftrightarrow &{} ((i-1)\alpha +a{-}1)\alpha _{a-1}{=}((i+1)\alpha +a-1)\alpha _{a-1} \\ &{} \Leftrightarrow &{} (i-1)\alpha =(i+1)\alpha \end{array} \end{aligned}$$

(by the definition of \(\alpha _{a-1}\) restricted to [an]). Let \(i \in \mathop {\mathrm {Inv}}\nolimits (\alpha )\cap [i_k+1,n]\). Then

$$\begin{aligned} \begin{array}{rcl} (i-1)\beta \alpha _{a-1}{=}(i+1)\beta \alpha _{a-1} &{} \Leftrightarrow &{} (a+1-(i-1)\alpha )\alpha _{a-1}{=}(a+1-(i+1)\alpha )\alpha _{a-1} \\ &{} \Leftrightarrow &{} (i-1)\alpha {=}(i+1)\alpha \end{array} \end{aligned}$$

(by the definition of \(\alpha _{a-1}\) restricted to [1, a]). Moreover, we have

$$\begin{aligned} (i_{k}-2)\beta \alpha _{a-1}=(i_{k})\beta \alpha _{a-1}\Leftrightarrow ((i_{k}-2)\alpha +a-1)\alpha _{a-1}=(a+1-(i_{k})\alpha )\alpha _{a-1}. \end{aligned}$$

Thereby, if \(i_{k}-1 \in \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \((i_{k}-2)\alpha =i_{k}\alpha =1\), whence \((i_{k}-2)\alpha +a-1= a = a+1-i_{k}\alpha \) and so \((i_{k}-2)\beta \alpha _{a-1}=i_{k}\beta \alpha _{a-1}\), i.e., \(i_{k}-1 \in \mathop {\mathrm {Inv}}\nolimits (\beta \alpha _{a-1})\). Conversely, if \(i_{k}-1 \notin \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \((i_{k}-2)\alpha \ne i_{k}\alpha \) and, as \((i_{k}-1)\alpha =2\), we have \((i_{k}-2)\alpha =3\), from which follows \((i_{k}-2)\beta \alpha _{a-1}=(a+2)\alpha _{a-1}=3\ne 1=i_{k}\beta \alpha _{a-1}\) and so \(i_{k}-1\notin \mathop {\mathrm {Inv}}\nolimits (\beta \alpha _{a-1})\). It remains to show that \(i_{k}\in \mathop {\mathrm {Inv}}\nolimits (\beta \alpha _{a-1})\). In fact, since \(a \in \mathop {\mathrm {Inv}}\nolimits (\alpha _{a-1})\) and \((i_{k}-1)\alpha =2=(i_{k}+1)\alpha \), we obtain

$$\begin{aligned}&(i_{k}-1)\beta \alpha _{a-1}=((i_{k}-1)\alpha +a-1)\alpha _{a-1}=(a+1)\alpha _{a-1}= (a-1)\alpha _{a-1}\\&\quad =(a+1-(i_{k}+1)\alpha )\alpha _{a-1}=(i_{k}+1)\beta \alpha _{a-1}. \end{aligned}$$

Thus, we have \(\mathop {\mathrm {Inv}}\nolimits (\alpha ) = \mathop {\mathrm {Inv}}\nolimits (\beta \alpha _{a-1})\). Since \(\beta \in \langle A' \rangle \), then \(\beta \alpha _{a-1} \in \langle A' \rangle \) and so, by Lemma 3.3, we have \(\alpha \in \langle A' \rangle \).

Case 2 Suppose now that there exists \(k \in [1,r+1]\) such that \(i_k\alpha = b\). Recall that \(\mathop {\mathrm {Im}}\nolimits (\alpha ) = [1, b]\). Consider the transformation \(\alpha \tau \alpha _{n-b} \in \mathrm {End}P_n\). Since \(\tau \) is a permutation of [1, n] and \(\alpha _{n-b}\) is injective in \([n-b+1,n] = \mathop {\mathrm {Im}}\nolimits (\alpha )\tau = \mathop {\mathrm {Im}}\nolimits (\alpha \tau )\), then \(\mathop {\mathrm {Ker}}\nolimits (\alpha \tau \alpha _{n-b}) = \mathop {\mathrm {Ker}}\nolimits (\alpha )\), i.e., \(\mathop {\mathrm {Inv}}\nolimits (\alpha \tau \alpha _{n-b}) = \mathop {\mathrm {Inv}}\nolimits (\alpha )\), by Lemma 3.2. Hence, \(\alpha \in \langle A' \rangle \) if and only if \(\alpha \tau \alpha _{n-b} \in \langle A' \rangle \), by Lemma 3.3. Observe also that \(i_k \in b\alpha ^{-1} = 1(\alpha \tau \alpha _{n-b})^{-1}\) and so, in particular, we also have \(i_k(\alpha \tau \alpha _{n-b}) = 1\), i.e., \(\alpha \tau \alpha _{n-b}\) satisfies the condition of case 1. Therefore, \(\alpha \tau \alpha _{n-b} \in \langle A' \rangle \) and so we have \(\alpha \in \langle A' \rangle \).

Case 3 Next, we suppose that \(\{1,b\}\alpha ^{-1} = \{1,n\}\). Without loss of generality, let \(1\alpha =1\) and \(n\alpha =b\) (if \(1\alpha =b\) and \(n\alpha =1\) then \(1\tau \alpha =1\), \(n\tau \alpha =b\) and, by Lemma 3.3, \(\alpha \in \langle A' \rangle \) if and only if \(\tau \alpha \in \langle A' \rangle \)).

First, let us admit that \(r=1\), i.e., \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\{i_{1},i_{2}\}\). Let \(j=i_{2}-i_{1}\) and \(i=2i_{1}-i_{2}-1\). As \(1\alpha =1\) and \(n\alpha =b\), then \(i_{1}\alpha =i_{1}\) and \(i_{2}\alpha =i_{1}-(i_{2}-i_{1})=2i_{1}-i_{2}=i+1\). In addition, from \(b-i_{2}\alpha =n-i_{2}\), we obtain

$$\begin{aligned} b=n+i_{2}\alpha -i_{2}=n+(2i_{1}-i_{2})-i_{2}=n+2i_{1}-2i_{2}=n-2j. \end{aligned}$$

As \(2 \le i_2\alpha < i_1\alpha \le b-1\), we have \(b=n-2j \ge i_{1}\alpha +1 = i_{1}+1\), whence \(i_{1}\le n-2j-1\), and \(i_{1}\alpha -i_{2}\alpha \le b-3\). Thus,

$$\begin{aligned} i=2i_{1}-i_{2}-1\le n-2j-1 + (i_{1}-i_{2})-1=n-3j-2 \end{aligned}$$

and

$$\begin{aligned} j{=}i_{2}{-}i_{1}{=}i_{1}\alpha {-}i_{2}\alpha \le b-3=n-2j-3 \quad {\Rightarrow }\quad 3j\le n-3 \quad \Rightarrow \quad j\le \left\lfloor \frac{n-3}{3}\right\rfloor . \end{aligned}$$

Therefore, we may consider \(\beta _{j,i}\in A'\) and, clearly, we have \(\alpha =\beta _{j,i}\). Hence \(\alpha \in \langle A' \rangle \).

Now, suppose that \(r > 1\). Define \(c=\max \{i_1\alpha , \ldots , i_r\alpha \}\) and let \(k \in [1,r]\) be such that \(i_k\alpha = c\). Since \(i_{r+1}\alpha <b=n\alpha \), we have \(i_{r+1}\alpha <i_r\alpha \le c\). Also, define \(d=\min \{i_{k+1}\alpha , \ldots , i_{r+1}\alpha \}\) and let \(\ell \in [k+1,r+1]\) be such that \(i_\ell \alpha = d\). Furthermore, we define a transformation \(\gamma \) of [1, n] by

$$\begin{aligned} x\gamma = \left\{ \begin{array}{ll} x\alpha , &{} \quad x < i_k\\ 2c-x\alpha , &{} \quad i_k \le x \le i_\ell \\ x\alpha + 2c-2d, &{} \quad x > i_\ell . \end{array} \right. \end{aligned}$$

Then \(\gamma \in \mathrm {End}P_n\). In fact, since \(\alpha \in \mathrm {End}P_n\), we have \(|x\gamma - (x+1)\gamma | = 1\), for all \(x \in [1,n-1]\setminus \{i_k-1, i_\ell \}\). Moreover, from \((i_k-1)\gamma = (i_k-1)\alpha = i_k\alpha - 1=c-1\) (notice that, if \((i_{k}-1)\alpha =i_k\alpha +1=(i_{k}+1)\alpha \) then, as \(1\alpha =1\), it would exist \(t\in [1,k-1]\) such that \(i_{t}\alpha >c\), which contradicts the definition of \(i_{k}\)) and \(i_k\gamma = 2c - i_k\alpha =c\), it follows that \(|(i_k-1)\gamma - i_k\gamma | = 1\). On the other hand, since we must have \((i_\ell +1)\alpha = i_\ell \alpha + 1\), from \(i_\ell \gamma = 2c - i_\ell \alpha =2c-d\) and \((i_\ell +1)\gamma =(i_\ell +1)\alpha +2c-2d = i_\ell \alpha +1 + 2c-2d =2c-d+1\), it follows that \(|i_\ell \gamma - (i_\ell +1)\gamma | = 1\).

Next, we show that \(\mathop {\mathrm {Inv}}\nolimits (\gamma ) = \mathop {\mathrm {Inv}}\nolimits (\alpha )\setminus \{i_{k},i_{\ell }\}\).

Clearly, if \(x\in [1, i_{k}-2] \cup [i_{k}+1,i_{\ell }-1]\cup [i_{\ell }+2,n]\) then \(x\in \mathop {\mathrm {Inv}}\nolimits (\gamma )\) if and only if \(x\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\). Also

$$\begin{aligned} \begin{array}{rcl} i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\gamma ) &{} \Leftrightarrow &{} (i_{k}-2)\gamma =i_{k}\gamma \\ &{} \Leftrightarrow &{} (i_{k}-2)\alpha = 2c - i_{k}\alpha \\ &{} \Leftrightarrow &{} (i_{k}-2)\alpha = c = i_{k}\alpha \\ &{} \Leftrightarrow &{} i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\alpha ). \end{array} \end{aligned}$$

On the other hand, since \(i_k\alpha = c\) and \((i_k-1)\alpha = (i_k+1)\alpha = c-1\), we have

$$\begin{aligned} (i_k-1)\gamma = (i_k-1)\alpha = c-1, i_k\gamma = 2c - i_k\alpha = c \end{aligned}$$

and

$$\begin{aligned} (i_k+1)\gamma = 2c -(i_k+1)\alpha = 2c - (c-1) = c+1, \end{aligned}$$

whence \(i_k \notin \mathop {\mathrm {Inv}}\nolimits (\gamma )\). Moreover,

$$\begin{aligned} \begin{array}{rcl} i_{\ell }+1\in \mathop {\mathrm {Inv}}\nolimits (\gamma ) &{} \Leftrightarrow &{} i_{\ell }\gamma =(i_{\ell }+2)\gamma \\ &{} \Leftrightarrow &{} 2c - i_{\ell }\alpha = (i_{\ell }+2)\alpha +2c-2d \\ &{} \Leftrightarrow &{} 2c-d = (i_{\ell }+2)\alpha +2c-2d \\ &{} \Leftrightarrow &{} (i_{\ell }+2)\alpha =d=i_{\ell }\alpha \\ &{} \Leftrightarrow &{} i_{\ell }+1\in \mathop {\mathrm {Inv}}\nolimits (\alpha ). \end{array} \end{aligned}$$

On the other hand, since \(i_\ell \alpha = d\) and \((i_\ell -1)\alpha = (i_\ell +1)\alpha = d+1\), we have

$$\begin{aligned} (i_\ell -1)\gamma {=} 2c-(i_\ell -1)\alpha {=} 2c -(d+1) = 2c-d-1, i_\ell \gamma = 2c - i_\ell \alpha = 2c-d \end{aligned}$$

and

$$\begin{aligned} (i_\ell +1)\gamma = (i_\ell +1)\alpha +2c-2d = d+1 + 2c-2d =2c-d+1, \end{aligned}$$

whence \(i_\ell \notin \mathop {\mathrm {Inv}}\nolimits (\gamma )\).

Therefore, \(\mathop {\mathrm {inv}}\nolimits (\gamma ) = r-1\) and so, by induction, we have \(\gamma \in \langle A' \rangle \).

Finally, we prove that \(\mathop {\mathrm {Inv}}\nolimits (\alpha ) = \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\).

Let \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\cap [1,i_{k}-2]\). Then

$$\begin{aligned} \begin{array}{rcl} (i-1)\gamma \beta _{c-d,d-1}=(i+1)\gamma \beta _{c-d,d-1} &{} \Leftrightarrow &{} (i-1)\alpha \beta _{c-d,d-1}=(i+1)\alpha \beta _{c-d,d-1} \\ &{} \Leftrightarrow &{} (i-1)\alpha =(i+1)\alpha \end{array} \end{aligned}$$

(by the definition of \(\beta _{c-d,d-1}\) restricted to [1, c]).

Let \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\cap [i_{k}+1,i_{\ell }-1]\). Then

$$\begin{aligned}&(i-1)\gamma \beta _{c-d,d-1}=(i+1)\gamma \beta _{c-d,d-1}\\&\quad \Leftrightarrow (2c-(i-1)\alpha )\beta _{c-d,d-1} =(2c-(i+1)\alpha )\beta _{c-d,d-1} \\&\quad \Leftrightarrow (c+(c-(i-1)\alpha ))\beta _{c-d,d-1} =(c+(c-(i+1)\alpha ))\beta _{c-d,d-1}\\&\quad \Leftrightarrow (i-1)\alpha =(i+1)\alpha \end{aligned}$$

(by the definition of \(\beta _{c-d,d-1}\) restricted to \([c,2c-d]\)).

Let \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\cap [i_{\ell }+2,n]\). Then

$$\begin{aligned} \begin{array}{ll} &{} (i-1)\gamma \beta _{c-d,d-1}=(i+1)\gamma \beta _{c-d,d-1}\\ &{}\quad \Leftrightarrow ((i-1)\alpha +2c-2d)\beta _{c-d,d-1}=((i+1)\alpha +2c-2d)\beta _{c-d,d-1} \\ &{}\quad \Leftrightarrow (2c-d+((i-1)\alpha -d))\beta _{c-d,d-1}=(2c-d+((i+1)\alpha -d))\beta _{c-d,d-1} \\ &{}\quad \Leftrightarrow (i-1)\alpha =(i+1)\alpha \end{array} \end{aligned}$$

(by the definition of \(\beta _{c-d,d-1}\) restricted to \([2c-d,n]\)).

Moreover, if \(i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \((i_{k}-2)\alpha =i_{k}\alpha =c\). Thus, \( (i_{k}-2)\gamma \beta _{c-d,d-1}=(i_{k}-2)\alpha \beta _{c-d,d-1}=c\beta _{c-d,d-1}=(2c-i_{k}\alpha )\beta _{c-d,d-1}=i_{k}\gamma \beta _{c-d,d-1} \) and so \(i_{k}-1\in \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\). Conversely, if \(i_{k}-1\notin \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \((i_{k}-2)\alpha \ne i_{k}\alpha =c\) and, as \((i_{k}-1)\alpha =i_{k}\alpha -1=c-1\), we have \((i_{k}-2)\alpha =c-2\). Hence \( (i_{k}-2)\gamma \beta _{c-d,d-1}=(i_{k}-2)\alpha \beta _{c-d,d-1}=(c-2)\beta _{c-d,d-1}=c-2\ne c= c\beta _{c-d,d-1}=(2c-c)\beta _{c-d,d-1}=(2c-i_k\alpha )\beta _{c-d,d-1}=i_{k}\gamma \beta _{c-d,d-1} \) and so \(i_{k}-1\notin \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\).

Analogously, if \(i_{\ell }+1\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \(i_{\ell }\alpha =(i_{\ell }+2)\alpha =d\), whence \( i_{\ell }\gamma \beta _{c-d,d-1}=(2c-i_{\ell }\alpha )\beta _{c-d,d-1}=(2c-d)\beta _{c-d,d-1}= d = ((i_{\ell }+2)\alpha +2c-2d)\beta _{c-d,d-1}=(i_{\ell }+2)\gamma \beta _{c-d,d-1} \) and so \(i_{\ell }+1\in \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\). Conversely, if \(i_{\ell }+1\notin \mathop {\mathrm {Inv}}\nolimits (\alpha )\) then \(d=i_{\ell }\alpha \ne (i_{\ell }+2)\alpha \). As \((i_{\ell }+1)\alpha =i_{\ell }\alpha +1=d+1\), then \((i_{\ell }+2)\alpha =d+2\), whence \( i_{\ell }\gamma \beta _{c-d,d-1}=d\ne d+2=(2c-d+2)\beta _{c-d,d-1}=((i_{\ell }+2)\alpha +2c-2d)\beta _{c-d,d-1}=(i_{\ell }+2)\gamma \beta _{c-d,d-1} \) and so \(i_{\ell }+1\notin \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\).

It remains to show that \(i_{k},i_{\ell }\in \mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\). As \(c, 2c-d \in \mathop {\mathrm {Inv}}\nolimits (\beta _{c-d,d-1})\), \((i_{k}-1)\alpha = c-1 = (i_{k}+1)\alpha \) and \((i_{\ell }-1)\alpha = d+1 = (i_{\ell }+1)\alpha \), we have \( (i_{k}-1)\gamma \beta _{c-d,d-1}=(i_{k}-1)\alpha \beta _{c-d,d-1}=(c-1)\beta _{c-d,d-1}= c-1 =(c+1)\beta _{c-d,d-1}=(2c-(i_{k}+1)\alpha )\beta _{c-d,d-1}=(i_{k}+1)\gamma \beta _{c-d,d-1}, \) as well as \( (i_{\ell }-1)\gamma \beta _{c-d,d-1}=(2c-(i_{\ell }-1)\alpha )\beta _{c-d,d-1}=(2c-d-1)\beta _{c-d,d-1}=d+1 =(2c-d+1)\beta _{c-d,d-1} = ((i_{\ell }+1)\alpha +2c-2d)\beta _{c-d,d-1}=(i_{\ell }+1)\gamma \beta _{c-d,d-1}. \)

Thus, we showed that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\mathop {\mathrm {Inv}}\nolimits (\gamma \beta _{c-d,d-1})\). Since \(\gamma \in \langle A' \rangle \), then \(\gamma \beta _{c-d,d-1} \in \langle A' \rangle \) and so, by Lemma 3.3, we have \(\alpha \in \langle A' \rangle \), as required. \(\square \)

Now, let us consider

$$\begin{aligned} A&=\{\tau \}\cup \left\{ \alpha _i\mid i=1,\ldots ,\left\lfloor \frac{n-1}{2}\right\rfloor \right\} \\&\cup \left\{ \beta _{j,i}\mid j=1,\ldots ,\left\lfloor \frac{n-3}{3}\right\rfloor ,\, i=1,\ldots ,\left\lfloor \frac{n-3j-1}{2}\right\rfloor \right\} . \end{aligned}$$

The next two lemmas together with the previous one show that A is a generating set of \(\mathrm {End}P_n\).

Lemma 3.5

\(\{\alpha _i \mid i = 1,2,\ldots ,n-2\} \subseteq \langle A \rangle \).

Proof

If \(i=1,\ldots ,\lfloor \frac{n-1}{2}\rfloor \) then \(\alpha _i \in A\) and so \(\alpha _i\in \langle A \rangle \). On the other hand, we have

$$\begin{aligned} \alpha _{\left\lfloor \frac{n-1}{2}\right\rfloor + 1} = \tau \alpha _{\left\lfloor \frac{n-1}{2}\right\rfloor - 1}, \ldots , ~ \alpha _{n-3} = \tau \alpha _2, ~ \alpha _{n-2} = \tau \alpha _1, \end{aligned}$$

if n is odd, and

$$\begin{aligned} \alpha _{\left\lfloor \frac{n-1}{2}\right\rfloor + 1} = \tau \alpha _{\left\lfloor \frac{n-1}{2}\right\rfloor }, \ldots , ~ \alpha _{n-3} = \tau \alpha _2, ~ \alpha _{n-2} = \tau \alpha _1, \end{aligned}$$

if n is even. Hence, we also have \(\alpha _i\in \langle A \rangle \), for \(i =\lfloor \frac{n-1}{2}\rfloor + 1,\ldots , n-2\), as required. \(\square \)

Lemma 3.6

\(\left\{ \beta _{j,i}\mid j=1,\ldots ,\lfloor \frac{n-3}{3}\rfloor ,\, i=1,\ldots ,n-3j-2\right\} \subseteq \langle A\rangle \).

Proof

Let \(j=1,\ldots ,\lfloor \frac{n-3}{3}\rfloor \). If \(i=1,\ldots ,\lfloor \frac{n-3j-1}{2}\rfloor \) then \(\beta _{j,i} \in A\) and so \(\beta _{j,i} \in \langle A\rangle \). On the other hand, it is a routine matter to verify that

$$\begin{aligned}&\mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor + 1}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor }\right) ,\\&~\mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor + 2}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor - 1}\right) , \ldots ,\\&\mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,n-3j-3}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,2}\right) , ~ \mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,n-3j-2}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,1}\right) , \end{aligned}$$

if \(n-3j-2\) is even, and

$$\begin{aligned}&\mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor + 1}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor - 1}\right) ,\\&~\mathop {\mathrm {Ker}}\nolimits \left( \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor + 2}\right) = \mathop {\mathrm {Ker}}\nolimits \left( \tau \beta _{j,\left\lfloor \frac{n-3j-1}{2}\right\rfloor - 2}\right) , \ldots ,\\&\mathop {\mathrm {Ker}}\nolimits (\beta _{j,n-3j-3}) = \mathop {\mathrm {Ker}}\nolimits (\tau \beta _{j,2}), ~ \mathop {\mathrm {Ker}}\nolimits (\beta _{j,n-3j-2}) = \mathop {\mathrm {Ker}}\nolimits (\tau \beta _{j,1}), \end{aligned}$$

if \(n-3j-2\) is odd. Thus, in view of Lemmas 3.1 and 3.5, for \(i =\left\lfloor \frac{n-3j-1}{2}\right\rfloor + 1,\ldots , n-3j-2\), we conclude that also \(\beta _{j,i} \in \langle A\rangle \), as required. \(\square \)

Proposition 3.7

The set A generates \(\mathrm {End}P_n\). Moreover, \(|A|=1+\left\lfloor \frac{n-1}{2}\right\rfloor +\sum _{j=1}^{\left\lfloor \frac{n-3}{3}\right\rfloor } \left\lfloor \frac{n-3j-1}{2}\right\rfloor \).

Proof

The assertion is an immediate consequence of Lemmas 3.43.5 and 3.6. \(\square \)

Let

$$\begin{aligned} \gamma _i=\left( \begin{array}{ccccccc} 1&{}\cdots &{}i&{}i+1&{}i+2&{}\cdots &{}n\\ 1&{}\cdots &{}i&{}i&{}i+1&{}\cdots &{}n-1 \end{array} \right) , \end{aligned}$$

for \(i=1,\ldots ,\lfloor \frac{n}{2}\rfloor \). Let

$$\begin{aligned} B=A\cup \left\{ \gamma _i\mid i=1,\ldots ,\left\lfloor \frac{n}{2}\right\rfloor \right\} . \end{aligned}$$

Let \(\alpha \in \mathrm {wEnd}P_n\). We say that \(i\in [1,n-1]\) is a repetition of \(\alpha \) if \((i)\alpha =(i+1)\alpha \). Denote by \( \mathop {\mathrm {rep}}\nolimits (\alpha ) \) the number of repetitions of \(\alpha \). This notion will be used in our next result. Observe that, clearly, \(\alpha \in \mathrm {End}P_n\) if and only if \(\mathop {\mathrm {rep}}\nolimits (\alpha )=0\).

Proposition 3.8

The set B generates \(\mathrm {wEnd}P_n\).

Proof

First, for \(i{=}\lfloor \frac{n}{2}\rfloor {+}1,\ldots ,n{-}1\), consider also \( \gamma _i{=}\left( \begin{array}{ccccccc} 1&{}{\cdots }&{}i&{}i{+}1&{}i{+}2&{}{\cdots }&{}n\\ 1&{}{\cdots }&{}i&{}i&{}i{+}1&{}{\cdots }&{}n{-}1 \end{array} \right) . \) Then, it is easy to check that \(\gamma _{n-i}=\tau \gamma _i\tau \gamma _1\), for all \(i=1,\ldots ,\lfloor \frac{n}{2}\rfloor \). Hence \(\gamma _1, \ldots , \gamma _{n-1}\) belong to the monoid generated by B.

Now, in order to show that any \(\alpha \in \mathrm {wEnd}P_n\) belongs to the monoid generated by B, we proceed by induction on \(\mathop {\mathrm {rep}}\nolimits (\alpha )\).

Let \(\alpha \in \mathrm {wEnd}P_n\) be such that \(\mathop {\mathrm {rep}}\nolimits (\alpha )=0\). Then, as observed above, \(\alpha \in \mathrm {End}P_n\) and so, by Proposition 3.7, we may conclude that \(\alpha \) belongs to the monoid generated by B.

Let \(k\ge 0\) and, by induction hypothesis, admit that \(\alpha \) belongs to the monoid generated by B, for all \(\alpha \in \mathrm {wEnd}P_n\) such that \(\mathop {\mathrm {rep}}\nolimits (\alpha )=k\) (notice that, for such \(\alpha \) to exist, we must have \(k\le n-1\)).

Let \(\alpha \in \mathrm {wEnd}P_n\) be such that \(\mathop {\mathrm {rep}}\nolimits (\alpha )=k+1\) (by supposing that \(k\le n-2\)). Let \(i\in [1,n-1]\) be a repetition of \(\alpha \) and take \( \beta =\left( \begin{array}{ccccccc} 1&{}\cdots &{}i&{}i+1&{}\cdots &{}n-1&{}n\\ 1\alpha &{}\cdots &{}i\alpha &{}(i+2)\alpha &{}\cdots &{}n\alpha &{} b \end{array} \right) , \) where \(b=n\alpha -1\), if \(n\alpha \ge 2\), or \(b=n\alpha +1\), otherwise. It is clear that \(\beta \in \mathrm {wEnd}P_n\) and \(\mathop {\mathrm {rep}}\nolimits (\beta )=\mathop {\mathrm {rep}}\nolimits (\alpha )-1=k\), whence \(\beta \) belongs to the monoid generated by B, by induction hypothesis. On the other hand, it is a routine matter to check that \(\alpha =\gamma _i\beta \) and so we may conclude that \(\alpha \) belongs to the monoid generated by B, as required. \(\square \)

Observe that \(|B|=n+\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \).

In order to compute the ranks of \(\mathrm {End}P_n\) and \(\mathrm {wEnd}P_n\), we start by proving a series of lemmas involving the notion of inversion.

Lemma 3.9

Let \(\alpha ,\beta \in \mathrm {wEnd}P_n\) be such that \(\alpha \beta \in \mathrm {End}P_n\). Then, we have:

  1. 1.

    \(\alpha \in \mathrm {End}P_n\);

  2. 2.

    \( \mathop {\mathrm {Inv}}\nolimits (\alpha )\subseteq \mathop {\mathrm {Inv}}\nolimits (\alpha \beta ); \)

  3. 3.

    \( \{i\in [2,n-1]\mid i\alpha \in \mathop {\mathrm {Inv}}\nolimits (\beta )\}\subseteq \mathop {\mathrm {Inv}}\nolimits (\alpha \beta ). \)

Proof

1. If \(\alpha \in \mathrm {wEnd}P_n\setminus \mathrm {End}P_n\) then \(i\alpha =(i+1)\alpha \), for some \(i\in [1,n-1]\), and so \(i\alpha \beta =(i+1)\alpha \beta \), whence \(\alpha \beta \not \in \mathrm {End}P_n\), which is a contradiction. Thus, \(\alpha \in \mathrm {End}P_n\).

2. Let \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\). Then \(i\in [2,n-1]\) and \((i-1)\alpha =(i+1)\alpha \). Hence \((i-1)\alpha \beta =(i+1)\alpha \beta \) and so \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha \beta )\).

3. Let \(i\in [2,n-1]\) be such that \(i\alpha \in \mathop {\mathrm {Inv}}\nolimits (\beta )\). Then, \(2\le i\alpha \le n-1\) and \((i\alpha -1)\beta =(i\alpha +1)\beta \).

If \((i-1)\alpha =(i+1)\alpha \) then \((i-1)\alpha \beta =(i+1)\alpha \beta \) and so \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha \beta )\).

Let us suppose that \((i-1)\alpha \ne (i+1)\alpha \). Then, either \((i-1)\alpha =i\alpha -1\) and \((i+1)\alpha =i\alpha +1\) or \((i-1)\alpha =i\alpha +1\) and \((i+1)\alpha =i\alpha -1\), from which follows that \((i-1)\alpha \beta =(i\alpha \mp 1)\beta =(i\alpha \pm 1)\beta =(i+1)\alpha \beta \) and so \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha \beta )\), as required. \(\square \)

Lemma 3.10

Let \(\alpha ,\beta \in \mathrm {wEnd}P_n\). Let \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha \beta )\) be such that \(i\not \in \mathop {\mathrm {Inv}}\nolimits (\alpha )\). Then \(i\alpha \in \mathop {\mathrm {Inv}}\nolimits (\beta )\).

Proof

As \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha \beta )\), we have \(2\le i\le n-1\) and \((i-1)\alpha \beta =(i+1)\alpha \beta \ne i\alpha \beta \). In addition, as \(2\le i\le n-1\) and \(i\not \in \mathop {\mathrm {Inv}}\nolimits (\alpha )\), we have \((i-1)\alpha \ne (i+1)\alpha \) or \((i-1)\alpha =(i+1)\alpha =i\alpha \). If \((i-1)\alpha =(i+1)\alpha =i\alpha \) then \((i-1)\alpha \beta =(i+1)\alpha \beta =i\alpha \beta \), which is a contradiction. Hence \((i-1)\alpha \ne (i+1)\alpha \). Moreover, if \((i-1)\alpha =i\alpha \) or \((i+1)\alpha =i\alpha \) then \((i-1)\alpha \beta =i\alpha \beta \) or \((i+1)\alpha \beta =i\alpha \beta \), which also is a contradiction. Thus, either \((i-1)\alpha =i\alpha -1\) and \((i+1)\alpha =i\alpha +1\) or \((i-1)\alpha =i\alpha +1\) and \((i+1)\alpha =i\alpha -1\) (and, in both cases, we must have \(2\le i\alpha \le n-1\)), whence \((i\alpha \mp 1)\beta =(i-1)\alpha \beta =(i+1)\alpha \beta =(i\alpha \pm 1)\beta \) and so \((i\alpha -1)\beta =(i\alpha +1)\beta \). Since \((i+1)\alpha \beta \ne i\alpha \beta \), we have \((i\alpha -1)\beta =(i\alpha +1)\beta \ne i\alpha \beta \), i.e., \(i\alpha \in \mathop {\mathrm {Inv}}\nolimits (\beta )\), as required. \(\square \)

Lemma 3.11

Let \(\alpha \in \mathrm {wEnd}P_n\) and \(i\in [2,n-1]\). Then \(i\in \mathop {\mathrm {Inv}}\nolimits (\alpha )\) if and only if \(n-i+1\in \mathop {\mathrm {Inv}}\nolimits (\tau \alpha )\).

Proof

First, notice that \(2\le i\le n-1\) if and only if \(2\le n-i+1\le n-1\). Then

$$\begin{aligned} \begin{array}{rcl} i\in \mathop {\mathrm {Inv}}\nolimits (\alpha ) &{} \Leftrightarrow &{} (i-1)\alpha =(i+1)\alpha \ne i\alpha \\ &{} \Leftrightarrow &{} (n-i+2)\tau \alpha =(n-i)\tau \alpha \ne (n-i+1)\tau \alpha \\ &{} \Leftrightarrow &{} ((n-i+1)+1)\tau \alpha =((n-i+1)-1)\tau \alpha \ne (n-i+1)\tau \alpha \\ &{} \Leftrightarrow &{}n-i+1\in \mathop {\mathrm {Inv}}\nolimits (\tau \alpha ), \end{array} \end{aligned}$$

as required. \(\square \)

The next lemma is clear.

Lemma 3.12

Let C be a generating set of \(\mathrm {End}P_n\) or of \(\mathrm {wEnd}P_n\). Then \(\tau \in C\).

Recall that \(\mathop {\mathrm {Inv}}\nolimits (\tau )=\emptyset \). Moreover, for \(\alpha \in \mathrm {End}P_n\), we have \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\emptyset \) if and only if \(\alpha =1\) or \(\alpha =\tau \).

Lemma 3.13

For each \(n\in {\mathbb {N}}\setminus \{1\}\), there holds the statement: If C is a generating set of \(\mathrm {End}P_n\) or of \(\mathrm {wEnd}P_n\) then \(\lfloor \frac{n-1}{2}\rfloor \le |\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=1\}|\).

Proof

If \(n=2\) then \(|\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=1\}|=0\) and so \(0=\lfloor \frac{2-1}{2}\rfloor \le |\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=1\}|\). Thereof, let \(n\ge 3\). In order to obtain a contradiction, let us assume that \(|\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=1\}|<\lfloor \frac{n-1}{2}\rfloor \) for an \(n\in {\mathbb {N}}\). As \(n\ge 3\), we have that \(\left[ 2,\lfloor \frac{n+1}{2}\rfloor \right] \ne \emptyset \). Then, there exists \(i\in \left[ 2,\lfloor \frac{n+1}{2}\rfloor \right] \) such that \(\{i,n-i+1\}\cap \mathop {\mathrm {Inv}}\nolimits (\alpha )=\emptyset \), for all \(\alpha \in C\). As \(1\le i-1\le \lfloor \frac{n-1}{2}\rfloor \), we may consider the transformation \(\alpha _{i-1}\in A\).

Let \(\xi _1,\ldots ,\xi _k\in C\setminus \{1\}\) be such that \(\alpha _{i-1}=\xi _1\cdots \xi _k\) and \(\{\xi _j,\xi _{j+1}\}\ne \{\tau \}\), for \(j=1,\ldots ,k-1\). Notice that \(\mathop {\mathrm {Inv}}\nolimits (\alpha _{i-1})=\{i\}\), whence \(\alpha _{i-1}\not \in C\) and so \(k\ge 2\). Moreover, as \(\alpha _{i-1}\in \mathrm {End}P_n\), by Lemma 3.9, we have \(\xi _1\in \mathrm {End}P_n\) and \( \mathop {\mathrm {Inv}}\nolimits (\xi _1)\subseteq \mathop {\mathrm {Inv}}\nolimits (\xi _1\cdots \xi _k)=\mathop {\mathrm {Inv}}\nolimits (\alpha _{i-1})=\{i\}. \) Then \(\mathop {\mathrm {Inv}}\nolimits (\xi _1)=\emptyset \), since \(\xi _1\in C\), and so \(\xi _1=\tau \) (since \(\xi _1\in \mathrm {End}P_n\) and \(\xi _1\ne 1\)).

Applying Lemma 3.9 again, we obtain \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\mathop {\mathrm {Inv}}\nolimits (\xi _1\xi _2)\subseteq \mathop {\mathrm {Inv}}\nolimits (\xi _1\cdots \xi _k)=\mathop {\mathrm {Inv}}\nolimits (\alpha _{i-1})=\{i\}\) and \(\tau \xi _2\in \mathrm {End}P_n\). Hence, \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\emptyset \) or \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\{i\}\).

Suppose that \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\emptyset \). Then \(\tau \xi _2=1\) or \(\tau \xi _2=\tau \), and so \(\xi _2=\tau \) or \(\xi _2=1\), which is not possible since \(\{\xi _1,\xi _2\}\ne \{\tau \}\) and \(\xi _2\ne 1\). Thus, we must have \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\{i\}\) and so, by Lemma 3.11, it follows that \(\mathop {\mathrm {Inv}}\nolimits (\xi _2)=\{n-i+1\}\), which is a contradiction, since \(\xi _2\in C\).

Therefore, C must contain at least \(\lfloor \frac{n-1}{2}\rfloor \) distinct transformations \(\alpha \) with \(\mathop {\mathrm {inv}}\nolimits (\alpha )=1\), as required. \(\square \)

Lemma 3.14

Let \(n\in {\mathbb {N}}\), \(n\ge 6\), \(j\in \left[ 1,\lfloor \frac{n-3}{3}\rfloor \right] \) and \(i\in \left[ 1,\lfloor \frac{n-3j-1}{2}\rfloor \right] \). Then

$$\begin{aligned} 2\le i+1\le n-2, \quad 4\le i+2j+1\le n-2\quad \text {and}\quad 5\le i+3j+1\le n-1. \end{aligned}$$

Proof

We have \(2\le i+1\le \frac{n-3j-1}{2}+1\le \frac{n-3-1}{2}+1=\frac{n}{2}-1< n-1\). On the other hand, \(4\le i+2j+1\le i+j+j+1\le \frac{n-3j-1}{2} + \frac{n-3}{3} +j+1 =\frac{5n-3j-9}{6}+1\le \frac{5n-3-9}{6}+1=\frac{5n}{6}-1<n-1\). Finally, \(5\le i+3j+1\le \frac{n-3j-1}{2}+3j+1=\frac{n+3j+1}{2}\le \frac{n+3\cdot \frac{n-3}{3}+1}{2}=n-1\), as required. \(\square \)

Lemma 3.15

For each \(n\in {\mathbb {N}}\setminus \{1\}\), there holds the statement: If C is a generating set of \(\mathrm {End}P_n\) or of \(\mathrm {wEnd}P_n\) then \(\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \le |\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=2\}|\).

Proof

If \(n\in [2,5]\) then \(0=|\{\alpha \in C\mid \mathop {\mathrm {inv}}\nolimits (\alpha )=2\}|\). Consider then \(n\ge 6\). Let \(j\in \left[ 1,\lfloor \frac{n-3}{3}\rfloor \right] \) and \(i\in \left[ 1,\lfloor \frac{n-3j-1}{2}\rfloor \right] \). In order to obtain a contradiction, let us assume that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )\ne \{i+j+1,i+2j+1\}\) and \(\mathop {\mathrm {Inv}}\nolimits (\alpha )\ne \{n-(i+j+1)+1,n-(i+2j+1)+1\}\), for all \(\alpha \in C\).

Let us consider the transformation \(\beta _{j,i}\in \mathrm {End}P_n\). Observe that \(\mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})=\{i+j+1,i+2j+1\}\), whence \(\beta _{j,i}\not \in C\). Let \(\xi _1,\ldots ,\xi _k\in C\setminus \{1\}\) be such that \(\beta _{j,i}=\xi _1\cdots \xi _k\) and \(\{\xi _\ell ,\xi _{\ell +1}\}\ne \{\tau \}\), for \(\ell =1,\ldots ,k-1\). Notice that \(k\ge 2\), since \(\beta _{j,i}\not \in C\). As \(\beta _{j,i}\in \mathrm {End}P_n\), by Lemma 3.9, we have \(\xi _1\in \mathrm {End}P_n\) and \( \mathop {\mathrm {Inv}}\nolimits (\xi _1)\subseteq \mathop {\mathrm {Inv}}\nolimits (\xi _1\cdots \xi _k)=\mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})=\{i+j+1,i+2j+1\}. \) Since \(\xi _1\in C\), then \(\mathop {\mathrm {inv}}\nolimits (\xi _1)=0\) or \(\mathop {\mathrm {inv}}\nolimits (\xi _1)=1\).

If \(\mathop {\mathrm {inv}}\nolimits (\xi _1)=1\) then \(\mathop {\mathrm {Inv}}\nolimits (\xi _1)\in \{\{i+j+1\},\{i+2j+1\}\}\).

On the other hand, suppose that \(\mathop {\mathrm {inv}}\nolimits (\xi _1)=0\). As \(\xi _1\in \mathrm {End}P_n\) (and \(\xi _1\ne 1\)), then we must have \(\xi _1=\tau \). By Lemma 3.9, we get \(\mathop {\mathrm {Inv}}\nolimits (\tau \xi _2)=\mathop {\mathrm {Inv}}\nolimits (\xi _1\xi _2)\subseteq \mathop {\mathrm {Inv}}\nolimits (\xi _1\cdots \xi _k)=\mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})=\{i+j+1,i+2j+1\}\) and \(\tau \xi _2\in \mathrm {End}P_n\). It follows that \(\xi _2\in \mathrm {End}P_n\) and, by Lemma 3.11, that \(\mathop {\mathrm {Inv}}\nolimits (\xi _2)\subseteq \{n-(i+j+1)+1,n-(i+2j+1)+1\}\). As \(\xi _2\in C\), we obtain \(\mathop {\mathrm {inv}}\nolimits (\xi _2)=0\) or \(\mathop {\mathrm {inv}}\nolimits (\xi _2)=1\). If \(\mathop {\mathrm {inv}}\nolimits (\xi _2)=0\) then \(\xi _2=\tau \) (since \(\xi _2\ne 1\) and \(\xi _2\in \mathrm {End}P_n\)) and so \(\{\xi _1,\xi _2\}=\{\tau \}\), which is a contradiction. Thus \(\mathop {\mathrm {Inv}}\nolimits (\xi _2)\in \{\{n-(i+j+1)+1\},\{n-(i+2j+1)+1\}\}\). Also, notice that, in this case, \(k\ge 3\) (since \(k=2\) would imply \(\xi _2=\tau \beta _{j,i}\) and so \(\mathop {\mathrm {inv}}\nolimits (\xi _2)=2\), which is a contradiction).

Therefore, we have four cases to consider.

Case 1\(\mathop {\mathrm {Inv}}\nolimits (\xi _1)=\{i+j+1\}\). Then, as \(\xi _1\in \mathrm {End}P_n\), we must have \((i+2j+1)\xi _1=(i+1)\xi _1\). On the other hand, since \(i+2j+1\in \mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})=\mathop {\mathrm {Inv}}\nolimits (\xi _1(\xi _2\cdots \xi _k))\) and \(i+2j+1\not \in \mathop {\mathrm {Inv}}\nolimits (\xi _1)\), by Lemma 3.10, we obtain \((i+2j+1)\xi _1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2\cdots \xi _k)\). Thus \((i+1)\xi _1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2\cdots \xi _k)\). Now, as \(2\le i+1\le n-2\) (by Lemma 3.14), it follows by Lemma 3.9 that \(i+1\in \mathop {\mathrm {Inv}}\nolimits (\xi _1(\xi _2\cdots \xi _k))=\mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})\), which is a contradiction.

Case 2\(\mathop {\mathrm {Inv}}\nolimits (\xi _1)=\{i+2j+1\}\). Notice that \(5\le i+3j+1\le n-1\), by Lemma 3.14. As \(\xi _1\in \mathrm {End}P_n\), in this case, we have \((i+3j+1)\xi _1=(i+j+1)\xi _1\). Since \(i+j+1\in \mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})=\mathop {\mathrm {Inv}}\nolimits (\xi _1(\xi _2\cdots \xi _k))\) and \(i+j+1\not \in \mathop {\mathrm {Inv}}\nolimits (\xi _1)\), by Lemma 3.10, we obtain \((i+j+1)\xi _1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2\cdots \xi _k)\), i.e., \((i+3j+1)\xi _1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2\cdots \xi _k)\). Hence, by Lemma 3.9, we get \(i+3j+1\in \mathop {\mathrm {Inv}}\nolimits (\xi _1(\xi _2\cdots \xi _k))=\mathop {\mathrm {Inv}}\nolimits (\beta _{j,i})\), which is a contradiction.

Before considering the next case, we observe that \(\mathop {\mathrm {Inv}}\nolimits (\tau \beta _{j,i})=\{n-(i+j+1)+1,n-(i+2j+1)+1\}\), by Lemma 3.11.

Case 3\(\xi _1=\tau \) and \(\mathop {\mathrm {Inv}}\nolimits (\xi _2)=\{n-(i+j+1)+1\}\). Since \(\xi _2\in \mathrm {End}P_n\), we deduce that \((n-(i+1)+1)\xi _2=(n-(i+2j+1)+1)\xi _2\). Moreover, as \(n-(i+2j+1)+1\in \mathop {\mathrm {Inv}}\nolimits (\tau \beta _{j,i})\), \(n-(i+2j+1)+1\not \in \mathop {\mathrm {Inv}}\nolimits (\xi _2)\) and \(\tau \beta _{j,i}=\xi _2\xi _3\cdots \xi _k\) (notice that, in this case, \(k\ge 3\)), by Lemma 3.10, we have \((n-(i+2j+1)+1)\xi _2\in \mathop {\mathrm {Inv}}\nolimits (\xi _3\cdots \xi _k)\). Thus, \((n-(i+1)+1)\xi _2\in \mathop {\mathrm {Inv}}\nolimits (\xi _3\cdots \xi _k)\). From \(2\le i+1\le n-2\) (by Lemma 3.14), we obtain \(3\le n-(i+1)+1\le n-1\) and so, by Lemma 3.9, it follows that \(n-(i+1)+1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2(\xi _3\cdots \xi _k))=\mathop {\mathrm {Inv}}\nolimits (\tau \beta _{j,i})\), which is a contradiction.

Case 4\(\xi _1=\tau \) and \(\mathop {\mathrm {Inv}}\nolimits (\xi _2)=\{n-(i+2j+1)+1\}\). Once again since \(\xi _2\in \mathrm {End}P_n\), we conclude that \((n-(i+j+1)+1)\xi _2=(n-(i+3j+1)+1)\xi _2\). On the other hand, as \(n-(i+j+1)+1\in \mathop {\mathrm {Inv}}\nolimits (\tau \beta _{j,i})\), \(n-(i+j+1)+1\not \in \mathop {\mathrm {Inv}}\nolimits (\xi _2)\) and \(\tau \beta _{j,i}=\xi _2\xi _3\cdots \xi _k\) (\(k\ge 3\), also in this case), by Lemma 3.10, we have \((n-(i+j+1)+1)\xi _2\in \mathop {\mathrm {Inv}}\nolimits (\xi _3\cdots \xi _k)\) and so \((n-(i+3j+1)+1)\xi _2\in \mathop {\mathrm {Inv}}\nolimits (\xi _3\cdots \xi _k)\). By Lemma 3.14, we have \(5\le i+3j+1\le n-1\), whence \(2\le n-(i+3j+1)+1\le n-4\). Hence, by Lemma 3.9, we obtain \(n-(i+3j+1)+1\in \mathop {\mathrm {Inv}}\nolimits (\xi _2(\xi _3\cdots \xi _k))=\mathop {\mathrm {Inv}}\nolimits (\tau \beta _{j,i})\), which is a contradiction.

Since we obtained a contradiction in all possible cases, it follows that \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\{i+j+1,i+2j+1\}\) or \(\mathop {\mathrm {Inv}}\nolimits (\alpha )=\{n-(i+j+1)+1,n-(i+2j+1)+1\}\), for some \(\alpha \in C\). Therefore C has at least \(\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \) distinct transformations \(\alpha \) with \(\mathop {\mathrm {inv}}\nolimits (\alpha )=2\), as required. \(\square \)

Theorem 3.16

\(\mathop {\mathrm {rank}}\nolimits (\mathrm {End}P_n)=1+\lfloor \frac{n-1}{2}\rfloor +\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \) for each \(n\in {\mathbb {N}}\setminus \{1\}\).

Proof

The assertion is an immediate consequence of Proposition 3.7 and Lemmas 3.123.13 and 3.15. \(\square \)

To calculate the rank of \(\mathrm {wEnd}P_n\), we still need the following lemma.

Lemma 3.17

For each \(n\in {\mathbb {N}}\setminus \{1\}\), there holds the statement: If C is a generating set of \(\mathrm {wEnd}P_n\) then \(\lfloor \frac{n}{2}\rfloor \le |\{\alpha \in C \cap \left( \mathrm {wEnd}P_n\setminus \mathrm {End}P_n\right) \mid \mathop {\mathrm {inv}}\nolimits (\alpha )=0\}|\).

Proof

Let \(i\in \left[ 1,\lfloor \frac{n}{2}\rfloor \right] \) (as \(n\ne 1\) we have \(\left[ 1,\lfloor \frac{n}{2}\rfloor \right] \ne \emptyset \)). Let \(\xi _1,\ldots ,\xi _k\in C\setminus \{1\}\) be such that \(\gamma _i=\xi _1\cdots \xi _k\) and \(\{\xi _j,\xi _{j+1}\}\ne \{\tau \}\), for \(j=1,\ldots ,k-1\). Then

$$\begin{aligned} \mathop {\mathrm {Ker}}\nolimits (\xi _1)\subseteq \mathop {\mathrm {Ker}}\nolimits (\gamma _i)=\text {id}_n \cup \{(i,i+1),(i+1,i)\}, \end{aligned}$$

whence \(\xi _1\) is a permutation of [1, n] or \(\mathop {\mathrm {Ker}}\nolimits (\xi _1)=\mathop {\mathrm {Ker}}\nolimits (\gamma _i)\) and so, as \(\xi _1\ne 1\), \(\xi _1=\tau \) or \(\mathop {\mathrm {Ker}}\nolimits (\xi _1)=\mathop {\mathrm {Ker}}\nolimits (\gamma _i)\).

Suppose that \(\xi _1=\tau \). Then \(k\ge 2\) and \(\tau \gamma _i=\xi _2\cdots \xi _k\). Hence

$$\begin{aligned} \mathop {\mathrm {Ker}}\nolimits (\xi _2)\subseteq \mathop {\mathrm {Ker}}\nolimits (\tau \gamma _i)=\text {id}_n \cup \{(n-i,n-i+1),(n-i+1,n-i)\}. \end{aligned}$$

Since \(\{\xi _1,\xi _2\}\ne \{\tau \}\), then \(\xi _2\ne \tau \) and so

$$\begin{aligned} \mathop {\mathrm {Ker}}\nolimits (\xi _2)=\mathop {\mathrm {Ker}}\nolimits (\tau \gamma _i)=\text {id}_n \cup \{(n-i,n-i+1),(n-i+1,n-i)\}. \end{aligned}$$

Therefore, C possesses at least \(\lfloor \frac{n}{2}\rfloor \) (distinct) transformations \(\alpha \) such that

$$\begin{aligned} \mathop {\mathrm {Ker}}\nolimits (\alpha )=\text {id}_n \cup \{(i,i+1),(i+1,i)\}, \end{aligned}$$

for some \(i\in [1,n-1]\). Clearly, \(\alpha \in \mathrm {wEnd}P_n\setminus \mathrm {End}P_n\) and \(\mathop {\mathrm {inv}}\nolimits (\alpha )=0\), for all transformations \(\alpha \) with this type of kernel. This completes the proof of the lemma. \(\square \)

Recall that, for a semigroup (or a monoid) S and a set \(X\subseteq S\), the relative rank of SmoduloX, denoted by \(\mathop {\mathrm {rank}}\nolimits (S:X)\), is the minimum cardinality of a set \(Y\subseteq S\) such that S is generated by \(X\cup Y\).

Theorem 3.18

For each \(n\in {\mathbb {N}}\setminus \{1\}\), \(\mathop {\mathrm {rank}}\nolimits (\mathrm {wEnd}P_n)=n+\sum _{j=1}^{\lfloor \frac{n-3}{3}\rfloor }\lfloor \frac{n-3j-1}{2}\rfloor \) and \(\mathop {\mathrm {rank}}\nolimits (\mathrm {wEnd}P_n:\mathrm {End}P_n)=\lfloor \frac{n}{2}\rfloor \).

Proof

The statement is the result of Proposition 3.8 together with Lemmas 3.123.133.15 and 3.17. \(\square \)