...

/

Introduction to Turing Machines

Introduction to Turing Machines

Get an introduction to Turing machines and their relationship to PDAs and post machines.

Historical background

In this lesson, we'll study a type of machine called the Turing machine (TM), named after the mathematician Alan Turing, who proposed the idea in 1936. At the time, he was trying to show that no universal algorithm could decide all logical mathematical questions, as the celebrated mathematician David Hilbert had proposed. It naturally followed that Turing needed to precisely define what an algorithm is. Others were also working on solving the same problem (notably Kurt Gödel, Alonzo Church, and Stephen Kleene), but it was Turing’s formulation of the nature of computations that proved to be the simplest and most effective, and also provided a sound theoretical foundation for the computer revolution.

His abstract “machines” prefigured what we now understand as a low-level computer instruction set. More importantly, it was Turing who introduced the notion of a program as input and simulating their behavior (i.e., “executing” them), which strongly influenced the development of the digital computer. But before we look at Turing machines, let’s consider what we can do with a pushdown automaton with two stacks.

PDA with two stacks and Turing machine

We know that the language L=anbncnL = a^nb^nc^n is not context-free, but a pushdown automaton with two stacks can recognize it. We use one stack to match the aa’s and bb’s, and the other to match the bb's and cc’s. See the 2-stack PDA below.

Press + to interact
A 2-stack PDA recognizing the language L
A 2-stack PDA recognizing the language L

There are two entries for stack operations—one for each stack. The pattern for each transition is <symbol>, <pop1>\rightarrow<push1>, <pop2>\rightarrow<push2>. The following table traces the string aabbccaabbcc through the 2-stack PDA.

State Input Stack 1 Stack 2
q0q_0 aabbccaabbcc λ\lambda λ\lambda
q0q_0 abbccabbcc XX λ\lambda
q0q_0 bbccbbcc XXXX λ\lambda
q1q_1 bccbcc XX XX
q1q_1 cc
...
Access this course and 1400+ top-rated courses and projects.