Rice's Theorem
Rice’s Theorem: Rice’s Theorem asserts: Theorem. Every non-trivial partitioning of the space of Turing machine codes based on the languages recognized by these Turing machines is undecidable.
Rice’s Theorem is, basically, a general statement about the undecidability of non-trivial partitions one can erect on Turing machine codes based on the language that the corresponding Turing machines accept. Stated another way, Rice’s Theorem asserts the impossibility of building an algorithmic classifier for Turing machine codes (“programs”) based on the language recognized by these Turing machines, if the classification attempted is anything but trivial (a trivial partition puts all the Turing machines into one or the other bin).
Relating these notions more to real-world programs, consider the language L consisting of all ASCII character sequences s1, s2, . . . such that each si is a C program ci. Now suppose that each ci, when run on inputs from {0, 1},∗ accepts only those sequences that describe a regular set. Rice’s Theorem says that languages such as L are not decidable. In other words, it is impossible to classify all C programs (or equivalently TMs) into those whose languages are regular and those whose languages are non-regular. Mathematically, given a property P, consider the set
L = {M | M is a Turing machine and P(Lang(M))}.
Furthermore, let P be non-trivial — meaning, it is neither ∅ nor Σ∗. For example, P could be “Regular”; since there are TMs that encode regular sets and there are TMs that do not encode regular sets, P represents a non-trivial partition over TR languages. Rice’s Theorem asserts that sets such as L above are undecidable.
Failing proof attempt
For the ease of exposition, we present, as a special case of Rice’s Theorem, the proof of Rice’s Theorem for P = Regular. Our first proof attempt will fail because of a small technical glitch. The glitch is caused by ∅ ∈ P, or in other words, allowing P(∅). In our special case proof, this glitch manifests in the form of ∅ ∈ Regular, as we are proving for the special case of P = Regular. We fix this glitch in Section 17.2.1.
Proof, with a small glitch, of a special case of Rice’s Theorem: By contradiction, assume that L has a decider, namely DL. The Turing machine DL is capable of classifying Turing machine codes into those whose languages pass the predicate test Regular. As noted earlier, Regular is a non-trivial property. Therefore, given DL, it should be possible to find at least one Turing machine— say N — whose language is regular (it does not matter which Turing machine this is). In particular, algorithm Manifest N is: