Lecture # 31 Theory Of Automata By Dr. MM Alam 1.

Slides:



Advertisements
Similar presentations
Theory of Computation CS3102 – Spring 2014 A tale of computers, math, problem solving, life, love and tragic death Nathan Brunelle Department of Computer.
Advertisements

Closure Properties of CFL's
Nathan Brunelle Department of Computer Science University of Virginia Theory of Computation CS3102 – Spring 2014 A tale.
101 The Cocke-Kasami-Younger Algorithm An example of bottom-up parsing, for CFG in Chomsky normal form G :S  AB | BB A  CC | AB | a B  BB | CA | b C.
CS 3240: Languages and Computation Properties of Context-Free Languages.
FORMAL LANGUAGES, AUTOMATA, AND COMPUTABILITY
Theory Of Automata By Dr. MM Alam
COMMONWEALTH OF AUSTRALIA Copyright Regulations 1969 WARNING This material has been reproduced and communicated to you by or on behalf of Monash University.
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture7: The Pumping Lemma for Context Free Languages Prof. Amos Israeli.
1 Introduction to Computability Theory Lecture5: Context Free Languages Prof. Amos Israeli.
Lecture 15UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 15.
CS5371 Theory of Computation
1 Module 33 Non-context free languages –Intuition and Examples CFL Pumping Lemma –Comparison to regular language pumping lemma –What it means –Proof overview.
1 CSC 3130: Automata theory and formal languages Tutorial 4 KN Hung Office: SHB 1026 Department of Computer Science & Engineering.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
CS Master – Introduction to the Theory of Computation Jan Maluszynski - HT Lecture 4 Context-free grammars Jan Maluszynski, IDA, 2007
1 The Pumping Lemma for Context-Free Languages. 2 Take an infinite context-free language Example: Generates an infinite number of different strings.
104 Closure Properties of Regular Languages Regular languages are closed under many set operations. Let L 1 and L 2 be regular languages. (1) L 1  L 2.
1 Module 36 Non context-free languages –Examples and Intuition Pumping lemma for CFL’s –Pumping condition –No proof of pumping lemma –Applying pumping.
CS5371 Theory of Computation Lecture 9: Automata Theory VII (Pumping Lemma, Non-CFL)
Normal forms for Context-Free Grammars
Foundations of (Theoretical) Computer Science Chapter 2 Lecture Notes (Section 2.3: Non-Context-Free Languages) David Martin With.
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
1 Background Information for the Pumping Lemma for Context-Free Languages Definition: Let G = (V, T, P, S) be a CFL. If every production in P is of the.
Homework #7 Solutions. #1. Use the pumping lemma for CFL’s to show L = {a i b j a i b j | i, j > 0} is not a CFL. Proof by contradiction using the Pumping.
Today Chapter 2: (Pushdown automata) Non-CF languages CFL pumping lemma Closure properties of CFL.
FORMAL LANGUAGES, AUTOMATA AND COMPUTABILITY
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
INHERENT LIMITATIONS OF COMPUTER PROGAMS CSci 4011.
Chapter 4 Context-Free Languages Copyright © 2011 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1.
Theory Of Automata By Dr. MM Alam
Lecture 16 Oct 18 Context-Free Languages (CFL) - basic definitions Examples.
CSE 3813 Introduction to Formal Languages and Automata Chapter 8 Properties of Context-free Languages These class notes are based on material from our.
CSCI 2670 Introduction to Theory of Computing September 20, 2005.
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.
Context-Free Grammars – Chomsky Normal Form Lecture 16 Section 2.1 Wed, Sep 26, 2007.
CSCI 2670 Introduction to Theory of Computing September 21, 2004.
Context-free Languages
Lecture # 5 Pumping Lemma & Grammar
Context-Free and Noncontext-Free Languages Chapter 13 1.
Lecture 11 Theory of AUTOMATA
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Cs3102: Theory of Computation Class 8: Non-Context-Free Languages Spring 2010 University of Virginia David Evans.
Context-Free and Noncontext-Free Languages Chapter 13 1.
Closure Properties Lemma: Let A 1 and A 2 be two CF languages, then the union A 1  A 2 is context free as well. Proof: Assume that the two grammars are.
Non-CF Languages The language L = { a n b n c n | n  0 } does not appear to be context-free. Informal: A PDA can compare #a’s with #b’s. But by the time.
Pumping Lemma for CFLs. Theorem 7.17: Let G be a CFG in CNF and w a string in L(G). Suppose we have a parse tree for w. If the length of the longest path.
Grammars A grammar is a 4-tuple G = (V, T, P, S) where 1)V is a set of nonterminal symbols (also called variables or syntactic categories) 2)T is a finite.
Introduction Finite Automata accept all regular languages and only regular languages Even very simple languages are non regular (  = {a,b}): - {a n b.
CSC312 Automata Theory Lecture # 26 Chapter # 12 by Cohen Context Free Grammars.
Chapter 8 Properties of Context-free Languages These class notes are based on material from our textbook, An Introduction to Formal Languages and Automata,
Transparency No. P2C5-1 Formal Language and Automata Theory Part II Chapter 5 The Pumping Lemma and Closure properties for Context-free Languages.
Transparency No. 1 Formal Language and Automata Theory Homework 5.
Chomsky Normal Form.
CS 461 – Oct. 5 Pumping lemma #2 –Understanding –Use to show a language is not a CFL Next: Applications of CFLs –Expression grammars and Compiling.
Theory Of Automata By Dr. MM Alam
Complexity and Computability Theory I Lecture #12 Instructor: Rina Zviel-Girshin Lea Epstein.
Context-Free and Noncontext-Free Languages Chapter 13.
Theory Of Automata By Dr. MM Alam
Lecture 22 Pumping Lemma for Context Free Languages
Theory Of Automata By Dr. MM Alam
FORMAL LANGUAGES AND AUTOMATA THEORY
Definition: Let G = (V, T, P, S) be a CFL
Properties of Context-Free Languages
Midterm #2 — Review problems
Recap lecture 42 Row language, nonterminals defined from summary table, productions defined by rows, rules for defining productions, all possible productions.
Recap lecture 25 Intersection of two regular languages is regular, examples, non regular languages, example.
The Cocke-Kasami-Younger Algorithm
Presentation transcript:

Lecture # 31 Theory Of Automata By Dr. MM Alam 1

Lecture 30 at a glance… Using JFLAP for PDA PDA Conversion to CFG Chomsky Normal Form Conversion in JFLAP 2

What are Non-Context-Free languages All languages are not CFL. Languages which are not Context-Free, are called Non-CFL. This chapter is about proving that all languages are not Context-Free We will also use the Pumping Lemma with and without JFLAP for the proof of the aforementioned fact. 3

Live Production VS Dead Production Definition A production of the form nonterminal  string of two nonterminals is called a live production. A production of the form nonterminal  terminal is called a dead production. Please keep in mind that every CFG in CNF has only aforementioned types of productions. – Guess what, are the rules of CNF? 4

Live Productions Example Thanks to Daniel I Cohen. The above excerpts have been taken from his Book: Automata Theory, Chapter Non Context Free Languages. 5

Finite many words can be generated if a CFG is in CNF and if there is restriction to use the live production at most once each. It may be noted that every time a live production is applied during the derivation of a word it increases the number of non- terminals by one, similarly, dead productions are applied, it decreases the number of non- terminals by one. 6

Self Embedded Nonterminal A nonterminal is said to be self-embedded, if in a given derivation of a word, it ever occurs as a tree descendant of itself 7

Theorem (33) Statement: If a CFG is in CNF with p live and q dead productions and if w is a word generated by the CFG, having more than 2 p letters then any derivation tree for w has a nonterminal z which is used twice, where the second z is the descended from the first z. 8

The nonterminal X is self-embedded 9

Example Grammar: 10

11

Consider the following CFG in CNF and the derivation tree of the word bbabbb 12

13

S A B B C A B B C A B b b b b a b Non-terminal A is self embedded Look at the triangle – upper one and lower one identified in the lower. Guess what – Pumping Lemma for CFG in CNF? 14

Pumping lemma for CFL in CNF If G is any CFG in CNF with p live productions, then every word w of length more than 2 p, then we can break substrings as w=uvxyz, where x is not null string and v and y are both not null string. Thus, all the words of the form uv n xy n z, n=1,2,3,… can also be generated by G. 15

Pumping Lemma Example Consider the following CFG in CNF: S  PQ Q  QS|b P  a we derive the word abab as follows: 16

S P Q Q S P Q b a b a y u x Pumping Lemma for CFG Example w=uvxyz where u=a, v= ʎ, x=b, y=ab, z= ʎ Left most is u, within the triangle, the left most is x and remaining part is y, since the v part can also be null. 17

S P S P Q a u Q S Q S P Q x y y b a b a b uvvxyyz=a ʎ ʎ babab ʎ =ababab belongs to the language generated by the given CFG. uv n xy n z, n=1,2,3,… belong to the language generated by the given CFG. 18

Example Consider the language L={a n b n c n :n=1,2,3,…}, let the language L be Context Free language Let the word w=a 200 b 200 c 200 of length more than 2 p, where p is the number of live productions of its CFG in CNF. Please follow the observations given on the next slide: 19

Only one substring ab Only one substring bc No substring ac No substring ba No substring ca No substring cb For any n=1,2,3,… Observations: Substrings u,v,x,y and z. uv 2 xy 2 z can’t belong to L, as all the words in a n b n c n have: Think on a 3 b 3 c 3 It may be noted that the pumping lemma is satisfied by all CFLs and the languages which don’t hold this pumping lemma, can’t be Context Free languages. Such languages are non-CFLs. Following are the examples of non- CFL. 20

“If w is a large enough word (2 P ) in a CF: then, w can be decomposed into w=uvxyz such that all words of the form uv n xy n z belong to L” 21

JFLAP For Non Context Free Languages Pumping Lemma in JFLAP How to list cases Playing game – You go first – Computer go first 22

Lecture 31 Summary Non Context Free Languages How to determine Non Context Free languages Pumping Lemma for Non Context Free Languages JFLAP For Pumping Lemma for Non Context Free Languages 23