0% found this document useful (0 votes)
25 views

Module 5 TuringMachine

The document outlines Module 5 of a course on Turing Machines, detailing their introduction, programming techniques, and extensions to the basic model. It covers the components and representations of Turing Machines, including transition tables and acceptance of languages, as well as advanced topics like multitape Turing Machines and nondeterministic Turing Machines. The content aims to provide a comprehensive understanding of Turing Machines and their capabilities in recognizing various types of languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

Module 5 TuringMachine

The document outlines Module 5 of a course on Turing Machines, detailing their introduction, programming techniques, and extensions to the basic model. It covers the components and representations of Turing Machines, including transition tables and acceptance of languages, as well as advanced topics like multitape Turing Machines and nondeterministic Turing Machines. The content aims to provide a comprehensive understanding of Turing Machines and their capabilities in recognizing various types of languages.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 78

S. J. P. N.

TRUST’S
HIRASUGAR INSTITUTE OF TECHNOLOGY, NIDASOSHI
Accredited at 'A+' Grade by NAAC
Programmes Accredited by NBA: CSE, ECE

Course:
Department Theory
of Computer Science &of
Engineering
Computation(BCS503)

Module 5: Turing
Machine
Prof. A. A. Daptardar
Asst. Prof. , Dept. of Computer Science & Engg.,
Hirasugar Institute of Technology, Nidasoshi
1
MODULE-5
Content to be covered:
Introduction to Turing Machines: Problems That
Computers Cannot Solve, The Turing Machine,
Programming Techniques for Turing Machines,
Extensions to the Basic Turing Machine,
Undecidability: A Language That Is Not
Recursively Enumerable.
TEXT BOOK: Sections 8.1,8.2, 8.3,8.4, 9.1, 9.2

2
TURING MACHINES
3
INTRODUCTION
Modified version of PDA
Much more powerful than PDA
It uses Tape to store symbols
It recognizes all types of languages
Regular language
CFL
CSL
REL
TURING MACHINE MODEL
It is a finite automaton connected to read-write head with the
following components:
Tape
Read-Write Head
Finite Control
REPRESENTATION
7
TM REPRESENTATION:
Represented using various notations:
Transition Tables
Instantaneous Descriptions
Transition Diagram
ACTIONS PERFORMED BY TM:
TM DEFINITION:
TRANSITION TABLE
INSTANTANEOUS
DESCRIPTION: (ID)
ACCEPTANCE OF A LANGUAGE
BY TM:
The TM can do one of the following things:
RECURSIVE / DECIDABLE
LANGUAGE:
CONSTRUCTION OF
TM:
20
L = {0n1n | n ≥ 1 }
The DFA which accepts the language consisting strings of 0’s and
1’s having a substring 001.

The transition table for the DFA is shown below:


As the DFA processes the input string from left to right in only one
direction, the TM also processes the input string in only one
direction. For each scanned input symbol(either 0 or 1) in
whichever state the DFA was in, the TM also enters into the same
states on same input symbols, replacing 0 by 0 and 1 by 1and
read-write head moves towards right. So the transition table for
DFA and TM remains same. So the transition table for TM to
recognize the language is shown below:
The TM is given by
M = (Q, Ʃ, Г, , q0, B, A)
Where
Q = { q0, q1, q2, q3, q4}
Ʃ = {0, 1}
Г = {0, 1}
 -is shown in the form of transition table above
q0 - is the start state
B – blank character
A = {q4} is the final state
The transition diagram for this is shown below:
The DFA which accepts the language consisting strings of 0’s and
1’s having a substring 011.

The transition table for the DFA is shown below:


As the DFA processes the input string from left to right in only one
direction, the TM also processes the input string in only one
direction. For each scanned input symbol(either 0 or 1) in
whichever state the DFA was in, the TM also enters into the same
states on same input symbols, replacing 0 by 0 and 1 by 1and
read-write head moves towards right. So the transition table for
DFA and TM remains same. So the transition table for TM to
recognize the language is shown below:
The TM is given by
M = (Q, Ʃ, Г, , q0, B, A)
Where
Q = { q0, q1, q2, q3}
Ʃ = {0, 1}
Г = {0, 1, B}
 -is shown in the form of transition table above
q0 - is the start state
B – blank character
A = {q4} is the final state
The transition diagram for this is shown below:
The DFA which accepts the language consisting of even number
of characters.

The transition table for the DFA is shown below:


As the DFA processes the input string from left to right in only one
direction, the TM also processes the input string in only one
direction. For each scanned input symbol(either 0 or 1) in
whichever state the DFA was in, the TM also enters into the same
states on same input symbols, replacing a by a and b by b and
read-write head moves towards right. So the transition table for
DFA and TM remains same. So the transition table for TM to
recognize the language is shown below:
The TM is given by
M = (Q, Ʃ, Г, , q0, B, A)
Where
Q = { q0, q1}
Ʃ = {a, b}
Г = {a, b, B}
 -is shown in the form of transition table above
