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

Similar documents
Computability and Complexity

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

Computation Histories

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

Limits of Computability

Non-emptiness Testing for TMs

CSE 105 THEORY OF COMPUTATION

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

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

FORMAL LANGUAGES, AUTOMATA AND COMPUTATION

DM17. Beregnelighed. Jacob Aae Mikkelsen

Lecture 12: Mapping Reductions

CS481F01 Solutions 8

CSE 105 THEORY OF COMPUTATION

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

Introduction to Turing Machines. Reading: Chapters 8 & 9

Reductions in Computability Theory

Computability Crib Sheet

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

4.2 The Halting Problem

Theory of Computation

Turing Machines, diagonalization, the halting problem, reducibility

Section 14.1 Computability then else

Lecture Notes: The Halting Problem; Reductions

ACS2: Decidability Decidability

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

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

Turing Machines A Turing Machine is a 7-tuple, (Q, Σ, Γ, δ, q0, qaccept, qreject), where Q, Σ, Γ are all finite

CSE 105 THEORY OF COMPUTATION

UNIT-VIII COMPUTABILITY THEORY

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

Theory of Computer Science

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

Turing Machines Part III

CSE355 SUMMER 2018 LECTURES TURING MACHINES AND (UN)DECIDABILITY

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

1 Showing Recognizability

Undecidable Problems and Reducibility

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

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

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

CPSC 421: Tutorial #1

Computability and Complexity

Automata Theory CS S-FR2 Final Review

A Lower Bound of 2 n Conditional Jumps for Boolean Satisfiability on A Random Access Machine

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

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

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

16.1 Countability. CS125 Lecture 16 Fall 2014

Problems, and How Computer Scientists Solve Them Manas Thakur

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

CS154, Lecture 10: Rice s Theorem, Oracle Machines

Introduction to Languages and Computation

UNRESTRICTED GRAMMARS

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

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

Decidability: Reduction Proofs

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

Reducability. Sipser, pages

Theory of Computer Science

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

CpSc 421 Homework 9 Solution

Turing Machine Recap

TAKE-HOME: OUT 02/21 NOON, DUE 02/25 NOON

17.1 The Halting Problem

Exam Computability and Complexity

Computational Models Lecture 8 1

CSE 105 Theory of Computation

Computational Models Lecture 8 1

V Honors Theory of Computation

CSE 105 THEORY OF COMPUTATION

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Final exam study sheet for CS3719 Turing machines and decidability.

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

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

The Power of One-State Turing Machines

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

6.8 The Post Correspondence Problem

5 3 Watson-Crick Automata with Several Runs

CSE 105 THEORY OF COMPUTATION

CSCI3390-Assignment 2 Solutions

Chapter 6: Turing Machines

1 Computational Problems

Functions on languages:

Advanced Undecidability Proofs

The purpose here is to classify computational problems according to their complexity. For that purpose we need first to agree on a computational

Context Sensitive Grammar

Theory of Computation (IX) Yijia Chen Fudan University

Decidability and Undecidability

Post s Correspondence Problem (PCP) Is Undecidable. Presented By Bharath Bhushan Reddy Goulla

Notes for Lecture Notes 2

Theory of Computation

Computability Theory

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

Decidability (What, stuff is unsolvable?)

Further discussion of Turing machines

CSCE 551 Final Exam, Spring 2004 Answer Key

COMP/MATH 300 Topics for Spring 2017 June 5, Review and Regular Languages

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Transcription:

