-1
$\begingroup$

Let the language $K = \{\langle W \rangle: W \text{ is a DFA on } \{a, b, c\} \text{ and } L(W) \text{ contains some string in } \{b, c\}^*\}$.

Is $K$ decidable?

Is it sufficient to define $M$ as follow :

  1. Input $w$;
  2. Simulate the computation of $W$ on $w$
  3. If the accepting state is final after reading at least one $b$ or one $c$ or both, then halt and accept $w$.
  4. Otherwise, halt and reject $w$

I think if $W$ is a DFA, $L(W)$ is a regular language, so it has a pumping length $p$ that is at most the number of states in $W$. Using the pumping lemma to explain why $M$ need only test words in $\{a,b,c\}^∗$ whose lengths are less than $p$ in order to ensure that if $L(W)$ contains at least one word with no $a$'s, $M$ will find one. Can I use that? If so, how? I am a bit stuck right now.

$\endgroup$
4
  • $\begingroup$ You have to show that there is a Turing machine $T$ that takes $W$ as input and accepts if there is a word $w \in \{b,c\}^*$ that is accepted by $W$. If no such $w$ exists then $T$ must reject. Notice that $w$ is not part of the input to $T$. $\endgroup$
    – Steven
    Commented Apr 13, 2021 at 16:14
  • $\begingroup$ You say "I think I have to show that there exists a Turing-Machine $M$, given $w$, which will halt and accept if $w$ is accepted by $W$ and halt and reject if $w$ is not accepted by $W$". This is incorrect. $w$ is not part of the input to $M$. The problem is not about deciding whether an input word $w$ is accepted by $W$ but about deciding whether there exists a word $w \in \{b,c\}^*$ that is accepted $W$. The input to $T$ is just a description of $W$. $\endgroup$
    – Steven
    Commented Apr 13, 2021 at 16:18
  • 3
    $\begingroup$ Please don't delete your post after receiving an answer. Part of our mission is to build an archive of high-quality questions and answers that will be useful not only to the asker, but also to others in the future. Answerers might be answering on that basis. When you delete the question, it prevents others with a similar question from being helped, and thus can be considered impolite to people who volunteered their time to help you. Thank you for listening. $\endgroup$
    – D.W.
    Commented Apr 14, 2021 at 0:24
  • 3
    $\begingroup$ Do not edit your question to remove useful content. See also cs.stackexchange.com/help/editing. $\endgroup$
    – D.W.
    Commented Apr 14, 2021 at 18:14

1 Answer 1

3
$\begingroup$

Assume that the input is a valid description of a DFA $W$ (for any reasonable description this is a decidable problem). You need to show that, given $W$, is is possible to decide whether there exists a word $w \in \{b,c\}^*$ that is accepted by $W$.

Since $W$ is a DFA, $L(W)$ is a regular language. By the closure properties of regular languages, $L' = L(W) \cap \{ b,c \}^*$ is also regular (and you can construct a DFA $W'$ for it by simply deleting all transitions labelled $a$ from $W$).

Then the problem is equivalent to deciding whether $L'$ is empty. This problem is known to be decidable. In fact, you can even solve it in linear time w.r.t. the natural description of the DFA: you just need to decide whether there exists a path from the initial state to a final state in the graph induced by $W'$ (which can be done using, e.g., a breadth first search).


Here is an alternative (slower) approach that more closely resembles the one in your question. Design a Turing machine $T$ that, on input $W$, behaves as follows:

  • Let $n$ be the number of states of $W$.
  • For each $i=0, \dots, n-1$:
    • For each word $w \in \{b,c\}^i$:
      • Simulate $W$ on $w$.
      • If $W$ accepted $w$ then accept.
  • Reject

It is clear that $T$ always halts and that if $W \not\in K$ then $T$ must reject. Therefore we only need to show that if $W \in K$ then $T$ accepts.

To show the above, it suffices to prove that the existence of some word $w \in \{b,c\}^*$ accepted by $W$ implies the existence of some $w' \in \{b,c\}^*$ with $|w'| \le n−1$ that is also accepted by $W$.

Among all possible words $w \in \{b,c\}^*$ accepted by $W$, let $w'$ be one of those minimizing $|w|$ and suppose towards a contradiction that $|w'| \ge n$. Since the pumping length of $L$ is at most $n$, we can invoke the pumping lemma to write $w'$ as $xyz$ with $|y| \ge 1$. Then, $w''=xz \in L$ belongs to $\{b,c\}^∗$, is accepted by $W$, and satisfies $|w''| < |w'|$. This contradicts the choice of $w'$.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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