# Recognizing the Repeatable Configurations of Time-Reversible Generalized Langton’s Ant Is PSPACE-Hard

^{*}

## Abstract

**:**Chris Langton proposed a model of an artificial life that he named “ant”: an agent- called ant- that is over a square of a grid moves by turning to the left (or right) accordingly to black (or white) color of the square where it is heading, and the square then reverses its color. Bunimovich and Troubetzkoy proved that an ant's trajectory is always unbounded, or equivalently, there exists no repeatable configuration of the ant's system. On the other hand, by introducing a new type of color where the ant goes straight ahead and the color never changes, repeatable configurations are known to exist. In this paper, we prove that determining whether a given finite configuration of generalized Langton's ant is repeatable or not is PSPACE-hard. We also prove the PSPACE-hardness of the ant's problem on a hexagonal grid.

## 1. Introduction

#### 1.1. Generalized Langton's Ant

The virtual ant defined by Chris Langton [1-3] is the following cellular automaton. The “ant”, represented by a pair (z, D) of a lattice point z ∈ ℤ^{2} ≔ ℤ + iℤ and a direction
$D\in \left\{{e}^{0},{e}^{\frac{\pi}{2}i},{e}^{\pi i},{e}^{\frac{3\pi}{2}i}\right\}$, moves around on a two-dimensional square lattice ℤ^{2}, where each lattice point, referred to as a “cell”, is colored by white or black (later we will also introduce gray cells). Initially, the ant is sitting on a given cell with a given direction, say z = 0 and D = 1. It proceeds to travel from cell to cell according to the following rule (see Figure 1): the ant (z, D) moves to
$\left(z+D,{e}^{\frac{\pi}{2}i}D\right)$ when z + D is a white cell, and to
$\left(z+D,{e}^{-\frac{\pi}{2}i}D\right)$ when z + D is a black cell; the cell z + D then reverses its color. In other words, the ant moves in the direction it is heading; when it lands on a white (or black) cell it rotates its direction 90° to the right (left); after that, the color of the cell changes to black (or white).

Langton's ant has been investigated independently as one model of Lorentz Lattice Gas Cellular Automata (LLGCA). Langton's ant corresponds to the Flipping Rotator (FR) model on ℤ^{2} [4]. In more general terms, the FR model was investigated on a triangular lattice
${\mathbf{\text{T}}}^{2}=\mathbb{Z}+{e}^{\frac{\pi}{3}i}\mathbb{Z}$ [5] and on a hexagonal lattice
${\mathbf{\text{H}}}^{2}={\mathbf{\text{T}}}^{2}-\sqrt{3}{e}^{\frac{\pi}{6}i}{\mathbf{\text{T}}}^{2}$ [6], too. On **H**^{2} the ant (z, D), where z ∈ **H**^{2} and
$D\in \left\{{e}^{\frac{2k\pi}{3}i}:k=0,1,2\right\}$, moves to
$\left(z+D,{e}^{\frac{2\pi}{3}i}D\right)$ and
$\left(z+D,{e}^{-\frac{2\pi}{3}i}D\right)$ when z + D is white and black, respectively (see Figure 1), and the cell z + D then reverses its color. Another generalization of Langton's ant on ℤ^{2} is to introduce a third type of cell, called “gray” cell [7]. The ant (z, D) moves to (z + D, D) if z + D is a grey cell, and the cell z + D never changes its color but remains gray forever (see Figure 1). In LLGCA models, gray cells were introduced naturally as empty lattice points. We remark that the **H**^{2} topology does not allow having such a gray cell.

We denote by R, L and S the ant's valid moves corresponding to the Right-turn, Left-turn and Straight-ahead respectively under these transaction rules; e.g., by R, L and S, the ant (z, D) on ℤ^{2} moves to
$\left(z+D,{e}^{\frac{\pi}{2}i}D\right)$,
$\left(z+D,{e}^{-\frac{\pi}{2}i}D\right)$ and (z + D, D), respectively.

#### 1.2. Recognizing the Repeatable Configurations of GLA

