Turing Machine Variations

Similar documents
3515ICT Theory of Computation Turing Machines

CS154. Turing Machines. Turing Machine. Turing Machines versus DFAs FINITE STATE CONTROL AI N P U T INFINITE TAPE. read write move.

Automata and Computability. Solutions to Exercises

24 Uses of Turing Machines

CSE 135: Introduction to Theory of Computation Decidability and Recognizability

Turing Machines: An Introduction

Turing Machines, Part I

(IALC, Chapters 8 and 9) Introduction to Turing s life, Turing machines, universal machines, unsolvable problems.

Pushdown Automata. place the input head on the leftmost input symbol. while symbol read = b and pile contains discs advance head remove disc from pile

Lecture 2: Universality

Pushdown automata. Informatics 2A: Lecture 9. Alex Simpson. 3 October, School of Informatics University of Edinburgh als@inf.ed.ac.

Theory of Computation Chapter 2: Turing Machines

Honors Class (Foundations of) Informatics. Tom Verhoeff. Department of Mathematics & Computer Science Software Engineering & Technology

Chapter 7 Uncomputability

CAs and Turing Machines. The Basis for Universal Computation

Implementation of Recursively Enumerable Languages using Universal Turing Machine in JFLAP

The Halting Problem is Undecidable

Welcome to... Problem Analysis and Complexity Theory , 3 VU

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

6.080/6.089 GITCS Feb 12, Lecture 3

Computational Models Lecture 8, Spring 2009

Diagonalization. Ahto Buldas. Lecture 3 of Complexity Theory October 8, Slides based on S.Aurora, B.Barak. Complexity Theory: A Modern Approach.

6.045: Automata, Computability, and Complexity Or, Great Ideas in Theoretical Computer Science Spring, Class 4 Nancy Lynch

Computability Theory

CS 3719 (Theory of Computation and Algorithms) Lecture 4

Theoretical Computer Science (Bridging Course) Complexity

Notes on Complexity Theory Last updated: August, Lecture 1

Finite Automata. Reading: Chapter 2

1 Definition of a Turing machine

How To Compare A Markov Algorithm To A Turing Machine

Regular Languages and Finite State Machines

Introduction to Automata Theory. Reading: Chapter 1

Properties of Stabilizing Computations

Complexity Classes P and NP

Introduction to Turing Machines

Algebraic Computation Models. Algebraic Computation Models

Regular Expressions and Automata using Haskell

Introduction to NP-Completeness Written and copyright c by Jie Wang 1

Quantum and Non-deterministic computers facing NP-completeness

CSC4510 AUTOMATA 2.1 Finite Automata: Examples and D efinitions Definitions

6.080 / Great Ideas in Theoretical Computer Science Spring 2008

The Classes P and NP

Universal Turing Machine: A Model for all Computational Problems

Deterministic Finite Automata

Notes on NP Completeness

Reading 13 : Finite State Automata and Regular Expressions

Prime Numbers. Difficulties in Factoring a Number: from the Perspective of Computation. Computation Theory. Turing Machine 電 腦 安 全

THE TURING DEGREES AND THEIR LACK OF LINEAR ORDER

T Reactive Systems: Introduction and Finite State Automata

Two-dimensional Languages

Finite Automata. Reading: Chapter 2

Complexity of Algorithms

Composability of Infinite-State Activity Automata*

Cardinality. The set of all finite strings over the alphabet of lowercase letters is countable. The set of real numbers R is an uncountable set.

THE SEARCH FOR NATURAL DEFINABILITY IN THE TURING DEGREES

NP-Completeness and Cook s Theorem

Automata on Infinite Words and Trees

MATHEMATICS: CONCEPTS, AND FOUNDATIONS Vol. III - Logic and Computer Science - Phokion G. Kolaitis

Increasing Interaction and Support in the Formal Languages and Automata Theory Course

Lecture 1: Oracle Turing Machines

Algorithmic Software Verification

Introduction to Logic in Computer Science: Autumn 2006

Chapter 1. Computation theory

Genetic programming with regular expressions

Lecture summary for Theory of Computation

3 Monomial orders and the division algorithm

Models of Sequential Computation

SRM UNIVERSITY FACULTY OF ENGINEERING & TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF SOFTWARE ENGINEERING COURSE PLAN

