Theorem: It is undecidable whether or not the languages generated by two given context-free grammars have an empty intersection.

Proof: By a reduction of post correspondence problem (which is known to be undecidable) to the empty intersection problem.
Given a set d1,...,dn of dominos where, for i=1,...,n, the top string of di is wi and the bottom string of di = xi. Consider the context-free grammars

W -> w1W d1 | w2W d2 | ... | wnW dn | w1 d1 | w2 d2 | ... | wn dn |
and
X -> x1X d1 | x2X d2 | ... | xnX dn | x1 d1 | x2 d2 | ... | xn dn |

Now notice that the given instance of PCS has a match exactly when the intersection of the languages generated by the resulting grammars above is nonempty.

Theorem: It is undecidable whether or not a given context-free grammar is ambiguous.

Proof: Given an instance of PCP, create the grammar G with productions S -> W | X and the productions for X and W above. Now the given instance has a match exactly when G is ambiguous.


Rob van Glabbeek rvg@cs.stanford.edu