Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I'd really like your help with the following question:

For $G$ a context free grammar, and $R$, $S$ regular expressions,

To which class does $\{ \langle G,R,S \rangle : L(G) \cap L(R) = L(S) \}$ belong?

Is it in $R$, $RE/R$, co-$RE/R$?

I know that Intersection of CFG and Regular expressions is CFG, and to compare two regular expressions is in $R$, but I'm not sure what is the answer.

Thank you

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted
+25

Given a context-free grammar $G$ and a regular expression $R$ the language $L(G) \cap L(R)$ is context-free, and can be found by an algorithm. This can be proved by taking a product of a pushdown automaton and a finite automaton.

Therefore, you can reduce the problem to checking if $L(G) = L(S)$.

This problem is in $\mathsf{coRE}$ since you can search for counterexample $w \in A^{\ast}$ which is in exactly one language.

However, given a CFG $G$, it is undecidable whether $L(G)=A^{\ast}$. This is proven using computation histories. Therefore the problem is undecidable, and the answer is $\mathsf{coRE} - \mathsf{R}$.

You might wonder if there are might be restrictions on $S$ which make the problem decidable. I asked this question at cstheory some time ago, and it turns out there is a rather nice criterion.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.