Cyclic Shift Problems on Graphs

We study a new reconfiguration problem inspired by classic mechanical puzzles: a colored token is placed on each vertex of a given graph; we are also given a set of distinguished cycles on the graph. We are tasked with rearranging the tokens from a given initial configuration to a final one by using cyclic shift operations along the distinguished cycles. We first investigate a large class of graphs, which generalizes several classic puzzles, and we give a characterization of which final configurations can be reached from a given initial configuration. Our proofs are constructive, and yield efficient methods for shifting tokens to reach the desired configurations. On the other hand, when the goal is to find a shortest sequence of shifting operations, we show that the problem is NP-hard, even for puzzles with tokens of only two different colors.

Authors

• 1 publication
• 10 publications
• 9 publications
• Shortest Reconfiguration of Matchings

Imagine that unlabelled tokens are placed on the edges of a graph, such ...
12/13/2018 ∙ by Nicolas Bousquet, et al. ∙ 0

• Swapping Colored Tokens on Graphs

We investigate the computational complexity of the following problem. We...
03/19/2018 ∙ by Katsuhisa Yamanaka, et al. ∙ 0

• Hardness of Token Swapping on Trees

Given a graph where every vertex has exactly one labeled token, how can ...
03/11/2021 ∙ by Oswin Aichholzer, et al. ∙ 0

• Shortest Reconfiguration Sequence for Sliding Tokens on Spiders

Suppose that two independent sets I and J of a graph with I = J are ...
06/21/2018 ∙ by Duc A. Hoang, et al. ∙ 0

• Finding Optimal Solutions to Token Swapping by Conflict-based Search and Reduction to SAT

We study practical approaches to solving the token swapping (TSWAP) prob...
06/25/2018 ∙ by Pavel Surynek, et al. ∙ 0

• Discovering Interesting Cycles in Directed Graphs

Cycles in graphs often signify interesting processes. For example, cycli...
09/03/2019 ∙ by Florian Adriaens, et al. ∙ 0

• A Computational Approach to Organizational Structure

An organizational structure defines how an organization arranges and man...
06/14/2018 ∙ by Bernhard Haeupler, et al. ∙ 0

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Recently, variations of reconfiguration problems have been attracting much interest, and several of them are being studied as important fundamental problems in theoretical computer science [8]. Also, many real puzzles which can be modeled as reconfiguration problems have been invented and proposed by the puzzle community, such as the 15-puzzle and Rubik’s cube. Among these, we focus on a popular type of puzzle based on cyclic shift operations: see Fig. 1. In these puzzles, we can shift some elements along predefined cycles as a basic operation, and the goal is to rearrange the pieces into a desired pattern.

In terms of reconfiguration problems, this puzzle can be modeled as follows. The input of the problem is a graph , a set of colors , and one colored token on each vertex in . We are also given a set of cycles of . The basic operation on is called “shift” along a cycle in , and it moves each token located on a vertex in into the next vertex along . This operation generalizes the token swapping problem, which was introduced by Yamanaka et al. [11], and has been well investigated recently. Indeed, when we restrict each cycle in to have length two (each cycle would correspond to an edge in ), the cyclic shift problem is equivalent to the token swapping problem.

In the mathematical literature, the study of permutation groups and their generators has a long history. An important theorem by Babai [1]

states that the probability that two random permutations of

objects generate either the symmetric group (i.e., the group of all permutations) or the alternating group (i.e., the group of all even permutations) is . However, the theorem says nothing about the special case where the generators are cycles.

In [4], Heath et al. give a characterization of the permutations that, together with a cycle of length , generate either or , as opposed to a smaller permutation group. On the other hand, in [7], Jones shows that and are the only finite primitive permutation groups containing a cycle of length or less. However, his proof is non-constructive, as it heavily relies on the classification of finite simple groups (and, as the author remarks, a self-contained proof is unlikely to exist). In particular, no non-trivial upper bound is known on the distance of two given permutations in terms of a set of generators.

The computational complexity of related problems has been studied, too. It is well known that, given a set of generators, the size of the permutation group they generate is computable in polynomial time. Also, the inclusion of a given permutation in the group is decidable in polynomial time, and an expression for in terms of the generators is also computable in polynomial time [2].

In contrast, Jerrum showed that computing the distance between two given permutations in terms of two generators is PSPACE-complete [6]. However, the generators used for the reduction are far from being cycles.