On Rice s theorem Hans Hüttel October 2001 We have seen that there exist languages that are Turing-acceptable but not Turing-decidable. An important example of such a language was the language of the Halting Problem A TM = { M, w M is a TM and M accepts w} which, as we discovered, was not Turing-decidable. We can now use this result to show that a plethora of other decision problems are also undecidable. The idea comes from Chapter 5 of ITTTOC [5], namely that of reducibility we provide an algorithmic transformation faithfully transforming any instance of the our problem P which we know to be undecidable (here P is the Halting Problem) to a corresponding instance of our new problem P. If we had a decision algorithm for P, we would then also have a decision algorithm for our old problem P as we could simply prefix our decision algorithm for P with our transformation algorithm. However, we also know that such an algorithm cannot exist, so P must be undecidable. 1 Properties In this note we shall use the notion of reducibility to establish to what extent (if any) one may decide properties of the input languages of Turing machines. The presentation in my note is inspired by that of [2]. 1.1 Property checkers would come in handy It would be nice indeed if we could determine if the input language of a Turing machine had some given property: Given Turing machine M, does L(M) have property S? This note is a translation by the author of [1] 1

On Rice s theorem 2 An example of a property of Turing-acceptable languages could be, say, that the language in question was regular. If we had an algorithm for determining whether the language of a Turing machine was regular we would have a tool that we could use to determine whether we might as well construct a finite-state automaton. It would also be nice if we could determine if a Turing machine accepted all strings that contained some specific sequence of characters. Then we would have a tool for determining e.g. if all data that we assumed to be correct were indeed correctly handled. Sadly, such property checkers do not exist. This is a consequence of Rice s theorem which states that any non-trivial property of Turing-acceptable languages is undecidable. 1.2 What is a property, mathematically speaking? We shall now prove Rice s theorem. To do this, we need to formulate a mathematical counterpart of the everyday notion of having a property. A property of Turing-acceptable languages corresponds to the set of languages possessing the particular property. For instance the property being context-free corresponds to the class {L L is a context-free language}. Conversely, any class of Turing-acceptable languages S gives us the property being a member of S. Which is why the following definition makes sense. Definition 1.1 Let S be an arbitrary class of Turing-acceptable languages sprog. S is called a property. We say that a language L has the property S if L S. The property S is called trivial if it is either the empty property of the class of all Turing-acceptable languages. We define the property language of S as L S = { M L(M) S}, i.e. the language of all machine encodings that describe a machine recognizing a language that has the property S. In what follows, whenever we speak of properties, we therefore think of classes of Turing-acceptable languages. Example 1.1 The following are examples of non-trivial properties of Turingacceptable languages (why?) The class { } consisting of the empty language (not to be confused with the empty property!) The class of languages that have the empty string ɛ as a member The class of context-free languages

On Rice s theorem 3 The class of regular languages The class of Turing-decidable (i.e. recursive) languages 2 Rice s theorem Rice s theorem was originally shown in [4]. Theorem 2.1 (Rice s theorem) If S is a non-trivial property of Turingacceptable languages, then the problem Does L(M) have the property S? is undecidable. The proof of Rice s theorem consists of a reduction from the Halting Problem. We show how one could use a property-checking algorithm to devise an algorithm for solving the Halting Problem. Proof: Consider a non-trivial property S. We show that the problem Does L(M) have the property S? is undecidable by a reduction from the Halting Problem. In the remainder of our proof we shall assume that the empty language is not a member of S. We then construct, given a machine/input description M, w a Turing machine M such that L(M ) has the property S if and only if M halts when given w as input. Our assumption that S gives us that this is equivalent to stating that L(M ) if and only if M halts when given w as input. It is no loss of generality to assume that S. For if we wanted to show that S was undecidable and S, we could simply consider the complementary property S. This property is undecidable if and only if S is. Since S is a non-trivial property of Turing-acceptable languages, there must be some L S. Since L is Turing-acceptable, there exists a Turing machine recognizing L. We call this machine M L. Now assume that S is decidable. This will mean that the property language L S is Turing-decidable (recursive). This in turn means that there exists a Turing machine M S which for any machine description M will determine whether L(M ) S or not. We can now solve the Halting Problem by an algorithm presented in Figure 1. The pre-processor Prep takes M, w as input and outputs a new machine description M, where L(M ) S iff M accepts w (i.e. if M, w L H ).

