0% found this document useful (0 votes)
15 views14 pages

Chapter6 Sample

Chapter 6 discusses finite state machines and their properties, including various exercises and examples related to languages and substrings. It covers topics such as the construction of languages, operations on sets, and theorems related to concatenation and closure properties. The chapter also includes recursive definitions and proofs related to the structure of languages.

Uploaded by

Ganesh Iyyappan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views14 pages

Chapter6 Sample

Chapter 6 discusses finite state machines and their properties, including various exercises and examples related to languages and substrings. It covers topics such as the construction of languages, operations on sets, and theorems related to concatenation and closure properties. The chapter also includes recursive definitions and proofs related to the structure of languages.

Uploaded by

Ganesh Iyyappan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

CHAPTER 6

LANGUAGES: FINITE STATE MACHINES


Section 6.1

1. (a) 25; 125 (b) = 3906

2. (a) (b) ( ) (c) (d) + + 3


3. 12
4. (a) 0 (b) 0 (c) 1 (d) 2
(e) 3 (f) 4 (g) 1 (h) 0

5.
6. There are 100 substrings of length 1: …, ; 99 substrings of length 2:
, ,…, ;…; 1 substring of length 100: …. . So there are 100+

99 + ... + 1 = = (100)(101)/2 = 5050 nonempty substrings in total.


7. (a) {00,11, 000,111, 0000,1111}
(b) {0,1}
(c) Σ* - { , 00, 11, 000, 111, 0000, 1111}
(d) {0,1,00,11)}
(e) Σ

(f) Σ* - {0, 1, 00, 11} = { , 01, 10} ∪ { | || ||≥ 3}


8. (a) AB = {1000, 101, 1100, 111}
(b) BA = {0010,0011, 110, 111}
(c) A³ = {101010, 101011, 101110, 111010, 101111, 111011, 111110, 111111}
(d) B² = {0000, 001, 100, 11}.

9. (a) ∈ AC => = ac, for some a ∈ A, c ∈ C => ∈ BD, since A B, C D.

(b) If A ≠ , let ∈A . ∈ A => = , for some ∈ A, c ∈ . But ∈ . is impossible. Hence A = .


[In like manner A = ].
10. (a) AB = { } (b) BA = { } (c) B³ = { }

(d) ={ } (e) A* = { ,...} = { } ∪ { ∈ Z+}


11. For any alphabet ∑, let B ∑. Then, if A = B*, it follows from part (f) of Theorem 6.2
that A* = (B*)* = B* = A.

167
12. (a) Yes (b) Yes (c) Yes
(d) Yes (e) No (f) Yes
13. (a) Here A* consists of all strings of even length where if ≠ , then starts with 0
and ends with 1, and the symbols (0 and 1) alternate.

(b) In this case A* contains precisely those strings made up of 3 0's, for ∈ N.

(c) Here a string ∈ A* if (and only if)

(i) is a string of O's, for ∈ N; or


(ii) is a string that starts and ends with 0, and has at least one 1 - but no consecutive
1's.
(d) For this last case A* consists of the following:

(i) Any string of 1's, for ∈ N; and


(ii) Any string that starts with 1 and contains at least one 0, but no consecutive 0's.
14. There are five possible choices:
(1) A = { }, B = {01,000,0101, 0111, 01000, 010111};
(2) A={01,000, 0101, 0111, 01000, 010111}, B = { };
(3) A={0}, B = {1,00, 101, 111, 1000, 10111};
(4) A={0,010), B = {1,00, 111}; and
(5) A = { , 01}, B = {01,000,0111}.

15. Let ∑ be an alphabet with ≠A Σ". If |A| = 1 and ∈ A, then = since A² = A.

But || || = 2 || ||=|| ||=>|| ||= 0 ⇒ = . If |A|> 1, let ∈ A where || ||> 0 but

|| || is minimal. Then ∈ => = , for some , ∈ A. Since || ||=|| || + || ||,


if || ||, || ||> 0, then one of , is in A with length smaller than || ||. Consequently,

