0% found this document useful (0 votes)
25 views1 page

Closure Properties of Context Free Languages

CFG -TOC

Uploaded by

shobanasofficial
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Closure Properties of Context Free Languages

CFG -TOC

Uploaded by

shobanasofficial
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Closure Properties of Context Free Languages (CFLs)

Context Free Languages (CFLs) are accepted by pushdown automata. Context free languages
can be generated by context free grammars, which have productions (substitution rules)
Properties of Context Free Languages
Union : If L1 ab nd L2 are two context free languages, their union L1 ∪ L2 will also be
context free. For example,
L1 = { anbncm | m >= 0 and n >= 0 } and L2 = { anbmcm | n >= 0 and m >= 0 }
L3 = L1 ∪ L2 = { anbncm ∪ anbmcm | n >= 0, m >= 0 } is also context free.
L1 says number of a’s should be equal to number of b’s and L2 says number of b’s should be
equal to number of c’s. Their union says either of two conditions to be true. So it is also
context free language.
Note: So CFL are closed under Union.

Concatenation : If L1 and If L2 are two context free languages, their concatenation L1.L2
will also be context free. For example,
L1 = { anbn | n >= 0 } and L2 = { cmdm | m >= 0 }
L3 = L1.L2 = { anbncmdm | m >= 0 and n >= 0} is also context free.
L1 says number of a’s should be equal to number of b’s and L2 says number of c’s should be
equal to number of d’s. Their concatenation says first number of a’s should be equal to
number of b’s, then number of c’s should be equal to number of d’s. So, we can create a PDA
which will first push for a’s, pop for b’s, push for c’s then pop for d’s. So it can be accepted
by pushdown automata, hence context free.
Note: So CFL are closed under Concatenation.

Kleene Closure : If L1 is context free, its Kleene closure L1* will also be context free. For
example,
L1 = { anbn | n >= 0 }
L1* = { anbn | n >= 0 }* is also context free.
Note :So CFL are closed under Kleen Closure.

Intersection and complementation :


If L1 and If L2 are two context free languages, their intersection L1 L2 need not be context free.
n n m
b c | n >= 0 and m >= 0 } and L2 = (ambncn
n | nn n>= 0 and m >= 0 }
b c | n >= 0 } need not be context free.
L1 says number of a’s should be equal to number of b’s and L2 says number of b’s should be
equal to number of c’s. Their intersection says both conditions need to be true, but push down
automata can compare only two. So it cannot be accepted by pushdown automata, hence not
context free.
Similarly, complementation of context free language L1 which is L1’, need not be context
free.
Note : So CFL are not closed under Intersection and Complementation.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy