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

Unit1 FLAT

Uploaded by

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

Unit1 FLAT

Uploaded by

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

Noida Institute of Engineering and Technology, Greater Noida

UNIT I
Introduction of Regular Languages and
Finite Automata

Unit: I

Formal Languages & Automata


Ms. Anushka Shivhare
Theory (ACSBS-306)
Assistant Professor
Course Details B.Tech
(B Tech 3rd Sem) CSDS

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


1
11/19/2024
Evaluation Scheme & Syllabus
B.Tech Computer Science and Business System (CSBS) Second Year
(Effective from the Session: 2021-22)
SEMESTER-III

Sl. Subject Periods Evaluation Schemes End


No. Codes Subject Name Semester Total Credit
L T P CT TA TOTAL PS TE PE

WEEKS COMPULSORY INDUCTION PROGRAM


1 ACSBS0306 Formal Language & Automata 3 0 0 30 20 50 100 150 3
Theory
2 ACSBS0303 Computer Organization & 3 0 0 30 20 50 100 150 3
Architecture
3 ACSBS0302 Object Oriented Programming 3 0 0 30 20 50 100 150 3
4 ACSBS0301 Computational Statistics 3 0 0 30 20 50 100 150 3
5 ACSBS0304 Software Engineering 3 0 0 30 20 50 100 150 3
6 ACSBS0305 Financial Management 2 0 0 30 20 50 100 150 2
7 ACSBS0353 Computer Organization & 0 0 2 25 25 50 1
Architecture Lab
8 ACSBS0352 Object Oriented Programming 0 0 2 25 25 50 1
Lab
9 ACSBS0351 Computational Statistics Lab 0 0 2 25 25 50 1
10 ACSBS0354 Software Engineering Lab 0 0 2 25 25 50 1
11 ANC0303 Indian Constitution 2 0 0 30 20 50 50 100 0
(Non- Credit)*
12 MOOCs (For B.Tech. Hons.
Degree)
GRAND TOTAL 1100 21

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 2


nit Number: 1
Subject Syllabus

B. TECH. SECOND YEAR (CSBS) 3rd Semester


Course Code ACSBS -0306 L T P Credits

Course title FORMAL LANGUAGE & AUTOMATA THEORY 3 0 0 3

Course objective:

To introduce mathematical foundations of computation including automata theory, provide the design concepts of abstract computation
model of finite automata, push down automata and turing Machine and familiarize the notions of algorithm, decidability, complexity,
and computability.
Pre-requisites:

 Discrete Mathematics
 Fundamental of Computer System
Course Contents / Syllabus
UNIT-I Introduction of Regular Languages and Finite Automata 8 Hours
Alphabet, languages and grammars, productions and derivation, Chomsky hierarchy of languages.

Regular expressions and languages, deterministic finite automata (DFA) and equivalence with regular expressions, nondeterministic
finite automata (NFA) and equivalence with DFA, regular grammars and equivalence with finite automata, properties of regular
languages, Kleene’s theorem, pumping lemma for regular languages, Myhill-Nerode theorem and its uses, minimization of finite
automata.
UNIT-II Context-free Languages and Pushdown Automata 8 Hours
Context-free grammars (CFG) and languages (CFL), Chomsky and Greibach Normal Forms, Equivalence with CFG, Parse trees,
Ambiguity in CFG, Pumping lemma for Context-free languages, Deterministic Pushdown Automata, Nondeterministic Pushdown
Automata (PDA), Closure Properties of CFLs.

Context-sensitive languages: Context-sensitive grammars (CSG) and languages, Linear Bounded Automata and Equivalence with
CSG.
UNIT-III Turing Machine 8 Hours
11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 3
nit Number: 1
The basic model for Turing machines (TM), Turing recognizable (Recursively Enumerable) and Turing- decidable (recursive) Languages and
their closure properties, Variants of Turing machines, Nondeterministic TMs and Equivalence with Deterministic TMs, Unrestricted Grammars
and Equivalence with Turing machines, TM as Enumerators.

UNIT-IV Undecidability 8 Hours


Church-Turing thesis, Universal Turing machine, Universal and diagonalization languages, Reduction between languages and Rice s theorem,
Undecidable problems about languages.
UNIT-V Basic Introduction to Complexity 8 Hours
Introductory ideas on Time complexity of deterministic and nondeterministic Turing machines, P and NP, NP- completeness, Cook’s
Theorem, other NP -Complete problems.
Course outcome: After completion of this course students will be able to:
CO 1 Design and Simplify automata for formal languages and apply K6
closure properties of formal language to construct finite automata for complex problems.

CO 2 Define grammar for context free languages and proving it K5


equivalence with PDA.
CO 3 Construct Turing Machine for recursive and recursive enumerable K6
languages.
CO 4 Identify the decidable and undecidable problems. K4
CO 5 Perform Polynomial time reduction and proving NP- K6
Completeness of basic NP-hard Problem.
Text books:
(1) Introduction to Automata Theory, Languages, and Computation John E. Hopcroft, Rajeev Motwani and Jeffrey D. Ullman.

Reference Books:
(1) Elements of the Theory of Computation, Harry R. Lewis and Christos H. Papadimitriou.
(2) Automata and Computability, Dexter C. Kozen.
(3) Introduction to the Theory of Computation, Michael Sipser.
(4) Introduction to Languages and the Theory of Computation, John Martin.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 4


nit Number: 1
(5) Computers and Intractability: A Guide to the Theory of NP Completeness, M. R. Garey and D. S. Johnson.

Laboratory:

YACC, the parser-generating tool (Chapter 5 of Introduction to Automata Theory, Languages, and Computation John E.
Hopcroft, Rajeev Motwani and Jeffrey D. Ullman.)

Links:

Unit I https://nptel.ac.in/courses/106/104/106104028/Lecture 1 -10, Lecture 16, 17 18, 19


