Theory of Computation Lecture 21: Turing Machines II

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

November 19, 2009Theory of Computation Lecture 19: Calculations on Strings IV 1 Numerical Representation of Strings Correspondingly, we define the following:
Variants of Turing machines
October 13, 2009Theory of Computation Lecture 11: A Universal Program III 1 Coding Programs by Numbers Gödel numbers are usually very large, even for small.
Computability and Complexity 14-1 Computability and Complexity Andrei Bulatov Cook’s Theorem.
Prof. Busch - LSU1 Decidable Languages. Prof. Busch - LSU2 Recall that: A language is Turing-Acceptable if there is a Turing machine that accepts Also.
Courtesy Costas Busch - RPI1 A Universal Turing Machine.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata are like Turing Machines with a restriction: The working space of the tape is the space of the.
Fall 2004COMP 3351 Recursively Enumerable and Recursive Languages.
Recursively Enumerable and Recursive Languages
Fall 2004COMP 3351 Turing Machines. Fall 2004COMP 3352 The Language Hierarchy Regular Languages Context-Free Languages ? ?
1 Uncountable Sets continued Theorem: Let be an infinite countable set. The powerset of is uncountable.
October 27, 2009Theory of Computation Lecture 12: A Universal Program IV 1Universality Then we append the following instruction: [C]IF K = Lt(Z) + 1 
November 10, 2009Theory of Computation Lecture 16: Computation on Strings I 1Diagonalization Another example: Let TOT be the set of all numbers p such.
December 8, 2009Theory of Computation Lecture 22: Turing Machines IV 1 Turing Machines Theorem 1.1: Any partial function that can be computed by a Post-
Fall 2004COMP 3351 A Universal Turing Machine. Fall 2004COMP 3352 Turing Machines are “hardwired” they execute only one program A limitation of Turing.
September 17, 2009Theory of Computation Lecture 4: Programs and Computable Functions III 1 Macros Now we want to use macros of the form: W  f(V 1, …,
1 1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 15-1 Mälardalen University 2012.
December 1, 2009Theory of Computation Lecture 21: Turing Machines II 1 Simulation of L n in T We will now construct a Post-Turing program Q that simulates.
Theory of Computation, NTUEE Theory of Computation Lecture 04 Undecidability Part of the materials are from Courtesy of Prof. Peter J. Downey Department.
1 Linear Bounded Automata LBAs. 2 Linear Bounded Automata (LBAs) are the same as Turing Machines with one difference: The input string tape space is the.
1 Turing’s Thesis. 2 Turing’s thesis: Any computation carried out by mechanical means can be performed by a Turing Machine (1930)
Theory of Computation Lecture 5: Primitive Recursive Functions I
November 12, 2009Theory of Computation Lecture 17: Calculations on Strings II 1 Numerical Representation of Strings First, we define two primitive recursive.
Recursively Enumerable and Recursive Languages
Lecture 24UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 24.
1 Turing Machines - Chap 8 Turing Machines Recursive and Recursively Enumerable Languages.
December 3, 2009Theory of Computation Lecture 21: Turing Machines III 1 Simulation of T in L Now the MIDDLE section of Q can be generated by replacing.
Chapter 5 Recursive and recursively enumerable functions Phrase-structure grammars.
1 Recursively Enumerable and Recursive Languages.
1 Assignment #5 is posted.. 2 An artist's rendition of a steam-powered Turing machine. There is a mural of this between the second and third floors in.
1 A Universal Turing Machine. 2 Turing Machines are “hardwired” they execute only one program A limitation of Turing Machines: Real Computers are re-programmable.
Fall 2006Costas Busch - RPI1 RE languages and Enumerators.
Recursively Enumerable and Recursive Languages
Multi-tape TM’s Often it’s useful to have several tapes when carrying out a computations. For example, consider a two tape I/O TM for adding numbers (we.
Theory of Computation Lecture 12: A Universal Program III
Theory Of Computer Science
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Reductions Costas Busch - LSU.
Diagonalization and Reducibility
Theory of Computation Lecture 23: Turing Machines IV
Numerical Representation of Strings
Theory of Computation Lecture 22: Turing Machines III
Turing Machines 2nd 2017 Lecture 9.
Turing Machines Acceptors; Enumerators
Chapter 9 TURING MACHINES.
Theory of Computation Lecture 5: Programs and Computable Functions III
COSC 3340: Introduction to Theory of Computation
Theory of Computation Lecture 6: Primitive Recursive Functions I
Turing acceptable languages and Enumerators
Theory Of Computer Science
Turing acceptable languages and Enumerators
The Programming Language L
Formal Languages, Automata and Models of Computation
Recall last lecture and Nondeterministic TMs
P.V.G’s College of Engineering, Nashik
Numerical Representation of Strings
Subject Name: FORMAL LANGUAGES AND AUTOMATA THEORY
The Programming Language L
Numerical Representation of Strings
Theory of Computation Lecture 4: Programs and Computable Functions II
Variants of Turing machines
Theory of Computation Lecture 6: Primitive Recursive Functions I
Theory of Computation Lecture 22: Turing Machines II
Theory of Computation Lecture 17: Calculations on Strings II
Theory of Computation Lecture 12: A Universal Program IV
Theory of Computation Lecture 11: A Universal Program III
Turing Machines Everything is an Integer
Theory of Computation Lecture 23: Turing Machines III
Presentation transcript:

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Example 3: We want to compute a function f(x1, x2, x3), where A = {s1, s2}, x1 = 0, x2 = s2s1s2, and x3 = 0. Then the initial tape configuration is as follows: B B s2 s1 s2 B  Notice that it is impossible to distinguish this initial tape configuration from that with two inputs x1 = 0 and x2 = s2s1s2. Therefore, the number of arguments must be provided externally. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Now let us look at the execution of a very simple T program. The arrow in the program indicates the next instruction to be executed.  PRINT s1 LEFT PRINT s2 B x  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Now let us look at the execution of a very simple T program. The arrow in the program indicates the next instruction to be executed. PRINT s1  LEFT PRINT s2 LEFT s1 x  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Now let us look at the execution of a very simple T program. The arrow in the program indicates the next instruction to be executed. PRINT s1 LEFT  PRINT s2 B s1 x  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Now let us look at the execution of a very simple T program. The arrow in the program indicates the next instruction to be executed. PRINT s1 LEFT PRINT s2  LEFT s2 s1 x  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Now let us look at the execution of a very simple T program. The arrow in the program indicates the next instruction to be executed. PRINT s1 LEFT PRINT s2  B s2 s1 x program terminated  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs What function did the previous program compute? Definition: Let f(x1, …, xm) be an m-ary partial function on the alphabet A = {s1, …, sn}. Then the program P in the Post-Turing language T is said to compute f if when started in the tape configuration B x1 B x2 B x3 …B xm  it eventually halts if and only if f(x1, …, xm) is defined and if, on halting, the string f(x1, …, xm) can be read from the tape by ignoring all symbols except s1, …, sn. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Notice that this definition allows P to contain instructions that mention symbols other than s1, …, sn. We further define the following: The program P will be said to compute f strictly if two additional conditions are met: 1. no instruction in P mentions any other symbol than s0, s1, …, sn; 2. whenever P halts, the tape configuration is … B B B y B B B …,  where the string y contains no blanks. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Do you remember our simple example program? It turned the tape configuration B x  into the configuration B s2 s1 x  So what does it compute? It strictly computes the function f(x) = s2s1x. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}):  [A] RIGHT B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1  IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 IF B GOTO E   PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 IF B GOTO E  PRINT M  [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 IF B GOTO E  PRINT M [B] RIGHT  IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 IF B GOTO E  PRINT M  [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B IF B GOTO E  PRINT M [B] RIGHT  IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B  [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B B IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT  IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B B IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C  PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D PRINT s1 IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D  IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D  IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B M s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D  PRINT s1 IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D  IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}):  [A] RIGHT B s1 s1 B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1  IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1 IF B GOTO E   PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 IF B GOTO E  PRINT M  [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 IF B GOTO E  PRINT M [B] RIGHT  IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B  [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT  IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B  [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 B IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT  IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 B IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C  PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D PRINT s1 IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D  IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1  [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT  IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D  IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 M B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D  PRINT s1 IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D  IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}):  [A] RIGHT B s1 s1 B s1 s1 IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1 s1  IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B [C] RIGHT IF s1 GOTO C PRINT s1 [D] LEFT IF s1 GOTO D IF B GOTO D IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Post-Turing Programs Another example (A = {s1}): [A] RIGHT B s1 s1 B s1 s1  IF B GOTO E  PRINT M [B] RIGHT IF s1 GOTO B program terminated [C] RIGHT IF s1 GOTO C This program computes PRINT s1 the function f(x) = xx. [D] LEFT IF s1 GOTO D Or, if we interpret x as IF B GOTO D a number, f(x) = 2x. PRINT s1 IF s1 GOTO A November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T We are going to prove the following theorem: Theorem 5.1: If f(x1, …, xm) is partially computable in Ln, then there is a Post-Turing program that computes f strictly. Proof: Let P be a program in Ln which computes f. We assume that P uses the following variables: X1, …, Xm, Z1, …, Zk, Y. So all in all there are l variables, where l = m + k + 1. Therefore, we can rename the variables as follows (while keeping their order): V1, …, Vl. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T We will now construct a Post-Turing program Q that simulates P step by step. Of course, the information available to Q must be put onto the tape. Therefore, we have to use a system for storing the values of all variables at certain positions on the tape: B x1 B x2 B … B xm B z1 B z2 B … B zk B y ,  where x1, x2, …, xm, z1, z2 , …, zk, y are the current values of the variables X1, X2, …, Xm, Z1, Z2 , …, Zk, Y (using the original variable names). November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T An advantage of this system is that the initial tape configuration is already in the correct form: B x1 B x2 B … B xm .  What needs to be done now is to show how to program the effect of each instruction type of Ln in the language T. In the following, we will define some macros that will help us to do this task. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T The macro GOTO L has the expansion IF s0 GOTO L // Remember: s0 = B IF s1 GOTO L : IF sn GOTO L November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T The macro RIGHT TO NEXT BLANK has the expansion [A] RIGHT IF B GOTO E GOTO A The macro LEFT TO NEXT BLANK has the expansion [A] LEFT November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T The macro MOVE BLOCK RIGHT has the expansion [C] LEFT IF s0 GOTO A0 IF s1 GOTO A1 : IF sn GOTO An [Ai] RIGHT i = 1, 2, …, n PRINT si : LEFT : GOTO C : [A0] RIGHT PRINT B LEFT Example: s3Bs1s2B  s3Bs1s2B  s3Bs1s2s2  s3Bs1s2s2  s3Bs1s2s2  s3Bs1s2s2  s3Bs1s1s2  s3Bs1s1s2  s3Bs1s1s2  s3BBs1s2  s3BBs1s2  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T The macro ERASE A BLOCK has the expansion [A] RIGHT IF B GOTO E PRINT B GOTO A This program causes the head to move to the right, erasing everything between its initial position and the first blank to its right. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T We introduce another convention: A number in square brackets after the name of a macro indicates how many times the macro expansion is to be inserted into the program. For example, MOVE BLOCK RIGHT [4] is short for MOVE BLOCK RIGHT MOVE BLOCK RIGHT MOVE BLOCK RIGHT MOVE BLOCK RIGHT November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T Now we can start simulating the three instruction types in the language Ln by Post-Turing programs. We begin the instruction type Vj  siVj . In order to place the symbol si to the left of the j-th variable on the tape, the values of the variables Vj, …, Vl must all be moved one square to the right to make room. After inserting si the tapehead must go back to the blank at the left of the value of V1 in order to be ready for the next simulated instruction. November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T Here is the program for the simulation of Vj  siVj: RIGHT TO NEXT BLANK [ l ] MOVE BLOCK RIGHT [ l – j + 1 ] RIGHT PRINT si LEFT TO NEXT BLANK [ j ] November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T Now we want to show how to simulate Vj  Vj- . The problem here is that if Vj contains the null string, it must be left unchanged. Thus, we move to the blank immediately to the right of the value of Vj. Then we move one step to the left, and if we find another blank there, Vj must contain the null string (indicated by two successive blanks). November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T Here is the program for the simulation of Vj  Vj- : RIGHT TO NEXT BLANK [ j ] LEFT IF B GOTO C // Vj contains null string MOVE BLOCK RIGHT [ j ] RIGHT GOTO E [C] LEFT TO NEXT BLANK [ j - 1 ] November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T And finally, here is the program for the simulation of IF Vj ENDS si GOTO L: RIGHT TO NEXT BLANK [ j ] LEFT IF si GOTO C // Vj ends in si GOTO D [C] LEFT TO NEXT BLANK [ j ] GOTO L // Note: transfer all labels from Ln to T [D] RIGHT // Vj could contain null string LEFT TO NEXT BLANK [ j ] November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of Ln in T Now we are able to translate any program in the language Ln into a corresponding program in T. There is only one thing that needs to be fixed: After the program terminates, we want only the string y to remain on the tape as the program’s output. This can be done by appending the following code to our generated T program: ERASE A BLOCK [ l – 1 ] This will erase the values of the first l – 1 variables on the tape, so only the last variable will remain and the final tape configuration will be … B B B y B B B …  November 30, 2017 Theory of Computation Lecture 21: Turing Machines II

Theory of Computation Lecture 21: Turing Machines II Simulation of T in L The next thing we want to prove is the following: Theorem 6.1: If there is a Post-Turing program that computes the partial function f(x1, …, xm), then f is partially computable. Since our definition of partial computability is based on the language L, this theorem states the following: If the m-ary partial function f on A* is computed by a program of T, then there is a program of L that computes f (using base n values of strings). November 30, 2017 Theory of Computation Lecture 21: Turing Machines II