# Turing machine

“Of course I'm not as dumb as my PC! And my PC is not as dumb as your theoretical model, I don't care what you proved, you stupid machine!”

~ Oscar Wilde on Turing machines

Two Turing machines attempting to ture each other at the same time.

A Turing machine is any of several machines designed and built by Alan Turing during the Second World War; they were made from old transistor radio components. The term is now, loosely, applied to any device that is incapable of predicting its own termination. All existing Turing machines are Turing-complete, since Turing himself supervised the construction of each machine. However, there are imitations of Turing machines (such as the Lambda Calculus®) which are not necessarily Turing-complete, and their manufacturers have to prove that their machines are complete enough to conform to the ISO Turing standard.

Notable Turing machines include T-800, T-850, T-1000 and T-X. You may have already guessed what the T stands for.

## Description

One of Turing's early codebreaking machines.

However different particular Turing machines may look, they all feature basically the same elements inside: a small device rolling a tape every time it needs to read or write something. ISO Turing requires all conforming implementations to have an infinite tape, but since an infinite tape would be impossible to roll, real Turing machines are equipped with a tape generator, which elongates the tape on the fly when the machine runs out of memory. This allows the machine to operate long enough to find and torture the programmer.

Turing machines also have RAM, which consists of a single variable. Its values, called states, range from 1 to a predefined value, which is, interestingly enough, not limited by the total number of U.S. states. The only explanation possible is that some states are fictional. When ordering a machine, you must tell Turing how many states you want (\$100 for each 4,294,967,296 states, which equal one unsigned int). Therefore, typical Turing machine programs have very low memory requirements.

