580 likes | 669 Views
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2012.
E N D
CDT314 FABER Formal Languages, Automata and Models of Computation Lecture 9 Mälardalen University 2012
ContentLanguage HierarchyDeterministic PDAs (DPDAs)Non-DPDA (NPDA)NPDAs Have More Power than DPDAsPositive Properties of Context Free Languages Negative Properties of Context Free Languages Intersection of CFL and RL (Regular Closure)
Non-regular languages Context-Free Languages Regular Languages
Deterministic PDAs (DPDAs) Based on C Busch, RPI, Models of Computation
DPDAs Allowed
Allowed In l -transitions something must be matched from the stack
The language is deterministic context-free.
Definition A language is deterministic context-free if some DPDA accepts it.
We will show: There is a context-free language (accepted by a NPDA) which is notdeterministic context-free (not accepted by a DPDA).
The language is context-free Context-free grammar for there is an NPDA that accepts
Theorem The language is notdeterministic context-free (i.e., there is no DPDA that accepts ). (Each a is to be matched by either one or two b. An initial choice must be made.) NDPA are more expressive than DPDA.There exist languages accepted by NDPA for which no DPDAexists. Example
there is a DPDA that accepts Proof (by contradiction) Assume the opposite, i.e. that is deterministic context free. Therefore:
DPDA with accepts accepts
The language is not context-free. Fact 1 (we will prove it later on using Pumping Lemma for CFL)
Fact 2 The language is not context-free (we will prove later on that the union of two context-free languages is context-free)
This will lead to contradiction, as is not context-free! We will construct a NPDA that accepts:
Replace with Modified We modify
Modified Original The NPDA that accepts
Since is accepted by a NPDA it is context-free. Contradiction!
Therefore: There is no DPDA that accepts Notdeterministic context free. END OF PROOF
is context free is context-free is context free Union Context-free languages are closed under Union
Example Language Grammar Union
For context-free languages with context-free grammars and start variables The grammar of the union has new start variable and additional production In general:
Context-free languages are closed under Concatenation is context free is context-free is context free Concatenation
Example Language Grammar Concatenation
For context-free languages with context-free grammars and start variables The grammar of the concatenation has new start variable and additional production In general:
is context free is context free Star Operation Context-free languages are closed under star-operation
Example Language Grammar Star Operation
For context-free language with context-free grammar and start variable The grammar of the star operation has new start variable and additional production In general:
is context free is context free Intersection Context-free languages are not closed under intersection notnecessarily context-free
Example Context-free: Context-free: Intersection NOT context-free
is context free not necessarily context-free Complement Context-free languages are not closed under complement
Example Context-free: Context-free: Complement NOT context-free
Intersection of Context-Free Languagesand Regular Languages (Regular Closure)
context free regular context-free The intersection of a context-free language and a regular language is a context-free language
Machine Machine DFA for NPDA for regular context-free Construct a new NPDA machine that accepts simulates in parallel and
DFA NPDA transition transition NPDA transition
NPDA DFA initial state initial state NPDA initial state
NPDA DFA final state final states NPDA final states
simulates in parallel and accepts string if and only if accepts string and accepts string