Theory of Computer Science. Theory of Computer Science. D8.1 Other Halting Problem Variants. D8.2 Rice s Theorem

Similar documents
Theory of Computer Science

Theory of Computer Science

Theory of Computer Science. Theory of Computer Science. D7.1 Introduction. D7.2 Turing Machines as Words. D7.3 Special Halting Problem

Theory of Computer Science. D5.1 Introduction. Theory of Computer Science. D5.2 Primitive Recursion vs. LOOP. D5.3 µ-recursion vs.

Theory of Computer Science. Theory of Computer Science. E2.1 P and NP. E2.2 Polynomial Reductions. E2.3 NP-Hardness and NP-Completeness. E2.

Limits of Computability

Theory of Computer Science. Theory of Computer Science. E5.1 Routing Problems. E5.2 Packing Problems. E5.3 Conclusion.

Theory of Computer Science. Theory of Computer Science. E2.1 P and NP. E2.2 Polynomial Reductions. E2.3 NP-Hardness and NP-Completeness. E2.

Theory of Computer Science

V Honors Theory of Computation

Theory of Computer Science. Theory of Computer Science. E1.1 Motivation. E1.2 How to Measure Runtime? E1.3 Decision Problems. E1.

17.1 The Halting Problem

Undecidable Problems and Reducibility

Theory of Computer Science

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

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

Lecture 12: Mapping Reductions

Theory of Computer Science. Theory of Computer Science. E4.1 Overview E4.2 3SAT. E4.3 Graph Problems. E4.4 Summary.

Introduction to Turing Machines

Theory of Computation

6.8 The Post Correspondence Problem

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

CSE 105 THEORY OF COMPUTATION

Section 14.1 Computability then else

Reducability. Sipser, pages

Computability and Complexity

Decidability: Church-Turing Thesis

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

CS20a: Turing Machines (Oct 29, 2002)

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

Primitive recursive functions: decidability problems

Theory of Computer Science. Theory of Computer Science. E3.1 Overview. E3.2 Cook-Levin Theorem E3.3 3SAT. E3.4 Summary. Further Reading (German)

Informal Statement Calculus

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

CPSC 421: Tutorial #1

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

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

CS481F01 Solutions 8

Theory of Computer Science

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

PREDICATE LOGIC: UNDECIDABILITY AND INCOMPLETENESS HUTH AND RYAN 2.5, SUPPLEMENTARY NOTES 2

Computational Models Lecture 8 1

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

Theory of Computation - Module 4

CS154, Lecture 10: Rice s Theorem, Oracle Machines

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

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

The Unsolvability of the Halting Problem. Chapter 19

Decidable Languages - relationship with other classes.

Computable Functions

Computational Models Lecture 8 1

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

ELEMENTS IN MATHEMATICS FOR INFORMATION SCIENCE NO.6 TURING MACHINE AND COMPUTABILITY. Tatsuya Hagino

Introduction to Turing Machines. Reading: Chapters 8 & 9

ECS 120 Lesson 20 The Post Correspondence Problem

ACS2: Decidability Decidability

Advanced Undecidability Proofs

CSE 105 THEORY OF COMPUTATION

CS 275 Automata and Formal Language Theory

Predicate Logic - Undecidability

Turing Machines Part III

Computability Crib Sheet

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

Computation Histories

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

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

UNIT-VIII COMPUTABILITY THEORY

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

CS 275 Automata and Formal Language Theory

Exam Computability and Complexity

(a) Definition of TMs. First Problem of URMs

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

Lecture Notes: The Halting Problem; Reductions

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

Theory of Computation

1 Showing Recognizability

Computational Models Lecture 9, Spring 2009

Computational Models Lecture 8 1

CSE 105 THEORY OF COMPUTATION

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

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

acs-07: Decidability Decidability Andreas Karwath und Malte Helmert Informatik Theorie II (A) WS2009/10

Pushdown Automata. Chapter 12

CSE 200 Lecture Notes Turing machine vs. RAM machine vs. circuits

C6.2 Push-Down Automata

Mapping Reductions. Mapping Reductions. Introduction to Computability. Theory. Mapping Reductions. Lecture13: Mapping. Reductions

Turing Machines. Lecture 8

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

CS20a: Turing Machines (Oct 29, 2002)

The Post Correspondence Problem; Applications to Undecidability Results

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

Introduction to Languages and Computation

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Foundations of Informatics: a Bridging Course

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

CpSc 421 Homework 9 Solution

CSE 105 THEORY OF COMPUTATION

Non-emptiness Testing for TMs

Computability Theory

DM17. Beregnelighed. Jacob Aae Mikkelsen

Transcription:

