View
22
Download
0
Category
Preview:
DESCRIPTION
COSC 3340: Introduction to Theory of Computation. University of Houston Dr. Verma Lecture 16. Turing Machine ( TM ). Bi-direction Read/Write. Finite State control. Historical Note. Proposed by Alan Turing in 1936 in: - PowerPoint PPT Presentation
Citation preview
Lecture 16 UofH - COSC 3340 - Dr. Verma1
COSC 3340: Introduction to Theory of Computation
University of Houston
Dr. Verma
Lecture 16
Lecture 16 UofH - COSC 3340 - Dr. Verma2
Turing Machine (TM)
. . .
Finite State
control
Bi-directionRead/Write
Lecture 16 UofH - COSC 3340 - Dr. Verma3
Historical Note
Proposed by Alan Turing in 1936 in:
On Computable Numbers, with an application to the Entscheidungsproblem, Proc. Lond.
Math. Soc. (2) 42 pp 230-265 (1936-7); correction ibid. 43, pp 544-546 (1937).
Lecture 16 UofH - COSC 3340 - Dr. Verma4
Turing Machine (contd.)
Based on (q, ), q – current state, – symbol scanned by head, in one move, the TM can:
(i) change state
(ii) write a symbol in the scanned cell
(iii) move the head one cell to the left or right
Some (q, ) combinations may not have any moves. In this case the machine halts.
Lecture 16 UofH - COSC 3340 - Dr. Verma5
Turing Machine (contd.)
We can design TM’s for computing functions from strings to strings
We can design TM’s to decide languages– using special states accept/reject or by writing Y/N on tape.
We can design TM’s to accept languages.– if TM halts string is accepted
Note: there is a big difference between language decision and acceptance!
Lecture 16 UofH - COSC 3340 - Dr. Verma6
Example of TM for {0n1n | n > 0}
English description of how the machine works:1. Look for 0’s2. If 0 found, change it to x and move right, else reject3. Scan past 0’s and y’s until you reach 14. If 1 found, change it to y and move left, else reject.5. Move left scanning past 0’s and y’s6. If x found move right7. If 0 found, loop back to step 2.8. If 0 not found, scan past y’s and accept.
Head is on the left or start of the string.
x and y are just variables to keep track of equality
Lecture 16 UofH - COSC 3340 - Dr. Verma7
Example of TM for {0n1n | n > 0} contd.
State Symbol Next state action
q0 0 (q1, x, R)
q0 1 halt/reject
q0 x halt/reject
q0 y (q3, y, R)
Head is on the left or start of the string.
Lecture 16 UofH - COSC 3340 - Dr. Verma8
Example of TM for {0n1n | n > 0} contd.
State Symbol Next state action
q1 0 (q1, 0, R)
q1 1 (q2, y, L)
q1 x halt/reject
q1 y (q1, y, R)
Head is on the left or start of the string.
Lecture 16 UofH - COSC 3340 - Dr. Verma9
Example of TM for {0n1n | n > 0} contd.
State Symbol Next state action
q2 0 (q2, 0, L)
q2 1 halt/reject
q2 x (q0, x, R)
q2 y (q2, y, L)
Head is on the left or start of the string.
Lecture 16 UofH - COSC 3340 - Dr. Verma10
Example of TM for {0n1n | n > 0} contd.
State Symbol Next state action
q3 0 halt/reject
q3 1 halt/reject
q3 x halt/reject
q3 y (q3, y, R)
q3 □ (q4, □, R)
Head is on the left or start of the string.
Lecture 16 UofH - COSC 3340 - Dr. Verma11
Example of TM for {0n1n | n > 0} contd.
State Symbol Next state action
q4 0 illegal i/p
q4 1 illegal i/p
q4 x illegal i/p
q4 y illegal i/p
q4 □ halt/accept
Head is on the left or start of the string.
Lecture 16 UofH - COSC 3340 - Dr. Verma12
Example of TM for {0n1n | n 0} contd.
Lecture 16 UofH - COSC 3340 - Dr. Verma13
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma14
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma15
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma16
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma17
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma18
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma19
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma20
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma21
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma22
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma23
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma24
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma25
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma26
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma27
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma28
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma29
JFLAP SIMULATION
Lecture 16 UofH - COSC 3340 - Dr. Verma30
Formal Definition of TM
Formally a TM M = (Q, , , , s) where, – Q – a finite set of states – input alphabet not containing the blank symbol # – the tape alphabet of M– s in Q is the start state : Q X Q X X {L, R} is the (partial) transition function.
Note: (i) We leave out special states. (ii) The model is deterministic but we just say TM instead of
DTM.
Recommended