CS381, Homework #12 Solutions
Question 1
Prove that the intersection of two CFGs is undecidable.
We shall prove this fact with a reduction from the halting problem to the
intersection of two CFGs. Recall from class, that for some Turing Machine
M
, on some input
x
we can write the valid computations of
M
as
G
=
L
(
C
1
)
∩
L
(
C
2
) =
k
1
(
k
2
)
R
...
k
n
. If you do not remember how to do
this, review your course notes.
Now observe, that if
G
(which is the intersection of two context free lan
guages) is nonempty, then it must contain some finite length string, which
means that the Turing Machine M has some sequence of valid computations
such that it halts on input x. We can make sure that when we formulate our
intersection, we allow the machine to end in any state (and not just final
states) as long as no input remains and there are no epsilon transitions from
the state in
k
n
. Thus, it may be that a string
x
is not accepted by
M
, but
if
G
is nonempty, it can be assured that
M
halts on
x
. If the intersection
is empty on the other hand, then there is no such sequence, and the Turing
Machine will run forever. This gives us a way to determine if a machine if
a Turing Machine M halts on input x using the intersection of two CFLs.
This conclusion though creates a contradiction, for if this intersection
problem were decidable, we could solve the halting problem using it, and
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '05
 HOPCROFT
 Halting problem

Click to edit the document details