The Classes P and NP. mohamed@elwakil.net

Regular Languages and Finite Automata

4.6 The Primitive Recursive Functions

1. Nondeterministically guess a solution (called a certificate) 2. Check whether the solution solves the problem (called verification)

Automata Theory. Şubat 2006 Tuğrul Yılmaz Ankara Üniversitesi

THEORY of COMPUTATION

Automata and Formal Languages

1 Description of The Simpletron

COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Simulation-Based Security with Inexhaustible Interactive Turing Machines

FINITE STATE AND TURING MACHINES

CHAPTER 7 GENERAL PROOF SYSTEMS

CS 301 Course Information

Introduction to Theory of Computation

10CS35: Data Structures Using C

Fabio Patrizi DIS Sapienza - University of Rome

Computer Architecture Syllabus of Qualifying Examination

Compiler Construction

Quantum Computing. Robert Sizemore

Finite Automata and Regular Languages

Chapter 4: Computer Codes

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1)

Philadelphia University Faculty of Information Technology Department of Computer Science First Semester, 2007/2008.

Turing Machines, Busy Beavers, and Big Questions about Computing

Mathematical Induction

CELLULAR AUTOMATA AND APPLICATIONS. 1. Introduction. This paper is a study of cellular automata as computational programs

Informatique Fondamentale IMA S8

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Lecture 12 Doubly Linked Lists (with Recursion)

Math Workshop October 2010 Fractions and Repeating Decimals

Notes on Complexity Theory Last updated: August, Lecture 1

Transcription:

Turing Machine Variations CIS 301 Theory of Computation Brian C Ladd Computer Science Department SUNY Potsdam Fall 2016 November 16, 2016 Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 1 / 25

Outline Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 2 / 25

Formal Definition Definition A Turning Machine (TM) is a 7-tuple M = (Q, Σ, Γ, δ, q 0, q accept, q reject ) 1 Q is a set of states 2 Σ is the input alphabet not including the special blank symbol 3 Γ is the tape alphabet Γ and Σ Γ 4 δ : Q Γ Q Γ {L, R} Example: δ(q,a) = (r,b, L) 5 q 0 Q is the start state 6 q accept Q is the accept state 7 q reject Q is the reject state Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 3 / 25

Variations? What could we vary in the Turing Machine? Head Movement: add stay put ; remove L Do they add any functionality? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 4 / 25

Variations? What could we vary in the Turing Machine? Head Movement: add stay put ; remove L Tape: doubly infinite; multiple tapes; 2-d tape Do they add any functionality? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 4 / 25

Variations? What could we vary in the Turing Machine? Head Movement: add stay put ; remove L Tape: doubly infinite; multiple tapes; 2-d tape Alphabet: minimize to {0, 1, } Do they add any functionality? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 4 / 25

Variations? What could we vary in the Turing Machine? Head Movement: add stay put ; remove L Tape: doubly infinite; multiple tapes; 2-d tape Alphabet: minimize to {0, 1, } Finite control: minimize to 3 states Do they add any functionality? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 4 / 25

Reduction to Turing Machine What would show a given variation is no more powerful than a TM? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 5 / 25

Reduction to Turing Machine What would show a given variation is no more powerful than a TM? Convert the description of a varying machine to a TM Emulate the varying machine using a standard Turing Machine Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 5 / 25

Stay Put TM Extend δ to δ S : Q Q Γ {L, R, S} Replace each transition with S, δ S (q i, c j ) = (q k, c l, S), with two transitions: Note: Γ appearing on both sides of a transition means no matter what is read, write the same symbol Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 6 / 25

Stay Put TM Extend δ to δ S : Q Q Γ {L, R, S} Replace each transition with S, δ S (q i, c j ) = (q k, c l, S), with two transitions: δ(q i, c j ) = (q k, c l, R) Note: Γ appearing on both sides of a transition means no matter what is read, write the same symbol Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 6 / 25

