Presentation is loading. Please wait.

Presentation is loading. Please wait.

Pumping with Al and Izzy Richard Beigel CIS Temple University.

Similar presentations


Presentation on theme: "Pumping with Al and Izzy Richard Beigel CIS Temple University."— Presentation transcript:

1

2 Pumping with Al and Izzy Richard Beigel CIS Temple University

3 Fundamental question: Which languages are regular and which are not? To prove L is regular –give a regular expression that generates L (definition) –construct an NFA that accepts L –use closure properties To prove L is not regular, use –Myhill-Nerode Theorem (  many prefix-inequivalent strings) –Pumping Theorem –closure properties

4 The Pumping Theorem for Regular Languages If L is regular then  N  z such that z  L and |z|  N  u,v,w such that z = uvw, |uv|  N, and |v| > 0  i [uv i w  L]

5 All those quantifiers make my brain hurt!  N  z such that z  L and |z|  N  u,v,w such that z=uvw, |uv|  N, and |v| > 0  i [uv i w  L]

6 Al and Izzy to the Rescue !  For All  There Izzy

7 2-Player Games Players alternate turns A record is kept of all plays A strategy for a player maps a record to his next playA strategy for a player maps a record to his next play The final record is evaluated to see who won

8 Players alternate turns A record is kept of all plays O O X O XX O

9 A strategy for a player maps a record to his next play O X O O O X O O O X A strategy is called winning if the player who uses it always wins.

10 The final record is evaluated to see who won O O X O XX O O wins

11 For each predicate there is a corresponding 2-player game As the formula is read left-to-right –Izzy picks values under each existential (  ) quantifier –Al picks values under each universal (  ) quantifier Izzy wins iff the base predicate is true for the selected values

12 Example: (  m) (  n > 0)[m < n] The Game The Predicate 1 Izzy picks m 2 Al picks n such that n > 0 Izzy wins iff m < n  m  n such that n > 0 m < n Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false.

13 Example: (  m) (  n > 0)[m > n] The Game The Predicate 1 Izzy picks m 2 Al picks n such that n > 0 Izzy wins iff m > n  m  n such that n > 0 m > n Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false.

14 Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false. Proof by induction on the number of quantifiers in P Inductive hypothesis (I.H.): If P is a predicate with n quantifiers and n variables, then P is true iff Izzy has a winning strategy in the corresponding game, and P is false iff Al has a winning strategy. Base case: n = 0. Then P is a Boolean constant, and Izzy wins iff P = true.

15 Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false. Inductive case: P = (Q x) P(x, x 2,…, x n+1 ) where P has n quantifiers. Case 1: Q = . –If P is true, there is a value c such that P(c, x 2,…, x n+1 ) is true. Izzy picks x = c and then continues with his winning strategy (by I.H.) for P(c, x 2,…, x n+1 ). –If P is false, every value c makes P(c, x 2,…, x n+1 ) false. Al just uses his strategy (by I.H.) for P(c, x 2,…, x n+1 ) Q is a quantifier, I.e.,  or 

16 Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false. Inductive case: P = (Q x) P(x, x 2,…, x n+1 ) where P has n quantifiers. Case 2: Q = . –If P is true, every value c makes P(c, x 2,…, x n+1 ) true. Izzy just uses his winning strategy (by I.H.) for P(c,x 2,…,x n+1 ). –If P is false, there is a value c such that P(c, x 2,…, x n+1 ) is false. Al picks x = c and then continues with his strategy (by I.H.) for P(c, x 2,…, x n+1 )

17 Al and Izzy Pumping Game Predicate 1 Izzy picks N 2 Al picks z such that z  L and |z|  N 3 Izzy picks u,v,w such that z = uvw, |uv|  N, and |v| > 0 4 Al picks i Izzy wins iff uv i w  L  N  z such that z  L and |z|  N  u,v,w such that z = uvw, |uv|  N, and |v| > 0  i uv i w  L

18 A paradigm for proving nonregularity If L is regular then the predicate given by the pumping theorem is true. If Al has a winning strategy then the predicate given by the pumping theorem is false then L is not regular. To prove nonregularity, just give a winning strategy for Al!

19 A winning strategy for Al proves {a n b n : n  0} is not regular 1 Izzy picks N 2 Al picks z such that z  L and |z|  N 3 Izzy picks u,v,w such that z = uvw, |uv|  N, and |v| > 0 4 Al picks i Izzy wins iff uv i w  L Al wins iff uv i w  L Let z = a N b N v = a k where k > 0 Let i = 0 uv i w = uw = a N  k b N  L since k > 0

20 A winning strategy for Al proves {a n : n is prime} is not regular 1 Izzy picks N 2 Al picks z such that z  L and |z|  N 3 Izzy picks u,v,w such that z = uvw, |uv|  N, and |v| > 0 4 Al picks i Izzy wins iff uv i w  L Al wins iff uv i w  L Let z = a p where p is prime and p  N v = a k where k > 0 Let i = p + 1 uv i w = uvv (i  1) w = a (p+(i  1)k) = a (p+pk) = a p(k+1)  L since k>0

21 Summary Predicates are equivalent to 2-player games You can prove or disprove a predicate by giving a winning strategy You can prove a language is nonregular by giving a winning strategy for Al in the pumping game

22 What else? 2-player games are also useful in –cryptography –security –interactive proofs –zero-knowledge proofs


Download ppt "Pumping with Al and Izzy Richard Beigel CIS Temple University."

Similar presentations


Ads by Google