Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
12 views5 pages

F23 CSCI356 Lec Decidability Part 2

The document discusses the undecidability of various problems related to context-free languages and Turing machines, specifically stating that both the equivalence problem for context-free languages (EQCFG) and the membership problem for Turing machines (ATM) are undecidable. It explains that while Turing machines can recognize certain languages, they cannot decide many problems due to the possibility of infinite loops. The document concludes by outlining the relationships between different classes of languages, emphasizing that ATM is not semidecidable, thus lying outside the language hierarchy.

Uploaded by

guptakriti040
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)
12 views5 pages

F23 CSCI356 Lec Decidability Part 2

The document discusses the undecidability of various problems related to context-free languages and Turing machines, specifically stating that both the equivalence problem for context-free languages (EQCFG) and the membership problem for Turing machines (ATM) are undecidable. It explains that while Turing machines can recognize certain languages, they cannot decide many problems due to the possibility of infinite loops. The document concludes by outlining the relationships between different classes of languages, emphasizing that ATM is not semidecidable, thus lying outside the language hierarchy.

Uploaded by

guptakriti040
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/ 5

CSCI 356: Theory of Computing

Lecture 4, Fall 2023 Page 7

Theorem 12. UCFG is undecidable.

4.2 Equivalence Problem


Since we now know that the class of context-free languages is not closed under either intersection or com-
plement, it seems hopeless to believe that the equivalence problem for context-free languages is decidable.
Indeed, since we can test the equivalence of two languages by testing the emptiness of their symmetric dif-
ference, and since the symmetric di↵erence is defined in terms of intersection and complement, we cannot
use the same approach here as we used for the equivalence problem for regular languages.
Like before, this observation itself doesn’t actually prove that EQCFG is undecidable; it only tells us that we
can’t use the same technique we used previously to prove the decidability of EQDFA . We will return to this
result later so that we can prove it formally.
Theorem 13. EQCFG is undecidable.

5 Undecidable Problems for Turing Machines


We now move on to considering decision problems for Turing machines. But wait. . . for each of the previous
two models, we started by considering decidable problems. Here, we jumped directly to undecidable problems.
Did we accidentally skip over one section? No: as it turns out, Turing machines are simply so powerful that
no common decision problem is decidable for this model.
But wait, since Turing machines are so powerful, doesn’t that mean they can solve all kinds of problems?
Indeed, that’s true, but they can’t decide many problems. Remember, in order to decide a problem, the
Turing machine must always halt and either accept or reject the input word corresponding to the problem
instance. The main issue encountered by the Turing machine is in the “halt” step, since there’s no guarantee
that the machine will halt on every input word it receives.
Indeed, even the most basic decision problems are rendered undecidable on a Turing machine, simply because
of the fundamental limitation that the machine may get caught in an infinite loop during its computation.

5.1 Membership Problem


We’ve seen that the membership problems for regular languages and context-free languages are both decid-
able, by virtue of the fact that the models recognizing such classes of languages always halt and either accept
and reject their input words. For Turing machines, however, we lose this valuable decidability property.
Before we continue, let’s review the notions of decidability and semidecidability from the previous lecture.
Suppose that M is a Turing machine recognizing a language L. Recall that:
• L is decidable if (i) whenever w 2 L, M accepts w; and (ii) whenever w 62 L, M rejects w; and
• L is semidecidable if (i) whenever w 2 L, M accepts w; and (ii) whenever w 62 L, M either rejects w
or enters a loop.
It’s quite straightforward to show that the membership problem for Turing machines, ATM , is semidecidable.
Theorem 14. ATM is semidecidable.

Proof. Construct a Turing machine MATM that takes as input hM, wi, where M is a Turing machine and
w is a word, and performs the following steps:
1. Simulate M on input w.
2. (a) If M ever enters its accepting state qaccept , then accept.
(b) If M ever enters its rejecting state qreject , then reject.
CSCI 356: Theory of Computing
Lecture 4, Fall 2023 Page 8

The machine MATM that we constructed in the proof of Theorem 14 looks quite similar to the earlier machine
MADFA we constructed to decide ADFA . However, MATM only semidecides ATM , since the machine has no
way of rejecting its input word if it gets caught in an infinite loop.
Note also that MATM is the canonical example of a universal Turing machine, since we can give it an
encoding of any Turing machine and any input word, and it will simulate the computation of that Turing
machine on that input word.
Now, we will prove that ATM is undecidable; that is, it is semidecidable but not decidable. The technique
we will use is essentially a proof by contradiction: we will assume that we have some machine capable of
deciding ATM , and then show that the existence of such a machine leads to some logical absurdity when we
give a particular input word to that machine.
Theorem 15. ATM is undecidable.

