Review Languages and Grammars Alphabets, strings, languages - - PDF document

review
SMART_READER_LITE
LIVE PREVIEW

Review Languages and Grammars Alphabets, strings, languages - - PDF document

Review Languages and Grammars Alphabets, strings, languages Regular Languages CS 301 - Lecture 7 Deterministic Finite Automata Nondeterministic Finite Automata More Pumping Lemma Equivalence of NFA and DFA Minimizing a


slide-1
SLIDE 1

1

CS 301 - Lecture 7 More Pumping Lemma

Fall 2008

Review

  • Languages and Grammars

– Alphabets, strings, languages

  • Regular Languages

– Deterministic Finite Automata – Nondeterministic Finite Automata – Equivalence of NFA and DFA – Minimizing a DFA – Regular Expressions – Regular Grammars – Properties of Regular Languages – Pumping lemma for Regular Languages

  • Today:

– More pumping lemma for regular languages

The Pumping Lemma:

  • Given a infinite regular language L
  • there exists an integer

m

  • for any string with length

L w∈ m w ≥ | |

  • we can write

z y x w =

  • with and

m y x ≤ | | 1 | | ≥ y

  • such that:

L z y x

i

∈ ... , 2 , 1 , = i

Theorem: The language

} : { ≥ = n b a L

n n is not regular

Proof:

Use the Pumping Lemma

slide-2
SLIDE 2

2

Assume for contradiction that is a regular language

L

Since is infinite we can apply the Pumping Lemma

L } : { ≥ = n b a L

n n Let be the integer in the Pumping Lemma Pick a string such that:

w L w ∈ m w ≥ | |

length m mb

a w =

We pick

m } : { ≥ = n b a L

n n it must be that length From the Pumping Lemma

1 | | , | | ≥ ≤ y m y x b ab aa aa a b a xyz

m m

... ... ... ... = = 1 , ≥ = k a y

k

x y z m m

Write:

z y x b a

m m

=

Thus: From the Pumping Lemma:

L z y x

i

∈ ... , 2 , 1 , = i

Thus: m mb

a z y x = L z y x ∈

2

1 , ≥ = k a y

k

slide-3
SLIDE 3

3

From the Pumping Lemma:

L b ab aa aa aa a z xy ∈ = ... ... ... ... ...

2

x y z k m + m

Thus:

L z y x ∈

2 m mb

a z y x = 1 , ≥ = k a y

k

y L b a

m k m

+

L b a

m k m

+

} : { ≥ = n b a L

n n

BUT:

L b a

m k m

+

CONTRADICTION!!!

Our assumption that is a regular language is not true

L Conclusion: L is not a regular language

Therefore: Regular languages Non-regular languages

} : { ≥ n b a

n n

slide-4
SLIDE 4

4

More Applications

  • f

the Pumping Lemma

Regular languages Non-regular languages

*} : { Σ ∈ = v vv L

R

Theorem: The language

is not regular

Proof:

Use the Pumping Lemma

*} : { Σ ∈ = v vv L

R

} , { b a = Σ

Assume for contradiction that is a regular language

L

Since is infinite we can apply the Pumping Lemma

L

*} : { Σ ∈ = v vv L

R

slide-5
SLIDE 5

5

m m m m

a b b a w =

We pick Let be the integer in the Pumping Lemma Pick a string such that:

w L w ∈ m w ≥ | |

length

m

and

*} : { Σ ∈ = v vv L

R Write

z y x a b b a

m m m m

=

it must be that length From the Pumping Lemma

a ba bb ab a aa a xyz ... ... ... ... ... ... = x y z m m m m 1 | | , | | ≥ ≤ y m y x 1 , ≥ = k a y

k Thus: From the Pumping Lemma:

L z y x

i

∈ ... , 2 , 1 , = i

Thus:

L z y x ∈

2

1 , ≥ = k a y

k m m m m

a b b a z y x =

From the Pumping Lemma:

L a ba bb ab a aa aa a z xy ?¸ ... ... ... ... ... ... ... =

2

x y z

k m +

m m m 1 , ≥ = k a y

k

y L z y x ∈

2 Thus: m m m m

a b b a z y x = L a b b a

m m m k m

+

slide-6
SLIDE 6

6 L a b b a

m m m k m

+

L a b b a

m m m k m

+

BUT: CONTRADICTION!!!

1 ≥ k

*} : { Σ ∈ = v vv L

R Our assumption that is a regular language is not true

L Conclusion: L is not a regular language

Therefore: Regular languages Non-regular languages

} , : { ≥ =

+

l n c b a L

l n l n

Theorem: The language

is not regular

Proof:

Use the Pumping Lemma

} , : { ≥ =

+

l n c b a L

l n l n

slide-7
SLIDE 7

7

Assume for contradiction that is a regular language

L

Since is infinite we can apply the Pumping Lemma

L } , : { ≥ =

+

l n c b a L

l n l n m m m

c b a w

2

=

We pick Let be the integer in the Pumping Lemma Pick a string such that:

w L w ∈ m w ≥ | |

length

m } , : { ≥ =

+

l n c b a L

l n l n and Write

z y x c b a

m m m

=

2 it must be that length From the Pumping Lemma

c cc bc ab aa aa a xyz ... ... ... ... ... ... = x y z m m m 2 1 | | , | | ≥ ≤ y m y x 1 , ≥ = k a y

k Thus: From the Pumping Lemma:

L z y x

i

∈ ... , 2 , 1 , = i

Thus: m m m

c b a z y x

2

= 1 , ≥ = k a y

k

slide-8
SLIDE 8

8

From the Pumping Lemma:

L c cc bc ab aa a xz ∈ = ... ... ... ... ... x z k m − m m 2

m m m

c b a z y x

2

= 1 , ≥ = k a y

k

L xz ∈

Thus:

L c b a

m m k m

− 2

L c b a

m m k m

− 2

L c b a

m m k m

− 2

BUT: CONTRADICTION!!!

} , : { ≥ =

+

l n c b a L

l n l n

1 ≥ k

Our assumption that is a regular language is not true

L Conclusion: L is not a regular language

Therefore: Regular languages Non-regular languages

} : {

!

≥ = n a L

n

slide-9
SLIDE 9

9

Theorem: The language

is not regular

Proof:

Use the Pumping Lemma

} : {

!

≥ = n a L

n

n n n ⋅ − ⋅ = ) 1 ( 2 1 ! 

Assume for contradiction that is a regular language

L

Since is infinite we can apply the Pumping Lemma

L } : {

!

≥ = n a L

n ! m

a w =

We pick Let be the integer in the Pumping Lemma Pick a string such that:

w L w ∈ m w ≥ | |

length

m } : {

!

≥ = n a L

n Write

z y x am =

! it must be that length From the Pumping Lemma

a aa aa aa aa a a xyz

m

... ... ... ... ...

! =

= x y z m m m − ! 1 | | , | | ≥ ≤ y m y x m k a y

k

≤ ≤ = 1 ,

Thus:

slide-10
SLIDE 10

10

From the Pumping Lemma:

L z y x

i

∈ ... , 2 , 1 , = i

Thus: ! m

a z y x = L z y x ∈

2

m k a y

k

≤ ≤ = 1 ,

From the Pumping Lemma:

L a aa aa aa aa aa a z xy ∈ = ... ... ... ... ... ...

2

x y z k m + m m − !

Thus: ! m

a z y x = m k a y

k

≤ ≤ = 1 , L z y x ∈

2

y L a

k m

+ !

L a

k m

+ !

! ! p k m = + } : {

!

≥ = n a L

n Since:

m k ≤ ≤ 1

There must exist such that:

p

However:

)! 1 ( ) 1 ( ! ! ! ! ! ! + = + = + < + ≤ + ≤ m m m m m m m m m m k m + !

for

1 > m )! 1 ( ! + < + m k m ! ! p k m ≠ +

for any p

slide-11
SLIDE 11

11 L a

k m

+ !

L a

k m

+ !

BUT: CONTRADICTION!!!

} : {

!

≥ = n a L

n

m k ≤ ≤ 1

Our assumption that is a regular language is not true

L Conclusion: L is not a regular language

Therefore:

What’s Next

  • Read

– Linz Chapter 1, 2.1, 2.2, 2.3, (skip 2.4) 3, 4, 5.1-5.3 – JFLAP Startup, Chapter 1, 2.1, 3, 4, 6.1

  • Next Lecture Topics from Chapter 5.1-5.3

– Context Free Grammars

  • Quiz 1 in Recitation on Wednesday 9/17

– Covers Linz 1.1, 1.2, 2.1, 2.2, 2.3 and JFLAP 1, 2.1 – Closed book, but you may bring one sheet of 8.5 x 11 inch paper with any notes you like. – Quiz will take the full hour

  • Homework

– Homework Due Thursday