1 A Non Context-Free Language (We will prove it at the next class)

Slides:



Advertisements
Similar presentations
PDAs Accept Context-Free Languages
Advertisements

Fall 2003Costas Busch - RPI1 Properties of Context-Free languages.
Closure Properties of CFL's
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.
Courtesy Costas Busch - RPI1 Positive Properties of Context-Free languages.
1 … NPDAs continued. 2 Pushing Strings Input symbol Pop symbol Push string.
1 Positive Properties of Context-Free languages. 2 Context-free languages are closed under: Union is context free is context-free.
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.
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.
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.
Courtesy Costas Busch - RPI1 Non-regular languages.
CS5371 Theory of Computation Lecture 4: Automata Theory II (DFA = NFA, Regular Language)
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 Pushdown Automata PDAs. 2 Pushdown Automaton -- PDA Input String Stack States.
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 PDAs Accept Context-Free Languages. 2 Context-Free Languages (Grammars) Languages Accepted by PDAs Theorem:
Fall 2004COMP 3351 Regular Expressions. Fall 2004COMP 3352 Regular Expressions Regular expressions describe regular languages Example: describes the language.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2010.
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.
Cs3102: Theory of Computation Class 6: Pushdown Automata Spring 2010 University of Virginia David Evans TexPoint fonts used in EMF. Read the TexPoint manual.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 11 Midterm Exam 2 -Context-Free Languages Mälardalen University 2005.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 6 Mälardalen University 2010.
Pushdown Automata Chapters Generators vs. Recognizers For Regular Languages: –regular expressions are generators –FAs are recognizers For Context-free.
Context-Free and Noncontext-Free Languages Chapter 13 1.
Costas Busch - LSU1 Properties of Context-Free languages.
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.
1 CD5560 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2006.
Formal Languages, Automata and Models of Computation
INHERENT LIMITATIONS OF COMPUTER PROGRAMS CSci 4011.
Grammar Set of variables Set of terminal symbols Start variable Set of Production rules.
1 CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 8 Mälardalen University 2011.
1 Closure E.g., we understand number systems partly by understanding closure properties: Naturals are closed under +, , but not -, . Integers are closed.
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.
Formal Languages, Automata and Models of Computation
PDAs Accept Context-Free Languages
Properties of Regular Languages
Deterministic FA/ PDA Sequential Machine Theory Prof. K. J. Hintz
Busch Complexity Lectures: Reductions
Linear Bounded Automata LBAs
Reductions Costas Busch - LSU.
NPDAs Accept Context-Free Languages
Formal Language & Automata Theory
PDAs Accept Context-Free Languages
Chapter 7 PUSHDOWN AUTOMATA.
NPDAs Accept Context-Free Languages
Single Final State for NFA
DPDA Deterministic PDA
CSE322 PROPERTIES OF REGULAR LANGUAGES
Properties of Regular Languages
Deterministic PDAs - DPDAs
Closure Properties of Context-Free languages
Properties of Context-Free languages
DPDA Deterministic PDA
… NPDAs continued.
Chapter 1 Regular Language
Applications of Regular Closure
NFAs accept the Regular Languages
Normal Forms for Context-free Grammars
Presentation transcript:

1 A Non Context-Free Language (We will prove it at the next class)

2 Regular languages Context-free languages Non Context-free languages

3 Deterministic PDAs DPDAs

4 DPDAs Allowed:

5 Not allowed:

6 Allowed: Something must be matched from the stack

7 Not allowed:

8 DPDA example

9 The language is deterministic context-free

10 Definition: A language is deterministic context-free if some DPDA accepts it

11 Example of Non-DPDA (NPDA)

12 Not allowed in DPDAs

13 NPDAs Have More Power than DPDAs

14 We will show: there is a context-free language which is not deterministic context-free (accepted by a NPDA) (not accepted by a DPDA)

15 The language is:

16 The language is context-free Context-free grammar for : there is an NPDA that accepts

17 is not deterministic context-free Theorem: The language (there is no DPDA that accepts )

18 Proof: Assume for contradiction that is deterministic context free Therefore: there is a DPDA that accepts

19 DPDA with accepts

20 The language is not context-free (we will prove it at the next class) Fact 1:

21 The language is not context-free (we will prove later today that the union of two context-free languages is context-free) Fact 2:

22 We will construct a NPDA that accepts: Contradiction!

23 We modify Modified Replace with

24 The NPDA that accepts Modified Original

25 Since is accepted by a NPDA it is context-free Contradiction! (since is not context-free)

26 Therefore: There is no DPDA that accepts End of Proof Not deterministic context free

27 Positive Properties of Context-Free languages

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

29 Example Union LanguageGrammar

30 In general: The grammar of the union has new start variable and additional production For context-free languages with context-free grammars and start variables

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

32 Example Concatenation LanguageGrammar

33 In general: The grammar of the concatenation has new start variable and additional production For context-free languages with context-free grammars and start variables

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

35 Example Language Grammar Star Operation

36 In general: The grammar of the star operation has new start variable and additional production For context-free language with context-free grammar and start variable

37 Negative Properties of Context-Free Languages

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

39 Example Context-free: NOT context-free Intersection

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

41 NOT context-free Example Context-free: Complement

42 Intersection of Context-free languages and Regular Languages

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

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

45 transition NPDADFA transition NPDA

46 initial state NPDADFA Initial state NPDA

47 final state final states NPDADFA final states NPDA

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

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