The Pumping Lemma for Regular Languages The Pumping Lemma - - PowerPoint PPT Presentation

▶
the pumping lemma for regular languages
SMART_READER_LITE
LIVE PREVIEW

The Pumping Lemma for Regular Languages The Pumping Lemma - - PowerPoint PPT Presentation

The Pumping Lemma for Regular Languages The Pumping Lemma forRegular Languages p.1/39 Nonregular languages Consider the language . The Pumping Lemma forRegular Languages


slide-1
SLIDE 1

The Pumping Lemma for Regular Languages

The Pumping Lemma forRegular Languages – p.1/39

slide-2
SLIDE 2

Nonregular languages

Consider the language

  • ✁
✂ ✄ ☎ ✆ ☎ ✝✟✞ ✠ ✄ ✡

.

The Pumping Lemma forRegular Languages – p.2/39

slide-3
SLIDE 3

Nonregular languages

Consider the language

  • ✁
✂ ✄ ☎ ✆ ☎ ✝✟✞ ✠ ✄ ✡

.

  • If we attempt to find a DFA that recognizes
✁

we discover that such a machine needs to remember how many

✂

s have been seen so far as it reads the input

The Pumping Lemma forRegular Languages – p.2/39

slide-4
SLIDE 4

Nonregular languages

Consider the language

  • ✁
✂ ✄ ☎ ✆ ☎ ✝✟✞ ✠ ✄ ✡

.

  • If we attempt to find a DFA that recognizes
✁

we discover that such a machine needs to remember how many

✂

s have been seen so far as it reads the input

  • Because the number of
✂

s isn’t limited, the machine needs to keep track of an unlimited number of possibilities

The Pumping Lemma forRegular Languages – p.2/39

slide-5
SLIDE 5

Nonregular languages

Consider the language

  • ✁
✂ ✄ ☎ ✆ ☎ ✝✟✞ ✠ ✄ ✡

.

  • If we attempt to find a DFA that recognizes
✁

we discover that such a machine needs to remember how many

✂

s have been seen so far as it reads the input

  • Because the number of
✂

s isn’t limited, the machine needs to keep track of an unlimited number of possibilities

  • This cannot be done with any finite number of states

The Pumping Lemma forRegular Languages – p.2/39

slide-6
SLIDE 6

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

The Pumping Lemma forRegular Languages – p.3/39

slide-7
SLIDE 7

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

  • Example:

The Pumping Lemma forRegular Languages – p.3/39

slide-8
SLIDE 8

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

  • Example:
  • ✁
✂☎✄ ✆ ✄

has an equal number of 0s and 1s

✝

The Pumping Lemma forRegular Languages – p.3/39

slide-9
SLIDE 9

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

  • Example:
  • ✁
✂☎✄ ✆ ✄

has an equal number of 0s and 1s

✝

not regular

The Pumping Lemma forRegular Languages – p.3/39

slide-10
SLIDE 10

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

  • Example:
  • ✁
✂☎✄ ✆ ✄

has an equal number of 0s and 1s

✝

not regular

  • ✁
✂ ✄ ✆ ✄

has equal no of 01 and 10 substrings

✝

The Pumping Lemma forRegular Languages – p.3/39

slide-11
SLIDE 11

Intuition may fail us

  • Just because a language appears to require

unbounded memory to be recognized, it doesn’t mean that it is necessarily so

  • Example:
  • ✁
✂☎✄ ✆ ✄

has an equal number of 0s and 1s

✝

not regular

  • ✁
✂ ✄ ✆ ✄

has equal no of 01 and 10 substrings

✝

regular

The Pumping Lemma forRegular Languages – p.3/39

slide-12
SLIDE 12

Language nonregularity

  • The technique for proving nonregularity of some

language is provided by a theorem about regular languages called pumping lemma

The Pumping Lemma forRegular Languages – p.4/39

slide-13
SLIDE 13

Language nonregularity

  • The technique for proving nonregularity of some

language is provided by a theorem about regular languages called pumping lemma

  • Pumping lemma states that all regular languages have

a special property

The Pumping Lemma forRegular Languages – p.4/39

slide-14
SLIDE 14

Language nonregularity

  • The technique for proving nonregularity of some

language is provided by a theorem about regular languages called pumping lemma

  • Pumping lemma states that all regular languages have

a special property

  • If we can show that a language
  • does not have this

property we are guaranteed that

  • is not regular.

The Pumping Lemma forRegular Languages – p.4/39

slide-15
SLIDE 15

Observation

Pumping lemma states that all regular languages have a special property.

The Pumping Lemma forRegular Languages – p.5/39

slide-16
SLIDE 16

Observation

Pumping lemma states that all regular languages have a special property. Pumping lemma does not state that only regular languages have this property. Hence, the property used to prove that a language

  • is not regular does not ensure that language

is

  • regular.

The Pumping Lemma forRegular Languages – p.5/39

slide-17
SLIDE 17

Observation

Pumping lemma states that all regular languages have a special property. Pumping lemma does not state that only regular languages have this property. Hence, the property used to prove that a language

  • is not regular does not ensure that language

is

  • regular.

Consequence: A language may not be regular and still have strings that have all the properties of regular languages.

The Pumping Lemma forRegular Languages – p.5/39

slide-18
SLIDE 18

Pumping property

All strings in the language can be “pumped" if they are at least as long as a certain value, called the pumping length

The Pumping Lemma forRegular Languages – p.6/39

slide-19
SLIDE 19

Pumping property

All strings in the language can be “pumped" if they are at least as long as a certain value, called the pumping length Meaning: each such string in the language contains a sec- tion that can be repeated any number of times with the re- sulting string remaining in the language.

The Pumping Lemma forRegular Languages – p.6/39

slide-20
SLIDE 20

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

The Pumping Lemma forRegular Languages – p.7/39

slide-21
SLIDE 21

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

  • If
  • is any string in
  • f length at least
✁

,

The Pumping Lemma forRegular Languages – p.7/39

slide-22
SLIDE 22

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

  • If
  • is any string in
  • f length at least
✁

,

  • Then
  • may be divided into three pieces,
  • ✁
✁ ✂

, satisfying the following conditions:

The Pumping Lemma forRegular Languages – p.7/39

slide-23
SLIDE 23

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

  • If
  • is any string in
  • f length at least
✁

,

  • Then
  • may be divided into three pieces,
  • ✁
✁ ✂

, satisfying the following conditions:

  • 1. for each
  • ✁
✂

