Lecture 13-15
Lecture 13-15
(CS F351)
BITS Dr. Raghunath
CS&IS Dept.
Pilani
Hyderabad Campus
is context-free
is context-free
Closure properties of CFLs
Theorem: Let be a context-free language then is also
context-free.
ID :
Proof:
Let be a CFG such that
Let be the maximum number of symbols in the right-hand side of
a rule / production in .
If the height of the parse tree is at most then the length of the
string generated is at most .
Pumping Lemma for CFLs (cont..)
Conversely, if a generated string is at least long, each of its parse trees
must be at least high.
Set .
If its parse tree must be at least high, because .
Let be the parse tree of that has the small number of nodes.
The height of is at least .
So, it must contain a path from the root to a leaf of length at
least .
That path has at least nodes; one at a terminal (leaf node) and
variables.
Some variable appears more than once on the path.
Pumping Lemma for CFLs (cont..)
Condition 1:
Condition 2:
Pumping Lemma for CFLs (cont..)
Condition 3: .
Already proved
is context-free
Already proved
is context-free
Already proved
Closure properties of CFLs
Theorem: Let be a context-free language then is also
context-free.
Already proved
Closure properties of CFLs
Theorem: Let and be two context-free languages. Then
is need not be context-free