The instruction goes to if register is empty; otherwise it deletes the final letter and goes to .
For , an empty input goes directly from to , where a is appended. On a nonempty input, state deletes every letter; once the register is empty it goes to and appends . Hence
For , the initial instruction tests whether the final letter is . If it is, state deletes the entire word and then goes to , producing . Otherwise state deletes the entire word and goes to , producing . Thusthe set of nonempty binary words ending in .
Use the same program as , replacing only its first line by a test for a final :If the input ends in , the loop erases it and eventually appends output . Every other input, including the empty word, follows the loop and produces . This is the characteristic function of .
Rename the old halt state as a nonhalting state , including every occurrence of in the original program, and introduce a new halt state . Attach the following output-flipping routine:Because the original machine computes a characteristic function, it reaches with register containing exactly or . The routine tests that symbol, removes it, and appends its complement. It therefore halts with .
Articles by others on the same topic
There are currently no matching articles.