In this paper, after giving some definitions (Section 2), we study the configuration space of a large class of cyclic shift problems which generalize the puzzles in Fig. 1 (Section 3). We show that, except for one special case, the permutation group generated by a given set of cycles is if at least one of the cycles has even length, and it is otherwise. This result is in agreement with Babai’s theorem [1], and shows a similarity with the configuration space of the (generalized) 15-puzzle [10]. Moreover, our proofs in Section 3 are constructive, and yield polynomial upper bounds on the number of shift operations required to reach a given configuration. This is contrasted with Section 4, where we show that finding a shortest sequence of shift operations to obtain a desired configuration is NP-hard, even for puzzles with tokens of only two different colors.

2 Preliminaries

Let be a finite, simple, undirected graph, where is the vertex set, with , and is the edge set. Let be a set of colors, where is a constant. A token placement for is a function : that is, represents the color of the token placed on the vertex . Without loss of generality, we assume to be surjective.

Let us fix a set of cycles in (note that does not necessarily contain all cycles of ). Two distinct token placements and of are adjacent with respect to if the following two conditions hold: (1) there exists a cycle in such that and or and for , and (2) for all vertices . In this case, we say that is obtained from by shifting the tokens along the cycle . If an edge is not spanned by any cycle in , plays no role in shifting tokens. Therefore, without loss of generality, we assume that every edge is spanned by at least one cycle in .

We say that two token placements and are compatible if, for each color , we have . Obviously, compatibility is an equivalence relation on token placements, and its equivalence classes are called compatibility classes for and Col. For a compatibility class and a cycle set , we define the token-shifting graph of and as the undirected graph with vertex set , where there is an edge between two token placements if and only if they are adjacent with respect to . A walk in a token-shifting graph starting from and ending in is called a shifting sequence between and , and the distance between and , i.e., the length of a shortest walk between them, is denoted as (if there is no walk between and , their distance is defined to be ). If , we write .

For a given number of colors , we define the -Colored Token Shift problem as follows. The input is a graph , a cycle set for , two compatible token placements and (with colors drawn from the set ), and a non-negative integer . The goal is to determine whether holds. In the case that is not given, we consider the -Colored Token Shift problem as an optimization problem that aims at computing .

3 Algebraic Analysis of the Puzzles

For the purpose of this section, the vertex set of the graph will be , and the number of colors will be , so that , and a token placement on can be interpreted as a permutation of . To denote a permutation of , we can either use the one-line notation , or we can write down its cycle decomposition: for instance, the permutation can be expressed as the product of disjoint cycles .

Note that, given a cycle set , shifting tokens along a cycle corresponds to applying the permutation or its inverse to . The set of token placements generated by shifting sequences starting from the “identity token placement” is therefore a permutation group with the composition operator, which we denote by , and we call it configuration group generated by . Since we visualize permutations as functions mapping vertices of to colors (and not the other way around), it makes sense to compose chains of permutations from right to left, contrary to the common convention in the permutation group literature. So, for example, if we start from the identity token placement for and we shift tokens along the cycles and in this order, we obtain the token placement

 (1 2 3)(3 4 5)=[2 3 1 4 5][1 2 4 5 3]=[2 3 4 5 1]=(1 2 3 4 5).

(Had we composed permutations from left to right, we would have obtained the token placement as a result.)

One of our goals in this section is to determine the configuration groups generated by some classes of cycle sets . Our choice of will be inspired by the puzzles in Fig. 1, and will consist of arrangements of cycles that share either one or two adjacent vertices. As we will see, except in one special case, the configuration groups that we obtain are either the symmetric group (i.e., the group of all permutations) or the alternating group (i.e., the group of all even permutations), depending on whether the cycle set contains at least one even-length cycle or not: indeed, observe that a cycle of length corresponds to an even permutation if and only if

is odd.

Note that the set of permutations in the configuration group coincides with the connected component of the token-shifting graph (as defined in the previous section) that contains . The other connected components are simply given by the cosets of in (thus, they all have the same size), while the number of connected components of the token-shifting graph is equal to the index of in , i.e., .

The other goal of this section is to estimate the diameter of the token-shifting graph, i.e., the maximum distance between any two token placements

and such that . To this end, we state some basic preliminary facts, which are folklore, and can be proved by mimicking the “bubble sort” algorithm.

Proposition 1
1. The -cycle and the transposition can generate any permutation of in shifts.

2. The -cycle and the 3-cycle can generate any even permutation of in shifts.111Of course, the two cycles generate strictly more than (hence ) if and only if is even; however, we will only apply Proposition 1.2 to generate even permutations.

