...

/

The Standard Turing Machine

The Standard Turing Machine

Learn about the various applications of Turing machines and gain an understanding of their formal definition.

We'll cover the following...

How a Turing machine works

Like the queue machine, a Turing machine does not have a separate input channel besides its working storage. A TM\text{TM} is a state machine that has a two-way infinite tape, consisting of cells that hold a single symbol. We assume that the input is already written somewhere on the tape, and a read-write head is positioned at the first symbol of the input. The rest of the cells are “preformatted” with a special symbol called a “blank,” which is not allowed to be part of the alphabet of any language.

The difference between a queue machine and a TM\text{TM} is how the data is accessed. Each step of a TM\text{TM}'s computation reads the current cell, overwrites that cell (sometimes with the current contents, so there is no change in symbol), and then moves one cell either to the left or right. For this reason, we say that a TM\text{TM} has unrestricted memory: we can reach any cell we want by a series of moves. Since the tape is infinite in length, TM\text{TM}s also have unlimited memory. The following TM\text{TM} accepts the language L = \{ a^nb^nc^n \;|\; n>0 \}.

Note: We use \square for blank. When drawing Turing machines by hand, it is convenient to use either BB or an underscore for a blank, LL for \leftarrow, and RR for \rightarrow.

Press + to interact
Turing machine accepting the language L
Turing machine accepting the language L

The pattern for transitions in a TM\text{TM} is <read>/<write>,<direction>. This machine marks each leading aa, bb, and cc with XX, YY, and ZZ, respectively, on each pass through the string. We don’t need an end-of-string marker since blanks can serve that purpose. Also, to skip over a symbol, we merely write it over itself. Having no out-edges, q5q_5 is a halt state. Most of the time we don’t include a nonaccepting halt state because an invalid string will cause the machine to crash, and we consider a crash as a rejection. The trace of aabbccaabbcc appears below.

Note: The brackets are not actually present on the tape. They only serve to show under which symbol the read/write head is positioned. ...

State Tape Contents
q0q_0 [a]abbcc[a]abbcc
q1q_1 X[a]bbccX[a]bbcc
q1q_1 Xa[b]bccXa[b]bcc
q2q_2 XaY[b]ccXaY[b]cc
q2q_2 XaYb[c]cXaYb[c]c
q3q_3 XaY[b]ZcXaY[b]Zc
q3q_3 Xa[Y]bZcXa[Y]bZc