The configuration space of a robotic arm in a tunnel of width 2

. We study the motion of a robotic arm inside a rectangular tunnel of width 2 . We prove that the conﬁguration space S of all possible positions of the robot is a CAT(0) cubical complex. Before this work, very few families of robots were known to have CAT(0) conﬁguration spaces. This property allows us to move the arm optimally from one position to another. Ardila, Owen


Introduction
We consider a robotic arm R n of length n moving in a rectangular tunnel of width 2 without selfintersecting. The robot consists of n links of unit length, attached sequentially, and its base is affixed to the lower left corner. Figure 1 illustrates two possible positions of an arm of length 8. The robot starts in the fully horizontal position, and is free to move using two kinds of local moves: • Switching corners: Two consecutive links facing different directions interchange their directions.
• Flipping the end: The last link of the robot rotates 90 • without intersecting itself. We study the following fundamental problem. Problem 1.1 Find the fastest way of moving the robotic arm R n from one position to another.
When we are in a city we do not know well and we are trying to get from one location to another, we will usually consult a map of the city to plan our route. This is a simple but powerful idea. Our strategy to approach Problem 1.1 will be to build and understand the "map" of all possible positions of the robot; this is called the configuration space or state complex S n . Following work of Reeves [9] and Abrams-Ghrist [1], Ardila, Baker, and Yatchak [2] showed that, if the configuration space of the robotic arm is CAT(0), Problem 1.1 can be solved efficiently. Thus Problem 1.1 motivates our main result. Theorem 1.2 The configuration space S n of the pinned-down robotic arm R n of length n in a tunnel of width 2 is a CAT(0) cubical complex.
In Section 3 we collect some preliminary evidence for this theorem. It follows from very general results of Abrams and Ghrist [1] that the configuration space S n is a cubical complex. Also, we know from work of Gromov [7] that S n will be CAT(0) if and only if it is contractible. Therefore, before proving Theorem 1.2, we first verify that S n has the correct Euler characteristic. We do it as follows. Theorem 1.3 Let S n be the configuration space for the robotic arm R n of length n moving in a rectangular tunnel of width 2. If c n,d denotes the number of d-dimensional cubes in S n , then n,d≥0 Notice that the Euler characteristic of S n is given by χ(S n ) = c n,0 −c n,1 +· · · . Substituting y = −1 in the above formula, we obtain the generating function for χ(S n ), which equals 1/(1−x) = 1+x+x 2 +· · · . We conclude: The Euler characteristic of the configuration space S n equals 1.
In Section 4 we sketch a proof of Theorem 1.2. Ardila, Owen, and Sullivant [4] gave a bijection between rooted CAT(0) cubical complexes X and simpler combinatorial objects P (X) called posets with inconsistent pairs or PIPs. This bijection allows us to prove (rooted) cubical complexes are CAT(0) by identifying their corresponding PIP. Following this approach, we show the following result which implies Theorem 1.2. Theorem 1.5 The PIP corresponding to the configuration space S n for the robotic arm R n of length n in a tunnel of width 2 is the extended coral PIP of Definition 4.4.
We use the PIP P (X) as a "remote control" to move the robot and navigate the space X. Using this remote control, we implement an algorithm to move the robotic arm in a tunnel of width 1 (using the results of [2]) and 2 (using Proposition 1.5) optimally, thus solving Problem 1.1.
We begin by considering the transition graph G(R n ) whose vertices are the possible states of the robot, and whose edges correspond to the allowable moves between them. Figure 4 and Figure 5 illustrate the transition graphs G(R 4 ) and G(R 6 ) of a robotic arm of length 4 and 6 respectively.
As these examples illustrate, each one of these graphs is the 1-skeleton of a cubical complex. For example, consider a position u which has two legal moves a and b occuring in disjoint parts of the arm. We call a and b physically independent or commutative because a(b(u)) = b(a(u)). In this case, there is a square connecting the vertices u, a(u), b(a(u)) = a(b(u)), and b(u) in G(R n ). This is a general phenomenon, which we now make precise.  Definition 2.1 The configuration space or state complex S(R n ) of the robot R n is the following cubical complex. The vertices correspond to the states of R n . An edge between vertices u and v corresponds to a legal move which takes the robot between positions u and v. The k-cubes correspond to k-tuples of commutative moves: Given k such moves which are applicable at a state u, we can obtain 2 k different states from u by performing a subset of these k moves; these are the vertices of a k-cube in S(R n ).
• there is a unique geodesic (shortest) path between any two points in X, and • X has non-positive global curvature.
The second property, illustrated in Figure 6, may be described as follows. Let T be a triangle in X of side lengths a, b, c, and let T be the triangle with the same lengths in the Euclidean plane. Consider a chord of length d in T which connects two points on the boundary of T ; there is a corresponding comparison chord in T , say of length d . If d ≤ d for any chord in T , we say that T is a thin triangle in X. The metric space X has non-positive global curvature if every triangle in X is thin.

