Lecture Notes: The Halting Problem; Reductions

Similar documents
1 Showing Recognizability

CSE 105 THEORY OF COMPUTATION

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)

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

Lecture 12: Mapping Reductions

CSCI3390-Lecture 6: An Undecidable Problem

ECS 120 Lesson 18 Decidable Problems, the Halting Problem

Turing Machine Recap

CSE 105 THEORY OF COMPUTATION

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

Computability and Complexity

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

1 Reducability. CSCC63 Worksheet Reducability. For your reference, A T M is defined to be the language { M, w M accepts w}. Theorem 5.

16.1 Countability. CS125 Lecture 16 Fall 2014

Decidability and Undecidability

A non-turing-recognizable language

CS 361 Meeting 26 11/10/17

Reductions in Computability Theory

CS 125 Section #10 (Un)decidability and Probability November 1, 2016

Computability and Complexity

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

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

Decidability: Church-Turing Thesis

CSE 105 Theory of Computation

} Some languages are Turing-decidable A Turing Machine will halt on all inputs (either accepting or rejecting). No infinite loops.

Intro to Theory of Computation

Turing Machines Part III

Undecidability COMS Ashley Montanaro 4 April Department of Computer Science, University of Bristol Bristol, UK

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

Computational Models Lecture 9, Spring 2009

Decidability (What, stuff is unsolvable?)

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

Turing Machines. Lecture 8

ACS2: Decidability Decidability

CSCE 551 Final Exam, Spring 2004 Answer Key

CSE 105 Theory of Computation

Turing Machines, diagonalization, the halting problem, reducibility

Undecidability. Andreas Klappenecker. [based on slides by Prof. Welch]

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

TURING MAHINES

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

Undecidable Problems and Reducibility

Theory of Computation

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

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

Warm-Up Problem. Please fill out your Teaching Evaluation Survey! Please comment on the warm-up problems if you haven t filled in your survey yet.

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

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

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

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

Further discussion of Turing machines

Non-emptiness Testing for TMs

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

Computation Histories

Most General computer?

Computational Models Lecture 8 1

Computational Models Lecture 8 1

Computability Crib Sheet

CSCI3390-Assignment 2 Solutions

1 Computational Problems

The Unsolvability of the Halting Problem. Chapter 19

1 Reals are Uncountable

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

Discrete Mathematics for CS Spring 2007 Luca Trevisan Lecture 27

Exam Computability and Complexity

A Universal Turing Machine

Notes for Lecture Notes 2

CSE 105 THEORY OF COMPUTATION

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

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

Automata Theory CS S-FR2 Final Review

CSE 105 THEORY OF COMPUTATION

Theory of Computation

Turing Machines. Reading Assignment: Sipser Chapter 3.1, 4.2

Reading Assignment: Sipser Chapter 3.1, 4.2

Decidability: Reduction Proofs

Reducability. Sipser, pages

CPSC 421: Tutorial #1

A Note on Turing Machine Design

MATH 521, WEEK 2: Rational and Real Numbers, Ordered Sets, Countable Sets

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

V Honors Theory of Computation

Computational Models Lecture 8 1

Decidable and undecidable languages

CS481F01 Solutions 8

Theory of Computation p.1/?? Theory of Computation p.2/?? We develop examples of languages that are decidable

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

Time-bounded computations

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

4.2 The Halting Problem

Theory of Computation (IX) Yijia Chen Fudan University

Decidable Languages - relationship with other classes.

Limits of Computability

Turing machine recap. Universal Turing Machines and Undecidability. Alphabet size doesn t matter. Robustness of TM

Finish K-Complexity, Start Time Complexity

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Transcription:

Lecture Notes: The Halting Problem; Reductions COMS W3261 Columbia University 20 Mar 2012 1 Review Key point. Turing machines can be encoded as strings, and other Turing machines can read those strings to peform simulations. Recall two definitions from last class: Definition 1. A language is Turing-recognizable if there exists a Turing machine which halts in an accepting state iff its input is in the language. Definition 2. A language is Turing-decidable if it halits in an accepting state for every input in the language, and halts in a rejecting state for every other input. Intuitively, for recognizability we allow our TM to run forever on inputs that are not in the language, while for decidability we require that the TM halt on every input. Now recall our two most important results: Theorem 1. There exist (uncountably many!) languages which are not Turing-recognizable. Proof. (intuitive) There are as many strings as natural numbers, because every (finite) string over a finite alphabet can be encoded as a binary number. There are as many TMs as strings, because every TM can be encoded as a string. Thus, both the strings and the TMs are countably infinite. There are as many languages as real numbers. Every language is a subset of the set of strings; we can think of this subset as being encoded by an infinite binary sequence (i.e. a real number) with 1s at indices corresponding to strings in the language and 0s everywhere else. Thus there are more languages than Turing machines; we conclude that some (indeed, most ) languages are not recognized by any TM. Now we will construct a specific undecidable language. 1

