Variants of Turing machines

Slides:



Advertisements
Similar presentations
Turing Machines Memory = an infinitely long tape Persistent storage A read/write tape head that can move around the tape Initially, the tape contains only.
Advertisements

Lecture 16 Deterministic Turing Machine (DTM) Finite Control tape head.
Variants of Turing machines
THE CHURCH-TURING T H E S I S “ TURING MACHINES” Pages COMPUTABILITY THEORY.
Foundations of (Theoretical) Computer Science Chapter 3 Lecture Notes (Section 3.2: Variants of Turing Machines) David Martin With.
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Variants.
CS605 – The Mathematics and Theory of Computer Science Turing Machines.
More Turing Machines Sipser 3.2 (pages ). CS 311 Fall Multitape Turing Machines Formally, we need only change the transition function to.
1 Introduction to Computability Theory Lecture11: Variants of Turing Machines Prof. Amos Israeli.
More Turing Machines Sipser 3.2 (pages ).
Turing’s Thesis Fall 2006 Costas Busch - RPI.
Complexity ©D.Moshkovitz 1 Turing Machines. Complexity ©D.Moshkovitz 2 Motivation Our main goal in this course is to analyze problems and categorize them.
CS5371 Theory of Computation Lecture 11: Computability Theory II (TM Variants, Church-Turing Thesis)
Lecture 5 Turing Machines
Computation Theory Introduction to Turing Machine.
January 28, 2015CS21 Lecture 101 CS21 Decidability and Tractability Lecture 10 January 28, 2015.
Prof. Busch - LSU1 Turing Machines. Prof. Busch - LSU2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Chapter 9 Turing Machine (TMs).
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
CSCI 4325 / 6339 Theory of Computation Zhixiang Chen Department of Computer Science University of Texas-Pan American.
חישוביות וסיבוכיות Computability and Complexity Lecture 7 TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: A AAAA.
1 Turing Machines Reading: Chapter 8. 2 Turing Machines are… Very powerful (abstract) machines that could simulate any modern day computer (although very,
The Church-Turing Thesis Chapter 3 Giorgi Japaridze Theory of Computability.
1Computer Sciences Department. Book: INTRODUCTION TO THE THEORY OF COMPUTATION, SECOND EDITION, by: MICHAEL SIPSER Reference 3Computer Sciences Department.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
CSC 3130: Automata theory and formal languages Andrej Bogdanov The Chinese University of Hong Kong Turing Machines.
TM Design Macro Language D and SD MA/CSSE 474 Theory of Computation.
Costas Busch - LSU1 Turing’s Thesis. Costas Busch - LSU2 Turing’s thesis (1930): Any computation carried out by mechanical means can be performed by a.
1 Turing Machines and Equivalent Models Section 13.1 Turing Machines.
Overview of the theory of computation Episode 3 0 Turing machines The traditional concepts of computability, decidability and recursive enumerability.
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
Automata & Formal Languages, Feodor F. Dragan, Kent State University 1 CHAPTER 3 The Church-Turing Thesis Contents Turing Machines definitions, examples,
1 Turing Machines. 2 The Language Hierarchy Regular Languages Context-Free Languages ? ?
Universal Turing Machine
Turing’s Thesis.
Turing’s Thesis Costas Busch - LSU.
CSCI 2670 Introduction to Theory of Computing
The Church-Turing Thesis
CSCI 2670 Introduction to Theory of Computing
Time complexity Here we will consider elements of computational complexity theory – an investigation of the time (or other resources) required for solving.
Busch Complexity Lectures: Turing Machines
Busch Complexity Lectures: Reductions
Reductions Costas Busch - LSU.
CS21 Decidability and Tractability
Pushdown Automata.
(Universal Turing Machine)
CSE 105 theory of computation
CSCI 2670 Introduction to Theory of Computing
Turing’s Thesis Costas Busch - RPI.
Turing Machines 2nd 2017 Lecture 9.
CSE 105 theory of computation
Turing Machines Acceptors; Enumerators
COSC 3340: Introduction to Theory of Computation
Decidability and Enumerability
Intro to Theory of Computation
Decidable Languages Costas Busch - LSU.
CS21 Decidability and Tractability
CSC 4170 Theory of Computation Time complexity Section 7.1.
Recall last lecture and Nondeterministic TMs
The Church-Turing Thesis
Instructor: Aaron Roth
CSE 105 theory of computation
Instructor: Aaron Roth
Variants of Turing machines
CSC 4170 Theory of Computation Time complexity Section 7.1.
Theory of Computation Lecture 23: Turing Machines III
Intro to Theory of Computation
CSE 105 theory of computation
Presentation transcript:

Variants of Turing machines

Turing machines with the “stay put” option A transition of this type of machine may have either L (move left), Or R (move right), or S (stay put). ab,S q1 q2 “Replace a with b and go to state q2 without moving the head” This does not increase the power of the machine, because the above transition can be simulated with the ordinary TM as follows:

Turing machines with the “stay put” option A transition of this type of machine may have either L (move left), Or R (move right), or S (stay put). ab,S q1 q2 “Replace a with b and go to state q2 without moving the head” This does not increase the power of the machine, because the above transition can be simulated with the ordinary TM as follows: ab,R L q1 q2

Multitape Turing machines A multitape TM has k tapes, each with its own read/write head. Initially, the input is written on the first tape, and all the other tapes are blank, with each head at the beginning of the corresponding tape. For a 3-tape TM, a transition will look like 0,1,11,0,1,R,R,L q1 q2 “If you are in state q1 and see 0 on Tape1, 1 on Tape2 and 1 on Tape3, type 1 on Tape1, 0 on Tape2 and 1 on Tape3; move Head1 right, Head2 right and Head3 left; go to state q2.”

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} Done Swap Tape1 Tape2 1 1 - - -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 1 1 - - -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 1 1 - - -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 1 - 1 - -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 - 1 1 - -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 - - 1 1 -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 - - 1 1 -

