# 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
- y ≠ ε,
- |xy| ≤ n, and
- for all k ≥ 0, the string xy
^{k}z 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 a
^{i}b^{i}, 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
- y ≠ ε,
- |xy| ≤ n, and
- for all k ≥ 0, the string xy
^{k}z is in L.

- Since |xy| ≤ n, xy = a
^{m} 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 a
^{p}b^{n}, where p < n.
- This contradicts the conclusion that xz must be in L.

## 3. Practice Problems

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

## 4. Reading Assignment

aho@cs.columbia.edu