180 likes | 193 Views
This article explores the Pumping Lemma and 2-Player Games as tools for proving the regularity or nonregularity of languages. It provides an overview of the Pumping Theorem, closure properties, and the Myhill-Nerode Theorem. It also explains how to use 2-Player Games to prove regularity/nonregularity and discusses their applications in various fields.
E N D
Pumping with Al and Izzy Richard Beigel CIS Temple University
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
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 [uviw L]
All those quantifiers make my brain hurt! N zsuch that z L and |z| N u,v,wsuch that z=uvw , |uv| N, and |v| > 0 i[uviw L]
For All There Izzy Al and Izzy to the Rescue!
2-Player Games • Players alternate turns • A record is kept of all plays • A strategy for a player maps a record to his next play • The final record is evaluated to see who won
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
Izzy picks m Al picks n such that n > 0 Izzy wins iffm < n m n such that n > 0 m < n Example: ( m) ( n > 0)[m<n] The Game The Predicate Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false.
Izzy picks m Al picks n such that n > 0 Izzy wins iffm > n m n such that n > 0 m > n Example: ( m) ( n > 0)[m>n] The Game The Predicate Izzy has a winning strategy iff the predicate is true. Al has a winning strategy iff the predicate is false.
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.
Q is a quantifier, I.e., or Izzy has a winning strategy iff the predicate is true.Al has a winning strategy iff the predicate is false. • Inductive case: P = (Qx) P(x, x2,…, xn+1) where P has n quantifiers. • Case 1: Q = . • If P is true, there is a value c such that P(c, x2,…, xn+1) is true. Izzy picks x = c and then continues with his winning strategy (by I.H.) for P(c, x2,…, xn+1). • If P is false, every value c makes P(c, x2,…, xn+1) false. Al just uses his strategy (by I.H.) for P(c, x2,…, xn+1)
Izzy has a winning strategy iff the predicate is true.Al has a winning strategy iff the predicate is false. • Inductive case: P = (Qx) P(x, x2,…, xn+1) where P has n quantifiers. • Case 2: Q = . • If P is true, every value c makes P(c, x2,…, xn+1) true. Izzy just uses his winning strategy (by I.H.) for P(c,x2,…,xn+1). • If P is false, there is a value c such that P(c, x2,…, xn+1) is false. Al picks x = c and then continues with his strategy (by I.H.) for P(c, x2,…, xn+1)
Izzy picks N Al picks z such that z L and |z| N Izzy picks u,v,w such that z = uvw, |uv| N, and |v| > 0 Al picks i Izzy wins iffuviw L N z such that z L and |z| N u,v,w such that z = uvw , |uv| N, and |v| > 0 i uviw L Al and Izzy Pumping Game Predicate
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!
Izzy picks N Al picks z such that z L and |z| N Izzy picks u,v,w such that z = uvw, |uv| N, and |v| > 0 Al picks i Izzy wins iffuviw L Al wins iffuviwL Let z = aN bN v = ak where k > 0 Let i = 0 uviw = uw = aNkbNL since k > 0 A winning strategy for Al proves {an bn : n 0} is not regular
Izzy picks N Al picks z such that z L and |z| N Izzy picks u,v,w such that z = uvw, |uv| N, and |v| > 0 Al picks i Izzy wins iffuviw L Al wins iffuviwL Let z = ap where p is prime and p N v = ak where k > 0 Let i = p + 1 uviw = uvv(i1)w = a(p+(i1)k) = a(p+pk) = ap(k+1) L since k>0 A winning strategy for Al proves {an: n is prime} is not regular
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
What else? 2-player games are also useful in • cryptography • security • interactive proofs • zero-knowledge proofs