7 Decidability
7 Decidability
Decidability/Undecidability
1 Decidable languages
Languages that are always accepted or rejected by a Turing Machine (i.e. by a decider TM).
Definition We will use < M > to denote the binary encoding of a TM. Or, alternatively, write a program
for M , and let < M > be its binary executable.
Examples:
Theorem 1.1 ADF A = {< B, w > | B is a DF A that accepts input string w} is decidable.
1. Simulate B on input w.
2. If the simulation ends in an accept state, accept. If it ends in a nonaccepting state, reject.
Theorem 1.3 AREX = {< R, w > | R is a regular expression that generates string w} is decidable.
(a) Mark any state that has a transition coming into it from any state that is already marked.
1. Construct a new DFA C from A and B, where C accepts only those strings that are accepted by either
A or B, but not both. Thus, if A and B recognize the same language, C will accept nothing. The
language of C is:
L(C) = (L(A) ∩ L(B)) ∪ (L(A) ∩ L(B))
But:
Theorem 1.8 EQCF G = {< G, H > | G and H are CF Gs and L(G) = L(H)} is NOT decidable.
2 Undecidability
• Problems that cannot be solved by computers (TMs).
Example Assume:
• q1 is the start state, q2 is the accept state, q3 is the reject state, and qi , i ≥ 4 are the rest of the states.
• Γ = {X1 , X2 , X3 , . . .} where X1 = 0, X2 = 1, X3 = t, . . .
• {L, R} = {D1 , D2 }
• The TM is encoded as the list of its transitions seperated by 11s since transition codes do not include
two consecutive 1s. We also include a prefix of 1 to be able to convert to an integer:
Then the ith TM is the TM, where the binary representation of the integer i is the binary encoding of TM
(< M >). Some TMs do not make sense. For an ith TM to be valid, there must be 5 blocks of 0s seperated
by single 1s between any pair of 11s. For example the 3rd TM does not make sense. For such TMs we will
assume that the language they accept is empty.
2
2.1 A language that is not Turing-recognizable
aa
aa input string
aa j 0 1 2 3 4 5 ...
TM i aa
a
0 0 0 0 0 0 0
1 0 0 0 0 0 0
·
·
·
·
<M > 0 0 1 0 1 0
·
·
·
·
Define:
Ld = {< M > | < M >∈
/ L(M )}
Assume that Ld is recognizable by some TM N ; i.e. Ld = L(N ). Now, the question becomes: is
< N >∈ Ld ?
• If so, evaluate M on w.
• If M accepts w, accept.
• If M rejects w, reject.
Note that U is not a decider. If M loops on w, U will also loop. Then AT M = L(U ).
3
Theorem 2.1 AT M is not decidable.
Proof by contradiction.
Assume that AT M is decided by some TM H.
accept, if w ∈ L(M )
H(< M, w >) =
reject, otherwise
From H, we can construct another TM D that decides Ld :
D on < M >: Is < M >∈ Ld ?
• Accept if H rejects.
• Reject if H accepts.
We know that no such D exists since Ld is not recognizable, i.e. not decidable. Hence, no such H exists.
AT M is not decidable.
Theorem 2.2 A language A is decidable iff it is Turing recognizable, and co-Turing recognizable.
• if both A and A are Turing recognizable, then we can build M1 for A, and M2 for A. Then, assume
M is a decider for A. M can run M1 and M2 in parallel. Note that, ∀w, either w ∈ A, or w ∈ A.
Then, if M1 accepts w, M will accept. Otherwise, if M2 accepts w, then M will reject.