Professional Documents
Culture Documents
ATC Class Work Finite Automata Book by Padma Reddy
ATC Class Work Finite Automata Book by Padma Reddy
ATC Class Work Finite Automata Book by Padma Reddy
https://books.google.co.in/books?id=RSODknf4pyIC&pg=PA54&lpg=PA54&dq=dfa+fo
r+mod+5+padma+reddy&source=bl&ots=VosvkNYa80&sig=ACfU3U2HY3WKDCFAooO
N7tVU-
kKEcWEN7Q&hl=en&sa=X&ved=2ahUKEwiC2ufIzK7sAhUYxDgGHcD0B0UQ6AEwDHoE
CAEQAg#v=onepage&q=dfa%20for%20mod%205%20padma%20reddy&f=true
Construct DFA which accepts strings of 0s and 1s where the value of each string is
represented as a binary number. only string representing modulo 5 must be accepted,
example – 0000, 0101, 1010, 1111, etc
Construct a DFA to accept strings of even number of a’s and b’s. process the accepted
and rejected strings
ATC Class work
A = (Q, Ʃ , 𝞭, q0, F)
1] Design a NFA for accepting strings of 0’s and 1’s ending with substring 01, and
Convert NFA to DFA using Subset construction method
𝞭N 0 1
->q0 { q0, q1} { q0 }
q1 ɸ { q2 }
*q2 ɸ ɸ
QD = { ɸ, q0, q1, q2, {q0, q1}, {q0, q2}, {q1, q2}, {qo, q1, q2} }
throw-away states like – {q1}, {q2}, {q1, q2}, {q0, q1, q2} as they are not reachable from initial state q0.
fig. DFA constructed from the NFA
now trace this DFA for strings acceptance and rejection ð (q0, 001), ð (q0, 0011)
2] Design a NFA for accepting strings of 0’s and 1’s where symbol 1 is present at the
second last position, and Convert NFA to DFA using Subset construction method
States (Q) in the given NFA is, n in no., n =3, QN= {q0, q1, q2}
QD = { ɸ, q0, q1, q2, {q0, q1}, {q0, q2}, {q1, q2}, {qo, q1, q2} }
Transition table for DFA, 𝞭D
𝞭D 0 1
ɸ ɸ ɸ
->q0 { q0} { q0, q1 }
q1 { q2} { q2 }
*q2 ɸ ɸ
{q0, q1} {q0, q2} {q0, q1, q2}
*{q0, q2} {q0} {q0, q1}
*{q1, q2} {q2} {q2}
*{qo, q1, q2} {q0, q2} {q0, q1, q2}
Throw-away states like – {q1}, {q2}, {q1, q2}, as they are not reachable from initial state q0.
fig. DFA constructed from the NFA
now trace this DFA for strings acceptance and rejection ð (q0, 001), ð (q0, 0011)
𝞭 0 1
->p { p, q} {p}
q ɸ {r}
*r {p, r} {q}
ATC Class work
1] Design a NFA for accepting strings of 0’s and 1’s where symbol 1 is present at the
second last position, Ʃ ={0,1}
2] Design a NFA for accepting strings of 0’s and 1’s ending with substring 01, Ʃ ={0,1}
compare the design and list the features of NFA and DFA
Definition of NFA (NFSM)
M = ( Q, Ʃ, q0, 𝞭, F)
5 tuples
Ʃ = {0, 1}
q0 – initial state
NFA example.
1. Design a FSM to accept the strings of a’s and b’s starting with substring ab, the
language is with alphabet Ʃ = {a, b}, show the acceptance and rejection for strs.
L= {ab, ababaa, abb, abaaaaaaaaba…….} RL
L’ = { ba, aa, bb, bab, a, bba, aaab, ………..}
DFA
𝞭 – transition function 𝞭 (q, a) = p p - final or non final state
= ð ( (q2, b), ∈)
= q2
Transitions
(q1, a) = q3, 𝞭 (q1, b) = q2, (q2, a) = q2, 𝞭 (q2, b) = q2, (q3, a) = q3,…..
3. Design a FSM to accept strings of 1’s and 0’s, that begins or ends or both with
substring 01
4. Design a FSM to accept strings of 0’s, 1’s and 2’s, beginning with a ‘0’, followed by
odd number of 1’s and ending with a ‘2’. the language is with alphabet Ʃ = {0, 1, 2}
Assignment questions
1. Design a FSM (FA ) to accept the strings with substring of three consecutive 0’s of the
language with alphabet Ʃ = {0, 1}
2. Design a FSM (FA ) to accept the language with strings of a’s and b’s having four a’s,
language with alphabet Ʃ = {a, b}
L ={ aaaa, bababaa, ababbbaa,
3. Design a FSM (FA ) to accept the language L = { w : na(w) <= 3, w ∈ {a, b}*}
L = {a, aa, aaa, ba, abb, abaa, ababa, …………}
4. Design a FSM (FA ) to accept the strings of a’s and b’s that do not have substring aba
of the language with alphabet Ʃ = {a, b}
L = { a, b, aa, aaabbb, abbb, abbabba, babba, abbbab, …………}
L’= { aba, ababa, ……………. }
==========================================================
Design a FSM (FA ) to accept the strings with substring 010 of the language with
alphabet Ʃ = {0, 1}
Design a FSM (FA ) to accept the strings of a’s and b’s do not ending with substring abb
of the language with alphabet Ʃ = {a, b}
a b b a a
q0 q1 q2 q3 q1 q2