3. The 3-cycles , , …, can generate any even permutation of in shifts.∎

All upper bounds given in Proposition 1 are worst-case asymptotically optimal (refer to [6] for some proofs).

3.1 Puzzles with two cycles

We first investigate the case where the cycle set contains exactly two cycles and , either of the form and with , or of the form and , with . The first puzzle is called 1-connected -puzzle, where , and the second one is called 2-connected -puzzle, where (so, in both cases and are the lengths of the two cycles and , respectively). See Fig. 2 for some examples. Note that the Turnstile puzzle in Fig. 1 (left) can be regarded as a 2-connected -puzzle.

Theorem 3.1

The configuration group of a 1-connected -puzzle is if both and are odd, and it is otherwise. Any permutation in the configuration group can be generated in shifts.

Proof

Observe that the commutator of and is the 3-cycle . So, we can apply Proposition 1.2 to the -cycle and the 3-cycle to generate any even permutation in shifts. If and are odd, then and are even permutations, and therefore cannot generate any odd permutation.

On the other hand, if is even (the case where is even is symmetric), then the -cycle is an odd permutation. So, to generate any odd permutation , we first generate the even permutation in shifts, and then we do one extra shift along the cycle .∎

Our first observation about 2-connected -puzzles is that the composition of and is the -cycle , which excludes only the element . Similarly, , which excludes only the element . We will write and as shorthand for and respectively, and we will use the permutations and to conjugate and , thus obtaining different -cycles and -cycles.222If and are two elements of a group, the conjugate of by is defined as . In the context of permutation groups, conjugation by any is an automorphism that preserves the cycle structure of permutations [9, Theorem 3.5].

Lemma 1

In a 2-connected -puzzle, any even permutation can be generated in shifts.

Proof

If we conjugate the 3-cycle by the inverse of , we obtain the 3-cycle . By applying Proposition 1.2 to the -cycle and the 3-cycle , we can generate any even permutation of in shifts.

Let be an even permutation of . In order to generate , we first move the correct token to position 1 in shifts, possibly scrambling the rest of the tokens: let be the resulting permutation. If is even, then is an even permutation of , and we can generate it in shifts as shown before, obtaining .

On the other hand, if is odd, then one of the generators and must be odd, too. Since is a 3-cycle, it follows that is odd. In this case, after placing the correct token in position 1 via , we shift the rest of the tokens along , and then we follow up with , which is an even permutation of , and can be generated it in shifts. Again, the result is .∎

Lemma 2

In a 2-connected -puzzle with and , any even permutation can be generated in shifts.

Proof

As shown in Fig. 3, the conjugate of by is the -cycle

 δ1=γ−11βγ1=(a a+1 … n−1 a−1 1),

and the conjugate of by is the -cycle

 δ2=γ−12β−1γ2=(n n−1 … a+2 a a−2 a−1).

Their composition is , and therefore is the 3-cycle . Conjugating this 3-cycle by , we finally obtain the 3-cycle ; note that has been generated in a number of shifts independent of . Now, since the 3-cycle and the -cycle induce a 2-connected -puzzle on , we can apply Lemma 1 to generate any even permutation of in shifts.∎

Theorem 3.2

The configuration group of a 2-connected -puzzle is:

1. Isomorphic to if .

2. if both and are odd.

3. otherwise.

Any permutation in the configuration group can be generated in shifts.

Proof

By the symmetry of the puzzle, we may assume . The case with is equivalent to Proposition 1.1, so let . If or , then Lemmas 2 and 1 apply, hence we can generate any even permutation in shifts: the configuration group is therefore at least . Now we reason as in Theorem 3.1: if and are odd, then and are even permutations, and cannot generate any odd one. If is even (the case where is even is symmetric), then is an odd permutation. In this case, to generate any odd permutation , we first generate the even permutation in shifts, and then we do one more shift along the cycle to obtain .

The only case left is . To analyze the 2-connected -puzzle, consider the outer automorphism defined on a generating set of as follows (cf. [9, Corollary 7.13]):

 ψ((1 2)) =(1 5)(2 3)(4 6),ψ((1 3))=(1 4)(2 6)(3 5), ψ((1 4)) =(1 3)(2 4)(5 6),ψ((1 5))=(1 2)(3 6)(4 5), ψ((1 6)) =(1 6)(2 5)(3 4).

