- Asked 2/7
- 2073 Chaitra
Pumping lemma: equal 0s and 1s
Short answer
If L is regular, there exists p≥1 such that any w∈L with |w|≥p can be split w=xyz, |xy|≤p, |y|≥1, xyⁱz∈L for all i. Assume L={w∈{0,1}* | equal 0 and 1} regular with p, take w=0^p 1^p. Since |xy|≤p, y=0^k (k≥1). Pump i=2 yields 0^(p+k)1^p, unequal counts, not in L, contradiction, so L not regular.
State the pumping lemma for regular languages. Using the pumping lemma, prove that the language L = {w : w ∈ {0,1}* and w has an equal number of 0's and 1's} is not regular.
Pumping lemma
If L is regular, there is p ≥ 1 such that every w ∈ L with |w| ≥ p can be split w = xyz where |xy| ≤ p, |y| ≥ 1 and xyⁱz ∈ L for all i ≥ 0.
Proof that L = {w ∈ {0,1}* : #0(w) = #1(w)} is not regular
Assume L is regular with pumping length p.
- Choose w = 0ᵖ1ᵖ. It has p zeros and p ones, so w ∈ L, and |w| = 2p ≥ p.
- Since |xy| ≤ p, the substring xy lies in the block of 0's. So y = 0ᵏ with 1 ≤ k ≤ p.
- Take i = 2: xy²z = 0^(p+k)1ᵖ.
- It has p + k zeros but only p ones, and k ≥ 1, so the counts are unequal. Therefore xy²z ∉ L.
This contradicts the pumping lemma, so L is not regular. ∎
Alternative proof (closure). If L were regular, then L ∩ 01 would be regular (regular languages are closed under intersection). But L ∩ 01 = {0ⁿ1ⁿ : n ≥ 0}, which is known to be non-regular. Contradiction.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Pumping lemma: a^(n²) not regular · Theory of Computation, chapter 2 · asked 5×
- Pumping lemma: aⁿb²ⁿ not regular · Theory of Computation, chapter 2 · asked 3×
- Pumping lemma: aⁿbaⁿ not regular · Theory of Computation, chapter 2
- Pumping lemma (CFL): ww not CF · Theory of Computation, chapter 3
- Pumping lemma: a^p, p prime · Theory of Computation, chapter 2 · asked 2×
- Pumping lemma (CFL): aⁿbⁿcⁿ not CF · Theory of Computation, chapter 3
- Closure properties of regular languages · Theory of Computation, chapter 2 · asked 2×
- Regular expressions and regular languages · Discrete Structure, chapter 2
- Closure properties of regular languages · Discrete Structure, chapter 2 · asked 2×
- High level languages and natural language · Computer Programming, chapter 1