0% found this document useful (0 votes)
27 views29 pages

FAFL-Final-Lecture 3.2

The document discusses deterministic finite automata (DFA). It defines DFA using quintuple notation and provides representation using transition diagrams and tables. It then discusses simple problems on constructing DFAs to accept various strings and prefixes over given alphabets.

Uploaded by

shruthi g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views29 pages

FAFL-Final-Lecture 3.2

The document discusses deterministic finite automata (DFA). It defines DFA using quintuple notation and provides representation using transition diagrams and tables. It then discusses simple problems on constructing DFAs to accept various strings and prefixes over given alphabets.

Uploaded by

shruthi g
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Established as per the Section 2(f) of the UGC Act, 1956

Approved by AICTE, COA and BCI, New Delhi

Lecture 3.2
Deterministic Finite Automata
School of Computing and Information
Technology
Ms. Shruthi G
[email protected]
AY:2020-2021
OUTLINE

Recap of Previous Lecture

Topic of the Lecture

Lecture Discussion

• Deterministic Finite Automata (DFA)


• Simple Problems on DFA Construction
• DFA accepting strings containing given Prefix
Deterministic Finite Automata
Recap of Previous Lecture
RECAP OF PREVIOUS LECTURE

Course Description • Finite Automata


• Transition Diagram
Finite • Configuration of Finite Automata
Automata
• Transition Function (δ)
• Extended Transition Function (δ*)
• Language Accepted and Rejected by Finite Automata
• Classification of Finite Automata
Deterministic Finite Automata
Topic of the Lecture
TOPIC OF THE LECTURE

Deterministic • Deterministic Finite Automata - Definition


Finite
• Simple Problems on DFA Construction
Automata
• DFA accepting strings that contain given Prefix
Finite Automata
Deterministic Finite Automata
DETERMINISTIC FINITE AUTOMATA
Definition
A Deterministic Finite Automaton (DFA) M is defined as
M = (Q, S, d, q0, F )
where
 Q is a finite non-empty set of internal states of M
 S is an alphabet (finite set of input symbols)
 d: Q × S → Q is a transition function
 q0  Q is the initial state
 F  Q is a set of accepting states or final states.

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 }

Transition Diagram Transition Table


δ a b
q0 q1 q5
q1 q5 q2
q2 q5 q3
q3 q4 q5
*q4 q5 q5
q5 q5 q5
Finite Automata
Simple Problems on DFA Construction
SIMPLE PROBLEMS ON DFA CONSTRUCTION
Problem Solving
Construct a DFA to accept the string “ab” over an alphabet {a, b}.
Here
Ʃ={a, b} and L = {ab}

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

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 including λ

δ 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

John E Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, Introduction to Automata


Theory, Languages and Computation, 3rd Edition, Pearson Education, 2009.

Peter Linz, An Introduction to formal Languages and Automata, 4/ E, Jones


and Bartlett Publishers, 2006.
RESOURCES AND TASK
Optional and non-optional tasks to be
completed
Optional Task

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

John E Hopcroft, Rajeev Motwani, Jeffrey D. Ullman, Introduction to Automata


Theory, Languages and Computation, 3rd Edition, Pearson Education, 2009.

Peter Linz, An Introduction to formal Languages and Automata, 4/ E, Jones


and Bartlett Publishers, 2006.
DISCUSSION
5 MINUTES

Construct a DFA to accept strings over {a,b} that begins with λ.


QUIZ
Questions from Lecture 3.1

1. Which of the following statement is correct?

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

2. The transition function of DFA machine is ___________

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

C) 3 D) None of the Mentioned

4. Which of the following statement is true for DFA?

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

5. Deterministic Finite state machine is _______ tuple machine

A) 4 B) 5

C) 6 D) unlimited

6. Minimum number of states required in DFA to accept binary strings


beginning with ”00” is _________

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

You might also like