Proof. Assume by way of contradiction that ATM is decidable, and suppose that H is a Turing machine that
decides ATM . Then, given an encoding of a Turing machine M and an input word w,
• H accepts hM, wi if M accepts w; and
• H rejects hM, wi if M rejects w.
We now construct a new Turing machine D that relies on using H as an integral part of its computation.
The machine D takes as input hMi, where M is a Turing machine, and performs the following steps:
1. Run H on input hM, hMii.
2. (a) If H accepts, then reject.
(b) If H rejects, then accept.
In other words, D gives as input to H an encoding of the Turing machine M and an encoded description of
the Turing machine M as the input word to M. Then, D returns the opposite of whatever H returns. That
is,
• D accepts hMi if M rejects hMi; and
• D rejects hMi if M accepts hMi.
Diagrammatically, D functions in the following way. Observe that H is a “black box”; we don’t know exactly
how it performs its computation, we only assume that it can do so.

M accepts hMi
D H accepts hM, hMii D rejects hMi

M rejects hMi
hMi hM, hMii H rejects hM, hMii D accepts hMi
Convert
input H

Now, consider what happens when we give D an encoding of itself as input. Suppose we give D the input
hDi, so that D runs H on input hD, hDii. Then, we get that
• D accepts hDi if D rejects hDi; and
• D rejects hDi if D accepts hDi.
In either case, D on input hDi must return the opposite answer as the simulation of D on input hDi, which
is of course impossible! As a result, we obtain a contradiction, and so no such machine H can exist to decide
ATM .
CSCI 356: Theory of Computing
Lecture 4, Fall 2023 Page 9

The underlying concept that makes the proof of Theorem 15 work is Cantor’s diagonal argument. In 1891,
the German mathematician Georg Cantor showed that there exist uncountably infinite sets, or sets whose
elements cannot be placed into a bijection with the (countably infinite) set of natural numbers.
The crux of the diagonal argument is that, if we take a set T of all binary words and assume that it is
countably infinite, then we can enumerate all the elements of T . We can then construct a new element s
that doesn’t belong to T by setting the ith symbol of s to be the inverse of the ith symbol in the ith word;
that is, if the ith symbol of the ith word is 0, then we take the ith symbol of s to be 1, and vice versa. In
this way, s di↵ers from every other word in T in at least one position. Since s is not an element of T , s could
not have been accounted for in the enumeration of T , and so T must not be countably infinite.
The same diagonal argument can be applied to Turing machines in order to prove Theorem 15. If we could
enumerate all Turing machines, then we could construct a table where each row corresponds to a Turing
machine Mi and each column corresponds to an encoding of a Turing machine hMj i. Then, the entries of
the table could be taken to be the result of running H on input hMi , hMj ii.
hM1 i hM2 i hM3 i hM4 i ···
M1 accept accept reject reject
M2 accept reject reject accept
M3 reject reject accept accept
M4 accept accept accept reject
.. ..
. .
By our assumption that H existed, and by the fact that we constructed D using H, we know that D must
appear in this table. We also know each entry in the row corresponding to D, since the entry in column i
is the opposite of the entry at index (i, i) of the table. However, this presents a problem: what is the entry
corresponding to hD, hDii? It somehow needs to be the opposite of itself, and we therefore arrive at the
same contradiction as before.
hM1 i hM2 i hM3 i hM4 i ··· hDi ···
M1 accept accept reject reject accept
M2 accept reject reject accept reject
M3 reject reject accept accept reject
M4 accept accept accept reject accept
.. ..
. .
D reject accept reject accept ?
.. ..
. .

5.2 Non-membership Problem


Now that we know the membership problem ATM is semidecidable but not decidable, we can be fairly sure
that obtaining a positive decidability result for other Turing machine decision problems is hopeless. But
what can we establish about variants of the Turing machine membership problem—like, say, the complement
of the membership problem?
Let us consider the Turing machine “non-membership problem”, defined as follows:

ATM = {hM, wi | M is a Turing machine that does not accept input word w}.