Theory of Computer Science May 15, 2017 D8. Rice s Theorem and Other Undecidable Problems Theory of Computer Science D8. Rice s Theorem and Other Undecidable Problems Malte Helmert University of Basel May 15, 2017 D8.1 Other Halting Problem Variants D8.2 Rice s Theorem D8.3 Outlook: Further Undecidable Problems D8.4 Summary Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 1 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 2 / 29 Overview: Computability Theory Further Reading (German) Computability Theory imperative models of computation: D1. Turing-Computability D2. LOOP- and WHILE-Computability D3. GOTO-Computability functional models of computation: D4. Primitive Recursion and µ-recursion D5. Primitive/µ-Recursion vs. LOOP-/WHILE-Computability undecidable problems: D6. Decidability and Semi-Decidability D7. Halting Problem and Reductions D8. Rice s Theorem and Other Undecidable Problems Post s Correspondence Problem Undecidable Grammar Problems Gödel s Theorem and Diophantine Equations Literature for this Chapter (German) Theoretische Informatik kurz gefasst by Uwe Schöning (5th edition) Chapter 2.6 Outlook: Chapters 2.7 2.9 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 3 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 4 / 29

Further Reading (English) Literature for this Chapter (English) Introduction to the Theory of Computation by Michael Sipser (3rd edition) Chapters 5.1 and 5.3 Outlook: Chapters 5.2 and 6.2 Notes: Sipser s definitions differ from ours. D8.1 Other Halting Problem Variants Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 5 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 6 / 29 General Halting Problem (1) General Halting Problem (2) Definition (General Halting Problem) The general halting problem or halting problem is the language H = {w#x {0, 1, #} w, x {0, 1}, M w started on x terminates} German: allgemeines Halteproblem, Halteproblem Note: H is semi-decidable. (Why?) Theorem (Undecidability of General Halting Problem) The general halting problem is undecidable. Intuition: if the special case K is not decidable, then the more general problem H definitely cannot be decidable. Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 7 / 29 Proof. We show K H (Reminder: K is the special halting problem). We define f : {0, 1} {0, 1, #} as f (w) := w#w. f is clearly total and computable, and w K iff M w started on w terminates iff w#w H iff f (w) H. Therefore f is a reduction from K to H. Because K is undecidable, H is also undecidable. Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 8 / 29

Halting Problem on Empty Tape (1) Halting Problem on Empty Tape (2) Definition (Halting Problem on the Empty Tape) The halting problem on the empty tape is the language H 0 = {w {0, 1} M w started on ε terminates}. German: Halteproblem auf leerem Band Note: H 0 is semi-decidable. (Why?) Theorem (Undecidability of Halting Problem on Empty Tape) The halting problem on the empty tape is undecidable. Proof. We show H H 0. Consider the function f : {0, 1, #} {0, 1} that computes the word f (z) for a given z {0, 1, #} as follows: Test if z has the form w#x with w, x {0, 1}. If not, return any word that is not in H 0 (e. g., encoding of a TM that instantly starts an endless loop). If yes, split z into w and x. Decode w to a TM M 2.... Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 9 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 10 / 29 Halting Problem on Empty Tape (3) Construct a TM M 1 that behaves as follows: If the input is empty: write x onto the tape and move the head to the first symbol of x (if x ε); then stop otherwise, stop immediately Construct TM M that first runs M 1 and then M 2. Return the encoding of M. D8.2 Rice s Theorem f is total and (with some effort) computable. Also: z H iff z = w#x and M w run on x terminates iff M f (z) started on empty tape terminates iff f (z) H 0 H H 0 H 0 undecidable Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 11 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 12 / 29

Rice s Theorem (1) Rice s Theorem (2) We have shown that a number of (related) problems are undecidable: special halting problem K general halting problem H halting problem on empty tape H0 Many more results of this type could be shown. Instead, we prove a much more general result, Rice s theorem, which shows that a very large class of different problems are undecidable. Rice s theorem can be summarized informally as: every question about what a given Turing machine computes is undecidable. Theorem (Rice s Theorem) Let R be the class of all computable functions. Let S be an arbitrary subset of R except S = or S = R. Then the language C(S) = {w {0, 1} the function computed by M w is in S} is undecidable. German: Satz von Rice Question: why the restriction to S and S R? Extension (without proof): in most cases neither C(S) nor C(S) is semi-decidable. (But there are sets S for which one of the two languages is semi-decidable.) Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 13 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 14 / 29 Rice s Theorem (3) Rice s Theorem (4) Proof. Let Ω be the function that is undefined everywhere. Case distinction: Case 1: Ω S Let q R \ S be an arbitrary computable function outside of S (exists because S R and S R). Let Q be a Turing machine that computes q.... Consider function f : {0, 1} {0, 1}, where f (w) is defined as follows: Construct TM M that first behaves on input y like M w on the empty tape (independently of what y is). Afterwards (if that computation terminates!) M clears the tape, creates the start configuration of Q for input y and then simulates Q. f (w) is the encoding of this TM M f is total and computable.... Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 15 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 16 / 29

Rice s Theorem (5) Rice s Theorem (6) Which function is computed by the TM encoded by f (w)? { Ω if M w does not terminate on ε M f (w) computes q otherwise For all words w {0, 1} : w H 0 = M w terminates on ε = M f (w) computes the function q = the function computed by M f (w) is not in S = f (w) / C(S)... Further: w / H 0 = M w does not terminate on ε = M f (w) computes the function Ω = the function computed by M f (w) is in S = f (w) C(S) Together this means: w / H 0 iff f (w) C(S), thus w H 0 iff f (w) C(S). Therefore, f is a reduction of H 0 to C(S). Since H 0 is undecidable, H 0 is also undecidable. We can conclude that C(S) is undecidable.... Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 17 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 18 / 29 Rice s Theorem (7) Rice s Theorem: Consequences Case 2: Ω / S Analogous to Case 1 but this time choose q S. The corresponding function f then reduces H 0 to C(S). Thus, it also follows in this case that C(S) is undecidable. Was it worth it? We can now know conclude immediately that (for example) the following informally specified problems are all undecidable: Does a given TM compute a constant function? Does a given TM compute a total function (i. e. will it always terminate, and in particular terminate in a correct configuration)? Is the output of a given TM always longer than its input? Does a given TM compute the identity function? Does a given TM compute the computable function f?... Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 19 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 20 / 29

Rice s Theorem: Practical Applications Practical problems that are undecidable due to Rice s theorem: automated debugging: Can a given variable ever receive a null value? Can a given assertion in a program ever trigger? Can a given buffer ever overflow? virus scanners and other software security analysis: Can this code do something harmful? Is this program vulnerable to SQL injections? Can this program lead to a privilege escalation? optimizing compilers: Is this dead code? Is this a constant expression? Can pointer aliasing happen here? Is it safe to parallelize this code path? parallel program analysis: Is a deadlock possible here? Can a race condition happen here? Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 21 / 29 D8.3 Outlook: Further Undecidable Problems Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 22 / 29 And What Else? Post s Correspondence Problem Here we conclude our discussion of undecidable problems. Many more undecidable problems exist. In this section, we briefly discuss some further classical results. Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 23 / 29 Post s Correspondence Problem (PCP) Given: Question: a set of domino types A: 1 B: 10 C: 011 101 00 11 Can we lay a (non-empty) sequence of dominoes such that the top and bottom word match? (We may use each type as often as we want.) 1 101 A 011 11 C 10 00 B 011 11 C undecidable by reduction from Halting problem (see Schöning, Chapter 2.7) German: Postsches Korrespondenzproblem Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 24 / 29

Undecidable Grammar Problems Gödel s First Incompleteness Theorem (1) Some Grammar Problems Given context-free grammars G 1 and G 2,...... is L(G 1 ) L(G 2 ) =?... is L(G 1 ) L(G 2 ) =?... is L(G 1 ) L(G 2 ) context-free?... is L(G 1 ) L(G 2 )?... is L(G 1 ) = L(G 2 )? Given a context-sensitive grammar G,...... is L(G) =?... is L(G) =? all undecidable by reduction from PCP (see Schöning, Chapter 2.8) Definition (Arithmetic Formula) An arithmetic formula is a closed predicate logic formula using constant symbols 0 and 1, function symbols + and, and no relation symbols. It is called true if it is true under the usual interpretation of 0, 1, + and over N 0. German: arithmetische Formel Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 25 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 26 / 29 Gödel s First Incompleteness Theorem (2) D8. Rice s Theorem and Other Undecidable Problems Summary Gödel s First Incompleteness Theorem The problem of deciding if a given arithmetic formula is true is undecidable. Moreover, neither it nor its complement are semi-decidable. As a consequence, there exists no sound and complete proof system for arithmetic formulas. D8.4 Summary proof idea: relate arithmetic formulas to halting problem for WHILE programs (see Schöning, Chapter 2.9) German: erster Gödelscher Unvollständigkeitssatz Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 27 / 29 Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 28 / 29

D8. Rice s Theorem and Other Undecidable Problems Summary Summary undecidable but semi-decidable problems: special halting problem a.k.a. self-application problem (from previous chapter) general halting problem halting problem on empty tape Rice s theorem: In general one cannot determine algorithmically what a given program (or Turing machine) computes. further undecidable problems: Post s Correspondence Problem many grammar problems proving or refuting the truth of an arithmetic formula Malte Helmert (University of Basel) Theory of Computer Science May 15, 2017 29 / 29