A Turing machine has a finite control, an unbounded tape divided into cells over a finite tape alphabet including a blank symbol, and a head that reads one cell at a time. For a deterministic Turing machine, the current state and scanned symbol determine the replacement symbol, a head move one cell left or right, and the next state. The input occupies finitely many cells initially; all other cells are blank. Distinguished halting states report acceptance or rejection.
A formal language is a decidable language if some Turing machine halts on every input string, accepting exactly the members and rejecting all nonmembers:
Halting on the nonmembers is part of the requirement; a machine that merely runs forever on some nonmembers need not decide the formal language.
Cancel one unary symbol from each block at each round. Mark the first, middle and last delimiters by , respectively; use for a cancelled symbol in the left block and for one in the right block. These are extra tape symbols of the Turing machine, all distinct from and blank. No numerical counter is needed in the finite control.
Starting on the first zero, replace it by , scan right through the first block of ones to replace the next zero by , then scan right through the second block and replace its terminal zero by . Move left to . If the initial head is on a blank immediately before the first zero, first move right to that zero. The cancellation loop always starts with the head at :
  • Move right past the symbols. If the next symbol is , all right-hand ones have been cancelled; enter the successful cleanup below.
  • Otherwise that symbol is . Replace it by , move left past right-block symbols to , and continue left past any symbols.
  • If the next symbol is , replace it by . Move right past the symbols back to and repeat the loop.
  • If instead the next symbol is , the left block is exhausted while the right block still needed a cancellation. Enter the zero-result cleanup below.
After completed rounds, the invariant is
It holds initially with , and each completed round changes exactly one remaining in each block into the corresponding marker. This proves the cancellation count and preserves the locations of all delimiters.
For successful cleanup, the right block is entirely symbols. From , sweep right, erasing all symbols and finally , then move left across the erased blanks back to the still-present . Erase and continue left, erasing each , until reaching either the last surviving or . Move one cell right and write the new terminal zero there. Move left through the surviving ones to , replace by , and halt. The remaining nonblank tape is exactly
For example, represents and becomes , representing three.
For zero-result cleanup, the head has reached . Sweep right, erasing everything through while retaining ; after erasing , move left across the blanks to . Replace by , write a second zero in the next cell, and halt. Thus if the machine returns . If , successful cleanup also leaves . With this explicit choice of behaviour,
Each sweep seeks a retained delimiter or an end marker a finite distance away. Each completed round removes one right-block ; after at most completed rounds either cleanup or left-block exhaustion occurs. The stated scans, writes and single-cell moves are implementable by finitely many states, so this is an implementation-level Turing machine construction. The output represents zero; a negative integer cannot be represented in the unsigned unary numeral system specified here.
The halting problem asks, given the encoding of a Turing machine and an input string, whether that machine eventually halts on that input. Its formal language is
Suppose a Turing machine decided this formal language. Construct another Turing machine that, on an input encoding , runs on . If answers that halts on its own encoding, enters an infinite loop. If answers that does not halt, halts. Handling malformed encodings by immediate rejection makes well-defined on arbitrary strings.
Now run on its own encoding. If says that halts, the construction makes loop; if says that does not halt, the construction makes halt. Either answer contradicts the assumed correctness of . Therefore
The contradiction concerns a decider that must give a correct terminating answer for every encoded machine and input. Simulating does detect a halt when one occurs, but cannot in general certify that a running computation will continue forever.

Articles by others on the same topic (0)

There are currently no matching articles.