The Unsolvability of the Halting Problem. Chapter 19

Similar documents
Decidability: Church-Turing Thesis

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

Turing Machines. Chapter 17

The Church-Turing Thesis. Chapter 18

Functions on languages:

MA/CSSE 474 Theory of Computation

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

CSE 105 THEORY OF COMPUTATION

CS20a: Turing Machines (Oct 29, 2002)

CSE 105 Theory of Computation

1 Showing Recognizability

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

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

Undecidable Problems and Reducibility

1 Acceptance, Rejection, and I/O for Turing Machines

Computability and Complexity

Introduction to Turing Machines

Reducability. Sipser, pages

CSCE 551 Final Exam, Spring 2004 Answer Key

Decidability: Reduction Proofs

Lecture Notes: The Halting Problem; Reductions

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)

Decidable Languages - relationship with other classes.

ACS2: Decidability Decidability

Computational Models Lecture 8 1

SCHEME FOR INTERNAL ASSESSMENT TEST 3

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

Limits of Computability

Computational Models Lecture 8 1

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

Exam Computability and Complexity

V Honors Theory of Computation

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

Decidability (What, stuff is unsolvable?)

Turing Machines. Lecture 8

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

CSE 105 THEORY OF COMPUTATION. Spring 2018 review class

4.2 The Halting Problem

TURING MAHINES

CSE 105 Theory of Computation

Computational Models Lecture 8 1

CS481F01 Solutions 8

CSE 105 THEORY OF COMPUTATION

Pushdown Automata. Chapter 12

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Introduction to Languages and Computation

CSE 105 THEORY OF COMPUTATION

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

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

DM17. Beregnelighed. Jacob Aae Mikkelsen

CSCC63 Worksheet Turing Machines

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

CS 301. Lecture 17 Church Turing thesis. Stephen Checkoway. March 19, 2018

Context Free Languages: Decidability of a CFL

Turing Machine Recap

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

CS154 Final Examination

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

CPSC 421: Tutorial #1

Homework Assignment 6 Answers

Introduction to Turing Machines. Reading: Chapters 8 & 9

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

Decidable and undecidable languages

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 16 : Turing Machines

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

CS154, Lecture 10: Rice s Theorem, Oracle Machines

CS20a: Turing Machines (Oct 29, 2002)

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

17.1 The Halting Problem

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

Computation Histories

Lecture 12: Mapping Reductions

CSE 105 THEORY OF COMPUTATION

Part I: Definitions and Properties

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

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

Computational Models Lecture 9, Spring 2009

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

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Equivalent Variations of Turing Machines

Turing Machines Part III

CSE 105 THEORY OF COMPUTATION

CS4026 Formal Models of Computation

CSE 105 THEORY OF COMPUTATION

Computability and Complexity

UNRESTRICTED GRAMMARS

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 14 : Turing Machines

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CS154 Final Examination

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

A non-turing-recognizable language

Theory of Computation

jflap demo Regular expressions Pumping lemma Turing Machines Sections 12.4 and 12.5 in the text

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

CS21 Decidability and Tractability

1 The decision problem for First order logic

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Transcription:

The Unsolvability of the Halting Problem Chapter 19

Languages and Machines SD D Context-Free Languages Regular Languages reg exps FSMs cfgs PDAs unrestricted grammars Turing Machines

D and SD A TM M with input alphabet decides a language L * iff, for any string w *, if w L then M accepts w, and if w L then M rejects w. A language L is decidable (in D) iff there is a Turing machine M that decides it. A TM M with input alphabet semidecides L iff for any string w *, if w L then M accepts w if w L then M does not accept w. M may reject or loop. A language L is semidecidable (in SD) iff there is a Turing machine that semidecides it.

Defining the Universe What is the complement of: A n B n = {a n b n : n 0} {<M, w> : TM M halts on input string w}.

Defining the Universe L 1 = {<M, w> : TM M halts on input string w}. L 2 = {<M> : M halts on nothing}. L 3 = {<M a, M b > : M a and M b halt on the same strings}. For a string w to be in L 1, it must: be syntactically well-formed. encode a machine M and a string w such that M halts when started on w. Define the universe from which we are drawing strings to contain only those strings that meet the syntactic requirements of the language definition. This convention has no impact on the decidability of any of these languages since the set of syntactically valid strings is in D.

