0% found this document useful (0 votes)
20 views

FAFL Final Lecture 4.2

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)
20 views

FAFL Final Lecture 4.2

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/ 24

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

Approved by AICTE, COA and BCI, New Delhi

Lecture 4.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

• DFA accepting strings that do not contain given Suffix/Prefix/Substring.


Deterministic Finite Automata
Recap of Previous Lecture
RECAP OF PREVIOUS LECTURE

DFA accepting strings that containing given Suffix


Course Description

DFA accepting strings that containing given Substring

The Language Accepted and Rejected by the DFA


Deterministic Finite Automata
Topic of the Lecture
TOPIC OF THE LECTURE

DFA accepting strings that do not contain given Suffix/Prefix/Substring


Deterministic Finite Automata
DFA accepting strings that do not contain given
Suffix/Prefix/Substring
DFA ACCEPTING STRINGS THAT DO NOT CONTAIN GIVEN
Problem Solving
SUFFIX
Construct a DFA to accept the strings that do not end with “ab” over an alphabet
{ a, b }.
Here Ʃ={a, b} and L = {ab, aab, bab, aaab, bbab, abab, abab, …}
L = { λ, a, b, aa, ba, bb, aba, bba, aabb, … }
Construct
SolutionDFA for L Now convert all
a • δ
Final states toaNon-Final
b states.
b accept • Non-Final states to Final sates.

q0 a qa b qab *q0 qa q0

accept accept *qa qa qab


a
b qab qa q0
DFA ACCEPTING STRINGS THAT DO NOT CONTAIN
Problem SUFFIX
GIVEN Solving
Construct a DFA to accept the strings that do not end with “abb” over an alphabet
{a, b}.
Here Ʃ={a, b} and L = {abb, aabb, babb, aaabb, bbabb, ababb, baabb, …}
L = { λ, a, b, aa, bb, ba, bba, bbaa, baba, bbbbbaaa, …. }
Construct DFA for L
Solution
a
b a
q0 a qa b b qabb
qab
accept accept accept
a accept
Now convert all
• Final states to Non-Final states. b
• Non-Final states to Final sates.
DFA ACCEPTING STRINGS THAT DO NOT CONTAIN
Problem PREFIX
GIVEN Solving
Construct a DFA to accept the strings that do not begin with “ab” over an
alphabet { a, b }.
Here Ʃ={a, b} and L = {ab, abb, aba, abaa, abbb, abba, ababa, abaab, abaaba, abaabbb, …}
L = { λ, a, b, aab, bab, aaab, bbab, aaabbb, … }
Construct
Solution DFA for L Now convert all
a, b • δ a b
Final states to Non-Final states.
• Non-Final states to Final sates.
*q0 qa ɸ
q0 a qa b qab
*qa ɸ qab
accept b a accept
accept qab qab qab
ɸ
accept a, b *ɸ ɸ ɸ
DFA ACCEPTING STRINGS THAT DO NOT CONTAIN
Problem SUBSTRING
GIVEN Solving
Construct a DFA to accept the strings that do not contain the substring “00” over
an alphabet {0, 1, 2}.
Here
Ʃ={0,1,2} and L = {00, 000, 100, 200, 0000, 0100, 0200, 1000, 1100, 1200, 20021, 1100211,...}
And L ={ λ, 0,1,2,10,11,12, 01,02,20,21,22,101,102,011,021, …. }
Construct DFA for L
Solution
1,2 0,1,2
accept
q0 0 q 0 q2
1
accept
1,2 accept
Now convert all
• Final states to Non-Final states.
• Non-Final states to Final sates.
DFA ACCEPTING STRINGS THAT CONTAIN GIVEN
Problem Solving
SUBSTRING
Construct a DFA that accept the strings that do not have the substring “abb” over
an alphabet {a, b}.
Here Ʃ={a, b} and L = {abb, abba, babb, aaabb, aaabbbb, abbab, abbba,…}
And L = { λ, a, b, ab, bb, ba, abab, baba, aabaab, …. }
Construct DFA for L
Solution
a,b
b a
q0 a qa b b qabb
qab
accept
a
Now convert all
• Final states to Non-Final states.
• Non-Final states to Final sates.
EXTRA
Problem Solving
Construct a DFA that accept the strings of a’s having at least one a.

Construct a DFA that accept the strings of a’s and b’s having at least one a.

Construct a DFA that accept the strings of a’s and b’s having exactly one a.
Construct a DFA that accept the Language L={awa| w € {a,b}*} (or) L={awa | w€
(a+b) n where n>=0.

Construct a DFA that accept the strings of 0’s & 1’s having three consecutive 0’s.
Construct a DFA that accept the strings of a’s and b’s having exactly 4 a’s.
Construct a DFA that accept the strings of a’s and b’s ending with ab (or) ba.
Construct a DFA that accept the strings of 0’s,1’s and 2’s beginning with 0
followed by odd numbers of 1’s and ending with 2.
Construct a DFA that accept the strings of a’s and b’s with atmost two consecutive
b’s.

Construct a DFA that accept the strings of 0’s and 1’s starting with atleast two 0’s
and ending with atleast two 1’s.
SUMMARY OF THE LECTURE

DFA
DFA
DFA accepting
accepting The Language
accepting strings that
strings that accepted and
strings that do not
containing rejected by
containing contain given
given the DFA
given Suffix Suffix/Prefix/
Substring
Substring
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 binary strings that begin with 0 and end with
resources 1 and do not contain the substring 110 over an alphabet Ʃ = { 0, 1}.

Non-Optional Task

Web • Construct DFA for accepting binary strings which when converted to
resources decimal is a multiple of 2.
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 that do not contain the substring λ over an alphabet {a, b}.
QUIZ
Questions from Lecture 4.1
1. The password to the admins account=”administrator”. The total number of
states required to make a password-pass system using DFA would be __________

A) 14 states B) 12 states

C) 13 states D) A password pass system cannot be


created using DFA
2. Which of the following is a not a part of 5-tuple finite automata?

A) Input alphabet B) Transition function

C) Initial State D) Output Alphabet


QUIZ
Questions from Lecture 4.1
3. If a DFA accept binary strings that has the substring 00 then this DFA
accept the binary strings

A) that begin with 00 B) End with 00

C) Both A and B D) None of the Mentioned

4. Which of the following statement is correct?

A) If initial state is final state then FA B) The initial state cannot be


accept λ. a final state.
C) All the states of an automata cannot be D) None of the mentioned
final state. are correct.
QUIZ
Questions from Lecture 4.2

5. The language of a DFA that accept binary strings that do not have prefix λ
is _______________
A) Ʃ* B) Ʃ+

C) ɸ D) { λ }

6. The language of a DFA that accept binary strings that do not have
substring λ is _______________

A) ɸ B) { λ }

C) Ʃ* D) Ʃ+
QUIZ
Questions from Lecture 4.2
7. The language accepted by the 8. The language accepted by the
following DFA over Ʃ = { 0, 1} is following DFA over Ʃ = { 0, 1} is
0, 1 0, 1

q q

A) ɸ C) Ʃ+ A) ɸ B) Ʃ*

C) Binary strings that


do not begin with λ D) Both A and C C) Binary strings D) Both B and C
that begin with λ
THANK YOU

You might also like