90
CS250: Discrete Math for Computer Science L31: Proving Languages are Not Recognized by any DFA

CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

CS250: Discrete Math for Computer Science

L31: Proving Languages are Not Recognized by any DFA

Page 2: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:

{w ∈ {a,b}?

∣∣ #b(w) ≡ 1 (mod 2)}

L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 3: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:{

w ∈ {a,b}?∣∣ #b(w) ≡ 1 (mod 2)

}L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 4: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:{

w ∈ {a,b}?∣∣ #b(w) ≡ 1 (mod 2)

}L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 5: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:{

w ∈ {a,b}?∣∣ #b(w) ≡ 1 (mod 2)

}L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 6: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:{

w ∈ {a,b}?∣∣ #b(w) ≡ 1 (mod 2)

}L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 7: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which Languages are Recognized by DFAs?

So far we have seen that the following languages have DFAsthat recognize them and regular expressions that denote them:{

w ∈ {a,b}?∣∣ #b(w) ≡ 1 (mod 2)

}L(a∗ba∗(ba∗ba∗)∗)

{w ∈ {0,1}∗

∣∣ next to last symbol is 1}

L((0|1)∗1(0|1))

{w ∈ {a,b}?

∣∣∣∣ #a(w) ≡ 1 (mod 2) ∧#b(w) ≡ 0 (mod 3)

}?

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

L(1∗01∗0(0|1)∗)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

L((0|1)∗(001|100)(0|1)∗)

Page 8: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 9: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 10: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 11: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 12: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 13: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

0

0,1

Page 14: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

{w ∈ {0,1}∗

∣∣ w has at least two 0’s}

= L(1∗01∗0(0|1)∗)

Build a DFA D4 s.t. L(D4) = L(1∗01∗0(0|1)∗)

1∗D4

1

1∗01∗

0

1

qf

00,1

Page 15: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which languages are recognized by DFA or denoted byregular expressions?

How can we prove a language, L, is not recognized by anyDFA?

Idea: must show that need more than a bounded size memoryto remember what we have seen so far, x , in order to decide ifextensions of x belong to L.

Page 16: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which languages are recognized by DFA or denoted byregular expressions?

How can we prove a language, L, is not recognized by anyDFA?

Idea: must show that need more than a bounded size memoryto remember what we have seen so far, x , in order to decide ifextensions of x belong to L.

Page 17: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Which languages are recognized by DFA or denoted byregular expressions?

How can we prove a language, L, is not recognized by anyDFA?

Idea: must show that need more than a bounded size memoryto remember what we have seen so far, x , in order to decide ifextensions of x belong to L.

Page 18: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Page 19: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Page 20: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Page 21: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Page 22: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 23: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 24: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 25: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 26: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101

∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 27: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 28: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4),

k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 29: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 30: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4),

k = 3 : 1110101 ∈ L(D4), . . .

Page 31: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 10101 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= ε y def

= 1 z def= 0101 ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 0101 ∈ L(D4), k = 1 : 10101 ∈ L(D4),

k = 2 : 110101 ∈ L(D4), k = 3 : 1110101 ∈ L(D4), . . .

Page 32: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 33: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 34: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 35: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 36: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε

∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 37: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 38: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4),

k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 39: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 40: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4),

k = 3 : 00000 ∈ L(D4), . . .

Page 41: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F )

be a DFA, n = |Q|w ∈ L(D) s.t. |w | ≥ n

Then ∃x , y , z ∈ Σ? s.t.

1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

1∗D4

1

1∗01∗

0

1

qf

00,1

n = 3, w = 000 ∈ L(D4), |w | ≥ 3

Split w into x · y · z s.t. 1 ∧ 2 ∧ 3 ∧ 4

x def= 00 y def

= 0 z def= ε ∀k ≥ 0 (xykz ∈ L(D4))

k = 0 : 00 ∈ L(D4), k = 1 : 000 ∈ L(D4),

k = 2 : 0000 ∈ L(D4), k = 3 : 00000 ∈ L(D4), . . .

Page 42: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 43: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 44: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 45: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 46: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 47: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

proof: Let w ∈ L(D), |w | ≥ n, w = w1,w2, . . . ,wn · u

w = w1 w2 w3 · · · wn uq0 q1 q2 q3 · · · qn−1 qn qf

By Pigeon-Hole Principle ∃i < j ≤ n (qi = qj)

w =

x︷ ︸︸ ︷w1 . . .wi

y︷ ︸︸ ︷wi+1 . . .wj

z︷ ︸︸ ︷wj+1 . . .wnu

q0 qi qi qf

qi = δ?(qi , y) |y | ≥ 1 δ?(qi , z) = qf ∈ F