Multitape Turing machines: Example Design a fragment of a 2-tape TM that swaps the contents of the tapes, from the position where the heads are at the beginning and there are no blanks followed by non-blank symbols. Tape alphabet: {0,1,-} 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R -,- - ,-,L,L Done Swap Tape1 Tape2 - - 1 1 -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The tape contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - 1 - - - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . # 1 - - - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . # - - - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . # - - - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . # 1 - - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . # 1 # - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . # 1 # - - - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . # 1 # - # - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - - - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 - q0 - - - - - - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . # 1 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # - # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # - # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . # 1 1 # # 1 # - - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 - q1 - - - 1 - - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . # 1 1 1 # # 1 - # - - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # - # 1 - # - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # - # 1 - # - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . . # 1 1 1 # - # 1 - # - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . # 1 1 1 # - # 1 # - - - -

Simulating multitape TM with ordinary TM Theorem 3.13: Every multitape TM M has an equivalent single-tape TM S. Proof idea: The contents and the head positions of M can be represented on the single tape of S and correspondingly updated as shown on the following example for a 3-tape M; S follows the steps of M and accepts iff M accepts. Tape1 M: Tape2 Tape3 S: 1 1 1 - q2 - - - 1 - - . . . # 1 1 1 # - # 1 - # - - -

. . . . . Swap Done   Swap     Shift  Shift initialization 0,00,0,R,R 0,11,0,R,R 0,-  -,0,R,R 1,00,1,R,R 1,11,1,R,R 1,-  -,1,R,R -,00,-,R,R -,11,-,R,R 如果原来有Q个状态,种字符, K个带子,则关键状态有Q* k个。 -,- - ,-,L,L Swap Done 0,1L 0,1L . 0L 0,1R 0,1R #L . 00, R . 0R #R 1R  -R  initialization Swap 0,R  1R  0 1  If(S,0,0 )=(p,0,0,R,R), 指向p状态 -R  #R 1,R  #R . 0, L Shift 0,1,-,#R . 00, R 0,1R 0,1R 0 1   . . . 1,L 0,1L 0,1L 0, 1, -L #R #L Shift

Nondeterministic Turing machines A nondeterministic TM is allowed to have more than 1 transition for a given tape symbol: A string is accepted, if one of the branches of computation takes us to the accept state. q2 ab,R : Q   P{Q  {L, R}} q1 ac,L q3 Theorem 3.16: Every nondeterministic TM has an equivalent deterministic TM. Idea: Simulate every possible branch of computation in a breadth-first manner.

