I. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines

Similar documents
I. Theory of Automata II. Theory of Formal Languages III. Theory of Turing Machines

CS 275 Automata and Formal Language Theory

Regular expressions, Finite Automata, transition graphs are all the same!!

First Midterm Examination

1.4 Nonregular Languages

CS 275 Automata and Formal Language Theory

Context-Free Grammars and Languages

CS375: Logic and Theory of Computing

First Midterm Examination

Harvard University Computer Science 121 Midterm October 23, 2012

1.3 Regular Expressions

Formal Languages Simplifications of CFGs

Closure Properties of Regular Languages

Grammar. Languages. Content 5/10/16. Automata and Languages. Regular Languages. Regular Languages

Parse trees, ambiguity, and Chomsky normal form

The University of Nottingham SCHOOL OF COMPUTER SCIENCE A LEVEL 2 MODULE, SPRING SEMESTER LANGUAGES AND COMPUTATION ANSWERS

Chapter 4 Regular Grammar and Regular Sets. (Solutions / Hints)

Regular Language. Nonregular Languages The Pumping Lemma. The pumping lemma. Regular Language. The pumping lemma. Infinitely long words 3/17/15

Non-Deterministic Finite Automata. Fall 2018 Costas Busch - RPI 1

CHAPTER 1 Regular Languages. Contents

FABER Formal Languages, Automata and Models of Computation

Automata and Languages

CSC 473 Automata, Grammars & Languages 11/9/10

Chapter 2 Finite Automata

1 From NFA to regular expression

Non Deterministic Automata. Linz: Nondeterministic Finite Accepters, page 51

For convenience, we rewrite m2 s m2 = m m m ; where m is repeted m times. Since xyz = m m m nd jxyj»m, we hve tht the string y is substring of the fir

Formal languages, automata, and theory of computation

Table of contents: Lecture N Summary... 3 What does automata mean?... 3 Introduction to languages... 3 Alphabets... 3 Strings...

CS 314 Principles of Programming Languages

Chapter Five: Nondeterministic Finite Automata. Formal Language, chapter 5, slide 1

Overview HC9. Parsing: Top-Down & LL(1) Context-Free Grammars (1) Introduction. CFGs (3) Context-Free Grammars (2) Vertalerbouw HC 9: Ch.

Tutorial Automata and formal Languages

Thoery of Automata CS402

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers

5. (±±) Λ = fw j w is string of even lengthg [ 00 = f11,00g 7. (11 [ 00)± Λ = fw j w egins with either 11 or 00g 8. (0 [ ffl)1 Λ = 01 Λ [ 1 Λ 9.

Assignment 1 Automata, Languages, and Computability. 1 Finite State Automata and Regular Languages

CS 330 Formal Methods and Models Dana Richards, George Mason University, Spring 2016 Quiz Solutions

Theory of Computation Regular Languages. (NTU EE) Regular Languages Fall / 38

CS 310 (sec 20) - Winter Final Exam (solutions) SOLUTIONS

CS 330 Formal Methods and Models

Finite Automata Theory and Formal Languages TMV027/DIT321 LP4 2018

TREE AUTOMATA AND TREE GRAMMARS

The size of subsequence automaton

Exercises Chapter 1. Exercise 1.1. Let Σ be an alphabet. Prove wv = w + v for all strings w and v.

Finite Automata. Informatics 2A: Lecture 3. John Longley. 22 September School of Informatics University of Edinburgh

Theory of Computation Regular Languages

Talen en Automaten Test 1, Mon 7 th Dec, h45 17h30

THEOTY OF COMPUTATION

Normal Forms for Context-free Grammars

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

Finite Automata. Informatics 2A: Lecture 3. Mary Cryan. 21 September School of Informatics University of Edinburgh

Lecture 6 Regular Grammars

Fundamentals of Computer Science

Revision Sheet. (a) Give a regular expression for each of the following languages:

Symbolic enumeration methods for unlabelled structures

Homework 4. 0 ε 0. (00) ε 0 ε 0 (00) (11) CS 341: Foundations of Computer Science II Prof. Marvin Nakayama

CSCI 340: Computational Models. Kleene s Theorem. Department of Computer Science

Designing finite automata II

Formal Languages and Automata

Non-Deterministic Finite Automata

Speech Recognition Lecture 2: Finite Automata and Finite-State Transducers. Mehryar Mohri Courant Institute and Google Research

Coalgebra, Lecture 15: Equations for Deterministic Automata

Formal Languages and Automata Theory. D. Goswami and K. V. Krishna

CSCI 340: Computational Models. Transition Graphs. Department of Computer Science

I1 = I2 I1 = I2 + I3 I1 + I2 = I3 + I4 I 3

Recursively Enumerable and Recursive. Languages

PART 2. REGULAR LANGUAGES, GRAMMARS AND AUTOMATA

80 CHAPTER 2. DFA S, NFA S, REGULAR LANGUAGES. 2.6 Finite State Automata With Output: Transducers

a,b a 1 a 2 a 3 a,b 1 a,b a,b 2 3 a,b a,b a 2 a,b CS Determinisitic Finite Automata 1

CS 330 Formal Methods and Models

1. For each of the following theorems, give a two or three sentence sketch of how the proof goes or why it is not true.

Non-deterministic Finite Automata

4.5 JACOBI ITERATION FOR FINDING EIGENVALUES OF A REAL SYMMETRIC MATRIX. be a real symmetric matrix. ; (where we choose θ π for.

Domino Recognizability of Triangular Picture Languages

CMPSCI 250: Introduction to Computation. Lecture #31: What DFA s Can and Can t Do David Mix Barrington 9 April 2014

Let's start with an example:

Chapter 1, Part 1. Regular Languages. CSC527, Chapter 1, Part 1 c 2012 Mitsunori Ogihara 1

CS:4330 Theory of Computation Spring Regular Languages. Equivalences between Finite automata and REs. Haniel Barbosa

CS 301. Lecture 04 Regular Expressions. Stephen Checkoway. January 29, 2018

CSE : Exam 3-ANSWERS, Spring 2011 Time: 50 minutes

On Determinisation of History-Deterministic Automata.

CSC 311 Theory of Computation

Homework 3 Solutions

Convert the NFA into DFA

Ehrenfeucht-Fraïssé Games: Applications and Complexity. Department of Mathematics and Computer Science University of Udine, Italy ESSLLI 2010 CPH

1B40 Practical Skills

SWEN 224 Formal Foundations of Programming WITH ANSWERS

Formal Language and Automata Theory (CS21004)

Random subgroups of a free group

ɛ-closure, Kleene s Theorem,

Minimal DFA. minimal DFA for L starting from any other

CHAPTER 1 Regular Languages. Contents. definitions, examples, designing, regular operations. Non-deterministic Finite Automata (NFA)

Foundations of XML Types: Tree Automata

Worked out examples Finite Automata

12.1 Nondeterminism Nondeterministic Finite Automata. a a b ε. CS125 Lecture 12 Fall 2014

Preview 11/1/2017. Greedy Algorithms. Coin Change. Coin Change. Coin Change. Coin Change. Greedy algorithms. Greedy Algorithms

Non Deterministic Automata. Formal Languages and Automata - Yonsei CS 1

Farey Fractions. Rickard Fernström. U.U.D.M. Project Report 2017:24. Department of Mathematics Uppsala University

1.2. Linear Variable Coefficient Equations. y + b "! = a y + b " Remark: The case b = 0 and a non-constant can be solved with the same idea as above.

Transcription:

CI 3104 /Winter 2011: Introduction to Forml Lnguges Chpter 16: Non-Context-Free Lnguges Chpter 16: Non-Context-Free Lnguges I. Theory of utomt II. Theory of Forml Lnguges III. Theory of Turing Mchines Dr. Neji Zgui CI3104-W11 1

Chpter 16: Non-Context-Free Lnguges Theorem. Let G e context-free grmmr in Chomsky norml form. Let L e the suset of words generted y G which hve derivtions such tht ech production of the form: Nonterminl Nonterminl Nonterminl is used t most once. L is finite set of words. roof. t ech step in derivtion, nonterminl is replced y either 2 nonterminls or one terminl. Thus, if there re p productions of the form: Nonterminl Nonterminl Nonterminl word in L contins t most p+1 letters. The set of words tht contin t most p+1 letters is finite Dr. Neji Zgui CI3104-W11 2

Chpter 16: Non-Context-Free Lnguges Exmple: / Y / Y / Y Y (1) (2) (3) Y (1) (2) (3) Dr. Neji Zgui CI3104-W11 3

Chpter 16: Non-Context-Free Lnguges rnch: pth etween the root nd lef of derivtion tree Z Z Z Z Z Z the sme nonterminl twice on the sme rnch (The 2 nd is tree descendnt of the 1 st. The nonterminl is self-emedded.) C C C C two different rnches Remrk: drivtion trees re inry Dr. Neji Zgui CI3104-W11 4 C Z Z

Chpter 16: Non-Context-Free Lnguges Theorem. Let G e context-free grmmr in Chomsky norml form tht hs p productions of the form: Nonterminl Nonterminl Nonterminl. Let w e word such tht length(w) 2 p. Then in every derivtion tree for w there exists some nonterminl Z tht ppers twice on the sme rnch. Dr. Neji Zgui CI3104-W11 5

Chpter 16: Non-Context-Free Lnguges Exmple 1 st rng 2 0 nodes 2 nd rng 2 1 nodes 3 rd rng 2 2 nodes 4 th rng 2 3 nodes C Y D p=3 p+1 rows 2 p leves, mximum Y C C D Dr. Neji Zgui CI3104-W11 6

Chpter 16: Non-Context-Free Lnguges roof. tree tht hs more thn 2 p leves hs more thn p+1 rows. ( tree tht hs p+1 rows hs t most 2 p leves.) p nonterminls p+1 nonterminls 1 terminl 1 terminl Dr. Neji Zgui CI3104-W11 7

Chpter 16: Non-Context-Free Lnguges Y Y Y Y Y Y Y p=4 Y Y Y Y Y Y the rnch tht ends in hs 6 nonterminls (5 pplictions of productions contining only nonterminls) t lest one production is used more thn once Dr. Neji Zgui CI3104-W11 8

Chpter 16: Non-Context-Free Lnguges Exmple: LINDROME {Λ} /Y//// Y 2 6 = 64 1 st row 2 nd row 3 rd row 4 th row 5 th row 6 th row Dr. Neji Zgui CI3104-W11 9

Chpter 16: Non-Context-Free Lnguges Dr. Neji Zgui CI3104-W11 10

Chpter 16: Non-Context-Free Lnguges The pumping lemm (for context-free lnguges) Let G e context-free grmmr in Chomsky norml form tht hs p productions of the form: Nonterminl Nonterminl Nonterminl. Let w e word such tht length(w) 2 p. Then w cn e decomposed into 5 fctors: w = uvxyz such tht x is not t lest one of v nd y is not for ll n 1, uv n xy n z is in the lnguge generted y G. Dr. Neji Zgui CI3104-W11 11

Chpter 16: Non-Context-Free Lnguges roof. From the previous theorem, there exists non terminl tht occurs t lest twice on the sme rnch. w = uvxyz x either v, or y u Q R z v x y Dr. Neji Zgui CI3104-W11 12

Chpter 16: Non-Context-Free Lnguges Note: u, z, nd t lest one of v nd y could e. u = v = x = y = z = Dr. Neji Zgui CI3104-W11 13

Dr. Neji Zgui CI3104-W11 14 Chpter 16: Non-Context-Free Lnguges In generl: uv n xy n z R Q z u v y R Q v y x R Q z u v y R Q v y R Q v y x uvvxyyz uvvvxyyyz

Chpter 16: Non-Context-Free Lnguges lterntively: uz vy x uz uvyz uvxyz w = uvxyz x either v, or y u Q R z v x y Dr. Neji Zgui CI3104-W11 15

Chpter 16: Non-Context-Free Lnguges TRT UH UH RED O RED CCET D O n n n? O RED D Dr. Neji Zgui CI3104-W11 16