https://nptel.ac.in/courses/113/11111/1003016/
https://www.youtube.com/results?search_query=%23AutomataTheory

Unit II https://nptel.ac.in/courses/106/104/106104028/Lecture 11 -15


https://nptel.ac.in/courses/113/11111/1003016/
https://www.youtube.com/results?search_query=%23AutomataTheory

Unit III https://nptel.ac.in/courses/106/104/106104028/Lecture 20 -30


https://nptel.ac.in/courses/106/106/106106049/
https://www.youtube.com/results?search_query=%23AutomataTheory

Unit IV https://nptel.ac.in/courses/106/104/106104028/Lecture 31 -33


https://nptel.ac.in/courses/113/11111/1003016/
https://www.youtube.com/results?search_query=%23AutomataTheory

Unit V https://nptel.ac.in/courses/106/104/106104028/Lecture 34-42


https://nptel.ac.in/courses/113/11111/1003016/
https://www.youtube.com/results?search_query=%23AutomataTheory

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 5


nit Number: 1
Branch Wise Applications

• It can compute man-made problems as well as


natural phenomena.Automata theory has a lot of
applications in real life as well, such that: Lambda
calculus, Combinatory logic, Markov algorithm, and
Register,Natural Language Processing ,Compiler
Design and Lexical analysis and Semantic analysis.
Also, the concept of Formal languages and automata
theory can overlap with other subjects as well.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 6


nit Number: 1
Course Objective

• Introduce concepts in automata theory and theory of computation

• Identify different formal language classes and their relationships


and PDAs.

• Applying the Concept of Turing Machine and LBAs.

• Prove or disprove theorems in automata theory using its properties

• Determine the decidability and intractability of computational


problems and complexity theory.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 7


nit Number: 1
Course Outcome
FORMAL LANGUAGE & AUTOMATA THEORY
(CSBS-0306)
Course Outcome (CO) Bloom’s Knowledge
Level (KL)

At the end of the course, the student will be able to understand


CO 1 Design and Simplify automata for formal languages and K6
apply closure properties of formal language to
construct finite automata for complex problems.
CO 2 Define grammar for context free languages and proving K5
it equivalence with PDA.
CO 3 Construct Turing Machine for recursive and recursive K6
enumerable languages.
CO 4 Identify the decidable and undecidable problems. K4

CO 5 Perform Polynomial time reduction and proving K6


NPCompleteness of basic NP-hard Problem

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 8
Program Outcomes

Engineering Graduates will be able to Understand:


1. Engineering knowledge
2. Problem analysis
3. Design/development of solutions
4. Conduct investigations of complex
5. Modern tool usage
6. The engineer and society
7. Environment and sustainability
8. Ethics
9. Individual and team work
10. Communication
11. Project management and finance
12. Life-long learning
11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 9
nit Number: 1
CO-PO and PSO Mapping
CO-PO correlation matrix of Theory of Automata and Formal
Languages (ACSBS0306)
PO PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12
1
CSBS0306.1 2 2 3 3 2 2 - - 2 1 - 3
CSBS0306.2 1 3 2 3 2 2 - 1 1 1 2 2
CSBS0306.3 2 2 3 2 2 2 - 2 2 1 2 3
CSBS0306.4 2 2 2 3 2 2 - 2 2 1 1 3
CSBS0306.5 3 2 2 2 2 2 - 2 1 1 1 2
Average 2 2.2 2.4 2.6 2 2 - 1.4 1.6 1 1.2 2.6

Mapping of Program Specific Outcomes and Course Outcomes:

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 10
End Semester Question Paper Templates (Offline Pattern/Online Pattern)

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 11


nit Number: 1
End Semester Question Paper Templates (Offline Pattern/Online Pattern)

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 12


nit Number: 1
Prerequisite and Recap

• Brief review of different operations like Union, Intersection,


difference, Complement, Introduction of graph & concept of
equivalence relation & equivalence class

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 13
Brief Introduction about the Subject with videos

Introduction: Automata theory is the study of abstract machines and automata, as well as
the computational problems that can be solved using them. It is a theory in theoretical
computer science.
Introduction, Finite Automata, Regular Expressions | Video Lectures | Theory of Computation | Mathema
tics | MIT
OpenCourseWare

Unit I
https://nptel.ac.in/courses/106/104/106104028/Lecture 1 -10, Lecture 16, 17 18, 19
https://nptel.ac.in/courses/113/11111/1003016/ https://www.youtube.com/results?search_query=%23AutomataTheory
Unit II
https://nptel.ac.in/courses/106/104/106104028/Lecture 11 -15
https://nptel.ac.in/courses/113/11111/1003016/ https://www.youtube.com/results?search_query=%23AutomataTheory
Unit III
https://nptel.ac.in/courses/106/104/106104028/Lecture 20 -30
https://nptel.ac.in/courses/106/106/106106049/ https://www.youtube.com/results?search_query=%23AutomataTheory
Unit IV
https://nptel.ac.in/courses/106/104/106104028/Lecture 31 -33
https://nptel.ac.in/courses/113/11111/1003016/ https://www.youtube.com/results?search_query=%23AutomataTheory
Unit V
https://nptel.ac.in/courses/106/104/106104028/Lecture 34-42
https://nptel.ac.in/courses/113/11111/1003016/ https://www.youtube.com/results?search_query=%23AutomataTheory
11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 14
nit Number: 1
Contents

• Introduction
• Theory of computation
• Basic Definitions
• Deterministic Finite Automata
• DFA Examples
• Non Deterministic Finite Automata
• NDFA Example
• Equivalence of DFA and NDFA
• Minimization of NDFA
• Machines with Output
11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 15
nit Number: 1
Unit Objective

• To understand the designing of Deterministic Finite Automata.


