Computational complexity of commutative grammars

Size: px
Start display at page:

Download "Computational complexity of commutative grammars"

Transcription

1 Computational complexity of commutative grammars Jérôme Kirman Sylvain Salvati Bordeaux I University - LaBRI INRIA October 1, 2013

2 Free word order Some languages allow free placement of several words or phrases: Fully non-configurational languages (Latin) Scrambling phenomenon (German) Case marking or pragmatics give information on syntactic roles Grammatically, all the possible word orders are equally valid, while the sentence s meaning and syntactic roles stay the same.

3 Scrambling in German subordinate clauses [BNR92] daß eine hiesige Firma meinem Onkel die Möbel vor drei Tagen ohne Voranmeldung zugestellt hat....that a local company to my uncle the furniture three days ago without warning has delivered....that a local company has delivered the furniture to my uncle three days ago without warning. All the possible orderings of the constituents (1,2,3,4,5) are possible Arguments of nested subordinate clauses can also be scrambled

4 Words modulo commutation There is a single sentence, which has many representations. One structure Many strings

5 Words modulo commutation There is a single sentence, which has many representations. One structure Many strings We need an object that represents a word modulo commutation of some of its letters/factors (sub-sequences) and a way to parse it

6 An algebra for words modulo commutation Words modulo commutation over an alphabet Σ will be constructed as terms of an algebra com(σ) Atomic terms are letters of the alphabet Σ and the empty word ε Terms are constructed by means of two operators: Concatenation of subterms (associative, as usual) Commutative combination of subterms (assoc + comm)

