Presentation is loading. Please wait.

Presentation is loading. Please wait.

COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.

Similar presentations


Presentation on theme: "COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University."— Presentation transcript:

1 COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University pursuant to Part VB of the Copyright Act 1968 (the Act). The material in this communication may be subject to copyright under the Act. Any further reproduction or communication of this material by you may be the subject of copyright protection under the Act. Do not remove this notice.

2 Turing Machines CSE2303 Formal Methods I Lecture 14

3 Overview Turing Machines Converting FA to TM Building Turing Machines

4 ... Finite String (input) All Blanks iiiiiiiv Tape Head Turing Machine Tape Head can: Move left and right. Read letters from the tape. Write letters onto the tape.

5 HALT 2 START 1 34 6 5 (a, A, R) (a, a, R) (B, B, R) (b, B, L) (A, A, R) (B, B, R) (B, B, L) (a, a, L) (A, A, R) ( , , R)

6 TM Components A Tape and Tape Head An Input Alphabet A Tape Alphabet A finite set of states –Each state is numbered by an integer  1. –Start State (1) –Halt State (2) A finite set of rules (letter, letter, direction) between states.

7 Definitions For a Turing Machine T Accept(T) –The set of strings leading to a HALT state. –Called the language accepted by T. Reject(T) –The set of strings that crash during execution. Loop(T) –The set of strings that loop forever.

8 Example HALT 2START 1 3 ( , , R) (b, b, R) (a, a, R) (b, b, R) Accept(T) = strings with a double aa Reject(T) = strings without a double aa that end in a Loop(T) =  or strings without a double aa that end in b

9 Regular Languages Every Regular Language can be accepted by a Turing Machine.

10 Convert FA to TM Change the - to START 1. Label all other states with a integer  3. Change the edge labels. –a to (a, a, R) –b to (b, b, R) Delete the + from all the Final states, and add an edge from each Final state to HALT 2, labeled with ( , , R).

11 EVEN-EVEN b b a ± b b aa a 3 45 START 1 (a, a, R) (b, b, R) (a, a, R) (b, b, R) (a, a, R) HALT 2 ( , , R)

12 Problem Build a Turing Machine that accepts the language {a n b n : n  0}.

13 If tape is blank, then Halt. Loop { If current letter is a, then change a to A & move right. Move right over any a’s and B’s. If current letter is b, then change b to B & move left. Move left over any B’s. If current letter is A, then move right & exit the loop. Else if current letter is a move left over any a’s. If current letter is A, then move right. } Move right over any B’s. If current letter is blank, then Halt.

14 HALT 2 START 1 34 6 5 (a, A, R) (a, a, R) (B, B, R) (b, B, L) (A, A, R) (B, B, R) (B, B, L) (a, a, L) (A, A, R) ( , , R)

15 Problem Build a Turing Machine that accepts the language {a n b n a n : n  0}.

16 Loop { If current letter is blank, then Halt. If current letter is a, then change a to A & move right. Move right over a*bb*. If current letter is a, then move left. If current letter is b, then change b to a & move right. Move right over any a’s. If current letter is blank, then delete 2 a’s on the left. Move left over any a’s and b’s. If current letter is A, then move right. }

17 TM for a n b n a n HALT 2START 1 345 987 6 ( , , L) (a, a, R) (b, a, R) (a, , L) (a, a, L) (b, b, L) (a, a, L) (b, b, R) (a, a, R) (a, A, R) (A, A, R) ( , , R)

18 Revision Know what a TM is, and how to use one. Be able to convert a FA into a TM. Be able to build a TM to define a language. Preparation Read –Chapter 25 in the Text book.


Download ppt "COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University."

Similar presentations


Ads by Google