,

✂✄ ☎ ✆ ✝ ✞

The Pumping Lemma forRegular Languages – p.7/39

slide-24
SLIDE 24

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

  • If
  • is any string in
  • f length at least
✁

,

  • Then
  • may be divided into three pieces,
  • ✁
✁ ✂

, satisfying the following conditions:

  • 1. for each
  • ✁
✂

,

✂✄ ☎ ✆ ✝ ✞

2.

✆ ✄ ✆
  • ✂

The Pumping Lemma forRegular Languages – p.7/39

slide-25
SLIDE 25

Theorem 1.70

Pumping Lemma: If

  • is a regular language, then there is

a pumping length

✁

such that:

  • If
  • is any string in
  • f length at least
✁

,

  • Then
  • may be divided into three pieces,
  • ✁
✁ ✂

, satisfying the following conditions:

  • 1. for each
  • ✁
✂

,

✂✄ ☎ ✆ ✝ ✞

2.

✆ ✄ ✆
  • ✂

3.

✆ ✂ ✄ ✆
  • ✁

The Pumping Lemma forRegular Languages – p.7/39

slide-26
SLIDE 26

Interpretation

  • Recall that
✝
  • ✝

represents the length of string

  • and
✁
  • means that
✁

may be concatenated

✁

times, and

✁ ✂ ✁ ✄

The Pumping Lemma forRegular Languages – p.8/39

slide-27
SLIDE 27

Interpretation

  • Recall that
✝
  • ✝

represents the length of string

  • and
✁
  • means that
✁

may be concatenated

✁

times, and

✁ ✂ ✁ ✄
  • When
  • ✁
  • ✁
✂

, either

  • r
✂

may be

✄

, but

✁
  • ✁
✄

The Pumping Lemma forRegular Languages – p.8/39

slide-28
SLIDE 28

Interpretation

  • Recall that
✝
  • ✝

represents the length of string

  • and
✁
  • means that
✁

may be concatenated

✁

times, and

✁ ✂ ✁ ✄
  • When
  • ✁
  • ✁
✂

, either

  • r
✂

may be

✄

, but

✁
  • ✁
✄
  • Without condition
✁
  • ✁
✄

theorem would be trivially true

The Pumping Lemma forRegular Languages – p.8/39

slide-29
SLIDE 29

Proof idea

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that recognizes

  • The Pumping Lemma forRegular Languages – p.9/39
slide-30
SLIDE 30

Proof idea

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that recognizes

  • Assign a pumping length
✁

to be the number of states of

  • The Pumping Lemma forRegular Languages – p.9/39
slide-31
SLIDE 31

Proof idea

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that recognizes

  • Assign a pumping length
✁

to be the number of states of

  • Show that any string
  • ✝
✞

,

✆
  • ✆
✁ ✁

may be broken into three pieces

✂ ✄ ✆

satisfying the pumping lemma’s conditions

The Pumping Lemma forRegular Languages – p.9/39

slide-32
SLIDE 32

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

The Pumping Lemma forRegular Languages – p.10/39

slide-33
SLIDE 33

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝
  • Since

accepts

  • ,
✝✟✞
  • must be fi nal;if
✝
  • ✝
✁ ✞

then the length of

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

is

✞ ✁ ✆

The Pumping Lemma forRegular Languages – p.10/39

slide-34
SLIDE 34

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝
  • Since

accepts

  • ,
✝✟✞
  • must be fi nal;if
✝
  • ✝
✁ ✞

then the length of

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

is

✞ ✁ ✆
  • Because
✝
  • ✝
✁ ✞

and

✝
  • ✝
✠ ✁

it result that

✞ ✁ ✆
  • ✁

.

The Pumping Lemma forRegular Languages – p.10/39

slide-35
SLIDE 35

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝
  • Since

accepts

  • ,
✝✟✞
  • must be fi nal;if
✝
  • ✝
✁ ✞

then the length of

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

is

✞ ✁ ✆
  • Because
✝
  • ✝
✁ ✞

and

✝
  • ✝
✠ ✁

it result that

✞ ✁ ✆
  • ✁

.

  • By pigeonhole principle:

The Pumping Lemma forRegular Languages – p.10/39

slide-36
SLIDE 36

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝
  • Since

accepts

  • ,
✝✟✞
  • must be fi nal;if
✝
  • ✝
✁ ✞

then the length of

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

is

✞ ✁ ✆
  • Because
✝
  • ✝
✁ ✞

and

✝
  • ✝
✠ ✁

it result that

✞ ✁ ✆
  • ✁

.

  • By pigeonhole principle:
  • If p pigeons are placed into fewer than p holes, some holes must

hold more than one pigeon

The Pumping Lemma forRegular Languages – p.10/39

slide-37
SLIDE 37

More ideas

  • If
  • and
✝
  • ✝
✠ ✁

, consider a sequence of states that goes through to accept

  • , example:
✁✄✂✆☎ ✁✄✝ ☎ ✁✄✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝
  • Since

accepts

  • ,
✝✟✞
  • must be fi nal;if
✝
  • ✝
✁ ✞

then the length of

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

is

✞ ✁ ✆
  • Because
✝
  • ✝
✁ ✞

and

✝
  • ✝
✠ ✁

it result that

✞ ✁ ✆
  • ✁

.

  • By pigeonhole principle:
  • If p pigeons are placed into fewer than p holes, some holes must

hold more than one pigeon

the sequence

✁ ✂ ☎ ✁ ✝ ☎ ✁ ✞✟ ☎ ✠ ✠ ✠ ☎ ✁ ✂ ✝

must contain a repeated state, see Figure 1

The Pumping Lemma forRegular Languages – p.10/39

slide-38
SLIDE 38

Recognition sequence

  • ✁
✂ ✄ ☎
  • ✄
✂ ✆ ☎
  • ✝
✂ ✝ ✞ ☎
  • ✆
✂ ✟ ☎
  • ✠
✂ ✄ ✡ ☎
  • ☛
✂ ✟ ☎
  • ☞
✂ ☞ ☎ ✌ ✌ ✌ ✂ ✆ ☛ ☎ ✂ ✄ ✆ ☎

Figure 1: State

✍✏✎

repeats when reads

✑

The Pumping Lemma forRegular Languages – p.11/39

slide-39
SLIDE 39

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂

The Pumping Lemma forRegular Languages – p.12/39

slide-40
SLIDE 40

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁

The Pumping Lemma forRegular Languages – p.12/39