• To understand the designing of Non deterministic finite automata.
• To understand the Minimization of Finite Automata.
• To understand the designing the Finite automata with output.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 16
Unit I Syllabus

•Introduction of Regular Languages and Finite Automata


Alphabet, languages and grammars, productions and
derivation, Chomsky hierarchy of languages. Regular
expressions and languages, deterministic finite automata
(DFA) and equivalence with regular expressions,
nondeterministic finite automata (NFA) and equivalence with
DFA, regular grammars and equivalence with finite
automata, properties of regular languages, Kleene’s theorem,
pumping lemma for regular languages, Myhill-Nerode
theorem and its uses, minimization of finite
automata.Machine with Output and RE to FA and FA to RE.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 17
Theory of Computation (CO1)

Prerequisite: Brief review of different operations like Union,


Intersection, difference, Complement, Introduction of graph &
concept of equivalence relation & equivalence class

Objective: To understand the basic definition of Automata

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 18
Theory of Computation (CO1)

Objective: To understand the basic definition of Automata

• It is a branch of computer science that deals with how effectively a


problem can be solved on a model of computation by using an
algorithm.
Theory of
Computation

Theory of
Computability Complexity
Automata and
Theory Theory
Formal Languages

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 19
Theory of Computation (CO1)
Objective: To understand the basic definition of Automata

Theory of Automata and Formal Languages :


• It deals with the definition and properties of various mathematical models of
computer.
• Example : Finite Automat, Context Free Grammar, PDA, Turing Machine

Computability Theory:
• It deals with what can and what cannot be computed by model.

Complexity Theory:
• It deals with computable problems based on their hardness.

Purpose of TOC:
• In order to develop formal mathematical model of computations that reflect real
world computers.
Ms. Anushka CSBS - 0306 FLAT Unit Number: 1
11/19/2024 20
Basic Definitions:

Symbol:
It is a character.
For Example : a,b,c,…….z
0,1,2,3,4…9
+,-,%,&........ Special characters.

Alphabet:
An alphabet is defined as a finite non empty set of symbols. It is
representd by symbol : Σ
Example: Σ: {0,1} set of binary alphabets.
Σ: {a,b,c,……z} set of all lower case letters.
Σ: {+,-,*,/,……} set of all special characters.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 21
Basic Definitions(Continued)

String

Definition − A string is a finite sequence of symbols taken from ∑.

Example − ‘cabcad’ is a valid string on the alphabet set ∑ = {a, b, c, d}

Length of a String

Definition − It is the number of symbols present in a string. (Denoted by |S|).


• Examples −
– If S = ‘cabcad’, |S|= 6
– If |S|= 0, it is called an empty string (Denoted by λ or ε)

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 22
Basic Definitions (Continued)

Kleene Star
• Definition − The Kleene star, ∑*, is a unary operator on a set of symbols
or strings, ∑, that gives the infinite set of all possible strings of all possible
lengths over ∑ including λ.
• Representation − ∑* = ∑0 ∪ ∑1 ∪ ∑2 ∪……. where ∑p is the set of all
possible strings of length p.
• Example − If ∑ = {a, b}, ∑* = {λ, a, b, aa, ab, ba, bb,………..}

Kleene Closure / Plus


• Definition − The set ∑+ is the infinite set of all possible strings of all
possible lengths over ∑ excluding λ.
• Representation − ∑+ = ∑1 ∪ ∑2 ∪ ∑3 ∪…….
• ∑+ = ∑* − { λ }
• Example − If ∑ = { a, b } , ∑+ = { a, b, aa, ab, ba, bb,………..}

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 23
Basic Definitions (Continued)

Language

• Definition − A language is a subset of ∑* for some alphabet ∑. It can be


finite or infinite.
• Example − If the language takes all possible strings of length 2 over ∑ = {a,
b}, then L = { ab, aa, ba, bb }

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 24
Automata

An automaton with a finite number of states is called a Finite Automaton


(FA) or Finite State Machine (FSM).

Formal definition of a Finite Automaton

An automaton can be represented by a 5-tuple (Q, ∑, δ, q0, F), where −


• Q is a finite set of states.
• ∑ is a finite set of symbols, called the alphabet of the automaton.
• δ is the transition function.
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 25
Deterministic Finite Automaton (DFA)

Recap: In previous slides we have learned about basic definitions used


in Automata.

Prerequisite: Knowledge about Alphabet, string and language.

Objective: To understand the formal mathematical definition of DFA

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 26
Deterministic Finite Automaton (DFA)

Objective: To understand the formal mathematical definition of DFA

Formal Definition of a DFA

• A DFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −


• Q is a finite set of states.
• ∑ is a finite set of symbols called the alphabet.
• δ is the transition function where δ: Q × ∑ → Q
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 27
Graphical Representation of a DFA (CO1)

A DFA is represented by digraphs called state diagram.

•The vertices represent the states.


•The arcs labeled with an input alphabet show the transitions.
•The initial state is denoted by an empty single incoming arc.
•The final state is indicated by double circles.

Example
Let a deterministic finite automaton be →
•Q = {a, b, c},
•∑ = {0, 1},
•q0 = {a},
•F = {c},

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 28
Graphical Representation of a DFA

Its graphical representation would be as follows −

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 29
DFA - Examples

1. Design a DFA that accepts “a”, over an alphabet ∑={a}

a
q0 q1

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 30
DFA - Examples

2. Design a DFA that accepts 0 or more ‘a’

q0

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 31
DFA - Examples

3. Design a DFA over an alphabet ∑={a}, which accepts those strings


which starts with 1 and ends with 0.

1 0

1 0
q0 q1 q2

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 32
DFA - Examples

4. Draw a DFA for following language over an alphabet {a,b}, L={all


strings starting with abb}

a,b

a b b
q0 q1 q2 q3

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 33
DFA - Examples

5. Draw a DFA for following language over an alphabet {a,b}, L={all


strings with abb as substring}