On Rice s theorem 4 M, w Prep M M S yes, L(M ) S no, L(M ) S H yes no Figure 1: Solving the Halting Problem using the property checker for S w M Acc. Start M L Acc. Acc. x T Figure 2: The machine M constructed by Prep But we must also describe the internal workings of Prep. In other words: What kind of M is constructed by Prep? This is revealed in Figure 2. M starts its operation by ignoring its actual input x and simulates M using the fixed input w. If M does not halt when given w, M will obviously not halt on input x no matter what x is. If, on the other hand, M does halt on w we start M L with x as its input and accept x iff M L halts on x. In other words: If M halts when given w, M accepts exactly the same strings as M L, i.e. L(M ) = L, and we know that L S. If M does not halt when given w, M will not accept any inputs, i.e. L(M ) = and by assumption S. And now we can decide the Halting Problem using the following algorithm: For any given input string M, w, use Prep to construct M. Next, use M S to determine if L(M ) has the property S. L(M ) has, as we have just seen, the property S iff M halts on w. But the Halting Problem is

On Rice s theorem 5 undecidable, so M S cannot exist. Stop and think 2.1 When (if ever) do we run the machine M constructed by Prep? 3 Consequences of Rice s theorem Theorem 2.1 has a whole bunch of consequences, some of which I will present in the following. 3.1 Undecidability results concerning input languages The following results are immediate from Rice s theorem: Corollary 3.1 The following problems are all undecidable. machine M, Given Turing 1. does M halt on an empty input tape? 2. does M halt for any inputs at all? 3. does M halt for all inputs? 4. is L(M) regular? Context-free? Turing-decidable? Proof: Follows from Example 1.1 We can also use Rice s theorem to give a somewhat different proof of Theorem 5.4 in ITTTOC [5]. Corollary 3.2 Given Turing machines M 1 and M 2 it is undecidable if L(M 1 ) = L(M 2 ). Proof: Assume that the above problem were decidable and could be decided by a Turing machine M =. But then we could decide the problem L(M) = by giving M = the inputs M and M, where M is any Turing machine that does not accept any inputs. Contradiction!

On Rice s theorem 6 3.2 Undecidability results about general grammars Another corollary (or a collection of such, if you want) is about general grammars. Corollary 3.3 The following problems are all undecidable: Given a general grammar G over terminal alphabet Σ,: 1. is it the case that ɛ L(G)? 2. is it the case that L(G)? 3. is it the case that L(G) = Σ? 4. is L(G) regular? Context-free? Turing-decidable? 3.3 Complexity checkers are impossible, too Rice s theorem has repercussions in complexity theory as well, as it shows that there can be no hope of finding a means of automatic complexity analysis. Questions such as Does Turing machine M run in polynomial time? are also undecidable, as the class of languages that are decidable in polynomial time is a non-trivial property. This follows from the fact that some languages are known not to be decidable by any polynomial-time Turing machine. Actually one can show that no matter what time complexity function T (n) you consider, there will be some language not recognizable by a machine with time complexity O(T (n)). So complexity checkers cannot exist! 3.4 Don t despair completely... Does Rice s theorem tell us that all questions concerning Turing machines and general grammars are undecidable? The answer to that is no. The theorem only concerns the properties of the language accepted by a machine, not the machine itself. For instance, the problem Does a Turing machine have more than 7 states? is obviously decidable. Rice s theorem tells us that we cannot predict the interesting aspects of the behaviour of an algorithm by algorithmic means. References [1] Hüttel, H. Om Rice s sætning, Aalborg University 2001.

On Rice s theorem 7 [2] Hopcroft, J.E. og J.D. Ullman. Introduction to Automata, Languages and Computation, Addison-Wesley 1979. [3] Machtey, M. og P.R. Young. An Introduction to the General Theory of Algorithms, North-Holland, 1978. [4] Rice, H.G. Classes of recursively enumerable sets and their decision problems, Trans. AMS 89:25 59. [5] Sipser, M. Introduction to the Theory of Computation, First edition, PWS Publishing 1997.