Indexed Languages and why you care. Presented by Pieter Hooimeijer

Similar documents
Context-Free and Noncontext-Free Languages

Automata Theory. CS F-10 Non-Context-Free Langauges Closure Properties of Context-Free Languages. David Galles

Pushdown Automata. We have seen examples of context-free languages that are not regular, and hence can not be recognized by finite automata.

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

Theory of Computation (IV) Yijia Chen Fudan University

MA/CSSE 474 Theory of Computation

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,

2.1 Solution. E T F a. E E + T T + T F + T a + T a + F a + a

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

Context-Free Languages (Pre Lecture)

Introduction to Theory of Computing

SCHEME FOR INTERNAL ASSESSMENT TEST 3

CISC4090: Theory of Computation

Section 1 (closed-book) Total points 30

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

Computational Models - Lecture 4

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

Homework 5 - Solution

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

Pushdown automata. Twan van Laarhoven. Institute for Computing and Information Sciences Intelligent Systems Radboud University Nijmegen

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

Pushdown Automata. Reading: Chapter 6

CISC 4090 Theory of Computation

THEORY OF COMPUTATION (AUBER) EXAM CRIB SHEET

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

PUSHDOWN AUTOMATA (PDA)

CA320 - Computability & Complexity

Foundations of Informatics: a Bridging Course

CISC 4090 Theory of Computation

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

Computational Models - Lecture 4 1

FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY

Computational Models - Lecture 5 1

Context-Free Languages

Harvard CS 121 and CSCI E-207 Lecture 10: Ambiguity, Pushdown Automata

Let P(n) be a statement about a non-negative integer n. Then the principle of mathematical induction is that P(n) follows from

Formal Languages, Automata and Models of Computation

Context-Free Grammars and Languages. Reading: Chapter 5

CSE 105 THEORY OF COMPUTATION

Pumping Lemma for CFLs

MA/CSSE 474 Theory of Computation

CSE 105 THEORY OF COMPUTATION

CSE 355 Test 2, Fall 2016

Introduction and Motivation. Introduction and Motivation. Introduction to Computability. Introduction and Motivation. Theory. Lecture5: Context Free

Lecture 17: Language Recognition

Solution Scoring: SD Reg exp.: a(a

AC68 FINITE AUTOMATA & FORMULA LANGUAGES DEC 2013

Theory Bridge Exam Example Questions

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

5 Context-Free Languages

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

Chapter 6. Properties of Regular Languages

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

Automata Theory CS F-08 Context-Free Grammars

The View Over The Horizon

Languages, regular languages, finite automata

Cliff s notes for equivalence of CFLs and L(PDAs) LisaCFL L = L(M) for some PDA M L=L(M)forsomePDAM L = L(G) for some CFG G

CMSC 330: Organization of Programming Languages. Pushdown Automata Parsing

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

Miscellaneous. Closure Properties Decision Properties

Context Free Languages (CFL) Language Recognizer A device that accepts valid strings. The FA are formalized types of language recognizer.

Computability and Complexity

Please give details of your answer. A direct answer without explanation is not counted.

Theory of Computation - Module 3

CS500 Homework #2 Solutions

DM17. Beregnelighed. Jacob Aae Mikkelsen

CS375 Midterm Exam Solution Set (Fall 2017)

Intro to Theory of Computation

Discrete Mathematics. CS204: Spring, Jong C. Park Computer Science Department KAIST

PS2 - Comments. University of Virginia - cs3102: Theory of Computation Spring 2010

cse303 ELEMENTS OF THE THEORY OF COMPUTATION Professor Anita Wasilewska

Context Free Languages: Decidability of a CFL

Theory of Computation

CA320 - Computability & Complexity

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

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

3130CIT Theory of Computation

CpSc 421 Final Exam December 15, 2006

CPS 220 Theory of Computation Pushdown Automata (PDA)

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

Theory of Computation (II) Yijia Chen Fudan University

CS 275 Automata and Formal Language Theory

CPS 220 Theory of Computation

Final exam study sheet for CS3719 Turing machines and decidability.

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

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

Finite Automata Theory and Formal Languages TMV026/TMV027/DIT321 Responsible: Ana Bove

Context-Free Grammars. 2IT70 Finite Automata and Process Theory

Grade 6 Math Circles October 20/21, Formalism and Languages: Beyond Regular Languages

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

Einführung in die Computerlinguistik

Theory of Computation

How to Pop a Deep PDA Matters

Pushdown Automata (Pre Lecture)

SYLLABUS. Introduction to Finite Automata, Central Concepts of Automata Theory. CHAPTER - 3 : REGULAR EXPRESSIONS AND LANGUAGES

CSE 105 THEORY OF COMPUTATION

CFGs and PDAs are Equivalent. We provide algorithms to convert a CFG to a PDA and vice versa.

Theory of Computation (Classroom Practice Booklet Solutions)

Pushdown Automata (2015/11/23)

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

Transcription:

Indexed Languages and why you care Presented by Pieter Hooimeijer 2008-02-07 1

Think Way Back... www.xkcd.com 2

...Far Enough:... CS NCF DCF REG REG 3

Formal Language Classes... CS NCF DCF REG REG PDA 4

Formal Language Classes... CS NCF PDA DCF REG REG DFA 5

Formal Language Classes... CS NCF Machines PDA Formalism S asb z DCF REG REG DFA a(ab)*b 6

Formal Language Classes... CS NCF Pump DCF REG REG Pump 7

The Context-Free Pumping Lemma Suppose L = { anbncn n = 1...} is contextfree. By the pumping lemma, any string s with s p can be 'pumped.' p 8

The Context-Free Pumping Lemma What does 'can be pumped' mean? s = uvxyz 1) vy >0 2) vxy p 3) uvixyiz is in L for all i 0 9

