Undecidable language : there is no TM that accepts and halts on every input
it may halt and decide for some inputs
For an undecidable language, the corresponding problem is undecidable (unsolvable):
there is no TM (algorithm) that gives and answer (y/n) for every input instance
answer may be given for some inputs.
We will show that two particular problems are unsolvable: membership problem and halting problem.
Membership problem
Input: Turing machine and string => Does accept , i.e. ?
Corresponding language: = { where M is a TM that accepts string }.
Theorem: A is undecidable => membership problem is undecidable.
Proof. Basic idea: we will assume is decidable. We will then prove that every Turing-acceptable
language is also decidable => a contradiction.
Suppose is decidable. Input string: , we have some decider for , if the output
is yes, accepts . If output is no, rejects :
12345
input <M, w>
A_TM decider
<M> ---> |=========|---> yes M accepts w
| H |
w ---> |=========|---> no M rejects w
Let be a Turing-acceptable language and let be the Turing machine that accepts . We will
prove that is also decidable by building a decider for . Building such decider means is
decidable.
1 2 3 4 5 6 7 8 9101112
╭ String description of M_L:
| this is hardwired and copied to the tape next to
| input string s, and then the pair <M_L, s> is input to H
|
| Decider for L
|==|==========================|
| | |
| <M_L> --> |=========|- yes ----> M accepts w (and halt)
| | H | |
s -----------> |=========|- no -----> M rejects w (and halt)
| |
|=============================|
Since was chosen arbitrarily, every Turing-acceptable language is decidable. But there exists
a Turing-acceptable language that is undecidable => contradiction.
A is undecidable
By construction, A is also Turing-acceptable. Design a TM that accepts it:
For input run on input . If accepts then accept .
Halting problem
Input: Turing machine and string => Does halt while processing input string ?
Corresponding language: Halt = { is a TM that halts on input string }.
Theorem: Halt is undecidable => halting problem is undecidable.
Proof 1
(This proof relies on there exists a Turing-acceptable language that is undecidable)
Basic idea: Suppose that Halt is decidable; we will prove that every Turing-acceptable
language is also decidable => a contradiction.
Support that Halt is decidable. Then for input string there exists a decider for Halt.
If decider outputs yes, halts on input . If decider outputs no, does not halt on input :
123456
input <M, w>
<M> ---> |=========|---> yes M halts on w
| HALT |
| decider |
w ---> |=========|---> no M does not halt on w
Let be a Turing-acceptable language and let be the Turing machine that accepts . We will prove that
is also decidable by building a decider for :
1 2 3 4 5 6 7 8 910111213141516
Decider for L
|==============================|
| |
| |===========| |
| <M_L> --> | M_L halts |- no --------> reject s and halt
s -----------> | on s? | |
| |===========|- yes |
| | |
| ╭————————————————╯ |
| | |
| |=====|====| |
| | Run M_L |- acc + halts -------> accept s and halt
| | with s | |
| |==========|- rej + halts -------> reject s and halt
| |
|==============================|
Therefore L is decidable. Since L was chosen arbitrarily, every Turing-acceptable language is decidable.
But there is a Turing-acceptable language that is undecidable => contradiction.
Proof 2
(This is a self-contained, alternative proof)
Basic idea: assume for contradiction that the halting problem is decidable. We will obtain a contradiction
using diagonilization technique.
Suppose Halt is decidable and there exists a decider for Halt.
12345
input <M, w>
Decider for Halt
<M> ---> |=========|---> yes M halts on w
| H |
w ---> |=========|---> no M does not halt on w
Look inside : input string in H has paths to accept and reject states.
1 2 3 4 5 6 7 8 910
Decider for Halt
===================================
| H |
| ╭----------- q_accept (yes) |
| | |
<M, w> ---> Q0 M halts on w? |
| | |
| ╰----------- q_reject (no) |
| |
===================================
Construct machine : If halts on input , then loop forever, else halt.