Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

Lecture on

Extended δ, Language Accepted by DFA and


Regular Language, DFA Construction

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:

➢ The extended transition function gives the state of the automaton


after reading a string.
➢ For example, if δ(q0,a) = q1 and δ(q1,b) = q2, then
δ* (q0,ab) = ?
δ* (q0,ab) = δ (δ*(q0,a), b)) = ?

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

 Decide on the states: Q

 Designate start state and final state(s)

 δ: Decide on the transitions:

 “Final” states == same as “accepting states”

 Other states == same as “non-accepting states”


Example Problems on DFA Designing
1. Design an automaton that accepts only the
input alphabet ‘a’.
Solution:

start a
q0 q1

Very important Note:


Do not forget to mark initial state with arrow and accepting /final
state with double circle in all finite automata
2. DFA for strings containing 01
111011
000010
1010
01010
100010
• What makes this DFA deterministic? • Q = {q0,q1,q2}
1 0,1 • ∑ = {0,1}
0
• start state = q0
start q 0 1
0 q1 q2 • F = {q2}
Accepting • Transition table
symbols
state
0 1
q0 q1 q0
• What if the language allows
states

q1 q1 q2
empty strings? *q2 q2 q2
7
Example #3

 Build a DFA for the following language

 L = { w ϵ {0,1}*| w is a bit string which contains the substring 11 }

 State Design

 q0 : start state

 q1: has never seen 11 but the most recent input was a 1

 q2: has seen 11 at least once

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

You might also like