slide-41
SLIDE 41

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • The Pumping Lemma forRegular Languages – p.12/39
slide-42
SLIDE 42

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • Piece
✆

is the part of

  • after the 2nd appearance of
✁
  • The Pumping Lemma forRegular Languages – p.12/39
slide-43
SLIDE 43

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • Piece
✆

is the part of

  • after the 2nd appearance of
✁
  • In other words:

The Pumping Lemma forRegular Languages – p.12/39

slide-44
SLIDE 44

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • Piece
✆

is the part of

  • after the 2nd appearance of
✁
  • In other words:
  • ✂

takes

  • from
✁ ✂

to

✁
  • ,

The Pumping Lemma forRegular Languages – p.12/39

slide-45
SLIDE 45

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • Piece
✆

is the part of

  • after the 2nd appearance of
✁
  • In other words:
  • ✂

takes

  • from
✁ ✂

to

✁
  • ,
  • ✄

takes

  • from
✁
  • to
✁
  • ,

The Pumping Lemma forRegular Languages – p.12/39

slide-46
SLIDE 46

More ideas, continuation

Divide

  • in to the three pieces:
  • ,
✁

, and

✂
  • Piece
✂

is the part of

  • appearing before
✁✁
  • Piece
✄

is the part of

  • between two appearances of
✁
  • Piece
✆

is the part of

  • after the 2nd appearance of
✁
  • In other words:
  • ✂

takes

  • from
✁ ✂

to

✁
  • ,
  • ✄

takes

  • from
✁
  • to
✁
  • ,
  • ✆

takes

  • from
✁
  • to
✁ ✂ ✝

The Pumping Lemma forRegular Languages – p.12/39

slide-47
SLIDE 47

Note

The division specifi ed above satisfi es the 3 conditions

The Pumping Lemma forRegular Languages – p.13/39

slide-48
SLIDE 48

Observations

Suppose that we run

  • n
  • ✁
✁ ✂

The Pumping Lemma forRegular Languages – p.14/39

slide-49
SLIDE 49

Observations

Suppose that we run

  • n
  • ✁
✁ ✂
  • Condition 1: it is obvious that
  • accepts
✂ ✄ ✆

,

✂✄ ✄ ✆

, and in general

✂✄ ☎ ✆

for all

  • ✂

. For

  • ✁
✂

,

✂ ✄ ☎ ✆ ✁ ✂ ✆

which is also accepted because

✆

takes

  • to
✁ ✂ ✝

The Pumping Lemma forRegular Languages – p.14/39

slide-50
SLIDE 50

Observations

Suppose that we run

  • n
  • ✁
✁ ✂
  • Condition 1: it is obvious that
  • accepts
✂ ✄ ✆

,

✂✄ ✄ ✆

, and in general

✂✄ ☎ ✆

for all

  • ✂

. For

  • ✁
✂

,

✂ ✄ ☎ ✆ ✁ ✂ ✆

which is also accepted because

✆

takes

  • to
✁ ✂ ✝
  • Condition 2: Since
✆
  • ✆
✁ ✁

, state

✁
  • is repeated. Then because
✄

is the part between two successive occurrences of

✁
  • ,
✆ ✄ ✆
  • ✂

.

The Pumping Lemma forRegular Languages – p.14/39

slide-51
SLIDE 51

Observations

Suppose that we run

  • n
  • ✁
✁ ✂
  • Condition 1: it is obvious that
  • accepts
✂ ✄ ✆

,

✂✄ ✄ ✆

, and in general

✂✄ ☎ ✆

for all

  • ✂

. For

  • ✁
✂

,

✂ ✄ ☎ ✆ ✁ ✂ ✆

which is also accepted because

✆

takes

  • to
✁ ✂ ✝
  • Condition 2: Since
✆
  • ✆
✁ ✁

, state

✁
  • is repeated. Then because
✄

is the part between two successive occurrences of

✁
  • ,
✆ ✄ ✆
  • ✂

.

  • Condition 3: makes sure that
✁
  • is the first repetition in the
  • sequence. Then by pigeonhole principle, the first
✁
  • ✁

states in the sequence must contain a repetition. Therefore,

✆ ✂✄ ✆
  • ✁

The Pumping Lemma forRegular Languages – p.14/39

slide-52
SLIDE 52

Pumping lemma’s proof

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that has

✁

states and recognizes

  • . Let
  • ✁
  • ✞
✁ ✂ ✂ ✂
  • ☎

be a string over

☎
  • f

length

✞ ✠ ✁

. Let

✄ ✞ ✂ ✄
  • ✂
✂ ✂ ✂ ✂ ✄ ☎ ☎ ✞

be the sequence of states while processing

  • , i.e.,
✄
  • ☎
✞ ✁ ✆
  • ✄
  • ✂
  • ✡

,

✆ ✆ ✁ ✆ ✞

The Pumping Lemma forRegular Languages – p.15/39

slide-53
SLIDE 53

Pumping lemma’s proof

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that has

✁

states and recognizes

  • . Let
  • ✁
  • ✞
✁ ✂ ✂ ✂
  • ☎

be a string over

☎
  • f

length

✞ ✠ ✁

. Let

✄ ✞ ✂ ✄
  • ✂
✂ ✂ ✂ ✂ ✄ ☎ ☎ ✞

be the sequence of states while processing

  • , i.e.,
✄
  • ☎
✞ ✁ ✆
  • ✄
  • ✂
  • ✡

,

✆ ✆ ✁ ✆ ✞
  • ✁
✁ ✁
  • ✁

and among the first

✁
  • ✁

elements in

✁ ✂ ☎ ✁ ✞ ☎ ✠ ✠ ✠ ☎ ✁✄✂ ☎ ✂

two must be the same state, say

✁✝✆ ✁ ✁ ✞

.

The Pumping Lemma forRegular Languages – p.15/39

slide-54
SLIDE 54

Pumping lemma’s proof

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that has

✁

states and recognizes

  • . Let
  • ✁
  • ✞
✁ ✂ ✂ ✂
  • ☎

be a string over

☎
  • f

length

✞ ✠ ✁

. Let

✄ ✞ ✂ ✄
  • ✂
✂ ✂ ✂ ✂ ✄ ☎ ☎ ✞

be the sequence of states while processing

  • , i.e.,
✄
  • ☎
✞ ✁ ✆
  • ✄
  • ✂
  • ✡

,

✆ ✆ ✁ ✆ ✞
  • ✁
✁ ✁
  • ✁

and among the first