Simulation Idea of TM for NTM TM will explore the computation graph in BFS (breadth-first order ) fashion. Enumerate all possible computations with just 1-step, then those with 2-steps, … Initial configuration of NTM 1 2 b . . . A computation with 2 steps 1 1 b ... b ... 1 b ... 2 2 2 . Why not in DFS? b is the maximum number of choices in one transition

Simulation Idea for NTM … input tape 1 □ □ D … x x # 1 x □ simulation tape … 1 2 3 3 2 3 1 2 1 1 3 □ address tape Deterministic TM D simulating non-deterministic TM N

Simulation Idea for NTM N Initially tape 1 contains the input w, and tapes 2 and 3 are empty. Copy tape 1 onto tape 2. Use tape 2 to simulate N with input w on one branch of its non-deterministic computation. Consult tape 3 to determine which choice to make. If no more symbol remains on tape 3 or if choice invalid, abort and go to next step. Go to next step if a reject configuration is encountered Replace the string on tape 3 with the lexicographically next string. Simulate the next branch of N’s computation by going to stage 2. Note: Here the lexicographic order is similar to ordinary one but the shorter strings are placed before longer strings. E.g., ,1, 2, 3, 11, 12, 13, 21, 22, 23, 31, 32, 33, 111, 112, 113, 121, 122, 123, …

If (p, a)={(q1,a1,L)(q2,a2,R)(q3,a3,L)} 则,’(p,x,a,1)=(q1,x,a1,L,L,R) ’(p,x,a,2)=(q2,x,a2,L,R,R) ’(p,x,a,3)=(q3,x,a3,L,L,R) ’(p,x,a,b)=(q,,,), 对b>3, q是转向结束这个模拟过程的状态,如进入把tape1内容写入tape2,并扩充路径的入口。其它带子的内容在模拟一个计算路径的过程中暂时不变。

From NTM to TM, example q3 Unspecified transitions 0x,R Unspecified transitions go to a reject state. q2 0y,R 0L q1 0x,R q5 R 0L R q4 0y,R q6 R 0z,R qaccept An NTM that recognizes {w0k| k is a multiple of 2 or 3, k  0 }

From NTM to TM, example Copy Tape 1 to Tape 2 0,, $0,0, $,R,R,L 0,,$,$,$,R,R,L , , $0,0,$, L,L,L 0,0, $ 0,0, $,L,L,L , ,, $,$, $,L,L,L $,$, $$,$, $,L,L,R $,$,  $,$, 1,L,L,L Copy Tape 1 to Tape 2 Increment the content of Tape 3 $,$, $ $,$,$,L,R,R

From NTM to TM q1 Check whether 03k Check whether 02k q1 $,,1 R,R,R q1 $,0,2 $,0,2,L,S,R $,0,1 $,x,1,L,R,R $,0,1 $,0,1,L,S,R $,,l L,L,L 其它情况拒绝 $,,1 L,R,R $,0,1 $,z,1,L,R,R $,0,1 $,y,1,L,R,R $,,1 L,R,R $,0,1 $,y,1,L,R,R $,0,1 $,x,1,L,R,R $,0,(,2) L,L,L $,,(,2) L,L,L $,0,(,2) L,L,L $,,(,2) L,L,L $,0,(,2) L,L,L $,,(,1,2)L,L.L Check whether 03k $,0,(,2) L,L,L $,,(,1,2) L,L,L $,(0,x,y,z),(1,2) L,L,L Check whether 02k $,0,(,2) L,L,L $,,(,1,2) L,L,L q1 $,$,$L,L,R $,(0,x,y,z),(1,2) L,L,L Start trying a new path

From NTM to TM Copy Tape 1 to Tape 2 Increment the content of Tape 3 $,$,(1,2) L,L,R $,$,(1,2) L,L,L $,$, L,L,L $,$,1 $,$,2,L,L,L $,$,2 $,$,1,L,L,L $,$, $,$,1,L,L,L $,$,1 $,$,2,L,L,L $,$,$ R,R,L $,$,2 $,$,1,L,L,L $,$,1 L,L,R $,$,$ $,$,$,L,L,R 0,(0, ,x,y,z),$0,0,$,R,R,L 0,(0,x,y,z),$0,0,$,R,R,L , (0, ,x,y,z),$,,$, L,R,L , (0,x,y,z),$ ,,$,L,R,L ($,0),(0,,x,y,z), $ ($,0),, $,L,R,L ($,0),, $L,L,L , ,$ ,,$,L,L,L Copy Tape 1 to Tape 2 ($,0),(0, $),$L,L,L $,$, $ L,R,R Increment the content of Tape 3 q1

