In computability theory, the Rice–Shapiro theorem is a generalization of Rice's theorem, named after Henry Gordon Rice and Norman Shapiro. It states that when a semi-decidable property of partial computable functions is true on a certain partial function, one can extract a finite subfunction such that the property is still true.
The informal idea of the theorem is that the "only general way" to obtain information on the behavior of a program is to run the program, and because a computation is finite, one can only try the program on a finite number of inputs.
A closely related theorem is the Kreisel-Lacombe-Shoenfield-Tseitin theorem, which was obtained independently by Georg Kreisel, Daniel Lacombe and Joseph R. Shoenfield, and by Grigori Tseitin.
Rice-Shapiro theorem. Let P be a set of partial computable functions such that the index set of P (i.e., the set of indices e such that φe ∈ P, for some fixed admissible numbering φ) is semi-decidable. Then for any partial computable function f, it holds that P contains f if and only if P contains a finite subfunction of f (i.e., a partial function defined in finitely many points, which takes the same values as f on those points).
Kreisel-Lacombe-Shoenfield-Tseitin theorem. Let P be a set of total computable functions such that the index set of P is decidable with a promise that the input is the index of a total computable function (i.e., there is a partial computable function D which, given an index e such that φe is total, returns 1 if φe ∈ P and 0 otherwise; D(e) need not be defined if φe is not total). We say that two total functions f, g "agree until n" if for all k ≤ n it holds that f(k) = g(k). Then for any total computable function f, there exists n such that for all total computable function g which agrees with f until n, f ∈ P ⟺ g ∈ P.
The two theorems are closely related, and also relate to Rice's theorem. Specifically:
By the Rice-Shapiro theorem, it is neither semi-decidable nor co-semi-decidable whether a given program:
By the Kreisel-Lacombe-Shoenfield-Tseitin theorem, it is undecidable whether a given program which is assumed to always terminate:
Let P be a set of partial computable functions with semi-decidable index set.
We first prove that P is an upward closed set, i.e., if f ⊆ g and f ∈ P, then g ∈ P (here, f ⊆ g means that f is a subfunction of g, i.e., the graph of f is contained in the graph of g). The proof uses a diagonal argument typical of theorems in computability.
Assume for contradiction that there are two functions f and g such that f ∈ P, g ∉ P and f ⊆ g. We build a program p as follows. This program takes an input x. Using a standard dovetailing technique, p runs two tasks in parallel.
We distinguish two cases.
Next, we prove that if P contains a partial computable function f, then it contains a finite subfunction of f. Let us fix a partial computable function f in P. We build a program p which takes input x and runs the following steps:
Suppose that φp ∉ P. This implies that the semi-algorithm for semi-deciding P used in the first step never returns true. Then, p computes f, and this contradicts the assumption f ∈ P. Thus, we must have φp ∈ P, and the algorithm for semi-deciding P returns true on p after a certain number of steps n. The partial function φp can only be defined on inputs x such that x ≤ n, and it returns f(x) on such inputs, thus it is a finite subfunction of f that belongs to P.
It only remains to assemble the two parts of the proof. If P contains a partial computable function f, then it contains a finite subfunction of f by the second part, and conversely, if it contains a finite subfunction of f, then it contains f, because it is upward closed by the first part. Thus, the theorem is proved.
A total function
h:N\rarrN
We fix U a computable enumeration of all total functions which are ultimately zero, that is, U is such that:
We can build U by standard techniques (e.g., for increasing N, enumerate ultimately zero functions which are bounded by N and zero on inputs larger than N).
Let P be as in the statement of the theorem: a set of total computable functions such that there is an algorithm which, given an index e and a promise that φe is computable, decides whether φe ∈ P.
We first prove a lemma: For all total computable function f, and for all integer N, there exists an ultimately zero function h such that h agrees with f until N, and f ∈ P ⟺ h ∈ P.
To prove this lemma, fix a total computable function f and an integer N, and let B be the boolean f ∈ P. Build a program p which takes input x and takes these steps:
Clearly, p always terminates, i.e., φp is total. Therefore, the promise to P run on p is fulfilled.
Suppose for contradiction that one of f and φp belongs to P and the other does not, i.e., (φp ∈ P) ≠ B. Then we see that p computes f, since P does not return B on p no matter the amount of steps. Thus, we have f = φp, contradicting the fact that one of f and φp belongs to P and the other does not. This argument proves that f ∈ P ⟺ φp ∈ P. Then, the second step makes p return zero for sufficiently large x, thus φp is ultimately zero; and by construction (due to the first step), φp agrees with f until N. Therefore, we can take h = φp and the lemma is proved.
With the previous lemma, we can now prove the Kreisel-Lacombe-Shoenfield-Tseitin theorem. Again, fix P as in the theorem statement, let f a total computable function and let B be the boolean "f ∈ P". Build the program p which takes input x and runs these steps:
We first prove that P returns B on p. Suppose by contradiction that this is not the case (P returns ¬B, or P does not terminate). Then p actually computes f. In particular, φp is total, so the promise to P when run on p is fulfilled, and P returns the boolean φp ∈ P, which is f ∈ P, i.e., B, contradicting the assumption.
Let n be the number of steps that P takes to return B on p. We claim that n satisfies the conclusion of the theorem: for all total computable function g which agrees with f until n, it holds that f ∈ P ⟺ g ∈ P. Assume by contradiction that there exists g total computable which agrees with f until n and such that (g ∈ P) ≠ B.
Applying the lemma again, there exists k such that U(k) agrees with g until n and g ∈ P ⟺ U(k) ∈ P. For such k, U(k) agrees with g until n and g agrees with f until n, thus U(k) also agrees with f until n, and since (g ∈ P) ≠ B and g ∈ P ⟺ U(k) ∈ P, we have (U(k) ∈ P) ≠ B. Therefore, U(k) satisfies the conditions of the parallel search step in the program p, namely: U(k) agrees with f until n and (U(k) ∈ P) ≠ B. This proves that the search in the second step always terminates. We fix k to be the value that it finds.
We observe that φp = U(k). Indeed, either the second step of p returns U(k)(x), or the third step returns f(x), but the latter case only happens for x ≤ n, and we know that U(k) agrees with f until n.
In particular, φp = U(k) is total. This makes the promise to P run on p fulfilled, therefore P returns φp ∈ P on p.
We have found a contradiction: one the one hand, the boolean φp ∈ P is the return value of P on p, which is B, and on the other hand, we have φp = U(k), and we know that (U(k) ∈ P) ≠ B.
For any finite unary function
\theta
C(\theta)
\theta
\theta
Equip the set of all partial-recursive functions with the topology generated by thesefrusta as base. Note that for every frustum
C
Ix(C)
A
Ix(A)
A
The Kreisel-Lacombe-Shoenfield-Tseitin theorem has been applied to foundational problems in computational social choice (more broadly, algorithmic game theory). For instance, Kumabe and Mihara apply this result to an investigation of the Nakamura numbers for simple games in cooperative game theory and social choice theory.
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]