pp Variants of Turing Machines (Sec. 3.2)

Similar documents
Variants of Turing Machines

Equivalence of NTMs and TMs

CS21 Decidability and Tractability

Turing Machines, continued

Outline. Language Hierarchy

CSE 105 THEORY OF COMPUTATION

ECS 120 Lesson 16 Turing Machines, Pt. 2

CISC 4090 Theory of Computation

CSE 105 THEORY OF COMPUTATION

Turing Machines. A transducer is a finite state machine (FST) whose output is a string and not just accept or reject.

Theory of Computation, Homework 3 Sample Solution

Theory of Languages and Automata

CSE 105 THEORY OF COMPUTATION

Theory of Computation p.1/?? Theory of Computation p.2/?? A Turing machine can do everything that any computing

Introduction to Computers & Programming

Actually talking about Turing machines this time

Computability and Complexity

COMP 382: Reasoning about algorithms

A Characterization of the Chomsky Hierarchy by String Turing Machines

Theory of Computations Spring 2016 Practice Final Exam Solutions

Computer Sciences Department

PDA s. and Formal Languages. Automata Theory CS 573. Outline of equivalence of PDA s and CFG s. (see Theorem 5.3)

TAFL 1 (ECS-403) Unit- V. 5.1 Turing Machine. 5.2 TM as computer of Integer Function

Theory of Programming Languages COMP360

Recursively Enumerable Languages, Turing Machines, and Decidability

(p 300) Theorem 7.27 SAT is in P iff P=NP

CSC-461 Exam #2 April 16, 2014

Source of Slides: Introduction to Automata Theory, Languages, and Computation By John E. Hopcroft, Rajeev Motwani and Jeffrey D.

Chapter 14: Pushdown Automata

Closure Properties of CFLs; Introducing TMs. CS154 Chris Pollett Apr 9, 2007.

Limitations of Algorithmic Solvability In this Chapter we investigate the power of algorithms to solve problems Some can be solved algorithmically and

1 Parsing (25 pts, 5 each)

The Big Picture. Chapter 3

Turing Machine Languages

Name: CS 341 Practice Final Exam. 1 a 20 b 20 c 20 d 20 e 20 f 20 g Total 207

Turing Machine as Transducer. Turing Machines. Computation with Turing Machines. Computation with Turing Machines. Computation with Turing Machines

We can create PDAs with multiple stacks. At each step we look at the current state, the current input symbol, and the top of each stack.

6.045J/18.400J: Automata, Computability and Complexity. Practice Quiz 2

Midterm Exam II CIS 341: Foundations of Computer Science II Spring 2006, day section Prof. Marvin K. Nakayama

Enumerations and Turing Machines

Definition 2.8: A CFG is in Chomsky normal form if every rule. only appear on the left-hand side, we allow the rule S ǫ.

CSE 105 THEORY OF COMPUTATION

Recursive and Recursively Enumerable Languages

Lecture 7: Primitive Recursion is Turing Computable. Michael Beeson

Final Course Review. Reading: Chapters 1-9

From Theorem 8.5, page 223, we have that the intersection of a context-free language with a regular language is context-free. Therefore, the language

CS402 - Theory of Automata Glossary By

Theory of Computations Spring 2016 Practice Final

I have read and understand all of the instructions below, and I will obey the Academic Honor Code.

4.1 Review - the DPLL procedure

Log-Space. A log-space Turing Machine is comprised of two tapes: the input tape of size n which is cannot be written on, and the work tape of size.

Does this program exist? Limits of computability. Does this program exist? A helper function. For example, if the string program is

We show that the composite function h, h(x) = g(f(x)) is a reduction h: A m C.

CS5371 Theory of Computation. Lecture 8: Automata Theory VI (PDA, PDA = CFG)

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2016

05. Turing Machines and Spacetime. I. Turing Machines and Classical Computability.

Computability Summary

Computability via Recursive Functions

Lecture 18: Turing Machines

CSCI 340: Computational Models. Turing Machines. Department of Computer Science

Lec-5-HW-1, TM basics

Universal Turing Machine Chomsky Hierarchy Decidability Reducibility Uncomputable Functions Rice s Theorem Decidability Continued

CS256 Applied Theory of Computation

Assignment 4 CSE 517: Natural Language Processing

Decidable Problems. We examine the problems for which there is an algorithm.

ONE-STACK AUTOMATA AS ACCEPTORS OF CONTEXT-FREE LANGUAGES *