b a
a,b

a b b
q0 q1 q2 q3

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 34
DFA - Examples

6. Draw a DFA for following language over an alphabet {a,b}, L={all


strings ending with abb}

b a
a a,b

a b b
q0 q1 q2 q3

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 35
DFA - Examples

7. Design a DFA over an alphabet {a,b} such that every string


accepted must be of length:
• |w|=2(mod3)

R=0
a,b
q0 q1 R=1

a,b a,b

q2 R=2

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 36
Non – Deterministic Finite Automata (CO1)

Recap: Learn the designing of DFA

Prerequisite: Understanding of DFA

Objective: To understand the mathematical definition of NDFA

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 37
Non – Deterministic Finite Automata (CO1)

Objective: To understand the mathematical definition of NDFA

Formal Definition of an NDFA

• An NDFA can be represented by a 5-tuple (Q, ∑, δ, q0, F) where −


• Q is a finite set of states.
• ∑ is a finite set of symbols called the alphabets.
• δ is the transition function where δ: Q × ∑ → 2Q
(Here the power set of Q (2Q) has been taken because in case of
NDFA, from a state, transition can occur to any combination of Q
states)
• q0 is the initial state from where any input is processed (q0 ∈ Q).
• F is a set of final state/states of Q (F ⊆ Q).

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 38
Non – Deterministic Finite Automata

• An NDFA is represented by digraphs called state diagram.


• The vertices represent the states.
• The arcs labeled with an input alphabet show the transitions.
• The initial state is denoted by an empty single incoming arc.
• The final state is indicated by double circles.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 39
NDFA – EXAMPLE

1. Draw a NDFA to accept strings containing the substring 0101

0,1 0,1
0 1 0 1
q0 q1 q2 q3 q4

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 40
THE EQUIVALENCE OF DFA AND NDFA

• Construct a DFA equivalent of following NDFA:


δ/Σ a b
→q0 q0,q1 q0
q1 q2 q1
q2 q3 q3
*q3 q2

δ/Σ a b
[→q0] [q0,q1] [q0]
[q0,q1] [q0,q1,q2] [q0,q1]
[q0,q1,q2] *[q0,q1,q2,q3] *[q0,q1,q3]
*[q0,q1,q3] [q0,q1,q2] [q0,q1,q2]
*[q0,q1,q2,q3] *[q0,q1,q2,q3] *[q0,q1,q2,q3]

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 41
MINIMIZATION OF DFA (CO1)

Minimize the given DFA-

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 42
MINIMIZATION OF DFA
Solution-
Step-01:
The given DFA contains no dead states and inaccessible states.

Step-02:
Draw a state transition table-

a b
→q0 q1 q2
q1 q1 q3
q2 q1 q2
q3 q1 *q4
*q4 q1 q2

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 43
MINIMIZATION OF DFA

Step-03:

Now using Equivalence Theorem, we have-


• P0 = { q0 , q1 , q2 , q3 } { q4 }
• P1 = { q0 , q1 , q2 } { q3 } { q4 }
• P2 = { q0 , q2 } { q1 } { q3 } { q4 }
• P3 = { q0 , q2 } { q1 } { q3 } { q4 }

• Since P3 = P2, so we stop.


• From P3, we infer that states q0 and q2 are equivalent and can be merged
together.
• So, Our minimal DFA is

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 44
MINIMIZATION OF DFA (CO1)

So after minimization the final


DFA will be Like:

Initial DFA

Final DFA

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 45
Finite Automata with Outputs (CO1)

Recap: Learn about DFA, NDFA and their designing, and


minimization and interconversions.

Prerequisite: Knowledge about DFA, NDFA .

Objective: To understand the Finite Automata Machines which gives


output.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 46
Finite Automata with Outputs (CO1)
Moore Machine Mealy Machine
• It is consists of 6 Touples • It is consists of 6 Touples
• Q-Finite set of states • Q-Finite set of states
• Σ-i/p alphabet • Σ-i/p alphabet
• δ-Transition Function • δ-Transition Function
(λ : Q×Σ→Q) (λ :Q×Σ→ ∆)
• q0-initial state • q0-initial state
• ∆-o/p alphabet • ∆-o/p alphabet
• λ-o/p function • λ -o/p function

11/19/2024 Ms. Anushka CSBS - 0306 FLAT U 47


nit Number: 1
Moore machine

• Construct a Moore machine that takes set of all strings over


alphabet {a,b} as i/p and prints 1 as o/p for every string ending
with ‘baa’ as substring.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 48
Mealy Machine
• Construct a Mealy machine for 1’s compliment

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 49
Moore to Mealy conversion

Given Moore Machine Mealy Machine after conversion

Link: https://www.youtube.com/watch?v=RBDE-vO7Ux0

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 50
Mealy to Moore Conversion
Given Mealy
Machine

Given Mealy Moore Machine after


Machine Moore Machine after Conversion
Conversion

Link: https://www.youtube.com/watch?v=vcNRb2cj1GI

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 51
Links and Online Courses Details

Youtube/other Video Links

• https://www.youtube.com/watch?v=Hl5jNAXcW18
• https://www.youtube.com/watch?v=-aIRqNnUvEg&list=PL85CF9F4A047C
7BF7

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 52
Introduction (CO1)

Objective: To understand the Regular Expression

– A regular expression is used to specify a language, and it does so


precisely.
– Regular expressions are very intuitive.
– Regular expressions are very useful in a variety of contexts.
– Given a regular expression, an NFA-ε can be constructed from it
automatically.
– Thus, so can an NFA be constructed, and a DFA, and a
corresponding program, all automatically!

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 53
Operations (CO1)

• Concatenation:
– x = 010
– y = 1101
– xy = 010 1101

– Language Concatenation: L1L2 = {xy | x is in L1 and y is in L2}


