Examples on Pumping Lemma and Minimization of DFA Zhao Qiao - - PowerPoint PPT Presentation

examples on pumping lemma and minimization of dfa
SMART_READER_LITE
LIVE PREVIEW

Examples on Pumping Lemma and Minimization of DFA Zhao Qiao - - PowerPoint PPT Presentation

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


slide-1
SLIDE 1

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

slide-2
SLIDE 2

Pumping Lemma? Regular or not? Minimization of FA

Outline

1

Pumping Lemma? Adversary Argument Explanation Examples

2

Regular or not? General Method Examples

3

Minimization of FA Example

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-3
SLIDE 3

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)uviw ∈ L
  • Adversary Argument

L is not regular ⇐ (∀n)(∃z)

  • z ∈ L, |z| ≥ n,

(∀u, v, w)

  • (z = uvw, |uv| ≤ n, |v| ≥ 1) ⇒ (∃i)uviw ∈

/L

  • Zhao Qiao qzhao@cse.cuhk.edu.hk

Examples on Pumping Lemma and Minimization of DFA

slide-4
SLIDE 4

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

  • r 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 uviw is not in L,then we win.

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-5
SLIDE 5

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

Palindromes over {a, b}

  • wwR|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

slide-6
SLIDE 6

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

Palindromes over {a, b}

  • wwR|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 first n symbols of our z,and we have to make sure the

  • utcome is not in L.

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-7
SLIDE 7

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

Palindromes over {a, b}

  • wwR|w ∈ {a, b}∗

✪ the adversary pick an arbitrary n to challenge us for a string z. ✩ we choose z = anbban ✌

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-8
SLIDE 8

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

Palindromes over {a, b}

  • wwR|w ∈ {a, b}∗

✪ the adversary pick an arbitrary n to challenge us for a string z. ✩ we choose z = anbban ✪ 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

slide-9
SLIDE 9

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

Palindromes over {a, b}

  • wwR|w ∈ {a, b}∗

✪ the adversary pick an arbitrary n to challenge us for a string z. ✩ we choose z = anbban ✪ 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 a’s.If we set i = 0(pump v out),then uviw = uw will have less leading a’s than its trailing a’s,so uw is not a palindrome.✌ ✌

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-10
SLIDE 10

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

Palindromes over {a, b}

  • wwR|w ∈ {a, b}∗

✪ the adversary pick an arbitrary n to challenge us for a string z. ✩ we choose z = anbban ✪ 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 a’s.If we set i = 0(pump v out),then uviw = uw will have less leading a’s than its trailing a’s,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

slide-11
SLIDE 11

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

slide-12
SLIDE 12

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 = anbanb ✌

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-13
SLIDE 13

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 = anbanb ✪ 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

slide-14
SLIDE 14

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 = anbanb ✪ 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 banb,and maybe some leading a’s.If we set i = 0(pump v out),then uviw = uw will have less leading a’s before the first b than its a’s between 2 b’s,so uw is not a twin string.✌ ✌

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-15
SLIDE 15

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 = anbanb ✪ 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 banb,and maybe some leading a’s.If we set i = 0(pump v out),then uviw = uw will have less leading a’s before the first b than its a’s between 2 b’s,so uw is not a twin string.✌ ✌ can we choose other i’s to win?

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-16
SLIDE 16

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

slide-17
SLIDE 17

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

slide-18
SLIDE 18

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

slide-19
SLIDE 19

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

slide-20
SLIDE 20

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

slide-21
SLIDE 21

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

slide-22
SLIDE 22

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 palindromes→pumping lemma

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-23
SLIDE 23

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 palindromes→pumping lemma

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-24
SLIDE 24

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 palindromes→pumping lemma c concatenation & complement

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-25
SLIDE 25

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 a’s and b’s. Hints

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-26
SLIDE 26

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 a’s and b’s. Hints a anbn

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-27
SLIDE 27

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. Hints a anbn

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-28
SLIDE 28

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. Hints a anbn b (n)n

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-29
SLIDE 29

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of a’s is a perfect cube. Hints a anbn b (n)n

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-30
SLIDE 30

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of a’s is a perfect cube. Hints a anbn b (n)n c n < (n + 1)3 − n3

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-31
SLIDE 31

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of a’s is a perfect cube. d all non-palindromes over {a, b}. Hints a anbn b (n)n c n < (n + 1)3 − n3

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-32
SLIDE 32

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 a’s and b’s. b all strings over (, ) in which the parentheses are paired. c all strings over {a, b} in which the number of a’s is a perfect cube. d all non-palindromes over {a, b}. Hints a anbn 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

slide-33
SLIDE 33

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • initial mark

b c d e f X X X X X g X X X X X a b c d e f mark final and non-final pair

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-34
SLIDE 34

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark ab

b X c d e f X X X X X g X X X X X a b c d e f δ(a, 0) = c, δ(b, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-35
SLIDE 35

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark ac

b X c cd,be d e f X X X X X g X X X X X a b c d e f δ(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

slide-36
SLIDE 36

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark ad

b X c cd,be d cd,be e f X X X X X g X X X X X a b c d e f δ(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

slide-37
SLIDE 37

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark ae

b X c cd,be d cd,be e X f X X X X X g X X X X X a b c d e f δ(a, 0) = c, δ(e, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-38
SLIDE 38

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark bc

b X c cd,be X d cd,be e X f X X X X X g X X X X X a b c d e f δ(b, 0) = f, δ(c, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-39
SLIDE 39

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark bd

b X c cd,be X d cd,be X e X f X X X X X g X X X X X a b c d e f δ(b, 0) = f, δ(d, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-40
SLIDE 40

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark be

b X c cd,be X d cd,be X e X

  • f

X X X X X g X X X X X a b c d e f δ(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

slide-41
SLIDE 41

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark dc

b X c cd,be X d cd,be X

  • e

X

  • f

X X X X X g X X X X X a b c d e f δ(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

slide-42
SLIDE 42

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark ec

b X c cd,be X d cd,be X

  • e

X

  • X

f X X X X X g X X X X X a b c d e f δ(e, 0) = f, δ(c, 0) = d

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-43
SLIDE 43

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark de

b X c cd,be X d cd,be X

  • e

X

  • X

X f X X X X X g X X X X X a b c d e f δ(d, 0) = d, δ(e, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-44
SLIDE 44

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • mark fg

b X c cd,be X d cd,be X

  • e

X

  • X

X f X X X X X g X X X X X X a b c d e f δ(f, 0) = d, δ(g, 0) = f

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA

slide-45
SLIDE 45

Pumping Lemma? Regular or not? Minimization of FA Example

Minimization of FA

  • merge non-distingushable states

b X c cd,be X d cd,be X

  • e

X

  • X

X f X X X X X g X X X X X X a b c d e f merge a,c,d and b,e

Zhao Qiao qzhao@cse.cuhk.edu.hk Examples on Pumping Lemma and Minimization of DFA