Homework #7. True False. d. Given a CFG, G, and a string w, it is decidable whether w ε L(G) True False

Similar documents
Lecture 12 Simplification of Context-Free Grammars and Normal Forms

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules).

Plan 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

CS453 Intro and PA1 1

Einführung in die Computerlinguistik

Parsing. Context-Free Grammars (CFG) Laura Kallmeyer. Winter 2017/18. Heinrich-Heine-Universität Düsseldorf 1 / 26

CFG Simplification. (simplify) 1. Eliminate useless symbols 2. Eliminate -productions 3. Eliminate unit productions

Context Free Languages: Decidability of a CFL

READING STATECHART DIAGRAMS

CONSTRUCTING STATECHART DIAGRAMS

CS375: Logic and Theory of Computing

Einführung in die Computerlinguistik Kontextfreie Grammatiken - Formale Eigenschaften

Simplification 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

CHAPTER 3 INEQUALITIES. Copyright -The Institute of Chartered Accountants of India

Properties of Context-Free Languages. Closure Properties Decision Properties

Differentiation Applications 1: Related Rates

CHM112 Lab Graphing with Excel Grading Rubric

Experiment #3. Graphing with Excel

Context-Free Grammar

AC68 FINITE AUTOMATA & FORMULA LANGUAGES JUNE 2014

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Chapter Summary. Mathematical Induction Strong Induction Recursive Definitions Structural Induction Recursive Algorithms

CHAPTER Read Chapter 17, sections 1,2,3. End of Chapter problems: 25

Finite Automata and Formal Languages TMV026/DIT321 LP Useful, Useless, Generating and Reachable Symbols

Before We Start. The Pumping Lemma. Languages. Context Free Languages. Plan for today. Now our picture looks like. Any questions?

CS 373: Theory of Computation. Fall 2010

Properties of Context-Free Languages

Problem 2.6(d) [4 pts] Problem 2.12 [3pts] Original CFG:

Properties of Context-free Languages. Reading: Chapter 7

Section 1 (closed-book) Total points 30

The Pumping Lemma for Context Free Grammars

Part 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

Theory of Computation - Module 3

Harvard CS 121 and CSCI E-207 Lecture 10: CFLs: PDAs, Closure Properties, and Non-CFLs

CHAPTER 24: INFERENCE IN REGRESSION. Chapter 24: Make inferences about the population from which the sample data came.

Context Free Grammars: Introduction. Context Free Grammars: Simplifying CFGs

Context-Free Grammars: Normal Forms

Revisiting the Socrates Example

Dataflow Analysis and Abstract Interpretation

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs

NPDA, CFG equivalence

Context-Free Languages (Pre Lecture)

Intro to Theory of Computation

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition

Ogden s Lemma for CFLs

Chapter 3 Kinematics in Two Dimensions; Vectors

LEARNING : At the end of the lesson, students should be able to: OUTCOMES a) state trigonometric ratios of sin,cos, tan, cosec, sec and cot

Computational Models - Lecture 5 1

Hiding in plain sight

THE LIFE OF AN OBJECT IT SYSTEMS

Notes for Comp 497 (454) Week 10

Definition: A grammar G = (V, T, P,S) is a context free grammar (cfg) if all productions in P have the form A x where

(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},

Notes for Comp 497 (Comp 454) Week 10 4/5/05

MTH401A Theory of Computation. Lecture 17

CSE 355 Test 2, Fall 2016

Turing Machines. Human-aware Robotics. 2017/10/17 & 19 Chapter 3.2 & 3.3 in Sipser Ø Announcement:

Unit 11 Solutions- Guided Notes. What are alloys? What is the difference between heterogeneous and homogeneous mixtures?

Preparation work for A2 Mathematics [2017]

Cambridge Assessment International Education Cambridge Ordinary Level. Published

Medium Scale Integrated (MSI) devices [Sections 2.9 and 2.10]

Administrativia. Assignment 1 due thursday 9/23/2004 BEFORE midnight. Midterm exam 10/07/2003 in class. CS 460, Sessions 8-9 1

