0% found this document useful (0 votes)
43 views4 pages

7 Decidability

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views4 pages

7 Decidability

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

CS 476 – 7.

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.

Proof We simply need to present a TM M1 that decides ADF A :


M1 = On input < B, w > , where B is a DFA and w is a string

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.2 AN F A = {< B, w > | B is an N F A that accepts input string w} is decidable.

Proof We will use M1 from above as a subroutine.


M2 = On input < B, w > , where B is an NFA and w is a string

1. Convert NFA B to an equivalent DFA C.

2. Run TM M1 on input < C, w >.

3. If M1 accepts, accept; otherwise, reject.

Theorem 1.3 AREX = {< R, w > | R is a regular expression that generates string w} is decidable.

Proof M3 = On input < R, w > , where R is a regular expression and w is a string

1. Convert regular expression R to an equivalent NFA A.

2. Run TM M2 on input < A, w >.

3. If M2 accepts, accept; otherwise, reject.

Theorem 1.4 EDF A = {< A > | A is a DF A and L(A) = ∅} is decidable.

Proof M4 = On input < A > , where A is a DFA

1. Mark the start state of A.

2. Repeat until no new states get marked:

(a) Mark any state that has a transition coming into it from any state that is already marked.

3. If no accept state is marked, accept; otherwise, reject.


Theorem 1.5 EQDF A = {< A, B > | A and B are DF As and L(A) = L(B)} is decidable.

Proof M5 = On input < A, B > , where A, B are DFAs

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))

2. Run M4 on input < C >.

3. If M4 accepts, accept; otherwise, reject.

Theorem 1.6 ACF G = {< G, w > | G is a CF G that generates string w} is decidable.

Theorem 1.7 ECF G = {< G > | G is a CF G and L(G) = ∅} is decidable.

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).

• Practical significance: software testing.

Fact: Every TM can be encoded as a binary string according to some convention.

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 }

• A transition δ(qi , Xj ) = (qk , Xl , Dm ) is encoded as 0i 10j 10k 10l 10m .

• 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:

T M = 1 Code1 11 Code2 11 Code3 . . .

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
·
·
·
·

The diagonal will be defined as


D = a1 a2 a3 . . .
where ai = 1 if (i, i) = 0 and ai = 0 if (i, i) = 1.

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 yes, < N >∈


/ Ld , hence < N >∈
/ Ld .

• If no, < N >∈ Ld , hence < N >∈ Ld .

Therefore, no such N is possible: Ld is not recognizable.

2.2 Recognizable but not decidable language


Define:
AT M = {< M, w > | M is a T M, and w ∈ L(M )}
Assume AT M is recognizable by a TM U (the “universal” TM).
U on < M, w >

• Check if M is a valid TM encoding.

• 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 ?

• Run H on < M, < M >>.

• 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.

Definition A language A is co-Turing recognizable if its complementation, A is Turing recognizable.

Theorem 2.2 A language A is decidable iff it is Turing recognizable, and co-Turing recognizable.

Proof There are two parts of this proof.

• if A is decidable, then A is decidable. Also A is decidable (simply switch qA and qR .

• 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.

Corollary 2.3 AT M is not Turing-recognizable.

Proof We know that AT M is Turing-recognizable. If AT M were also Turing-recognizable, AT M would be


decidable. But we know that AT M is undecidable, so AT M must not be Turing-recognizable.

You might also like