Thus, xykz ∈ L(D) for k = 0,1,2, . . . �

Page 48: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Easiest tool to prove languages not DFA acceptable

Page 49: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular Sets:Let D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

Let w ∈ L(D) s.t. |w | ≥ n.

Then ∃x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Easiest tool to prove languages not DFA acceptable

Page 50: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 51: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 52: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)

Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 53: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 54: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 55: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 56: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 57: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 58: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

F

Therefore E is not DFA acceptable. �

Page 59: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: E ={

ar br∣∣ r ∈ N

}is not DFA acceptable.

proof by contradiction:Assume: E is accepted by DFA D with n states.

you (G) choose string: w ∈ E = L(D)Let w = anbn

By pumping lemma, D chooses x , y , z ∈ {a,b}?, s.t.,

1. w = anbn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ E )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an−ibn ∈ E .

but an−ibn 6∈ E .

FTherefore E is not DFA acceptable. �

Page 60: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 61: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 62: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D)

Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 63: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 64: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 65: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 66: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 67: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 68: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

F

Therefore M is not DFA acceptable. �

Page 69: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: M ={

w ∈ {a,b}?∣∣ #a(w) > #b(w)

}not DFA-acceptable.

proof by contradiction:Assume: M is accepted by DFA D with n states.

you choose string: w ∈ M = L(D) Let w = an+1bn

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = an+1bn = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ M )

Since 0 < |xy | ≤ n, y = ai , 0 < i ≤ n

Thus xy0z = an+1−ibn ∈ M.

but an+1−ibn 6∈ M.

FTherefore M is not DFA acceptable. �

Page 70: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted

by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 71: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 72: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 73: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 74: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 75: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 76: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 77: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 78: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

F

Therefore P is not regular. �

Page 79: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Prop: P ={

w ∈ {a,b}?∣∣ |w | is prime

}is not DFA acceptable.

proof: Assume: P is accepted by DFA D with n states.

you choose string: w ∈ P = L(D) to get contradiction

Let w = ap where p ≥ n is prime

By pumping lemma, D chooses x , y , z ∈ {a,b}∗ s.t.

1. w = ap = xyz2. |xy | ≤ n3. |y | > 0, and4. ∀k ∈ N ( xykz ∈ P )

y = ai , 0 < i ≤ n

Thus xyp+1z = xyzyp = apap·i = ap(i+1) ∈ P.

but p(i + 1) is not prime, so xyp+1z 6∈ P.

FTherefore P is not regular. �

Page 80: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular SetsLet D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

You (G) choose w ∈ L(D) s.t. |w | ≥ n.

Then D chooses x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Finally, you point out why a contradiction ensues.

Page 81: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Pumping Lemma for Regular SetsLet D = (Q,Σ, δ,q0,F ) be a DFA.

Let n = |Q|.

You (G) choose w ∈ L(D) s.t. |w | ≥ n.

Then D chooses x , y , z ∈ Σ? s.t. the following all hold:1. xyz = w

2. |xy | ≤ n

3. |y | > 0, and

4. ∀k ≥ 0 (xykz ∈ L(D))

Finally, you point out why a contradiction ensues.

Page 82: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 83: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 84: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 85: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 86: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 87: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 88: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Preview: Nondeterministic Finite Automata (NFA)

{w ∈ {0,1}∗

∣∣ w has 001 or 100}

= L((0|1)∗(001|100)(0|1)∗)

Build an NFA N5 that accepts L((0|1)∗(001|100)(0|1)∗)

ε

0,1

N5

0

0

1

1

100

000

qf

0

1 0,1

Page 89: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Goal for Friday

Kleene’s Theorem Let A ⊆ Σ? be any language. Then thefollowing are equivalent:

1. A = L(D), for some DFA D.

2. A = L(N), for some NFA N wo ε transitions.

3. A = L(N), for some NFA N.

4. A = L(e), for some regular expression e.

5. A is regular.

True by definition: (4)⇔ (5)

Page 90: CS250: Discrete Math for Computer SciencePumping Lemma for Regular Sets: Let D = (Q; ; ;q0;F) be a DFA, n = jQj w 2L(D) s.t. jwj n Then 9x;y;z 2? s.t. 1. xyz = w 2. jxyj n 3. jyj>0,

Goal for Friday

Kleene’s Theorem Let A ⊆ Σ? be any language. Then thefollowing are equivalent:

1. A = L(D), for some DFA D.

2. A = L(N), for some NFA N wo ε transitions.

3. A = L(N), for some NFA N.

4. A = L(e), for some regular expression e.

5. A is regular.

True by definition: (4)⇔ (5)