(a) R=01[((10)*+111)*+0]*1 (b) ((01+10)*00)*. [8+8] 4. (a) Find the left most and right most derivations for the word abba in the grammar

14.1 Encoding for different models of computation

CS 125 Section #4 RAMs and TMs 9/27/16

CpSc 421 Final Solutions

CT32 COMPUTER NETWORKS DEC 2015

Theory of Computer Science

Pushdown Automata. A PDA is an FA together with a stack.

CS 44 Exam #2 February 14, 2001

Theory of Computation Dr. Weiss Extra Practice Exam Solutions

The Turing Machine. Unsolvable Problems. Undecidability. The Church-Turing Thesis (1936) Decision Problem. Decision Problems

W[1]-hardness. Dániel Marx 1. Hungarian Academy of Sciences (MTA SZTAKI) Budapest, Hungary

Automata Theory CS F-14 Counter Machines & Recursive Functions

W[1]-hardness. Dániel Marx. Recent Advances in Parameterized Complexity Tel Aviv, Israel, December 3, 2017

Storage capacity of labeled graphs

Modeling Computer Insecurity

CSCI 3130: Formal Languages and Automata Theory Lecture 16 The Chinese University of Hong Kong, Fall 2010

English for Computer Science

Where Can We Draw The Line?

Structure of a Compiler: Scanner reads a source, character by character, extracting lexemes that are then represented by tokens.

Finite Automata. Dr. Nadeem Akhtar. Assistant Professor Department of Computer Science & IT The Islamia University of Bahawalpur

CS210 THEORY OF COMPUTATION QUESTION BANK PART -A UNIT- I

lec3:nondeterministic finite state automata

implementing the breadth-first search algorithm implementing the depth-first search algorithm

UNIT I PART A PART B

Material from Recitation 1

where is the transition function, Pushdown Automata is the set of accept states. is the start state, and is the set of states, is the input alphabet,

5.2: Closure Properties of Recursive and Recursively Enumerable Languages

More on Polynomial Time and Space

(Refer Slide Time: 0:19)

CS 125 Section #10 Midterm 2 Review 11/5/14


Regular Languages and Regular Expressions

Control Structures. Code can be purely arithmetic assignments. At some point we will need some kind of control or decision making process to occur


Transcription:

pp. 176-176-182. Variants of Turing Machines (Sec. 3.2) Remember: a language is Turing recognizable if some TM accepts it. Adding features may simplify programmability but DO NOT affect what a TM can compute. Anything a fancy TM can compute, can be computed with a basic TM (perhaps with more complex set of δs.) Option to stay still (p. 176) (not move head) δ:qxγ -> QxΓx {L, R, S} S means stay still δ(q,a) -> (r,b,s) can be replaced by 2 transitions of standard TM δ(q,a) -> (r 1,b,R) δ(r 1,x) -> (q,x,l) for all x in Γ Thus no TM with S option can compute anything not computable by basic TM But may be faster or easier to program 1

MultiTape TM (p. 176) Assume M has k tapes: all use same Γ 1 st one as in basic machine (i.e. holds initial input) Rest are initially all blank Separate read/write head under each tape That can be moved individually δ: Q x Γ k -> Q x Γ k x {L,R,S} k δ(q,a 1, a k ) = (r, b 1, b k, d 1, d k ) means If in state q, and for all 1 i k, tape i has a i under its head Then for all I, change a i to b i on tape i And for all I, move tape i in direction d i Proof: assume M is a k tape TM (Q,Σ,Γ,δ,q start,q accept,q reject ). Construct equivalent 1-tape TM S (Q,Σ,Γ,δ,q start,q accept,q reject ) as follows: Assume starting tape is w 1 w n Add new characters to Γ For each x in Γ, add a new symbol x to Γ indicates a tape head is on that cell Include a Add a special symbol # to Γ To mark start of a new simulated tape 2

Add new initial states with transitions that do following Insert a # onto left of tape, moving w right one place Replace w 1 by w 1 Write k-1 copies of # to end of w Write a final # at end Resulting tape looks like #w 1 w n # # # # The ith # indicate the start of the ith tape The ith ed symbol indicates the current position of the ith tape head (p. 177) Fig. 3.14 diagrams 3-tape example To simulate with S a single transition of M from state q Sequentially try each rule from M that starts with q: Move to the ith ed symbol and compare to a i If we find a mismatch, quit and try next rule If we have match on all a i s, go back to start of tape and go back to each ed symbol in sequence Replace by b i Move simulated tape head i by moving L, R, or S, and replace that symbol by its ed version On a move R where we hit a # 1 st move entire rest of string right one position Then write a blank 3

