Pumping Lemma - Computability - Lecture Slide, Slides of Computer Science

Some concepts of Computability are Algorithmic Problems, Automata, Closure of Regular Languages, Computability, Free Languages, Machine Transforms, Magic Bullets, Minimization, Models of Computation, Nondeterministic Complexity. Important points in this lecture are: Pumping Lemma, Context Free Pumping, Motivation, Theorem, Proof, Proving Non-Context, Context Freeness, Examples on Slides, Examples on Blackboard, Paths of Length

Typology: Slides

2012/2013

Uploaded on 04/25/2013

rajnikanth
rajnikanth 🇮🇳

4.3

(32)

135 documents

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Context Free Pumping Lemma
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download Pumping Lemma - Computability - Lecture Slide and more Slides Computer Science in PDF only on Docsity!

Context Free Pumping Lemma

Agenda

Context Free Pumping

 Motivation

 Theorem

 Proof

Proving non-Context Freeness

 Examples on slides

 Examples on blackboard

Pumping PDA‟s

However, regular pumping lemma fails in

this example.

Q: Give an example of a pattern that

cannot be pumped.

r s

e , e$

q

e , $e

(, e X

), Xe

Pumping PDA‟s

A: (^ n^ )^ n^ can‟t be pumped in the first half.

However, could pump two substrings at

once. I.e. could take k left parens if

take k right parens. I.e. can “tandem

pump”.

r s

e , e$

q

e , $e

(, e X

), Xe

Tandem Pumping

A1: Yes. Any pumpable string is automatically

tandem pumpable by letting y = e. In our case, let u = e, v = 00, x = y = e, z = 111. uv ixy iz =(00)^ i111 is indeed in 0*111.

A2: Yes. Let u = e, v = 00, x = 1, y = 11

and z = e.

uv ixy iz =(00)^ i1(00)^ i^ is indeed in {0^ n 10 n}

A3: NO! Tandem pumping 00100100 leads

either to too many 1‟s, or would increase two

of the 0-streaks, without ability to increase

the remaining 0-streak.

Tandem Pumping

In general, since pumping automatically

implies tandem pumping, all (infinite)

regular languages are tandem

pumpable. Turns out, that all (infinite)

context free languages are as well. But

Q3 can be generalized to show that

{0^ n 10 n 10 n} does not admit tandem

pumping of strings which are past a

certain length. This will end up proving

that {0^ n 10 n 10 n} is not context free:

CFPL – Intuition

Intuitively s = uvxyz is found as follows: Only finitely

many stack changes possible at cycles in the graph

of length  n (the number of states). Thus if s is

long enough, there will have to be some states q,r

such that the same string is pushed at q as is

popped at r and such that the path from q to r starts

and ends with same stack configuration. With these

assumption, can then pump up v and y in tandem as

v pushes same stuff that y pops off.

q r

-x

p

s

-v^ -y

-z

-u

tk … t 2 t 1 sk … s 2 s 1

sk … s 2 s 1

CFPL - Proof

The previous can actually be formalized and

used to prove the Context Free Pumping

Lemma. However, this is actually quite

painful compared to very simple grammar-

theoretic proof:

Proof of CFPL: We may assume that the

language is in CNF. This is not an essential

assumption but it makes the proof a little

easier.

Consider a derivation tree in which some

occurring variable node has itself as an

ancestor:

c h u g a

f o r y o u

S

a A

c h o o

c h u g a

A

A

a n d a c h o o

And again:

CFPL – Proof

c h u g a

f o r y o u

S

a A

c h o o

c h u g a

A

c h o o

c h u g a

A

A

a n d a c h o o

CFPL – Proof

CFPL – Proof

f o r y o u

S

a A

a n d a

CFPL – Proof

In our particular case, we were able to

create any string of the form

a (chuga)^ i^ and a (choo)^ i^ for you

In general, any branch down the derivation

tree with a repeated variable gives rise to

strings of the form uv ixy iz all of which

are in L.

The end of the proof is just a counting

argument to see when a repeated

variable is guaranteed to occur.

CFPL – Proof

A: If n is the number of variables in the

grammar, any subtree of height h = n+

will have a repeated variable. This is

because the bottom row of a derivation

tree is composed of terminals, so height

n+1 (= n+2 levels) guarantees n+

levels of variables, at least on one branch

from the root. Pigeonhole principle

guarantees that some variable will be

encountered twice! Docsity.com

CFPL – Proof

Q: If the grammar is in CNF, what kind of

tree is any derivation tree?