The link condition.
There is a well-known combinatorial approach to determining when a cubical complex is nonpositively curved due to Gromov. , is defined to be the abstract simplicial complex whose k-dimensional simplices are the (k + 1)-dimensional cells incident to v with the natural boundary relationships.
Certain global topological features of a metric cubical complex are completely determined by the local structure of the vertex links: a theorem of Gromov [26] asserts that a finite dimensional Euclidean cubical complex is NPC if and only if the link of every vertex is a flag complex without digons. Recall: a digon is a pair of vertices connected by two edges, and a flag complex is a simplicial complex which is maximal among all simplicial complexes with the same 1-dimensional skeleton. Gromov's theorem permits us an elementary proof of the following general result.  The CAT(0) property is particularly favorable for configuration spaces, as the next result shows. 2,9] If the configuration space of a robot is a CAT(0) cubical complex, there is an algorithm to find the fastest way of moving the robot from one position to another.
As explained in [2], Theorem 2.3 applies to three natural definitions of "fastest", in terms of: • the number of moves, if only one move at a time is allowed, • the number of steps (where in each step we may perform several physically independent moves), • time elapsed.
One could also ask for the shortest path between two points in a CAT(0) cubical complex under the Euclidean metric. This seems to be a more difficult problem, as explained by Ardila-Owen-Sullivant in [4]. In any case, the Euclidean metric is less relevant to robotic applications.
3 Face enumeration and the Euler characteristic of S n Definition 2.2 does not provide an efficient way of testing whether a space is CAT(0). Gromov proved the groundbreaking result that for cubical complexes, this metric property has a topological-combinatorial characterization: if and only if it is simply connected, and the link of every vertex is a flag simplicial complex.
Recall that a simplicial complex ∆ is flag if it has no empty simplices; that is, if the 1-skeleton of a simplex is in ∆, then that simplex must be in ∆. It is clear from the definition of S n that the link of every vertex is flag. Furthermore, notice that non-simply connected spaces cannot be contractible, while CAT(0) spaces are contractible [5]. Therefore, Theorem 1.2 is equivalent to proving that S n is contractible. In this section, we prove the following partial result in that direction.

Face enumeration.
Let us compute the generating function for the f -vectors of the configuration spaces S n .

States of the robot with a link facing to the left.
We first observe that the robotic arm may reach a state where the end of the arm is facing to the left as illustrated in Figure 7. However, since the robot never self intersects, we have at most one link facing left.

Cubes and partial states
Consider a d-cube in the configuration space S n ; it has 2 d vertices. If one superimposes the corresponding 2 d positions of the robotic arm, one obtains a sequence of edges, squares, and possibly a "claw" in the last position, as illustrated in Figure 9. The number of squares (including the claw if it is present) is d, corresponding to the d physically independent moves that are being represented by this cube. We call the resulting diagram a partial state, and let its weight be x n y d . It is clear that the partial states of weight x n y d are in bijection with the d-cubes of S n . Each partial state gives rise to a word in the alphabet {r, v, , , , }, where: • r represents a horizontal link of the robot facing to the right. Its weight is x.
• v represents a vertical link. Its weight is x.
• represents a horizontal link facing to the left. Its weight is x.
• represents a square, which comes from a move that switches corners of two consecutive links facing different directions. Its weight is x 2 y.
• represents a claw, which comes from a move that flips the end of the robot, with the horizontal link facing to the right. Its weight is xy.
• represents a claw, which comes from a move that flips the end of the robot, with the horizontal link facing to the left. Its weight is xy.
For example, the partial state of Figure 9 gives rise to the word r rv r rr rrv . The weight of the partial state is the product of the weights of the individual symbols; in this case it is x 20 y 6 , which is equal to the product x(x 2 y)(x 2 y)xx(x 2 y)x(x 2 y)xx(x 2 y)xxx(xy). It is worth remarking that this word does not determine the partial state uniquely.

Factorization of partial states into irreducibles.
Our next goal is to use generating functions to enumerate all partial states according to their length and dimension. The key idea is that we can "factor" a partial state uniquely as a concatenation of irreducible factors. Each new time that the partial state hits one of the borders of the tunnel, we start a new factor. For example, the factorization of the partial state of Figure 9 is shown in Figure 10.   Tables 1 and 2.) • its first step is a horizontal link along the bottom border of the tunnel, and • either it never arrives to a border, or it arrives in its final step, which is a claw. Let M and F be the sets of irreducible and irreducible final partial states, respectively. . . m ± f ± where each m i ∈ M , f ∈ F , and p ± equals p or its reflection p − across the horizontal axis. It remains to observe that whether m ± i is m i or m − i (and whether p ± is either p or p − ) is determined by the previous terms of the sequence.
Corollary 3.6 If the generating functions for partial states, irreducible partial states, and irreducible final partial states are C(x, y), M (x, y), F (x, y) respectively, then .
Proof: This follows from Proposition 3.5. The extra factor of x comes from the fact that Proposition 3.5 is counting partial states with an initial right step.

Enumeration of irreducible partial states.
Proposition 3.7 The generating function for the irreducible partial states M is Proof: An irreducible partial state has exactly two symbols that contribute a vertical move, which can be either a v or a . where and v represent a move whose vertical step is in the opposite direction to the previous vertical step. Table 1 illustrates these 8 families together with their corresponding generating functions.

