Professional Documents
Culture Documents
l5 Updated Dfa MSK
l5 Updated Dfa MSK
By
Dr. M. Senthilkumar
Assistant Professor (SG), CSE Dept,
ASE, CBE
Extended Transition Function for a DFA
➢ Extended transition function δ ∗ : Q × Σ ∗ → Q is defined
recursively:
Finally,
Language Accepted by a DFA
➢ The language accepted by a DFA M = (Q, Σ, δ, q0, F) is
L(M) = {w ∈ Σ∗ : δ∗(q0, w) ∈ F}
➢ L(M) is the set of all strings on the input alphabet accepted by
automaton M
➢ Example: Language accepted by the automaton given below is
L = {anb : n ≥ 0}.
Regular Language
➢A language L is called regular if and only if there exists a
DFA M such that L = L(M).
➢Thus, DFAs define the family of languages called
regular.
➢ Regular Language can be represented by an equivalent
DFA.
Regular Language = DFA
Steps for DFA Construction
Steps for building a DFA to recognize L:
Given ∑ = some set of alphabets
start a
q0 q1
q1 q1 q2
empty strings? *q2 q2 q2
7
Example #3
State Design
q0 : start state
q1: has never seen 11 but the most recent input was a 1
8
Contd...DFA for strings containing 11
111111
000110
10110
010110
1000110
• Q = {q0,q1,q2}
• What makes this DFA deterministic?
0 0,1 • ∑ = {0,1}
• start state = q0
start 1 1
q0 q1 q2 • F = {q2}
Accepting • Transition table
symbols
state
0 1
q0 q0 q1
• What if the language allows
states
q1 q0 q2
empty strings? *q2 q2 q2
9
Problems on DFA Designing
4. Construct a DFA accepting set of string over
{a, b} where each string containing ‘a’ as the
substring.
Solution:
The state transition diagram of the language
containing ‘a’ as the substring will be
5. DFA for strings containing ab
bbbabb
aaaaba
baba
ababa
baaaba
• What makes this DFA deterministic? • Q = {q0,q1,q2}
a a,b • ∑ = {a,b}
a
• start state = q0
start b b
q0 q1 q2 • F = {q2}
Accepting • Transition table
symbols
state
a b
states q0 q1 q0
q1 q1 q2
*q2 q2 q2
11
Practice Questions on DFA Designing
1. Construct a DFA for the set of string over {a, b}
such that length of the string |w| is divisible by 2.
2. Construct a DFA for the set of string over {a, b}
such that length of the string |w| is not divisible by
3.
3. Construct a DFA accepting a set of strings over {a,
b} in which {abwa / wε{a, b}*}.
Solutions:
Attached as a word doc
(filename - Assignment QsAs-DFA Design_MSK.doc)
Thank You