Instead of proving the decidability status of ATM directly, as we did in proving ATM was undecidable, we
will use a di↵erent approach with ATM that focuses on semidecidability.
Consider L, the complement of a language L. If the original language L is semidecidable, then we say that
the complement language L is co-semidecidable. Saying that L is co-semidecidable is another way of saying
that we can semidecide the complement of L; in other words, we can semidecide L = L.
CSCI 356: Theory of Computing
Lecture 4, Fall 2023 Page 10

Since the original language L and the language of all words not in the complement language L are one and
the same, we can use any Turing machine M semideciding L also to co-semidecide L.
Note that L is co-semidecidable whenever L is semidecidable, but this does not necessarily imply that L
is itself semidecidable. If L is semidecidable, then of course L is co-semidecidable by our definition. In
the situation where L is both semidecidable and co-semidecidable, we can “upgrade” the class to which L
belongs.
Theorem 16. A language L is decidable if and only if L is both semidecidable and co-semidecidable.

Proof. ()): Suppose L is decidable. Since all decidable languages are also semidecidable, we have that L is
semidecidable. If we take the Turing machine deciding L and exchange the accepting and rejecting outputs,
then we get a machine that decides L. Thus, L is semidecidable, and so L is co-semidecidable.
((): Suppose L is both semidecidable and co-semidecidable. Then there exists a Turing machine MSD
semideciding L and a Turing machine McoSD co-semideciding L. Using these two Turing machines, we can
construct a Turing machine MD that takes as input a word w and performs the following steps:
1. Run both MSD and McoSD on the input word w in parallel.
2. (a) If MSD accepts, then accept.
(b) If McoSD accepts, then reject.
Diagrammatically, MD functions in the following way.

MD
MSD accepts w MD accepts w
MSD
w

McoSD accepts w MD rejects w


McoSD

Since every word w must belong to either L or L, either MSD or McoSD must accept w. Moreover, since
MD halts whenever either MSD or McoSD accepts, we have that MD decides L, and so L is decidable.

Since Theorem 14 tells us that ATM is semidecidable, we know that ATM is co-semidecidable. However, if ATM
were not just co-semidecidable but also semidecidable, then we would have that ATM is co-semidecidable.
This presents a problem, since this would ultimately suggest that ATM is decidable! Therefore, we can
conclude the following.
Corollary 17. ATM is not semidecidable.

Proof. Assume by way of contradiction that ATM is semidecidable. Then ATM would be co-semidecidable,
and by Theorem 16, ATM would be decidable, which contradicts Theorem 15.

Corollary 17 reveals a remarkable fact: ATM is not only undecidable, but it also isn’t even semidecidable,
and so it lies entirely outside of our language hierarchy! In the next lecture, we’ll see a number of other
examples of languages that are neither decidable nor semidecidable; in some cases, these languages are
co-semidecidable, while in other cases, we can’t even establish co-semidecidability.
CSCI 356: Theory of Computing
Lecture 4, Fall 2023 Page 11

Summary
Speaking of our language hierarchy, we now have enough information to complete the “big picture” of the
relationships between languages. We know by Corollary 10 that all context-free languages are also decidable.
We also know by Theorem 16 that a language is decidable if and only if it is both semidecidable and co-
semidecidable, so the class of decidable languages forms a subset positioned at the intersection between the
classes of semidecidable and co-semidecidable languages.
Adding these new language classes to our hierarchy, we get the following diagram. Each of the decision
problems we discussed in this lecture have been added to the appropriate class in this diagram, along with
a number of other decision problems we will investigate further in the next lecture.

All Languages UTM

UTM EQTM
Semidecidable Languages
HALTTM ATM EQTM
Turing Machines

ETM Decidable Languages


EQDFA w#w ADFA an bn cn ANFA
UCFG
EDFA Context-Free Languages ACFG
EQCFG La>b an bn ai #bi wwR

L() Regular Languages ai bj ck ECFG


UDFA
a [ ba {a, b}⇤ c 01⇤ [ 1 (i = j or
j = k)
ww
⌃⇤ Finite Languages an
{✏} {a} ;
EQCFG
Acyclic DFAs
Finite Automata
UCFG
Pushdown Automata
Halting Turing Machines ETM

Co-Semidecidable Languages
ATM HALTTM
Turing Machines

You might also like