You are on page 1of 23

CFL closure property

Group member :

• Usama sohail s2018266118


• Ayesha batool s2018266069
• Eman Fatima s2018266018
• Aimen Iqbal s2018266062
• Usman rashid s2017266049
CLOSER PROPERTY

What is closure property?


A set is closed under an operation if performance of that operation on
members of the set always produces a member of that same set.
EXAMPLE 1:
If a and b are two integers. Then a+b is also an integer. So “+” operation
is closed under addition.
EXAMPLE 2:
 If a and b are two integers. Then a/b may not be an integer. So “/ ”
operation is not closed under integers.
CLOSER PROPERTY

There are total 10 closure property but 5 are important property in


it which are as following:
Union
Concatenation
Kleen’s
Intersection
Complementation
Intersection property

The CFL is not necessarily closed under intersection.


• Let’s take a context-free language
• L1 = { anbncm | m, n ≥ 1}
G1 : { S AB
A aAb | ab L1 is accepted by PDA
B cB | c}
Intersection property

• Let take another context free language


• L2 = { anbmcm | m, n ≥ 1}
G2 : { S AB
A aA | a L2 is accepted by PDA
B bBc |bc }
• L1 ∩ L2 = { anbncn | n ≥ 1 }
L1 ∩ L2 can be defined by a TM or Two stack PDA
CFLs closed under the union (∪) property
CFLs closed under the union (∪) property

• In set theory , the union (denoted by ∪) of a collection of sets is


the set of all elements in the collection.
• As all regular languages are context-free the union of both results
in a context-free language.

L1 ∪ L2
CFLs closed under the union (∪) property

• L1 and L2 and then show that the union of these languages, L1 ∪


L2 is a CFL.
• L1, L2 are CFLs, there must exist CFGs which generate these two
languages.
• G1 and G2 generate the languages L1 and L2 respectively
proof:
Represent in finite automata

So,G1 and G2 CFG


Example ::
Concatenation property

• L1 and L2 and then show that the concatenation of these


languages, L1.L2 is a CFL.
• L1, L2 are CFLs, there must exist CFGs which generate these two
languages.
• G1 and G2 generate the languages L1 and L2 respectively
proof

P={S S1S2
S1 aA
A b
S2 bB
P B b}
Represent in finite automata
Example::
COMPLEMENTATION
Complementation in CFL

• First of all let me tell that intersection and complementation are


not closed under CFL property.
• If L1 is a CFL, then (L1)` may not be a CFL.
• They are closed under union. If they are closed under
complement, then they are closed under intersection, which is
false.
Example ::

• 1. Assume the complement of every CFL is a CFL..


• 2. Let L1 and L2 be 2 CFLs.
• 3. Since CFLs are close under union, and we are assuming they are closed
under complement,
L1 ∩ L2 =( L1’ ∪ L2’)’
CFL ∪ CFL
CFL = CFL
• However, we know there are CFLs whose intersection is not a CFL.
• Therefore, our assumption that CFLs are closed under complement is false.
Kleen’s closure property in CFL
Example ::

• Let G1 be a CFG such that G1∈L1 then G1* is also a CFG.


• How?
• G1 is given by G1={V1,T,P1,S1}
• P1={S1--> aA   
A-->b}

• Where as G1* is given by G1*={V1∪{S},T,P,S}


• P={S-->S1.S| ∈
S1-->aA
• A-->B}
In finite automata

• G1 is given by G1={V1,T,P1,S1}
• P1={S1--> aA
•   A-->b}
• a
S1 A

• b

F1 +
In finite automata

• Where as G1* is given by G1*= { (V1 ∪ S),T, P, S }


• P={ S-->S1.S| ∈
• S1-->aA
• S
A-->B }                                 Derivation form:         

S
S1

So , G1* is close
under CFL

You might also like