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

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 Answer

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.

-
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 21, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": false, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 20, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.9428209662437439, "perplexity_flag": "head"}