Professional Documents
Culture Documents
Properties of CFL
8.2: Closure Properties for CFL (1)
Concatenation L = L1L2
G = ({S} NT1 NT2, 1 2,
P1 P2 {S S1S2}, S)
Closure L = L1*
G = ({S} NT1, 1, P1 {S | S1S}, S)
Intersection L = L1 L2
L not necessarily context-free.
CFLs are not closed under intersection!
Can’t simulate two stacks by one stack.
L1 = {an bn cm | n, m 0}
is CFL
L2 = {an bm cm | n, m 0}
is CFL
L = L1 L2 = {ak bk ck | k 0}
is NOT CFL
8.2: Closure Properties for CFL (4)
__
Complementation L= L1
L not necessarily context-free.
CFLs are not closed under complementation!
By DeMorgan’s Law,
since union closed,
if complementation closed, so is intersection.
(contradiction)
L L1 L2 L1 L2
8.2: Closure Properties for CFL (5)
Intersection with RL L = L1 R
L is context-free.
Intuition: Only one stack to simulate, so OK.