Algorithm for Regular Language

152 Views Asked by At

Let $L$ be a regular language with the alphabet $\Sigma$. I'm trying to find an algorithm to tell whether $L=\Sigma^{*}$, whether $L$ accepts all strings in its alphabet. I think this algorithm uses converting the language to a DFA, but I'm not sure what to do from there. question source

1

There are 1 best solutions below

0
On BEST ANSWER

I will assume that $L$ is represented by a DFA. (If not, begin by converting the regular expression or regular grammar representing it to a DFA; this can be done algorithmically.) There are several possibilities, among them the following:

  1. Apply one of the algorithms that reduce a DFA to a minimal DFA, and check to see whether it has exactly one state, and that state is an acceptor state.

  2. Apply an algorithm that removes all inaccessible states from the DFA, and check that the remaining states are all acceptor states.

  3. Let $p$ be the number of states in the DFA, and test whether every word of length less than $p$.

I’ll leave it to you to show that these actually work.