CS 477/677 Analysis of Algorithms Fall 2007 Dr. George Bebis Course Project Due Date: 11/29/2007

Context Free Grammars

TAFL 1 (ECS-403) Unit- III. 3.1 Definition of CFG (Context Free Grammar) and problems. 3.2 Derivation. 3.3 Ambiguity in Grammar

MOCK CBSE BOARD EXAM MATHEMATICS. CLASS X (Paper 1) (AS PER THE GUIDELINES OF CBSE)

ANSWER KEY FOR MATH 10 SAMPLE EXAMINATION. Instructions: If asked to label the axes please use real world (contextual) labels

CS5371 Theory of Computation. Lecture 7: Automata Theory V (CFG, CFL, CNF)

Chapter 2 GAUSS LAW Recommended Problems:

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

Chap. 7 Properties of Context-free Languages

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.

Department of Economics, University of California, Davis Ecn 200C Micro Theory Professor Giacomo Bonanno. Insurance Markets

Introduction to Formal Languages, Automata and Computability p.1/42

This lecture covers Chapter 7 of HMU: Properties of CFLs

Solution. S ABc Ab c Bc Ac b A ABa Ba Aa a B Bbc bc.

Homework 4. Chapter 7. CS A Term 2009: Foundations of Computer Science. By Li Feng, Shweta Srivastava, and Carolina Ruiz

Homework 4 Solutions. 2. Find context-free grammars for the language L = {a n b m c k : k n + m}. (with n 0,

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL, DPDA PDA)

A B C. 2. Some genes are not regulated by gene switches. These genes are expressed constantly. What kinds of genes would be expressed constantly?

Revision: August 19, E Main Suite D Pullman, WA (509) Voice and Fax

Computability and Complexity

CS5371 Theory of Computation. Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)

Section 6-2: Simplex Method: Maximization with Problem Constraints of the Form ~

Fields and Waves I. Lecture 3

Fundamental Concepts in Structural Plasticity

This section is primarily focused on tools to aid us in finding roots/zeros/ -intercepts of polynomials. Essentially, our focus turns to solving.

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Examples: 1. How much heat is given off by a 50.0 g sample of copper when it cools from 80.0 to 50.0 C?

AP Statistics Practice Test Unit Three Exploring Relationships Between Variables. Name Period Date

4 electron domains: 3 bonding and 1 non-bonding. 2 electron domains: 2 bonding and 0 non-bonding. 3 electron domains: 2 bonding and 1 non-bonding

MA/CSSE 474 Theory of Computation

Cop yri ht 2006, Barr Mabillard.

Pushdown Automata. Notes on Automata and Theory of Computation. Chia-Ping Chen

Chapter 5: Context-Free Languages

Properties of context-free Languages

We can see from the graph above that the intersection is, i.e., [ ).

Context Free Grammars: Introduction

Transcription:

Hmewrk #7 #1. True/ False a. The Pumping Lemma fr CFL s can be used t shw a language is cntext-free b. The string z = a k b k+1 c k can be used t shw {a n b n c n } is nt cntext free c. The string z = a k a k a k can be used t shw {w w R w w ε {a,b}* } is nt cntextfree d. Given a CFG, G, a string w, it is decidable whether w ε L(G) e. The intersectin f a cntext-free language a regular language is cntext-free #2. Why must we remve the recursive Start t cnvert t Chmsky Nrmal frm? If S ccurs n the right h side, S λ is a prductin, then S can ccur in the middle f a derivatin essentially shrten a sentential frm. We dn t want this because we want a relatinship between the length f the derivatin the length f the string generated. #3. What is the relatinship between the length f a string the length f its derivatin if the grammar is in Greibach nrmal Frm? If there are n lambda prductins, each prductin prduces exactly 1 terminal, s the derivatin is the same as the string length in this case. #4. Cnvert the fllwing grammar t Chmsky Nrmal Frm. Shw wrk clearly. Slutin Remve Recursive Start:

