hw3 Tex
hw3 Tex
DFA-state on a on b
S0 = {A, B} (initial) S0 S1 = {C, D}
S1 = {C, D} S2 = {B, C, D} S3 = {D}
S2 = {B, C, D} S4 = {A, B, C, D} S1
S3 = {D} S3 S5 = ∅
S4 = {A, B, C, D} S4 S1
S5 = ∅ S5 S5
Accepting states that has D: {C, D}, {B, C, D}, {D}, {A, B, C, D}.
(2) Minimization
Initial partition:
{{S0 , S5 }, {S1 , S2 , S3 , S4 }} .
non-final final
Refinement steps:
[leftmargin=1.5cm]{S0 , S5 } 7→ {{S0 }, {S5 }} (on b, S0 → S1 final,
S5 → S5 non-final); {S1 , S2 , S3 , S4 } 7→ {{S3 }, {S1 , S2 , S4 }} (on b, only
S3 goes to non-final); {S1 , S2 , S4 } 7→ {{S1 }, {S2 , S4 }} (on b, S1 → S3 ,
S2 , S4 → S1 ).
No further splits occur. Thus the six original DFA states collapse to five
equivalence classes:
1
Renaming these
Q′′ = {q0 , q∅ , qD , qCD , qBCD },
one obtains the minimized DFA M ′′ :
state a b accept?
q0 (= {A, B}) (initial) q0 qCD no
qCD (= {C, D}) qBCD qD yes
qBCD (= {B, C, D} ∪ {A, B, C, D}) qBCD qCD yes
qD (= {D}) qD q∅ yes
q∅ q∅ q∅ no
Start state q0 , accepting states {qCD , qBCD , qD }.
L(M ) = { a∗ (b | bb)a∗ }.
Problem 2
Use the pumping lemma to prove that L = { ww : w ∈ {0, 1}} is non-regular.
The language
L = ww w ∈ {0, 1}
is not regular.
2
Decompose s = xyz. Because |xy| ≤ p, the entire block xy lies within
the first 0p . Hence
y = 0k for some 1 ≤ k ≤ p.
s′ = x y 0 z = xz = 0p−k 1p 0p 1p .
Problem 3
Prove that L = {ww | w ∈ {0, 1}∗ } is non-regular, where w is the bitwise
binary complement of w. For example, 0001 = 1110, so 00011110 ∈ L.
The language
L = {ww | w ∈ {0, 1}∗ }
is not regular.
2. |xy| ≤ p, and
Decompose s = xyz. Since |xy| ≤ p and the first p characters of s are all
0s, both x and y consist of only 0s. In particular,
y = 0k for some k ≥ 1.
3
Pump down (i = 0).
s′ = xy 0 z = xz = 0p−k 1p .
Now s′ does not belong to L, because it is no longer of the form ww — the
second half of the string is still 1p , but the first half is shorter than p 0s.
In fact, 0p−k = 1p−k ̸= 1p , so there is no string w such that s′ = ww.
Problem 4
Prove or disprove each of the following two statements:
1. Statement: If L1 and L2 are nonregular, then L1 ∪ L2 must be non-
regular.
Counterexample: Let
L1 = { an bn | n ≥ 0 }, L2 = { an bn | n ≥ 1 }.
Both L1 and L2 are nonregular (can be shown using the Pumping
Lemma). But:
L1 ∪ L2 = { an bn | n ≥ 0 } ∪ { an bn | n ≥ 1 } = { an bn | n ≥ 0 } = L1 ,
which is still nonregular. So this doesn’t yet disprove it.
Let’s try a better example.
Let
L1 = { ap | p is prime }, L2 = { an | n is not prime }.
Then both L1 and L2 are nonregular.
But
L1 ∪ L2 = { an | n ≥ 2 }
which is regular (a regular expression: aa(a)∗ ).
Therefore, L1 ∪ L2 can be regular even if L1 and L2 are nonregular.
Therefore, the statement is false.
4
2. Statement: If L1 and L2 are nonregular, then L1 · L2 must be non-
regular.
L1 = {0m 1n 2n | m, n ≥ 0},
L2 = {0n 2n 1m | m, n ≥ 0}.
0∗ 1∗ 2∗ 0∗ 2∗ 1∗ .