A Different Definition of Complement Our earlier definition: L 1 = {x: x is not a syntactically well formed <M, w> pair} {<M, w> : TM M does not halt on input string w}. We will use a different definition: Define the complement of any language L whose member strings include at least one Turing machine description to be with respect to a universe of strings that are of the same syntactic form as L. Now we have: L 1 = {<M, w> : TM M does not halt on input string w}.

The Language H H = {<M, w> : TM M halts on input string w} Theorem: The language: H = {<M, w> : TM M halts on input string w} is semidecidable, but is not decidable.

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25 76 38 19 58

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25 76 38 19 58 29 88 44 22 11

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16

Does This Program Halt? times3(x: positive integer) = While x 1 do: If x is even then x = x/2. Else x = 3x + 1 25 76 38 19 58 29 88 44 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 http://www.numbertheory.org/php/collatz.html

H is Semidecidable Lemma: The language: H = {<M, w> : TM M halts on input string w} is semidecidable. Proof:

Lemma: The language: H is Semidecidable H = {<M>, w : TM M halts on input string w} is semidecidable. Proof: The TM M H semidecides H: M H (<M, w>) = 1. Run M on w. M H halts iff M halts on w. Thus M H semidecides H.

The Unsolvability of the Halting Problem Lemma: The language: H = {<M, w> : TM M halts on input string w} is not decidable. Proof: If H were decidable, then some TM M H would decide it. M H would implement the specification: halts(<m: string, w: string>) = If <M> is a Turing machine description and M halts on input w then accept. Else reject.

Trouble Trouble(x: string) = if halts(x, x) then loop forever, else halt. If there exists an M H that computes the function halts, Trouble exists: What is Trouble(<Trouble>)? What is halts(<trouble, Trouble>)? If halts reports that Trouble(<Trouble>) halts, Trouble loops. But if halts reports that Trouble(<Trouble>) does not halt, then Trouble halts.

Viewing the Halting Problem as Diagonalization Lexicographically enumerate Turing machines. Let 1 mean halting, blank mean non halting. machine 1 1 machine 2 1 But Trouble behaves as: i 1 i 2 i 3 <Troubl e> machine 3 1 1 Trouble 1 1 1 1 1 1 Trouble 1 1 1 Or maybe halts said that trouble(<trouble>) would halt. But then trouble would loop.

If H were in D H = {<M>, w : TM M halts on input string w} Theorem: If H were in D then every SD language would be in D. Proof: Let L be any SD language. There exists a TM M L that semidecides it. If H were also in D, then there would exist an O that decides it.

If H were in D To decide whether w is in L(M L ): M'(w: string) = 1. Run O on <M L, w>. 2. If O accepts (i.e., M L will halt), then: 2.1. Run M L on w. 2.2. If it accepts, accept. Else reject. 3. Else reject. So, if H were in D, all SD languages would be.

Back to the Entscheidungsproblem Theorem: The Entscheidungsproblem is unsolvable. Proof: (Due to Turing) 1. If we could solve the problem of determining whether a given Turing machine ever prints the symbol 0, then we could solve the problem of determining whether a given Turing machine halts. 2. But we can t solve the problem of determining whether a given Turing machine halts, so neither can we solve the problem of determining whether it ever prints 0. 3. Given a Turing machine M, we can construct a logical formula F that is true iff M ever prints the symbol 0. 4. If there were a solution to the Entscheidungsproblem, then we would be able to determine the truth of any logical sentence, including F and thus be able to decide whether M ever prints the symbol 0. 5. But we know that there is no procedure for determining whether M ever prints 0. 6. So there is no solution to the Entscheidungsproblem.

Language Summary IN SD OUT Semideciding TM H D Deciding TM A n B n C n Diagonalize Context-Free CF grammar A n B n Pumping PDA Closure Closure Regular Regular Expression a*b* Pumping FSM Closure