Decidability

The Accepting Problem

I’m sorry Dave. I can’t do that.

Read pages 206 to 209 — Corollary 4.18. It contains the classic, and devious, proof that there is a language that can not be decided.

Consider the language:
    ATM = {<M, w> | M is a Turing machine that accepts w}

Assume H is a decider for ATM. Deciders never loop.
    H(<M, w>) = accept, if M accepts w
    H(<M, w>) = reject, if M does not accept w — perhaps M even loops!

Use H to build the demonic D
    D(<M>) = accept, if H(<M, <M>>) = reject
    D(<M>) = reject, if H(<M, <M>>) = accept
We can do this because H is a decider.

Let’s simplify that a little
    D(<M>) = accept, if M does not accept <M>
           = reject, if M does accept <M>

But what, if we pass D to D
    D(<D>) = accept, if D does not accept <D>
           = reject, if D does accept <D>

This is a clear contradiction. Consequently, there can be no Turing machine that decides ATM. Therefore, ATM is undecidable.

The videos of Harry H. Porter, III are another reference for those who like to YouTube it.

The Halting Problem

This is Theorem 5.1 on pages 216 and 217: HALTTM is undecidable. This is a proof by contradiction using the previous result that ATM is undecidable.

Consider the language:
    HALTTM = {<M, w> | M is a Turing machine that halts on input w}

Assume you have a Turing machine R that decides HALTTM
    Remember — A decider always halts!
Build a Turing machine S that “calls” R to decide ATM.

    S(<M>, w):
        Run R, the decider of HALTTM, on <M, w>
        If R rejects     // M loops on w
            Reject
        Else             // M halts on w
            Simulate M on w until it halts
            If M accepts
                Accept
            Else    
                Reject   

We have demonstrated that: if there is a decider for ATM, then there is a decider for HALTTM. However, we just proved that there is no decider for HALTTM. Therefore we have proved, by contradiction, that there is no decider for ATM

Proving ATM is undecidable using function reduction

This is alternative proof of that ATM is undecidable. It is given in Example 5.28 on pages 236 and 237.

We start with Definition 5.20 (p 235), for a mapping reduction f:

A language A is mapping reducible to language B, written A ≤m B, if there exists a function f: Σ* → Σ*, such that

f is a called the reduction from A to B.

Following Example 5.24 (p 236), we will now define a computable function F from Σ* to Σ* that satisfies the definition of being a reduction from ATM to HALTTM. Notice that the MR in this code, looks a lot like the S in the previous code.

F(<M, z>):
    // Just in case we get an weird Σ* input
    If ArgumentIsNotTuringMachineAndInput:
        Return SomethingThatIsNotTuringMachineWithInput
    // Otherwise, Construct MR for return
    MR(z):
        Simulate M on z until it halts
        If M accepts
            Accept
        If M rejects   
            Enter a loop
    Return <MR, z>

So the trick is making sure that the input is in ATM if and only the output is in HALTTM. This trick that is often “left to the reader.”

w ∈ ATM ⇒ f(w) ∈ HALTTM

Because w ∈ ATM, w is a pair <M, z> where M is a Turing machine that accepts z. The reduction f (or F) described above will return the pair <MR, z> where MR is the Turing machine created while running M on z. Because M accepts z, MR also halts on z. Therefore, <MR,z> ∈ HALTTM. Consequently f(w) ∈ HALTTM

f(w) ∈ HALTTM ⇒ w ∈ ATM

f(w) is a pair <MR, z> where MR is the Turing machine created when f is applied to a <M, z>. Since f(w) ∈ HALTTM, <MR, z> ∈ HALTTM. Consequently, MR must halt when applied to z. However, the clever MR halts only if M accepts z. This means that <M, z> ∈ ATM or, equivalently, w ∈ ATM.

ATM ≤m HALTTM

We can finally say it. Being formal was hard.

Are we there yet?

It’s been a lot of work; however, now we can make use of Corollary 5.23 and Theorem 4.11 to give a proof of Theorem 5.1.

Was it worth it? Constructing the reduction and formally verifying it really is a reduction was a lot of work. However, we were able to give a constructive proof. Many people (including mathematicians) just find proof by contradiction to be unsatisfying.