These transaction rules assure that Generalized Langton's Ant (GLA) is a time-reversible cellular automaton: the current configuration of GLA, consisting of a coloring of the cells and an ant's starting cell and direction, determines the past configurations as well as the future ones. As a consequence, the configurations of GLA are divided into the following two kinds: an ant's trajectory starting from a configuration of one kind is unbounded, never repeating the same configuration again; an ant's trajectory starting from a configuration of the other kind is bounded, repeating a finite series of configurations an infinitive number of times.

A “finite” configuration of GLA is defined by a finite coloring of the cells and an ant's starting cell and direction. Here, a coloring is finite if it has only a finite number of non-background-color cells. In this paper, we use the all white, all black, and half-and-half coloring as the background, where the half-and-half coloring gives white (black) color to the cells on the upper-half (lower-half) plane (see Figure 2Figure 2). We define size of a configuration by the minimum size of a closed square which contains the ant's starting cell and the all non-background-color cells. In this paper, we study the computational complexity of determining whether a given finite configuration of GLA is repeatable or not.

#### 1.3. Previous Results

Bunimovch and Troubetskoy [4] proved the following: when there is no gray cell, an ant's trajectory on ℤ^{2} is always unbounded, or equivalently, there exists no repeatable configuration of the ant's system. As a matter of fact, the set of repeatable configurations of GLA on ℤ^{2} with no gray cell is empty, hence its recognition problem is trivial. On the other hand, repeatable configurations exist of GLA on ℤ^{2} with some gray cells (see Figure 3, see also [8]). The **H**^{2} model is also known to have repeatable configurations (see Figure 3, see also [6]).

The long-run behavior of Langton's ant on ℤ^{2} has been studied using both theories and experiments for more than two decades, yet it is still highly unpredictable. As a result, indicating hardness of the prediction, Gajardo, Moreira and Goles [9] proved that the following problem on ℤ^{2} with no gray cell is PTIME-hard: “Does the ant ever visit this given cell?”.

#### 1.4. New Results

In this paper, we prove the following theorems:

#### Theorem 1

Recognizing the repeatable configurations of GLA on ℤ^{2} with gray cells is PSPACE-hard.

#### Theorem 2

Recognizing the repeatable configurations of GLA on **H**^{2} is PSPACE-hard.

To prove these theorems, we should have unbounded trajectories of the ant on each of the topologies. For the half-and-half background, Figure 2 shows such unbounded trajectories where the ant, starting from the arrow, walks from left to right by repeating the LLRR (LLLRRR) moves forever on ℤ^{2} (**H**^{2}). On the other hand, for the monochromatic background, we do have the famous diagonal highway on ℤ^{2} (see Figure 4), but no provable unbounded trajectory is known on **H**^{2} [6]. For this reason, we can prove Theorem 1 for both of the monochromatic and half-and-half backgrounds, but Theorem 2 for only the half-and-half background.

We will prove Theorem 1 for “everywhere sparse” gray cells. For a given function f: ℕ → ℕ, we say that a configuration is colored by f-sparse gray cells if the configuration size is n and its coloring has no more than one gray cell within any closed square of size no more than
$\frac{n}{\sqrt{f(n)}}$. For example, a configuration colored by k-sparse gray cells, for any constant k ∈ ℕ, contains no more than k gray cells, and a configuration colored by n^{2}-sparse gray cells could have an arbitrary number of gray cells. We prove the following theorem:

#### Theorem 3

For any ε > 0 recognizing the repeatable configurations of GLA on ℤ^{2} colored by n^{ε}-sparse gray cells is PSPACE-complete.

#### 1.5. Reduction

To prove Theorems 1–3, it is enough to reduce a known PSPACE-hard problem to the ant's problems on square and hexagonal grids. In this paper, we will reduce QBF (Quantified Boolean Formula) evaluation problem to the ant's problems. An instance of QBF is given by a closed CNF (Conjunctive Normal Form) formula, which is written as Q_{1}x_{1}Q_{2}x_{2}^{…}Q_{n}x_{n}ϕ(x_{1},…,x_{n}) by an open CNF formula ϕ(x_{1},…,x_{n}) and arbitrary Boolean quantifiers Q_{i} ∈ {∃, ∀}. Then, QBF evaluation problem asks the truth value of a given closed CNF formula. QBF evaluation problem is a well known PSPACE-complete problem [10].

#### 1.6. Preparation

