TM M ... TM M. right half left half # # ...

Similar documents
Section: Other Models of Turing Machines. Definition: Two automata are equivalent if they accept the same language.

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

Nondeterminism and Nodeterministic Automata

Chapter 2 Finite Automata

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

This lecture covers Chapter 8 of HMU: Properties of CFLs

Convert the NFA into DFA

CS S-12 Turing Machine Modifications 1. When we added a stack to NFA to get a PDA, we increased computational power

AUTOMATA AND LANGUAGES. Definition 1.5: Finite Automaton

input tape head moves current state

First Midterm Examination

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

Let's start with an example:

Worked out examples Finite Automata

Some Theory of Computation Exercises Week 1

Regular expressions, Finite Automata, transition graphs are all the same!!

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Formal Languages and Automata

Converting Regular Expressions to Discrete Finite Automata: A Tutorial

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

1 Nondeterministic Finite Automata

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

Intermediate Math Circles Wednesday, November 14, 2018 Finite Automata II. Nickolas Rollick a b b. a b 4

Java II Finite Automata I

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

Homework 3 Solutions

Lecture 08: Feb. 08, 2019

Formal languages, automata, and theory of computation

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Non-Deterministic Finite Automata

Minimal DFA. minimal DFA for L starting from any other

CHAPTER 1 Regular Languages. Contents

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Recursively Enumerable and Recursive. Languages

CS 373, Spring Solutions to Mock midterm 1 (Based on first midterm in CS 273, Fall 2008.)

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Designing finite automata II

Theory of Computation Regular Languages

First Midterm Examination

CS 330 Formal Methods and Models

CS103B Handout 18 Winter 2007 February 28, 2007 Finite Automata

Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Regular Expressions (RE) Kleene-*

Deterministic Finite Automata

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Lecture 09: Myhill-Nerode Theorem

Revision Sheet. (a) Give a regular expression for each of the following languages:

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

11.1 Finite Automata. CS125 Lecture 11 Fall Motivation: TMs without a tape: maybe we can at least fully understand such a simple model?

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

Myhill-Nerode Theorem

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

5.1 Definitions and Examples 5.2 Deterministic Pushdown Automata

Coalgebra, Lecture 15: Equations for Deterministic Automata

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

Fundamentals of Computer Science

Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem. Kleene s Theorem 2/16/15

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

CS 311 Homework 3 due 16:30, Thursday, 14 th October 2010

CISC 4090 Theory of Computation

Finite-State Automata: Recap

CSCI FOUNDATIONS OF COMPUTER SCIENCE

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

Formal Language and Automata Theory (CS21004)

Context-Free Grammars and Languages

Normal Forms for Context-free Grammars

Compiler Design. Fall Lexical Analysis. Sample Exercises and Solutions. Prof. Pedro C. Diniz

CS375: Logic and Theory of Computing

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

More on automata. Michael George. March 24 April 7, 2014

Non-deterministic Finite Automata

1.4 Nonregular Languages

Anatomy of a Deterministic Finite Automaton. Deterministic Finite Automata. A machine so simple that you can understand it in less than one minute

Harvard University Computer Science 121 Midterm October 23, 2012

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2016

Finite Automata-cont d

Non-deterministic Finite Automata

3 Regular expressions

CS 267: Automated Verification. Lecture 8: Automata Theoretic Model Checking. Instructor: Tevfik Bultan

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Lecture 9: LTL and Büchi Automata

In-depth introduction to main models, concepts of theory of computation:

NFAs and Regular Expressions. NFA-ε, continued. Recall. Last class: Today: Fun:

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

State Minimization for DFAs

CS 275 Automata and Formal Language Theory

FABER Formal Languages, Automata and Models of Computation

CS 275 Automata and Formal Language Theory

CMSC 330: Organization of Programming Languages

NFAs continued, Closure Properties of Regular Languages

Linear Inequalities. Work Sheet 1

Languages & Automata

