FAFL-Final-Lecture 3.2
FAFL-Final-Lecture 3.2
Lecture 3.2
Deterministic Finite Automata
School of Computing and Information
Technology
Ms. Shruthi G
[email protected]
AY:2020-2021
OUTLINE
Lecture Discussion
Note: Every state must have only one transition (either to same state or to
different state) for every input symbol.
DETERMINISTIC FINITE AUTOMATA
Representation
Let Deterministic Finite Automata M = (Q, S , δ, q0, F ) Quintuple Formulation
where
Q = { q0, q1, q2, q3, q4, q5 } Σ = { a , b } Initial State = q0 F= { q4 }
δ = { δ(q0,a)=q1,δ(q0,b)=q5,δ(q1,a)=q5,δ(q1,b)=q2,δ(q2,a)=q5,δ(q2,b)=q3,δ(q3,a)=q4,
δ(q4,a)=q5,δ(q4,b)=q5, δ(q5,a)= q5,δ(q5,b)=q5 }
a
δ a b
q0 qa b qab
q0 qa qb
b a accept
a, b qa qb qab
qb a, b qb qb qb
TRAP State
Solution *qab qb qb
SIMPLE PROBLEMS ON DFA CONSTRUCTION
Problem Solving
Construct a DFA to accept the strings “aa” and “ab” over an alphabet {a, b}.
Here
Ʃ={a, b} and L = {aa, ab}
q0 a qa a, b qab δ a b
accept
q0 qa qb
b a,b qa qab qab
TRAP qb a, b qb qb qb
State Solution *qab qb qb
SIMPLE PROBLEMS ON DFA CONSTRUCTION
Problem Solving
Construct a DFA to accept the string “a”, “b”, and “ab” over an alphabet {a, b}.
Here
Ʃ={a, b} and L = {a, b, ab}
Solution b δ a b
a qa qab q0 qa qb
q0 a *qa ɸ qab
a, b
*qb ɸ ɸ
b qb *qab ɸ ɸ
a, b ɸ a, b ɸ ɸ ɸ
SIMPLE PROBLEMS ON DFA CONSTRUCTION
Problem Solving
Construct a DFA to accept the string “λ” over an alphabet {a, b}.
Here
Ʃ={a, b} and L = { λ}
Solution δ a b
a, b
q0 ɸ a, b *q0 ɸ ɸ
ɸ ɸ ɸ
SIMPLE PROBLEMS ON DFA CONSTRUCTION
Problem Solving
Construct a DFA to accept the string Ʃ+ over an alphabet {a, b}.
Here Ʃ={a, b} and L = { a, b, ab, ba, aa, bb, aba, abb, baa, bab, …} i.e. All strings except λ
Solution δ a b
a, b q0 q1 q1
q0 q1 a, b
*q1 q1 q1
δ a b
q0
a, b *q0 q0 q0
Solution
Finite Automata
DFA accepting strings that contain given Prefix
DFA ACCEPTING STRINGS THAT CONTAIN GIVEN
Problem Solving
PREFIX
Construct a DFA to accept the strings that begin with “ab” over an alphabet {a, b}.
Here
Ʃ={a, b} and L = {ab, aba, abb, abaa, abbb, abab, abba, …}
Solution a, b δ a b
q0 qa qb
q0 a qa b qab qa qb qab
b a accept *qab qab qab
qb a, b qb qb qb
TRAP State
DFA ACCEPTING STRINGS THAT CONTAIN GIVEN
Problem Solving
PREFIX
Construct a DFA to accept the binary strings that begin with “00” over an
alphabet {0, 1, 2}.
Here
Ʃ={0,1,2} and L = {00, 000, 001, 002, 0000, 0001, 0002, 0010, 0011, 0012, …}
Solution
0,1,2
q0 0 q 0 q2
1
1, 2 1,2 accept
ɸ 0,1,2
TRAP State
DFA ACCEPTING STRINGS THAT CONTAIN GIVEN
Problem Solving
PREFIX
Construct a DFA to accept the strings that begin with abb over an alphabet {a, b}.
Here
Ʃ={a, b} and L = {abb, abba, abbb, abbaa, abbbb, abbab, abbba, …}
Solution a, b
q0 a qa b b qabb
qab
a
b a accept
qb a, b
TRAP State
SUMMARY OF THE LECTURE
Structure of
Finite Definition of Constructing
Automata and Deterministic DFA to accept
Problem
its Finite string
Solving on DFA
Classification Automata containing
(DFA, NFA and (DFA) given Prefix
Epsilon-NFA)
RESOURCES AND TASK
Optional and non-optional reading resources of the
Lecture
Optional Resources
• https://www.eecs.wsu.edu/~ananth/CptS317/Lectures/index.htm
Web • https://www.geeksforgeeks.org/theory-of-computation-automata-tutorials/
resources • https://www.tutorialspoint.com/automata_theory/automata_theory_introdu
ction.htm
Non-Optional Resources
Web • Construct DFA to accept floating point number by following the rules of
resources C programming language.
Non-Optional Task
Web
• Construct DFA for accepting vowels of English alphabet.
resources
SUMMARY OF THE LECTURE
Reading resources for the next lecture
Topic of Next Lecture: DFA construction for various languages with varying String formats
• https://www.eecs.wsu.edu/~ananth/CptS317/Lectures/index.htm
Web • https://www.geeksforgeeks.org/theory-of-computation-automata-tutorials/
resources • https://www.tutorialspoint.com/automata_theory/automata_theory_introduc
tion.htm
A) δ is same for DFA and NFA B) δ is same for NFA and epsilon-
NFA
C) δ is same for NFA, DFA, epsilon-NFA D) None of the mentioned
A)Σ x Q Σ B) Q x Q Σ
C) Σ x Σ Q D) Q x Σ Q
QUIZ
Questions from Lecture 3.1
3. To accept Ф the minimum number of states that a Finite Automata
needed is ______
A) 1 B) 2
A) A state can take multiple transition for B) A state may not take any
same input symbol input
C) All states must take every input exactly D) None of the mentioned
once and make only one transition
QUIZ
Questions from Lecture 3.2
A) 4 B) 5
C) 6 D) unlimited
A) 3 B) 4
C) 2 D) can’t be represented
QUIZ
Questions from Lecture 3.2
7. The language accepted by the 8. The language accepted by the
following DFA over Ʃ = { a, b} is following DFA over Ʃ = { a, b} is
a, b a, b
q q
A) ɸ B) Ʃ* A) ɸ B) Ʃ*
C) Ʃ+ D) λ C) Ʃ+ D) λ
THANK YOU