A (ant's walking) course is a sequence of ant's consecutive valid moves; it also represents a sequence of the induced coloring. When a coloring S of the ant's system turns to a coloring T by an ant's walking course w, we write as
$S\stackrel{w}{\to}T$. When the ant, at a place I, moves to another place O by w, we write it as
$I\stackrel{w}{\to}O$. The reverse of the ant (z, D) is (z + D, − D). By time reversibility, we can define the reverse w^{−1} of w by the following walking course: reverse the order of the coloring in w, and reverse the ants therein. We write
$S\underset{{w}^{-1}}{\overset{w}{\rightleftarrows}}T$, meaning that S turns to T by w, and T turns to S by w^{−1}.

## 2. Gadgets

A gadget is a collection of GLA's coloring written on the all white background with an associated transition diagram and several input and output marked arrows. A polynomial number of gadgets are seamlessly connected to form an entire coloring of GLA, where some gadgets may be used after rotation or reflection. Note that the colors of reflected gadgets should be switched.

#### 2.1. Path

We connect the rotations and reflections of PATH gadgets (see Figure 5) to form a long path along which the ant is guided. Its coloring is initially INIT, which turns to USED by a course $IN\stackrel{w}{\to}\mathit{\text{OUT}}$.

#### 2.2. Switch & Pass

A Switch & Pass (S&P) gadget (see Figure 6) can memorize 1 bit information by its coloring state. The coloring is initially OFF, which turns to ON by a walking course
${I}_{\text{S}\&\text{P}}\stackrel{{w}_{1}}{\to}{\text{O}}_{\text{S}\&\text{P}}$; in other words, the ant is “Switching” the coloring state and “Passing” through it. When the coloring is OFF, the ant entering at IN walks along w_{2} and exits at O_{OFF}, changing the coloring to UOFF. When the coloring is ON, the ant entering at IN walks along w_{3} and exits at O_{ON}, changing the coloring to UON.

#### 2.3. Switch & Turn

A Switch & Turn (S&T) gadget (see Figure 7) can memorize 1 bit information by its coloring state, too. The coloring is initially OFF, which turns to ON by an ant's walking course
${I}_{\text{S}\&\text{T}}\stackrel{{w}_{1}}{\to}{O}_{\text{S}\&\text{T}}$; in other words, since O_{S&T} is the reverse of I_{S&T}, the ant is “Switching” the coloring state and “Turning” around. When the coloring is OFF, the ant entering at IN walks along w_{2} and exits at OUT_{OFF}. When the coloring is ON, the ant entering at IN walks along w_{3} and exits at OUT_{ON}.

#### 2.4. Conjunction

The CONJunction (CONJ) gadget (see Figure 8, see also [9]) has two entrances and one exit. The coloring is initially INIT. The ant entering at IN_{j} walks along w_{j} and exits at OUT, for each j =1, 2.

#### 2.5. Pseudo-Crossing

A Pseudo-Crossing (PC) gadget (see Figure 9, see also [9]) has two entrances IN_{1} and IN_{2} and two exits OUT_{1} and OUT_{2} such that the ant entering at IN_{j} walks along w_{j} and exits at OUT_{j} for each j = 1, 2. Since IN_{1}, IN_{2}, OUT_{1}, OUT_{2} are placed clockwise in this order in 2D plane, these two walking courses w_{1} and w_{2} should be mutually crossing. Beginning from the initial coloring INIT, the ant can take mutually intersecting courses, first
${\mathit{\text{IN}}}_{1}\stackrel{{w}_{1}}{\to}{\mathit{\text{OUT}}}_{1}$ and secondly
${\mathit{\text{IN}}}_{1}\stackrel{{w}_{3}}{\to}{\mathit{\text{OUT}}}_{1,2}$ order, changing the coloring to
$\mathit{\text{INIT}}\stackrel{{w}_{1}}{\to}{\mathit{\text{USED}}}_{1}\stackrel{{w}_{3}}{\to}{\mathit{\text{USED}}}_{1,2}$.

#### 2.6. Crossing

A CROSSing (CROSS) gadget (see Figure 10) is placed at each crossing point of two intersecting paths on 2D plane. It is built by one S&P gadget and three PC gadgets, named PC_{1}, PC_{2} and PC_{3}. The coloring of a CROSS gadget can be represented by the coloring of all gadgets composing it, that are S&P, PC_{1}, PC_{2}, PC_{3}, two CONJ gadgets and many PATH gadgets connecting them. We indicate the coloring of a CROSS gadget only by those of (S&P, PC_{1}, PC_{2}, PC_{3}). The coloring of CONJ (PATH) gadgets and PATH gadgets are initially INIT, that turn to USED_{j} (USED) when the ant has passed through them. The ant can take mutually intersecting courses by first
${\mathit{\text{IN}}}_{1}\stackrel{{w}_{1}}{\to}{\mathit{\text{OUT}}}_{1}$ and secondly
${\mathit{\text{IN}}}_{2}\stackrel{{w}_{3}}{\to}{\mathit{\text{OUT}}}_{2}$, as well as by first
${\mathit{\text{IN}}}_{2}\stackrel{{w}_{2}}{\to}{\mathit{\text{OUT}}}_{2}$ and secondly
${\mathit{\text{IN}}}_{1}\stackrel{{w}_{4}}{\to}{\mathit{\text{OUT}}}_{1}$. In Figure 10, each of these paths are depicted by thick lines, where those gadgets that passed through are shown by the thick lines that have turned to used coloring, while the other gadgets remain in their initial coloring.

## 3. CNF Formulae Evaluation

In this section, we construct an EVAL_{ϕ} gadget for evaluating the truth value of a CNF formula ϕ by inputting a given truth-value assignment a. It has one entrance IN and two exits OUT_{FALSE} and OUT_{TRUE}. The ant entering at IN is routed to exit at OUT_{FALSF} (OUT_{TRUE}) if ϕ(a) is FALSE (TRUE).

Let POS = {x_{1},…,x_{n}} and NEG = {−x_{1},…, −x_{n}}. Let y_{i,j} ∈ POS ∪ NEG be the jth literal in the ith term of ϕ(x_{1},…,x_{n}), where 1 ≤ i ≤ m and 1 ≤ j ≤ k_{i}. These literals y_{i,j} are implemented in EVAL_{ϕ}, by S&P gadgets, named S&P_{i,j}. Then, draw PATHs between S&P_{i,j} in the following manner to define an evaluator EVAL_{ϕ} of ϕ: IN → IN of S&P_{1,1} (see Figure 11-1). When y_{i,j} ∈ POS (NEG), OUT_{OFF} (OUT_{ON}) of S&P_{i,j} → IN of S&P_{i,j+1} (see Figure 11-2). When y_{i,ki} ∈ POS(NEG), OUT_{OFF} (OUT_{ON}) of S&P_{i,ki} → OUT_{FALSE} (see Figure 11-3). When y_{m,j} ∈ POS (NEG), OUT_{ON} (OUT_{OFF}) of S&P_{m,j} → OUT_{TRUE} (see Figure 11-4).

For each x_{k} ∈ POS, EVAL_{ϕ} has an entrance I_{xk} and an exit O_{xk} such that the ant entering at I_{xi} switches the coloring states of all S&P gadgets corresponding to the literals y_{i,j} ∈ {x_{k}, -x_{k}} from OFF to ON, and exits at O_{xi}. Figure 11-5 is drawing such PATHs, where the ports I_{x1}, O_{x1}, I_{x2}, O_{x2},…,I_{xn}, O_{xn} should be placed in this order for further development in the next section.

Suppose that the coloring of the composing gadgets of EVAL_{ϕ} are all initialized. For every a ∈ {FALSE, TRUE}^{n}, we denote by INIT_{a} the coloring of EVAL_{ϕ} after taking the walking courses I_{xk} → O_{xk} for all x_{k} such that a_{xk} = TRUE in the descending order of k. Consequently, INIT_{a} sets the coloring of every S&P_{i,j}, with y_{i,j} ∈ {x_{k}, −x_{k}} OFF(ON) if a_{k} = FALSE (TRUE).

#### Lemma 1

If the coloring of EVAL_{ϕ} is INIT_{a} and ϕ(a) = FALSE (TRUE), then the ant entering at IN exits at OUT_{FALSE} (OUT_{TRUE}).

#### Proof

First, suppose that ϕ (a) = FALSE. We can assume that the ℓth term of ϕ is FALSE and the ith term of ϕ is TRUE for every 1 ≤ i < l. So, we can assume that for every 1 ≤ j ≤ k_{ℓ}, if y_{ℓ,j} ∈ POS (NEG) then S&P_{ℓ,j} is OFF (ON), and for every 1 ≤ i < l there exits 1 ≤ j_{i} ≤ k_{i} such that if y_{i,ji} ∈ POS (NEG) then S&P_{i,ji}, is ON(OFF); in addition, for every 1 ≤ j < j_{i}, if y_{i,j} ∈ POS (NEG) then S&P_{i,j} is OFF (ON). Given these colorings of the S&Ps, the ant walks from IN to OUT_{FALSE} in the following way: IN → IN of S&P_{1,1}; IN of S&P_{i,j} → OUT_{OFF} (OUT_{ON}) of S&P_{i,j} → IN of S&P_{i,j}_{+1}; IN of S&P_{i,ji} → OUT_{ON} (OUT_{OFF}) of S&P_{i,ji} → IN of S&P_{i}_{+1,1}; IN of S&P_{ℓ,j} → OUT_{OFF} (OUT_{ON}) of S&P_{ℓ,j} → IN of S&P_{ℓ,j}_{+1}; IN of S&P_{ℓ,kℓ} → OUT_{OFF} (OUT_{ON}) of S&P_{ℓ,kℓ} → OUT_{OFF}. Figure 11-6 illustrates this walking course by a thick line when ϕ = (x_{1} V −x_{2}) Λ (−x_{1} V x_{2}) and (a_{1}, a_{2}) = (TRUE, FALSE), where the gadgets have passed through, shown by the thick line, have turned to used coloring states, while the other gadgets still remain in their initial coloring.

Secondly, suppose that ϕ(a) = TRUE. Then, all terms of ϕ are TRUE. So, we can assume that for every 1 ≤ i ≤ m there exits 1 ≤ j_{i} ≤ k_{i} such that if y_{i,ji} ∈ POS (NEG) then S&P_{i,ji} is ON(OFF); in addition, for every 1 ≤ j < j_{i}, if y_{i,j} ∈ POS (NEG) then S&P_{i,j} is OFF (ON). Given these colorings of the S&P s, the ant walks from IN to OUT_{TRUE} in the following way: IN → IN of S&P_{1,1}; IN of S&P_{i,j} → OUT_{OFF} (OUT_{ON}) of S&P_{i,j} → IN of S&P_{i,j}_{+1}; IN of S&P_{i,ji} → OUT_{ON} (OUT_{OFF}) of S&P_{i,ji} → IN of S&P_{i}_{+1,1}; IN of S&P_{m,j} → OUT_{OFF} (OUT_{ON}) of S&P_{m,j} → IN of S&P_{m,j}_{+1}; IN of S&P_{m,jm} → OUT_{ON} (OUT_{OFF}) of S&P_{m,jm} → OUT_{ON}. Figure 11-7 illustrate this walking course when ϕ = (x_{1} V −x_{2}) Λ (−x_{1} V x_{2}) and (a_{1}, a_{2}) = (TRUE, TRUE).

Let USED_{a} be the coloring of an EVAL_{ϕ} gadget derived from INIT_{a} by the ant's walking course from the entrance to an exit of EVAL_{ϕ}.

## 4. Boolean Quantifiers Evaluation

Let ϕ(x_{1},…,x_{n}) be an arbitrary CNF formula of the variables x_{1},…,x_{n}. For arbitrary taken quantifiers Q_{i} ∈ {∃, ∀}, let ϕ_{i}(x_{1},…,x_{i}) ≔ Q_{i}_{+1}x_{i}_{+1}Q_{i}_{+2}x_{i}_{+2} … Q_{n}x_{n}ϕ(x_{1},…,x_{n}). In particular, ϕ_{n}(x_{1},…,x_{n}) = ϕ(x_{1},…,x_{n}). Let EVAL_{n} ≔ EVAL_{ϕ} built in the previous section. We have already defined INIT_{n,a} ≔ INIT_{a} as a coloring of EVAL_{n} for every a ∈ {FALSE, TRUE}^{n}. In the following, for each i = n, n − 1,…,0, we define inductively an EVAL_{i}, gadget and its coloring INIT_{i, a} for every a ∈ {FALSE, TRUE}^{i}. Figure 12 depicts our construction of an EVAL_{i} gadget when Q_{i}_{+1} = ∀, containing an already constructed EVAL_{i}_{+1} gadget. We describe the coloring of EVAL_{i} by those of the (S&T, S&P, CONJ, EVAL_{i}_{+1}) gadgets therein. For a ∈ {FALSE, TRUE}^{i} and b ∈ {FALSE, TRUE}, let (a,b) = (a_{1},…,a_{i},b) ∈ {FALSE, TRUE}^{i}^{+1}. Let INIT_{i,a} be the coloring of EVAL_{i}, that sets the coloring of the (S&T, S&P, CONJ, EVAL_{i}_{+1}) gadgets as (UOFF, OFF, INIT, INIT_{i+1 (a, FALSE)}); the coloring of the other gadgets are set to be initialized. Then, we denote by USED_{i, a} the coloring derived from INIT_{i, a} by the ant's walking course from the entrance to an exit of EVAL_{i}. We have already defined USED_{n, a} ≔ USED_{a}. In the following lemma, USED_{i, a} are inductively defined, too.

#### Lemma 2

For every a ∈ {FALSE, TRUE}^{i}, if the coloring of EVAL_{i} is INIT_{i, a} and ϕ_{i}(a_{1},…,a_{i}) = FALSE (TRUE) then the ant entering to the EVAL_{i} gadget at IN_{i} exits at OUT_{i, FALSE} (OUT_{i, TRUE}).

#### Proof

Lemma 1 proves the i = n case of Lemma 2. Let a ∈ {FALSE, TRUE}^{i}. By the backward induction hypothesis, Lemma 2 is assumed to hold for both ϕ_{i}_{+1}(a, FALSE) and ϕ_{i}_{+1}(a, TRUE). In the following proof, we prove Lemma 2 for ϕ_{i}(a) when Q_{i} = Q_{∀}.

#### Case 1

Suppose that ϕ_{i}_{+1}(a, FALSE) = FALSE. The ant walks as follows (Figure 12-1): IN_{i} → S&T → CONJ → IN_{i}_{+l}, changing the coloring of (S&T, CONJ) from (UOFF, INIT) to (OFF, USED_{1}); next, since the coloring of EVAL_{i}_{+1} is INIT_{i+1,(a, FALSE)}, by Lemma 2 for ϕ_{i}_{+1}(a, FALSE), the ant starting from IN_{i}_{+1} reaches to OUT_{i+1, FALSE}, which changes the coloring of EVAL_{i}_{+1} from INIT_{i+1, (a, FALSE)} to USED_{i+1, (a, FALSE)}; finally, the ant walks from OUT_{i}_{+1, FALSE} to OUT_{i, FALSE}.

#### Case 2

Suppose ϕ_{i}_{+1}(a, FALSE) = TRUE and ϕ_{i}_{+1}(a, TRUE) = FALSE. First, the ant walks as follows (see Figure 12-2): IN_{i} → S&T → CONJ → IN_{i}_{+1}; next, since ϕ_{i}_{+1}(a, FALSE) = TRUE, the ant entering EVAL_{i}_{+1} at IN_{i}_{+1} reaches to OUT_{i}_{+1, TRUE}, changing the coloring of EVAL_{i}_{+1} from INIT_{i}_{+1, (}_{a}_{, FALSE)} to USED_{i+1 (a, FALSE)}; after that, the ant walks as OUT_{i}_{+1, TRUE} → IN of S&P → OUT_{OFF} of S&P → I_{S&T}, which change the coloring of the S&P gadget from OFF to ON, and the coloring of the PATHs taken from INIT to USED; then, getting into the S&T gadget, the ant turns around and exits at O_{S&T}, switching the coloring of the S&T gadget from OFF to ON.

Secondly, the ant takes the following reversed walking course (see Figure 12-3): O_{S&T} → S&P → EVAL_{i}_{+1} → CONJ → IN of S&T, changing the colorings of (S&P, EVAL_{i}_{+1}, CONJ) from (UOFF, USED_{i+1, (a, FALSE)}, USED_{1}) to (ON, INIT_{(a, FALSE)}, INIT); the coloring of the taken PATH taken and CROSS gadgets are initialized, too.

We remark that the gadgets that passed through, shown by the dotted line in Figure 12-3, are those gadgets that changed to the used color by the ant's forward walking, but then initialized by the ant's backward walking. These gadgets can be used again without violating the rules of the transition diagram given in Section 2; in other words, the already completely used gadgets, e.g., USED PATH gadgets or USED_{1,2} CROSS gadgets, will never be used without being initialized in this manner.

Finally, the ant walks as follows (see Figure 12-4): IN of S&T → OUT_{ON} of S&T → I_{S&P} → O_{S&P} → I_{xi} of EVAL_{ϕ} → O_{xi} of EVAL_{ϕ} → CONJ → IN_{i}_{+1}, changing the coloring of (S&T, S&P, EVAL_{i}_{+1}, CONJ) from (ON, OFF, INIT_{(a, FALSE)}, INIT) to (UON, ON, INIT_{(a, TRUE)}, USED_{2}); we remark that, as shown in Figure 11, the walking course I_{xi} → O_{xi} going through the EVAL_{ϕ} gadget have polynomially many crossing points with other such courses I_{xj} → O_{xj} inside the EVAL_{ϕ} gadget; next, since ϕ_{i}_{+1}(a, TRUE) = FALSE, the ant entering to EVAL_{i}_{+1} at IN_{i}_{+1} reaches OUT_{i}_{+1,FALSE}; finally, the ant walks as OUT_{i}_{+1, FALSE} → OUT_{i, FALSE}.

#### Case 3

Suppose ϕ_{i}_{+1}(a, FALSE) = TRUE and ϕ_{i}_{+1}(a, TRUE) = TRUE. First, the ant walks as in Case 2: IN_{i} → S&T → CONJ → IN_{i}_{+1} → OUT_{i}_{+1,TRUE} → IN of S&P → OUT_{OFF} of S&P → I_{S&T} → O_{S&T} → S&P → EVAL_{i}_{+1} → CONJ → IN of S&T → OUT_{ON} of S&T → I_{S&P} → O_{S&P} → I_{xi} of EVAL_{ϕ} → O_{xi} of EVAL_{ϕ} → CONJ → IN_{i}_{+1}.

Secondly, the ant walks as follows (see Figure 12-5): since the coloring of EVAL_{i}_{+1} has become INIT_{(a, TRUE)} and ϕ_{i}_{+1} (a, TRUE) = TRUE, the ant reaches OUT_{i}_{+1,TRUE}; after that, since the coloring of the S&P gadget has become ON, the ant walks as OUT_{i}_{+1,TRUE} → IN of S&P → OUT_{ON} of S&P → OUT_{i,TRUE}.

By these three Cases, Lemma 2 has shown to hold for ϕ_{i}(a) when Q_{i} = ∀. Since ∃ is a logical dual of ∀, a gadget of the Q_{i} = ∃ case is obtained from Figure 12 by switching the labels OUT_{i′,TRUE} and OUT_{i′, FALSE} for i′ = i and i+1. Accordingly, rewriting the above proof attains that of the Q_{i} = ∃ case.

## 5. Polynomial-Time Reduction

For a given closed QBF formula ϕ_{0}, Lemma 2 and its proof gives a polynomial-time construction of an EVAL_{0} gadget such that if ϕ_{0} = FALSE (TRUE) then the ant placed at IN_{0} of INIT_{0, FALSEn} coloring of EVAL_{0} finally reaches OUT_{0, FALSE} (OUT_{0,TRUE}). So, as illustrated in Figure 13, plugging reflectors (see Figure 3) in both IN_{0} and INIT_{0, FALSEn} and a diagonal highway (see Figure 4) in OUT_{0,TRUE} gives an initial configuration of GLA such that ϕ_{0} = FALSE (TRUE) if, and only if, the ant stays in a bounded area (goes out of any bounded area). This establishes an efficient reduction from the QBF evaluation problem to the recognition problem of the repeatable coloring of GLA on ℤ^{2} with gray cells, proving Theorem 1. For the **H**^{2} model, plugging a highway along the horizon of the half-and-half background (see Figure 1) to OUT_{0,TRUE} gives an efficient reduction, too, proving Theorem 2.

Among our gadgets on ℤ^{2} given in Section 2, only Switch & Turn gadget uses gray cell. In addition, the Switch & Turn gadget contains only one gray cell. So, putting these Switch & Turn gadgets mutually away from each other makes a size-n configuration of GLA colored by n^{ε}-sparse gray cells for the reduction, proving Theorem 3.

## 6. Open Questions

We can construct all gadgets shown in Section 2 on the **T**^{2} (triangular lattice) model with gray cells, excepting the Switch & Turn gadget. Although we are lacking the Switch & Turn gadget, we believe that the recognition problem of the repeatable configurations of GLA on **T**^{2} with gray cells is PSPACE-hard. The experimental results by Wang and Cohen [6] showed that randomly generated configurations of GLA on **H**^{2} for the monochromatic background, fall into the repeatable configurations with high probability. As far as we know, it is challenging to find even one provably unrepeatable configuration of GLA on **H**^{2} for the monochromatic background. Perhaps it is more challenging to prove the following: “an ant's trajectory starting from a repeatable size- n configuration of GLA is always at most a polynomial of n”. If this were true, then the recognition problem of the repeatable configurations of GLA would belong to PSPACE.

**Figure 4.**The ant starting from the arrow proceeds as RLRLRLRLRL, and then starts repeating 104 steps forever, forming the famous diagonal highway going in a southeast direction.

**Figure 13.**Reduction from QBF evaluation problem to the recognition problem of the repeatable coloring of GLA.

## References

- Langton, C.G. Studying artificial life with cellular automata. Physica D
**1986**, 22, 120–149. [Google Scholar] - Gale, D. Tracking the Automatic Ant and Other Mathematical Explorations; Springer-Verlag: New York, NY, USA, 1998. [Google Scholar]
- Langton, C.G. Artificial Life; Addison-Wesley: Redwood, CA, USA, 1989. [Google Scholar]
- Bunimovich, L.A.; Troubetzkoy, S.E. Recurrence properties of Lorentz lattice gas cellular automata. J. Stat. Phys.
**1992**, 67, 289–302. [Google Scholar] - Kong, X.P.; Cohen, E.G.D. Diffusion and propagation in triangular Lorentz lattice gas cellular automata. J. Stat. Phys.
**1991**, 62, 737–757. [Google Scholar] - Wang, F.; Cohen, E. Diffusion in Lorentz lattice gas cellular automata: The honeycomb and quasi-lattices compared with the square and triangular lattices. J. Stat. Phys.
**1995**, 81, 467–495. [Google Scholar] - Gale, D. The Industrious Ant. Math. Intell.
**1993**, 15, 54–58. [Google Scholar] - Bunimovich, L.A.; Troubetzkoy, S.E. Rotators, periodicity, and absence of diffusion in cyclic cellular automata. J. Stat. Phys.
**1994**, 74, 1–10. [Google Scholar] - Gajardo, A.; Moreira, A.; Goles, E. Complexity of Langton's ant. Discrete Appl. Math.
**2002**, 117, 41–50. [Google Scholar] - Garey, M.R.; Johnson, D.S. Computers and Intractability: A Guide to the Theory of NP-Completeness; W.H. Freeman & Co.: San Francisco, CA, USA, 1979. [Google Scholar]

© 2011 by the authors; licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution license (http://creativecommons.org/licenses/by/3.0/).

## Share and Cite

**MDPI and ACS Style**

Tsukiji, T.; Hagiwara, T.
Recognizing the Repeatable Configurations of Time-Reversible Generalized Langton’s Ant Is PSPACE-Hard. *Algorithms* **2011**, *4*, 1-15.
https://doi.org/10.3390/a4010001

**AMA Style**

Tsukiji T, Hagiwara T.
Recognizing the Repeatable Configurations of Time-Reversible Generalized Langton’s Ant Is PSPACE-Hard. *Algorithms*. 2011; 4(1):1-15.
https://doi.org/10.3390/a4010001

**Chicago/Turabian Style**

Tsukiji, Tatsuie, and Takeo Hagiwara.
2011. "Recognizing the Repeatable Configurations of Time-Reversible Generalized Langton’s Ant Is PSPACE-Hard" *Algorithms* 4, no. 1: 1-15.
https://doi.org/10.3390/a4010001