Download presentation
Presentation is loading. Please wait.
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
Universal Turing Machine CSE2303 Formal Methods I Lecture 16
3
Overview Tables for Turing Machines Encoding Decoding Definition of a Universal Turing Machine Algorithm for a Universal Turing Machine
4
Assumptions Input Alphabet a b Tape Alphabet a b # Start State –Numbered 1. Halt State –Numbered 2
5
Example START 1 34 HALT 2 (a, a, R) (b, b, R) ( , , R)
6
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,#, R) (#,#, R) ( , , R)
7
Table
8
Conditions to Check Check whether there is a row with a 1 in the From column. Check that there is no row with a 2 in the From column. Check there are no two rows with the same numbers in the From and the same letter in the Read column.
9
Coding Integer n –Code as: a n b
10
Coding the Table
11
Encoding of the TM abaaabaabbbaaabaaabaaaabaaabaaaabababbaa aabaaaabababbaaaabaaaaabaaaaaaaaaabaaaa aababaabaaaaaabaaaaaabaaaabaaaaaabaaaaa aabbabaaaaaaaaabaaaaaaaabaabaaaaaaaaaab aaaaaaaaabaabaaaaaaaaaaabaaaaaaaaabaaaa aaaaaaaaaabaaaaaaaaabababaaaaaaaaaababb bbbbabaabbabab
12
Code Word Language (CWL) CWL is the regular language (a + ba + b (a + b) 5 )* Words which encode a TM belong to CWL. Note: Not all words in CWL encode a TM
13
Decode abaaabaaaababaaabababbaaabaaaabababbaaaabaabbabab
14
Algorithm 1. Count the initial clump of a ’s. 2. Count the next clump of a ’s. 3. Read the next two letters. 4. Read the next two letters. 5. Read the next letter. 6. Repeat until there are no more letters.
15
Definition An Universal Turing Machine (UTM) is A Turing Machine Can run any TM on any input data.
16
Example Turing Machine abaaabaaaabababababbaaabaabaaaab Data baa HALT 2START 1 3 (a, a, R) (b, b, R)
17
Input for UTM #abaaabaaaabababababbaaabaabaaaab$baa Start of Tape Turing Machine (encoded) Mark to indicate start of Data Data
18
Algorithm for an UTM Initialize Tape Remember first letter of data Find first instruction Is the next state HALT? Update Tape Remember current letter of data Find next instruction YES NO HALT Find & remember what to write & where to move Update Tape Find & remember what to write & where to move
19
Revision Know how to encode a Turing Machine. Know how to decode Turing Machine representation. Know what is a Universal Turing Machine, and what it does. Preparation Read –Chapter 25 in the Text Book.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.