CMSC 330: Organization of Programming Languages. DFAs, and NFAs, and Regexps (Oh my!)

CS415 Compilers. Lexical Analysis and. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

Types of Finite Automata. CMSC 330: Organization of Programming Languages. Comparing DFAs and NFAs. NFA for (a b)*abb.

Transcription:

CPS 140 - Mthemticl Foundtions of CS Dr. S. Rodger Section: Other Models of Turing Mchines èhndoutè Deænition: Two utomt re equivlent if they ccept the sme lnguge. We will demonstrte equivlence etween two clsses of utomt y showing tht for every mchine in one clss, there is mchine in the second clss tht cn simulte it, nd vice vers. Turing Mchines with Sty Option Allow the tpe hed to sty in plce fter writing. Modify æ, Theorem Clss of stndrd TM's is equivlent to clss of TM's with sty option. Proof: æ èèè: Given stndrd TM M, then there exists TM M' with sty option such tht LèMè=LèM'è. èesyè æ èèè: Given TM M with sty option, construct stndrd TM M' such tht LèMè=LèM'è. M=èK,æ;,;æ;q 0 ;B,Fè M'= For ech trnsition in M with move èl or Rè put the trnsition in M'. So, for æèq i ;è=èq j ;;LorRè put into æ 0 For ech trnsition in M with S èsty-optionè, move right nd move left. So for æèq i ;è=èq j ;;Sè LèMè=LèM'è. QED. 1

Deænition: A multiple trck TM divides ech cell of the tpe into k cells, for some constnt k. A 3-trck TM: c 1 1 1 tpe hed Amultiple trck TM strts with the input on the ærst trck, ll other trcks re lnk. æ: Theorem Clss of stndrd TM's is equivlent to clss of TM's with multiple trcks. æ èèè: Given stndrd TM M there exists TM M' with multiple trcks such tht LèMè=LèM'è. æ èèè: Given TM M with multiple trcks there exists stndrd TM M' such tht LèMè=LèM'è. 2

Deænition: A TM with semi-inænite tpe is stndrd TM with left oundry. Theorem Clss of stndrd TM's is equivlent to clss of TM's with semi-inænite tpes. æ èèè: Given stndrd TM M there exists TM M' with semi-inænite tpe such tht LèMè=LèM'è. Given M, construct 2-trck semi-inænite TM M' TM M... c... TM M # # c... right hlf left hlf æ èèè: Given TM M with semi-inænite tpe there exists stndrd TM M' such tht LèMè=LèM'è. 3

Deænition: tpes. An Multitpe Turing Mchine is stndrd TM with multiple è ænite numerè redèwrite Control Unit tpe 2 tpe 1 c tpe 3 For n n-tpe TM, deæne æ: Theorem Clss of Multitpe TM's is equivlent to clss of stndrd TM's. æ èèè: Given stndrd TM M, construct multitpe TM M' such tht LèMè=LèM'è. æ èèè: Given n-tpe TM M construct stndrd TM M' such tht LèMè=LèM'è. 4

Deænition: An Oæ-Line Turing Mchine is stndrd TM with 2 tpes: red-only input tpe nd redèwrite output tpe. Deæne æ: c input tpe (red only) Control Unit d red/write tpe Theorem Clss of stndrd TM's is equivlent to clss of Oæ-line TM's. æ èèè: Given stndrd TM M there exists n oæ-line TM M' such tht LèMè=LèM'è. æ èèè: Given n oæ-line TM M there exists stndrd TM M' such tht LèMè=LèM'è. 5

Running Time of Turing Mchines The running time of TM's is deæned to e the count of the numer of moves, writes nd reds. Since ech trnsition does ll three of these, you cn just count the numer of moves, nd multiple your nswer y 3. Exmple: Given L=f n n c n jné0g. Given w2 æ æ, is w in L? Write 3-tpe TM for this prolem. Deænition: An Multidimensionl-tpe Turing Mchine is stndrd TM with multidimensionl tpe èexpnds inænitely in multidimensionsè. èwe will just exmine the 2-dimensionl-tpe TMè. " è c! è The tpe hed ènot shownè would e pointing to one of the tpe cells. Deæne æ: 6