Because is an automorphism, the subgroup of generated by and is isomorphic to the subgroup generated by the permutations and . Since and , and recalling that for all , we have:

 ψ(α) =ψ((1 2))ψ((1 3))ψ((1 4))=[1 5 6 4 3 2]=(2 5 3 6) and ψ(β) =ψ((1 3))ψ((1 4))ψ((1 5))ψ((1 6))ψ((1 3))=[3 1 5 4 2 6]=(1 3 5 2).

Note that the new generators and both leave the token in place, and so they cannot generate a subgroup larger than (up to isomorphism). On the other hand, we have . This 3-cycle, together with the 4-cycle , induces a 2-connected -puzzle on : as shown before, the configuration group of this puzzle is (isomorphic to) . We conclude that the configuration group of the 2-connected -puzzle is isomorphic to , as well. A given permutation is in the configuration group if and only if leaves the token in place.∎

3.2 Puzzles with any number of cycles

Let us generalize the -puzzle to larger numbers of cycles. (As far as the authors know, there are commercial products that have 2, 3, 4, and 6 cycles.) We say that two cycles are properly interconnected if they share exactly one vertex, of if they share exactly two vertices which are consecutive in both cycles. Note that all 1-connected and 2-connected -puzzles consist of two properly interconnected cycles. Given a set of cycles in a graph , let us define the interconnection graph , where there is an (undirected) edge between two cycles of if and only if they are properly interconnected.

Let us assume (to avoid special configurations of small size, which can be analyzed by hand), and let consist of cycles of lengths , , …, , respectively. We say that induces a generalized -puzzle on if there is a subset such that:

1. contains at least two cycles;

2. the induced subgraph is connected;

3. each vertex of is contained in at least one cycle in .

When we fix such a subset , the cycles in are called relevant cycles, and the vertices of that are shared by two properly interconnected relevant cycles are called relevant vertices for those cycles. See Fig. 4 for an example of a generalized puzzle.

The next two lemmas are technical; their proof is found in the Appendix.

Lemma 3

In a generalized puzzle with three relevant cycles, , such that and induce a 2-connected -puzzle, any permutation involving only vertices in and can be generated in shifts.∎

Lemma 4

Let , and let be a sequence such that each element of appears in at least once, and any three consecutive elements of are distinct. Then, the set of 3-cycles can generate any even permutation of in shifts.∎

Theorem 3.3

The configuration group of a generalized -puzzle is if , , …, are all odd, and it is otherwise. Any permutation in the configuration group can be generated in shifts.

Proof

Observe that it suffices to prove that the given cycles can generate any even permutation in shifts. Indeed, if all cycles have odd length, they cannot generate any odd permutation. On the other hand, if there is a cycle of even length and we want to generate an odd permutation , we can shift tokens along that cycle, obtaining an odd permutation , and then we can generate the even permutation in shifts, obtaining .

Let us fix a set of relevant cycles : we will show how to generate any even permutation by shifting tokens only along relevant cycles. By properties (2) and (3) of generalized puzzles, there exists a walk on that visits all vertices (possibly more than once), traverses only edges of relevant cycles, and transitions from one relevant cycle to another only if they are properly interconnected, and only through a relevant vertex shared by them. We will now slightly modify so that it satisfies the hypotheses of Lemma 4, as well as some other conditions. Namely, if , , are any three vertices that are consecutive in , we would like the following conditions to hold:

1. , , are all distinct (this is the condition required by Lemma 4);

2. either and are in the same relevant cycle, or and are in the same relevant cycle;

3. and are either in the same relevant cycle, or in two properly interconnected relevant cycles.

To satisfy all conditions, it is sufficient to let do a whole loop around a relevant cycle before transitioning to the next (note that Lemma 4 applies regardless of the length of ). The only case where this is not possible is when has to go through a relevant 2-cycle that is a leaf in the induced subgraph , such that shares exactly one relevant vertex, say , with another relevant cycle . To let cover in a way that satisfies the above conditions, we set either or : that is, we skip after visiting . After this modification, is no longer a walk on , but it satisfies the hypotheses of Lemma 4, as well as the three conditions above.

We will now show that the 3-cycle can be generated in shifts, for all . By Lemma 4, we will therefore conclude that any even permutation of can be generated in shifts. Due to conditions (2) and (3), we can assume without loss of generality that and are both in the same relevant cycle , and that is either in or in a different relevant cycle which is properly interconnected with . In the first case, by property (1) of generalized puzzles, there exists another relevant cycle properly interconnected with . So, in all cases, and induce a 1-connected or a 2-connected -puzzle.