The Context-Free Pumping Lemma Suppose L = { anbncn n = 1...} is context-free. Consider s = apbpcp; for any split s = uvxyz, we have: - if v contains a's, then y cannot contain c's - if y contains c's, then v cannot contain a's - a problem: uv0xy0z = uxz will never be in L 10

Moving Right Along 11

Motivation Some Examples Can solve problems by phrasing them as 'language' problems: Finding valid control flow graph paths Solving set constraint problems Static string analysis Lexing, parsing For fun... 12

Example String Variables www.xkcd.com 13

The Nugget Some Code: x = 'z'; while(n < 5) { x = '('. x. ')'; n ++; } We want a context free grammar to model x Suppose we don't know anything about n 14

The Nugget Some Code: >x = 'z'; Grammar: A -> z while(n < 5) { x = '('. x. ')'; n ++; } 15

The Nugget Some Code: x = 'z'; while(n < 5) { > x = '('. x. ')'; n ++; } Grammar: A -> z B -> (A) [True] [n < 5] 16

The Nugget Some Code: x = 'z'; while(n < 5) { x = '('. x. ')'; n ++; >>} Grammar: A -> z B -> (A) C -> A B [True] [n < 5] [n < 5] 17

The Nugget Some Code: x = 'z'; while(n < 5) { x = '('. x. ')'; n ++; >>} Grammar: A -> z B -> (C) C -> A B [True] [n < 5] [True] 18

The Nugget Some Code: x = 'z'; while(n < 5) { x = '('. x. ')'; n ++; >>} Grammar: X -> C A -> z B -> (C) C -> A B [True] [n < 5] [True] 19

Indexed Languages... CS *I* NCF DCF REG REG 20

Definition: Indexed Grammar G = (N, T, F, P, S) P : { N ((NF*) T)* } F : { { N (N T)*}f } 21

Derivation Rule Example 1 S Sf S ABgC S Sf Sff Aff Bgff Cff 22

Derivation Rule Example 1 S Sf S ABgC 'normal' production: copy index stack S Sf Sff Aff Bgff Cff 23

Derivation Rule Example 2 S Af F = { { A B}f } S Af B 24

Derivation Rule Example 2 S Af F = { { A B}f } S Af B 25

Derivation Rule Example 2 S Af F = { { A B}f } 'index' production: pop leftmost index (for current nonterminal only) S Af B 26

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} 27

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} What is the language of this grammar? 28

An Example Grammar S Df D Dg ABC S g = {A Aa B Bb C Cc} f = {A a B b C c} 29

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} S Df f = {A a B b C c} 30

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} S Df Dgf f = {A a B b C c} 31

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} S Df Dgf Agf Bgf Cgf f = {A a B b C c} 32

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} S Df Dgf Agf Bgf Cgf f = {A a B b C c} 33

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} S Df Dgf Agf Bgf Afa Cgf 34

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} S Df Dgf Agf Bgf Afa a Cgf aa 35

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} S Df Dgf Agf Bgf Afa Bfb a b aa bb Cgf 36

An Example Grammar S Df D Dg ABC g = {A Aa B Bb C Cc} f = {A a B b C c} S Df Dgf Agf Bgf Cgf Afa Bfb Cfc c a b aa bb cc 37

Where am I? { anbncn n = 1...}... CS *I* NCF DCF REG REG 38

... CS *I* DCF NCF Machines PDA Formalisms S asb z Pumps REG REG DFA a(ab)*b 39

... CS *I* DCF NCF NSA PDA S asfb z S asb z? REG REG DFA a(ab)*b 40

Associated Automaton 41

Associated Automaton 42

(Actual NSA) [Gilman, Shapiro 1998] 43

But will it pump? It's complicated on derivation trees rather than strings [Hayashi 1973] Several corollaries exist [Gilman 1996] (less general; easier to use) 44

The Lemma L : indexed language m : positive integer There is a constant k > 0 so that each w in L can be split (w = w1w2...wr) subject to:

The Lemma L : indexed language m : positive integer There is a constant k > 0 so that each w in L can be split (w = w1w2...wr) subject to: m<r k each wi > 0

The Lemma L : indexed language m : positive integer There is a constant k > 0 so that each w in L can be split (w = w1w2...wr) subject to: m<r k each wi > 0 any m-sized set of wi's is a subset of some w' in L; w' is a subproduct of w

Lemma Example

Lemma Example

(Montage Time) 50

{ anbncn n = 1...} { (abn)n n = 1...}... CS *I* DCF NCF NSA PDA S asfb z S asb z? REG REG DFA a(ab)*b 51

52

References Indexed Grammars An Extension to Context-Free Grammars (Aho) Nested Stack Automata (Aho) Sequentially Indexed Grammars (van Eijck) A Shrinking Lemma for Indexed Languages (Gilman) On Groups Whose Word Problem is Solved by a Nested Stack Automaton (Gilman and Shapiro) On Derivation Trees of Indexed Grammars (Hayashi) 53