Theorem Clss of stndrd TM's is equivlent to clss of 2-dimensionl-tpe TM's. æ èèè: Given stndrd TM M, construct 2-dim-tpe TM M' such tht LèMè=LèM'è. æ èèè: Given 2-dim tpe TM M, construct stndrd TM M' such tht LèMè=LèM'è. Imgine numering ech cell on the 2-dim tpe TM using x-y-coordintes. Note tht there re only ænite numer of symols èignoring lnksè written on the 2-dim tpe. " -1,2 1,2 2,2 è -2,1-1,1 1,1 2,1 c 3,1! -2,-1-1,-1 1,-1 2,-1 Construct M' to e 2 trck TM. The ærst trck stores ll symols èignoring lnksè written on the 2-dim tpe, nd the second trck stores the position of ech symol. Mrkers èèè re used to seprte positions nd symols. è è è è c è 1 è 1 è 1 1 è 1 è 1 1 1 è 1 " The tpe hed in M' will point to the sme symol nd position tht M points to. M' will simulte move inmy serching its tpe for the next position. If the position is not listed, then the position is dded with B s the vlue written in tht position. Deænition: A nondeterministic Turing mchine is stndrd TM in which the rnge of the trnsition function is set of possile trnsitions. Deæne æ: Theorem Clss of deterministic TM's is equivlent to clss of nondeterministic TM's. æ èèè: Given deterministic TM M, construct nondeterministic TM M' such tht LèMè=LèM'è. æ èèè: Given nondeterministic TM M, construct deterministic TM M' such tht LèMè=LèM'è. Every time there is choice in the trnsition function new mchine should e creted. Construct M' to e 2-dim tpe TM. Two rows will represent the simultion of one mchine. The ærst row stores the contents of the tpe, nd the second row stores the position of the tpe hed nd the current stte of the mchine. Whenever there is choice in M, two new rows will e dded to M' to simulte the new mchine. Mrkers èèè re used to indicte the current work re. 7

A step consists of mking one move for ech of the current mchines. If ny of these mchines hve choice, then dditionl mchines re dded èi.e. two rows dded to the 2-dim tpe TM. For exmple: Consider the following trnsition: æèq 0 ;è=fèq 1 ;;Rè;èq 2 ;;Lè;èq 1 ;c;règ Suppose the 2-dim tpe egins in stte q 0 with input c. Note tht q 0 lso represents the position of the tpe hed on M. è è è è è è c è è q 0 è è è è è è The one move hs three choices, so 2 dditionl mchines re strted. è è è è è è è c è è q 1 è è c è è q 2 è è c c è è q 1 è è è è è è è The ærst two rows represent tking the ærst choice ove. The next two rows represent tking the second choice ove. The lst two rows represent tking the third choice ove. Note the tpe hed of M' hs not e shown. It would point to squre within the mrked region. Deænition: A 2-stck NPDA is n NPDA with 2 stcks. Control Unit stck 1 stck 2 Deæne æ: 8

Consider the following lnguges which could not e ccepted y n NPDA. 1. L=f n n c n jné0g 2. L=f n n n n jné0g 3. L=fw 2 æ æ j numer of 's equls numer of 's equls numer of c'sg, æ=f; ; cg Theorem Clss of 2-stck NPDA's is equivlent to clss of stndrd TM's. æ èèè: Given 2-stck NPDA, construct 3-tpe TM M' such tht LèMè=LèM'è. æ èèè: Given stndrd TM M, construct 2-stck NPDA M' such tht LèMè=LèM'è. 9