Definition 3. The language X T M = { M : M does not accept M } Theorem 2. X T M is not Turing-decidable. Question. Give the paradox proof. Proof 1. (by Epimenides paradox) Suppose we had a Turing machine M deciding this language. What happens when we run M with input M? If we claim it accepts, then by definition it ought to reject; if it rejects, then it ought to accept! Either way, we have a contradiction. Alternatively, here s a proof that it s not even Turing-recognizable. Question. Give the diagonalization proof. Proof 2. (by diagonalization) Suppose we constructed an (infinite) chart listing all the Turing machines and all encodings of Turing machines. We write 1 in cell [i, j] if M i accepts M j and 0 otherwise: M 1 M 2 M 3 M 1 0 1 1 M 2 1 1 1 M 3. 1 0 1... (The particular arrangement of 1s and 0s is unimportant it will depend on our encoding scheme.) Note that by reading the 1s from the ith row, we get the language decided by M i. Does X T M appear in any row of this list? Not the first row: M 1 rejects M 1, so M 1 must be in X T M. Not the second row: M 2 accepts M 2, so M 2 must not be in X T M. Continuing with this procedure, we can show that X T M is not the same as any row of this enumeration of TMs, and as a consequence is not decided by any TM. 2 The Accepting Problem X T M is admittedly a rather strange language, and it s not obvious why we should really care that it s not recognizable. Let s look at a different one: Definition 4. The language A T M = ({ M, w) : M accepts w} The question of whether A T M is decidable is precisely the question of whether one TM can predict the output of another TM! Question. Is this language Turing-recognizable? Yes. Given M, w as input, we can just simulate M on w. Question. Is this language Turing-decidable? 2

No. Theorem 3. A T M is undecidable. Proof. Suppose, towards contradiction, that we had a TM M deciding A T M. Then we could construct a TM N deciding X T M, as follows: Given input P : Run M on P, P. If M accepts, reject. If M rejects, accept. Clearly, N is a TM deciding X T M. But we know that there no such TM exists! Because the existence of M implies the existence of N, we conclude that M also does not exist. Clarification. Understand why A T M is recognizable but not decidable. Key point. There is no Turing machine which can predict the output of all other Turing machines. However, there are Turing machines which can predict the output of some other Turing machines. 3 The Halting Problem Let s try a more modest goal: rather than actually attempting to predict output, let s just predict whether a Turing machine halts on its input, or runs forever. Definition 5. The language HALT T M = {( M, w) : M halts on input w} Question. Is this language Turing-recognizable? Yes: again, it just simulates (but it will run forever if the simulated machine does!). Question. Is this language Turing-decidable? No. Theorem 4. HALT T M is undecidable. Proof. This is very much like the previous proof. Suppose we had a TM M deciding HALT T M. The we could construct a TM N deciding A T M, as follows: Given input ( P, w): Run M on ( P, w). If M rejects, reject: P runs forever given input w, so does not accept w. 3

Otherwise, we know that P terminates, and it is safe to simulate it on w. Do so. If P accepts, accept. If P rejects, reject. Clearly, N decides A T M. Similarly to the previous proof, we know that A T M is undecidable, so M cannot exist. Key point. There is no Turing machine which finds infinite loops in all other Turing machines (though again, it may do so for a restricted subset). This is a problem which would have real, practical benefits if it were soluble, but it s not. Clarification. Is this clear? 4 Other Undecidable Languages Definition 6. The language E T M = { M : L(M) = } Question. Is this language decidable? No: we can construct a decider for A T M again. Proof. Suppose M decides E T M. Given input P, w : Construct a new TM P which rejects if its input is not w, and otherwise simulates P on w. Run M on P. If M accepts, reject. If M rejects, accept. We have a contradiction. 5 Reductions In working through these examples we ve come across a very powerful proof technique: to prove that some language is undecidable, we assume that we have a decider, and show that this implies the existence of a decider for a known undecidable problem. This technique is called reduction. There are several different kinds of reduction; the kind that we ve discussed so far is called Turing reduction (for reasons that are hopefully obvious). The general idea is that 4

we assume we have a TM which computes the solution to one problem, and we use that to compute the solution to another problem. To say that a solver for B allows us to solve A ( A reduces to B ), we write A T B (I ve always found this notation weird. An easy way to remember it is that if A is reducible to B, the machine that computes B is at least as powerful as the machine that computes A: it is definitely powerful enough to solve A, and maybe other problems as well. So A is easier than B.) Question. A T M T X T M, or vice-versa? Vice-versa. Let s formalize the proof technique we ve been using so far: Theorem 5. A T B and B decidable A decidable. Corollary 1. A T B and A undecidable B undecidable. 6 Other Undecidable Languages, continued Now let s try a few more reductions: Definition 7. The language REG T M = { M : L(M) is regular} Question. Prove that this is undecidable. (Hint: reduce from A T M) Proof. Suppose we have a decider M for REG T M. Given input P, w : Construct a new TM P as follows: If the input is of the form 0 n 1 n, accept. Otherwise, ignore the input and run P on w Run M on P If M doesn t accept w, L(P ) = {0 n 1 n }, and is not regular. If M accepts w, L(P ) = Σ. Thus, If M accepts, accept. If M rejects, reject. Once again, a contradiction. 5

Definition 8. The language EQ T M = {( M, N ) : L(M) = L(N)} Question. Prove that this is undecidable. (Hint: reduce from E T M) Proof. Suppose we have a decider M for EQ T M. Construct the following decider for E T M : Given input P : Construct a TM Q which rejects immediately on all inputs. Run M on ( P, Q ), and accept iff it accepts. Once again, a contradiction. 7 Next Class It seems like every interesting language of Turing machines we ve come up with is undecidable. Is there any property of Turing machines which can be decided? 6