– L1 = {01, 00}
– L2 = {11, 010}
– L1L2 = {01 11, 01 010, 00 11, 00 010}

• Language Union:
– L1 = {01, 00}
– L2 = {01, 11, 010}
– L1 U L2 = {01, 00, 11, 010}

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 54
Operations (CO1)

• Let L, L1, L2 be subsets of Σ*

• Concatenation: L1L2 = {xy | x is in L1 and y is in L2}

• Concatenating a language with itself: L0 = {ε}


Li = LLi-1, for all i >= 1

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 55
Kleene closure

Say, L, or L1 ={a, abc, ba}, on Σ ={a,b,c}

Then, L2 = {aa, aabc, aba, abca, abcabc, abcba, baa, baabc, baba}

L3= {a, abc, ba}

…..

But, L0 = {ε}

Kleene closure of L, L* = {ε, L1, L2, L3, . . .}

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 56
Operations

• Let L, L1, L2 be subsets of Σ*

• Concatenation: L1L2 = {xy | x is in L1 and y is in L2}

• Union is set union of L1 and L2

• Kleene Closure: L* = Li = L0 U L1 U L2 U…

• Positive Closure: L+ = Li = L1 U L2 U…

• Question: Does L+ contain ε?

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 57
Definition of a Regular Expression

• Let Σ be an alphabet. The regular expressions over Σ are:

– Ø Represents the empty set { }


– ε Represents the set {ε}
– a Represents the set {a}, one string of length 1, for any
symbol a in Σ

Let r and s be regular expressions that represent the sets R and S, respectively.

– r+s Represents the set R U S (precedence 3)


– rs Represents the set RS (precedence level 2)
– r* Represents the set R* (highest precedence,
level 1)
– (r) Represents the set R (not an operator, rather provides
precedence)

• If r is a regular expression, then L(r) is used to denote the corresponding language.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 58
Formal Definition of Regular Expressions

The set of regular expression is defined by following rules:


• Every letter of Σ can be made into regular expression. Null string, ɛ
itself is a regular expression.
• If r1 and r2 are regular expression then :
• (r1)
• r1·r2
• r1+r2
• r1*
• r1+ are also regular.
• Nothing else is a regular.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 59
Examples related to Regular Expressions
1. Write a regular expression of language which contains string such
that it contains at least one ‘a’ and at least one ‘b’ over an alphabet
{a,b,c}.

• (a+b+c)*a(a+b+c)*b(a+b+c)*+(a+b+c)*b(a+b+c)*a(a+b+c)*

2. The set of all strings with even number of a’s followed by an odd
number of b’s.

• (aa)*(bb)*b

3. The set of all strings over {a,b} that has at least one pair of
consecutive a’s.
• (a+b)*aa(a+b)*
Ms. Anushka CSBS - 0306 FLAT Unit Number: 1
11/19/2024 60
Examples (CO1)
4. The set of all strings beginning with an ‘a’ or ‘c’ then followed by
some number of b’s.

• (a+c)b*

5. The set of all words ending with either ‘bb’ or single ‘a’.

• (a+b)*(a+bb)

6. Length of all strings whose length is exactly 2.

• (a+b)(a+b)

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 61
Examples

7. Length of all strings should be at least 2:

• (a+b)(a+b)(a+b)*

8. Length of all strings should be at most 2:

• (a+b+ɛ)(a+b+ɛ)

9. All possible strings whose length is even:

• ((a+b)(a+b))*

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 62
Examples

10. All possible strings whose length is odd:

• ((a+b)(a+b))*(a+b)

11. All strings whose length is divisible by 3:

• ((a+b)(a+b)(a+b))*

12. All strings whose length is 2(mod 3):

• ((a+b)(a+b)(a+b))*(a+b)(a+b)

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 63
Identities of Regular Expression (CO1)

Recap: we have learned about the basic definition of Regular


expressions.

Prerequisite: Basic knowledge of Regular Expressions.

Objective: To understand the mathematical formulation of RE.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 64
Identities of Regular Expression (CO1)
Objective: To understand the mathematical formulation of RE.

1. Øu = uØ = Ø Like multiplying by 0
2. εu = uε = u Like multiplying by 1
3. Ø* = ε L* = Li = L0 U L1 U L2 U…
4. ε* = ε = {ε}
5. u+v = v+u
6. u+Ø=u
7. u+u=u
8. u* = (u*)*
9. u(v+w) = uv+uw [which operation is hidden before
parenthesis?]
10. (u+v)w = uw+vw
11. (uv)*u = u(vu)* [note: you have to have a single u, at start
or end]

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 65
Regular Expressions to Finite Automata

• Φ =

• ɛ = ɛ

• a = a
q0 q1

• a + b= a,b
q0 q1

• a·b = a b
q0 q1 q2

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 66
Regular Expressions to Finite Automata
ɛ

ɛ a ɛ
• a* = q0 q1 q2 q3
ɛ

b
• ab* = a
q0 q1

a
• ab* =
q1 q0

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 67
Regular Expressions to Finite Automata (EXAMPLES)

Q: Convert following RE to FA: (0 + 1(10)*)*

SOLUTION:
(0 + 1(10)*)*
• STEP 1: q0 q1

(0 + 1(10)*)*
ɛ ɛ
• STEP 2: q0 q1 q2

1
q3 (10)*
• STEP 3: ɛ ɛ
q0 q1 q2

0
Ms. Anushka CSBS - 0306 FLAT Unit Number: 1
11/19/2024 68
Regular Expressions to Finite Automata
(EXAMPLES)
• STEP 4
ɛ 0
q3

1 q4
q5

ɛ 1
ɛ ɛ
q0 q1 q2

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 69
Regular Expressions to Finite Automata
(EXAMPLES)
Q: Convert following RE to FA: 0·1·[(10* + 111)* + 0]* · 1
1
SOLUTION: 0