That the 3-cycle can be generated in shifts now follows directly from Theorems 3.2 and 3.1, except if and and share exactly two vertices: indeed, the 2-connected -puzzle is the only case where we cannot generate any 3-cycle. However, since we are assuming that , there must be a third relevant cycle , which is properly interconnected with or . Our claim now follows from Lemma 3.∎

4 NP-Hardness for Puzzles with Two Colors

In this section, we show that the 2-Colored Token Shift problem is NP-hard. That is, for a graph , cycle set , two token placements and for , and a non-negative integer , it is NP-hard to determine if .

Theorem 4.1

The 2-Colored Token Shift problem is NP-hard.

Proof

We will give a polynomial-time reduction from the NP-complete problem 3-Dimensional Matching, or 3DM [3]: given three disjoint sets , , , each of size , and a set of triplets , does contain a matching, i.e., a subset of size exactly such that all elements of , , appear in ?

Given an instance of 3DM , with , we construct the instance of the 2-Colored Token Shift problem illustrated in Fig. 5.

The vertex set of includes the sets , , (shown with a green background in the figure: these will be called green vertices), as well as the vertex . Also, for each triplet , with , the vertex set contains three vertices , , (shown with a yellow background in the figure: these will be called yellow vertices), and the cycle set has the three cycles , , and (drawn in blue in the figure). Finally, we have the vertex , and the vertices , , …, ; for each , the cycle set contains the cycle (drawn in red in the figure). In the initial token placement , there are black tokens on the vertices of the form , and white tokens on all other vertices. In the final token placement , there is a total of black tokens on all the vertices in , , , plus black tokens on , , …, ; all other vertices have white tokens. With this setup, we let .

It is easy to see that, if the 3DM instance has a matching , then . Indeed, for each , with , we can shift tokens along the three blue cycles containing the yellow vertices , , , thus moving their three black tokens into the green vertices , , and . Since is a matching, these shifts eventually result in , , and being covered by black tokens. Finally, we can shift the black tokens corresponding to triplets in along red cycles, moving them into the vertices , , …, . Clearly, this is a shifting sequence of length from to .

We will now prove that, assuming that , the 3DM instance has a matching. Note that each shift, no matter along which cycle, can move at most one black token from a yellow vertex to a non-yellow vertex. Since in there are black tokens on yellow vertices, and in no token is on a yellow vertex, it follows that each shift must cause exactly one black token to move from a yellow vertex to a non-yellow vertex, and no black token to move back into a yellow vertex.

This implies that no black token should ever reach vertex : if it did, it would eventually have to be moved to some other location, because does not hold a black token in . However, the black token in cannot be shifted back into a yellow vertex, and therefore it will be shifted into a green vertex along a blue cycle. Since every shift must cause a black token to leave the set of yellow vertices, such a token will move into : we conclude that will always contain a black token, which is a contradiction. Similarly, we can argue that the vertex should never hold a black token.

Let us now focus on a single triplet of yellow vertices , , . Exactly three shifts must involve these vertices, and they must result in the three black tokens leaving such vertices. Clearly, this is only possible if the three black tokens are shifted in the same direction. If they are shifted in the direction of (i.e., rightward in Fig. 5), they must move into green vertices (because they cannot go into ); if they are shifted in the direction of (i.e., leftward in Fig. 5), they must move into (because they cannot go into ).

Note that, if a black token ever reaches a green vertex, it can no longer be moved: any shift involving such a token would move it back into a yellow vertex or into . It follows that the only way of filling all the green vertices with black token is to select a subset of exactly triplets of yellow vertices and shift each of their black tokens into a different green vertex. These triplets of yellow vertices correspond to a matching for the 3DM instance.∎

In the above reduction, we can easily observe that the final token placement can always be reached from the initial token placement in a polynomial number of shifts. Therefore, for this particular set of instances, the 2-Colored Token Shift problem is in NP. The same is also true of the puzzles introduced in Section 3, due to the polynomal upper bound given by Theorem 3.3. However, we do not know whether this is true for the -Colored Token Shift problem in general, even assuming . A theorem of Helfgott and Seress [5] implies that, if , the distance between and has a quasi-polynomial upper bound; this, however, is insufficient to conclude that the problem is in NP. On the other hand, it is not difficult to see that the -Colored Token Shift problem is in PSPACE; characterizing its computational complexity is left as an open problem. It would also be interesting to establish if the problem remains NP-hard when restricted to planar graphs or to graphs of constant maximum degree.

References

