Multiple Context-Free Grammars

Size: px
Start display at page:

Download "Multiple Context-Free Grammars"

Transcription

1 Ogden s Lemma, Multiple Context-Free Grammars, and the Control Language Hierarchy Makoto Kanazawa National Institute of Informatics and SOKENDAI Japan Multiple Context-Free Grammars Introduced by Seki, Matsumura, Fujii, and Kasami ( ) Independently by Vijay-Shanker,Weir, and Joshi (1987) Many equivalent models Arising from concerns in computational linguistics. CFGs are almost good enough for NL grammars, but not quite; a mild extension of CFGs is needed. Several criteria were put forward as to what constitutes a mild extension. Often thought to be an adequate formalization of mildly context-sensitive grammars (Joshi 1985) Which properties of CFGs are shared by/ generalize to MCFGs?

2 Multiple Context-Free Grammars A(α1,,αq) B1(x1,1,,x1,q 1 ),,Bn(xn,1,,xn,q n ) n 0, q, qi 1, αk (Σ { xi,j i [1,n], j [1,qi] })* each xi,j occurs exactly once in (α1,,αq) It s best to think of an MCFG as a kind of logic program. Each rule is a definite clause. Nonterminals are predicates on strings. q dim(a) (dimension of A) dim(s) 1 L(G) { w Σ* G S(w) } 4 S(x1#x) D(x1, x) D(x1y1, yx) E(x1,x), D(y1,y) E(ax1ā, āxa) D(x1,x) -MCFG -ary branching { w#w R w D1* } S(aaāāaā#āaāāaa) D(aaāāaā, āaāāaa) m-mcfg MCFG with nonterminal dimension not exceeding m 1-MCFG CFG Derivation tree for w proof of S(w) E(aaāā, āāaa) D(aā, āa) D(aā, āa) E(aā, āa) E(aā, āa) 5 derivation tree S(x1 xm) A(x1,,xm) A(ε,,ε) A(a1 x1 a,,am 1 xm am) A(x1,,xm) The languages of MCFGs form an infinite hierarchy. non-branching m-mcfg m-m (m 1)-M -M { a1 n a n am 1 n am n n 0 } Seki et al M 6

3 S(aaāāaā#āaāāaa) D(aaāāaā, āaāāaa) Pumping S(x1#x) D(x1, x) D(x1y1, yx) E(x1,x), D(y1,y) E(ax1ā, āxa) D(x1,x) Derivation trees of MCFGs are similar to those of CFGs. When the same nonterminal occurs twice on the same path of a derivation tree, E(aaāā, āāaa) D(aā, āa) D(aā, āa) E(aā, āa) E(aā, āa) 7 S(y1#y) D(y1, y) D(ax1āaā, āaāxa) E(ax1ā, āxa) D(aā, āa) D(x1, x) D(aā, āa) E(aā, āa) E(aā, āa) a n aā(āaā) n #(āaā) n āaa n L(G) 8 You can decompose the derivation tree into three parts, and the middle part can be iterated any number of times, including zero times. In the overall derivation tree, the variables x 1, x, y 1, y are instantiated by The number of iterated substrings (factors) larger than two. Iterative Properties L is k-iterative iff p z L( z p u1 uk+1 v1 vk( z u1v1 ukvkuk+1 v1 vk ε n 0(u1v1 n ukvk n uk+1 L)) For MCFGs, need to consider a generalized form of the condition of the puming lemma. Not straightforward; open question for a long time. L L is -iterative L m-m L is m-iterative? 9

4 Difficulty with Pumping The middle part of the derivation tree may look like this. A(v1 x1v, v xv4 ) A(v1x1v, vxv4) A(v1x1v, vxv4) A(x1, x) A(x1, x) 10 Difficulty with Pumping Or like this. A(v1 x1vxvvv4v, v4) A(v1x1vxv, v4) A(v1x1vxv, v4) A(x1, x) uneven pump A(x1, x) 11 S(x1#x#x) A(x1, x, x) A(ax1, y1cxc dyd x, yb) A(x1, x, x), A(x1, x, x) The pumping lemma fails for - MCFGs. A(a, ε, b) m-m -M -M not k-iterative for any k Kanazawa et al M 1

5 Pumping Lemma for Subclasses Pumping possible for special cases. Well-nested MCFGs. m-mwn m-iterative m-m -Mwn 1-Mwn -M 1-M 4-iterative well-nested MCFGs Kanazawa Well-Nestedness Has a natural equivalent characterization: ycft sp { w#w R w D1* } S(x1#x) D(x1, x) D(x1y1, yx) E(x1,x), D(y1,y) { w#w w D1* } S(x1#x) D(x1, x) D(x1y1, xy) E(x1,x), D(y1,y) E(ax1ā, āxa) D(x1,x) well-nested E(ax1ā, axā) D(x1,x) non-well-nested { w#w w D1* } Mwn 14 Kanazawa and Salvati 010 Difficulty with Pumping A(v1 x1vxvvv4v, v4) Pumping not easy to prove even form well-nested MCFGs: this situation can still arise. A(v1x1vxv, v4) A(v1x1vxv, v4) A(x1, x) uneven pump A(x1, x) 15

6 S(x1x) A(x1, x) A(ax1bxc, d) A(x1, x) non-branching well-nested A(ε, ε) S(ε) S(abcd) S(aabcbdcd) S(aaabcbdcbdc,d) A(ε, ε) A(abc, d) A(ε, ε) A(aabcbdc,d) A(abc, d) A(ε, ε) A(aaabcbdcbdc,d) A(aabcbdc,d) A(abc, d) A(ε, ε) i0 i1 i i { ε } { a i 1 abc(bdc) i 1 d i 1 } A very simple example. The only choice you can make is the number of times you use the second rule. Actually -iterative, but no straightforward connection between the iterated substrings and parts of derivation trees. 16 Pumping Lemma for Subclasses m-iterative m-m m-mwn My proof of the pumping lemma for m-m wn and -M is not straightforward. -Mwn 1-Mwn -M 1-M 4-iterative Kanazawa 009, by grammar splitting and transformation What about Ogden s Lemma? 17 Ogden s Lemma for L p z L(at least p positions of z are marked u1uu v1v( z u1v1uvu (u1, v1, u each contain a marked position u, v, u each contain a marked position) v1uv contains no more than p marked positions n 0(u1v1 n uv n u L)) Ogden

7 There are various ways of generalizing Ogden s lemma suitable for MCFGs. At least this much should be implied. L has the weak Ogden property iff p z L(at least p positions of z are marked k 1 u1 uk+1 v1 vk( z u1v1 ukvkuk+1 i(vi contains a marked position) n 0(u1v1 n ukvk n uk+1 L)) 19 The Failure of Ogden s Lemma This is the first new result in this talk. m-mwn -Mwn -Mwn 1-Mwn m-iterative 6-iterative m-m -M 1-M 4-iterative The weak Ogden property fails for -Mwn and -M. 0 { a i1 b i0 $a i b i1 $a i b i $ $a in b in 1 n, i0,,in 0 } A language for which the weak Ogden property fails. -Mwn -Mwn -M 1

8 A(ε) A(bx1) A(x1) B(x1, ε) A(x1) B(ax1, bx) B(x1, x) C(x1, x, ε) B(x1, x) C(x1, ax, bx) C(x1, x, x) C(x1$x, x, ε) C(x1, x, x) D(x1$x, x) C(x1, x, x) D(x1, ax) D(x1, x) S(x1$x) D(x1, x) non-branching -MCFG A(ε) A(bx1) A(x1) B(x1, ε) A(x1) B(ax1, bx) B(x1, x) C(ε, ε) C(ax1, bx) C(x1, x) D(x1$y1x, y) B(x1, x), C(y1, y) D(x1$y1x, y) D(x1, x), C(y1, y) E(x1, x) D(x1, x, x) E(x1, ax) E(x1, x) S(x1$x) E(x1, x) -MCFG { a i1 b i0 $a i b i1 $a i b i $ $a in b in 1 n, i0,,in 0 } Mark the positions of $. { a i1 b i0 $a i b i1 $a i b i $ $a in b in 1 n, i0,,in 0 } is -iterative a$a b$a b $ $a p+1 b p Weir s (199) Control Language Hierarchy Subclasses of M that are known to have an Ogden property. Ck Ck k 1 -M Kanazawa and Salvati 007 C -Mwn C1 Generalization of Ogden s lemma Palis and Shende

9 G: Control Grammars 1: S asās : S bsb S : S ε CFG with child selection K { 1 n n n 0 } control set a a S 1 S b S b S b S b S ε ε ε 1 S ā ā S 1 S ε a S ā S b S b S ε ε ε Languages in each level of the control language hierarchy are given by control grammars. L(G, K) D* ({ a n b n n 1} b {ā,b }*)* 5 Control Language Hierarchy C1 Ck+1 { L(G, K) K Ck } 6 Ogden s Lemma for C k L Ck It is quite straightforward to prove an Ogden s lemma for C k. p z L(at least p positions of z are marked u1 uk+1 v1 vk( z u1v1 ukvkuk+1 i(ui, vi, ui+1 each contain a marked position) vk 1uk 1vk 1+1 contains no more than p marked positions n 0(u1v1 n uv n ukvk n uk+1 L)) 7 Palis and Shende 1995 k 1 gives Ogden s (1968) original lemma.

10 Proper MCFGs A(α1,,αq) Approach this existing result from the MCFG formalism. Sufficient condition for an Ogden property. dimension q αi contains xi A(x1,,xq) 8 S(x1x) A(x1, x) A(ax1c, d) B(x1) B(x1bx) A(x1, x) A(ε, ε) proper -MCFG Slight variation of an earlier example. S(aabcbdcd) A(ax1bxc,d) A(aabcbdc,d) dimension < B(x1bx) B(abcbd) B(ax1cbd) A(x1, x) A(abc, d) A(ax1c, d) dimension 1 B(b) B(x1) A(ε, ε) 9 Ogden s Lemma for m-m prop Constrain all of v 1,,v m L m-mprop p z L(at least p positions of z are marked u1 um+1 v1 vm( z u1v1 umvmum+1 i(ui, vi, ui+1 each contain a marked position) v1uv,vu4v4,,vm 1umvm together contain no more than p marked positions n 0(u1v1 n uv n umvm n um+1 L)) m 1 gives Ogden s (1968) original lemma. 0

11 C k k 1 -M prop The earlier result is subsumed by the present result. G: 1: S asās : S bsb S : S ε l(1) a, r(1) ās l() b, r() b S l() ε, r() ε homomorphisms K { 1 n n n 0 } K K(x1) E(x1) E(1x1) E(x1) E(ε) m-mcfg (1,R), l, r (K) { l(w)r(w R ) w K} homomorphic replication Kʹ(x1x) K(x1, x) K(x1l(), r()x) E(x1, x) E(l(1)x1l(), r()xr(1)) E(x1, x) E(ε, ε) 1 m-mcfg 1 S Generates strings with nonterminals. a 1 S a S b S b S b S b S ε ε ε ā S ā S ε 1 a S ā S b S b S ε ε ε l(11)r(11) aabbb Sb SāSāS l()r() ε l(1)r(1) abb SāS (1,R), l, r (K) { l(w)r(w R ) w K} Kʹ(x1x) K(x1, x) K(x1l(), r()x) E(x1, x) E(l(1)x1l(), r()xr(1)) E(x1, x) E(ε, ε) Kʹ(x1x) K(x1, x) K(x1, x) E(x1, x) E(ax1b, b SxāS) E(x1, x) E(ε, ε) a a S 1 S b S b S b S b S ε ε ε 1 S ā ā S 1 S ε a S ā S b S b S ε ε ε (1,R), l, r (K) { l(w)r(w R ) w K} L(G, K) Kʹ(x1x) K(x1, x) K(x1, x) E(x1, x) E(ax1b, b SxāS) E(x1, x) E(ε, ε) Kʹ(x1x) K(x1, x) K(x1, x) E(x1, x) E(ax1b, b yxāz) E(x1, x), Kʹ(y), Kʹ(z) E(ε, ε) S Kʹ iterated substitution Σ* The construction doubles the dimension, preserves properness. m-mcfg

12 Ck Ck k 1 -Mprop m-mprop The different requirement shows the properness of the inclusion. C -Mwn C1 -Mprop 1-Mprop p z u1v1uvuvu4v4u5 p 4 Summary Pumping doesn t imply Ogden: There is no Ogdenlike theorem for -Mwn -M There is a natural Ogden s lemma for m-mprop Covers Weir s control language hieararchy

Ogden s Lemma, Multiple Context-Free Grammars, and the Control Language Hierarchy

Ogden s Lemma, Multiple Context-Free Grammars, and the Control Language Hierarchy Ogden s Lemma, Multiple Context-Free Grammars, and the Control Language Hierarchy Makoto Kanazawa? National Institute of Informatics and SOKENDAI, 2 1 2 Hitotsubashi, Chiyoda-ku, Tokyo, 101 8430, Japan

More information

Multiple Context-free Grammars

Multiple Context-free Grammars Multiple Context-free Grammars Course 4: pumping properties Sylvain Salvati INRI Bordeaux Sud-Ouest ESSLLI 2011 The pumping Lemma for CFL Outline The pumping Lemma for CFL Weak pumping Lemma for MCFL No

More information

The word problem in Z 2 and formal language theory

The word problem in Z 2 and formal language theory The word problem in Z 2 and formal language theory Sylvain Salvati INRIA Bordeaux Sud-Ouest Topology and languages June 22-24 Outline The group language of Z 2 A similar problem in computational linguistics

More information

LCFRS Exercises and solutions

LCFRS Exercises and solutions LCFRS Exercises and solutions Laura Kallmeyer SS 2010 Question 1 1. Give a CFG for the following language: {a n b m c m d n n > 0, m 0} 2. Show that the following language is not context-free: {a 2n n

More information

Context 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. 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 information

MIX Is Not a Tree-Adjoining Language

MIX Is Not a Tree-Adjoining Language MIX Is Not a Tree-Adjoining Language Makoto Kanazawa National Institute of Informatics 2 1 2 Hitotsubashi, Chiyoda-ku Tokyo, 101 8430, Japan kanazawa@nii.ac.jp Sylvain Salvati INRIA Bordeaux Sud-Ouest,

More information

Theory of Computation - Module 3

Theory 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 information

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

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 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 information

Chapter 16: Non-Context-Free Languages

Chapter 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 information

The Pumping Lemma for Context Free Grammars

The 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 information

FLAC Context-Free Grammars

FLAC 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 information

Fundamentele Informatica II

Fundamentele Informatica II Fundamentele Informatica II Answer to selected exercises 5 John C Martin: Introduction to Languages and the Theory of Computation M.M. Bonsangue (and J. Kleijn) Fall 2011 5.1.a (q 0, ab, Z 0 ) (q 1, b,

More information

Chapter 3. Regular grammars

Chapter 3. Regular grammars Chapter 3 Regular grammars 59 3.1 Introduction Other view of the concept of language: not the formalization of the notion of effective procedure, but set of words satisfying a given set of rules Origin

More information

Context-Free Grammars and Languages. Reading: Chapter 5

Context-Free Grammars and Languages. Reading: Chapter 5 Context-Free Grammars and Languages Reading: Chapter 5 1 Context-Free Languages The class of context-free languages generalizes the class of regular languages, i.e., every regular language is a context-free

More information

Theory of Computer Science

Theory 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 information

Weak vs. Strong Finite Context and Kernel Properties

Weak vs. Strong Finite Context and Kernel Properties ISSN 1346-5597 NII Technical Report Weak vs. Strong Finite Context and Kernel Properties Makoto Kanazawa NII-2016-006E July 2016 Weak vs. Strong Finite Context and Kernel Properties Makoto Kanazawa National

More information

Computational complexity of commutative grammars

Computational complexity of commutative grammars Computational complexity of commutative grammars Jérôme Kirman Sylvain Salvati Bordeaux I University - LaBRI INRIA October 1, 2013 Free word order Some languages allow free placement of several words or

More information

Sheet 1-8 Dr. Mostafa Aref Format By : Mostafa Sayed

Sheet 1-8 Dr. Mostafa Aref Format By : Mostafa Sayed Sheet -8 Dr. Mostafa Aref Format By : Mostafa Sayed 09 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)

More information

Notes for Comp 497 (454) Week 10

Notes for Comp 497 (454) Week 10 Notes for Comp 497 (454) Week 10 Today we look at the last two chapters in Part II. Cohen presents some results concerning the two categories of language we have seen so far: Regular languages (RL). Context-free

More information

Multiple Context Free Grammars

Multiple Context Free Grammars Multiple Context Free Grammars Siddharth Krishna September 14, 2013 Abstract Multiple context-free grammars (MCFGs) are a generalization of context-free grammars that deals with tuples of strings. This

More information

Chapter 6. Properties of Regular Languages

Chapter 6. Properties of Regular Languages Chapter 6 Properties of Regular Languages Regular Sets and Languages Claim(1). The family of languages accepted by FSAs consists of precisely the regular sets over a given alphabet. Every regular set is

More information

Properties of Context-Free Languages

Properties of Context-Free Languages Properties of Context-Free Languages 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 information

Well-Nestedness Properly Subsumes Strict Derivational Minimalism

Well-Nestedness Properly Subsumes Strict Derivational Minimalism A revised version is to appear in: S. Pogodalla and J.-P. Prost (eds.), Logical Aspects of Computational Linguistics (LACL 2011), Lecture Notes in Artificial Intelligence Vol. 6736, pp. 112-128, Springer,

More information

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars formal properties Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2018 1 / 20 Normal forms (1) Hopcroft and Ullman (1979) A normal

More information

5 Context-Free Languages

5 Context-Free Languages CA320: COMPUTABILITY AND COMPLEXITY 1 5 Context-Free Languages 5.1 Context-Free Grammars Context-Free Grammars Context-free languages are specified with a context-free grammar (CFG). Formally, a CFG G

More information

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

6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs CSC4510/6510 AUTOMATA 6.1 The Pumping Lemma for CFLs 6.2 Intersections and Complements of CFLs The Pumping Lemma for Context Free Languages One way to prove AnBn is not regular is to use the pumping lemma

More information

Pushdown Automata. Reading: Chapter 6

Pushdown 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 information

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y.

Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. CSE2001, Fall 2006 1 Problem Session 5 (CFGs) Talk about the building blocks of CFGs: S 0S 1S ε - everything. S 0S0 1S1 A - waw R. S 0S0 0S1 1S0 1S1 A - xay, where x = y. S 00S1 A - xay, where x = 2 y.

More information

Automata Theory CS F-08 Context-Free Grammars

Automata 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 information

C1.1 Introduction. Theory of Computer Science. Theory of Computer Science. C1.1 Introduction. C1.2 Alphabets and Formal Languages. C1.

C1.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 information

Introduction to Theory of Computing

Introduction 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 information

EXAMPLE 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. 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 information

Computational Models - Lecture 5 1

Computational 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 information

Concordia University Department of Computer Science & Software Engineering

Concordia 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 information

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages

What Is a Language? Grammars, Languages, and Machines. Strings: the Building Blocks of Languages Do Homework 2. What Is a Language? Grammars, Languages, and Machines L Language Grammar Accepts Machine Strings: the Building Blocks of Languages An alphabet is a finite set of symbols: English alphabet:

More information

CS375: Logic and Theory of Computing

CS375: 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 information

NPDA, CFG equivalence

NPDA, 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 information

5/10/16. Grammar. Automata and Languages. Today s Topics. Grammars Definition A grammar G is defined as G = (V, T, P, S) where:

5/10/16. Grammar. Automata and Languages. Today s Topics. Grammars Definition A grammar G is defined as G = (V, T, P, S) where: Grammar Automata and Languages Grammar Prof. Mohamed Hamada oftware Engineering Lab. The University of Aizu Japan Regular Grammar Context-free Grammar Context-sensitive Grammar Left-linear Grammar right-linear

More information

CFG 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 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 information

Recitation 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 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 information

Harvard 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 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 information

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

Finite 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 information

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

Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Harvard CS 121 and CSCI E-207 Lecture 12: General Context-Free Recognition Salil Vadhan October 11, 2012 Reading: Sipser, Section 2.3 and Section 2.1 (material on Chomsky Normal Form). Pumping Lemma for

More information

CPSC 313 Introduction to Computability

CPSC 313 Introduction to Computability CPSC 313 Introduction to Computability Grammars in Chomsky Normal Form (Cont d) (Sipser, pages 109-111 (3 rd ed) and 107-109 (2 nd ed)) Renate Scheidler Fall 2018 Chomsky Normal Form A context-free grammar

More information

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

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 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 information

CS375: Logic and Theory of Computing

CS375: 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 information

Computational Models - Lecture 4 1

Computational 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 information

CS 341 Homework 16 Languages that Are and Are Not Context-Free

CS 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 information

An automaton with a finite number of states is called a Finite Automaton (FA) or Finite State Machine (FSM).

An 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 information

Context-Free Grammars and Languages

Context-Free Grammars and Languages Context-Free Grammars and Languages 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 information

TAFL 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 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 information

SFWR ENG 2FA3. Solution to the Assignment #4

SFWR 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 information

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

Homework 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 information

Context-Free and Noncontext-Free Languages

Context-Free and Noncontext-Free Languages Examples: Context-Free and Noncontext-Free Languages a*b* is regular. A n B n = {a n b n : n 0} is context-free but not regular. A n B n C n = {a n b n c n : n 0} is not context-free The Regular and the

More information

Properties of Context-free Languages. Reading: Chapter 7

Properties of Context-free Languages. Reading: Chapter 7 Properties of Context-free Languages Reading: Chapter 7 1 Topics 1) Simplifying CFGs, Normal forms 2) Pumping lemma for CFLs 3) Closure and decision properties of CFLs 2 How to simplify CFGs? 3 Three ways

More information

SCHEME FOR INTERNAL ASSESSMENT TEST 3

SCHEME 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 information

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

Notes for Comp 497 (Comp 454) Week 10 4/5/05 Notes for Comp 497 (Comp 454) Week 10 4/5/05 Today look at the last two chapters in Part II. Cohen presents some results concerning context-free languages (CFL) and regular languages (RL) also some decidability

More information

Computational Models - Lecture 4 1

Computational Models - Lecture 4 1 Computational Models - Lecture 4 1 Handout Mode Iftach Haitner. Tel Aviv University. November 21, 2016 1 Based on frames by Benny Chor, Tel Aviv University, modifying frames by Maurice Herlihy, Brown University.

More information

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

Problem 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 information

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

Finite 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 information

Properties of Context-Free Languages. Closure Properties Decision Properties

Properties of Context-Free Languages. Closure Properties Decision Properties Properties of Context-Free Languages Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms

More information

Chapter 5: Context-Free Languages

Chapter 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 information

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u,

1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u, 1. Draw a parse tree for the following derivation: S C A C C A b b b b A b b b b B b b b b a A a a b b b b a b a a b b 2. Show on your parse tree u, v, x, y, z as per the pumping theorem. 3. Prove that

More information

A short proof that O 2 is an MCFL

A short proof that O 2 is an MCFL A short proof that O 2 is an MCFL Mark-Jan Nederhof School of Computer Science University of St Andrews, UK Astract We present a new proof that O 2 is a multiple context-free language. It contrasts with

More information

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

AC68 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 information

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};

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}; 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 information

CS 373: Theory of Computation. Fall 2010

CS 373: Theory of Computation. Fall 2010 CS 373: Theory of Computation Gul Agha Mahesh Viswanathan Fall 2010 1 1 Normal Forms for CFG Normal Forms for Grammars It is typically easier to work with a context free language if given a CFG in a normal

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE 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 information

Lecture 12 Simplification of Context-Free Grammars and Normal Forms

Lecture 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 information

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 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 information

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 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 information

6.8 The Post Correspondence Problem

6.8 The Post Correspondence Problem 6.8. THE POST CORRESPONDENCE PROBLEM 423 6.8 The Post Correspondence Problem The Post correspondence problem (due to Emil Post) is another undecidable problem that turns out to be a very helpful tool for

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

(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 information

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1)

COSE212: Programming Languages. Lecture 1 Inductive Definitions (1) COSE212: Programming Languages Lecture 1 Inductive Definitions (1) Hakjoo Oh 2017 Fall Hakjoo Oh COSE212 2017 Fall, Lecture 1 September 4, 2017 1 / 9 Inductive Definitions Inductive definition (induction)

More information

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

Homework 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 information

CSE 355 Test 2, Fall 2016

CSE 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 information

Parsing beyond context-free grammar: Parsing Multiple Context-Free Grammars

Parsing beyond context-free grammar: Parsing Multiple Context-Free Grammars Parsing beyond context-free grammar: Parsing Multiple Context-Free Grammars Laura Kallmeyer, Wolfgang Maier University of Tübingen ESSLLI Course 2008 Parsing beyond CFG 1 MCFG Parsing Multiple Context-Free

More information

The View Over The Horizon

The 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 information

Computational Models - Lecture 4

Computational 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 information

Foundations of Informatics: a Bridging Course

Foundations 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 information

CSE 105 Homework 5 Due: Monday November 13, Instructions. should be on each page of the submission.

CSE 105 Homework 5 Due: Monday November 13, Instructions. should be on each page of the submission. CSE 05 Homework 5 Due: Monday November 3, 207 Instructions Upload a single file to Gradescope for each group. should be on each page of the submission. All group members names and PIDs Your assignments

More information

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4

Chomsky Normal Form and TURING MACHINES. TUESDAY Feb 4 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: A BC A a S ε B and C aren t start variables a is

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL 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 information

An Additional Observation on Strict Derivational Minimalism

An Additional Observation on Strict Derivational Minimalism 10 An Additional Observation on Strict Derivational Minimalism Jens Michaelis Abstract We answer a question which, so far, was left an open problem: does in terms of derivable string languages the type

More information

ÖVNINGSUPPGIFTER I SAMMANHANGSFRIA SPRÅK. 17 april Classrum Edition

Ö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 information

Exam: Synchronous Grammars

Exam: Synchronous Grammars Exam: ynchronous Grammars Duration: 3 hours Written documents are allowed. The numbers in front of questions are indicative of hardness or duration. ynchronous grammars consist of pairs of grammars whose

More information

CISC 4090 Theory of Computation

CISC 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 information

CISC4090: Theory of Computation

CISC4090: 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 information

Complexity of Natural Languages Mildly-context sensitivity T1 languages

Complexity of Natural Languages Mildly-context sensitivity T1 languages Complexity of Natural Languages Mildly-context sensitivity T1 languages Introduction to Formal Language Theory day 4 Wiebke Petersen & Kata Balogh Heinrich-Heine-Universität NASSLLI 2014 Petersen & Balogh

More information

V Honors Theory of Computation

V Honors Theory of Computation V22.0453-001 Honors Theory of Computation Problem Set 3 Solutions Problem 1 Solution: The class of languages recognized by these machines is the exactly the class of regular languages, thus this TM variant

More information

Miscellaneous. Closure Properties Decision Properties

Miscellaneous. Closure Properties Decision Properties Miscellaneous Closure Properties Decision Properties 1 Closure Properties of CFL s CFL s are closed under union, concatenation, and Kleene closure. Also, under reversal, homomorphisms and inverse homomorphisms.

More information

Properties of Context Free Languages

Properties of Context Free Languages 1 Properties of Context Free Languages Pallab Dasgupta, Professor, Dept. of Computer Sc & Engg 2 Theorem: CFLs are closed under concatenation If L 1 and L 2 are CFLs, then L 1 L 2 is a CFL. Proof: 1. Let

More information

Automata: a short introduction

Automata: a short introduction ILIAS, University of Luxembourg Discrete Mathematics II May 2012 What is a computer? Real computers are complicated; We abstract up to an essential model of computation; We begin with the simplest possible

More information

CS375: Logic and Theory of Computing

CS375: 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 information

Sharpening the empirical claims of generative syntax through formalization

Sharpening the empirical claims of generative syntax through formalization Sharpening the empirical claims of generative syntax through formalization Tim Hunter University of Minnesota, Twin Cities ESSLLI, August 2015 Part 1: Grammars and cognitive hypotheses What is a grammar?

More information

Parsing Linear Context-Free Rewriting Systems

Parsing Linear Context-Free Rewriting Systems Parsing Linear Context-Free Rewriting Systems Håkan Burden Dept. of Linguistics Göteborg University cl1hburd@cling.gu.se Peter Ljunglöf Dept. of Computing Science Göteborg University peb@cs.chalmers.se

More information

CS481F01 Prelim 2 Solutions

CS481F01 Prelim 2 Solutions CS481F01 Prelim 2 Solutions A. Demers 7 Nov 2001 1 (30 pts = 4 pts each part + 2 free points). For this question we use the following notation: x y means x is a prefix of y m k n means m n k For each of

More information

Linear conjunctive languages are closed under complement

Linear conjunctive languages are closed under complement Linear conjunctive languages are closed under complement Alexander Okhotin okhotin@cs.queensu.ca Technical report 2002-455 Department of Computing and Information Science, Queen s University, Kingston,

More information

Even More on Dynamic Programming

Even More on Dynamic Programming Algorithms & Models of Computation CS/ECE 374, Fall 2017 Even More on Dynamic Programming Lecture 15 Thursday, October 19, 2017 Sariel Har-Peled (UIUC) CS374 1 Fall 2017 1 / 26 Part I Longest Common Subsequence

More information

3.10. TREE DOMAINS AND GORN TREES Tree Domains and Gorn Trees

3.10. TREE DOMAINS AND GORN TREES Tree Domains and Gorn Trees 3.10. TREE DOMAINS AND GORN TREES 211 3.10 Tree Domains and Gorn Trees Derivation trees play a very important role in parsing theory and in the proof of a strong version of the pumping lemma for the context-free

More information