B.C.A 2017-18 THEORY OF COMPUTATION MODULE SPECIFICATION SHEET Course Outline To introduce students the basic concepts in theoretical computer science, and the formal relationships among machines, languages and grammars. The purpose of this subject is to cover the underlying concepts and techniques used in Theory of Computations. In this course we cover finite automata, pushdown automata, Context free grammars and Turing Machines. We also Cover Pumping Lemma for context free Language and Regular Language. Faculty Details BHAVYA R Assistant Professor Department of BCA bhavyareddy@pes.edu PES DEGREE COLLEGE BANGALORE SOUTH CAMPUS Affiliated to Bangalore University
1. GENERAL INFORMATION Academic Year : 2017-18 Semester : VI Title Code Duration THEORY OF COMPUTATION Credits 3 BCA601T Lectures 60 Seminars 00 Total: 60 2. PRE REQUIREMENT STATEMENT This Subject has a good balance between Theory and Mathematical rigor. The students are expected to have a basic understanding of Discrete Mathematical Structures. 3. COURSE RELEVANCE In order to perform a rigorous study of computation, computer scientists work with a mathematical abstraction of computers called a model of computation. There are several models in use, but the most commonly examined is the Turing machine Computer scientists study the Turing machine because it is simple to formulate, can be analyzed and used to prove results, and because it represents what many consider the most powerful possible "reasonable" model of computation 4. LEARNING OUTCOMES 1. student can improve his/her logical thinking in solving the problems and theorems and understand the various concepts. 2. Model, compare and analyse different computational models using combinatorial methods. 3. Apply rigorously formal mathematical methods to prove properties of languages, grammars and automata. 4. Construct algorithms for different problems and argue formally about correctness on different restricted machine models of computation. 5. Identify limitations of some computational models and possible methods of proving them, this course is applicable to engineering application like designing the compilers. 5. VENUE AND HOURS/WEEK All lectures will normally be held on VII Floor. Lecture Sessions / Week : 5 2
6. MODULE MAP Session No Topics Portions Covered (%) Cumulative Portions Covered (%) Unit-1:Introduction Learning Objective By the end of this unit, students will be able to: Analyse and demonstrate the knowledge and ability to identify different types of finite automata and its capability. 1 Introduction Set Theory TextBook2: Chapter 1 Pg 1.2 to 1.3 2 Terminologies used in Finite Automata Operations on strings, operations on languages TextBook2: Chapter 1: Pg 1.3 to 1.4 3 Finite Automata(FA) Transition Diagram, table TextBook2: Chapter 1: Pg 1.6 to 1.8 4 Applications of Finite Automata and Types of FA DFA,NFA, ε-nfa TextBook2: Chapter 1: Pg 1.7 to1.8 5 Deterministic Finite Automata(DFA) Mathematical Representation of a DFA, Extended Transition function of DFA, Language Accepted bya DFA TextBook2: Chapter 1 Pg 1.9 t1.11 22.41% 22.41% 3
6 DFA Design 1.pattern Recognition problems TextBook2: Chapter 1 Pg 1.11to1.1.28 7 DFA Design 2.Divisible by K Problems TextBook2: Chapter Pg 1.11to1.1.31 8 DFA Design 3.Modulo-K-Counter problems. TextBook2: Chapter 1 Pg1.35 to1.40 9 Non Deterministic Finite Automata(NFA) Mathematical representation of NFA, NFA Design TextBook2: Chapter 1 Pg1.40 to1.65 10 Problems on Non Deterministic Finite Automata(NFA NFA Design Problems TextBook2: Chapter 1 Pg1.40 to1.65 11 ε-nfa Mathematical representation of ε-nfa,ε- Closure,Conversion from ε-nfa to DFA TextBook2: Chapter 1 Pg1.66 to1.67 12 Problems on ε-nfa Problems on constructing ε-nfa TextBook2: Chapter 1 Pg1.67 to1.74 4
13 Comparison of DFA, NFA,ε-NFA Comparison of DFA, NFA,ε-NFA TextBook2: Chapter 1 Pg1.74 to1.75 Unit II:Regular Expressions Learning Objective: By the end of this unit, students will be able to analyse regular expression, applications of regular expression, pumping lemma for regular expression and Minimization of finite automata. Apply rigorously formal mathematical methods to prove properties of languages, grammars and automata. 14 Introduction, Regular Expressions Properties of Regular Expressions. Pg2.2 to 2.9 15 Basic operations of Regular Expressions, Describing Regular Expressions Basic operations of Regular Expressions, Describing Regular Expressions Pg2.9 to2.13 16 Construction of ε-nfa from Regular Expression Construction of ε-nfa from Regular Expression Pg2.13 to2.20 17 Problems on Construction of ε-nfa from Regular Expression Problems on Construction of ε-nfa from Regular Expression Pg2.20 to2.25 5
18 Construction of Regular Expression from Finite Automata Construction of Regular Expression from Finite Automata Pg2.25 to2.28 19 Application of Regular Expressions Problems on Regular Expressions Pg2.3 to2.28 20 Pumping Lemma for Regular Languages Theorem, Application of pumping lemma TextBook2: Chapter 2 Pg2.28 to2.30 21 Pumping Lemma for Regular Languages Problems on pumping lemma Pg2.30 to 2.37 22 Properties of Regular Languages Closure Properties, Decision Properties. Pg2.37 to 40 23 Minimization of Finite Automata Minimization of Finite Automata Pg2.40 to 2.50 24 Problems on Minimization of Finite Automata Solving Problems on Minimization of Finite Automata Pg2.50 to 2.60 20.69% 43.1% 6
25 Problems on Minimization of Finite Automata Solving Problems on Minimization of Finite Automata Pg2.60 to 2.70 UNIT-3:Context Free Grammar: Learning Objective : By the end of this unit, students will be able to: Illustrate the Push down automata for a given language and discuss its properties. 26 Grammar,Types of Grammar Types of grammar Pg3.2 to 3.4 27 Context Free Grammar Definition,Language accepted by a CFG Pg3.4 to 3.6 28 Design of Language from CFG Problems Pg3.6 to 3.8 29 Design of Context Free Grammar from Finite Automata Problems Pg.3.8to 3.13 30 Design of Context Free Grammar from Languages Problems Pg. 3.13 to3.17 20.69% 63.79% 7
31 Design of Context Free Grammar from Languages Problems Pg.3.17to 3.20 32 Design of CFG from Regular Expressions Problems,Parsing/Derivation Pg.3.20to 3.21 33 Parsing/Derivation Left Most Derivation, Right Most Derivation Pg.3.21 to 3.23 34 Parse Tree / Derivation Tree(PT) Definition, subtree, problems, Applications of CFG Pg.3.24 to 3.28 35 Ambiguous Grammar Definition, Problems Pg.3.29 to 3.36 36 Pushdown Automata(PDA) Defintion,Language accepted by a PDA Pg. 3.36 to3.40 37 Construction of PDA Problems Pg. 3.40to3.51 8
Unit IV:Normal Forms for CFG Learning Objective: By the end of this unit, students will be able to: analyse the Chomsky Normal Form(CNF), Greibach Normal Form(GNF) 38 Introduction Substitution,Left Recursion Pg. 4.2 to 4.3 39 Simplification of CFG Elimination of Useless Symbols Pg. 4.5 to4.8 40 Elimination ε- Productions ε- Productions, Nullable Variable, Method to eliminate ε- Productions Pg. 4.8to4.10 41 Elimination ε- Productions Problems on Elimination ε- Productions 20.69% 84.48% Pg. 4.10to16 42 Elimination Unit Productions Defintion,Procedure to eliminate unit productions, Problems Pg. 4.16to4.24 43 Elimination Unit Productions Problems on Elimination Unit Productions Pg. 4.24to4.39 9
44 Normal forms for Context- free Grammars CNF,Reduction of CFG to CNF Pg. 4.39 45 Problems Problems on CNF : Pg. 4.39 to 4.48 46 Greibach Normal Form(GNF) Definition, Problems Pg. 4.49 to 4.59 47 Conversion of CFG to pda Steps,Problems Pg. 4.59 to 4.66 48 Pumping lemma for context free language Theorem Pg. 4.66 to4.69 49 Closure Properties of CFL s Theorem Pg. 4.69 to 4.71 Unit V:Turing Machine(TM) Learning Objective: By the end of this unit, students will be able to : Discuss the Abstract model of Computing machine through Turing machine and its types 50 Introduction to Turing machine(tm) Model of Turing Machine, Transition Diagram for Turing 10
,Transition Table, Instantaneous Description of a TM(ID) TextBook2: Chapter 5 Pg. 5.2 to 5.4 51 Construction of Turing machine(tm) Problems TextBook2: Chapter 5 Pg. 5.4 to 5.10 52 Problems on Turing machine(tm) TextBook2: Chapter 5 Problems on Turing machine(tm) TextBook2: Chapter 5 Pg. 5.4 to 5.10 53 Problems on Turing machine(tm) TextBook2: Chapter 5 Problems on Turing machine(tm) Pg. 5.10 to 5.16. 54 Types of Turing Machines Multi tape TM,Non deterministic TM,Multi-dimension TM,Multi head TM TextBook2: Chapter 5 Pg. 5.16 to 5.18 55 Undecidability Undecidability TextBook2: Chapter 5 Pg. 5 5.18 56 Recursive and recursively enumerable languages Definition, Properties TextBook2: Chapter 5 Pg. 5.18 15.52% 100% 11
57 Halting Problem of Turing Machine Theorem TextBook2: Chapter 5 Pg. 5.20 to 5.22 58 The Post Correspondence Problem(PCP) Definition, Problems TextBook2: Chapter 5 Pg. 5.23 to 5.24 59 Revision 60 Revision 7. RECOMMENDED BOOKS/JOURNALS/WEBSITES 7.1.Text books: 1. John E. Hopcroft, Rajeev Motwani, Jeffrey D.Ullman: Introduction to Automata Theory, Languages and Computation, 3rd Edition, Pearson Education, 2011. 2.Sarakutty T K, T Kohila Kangalakshmi: Theory of Computation,Skyward Publishers 7.2. Reference Books: 1. John C Martin: Introduction to Languages and Automata Theory, 3rd Edition, Tata McGraw-Hill, 2007. 2. Daniel I.A. Cohen: Introduction to Computer Theory, 2nd Edition, John Wiley & Sons, 2009. 3. Thomas A. Sudkamp: An Introduction to the Theory of Computer Science, Languages and Machines, 3rd Edition,Pearson Education, 2006 7.3. WEBSITES / ONLINE REFERENCES 1. http//www.tutorialspoint.com/cplusplus 2. http//www.e-booksdirectory.com 8. ASSIGNMENT(S) ASSIGNMENT 1& 2 1. Draw a DFA to accept string of a s and b s having a substring aab. 2. Draw a DFA to accept strings of a s and b s having even number of a s and even number of b s? 3. Obtain a DFA to accept the language L={w: w mod 3=0} on ={a,b} 4. Construct a DFA to accept all strings on {a,b} having the prefix `baa` simulate the behaviour of DFA on baabab, abaab. 5. Explain finite automata in detail with an example. ASSIGNMENT 3 & 4 1. State and prove pumping lemma for Regular languages. 12
2. Construct on ε-nfa for the regular expression (0+1)*1(0+1). 3. Show that L={0 n 1 n n 0} is not Regular. 4. Show that L={W n a (W) = n b (W)} is not Regular 5. Explain Chomsky hierarchy og generative grammars. ASSIGNMENT 5 & 6 1. Construct a Turing Machine to accept the language L={0 n 1 n n 0} 2. Explain the halting problem of TM 3. Describe the Post correspondence problem. 4. Define Recursive and Recursively enumerable languages. 5. Explain Types turing Turing machine. 9. THEORY ASSESSMENT A. WRITTEN EXAMINATION The Theory Examination is for 100 Marks which will be held for duration of 3 Hrs. The Scheme and Blue Print will be released to the students once the Bangalore University releases it. B. CONTINUOUS ASSESSMENT The Continuous Assessment is conducted as per the following parameters. Parameter Assessment Marks Final Weightage Internal Test 50 Marks 37.5 Marks Assignment / 10 Marks 6.25 Marks Class Test 10 marks 6.25 Marks Total 70 Marks 50 Marks The students are hereby required to note that every internal test weightage will calculated for 44 Marks. This includes timely submission of assignments and attending class tests as conducted. Internal Test 01 Internal Test 02 Internal Test 03 Parameter MARKS 44 MARKS 44 MARKS 44 MARKS Final Internal Marks (Sum The Three Internal Tests) Attendance >95 % : 06 Marks 90-95 % : 05 Marks 85-90 % : 04 Marks 80-85 % : 03 Marks 75-80 % : 02 Marks 44 MARKS 06 MARKS 13
Total 50 MARKS 10. ASSESSMENT / ASSIGNMENT / CLASS TEST / ACTIVITY PLANNER Week 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Internal Test T1 T2 T2 Assignments Submission A1 A2 A3 A4 A5 A6 Class Test /CT /CT /CT Legend Meaning Test Topics Examinable T1, T2,T3 Internal Tests T1 Class 1 19 A1, A2, A3, A4, A5, A6 Assignments T2 Class 20-39 CT Class Test T3 Class 40-58 11. QUESTION BANK Unit-1: Introduction 2 marks Questions 1. Define Symbol, Alphabet? 2. Define ε NFA? 3. Design a DFA which ends with 01? 4. What are the Applications of Finite Automata? 5. Define extended transition function of DFA. 6. Design a DFA which accept strings of a s and b s starting with a string ab. 10 marks Questions 1. Draw a DFA to accept string of a s and b s having a substring aab. 2. Draw a DFA to accept strings of a s and b s having even number of a s and even number of b s? 3. Obtain a DFA to accept the language L={w: w mod 3=0} on ={a,b} 4. Draw a FA to accept decimal strings divisible by 3. 5. Differentiate between DFA, NFA, εnfa? 6. Draw a DFA to accept string of a s and b s ending with ab or ba. 7. Convert the following NFA into an equilent DFA. 14
Unit-2:Regular Expression 2 marks Questions 1. Define Regular Expression. 2. Construct a Regular Expression for the language consisting of all strings of a s and b s beginning with a and ending with ab. 3. Write a Regular Expression representing strings of 0 s and 1 s having odd length. 4. Write the properties of Regular languages. 5. Construct on ε-nfa for the regular expression 00*+1. 6. Define Closure properties and Decision properties of Regular languages. 10 marks Questions 1. State and prove pumping lemma for Regular languages. 2. Construct on ε-nfa for the regular expression (0+1)*1(0+1). 3. Show that L={0 n 1 n n 0} is not Regular. 4. Show that regular languages are closed under intersection and reversal. Unit-3:Context Free Grammars 1. Show that L={W n a (W) = n b (W)} is not Regular 2. Explain Chomsky hierarchy in generative grammars. 3. Define Parse tree and subtree with examples. 4. Construct a leftmost, rightmost, and parse tree. a)aaaaa b)abbbba c)bababbabab 5. Design a PDA to accept the language L(M)={wcw R w ε(a+b) *} where w R is the reverse of w. Unit-4:Normal Forms for CFG 2 marks 1. Define Right most Derivation and Left most Derivation. 2. Define Parsing and Ambiguous Grammar. 3. Eliminate left Recursion from the grammar. i. S->aB/bA ii. A->Ab/Sa 4. Define CFG, CNF and GNF. 5. Explain nullable variable with an example. 10 marks 1. Write the steps to Eliminate Useless symbols. 2. Write short note on Chomsky Hierarchy of languages. 3. Convert the following CFG to GNF S->AB A->BSB A->a B->b 15
4. Define Unit Productions & Eliminate all Unit Productions from the grammar. S->AB A->a B->C/b C->D D->E/bC E->d/Ab Unit-5:Turing Machine 2 marks questions 1. Write any four types of Turing Machine. 2. Define Post Correspondence problem 3. Define TM, Language acceptance of TM and ID of TM. 10 marks questions 1. Construct a Turing Machine to accept the language i. L={0 n 1 n n 0} 2. Explain the halting problem of TM 12. PREVIOUS QUESTION PAPERS 16
17
18
19
20
21