✁
  • ✁

elements in

✁ ✂ ☎ ✁ ✞ ☎ ✠ ✠ ✠ ☎ ✁✄✂ ☎ ✂

two must be the same state, say

✁✝✆ ✁ ✁ ✞

.

  • Because
✁ ✞
  • ccurs among the first
✁
  • ✁

places in the sequence starting at

✁ ✂

, we have

  • ✁
  • ✁

The Pumping Lemma forRegular Languages – p.15/39

slide-55
SLIDE 55

Pumping lemma’s proof

Let

✁
  • ✁✄✂
☎ ✂ ✆ ✂ ✝✟✞ ✂ ✠ ✡

be a DFA that has

✁

states and recognizes

  • . Let
  • ✁
  • ✞
✁ ✂ ✂ ✂
  • ☎

be a string over

☎
  • f

length

✞ ✠ ✁

. Let

✄ ✞ ✂ ✄
  • ✂
✂ ✂ ✂ ✂ ✄ ☎ ☎ ✞

be the sequence of states while processing

  • , i.e.,
✄
  • ☎
✞ ✁ ✆
  • ✄
  • ✂
  • ✡

,

✆ ✆ ✁ ✆ ✞
  • ✁
✁ ✁
  • ✁

and among the first

✁
  • ✁

elements in

✁ ✂ ☎ ✁ ✞ ☎ ✠ ✠ ✠ ☎ ✁✄✂ ☎ ✂

two must be the same state, say

✁✝✆ ✁ ✁ ✞

.

  • Because
✁ ✞
  • ccurs among the first
✁
  • ✁

places in the sequence starting at

✁ ✂

, we have

  • ✁
  • ✁
  • Now let
✂ ✁
  • ✂
✠ ✠ ✠
  • ✆
  • ✂

,

✄ ✁
  • ✆
✠ ✠ ✠
  • ✞
  • ✂

,

✆ ✁
  • ✞
✠ ✠ ✠
  • ✂

.

The Pumping Lemma forRegular Languages – p.15/39

slide-56
SLIDE 56

Note

  • As
✂

takes

  • from
✁ ✂

to

✁ ✆

,

✄

takes

  • from
✁ ✆

to

✁ ✆

, and

✆

takes

  • from
✁ ✆

to

✁ ✂ ☎ ✂

, which is an accept state,

  • must accept
✂✄ ☎ ✆

, for

  • ✁
✂

The Pumping Lemma forRegular Languages – p.16/39

slide-57
SLIDE 57

Note

  • As
✂

takes

  • from
✁ ✂

to

✁ ✆

,

✄

takes

  • from
✁ ✆

to

✁ ✆

, and

✆

takes

  • from
✁ ✆

to

✁ ✂ ☎ ✂

, which is an accept state,

  • must accept
✂✄ ☎ ✆

, for

  • ✁
✂
  • We know that
  • ✁
✁
  • , so
✆ ✄ ✆
  • ✂

;

The Pumping Lemma forRegular Languages – p.16/39

slide-58
SLIDE 58

Note

  • As
✂

takes

  • from
✁ ✂

to

✁ ✆

,

✄

takes

  • from
✁ ✆

to

✁ ✆

, and

✆

takes

  • from
✁ ✆

to

✁ ✂ ☎ ✂

, which is an accept state,

  • must accept
✂✄ ☎ ✆

, for

  • ✁
✂
  • We know that
  • ✁
✁
  • , so
✆ ✄ ✆
  • ✂

;

  • We also know that
  • ✁
  • ✁

, so

✆ ✂✄ ✆
  • ✁

The Pumping Lemma forRegular Languages – p.16/39

slide-59
SLIDE 59

Note

  • As
✂

takes

  • from
✁ ✂

to

✁ ✆

,

✄

takes

  • from
✁ ✆

to

✁ ✆

, and

✆

takes

  • from
✁ ✆

to

✁ ✂ ☎ ✂

, which is an accept state,

  • must accept
✂✄ ☎ ✆

, for

  • ✁
✂
  • We know that
  • ✁
✁
  • , so
✆ ✄ ✆
  • ✂

;

  • We also know that
  • ✁
  • ✁

, so

✆ ✂✄ ✆
  • ✁

Thus, all conditions are satisfi ed and lemma is proven

The Pumping Lemma forRegular Languages – p.16/39

slide-60
SLIDE 60

Before using lemma

Note: To use this lemma we must also ensure that if the property stated by the pumping lemma is true then the language is regular.

The Pumping Lemma forRegular Languages – p.17/39

slide-61
SLIDE 61

Before using lemma

Note: To use this lemma we must also ensure that if the property stated by the pumping lemma is true then the language is regular. Proof: assuming that each element of language

  • satisfi es

the three conditions stated in pumping lemma we can easily construct a FA that recognizes

  • , that is,
  • is regular.

The Pumping Lemma forRegular Languages – p.17/39

slide-62
SLIDE 62

Before using lemma

Note: To use this lemma we must also ensure that if the property stated by the pumping lemma is true then the language is regular. Proof: assuming that each element of language

  • satisfi es

the three conditions stated in pumping lemma we can easily construct a FA that recognizes

  • , that is,
  • is regular.

Note: if only some elements of

  • satisfy the three conditions it does not

mean that

  • is regular.

The Pumping Lemma forRegular Languages – p.17/39

slide-63
SLIDE 63

Using pumping lemma (PL)

Proving that a language

  • is not regular using PL:

The Pumping Lemma forRegular Languages – p.18/39

slide-64
SLIDE 64

Using pumping lemma (PL)

Proving that a language

  • is not regular using PL:
  • 1. Assume that
✞

is regular in order to obtain a contradiction

The Pumping Lemma forRegular Languages – p.18/39

slide-65
SLIDE 65

Using pumping lemma (PL)

Proving that a language

  • is not regular using PL:
  • 1. Assume that
✞

is regular in order to obtain a contradiction

  • 2. The pumping lemma guarantees the existence of a pumping

length

✁

s.t. all strings of length

✁
  • r greater in
✞

can be pumped

The Pumping Lemma forRegular Languages – p.18/39

slide-66
SLIDE 66

Using pumping lemma (PL)

Proving that a language

  • is not regular using PL:
  • 1. Assume that
✞

is regular in order to obtain a contradiction

  • 2. The pumping lemma guarantees the existence of a pumping

length

✁

s.t. all strings of length

✁
  • r greater in
✞

can be pumped

  • 3. Find
  • ✝
✞

,

✆
  • ✆
✁ ✁

, that cannot be pumped: demonstrate that

  • cannot be pumped by considering all ways of dividing
  • into
✂

,

✄

,

✆

, showing that for each division one of the pumping lemma conditions, (1)

✂✄ ☎ ✆ ✝ ✞

, (2)

✆ ✄ ✆
  • ✂

, (3)

✆ ✂✄ ✆
  • ✁

, fails.

The Pumping Lemma forRegular Languages – p.18/39

slide-67
SLIDE 67

Observations

  • The existence of
  • contradicts pumping lemma, hence
  • cannot be regular

The Pumping Lemma forRegular Languages – p.19/39

slide-68
SLIDE 68

Observations

  • The existence of
  • contradicts pumping lemma, hence
  • cannot be regular
  • Finding
  • sometimes takes a bit of creative thinking.

Experimentation is suggested

The Pumping Lemma forRegular Languages – p.19/39

slide-69
SLIDE 69

Applications

Example 1: prove that

  • ✁
✂ ✄ ☎ ✆ ☎ ✝ ✞ ✠ ✄ ✡

is not regular

The Pumping Lemma forRegular Languages – p.20/39

slide-70
SLIDE 70

Applications

Example 1: prove that

  • ✁
✂ ✄ ☎ ✆ ☎ ✝ ✞ ✠ ✄ ✡

is not regular Assume that

  • is regular and let
✁

be the pumping length of

  • . Choose
  • ✁
✄
  • ✆
  • ; obviously
✝ ✄
  • ✆
  • ✝
  • ✁

. By pumping lemma

  • ✁
  • ✁
✂

such that for any

✁ ✠ ✄

,

  • ✁
  • ✂
  • The Pumping Lemma forRegular Languages – p.20/39
slide-71
SLIDE 71

Example, continuation

Consider the cases:

The Pumping Lemma forRegular Languages – p.21/39

slide-72
SLIDE 72

Example, continuation

Consider the cases:

1.

✄

consists of

✂

s only. In this case

✂ ✄ ✄ ✆

has more

✂

s than

✁

s and so it is not in

✁

, violating condition 1

The Pumping Lemma forRegular Languages – p.21/39

slide-73
SLIDE 73

Example, continuation

Consider the cases:

1.

✄

consists of

✂

s only. In this case

✂ ✄ ✄ ✆

has more

✂

s than

✁

s and so it is not in

✁

, violating condition 1 2.

✄

consists of

✁

s only. This leads to the same contradiction

The Pumping Lemma forRegular Languages – p.21/39

slide-74
SLIDE 74

Example, continuation

Consider the cases:

1.

✄

consists of

✂

s only. In this case

✂ ✄ ✄ ✆

has more

✂

s than

✁

s and so it is not in

✁

, violating condition 1 2.

✄

consists of

✁

s only. This leads to the same contradiction 3.

✄

consists of

✂

s and

✁
  • s. In this case
✂ ✄ ✄ ✆

may have the same number of

✂

s and

✁

s but they are out of order with some

✁

s before some

✂

s hence it cannot be in

✁

either

The Pumping Lemma forRegular Languages – p.21/39

slide-75
SLIDE 75

Example, continuation

Consider the cases:

1.

✄

consists of

✂

s only. In this case

✂ ✄ ✄ ✆

has more

✂

s than

✁

s and so it is not in

✁

, violating condition 1 2.

✄

consists of

✁

s only. This leads to the same contradiction 3.

✄

consists of

✂

s and

✁
  • s. In this case
✂ ✄ ✄ ✆

may have the same number of

✂

s and

✁

s but they are out of order with some

✁

s before some

✂

s hence it cannot be in

✁

either

The contradiction is unavoidable if we make the assumption that

  • is regular so
  • is not regular

The Pumping Lemma forRegular Languages – p.21/39

slide-76
SLIDE 76

Example 2

Prove that

  • ✁
✂✂✁ ✝ ✁

has an equal number of 0s and 1s

✡

is not regular

The Pumping Lemma forRegular Languages – p.22/39

slide-77
SLIDE 77

Example 2

Prove that

  • ✁
✂✂✁ ✝ ✁

has an equal number of 0s and 1s

✡

is not regular Proof: assume that

  • is regular and
✁

is its pumping length. Let

  • ✁
✄
  • ✆
  • with
  • . Then pumping lemma guarantees

that

  • ✁
  • ✁
✂

, where

  • ✁
  • ✂
  • for any
✁ ✠ ✄

.

The Pumping Lemma forRegular Languages – p.22/39

slide-78
SLIDE 78

Note

If we take the division

  • ✁
✂ ✁ ✄

,

✁ ✁ ✄
  • ✆
  • it seems that

indeed, no contradiction occurs. However:

The Pumping Lemma forRegular Languages – p.23/39

slide-79
SLIDE 79

Note

If we take the division

  • ✁
✂ ✁ ✄

,

✁ ✁ ✄
  • ✆
  • it seems that

indeed, no contradiction occurs. However:

  • Condition 3 states that
✆ ✂✄ ✆
  • ✁

, and in our case

✂✄ ✁ ✂
  • ✁
  • and
✆ ✂ ✄ ✆
  • ✁

. Hence,

✂
  • ✁
  • cannot be pumped

The Pumping Lemma forRegular Languages – p.23/39

slide-80
SLIDE 80

Note

If we take the division

  • ✁
✂ ✁ ✄

,

✁ ✁ ✄
  • ✆
  • it seems that

indeed, no contradiction occurs. However:

  • Condition 3 states that
✆ ✂✄ ✆
  • ✁

, and in our case

✂✄ ✁ ✂
  • ✁
  • and
✆ ✂ ✄ ✆
  • ✁

. Hence,

✂
  • ✁
  • cannot be pumped
  • If
✆ ✂✄ ✆
  • ✁

then

✄

must consists of only

✁

s, so

✂ ✄ ✄ ✆ ✁ ✝
  • because

there are more 1-s than 0-s.

The Pumping Lemma forRegular Languages – p.23/39

slide-81
SLIDE 81

Note

If we take the division

  • ✁
✂ ✁ ✄

,

✁ ✁ ✄
  • ✆
  • it seems that

indeed, no contradiction occurs. However:

  • Condition 3 states that
✆ ✂✄ ✆
  • ✁

, and in our case

✂✄ ✁ ✂
  • ✁
  • and
✆ ✂ ✄ ✆
  • ✁

. Hence,

✂
  • ✁
  • cannot be pumped
  • If
✆ ✂✄ ✆
  • ✁

then

✄

must consists of only

✁

s, so

✂ ✄ ✄ ✆ ✁ ✝
  • because

there are more 1-s than 0-s.

This gives us the desired contradiction

The Pumping Lemma forRegular Languages – p.23/39

slide-82
SLIDE 82

Other selections

Selecting

  • ✁
  • ✄
✆ ✡
  • leads us to trouble because this string

can be pumped by the division:

  • ✁
✄

,

✁ ✁ ✄ ✆

,

✂ ✁
  • ✄
✆ ✡
  • ✞

. Then

  • ✁
  • ✂
  • for any
✁ ✠ ✄

The Pumping Lemma forRegular Languages – p.24/39

slide-83
SLIDE 83

An alternative method

Use the fact that

  • is nonregular.

The Pumping Lemma forRegular Languages – p.25/39

slide-84
SLIDE 84

An alternative method

Use the fact that

  • is nonregular.
  • If
  • were regular then
  • ✂
✁ ✁ ✁

would also be regular because

✂ ✁ ✁ ✁

is regular and

  • f regular languages is a regular language.

The Pumping Lemma forRegular Languages – p.25/39

slide-85
SLIDE 85

An alternative method

Use the fact that

  • is nonregular.
  • If
  • were regular then
  • ✂
✁ ✁ ✁

would also be regular because

✂ ✁ ✁ ✁

is regular and

  • f regular languages is a regular language.
  • But
  • ✂
✁ ✁ ✁ ✁ ✂ ✂ ✂ ✁ ✂ ✆
  • ✁
✂ ✝

which is not regular.

The Pumping Lemma forRegular Languages – p.25/39

slide-86
SLIDE 86

An alternative method

Use the fact that

  • is nonregular.
  • If
  • were regular then
  • ✂
✁ ✁ ✁

would also be regular because

✂ ✁ ✁ ✁

is regular and

  • f regular languages is a regular language.
  • But
  • ✂
✁ ✁ ✁ ✁ ✂ ✂ ✂ ✁ ✂ ✆
  • ✁
✂ ✝

which is not regular.

  • Hence,
  • is not regular either.

The Pumping Lemma forRegular Languages – p.25/39

slide-87
SLIDE 87

Example 3

Show that

✠ ✁ ✂ ✁ ✁ ✝ ✁
  • ✂
✄ ✂ ✆ ✡
  • ✡

is nonregular using pumping lemma

The Pumping Lemma forRegular Languages – p.26/39

slide-88
SLIDE 88

Example 3

Show that

✠ ✁ ✂ ✁ ✁ ✝ ✁
  • ✂
✄ ✂ ✆ ✡
  • ✡

is nonregular using pumping lemma Proof: Assume that

✠

is regular and

✁

is its pumping length. Consider

  • ✁
✄
  • ✆
✄
  • ✆
  • ✠

. Since

✝
  • ✝
  • ✁

,

  • ✁
  • ✁
✂

and satisfi esthe conditions of the pumping lemma.

The Pumping Lemma forRegular Languages – p.26/39

slide-89
SLIDE 89

Note

  • Condition 3 is again crucial because without it we

could pump

  • if we let
  • ✁
✂ ✁ ✄

, so

  • ✁
✁ ✂
  • ✠

The Pumping Lemma forRegular Languages – p.27/39

slide-90
SLIDE 90

Note

  • Condition 3 is again crucial because without it we

could pump

  • if we let
  • ✁
✂ ✁ ✄

, so

  • ✁
✁ ✂
  • ✠
  • The string
  • ✁
✄
  • ✆
✄
  • ✆

exhibits the essence of the nonregularity of

✠

.

The Pumping Lemma forRegular Languages – p.27/39

slide-91
SLIDE 91

Note

  • Condition 3 is again crucial because without it we

could pump

  • if we let
  • ✁
✂ ✁ ✄

, so

  • ✁
✁ ✂
  • ✠
  • The string
  • ✁
✄
  • ✆
✄
  • ✆

exhibits the essence of the nonregularity of

✠

.

  • If we chose, say
✄
  • ✄
  • ✠

we fail because this string can be pumped

The Pumping Lemma forRegular Languages – p.27/39

slide-92
SLIDE 92

Example 4

Show that

  • ✁
✂ ✆ ☎ ✝ ✝✟✞ ✠ ✄ ✡

is nonregular.

The Pumping Lemma forRegular Languages – p.28/39

slide-93
SLIDE 93

Example 4

Show that

  • ✁
✂ ✆ ☎ ✝ ✝✟✞ ✠ ✄ ✡

is nonregular. Proof by contradiction: Assume that

  • is regular and let
✁

be its pumping length. Consider

  • ✁
✆
  • ✝
  • ,
✝
  • ✝
✠ ✁

. Pumping lemma guarantees that

  • can be split,
  • ✁
  • ✁
✂

, where for all

✁ ✠ ✄

,

  • ✁
  • ✂
  • The Pumping Lemma forRegular Languages – p.28/39
slide-94
SLIDE 94

Searching for a contradiction

The elements of

  • are strings whose lengths are perfect
  • squares. Looking at fi rst perfect squareswe observe that

they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,

✂ ✂ ✂

The Pumping Lemma forRegular Languages – p.29/39

slide-95
SLIDE 95

Searching for a contradiction

The elements of

  • are strings whose lengths are perfect
  • squares. Looking at fi rst perfect squareswe observe that

they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,

✂ ✂ ✂
  • Note the growing gap between these numbers: large members

cannot be near each other

The Pumping Lemma forRegular Languages – p.29/39

slide-96
SLIDE 96

Searching for a contradiction

The elements of

  • are strings whose lengths are perfect
  • squares. Looking at fi rst perfect squareswe observe that

they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,

✂ ✂ ✂
  • Note the growing gap between these numbers: large members

cannot be near each other

  • Consider two strings
✂ ✄ ☎ ✆

and

✂ ✄ ☎ ☎ ✂ ✆

which differ from each other by a single repetition of

✄

.

The Pumping Lemma forRegular Languages – p.29/39

slide-97
SLIDE 97

Searching for a contradiction

The elements of

  • are strings whose lengths are perfect
  • squares. Looking at fi rst perfect squareswe observe that

they are: 0, 1, 4, 9, 25, 36, 49, 64, 81,

✂ ✂ ✂
  • Note the growing gap between these numbers: large members

