Why for the input: 'a' I'm getting 'Accept' in the automata

31 Views Asked by At

This is a finite non-deterministic automaton ($\lambda$ same like $\epsilon$)

I don't understand why for the input: 'a' (first line) I'm getting 'Accept'

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

In your description of the automaton the set of accepting states is missing. Assume now that the automaton is defined as

$$(Q=\{q_0,q_1,q_2\},\Sigma=\{a,b\},\Delta,q_0,F=\{q_1,q_2\})$$

where the state transition function $\Delta$ is defined by the figure and $F$, the set of accepting states is defined so I could explain the results.

You get "accept" first because in state $q_0$ input $a$ is defined and takes the automaton to state $q_1$ and $q_2$ both $ \in F$ the set of accepting states. From $q_1$ an $\varepsilon$-move (without input) takes the automaton back to state $q_0$ where $a$ is accepted again by taking the automaton to the accepting states. Then the next $a$ is accepted again. However, $b$ is not accepted in state $q_0$ as a result a $b$ as a first input cannot take the automaton to the set of accepting states. After an $a$, however $b$ is acceptable in $q_2$ taking the automaton to $q_1\in F$.


If we had $F=\{q_1\}$ then we would get the same results. The state transitions for the input sequence $aa$ would be then

$$q_0\overrightarrow a \{q_1,q_2\}\overrightarrow \varepsilon \{q_0,q_2\}\overrightarrow a \{q_1,q_2\}.$$

The state transition triggered by the input sequence $ab$ would be

$$q_0\overrightarrow a \{q_1,q_2\}\overrightarrow \varepsilon \{q_0,q_2\}\overrightarrow b \{q_0,q_1\}.$$

In both cases the inputs would trigger "accept" and "accept" because $q_1\in F$ is always in the set of possible states.