Turing

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 15

Turing Machines

(Finally!)
Designing Universal Computational
Devices Was Not The Only
Contribution from Alan Turing…
Enter the year 1940:
•The world is at war
•Nazi Germany has succeeded in conquering most of west
Europe
•Britain is under siege
•British supply lines are threaten by German
•Germany used the Enigma Code, considered unbreakable
•Alan Turing led a group of scientist that broke the
enigma code
Enter the year 2001: The National Security Agency (NSA)
needs people! (www.nsa.gov)
Background

•Automata accepts regular languages only

For example, {ww: n =0, 1, …} is not regular

•Pushdown Automata accepts context-free languages only

For example, {ww : w  *} is not context-free

•We can easily write an algorithm (in C) recognizing if a


sequence of characters have the form www or not
The Key Question
•Is it possible to design a formal model of a computational
device that capture the capabilities of any algorithm?

Alan Turing, 1940’s: Yes!


Basic Idea
Turing decomposed operations in the device as follows:
•A pencil will be “observing” symbols from a paper
•Computational steps erase a symbol observed
by the pencil and write a new one in its place
•The decision about which symbol should be
written and which will be observed next depend on:
1. The current symbol being observed
2. The “state of mind” of the device
This device is called a Turing Machine
Turing Machine Looks Similar to
Finite Automata
Common:

•A “state of mind” sounds like the collection of states


•A “pencil” sounds like the pointer for the next word

Main differences:
•Turing machines can write on the “paper”
•Turing machines can backup and read symbols again

This turns out to be a major difference!


In Turing’s Own Words

... which can be made to do the work of any special-purpose


machine, that is to say to carry out any piece of computing,
if a tape bearing suitable "instructions" is inserted into it.
Expressivity of Turing Machines (TMs)

•TMs can simulate any data structure

•TMs can simulate major components of imperative


languages: sequence, branching and loop

•TMs can control branching and loops

•Several extensions have been attempted: adding heads,


tapes, etc. They all end up being implementable on TMs
Church-Turing Thesis

Every computer algorithm can be


implemented as a Turing machine
Informal Description

Control

head
 a1 a2 … Tape

The head:
cell •Reads the symbol from the cell its
positioned, and
Marker for •Either:
the first cell •Writes a new symbol in the cell, or
•Moves one cell to the left or right
Informal Description (II)

•New cells can be added to the right of the tape as needed


(similar to RAM memory)

•These new cells contain the blank symbol, 

•Tape is bounded to the left by a cell containing the symbol 


Preliminaries to Formal Description

 denotes the alphabet of symbols. It must contain  and . It


cannot contain  or 

•There is an input string located contiguous to the initial cell (i.e.,


the cell containing the  symbol)

• Transitions can be described by:

((s,a),(q,b)) If in state s and the current cell has an a


then jump to state q and write b in the
current cell
Preliminaries to Formal Description (II)

• Transitions can also be described by:

((s,a),(q,)) If in state s and the current cell has an a


then jump to state q and move the header
one cell to the right

((s,a),(q,)) If in state s and the current cell has an a


then jump to state q and move the header
one cell to the left
Formal Definition

Definition. A Turing machine is a 5-tuple (S, , , s, H), where:

•S is a set of states

 is an alphabet It must contain  and . It cannot contain


 or 

•s  S is the initial state

•H  S is the set of halting states


Formal Definition (II)

  is a collection of transitions defined by the function:


: (S-H)    S  (  (, })
such that:

1. For any q  S – H, (q, ) = (p,) for some p  S


2. There cannot be any p, q  S and a   such that
(p, a) = (q, ) (that is,  cannot be added)

You might also like