I am learning about automata and finite state machines. Consider the following automaton, that accepts the word 'ab', does not have to be infinite, just once:
alphabet: 'a','b' states: 1,2, 3 (3 is the final state and 1 is the initial state)
transitions:
state 1, symbol a, state 2 state 2, symbol b, state 3
First part of my questions:
Question 1. Is it required to add self-loops at 1 for 'b', and a self-loop for 'a' at 2?
Question 2. What about at state 3(final)? Should I add self-loops for 'a' and 'b'?
I basically need to know, how to design my final state. So that even if my alphabet was expanded (say a, b, c), and I have a 'dump' state, with the following transitions:
state 1, symbol a, state 2 state 1, symbol b or c, state dump state 2, symbol b, state 3 state 2 symbol a or c, state dump
Question 3. Now from final state 3, should I add a transition to dump state, with symbol values a,b,c ???
Your assistance is much appreciated.
Asked By : Piotr L.
Answered By : saadtaame
Your original automaton is fine, it accepts the singleton $\{ab\}$. Here is a pictorial representation:
In the above automaton it's implicit that given a state and a letter for which there is no arrow going out of that state, then the automaton "crashes". If you want to be complete, you can add a dead state that absorbs strings that don't belong in the language. Here is the complete automaton:
If you add self-loops at 1 and/or 2, you will change the language that the automaton accepts. Look at this:
The self-loop at 1 labeled with $b$ changes the language to $\{ab, bab, bbab, bbbab, \dots\}$.
Best Answer from StackOverflow
Question Source : http://cs.stackexchange.com/questions/9711
0 comments:
Post a Comment
Let us know your responses and feedback