For the next transition table:
$$\begin{array}{|c|c|c|c|}\hline&0&1&2\\\hline a&a&b&d\\\hline b&a&b&c\\\hline c&c&d&a\\\hline d&c&c&a\\\hline\end{array}\\a\text{ is initial state}\\\{a,d\}\text{ are final states}$$
-
Make the digraph of the finite automaton and indicate if it is DFA (deterministic) or NDFA (non-deterministic).
-
Build a regular grammar that generates the language recognized by the automaton and indicate it.
- The digraph I made is:
where $\mathrm{start}=a$, $\,s0=b$, $\,s1=c$, $\,s2=d$ and the states marked with a tick are final states.
The finite state machine (which is an automaton) $A=(\{a,b,c,d\},\{0,1,2\},\delta,a,\{a,d\})$, where $\delta:\{a,b,c,d\}\times\{0,1,2\}\to\{a,b,c,d\}$ is deterministic because each state has at most one change of state for each letter of the alphabet and there are no state changes for the null word.
- A regular $\require{cancel}\cancel{\text{grammar}}\text{ expression}$ could be: $$\require{cancel}\xcancel{\begin{align*}L(A)&=0^*\\&\vee2^*\\&\vee(220^*2^*)^*\\&\vee(11^*0)^*\\&\vee(11^*20^*\vee2)^*\\&\vee(11^*20^*\vee(12))^*\\&\vee(11^*20^*\vee1)^*.\end{align*}}$$ \begin{align*}a&=0^*\vee1b\vee2d\vee\lambda\\b&=1^*\vee0a\vee2c\\c&=1d\vee2a\vee0^*\\d&=1c\vee0c\vee2a\vee\lambda\end{align*} and from here I do not know how to build the regular expression and then build the regular grammar (I have seen this and this links but I do not understand them since I could not even get the regular expression) because I have never seen an automaton with $2$ final states!!
Also, the statement what does it mean by indicating the regular grammar?
Everything is correct?
Thanks!
External link:
- Automaton created by automatonsimulator.com. You can test it introducing words here.
Best Answer
Using FSM2Regex, I encoded your transition table:
The resulting state transition graph:
And the generated regular expression:
In FSM2Regex syntax, a valid regex consists of alphanumeric characters representing the set of input symbols (here 0, 1, 2), the $ character representing the empty string, the choice operator +, the Kleene operator *, and parentheses ( and ).
The state machine is deterministic. There are no ambiguous state transitions where the machine has a choice which state to assume next.
See here for a definition of a regular grammar. Note that a grammar and a regular expression possibly can be converted to each other but are different concepts.
To derive a regular expression, several algorithms or visual methods exist. See this post for a detailed explanation. Basically, internal (= non-initial and non-final) states are removed step-by-step. Result is a state transition diagram or table with only the initial and one or more final states. The transition condition from initial to a final state is the regular expression.