Rice's theorem
   HOME

TheInfoList



OR:

In
computability theory Computability theory, also known as recursion theory, is a branch of mathematical logic, computer science, and the theory of computation that originated in the 1930s with the study of computable functions and Turing degrees. The field has sinc ...
, Rice's theorem states that all non-trivial
semantic Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comput ...
properties of programs are undecidable. A semantic property is one about the program's behavior (for instance, does the program terminate for all inputs), unlike a syntactic property (for instance, does the program contain an
if-then-else In computer science, conditionals (that is, conditional statements, conditional expressions and conditional constructs,) are programming language commands for handling decisions. Specifically, conditionals perform different computations or actio ...
statement). A property is ''non-trivial'' if it is neither true for every partial computable function, nor false for every partial computable function. Rice's theorem can also be put in terms of functions: for any non-trivial property of
partial functions In mathematics, a partial function from a set to a set is a function from a subset of (possibly itself) to . The subset , that is, the domain of viewed as a function, is called the domain of definition of . If equals , that is, if is d ...
, no general and effective method can decide whether an
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
computes a partial function with that property. Here, a property of partial functions is called ''trivial'' if it holds for all
partial computable function Computable functions are the basic objects of study in computability theory. Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do ...
s or for none, and an effective decision method is called ''general'' if it decides correctly for every algorithm. The theorem is named after
Henry Gordon Rice Henry Gordon Rice (July 18, 1920 – April 14, 2003) was an American logician and mathematician best known as the author of Rice's theorem, which he proved in his doctoral dissertation of 1951 at Syracuse University with thesis advisor Paul C ...
, who proved it in his doctoral dissertation of 1951 at
Syracuse University Syracuse University (informally 'Cuse or SU) is a Private university, private research university in Syracuse, New York. Established in 1870 with roots in the Methodist Episcopal Church, the university has been nonsectarian since 1920. Locate ...
.


Introduction

Let be a property of a
formal language In logic, mathematics, computer science, and linguistics, a formal language consists of words whose letters are taken from an alphabet and are well-formed according to a specific set of rules. The alphabet of a formal language consists of sym ...
that is nontrivial, meaning # there exists a
recursively enumerable language In mathematics, logic and computer science, a formal language is called recursively enumerable (also recognizable, partially decidable, semidecidable, Turing-acceptable or Turing-recognizable) if it is a recursively enumerable subset in the set o ...
having the property ''p'', # there exists a recursively enumerable language not having the property ''p'', (that is, ''p'' is neither uniformly true nor uniformly false for all recursively enumerable languages). Then it is undecidable to determine for a given
Turing machine A Turing machine is a mathematical model of computation describing an abstract machine that manipulates symbols on a strip of tape according to a table of rules. Despite the model's simplicity, it is capable of implementing any computer alg ...
''M'', whether the language recognized by it has the property ''p''. In practice, this means that there is no machine that can always decide whether the language of a given Turing machine has a particular nontrivial property. Special cases include e.g. the undecidability of whether the language recognized by a Turing machine could be recognized by a nontrivial simpler machine, such as a
finite automaton A finite-state machine (FSM) or finite-state automaton (FSA, plural: ''automata''), finite automaton, or simply a state machine, is a mathematical model of computation. It is an abstract machine that can be in exactly one of a finite number o ...
(meaning, it is undecidable whether the language of a Turing machine is regular). It is important to note that Rice's theorem does not concern the properties of machines or programs; it concerns properties of functions and languages. For example, whether a machine runs for more than 100 steps on a particular input is a decidable property, even though it is non-trivial. Two different machines recognizing exactly the same language might require a different number of steps to recognize the same input string. Similarly, whether a machine has more than five states is a decidable property of the machine, as the number of states can simply be counted. For properties of this kind, which concerns a Turing machine but not the language recognized by it, Rice's theorem does not apply. Using
Rogers Rogers may refer to: Places Canada *Rogers Pass (British Columbia) * Rogers Island (Nunavut) United States * Rogers, Arkansas, a city * Rogers, alternate name of Muroc, California, a former settlement * Rogers, Indiana, an unincorporated communit ...
' characterization of acceptable programming systems, Rice's theorem may essentially be generalized from Turing machines to most computer
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
s: there exists no automatic method that decides with generality non-trivial questions on the behavior of computer programs. As an example, consider the following variant of the
halting problem In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. Alan Turing proved in 1936 that a ...
. Let ''P'' be the following property of partial functions F of one argument: ''P''(F) means that F is defined for the argument '1'. It is obviously non-trivial, since there are partial functions that are defined at 1, and others that are undefined at 1. The ''1-halting problem'' is the problem of deciding of any algorithm whether it defines a function with this property, i.e., whether the algorithm halts on input 1. By Rice's theorem, the 1-halting problem is undecidable. Similarly the question of whether a Turing machine ''T'' terminates on an initially empty tape (rather than with an initial word ''w'' given as second argument in addition to a description of ''T'', as in the full halting problem) is still undecidable.


Formal statement

Let \mathbb N denote the
natural numbers In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called '' cardinal ...
, and let \mathbf^ denote the class of unary (partial) computable functions. Let \phi\colon \mathbb \to \mathbf^ be an admissible numbering of the
computable function Computable functions are the basic objects of study in computability theory. Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do ...
s. Denote by \phi_e:=\phi(e) the th (partial) computable function. We identify each ''property'' that a computable function may have with the subset of \mathbf^ consisting of the functions with that property. Thus, given a set F \subseteq \mathbf^, a computable function \phi_e has property F if and only if \phi_e \in F. For each property F \subseteq \mathbf^ there is an associated membership
decision problem In computability theory and computational complexity theory, a decision problem is a computational problem that can be posed as a yes–no question of the input values. An example of a decision problem is deciding by means of an algorithm whe ...
D_F of determining, given , whether \phi_e \in F. Rice's theorem states that the decision problem D_F is decidable (also called ''recursive'' or ''computable'') if and only if F = \varnothing or F = \mathbf^.


Examples

According to Rice's theorem, if there is at least one partial computable function in a particular class ''C'' of partial computable functions and another partial computable function not in ''C'' then the problem of deciding whether a particular program computes a function in ''C'' is undecidable. For example, Rice's theorem shows that each of the following sets of partial computable functions is undecidable (that is, the set is not recursive, or not
computable Computability is the ability to solve a problem in an effective manner. It is a key topic of the field of computability theory within mathematical logic and the theory of computation within computer science. The computability of a problem is clos ...
): * The class of partial computable functions that return ''0'' for every input, and its complement. * The class of partial computable functions that return ''0'' for at least one input, and its complement. * The class of partial computable functions that are constant, and its complement. *The class of partial computable functions that are identical to a given partial computable function, and its complement. *The class of partial computable functions that diverge (i.e., undefined) for some input, and its complement. * The class of indices for computable functions that are total. * The class of indices for
recursively enumerable set In computability theory, a set ''S'' of natural numbers is called computably enumerable (c.e.), recursively enumerable (r.e.), semidecidable, partially decidable, listable, provable or Turing-recognizable if: *There is an algorithm such that th ...
s that are cofinite. * The class of indices for recursively enumerable sets that are recursive.


Proof by Kleene's recursion theorem

A corollary to
Kleene's recursion theorem In computability theory, Kleene's recursion theorems are a pair of fundamental results about the application of computable functions to their own descriptions. The theorems were first proved by Stephen Kleene in 1938 and appear in his 1952 ...
states that for every Gödel numbering \phi\colon \mathbb \to \mathbf^ of the
computable function Computable functions are the basic objects of study in computability theory. Computable functions are the formalized analogue of the intuitive notion of algorithms, in the sense that a function is computable if there exists an algorithm that can do ...
s and every computable function Q(x,y), there is an index e such that \phi_e(y) returns Q(e,y). (In the following, we say that f(x) "returns" g(x) if either f(x)=g(x), or both f(x) and g(x) are undefined.) Intuitively, \phi_e is a quine, a function that returns its own source code (Gödel number), except that rather than returning it directly, \phi_e passes its Gödel number to Q and returns the result. Assume for contradiction that F is a set of computable functions such that \emptyset \neq F \neq \mathbf^. Then there are computable functions f \in F and g \notin F. Suppose that the set of indices x such that \phi_x \in F is decidable; then, there exists a function Q(x,y) that returns g(y) if \phi_x \in F, and f(y) otherwise. By the corollary to the recursion theorem, there is an index e such that \phi_e(y) returns Q(e,y). But then, if \phi_e \in F, then \phi_e is the same function as g, and therefore \phi_e \notin F; and if \phi_e \notin F, then \phi_e is f, and therefore \phi_e \in F. In both cases, we have a contradiction.


Proof by reduction from the halting problem


Proof sketch

Suppose, for concreteness, that we have an algorithm for examining a program ''p'' and determining infallibly whether ''p'' is an implementation of the squaring function, which takes an integer ''d'' and returns ''d''2. The proof works just as well if we have an algorithm for deciding any other nontrivial property of program behavior (i.e. a semantic and non-trivial property), and is given in general below. The claim is that we can convert our algorithm for identifying squaring programs into one that identifies functions that halt. We will describe an algorithm that takes inputs ''a'' and ''i'' and determines whether program ''a'' halts when given input ''i''. The algorithm for deciding this is conceptually simple: it constructs (the description of) a new program ''t'' taking an argument ''n'', which (1) first executes program ''a'' on input ''i'' (both ''a'' and ''i'' being hard-coded into the definition of ''t''), and (2) then returns the square of ''n''. If ''a''(''i'') runs forever, then ''t'' never gets to step (2), regardless of ''n''. Then clearly, ''t'' is a function for computing squares if and only if step (1) terminates. Since we've assumed that we can infallibly identify programs for computing squares, we can determine whether ''t'', which depends on ''a'' and ''i'', is such a program; thus we have obtained a program that decides whether program ''a'' halts on input ''i''. Note that our halting-decision algorithm never executes ''t'', but only passes its description to the squaring-identification program, which by assumption always terminates; since the construction of the description of ''t'' can also be done in a way that always terminates, the halting-decision cannot fail to halt either. halts (a,i) This method doesn't depend specifically on being able to recognize functions that compute squares; as long as ''some'' program can do what we're trying to recognize, we can add a call to ''a'' to obtain our ''t''. We could have had a method for recognizing programs for computing square roots, or programs for computing the monthly payroll, or programs that halt when given the input "Abraxas"; in each case, we would be able to solve the halting problem similarly.


Formal proof

For the formal proof, algorithms are presumed to define partial functions over strings and are themselves represented by strings. The partial function computed by the algorithm represented by a string ''a'' is denoted F''a''. This proof proceeds by
reductio ad absurdum In logic, (Latin for "reduction to absurdity"), also known as (Latin for "argument to absurdity") or ''apagogical arguments'', is the form of argument that attempts to establish a claim by showing that the opposite scenario would lead to absu ...
: we assume that there is a non-trivial property that is decided by an algorithm, and then show that it follows that we can decide the
halting problem In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. Alan Turing proved in 1936 that a ...
, which is not possible, and therefore a contradiction. Let us now assume that ''P''(''a'') is an algorithm that decides some non-trivial property of F''a''. Without loss of generality we may assume that ''P''(''no-halt'') = "no", with ''no-halt'' being the representation of an algorithm that never halts. If this is not true, then this holds for the negation of the property. Since ''P'' decides a non-trivial property, it follows that there is a string ''b'' that represents an algorithm and ''P''(''b'') = "yes". We can then define an algorithm ''H''(''a'', ''i'') as follows: :1. construct a string ''t'' that represents an algorithm ''T''(''j'') such that :* ''T'' first simulates the computation of F''a''(''i''), :* then ''T'' simulates the computation of F''b''(''j'') and returns its result. :2. return ''P''(''t''). We can now show that ''H'' decides the halting problem: * Assume that the algorithm represented by ''a'' halts on input ''i''. In this case F''t'' = F''b'' and, because ''P''(''b'') = "yes" and the output of ''P''(''x'') depends only on F''x'', it follows that ''P''(''t'') = "yes" and, therefore ''H''(''a'', ''i'') = "yes". * Assume that the algorithm represented by ''a'' does not halt on input ''i''. In this case F''t'' = F''no-halt'', i.e., the partial function that is never defined. Since ''P''(''no-halt'') = "no" and the output of ''P''(''x'') depends only on F''x'', it follows that ''P''(''t'') = "no" and, therefore ''H''(''a'', ''i'') = "no". Since the halting problem is known to be undecidable, this is a contradiction and the assumption that there is an algorithm ''P''(''a'') that decides a non-trivial property for the function represented by ''a'' must be false.


Rice's theorem and index sets

Rice's theorem can be succinctly stated in terms of index sets:
Let \mathcal be a class of partial recursive functions with
index set In mathematics, an index set is a set whose members label (or index) members of another set. For instance, if the elements of a set may be ''indexed'' or ''labeled'' by means of the elements of a set , then is an index set. The indexing consists ...
C. Then C is recursive if and only if C = \varnothing or C = \mathbb.
Here \mathbb is the set of
natural numbers In mathematics, the natural numbers are those numbers used for counting (as in "there are ''six'' coins on the table") and ordering (as in "this is the ''third'' largest city in the country"). Numbers used for counting are called '' cardinal ...
, including
zero 0 (zero) is a number representing an empty quantity. In place-value notation such as the Hindu–Arabic numeral system, 0 also serves as a placeholder numerical digit, which works by Multiplication, multiplying digits to the left of 0 by th ...
.


An analogue of Rice's theorem for recursive sets

One can regard Rice's theorem as asserting the impossibility of effectively deciding for any ''recursively enumerable'' set whether it has a certain nontrivial property. In this section, we give an analogue of Rice's theorem for
recursive set In computability theory, a set of natural numbers is called computable, recursive, or decidable if there is an algorithm which takes a number as input, terminates after a finite amount of time (possibly depending on the given number) and correctly ...
s'','' instead of recursively enumerable sets. Roughly speaking, the analogue says that if one can effectively determine for every ''recursive'' set whether it has a certain property, then only finitely many integers determine whether a recursive set has the property. This result is analogous to the original theorem of Rice, because both results assert that a property is "decidable" only if one can determine whether a set has that property by examining ''for at most finitely many i'' (for no i, for the original theorem), if i belongs to the set. Let W be a class (called a ''simple game'' and thought of as a property) of recursive sets. If S is a recursive set, then for some e, computable function \phi_e is the characteristic function of S. We call e a ''characteristic index'' for S. (There are infinitely many such e.) Let's say the class W is ''computable'' if there is an algorithm (computable function) that decides for any nonnegative integer e (not necessarily a characteristic index), * if e is a characteristic index for a recursive set belonging to W, then the algorithm gives "yes"; * if e is a characteristic index for a recursive set not belonging to W, then the algorithm gives "no". A set S\subseteq \mathbb ''extends'' a string \tau of 0's and 1's if for every k< , \tau, (the length of \tau), the kth element of \tau is 1 if k\in S; and is 0 otherwise. For example, S=\ extends the string 01011001. A string \tau is ''winning determining'' if every recursive set extending \tau belongs to W. A string \tau is ''losing determining'' if no recursive set extending \tau belongs to W. We can now state the following ''analogue of Rice's theorem'': A class W of recursive sets is computable if and only if there are a recursively enumerable set T_0 of losing determining strings and a recursively enumerable set T_1 of winning determining strings such that every recursive set extends a string in T_0\cup T_1. This result has been applied to foundational problems in
computational social choice Computational social choice is a field at the intersection of social choice theory, theoretical computer science, and the analysis of multi-agent systems. It consists of the analysis of problems arising from the aggregation of preferences of a grou ...
(more broadly,
algorithmic game theory Algorithmic game theory (AGT) is an area in the intersection of game theory and computer science, with the objective of understanding and design of algorithms in strategic environments. Typically, in Algorithmic Game Theory problems, the input to ...
). For instance, Kumabe and Mihara apply this result to an investigation of the
Nakamura number In cooperative game theory and social choice theory, the Nakamura number measures the degree of rationality of preference aggregation rules (collective decision rules), such as voting rules. It is an indicator of the extent to which an aggregation r ...
s for simple games in
cooperative game theory In game theory, a cooperative game (or coalitional game) is a game with competition between groups of Player (game), players ("coalitions") due to the possibility of external enforcement of cooperative behavior (e.g. through contract law). Those ...
and
social choice theory Social choice theory or social choice is a theoretical framework for analysis of combining individual opinions, preferences, interests, or welfares to reach a ''collective decision'' or ''social welfare'' in some sense.Amartya Sen (2008). "Soci ...
.


See also

*
Gödel's incompleteness theorems Gödel's incompleteness theorems are two theorems of mathematical logic that are concerned with the limits of in formal axiomatic theories. These results, published by Kurt Gödel in 1931, are important both in mathematical logic and in the phil ...
*
Halting problem In computability theory, the halting problem is the problem of determining, from a description of an arbitrary computer program and an input, whether the program will finish running, or continue to run forever. Alan Turing proved in 1936 that a ...
*
Recursion theory Computability theory, also known as recursion theory, is a branch of mathematical logic, computer science, and the theory of computation that originated in the 1930s with the study of computable functions and Turing degrees. The field has sinc ...
*
Rice–Shapiro theorem In computability theory, the Rice–Shapiro theorem is a generalization of Rice's theorem, and is named after Henry Gordon Rice and Norman Shapiro Norman Zalmon Shapiro was an American mathematician, who was the co-author of the Rice–Shapiro t ...
*
Scott–Curry theorem In mathematical logic, the Scott–Curry theorem is a result in lambda calculus stating that if two non-empty sets of lambda terms ''A'' and ''B'' are closed under beta-convertibility then they are recursively inseparable. Explanation A set ''A'' ...
, an analogue to Rice's theorem in lambda calculus *
Turing's proof Turing's proof is a proof by Alan Turing, first published in January 1937 with the title "On Computable Numbers, with an Application to the ". It was the second proof (after Church's theorem) of the negation of Hilbert's ; that is, the conjecture ...
*
Wittgenstein on Rules and Private Language ''Wittgenstein on Rules and Private Language'' is a 1982 book by philosopher of language Saul Kripke in which he contends that the central argument of Ludwig Wittgenstein's ''Philosophical Investigations'' centers on a devastating rule-following p ...


Notes


References

* * *


External links

*{{MathWorld, urlname=RicesTheorem, title=Rice's theorem Articles containing proofs Theorems in theory of computation Theorems in the foundations of mathematics Undecidable problems