one of || || or || || is 0, so ∈ Α.

16. (a) , ,

(b) r, d are onto; (Σ*) = {a}Σ"; (Σ*) = Σ*{a}


(c) is invertible and = .

(d) 25; 125; for even, for odd.

(e) ( )( ) = =( )( )
(f) (B) = { )
(B) = { }.
168
(B)=

| (B)| = | ( )| = ( )= = 6(5) = 30

17. If A = then it follows by mathematical induction that A = for all ∈ . Hence


A= . From Exercise 15 we know that A = Α² => λ Α, so A = A*.

18. Theorem 6.1(b): ∈ (AB)C <=> = (ab)c, for some a ∈ A, b B, c C <=>

=( ... ... )( … ), where ∈ A,1 ≤ ≤ , ∈ B,1 ≤ ≤ ,

C,1≤ ≤ <=> = … … … , where ; ∈ A, 1≤ ≤ ,

B,1 ≤ ≤ , ∈ C,1 ≤ ≤ <=> =( ... )( ), where

∈ A, 1 ≤ ≤ , ∈ B,1 ≤ ≤ , ∈C,1≤k≤ <=> ∈ A(BC). Hence


(AB)C = A(BC).

Theorem 6.2(b): For ∈ A, = λ with λ ∈ Β*. Hence A B* A.

Theorem 6.2(f): From Theorem 6.2( ) A* A*A*. Conversely, ∈ A*A*⇒ =

where with , ∈ A, for 1 ≤ ≤ , 1 ≤ ≤ . Hence

∈ A*, so A* A* A* and the equality follows.

Since (A*)* (A*) , it follows that A* (A*)*. Conversely, if ∈ (A*)*, then

, where ∈ A*, for 1 ≤ ≤ . Each = , where

∈ A, 1 ≤ ≤ . Hence ∈ A*, so (A*)* A* and (A*)* = A*.

(A*) = = (A*) (A*) =(A*)*. If ∈ (A*)*, then , where

∈ A*, for 1 ≤ ≤ . Then ∈ A*

(A*) = (A*) , so (A*)* = (A*) .

Since A A*, (A )* (A*)" by part (d) of this theorem. For ∈ (A*)*, if = , then

∈ (A )*. If ≠ , then as above ∈A


(A ) and the result follows.

19. By Definition 6.11 AB = { ∈ A, ∈ B), and since it is possible to have

with ∈ A, , and ∈ B, , it follows that |AB| < |A x B| = |A||B|.


20. (a) { }* { }* (b) { }* { }* { }* (c) { , }*
(d) { , }* (e) ( { , }*) ({ , }* )
(f) [( { , }*) ({ , }* )] - [ { , }* ]

169
21. (a) The words 001 and 011 have length 3 and are in A. The words 00011 and 00111 have
length 5 and they are also in A.

(b) From step (1) we know that 1∈ A. Then by applying step (2) three times we get

(i) 1∈A => 011 ∈ Α;

(ii) 011 ∈ A => 00111∈A; and

(iii) 00111 ∈ A => 0001111 ∈ Α.


(c) If 00001111 were in A, then from step (2) we see that this word would have to be
generated from 000111 (in A). Likewise, 000111 in A => 0011 is in A => 01 is in A.
However, there are no words in A of length 2 - in fact, there are no words of even length
in A.

22. (a) (1) λ ∈ Α; and

(2) If ∈ A, then each of the following is also in A:


(i) 1 (ii) 1 (iii) 00 (iv) 00 (v) 0 0
[And no other string of 0's and 1's is in A.]

(b) (1) λ ∈ Α; and

(2) For each ∈ A the strings l and 0 are also in A.


23. (a) Steps Reason
1. () is in A. Part (1) of the recursive definition
2. (()) is in A. Step 1 and part (2(ii)) of the definition
3. (())() is in A. Steps 1, 2, and part (2(i)) of the definition

(b) Steps Reasons


