Title: Closure Properties of Context-Free languages
1Closure Propertiesof Context-Free languages
2Union
Context-free languages are closed under
Union
is context free
is context free
is context-free
3Example
Language
Grammar
Union
4In general
For context-free languages with context-free
grammars and start variables
The grammar of the union has new start
variable and additional production
5Concatenation
Context-free languages are closed under
Concatenation
is context free
is context free
is context-free
6Example
Language
Grammar
Concatenation
7In general
For context-free languages with context-free
grammars and start variables
The grammar of the concatenation has new
start variable and additional production
8Star Operation
Context-free languages are closed under
Star-operation
is context free
is context-free
9Example
Language
Grammar
Star Operation
10In 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
11Negative Propertiesof Context-Free Languages
12Intersection
Context-free languages are not closed under
intersection
is context free
is context free
not necessarily context-free
13Example
Context-free
Context-free
Intersection
NOT context-free
14Complement
Context-free languages are not closed under
complement
is context free
not necessarily context-free
15Example
Context-free
Context-free
Complement
NOT context-free
16Intersectionof Context-free languagesand
Regular Languages
17The intersection of a context-free
language and a regular language is
a context-free language
context free
regular
context-free
18Machine
Machine
for
DFA
for
NPDA
regular
context-free
Construct a new NPDA machine that accepts
simulates in parallel and
19NPDA
DFA
transition
transition
NPDA
transition
20NPDA
DFA
transition
NPDA
transition
21NPDA
DFA
initial state
initial state
NPDA
Initial state
22NPDA
DFA
final state
final states
NPDA
final states
23Example
context-free
NPDA
24regular
DFA
25context-free
Automaton for
NPDA
26In General
simulates in parallel and
accepts string
if and only if
accepts string and
accepts string
27Therefore
is NPDA
is context-free
is context-free
28Applications of Regular Closure
29The intersection of a context-free
language and a regular language is
a context-free language
Regular Closure
context free
regular
context-free
30An Application of Regular Closure
Prove that
is context-free
31We know
is context-free
32We also know
is regular
is regular
33regular
context-free
context-free
(regular closure)
is context-free
34Another Application of Regular Closure
Prove that
is not context-free
35is context-free
If
(regular closure)
Then
context-free
regular
context-free
Impossible!!!
36Decidable Propertiesof Context-Free Languages
37Membership Question
for context-free grammar find if string
38Empty Language Question
for context-free grammar find if
39Infinite Language Question
for context-free grammar find if
is infinite
40Example
Infinite language
Dependency graph
41(No Transcript)