Sei sulla pagina 1di 45

Pumping Lemma? Regular or not?

Minimization of FA

Examples on Pumping Lemma and Minimization of DFA


Zhao Qiao qzhao@cse.cuhk.edu.hk
Department of Computer Science & Engineering The Chinese University of Hong Kong

September 28, 2008

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Outline
1

Pumping Lemma? Adversary Argument Explanation Examples Regular or not? General Method Examples Minimization of FA Example

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Adversary Argument
Pumping Lemma L is regular (n)(z) z L, |z| n (u, v , w) (z = uvw, |uv | n, |v | 1) and (i)uv i w L

Adversary Argument L is not regular (n)(z) z L, |z| n, (u, v , w) (z = uvw, |uv | n, |v | 1) (i)uv i w /L

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Explanation
Using the adversary argument,we can verify a non-regular language L by the following game: Game Proof the adversary pick an arbitrary n to challenge us for a string z. ? we construct a special string z in L with length greater than or equal to n. the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less or equal to n. ? if we can always choose a i to show him that uv i w is not in L,then we win.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}

ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}


ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $? How to choose z in L?The following moves will mess with the rst n symbols of our z,and we have to make sure the outcome is not in L.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}

ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an bban

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}


ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an bban % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}


ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an bban % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n. $ u,v only contain a; w contains a trailing substring bban ,and maybe some leading as.If we set i = 0(pump v out),then uv i w = uw will have less leading as than its trailing as,so uw is not a palindrome.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Palindromes over {a, b}


ww R |w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an bban % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n. $ u,v only contain a; w contains a trailing substring bban ,and maybe some leading as.If we set i = 0(pump v out),then uv i w = uw will have less leading as than its trailing as,so uw is not a palindrome.

In fact,we can choose any i other than 1.


Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Twin strings over over {a, b}


ww|w {a, b} % the adversary pick an arbitrary n to challenge us for a string z.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Twin strings over over {a, b}


ww|w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an ban b

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Twin strings over over {a, b}


ww|w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an ban b % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Twin strings over over {a, b}


ww|w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an ban b % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n. $ u,v only contain a; w contains a trailing substring ban b,and maybe some leading as.If we set i = 0(pump v out),then uv i w = uw will have less leading as before the rst b than its as between 2 bs,so uw is not a twin string.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Adversary Argument Explanation Examples

Twin strings over over {a, b}


ww|w {a, b} % the adversary pick an arbitrary n to challenge us for a string z. $ we choose z = an ban b % the adversary arbitrarily break z into u, v and w,where v is not empty and uv s length less than or equal to n. $ u,v only contain a; w contains a trailing substring ban b,and maybe some leading as.If we set i = 0(pump v out),then uv i w = uw will have less leading as before the rst b than its as between 2 bs,so uw is not a twin string.

can we choose other is to win?


Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

General Method

To prove a language to be regular,we can use regular expression,DFA,NFA or - NFA to construct it directly.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

General Method

To prove a language to be regular,we can use regular expression,DFA,NFA or - NFA to construct it directly. We can also use the closure properties of regular languages: union,concatenation,Kleene closure, complement,intersection,substitution(quotient).

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

General Method

To prove a language to be regular,we can use regular expression,DFA,NFA or - NFA to construct it directly. We can also use the closure properties of regular languages: union,concatenation,Kleene closure, complement,intersection,substitution(quotient). To prove a language to be non-regular,we can use pumping lemma and the closure properties of regular languages.

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} Hints

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} Hints a concatenation & complement

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} b {waw|w L} Hints a concatenation & complement

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} b {waw|w L} Hints a concatenation & complement b like palindromespumping lemma

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} b {waw|w L} c {uv |u L, v /L} Hints a concatenation & complement b like palindromespumping lemma

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q1

L is a regular language over {a,b,c},Deicide whether the following languages are regular. Problems a {w|w L, a /w} b {waw|w L} c {uv |u L, v /L} Hints a concatenation & complement b like palindromespumping lemma c concatenation & complement

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs.

Hints

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs.

Hints a an b n

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired.

Hints a an b n

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired.

Hints a an b n b (n )n

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of as is a perfect cube.

Hints a an b n b (n )n

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of as is a perfect cube.

Hints a an b n b (n )n c n < (n + 1)3 n3

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of as is a perfect cube. d all non-palindromes over {a, b}.

Hints a an b n b (n )n c n < (n + 1)3 n3

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

General Method Examples

Q2
Prove that the following languages are non-regular. Problems a all strings over {a, b} with the same number of as and bs. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of as is a perfect cube. d all non-palindromes over {a, b}.

Hints a an b n b (n )n c n < (n + 1)3 n3 d closure property of complement

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
initial mark b c d e f g

X X a

X X b

X X c

X X d

X X e

mark nal and non-nal pair

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark ab b c d e f g X

X X a

X X b

X X c

X X d

X X e

(a, 0) = c, (b, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark ac b c d e f g X cd,be

X X a

X X b

X X c

X X d

X X e

(a, 0) = c, (c, 0) = d (a, 1) = b, (c, 1) = e

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark ad b c d e f g X cd,be cd,be X X a X X b X X c X X d X X e

(a, 0) = c, (d, 0) = d (a, 1) = b, (d, 1) = e

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark ae b c d e f g X cd,be cd,be X X X a

X X b

X X c

X X d

X X e

(a, 0) = c, (e, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark bc b c d e f g X cd,be cd,be X X X a X

X X b

X X c

X X d

X X e

(b, 0) = f , (c, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark bd b c d e f g X cd,be cd,be X X X a X X X X b X X c X X d X X e

(b, 0) = f , (d, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark be b c d e f g X cd,be cd,be X X X a X X X X b

X X c

X X d

X X e

(b, 0) = (e, 0) = f (b, 1) = (e, 1) = g

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark dc b c d e f g X cd,be cd,be X X X a X X X X b

X X c X X d X X e

(d, 0) = (c, 0) = d (d, 1) = (c, 1) = e

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark ec b c d e f g X cd,be cd,be X X X a X X X X b

X X X c

X X d

X X e

(e, 0) = f , (c, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark de b c d e f g X cd,be cd,be X X X a X X X X b

X X X c

X X X d

X X e

(d, 0) = d, (e, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
mark fg b c d e f g X cd,be cd,be X X X a X X X X b

X X X c

X X X d

X X e

X f

(f , 0) = d, (g, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Pumping Lemma? Regular or not? Minimization of FA

Example

Minimization of FA
merge non-distingushable states b c d e f g X cd,be cd,be X X X a X X X X b

X X X c

X X X d

X X e

X f

merge a,c,d and b,e

Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

Potrebbero piacerti anche