ɛ 1 q6 q7
q5

1 q4 1
ɛ ɛ
0 1 1
q0 q1 q2 q3

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 70
Finite Automata to Regular Expressions

Recap: Understand about the Regular Expressions and their identities.

Prerequisite: Basic knowledge of Regular expressions and Finite


Automata.

Objective: To understand the relationship between Finite Automata


and RE.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 71
Finite Automata to Regular Expressions
Objective: To understand the relationship between Finite Automata
and RE

There are two methods for conversion of Finite Automata to Regular


Expressions :

1. Through state / loop elimination Method


2. Arden’s Theorem

In State / loop elimination method consists of :


1. State elimination method
2. Generic One State Loop elimination Method
3. Generic Two State Loop elimination Method

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 72
State Elimination Process

a b
q0 q1 q2

a.b
q0 q2

This can be achieved by eliminating state q1

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 73
Generic One State Machine

q5 R*

This means that loop present in the state is represented by Kleene star

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 74
Generic Two State Machine

CASE 1:
R1 R3 R2

q0 q1

R4
R1+R3R2*R4 R2

R3
q0 q1

(R1+R3R2*R4)*R3R2*

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 75
Generic Two State Machine

CASE 2:
R1 R3 R2

q0 q1

R4
R1 R2+R4R1*R3
R3
q0 q1

R1*R3(R2+R4R1*R3)*

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 76
EXAMPLE

• Solve:
a b b

q0 q1

b
a+bb*b b

b
q0 q1

• (a+bb*b)*bb*

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 77
Arden's Theorem

Recap: We have covered basics about regular expressions, Identities of


RE, then inter conversion of RE to FA.

Prerequisite: Basic knowledge of Finite Automata and recursion.

Objective: To understand the Arden’s Theorem.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 78
Arden's Theorem
Objective: To understand the Arden’s Theorem

Statement −
• Let P and Q be two regular expressions.
• If P does not contain null string, then R = Q + RP has a unique solution that is R =
QP*

Proof −
• R = Q + (Q + RP)P [After putting the value R = Q + RP]
• = Q + QP + RPP
• When we put the value of R recursively again and again, we get the following
equation −
• R = Q + QP + QP2 + QP3…..
• R = Q (ε + P + P2 + P3 + …. )
• R = QP* [As P* represents (ε + P + P2 + P3 + ….) ]
• Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 79
Problem of Arden’s Theorem

• Construct a regular expression corresponding to the automata given