7 Terms and associated languages Ranked signature: com(σ) := {a 0 a Σ {ε 0 ; 2 ; 2

8 Terms and associated languages Ranked signature: com(σ) := {a 0 a Σ {ε 0 ; 2 ; 2 Equivalence relation for terms ( ): x y z x y z x y z x y z x y y x associativity associativity commutativity

9 Terms and associated languages Ranked signature: com(σ) := {a 0 a Σ {ε 0 ; 2 ; 2 Equivalence relation for terms ( ): x z x z y y z x y y z associativity associativity commutativity Language of a term: x L(t) := {yield(t ) t t x y y x

10 Examples of terms t 1 = a b c L(t 1 ) = {abc, acb

11 Examples of terms t 1 = t 2 = a a b c b c L(t 1 ) = {abc, acb L(t 2 ) = {abc, acb, bac, bca, cab, cba

12 Examples of terms t 1 = t 2 = t 3 = a a a b c b c ε b c L(t 1 ) = {abc, acb L(t 2 ) = {abc, acb, bac, bca, cab, cba L(t 3 ) = {abc, acb, bca, cba

13 Packed representation Using this algebra, we get objects to represent free word orders: 1 eine hiesige Firma a local company... daß... that 2 meinem Onkel to my uncle t = 3 die Möbel the furniture 4 zugestellt delivered 5 vor drei Tagen ohne Voranmeldung three days ago without warning hat has L(t) = daß zugestellt hat daß zugestellt hat daß zugestellt hat. daß zugestellt hat daß zugestellt hat. daß zugestellt hat daß zugestellt hat. daß zugestellt hat daß zugestellt hat 5! = 120 word orders

14 Towards commutative grammars t {w w L(t) sentence with free order set of representations

15 Towards commutative grammars t {w w L(t) sentence with free order set of representations Commutative grammars are defined as term grammars, with: L w (G) := L(t) t L(G)

16 Towards commutative grammars t {w w L(t) sentence with free order set of representations Commutative grammars are defined as term grammars, with: L w (G) := L(t) t L(G) L(G) = t 1 ; t 2 ;... L w (G) = L(t 1 ) L(t 2 )...

17 Commutative context-free grammars The first natural class of grammars we consider is CCFG: Regular term grammars on the terminal signature com(σ) CCFG generalize CFG (without the operator) G = N, com(σ), R, S The rules of R have the form N t, with t com(n Σ)

18 Example of CCFG G := {S, W, com({a, b, c, #), R, S S ; S ε ; W ; W ε R := S W # a b c W

19 Example of CCFG G := {S, W, com({a, b, c, #), R, S S ; S ε ; W ; W ε R := S W # a b c W L w (G) = {w 1 #... w n # n N w i a = w i b = w i c

20 Example of CCFG G := {S, W, com({a, b, c, #), R, S S ; S ε ; W ; W ε R := S W # a b c W L w (G) = {w 1 #... w n # n N w i a = w i b = w i c R = S x 1 S(x1) W (x2) ; W W (x1) x 2 # a b c x 1 S(ε) ; W (ε)

21 Commutative regular grammars CREG are a more constrained version of CCFG: Right-hand sides are restricted to right-branching terms with a single non-terminal at the end (rightmost leaf) CREG generalize right-linear (regular) word grammars A a b c B A typical CREG production

22 Commutative multiple regular grammar CMREG extend CCFG by allowing multiple terms: Productions have the form: A(t 1,..., t n ) B 1 (x 1,1,..., x 1,n1 ),..., B p (x p,1,..., x p,np ) Where t i com ( Σ { x i,j 1 i p 1 j n i ). Nonterminals are typed for consistency, with τ(s) = [o]. CMREG generalize multiple context free word grammars. A B(x 1,1, x 1,2 ) C(x 2,1, x 2,2 ) x 1,1 x 2,1 x 1,2 x 2,2 Example of a CMREG production.

23 Commutative macro grammars CMG are another generalization of CCFG: Nonterminals construct contexts (not just ground terms). Nonterminals are typed to enforce arities, with τ(s) = [o]. CMG generalize well-nested MCFGs. A x 2 x 1 [ ] B(x 1) C(x 2 ) a Example of a CMG production.

24 Commutative multiple context-free grammars CMCFG generalize the other classes: Nonterminals construct tuples of contexts. Intuitively the meet of CMG and CMREG. Nonterminals are also typed with τ(s) = [o]. x 1 A c [ ] c [ ], a x 3, b x 2 A(x 1, x 2, x 3 ) Example of a CMCFG production.

25 Outline of commutative grammar hierarchy MCFGwn CMG CMCFG CMREG MCFG CCFG CFG CREG RG Hierarchy of mildly context-sensitive commutative grammars (arrows denote inclusion)

26 Outline of commutative grammar hierarchy MCFGwn CMCFG?? CMG CMREG MCFG CCFG CFG CREG RG Hierarchy of mildly context-sensitive commutative grammars (arrows denote inclusion)

27 Two decisions problems for parsing We consider two classes of decision problems related to parsing: Universal membership problem Input A word w and a grammar G. Answer YES iff w L w (G). Membership problem for G Input A word w. Answer YES iff w L w (G). Solving both problems involves parsing w according to G; however, for membership, G is a fixed-size parameter (part of the constant).

28 Overview of results Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

29 NP-completeness of universal term membership Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

30 NP-hardness of UTM (1/2) 3-PARTproblem: Input A set S of 3m integers ( k 4 n i k ) 2 m n 1 n 2 n 3 n 4 n 5 n 6... n 3m 5 n 3m 4 n 3m 3 n 3m 2 n 3m 1 n 3m S k

31 NP-hardness of UTM (1/2) 3-PARTproblem: ( k Input A set S of 3m integers 4 n i k ) 2 Answer YES iff there is a partition S 1... S m of S that satisfies: n j = k nj Si S i m n 1 n 2 n 3 n 4 n 5 n 6... n 3m 5 n 3m 4 n 3m 3 S part. π n π(1) n π(2) n π(3) S 1 n π(4) n π(5) n π(6) S 2... n π(3m 5) n π(3m 4) n π(3m 3) S m 1 S n 3m 2 n 3m 1 n 3m n π(3m 2) n π(3m 1) n π(3m) S m k k

32 NP-hardness of UTM (2/2) t =... #... # {{ m a... a {{ n 1 a... a {{ n 2 a... a {{ n 3m 1 a... a {{ n 3m w = (a k #) m w = a. {{.. a # a. {{.. a #... a. {{.. a # k k {{ k m

33 Outline of NP algorithm for UTM To check wether w L(t): Guess a term t (s.t. t t in com(σ) by assoc/comm of ) Check that yield(t ) = w Check that t t w = acb L(t)? t : t 2 : t : c a a a b b c c b t t yield(t ) = acb acb L(t)

34 NP-completeness of universal CCFG membership Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

35 Outline of NP algorithm for CCFG Deciding wether w L w (G): Construct a compact grammar G s.t. L w (G ) = L w (G). Guess a derivation of a term t L(G ) with t w k. Check that the derivation is valid in Ptime. Check that w L(t) in NP. Why is there such a G? (t, ε) ε t (ε, t) ε t (t, ε) ε t (ε, t) ε t iff t = 1 or t = (t 1, t 2 ) Language-preserving rewriting system for terms.

36 Logcfl-completeness of CCFG membership Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

37 Notations for the CCFG algorithm Grammars are compact and in normal form: ( ) [op] A B(x) C(y) x y A(a) Derivation items are unordered vectors of NT between two positions: v, i, j (1 i, j w ) ψ(g, N) is the precomputed (semilinear) set of bags of non-terminals that N can generate in any order according to G.

38 CCFG parsing algorithm A(a) a = w[i, j] constant 1 A, i, j 1 B, i, j 1 C, j, k A(x y) B(x) C(y) combine 1 A, i, k v 1, i, j v 2, j, k 0 < v 1 0 < v 2 v 1 + v 2 w comm. combine v 1 + v 2, i, k v, i, j v ψ(g, A) comm. reduction 1 A, i, j Logcfl recognition algorithm for CCFG.

39 NP-hardness of fixed grammars beyond CCFG Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

40 Yet another reduction to 3-PART Based on 3-PART - triplets and their sum are derived in parallel.... t m a. {{.. a n 1,1 # a. {{.. a n 1,2 # a. {{.. a n 1,3 # b. {{.. b # n 1,1 +n 1,2 +n 1,3 w = a n 1 #... a n 3m #(b k #) m w = a. {{.. a #... a. {{.. a # b. {{.. b #... b. {{.. b # n 1 n 3m k {{ k m

41 NP-hard fixed CMREG x 5 S x 1 x 2 x 3 x 4 ( A, x 2, x 3, a x ( 1 A x 1,, x 3, a x ( 2 A x 1, x 2,, a x 3 A(x 1 ) S(x 2 ) ) A(x 1, x 2, x 3, x 4 ) b x 4 ) A(x 1, x 2, x 3, x 4 ) b x 4 ) A(x 1, x 2, x 3, x 4 ) b x 4 S(ε) A (#, #, #, #)

42 NP-hard fixed CMG S S(ε) x 1 # # # # x 2 A [ ] [ ] [ ] [ ] A(x 1) S(x 2 ) x 1 A [ ] [ ] A(x 1) a [ ] b [ ] x 1 A [ ] [ ] A(x 1) a [ ] b [ ] x 1 A [ ] [ ] A(x 1) a [ ] b [ ]

43 Overview of results Class Membership Universal membership ND Full Terms O(1) NP-C CREG Nlogspace NP-C CCFG Logcfl-C NP-C CMG NP-C Pspace-C Exptime CMREG NP-C Pspace-C Exptime-C CMCFG NP-C Pspace-C Exptime-C

44 Conclusion and perspectives In summary, we have provided: An algebraic representation of sentences with free order A hierarchy of generative grammars to construct such representations A study of the associated computational complexities Next we want to look into: Closure properties : rational cones, AFL,... Relation with UVG, dependency parsing,...

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

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

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

60-354, Theory of Computation Fall Asish Mukhopadhyay School of Computer Science University of Windsor

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

Einführung in die Computerlinguistik

Einführung in die Computerlinguistik Einführung in die Computerlinguistik Context-Free Grammars (CFG) Laura Kallmeyer Heinrich-Heine-Universität Düsseldorf Summer 2016 1 / 22 CFG (1) Example: Grammar G telescope : Productions: S NP VP NP

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

Context Free Grammars

Context Free Grammars Automata and Formal Languages Context Free Grammars Sipser pages 101-111 Lecture 11 Tim Sheard 1 Formal Languages 1. Context free languages provide a convenient notation for recursive description of languages.

More information

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write:

Languages. Languages. An Example Grammar. Grammars. Suppose we have an alphabet V. Then we can write: Languages A language is a set (usually infinite) of strings, also known as sentences Each string consists of a sequence of symbols taken from some alphabet An alphabet, V, is a finite set of symbols, e.g.

More information

CMPT-825 Natural Language Processing. Why are parsing algorithms important?

CMPT-825 Natural Language Processing. Why are parsing algorithms important? CMPT-825 Natural Language Processing Anoop Sarkar http://www.cs.sfu.ca/ anoop October 26, 2010 1/34 Why are parsing algorithms important? A linguistic theory is implemented in a formal system to generate

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

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

Parsing. 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 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

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

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

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

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages

Peter Wood. Department of Computer Science and Information Systems Birkbeck, University of London Automata and Formal Languages and and Department of Computer Science and Information Systems Birkbeck, University of London ptw@dcs.bbk.ac.uk Outline and Doing and analysing problems/languages computability/solvability/decidability

More information

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis

Suppose h maps number and variables to ɛ, and opening parenthesis to 0 and closing parenthesis 1 Introduction Parenthesis Matching Problem Describe the set of arithmetic expressions with correctly matched parenthesis. Arithmetic expressions with correctly matched parenthesis cannot be described

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

Movement-Generalized Minimalist Grammars

Movement-Generalized Minimalist Grammars Movet-Generalized Minimalist Grammars Thomas Graf tgraf@ucla.edu tgraf.bol.ucla.edu University of California, Los Angeles LACL 2012 July 2, 2012 Outline 1 Monadic Second-Order Logic (MSO) Talking About

More information

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis

Syntactical analysis. Syntactical analysis. Syntactical analysis. Syntactical analysis Context-free grammars Derivations Parse Trees Left-recursive grammars Top-down parsing non-recursive predictive parsers construction of parse tables Bottom-up parsing shift/reduce parsers LR parsers GLR

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

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

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

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

MA/CSSE 474 Theory of Computation

MA/CSSE 474 Theory of Computation MA/CSSE 474 Theory of Computation CFL Hierarchy CFL Decision Problems Your Questions? Previous class days' material Reading Assignments HW 12 or 13 problems Anything else I have included some slides online

More information

Formalizing Arrow s Theorem in Logics of Dependence and Independence

Formalizing Arrow s Theorem in Logics of Dependence and Independence 1/22 Formalizing Arrow s Theorem in Logics of Dependence and Independence Fan Yang Delft University of Technology Logics for Social Behaviour ETH Zürich 8-11 February, 2016 Joint work with Eric Pacuit

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

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010

CS311 Computational Structures. NP-completeness. Lecture 18. Andrew P. Black Andrew Tolmach. Thursday, 2 December 2010 CS311 Computational Structures NP-completeness Lecture 18 Andrew P. Black Andrew Tolmach 1 Some complexity classes P = Decidable in polynomial time on deterministic TM ( tractable ) NP = Decidable in polynomial

More information

A Polynomial Time Algorithm for Parsing with the Bounded Order Lambek Calculus

A Polynomial Time Algorithm for Parsing with the Bounded Order Lambek Calculus A Polynomial Time Algorithm for Parsing with the Bounded Order Lambek Calculus Timothy A. D. Fowler Department of Computer Science University of Toronto 10 King s College Rd., Toronto, ON, M5S 3G4, Canada

More information

bc7f2306 Page 1 Name:

bc7f2306 Page 1 Name: Name: Questions 1 through 4 refer to the following: Solve the given inequality and represent the solution set using set notation: 1) 3x 1 < 2(x + 4) or 7x 3 2(x + 1) Questions 5 and 6 refer to the following:

More information

Tree Automata and Rewriting

Tree Automata and Rewriting and Rewriting Ralf Treinen Université Paris Diderot UFR Informatique Laboratoire Preuves, Programmes et Systèmes treinen@pps.jussieu.fr July 23, 2010 What are? Definition Tree Automaton A tree automaton

More information

Multiple Context-Free Grammars

Multiple Context-Free Grammars 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,

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

Functions on languages:

Functions on languages: MA/CSSE 474 Final Exam Notation and Formulas page Name (turn this in with your exam) Unless specified otherwise, r,s,t,u,v,w,x,y,z are strings over alphabet Σ; while a, b, c, d are individual alphabet

More information

Context-Free Languages (Pre Lecture)

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

Context-Free Grammars (and Languages) Lecture 7

Context-Free Grammars (and Languages) Lecture 7 Context-Free Grammars (and Languages) Lecture 7 1 Today Beyond regular expressions: Context-Free Grammars (CFGs) What is a CFG? What is the language associated with a CFG? Creating CFGs. Reasoning about

More information

(NB. Pages are intended for those who need repeated study in formal languages) Length of a string. Formal languages. Substrings: Prefix, suffix.

(NB. Pages are intended for those who need repeated study in formal languages) Length of a string. Formal languages. Substrings: Prefix, suffix. (NB. Pages 22-40 are intended for those who need repeated study in formal languages) Length of a string Number of symbols in the string. Formal languages Basic concepts for symbols, strings and languages:

More information

Advances in Abstract Categorial Grammars

Advances in Abstract Categorial Grammars Advances in Abstract Categorial Grammars Language Theory and Linguistic Modeling Lecture 3 Reduction of second-order ACGs to to Datalog Extension to almost linear second-order ACGs CFG recognition/parsing

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

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

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

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

Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing. Part I. Formal Properties of TAG. Outline: Formal Properties of TAG

Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing. Part I. Formal Properties of TAG. Outline: Formal Properties of TAG Grammar formalisms Tree Adjoining Grammar: Formal Properties, Parsing Laura Kallmeyer, Timm Lichte, Wolfgang Maier Universität Tübingen Part I Formal Properties of TAG 16.05.2007 und 21.05.2007 TAG Parsing

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

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

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

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

MA/CSSE 474 Theory of Computation

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

St.MARTIN S ENGINEERING COLLEGE Dhulapally, Secunderabad

St.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 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

UNIT II REGULAR LANGUAGES

UNIT II REGULAR LANGUAGES 1 UNIT II REGULAR LANGUAGES Introduction: A regular expression is a way of describing a regular language. The various operations are closure, union and concatenation. We can also find the equivalent regular

More information

1. Groups Definitions

1. Groups Definitions 1. Groups Definitions 1 1. Groups Definitions A group is a set S of elements between which there is defined a binary operation, usually called multiplication. For the moment, the operation will be denoted

More information

Theory Bridge Exam Example Questions

Theory Bridge Exam Example Questions Theory Bridge Exam Example Questions Annotated version with some (sometimes rather sketchy) answers and notes. This is a collection of sample theory bridge exam questions. This is just to get some idea

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

Everything You Always Wanted to Know About Parsing

Everything You Always Wanted to Know About Parsing Everything You Always Wanted to Know About Parsing Part V : LR Parsing University of Padua, Italy ESSLLI, August 2013 Introduction Parsing strategies classified by the time the associated PDA commits to

More information

Efficient Parsing of Well-Nested Linear Context-Free Rewriting Systems

Efficient Parsing of Well-Nested Linear Context-Free Rewriting Systems Efficient Parsing of Well-Nested Linear Context-Free Rewriting Systems Carlos Gómez-Rodríguez 1, Marco Kuhlmann 2, and Giorgio Satta 3 1 Departamento de Computación, Universidade da Coruña, Spain, cgomezr@udc.es

More information

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA.

Outline. CS21 Decidability and Tractability. Machine view of FA. Machine view of FA. Machine view of FA. Machine view of FA. Outline CS21 Decidability and Tractability Lecture 5 January 16, 219 and Languages equivalence of NPDAs and CFGs non context-free languages January 16, 219 CS21 Lecture 5 1 January 16, 219 CS21 Lecture

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

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

Bounded and Ordered Satisfiability: Connecting Recognition with Lambek-style Calculi to Classical Satisfiability Testing

Bounded and Ordered Satisfiability: Connecting Recognition with Lambek-style Calculi to Classical Satisfiability Testing Chapter 1 Bounded and Ordered Satisfiability: Connecting Recognition with Lambek-style Calculi to Classical Satisfiability Testing MICHAIL FLOURIS, LAP CHI LAU, TSUYOSHI MORIOKA, PERIKLIS A. PAPAKONSTANTINOU,

More information

Roger Levy Probabilistic Models in the Study of Language draft, October 2,

Roger Levy Probabilistic Models in the Study of Language draft, October 2, Roger Levy Probabilistic Models in the Study of Language draft, October 2, 2012 224 Chapter 10 Probabilistic Grammars 10.1 Outline HMMs PCFGs ptsgs and ptags Highlight: Zuidema et al., 2008, CogSci; Cohn

More information

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory

Closure Properties of Context-Free Languages. Foundations of Computer Science Theory Closure Properties of Context-Free Languages Foundations of Computer Science Theory Closure Properties of CFLs CFLs are closed under: Union Concatenation Kleene closure Reversal CFLs are not closed under

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

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars

COMP-330 Theory of Computation. Fall Prof. Claude Crépeau. Lec. 10 : Context-Free Grammars COMP-330 Theory of Computation Fall 2017 -- Prof. Claude Crépeau Lec. 10 : Context-Free Grammars COMP 330 Fall 2017: Lectures Schedule 1-2. Introduction 1.5. Some basic mathematics 2-3. Deterministic finite

More information

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed

HKN CS/ECE 374 Midterm 1 Review. Nathan Bleier and Mahir Morshed HKN CS/ECE 374 Midterm 1 Review Nathan Bleier and Mahir Morshed For the most part, all about strings! String induction (to some extent) Regular languages Regular expressions (regexps) Deterministic finite

More information

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

Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). Note: In any grammar here, the meaning and usage of P (productions) is equivalent to R (rules). 1a) G = ({R, S, T}, {0,1}, P, S) where P is: S R0R R R0R1R R1R0R T T 0T ε (S generates the first 0. R generates

More information

CS481F01 Solutions 8

CS481F01 Solutions 8 CS481F01 Solutions 8 A. Demers 7 Dec 2001 1. Prob. 111 from p. 344 of the text. One of the following sets is r.e. and the other is not. Which is which? (a) { i L(M i ) contains at least 481 elements }

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, Parsing, and Factorization of Tree-Local Multi-Component Tree-Adjoining Grammar

Complexity, Parsing, and Factorization of Tree-Local Multi-Component Tree-Adjoining Grammar Complexity, Parsing, and Factorization of Tree-Local Multi-Component Tree-Adjoining Grammar Rebecca Nesson School of Engineering and Applied Sciences Harvard University Giorgio Satta Department of Information

More information

A* Search. 1 Dijkstra Shortest Path

A* Search. 1 Dijkstra Shortest Path A* Search Consider the eight puzzle. There are eight tiles numbered 1 through 8 on a 3 by three grid with nine locations so that one location is left empty. We can move by sliding a tile adjacent to 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

Final exam study sheet for CS3719 Turing machines and decidability.

Final exam study sheet for CS3719 Turing machines and decidability. Final exam study sheet for CS3719 Turing machines and decidability. A Turing machine is a finite automaton with an infinite memory (tape). Formally, a Turing machine is a 6-tuple M = (Q, Σ, Γ, δ, q 0,

More information

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

FORMAL 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

CPS 220 Theory of Computation

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

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS

Automata Theory. Lecture on Discussion Course of CS120. Runzhe SJTU ACM CLASS Automata Theory Lecture on Discussion Course of CS2 This Lecture is about Mathematical Models of Computation. Why Should I Care? - Ways of thinking. - Theory can drive practice. - Don t be an Instrumentalist.

More information

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4

Syntax Analysis Part I. Position of a Parser in the Compiler Model. The Parser. Chapter 4 1 Syntax Analysis Part I Chapter 4 COP5621 Compiler Construction Copyright Robert van ngelen, Flora State University, 2007 Position of a Parser in the Compiler Model 2 Source Program Lexical Analyzer Lexical

More information

Learning Context Free Grammars with the Syntactic Concept Lattice

Learning Context Free Grammars with the Syntactic Concept Lattice Learning Context Free Grammars with the Syntactic Concept Lattice Alexander Clark Department of Computer Science Royal Holloway, University of London alexc@cs.rhul.ac.uk ICGI, September 2010 Outline Introduction

More information

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

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars

Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Harvard CS 121 and CSCI E-207 Lecture 9: Regular Languages Wrap-Up, Context-Free Grammars Salil Vadhan October 2, 2012 Reading: Sipser, 2.1 (except Chomsky Normal Form). Algorithmic questions about regular

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

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

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

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University

Intelligent Agents. Formal Characteristics of Planning. Ute Schmid. Cognitive Systems, Applied Computer Science, Bamberg University Intelligent Agents Formal Characteristics of Planning Ute Schmid Cognitive Systems, Applied Computer Science, Bamberg University Extensions to the slides for chapter 3 of Dana Nau with contributions by

More information

Probabilistic Aspects of Computer Science: Probabilistic Automata

Probabilistic Aspects of Computer Science: Probabilistic Automata Probabilistic Aspects of Computer Science: Probabilistic Automata Serge Haddad LSV, ENS Paris-Saclay & CNRS & Inria M Jacques Herbrand Presentation 2 Properties of Stochastic Languages 3 Decidability Results

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

This lecture covers Chapter 7 of HMU: Properties of CFLs

This lecture covers Chapter 7 of HMU: Properties of CFLs This lecture covers Chapter 7 of HMU: Properties of CFLs Chomsky Normal Form Pumping Lemma for CFs Closure Properties of CFLs Decision Properties of CFLs Additional Reading: Chapter 7 of HMU. Chomsky Normal

More information

Music as a Formal Language

Music as a Formal Language Music as a Formal Language Finite-State Automata and Pd Bryan Jurish moocow@ling.uni-potsdam.de Universität Potsdam, Institut für Linguistik, Potsdam, Germany pd convention 2004 / Jurish / Music as a formal

More information

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University

Set Theory. CSE 215, Foundations of Computer Science Stony Brook University Set Theory CSE 215, Foundations of Computer Science Stony Brook University http://www.cs.stonybrook.edu/~cse215 Set theory Abstract set theory is one of the foundations of mathematical thought Most mathematical

More information

Alternating nonzero automata

Alternating nonzero automata Alternating nonzero automata Application to the satisfiability of CTL [,, P >0, P =1 ] Hugo Gimbert, joint work with Paulin Fournier LaBRI, Université de Bordeaux ANR Stoch-MC 06/07/2017 Control and verification

More information

Intro to Theory of Computation

Intro to Theory of Computation Intro to Theory of Computation LECTURE 7 Last time: Proving a language is not regular Pushdown automata (PDAs) Today: Context-free grammars (CFG) Equivalence of CFGs and PDAs Sofya Raskhodnikova 1/31/2016

More information

Automata Theory and Formal Grammars: Lecture 1

Automata Theory and Formal Grammars: Lecture 1 Automata Theory and Formal Grammars: Lecture 1 Sets, Languages, Logic Automata Theory and Formal Grammars: Lecture 1 p.1/72 Sets, Languages, Logic Today Course Overview Administrivia Sets Theory (Review?)

More information

Congruence based approaches

Congruence based approaches Congruence based approaches Learnable representations for languages Alexander Clark Department of Computer Science Royal Holloway, University of London August 00 ESSLLI, 00 Outline Distributional learning

More information

CPSC 421: Tutorial #1

CPSC 421: Tutorial #1 CPSC 421: Tutorial #1 October 14, 2016 Set Theory. 1. Let A be an arbitrary set, and let B = {x A : x / x}. That is, B contains all sets in A that do not contain themselves: For all y, ( ) y B if and only

More information

SEPARATING REGULAR LANGUAGES WITH FIRST-ORDER LOGIC

SEPARATING REGULAR LANGUAGES WITH FIRST-ORDER LOGIC Logical Methods in Computer Science Vol. 12(1:5)2016, pp. 1 30 www.lmcs-online.org Submitted Jun. 4, 2014 Published Mar. 9, 2016 SEPARATING REGULAR LANGUAGES WITH FIRST-ORDER LOGIC THOMAS PLACE AND MARC

More information

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler

Database Theory VU , SS Complexity of Query Evaluation. Reinhard Pichler Database Theory Database Theory VU 181.140, SS 2018 5. Complexity of Query Evaluation Reinhard Pichler Institut für Informationssysteme Arbeitsbereich DBAI Technische Universität Wien 17 April, 2018 Pichler

More information

Parikh s theorem. Håkan Lindqvist

Parikh s theorem. Håkan Lindqvist Parikh s theorem Håkan Lindqvist Abstract This chapter will discuss Parikh s theorem and provide a proof for it. The proof is done by induction over a set of derivation trees, and using the Parikh mappings

More information

Parsing Regular Expressions and Regular Grammars

Parsing Regular Expressions and Regular Grammars Regular Expressions and Regular Grammars Laura Heinrich-Heine-Universität Düsseldorf Sommersemester 2011 Regular Expressions (1) Let Σ be an alphabet The set of regular expressions over Σ is recursively

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

Ogden s Lemma for CFLs

Ogden s Lemma for CFLs Ogden s Lemma for CFLs Theorem If L is a context-free language, then there exists an integer l such that for any u L with at least l positions marked, u can be written as u = vwxyz such that 1 x and at

More information

Non-context-Free Languages. CS215, Lecture 5 c

Non-context-Free Languages. CS215, Lecture 5 c Non-context-Free Languages CS215, Lecture 5 c 2007 1 The Pumping Lemma Theorem. (Pumping Lemma) Let be context-free. There exists a positive integer divided into five pieces, Proof for for each, and..

More information

Grammars (part II) Prof. Dan A. Simovici UMB

Grammars (part II) Prof. Dan A. Simovici UMB rammars (part II) Prof. Dan A. Simovici UMB 1 / 1 Outline 2 / 1 Length-Increasing vs. Context-Sensitive rammars Theorem The class L 1 equals the class of length-increasing languages. 3 / 1 Length-Increasing

More information

Section 1 (closed-book) Total points 30

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