Lecture 14: Recursive Languages

Similar documents
Lecture 13: Turing Machine

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CS5371 Theory of Computation. Lecture 10: Computability Theory I (Turing Machine)

CSCC63 Worksheet Turing Machines

Equivalence of TMs and Multitape TMs. Theorem 3.13 and Corollary 3.15 By: Joseph Lauman

CS21 Decidability and Tractability

Turing s thesis: (1930) Any computation carried out by mechanical means can be performed by a Turing Machine

Harvard CS 121 and CSCI E-121 Lecture 14: Turing Machines and the Church Turing Thesis

CS4026 Formal Models of Computation

More Turing Machines. CS154 Chris Pollett Mar 15, 2006.

Chapter 3: The Church-Turing Thesis

CSE 105 THEORY OF COMPUTATION

Turing Machines Part II

Computability Theory. CS215, Lecture 6,

Introduction to Turing Machines. Reading: Chapters 8 & 9

Lecture 2: Regular Expression

Busch Complexity Lectures: Turing s Thesis. Costas Busch - LSU 1

Busch Complexity Lectures: Turing Machines. Prof. Busch - LSU 1

Introduction to Turing Machines

SCHEME FOR INTERNAL ASSESSMENT TEST 3

Turing Machines. The Language Hierarchy. Context-Free Languages. Regular Languages. Courtesy Costas Busch - RPI 1

More About Turing Machines. Programming Tricks Restrictions Extensions Closure Properties

Lecture 12: Mapping Reductions

Lecture 1: Finite State Automaton

Chapter 8. Turing Machine (TMs)

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

Turing Machines (TM) Deterministic Turing Machine (DTM) Nondeterministic Turing Machine (NDTM)

Most General computer?

IV. Turing Machine. Yuxi Fu. BASICS, Shanghai Jiao Tong University

Computation Histories

1 Showing Recognizability

CS 525 Proof of Theorems 3.13 and 3.15

The Church-Turing Thesis

Midterm II : Formal Languages, Automata, and Computability

Turing machines Finite automaton no storage Pushdown automaton storage is a stack What if we give the automaton a more flexible storage?

16.1 Countability. CS125 Lecture 16 Fall 2014

Part I: Definitions and Properties

Finite Automata. Mahesh Viswanathan

Turing machines COMS Ashley Montanaro 21 March Department of Computer Science, University of Bristol Bristol, UK

Turing Machine properties. Turing Machines. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions. Alternate TM definitions

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

The Turing Machine. CSE 211 (Theory of Computation) The Turing Machine continued. Turing Machines

Theory of Computation Lecture Notes. Problems and Algorithms. Class Information

Computability and Complexity

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Fundamentals of Computer Science

Lecture notes on Turing machines

Recap DFA,NFA, DTM. Slides by Prof. Debasis Mitra, FIT.

Turing Machines. Wen-Guey Tzeng Computer Science Department National Chiao Tung University

Variations of the Turing Machine

Turing Machine Variants. Sipser pages

Turing Machines. 22c:135 Theory of Computation. Tape of a Turing Machine (TM) TM versus FA, PDA

Turing s Thesis. Fall Costas Busch - RPI!1

where Q is a finite set of states

Lecture Notes: The Halting Problem; Reductions

Announcements. Problem Set 6 due next Monday, February 25, at 12:50PM. Midterm graded, will be returned at end of lecture.

CSCI3390-Assignment 2 Solutions

Lecture 1: Introduction

Chapter 1 - Time and Space Complexity. deterministic and non-deterministic Turing machine time and space complexity classes P, NP, PSPACE, NPSPACE

Testing Emptiness of a CFL. Testing Finiteness of a CFL. Testing Membership in a CFL. CYK Algorithm

Griffith University 3130CIT Theory of Computation (Based on slides by Harald Søndergaard of The University of Melbourne) Turing Machines 9-0