B: Bidirectional Infinite Tape Tape goes on forever in both directions, not just right First emulate on a 2-tape TM Tape 1 is the right hand side of the double sided tape Tape 2 is the left handed side of the double sided tape Have a special # on start of both sides of tape Two sets of states from B: one where we are on right hand side of B s tape other where we are on left hand side of B s tape If in a right-side of tape state and move L, add additional states to check if new cell is cell 0 This is case where B has crossed the center of its tape, moving left If so, switch to correct state on 2 nd tape And whenever original state says move left, new transition says more right, and vice versa If on 2 nd tape, and move right into a cell with a # I.E. have crossed the center of the original tape and moving right Move left to cell 0, switch to equivalent state that uses 1 st tape Then emulate 2-tape machine on a basic TM 4

S: TM with a Stack δ:qxγ 1 x Γ 2 -> Qx Γ1 x Γ 2 x {L, R} Γ 2 : tape characters Γ 1 : stack characters Having a stack is useful to simplify programming by supporting subroutines and recursive operations Solution: Simulate on a 2-tape machine One tape is original tape 2 nd tape is stack Γ1 and Γ 2 include duplicates of Γ 1 and Γ 2 i.e. a and a where ed symbols represent top of stack Any push or pop to stack causes switch to states that modify just stack Then emulate 2-tape on single tape 5

(p. 178) NTM: NonDeterministic TMs δ:qxγ -> P( QxΓx {L, R,} ) Each (q,a) can lead to one of a set of transitions There are multiple choices for each state & tape symbol If any of these choices lead to an accept state, then TM accepts its input (p. 179) Theorem 3.16: Every nondeterministic TM N has equivalent deterministic TM D Solution: have D work thru each possible variation in N s transitions sequentially In a breadth-first exploration of tree of choices Each node in tree is a configuration of N Root node is initial configuration Explore all possible set of choices at level k before trying any choices at level k+1 If any choice leads to q accept, accept If all choices lead to q reject, reject Looping is still possible 6

D has 3 tapes (see Fig. 3.17 on page 179) Tape 1: Input tape never changed Tape 2: Simulation tape: copy of N s tape having made one set of choices Tape 3: Keeps track of which node in tree Tape 2 represents Let b = size of largest set of possible choices from one transition Γ 3 = {1, b} Eg. 431 on tape 3 means tape 2 represents Having made 4 nd choice at root, Having made 3 rd choice from above Having made 1 st choice from above Computation as follows: Copy tape 1 to 2 Initialize tape 3 to ε Use Tape 2 to simulate one branch of N s tree Before each step of N, consult next symbol on tape 3 to determine which choice to make If accepting configuration found, enter accept state 7

Replace string on tape 3 with next string in tree ordering and restart if any of following No more symbols on tape 3 Simulation ended up invalid Choice on tape is invalid D clearly computes anything N does but with 3 tapes But a 3-tape TM can be simulated by a 1 tape TM SLOWLY!!! Thus N can be simulated by a basic 1-Tape TM! (p. 180) Corollary 3.18. A language is Turingrecognizable if some NTM recognizes it Proof: all NTMs can be converted into a TM A NTM is a Decider if all branches halt In proof of Theorem 3.16 we can modify simulation of N so that if N always halts then so does D. Thus Corollary 3.19: L is decidable iff some NTM decides it 8

(p. 180) An Enumerator of a language L is a TM with A printer where each rule can also output a symbol An initial blank work tape A set of rules that uses work tape to generate all possible strings from a language And write each string to the printer (p. 181) Theorem 3.21 A language L is Turingrecognizable iff some enumerator can enumerate it. If: assume TM E enumerates L, following TM M accepts it Given a string w, M runs E from start For each string that is output, compare it to w If ever a match, accept it All (and only) w s from L will be accepted! Only if: Assume TM M accepts L, construct E as follows: Build an enumerator E for all strings in * Do the following for i=1, 2,. Run E to generate next string For each output from E run M for exactly i steps Guarantees we will stop If accepted, print out string from E Equivalent logically to running parallel set of Ms, each running on a different string from * 9

Summary of all this No computer can compute anything that basic TM cannot With caveat of enough memory Thus all computers compute exactly the same class of algorithms Any reasonable programming language can be used to write a TM emulator Thus any reasonable programming language can be compiled into any other reasonable language Thus all programming languages describe exactly the same class of algorithms 10