Suppose I have a set of strings $S$ that is generated from the alphabet. Suppose I have a DFA $D$ and a CFG $G$, are the questions of
- $\{D\mid D\text{ is a DFA and }L(D) = S\}$ and
- $\{G\mid G\text{ is a CFG and }L(G) = S\}$
decidable?
I know that the easier question of whether $D$ or $G$ generates a particular string $w$ or whether the language is the empty-language is decidable, but how can I decide on a particular set of strings?
I am thinking for the case of DFA I can do something like set-difference and check if $L(D/S)$ is empty.
For the case of CFG since it is not closed under complement is this question undecideable?
Asked By : John Smith
Answered By : Yuval Filmus
Let's assume that $S$ is regular and given in some explicit form (DFA, regular grammar, regular expression, what have you). Given a DFA $D$, we can compute a DFA for $L(D) \triangle S$ (here $\triangle$ is symmetric difference) and check whether it is empty or not. This allows us to decide whether $L(D) = S$ or not.
Given a CFG $G$, we can compute a CFG $G'$ for $G \cap \overline{S}$, and then check whether $L(G') = \emptyset$. This allows us to check whether $L(G) \subseteq S$. However, in general we cannot check the opposite inclusion: determining whether $L(G) = \Sigma^*$ is undecidable (the universality problem). However, if $S$ is finite, we can check whether $G$ generates each of the strings in $S$, and thereby solve the problem.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/41730
0 comments:
Post a Comment
Let us know your responses and feedback