Universl TM - progrmmle TM æ Input: í n encoded TM M í input string w æ Output: í Simulte M on w An encoding of TM Let TM M=fK,æ;,;æ;q 1 ;B,Fg æ K=fq 1 ;q 2 ;:::;q n g Designte q 1 s the strt stte. Designte q 2 s the only ænl stte. q n will e encoded s n 1's æ Moves L will e encoded y 1 R will e encoded y 11 æ,=f 1 ; 2 ;:::; m g where 1 will lwys represent the B. If we use 0's s seprtors etween symols deæning æ, then we cn deæne TM s string of 0's nd 1's. For exmple, consider the simple TM: ;,R ;,L q 1 q 2,=fB,,g which would e encoded s 10

The TM hs 2 trnsitions, æèq 1,è=èq 1,,Rè, æèq 1,è=èq 2,,Lè which cn e represented s 5-tuples: èq 1,,q 1,,Rè,èq 1,,q 2,,Lè Thus, the encoding of the TM is: 0101101011011010111011011010 where the ærst group of 1's è1è represents q 1, the second group of 1's è11è represents '', etc. The ærst æve groups of 1's represent the ærst trnsition ove, nd the second æve groups of 1's represent the second trnsition ove. The input to the universl TM would e the code of TM followed y the code of the input string. Use 2 0's to seprte the TM code nd the input string. For exmple, the encoding of the TM ove with input string ë" would e encoded s: 010110101101101011101101101001101110110 Question: Given w 2f0;1g +,iswthe encoding of TM? 11

Universl TM The Universl TM èdenoted M U è is 3-tpe TM: Control Unit 0 1 1 0... tpe contents of M 0 1 0 encoding of M 1... 1 1 1 current stte of M Tpe 1 contins the encoding of TM M. Tpe 2 contins the contents of the tpe of M. Tpe 3 contins the current stte. Suppose TM M ws in stte q 3 nd it's tpe hed ws pointing to n ''. The universl TM would hve the encoding of q 3 èrepresented y 111è on tpe 3, nd tpe 2's hed would e pointing to the ærst symol in the encoding of n ''. Progrm for M U 1. Strt with ll input èencoding of TM nd string wè on tpe 1. Verify tht it contins the encoding of TM. 2. Move input w to tpe 2 3. Initilize tpe 3 to 1 èthe initil stteè 4. Repet èsimulte TM Mè èè consult tpe 2 nd 3, èsuppose current symol on tpe 2 is nd stte on tpe 3 is pè èè lookup the move ètrnsitionè on tpe 1, èsuppose æèp,è=èq,,rè.è ècè pply the move æ write on tpe 2 èwrite è æ move on tpe 2 èmove rightè æ write new stte on tpe 3 èwrite qè Oservtion: Every TM cn e encoded s string of 0's nd 1's. Enumertion procedure - process to list ll elements of set in ordered fshion. Deænition: An inænite set is countle if its elements hve 1-1 correspondence with the positive integers. Exmples: æ S = f positive odd integers g æ S=frel numers g æ S=fw2æ + g,æ=f; g 12

æ S=fTM's g æ S=fèi,jè j i,jé0, re integersg Liner Bounded Automt We plce restrictions on the mount oftpewe cn use, restricting our usge to the size of the input string. An input string is listed with 'ë' signifying the left end of the input nd 'ë' signifying the right end of the input. The tpe hed cnnot move to the left of 'ë' or to the right or 'ë'. ë c ë " Deænition: A liner ounded utomton èlbaè is nondeterministic TM M=èK,æ;,;æ;q 0 ;B,Fè such tht ë; ë 2 æ nd the tpe hed cnnot move out of the conænes of ëë's. Thus, æèq i ; ëè = èq j ; ë;rè, nd æèq i ; ëè=èq j ;ë;lè Deænition: Let M e LBA. LèMè=fw 2 èæ,fë;ëgè æ jq 0 ëwë æ`ëx 1 q f x 2 ëg Exmple: L=f n n c n jné0gis ccepted y some LBA 13