CS5371 Theory of Computation. Lecture 14: Computability V (Prove by Reduction)

Designing 1-tape Deterministic Turing Machines

CSCE 551: Chin-Tser Huang. University of South Carolina

Turing Machines. Our most powerful model of a computer is the Turing Machine. This is an FA with an infinite tape for storage.

Advanced topic: Space complexity

Theory of Computation

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Homework. Turing Machines. Announcements. Plan for today. Now our picture looks like. Languages

Theory of Computation - Module 4

Non-emptiness Testing for TMs

Automata Theory CS S-12 Turing Machine Modifications

The tape of M. Figure 3: Simulation of a Turing machine with doubly infinite tape

The Power of One-State Turing Machines

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Chapter 6: Turing Machines

Lecture 1: Course Overview and Turing machine complexity

6.045J/18.400J: Automata, Computability and Complexity. Quiz 2. March 30, Please write your name in the upper corner of each page.

Turing Machines. Lecture 8

Theory of Computing Tamás Herendi

CS 410/610, MTH 410/610 Theoretical Foundations of Computing

An example of a decidable language that is not a CFL Implementation-level description of a TM State diagram of TM

Turing Machines (TM) The Turing machine is the ultimate model of computation.

Turing Machines and the Church-Turing Thesis

Further discussion of Turing machines

Turing machines and computable functions

The Turing Machine. Computability. The Church-Turing Thesis (1936) Theory Hall of Fame. Theory Hall of Fame. Undecidability

CSE 460: Computabilty and Formal Languages Turing Machine (TM) S. Pramanik

CS5371 Theory of Computation. Lecture 12: Computability III (Decidable Languages relating to DFA, NFA, and CFG)

Theory of Computation

Theory of Computer Science

Computability Theory

Theory of Computation

V Honors Theory of Computation

Computational Models - Lecture 6

COL 352 Introduction to Automata and Theory of Computation Major Exam, Sem II , Max 80, Time 2 hr. Name Entry No. Group

TURING MAHINES

Variants of Turing Machine (intro)

1 Unrestricted Computation

SE 3310b Theoretical Foundations of Software Engineering. Turing Machines. Aleksander Essex

Transcription:

