CS154, Lecture 10: Rice s Theorem, Oracle Machines

Similar documents
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CSE 105 THEORY OF COMPUTATION

Computability and Complexity

CSE 105 THEORY OF COMPUTATION

CS154, Lecture 17: conp, Oracles again, Space Complexity

V Honors Theory of Computation

CSE 105 Theory of Computation

1 Showing Recognizability

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

CS 301. Lecture 18 Decidable languages. Stephen Checkoway. April 2, 2018

Lecture 20: conp and Friends, Oracles in Complexity Theory

CSE 105 Theory of Computation

Decidability and Undecidability

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

Lecture 12: Mapping Reductions

Mapping Reducibility. Human-aware Robotics. 2017/11/16 Chapter 5.3 in Sipser Ø Announcement:

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

TURING MAHINES

CS481F01 Solutions 8

CSE 105 THEORY OF COMPUTATION

CS20a: Turing Machines (Oct 29, 2002)

CpSc 421 Homework 9 Solution

There are two main techniques for showing that problems are undecidable: diagonalization and reduction

Undecidability. We are not so much concerned if you are slow as when you come to a halt. (Chinese Proverb)

uring Reducibility Dept. of Computer Sc. & Engg., IIT Kharagpur 1 Turing Reducibility

Introduction to Languages and Computation

Turing Machines Part III

Decision Problems with TM s. Lecture 31: Halting Problem. Universe of discourse. Semi-decidable. Look at following sets: CSCI 81 Spring, 2012

Decidability. Linz 6 th, Chapter 12: Limits of Algorithmic Computation, page 309ff

SD & Turing Enumerable. Lecture 33: Reductions and Undecidability. Lexicographically Enumerable. SD & Turing Enumerable

4.2 The Halting Problem

conp, Oracles, Space Complexity

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

Definition: conp = { L L NP } What does a conp computation look like?

Non-emptiness Testing for TMs

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

CPSC 421: Tutorial #1

Decidable and undecidable languages

Lecture Notes: The Halting Problem; Reductions

Computability Crib Sheet

q FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY. FLAC (15-453) Spring L. Blum. REVIEW for Midterm 2 TURING MACHINE

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

Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009

Introduction to Turing Machines

Turing Machines. Lecture 8

Theory of Computation (IX) Yijia Chen Fudan University

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Computational Models Lecture 8 1

CS5371 Theory of Computation. Lecture 15: Computability VI (Post s Problem, Reducibility)

Computation Histories

Computational Models Lecture 9, Spring 2009

What languages are Turing-decidable? What languages are not Turing-decidable? Is there a language that isn t even Turingrecognizable?

Computability Theory. CS215, Lecture 6,

Turing Machine Recap

15-251: Great Theoretical Ideas in Computer Science Fall 2016 Lecture 6 September 15, Turing & the Uncomputable

Computability and Complexity

Limits of Computability

Reducability. Sipser, pages

Chap. 4,5 Review. Algorithms created in proofs from prior chapters

Computability Theory

Homework Assignment 6 Answers

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Introduction to Turing Machines. Reading: Chapters 8 & 9

Undecidability and Rice s Theorem. Lecture 26, December 3 CS 374, Fall 2015

Computational Models Lecture 8 1

Decidability (intro.)

CSE 105 THEORY OF COMPUTATION

problem X reduces to Problem Y solving X would be easy, if we knew how to solve Y

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

CSCC63 Worksheet Turing Machines

17.1 The Halting Problem

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2018, face-to-face day section Prof. Marvin K. Nakayama

Undecidable Problems and Reducibility

Computational Models Lecture 8 1

Homework 8. a b b a b a b. two-way, read/write

UNIT-VIII COMPUTABILITY THEORY

Midterm Exam 2 CS 341: Foundations of Computer Science II Fall 2016, face-to-face day section Prof. Marvin K. Nakayama

CSCI3390-Lecture 6: An Undecidable Problem

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

Reductions in Computability Theory

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

Part I: Definitions and Properties

CSE 105 THEORY OF COMPUTATION

Lecture 13: Foundations of Math and Kolmogorov Complexity

16.1 Countability. CS125 Lecture 16 Fall 2014

CS154, Lecture 12: Kolmogorov Complexity: A Universal Theory of Data Compression

ACS2: Decidability Decidability

Decidability. Overview. Preliminaries to Halting Problem. Decidable Problems of Regular Languages. Decidable Problems of Context-Free Languages

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

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Decidable Languages - relationship with other classes.

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

Theory of Computation

CS21 Decidability and Tractability

Turing Machines, diagonalization, the halting problem, reducibility

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

CS20a: Turing Machines (Oct 29, 2002)

ON COMPUTAMBLE NUMBERS, WITH AN APPLICATION TO THE ENTSCHENIDUGSPROBLEM. Turing 1936

CSE 105 THEORY OF COMPUTATION

Finish K-Complexity, Start Time Complexity

Transcription:

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Moral: Analyzing Programs is Really, Really Hard But can we more easily tell when some program analysis problem is undecidable?

Problem 1 Undecidable { (M, w) M is a TM that on input w, tries to move its head past the left end of the input } Problem 2 Decidable { (M, w) M is a TM that on input w, moves its head left at least once, at some point}

Problem 1 Undecidable L = { (M, w) M is a TM that on input w, tries to move its head past the left end of the input } Proof: Reduce A TM to L On input (M,w), make a TM N that shifts w over one cell, marks a special symbol $ on the leftmost cell, then simulates M(w) on the tape. If M s head moves to the cell with $ but has not yet accepted, N moves the head back to the right. If M accepts, N tries to move its head past the $. (M,w) is in A TM if and only if (N,w) is in L

Problem 2 Decidable { (M, w) M is a TM that on input w, moves its head left at least once, at some point} On input (M,w), run M on w for Q + w + 1 steps, where Q = number of states of M. Accept Reject If M s head moved left at all Otherwise (Why does this work?)

Problem 3 REVERSE = { M M is a TM with the property: for all w, M(w) accepts M(w R ) accepts}. Decidable or not? REVERSE is undecidable.

Rice s Theorem Let P : {Turing Machines} {0,1}. (Think of 0=false, 1=true) Suppose P satisfies: 1. (Nontrivial) There are TMs M YES and M NO where P(M YES ) = 1 and P(M NO ) = 0 2. (Semantic) For all TMs M 1 and M 2, If L(M 1 ) = L(M 2 ) then P(M 1 ) = P(M 2 ) Then, L = {M P(M) = 1} is undecidable. A Huge Hammer for Undecidability!

Some Examples and Non-Examples Semantic Properties P(M) M accepts 0 for all w, M(w) accepts iff M(w R ) accepts L(M) = {0} L(M) is empty L(M) = Σ M accepts 154 strings L = {M P(M) is true} is undecidable Not Semantic! M halts and rejects 0 M tries to move its head off the left end of the tape, on input 0 M never moves its head left on input 0 M has exactly 154 states M halts on all inputs There are M 1 and M 2 such that L(M 1 ) = L(M 2 ) and P(M 1 ) P(M 2 )

Rice s Theorem: If P is nontrivial and semantic, then L = {M P(M) = 1} is undecidable. Proof: Either reduce A TM or A TM to the language L Define M to be a TM such that L(M ) = Case 1: P(M ) = 0 Since P is nontrivial, there s M YES such that P(M YES ) = 1 Reduction from A TM to L On input (M,w), output: M w (x) := If ((M accepts w) & (M YES accepts x)) then ACCEPT, else REJECT If M accepts w, then L(M w ) = L(M YES ) Since P(M YES ) = 1, we have P(M w ) = 1 and M w L If M does not accept w, then L(M w ) = L(M ) = Since P(M ) = 0, we have M w L

Rice s Theorem: If P is nontrivial and semantic, then L = {M P(M) = 1} is undecidable. Proof: Either reduce A TM or A TM to the language L Define M to be a TM such that L(M ) = Case 2: P(M ) = 1 Since P is nontrivial, there s M NO such that P(M NO ) = 0 Reduction from A TM to L On input (M,w), output: M w (x) := If ((M accepts w) & (M NO accepts x)) then ACCEPT, else REJECT If M does not accept w, then L(M w ) = L(M ) = Since P(M ) = 1, we have M w L If M accepts w, then L(M w ) = L(M NO ) Since P(M NO ) = 0, we have M w L

The Regularity Problem for Turing Machines REGULAR TM = { M M is a TM and L(M) is regular} Given a program, is it equivalent to some DFA? Theorem: REGULAR TM is not recognizable Proof: Use Rice s Theorem! P(M) := L(M) is regular is nontrivial: - there s an M such that L(M ) = : P(M ) = 1 - there s an M deciding {0 n 1 n n 0}: P(M ) = 0 P is also semantic: If L(M) = L(M ) then L(M) is regular iff L(M ) is regular, so P(M) = 1 iff P(M ) = 1, so P(M) = P(M ) By Rice s Thm, we have A TM m REGULAR TM

Recognizability via Logic Definition: A decidable predicate R(x,y) is a proposition about the input strings x and y, such that some TM M implements R. That is, for all x, y, R(x,y) is TRUE M(x,y) accepts R(x,y) is FALSE M(x,y) rejects Can think of R as a function from Σ* Σ*! {T,F} Examples: R(x,y) = xy has at most 100 zeroes R(N,y) = TM N halts on y in at most 99 steps

Theorem: A language A is recognizable if and only if there is a decidable predicate R(x, y) such that: A = { x y R(x, y) } Proof: (1) If A = { x y R(x,y) } then A is recognizable Define the TM M(x): Enumerate all finite-length strings y, If R(x,y) is true, accept M accepts exactly those x s.t. y R(x,y) is true (2) If A is recognizable, then there is a decidable predicate R(x, y) such that: A = { x y R(x,y) } Suppose TM M recognizes A. Let R(x,y) be TRUE iff M accepts x in y steps M accepts x y R(x,y)

Oracle Turing Machines, Turing Reductions and Hierarchies

Oracle Turing Machines FINITE q STATE YES q? CONTROL Is (M, w) in A TM? yes IA N P U T INFINITE REWRITABLE TAPE

Oracle Turing Machines An oracle Turing machine M that can ask membership queries in a set B Γ* on a special oracle tape [Formally, M enters a special state q? ] The TM receives an answer to the query in one step[formally, the transition function on q? is defined in terms of the entire oracle tape: if the string y written on the oracle tape is in B, then state q? is changed to q YES, otherwise q NO ] This notion makes sense even if B is not decidable!

How to Think about Oracles? A black-box subroutine. In terms of Turing Machine pseudocode: An oracle Turing machine M with oracle B Γ* lets you include the following kind of branching instructions: if (z in B) then <do something> else <do something else> where z is some string defined earlier in pseudocode. By definition, the oracle TM can always check the condition (z in B) in one step This notion makes (mathematical) sense even if B is not decidable

Definition: A is recognizable with B if there is an oracle TM M with oracle B that recognizes A Definition: A is decidable with B if there is an oracle TM M with oracle B that decides A Language A Turing-Reduces to B A T B

A TM is decidable with HALT TM (A TM T HALT TM ) We can decide if M accepts w using an ORACLE for the Halting Problem: On input (M,w), If (M,w) is in HALT TM then run M(w) and output its answer. else REJECT.

HALT TM is decidable with A TM (HALT TM T A TM ) On input (M,w), decide if M halts on w as follows: 1. If (M,w) is in A TM then ACCEPT 2. Else, switch the accept and reject states of M to get a machine M. If (M,w) is in A TM then ACCEPT 3. REJECT

Theorem: If A m B then A T B Proof (Sketch): T versus m If A m B then there is a computable function f : Σ* Σ*, where for every w, w A f(w) B To decide A on the string w, just compute f(w) and call the oracle for B Theorem: HALT TM T HALT TM Theorem: HALT TM m HALT TM Why?

Limitations on Oracle TMs! The following problem cannot be decided by any TM with an oracle for the Halting Problem: SUPERHALT = { (M,x) M, with an oracle for the Halting Problem, halts on x} We can use the proof by diagonalization! Assume H (with HALT oracle) decides SUPERHALT Define D(X) := if H(X,X) (with HALT oracle) accepts then LOOP, else ACCEPT. (D uses a HALT oracle to simulate H) But D(D) halts H(D,D) accepts D(D) loops (by assumption) (by def of D)

Limits on Oracle TMs Theorem There is an infinite hierarchy of unsolvable problems! Given ANY oracle O, there is always a harder problem that cannot be decided with that oracle O SUPERHALT 0 = HALT = { (M,x) M halts on x}. SUPERHALT 1 = { (M,x) M, with an oracle for HALT TM, halts on x} SUPERHALT n = { (M,x) M, with an oracle for SUPERHALT n-1, halts on x}

OK No Just Words a Few