Autmata ch2
Autmata ch2
Example: δ(q0, a) = q1
δ(q0, 1) = q1
• Finite automata is called deterministic finite automata if the machine read an input string one
symbol at a time.
• Deterministic refers to the uniqueness the computation.
• In DFA, there is only one path for specific input symbol from current state to the next state.
• DFA does not accept the null move.
• DFA cannot change the state without any input character.
• DFA can contains multiple final state.
• DFA is used in lexical analysis in compiler.
q0 b q1
a
q2
• Example 2: Design DFA with given ∑ = {0,1} that accepts those string which
starts with 1 and ends with 0.
• Solution: minimum length of string is 2.
L = { 10, 100, 1010, 11001100, …. }
Number of states = |minimum length| + 1
=2+1
=3
• DFA Diagram
• Design DFA with given ∑ = {0,1} that accepts even number of 0’s and even
number of 1’s.
• Solution: minimum length of string is 3.
L = { 001, 110, 100, …. }
DFA Diagram
• Construct DFA that accepting all strings over ∑ = {a, b} ending with ab.
• Solution: minimum length of string is 2.
number of states = 2+1 =3
L = {ab, aab, bab, bbab…. }
0
b a
DFA Diagram q0 a b q
q
1 a 2
b
• The finite automata are called NFA when there exist many paths for specific input
from the current state to the next state.
• It is easy to construct an NFA than DFA for a given regular language.
• Every NFA is not DFA, but each NFA can be translated into DFA.
• NFA is defined in the same way as DFA but with the following two exceptions:
1. it contains multiple next states, and
2. it contains ε transition.
• we can see that from state q0 for input a, there are two next states q1 and q2
• similarly, from q0 for input b, the next states are q0 and q1.
• Thus it is not fixed or determined that with a particular input where to go next.
• Hence this FA is called non-deterministic finite automata.
• NFA also has five tuples same as DFA, but with different transition function, as
shown follows:
• δ: Q x ∑ →2Q
• where,
• Q finite set of States
• ∑ finite set of input symbol
• q0 initial state
• F final state
• δ transition function
11/26/2022 Global College 21
Graphical Representation of an NFA
• In the above diagram, we can see that when the current state is q0, on input 0,
the next state will be q0 or q1, and on 1 input the next state will be q1.
• When the current state is q1, on input 0 the next state will be q2 and on 1
input, the next state will be q0.
• When the current state is q2, on 0 input the next state is q2, and on 1 input the
next state will be q1 or q2.
• Transition Table:
Present State Next state for Input 0 Next State of Input 1
→q0 q1 ε
q1 ε q2
*q2 q2 q2
11/26/2022 Global College 24
Example 3
• Transition Table
• Design an NFA with ∑ = {0, 1} accepts all string ending with 01.
• Construct NFA for set of strings of all that starts with 0 over {0, 1}
Solution:
0,1
q0 0 q1