• [1] László Babai. The Probability of Generating the Symmetric Group. Journal of Combinatorial Theory (Series A), 52:148–153, 1989.
• [2] Merrick Furst, John Hopcroft, and Eugene Luks. Polynomial-Time Algorithms for Permutation Groups. In Proceedings of the 21st Annual Symposium on Foundations of Computer Science, 36–41, 1980.
• [3] Michael R. Garey and David S. Johnson. Computers and Intractability: A Guide to the Theory of NP-Completeness. W. H. Freeman and Company, 1979.
• [4] Daniel Heath, I. M. Isaacs, John Kiltinen, and Jessica Sklar. Symmetric and Alternating Groups Generated by a Full Cycle and Another Element. The American Mathematical Monthly, 116(5):447–451, 2009.
• [5] Harald A. Helfgott and Ákos Seress. On the Diameter of Permutation Groups. Annals of Mathematics, 179(2):611–658, 2014.
• [6] Mark R. Jerrum. The Complexity of Finding Minimum-Length Generator Sequences. Theoretical Computer Science, 36:265–289, 1985.
• [7] Gareth A. Jones. Primitive Permutation Groups Containing a Cycle. Bulletin of the Australian Mathematical Society, 89(1):159–165, 2014.
• [8] Naomi Nishimura. Introduction to Reconfiguration. Algorithms, 11(4):1–25, 2018.
• [9] Joseph J. Rotman. An Introduction to the Theory of Groups. Springer-Verlag, 4th edition, 1995.
• [10] Richard M. Wilson. Graph Puzzles, Homotopy, and the Alternating Group. Journal of Combinatorial Theory (Series B), 16:86–96, 1974.
• [11] Katsuhisa Yamanaka, Takashi Horiyama, J. Mark Keil, David Kirkpatrick, Yota Otachi, Toshiki Saitoh, Ryuhei Uehara, and Yushi Uno. Swapping Colored Tokens on Graphs. Theoretical Computer Science, 729:1–10, 2018.

Appendix

Missing Proofs

Lemma 3

In a generalized puzzle with three relevant cycles, , such that and induce a 2-connected -puzzle, any permutation involving only vertices in and can be generated in shifts.

Proof

Let and be the permutations corresponding to shifting tokens along and , respectively. As in Section 3.1, we set and . Since we are assuming that , there must be a seventh vertex, and shifting along corresponds to a permutation of the form .

We will prove that it is always possible to generate a transposition of the form , with , in shifts. Indeed, such a transposition, together with the 5-cycle , induces a 1-connected -puzzle on . Our lemma will thus follow from Theorem 3.1 and the fact that, in a 1-connected -puzzle, the distance between any two token placements is bounded by a constant.

If , or if is 1-connected with or , then the transposition can be generated in shifts, due to Theorems 3.2 and 3.1. So, we may assume that , and is properly interconnected with and shares exactly two vertices with it. Perhaps, shares at least two vertices with , as well. The only possible configurations, up to symmetry, are the following:

1. . Then, and induce a 1-connected -puzzle on , and can generate the transposition by Theorem 3.1.

2. . Then, and induce a 2-connected -puzzle on , and can generate the transposition by Theorem 3.2.

3. . In this case, .

4. . In this case, .

5. . In this case, .

6. . In this case, .

7. . In this case, .

8. . In this case, .∎

Lemma 4

Let , and let be a sequence such that each element of appears in at least once, and any three consecutive elements of are distinct. Then, the set of 3-cycles can generate any even permutation of in shifts.

Proof

Let be the function mapping each to the minimum index such that . Let be the permutation of such that the sequence is monotonically increasing.

We will prove by induction on that can generate any 3-cycle on in at most shifts. Assume this claim to be true up to a certain , and let us prove it for . Let , and note that it suffices to prove that generates all 3-cycles in , because the 3-cycles on are already accounted for by the inductive hypothesis.

So, fix one such 3-cycle , and observe that already contains a 3-cycle in , namely . Indeed, we have , and, by the minimality of , there exist two distinct indices such that and .

If , then , and we are done. If and are disjoint, consider the 3-cycle , which, by the inductive hypothesis, can be generated by in at most shifts. We have , and so can generate in at most shifts.

Otherwise, and intersect in exactly one element, which we may assume to be , without loss of generality. In this case, , where is defined as above. So, can generate in at most shifts.

By taking , we conclude that can generate any 3-cycle on in at most shifts, implying that it can generate any even permutation of in shifts, due to Proposition 1.3.∎