Lecture 14: Recursive Languages Instructor: Ketan Mulmuley Scriber: Yuan Li February 24, 2015 1 Recursive Languages Definition 1.1. A language L Σ is called recursively enumerable (r. e.) or computably enumerable if there exists a Turing machine M such that L = L(M). Recall that L(M) = {w Σ : q 0 w M α 1pα 2, where p F, α 1, α 2 Γ }, and M can loop on some input, in which that input is not in L(M). Definition 1.2. A language L is called recursive if there exists a Turing machine M such that L = L(M) and M halts on all inputs. Turing machine can also be used to compute functions. Suppose on input } 00 {{ 0} 1 00 }{{ 0} 1 1 } 00 {{ 0} B, k 1 k 2 k l Turing machine M finally halts and output 00 }{{ 0} B, f(k 1,k 2,...,k l ) where f : N l N. Then we say Turing machine M computes f. Formally, given a TM M, define f(k 1, k 2,..., k l ) = (undefined) if M does not halt or does not halt with output in correct form; f(k 1, k 2,..., k l ) = m if M stops with 0 m on the tape. 1

Definition 1.3. We say that f : N l N is totally recursive if f = f M for some TM M that always halts with output in the correct form, and thus f(k 1, k 2,..., k l ) is defined everywhere. We say that f : N l N { } is partially recursive if f = f M for some TM M that may not always halt (with output in correct format), and thus f(k 1, k 2,..., k l ) is not defined everywhere. Proposition 1.4. If f : N l N is totally recursive, then language L = {((k 1, k 2,..., k l ), m) : f(k 1,..., k l ) = m} is recursive. Proof. In order to prove L is recursive, we need to prove there exists a Turing machine M such that L(M) = L and M halts on all inputs. Since f : N l N is totally recursive, by definition, there exists a TM N which, on input (k 1, k 2,..., k l ), (always halts and) outputs f(k 1,..., k l ). Our Turing machine M works as follows, on input (k 1, k 2,..., k l, m), simulate N on (k 1, k 2,..., k l ), until N halts with output m. Accept if and only if m = m. It clear that M accepts language L, and M halts on all input, since N halts on all (k 1, k 2,..., k l ). Proposition 1.5. If f : N l N is partially recursive, then L = {((k 1, k 2,..., k l ), m) : f(k 1,..., k l ) = m} is recursively enumerable. The proof is similar to the Proposition 1.4, which is omitted. Proposition 1.6. Conversely, if L = {((k 1, k 2,..., k l ), m)} is recursively enumerable, and it is a graph function, i.e., for all k 1, k 2,..., k l, there exists at most one m such that ((k 1, k 2,..., k l ), m) L. Then the function f : N l N { }, defined by f(k 1, k 2,..., k l ) = m if there exists m such that ((k 1, k 2,..., k l ), m) L, is partially recursive. Proof. In order to prove f is partially recursive, we need to construct Turing machine M, which outputs f(k 1, k 2,..., k l ) on input (k 1, k 2,..., k l ), if f(k 1, k 2,..., k l ) is defined. Since L is r. e., there exists a Turing machine N such that L(N) = L. Our machine M does the following: enumerate (i, j) N N, and when (i, j) is enumerated, simulate N on ((k 1,..., k l ), i) for j steps, if M halts, output i. The following is similar to prove: Proposition 1.7. If L = {((k 1, k 2,..., k l ), m)} is recursive, and for all k 1, k 2,..., k l N, there exists exactly one m N such that ((k 1, k 2,..., k l ), m) L. Then the function f : N l N, defined by f(k 1, k 2,..., k l ) = m for the unique m such that ((k 1, k 2,..., k l ), m) L, is totally recursive. 2

2 Enhancing Turing Machine Turing machine is the simplest programming language which is as powerful as C, C++, Java, etc. However, it is not easy to program on Turing machine. Imagine writing a TM for weather forecasting will be very difficult. Now we will enhance the convenience (not the power) of Turing machine. Let us add a cache (finite storage in finite content) in the head, which can be implemented using usual one-tape Turing machine with new state Q = Q Γ n, where n is the length of the cache. Figure 1: TM with a cache Suppose we want to have multiple tracks (and only one head) for a Turing machine. It is equivalent to a one-tape Turing machine with new tape alphabet Γ k, where k is the number of tracks. Figure 2: TM with multiple tracks In the usual Turing machine, there is one tape infinite in one direction. 3

Suppose we want to have two-way infinite tape. It can be implemented using a two-track Turing machine, where the head read one tape at a time. Figure 3: Two-way infinite tape TM Suppose we want to implement a multitape TM as the following figure suggests. At each step, depending on states q 1, q 2, q 3, and input symbols Figure 4: Multitape TM a, b, c on each tape, the machine changes a to a, b to b, c to c, moves q 1 left or right, q 2 left or right, q 3 left or right, and changes state q 1 to q 1, q 2 to q 2, q 3 to q 3. This multitape Turing machine can be implemented using multitrack TM (2 tracks per tape), where the first track for each tape keeps track of the location of the head (marked by X, all others are blank). The new head has state Q k, where k is the number of tapes, and a cache of size k, which 4

stores the symbols each head points to. For each step of the old machine, the new multitrack TM first reads all symbols in each tape and put them in the cache, depending on current state (q 1, q 2, q 3 ), the new machine changes to a new state (q 1, q 2, q 3), and then goes to each position under symbol X, changes the symbol, and moves X either left or right. Figure 5: Simulate multitape TM by multitrack TM with cache It is easy to see the cost of simulating each move is proportional to the distance between the leftmost and rightmost heads, and thus the blowup in time is quadratic. 5