1 Positive Properties of Context-Free languages. 2 Context-free languages are closed under: Union is context free is context-free.

Slides:



Advertisements
Similar presentations
PDAs Accept Context-Free Languages
Advertisements

6.2 Closure Properties of CFL's
Fall 2003Costas Busch - RPI1 Properties of Context-Free languages.
Properties of Regular Languages
1 Introduction to Computability Theory Lecture12: Decidable Languages Prof. Amos Israeli.
Lecture 3UofH - COSC Dr. Verma 1 COSC 3340: Introduction to Theory of Computation University of Houston Dr. Verma Lecture 3.
Prof. Busch - LSU1 Properties of Context-Free languages.
Costas Busch - RPI1 Single Final State for NFAs. Costas Busch - RPI2 Any NFA can be converted to an equivalent NFA with a single final state.
Fall 2006Costas Busch - RPI1 Regular Expressions.
Courtesy Costas Busch - RPI1 Positive Properties of Context-Free languages.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
1 More Properties of Regular Languages. 2 We have proven Regular languages are closed under: Union Concatenation Star operation Reverse.
1 Regular Expressions. 2 Regular expressions describe regular languages Example: describes the language.
Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
Courtesy Costas Busch - RPI1 NPDAs Accept Context-Free Languages.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Rules have form String of variables and terminals String of variables and terminals.
1 Converting NPDAs to Context-Free Grammars. 2 For any NPDA we will construct a context-free grammar with.
1 Normal Forms for Context-free Grammars. 2 Chomsky Normal Form All productions have form: variable and terminal.
Fall 2004COMP 3351 Single Final State for NFA. Fall 2004COMP 3352 Any NFA can be converted to an equivalent NFA with a single final state.
Fall 2004COMP 3351 NPDA’s Accept Context-Free Languages.
Costas Busch - RPI1 Positive Properties of Context-Free languages.
Fall 2003Costas Busch - RPI1 Decidable Problems of Regular Languages.
1 Single Final State for NFAs and DFAs. 2 Observation Any Finite Automaton (NFA or DFA) can be converted to an equivalent NFA with a single final state.
1 NFAs accept the Regular Languages. 2 Equivalence of Machines Definition: Machine is equivalent to machine if.
Fall 2006Costas Busch - RPI1 Properties of Regular Languages.
Prof. Busch - RPI1 Decidable Problems of Regular Languages.
1 Applications of Regular Closure. 2 The intersection of a context-free language and a regular language is a context-free language context free regular.
1 A Single Final State for Finite Accepters. 2 Observation Any Finite Accepter (NFA or DFA) can be converted to an equivalent NFA with a single final.
1 A Non Context-Free Language (We will prove it at the next class)
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 5 School of Innovation, Design and Engineering Mälardalen University 2012.
1 Let L= { w= u v : u  {a, b}*, v  {c, d}* and |u|= |v|} 1.Design a context-free grammar that generates L. 2.Use your grammar and the construction from.
TK PrasadPumping Lemma1 Nonregularity Proofs. TK PrasadPumping Lemma2 Grand Unification Regular Languages: Grand Unification (Parallel Simulation) (Rabin.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
Regular Expressions Costas Busch - LSU.
Costas Busch - LSU1 Properties of Context-Free languages.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2006.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
1 The Chomsky Hierarchy. 2 Unrestricted Grammars: Productions String of variables and terminals String of variables and terminals.
CS 154 Formal Languages and Computability March 17 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
1 Use the pumping theorem for context-free languages to prove that L= { a n b a n b a p : n, p ≥ 0, p ≥ n } is not context-free. Hint: For the pumping.
Standard Representations of Regular Languages
Properties of Context-Free Languages
Properties of Regular Languages
PROPERTIES OF REGULAR LANGUAGES
Linear Bounded Automata LBAs
NPDAs Accept Context-Free Languages
Formal Language & Automata Theory
PDAs Accept Context-Free Languages
NPDAs Accept Context-Free Languages
Single Final State for NFA
CSE 105 theory of computation
Decision Properties of Regular Languages
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
COSC 3340: Introduction to Theory of Computation
CSE322 CONSTRUCTION OF FINITE AUTOMATA EQUIVALENT TO REGULAR EXPRESSION Lecture #9.
4. Properties of Regular Languages
Deterministic PDAs - DPDAs
Closure Properties of Context-Free languages
Decidable Problems of Regular Languages
Properties of Context-Free languages
… NPDAs continued.
Applications of Regular Closure
CSE 105 theory of computation
NFAs accept the Regular Languages
Normal Forms for Context-free Grammars
CSE 105 theory of computation
Presentation transcript:

1 Positive Properties of Context-Free languages

2 Context-free languages are closed under: Union is context free is context-free

3 Union Example: Union grammar:

4 In general: Take any two context-free grammars with start variables The union grammar has start variable and is context-free

5 Context-free languages are closed under: Concatenation is context free is context-free

6 Concatenation Example: Concatenation grammar:

7 In general: Take any two context-free grammars with start variables The concatenation grammar has start variable and is context-free

8 Context-free languages are closed under: Star-operation is context freeis context-free

9 Star operation Example: Star grammar:

10 In general: Take any context-free grammars with start variable The concatenation grammar has start variable and is context-free

11 Negative Properties of Context-Free Languages

12 Context-free languages are not closed under: intersection is context free not necessarily context-free

13 Counter Example: Context-free: NOT context-free

14 Context-free languages are not closed under: complement is context freenot necessarily context-free

15 Counter Example: Context-free: NOT context-free

16 Intersection of Context-free languages and Regular Languages

17 The intersection of a context-free language and a regular language is a context-free language context free regular context-free

18 for NPDA DFA Construct a new NPDA machine that accepts Machine context-free regular simulates in parallel and

19 transition NPDADFA transition NPDA

20 initial state NPDADFA Initial state NPDA

21 final state final states NPDADFA final states NPDA

22 simulates in parallel and accepts stringif and only if accepts string and accepts string

23 Therefore: (since is NPDA) is context-free

24 Example Applications of Regular Closure Prove that: is context-free

25 We know: is context-free

26 is regular We also know:

27 is regular is context-free

28 Another application Prove that: is not context-free

29 context-free regularIs context-free If is context-free Then Impossible!!! Therefore, is not context free

30 Decidable Properties of Context-Free Languages

31 Membership Question: for grammar find if string

32 Membership Question: for grammar find if string Membership Algorithms: Parsers Exhaustive search parser CYKparsing algorithm

33 Empty Language Question: for grammar find if

34 Empty Language Question: for grammar find if Algorithm: Check if start variable is useless Remove useless variables

35 Infinite Language Question: for grammar find if is infinite

36 Infinite Language Question: for grammar find if is infinite Algorithm: Remove useless variables Remove unit and lambda productions Create the dependency graph for variables If there is a loop in the dependency graph the language is infinite

37 Example: Dependency graph infinite

38