cannot be near each other

  • Consider two strings
✂ ✄ ☎ ✆

and

✂ ✄ ☎ ☎ ✂ ✆

which differ from each other by a single repetition of

✄

.

  • If we chose
  • very large the lengths of
✂ ✄ ☎ ✆

and

✂✄ ☎ ☎ ✂ ✆

cannot be both perfect square because they are too close to each other.

The Pumping Lemma forRegular Languages – p.29/39

slide-98
SLIDE 98

Turning this idea into a proof

Calculate the value of

✁

that gives us the contradiction.

The Pumping Lemma forRegular Languages – p.30/39

slide-99
SLIDE 99

Turning this idea into a proof

Calculate the value of

✁

that gives us the contradiction.

  • If
  • ✁
✞
  • , calculating the difference we obtain
  • ✞
✁ ✆ ✡
  • ✁
✞
  • ✁
✂ ✞ ✁ ✆ ✁ ✂
  • ✁
✆

The Pumping Lemma forRegular Languages – p.30/39

slide-100
SLIDE 100

Turning this idea into a proof

Calculate the value of

✁

that gives us the contradiction.

  • If
  • ✁
✞
  • , calculating the difference we obtain
  • ✞
✁ ✆ ✡
  • ✁
✞
  • ✁
✂ ✞ ✁ ✆ ✁ ✂
  • ✁
✆
  • By pumping lemma
✝
  • ✁
  • ✂
✝

and

✝
  • ✁
  • ☎
✞ ✂ ✝

are both perfect

  • squares. But letting
✝
  • ✁
  • ✂
✝ ✁
  • we can see that they

cannot be both perfect square if

✝ ✁ ✝
  • ✂
✝
  • ✁
  • ✂
✝ ✁ ✆

, because they would be too close together.

The Pumping Lemma forRegular Languages – p.30/39

slide-101
SLIDE 101

Value of

  • for contradiction

To calculate the value for

✁

that leads to contradiction we

  • bserve that:

The Pumping Lemma forRegular Languages – p.31/39

slide-102
SLIDE 102

Value of

  • for contradiction

To calculate the value for

✁

that leads to contradiction we

  • bserve that:
  • ✝
✁ ✝ ✆ ✝
  • ✝
✁ ✁
  • The Pumping Lemma forRegular Languages – p.31/39
slide-103
SLIDE 103

Value of

  • for contradiction

To calculate the value for

✁

that leads to contradiction we

  • bserve that:
  • ✝
✁ ✝ ✆ ✝
  • ✝
✁ ✁
  • Let
✁ ✁ ✁
  • . Then
✝ ✁ ✝ ✆ ✁
  • ✁
✁
  • ✂
✁
  • ✁
✆ ✆ ✂ ✝
  • ✁
  • ✂
✝ ✁ ✆

The Pumping Lemma forRegular Languages – p.31/39

slide-104
SLIDE 104

Example 5

Sometimes “pumping down" is useful when we apply pumping lemma.

The Pumping Lemma forRegular Languages – p.32/39

slide-105
SLIDE 105

Example 5

Sometimes “pumping down" is useful when we apply pumping lemma.

  • We illustrate this using pumping lemma to prove that
  • ✁
✂ ✂ ☎ ✁ ✆ ✆
  • ✝

is not regular

The Pumping Lemma forRegular Languages – p.32/39

slide-106
SLIDE 106

Example 5

Sometimes “pumping down" is useful when we apply pumping lemma.

  • We illustrate this using pumping lemma to prove that
  • ✁
✂ ✂ ☎ ✁ ✆ ✆
  • ✝

is not regular

  • Proof: by contradiction using pumping lemma. Assume that
  • is

regular and its pumping length is

✁

.

The Pumping Lemma forRegular Languages – p.32/39

slide-107
SLIDE 107

Searching for a contradiction

  • Let
  • ✁
✄
  • ☎
✞ ✆
  • ; From decomposition
  • ✁
  • ✁
✂

, from condition 3,

✝
  • ✁
✝ ✆ ✁

it results that

✁

consists only of 0s.

The Pumping Lemma forRegular Languages – p.33/39

slide-108
SLIDE 108

Searching for a contradiction

  • Let
  • ✁
✄
  • ☎
✞ ✆
  • ; From decomposition
  • ✁
  • ✁
✂

, from condition 3,

✝
  • ✁
✝ ✆ ✁

it results that

✁

consists only of 0s.

  • Let us examine
  • ✁
✁ ✂

to see if it is in

  • . Adding an

extra-copy of

✁

increases the number of zeros. Since

  • contains all strings
✄
  • ✆
  • that have more 0s than 1s, it

will still give a string in

  • The Pumping Lemma forRegular Languages – p.33/39
slide-109
SLIDE 109

Searching for a contradiction

  • Let
  • ✁
✄
  • ☎
✞ ✆
  • ; From decomposition
  • ✁
  • ✁
✂

, from condition 3,

✝
  • ✁
✝ ✆ ✁

it results that

✁

consists only of 0s.

  • Let us examine
  • ✁
✁ ✂

to see if it is in

  • . Adding an

extra-copy of

✁

increases the number of zeros. Since

  • contains all strings
✄
  • ✆
  • that have more 0s than 1s, it

will still give a string in

  • The Pumping Lemma forRegular Languages – p.33/39
slide-110
SLIDE 110

Try something else

  • Since
  • ✁
  • ✂
  • even when
✁ ✁ ✄

, consider

✁ ✁ ✄

and

  • ✁
✂ ✂ ✁
  • ✂
  • .

The Pumping Lemma forRegular Languages – p.34/39

slide-111
SLIDE 111

Try something else

  • Since
  • ✁
  • ✂
  • even when
✁ ✁ ✄

, consider

✁ ✁ ✄

and

  • ✁
✂ ✂ ✁
  • ✂
  • .
  • This decreases the number of 0s in
  • .

The Pumping Lemma forRegular Languages – p.34/39

slide-112
SLIDE 112

Try something else

  • Since
  • ✁
  • ✂
  • even when
✁ ✁ ✄

, consider

✁ ✁ ✄

and

  • ✁
✂ ✂ ✁
  • ✂
  • .
  • This decreases the number of 0s in
  • .
  • Since
  • has just one more 0 than 1 and
  • ✂

cannot have more 0s than 1s,

(

✂✄ ✆ ✁ ✂
  • ☎
✂ ✁
  • and
✆ ✄ ✆ ✁ ✁ ✂

)

  • ✂