Remve λ Prductins: A is nullable, but the thers are nt (n prductin has an A n its rhs). New grammar: S S A B DD BCB D B AB B C Remve unit rules: S asb BB BCD ab BC A AB Cc c DD BCB Scc cc B AB Cc c Remve useless: Term = {D, C, A, S, S } s all useful s far Reach = {S, S, B, C, D, A} s all useful: S asb BB BCD ab BC A AB Cc c DD BCB Scc cc B AB Cc c

Cnvert t CNF (lts f ways t d this) S AT 1 BB B T 3 A T 2 BC A a T 1 S T 2 T 2 b T 3 CD A AB CT4 c DD BT 6 Scc cc S AT 1 BB B T 3 A T 2 BC B AB CT 4 c T 4 c D S T 5 T 4 T 4 T 5 T 4 T 4 T 6 CB #5. Shw the fllwing languages are r are nt cntext-free: a) {a i b j c m i j m} Many f yu tld me this was nt cntext-free. I think yu gt caught in what i j m means. Nte that when i = 2, j = 3, m = 2, i j m. ( is nt transitive). Here is a grammar: In what fllws: A generates 0 r mre a s B generates 0 r mre b s C generates 0 r mre c s E first generates an equal number f b s c s then 1 r mre b s (via B) r 1 r mre c s (via cc). S E b*c* (#b #c) Similarly D a*b* (#a #b) It is cntext-free: S A E D C A a A λ B b B b C c C λ D a D b B a A E b E c B cc S A E a A E a a A E a a E a a b E c a a b b E c c aabbbcc etc. b) {a i b j c m i < j < m; i,j,k > 0}

Nt cntext free: Let n be the integer frm the CFL pumping lemma Chse x = a n b n+1 c n+2 Cnsider all strings u, v, w, y, z such that x = uvwyz vwy <= n vy >= 1 There are five pssible cases fr strings v y v y cntain at least 1 a 0 b's c's v y cntain at least 1 a 1 b 0 c's v y cntain at least 1 b 0 a's c's v y cntain at least 1 b 1 c 0 a's v y cntain at least 1 c 0 a's b's In summary, v y cannt cntain bth a's c's. This fllws frm the fact that vwy <= n v y must cntain at least ne character This fllws frm the fact that vy >= 1 We will shw fr each case that there exists a k such that uv k wy k z is nt in L Case 1: v y cntain at least 1 a 0 b's c's Chse k=2 uv 2 wy 2 z is nt in L uv 2 wy 2 z cntains exactly n+1 b's exactly n+1 b's v y cntain 0 b's uv 2 wy 2 z cntains at least n+1 a's This fllws frm uvwyz cntains exactly n a's v y cntain at least 1 a Case 2: v y cntain at least 1 a b 0 c's Chse k=2 uv 2 wy 2 z is nt in L uv 2 wy 2 z cntains exactly n+2 c's exactly n+2 c's v y cntain 0 c's uv 2 wy 2 z cntains at least n+2 b's This fllws frm uvwyz cntains exactly n+1 b's v y cntain at least 1 b Case 3: v y cntain 0 a's c's at least 1 b Chse k=2 Culd chse k=0 as well

uv 2 wy 2 z is nt in L uv 2 wy 2 z cntains exactly n+2 c's exactly n+2 c's v y cntain 0 c's uv 2 wy 2 z cntains at least n+2 b's This fllws frm uvwyz cntains exactly n+1 b's v y cntain at least 1 b Case 4: v y cntain 0 a's at least 1 b 1 c Chse k=0 uwz is nt in L uwz cntains exactly n a's exactly n a's v y cntain 0 a's uwz cntains at mst n b's This fllws frm uvwyz cntains exactly n+1 b's v y cntain at least ne b Case 5: v y cntain 0 a's b's at least 1 c Chse k=0 uwz is nt in L uwz cntains exactly n+1 b's exactly n+1 b's v y cntain 0 b's uwz cntains at mst n+1 c's This fllws frm uvwyz cntains exactly n+2 c's v y cntain at least 1 c In all cases, we have shwn that there exists a chice f k such that uv k wy k z is nt in L. Thus L des nt satisfy the pumping cnditin. Thus L is nt a cntext-free language.