Reading preferences
Optional display controls need JavaScript. All reading content and navigation work without it.
Source file content/turing-machines/undecidability/undecidability.tex
Source file content/turing-machines/undecidability/introduction.tex
Introduction
It might seem obvious that not every function, even every arithmetical function, can be computable. There are just too many, whose behavior is too complicated. Functions defined from the decay of radioactive particles, for instance, or other chaotic or random behavior. Suppose we start counting 1-second intervals from a given time, and define the function source as the number of particles in the universe that decay in the source-th 1-second interval after that initial moment. This seems like a candidate for a function we cannot ever hope to compute.
But it is one thing to not be able to imagine how one would compute such functions, and quite another to actually prove that they are uncomputable. In fact, even functions that seem hopelessly complicated may, in an abstract sense, be computable. For instance, suppose the universe is finite in time---some day, in the very distant future the universe will contract into a single point, as some cosmological theories predict. Then there is only a finite (but incredibly large) number of seconds from that initial moment for which source is defined. And any function which is defined for only finitely many inputs is computable: we could list the outputs in one big table, or code it in one very big Turing machine state transition diagram.
We are often interested in special cases of functions whose values give the answers to yes/no questions. For instance, the question “is source a prime number?” is associated with the function
We say that a yes/no question can be effectively decided, if the associated source-valued function is effectively computable.
To prove mathematically that there are functions which cannot be effectively computed, or problems that cannot effectively decided, it is essential to fix a specific model of computation, and show that there are functions it cannot compute or problems it cannot decide. We can show, for instance, that not every function can be computed by Turing machines, and not every problem can be decided by Turing machines. We can then appeal to the Church--Turing thesis to conclude that not only are Turing machines not powerful enough to compute every function, but no effective procedure can.
The key to proving such negative results is the fact that we can assign numbers to Turing machines themselves. The easiest way to do this is to enumerate them, perhaps by fixing a specific way to write down Turing machines and their programs, and then listing them in a systematic fashion. Once we see that this can be done, then the existence of Turing-uncomputable functions follows by simple cardinality considerations: the set of functions from source to source (in fact, even just from source to source) are non-enumerable, but since we can enumerate all the Turing machines, the set of Turing-computable functions is only denumerable.
We can also define specific functions and problems which we can prove to be uncomputable and undecidable, respectively. One such problem is the so-called Halting Problem. Turing machines can be finitely described by listing their instructions. Such a description of a Turing machine, i.e., a Turing machine program, can of course be used as input to another Turing machine. So we can consider Turing machines that decide questions about other Turing machines. One particularly interesting question is this: “Does the given Turing machine eventually halt when started on input source?” It would be nice if there were a Turing machine that could decide this question: think of it as a quality-control Turing machine which ensures that Turing machines don't get caught in infinite loops and such. The interesting fact, which Turing proved, is that there cannot be such a Turing machine. There cannot be a single Turing machine which, when started on input consisting of a description of a Turing machine source and some number source, will always halt with either output source or source according to whether source machine would have halted when started on input source or not.
Once we have examples of specific undecidable problems we can use them to show that other problems are undecidable, too. For instance, one celebrated undecidable problem is the question, “Is the first-order formula source valid?”. There is no Turing machine which, given as input a first-order formula source, is guaranteed to halt with output source or source according to whether source is valid or not. Historically, the question of finding a procedure to effectively solve this problem was called simply “the” decision problem; and so we say that the decision problem is unsolvable. Turing and Church proved this result independently at around the same time, so it is also called the Church--Turing Theorem.
Source file content/turing-machines/undecidability/enumerating-tms.tex
Enumerating Turing Machines
Explain
We can show that the set of all Turing machines is enumerable. This follows from the fact that each Turing machine can be finitely described. The set of states and the tape vocabulary are finite sets. The transition function is a partial function from source to source, and so likewise can be specified by listing its values for the finitely many argument pairs for which it is defined.
This is true as far as it goes, but there is a subtle difference. The definition of Turing machines made no restriction on what elements the set of states and tape alphabet can have. So, e.g., for every real number, there technically is a Turing machine that uses that number as a state. However, the behavior of the Turing machine is independent of which objects serve as states and vocabulary. Consider the two Turing machines in link to figure Variants of the Even machine.
Undecidability figure
Figure containing two behaviorally equivalent Even-machine diagrams with renamed states and tape symbols.
Source transcription
Turing machine state diagram
First Even-machine variant, using states q zero and q one with stroke and blank tape symbols. State diagram. Purpose: Shows the Even-machine transition pattern before renaming, with initial state q zero and state q one. Initial state: state q sub zero. States: state q sub zero, state q sub one. Transition one: from state q sub zero, when reading stroke symbol, write stroke symbol, move right, and enter state q sub one. Transition two: from state q sub one, when reading blank symbol, write blank symbol, move right, and enter state q sub one. Transition three: from state q sub one, when reading stroke symbol, write stroke symbol, move right, and enter state q sub zero. Every displayed state has at least one outgoing transition
Source transcription
[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm, semithick] tikzstyleevery state=[fill=none,draw=black,text=black]
node[initial,state] (A) source; node[state] (B) [right of=A] source;
path (A) edge [bend left] node TMtransTMstrokeTMstrokeTMright (B) (B) edge [loop above] node TMtransTMblankTMblankTMright (B) edge [bend left] node TMtransTMstrokeTMstrokeTMright (A);
\\
Turing machine state diagram
Second Even-machine variant, using states s and h and capital A in place of the stroke symbol. State diagram. Purpose: Shows the same transition pattern after renaming the states and stroke symbol. Initial state: state s. States: state s, state h. Transition one: from state s, when reading capital A symbol, write capital A symbol, move right, and enter state h. Transition two: from state h, when reading blank symbol, write blank symbol, move right, and enter state h. Transition three: from state h, when reading capital A symbol, write capital A symbol, move right, and enter state s. Every displayed state has at least one outgoing transition
Source transcription
[->,>=stealth',shorten >=1pt,auto,node distance=2.8cm, semithick] tikzstyleevery state=[fill=none,draw=black,text=black]
node[initial,state] (A) source; node[state] (B) [right of=A] source;
path (A) edge [bend left] node TMtransAATMright (B) (B) edge [loop above] node TMtransTMblankTMblankTMright (B) edge [bend left] node TMtransAATMright (A);
captionVariants of the Even machine
These two diagrams correspond to two machines, source with the tape alphabet source and set of states source, and source with alphabet source and states source. But their instructions are otherwise the same: source will halt on a sequence of source source's iff source is even, and source will halt on a sequence of source source's iff source is even. All we've done is rename source to source, source to source, and source to source. This example generalizes: we can think of Turing machines as the same as long as one results from the other by such a renaming of symbols and states. In fact, we can simply think of the symbols and states of a Turing machine as positive integers: instead of source think source, instead of source think source, etc.; source is source, source is source, etc. In this way, the Even machine becomes the machine depicted in link to figure A standard Even machine.
Undecidability figure
Figure containing the standardized positive-integer encoding of the Even machine.
Source transcription
Turing machine state diagram
Standard Even-machine diagram with states one and two and encoded tape symbols two and three. State diagram. Purpose: Shows the same Even-machine behavior after replacing every state and symbol by a positive-integer code. Initial state: state one. States: state one, state two. Transition one: from state one, when reading three, write three, move right, and enter state two. Transition two: from state two, when reading two, write two, move right, and enter state two. Transition three: from state two, when reading three, write three, move right, and enter state one. Every displayed state has at least one outgoing transition
captionA standard Even machine
We might call a Turing machine with states and symbols that are positive integers a standard machine, and only consider standard machines from now on.Footnote: The terminology “standard machine” is not standard.
We wanted to show that the set of Turing machines is enumerable, and with the above considerations in mind, it is enough to show that the set of standard Turing machines is enumerable. Suppose we are given a standard Turing machine source. How could we describe it using a finite string of positive integers? We'll first list the number of states, the states themselves, the number of symbols, the symbols themselves, and the starting state. (Remember, all of these are positive integers, since source is a standard machine.) What about source? The set of possible arguments, i.e., pairs source, is finite, since source and source are finite. So the information in source is simply the finite list of all source-tuples source where source, and source is a number that codes the direction source (say, source for source, source for source, and source for source).
In this way, every standard Turing machine can be described by a finite list of positive integers, i.e., as a sequence source. For instance, the standard Even machine is coded by the sequence
Undecidability theorem
There are functions from source to source which are not Turing computable.
Proof
We know that the set of finite sequences of positive integers source is enumerable (link to exercise on enumerating finite sequences of positive integers). This gives us that the set of descriptions of standard Turing machines, as a subset of source, is itself enumerable. Every Turing computable function source to source is computed by some (in fact, many) Turing machines. By renaming its states and symbols to positive integers (in particular, source as source, source as source, and source as source) we can see that every Turing computable function is computed by a standard Turing machine. This means that the set of all Turing computable functions from source to source is also enumerable.
On the other hand, the set of all functions from source to source is not enumerable (link to exercise showing functions from natural numbers to natural numbers are nonenumerable). If all functions were computable by some Turing machine, we could enumerate the set of all functions by listing all the descriptions of Turing machines that compute them. So there are some functions that are not Turing computable.
Unsolved undecidability exercise
Can you think of a way to describe Turing machines that does not require that the states and alphabet symbols are explicitly listed? You may define your own notion of “standard” machine, but say something about why every Turing machine can be computed by a “standard” machine in your new sense.
Source file content/turing-machines/undecidability/universal-tm.tex
Universal Turing Machines
In link to section Enumerating Turing Machines we discussed how every Turing machine can be described by a finite sequence of integers. This sequence encodes the states, alphabet, start state, and instructions of the Turing machine. We also pointed out that the set of all of these descriptions is enumerable. Since the set of such descriptions is denumerable, this means that there is a surjective function from source to these descriptions. Such a surjective function can be obtained, for instance, using Cantor's zig-zag method. It gives us a way of enumerating all (descriptions) of Turing machines. If we fix one such enumeration, it now makes sense to talk of the sourcest, sourcend, dots, sourceth Turing machine. These numbers are called indices.
Undecidability definition
If source is the sourceth Turing machine (in our fixed enumeration), we say that source is an index of source. We write source for the sourceth Turing machine.
A machine may have more than one index, e.g., two descriptions of source may differ in the order in which we list its instructions, and these different descriptions will have different indices.
Importantly, it is possible to give the enumeration of Turing machine descriptions in such a way that we can effectively compute the description of source from its index, and to effectively compute an index of a machine source from its description. By the Church--Turing thesis, it is then possible to find a Turing machine which recovers the description of the Turing machine with index source and writes the corresponding description on its tape as output. The description would be a sequence of blocks of source's (representing the positive integers in the sequence describing source).
Given this, it now becomes natural to ask: what functions of Turing machine indices are themselves computable by Turing machines? What properties of Turing machine indices can be decided by Turing machines? An example: the function that maps an index source to the number of states the Turing machine with index source has, is computable by a Turing machine. Here's what such a Turing machine would do: started on a tape containing a single block of source source's, it would first decode source into its description. The description is now represented by a sequence of blocks of source's on the tape. Since the first element in this sequence is the number of states. So all that has to be done now is to erase everything but the first block of source's and then halt.
A remarkable result is the following:
Undecidability theorem
There is a universal Turing machine source which, when started on input source
source thus computes the function source given by source if source started on input source halts with output source, and undefined otherwise.
Proof
To actually produce source is basically impossible, since it is an extremely complicated machine. But we can describe in outline how it works, and then invoke the Church--Turing thesis. When it starts, source's tape contains a block of source source's followed by a block of source source's. It first “decodes” the index source to the right of the input source. This produces a list of numbers (i.e., blocks of source's separated by source's) that describes the instructions of machine source. source then writes the number of the start state of source and the number source on the tape to the right of the description of source. (Again, these are represented in unary, as blocks of source's.) Next, it copies the input (block of source source's) to the right---but it replaces each source by a block of three source's (remember, the number of the source symbol is source, source being the number of source and source being the number of source). At the left end of this sequence of blocks (separated by source symbols on the tape of source), it writes a single source, the code for source.
source now has on its tape: the index source, the number source, the code number of the start state (the “current state”), the number of the initial head position source (the “current head position”), and the initial contents of the “tape” (a sequence of blocks of source's representing the code numbers of the symbols of source---the “symbols”---separated by source's).
It now simulates what source would do if started on input source, by doing the following:
Find the number source of the “current head position” (at the beginning, that's source),
Move to the sourceth block in the “tape” to see what the “symbol” there is,
Find the instruction matching the current “state” and “symbol,”
Move back to the sourceth block on the “tape” and replace the “symbol” there with the code number of the symbol source would write,
Move the head to where it records the current “state” and replace the number there with the number of the new state,
Move to the place where it records the “tape position” and erase a source or add a source (if the instruction says to move left or right, respectively).
Repeat.Footnote: We're glossing over some subtle difficulties here. E.g., source may need some extra space when it increases the counter where it keeps track of the “current head position”---in that case it will have to move the entire “tape” to the right.
If source started on input source never halts, then source also never halts, so its output is undefined.
If in step link to the universal-machine simulation step that finds a matching instruction it turns out that the description of source contains no instruction for the current “state”/“symbol” pair, then source would halt. If this happens, source erases the part of its tape to the left of the “tape.” For each block of three source's (representing a source on source's tape), it writes a source on the left end of its own tape, and successively erases the “tape.” When this is done, source's tape contains a single block of source's of length source.
If source encounters something other than a block of three source's on the “tape,” it immediately halts. Since source's tape in this case does not contain a single block of source's, its output is not a natural number, i.e., source is undefined in this case.
Source file content/turing-machines/undecidability/halting-problem.tex
The Halting Problem
Explain
Assume we have fixed some enumeration of Turing machine descriptions. Each Turing machine thus receives an index: its place in the enumeration source, source, source, dots of Turing machine descriptions.
We know that there must be non-Turing-computable functions: the set of Turing machine descriptions---and hence the set of Turing machines---is enumerable, but the set of all functions from source to source is not. But we can find specific examples of non-computable functions as well. One such function is the halting function.
Undecidability definition
[Halting function] The halting function source is defined as
Undecidability definition
[Halting problem] The Halting Problem is the problem of determining (for any source, source) whether the Turing machine source halts for an input of source strokes.
Explain
We show that source is not Turing-computable by showing that a related function, source, is not Turing-computable. This proof relies on the fact that anything that can be computed by a Turing machine can be computed by a disciplined Turing machine (link to section Disciplined Machines), and the fact that two Turing machines can be hooked together to create a single machine (link to section Combining Machines).
Undecidability definition
The function source is defined as
Undecidability lemma
The function source is not Turing computable.
Proof
We suppose, for contradiction, that the function source is Turing computable. Then there would be a Turing machine source that computes source. We may assume, without loss of generality, that when source halts, it does so while scanning the first square (i.e., that it is disciplined). This machine can be “hooked up” to another machine source, which halts if it is started on input source (i.e., if it reads source in the initial state while scanning the square to the right of the end-of-tape symbol), and otherwise wanders off to the right, never halting. source, the machine created by hooking source to source, is a Turing machine, so it is source for some source (i.e., it appears somewhere in the enumeration). Start source on an input of source sources. There are two possibilities: either source halts or it does not halt.
Suppose source halts for an input of source sources. Then source. So source, when started on source, halts with a single source as output on the tape. Then source starts with a source on the tape. In that case source does not halt. But source is the machine source, so it should do exactly what source followed by source would do (i.e., in this case, wander off to the right and never halt). So source cannot halt for an input of source source's.
Now suppose source does not halt for an input of source sources. Then source, and source, when started on input source, halts with a blank tape. source, when started on a blank tape, immediately halts. Again, source does what source followed by source would do, so source must halt for an input of source source's.
In each case we arrive at a contradiction with our assumption. This shows there cannot be a Turing machine source: source is not Turing computable.
Undecidability theorem
[Unsolvability of the Halting Problem] The halting problem is unsolvable, i.e., the function source is not Turing computable.
Proof
Suppose source were Turing computable, say, by a Turing machine source. We could use source to build a Turing machine that computes source: First, make a copy of the input (separated by a source symbol). Then move back to the beginning, and run source. We can clearly make a machine that does the former (see link to exercise asking for a disciplined copier machine), and if source existed, we would be able to “hook it up” to such a copier machine to get a new machine which would determine if source halts on input source, i.e., computes source. But we've already shown that no such machine can exist. Hence, source is also not Turing computable.
Unsolved undecidability exercise
The Three Halting (3-Halt) problem is the problem of giving a decision procedure to determine whether or not an arbitrarily chosen Turing Machine halts for an input of three source's on an otherwise blank tape. Prove that the 3-Halt problem is unsolvable.
Unsolved undecidability exercise
Show that if the halting problem is solvable for Turing machine and input pairs source and source where source, then it is also solvable for the cases where source.
Unsolved undecidability exercise
We proved that the halting problem is unsolvable if the input is a number source, which identifies a Turing machine source via an enumeration of all Turing machines. What if we allow the description of Turing machines from link to section Enumerating Turing Machines directly as input? Can there be a Turing machine which decides the halting problem but takes as input descriptions of Turing machines rather than indices? Explain why or why not.
Unsolved undecidability exercise
Show that the partial function source is defined as
is Turing computable.
Source file content/turing-machines/undecidability/decision-problem.tex
The Decision Problem
We say that first-order logic is decidable iff there is an effective method for determining whether or not a given sentence is valid. As it turns out, there is no such method: the problem of deciding validity of first-order sentences is unsolvable.
In order to establish this important negative result, we prove that the decision problem cannot be solved by a Turing machine. That is, we show that there is no Turing machine which, whenever it is started on a tape that contains a first-order sentence, eventually halts and outputs either source or source depending on whether the sentence is valid or not. By the Church--Turing thesis, every function which is computable is Turing computable. So if this “validity function” were effectively computable at all, it would be Turing computable. If it isn't Turing computable, then, it also cannot be effectively computable.
Our strategy for proving that the decision problem is unsolvable is to reduce the halting problem to it. This means the following: We have proved that the function source that halts with output source if the Turing machine described by source halts on input source and outputs source otherwise, is not Turing computable. We will show that if there were a Turing machine that decides validity of first-order sentences, then there is also Turing machine that computes source. Since source cannot be computed by a Turing machine, there cannot be a Turing machine that decides validity either.
The first step in this strategy is to show that for every input source and a Turing machine source, we can effectively describe a sentence source representing the instruction set of source and the input source and a sentence source expressing “source eventually halts” such that:
The bulk of our proof will consist in describing these sentences source and source and in verifying that source is valid iff source halts on input source.
Source file content/turing-machines/undecidability/representing-tms.tex
Representing Turing Machines
Explain
In order to represent Turing machines and their behavior by a sentence of first-order logic, we have to define a suitable language. The language consists of two parts: predicate symbols for describing configurations of the machine, and expressions for numbering execution steps (“moments”) and positions on the tape.
We introduce two kinds of predicate symbols, both of them 2-place: For each state source, a predicate symbol source, and for each tape symbol source, a predicate symbol source. The former allow us to describe the state of source and the position of its tape head, the latter allow us to describe the contents of the tape.
In order to express the positions of the tape head and the number of steps executed, we need a way to express numbers. This is done using a constant symbol source, and a source-place function source, the successor function. By convention it is written after its argument (and we leave out the parentheses).
For each number source there is a canonical term source, the numeral for source, which represents it in source. source is source, source is source, source is source, and so on. More formally:
The term source, i.e., source names the leftmost position on the tape as well as the time before the first execution step (the initial configuration). The term source, i.e., source names the square to the right of the leftmost square, and the time after the first execution step, and so on.
We also introduce a predicate symbol source to express both the ordering of tape positions (when it means “to the left of”) and execution steps (then it means “before”).
Once we have the language in place, we list the “axioms” of source, i.e., the sentences which, taken together, describe the behavior of source when run on input source. There will be sentences which lay down conditions on source, source, and source, sentences that describes the input configuration, and sentences that describe what the configuration of source is after it executes a particular instruction.
Undecidability definition
Given a Turing machine source, the language source consists of:
A two-place predicate symbol source for every state source. Intuitively, source expresses “after source steps, source is in state source scanning the sourceth square.”
A two-place predicate symbol source for every symbol source. Intuitively, source expresses “after source steps, the sourceth square contains symbol source.”
A constant symbol source
A one-place function symbol source
A two-place predicate symbol source
The sentences describing the operation of the Turing machine source on input source are the following:
Axioms describing numbers and source:
A sentence that says that every number is less than its successor:
A sentence that ensures that source is transitive:
Axioms describing the input configuration:
Axioms describing the transition from one configuration to the next:
For the following, let source be the conjunction of all sentences of the form
where source. We use source to express “other than at square source, the tape after source steps is the same as after source steps.”
For every instruction source, the sentence:
This says that if, after source steps, the machine is in state source scanning square source which contains symbol source, then after source steps it is scanning square source, is in state source, square source now contains source, and every square other than source contains the same symbol as it did after source steps.
For every instruction source, the sentence:
Take a moment to think about how this works: now we don't start with “if scanning square source dots” but: “if scanning square source dots” A move to the left means that in the next step the machine is scanning square source. But the square that is written on is source. We do it this way since we don't have subtraction or a predecessor function.
Note that numbers of the form source are source, source, dots, i.e., this doesn't cover the case where the machine is scanning square source and is supposed to move left (which of course it can't---it just stays put). That special case is covered by the second conjunction: it says that if, after source steps, the machine is scanning square source in state source and square source contains symbol source, then after source steps it's still scanning square source, is now in state source, the symbol on square source is source, and the squares other than square source contain the same symbols they contained ofter source steps.
For every instruction source, the sentence:
Let source be the conjunction of all the above sentences for Turing machine source and input source.
In order to express that source eventually halts, we have to find a sentence that says “after some number of steps, the transition function will be undefined.” Let source be the set of all pairs source such that source is undefined. Let source then be the sentence
If we use a Turing machine with a designated halting state source, it is even easier: then the sentence source
expresses that the machine eventually halts.
Undecidability proposition
Proof
Exercise.
Unsolved undecidability exercise
Prove link to proposition that represented numerals preserve strict order. (Hint: use induction on source).
Source file content/turing-machines/undecidability/verification.tex
Verifying the Representation
Explain
In order to verify that our representation works, we have to prove two things. First, we have to show that if source halts on input source, then source is valid. Then, we have to show the converse, i.e., that if source is valid, then source does in fact eventually halt when run on input source.
The strategy for proving these is very different. For the first result, we have to show that a sentence of first-order logic (namely, source) is valid. The easiest way to do this is to give a derivation. Our proof is supposed to work for all source and source, though, so there isn't really a single sentence for which we have to give a derivation, but infinitely many. So the best we can do is to prove by induction that, whatever source and source look like, and however many steps it takes source to halt on input source, there will be a derivation of source.
Naturally, our induction will proceed on the number of steps source takes before it reaches a halting configuration. In our inductive proof, we'll establish that for each step source of the run of source on input source, source, where source correctly describes the configuration of source run on source after source steps. Now if source halts on input source after, say, source steps, source will describe a halting configuration. We'll also show that source, whenever source describes a halting configuration. So, if source halts on input source, then for some source, source will be in a halting configuration after source steps. Hence, source where source describes a halting configuration, and since in that case source, we get that source, i.e., that source.
The strategy for the converse is very different. Here we assume that source and have to prove that source halts on input source. From the hypothesis we get that source, i.e., source is true in every structure in which source is true. So we'll describe a structure source in which source is true: its domain will be source, and the interpretation of all the source and source will be given by the configurations of source during a run on input source. So, e.g., source iff source, when run on input source for source steps, is in state source and scanning square source. Now since source by hypothesis, and since source by construction, source. But source iff there is some source so that source, run on input source, is in a halting configuration after source steps.
Undecidability definition
Let source be the sentence
where source is the state of source at time source, source is scanning square source at time source, square source contains symbol source at time source for source and source is the right-most non-blank square of the tape at time source, or the right-most square the tape head has visited after source steps, whichever is greater.
Undecidability lemma
If source run on input source is in a halting configuration after source steps, then source.
Proof
Suppose that source halts for input source after source steps. There is some state source, square source, and symbol source such that:
After source steps, source is in state source scanning square source on which source appears.
The transition function source is undefined.
source is the description of this configuration and will include the clauses source and source. These clauses together imply source:
Explain
So if source halts for input source, then there is some source such that source. We will now show that for any time source, source.
Undecidability lemma
For each source, if source has not halted after source steps, source.
Proof
Induction basis: If source, then the conjuncts of source are also conjuncts of source, so entailed by it.
Inductive hypothesis: If source has not halted before the sourceth step, then source. We have to show that (unless source describes a halting configuration), source.
Suppose source and after source steps, source started on source is in state source scanning square source. Since source does not halt after source steps, there must be an instruction of one of the following three forms in the program of source:
We will consider each of these three cases in turn.
Suppose there is an instruction of the form link to right-move case in the configuration induction. By link to definition of the first-order machine-description languagelink to right-move representation sentence, this means that
as follows: The first line comes directly from the consequent of the preceding conditional, by modus ponens. Each conjunct in the middle line---which excludes source---follows from the corresponding conjunct in source together with source.
If source, source (link to proposition that represented numerals preserve strict order) and by transitivity of source, we have source. If source, then source by logic alone. The last line then follows from the corresponding conjunct in source, source, and source. If source, this already is source.
Now suppose source. In that case, after source steps, the tape head has also visited square source, which now is the right-most square visited. So source has a new conjunct, source, and the last conjunct is source. We have to verify that these two sentences are also implied.
We already have source. In particular, this gives us source. From the axiom source we get source. By modus ponens, source follows.
Also, since source, the axiom for transitivity of source gives us source. (We leave the verification of this as an exercise.)
Suppose there is an instruction of the form link to left-move case in the configuration induction. Then, by link to definition of the first-order machine-description languagelink to left-move representation sentence,
as before. (Note that in the first case, source and in the second case source.) But this just is source.
Case link to stay-put case in the configuration induction is left as an exercise.
Unsolved undecidability exercise
Complete case link to stay-put case in the configuration induction of the proof of link to configuration representation lemma.
Unsolved undecidability exercise
Give a derivation of source from source and source (assuming source, i.e., either source or source).
Unsolved undecidability exercise
Give a derivation of source from source, source, and source.)
Undecidability lemma
Proof
By link to configuration representation lemma, we know that, for any time source, the description source of the configuration of source at time source is entailed by source. Suppose source halts after source steps. At that point, it will be scanning square source, for some source. Then source describes a halting configuration of source, i.e., it contains as conjuncts both source and source with source undefined. Thus, by link to lemma that a halting configuration entails the halting sentence, source. But since source, we have source and therefore source is valid.
Explain
To complete the verification of our claim, we also have to establish the reverse direction: if source is valid, then source does in fact halt when started on input source.
Undecidability lemma
Proof
Consider the source-structure source with domain source which interprets source as source, source as the successor function, and source as the less-than relation, and the predicates source and source as follows:
In other words, we construct the structure source so that it describes what source started on input source actually does, step by step. Clearly, source. If source, then also source, i.e.,
As source, there must be source, source so that source for some source and source such that source is undefined. By the definition of source, this means that source started on input source after source steps is in state source and reading symbol source, and the transition function is undefined, i.e., source has halted.
Source file content/turing-machines/undecidability/unsolvability-decision-problem.tex
The Decision Problem is Unsolvable
Undecidability theorem
The decision problem is unsolvable: There is no Turing machine source, which when started on a tape that contains a sentence source of first-order logic as input, source eventually halts, and outputs source iff source is valid and source otherwise.
Proof
Suppose the decision problem were solvable, i.e., suppose there were a Turing machine source. Then we could solve the halting problem as follows. We construct a Turing machine source that, given as input the number source of Turing machine source and input source, computes the corresponding sentence source and halts, scanning the leftmost square on the tape. The machine source would then, given input source and source, first compute source and then run the decision problem machine source on that input. source halts with output source iff source is valid and outputs source otherwise. By link to lemma that validity of the representation implies halting and link to lemma that halting implies validity of the representation, source is valid iff source halts on input source. Thus, source, given input source and source halts with output source iff source halts on input source and halts with output source otherwise. In other words, source would solve the halting problem. But we know, by link to theorem on unsolvability of the Halting Problem, that no such Turing machine can exist.
Undecidability corollary
It is undecidable if an arbitrary sentence of first-order logic is satisfiable.
Proof
Suppose satisfiability were decidable by a Turing machine source. Then we could solve the decision problem as follows: Given a sentence source as input, move source to the right one square. Return to square source and write the symbol source.
Now run the Turing machine source. It eventually halts with output either source (if source is satisfiable) or source (if source is unsatisfiable) on the tape. If there is a source on square source, erase it; if square source is empty, write a source, then halt.
This Turing machine always halts, and its output is source iff source is unsatisfiable and source otherwise. Since source is valid iff source is unsatisfiable, the machine outputs source iff source is valid, and source otherwise, i.e., it would solve the decision problem.
Explain
So there is no Turing machine which always gives a correct “yes” or “no” answer to the question “Is source a valid sentence of first-order logic?” However, there is a Turing machine that always gives a correct “yes” answer---but simply does not halt if the answer is “no.” This follows from the soundness and completeness theorem of first-order logic, and the fact that derivations can be effectively enumerated.
Undecidability theorem
Validity of first-order sentences is semi-decidable: There is a Turing machine source, which when started on a tape that contains a sentence source of first-order logic as input, source eventually halts and outputs source iff source is valid, but does not halt otherwise.
Proof
All possible derivations of first-order logic can be generated, one after another, by an effective algorithm. The machine source does this, and when it finds a derivation that shows that source, it halts with output source. By the soundness theorem, if source halts with output source, it's because source. By the completeness theorem, if source there is a derivation that shows that source. Since source systematically generates all possible derivations, it will eventually find one that shows source, so will eventually halt with output source.
Source file content/turing-machines/undecidability/trakhtenbrot.tex
Trakhtenbrot's Theorem
Explain
In link to section Representing Turing Machines we defined sentences source and source for a Turing machine source and input string source. Then we showed in link to lemma that halting implies validity of the representation and link to lemma that validity of the representation implies halting that source is valid iff source, started on input source, eventually halts. Since the Halting Problem is undecidable, this implies that validity and satisfiability of sentences of first-order logic is undecidable (references link to theorem that the decision problem is unsolvable and link to corollary that first-order satisfiability is undecidable).
But validity and satisfiability of sentences is defined for arbitrary structures, finite or infinite. You might suspect that it is easier to decide if a sentence is satisfiable in a finite structure (or valid in all finite structures). We can adapt the proof of the unsolvability of the decision problem so that it shows this is not the case.
First, if you go back to the proof of link to lemma that validity of the representation implies halting, you'll see that what we did there is produce a model source of source which describes exactly what machine source does when started on input source. The domain of that model was source, i.e., infinite. But if source actually halts on input source, we can build a finite model source in the same way. Suppose source started on input source halts after source steps. Take as domain source the set source, where source is the larger of source and the length of source, and let
and source iff source or source. Otherwise source is defined just like source. By the definition of source, just like in the proof of link to lemma that validity of the representation implies halting, source. And since we assumed that source halts on input source, source. So, source is a finite model of source (note that we've replaced source with source).
We are halfway to a proof: we've shown that if source halts on input source, then source has a finite model. Unfortunately, the converse of this does not hold, i.e., there are Turing machines that don't halt on some input source, but source still has a finite model. For instance, consider the machine source with the single state source and instruction source. Started on empty input source, this machine never halts: it is in an infinite loop, but does not change the tape or move the head. All configurations are the same (same state, same head position, same tape contents). We can define a finite structure source that satisfies source (exercise). We can, however, change source in a suitable way so that such structures are ruled out.
Unsolved undecidability exercise
Let source be a Turing machine with the single state source and single instruction source. Let source, source and source, and source. Define source, source, and source so that source and source become true and explain why they are. Hint: Observe that source is undefined. Ensure that
are both true in source.
Consider the sentences describing the operation of the Turing machine source on input source:
Axioms describing numbers and source (just like in the definition of source in link to section Representing Turing Machines).
Axioms describing the input configuration: just like in the definition of source.
Axioms describing the transition from one configuration to the next:
For the following, let source be as before, and let
For every instruction source, the sentence:
For every instruction source, the sentence
For every instruction source, the sentence:
As you can see, the sentences describing the transitions of source are the same as the corresponding sentence in source, except we add source at the end. source ensures that the number source of the “next” configuration is different from all previous numbers source, source, dots.
Let source be the conjunction of all the above sentences for Turing machine source and input source.
Undecidability lemma
If source started on input source halts, then source has a finite model.
Proof
Let source be as in the proof of link to lemma that validity of the representation implies halting, except
where source and source is the least number such that source started on input source has halted after source steps. We leave the verification that source as an exercise.
Unsolved undecidability exercise
Complete the proof of link to lemma that halting gives a finite model by proving that source.
Undecidability lemma
If source has a finite model, then source started on input source halts.
Proof
We show the contrapositive. Suppose that source started on source does not halt. If source has no model at all, we are done. So assume source is a model of source. We have to show that it cannot be finite.
We can prove, just like in link to configuration representation lemma, that if source, started on input source, has not halted after source steps, then source. Since source started on input source does not halt, source for all source. Note that by link to proposition that represented numerals preserve strict order, source for all source. Also source. So, source for all source, i.e., the infinitely many terms source must all have different values in source. But this requires that source be infinite, so source cannot be a finite model of source.
Unsolved undecidability exercise
Complete the proof of link to lemma that a finite model gives halting by proving that if source, started on input source, has not halted after source steps, then source.
Undecidability theorem
[Trakhtenbrot's Theorem] It is undecidable if an arbitrary sentence of first-order logic has a finite model (i.e., is finitely satisfiable).
Proof
Suppose there were a Turing machine source that decides the finite satisfiability problem. Then given any Turing machine source and input source, we could compute the sentence source, and use source to decide if it has a finite model. By references link to lemma that halting gives a finite model and link to lemma that a finite model gives halting, it does iff source started on input source halts. So we could use source to solve the halting problem, which we know is unsolvable.
Undecidability corollary
There can be no derivation system that is sound and complete for finite validity, i.e., a derivation system which has source iff source for every finite structure source.
Proof
Exercise.
Unsolved undecidability exercise
Prove link to corollary excluding a sound and complete proof system for finite validity. Observe that source is satisfied in every finite structure iff source is not finitely satisfiable. Explain why finite satisfiability is semi-decidable in the sense of link to theorem that first-order validity is semidecidable. Use this to argue that if there were a derivation system for finite validity, then finite satisfiability would be decidable.
Source disclosures
- TR033-SAR-003: Problems that cannot be effectively decided. source
- TR033-SAR-004: Whether M would have halted when started on input n. source
- TR033-SAR-005: Every Turing computable function from the natural numbers to the natural numbers is computed by some Turing machine. source
- TR033-SAR-006: Explain why every Turing machine can be simulated by a standard machine in your new sense. source
- TR033-SAR-007: The first element in this sequence is the number of states, so all that remains is to erase everything but the first block of strokes and halt. source
- TR033-SAR-001: Route this section under the canonical Turing Machines part and Undecidability chapter; retain the older comment header only in provenance. source
- TR033-SAR-002: Identify this file as the Decision Problem section; retain the copied unsolvability comment only in provenance. source
- TR033-SAR-008: If it is not Turing computable, then it also cannot be effectively computable. source
- TR033-SAR-009: Then there is also a Turing machine that computes h. source
- TR033-SAR-010: There will be sentences that describe the input configuration. source
- TR033-SAR-011: The same symbols they contained after y steps. source
- TR033-SAR-012: Restore the formula marker on T of M comma w in the entailment. source
- TR033-SAR-013: In the satisfaction clause, say machine M, not T, is in state q after n steps. source
- TR033-SAR-014: Use the already fixed state q and symbol sigma in both conjuncts and in the membership condition for X. source
- TR033-SAR-015: For the inductive step, suppose n is at least zero. source
- TR033-SAR-016: Restore Obj before the tape-symbol predicate in the excluded conjunct. source
- TR033-SAR-017: The last line follows from the blank-tail conjunct of C of M comma w comma n, the just-derived ordering implication, and A of numeral m comma numeral n. source
- TR033-SAR-018: In the square-zero branch use the fixed current state q and successor state q prime, as in the instruction under discussion. source
- TR033-SAR-019: End the exercise after the displayed transitivity axiom without an extra closing parenthesis. source
- TR033-SAR-020: There is no Turing machine D that, when started with a first-order sentence B as input, always halts and outputs one exactly when B is valid and zero otherwise. source
- TR033-SAR-021: It is undecidable whether an arbitrary first-order sentence is satisfiable. source
- TR033-SAR-022: Use the marked object-language sentence B consistently. source
- TR033-SAR-023: The sole instruction returns to the only state q zero. source
- TR033-SAR-024: Both successor values in the exercise are interpreted in structure M double prime. source
- TR033-SAR-025: Include B of y prime in the non-boundary left-move consequent as well as in the boundary consequent. source
- TR033-SAR-026: The transition sentences are the same as the corresponding sentences in T of M comma w. source
- TR033-SAR-027: Restore the formula marker on E of M comma w. source
- TR033-SAR-028: The exercise asks for satisfaction of T prime of M comma w and E of M comma w. source
- TR033-SAR-029: Assume structure M is a model of T prime of M comma w conjoined with E of M comma w. source
- TR033-SAR-030: It is undecidable whether an arbitrary first-order sentence has a finite model. source