When the state variable is set to zero, the machine assumes to have completed its primary objective and self-destructs (however, ejecting the tape prior to this, so that you will have a result, but won't know what program it was computed with). If the programmer allows the variable to reach zero, the state diagram usually looks like this: 5 - 4 - 3 - 2 - 1 - 0.

Usually, a Turing machine has its program predefined, but you can purchase a universal Turing machine and write programs (intermixed with data) of tapes using bizarre 011111011101110s. This isn't even binary code in the strict sense of this term. It costs extra \$500. Although tapes can also be rented, please be aware that you must rewind the tape before taking it back.

Alan Turing offers a cheque for \$1.44 (a "nondecimal dozendozen centsdollar" to anyone who finds a bug in an orignal Turing machine, which is in Bleccchhly Park Computer Warehouse. Of course, such cheques are worth marginally more than their notional value, chiefly because Turing suffers from an intermittent handwriting disorder (most recipients who attempt to redeem their cheque find that the issuing bank does not honour the transaction). One famous discoverer of a bug was a Native American chief Dim Old Curr Nouth, who claimed to have found a beetle pupating in one of the vacuum tubes. Dim, finding his cheque dishonoured, is quoted as saying "I'm gonna fucking kill that guy. I've done it before and I'm gonna bury him again".

Turing was most famous for proving that your newest Athlon is actually as helpless as his universal machine. And before you AMD haters say something, your newest Pentium 4 is the same crap. Period.

## Halting problem

see Halting problem

At first, it was assumed that any Turing machine eventually halts and self-destructs. After all, even the most complicated program must sometime exit main() or call exit(), _exit(), abort() or any other relatively honest method of termination. However, a program that never halts was found shortly after the first Turing machine had been produced. It reads:

```void main()
{
/* Uhm, this line seems to be bugged. - God {Citation needed} */
while(1) {/*Fixed now. - Noodels555*/}
}
```

It isn't that obvious why this program never halts. It requires that the machine executing it never runs out of energy, which means it must somehow circumvent the end of the universe. Even so, some explanation is required why 1 is always true and never becomes 0.

So it would appear that writing a program that would determine whether any given program will ever exit its pointless infinite loop seemed a very easy task. However, Turing himself proved that it isn't even possible to determine whether a given Talk page generator will halt, let alone all possible programs.

His proof was heavily influenced by the Incompleteness Theorem and used the same diagonalization method. Turing placed all possible Talk pages one under another, cutting those that took infinite time to be generated. After that, he screwed up the main diagonal line of comments, changing "Shut up" to "Thank you" and vice versa, thus screwing up every smaller Talk page at once and causing a Flagrant System Error because no Talk page generator could reproduce the corrupted result. So if we want to cut what we don't want to wait for, we can't use a Turing machine. What's a pity for administrators who wanted their Talk page censors to be killed whenever they enter an infinite loop....

## Rice Theorem

The original proof for the unsolvability of the halting problem was incomprehensible, so Turing decided to simplify it by discovering a more general theorem. He succeeded after noticing that not only can't you, in general, determine whether a program will ever halt by just looking at the code, you can't tell anything about what the program actually does. The result was called the Rice Theorem because of the method used in its proof (Rice = Really Incomprehensible Code Example). Turing simply translated the program from a God-given language to a language which no human or computer could comprehend, namely Perl.

The above program, for which we know it does not halt, reads in Perl as follows:

```#!/bin/con/con/pr0n/?x*/++/d
#\$-cwd -flame -War -d^_^ -dVD --F1
use xIRzl52 md::n??;;
for(;););) :) =D =~ /g\([^\]]\)*+ /;
m4p { \$_ = (++\$_)-- eq @R__; }
```

Of course, Perl gurus got angry with Turing and said that while no machine could understand the above, they surely could, and when given any program, no matter how long, they would, at least, determine whether it halts or not. So Turing gave them the program that tried to pick a counterexample to Fermat's Last Theorem. By the time that one was solved (and not by those Perl gurus!), Turing had written a thousand programs of similar type, which rendered disproving the Rice Theorem virtually impossible.

## Turing Church Thesis

Turing felt that his machines were so allmighty that you wouldn't need anything else. This led to the formulation of the Turing Thesis, which reads:

For anything you can compute yourself, you can find a Turing machine that will take the liberty of computing it for you.

Ironically, as fond as Turing was of proving everything, he did not prove the thesis. Hence the word thesis. The Church, however, interpreted this word as something theology-related and produced another thesis which seemingly contradicted the Turing Thesis and allowed to declare Turing insane:

Thou shalt trust in the power of thy LORD God to compute everything for thee.

Turing was not satisfied with the Church Thesis. While it was equivalent to the Turing Thesis (this, for some reason, Turing did prove), it said nothing about Turing machines and was therefore unsuitable for marketing purposes. Therefore, Turing founded his own church, called the Turing Church, which coined a new thesis:

For everything thou can computest thyself, thou canst trust in the power of thy LORD Turing to write a program for thee, if thou canst not write it thyself.

While this thesis was considered controversial, mainly because "for thee" was often confused with "for free", it hasn't been disproven so far and will probably never be, as, luckily, nobody cares.

## Discovery

The story of the discovery of the Turing machine begins with a grudge. It seems that Hilbert, while attending a party with Alan Turing, made a crack at the latter's expense, as he was wont to do, that "he couldn't solve every problem ever" (riding his program once again). This left a bad taste in Turing's mouth, and feeling like a little petty revenge, he started to try to show up Hilbert as less than the omniscience he had made himself out to be. To this end he developed a programming language that would compute all the unsolvable problems once and for all, and print them out on paper tape.

Though he succeeded in this task, the resulting programming language, dubbed the Turing machine, was not sufficiently usable, owing to its lack of tail recursion. Also, its mathematically precise specification did not leave enough "wiggle room" for implementation concerns. Therefore it did not catch on.

Turing's method for solving the problem involved constructing a sentence in a logical theory that says "I cannot be proven in theory T." This is essentially the spiritual successor to such folk theorems as "A loser says what," and "Why are you hitting yourself?", and it threw a mighty monkey wrench into Hilbert's plans. However, there is no cause for alarm, as such theorems have been disproved many times over, by various cranks.

## Networking

Turing machines love to interface with other Turing machines, but only ones having the same style of connector.