Properties of Context-Free languages Fall 2003 Costas Busch - RPI
Union Context-free languages are closed under: Union is context free Fall 2003 Costas Busch - RPI
Example Language Grammar Union Fall 2003 Costas Busch - RPI
For context-free languages with context-free grammars In general: For context-free languages with context-free grammars and start variables The grammar of the union has new start variable and additional production Fall 2003 Costas Busch - RPI
Concatenation Context-free languages are closed under: Concatenation is context free is context free is context-free Fall 2003 Costas Busch - RPI
Example Language Grammar Concatenation Fall 2003 Costas Busch - RPI
For context-free languages with context-free grammars In general: For context-free languages with context-free grammars and start variables The grammar of the concatenation has new start variable and additional production Fall 2003 Costas Busch - RPI
Star Operation Context-free languages are closed under: Star-operation is context free is context-free Fall 2003 Costas Busch - RPI
Example Language Grammar Star Operation Fall 2003 Costas Busch - RPI
For context-free language with context-free grammar and start variable In general: For context-free language with context-free grammar and start variable The grammar of the star operation has new start variable and additional production Fall 2003 Costas Busch - RPI
Negative Properties of Context-Free Languages Fall 2003 Costas Busch - RPI
Intersection Context-free languages are not closed under: intersection is context free is context free not necessarily context-free Fall 2003 Costas Busch - RPI
Example Context-free: Context-free: Intersection NOT context-free Fall 2003 Costas Busch - RPI
Complement Context-free languages are not closed under: complement is context free not necessarily context-free Fall 2003 Costas Busch - RPI
Example Context-free: Context-free: Complement NOT context-free Fall 2003 Costas Busch - RPI
Intersection of Context-free languages and Regular Languages Fall 2003 Costas Busch - RPI
a context-free language and a regular language The intersection of a context-free language and a regular language is a context-free language context free regular context-free Fall 2003 Costas Busch - RPI
Construct a new NPDA machine that accepts DFA for NPDA for regular context-free Construct a new NPDA machine that accepts simulates in parallel and Fall 2003 Costas Busch - RPI
NPDA DFA transition transition NPDA transition Fall 2003 Costas Busch - RPI
NPDA DFA transition NPDA transition Fall 2003 Costas Busch - RPI
NPDA DFA initial state initial state NPDA Initial state Fall 2003 Costas Busch - RPI
NPDA DFA final state final states NPDA final states Fall 2003 Costas Busch - RPI
Example: context-free NPDA Fall 2003 Costas Busch - RPI
regular DFA Fall 2003 Costas Busch - RPI
context-free Automaton for: NPDA Fall 2003 Costas Busch - RPI
simulates in parallel and In General: simulates in parallel and accepts string if and only if accepts string and accepts string Fall 2003 Costas Busch - RPI
Therefore: is NPDA is context-free is context-free Fall 2003 Costas Busch - RPI
Applications of Regular Closure Fall 2003 Costas Busch - RPI
a context-free language and a regular language The intersection of a context-free language and a regular language is a context-free language Regular Closure context free regular context-free Fall 2003 Costas Busch - RPI
An Application of Regular Closure Prove that: is context-free Fall 2003 Costas Busch - RPI
We know: is context-free Fall 2003 Costas Busch - RPI
We also know: is regular is regular Fall 2003 Costas Busch - RPI
context-free regular context-free is context-free (regular closure) Fall 2003 Costas Busch - RPI
Another Application of Regular Closure Prove that: is not context-free Fall 2003 Costas Busch - RPI
Impossible!!! If is context-free Then context-free regular (regular closure) Then context-free regular context-free Impossible!!! Therefore, is not context free Fall 2003 Costas Busch - RPI