Solution

ID: past-exam-of-the-mathematics-course-of-the-university-of-cambridge/2025/ii/paper-3/4f/c/solution

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 .

New to topics? Read the docs here!