Turing Machines
A Turing machine is a quadruple , where
is a finite nonempty set of states (e.g., , for some .
is the initial state.
is the set of final states.
is the transition (partial) function.
NOTE: Above, we represent "tally" using , "blank" using , "left" using , and "right" using .
Wow! That's a lot to take in. The first three items in the quadruple are pretty straightforward, but what is that fourth item? Let's describe this in a more gentle way:
is a partial function (may not be defined for some inputs in the domain) mapping pairs of non-final states and tape cell possibilities to triples containing a state, tape cell possibility, and head direction.
For example, if maps to , then this can be read as "if the machine's state is and the current tape cell is blank, then switch to state , place a tally at the current tape cell, and move the head to the tape cell immediately right of the current tape cell.
Recall our example of adding two tallies to a number on a tape. We used the following algorithm:
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.
The transition function for this algorithm can be represented using a table:
0
Again, means "tally", means "blank", means "right", and means "left" here.
We can write the transition function in an even more compact notation as follows:
Believe it or not, you've just written your first Varphi Program! Here it is in a code block.
Pretty simple, right?
Last updated
Was this helpful?