MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

Embed Size (px)

Citation preview

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    1/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 1 of 18

    TOPIC TITLE: Nondeterministic Finite Automata

    Specific Objectives:

     At the end of the topic session, the students are expected to:

    Cognit ive:

    1. Define nondeterminism.2. Enumerate and explain the differences between

    nondeterministic finite automata (NFA) and deterministic finiteautomata (DFA).

    3. Explain how an NFA performs its computation.4. Discuss how ε -transitions are handled.

    Affective:

    1. Listen to others with respect.2. Participate in class discussions actively.

    MATERIALS/EQUIPMENT:

    o  topic slideso  OHP

    TOPIC PREPARATION:

    o  Have the students review related topics that were discussed inprevious courses.

    o  Prepare the slides to be presented in class.o  It is imperative for the instructor to incorporate various kinds of

    teaching strategies while discussing the suggested topics. o  Prepare additional examples on the topic to be presented. 

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    2/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 2 of 18

    NondeterminismPage 1 of 33

    Nondeterministic Finite Automata

    Nondeterminism

    Introduction

    The main characteristic of a DFA is that for each input symbol, the automaton canmove to only one state from any given current state.

    Consider a DFA that accepts strings over the alphabet   = {0, 1} that starts with a 0and ends with a 1 as shown below:

    0 1q 0

    0 1

    q 2q 1

    0

    q 3

    0, 1

    1

     

     At state q0, for example, if the input is 0, the DFA moves to only one state which isq1. If the input is 1, the DFA moves again to only one state which is q3. The samecan be said about all the other states.

    Since the DFA can move to only one state from any given current state, then thisimplies that a DFA can only be in one state at any one time.

    Nondeterminism

    Page 2 of 33

    Consider now the following finite automaton:

    0 1q 0

    0, 1

    q 2q 1

     

    Without going through detailed computations, it can be observed that this machinealso accepts strings that start with a 0 and end with 1.

     A careful examination of this machine shows that if it is at state q1 and the input isequal to 1, the machine goes to state q2 and stays at q1 at the same time. This isbecause state q2 has two outgoing edges labeled with the symbol 1. States in aDFA always have only one outgoing edge for each input symbol.

    The given machine is not considered a DFA because there is a situation in which asingle input symbol causes the automaton to move to more than one state.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    3/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 3 of 18

    NondeterministicPage 3 of 33

    The given graph is the state diagram for a nond eterminist ic f ini te automaton  (NFA).

    Because an NFA can move to more than one state given a single input symbol, anNFA is said to have “choices.” 

    Take the given NFA as an example. If the NFA is currently in state q1 and an inputsymbol 1 arrives, the NFA has the option of either staying in state q1 or going tostate q2. In DFAs, there is always no choice. There is always one state to go togiven a certain input symbol.

    NondeterminismPage 4 of 33

    Since the NFA has the option of either staying in state q1 or going to state q2, theNFA will consider both possibilities.

    How will this be done?

    The NFA will make a “copy” of itself. There are now two “copies” of the same NFA.One copy will stay at state q1  and continue the computation from there. Thesecond copy will go to state q2 and also continue the computation from that state.From this point on, there will be two computations occurring simultaneously.

    In other words, the NFA has the ability to “guess” the outcome of the computation.In the example given, the NFA tries to see if a string will be accepted by continuing

    the computation at state q1. At the same time, it also tries to see if the same inputstring will be accepted if i t continues the computation at state q2.

    Effectively, the NFA is said to be in two states, q1 and q2, at the same instance.This is another characteristic of NFAs. It is possible for an NFA to be in severalstates at any given time.

    This is in contrast with a DFA since DFAs can only be in one state at a time. InDFAs, there can only be one computation occurring at any time.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    4/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 4 of 18

    NondeterminismPage 5 of 33

    Notice also that in an NFA, it is possible that a state may not have a transition edgefor one or more of the input symbols of the alphabet.

    In the given example, take note that for state q0, there is a transition edge for inputsymbol 0 but none for 1. If there happens to be a copy of the NFA that is currently

    at state q0 and an input symbol 1 arrives, this copy has nowhere to go becausethere is no outgoing or transition edge for an input equal to 1. The computationbeing done by this copy of the NFA stops and it ceases to exist. This copy of theNFA simply “dies.” 

    Similarly, state q2 of the given NFA has no outgoing edge for both input symbols ofthe alphabet. So if there happens to a copy of the NFA that is at state q2 and 1 ora 0 arrives, this copy also stops processing and dies.

    NondeterminismPage 6 of 33

    Here is an example to illustrate how an NFA processes strings.

    Given the same NFA that accepts strings that start with a 0 and end with a 1:

    0 1q 0

    0, 1

    q 2q 1

     

    Let us determine if the string 01011 will be accepted.

    1. Initially, the NFA will be at state q0. When the first input symbol (0)arrives, the NFA goes to state q1 as shown below:

    q 0

    q 1

    0

    input state

    start

     

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    5/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 5 of 18

    NondeterminismPage 7 of 33

    2. Assume now that the second input symbol (1) arrives. The NFA (which iscurrently in state q1) has two options, either it stays at q1 or goes to q2.The machine will try both possibilities at the same time. It will then stay atstate q1 and go to state q2 simultaneously. This is shown below:

    q 0

    q 1

    0

    input state

    (start)

    q 1

    1

    q 2  

    In other words, the NFA made another copy of itself. One copy tocontinue the processing at state q1 and the other at state q2. There are

    now two computations occurring at the same time. The NFA is said to bein both states q1 and q2.

    NondeterminismPage 8 of 33

    3. Assume now that the third input symbol (0) arrives. There are currentlytwo copies of the NFA, one is at state q1 while the other is at state q2.The copy of the NFA which is at state q1 stays at q1. The copy which is atstate q2 stops processing because it has nowhere to go. In other words,this copy of the NFA dies.

    q 0

    q 1

    0

    input state

    (start)

    q 1

    1

    q 2

    q 1

    (stopped)

    0

     

    Hence, at this point in time, there will only be one remaining copy of theNFA—the one that is still at state q1.

    If it so happens that all copies of the NFA die at a certain input symbol,then the entire NFA ceases to exist and the string is rejected.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    6/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 6 of 18

    NondeterminismPage 9 of 33

    4. Assume now that the fourth input symbol (1) arrives. There is only onecopy of the NFA and it is currently in state q1. The NFA will again havetwo options, either stay at q1 or go to q2. The NFA will again considerboth possibilities. So it will create another copy of itself. One copy willcontinue the computation at state q1 while the other at state q2.

    q 0

    q 1

    0

    input state

    (start)

    q 1

    1

    q 2

    q 1

    (stopped)

    0

    q 1   q 2

    1

     

    The NFA is again said to be in states q1 and q2 simultaneously.

    NondeterminismPage 10 of 33

    5. Assume now that the fifth and last input symbol (1) arrives. There arecurrently two copies of the NFA, one is at state q1 and the other at q2.The copy of the NFA which is at state q1 has the option of staying at q1 orgoing to q2. As usual, the NFA will consider both so it creates anothercopy of itself —one to continue the computation at state q1 and the otherat state q2.

    The other copy which is at state q2 stops processing and ceases to exist.

    q 0

    q 1

    0

    input state

    (start)

    q 1

    1

    q 2

    q 1

    (stopped)

    0

    q 1   q 2

    1

    q 1   q 2

    (stopped)

    1

     

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    7/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 7 of 18

    NondeterminismPage 11 of 33

     After the last input, there are two copies of the NFA. One copy is currently at stateq1 and another at state q2 (which is a final state). So the NFA is currently in bothstates q1  and q2. Since at least one of the copies is at a final state, the NFAaccepts the input string 01011.

    If it so happens that there is no copy of the NFA that is in a final state, then thestring will be rejected.

    Here is another example. Given the following NFA, determine if the string 110110will be accepted.

    1 0, 1q 0

    0, 1

    q 1   q 3q 2

    0, 1

     

    NondeterminismPage 12 of 33

    1. Initially, the NFA will be at state q0. When the first input symbol (1)arrives, the NFA has two options—either stay at q0 or go to q1. The NFAwill now create a copy of itself. One copy continues the processing atstate q0 while the other copy continues at state q1.

    q 0

    1

    input   state

    (start)

    q 1q 0  

    There will now be two copies of the NFA. One copy is at state q0 whilethe other is at state q1. So the NFA is said to be in states q0 and q1.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    8/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 8 of 18

    NondeterminismPage 13 of 33

    2. There are currently two copies of the NFA. One is at state q0 while theother is at q1. When the second input symbol (1) arrives, the copy of theNFA which is at state q0 has two options—either stay at q0 or go to q1.The machine will try both possibilities so it creates a copy of itself. Onecopy continues the processing at q0 while the other at state q1.

    On the other hand, the copy which is at state q1 will go to state q2.

    q 0

    1

    input   state

    (start)

    1

    q 0   q 1   q 2

    q 1q 0

     

    There will now be three copies of the NFA. One is at state q0, the secondone is at state q1, and the third is at state q2. The NFA is then said to bein states q0, q1, and q2.

    NondeterminismPage 14 of 33

    3. There are currently three copies of the NFA. One is at state q0, anotherat state q1, and the third copy is at state q2. When the third input symbol(0) arrives, the copy of the NFA which is at state q0 stays at q0, the copywhich is at state q1 goes to q2, and the copy which is at q2 goes to stateq3.

    q 0

    1

    input   state

    (start)

    1

    0

    q 2q 0   q 3

    q 0   q 1   q 2

    q 1q 0

     

    The NFA is now said to be in states q0, q2, and q3.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    9/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 9 of 18

    DeterminismPage 15 of 33

    4. There are currently three copies of the NFA. One is at state q0, anotherat state q2, while the third copy is at state q3. When the fourth inputsymbol (1) arrives, the copy of the NFA which is at state q0  has twooptions—stay at q0 or go to q1. The machine will try both possibilities so itcreates another copy of itself —one copy to continue the processing at

    state q0 and another to continue at state q1.

    The second copy which is at state q2 will go to q3.

    The third copy which is at state q3 stops computing because it hasnowhere to go.

    q 0

    1

    input   state

    (start)

    1

    0

    1

    q 1q 0   q 3

    q 2q 0   q 3   (stopped)

    q 0   q 1   q 2

    q 1q 0

     

    The NFA is now said to be at states q0, q1, and q3.

    NondeterminismPage 16 of 33

    5. There are currently three copies of the NFA. One is at state q0, anotherat state q1, while the third copy is at state q3. When the fifth input symbol(1) arrives, the copy of the NFA which is at state q0 has two options—stay

    at q0  or go to q1. The machine will try both possibilities so it createsanother copy of itself —one copy to continue the processing at state q0 and another to continue at state q1.

    The second copy which is at state q1 will go to q2.

    The third copy which is at q3 stops processing and ceases to exist.

    q 0

    1

    input   state

    (start)

    1

    0

    1

    (stopped)

    1

    q 0   q 1   q 2

    q 1q 0   q 3

    q 2q 0   q 3  (stopped)

    q 0   q 1   q 2

    q 1q 0

     

    The NFA is now said to be at states q0, q1, and q2.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    10/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 10 of 18

    NondeterminismPage 17 of 26

    6. There are currently three copies of the NFA. One is at state q0, anotherat state q1, while the third copy is at state q2. When the sixth and finalinput symbol (0) arrives, the copy of the NFA which is at state q0 stays atq0. The second copy which is at state q1  goes to q2. The third copywhich is at state q2 goes to q3.

    q 0

    1

    input   state

    (start)

    1

    0

    1

    q 0   q 2

    (stopped)

    1

    q 3

    q 0   q 1   q 2

    q 1q 0   q 3

    q 2q 0   q 3  (stopped)

    q 0   q 1   q 2

    q 1q 0

    0

     

    Nondeterminism

    Page 18 of 33The NFA is now at three states, q0, q2, and q3. Since one of these states is afinal state (q3), then the NFA accepts the input string 110110.

    Take note that the NFA in this example will accept all strings whose third to the lastinput symbol is a 1.

    ε -Transitions

    One other difference between an NFA and a DFA is that an NFA may have ε - transi t ions  (epsilon transitions). An ε-transition is shown below:

    q  jq i

     

     An ε -transition, also called si lent transi t ion , from state qi to state q j is depicted asa directed edge from qi to q j with a label ε  signifying no input symbol.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    11/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 11 of 18

    NondeterminismPage 19 of 33

     An ε -transition from state qi to state q j means that once an NFA goes to state qi, ithas the option of staying at qi or it can go right away to state q j even without anyadditional input arriving.

    So once an input symbol causes the NFA to go to state qi, the NFA will

    automatically create a copy of itself that will also go to q j. So the NFA will be instates qi and q j at the same time.

    Example:

    Given the following NFA, determine if the string 010010 will be accepted.

    q 0

    0

    q 2q 1

    1

     

    NondeterminismPage 20 of 33

    1. Initially, the NFA will be at state q0. When the first input symbol (0)arrives, the NFA goes to q1.  At q1, it has the option of immediately goingto q2  without any new input symbol arriving. This is because of the ε -transition from state q1  to state q2. The NFA will consider bothpossibilities so it creates another copy of itself. One copy will continuethe computation at state q1 while the other copy will continue at state q2.

    q 0

    q 1

    0

    input state

    (start)

    q 2  

    The NFA is said to be in states q1 and q2.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    12/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 12 of 18

    NondeterminismPage 21 of 33

    2. There are currently two copies of the NFA. One copy is at state q1 whileother is at state q2. When the second input symbol (1) arrives, the copyof the NFA which is at state q1 stops computing since it has nowhere togo. It therefore ceases to exist. The copy at state q2 will go to state q0.The NFA will then only be in one state which is q0.

    q 0

    q 1

    0

    input state

    (start)

    q 0

    1

    q 2(stopped)

     

    NondeterminismPage 22 of 26

    3. There is currently only one copy of the NFA which is at state q0. Whenthe third input symbol (0) arrives, the NFA goes to q1.  But once at q1, ithas the option of immediately going to q2 without any new input symbolarriving. This is caused again by the ε -transition from state q1 to state q2.The NFA will consider both possibilities so it creates another copy ofitself. One copy will continue the computation at state q1 while the othercopy will continue at state q2.

    q 0

    q 1

    0

    input state

    (start)

    q 0

    1

    q 2(stopped)

    q 1   q 2

    0

     

    The NFA is now said to be in states q1 and q2.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    13/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 13 of 18

    NondeterminismPage 23 of 33

    4. There are currently two copies of the NFA. One copy is at state q1 whileother is at state q2. When the fourth input symbol (0) arrives, the copy ofthe NFA which is at state q1 stays at q1. Since there is an ε -transitionfrom q1 to q2, it will also immediately go to q2 by creating another copy ofitself.

    The second copy of the NFA (the one at state q2) ceases to existbecause it has nowhere to go.

    q 0

    q 1

    0

    input state

    (start)

    q 0

    1

    q 2(stopped)

    q 1   q 2

    0

    (stopped)

    q 1   q 2

    0

     

    The NFA is now in states q1 and q2.

    NondeterminismPage 24 of 33

    5. There are currently two copies of the NFA. One copy is at state q1 whilethe other is at state q2. When the fifth input symbol (1) arrives, the copyof the NFA which is at state q1 stops computing since it has nowhere togo. The remaining copy of the NFA (the one at state q2) goes to q0.There is now only one copy of the NFA.

    q 0

    q 1

    0

    input state

    (start)

    q 0

    1

    q 2(stopped)

    q 1   q 2

    0

    (stopped)

    q 1   q 2

    q 0

    0

    1

    (stopped)

     

    The NFA is said to be in state q0 only.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    14/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 14 of 18

    NondeterminismPage 25 of 33

    6. There is currently only one copy of the NFA which is at state q0. Whenthe sixth and last input symbol (0) arrives, the NFA goes to q1.  Once atq1, it has the option of immediately going to q2  without any new inputsymbol arriving. This is caused again by the ε -transition from state q1 tostate q2. The NFA will consider both possibilities so it creates another

    copy of itself. One copy will continue the computation at state q1 whilethe other copy will continue at state q2.

    The NFA will then be at state q1 and state q2. Since one of these statesis a final state (q1), the string 010010 is accepted.

    Take note that this NFA accepts all strings that start and end with a 0. Ifan input string starts with a 1, the NFA immediately dies (state q0 has nooutgoing edge for input symbol 1) and the string is rejected.

    NondeterminismPage 26 of 33

    This figure shows the complete flow with an input string of 010010.

    q 0

    q 1

    0

    input state

    (start)

    q 0

    1

    q 2(stopped)

    q 1   q 2

    0

    (stopped)

    q 1   q 2

    q 0

    0

    1

    q 1   q 2

    0

    (stopped)

     

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    15/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 15 of 18

    NondeterminismPage 27 of 33

    To summarize the differences between an NFA and a DFA:

    1. NFAs can move to more than one state from any given currentstate. They can therefore be in several states at the same time.DFAs can only be in one state at a time.

    2. In a given state, NFAs may not necessarily have a transition edgefor each symbol in the alphabet. Each state in a DFA must have atransition edge for each input symbol in the alphabet.

    3. NFAs can move to a state even without any input symbol arriving(ε-transitions). This is not possible for DFAs.

    [Nondeterminism, Pages 1 –

    27 of 33] 

    Nondeterministic Finite AutomataPage 28 of 33

    Nondeterministic Finite Automata 

    Formal Definition:

    The formal definition of a NFA is similar to that of a DFA. Recall that thedefinition of a DFA is obtained by simply listing the components of an

    automaton, which are the set of states (Q), the alphabet ( ), the transition

    function ( ), the start state (q0), and the set of final states (F ).

    The main difference between the two definitions is in the transition function.

    The transition function of an NFA must consider the possibility of state

    transitions even if there is no input symbol (ε -transitions).

    The transition function must also consider the possibility that the NFA maygo to several states given the same input symbol. It may even not go toany state at all (the copy dies) given an input symbol because there is notransition edge for that particular input symbol.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    16/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 16 of 18

    Nondeterministic Finite AutomataPage 29 of 33

    For example:

    0 1q 0

    0, 1

    q 2q 1

     

    The formal definition of this NFA is a 5-tuple N 1 = {Q,  ,  , q0, F } where:

    1. Q = {q0, q1, q2}

    2.   = {0, 1}

    3.  : 

    4. Start State = q0.

    5. F  = {q2}

    Take note that the transition function has the symbol ε   together with theinput symbols. The ε  should not be taken as an actual input symbol. It iswritten there to take into consideration ε -transitions. In this NFA, there areno ε -transitions indicated by the absence of any entry below it.

    Blank entries in the transition function indicate no transition will occur whenthe NFA is in a particular state and a certain input symbol arrives. Forexample, if the NFA is currently in state q0 and the input is equal to 1, theNFA stops processing because it has nowhere to go. This is becausethere is a blank entry at the intersection of state q0 and input symbol 1 inthe table. Mathematically:

      (q0, 1) =  

    Finally, take note of the two entries (q1 and q2) at the intersection of stateq1 and input symbol 1 in the table. This means that if the NFA is in stateq1 and the incoming input is 1, the NFA will go to two states, q1 and q2.Mathematically:

      (q1, 1) = {q1, q2}

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    17/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STIPage 17 of 18

    Designing Deterministic Finite AutomataPage 30 of 33

     Another example:

    q 0

    0

    q 2q 1

    1

     

    The formal definition of this NFA is a 5-tuple N 2 = {Q,  ,  , q0, F } where:

    1. Q = {q0, q1, q2}

    2.   = {0, 1}

    3.  : 

    4. Start State = q0 

    5. F  = {q1}

    Nondeterministic Finite AutomataPage 31 of 33

    For each of the following NFA examples, have the students formally describe theNFA by listing down the components of each (set of states, set of symbols, thetransition table, the start state, and the set of final states). Then, let them

    experiment with various strings to determine the strings that will be accepted andrejected by the NFA. Finally, have them come up with a generalized statement onthe strings accepted by the NFA.

    It is not advised that the instructor let the students work on all the examples andthen later present to them all the solutions.

    Instead, it is highly recommended that the students work on them one at a time.Meaning, have them work on one example for 5 to 10 minutes. Then present tothem the solution for that example. After that, have them work on the secondexample for another 5 to 10 minutes and then present to them the solution. In thisway, the students learn from their mistakes before proceeding to solve the nextexercise.

    For NFA N 1: This NFA accepts all strings that are “multiples” of 10 (such as 10,1010, 101010) including the empty string.

    For NFA N 2: This NFA accepts all strings that contain the substring 11.

  • 8/21/2019 MELJUN CORTES Automata Lecture Nondeterministic Finite Automata 1

    18/18

     

    Theory of Computation (With Automata Theory)

    Nondeterministic Finite Automata *Property o f STI18 f 18

    Nondeterministic Finite AutomataPage 32 of 33

    For NFA N 3: This NFA accepts all strings that are “multiples” of 010 (such as 010,010010, 010010010) or strings that are multiples of 101 (such 101, 101101,101101101), or strings that are multiples of 101 followed by multiples of 010 (suchas 101010, 101101010010). The NFA also accepts the empty string.

    For NFA N 4: This NFA accepts all strings that contain the substring 11 or 101.

    Nondeterministic Finite AutomataPage 33 of 33

    The state diagram for the required DFA:

    In an NFA, a state may have zero, one, or many outgoing edges for each inputsymbol, and an NFA may or may not have an ε -transition. DFAs can only haveone outgoing edge for each input symbol and they cannot have ε -transitions.

    By careful analysis of the definitions of both NFA and DFA, a DFA may beconsidered as a special type of NFA with the following restrictions:

    1. DFAs can only have one outgoing edge for each input symbol and each

    input symbol must have an outgoing edge.

    2. A DFA cannot have ε -transitions.

    It can therefore be said that a DFA is a restricted type of NFA. In fact, all DFAs areNFAs.

    However, not all NFAs are DFAs.

    In other words, nondeterminism is a generalization of determinism.

    [Nondeterministic Finite Automata, Pages 28 –33 of 33]