Académique Documents
Professionnel Documents
Culture Documents
COURSE FILE
Assistant Professor
Department of CSE
BIT, Meerut
METHODS OF EVALUATION
Course Description:
This module introduces the theory of computation through a set of abstract machines that serve
as models for computation - finite automata, pushdown automata, and Turing machines – and
examines the relationship between these automata and formal languages. Additional topics
beyond the automata classes themselves include deterministic and nondeterministic machines,
regular expressions, context free grammars, undecidability, and the P and NP problems.
Course Objectives:
Learning Outcomes:
1)Knowledge
- Acquire a full understanding and mentality of Automata Theory as the basis of all computer
science
languages design.
- Have a clear understanding of the Automata theory concepts such as RE's, DFA's, NFA's,
Turing
machines, Grammar, halting problem, computability and complexity.
2) Cognitive skills (thinking and analysis).
- Be able to design FAs, NFAs, Grammars, languages modelling, small compilers basics.
- Be able to design sample automata.
- Be able to minimize FA's and Grammars of Context Free Languages.
3)Professional Skill
- Perceive the power and limitation of a computer.
- Solve the problems using formal language.
4) Attitude
- Develop a view on the importance of computational theory.
5) Abilities
-Implement the concepts of automata into compiler construction and hardware design.
-Implement the concepts of automata into text processing and in the area of artificial
intelligence.
On completion of this Subject / Course the student shall be able to:
These program outcomes are designed to prepare the student for a lifetime of growth in
a computer science career.
The expected outcomes of the Course / Subject are:
2 QUIZ-2
3 UNIT TEST-1
4 QUIZ-3
5 QUIZ-4
6 UNIT TEST-2
7 QUIZ-5
8 QUIZ-6
9 UNIT TEST-3
10 QUIZ-7
11 QUIZ-8
12 UNIT TEST-4
13 QUIZ-9
14 QUIZ-10
15 UNIT TEST-5
Mid-Term Test Details
Subject Name: Theory of Automata & Formal Languages [RCS-403]
Year: 2nd
Students
S.N Topics Covered <50% 50-75% >75% Remarks
Appeared
3
LESSON PLAN
Subject Name: Theory of Automata & Formal Languages [RCS-403] Year: 2nd
4 I NFA with epsilon transition, Language of 25-1-2018 1,2,3 TB-1, Page 68-73
NFA.
5 Equivalence of NFA and DFA. 29-1-2018 1,2,3 TB-1, Page 57
6 Minimization of Finite Automata. 30-1-2018 1,2,3 TB-1, Page 148
7 Distinguishing one string from other. 31-1-2018 1,2,3 TB-1, Page 146-148
Myhill-Nerode Theorem. 2-2-2018
8 1,2,3 Lecture Notes
17 FA with output: Moore and Mealy machine. 17-2-2018 1,2,3 TB-2, Page 84
18 Equivalence of Moore and Mealy Machine. 18-2-2018 1,2,3 TB-2, Page 85-87
19 22-2-2018
20 Applications and Limitation of FA. 23-2-2018 1,3 TB-1, Page 64
Context free grammar (CFG) and Context 26-2-2018
21 Free Languages (CFL): Definition, 1,4 TB-1, Page 157
Examples, Derivation , Derivation trees.
22 Ambiguity in Grammar, Inherent ambiguity. 28-2-2018 1,4 TB-1, Page 193
23 Ambiguous to Unambiguous CFG. 5-3-2018 1,4 TB-1, Page 194
6-3-2018
24 Useless symbols, Simplification of CFGs. 1,4 TB-1, Page 240
7-3-2018
28 14-3-2018
Closure properties of CFLs. 1,4 TB-1, Page 264-271
29 15-3-2018
30 16-3-2018
Decision Properties of CFLs: Emptiness,
1,4 TB-1, Page 276-283
31 Finiteness and Membership. 20-3-2018
Date Date Date Date Date Date Date Date Date Date Date Date
S N. Name of Student UPTU R N
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Total Present
TUTORIAL SHEETS – I
TUTORIAL SHEETS – II
Note: This Tutorial corresponds to Unit Nos.1-2
SASA|aB
AB|S
Bb|ε
SaAA
AaS|bS|a
Q4. Let L2 denote the context-free language {ααR | α ∈ {a, b}*}, where αR stands for the
reverse of the stringα. Prove or disprove: The complement of L2 (that is, ∼L2 = {a, b}* - L2)
is context-free. (Note: Either construct a CFG/PDA to accept ∼L2, or supply a proof based on
a) L = { an / n is odd}
b) L={an bn /n>=1}.
find the left most derivation. Also draw parse tree for the same. Obj-4
Obj-4
Q9. What is the disadvantages of unambiguous parse tree. Give an example. Obj-4
TUTORIAL SHEETS – IV
b)
Q3. Design the Turing machine which can shift the data on tape by two spaces. Obj-7
Q4. Design a Turing machine for function f(x,y)=x(x+y). Obj-7
Q5. Is it true that the language accepted by a non deterministic Turing Machine is different
from recursively enumerable language? Obj-7
Q6. When we say a problem is decidable? Give an example of undecidable problem? Give
two properties of recursively enumerable sets which are undecidable. Obj-8
Q7. Show that the following problem is undecidable.“Given two CFG’s G1 and G2, is
L(G1)∩L(G2)=Φ?”. Obj-8
Q8. Let Σ={0,1}.Let A and B be the lists of three strings each, defined as List A=
{1,10111 ,10}, List B={111 ,10 ,0 }.Does the instance of PCP has a solution.
Obj-8
Theory of Automata & Formal Languages
UNIT1
ASSIGNMENT1
1. Define finite automata. Discuss the applications based on finite automata.
2. Describe the Deterministic and Non deterministic finite automata. How does the
Deterministic finite automaton differ from Non deterministic finite automata?
*
3. Construct a DFA for the language L= (a+b) abb.
4. Construct a finite automata accepting all strings over {0, 1} having odd number of 0’s
5. Construct a finite automata accepting all strings over {0, 1} having even number of
0’s and 1’s.
6. What do you mean by Regular expressions? How can you convert a NFA to regular
expression?
UNIT1
ASSIGNMENT2
*
1. Construct the FA from the following regular expression r= (11+110) 0.
*
2. Construct a DFA equivalent to regular expression ba+(a+bb)a b
3. How NFA is converted to DFA? Give example and explain.
4. Construct DFA for given NFA with ∈moves.
5. Construct a DFA equivalent to
M= ({q0, q1,q2},{0,1},$,q0,{q2})
6. Find a Regular expression corresponding to each of the following subsets over {0,1}*.
th
a. The set of all strings where the 10 symbol from right end is a 1.
b. The set of all strings containing exactly 2a’s.
c. The set of all strings containing at least 2a’s.
d. The set of all strings containing the substring aa.
UNIT2
ASSIGNMENT1
1. Define finite state machine. Describe Moore and Melay machines in detail.
2. Describe Myhill Nerode theorem.
3. Discuss the limitations of FSM.
4. Discuss Pumping lemma. Describe the application of pumping lemma.
5. Prove that the class of regular set is closed under complementation.
6. Explain Melay and More machines. Construct Mooray machine which is equivalent
toMelay machine.
Melay Machine
Present state Input a=0 Input a=1
State Output State Output
q1 q3 0 q2 0
q2 q1 1 q4 0
q3 q2 1 q1 1
q4 q4 1 q3 0
UNIT2
ASSIGNMENT2
1. Construct minimum state automata equivalent to transition diagram:
2. Construct finite automata equivalent to regular expression
*
(0+1) (00+11)(0+1)
3. Convert this NFA into R.E by using arden’s method.
i2
4. Show that the set L={a |i>=1} is not regular.
i i
5. Show that L={0 1 |>=1} is not regular.
6. Construct a Moore machine equivalent to melay machine.
Start 0/Z1
q2
q1
1/Z2 0/Z1
1/Z1 1/Z
q3
UNIT3
ASSIGNMENT1
1. Discuss Griebach Normal Form (GNF) and its applications.
2. Convert the grammar into GNF.
S>AB
A>BS/b
B>SA/a
3. What is meant by pushdown machines? Discuss the application of pushdown
machines.
4. Define context free and context sensitive grammar and explain them.
5. Write three different derivation of the string “ababaa” using the following grammar.
Also give the derivation tree.
S> AA
A>AAA|bA|Ab|a
6. Eliminate all null productions.
S>ACD
A>a
B>∈
C>ED/∈
D>BC/b
E>b
UNIT3,4
ASSIGNMENT2
1. S>S+S/S*S/a/b show that G is ambiguous.
2. Find a grammar in CNF equivalent to the grammar.
S>ASA/bA
A>B/S
B>C
3. What do you mean by ambiguity? If CGF is S=SbS/a, show that G is ambiguous.
n n
4. Design a PDA to accept the language L= {a b | n>=1} by null store.
n m n
5. Design a PDA to accept the language L= (a b c |n,m>=1} by null store.
6. Construct a PDA with equal no of a’s and b’s by final state.
UNIT5
ASSIGNMENT1
1. Write a short note on unrestricted grammar.
2. Write a note on PCP problem.
3. Explain Deterministic and Non deterministic Turing machines.
4. Write short note on primitive recursive functions.
5. What do you mean by halting problem of Turing machine?
6. Write short note on Chomsky hierarchy.
UNIT5
ASSIGNMENT2
n n
1. Design a Turing machine to accept the language L={a b |n>=1}
2. Find the highest type number which can be applied to the following productions:
S>Aa, A>c/Ba, B>abc
S>aS/ab
3. Design a Turing machine over {1,b} which can compute a concatenation function over
∑= {1}. If a pair of words (w1, w2) is input, the output has to be w1w2.
4. Explain Primitive recursive function over initial function.
5. Explain Primitive recursive function over N.
6. Explain the model of Linear bounded automata.
QUIZ-1
Q1. Consider the DFA given above. Which of the following are FALSE?
1. Complement of L(A) is context-free.
2. L(A) = L((11*0+0)(0 + 1)*0*1*)
3. For the language accepted by A, A is the minimal DFA.
4. A accepts all strings over {0, 1} of length at least 2.
A 1 and 3 only
B 2 and 4 only
C 2 and 3 only
D 3 and 4 only
Q2. What is the complement of the language accepted by the NFA shown below?
Q3. Let w be any string of length n is {0,1}*. Let L be the set of all substrings of w. What is the
minimum number of states in a non-deterministic finite automaton that accepts L?
A n-1
B n
C n+1
D 2n-1
Q4. Which one of the following languages over the alphabet {0,1} is described by the regular
expression: (0+1)*0(0+1)*0(0+1)*?
A 15 states
B 11 states
C 10 states
D 9 states
Q4.
A (1*0)*1*
B 0 + (0 + 10)*
C (0 + 1)* 10(0 + 1)*
D none of these
QUIZ-3
Q1.
The Finite state machine described by the following state diagram with A as starting state, where
an arc label is x / y and x stands for 1-bit input and y stands for 2- bit output
A Outputs the sum of the present and the previous bits of the input.
B Outputs 01 whenever the input sequence contains 11.
C Outputs 00 whenever the input sequence contains 10.
D None of these
Q2. The smallest finite automation which accepts the language {x | length of x is divisible by 3}
has :
A 2 states
B 3 states
C 4 states
D 5 states
Q3. Given an arbitary non-deterministic finite automaton (NFA) with N states, the maximum
number of states in an equivalent minimized DFA is at least
2 N
A-N B-2 C-2N D-N!
Q4.
A {q0, q1, q2}
B {q0, q1}
C {q0, q1, q2, q3}
D {q3}
Q5. How many minimum states are required in a DFA to find whether a given binary string
has odd number of 0's or not, there can be any number of 1's.
A-1 B-2 C-3 D-4
QUIZ-4
Q1. The number of states in the minimal deterministic finite automaton corresponding to the
regular expression (0 + 1)*(10) is
Q2. Let T be the language represented by the regular expression Σ∗0011Σ∗ where Σ = {0, 1}. What is the
minimum number of states in a DFA that recognizes L' (complement of L)?
Q3.
Which of the following statements is TRUE about the regular expression 01*0?
A It represents a finite set of finite strings.
B It represents an infinite set of finite strings.
C It represents a finite set of infinite strings.
D It represents an infinite set of infinite strings
Q4. The number of states in the minimum sized DFA that accepts the language defined by the regular
expression (0+1)*(0+1)(0+1)* is __________________
A All palindromes
B All odd length palindromes.
C Strings that begin and end with the same symbol
D All even length palindromes
Q4. Consider the CFG with {S,A,B) as the non-terminal alphabet, {a,b) as the terminal alphabet,
S as the start symbol and the following set of production rules
S --> aB S --> bA
B --> b A --> a
B --> bS A --> aS
B --> aBB A --> bAA
Which of the following strings is generated by the grammar?
A aaaabb
B aabbbb
C aabbab
D abbbba
Q5. For the correct answer strings to above question, how many derivation trees are there?
A 1
B 2
C 3
D 4
A not recursive
B is recursive and is a deterministic CFL.
C is a regular language.
D is not a deterministic CFL but a CFL
Q2. Let G = ({S}, {a, b} R, S) be a context free grammar where the rule set R is S → a S b | SS | ε
Which of the following statements is true?
AG is not ambiguous
BThere exist x, y, ∈ L (G) such that xy ∉ L(G)
CThere is a deterministic pushdown automaton that accepts L(G)
DWe can find a deterministic finite state automaton that accepts L(G)
Q3. Which of the following statements is true?
A If a language is context free it can always be accepted by a deterministic push-down automaton
B The union of two context free languages is context free
C The intersection of two context free languages is context free
D The complement of a context free language is context free
Q4. Which one of the following statements is FALSE?
There exist context-free languages such that all the context-free grammars generating them are
A
ambiguous
An unambiguous context free grammar always has a unique parse tree for each string of the language
B
generated by it.
Both deterministic and non-deterministic pushdown automata always accept the same set of
C
languages
D A finite set of string from one alphabet is always a regular language.
Q5. A CFG G is given with the following productions where S is the start symbol, A is a non-terminal
and a and b are terminals.
S→aS∣A
A→aAb∣bAa∣ϵ
Which of the following strings is generated by the grammar above?
A-aabbaba B-aabaaba C-abababb D-aabbaab
QUIZ-7
m n m+n
Q1. The language {a b C | m, n ≥ 1} is
A regular
B context-free but not regular
C context sensitive but not context free
D type-0 but not context sensitive
Q2. The language accepted by a Pushdown Automation in which the stack is limited to 10 items is
best described as
A Context Free
B Regular
C Deterministic Context Free
D Recursive
Q3. Which of the following statements is true?
A If a language is context free it can always be accepted by a deterministic push-down automaton
B The union of two context free languages is context free
C The intersection of two context free languages is context free
D The complement of a context free language is context free
Q4. Which of the following languages are context-free?
L1 = {ambnanbm ⎪ m, n ≥ 1}
L2 = {ambnambn ⎪ m, n ≥ 1}
L3 = {ambn ⎪ m = 2n + 1}
A L1 and L2 only
B L1 and L3 only
C L2 and L3 only
D L3 only
QUIZ-9
QUIZ-8
Q1. Let L1 be a recursive language. Let L2 and L3 be languages that are recursively enumerable but not
recursive. Which of the following statements is not necessarily true? (A) L2 – L1 is recursively
enumerable. (B) L1 – L3 is recursively enumerable (C) L2 ∩ L1 is recursively enumerable (D) L2 ∪ L1 is
recursively enumerable
A B C D
A regular
B context-free
C context-sensitive
D recursive
Q3. Let L be a language and L' be its complement. Which one of the following is NOT a viable
possibility?
Q5. Let L1 be a recursive language, and let L2 be a recursively enumerable but not a
recursive language. Which one of the following is TRUE?
L1' --> Complement of L1
L2' --> Complement of L2
A L1' is recursive and L2' is recursively enumerable
B L1' is recursive and L2' is not recursively enumerable
C L1' and L2' are recursively enumerable
D L1' is recursively enumerable and L2' is recursive