Type
Illustration Generating function Tab. 1: Generating functions for the eight types of irreducible partial states.
Consider for example the family M 2 . We must have at least one horizontal step before the first , and at least one horizontal step between the two s, to make sure they do not intersect. Therefore the partial states in M 2 are given by (rr * ) (rr * ) , whose generating function is The other formulas follow similarly. Thus M (x, y) = m 1 (x, y) + · · · + m 8 (x, y) is obtained by adding the generating functions in Table 1.

Enumeration of irreducible final partial states.
Now let us compute the generating function F (x, y) for irreducible final partial states.
Proposition 3.8 The generating function for the final irreducible partial states is Proof: Each irreducible final partial state has at most one symbol among {v, }, and can possibly end with a symbol in { , , }. Again, we let and represent a move whose vertical step is in the opposite direction to the previous vertical step. Table 2 shows the 10 different families of possibilities together with their corresponding generating functions. The generating function of F is f (x, y) = f 1 (x, y) + · · · + f 10 (x, y). The result is then obtained by adding the generating functions in Table 2.
Theorem 3.10 The Euler characteristic of the configuration space S n equals 1.
Proof: Since the Euler characteristic of S n is χ(S n ) = d≥0 (−1) d c n,d , the generating function for χ(S n ) is given by substituting y = −1 into Theorem 3.9: in an expected but still beautiful miracle of cancellation. All the coefficients of this series are equal to 1, as desired.

Posets with inconsistent pairs (PIPs)
Determining whether a metric space X is CAT(0) is a rather subtle question in general; it should be clear that Definition 2.2 is not a very tractable method, as it would require checking the length of every chord in every triangle in X. Fortunately, Gromov [7] showed that when X is a cubical complex, this metric property has the combinatorial and topological characterization stated in Theorem 3.1. In fact, for finite CAT(0) cubical complexes, there are several combinatorial characterizations [4,10,11,12]. We will use the one given by Ardila, Owen, and Sullivant in [4], which we now describe.  if p q and q < q then p q .
The Hasse diagram of a poset with inconsistent pairs (PIP) is obtained by drawing the poset, and connecting each <-minimal inconsistent pair with a dotted line. The left panel of Figure 11 shows an example.
Recall that an order ideal of P is a subset I such that if x < y and y ∈ I then x ∈ I. We say that I is consistent if it contains no inconsistent pair.
Each PIP P gives rise to a rooted cube complex, which we denote X(P ). The vertices of X(P ) are identified with the consistent order ideals of P . There will be a cube C(I, M ) for each pair (I, M ) of a consistent order ideal I and a subset M ⊆ I max , where I max is the set of maximal elements of I. This cube has dimension |M |, and its vertices are obtained by removing from I the 2 |M | possible subsets of M . The cubes are naturally glued along their faces according to their labels. The root is the vertex corresponding to the empty order ideal. Figure 11 shows a PIP P and the corresponding complex X(P ), which is rooted at v.   4.2 offers a useful technique to prove that a configuration space is a CAT(0) cubical complex; we "simply" have to choose a root for it, and find the corresponding PIP. Of course, carrying this task out is a non-trivial matter, as will soon become apparent. We propose the following solution for the robotic arm in a tunnel of width 2. Definition 4.3 Define the coral PIP C n as follows.
• The elements are non-decreasing k-tuples (a 1 , . . . , a k−1 ; a k ) such that a k ≤ n and • The element (a 1 , . . . , a k−1 ; a k ) is covered by at most 3 elements: • The minimal inconsistent pairs are (a 1 , . . . , a k−1 ; n) (a 1 + 1, . . . , a k−1 + 1, n; n) The colored figure above illustrates the coral PIPs for n = 1, 2, . . . , 9; every time we add a new link to the arm, we add a new layer (indicated by a new color) to the PIP.
The vertices L 1 and L 2 correspond to the two simplest positions of the arm having a left step, namely, r . . . rul and r . . . ruurrdl respectively.
Theorem 4.5 The configuration space S n of the robotic arm of length n in a tunnel of width 2 is a CAT(0) cubical complex. Its corresponding PIP is the extended coral PIP C n of Definition 4.4.
One can verify directly that the bijection P → X(P ) of Theorem 4.2 sends the coral PIP C n to the configuration space S n . However, the proof becomes simpler when it is framed in a more general setting.
In an upcoming paper [3] we study the robotic arm of length n with no left steps in a tunnel of any width, and prove that its configuration space is a CAT(0) cubical complex. The more general coral PIP, which generalizes Definition 4.3, is described in terms of combinatorial objects called coral snake tableaux. For details and proofs, see [3].

Implementation of the shortest path algorithm
Theorem 5.1 [1,2,9] If the configuration space of a robot is a CAT(0) cubical complex, there is an algorithm to move the robot optimally from one position to another, in terms of: • the number of moves, if only one move at a time is allowed, • the number of steps (where in each step we may perform several physically independent moves), • time elapsed.