below −

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 80
Problem of Arden’s Theorem
• Solution:
Here the initial state and final state is q1.
The equations for the three states q1, q2, and q3 are as follows −
q1 = q1a + q3a + ε (ε move is because q1 is the initial state0
q2 = q1b + q2b + q3b
q3 = q2a
Now, we will solve these three equations −
q2 = q1b + q2b + q3b
= q1b + q2b + (q2a)b (Substituting value of q3)
= q1b + q2(b + ab)
= q1b (b + ab)* (Applying Arden’s Theorem)
q1 = q1a + q3a + ε
= q1a + q2aa + ε (Substituting value of q3)
= q1a + q1b(b + ab*)aa + ε (Substituting value of q2)
= q1(a + b(b + ab)*aa) + ε
= ε (a+ b(b + ab)*aa)*
= (a + b(b + ab)*aa)*
Hence, the regular expression is (a + b(b + ab)*aa)*.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 81
Pumping Lemma

Recap: Till now we have studied RE, Identities of RE, interconversions of RE


and FA, and Arden’s Theorem.

Prerequisite: Basic understanding of finite automata and mathematical


induction.

Objective: To understand the Pumping Lemma.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 82
Pumping Lemma
Objective: To understand the Pumping Lemma
Theorem
Let L be a regular language. Then there exists a constant ‘c’ such that for
every string w in L −
• |w| ≥ c
We can break w into three strings, w = xyz, such that −
• |y| > 0
• |xy| ≤ c
For all k ≥ 0, the string xykz is also in L.

Applications of Pumping Lemma


• Pumping Lemma is to be applied to show that certain languages are not
regular. It should never be used to show a language is regular.
• If L is regular, it satisfies Pumping Lemma.
• If L does not satisfy Pumping Lemma, it is non-regular.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 83
Pumping Lemma Proof

• the pumping-lemma states that for any regular language L, there exists a
number p such that for any string w in L of length at least p there are strings
x,y,z such that

• w = xyz (1)
• |xy| <= p (2)
• |y| >= 1
• For all i, xyiz is in L (3)

• To prove that a language L is not regular, we show that the pumping lemma
fails. That is, we show that:
• For any number p, there exists a string w p in L of length at least p such that if
we choose any strings x,y,and z satisfying conditions (1)-(3), then there is
some number i such that xyiz is not in L.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 84
Pumping Lemma Proof

• So, a pumping lemma proof normally looks something like this (just fill in the
blanks)
• Suppose L were regular. Let p be the pumping length given by the pumping
lemma. Consider the string wp = (insert here some description of a string,
parametrized by p)
• Clearly, |wp| >= p and wp is in L. So, by the pumping lemma, there must be
some choice of x,y,z satisfying the conditions of the pumping lemma.
• But, consider any choice of x,y,z for which wp = xyz, |xy| <= p, and |y| >= 1.
• [Insert argument as to why for some particular i, xy iz is not in L; usually i=0 or
i=2 works. Using the fact that |xy| <= p, you know that y must be in the first p
characters of the string wp.. Using this, you can usually restrict the cases for
what y can be, and argue for each of the cases that xyiz is not in L.]
• Since xyiz is not in L, we get a contraditiction; hence the assumption that L is
regular is false. Hence L is not regular.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 85
Pumping Lemma Examples

Problem
• Prove that L = {aibi | i ≥ 0} is not regular.
Solution −
• At first, we assume that L is regular and n is the number of states.
• Let w = anbn. Thus |w| = 2n ≥ n.
• By pumping lemma, let w = xyz, where |xy| ≤ n.
• Let x = ap, y = aq, and z = arbn, where p + q + r = n, p ≠ 0, q ≠ 0, r ≠ 0. Thus |
y| ≠ 0.
• Let k = 2. Then xy2z = apa2qarbn.
• Number of as = (p + 2q + r) = (p + q + r) + q = n + q
• Hence, xy2z = an+q bn. Since q ≠ 0, xy2z is not of the form anbn.
• Thus, xy2z is not in L. Hence L is not regular.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 86
Properties of Regular Sets

Recap: Till now we have studied RE, Identities of RE, interconversions


of RE and FA, Arden’s Theorem and Pumping lemma.

Prerequisite: Basic understanding of finite automata and Regular


expressions.

Objective: To understand the basic properties of Regular Expressions.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 87
Properties of Regular Sets

Property 1. The union of two regular set is regular.

Proof −
• Let us take two regular expressions
• RE1 = a(aa)* and RE2 = (aa)*
• So, L1 = {a, aaa, aaaaa,.....} (Strings of odd length excluding Null) and
L2 ={ ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
• L1 ∪ L2 = { ε, a, aa, aaa, aaaa, aaaaa, aaaaaa,.......}
(Strings of all possible lengths including Null)
• RE (L1 ∪ L2) = a* (which is a regular expression itself)
• Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 88
Properties of Regular Sets

Property 2. The intersection of two regular set is regular.

Proof −
• Let us take two regular expressions
• RE1 = a(a*) and RE2 = (aa)*
• So, L1 = { a,aa, aaa, aaaa, ....} (Strings of all possible lengths
excluding Null)
• L2 = { ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
• L1 ∩ L2 = { aa, aaaa, aaaaaa,.......} (Strings of even length excluding
Null)
• RE (L1 ∩ L2) = aa(aa)* which is a regular expression itself.
Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 89
Properties of Regular Sets

Property 3. The complement of a regular set is regular.

Proof −
• Let us take a regular expression −
• RE = (aa)*
• So, L = {ε, aa, aaaa, aaaaaa, .......} (Strings of even length including
Null)
• Complement of L is all the strings that is not in L.
• So, L’ = {a, aaa, aaaaa, .....} (Strings of odd length excluding Null)
• RE (L’) = a(aa)* which is a regular expression itself.
Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 90
Properties of Regular Sets

Property 4. The difference of two regular set is regular.

Proof −
• Let us take two regular expressions −
• RE1 = a (a*) and RE2 = (aa)*
• So, L1 = {a, aa, aaa, aaaa, ....} (Strings of all possible lengths
excluding Null)
• L2 = { ε, aa, aaaa, aaaaaa,.......} (Strings of even length including Null)
• L1 – L2 = {a, aaa, aaaaa, aaaaaaa, ....}
• (Strings of all odd lengths excluding Null)
• RE (L1 – L2) = a (aa)* which is a regular expression.
Hence, proved.
Ms. Anushka CSBS - 0306 FLAT Unit Number: 1
11/19/2024 91
Properties of Regular Sets

Property 5. The reversal of a regular set is regular.

Proof −
• We have to prove LR is also regular if L is a regular set.
• Let, L = {01, 10, 11, 10}
• RE (L) = 01 + 10 + 11 + 10
• LR = {10, 01, 11, 01}
• RE (LR) = 01 + 10 + 11 + 10 which is regular
Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 92
Properties of Regular Sets

Property 6. The closure of a regular set is regular.

Proof −
• If L = {a, aaa, aaaaa, .......} (Strings of odd length excluding Null)
• i.e., RE (L) = a (aa)*
• L* = {a, aa, aaa, aaaa , aaaaa,……………} (Strings of all lengths
excluding Null)
• RE (L*) = a (a)*
Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 93
Properties of Regular Sets

Property 7. The concatenation of two regular sets is regular.

Proof −
• Let RE1 = (0+1)*0 and RE2 = 01(0+1)*
• Here, L1 = {0, 00, 10, 000, 010, ......} (Set of strings ending in 0)
• and L2 = {01, 010,011,.....} (Set of strings beginning with 01)
• Then, L1 L2 =
{001,0010,0011,0001,00010,00011,1001,10010,.............}
• Set of strings containing 001 as a substring which can be
represented by an RE − (0 + 1)*001(0 + 1)*
Hence, proved.

Ms. Anushka CSBS - 0306 FLAT Unit Number: 1


11/19/2024 94
Daily Quiz

1. Draw a DFA for the following language over {0,1}:


a. All strings with even number of 0 and even number of 1.
b. All string of length at most 5.
2. Prove that NDFA = DFA
3. Give DFA accepting the following language over alphabet {0,1}
a. The set of all strings ending in 00
b. The ste of strings with 011 as sub string.
c. The set of string starting with 10.
4. What do you understand by Epsilon closure in FA?
5. State and prove Myhill Nerode Theorem.
6. Construct a DFA for the language that contains the strings ending
with 0.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 95


Daily Quiz

1. Find all possible regular expression of language L over {a,b}:


a. The set of all strings ending in b.
b. The set of all strings ending in ba.
c. The set of all strings ending neither in b nor in ba.
d. The set of all strings ending in ab.
e. The set of all strings ending in ab.
f. The set of all strings ending neither in ab nor in ba.
2. Write regular expression for each of the following language over
the alphabet {0,1}.
a. The set of all strings in which every pair of adjacent zero appear before any
pair of adjacent one.
b. The set of all strings not containing 010 as substring.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 96


MCQ s

1. FA will have equivalent ………….

a. Regular Expression
b. Arithmetic Expression
c. Logical Expression
d. Algebraic Expression

2. For a regular expression (0*10*10*)* which of the following string matches:

e. 001
f. 0011101
g. 0010101
h. 1

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 97


MCQs

3. A language represented by a regular expression which will contain ɛ when


it uses …….. operator for entire sub expression.
a. +
b. .
c. *
d. ++

4. For a regular expression (10* + 001*) the minimum length of a string is:

e. 1
f. 2
g. 0
h. 3

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 98


Weekly Assignment

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 99


Weekly Assignment

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 100


MCQ s

• The non- Kleene Star operation accepts the following string of finite length
over set A = {a,b} | where string s contains even number of 0 and 1
A. ab,aabb,ababab
B. aabb,bbaabbaa
C. ε,aabb,bbaabbaa
D. ε,aabb,bbaabbaa

• A regular language over an alphabet ∑ is one that cannot be obtained


from the basic languages using the operation

A. Union
B. Concatenation
C. Kleene*
D. All of the mentioned

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 101


MCQ s

• 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

• Moore Machine is an application of:

a. Finite automata without input


b. Finite automata with output
c. Non- Finite automata with output
d. None of the mentioned

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 102


Glossary Questions

• Attempt all the parts. Pick the correct options from the Glossary.[CO1]
(i) Regular Grammar (ii) Context Free grammar
(iii) Context Sensitive Grammar (iv) Unrestricted Grammar

A)………….. Corresponds to the PDA.(ii)


B)…………….Corresponds to the LBA.(iii)
C)……………..Corresponds to the FA.(i)
D)………………Corresponds to the TM.(iv)
• Attempt all the parts. Pick the correct options from the Glossary.[CO1]
(i) Type -0 (ii) Type -1 (iii) Type -2 (iv) Type -3

