Convert this from NFA to DFA - dfa

Construct a DFA (with alphabet {a,b}) that is equivalent to the following NFA:
My conversion is below, but it appears to be wrong, can you help me explain why?

Any DFA state that includes NFA state 5 must also include NFA state 2, due to the epsilon transition. You have a DFA state labelled just 5, which is thus wrong -- it should be 2,5 (and be merged with the other 2,5 state as a result).
You also forgot to label the edge from 2,3,5 to 4,6 (should be b).

Related

Make DFA of the set of all strings from {0,1} whose tenth symbol from the right end is a 1

What will be the transition diagram of the set of all strings from {0,1} whose tenth symbol from the right end is a 1 ?
I know the regular expression is (0+1)*1(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)
But I couldn't turn it into DFA.
I encountered this question in Introduction to Automata Theory, Languages, and Computations by John E. Hopcroft, Rajeev Motwani, Jeffrey D. Ullman.
First, we need to get hold of the NFA here. This would have 11 states in linear formation with the start having a self loop with 0,1 and a transition to the next state with 1 (not 0). All the other 9 transitions from qi -> qi+1 would have transition for 0,1 both. The last state, q10 will be our accept state.
That was fairly a straightforward approach for the NFA. Now if we convert this NFA to a DFA considering all 211 subsets of set of states of the NFA, we would get the solution.
I will add the NFA Diagram when I get some time. And try to figure out an easy trick to solve the DFA without considering all the possibilities.
You can look at Example 1.30 from Introduction to the Theory of Computation - M. Sipser - 3rd Edition at page 51. There they showed an NFA for strings having 1 at the third position from the end would have 4 states but that corresponding DFA would have 8 states. Not posting the screenshots for copyright issues.
DFA of the set of all strings from {0,1} whose tenth symbol from the right end is a ...
the regular expression for given language is :
(0+1)*1(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)(0+1)
Hope you got it..!!

Cross product of incomplete DFA's

I am trying to do a cross product between two DFA's but they are both incomplete DFA's.
The following image is the answer I came up with for the intersection of cross product between two incomplete DFA's. The alphabet is {a,b,c,d,e}.
Is it correct or does the fact that they are incomplete change everything?
The fact that they're incomplete does make your job different if you are constructing the cross product to find the union; however, for the intersection you can still use this basic approach. But, you made some errors:
Let's start in the top left, and look at all the transitions out of the state A1:
First, you have a state transition labeled c from state A1 to state A2. However, that's incorrect because there is no transition from A to A in the top DFA that's labeled with c. Then, you have a transition labeled a that goes from state A1 to itself. This is also incorrect because there's no transition from state 1 to anything labeled a. Likewise, there's no transition out from state 1 labeled b so that also invalidates your transition from A1 to B1.
When working with incomplete DFAs and making a cross-product like this, you'll only have outgoing edges for a state (p,q) when there's a letter that both state p and state q have outgoing edges for.
Therefore, there are no transitions out of the start state. At this point, we can stop working because with no transitions out of the start state, there's no point - the resulting DFA matches nothing.
Another possibility of how to approach this is to first make both DFAs complete by adding a non-accepting state (I call this state ∅). This state should have an edge going to it from every state for every letter for which there isn't already a different outgoing edge. For example, in the first DFA there would be an edge from A to ∅ for c, d, and e. Also, there should be an edge from ∅ to ∅ for every letter. Now both DFAs are complete.
When you do this, you end up with edges out of A1 going to: A∅ for a, B∅ for b, ∅1 for c, and ∅∅ for d and e. The rest is left as an exercise, but if you draw it out completely you'll discover again that there's no path from A1 to any accepting state.
Making both DFAs complete first is in fact what you need to do if you're constructing the cross-product to find the union - with the intersection it's permissible to simply throw away any state involving ∅ in either DFA since reaching ∅ means that you'll never reach an accepting state, but with the union you need to keep them because some states involving ∅ may be accepting states of the cross-product. (You can still throw away the state ∅∅ and any edge to that)

Subset construction of a DFA from NFA

I am reading the book Compilers Principles, Techniques, and Tools by Alfred V.Aho. The subset construction of a DFA from an NFA has the following operations on NFA states
e-closure(s)| Set of NFA states reachable from NFA state s on e-transations alone
e-closure(T)| Set of NFA states reachable from some NFA state s in set T on e-transation alone; =**U**s in T e-closure(s)
move(T,a) | Set of NFA states to which there is a transition on input symbol **a** from some state s in T
The following is an NFA accepting (a|b)*abb
And the Transition table Dtran for DFA D is
The problem I have is I am not able to understand how we are getting NFA States for DFA states B C D and E
When marking DFA state A. Among the states in NFA {0,1,2,4,7} only 2 and 7 has transition to a, move(A,a) ={3,8}and e-closure({3,8}) ={1,2,3,4,6,7,8}.
My problem is how do we end up with {1,2,3,4,6,7,8} and the NFA states that follows.
You should also incorporate e-transitions after a transition. So when looking at the move(A,a)={3,8} you should add the states {6,7,1,2,4} as these are all reachable from the state 2 with move(A,a)={3,8} with 1 or more e-transitions.
I didn't check, but I assume the other states can be constructed similarily.

NFA to DFA conversion = deterministic?

I am struggling a bit with the meaning of determinism and nondeterminism. I get the difference when it comes to automata, but I can't seem to find an answer for the following: Is a NFA to DFA transformation deterministic?
If multiple DFAs can be constructed for the same regular language, does that mean that the result of a NFA to DFA transformation is not unique? And thus a nondeterministic algorithm?
I'm happy with any information you guys might be able to provide.
Thanks in advance!
There are two different concepts at play here. First, you are correct that there can be many different DFAs equivalent to the same NFA, just as there can be many NFAs that are all equivalent to one another.
Independently, there are several algorithms for converting an NFA into a DFA. The standard algorithm taught in most introductory classes on formal languages is the subset construction (also called the powerset construction). That algorithm is deterministic - there's a specific sequence of steps to follow to convert an NFA to a DFA, and accordingly you'll always get back the same DFA whenever you feed in the same NFA. You could conceivably have a nondeterministic algorithm for converting an NFA to a DFA, where the algorithm might produce one of many different DFAs as output, but to the best of my knowledge there aren't any famous algorithms of this sort.
Hope this helps!
DFA- means deterministic finite automata
Where as NFA- means non deterministic finite automata..
In dfa for every state there is a transition for both the inputs... I we have...{a, b} are the inputs for the given question.. For.. Every state there is a transition for both a and b... That automata is known as deterministic finite automata..
Where as in NDA we need not to have both input transitions for every state... At least one transition... is sufficient...
In NFA Epsilon transition is also accepted.. And dead state is also accepted...
In nfa... No of states required is less.. When compare to dfa.. Every dfa is equivalent to nfa... But every dfa is not equivalent to nfa...

NFA to DFA conversion whose language is the complement of L(A)

Can someone please help me with this question?
Describe an algorithm that converts an NFA into a DFA whose language is the complement of L(A). The complement should be taken with respect to the alphabet of A. Given an informal argument for why your construction works. You need not give a formal proof.
Any kind of guidance is appreciated...
You can convert a FA to its complement by turning its accept states into non-accept states, and turning its non-accept states into accept states. Easy!
You can convert a NFA to a DFA by considering that any NFA state is a power of the states: that is, for each state in the NFA, it is either active or not active. You can map each of these states to a state in a DFA, so you end up with at most 2|Q| states for your DFA which represents your NFA.
Edit: this algorithm and its proof do not actually need the details of A, so long as it is a valid Finite State Automaton.

Resources