Rice's theorem #
Every nontrivial property of the behavior of machines is undecidable on their descriptions
(Turing.MultiTapeTM.rice) Rice Sipser, Problem 5.28. The behavior of
the machine described by a word w (Turing.MultiTapeTM.behavior) relates each input of bits on
which it halts to the output it halts with; a property of behaviors is nontrivial when the
machine described by some word has it and the machine described by another does not. Equivalently,
a set of words that depends only on the behavior of the machines they describe, and is neither
empty nor everything, is undecidable (Turing.MultiTapeTM.not_isDecidable_of_behavior).
The proof goes through the two-way case of Kleene's recursion theorem
(Turing.MultiTapeTM.exists_behavior_eq) Sipser, Theorem 6.3: for every computable
verdict f on words and descriptions d false and d true, some word e describes a machine
behaving as d (f e). The full theorem allows any computable transformation of descriptions in
place of the choice between d false and d true; the choice is all that Rice's theorem needs.
Applied to a decider of the property, with d true outside the property and d false inside it,
it gives a word describing a machine inside the property exactly when it is outside. For each
input of bits x, halting on x is such a property (Turing.MultiTapeTM.not_isDecidable_halts),
the native form of Mathlib's ComputablePred.halting_problem.
The recursion theorem is Kleene's construction, from two constructions on descriptions. The s-m-n
theorem builds an input prefix into a description (Turing.MultiTapeTM.Universal.hardwire), in
polynomial time. Dispatching (Turing.MultiTapeTM.Universal.dispatch) runs a machine computing a
total function, keeping its output on a work tape, and then runs d b on that output without its
first bit b (Turing.MultiTapeTM.Universal.Desc.computes_dispatch). Let t describe the
machine that reads a word y before its input x and dispatches on f (s y) :: x, where s y
describes the machine described by y with y built in. Then e = s t describes a machine that
runs the machine described by t on y = t and x, so behaves as d (f (s t)). No universal
machine is needed: d false and d true are fixed, and their transitions are part of the
description of the dispatching machine, reading their input from the work tape as in
Turing.MultiTapeTM.Universal.Redirect.redirect.
Main definitions #
Turing.MultiTapeTM.behavior: the behavior of the machine described by a word.Turing.MultiTapeTM.Universal.dispatch: dispatching on the first bit computed by a machine.
Main results #
Turing.MultiTapeTM.Universal.Desc.computes_dispatch: the behavior of a dispatching machine.Turing.MultiTapeTM.exists_behavior_eq: the two-way case of the recursion theorem.Turing.MultiTapeTM.rice,Turing.MultiTapeTM.not_isDecidable_of_behavior: Rice's theorem.Turing.MultiTapeTM.not_isDecidable_halts: halting on a fixed input is undecidable.
References #
Finding transitions #
The transition found in the description of a machine is the renamed transition of the machine.
The key read in a well-shaped configuration of the simulation is the key of the configuration it represents.
Dispatching on a computed bit #
The action on the virtual input tape writing there the symbol o emitted by a transition.
Instances For
The states of the description d b in Turing.MultiTapeTM.Universal.dispatch.
Instances For
The number of work tapes of the two descriptions.
Instances For
The transitions of tm, in the states 4 * q + 1, writing its output on the virtual input
tape, and moving to the state 4 when tm halts.
Instances For
Rewinding the virtual input tape, in the state 4, and branching on its first symbol in the
state 8: the symbol becomes the marker, and the input head moves onto the blank left of the
input.
Instances For
Dispatching on a computed bit. The description runs the machine tm, buffering its output
on a new first work tape, the virtual input tape; when tm halts with output b :: v and blank
work tapes, as after a tidy computation, it runs the description d b on v, reading it from the
virtual input tape (Turing.MultiTapeTM.Universal.Desc.computes_dispatch).
Instances For
Each transition writing the marker, rewinding or branching is the one found for its key.
For the states of tm, the transitions found are those of tm, writing the output on the
virtual input tape.
For the states of d b and an input head reading a blank, the transitions found are those of
d b, redirected.
Running tm #
A step of tm is a step of dispatch eS tm d, which emits nothing.
While the description of tm runs, dispatch eS tm d runs it after writing the marker.
The run of tm on w, from a tidy computation: the description of tm runs, with a
transition for every key it meets, until it halts with the input head on the first symbol, blank
work tapes and the output b :: v.
Dispatching on a computed bit: if tm computes b :: v from w tidily, then
dispatch eS tm d halts on w with output o exactly when d b halts on v with output o.
The recursion theorem and Rice's theorem #
Building the description of a word into itself, as an input prefix, is computable in polynomial time.
Kleene's recursion theorem, in its two-way case. For every computable verdict f on words
and descriptions d false, d true, some word e describes a machine behaving on inputs of bits
as d (f e) does: a machine can make its whole behavior depend on a computable verdict about its
own description. The full recursion theorem allows any computable transformation of descriptions
in place of the choice between d false and d true. The proof is Kleene's construction: a
machine reads a word y before its input, computes the verdict on the description of the machine
described by y with y built in, and dispatches on it; e is that description for y the
description of the machine itself.
Rice's theorem. Every nontrivial property of the behavior of machines is undecidable on
their descriptions: if C contains the behavior of the machine described by some word and not that
of the machine described by another, then the set of words describing machines whose behavior is
in C is undecidable Rice Sipser, Problem 5.28.
Rice's theorem, for sets of words. A set of words that holds of a word or not according to
the behavior of the machine it describes, and is neither empty nor everything, is undecidable.
This is the counterpart of Mathlib's ComputablePred.rice₂ for partial recursive codes.
Halting on a fixed input #
Halting on a fixed input is undecidable: for every input of bits x, no computable
function decides, of a word, whether the machine it describes halts on x. This is the native
counterpart of Mathlib's ComputablePred.halting_problem, a corollary of Rice's theorem.