# COMS W3261 Computer Science Theory Lecture 5:September 19, 2012 Pumping Lemma for Regular Languages

## Overview

• Algebraic laws can be used to simplify regular expressions.
• The pumping lemma for regular languages can be used to show that some languages are not regular.

## 1. Algebraic Laws for Regular Expressions

• Algebraic laws can be used to simplify regular expressions
• Here are some of the most important algebraic identities for regular expressions
• Union is commutative: L + M = M + L
• Union is associative: (L + M) + N = L + (M + N)
• Concatenation is associative: (LM)N = L(MN)
• ∅ is the identity for union: ∅ + L = L + ∅ = L
• ε is the identity for concatenation: εL = Lε = L
• ∅ is the annihilator for concatenation: ∅L = L∅ = ∅
• Concatenation left distributes over union: L(M + N) = LM + LN
• Concatenation right distributes over union: (M + N)L = ML + NL
• Union is idempotent: L + L = L
• L** = L*
• ∅* = ε
• ε* = ε

## 2. The Pumping Lemma for Regular Languages

• The pumping lemma for regular languages states that for every nonfinite regular language L, there exists a constant n that depends on L such that for all w in L with |w| ≥ n, there exists a decomposition of w into xyz such that
1. y ≠ ε,
2. |xy| ≤ n, and
3. for all k ≥ 0, the string xykz is in L.
• Proof: See HMU, p. 129.

• One important use of the pumping lemma is to prove some languages are not regular.
• Example: The language L consisting of all strings of a's and b's of the form aibi, i ≥ 0, is not regular.
• The proof will be by contradiction. Assume L is regular. Then by the pumping lemma there is a constant n associated with L such that for all w in L with |w| ≥ n, w can be written as xyz such that
1. y ≠ ε,
2. |xy| ≤ n, and
3. for all k ≥ 0, the string xykz is in L.
• Since |xy| ≤ n, xy = am for some 0 < m ≤ n.
• Setting k = 0, condition (3) of the pumping lemma says xz must also be in L.
• But xz is of the form apbn, where p < n.
• This contradicts the conclusion that xz must be in L.

## 3. Practice Problems

1. Show that the language consisting of all strings of balanced parentheses is not regular.
2. Prove that the language consisting of all strings of a's and b's that read the same forwards as backwards is not regular.
3. Prove that the language L = { w | w = aibj where i is not equal to j } is not regular.