Pumping lemma for CFG Flashcards

(16 cards)

1
Q

What is the goal of the pumping lemma for CFLs?

A

To prove that certain languages are not context-free.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the pumping lemma for context-free languages?

A

If L is a CFL, then there exists n > 0 such that any w ∈ L with |w| ≥ n can be split as w = uvxyz, where |vxy| ≤ n, v ≠ ε or y ≠ ε, and uvⁱx yⁱz ∈ L for all i ≥ 0.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What conditions must the decomposition uvxyz satisfy in the CFL pumping lemma?

A
  1. v ≠ ε or y ≠ ε; 2. |vxy| ≤ n; 3. uvⁱ x yⁱ z ∈ L for all i ≥ 0.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the intuition behind the pumping lemma for CFLs?

A

In long enough parse trees, some non-terminal must repeat, creating a subtree that can be pumped.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the strategy for using the CFL pumping lemma to prove non-context-freeness?

A

Assume L is a CFL, pick a long enough word, show all valid decompositions violate the pumping conditions, and conclude a contradiction.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What language is used as the canonical example of a non-context-free language?

A

L = { aⁿbⁿcⁿ | n ≥ 0 }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why can’t L = { aⁿbⁿcⁿ } be generated by a CFG?

A

CFGs can match two counts (like aⁿbⁿ) but not three simultaneously.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In the CFL pumping lemma

A

what does the constraint |vxy| ≤ n ensure?

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What happens if you pump v and y in aⁿbⁿcⁿ?

A

You disturb the equal balance of a’s, b’s, or c’s, creating a string not in the language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why is the language aⁿbⁿcⁿ not context-free?

A

Because no decomposition uvxyz satisfies the CFL pumping lemma without breaking the required equal counts.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Are context-free languages closed under intersection?

A

No, the intersection of two CFLs may not be a CFL.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Give an example showing CFLs are not closed under intersection.

A

L1 = { aⁿbⁿcᵏ }, L2 = { aⁿbᵏcᵏ }; L1 ∩ L2 = { aⁿbⁿcⁿ } which is not context-free.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Are context-free languages closed under complement?

A

No — if they were, they would also be closed under intersection (which they are not).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the general consequence of CFLs not being closed under complement?

A

You can’t assume the complement of a CFL is context-free, which affects constructions involving set operations.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Which operations are context-free languages closed under?

A

Union, concatenation, and Kleene star.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which operations are context-free languages not closed under?

A

Intersection and complement.