cannot be in

  • .

The Pumping Lemma forRegular Languages – p.34/39

slide-113
SLIDE 113

Try something else

  • Since
  • ✁
  • ✂
  • even when
✁ ✁ ✄

, consider

✁ ✁ ✄

and

  • ✁
✂ ✂ ✁
  • ✂
  • .
  • This decreases the number of 0s in
  • .
  • Since
  • has just one more 0 than 1 and
  • ✂

cannot have more 0s than 1s,

(

✂✄ ✆ ✁ ✂
  • ☎
✂ ✁
  • and
✆ ✄ ✆ ✁ ✁ ✂

)

  • ✂

cannot be in

  • .

This is the required contradiction

The Pumping Lemma forRegular Languages – p.34/39

slide-114
SLIDE 114

Minimum pumping length

  • The pumping lemma says that every regular language

has a pumping length

✁

, such that every string in the language of length at least

✁

can be pumped.

The Pumping Lemma forRegular Languages – p.35/39

slide-115
SLIDE 115

Minimum pumping length

  • The pumping lemma says that every regular language

has a pumping length

✁

, such that every string in the language of length at least

✁

can be pumped.

  • Hence, if
✁

is a pumping length for a regular language

  • so is any length
✁
  • ✠
✁

.

The Pumping Lemma forRegular Languages – p.35/39

slide-116
SLIDE 116

Minimum pumping length

  • The pumping lemma says that every regular language

has a pumping length

✁

, such that every string in the language of length at least

✁

can be pumped.

  • Hence, if
✁

is a pumping length for a regular language

  • so is any length
✁
  • ✠
✁

.

  • The minimum pumping length for
  • is the smallest
✁

that is a pumping length for

  • .

The Pumping Lemma forRegular Languages – p.35/39

slide-117
SLIDE 117

Example

Consider

  • ✁
✄ ✆
  • . The minimum pumping length for
  • is 2.

The Pumping Lemma forRegular Languages – p.36/39

slide-118
SLIDE 118

Example

Consider

  • ✁
✄ ✆
  • . The minimum pumping length for
  • is 2.

Reason: the string

  • ✁
✂ ✝ ✞

,

✆
  • ✆
✁ ✁

and

  • cannot be pumped. But any

string

  • ✝
✞

,

✆
  • ✆
✁
  • can be pumped because for
  • ✁
✂ ✄ ✆

where

✂ ✁ ✂

,

✄ ✁ ✁

,

✆ ✁ ✁
  • ✂

and

✂✄ ☎ ✆ ✝ ✞

. Hence, the minimum pumping length for

✞

is 2.

The Pumping Lemma forRegular Languages – p.36/39

slide-119
SLIDE 119

Problem 1

Find the minimum pumping length for the language

✄ ✄ ✄ ✆
  • .

The Pumping Lemma forRegular Languages – p.37/39

slide-120
SLIDE 120

Problem 1

Find the minimum pumping length for the language

✄ ✄ ✄ ✆
  • .

Solution: The minimum pumping length for

✂ ✂ ✂ ✁ ✁

is 4. Reason:

✂ ✂ ✂ ✝ ✂ ✂ ✂ ✁ ✁

but

✂ ✂ ✂

cannot be pumped. Hence, 3 is not a pumping length for

✂ ✂ ✂ ✁ ✁

. If

  • ✝
✂ ✂ ✂ ✁ ✁

and

✆
  • ✆
✁
  • can be pumped by

the division

  • ✁
✂✄ ✆

,

✂ ✁ ✂ ✂ ✂

,

✄ ✁ ✁

,

✆ ✁ ✁
  • ✂

.

The Pumping Lemma forRegular Languages – p.37/39

slide-121
SLIDE 121

Problem 2

Find the minimum pumping length for the language

✄
  • ✆
  • .

The Pumping Lemma forRegular Languages – p.38/39

slide-122
SLIDE 122

Problem 2

Find the minimum pumping length for the language

✄
  • ✆
  • .

Solution: The minimum pumping length of

✂ ✁ ✁ ✁

is 1.

The Pumping Lemma forRegular Languages – p.38/39

slide-123
SLIDE 123

Problem 2

Find the minimum pumping length for the language

✄
  • ✆
  • .

Solution: The minimum pumping length of

✂ ✁ ✁ ✁

is 1. Reason: the minimum pumping length for

✂ ✁ ✁ ✁

cannot be 0 because

  • is

in the language but cannot be pumped. Every nonempty string

  • ✝
✂ ✁ ✁ ✁

,

✆
  • ✆
✁ ✁

can be pumped by the division:

  • ✁
✂✄ ✆

,

✂ ✁
  • ,
✄

first character

  • f
  • and
✆

the rest of

  • .

The Pumping Lemma forRegular Languages – p.38/39

slide-124
SLIDE 124

Problem 3

Find the minimum pumping length for the language

✄
  • ✆
☎ ✄ ☎ ✆
  • ✆
✄
  • ✆

.

The Pumping Lemma forRegular Languages – p.39/39

slide-125
SLIDE 125

Problem 3

Find the minimum pumping length for the language

✄
  • ✆
☎ ✄ ☎ ✆
  • ✆
✄
  • ✆

.

Solution: The minimum pumping length for

✂ ✁ ✁ ☎ ✂ ☎ ✁ ✁
  • ✁
✂ ✁ ✁

is 3.

The Pumping Lemma forRegular Languages – p.39/39

slide-126
SLIDE 126

Problem 3

Find the minimum pumping length for the language

✄
  • ✆
☎ ✄ ☎ ✆
  • ✆
✄
  • ✆

.

Solution: The minimum pumping length for

✂ ✁ ✁ ☎ ✂ ☎ ✁ ✁
  • ✁
✂ ✁ ✁

is 3. Reason: The pumping length cannot be 2 because the string

✁ ✁

is in the language and it cannot be pumped. Let

  • be a string in the language
  • f length at least 3. If
  • is generated by
✂ ✁ ✁ ☎ ✂ ☎ ✁ ✁

we can write is as

  • ✁
✂✄ ✆

,

✂ ✁
  • ,
✄

is the first symbol of

  • , and
✆

is the rest of the string. If

  • is generated by
✁ ✂ ✁ ✁

we can write it as

  • ✁
✂✄ ✆

,

✂ ✁ ✁

,

✄ ✁ ✂

and

✆

is the remainder of

  • .

The Pumping Lemma forRegular Languages – p.39/39