Presentation is loading. Please wait.

Presentation is loading. Please wait.

COSC 3340: Introduction to Theory of Computation

Similar presentations


Presentation on theme: "COSC 3340: Introduction to Theory of Computation"— Presentation transcript:

1 COSC 3340: Introduction to Theory of Computation
University of Houston Dr. Verma Lecture 16 Lecture 16 UofH - COSC Dr. Verma

2 Turing Machine (TM) . . . Bi-direction Read/Write Finite State control
Bi-direction Read/Write Finite State control Lecture 16 UofH - COSC Dr. Verma

3 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 Dr. Verma

4 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 Dr. Verma

5 Example of TM for {0n1n | n > 0}
English description of how the machine works: Look for 0’s If 0 found, change it to x and move right, else reject Scan past 0’s and y’s until you reach 1 If 1 found, change it to y and move left, else reject. Move left scanning past 0’s and y’s If x found move right If 0 found, loop back to step 2. 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 Dr. Verma

6 Example of TM for {0n1n | n > 0} contd.
Head is on the left or start of the string. State Symbol Next state action q0 (q1, x, R) 1 halt/reject x y (q3, y, R) Lecture 16 UofH - COSC Dr. Verma

7 Example of TM for {0n1n | n > 0} contd.
Head is on the left or start of the string. State Symbol Next state action q1 (q1, 0, R) 1 (q2, y, L) x halt/reject y (q1, y, R) Lecture 16 UofH - COSC Dr. Verma

8 Example of TM for {0n1n | n > 0} contd.
Head is on the left or start of the string. State Symbol Next state action q2 (q2, 0, L) 1 halt/reject x (q0, x, R) y (q2, y, L) Lecture 16 UofH - COSC Dr. Verma

9 Example of TM for {0n1n | n > 0} contd.
Head is on the left or start of the string. State Symbol Next state action q3 halt/reject 1 x y (q3, y, R) (q4, □, R) Lecture 16 UofH - COSC Dr. Verma

10 Example of TM for {0n1n | n > 0} contd.
Head is on the left or start of the string. State Symbol Next state action q4 illegal i/p 1 x y halt/accept Lecture 16 UofH - COSC Dr. Verma

11 Example of TM for {0n1n | n > 0} contd.
Lecture 16 UofH - COSC Dr. Verma

12 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

13 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

14 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

15 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

16 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

17 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

18 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

19 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

20 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

21 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

22 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

23 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

24 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

25 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

26 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

27 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

28 JFLAP SIMULATION Lecture 16 UofH - COSC Dr. Verma

29 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. Lecture 16 UofH - COSC Dr. Verma


Download ppt "COSC 3340: Introduction to Theory of Computation"

Similar presentations


Ads by Google