Stay Put TM Extend δ to δ S : Q Q Γ {L, R, S} Replace each transition with S, δ S (q i, c j ) = (q k, c l, S), with two transitions: δ(q i, c j ) = (q k, c l, R) δ(q k, Γ) = (q k, Γ, L) Note: Γ appearing on both sides of a transition means no matter what is read, write the same symbol Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 6 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Move input one cell to the right Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Move input one cell to the right Put $ in the first location (marks flip over point) Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Move input one cell to the right Put $ in the first location (marks flip over point) Spread the input to every other cell, putting blanks between them Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Move input one cell to the right Put $ in the first location (marks flip over point) Spread the input to every other cell, putting blanks between them For every L : move two to the left (use intermediate state that leaves cell contents alone): if middle cell has $ then reverse direction, moving R by two locations Remember that directions are reversed in the store Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Two-Way Infinite Tape TM Extend the tape to be infinite to the left as well as to the right Head begins reading the left-most non-blank on the tape Blanks not allowed in the input Emulate on a standard Turing Machine: Imagine: Fold the double-infinite tape over on itself Mark the fold and alternate the cells: odd cells are the tape to the right; even cells are the tape to the left Start with input on tape Move input one cell to the right Put $ in the first location (marks flip over point) Spread the input to every other cell, putting blanks between them For every L : move two to the left (use intermediate state that leaves cell contents alone): if middle cell has $ then reverse direction, moving R by two locations Remember that directions are reversed in the store For every R : move two to the right If directions are reversed, could see $ so react by moving to correct next cell and re-reversing directions Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 7 / 25

Multi-tape TM Extend a TM with k tapes, each with its own read/write head Initially tape 1 contains the input; all other tapes are blank δ M : Q Γ k Q Γ k {L, R} k Example δ M (q i, a 1,, a k ) = (q j, b 1,, b k, L,, R) Theorem (310) Every multi-tape TM has an equivalent single tape TM Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 8 / 25

Multi-tape TM Sketch Show how to emulate multi-tape machine M with a single tape machine, S Finite Control 1 0 1 1 0 a b c c r s r s Γ M = {0, 1, a, b, } Γ S = {0, 1, a, b,, #, 0, 1, ȧ, ḃ, } Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 9 / 25

Multi-tape TM Proof S = On input string w = w 1 w n : 1 First S puts its tape into the format that represents all k tapes of M The formatted tape of S contains: # w 1 w 2 w n # # # 2 To simulate a single move of M, S scans its tape from the first #, which marks the left-hand end, to the (k + 1)st #, which marks the right-hand end, in order to determine the symbols under the virtual heads Then S makes a second pass to update the tapes according to the way that M s transition function dictates 3 If at any point S moves one of the virtual heads to the right onto a #, this action signifies that M has moved the corresponding head onto the previously unread blank portion of that tape So S writes a blank symbol on this tape cell and shifts the tape contents, from this cell until the rightmost #, one unit to the right Then S continues as before Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 10 / 25

Multi-tape TM # 1 0 1 1 0 # a b c ċ # r ṡ r s # Finite Control Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 11 / 25

Multi-tape TM Definition A language is Turing-recognizable iff TM that recognizes it Corollary A language is Turing-recognizable iff multi-tape TM that recognizes it Proof If a language is Turing-recognizable, then multi-tape TM that recognizes it By definition: if language is Turing-recognizable, L is recognized by some single-tape TM A single-tape TM is a one-tape multi-tape TM multi-tape machine that recognizes L Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 12 / 25

Multi-tape TM Definition A language is Turing-recognizable iff TM that recognizes it Corollary A language is Turing-recognizable iff multi-tape TM that recognizes it Proof If multi-tape TM that recognizes language L, then L is Turing-recognizable Show that any multi-tape TM can be simulated on a single-tape TM (proof is from previous slides) Since any multi-tape machine can run on a single tape, L, recognized by a multi-tape machine is also recognized by some single-tape machine; therefore L is Turing-recognizable Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 13 / 25

Non-deterministic TM Extend TM such that it may proceed in any number of ways δ N : Q Γ P(Q Γ {L, R}) Approach: Where there is a choice point, a new TM is spawned The TMs form a tree If one of the TMs succeeds (enters an accept state), then the nondeterministic machine accepts its input Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 14 / 25

Non-deterministic TM Theorem Every non-deterministic TM has an equivalent deterministic TM Proof Keep a tree of the nondeterministc TMs and search it breadth-first Why not search depth-first? Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 15 / 25

Non-deterministic TM Theorem Every non-deterministic TM has an equivalent deterministic TM Proof Keep a tree of the nondeterministc TMs and search it breadth-first Why not search depth-first? Must execute each machine, adding one step at a time Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 15 / 25

Non-deterministic TM Theorem Every non-deterministic TM has an equivalent deterministic TM Proof For D, the deterministic version of N, use three tapes 1 Tape 1 - input string 2 Tape 2 - a copy of N tape run for k steps on one copy of the machine 3 Tape 3 - address tape Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 16 / 25

Non-deterministic TM Theorem Every non-deterministic TM has an equivalent deterministic TM Proof Description of D s operation: 1 Initially, tape 1 contains w and tapes 2 and 3 are empty, in start state 2 Copy tape 1 to tape 2 3 Use tape 2 to simulate N with input w on one branch of N s computation Before each step on this branch, look at the next symbol on tape 3 to determine which choice to make among those that are possible If no more symbols are on tape 3 (at a blank) or the choice is invalid, abort this computation by going to stage 4 Also go to stage 4 if a rejecting configuration is encountered If an accepting configuration is encountered, accept the input 4 Replace the string on tape 3 with the lexicographically next string, and go to stage 2 Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 17 / 25

Non-deterministic TM Corollary A language, L, is Turing recognizable iff some non-deterministic TM recognizes it Proof Any deterministic TM is also a non-deterministic TM; if L is Turing-recognizable, M L, M L a deterministic TM recognizer: L is recognized by a NTM By previous theorem, NTM recognizer N L can be simulated on a DTM, M N:L : M N:L is a DTM recognizer of L Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 18 / 25

Non-deterministic TM Corollary A language, L, is Turing decidable iff some non-deterministic TM decides it Proof Any deterministic TM is also a non-deterministic TM; if L is Turing-decidable, M L, M L a deterministic TM decider: L is decided by a NTM By previous theorm, NTM decider N L can be simulated on a DTM, M N:L : M N:L is a DTM decider of L Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 19 / 25

Enumerators Definition An enumerator is a TM with a printer The language enumerated by E is the set of all strings printed to its printer Order and repetition are not important Theorem A language is Turing-recognizable iff some enumerator enumerates it How is this different from what I discussed on Monday? What difference does it make Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 20 / 25

Enumerators Theorem A language is Turing-recognizable iff some enumerator enumerates it Proof If E enumerates the language, A, construct TM M which recognizes the language: M = On input w: 1 Run E Every time that E outputs a string, compare it with w 2 If this output of E matches w, accept, else go to 1 Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 ) Turing Machine Variations November 16, 2016 21 / 25

