Toc Unit1
Toc Unit1
COMPUTATION
Automata
a a b
b c a
c b c
Its graphical representation would be as follows
In NDFA, for a particular input symbol, the machine can move to any
combination of the states in the machine. In other words, the exact state to
which the machine moves cannot be determined. Hence, it is called Non-
deterministic Automaton. As it has finite number of states, the machine is
called Non-deterministic Finite Machine or Non-deterministic Finite
Automaton.
• Formal Definition of an NDFA
• An NDFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −
• Q is a finite set of states.
• ∑ is a finite set of symbols called the alphabets.
• δ is the transition function where δ: Q × ∑ → 2Q
• (Here the power set of Q (2Q) has been taken because in case of NDFA,
from a state, transition can occur to any combination of Q states)
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).
Graphical Representation of an NDFA: (same as DFA)
• Example
• Let a non-deterministic finite automaton be →
• Q = {a, b, c}
• ∑ = {0, 1}
• q0 = {a}
• F = {c}
• The transition function δ as shown below −
Present State Next State for Input Next State for Input
0 1
a a, b b
b c a, c
c b, c c
Example
Let us consider the DFA From the DFA, the acceptable strings can be derived.
• Input − An NDFA
• Output − An equivalent DFA
• Step 1 − Create state table from the given NDFA.
• Step 2 − Create a blank state table under possible input alphabets
for the equivalent DFA.
• Step 3 − Mark the start state of the DFA by q0 (Same as the
NDFA).
• Step 4 − Find out the combination of States {Q0, Q1,... , Qn} for
each possible input alphabet.
• Step 5 − Each time we generate a new DFA state under the input
alphabet columns, we have to apply step 4 again, otherwise go to
step 6.
• Step 6 − The states which contain any of the final states of the
NDFA are the final states of the equivalent DFA.
q δ(q,0) δ(q,1)
a {a,b,c,d,e} {d,e}
b {c} {e}
c ∅ {b}
d {e} ∅
e ∅ ∅
Using the above algorithm, we find its equivalent DFA. The state table of the DFA
is shown in below.
q δ(q,0) δ(q,1)
[d,e] [e] ∅
[e] ∅ ∅
[c, e] ∅ [b]
[c] ∅ [b]
The state diagram of the DFA is as follows
DFA Minimization using Myphill-Nerode Theorem
Algorithm
• Input − DFA
• Output − Minimized DFA
• Step 1 − Draw a table for all pairs of states (Qi, Qj) not
necessarily connected directly [All are unmarked initially]
• Step 2 − Consider every state pair (Qi, Qj) in the DFA where
Qi ∈ F and Qj ∉ F or vice versa and mark them. [Here F is the
set of final states]
• Step 3 − Repeat this step until we cannot mark anymore states −
• If there is an unmarked pair (Qi, Qj), mark it if the pair {δ (Qi,
A), δ (Qi, A)} is marked for some input alphabet.
• Step 4 − Combine all the unmarked pair (Qi, Qj) and make them
a single state in the reduced DFA.
Step 1 − We draw a table for all pair of states.
a b c D e f
f
• Step 2 − We mark the state pairs.
a b c D e f
c ✔ ✔
d ✔ ✔
e ✔ ✔
f ✔ ✔ ✔
• Step 3 − We will try to mark the state pairs, with green colored
check mark, transitively. If we input 1 to state ‘a’ and ‘f’, it
will go to state ‘c’ and ‘f’ respectively. (c, f) is already marked,
hence we will mark pair (a, f). Now, we input 1 to state ‘b’ and
‘f’; it will go to state ‘d’ and ‘f’ respectively. (d, f) is already
marked, hence we will mark pair (b, f).
a b c D e f
c ✔ ✔
d ✔ ✔
e ✔ ✔
f ✔ ✔ ✔ ✔ ✔
• After step 3, we have got state combinations {a, b} {c, d} {c,
e} {d, e} that are unmarked.
• We can recombine {c, d} {c, e} {d, e} into {c, d, e}
• Hence we got two combined states as − {a, b} and {c, d, e}
• So the final minimized DFA will contain three states {f}, {a,
b} and {c, d, e}
DFA Minimization using Equivalence Theorem
a b C
b a D
c e F
d e F
e e F
f f F
• Let us apply the above algorithm to the above
DFA −
• P0 = {(c,d,e), (a,b,f)}
• P1 = {(c,d,e), (a,b),(f)}
• P2 = {(c,d,e), (a,b),(f)}
• Hence, P1 = P2.
• There are three states in the reduced DFA. The
reduced DFA is as follows −
Q δ(q,0) δ(q,1)