An enumerator is a TM with two tapes: the work tape and the printer. Enumerators An enumerator is a TM with two tapes: the work tape and the printer. Initially both tapes are blank. On the work tape it can read, write and move in either direction just as an ordinary TM. On the printer, it can only print one of the symbols of the language alphabet, or #, serving as the “end of string” symbol, which is not in the language alphabet. So that transitions look like meaning “if, in state q1, you see an a on the work tape, replace it with b, move in the direction D (D=L or D=R), go to state q2 and print c on the printer”. Every time a symbol is printed on the printer, the printer head moves right. If c is absent, nothing happens on the printer. There is a start state, but there are no accept or reject states. Entering a configuration from which there is no transition causes the enumerator to halt. The language enumerated by an enumerator is the set of strings (separated with #) that it prints on the printer. It is OK if some of the strings are printed more than once. c a  b,D q1 q2

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape - - - - - - - - - - Printer - - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape - - - - - - - - - - Printer - - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - - - Printer - - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - - - Printer - - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - - Printer # - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - - Printer # - - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - - Printer # - - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - Printer # # - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - Printer # # - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - Printer # # - - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - Printer # # - - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - - Printer # # - - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # - -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - - Printer # # # -

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - Printer # # # #

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - Printer # # # #

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - Printer # # # #

An example of an enumerator # -  0,L -  $,L $  R start go to the beginning print 0  L 0  R Work tape $ - - - - - Printer # # # #

Enumerability vs Turing recognizability Definition: A language is said to be (recursively) enumerable iff some enumerator enumerates it. Theorem 3.21: A language is Turing recognizable iff it is enumerable. Proof sketch. (): Suppose E enumerates L. Construct a TM M that works as follows: M = “On input w: 1. Simulate E. Every time E prints a new string, compare it with w. 2. If w is ever printed, accept.” (): Suppose M recognizes L. Let s1,s2,s3,… be the lexicographic list of all strings over the alphabet of L. Construct an enumerator E that works as follows: E = “ 1. Repeat the following for i=1,2,3,… 2. Simulate M for i steps on each of the inputs s1,s2,…,si. 3. If any computations accept, print out the corresponding sj.”

Turing machines with an output (not in the textbook!) The only difference with ordinary TM is that a TM with an output (TMO) has a state halt instead of accept and reject; if and when such a Machine reaches the halt state, the contents of the tape (up to the first blank cell) will be considered its output. Example: Design a machine that, for every input w{0,1}*, returns w0.

Turing machines with an output (not in the textbook!) The only difference with ordinary TM is that a TM with an output (TMO) has a state halt instead of accept and reject; if and when such a Machine reaches the halt state, the contents of the tape (up to the first blank cell) will be considered its output. Example: Design a machine that, for every input w{0,1}*, returns w0. 0R 1R - 0,R halt

A function g: * * is said to be computable, iff there is a TMO Computable functions A function g: * * is said to be computable, iff there is a TMO M such that for every input w* M returns the output u with u=g(w). In this case we say that M computes g. Example: Let f: {0,1}* {0,1}* be the function defined by f(w)=w0, so that f()=0, f(0)=00, f(1)=10, f(00)=000, f(01)=010, etc. Then obviously f is computable. The graph of a function g: * * is the language {(w,u) | w*, u=g(w)} E.g., the graph of the above function f is {(,0), (0,00), (1,10), (00,000), (01,010), …}, i.e. {(w,u) | w{0,1}*, u=w0}

Computability vs decidability Theorem: A function is computable iff its graph is decidable. Proof sketch. Let g: * * be a function. (): Suppose C is a TMO that computes g. Construct a TM D that works as follows: D = “On input t: 1. If t does not have the form (w,u), where w,u*, then reject. Otherwise, 2. Simulate C for input w. If it returns u, accept; otherwise reject.” (): Suppose a TM D decides the graph of g. Let s1,s2,s3,… be the lexicographic list of all strings over the alphabet . Construct a TMO C that works as follows: C =“On input t: Simulate D for each of the inputs (t,s1), (t,s2),(t,s3),… until you find si suct that (t,si) is accepted, and return this si”