Enumerators Theorem A language is Turing-recognizable iff some enumerator enumerates it Proof A is Turing-recognizable; construct an enumerator E to enumerate it L(M) = A, M a TM (by definition of Turing-recognizable) A Σ ; let s 1, s 2, s 3, be an infinite sequence of all the strings in Σ E = Ignore the input 1 For i = 1, 2, 3, 1 Run M for i steps on each input s 1,, s i 2 If M accepts any of these strings, print it Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 22 / 25

Enumerators Example Run M for i Steps, i = Strings Tested Printer output 1 s 1 2 s 1, s 2 3 s 1, s 2, s 3 4 s 1,s 2,s 3, s 4 s 2 5 s 1,s 2,s 3, s 4,s 5 s 2, s 5 6 s 1,s 2,s 3, s 4,s 5, s 6 s 2, s 3, s 5 7 s 1,s 2,s 3, s 4,s 5, s 6, s 7 s 2, s 3, s 5 8 s 1,s 2,s 3, s 4,s 5, s 6, s 7 s 1, s 2, s 3, s 5 Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 23 / 25

Turing Machine Summary There are other models of general purpose computation that have been proposed Example A PDA with a deque? Peter Joachim, contributor All are similar to TM: 1 Unrestricted access to a limitless memory FA - limited memory PDA - limitless memory, but restricted access 2 All perform a finite amount of work in a given step All machines with the above two features have the same power of computation as a TM Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 24 / 25

What Does This Mean? 1 Any model of computation can be simulated by a TM and vice versa 2 Any algorithm that runs on any other machine can be run on a TM Definition Since all computational models can simulate each other and compute all the same algorithms, we can describe an algorithm as being able to be run on a computing machine This is a unique, precise description of the class algorithm A precise definition of algorithm was not worked out until Turing and Church came along Brian C Ladd ( Computer Science Department SUNY Potsdam Fall 2016 Turing ) Machine Variations November 16, 2016 25 / 25