To understand Turing machine states, an example is usually very helpful.
Suppose we are using the following representation convention:
Now suppose you are given the following tape:
In the task description above, we stated that the head will be stationed at the the leftmost tally on the input tape. In Varphi, and in Turing machines in general, this is an assumption that holds. The head of a machine that is described using Varphi will always start at the leftmost tally on the input tape.
A natural way of doing this is as follows:
Read the current tape cell.
If there is a tally at the current tape cell, write a tally to the current tape cell (leaving it as-is) and move to the tape cell immediately to the right of the current one. Repeat.
Now what if the task was to add two tallies instead of just one? Let's try to write a similar algorithm:
Read the current tape cell.
If there is a tally at the current tape cell, write a tally to the current tape cell (leaving it as-is) and move to the tape cell immediately to the right of the current one. Repeat.
If the current tape cell is blank, write a tally to the current tape cell and move to the tape cell immediately to the right of the current one. What now??? We still need to add one more tally.
It turns out that we don't have enough expressive power to achieve this task without introducing the concept of states.
To represent a number , repeat the symbol times.
You are tasked with making the tape, after you are done, contain one more tally () than what was originally on it. Specifically, you should add the extra tally to the right of the tallies that were originally on the tape. Also suppose that the only way you can access the tape is through a Turing machine head, which you control by supplying instructions to. The head will originally be stationed at the leftmost tally on the tape (which you can assume is guaranteed to exist). Also assume that there is exactly one contiguous block of tallies on the tape.
If the current tape cell is blank, write to the current tape cell and move to the tape cell immediately to the right of the current one. Stop.
We can think of a Turing machine state as being a "state of mind" of the Turing machine. For the example where we are adding two s to the right of a number, we can rewrite the algorithm using states as follows:
Start at state . Read the current tape cell.
If we are on state :
If there is a tally at the current tape cell, write a tally to the current tape cell (leaving it as-is) and move to the tape cell immediately to the right of the current one. Stay on state . Repeat.
If the current tape cell is blank, write a tally to the current tape cell and move to the tape cell immediately to the right of the current one. Switch to state . Repeat.
If we are on state :
If the current tape cell is blank, write a tally to the current tape cell and move to the tape cell immediately to the right of the current one. Switch to state . Repeat.
We have written our algorithm in a completely unambiguous way. Notice that not every state needs to define rules. For example, has no rules, which means it's a halting state (the algorithm terminates if we reach this state). Also, notice that defines no rule for if a tally is encountered at the current tape cell, because we do not expect there to be any non-blank tape cell to the right of the tape cell containing the rightmost tally of the input number.