0% found this document useful (0 votes)
23 views21 pages

Lecture 15-16

Uploaded by

f20210563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views21 pages

Lecture 15-16

Uploaded by

f20210563
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Theory of Computation

(CS F351)
BITS Dr. Raghunath
CS&IS Dept.
Pilani
Hyderabad Campus

BITS Pilani, Hyderabad Campus


Lecture: 31-33
Turing Machine
BITS
Dr. Raghunath Reddy
Pilani
Hyderabad Campus

BITS Pilani, Hyderabad Campus


Turing Machines
 It is a much more accurate model of a general-purpose computer.

 A Turing machine can do everything that a real computer can do.

 Similar to a finite automata but with an unlimited and unrestricted


memory.
 It uses an infinite tape as its unlimited memory.

 It has a tape head that can read and write symbols and move
around the tape.
Turing Machines
 How it is different from finite automata

 A TM can both write on the tape and read from it.

 The read-write head can move both to the left and to the right

 The tape is infinite.


Turing Machines Formal Definition
 A TM is a 7-tuple where

 is the set of states.

 is the tape alphabet

 a symbol of , is the blank

 is the input alphabet, where and

 is the start state

 is the set of final states.


Turing Machines Formal Definition
 Example: Consider a language .
Instantaneous Description (ID)
 An ID of a TM is denoted by .

 Here, is the current state of the TM

 is the string in that is the content of the tape up to the


rightmost nonblank symbol or the symbol to the left of the head,
whichever is rightmost.

 Finally, the tape head is assumed to be scanning the leftmost


symbol of , or if , the head is scanning a blank symbol.
Move of TM
 Let be an ID.

 Suppose
 If then is taken to be .
 If , then there is no next ID.
 If then new ID will be

 Suppose
Language accepted by a TM
 We say that an ID yields ID in one move, we write .

 If an ID yields ID in several moves (zero or more), we write .

 A string is said to be accepted by a TM

if where is a final state and

 The language recognizing by a TM , denoted by is the set of those


words in that are accepted by

 Note: for strings not accepted by a TM, it is possible that the TM


will never halt.
Language accepted by a TM
A.
Language accepted by a TM
 TM to accept
Language accepted by a TM
Language accepted by a TM
Multi-tape Turing machine
 It consists of a finite control with tape heads
and tapes.

 On a single move, depending on the state of


the finite control and the symbol scanned by
each of the tape heads, the machine can:
 change state;
 print a new symbol on each of the cells
scanned by its tape head
 move each of its tape heads.

 Initially, the input appears on the first tape, and the other
tapes are blank.
Multi-tape Turing machine
 TM to accept

 Solution:
 Idea:
Multi-tape Turing machine
 TM to find the sum of two binary numbers.

Source: https://www.ccs.neu.edu/home/vkp/390-fl07/TM-Variants.pdf
Multi-tape TM vs Single-tape TM
 Theorem: For every -tape TM, there is an equivalent (single-tape) TM.

 Proof:

Image from Sipser book


Multi-tape TM vs Single-tape TM
 “on input ”:
 First puts its tape into the format that represents all tapes of . The
formatted tape contains

 To simulate a single move, scans its tape from the first to the st in order to
determine the symbols under the virtual head.
 Then makes a second pass to update the tapes according to the way
that ’s transition function indicates.

 If at any point moves one of the virtual heads to the right onto athis action
signifies that has moved the corresponding head on the previously unread
blank portion of that tape. So writes a blank symbol on this tape cell and
shifts the tape contents, from this cell until the rightmost , one unit to the
right. Then it continues the simulation as before.
Non-deterministic Turing Machine
 Transition function:

 Theorem: Every non-deterministic Turing machine () has an


equivalent deterministic Turing machine (D).

 Proof: The simulating deterministic TM has three tapes.

Image from Sipser book


Non-deterministic Turing Machine
 “on input :

1. Copy tape 1 to tape 2.

2. Use tape 2 to simulate N on the computation path from the root to the
node represented by the address on tape 3.
• This is done one step at a time by consulting by consulting the next
symbol to the right on the tape 3 after each simulated transition.
• If no more symbols remain on tape 3 or if this nondeterministic choice
is invalid, abort this branch by going to step 4.

3. If an accepting configuration is encountered, accept.

4. Replace the string on tape 3 by the next string in the string ordering. Go to
step 1. ‘’
Thank you

BITS Pilani, Hyderabad Campus

You might also like