q0 - is the start state
B – blank character
A = {q2} is the final state
The transition diagram for this is shown below:
PROGRAMMING
TECHNIQUES FOR
TURING
MACHINES
47
Storage in the State
Multiple Tracks
Subroutines
8.3.1 STORAGE IN THE STATE
We can use the finite control not only to represent a position in
the "program" of the Turing machine, but to hold a finite amount
of data.
Figure 8.13 suggests this technique (as well as another idea:
multiple tracks).
There, we see the finite control consisting of not only a "control"
state q, but three data elements A, B, and C.
The technique requires no extension to the TM model; we merely
think of the state as a tuple.
 In the case of Fig. 8.13, we should think of the state as [q, A, B,
G].
Regarding states this way allows us to describe transitions in a
more systematic way, often making the strategy behind the TM
program more transparent.
8.3.2 MULTIPLE TRACKS
Another useful "trick" is to think of the tape of a Turing
machine as composed of several tracks.
Each track can hold one symbol, and the tape alphabet
of the TM consists of tuples, with one component for
each "track."
Thus, for instance, the cell scanned by the tape head in
Fig. 8.13 contains the symbol [X, Y, Z].
Like the technique of storage in the finite control, using
multiple tracks does not extend what the Turing
machine can do.
 It is simply a way to view tape symbols and to imagine
that they have a useful structure.
8.3.3 SUBROUTINES
As with programs in general, it helps to think of Turing machines
as built from a collection of interacting components, or
"subroutines."
A Turing-machine subroutine is a set of states that perform some
useful process.
This set of states includes a start state and another state that
temporarily has no moves, and that serves as the "return" state to
pass control to whatever other set of states called the subroutine.
The "call" of a subroutine occurs whenever there is a transition to
its initial state.
Since the TM has no mechanism for remembering a "return
address," that is, a state to go to after it finishes, should our
design of a TM call for one subroutine to be called from several
states, we can make copies of the subroutine, using a new set of
states for each copy.
 The "calls" are made to the start states of different copies of the
subroutine, and each copy "returns" to a different state.
EXTENSIONS TO
THE BASIC TURING
MACHINE
62
MultiTape Turing Machines
Equivalence of One Tape and MultiTape TM’s
Running Time and Many Tapes to One Construction
Nondeterministic Turing Machine
EXTENSIONS TO THE BASIC
TURING MACHINE
In this section we shall see certain computer models
that are related to Turing machines and have the same
language-recognizing power as the basic model of a
TM with which we have been working.
One of these, the multitape Turing machine, is
important because it is much easier to see how a
multitape TM can simulate real computers (or other
kinds of Turing machines), compared with the single-
tape model we have been studying.
 Yet the extra tapes add no power to the model, as far
as the ability to accept languages is concerned.
8.4.1 MULTITAPE TURING
MACHINES
A multitape TM is as suggested by Fig. 8.16.
The device has a finite control (state), and some finite
number of tapes.
 Each tape is divided into cells, and each cell can hold
any symbol of the finite tape alphabet.
As in the single-tape TM, the set of tape symbols
includes a blank, and has a subset called the input
symbols, of which the blank is not a member.
The set of states includes an initial state and some
accepting states.
Initially :
1.The input, a finite sequence of input symbols, is
placed on the first tape.
2.All other cells of all the tapes hold the blank.
3.The finite control is in the initial state.
4.The head of the first tape is at the left end of the
input.
5.All other tape heads are at some arbitrary cell.
Since tapes other than the first tape are
completely blank, it does not matter where the
head is placed initially; all cells of these tapes
"look" the same.
A move of the multitape TM depends on the
state and the symbol scanned by each of the
tape heads. In one move, the multitape TM does
the following:
1.The control enters a new state, which could be
the same as the previous state.
2.On each tape, a new tape symbol is written on
the cell scanned. Any of these symbols may be
the same as the symbol previously there.
3.Each of the tape heads makes a move, which
can be either left, right, or stationary. The heads
move independently, so different heads may
move in different directions, and some may not
move at all.
8.4.2 EQUIVALENCE OF ONE-
TAPE AND MULTITAPE TM'S
The recursively enumerable languages
are defined to be those accepted by a
one-tape TM. Surely, multitape TM's
accept all the recursively enumerable
languages, since a one-tape TM is a
multitape TM.
8.4.3 RUNNING TIME AND THE
MANY-TAPES-TO-ONE
CONSTRUCTION
Let us now introduce a concept that will become quite
important later: the "time complexity" or "running time"
of a Turing machine.
We say the running time of TM M on input w is the
number of steps that M makes before halting.
If M doesn't halt on w, then the running time of Mon w
is infinite. The time complexity of TM M is the function
T(n) that is the maximum, over all inputs w of length n,
of the running time of M on w.
 For Turing machines that do not halt on all inputs, T(n)
may be infinite for some or even all n. However, we
shall pay special attention to TM's that do halt on all
inputs, and in particular, those that have a polynomial
time complexity T(n)
The constructed onetape TM may take much more
running time than the multi tape TM. However, the
amounts of time taken by the two Turing machines are
commensurate in a weak sense: the one-tape TM takes
time that is no more than the square of the time taken by
the other. While "squaring" is not a very strong guarantee,
it does preserve polynomial running time.
a) The difference between polynomial time and higher
growth rates in running time is really the divide between
what we can solve by computer and what is in practice
not solvable.
b) Despite extensive research, the running time needed
to solve many problems has not been resolved closer
than to within some polynomial. Thus, the question of
whether we are using a one-tape or multitape TM to solve
the problem is not crucial when we examine the running
time needed to solve a particular problem.
8.4.4 NONDETERMINISTIC
TURING MACHINES

You might also like