1. () is in A. Part (1) of the recursive definition
2. (()) is in A. Step 1 and part (2(ii)) of the definition
3. (())() is in A. Steps 1, 2, and part (2(i)) of the definition
4. (())()() is in A. Steps 1, 3, and part (2(i)) of the definition

(c) Steps Reasons


1. () is in A. Part (1) of the recursive definition
2. ()() is in A. Step 1 and part (2(i)) of the definition
3. (()()) is in A. Step 2 and part (2(ii)) of the definition
4. ()(()()) is in A. Steps 1, 3, and part (2(i)) of the definition
170
24. (1) λ ∈ A and ∈ A for all ∈ Σ; and

(2) For each ∈ A and Ε Σ, the string is also in A.


[No other string from Σ* is in A.]

25. Length 3: =3

Length 4: =5

Length 5: =8

Length 6: = 13 [Here the summand counts the strings where there

are no 0s; the summand counts the strings where we arrange the symbols 1, 1, 1, 1, 00;

the summand is for the arrangements of 1,1,00,00; and the summand counts the
arrangements of 00,00,00.]

26. [Here counts the arrangements for one 111 and eight 00's; counts the arrangements

for three 111's and five 00's; and is for the arrangements of five 111's and two 00's.]

Α: (1) λ ∈ Α

(2) If ∈ A, then 0 0, 0 l, 1 0, 1 1 ∈ A.

27. B: (1) 0,1 ∈ Α.

(2) If ∈ A, then 0 0, 0 1, 1 0, l l ∈ A.
28. Of the 3 3 3 3 = = 81 words in ∑ , there are 3 3 3 2 = 27 2 = 54 words that
start with one of the letters a, b, or c and end with a different letter. Consequently, one
must select at least 54+2=56 words from ∑ to guarantee that at least two start and
end with the same letter.

171
Section 6.2
1. (a) 0010101; (b) 0000000; (c) 001000000;

2. Because of the first output of 1 we must be at state when the third input is read. This
then forces the first three inputs to be 1,0,1. To get the second output of 1 we must be
at state when the fifth input is read. This forces the remaining two inputs to be 0,1.
Hence =10101.

3. (a) 010110 (b)

172
4. = { |0 ≤ ≤ 5}, where at state , the machine remembers the insertion of a total of
cents.

I = {5 , 10 , 25 , B, W}

0 = { (nothing), (peppermint), (spearmint), 5 , 10 , 15 , 20 , 25 }

5 10 25 B W 5 10 25 B W
n n n n n
n n 5 n n
n n 10 n n
n n 15 n n
n 5 20 n n
5 10 25

5. (a) 010000; (b) ( )100000; ( ) 000000; ( ) 110010;


(c)

0 1 0 1
0 0
1 1
0 0
0 1
0 1

(d) (e) = 101 (unique)


6. (a) The machine recognizes (with an output of 1) every 0 (in an input string ) that is
preceded by another 0.
(b) State remembers that at least one 0 has been supplied from an input string .
(c) A = {1}*, B = {00}
7. (a) (i) 15 (ii) (iii) (b)

173
8. (a)
Input 0110111011
Output 0000000010
(b)

0 1 0 1
0 0
0 0
0 0
0 0
0 0
0 1

(c) ( , ) = 0000001 for = (1)1111101; (2)1111011; (3)1110111; (4)1101111;


(5)1011111; and (6)0111111
(d) The machine recognizes the occurrence of a sixth 1, a 12th 1,... in an input .
9.
(a)

0 1 0 1
0 0
0 0
0 1
0 0
0 0
1 0

(b) There are only two possibilities: =1111 or = 0000.


(c) A = {111}{1}* {000}{0}*
(d) Here A = {11111}{1}* {00000}{0}*.

174
Section 6.3
1. (a) (b)

2. (0110)

(1010)

3.
175
4.

5.
(a)
(b) (i) Input 111
Output 011
(ii) Input 1010
Output 0101
(iii) Input 00011
Output 00001

