4
$\begingroup$

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

1 Answers 1

5

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.