Sheet 1-8 Dr. Mostafa Aref Format By : Mostafa Sayed
|
|
- Dina Harper
- 5 years ago
- Views:
Transcription
1 Sheet -8 Dr. Mostafa Aref Format By : Mostafa Sayed 09
2 Introduction Assignment. For = {a, } a) Write 0 strings of the following languages i) All strings with no more than one a,,, a, a, a, a, a, a, a ii) All strings with at least three a s aaa, aaa, aaa, aaaaa, aaa, aaa, aaa, aaa, aaa, aaa ) Write the grammar for the aove two languages i) All strings with no more than one a S B ii) S B BaB B B All strings with at least three a s BaBaBaB B ab 2. Give a simple description of the language generated y the grammar with production S aa A S S L = {(a) n : n>= 0 } 3. Find the grammar that generates the language L = {ww R : w {a, } + }. S aba B B B aba Format By : Mostafa Sayed (The Best) Page 2
3 4. Consider the grammar G = ({A, B, C, D, E, S}, {a}, S, P), with productions S ABaC Ba aab BC DC E ad Da AD AB ae Ea AE Drive three different sentences in L(G). From these, make a conjecture aout L(G). S S S aa, aaaa, aaaaaaaa. L(G) = {a n : n = 2 i, i>=} Format By : Mostafa Sayed (The Best) Page 3
4 Finite Automata Assignment. For = {a, }, construct dfa that accept the sets of a. All strings with no more than one a q 0 a q a q 2 a,. All strings with at least three a s a, q 0 a q a q 2 a q 3 2. Give a simple description of the language accepted y the following dfa a a, a q 0 q q 2 a q 3 All strings of a s and s except that contains sustring a 3. Find a dfa that accept the language defined y the following nfa q 0 q q 2 q 3 q 4 q 5 q 0 q q 2 q 3 q 4 q 5 4. Can you construct a dfa or nfa that accepts the following language L = {ww R : w {a, } + }. No: Explain why? Because it is not a regular language, it a context-free language. Format By : Mostafa Sayed (The Best) Page 4
5 5. For = {a, }, Convert the following nfa into an equivalent dfa. q 0 a q a, q 2 {q 0 } {q } a {q 2 } a, a {q, q 2 } Format By : Mostafa Sayed (The Best) Page 5
6 Regular Languages Assignment. Give a regular expression for a. L = {a n m, n >=4, m =< 3} aaaaa*(,,, ). L = {a n w, n >=3, w {a, } + } a*(a + )(a + )* 2. Find regular expression for the languages accepted y the following automata a. a*(a)** a a, a q 0 q q 2 a q 3. q 0 q q 2 q 3 + ()* q 4 q 5 3. Construct a dfa that accept the language generated y the grammar S aa A ab B aa a q 0 a q a q 2 q 3 a a, q 4 a, Format By : Mostafa Sayed (The Best) Page 6
7 4. Find a regular grammar for the language L = {a n m : n + m is even} S aaa aa A aaa B B B A aaa B 5. Show that there exits an algorithm for determining if L L 2 for any regular languages L and L 2 Since L and L 2 are regular languages, L U L 2 is also regular language. (Theorem 4.) If L U L 2 = L 2 then L L 2 We determine the aove equality using Theorem 4.7. Then, that there exits an algorithm for determining if L L 2 6. Consider the following languages. For each, state whether or not it is regular. Then prove your statement. a. L = {a n m, n =< m } This is not a regular language. To show that we need to use pumping lemma - The opponent: Given a positive integer m 2- We: choose w = aaaa a m m 3- The opponent: has to decompose w into xyz, xy < m a. xy contains all a s, y has at least one a,. xy contains all s, y has at least one, c. xy contains some a s and some s, y has a s and s, y i, i > 2, w does not elong to the language. d. xy contains some a s and some s, y has at least one, y i, i =0, we have a s more than s 4- We: show a. y i, i > 2, we have a s more than s. y i, i =0, we have a s more than s c. y i, i > 2, w does not elong to the language. d. y i, i =0, we have a s more than s Therefore, the language is not regular. Format By : Mostafa Sayed (The Best) Page 7
8 . L = {ww, w {a, } * } This is not a regular language. To show that we need to use pumping lemma - The opponent: Given a positive integer m 2- We: choose w = = aaaa a aaaa a m m m m 3- The opponent: has to decompose w into xyz, xy < m a. xy contains all a s, y has at least one a,. xy contains all s, y has at least one, c. xy contains some a s and some s, y has a s and s, d. xy contains some a s and some s, y has at least one, e. So on 4- We: show a. yi, i > 2, we have a s in the left more than a s in the right. yi, i > 2, we have s in the left more than s in the right c. y i, i =0, we have a s more than s d. y i, i > 2, w does not elong to the language. e. y i, i =0, we have s in the left more than s in the right f. So on Therefore, the language is not regular. c. L = {a n m c l, n + m + l = 0} This language is regular, since it is finite. d. L = {a n m : n + m is even} This language is regular; there is a regular grammar for it (see prolem 4). e. L = {a n m c l, n =< 0, m =< 0, l >= 0} This language is regular; there is a regular expression for it: (, a, aa, aaa, aaaa, aaaaaaaaaa)(,,,, )ccccccccccc* Format By : Mostafa Sayed (The Best) Page 8
9 Context-Free Language Assignment 7. Find context-free grammar for the following languages (n >= 0, m>=0, k>=0) a. L = {a n m, n =< m } S as B, B B. L = {ww, w {a,, c} * } This language is not a context-free language. We cannot write context-free grammar for it. c. L = {a n m c k, k = n + m } S asc abc, B Bc. 8. Show a derivation tree for the string aa with the grammar S AB, A ab, B S. S AB abb asb aabb aabbb aasbb aabb aasb aab aas aa 9. Show that the following grammar is amiguous S ass SaS S ass asass aass aas aa S ass as aass aas aa Format By : Mostafa Sayed (The Best) Page 9
10 Simplification of CFG Assignment 0. Eliminate all useless productions from the grammar S a aa B C, A ab, B Aa, C ccd, D ddd S a aa B A ab, B Aa. Eliminate -productions from the grammar S AaB aab, A, B A S ab aab a aa B 2. Transform the grammar S aab, A AB, B Baa A into Chomsky normal form. a. Eliminate -productions S aab aa ab a A A B AB B Baa A aa.. Eliminate unit productions B A S aab aa ab a A A B AB B Baa A B AB aa. c. Sustitute terminals symols with variales V a a V S V a V AB V a V A V a V B V a V A V A V B V AB B B V a V a V A V B V AB V a V a d. Simplify several variales into two variales V d V a V V e V a V a V f AB S V d V f Vd A V d B V a V A V A V B V V f B B V e V A V B V V f V a V a V a a V Format By : Mostafa Sayed (The Best) Page 0
11 Pushdown Automata. Construct and draw an npda that accept the following languages: a. L = L(a**) a,z/z,z/z q 0,z/z q,z/z q f We do not need to use the stack for this prolem. We need to have two different state for accepting a s and s. L = {a n m c m+n : n >= 0, m >= 0} a,z/0z,0/00 c,0/ a,0/00 q 0 q q 2 q f,0/00 c,0/,z/z a,z/0z a,0/00 c,/ c,0/,0/0,/ q 0 c,/ c,0/ q q f,z/z In the first solution, we are using a single stack symol with two states for accepting a s then s. In the second solution, we are using two different stack symols for accepting a s and s. But, we are using one state to accept oth of them. c. L = {a 3n n : n >= 0 } a,z/z a,3/3,3/ a,/2 a,2/3 q 0,3/ q,z/z q f We may use ant three symols to keep track of every three a s. (e.g. x,y,z) We may use just one symol and keep adding it. But we need to remove three symols for each. 2. Construct and draw an npda that accept the following languages: S BB, B SB a Convert this grammar to Greiach normal form: S ab BB B B abb a a,s/b,s/bb,s/ a,b/bb,b/b a,b/ q 0,z/Sz q,z/ q f Format By : Mostafa Sayed (The Best) Page
12 3. Show that the following language is not a context-free language L = {w {a,, c}* : n a (w) + n (w) = 2n c (w)} We need to use pumping lemma for context-free languages - The opponent: Given a positive integer m 2- We: choose w = aaaa a cccc c m m 2m 3- The opponent: has to decompose w into uvxyz, vxy =< m, vy >= e. vxy contains all a s, v and y has at least one a, f. vxy contains all s, v and y has at least one, g. vxy contains some a s and some s, v at least one a and y has at least one h. so on 4- We: show i. uv i xy i z, i > 2, we have a s more than c s j. uv i xy i z, i > 2, we have s more than c s k. uv i xy i z, i > 2, we have a s and s more than c s l. so on Therefore, the language is not a context-free language. Format By : Mostafa Sayed (The Best) Page 2
13 Turing Machine. Construct Turing machines that accepts the following language on {x, y, z}. a. L = {w: w is multiple of 4} (Draw the transition diagram). z/z,r y/y,r x/x,r c,0/ x/x,r x/x,r x/x,r q 0 y/y,r q y/y,r q 2 y/y,r q 3 z/z,r z/z,r z/z,r /,L q f. L = {w: n x (w) = n y (w) = n z (w)} (Draw the transition diagram). /,R y/y,r a/a,r c/c,r x/x,r /,R x/x,r /,R c/c,r a/a,r y/,r q x q xy x/a,r z/c,r c/c,r a/a,r x/a,r c/c,r a/a,r c/c,r a/a,r /,R c/c,l a/a,l /,L /,R /,R y/y,r y/y,r z/z,r x/x,l y/y,l z/z,l y/,r z/c,r q q y q yz x/a,r q xyz z/c,r y/,r /,R z/z,r x/a,r x/a,r /,R c/c,r a/a,r q f q xz /,R c/c,r a/a,r z/z,r x/x,r 2. Construct Turing machines that computes f(x, y) = 3x + y (Draw the transition diagram). Format By : Mostafa Sayed (The Best) Page 3
14 3. Construct Linear ounded automata for L = {ww R : w {a,, c} + } (Draw the transition diagram). c/c,l a/a,l /,L c/c,r a/a,r /,R q a ]/],L 0/0,L q aa a/0,r /,R a/0,l 0/0,R c/c,r a/a,r q 0 /0,R q ]/],L 0/0,L q /0,L q 2 ]/],L c/c,r a/a,r c/0,l c/0,r /,R ]/],L 0/0,L q c q c q Format By : Mostafa Sayed (The Best) Page 4
15 A Hierarchy of Formal Languages ) Give language examples that demonstrate the suset relations in the following diagram. These examples should e mutual exclusive (i.e. a CSL should not e CFL nor RL). RE Language CSL CFL RL a) R.E. Language: ) CSL: a n n c n c) CFL: a n n d) RL: a* 2) Find a PC-solution for the following sequences: X = { a, aa,, a } and Y = {, a, aa, a }. X2 X3 X X4 aa a a a aa a Y2 Y3 Y Y4 Format By : Mostafa Sayed (The Best) Page 5
Automata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008
Automata Theory Final Exam Solution 08:10-10:00 am Friday, June 13, 2008 Name: ID #: This is a Close Book examination. Only an A4 cheating sheet belonging to you is acceptable. You can write your answers
More informationHomework 4 Solutions. 2. Find context-free grammars for the language L = {a n b m c k : k n + m}. (with n 0,
Introduction to Formal Language, Fall 2016 Due: 21-Apr-2016 (Thursday) Instructor: Prof. Wen-Guey Tzeng Homework 4 Solutions Scribe: Yi-Ruei Chen 1. Find context-free grammars for the language L = {a n
More informationConcordia University Department of Computer Science & Software Engineering
Concordia University Department of Computer Science & Software Engineering COMP 335/4 Theoretical Computer Science Winter 2015 Assignment 3 1. In each case, what language is generated by CFG s below. Justify
More informationTAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar
TAFL 1 (ECS-403) Unit- III 3.1 Definition of CFG (Context Free Grammar) and problems 3.2 Derivation 3.3 Ambiguity in Grammar 3.3.1 Inherent Ambiguity 3.3.2 Ambiguous to Unambiguous CFG 3.4 Simplification
More informationHarvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs
Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs Harry Lewis October 8, 2013 Reading: Sipser, pp. 119-128. Pushdown Automata (review) Pushdown Automata = Finite automaton
More informationTheory of Computation - Module 3
Theory of Computation - Module 3 Syllabus Context Free Grammar Simplification of CFG- Normal forms-chomsky Normal form and Greibach Normal formpumping lemma for Context free languages- Applications of
More informationSt.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad
St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad-500 014 Subject: FORMAL LANGUAGES AND AUTOMATA THEORY Class : CSE II PART A (SHORT ANSWER QUESTIONS) UNIT- I 1 Explain transition diagram, transition
More informationTheory of Computation
Fall 2002 (YEN) Theory of Computation Midterm Exam. Name:... I.D.#:... 1. (30 pts) True or false (mark O for true ; X for false ). (Score=Max{0, Right- 1 2 Wrong}.) (1) X... If L 1 is regular and L 2 L
More informationLecture 12 Simplification of Context-Free Grammars and Normal Forms
Lecture 12 Simplification of Context-Free Grammars and Normal Forms COT 4420 Theory of Computation Chapter 6 Normal Forms for CFGs 1. Chomsky Normal Form CNF Productions of form A BC A, B, C V A a a T
More informationAC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013
Q.2 a. Prove by mathematical induction n 4 4n 2 is divisible by 3 for n 0. Basic step: For n = 0, n 3 n = 0 which is divisible by 3. Induction hypothesis: Let p(n) = n 3 n is divisible by 3. Induction
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY REVIEW for MIDTERM 1 THURSDAY Feb 6 Midterm 1 will cover everything we have seen so far The PROBLEMS will be from Sipser, Chapters 1, 2, 3 It will be
More information(b) If G=({S}, {a}, {S SS}, S) find the language generated by G. [8+8] 2. Convert the following grammar to Greibach Normal Form G = ({A1, A2, A3},
Code No: 07A50501 R07 Set No. 2 III B.Tech I Semester Examinations,MAY 2011 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 80 Answer any FIVE Questions All
More informationCS375: Logic and Theory of Computing
CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Table of Contents: Week 1: Preliminaries (set algebra, relations, functions) (read Chapters
More informationTheory of Computation (Classroom Practice Booklet Solutions)
Theory of Computation (Classroom Practice Booklet Solutions) 1. Finite Automata & Regular Sets 01. Ans: (a) & (c) Sol: (a) The reversal of a regular set is regular as the reversal of a regular expression
More informationSimplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University
Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form
More informationSimplification of CFG and Normal Forms. Wen-Guey Tzeng Computer Science Department National Chiao Tung University
Simplification of CFG and Normal Forms Wen-Guey Tzeng Computer Science Department National Chiao Tung University Normal Forms We want a cfg with either Chomsky or Greibach normal form Chomsky normal form
More information60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor
60-354, Theory of Computation Fall 2013 Asish Mukhopadhyay School of Computer Science University of Windsor Pushdown Automata (PDA) PDA = ε-nfa + stack Acceptance ε-nfa enters a final state or Stack is
More informationÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 17 april Classrum Edition
ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK 7 april 23 Classrum Edition CONTEXT FREE LANGUAGES & PUSH-DOWN AUTOMATA CONTEXT-FREE GRAMMARS, CFG Problems Sudkamp Problem. (3.2.) Which language generates the
More informationINSTITUTE OF AERONAUTICAL ENGINEERING
INSTITUTE OF AERONAUTICAL ENGINEERING DUNDIGAL 500 043, HYDERABAD COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name : FORMAL LANGUAGES AND AUTOMATA THEORY Course Code : A40509 Class :
More informationHomework 4. Chapter 7. CS A Term 2009: Foundations of Computer Science. By Li Feng, Shweta Srivastava, and Carolina Ruiz
CS3133 - A Term 2009: Foundations of Computer Science Prof. Carolina Ruiz Homework 4 WPI By Li Feng, Shweta Srivastava, and Carolina Ruiz Chapter 7 Problem: Chap 7.1 part a This PDA accepts the language
More informationVTU QUESTION BANK. Unit 1. Introduction to Finite Automata. 1. Obtain DFAs to accept strings of a s and b s having exactly one a.
VTU QUESTION BANK Unit 1 Introduction to Finite Automata 1. Obtain DFAs to accept strings of a s and b s having exactly one a.(5m )( Dec-2014) 2. Obtain a DFA to accept strings of a s and b s having even
More informationTheory of Computation (IV) Yijia Chen Fudan University
Theory of Computation (IV) Yijia Chen Fudan University Review language regular context-free machine DFA/ NFA PDA syntax regular expression context-free grammar Pushdown automata Definition A pushdown automaton
More information1. (a) Explain the procedure to convert Context Free Grammar to Push Down Automata.
Code No: R09220504 R09 Set No. 2 II B.Tech II Semester Examinations,December-January, 2011-2012 FORMAL LANGUAGES AND AUTOMATA THEORY Computer Science And Engineering Time: 3 hours Max Marks: 75 Answer
More informationTheory of Computer Science
Theory of Computer Science C1. Formal Languages and Grammars Malte Helmert University of Basel March 14, 2016 Introduction Example: Propositional Formulas from the logic part: Definition (Syntax of Propositional
More informationComputational Models - Lecture 4
Computational Models - Lecture 4 Regular languages: The Myhill-Nerode Theorem Context-free Grammars Chomsky Normal Form Pumping Lemma for context free languages Non context-free languages: Examples Push
More informationCS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL) Objectives Introduce Pumping Lemma for CFL Apply Pumping Lemma to show that some languages are non-cfl Pumping Lemma
More informationSFWR ENG 2FA3. Solution to the Assignment #4
SFWR ENG 2FA3. Solution to the Assignment #4 Total = 131, 100%= 115 The solutions below are often very detailed on purpose. Such level of details is not required from students solutions. Some questions
More informationPart 4 out of 5 DFA NFA REX. Automata & languages. A primer on the Theory of Computation. Last week, we showed the equivalence of DFA, NFA and REX
Automata & languages A primer on the Theory of Computation Laurent Vanbever www.vanbever.eu Part 4 out of 5 ETH Zürich (D-ITET) October, 12 2017 Last week, we showed the equivalence of DFA, NFA and REX
More informationThe View Over The Horizon
The View Over The Horizon enumerable decidable context free regular Context-Free Grammars An example of a context free grammar, G 1 : A 0A1 A B B # Terminology: Each line is a substitution rule or production.
More informationCISC 4090 Theory of Computation
CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: Captured by Regular Operations a b
More informationComputational Models - Lecture 4 1
Computational Models - Lecture 4 1 Handout Mode Iftach Haitner and Yishay Mansour. Tel Aviv University. April 3/8, 2013 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice
More informationFinite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018
Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018 Lecture 14 Ana Bove May 14th 2018 Recap: Context-free Grammars Simplification of grammars: Elimination of ǫ-productions; Elimination of
More informationHomework 5 - Solution
DCP3122 Introduction to Formal Languages, Spring 2015 Instructor: Prof. Wen-Guey Tzeng Homework 5 - Solution 5-May-2015 Due: 18-May-2015 1. Given Σ = {a, b, c}, find an NPDA that accepts L = {a n b n+m
More information2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a
. Solution E T F a E E + T T + T F + T a + T a + F a + a E E + T E + T + T T + T + T F + T + T a + T + T a + F + T a + a + T a + a + F a + a + a E T F ( E) ( T ) ( F) (( E)) (( T )) (( F)) (( a)) . Solution
More informationCFG Simplification. (simplify) 1. Eliminate useless symbols 2. Eliminate -productions 3. Eliminate unit productions
CFG Simplification (simplify) 1. Eliminate useless symbols 2. Eliminate -productions 3. Eliminate unit productions 1 Eliminating useless symbols 1. A symbol X is generating if there exists: X * w, for
More informationContext-Free Grammar
Context-Free Grammar CFGs are more powerful than regular expressions. They are more powerful in the sense that whatever can be expressed using regular expressions can be expressed using context-free grammars,
More informationDefinition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where
Recitation 11 Notes Context Free Grammars Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x A V, and x (V T)*. Examples Problem 1. Given the
More informationIntroduction to Theory of Computing
CSCI 2670, Fall 2012 Introduction to Theory of Computing Department of Computer Science University of Georgia Athens, GA 30602 Instructor: Liming Cai www.cs.uga.edu/ cai 0 Lecture Note 3 Context-Free Languages
More informationFinite Automata and Formal Languages TMV026/DIT321 LP Useful, Useless, Generating and Reachable Symbols
Finite Automata and Formal Languages TMV026/DIT321 LP4 2012 Lecture 13 Ana Bove May 7th 2012 Overview of today s lecture: Normal Forms for Context-Free Languages Pumping Lemma for Context-Free Languages
More informationEXAMPLE CFG. L = {a 2n : n 1 } L = {a 2n : n 0 } S asa aa. L = {a n b : n 0 } L = {a n b : n 1 } S asb ab S 1S00 S 1S00 100
EXAMPLE CFG L = {a 2n : n 1 } L = {a 2n : n 0 } S asa aa S asa L = {a n b : n 0 } L = {a n b : n 1 } S as b S as ab L { a b : n 0} L { a b : n 1} S asb S asb ab n 2n n 2n L {1 0 : n 0} L {1 0 : n 1} S
More informationCS375: Logic and Theory of Computing
CS375: Logic and Theory of Computing Fuhua (Frank) Cheng Department of Computer Science University of Kentucky 1 Tale of Contents: Week 1: Preliminaries (set alger relations, functions) (read Chapters
More informationContext-Free Languages (Pre Lecture)
Context-Free Languages (Pre Lecture) Dr. Neil T. Dantam CSCI-561, Colorado School of Mines Fall 2017 Dantam (Mines CSCI-561) Context-Free Languages (Pre Lecture) Fall 2017 1 / 34 Outline Pumping Lemma
More informationTHEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET
THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET Regular Languages and FA A language is a set of strings over a finite alphabet Σ. All languages are finite or countably infinite. The set of all languages
More informationComputational Models - Lecture 5 1
Computational Models - Lecture 5 1 Handout Mode Iftach Haitner. Tel Aviv University. November 28, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.
More informationCA320 - Computability & Complexity
CA320 - Computability & Complexity David Sinclair Context-Sensitive Grammars An unrestricted grammar is a 4-tuple G = (V,Σ,S,P), where V and Σ are disjoint sets of variables and terminals respectively.
More informationThe Pumping Lemma for Context Free Grammars
The Pumping Lemma for Context Free Grammars Chomsky Normal Form Chomsky Normal Form (CNF) is a simple and useful form of a CFG Every rule of a CNF grammar is in the form A BC A a Where a is any terminal
More informationDM17. Beregnelighed. Jacob Aae Mikkelsen
DM17 Beregnelighed Jacob Aae Mikkelsen January 12, 2007 CONTENTS Contents 1 Introduction 2 1.1 Operations with languages...................... 2 2 Finite Automata 3 2.1 Regular expressions/languages....................
More informationSection 1 (closed-book) Total points 30
CS 454 Theory of Computation Fall 2011 Section 1 (closed-book) Total points 30 1. Which of the following are true? (a) a PDA can always be converted to an equivalent PDA that at each step pops or pushes
More informationC1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.
Theory of Computer Science March 20, 2017 C1. Formal Languages and Grammars Theory of Computer Science C1. Formal Languages and Grammars Malte Helmert University of Basel March 20, 2017 C1.1 Introduction
More informationBefore We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?
Before We Start The Pumping Lemma Any questions? The Lemma & Decision/ Languages Future Exam Question What is a language? What is a class of languages? Context Free Languages Context Free Languages(CFL)
More informationContext Free Languages. Automata Theory and Formal Grammars: Lecture 6. Languages That Are Not Regular. Non-Regular Languages
Context Free Languages Automata Theory and Formal Grammars: Lecture 6 Context Free Languages Last Time Decision procedures for FAs Minimum-state DFAs Today The Myhill-Nerode Theorem The Pumping Lemma Context-free
More informationAutomata Theory. CS F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages. David Galles
Automata Theory CS411-2015F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages David Galles Department of Computer Science University of San Francisco 10-0: Fun with CFGs Create
More informationFormal Languages, Automata and Models of Computation
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2011 1 Content - More Properties of Regular Languages (RL)
More informationProblem 2.6(d) [4 pts] Problem 2.12 [3pts] Original CFG:
Problem 2.6(d) [4 pts] S X T#X X#T T#X#T X axa bxb #T# # T at bt #T ε Problem 2.12 [3pts] Original CFG: R XRX S S atb bta T XTX X ε X a b q start ε, ε $ ε, R X ε, ε R ε, ε X ε, R S ε, T X ε, T ε ε, X a
More informationPushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen
Pushdown Automata Notes on Automata and Theory of Computation Chia-Ping Chen Department of Computer Science and Engineering National Sun Yat-Sen University Kaohsiung, Taiwan ROC Pushdown Automata p. 1
More informationCS 420, Spring 2018 Homework 4 Solutions. 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0};
CS 420, Spring 2018 Homework 4 Solutions 1. Use the Pumping Lemma to show that the following languages are not regular: (a) {0 2n 10 n n 0}; Solution: Given p 1, choose s = 0 2p 10 p. Then, s is in the
More informationCISC 4090 Theory of Computation
CISC 4090 Theory of Computation Context-Free Languages and Push Down Automata Professor Daniel Leeds dleeds@fordham.edu JMH 332 Languages: Regular and Beyond Regular: a b c b d e a Not-regular: c n bd
More informationCS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA) Objectives Introduce the Pumping Lemma for CFL Show that some languages are non- CFL Discuss the DPDA, which
More informationPushdown Automata. Reading: Chapter 6
Pushdown Automata Reading: Chapter 6 1 Pushdown Automata (PDA) Informally: A PDA is an NFA-ε with a infinite stack. Transitions are modified to accommodate stack operations. Questions: What is a stack?
More informationPushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen
Pushdown automata Twan van Laarhoven Institute for Computing and Information Sciences Intelligent Systems Version: fall 2014 T. van Laarhoven Version: fall 2014 Formal Languages, Grammars and Automata
More informationQuestion Bank UNIT I
Siddhivinayak Technical Campus School of Engineering & Research Technology Department of computer science and Engineering Session 2016-2017 Subject Name- Theory of Computation Subject Code-4KS05 Sr No.
More informationCS500 Homework #2 Solutions
CS500 Homework #2 Solutions 1. Consider the two languages Show that L 1 is context-free but L 2 is not. L 1 = {a i b j c k d l i = j k = l} L 2 = {a i b j c k d l i = k j = l} Answer. L 1 is the concatenation
More informationdownload instant at Assume that (w R ) R = w for all strings w Σ of length n or less.
Chapter 2 Languages 3. We prove, by induction on the length of the string, that w = (w R ) R for every string w Σ. Basis: The basis consists of the null string. In this case, (λ R ) R = (λ) R = λ as desired.
More informationCISC4090: Theory of Computation
CISC4090: Theory of Computation Chapter 2 Context-Free Languages Courtesy of Prof. Arthur G. Werschulz Fordham University Department of Computer and Information Sciences Spring, 2014 Overview In Chapter
More informationCS 341 Homework 16 Languages that Are and Are Not Context-Free
CS 341 Homework 16 Languages that Are and Are Not Context-Free 1. Show that the following languages are context-free. You can do this by writing a context free grammar or a PDA, or you can use the closure
More informationCSE 355 Test 2, Fall 2016
CSE 355 Test 2, Fall 2016 28 October 2016, 8:35-9:25 a.m., LSA 191 Last Name SAMPLE ASU ID 1357924680 First Name(s) Ima Regrading of Midterms If you believe that your grade has not been added up correctly,
More informationChapter 16: Non-Context-Free Languages
Chapter 16: Non-Context-Free Languages Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter
More informationContext Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer.
Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer. Language Generator: Context free grammars are language generators,
More informationCPS 220 Theory of Computation
CPS 22 Theory of Computation Review - Regular Languages RL - a simple class of languages that can be represented in two ways: 1 Machine description: Finite Automata are machines with a finite number of
More informationSolution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.
Section 12.4 Context-Free Language Topics Algorithm. Remove Λ-productions from grammars for langauges without Λ. 1. Find nonterminals that derive Λ. 2. For each production A w construct all productions
More informationAn automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).
Automata The term "Automata" is derived from the Greek word "αὐτόματα" which means "self-acting". An automaton (Automata in plural) is an abstract self-propelled computing device which follows a predetermined
More informationCS A Term 2009: Foundations of Computer Science. Homework 2. By Li Feng, Shweta Srivastava, and Carolina Ruiz.
CS3133 - A Term 2009: Foundations of Computer Science Prof. Carolina Ruiz Homework 2 WPI By Li Feng, Shweta Srivastava, and Carolina Ruiz Chapter 4 Problem 1: (10 Points) Exercise 4.3 Solution 1: S is
More informationNPDA, CFG equivalence
NPDA, CFG equivalence Theorem A language L is recognized by a NPDA iff L is described by a CFG. Must prove two directions: ( ) L is recognized by a NPDA implies L is described by a CFG. ( ) L is described
More informationSCHEME FOR INTERNAL ASSESSMENT TEST 3
SCHEME FOR INTERNAL ASSESSMENT TEST 3 Max Marks: 40 Subject& Code: Automata Theory & Computability (15CS54) Sem: V ISE (A & B) Note: Answer any FIVE full questions, choosing one full question from each
More informationCS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)
CS5371 Theory of Computation Lecture 7: Automata Theory V (CFG, CFL, CNF) Announcement Homework 2 will be given soon (before Tue) Due date: Oct 31 (Tue), before class Midterm: Nov 3, (Fri), first hour
More informationChapter 5: Context-Free Languages
Chapter 5: Context-Free Languages Peter Cappello Department of Computer Science University of California, Santa Barbara Santa Barbara, CA 93106 cappello@cs.ucsb.edu Please read the corresponding chapter
More informationParsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26
Parsing Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Winter 2017/18 1 / 26 Table of contents 1 Context-Free Grammars 2 Simplifying CFGs Removing useless symbols Eliminating
More informationGrammars and Context Free Languages
Grammars and Context Free Languages H. Geuvers and A. Kissinger Institute for Computing and Information Sciences Version: fall 2015 H. Geuvers & A. Kissinger Version: fall 2015 Talen en Automaten 1 / 23
More informationComputational Models - Lecture 3
Slides modified by Benny Chor, based on original slides by Maurice Herlihy, Brown University. p. 1 Computational Models - Lecture 3 Equivalence of regular expressions and regular languages (lukewarm leftover
More informationContext-Free Grammars. 2IT70 Finite Automata and Process Theory
Context-Free Grammars 2IT70 Finite Automata and Process Theory Technische Universiteit Eindhoven May 18, 2016 Generating strings language L 1 = {a n b n n > 0} ab L 1 if w L 1 then awb L 1 production rules
More informationLet P(n) be a statement about a non-negative integer n. Then the principle of mathematical induction is that P(n) follows from
1. Define automata? ANNA UNIVERSITY, CHENNAI B.E/B.Tech DEGREE EXAMINATION APR/MAY 2008 Fifth Semester Computer Science and Engineering CS1303-Theory of Computation Part-A An automaton is an abstract computing
More informationMA/CSSE 474 Theory of Computation
MA/CSSE 474 Theory of Computation Bottom-up parsing Pumping Theorem for CFLs Recap: Going One Way Lemma: Each context-free language is accepted by some PDA. Proof (by construction): The idea: Let the stack
More informationFORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
15-453 FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY Chomsky Normal Form and TURING MACHINES TUESDAY Feb 4 CHOMSKY NORMAL FORM A context-free grammar is in Chomsky normal form if every rule is of the form:
More informationCA320 - Computability & Complexity
CA320 - Computability & Complexity Dav Sinclair Context-Free Grammars A context-free grammar (CFG) is a 4-tuple G = (N,Σ,S,P) where N is a set of nonterminal symbols, or variables, Σ is a set of terminal
More informationContext-Free Grammars: Normal Forms
Context-Free Grammars: Normal Forms Seungjin Choi Department of Computer Science and Engineering Pohang University of Science and Technology 77 Cheongam-ro, Nam-gu, Pohang 37673, Korea seungjin@postech.ac.kr
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 14 SMALL REVIEW FOR FINAL SOME Y/N QUESTIONS Q1 Given Σ =, there is L over Σ Yes: = {e} and L = {e} Σ Q2 There are uncountably
More informationFLAC Context-Free Grammars
FLAC Context-Free Grammars Klaus Sutner Carnegie Mellon Universality Fall 2017 1 Generating Languages Properties of CFLs Generation vs. Recognition 3 Turing machines can be used to check membership in
More informationAutomata Theory CS F-08 Context-Free Grammars
Automata Theory CS411-2015F-08 Context-Free Grammars David Galles Department of Computer Science University of San Francisco 08-0: Context-Free Grammars Set of Terminals (Σ) Set of Non-Terminals Set of
More informationFoundations of Informatics: a Bridging Course
Foundations of Informatics: a Bridging Course Week 3: Formal Languages and Semantics Thomas Noll Lehrstuhl für Informatik 2 RWTH Aachen University noll@cs.rwth-aachen.de http://www.b-it-center.de/wob/en/view/class211_id948.html
More informationMore Properties of Regular Languages
More Properties of Regular anguages 1 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse 2 Namely, for regular languages 1 and 2 : Union 1 2 Concatenation Star
More informationFinite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove
Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove Tuesday 28 of May 2013 Total: 60 points TMV027/DIT321 registration VT13 TMV026/DIT321 registration before VT13 Exam
More informationGrammars and Context Free Languages
Grammars and Context Free Languages H. Geuvers and J. Rot Institute for Computing and Information Sciences Version: fall 2016 H. Geuvers & J. Rot Version: fall 2016 Talen en Automaten 1 / 24 Outline Grammars
More informationRecitation 4: Converting Grammars to Chomsky Normal Form, Simulation of Context Free Languages with Push-Down Automata, Semirings
Recitation 4: Converting Grammars to Chomsky Normal Form, Simulation of Context Free Languages with Push-Down Automata, Semirings 11-711: Algorithms for NLP October 10, 2014 Conversion to CNF Example grammar
More informationPushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.
Pushdown Automata We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata. Next we consider a more powerful computation model, called a
More informationLecture 11 Context-Free Languages
Lecture 11 Context-Free Languages COT 4420 Theory of Computation Chapter 5 Context-Free Languages n { a b : n n { ww } 0} R Regular Languages a *b* ( a + b) * Example 1 G = ({S}, {a, b}, S, P) Derivations:
More informationcse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska
cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska LECTURE 11 CHAPTER 3 CONTEXT-FREE LANGUAGES 1. Context Free Grammars 2. Pushdown Automata 3. Pushdown automata and context -free
More informationAC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014
Q.2 a. Show by using Mathematical Induction that n i= 1 i 2 n = ( n + 1) ( 2 n + 1) 6 b. Define language. Let = {0; 1} denote an alphabet. Enumerate five elements of the following languages: (i) Even binary
More informationMTH401A Theory of Computation. Lecture 17
MTH401A Theory of Computation Lecture 17 Chomsky Normal Form for CFG s Chomsky Normal Form for CFG s For every context free language, L, the language L {ε} has a grammar in which every production looks
More informationPlan for 2 nd half. Just when you thought it was safe. Just when you thought it was safe. Theory Hall of Fame. Chomsky Normal Form
Plan for 2 nd half Pumping Lemma for CFLs The Return of the Pumping Lemma Just when you thought it was safe Return of the Pumping Lemma Recall: With Regular Languages The Pumping Lemma showed that if a
More informationCS 133 : Automata Theory and Computability
CS 133 : Automata Theory and Computability Lecture Slides 1 Regular Languages and Finite Automata Nestine Hope S. Hernandez Algorithms and Complexity Laboratory Department of Computer Science University
More information