Rice's Theorem

We proved that the halting problem is not decidable, that is, that the set of Gödel numbers of register machines that halt on the empty input is not a decidable set.

Rice's theorem says that the set of Gödel numbers of register machines that solve any nontrivial problem whatsoever is also undecidable.

Obviously, the set of Gödel numbers of register machines that have an even number of steps, or that use exactly seven registers, or that have only three jump instructions, and so forth, are decidable sets.

We are interested in what sets are decidable, r.e., and the like.

We are interested in using, for example, register machines, to decide and list and so forth sets of strings.

We are not interested in the details of a program, just in its results.

ProtoDefinition. A set of strings is an index set if whenever two strings code register machines that exhibit the same behavior, then both are in the set or both are out of the set.

We can think of an index set as specifying, not a group of machines, but a group of machine behaviors.

For example, the set of Gödel numbers of machines with an even number of steps is not an index set, while the set of machines that halts is an index set.

There are many possible definitions of behavior for which the theorem works.
Definitions. Two machines exhibit the same behavior if

Finally, the best one:

A set that is an index set in the first sense is an index set in the last: It only must either have all machines that halt in or all machines that halt out, and so any two machines that do exactly the same thing in the last sense certainly both halt or not, and so both are in the set or not. Thus, all sets that index sets in any of the senses are index sets in the last sense; it is the broadest. That is, every set that is an index set in any of the senses is an index set in this one, so a theorem about all index sets in this last sense, will include such a theorem about index sets in the other senses.

This gives us the strongest theorem.

Finally, a couple of definitions:

Definition Register machine program $P$ is equivalent to register machine $Q$ if they are machines for the same alphabet and for all $n$ for all inputs of $n$ strings they print the same outputs in the same order and one halts if and only if the other does.

Definition A set of strings in the language in which we encode register machines is an index set if whenever machines $P$ and $Q$ are equivalent, $P$ is in the set if and only if $Q$ is.

Of course, the reference to register machines is inessential. As usual, all we really need is a universal member of a set of codes, an $s$-$m$$n$ and that a few simple functions are computable.

Definition The trivial index sets are

Definition $E$ is the index set of G&omul;del numbers for all machines that do not halt and produce no output.

Note that all machines in $E$ are equivalent, and so every index set includes all of $E$ as a subset or else none of $E$.

Rice's Lemma Any nontrivial index set of which $E$ is not a subset is not decidable.

Proof: We prove the lemma by reducing to the halting problem. Let $I$ be an index set as specified. Then there is a machine $P$ in $I$ that on some input or other, does something besides run forever with no output, and no machine in $I$ runs forever with no output.

We need an algorithm that, given a machine $Q$ decides whether it halts on the empty input. There is a function from (Gödel numbers of) machines to () machines that does the following on input $i$:

First, take $Q$ and delete all the PRINT statements. The resulting program $Q_{o}$ produces no output and halts if and only if $Q$ does.

Now, the desired program operates as follows: First, run $Q_{o}$ on the empty input, then, afterward (we never get there if $Q_{o}$ doesn't halt), run $P$ on input $i$.

That is it. What does that program do? If $Q$ doesn't halt, the program runs forever with no output on any input. If $Q$ does halt, it exhibits the same behavior as $P$. Thus, this program is in $I$ if and only if $Q$ halts. So, since the halting problem is not decidable, neither is $I$.

$\qed$

Now, Rice's theorem: we need to handle index sets that have $E$ as a subset. A set is decidable if and only if its complement is decidable. We already showed that the complement of any index set that has $E$ as a subset is not decidable as part of the lemma.

(Annoying details: The complement of an index set that has $E$ as a subset does not have $E$ as a subset, but it is not quite an index set: it includes not only all the () machines that exhibit other behavior, but also all the garbage strings that do not code machines. However, it is decidable whether or not a string codes a machine, and so if the complement is decidable, so is the subset of it that consists only of strings that code machines—since the intersection of decidable sets is decidable. That subset is not decidable by Rice's lemma.)

Corollaries.

It is not decidable whether a machine has any output.

It is not decidable whether a machine has exactly one output.

It is not decidable whether a machine has a particular string as an output.

It is not decidable whether a machine has finitely many outputs.

Though the theorem proved dealt only with using () register machines, one can prove "the same" theorem for any definition of recursive, and indeed for other definitions for which there is a universal "machine" and an $s$-$m$-$n$ theorem.

Examples: We produced formulas that allow representations, and so it is not decidable whether a formula is satisfiable, is satisfiable by a particular number, is satisfiable by only finitely many numbers, ... .

We have notions of relative recursion: suppose we pick an index set and allow our programs to use an oracle for it. Thus, for example, we add to our register machine language a new command:

GUESSHALT n

The machine jumps to step n if the content of register 0 is () a machine that halts, otherwise it just goes to the next instruction.

The sets "decidable" using such oracle machines are far more than the just the really decidable sets, since, obviously, the halting problem is "decidable" for such machines. We have a new notion of index set, ... . Rice's theorem can be proved here too.

You can even invent various notions of machines that take real numbers, not just strings as inputs. Rice's theorem again.

-- ProfessorShaughanLavine? - 27 Apr 2005