I have been playing Manufactoria, a game in which one has to build a production line that tests/modifies "robots". Each robot has a "tape" where each cell is colored either red, green, blue or yellow. The production line can test/modify a robot by popping colors off the start of its tape, by moving the robot to different lines depending on the color popped off, and by pushing more colors onto the end of its tape. The tape is effectively a queue.
One level ("Robostilts") asks you, the designer, to build a production line that modifies each robot's tape to put a "green" at the start, and a "yellow" at the end. It turns out this challenge is easily completed because all robots start with only red and blue colors on the tape, and no green or yellows.
However, I initially misinterpreted the challenge, thinking that the input tapes were completely arbitrary. This seemed challenging, and now I think it's impossible. However, I don't know how to show this precisely, but I thought someone here might be able to. I have formalized the problem below.
$A$ is the four-letter alphabet $\{ R, G, B, Y \}$.
An automaton is $(S,sInit,sTerm,d)$ where
- $S$ is a set of states
- $sInit \in S$ is the initial state
- $sTerm \in S$ is the terminal state
- $d$ is a transition function $: (S \times A) \rightarrow (S \times A\star)$. (Note: $A\star$ denotes lists of $A$ elements.)
The automaton steps through a series of configurations $(s, x) \in (S \times A\star)$.
For a given "input string" $i \in A\star$, the initial configuration is $(sInit, i)$.
The function $step : (S \times A\star) \rightarrow (S \times A\star)$ is given by
$ step (s, [x] \mathbin{+\mkern-10mu+} xs) =\\ \qquad\mathbf{let}\quad(s', new) = d(s,x)\\ \qquad\mathbf{in}\quad(s', xs \mathbin{+\mkern-10mu+} new) $
The task is to define such a machine which, starting with configuration $(sInit, i)$ for an arbitrary $i$, after a finite number of applications of the step function, reaches configuration $(sTerm, [G] \mathbin{+\mkern-10mu+} i \mathbin{+\mkern-10mu+} [Y])$.
Is this possible? If yes, how? If no, why not?