(c) The machine outputs a 0 followed by the first -1 symbols of the symbol input
string . Hence the machine is a unit delay.
(d) The machine here performs the same tasks as the one in Fig. 6.13 (and has only two
states.)

6. Suppose the contrary and let the machine have states, for some n ∈ . Consider the

176
input string . We expect the output here to be . As the O's in this input string
are processed we obtain n+1 states , from the function v. Consequently,

by the Pigeonhole Principle, there are two states where i < j but = . So if
the states for i + 1 ≤ ≤ , are removed, along with their inputs of 0, then this
machine will recognize the sequence , where + 1 - (j - i) ≤ . But the string
.

7. (a) The transient states are . State is a sink state. { }, { },


{ } (with the corresponding restrictions on the given function ) constitute subma-
chines. The strongly connected submachines are { } and { }.
(b) States are transient. The only sink state is 54. The set { }provides
the states for a submachine; { }, { }provide strongly connected submachines.
(c) Here there are no transient states. State as is a sink state. There are three subma-
chines: { }, { }and { } . The only strongly connected submachine
is { }.
8. Either 110 or 111 provides a transfer sequence from to
Supplementary Exercises
1. (a) True (b) False (c) True
(d) True (e) True (f) True

2. No. Let with A = { }, B = { }. Then = ={ |n ≥ 0), but A B.

3. Let and A = { }. Then A² = { } and ( ) ( , , ...). However =


{ , , …}and (A*)² = A*, so (A*) ≠ (A2)*.
4. (a) ACB. [For example, 111 € B but 111 & A*.]
(b) A = C*.

177
5. :Starting at so we can return to for any input from {1,00}. To finish at state requires an input of 0. Hence
{1,00}*{0}

: {0}{1,00}*{0}

: (1,00)* - { }
010: {1}{1,00)*U {10}{1,00}*

6.
(a)
0 1 0 1
0 0
0 0
0 0
0 1

(b) For any input string , this machine recognizes (with output 1) the occurrence of
every fourth 1 in .

(c) + + = 72. (The first summand is for the sequence of eight 1's, the second
summand for the sequences of four 1's and four 0's, and the last summand for the sequence
of eight 0's.)

For || ||= 12, there are + + + = 992 such sequences.


7. (a) By the Pigeonhole Principle there is a first states that is encountered twice. Let
be the output string that resulted since s was first encountered until we reach this state a
second time. Then from that point on the output is .....
(b) (c)
8.
9.

178
10.

0 1 0 1
0 1
1 0
1 0
0 1

Here the table for is obtained from Table 6.15 by reversing 0 and 1 (and, 1 and 0) for
the columns under 0 and 1.

11.

0 1 0 1
( , ( , ( ,
) ) ) 1 1
( , ( , ( , (a)
) ) ) 0 1
( , ( , ( ,
) ) ) 1 1
( , ( , ( ,
) ) ) 1 1
( , ( , ( ,
) ) ) 1 1
( , ( , ( ,
) ) ) 1 0

(b) (( , ), 1101) = 1111; M₁ is in state and M₂ is in state .


12. The following program determines the output for the input string 1000011000.
10 Dim A(3,2), B(3,2)
20 Mat Read A,B
30 Data 2,1,3,1,3,1,0,0,0,0,1,1
40 Dim P(100), S(100)
50 Read N
60 For I =1 to N
70 Read X
80 If I <> 1 Then 120
90 If X = 0 Then P(1) = B(1,1) Else P(1) = B(1,2)
100 If X = 0 Then S(1) A(1,1) Else S(1) = A(1,2)
110 Go To 140

179
120 Y = X +1
130 P(I) = B(S(I-1)Y): S(I) = A(S(I-1),Y)
140 Next I
150 Data 10,1,0,0,0,0,1,1,0,0,0
160 Print "The output is";
170 For I = 1 Το Ν-1
180 Print P(I);
190 Next I
200 Print P(N)
210 Print "The machine is now in state"; S(N)
220 End

180

You might also like