A)………….. Corresponds to the PDA.(iii)


B)…………….Corresponds to the LBA.(ii)
C)……………..Corresponds to the FA.(iv)
D)………………Corresponds to the TM.(i)

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 103


Glossary Questions

• Attempt all the parts. Pick the correct options from the Glossary.[CO1]
(i) PDA (ii) FA
(iii) TM (iv) LBA

A)…………….Consist of the Store Symbol .(i)


B)…………….Corresponds to Type-0 Grammar.(iii)
C)……………..it is having limited capacity.(ii)
D)………………Corresponds to Type-1 Grammar.(iv)
• Attempt all the parts. Pick the correct options from the Glossary.[CO1]
(i) String (ii) Alphabet
(iii) Kleene Closure (iv) Positive Closure
A)…………….Consist of the Null Symbol .(iii)
B)…………….combination of the characters.(i)
C)……………..it is the smallest element of the string.(ii)
D)………………not consist of the null symbol.(iv)

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 104


Old Question Papers

• https://drive.google.com/file/d/12YgCV_q7QeE1d_Hp0JrOWR
FgXOcdKSRc/view?usp=sharing
• https://drive.google.com/file/d/1J5wqcdUF3nf_8UMcYD_wTb
lTK3SmChqr/view?usp=sharing
• https://drive.google.com/file/d/1VxIo8y0ZSdXXcHYLwUgii9M
uZEosGGyC/view?usp=sharing
• https://drive.google.com/file/d/1ZlOKf6Il9xwPF6YlmSGAsFSs
AjT4fNPu/view?usp=sharing
• https://drive.google.com/file/d/1dyqbDpBPuY50gsmu62JcVtg
D65t_0lu4/view?usp=sharing

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 105


Expected Questions for University Exam

1. Design a DFA over an alphabet {0,1}, which accepts those strings


which starts with 1 and ends with 0.
2. Design a DFA over an alphabet {0,1}, which accepts those stings
which contain odd number of 1’s.
3. Design a DFA over an alphabet {0,1}, which accepts those stings of
length at most 5.
4. Design a DFA for a language of strings for an alphabet {0,1}, which
accepts a string ending with 10.
5. Design a DFA for the language containing strings in which left most
symbol differ from right most symbol over an alphabet {0,1}.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 106


Expected Questions for University Exam

1. Find the regular expression for a language which accept string


whose length is at least 2.
2. Find the regular expression for a language which accept string
whose length is 2mod3.
3. Find the regular expressions for a language which accept strings
containing at most 2 a’s over an alphabet {a,b}.
4. Find a RE for a language which accept a string which starting and
ending with same symbols over an alphabet {a,b}.
5. Construct a RE for following FA:

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 107


Recap

• The knowledge of regular languages and finite automata is essential


for designing a compiler.

• Deterministic Finite Automata are machine model which recognize


strings of a regular language.

• All type of Finite Automata (DFA, NDFA ) are equal in power and
convert one type of automata to other.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 108


Recap

• Regular Languages are set of strings obtained from the basic


languages using union, intersection, concatination and kleene’s star
operations.
• Regular expression is a simple mathematical representation for
regular languages.
• There are two types of regular expression – Simple regular
expression and complex regular expression.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 109


References

1. Aho, Hopcroft and Ullman, The Design and Analysis of Computer


Algorithms, Addison Wesley.
2. Aho, Sethi, Ullman, Compilers Principles, Techniques and Tools, Pearson
Education, 2003.
3. Hopcroft and Ullman, Introduction to Automata Theory, Languages and
Computation, Addison Wesley.
4. Kohavi, ZVI, Switching And Finite Automata Theory, Tata McGraw-Hill,
2006.
5. Lewis and Papadimitriou, Elements of the Theory of Computation,
Prentice-Hall.
6. Martin, Introduction to Languages and the Theory of Computation,
McGraw-Hill, 2nd edition,1996.
7. Mishra, KLP, Chandrasekaran, N. Theory of Computer Science, (Automata,
Languages and Computation) PHI, 2002.

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 110


Noida Institute of Engineering and Technology, Greater Noida

Thank You

11/19/2024 Ms. Anushka CSBS - 0306 FLAT Unit Number: 1 111

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy