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

Similar documents
Computability and Complexity

CSE 105 THEORY OF COMPUTATION

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

CSE 105 THEORY OF COMPUTATION

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

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

1 Showing Recognizability

CSE 105 Theory of Computation

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

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

Decidability and Undecidability

CSE 105 THEORY OF COMPUTATION

Undecidable Problems and Reducibility

Reducability. Sipser, pages

Decidable Languages - relationship with other classes.

CS20a: Turing Machines (Oct 29, 2002)

CpSc 421 Homework 9 Solution

Turing Machine Recap

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

V Honors Theory of Computation

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

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Lecture 12: Mapping Reductions

Theory of Computation

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

Automata Theory CS S-FR2 Final Review

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

Lecture Notes: The Halting Problem; Reductions

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Computation Histories

Turing Machines Part III

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

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

Non-emptiness Testing for TMs

Decidability: Reduction Proofs

Introduction to Languages and Computation

Computability Theory

CS481F01 Solutions 8

A non-turing-recognizable language

Midterm II : Formal Languages, Automata, and Computability

ACS2: Decidability Decidability

CSE 105 THEORY OF COMPUTATION

CSE 105 THEORY OF COMPUTATION

A Note on Turing Machine Design

CSE 105 THEORY OF COMPUTATION

Advanced Undecidability Proofs

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

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

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

CSE 105 THEORY OF COMPUTATION

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

CSE 105 Theory of Computation

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

Homework Assignment 6 Answers

Computational Models Lecture 9, Spring 2009

CSE 105 THEORY OF COMPUTATION

Theory of Computation

The Unsolvability of the Halting Problem. Chapter 19

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

Exam Computability and Complexity

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

CS 361 Meeting 26 11/10/17

CSCE 551 Final Exam, Spring 2004 Answer Key

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

Reductions in Computability Theory

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

Problems, and How Computer Scientists Solve Them Manas Thakur

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

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

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

Computability Theory

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CP405 Theory of Computation

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

Decidability: Church-Turing Thesis

CPSC 421: Tutorial #1

TURING MAHINES

Week 3: Reductions and Completeness

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

On Rice s theorem. Hans Hüttel. October 2001

6.045 Final Exam Solutions

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

Intro to Theory of Computation

CSCI3390-Lecture 6: An Undecidable Problem

17.1 The Halting Problem

Introduction to Turing Machines

CSCC63 Worksheet Turing Machines

CS151 Complexity Theory. Lecture 1 April 3, 2017

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

Automata & languages. A primer on the Theory of Computation. Laurent Vanbever. ETH Zürich (D-ITET) October,

Decidability (intro.)

Decidability. Human-aware Robotics. 2017/10/31 Chapter 4.1 in Sipser Ø Announcement:

UNIT-VIII COMPUTABILITY THEORY

CS20a: Turing Machines (Oct 29, 2002)

CS 154 Introduction to Automata and Complexity Theory

Decidable and undecidable languages

Intro to Theory of Computation

Part I: Definitions and Properties

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

Transcription:

CS 373: Theory of Computation Sariel Har-Peled and Madhusudan Parthasarathy Lecture 23: Rice Theorem and Turing machine behavior properties 21 April 2009 This lecture covers Rice s theorem, as well as decidability of TM behavior properties. 1 Outline & Previous lecture 1.1 Forward outline of lectures This week and next, we ll see three major techniques for proving undecidability: Rice s Theorem (today): generalize a lot of simple reductions with common outline. Linear Bounded automata (Thursday): Allow us to show that ALL CF G, EQ CF G are undecidable. Also, LBAs illustrate a useful compromise in machine power: much of the flexibility of a TM but enough resource limits to be more analyzable. Post s Correspondence problem (a week from Thursday): AMBIG CFG is undecidable. allows us to show that 1.2 Recap of previous class In the previous class, we proved that the following language is undecidable. Regular TM = M M is a TM and L(M) is regular. To do this, we assume that Regular TM was decided by some TM S. We then used this to build a decider for A TM (which can not exist) Decider for A TM (i) Input = M, w (ii) Construct M w (see below). (iii) Feed M w to S and return the result. Our auxiliary TM M w looked like: TM M w : (i) Input = x 1

(ii) If x has the form a n b n, halt and accept. (iii) Otherwise, simulate M on w. (iv) If the simulation accepts, then accept. (v) If the simulation rejects, then reject. The language of M w was either Σ or a n b n, depending on whether M accepts w. 2 Rice s Theorem 2.1 Another Example - The language L 3 Let us consider another reduction with a very similar outline. Suppose we have the following language L 3 = M L(M) = 3. That is L 3 contains all Turing machines whose languages contain exactly three strings. Lemma 2.1 The language L 3 is undecidable. Proof: Proof by reduction from A TM. Assume, for the sake of contradiction, that L 3 was decidable and let decider L3 be a TM deciding it. We use decider L3 to construct a Turing machine decider 9 -A TM deciding A TM. The decider TMdecider 9 -A TM is constructed as follows: decider 9 -A TM ( M, w ) Construct a new Turing machine M w : M w ( x ): // x: input res Run M on w if (res = reject) then reject if x = UIUC or x = Iowa or x = Michigan then accept reject return decider L3 ( M w ). (We emphasize here again, that constructing M w involve taking the encoding of M and w, and generating the encoding of M w.) Notice that the language of M w has only two possible values. If M loops or rejects w, then L(M w ) =. If M accepts w, then th the language of M w contains exactly three strings: UIUC, Iowa, and Michigan. So decider 9 -A TM ( Mw ) accepts exactly when M accepts w. Thus, decider 9 -A TM is a decider for A TM But we know that A TM is undecidable. A contradiction. As such, our assumption that L 3 is decidable is false. 2

2.2 Rice s theorem Notice that these two reductions have very similar outlines. Our hypothetical decider decider looks for some property P. The auxiliary TM s tests x for membership in an example set with property P. The big difference is whether we simulate M on w before or after testing x and, consequently, whether the second possibility for L(M w ) is or Σ. It s easy to cook up many examples of reductions similar to this one, all involving sets of TM s whose languages share some property (e.g. they are regular, they have size three). Rice s Theorem generalizes all these reductions into a common result. Theorem 2.2 (Rice s Theorem.) Suppose that L is a language of Turing machines; that is, each word in L encodes a TM. Furthermore, assume that the following two properties hold. (a) Membership in L depends only on the Turing machine s language, i.e. if L(M) = L(N) then M L N L. (b) The set L is non-trivial, i.e. L and L does not contain all Turing machines. Then L is a undecidable. Proof: Assume, for the sake of contradiction, that L is decided by TMdeciderForL. We will construct a TMDecider 4 -A TM that decides A TM. Since Decider 4 -A TM does not exist, we will have a contradiction, implying that deciderforl does not exist. Remember from last class that TM is a TM (pick your favorite) which rejects all input strings. Assume, for the time being, that TM L. This assumption will be removed shortly. Since L is non-trivial, also choose some other TM Z L. Now, given M, w Decider 4 - A TM will construct the encoding of the following TM M w. TM M w : (1) Input = x. (2) Simulate M on w. (3) If the simulation rejects, halt and reject. (4) If the simulation accepts, simulate Z on x and accept if and only if T halts and accepts. If M loops or rejects w, then M w will get stuck on line (2) or stop at line (3). So L(M w ) is. Because membership in L depends only on a Turing machine s language and TM is not in L, this means that M w is not in L. So M w will be rejected by N. If M accepts w, then M w will proceed to line (4), where it simulates the behavior of Z. So L(M w ) will be L(Z). Because membership in L depends only on a Turing machine s language and T is L, this means that M w is in L. So M w will be accepted by N. As usual, our decider for A TM looks like: Decider 4 -A TM ( M, w ) Construct M w from M, w return deciderforl ( M w ) 3

So Decider 4 -A TM ( M, w ) will accept M, w iff deciderforl accepts M w. But we saw above that deciderforl accepts M w iff M accepts w. So Decider 4 -A TM is a decider for A TM. Since such a decider cannot exist, we must have been wrong in our assumption that there was a decider for L. Now, let us remove the assumption that TM / L. The above proof showed that L is undecidable, assuming that TM was not in L. If TM L, then we run the above proof using L in place of L. At the end, we note that L is decidable iff L is decidable. 3 TM decidability by behavior 3.1 TM behavior properties One thinking about TMs there are three kind of properties one might consider: (1) The language accepted by the TM s, e.g. the TM accepts the string UIUC. In this case, such a property is very likely undecidable by Rice s theorem. (2) The TM s structure, e.g. the TM has 13 states. In this case, the property can probably be checked directly on the given description of the TM, and as such this is (probably) decidable. (3) The TM s behavior, e.g. the TM never moves left on input UIUC. This kind properties can be either decidable or not depending on the behavior under consideration, and this classification might be non-trivial. 3.2 A decidable behavior property For example, consider the following set of Turing machines: L R = M Mnever moves left for the input x, where x is the empty word. Surprising, the language L R is decidable because never moving left (equivalently: always moving right) destroys the Turing machine s ability to do random access into its tape. It is effectively made into a DFA. Specifically, if a Turing machine M never moves left, it reads through the whole input, then starts looking at blank tape cells. Once it is on the blank part of the tape, it can cycle through its set of states. But after Q moves, it has run out of distinct states and must be in a loop. So, if you watch M for four moves (the length of the string "UIUC") plus Q + 1 moves, it has either halted or its in an infinite loop. Therefore, to decide L R, you simulate the input Turing machine for Q + 5 moves. After that many moves, it has either moved left (in which case you reject), or has halted or gone into an infinite loop without ever moving left (in which case you accept). This algorithm is a decider (not just a recognizer) for L, because it definitely halts on any input Turing machine M. 4

3.3 An undecidable behavior property By contract, consider the following language: L x = M M writes an x at some point, when started on blank input This language L x is undecidable. The reason is that a Turing machine with this restriction (no writing x s) can simulate a Turing machine without the restriction. Proof: Suppose that L x were decidable. Let R be a Turing machine deciding L x. We will now construct a Turing machine S that decides A TM. S is constructed as follows: Construct the code for a new Turing machine M w as follows (a) On input y (which will be ignored). (b) Substitute X for x every where in < M > and w, creating new versions < M > and w. (c) Simulate M on w (d) If M rejects w, reject. (e) If M accepts w, print x on the tape and then accept. Run R on M w. If R accepts, then accept. If R rejects, then reject. If M accepts w, then M w will print x on any input (and thus on a blank input). If M rejects w or loops on w, then M w is guaranteed never to print x accidently. So R will accept M w exactly when M accepts w. Therefore, S decides A TM. But we know that A TM is undecidable. So S can not exist. Therefore we have a contradiction. So L x must have been undecidable.. A More examples The following examples weren t presented in lecture, but may be helpful to students. A.1 The language L UIUC Here s another example of a reduction that fits the Rice s Theorem outline. Let L UIUC = M L(M) contains the string UIUC. Lemma A.1 L UIUC is undecidable. 5

Proof: Proof by reduction from A TM. Suppose that L UIUC were decidable and let R be a Turing machine deciding it. We use R to construct a Turing machine deciding A TM. S is constructed as follows: Construct code for a new Turing machine M w as follows: Input is a string x. Erase the input x and replace it with the constant string w. Simulate M on w. Feed M w to R. If R accepts, accept. If R rejects, reject. If M accepts w, the language of M w contains all strings and, thus, the string UIUC. If M does not accept w, the language of M w is the empty set and, thus, does not contain the string UIUC. So R( M w ) accepts exactly when M accepts w. Thus, S decides A TM But we know that A TM is undecidable. So S does not exist. Therefore we have a contradiction. So L UIUC must have been undecidable. A.2 The language Halt_Empty_TM Here s another example which isn t technically an instance of Rice s Theorem, but has a very similar structure. Let Halt_Empty_TM = M Lemma A.2 Halt_Empty_TM is undecidable. M halts on blank input. Proof: By reduction from A TM. Suppose that Halt_Empty_TM were decidable and let R be a Turing machine deciding it. We use R to construct a Turing machine deciding A TM. S is constructed as follows: Construct code for a new Turing machine M w as follows: Input is a string x. Ignore the value of x. Simulate M on w. Feed M w to R. If R accepts, then accept. If R rejects, then reject. If M accepts w, the language of M w contains all strings and, thus, in particular the empty string. If M does not accept w, the language of M w is the empty set and, thus, does not contain the empty string. So R ( M w ) accepts exactly when M accepts w. Thus, S decides A TM But we know that A TM is undecidable. So S can not exist. Therefore we have a contradiction. So Halt_Empty_TM must have been undecidable. 6

A.3 The language L 111 Here is another example of an undecidable language defined by a Turing machine s behavior, to which Rice s Theorem does not apply. Let L 111 = M M prints three one s in a row on blank input. Lemma A.3 The language L 111 is undecidable. Proof: Suppose that L 111 were decidable. Let R be a Turing machine deciding L 111. We will now construct a Turing machine S that decides A TM. The decider S for A TM is constructed as follows: Construct the code for a new Turing machine M, which is just like M except that every use of the character 1 is replaced by a new character 1 which M does not use. when M would accept, M first prints 111 and then accepts Similarly, create a string w in which every character 1 has been replaced by 1. Create a second new Turing machine M w which simulates M on the hard-coded string w. Run R on M w. If R accepts, accept. If R rejects, then reject. If M accepts w, then M w will print 111 on any input (and thus on a blank input). If M does not accept w, then M w is guaranteed never to print 111 accidently. So R will accept M w exactly when M accepts w. Therefore, S decides A TM. But we know that A TM is undecidable. So S can not exist. Therefore we have a contradiction. So L 111 must have been undecidable. 7