Professional Documents
Culture Documents
Recap: Example: - Design A CFG That Generates All The Even Integers Up To 998
Recap: Example: - Design A CFG That Generates All The Even Integers Up To 998
S->AB|AAB|0|2|4|6|8
A->0|1|2|3|4|5|6|7|8|9
B->0|2|4|6|8
IDENTIFYING NON-CONTEXT FREE
LANGUAGES
HOW TO IDENTIFY NON-CONTEXT-FREE LANGUAGES?
HOW TO IDENTIFY NON-CONTEXT-FREE LANGUAGES?
• It express the idea that when one/ several languages are CFLs, and L is formed from them by applying
certain operations, which is also CFL, then CFLs are closed under those operations
CLOSURE UNDER UNION
CLOSURE UNDER CONCATENATION
CLOSURE UNDER STAR CLOSURE
CLOSURE UNDER INTERSECTION
• CFLs are not closed under intersection
• Let’s consider L3 = {anbncn : n ≥ 0}
• L3 = L1 ∩ L2, where L1 = { anbncm : n ≥ 0, m ≥ 0 }, L2 = { anbmcm : n ≥ 0, m ≥ 0}
• Both L1 and L2 are CFLs
• For L1:
• If the CFLs are closed under intersection, then L3 would also be CFL.
• But, it was proved earlier that L3 is not CFL
CLOSURE UNDER COMPLEMENTATION
• Suppose, L1 = {a100b100}, L1 = ?