Professional Documents
Culture Documents
Lec 06
Lec 06
Lec 06
Ashutosh Trivedi
0, 1
0, 1 0, 1 1
start s1 s2 s3 s4
0
Ashutosh Trivedi – 2 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Some languages are not regular!
Ashutosh Trivedi – 3 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Some languages are not regular!
Ashutosh Trivedi – 3 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Why?
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma
Ashutosh Trivedi – 4 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
A simple observation about DFA
0 1
1
start E O
start E . start E .
0 0
E . E .
1 0
O . E .
0 1
E . O .
Ashutosh Trivedi – 5 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
A simple observation about DFA
Ashutosh Trivedi – 6 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
a
1 2a ak
– Let s0 −
→ s1 −
→ s2 . . . −
→ sk be the run of w on A.
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
a
1 a
2 a k
– Let s0 −
→ s1 −
→ s2 . . . −
→ sk be the run of w on A.
– Let i be the index of first state that the run revisits and let j be the
index of second occurrence of that state, i.e. si = sj ,
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
1a 2 a ka
– Let s0 −
→ s1 −
→ s2 . . . −
→ sk be the run of w on A.
– Let i be the index of first state that the run revisits and let j be the
index of second occurrence of that state, i.e. si = sj ,
– Let x = a1 a2 . . . ai and y = ai+1 . . . aj , and z = aj+1 . . . ak .
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
1a 2 a ka
– Let s0 −
→ s1 −
→ s2 . . . −
→ sk be the run of w on A.
– Let i be the index of first state that the run revisits and let j be the
index of second occurrence of that state, i.e. si = sj ,
– Let x = a1 a2 . . . ai and y = ai+1 . . . aj , and z = aj+1 . . . ak .
– notice that |y| > 0 and |xy| ≤ n
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Pumping Lemma: Proof
Proof.
– Let A be the DFA accepting L and p be the set of states in A.
– Let w = (a1 a2 . . . ak ) ∈ L be any string of length ≥ p.
1a 2 a ka
– Let s0 −
→ s1 −
→ s2 . . . −
→ sk be the run of w on A.
– Let i be the index of first state that the run revisits and let j be the
index of second occurrence of that state, i.e. si = sj ,
– Let x = a1 a2 . . . ai and y = ai+1 . . . aj , and z = aj+1 . . . ak .
– notice that |y| > 0 and |xy| ≤ n
– Also, notice that for all i ≥ 0 the string xyi z is also in L.
Ashutosh Trivedi – 7 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma
Ashutosh Trivedi – 8 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma
Theorem
Prove that the language L = {0n 1n } is not regular.
Ashutosh Trivedi – 10 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma I
Theorem
Prove that the language L = {0n 1n } is not regular.
Proof.
1. State the contrapositive of Pumping lemma.
2. Let p be an arbitrary number.
3. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
Ashutosh Trivedi – 10 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma I
Theorem
Prove that the language L = {0n 1n } is not regular.
Proof.
1. State the contrapositive of Pumping lemma.
2. Let p be an arbitrary number.
3. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
4. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
Ashutosh Trivedi – 10 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma I
Theorem
Prove that the language L = {0n 1n } is not regular.
Proof.
1. State the contrapositive of Pumping lemma.
2. Let p be an arbitrary number.
3. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
4. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
5. For each such triplet, there exists an i (say i = 0) such that xyi z 6∈ L.
6. Hence L is non-regular.
Ashutosh Trivedi – 10 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma II
Theorem
Prove that the language
is not regular.
Ashutosh Trivedi – 11 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma II
Theorem
Prove that the language
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
Ashutosh Trivedi – 11 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma II
Theorem
Prove that the language
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
Ashutosh Trivedi – 11 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma II
Theorem
Prove that the language
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p ∈ L. Notice that |0p 1p | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
4. For each such triplet, there exists an i (say i = 0) such that xyi z 6∈ L.
5. Hence L is non-regular.
Ashutosh Trivedi – 11 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma III
Theorem
Prove that the language
2
M = {1n : n ≥ 0}
is not regular.
Ashutosh Trivedi – 12 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma III
Theorem
Prove that the language
2
M = {1n : n ≥ 0}
is not regular.
Proof.
1. Let p be an arbitrary number.
2 2
2. Consider the string 1p ∈ L. Notice that |1p | ≥ p.
Ashutosh Trivedi – 12 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma III
Theorem
Prove that the language
2
M = {1n : n ≥ 0}
is not regular.
Proof.
1. Let p be an arbitrary number.
2 2
2. Consider the string 1p ∈ L. Notice that |1p | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 1k for some 1 ≤ k ≤ p.
Ashutosh Trivedi – 12 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma III
Theorem
Prove that the language
2
M = {1n : n ≥ 0}
is not regular.
Proof.
1. Let p be an arbitrary number.
2 2
2. Consider the string 1p ∈ L. Notice that |1p | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 1k for some 1 ≤ k ≤ p.
2
−l+k
4. Now consider 1l 1k 1k 1p (pumping twice) and show that it is not
perfect square.
5. Hence L is non-regular.
Ashutosh Trivedi – 12 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma IV
Theorem
Prove that the language
M = {0i 1j : i > j}
is not regular.
Ashutosh Trivedi – 13 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma IV
Theorem
Prove that the language
M = {0i 1j : i > j}
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p+1 ∈ L. Notice that |0p 1p+1 | ≥ p.
Ashutosh Trivedi – 13 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma IV
Theorem
Prove that the language
M = {0i 1j : i > j}
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p+1 ∈ L. Notice that |0p 1p+1 | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
Ashutosh Trivedi – 13 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma IV
Theorem
Prove that the language
M = {0i 1j : i > j}
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p+1 ∈ L. Notice that |0p 1p+1 | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
4. All pumping-ups are in the language!
Ashutosh Trivedi – 13 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Applying Pumping Lemma IV
Theorem
Prove that the language
M = {0i 1j : i > j}
is not regular.
Proof.
1. Let p be an arbitrary number.
2. Consider the string 0p 1p+1 ∈ L. Notice that |0p 1p+1 | ≥ p.
3. Only way to break this string in xyz triplets such that |xy| ≤ p and
y 6= ε is to choose y = 0k for some 1 ≤ k ≤ p.
4. All pumping-ups are in the language!
5. Solution: pump-down.
6. Hence L is non-regular.
Ashutosh Trivedi – 13 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Proving a language Regular
Proving Regularity
Pumping Lemma is necessary but not sufficient condition for regularity.
Ashutosh Trivedi – 14 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma
Proving a language Regular
Proving Regularity
Pumping Lemma is necessary but not sufficient condition for regularity.
Verify that this language satisfies the pumping condition, but is not
regular!
Ashutosh Trivedi – 14 of 14
Ashutosh Trivedi Lecture 5: Pumping Lemma