You are on page 1of 5

# Seulgi Kim (sk765)

## 1. (a) the set of strings in {4, 8, 1} containing the substring 481

Symbol definition
S = current string
P(x) = true if string x contains substring 481

State Definition

1 P(S) = false

## 3 P(S) = false, and the previous 2 characters are48

4 P(S) = true

4 8
1
1 2 3 4
1 4

1,8 4
1,4,8
Seulgi Kim (sk765)

State Definition

## x x = (length of the current string) mod 14

0 a
a 13
1 a
a

12
2
a
a
11
3
a

a 10

4
a
a 9

a
5

a 8
a
a
6 7
Seulgi Kim (sk765)

1. c) the set of strings x {0,1} such that #0(x) is even and #1(x) is a multiple of three

State Definition

## 6 #0(x) is odd and #1(x) % 3 = 2

0 1
1
2 6

1 0 0

3 1 5

0 1

0
4
Seulgi Kim (sk765)

d. the set of strings over the alphabet {a,b} containing at least three occurrences of three
consecutive bs, overlapping permitted (e.g., the string bbbbb should be accepted)

Symbol definition
N = number of occurrences of three consecutive bs that are found.
State Definition

## 9 N = 2, and previous two characters are bs.

10 N >= 3

a a

b b
1 2 3
a

a a b

b b
4 5 6
a

b
a a

b b
7 8 9
a
b

a,b
10
Seulgi Kim (sk765)

1.e) the set of strings in {0, 1, 2} that are ternary (base 3) representations, leading zeros
permitted, of numbers that are not multiples of four. (Consider the null string a
representation of zero.)

Symbol definition
#(x) = Decimal value of ternary number x.
S = Current state
F(x) = The remainder of x after dividing it by 4.

Note.
Let c {0,1,2}
#(x + c) = #(x)*3 + c
If F(#(S)) = 0, F(#(S+c)) = F(#(S)*3 + c) = F(F(#(S)*3) + F(c)) = F(F(0*3)) + c) = F(c) = c
if F(#(S)) = 1, F(#(S+c)) = F(#(S)*3 + c) = F(F(#(S)*3) + F(c)) = F(F(1*3)) + c) = F(3 + c)
if F(#(S)) = 2, F(#(S+c)) = F(#(S)*3 + c) = F(F(#(S)*3) + F(c)) = F(F(2*3)) + c) = F(2 + c)
if F(#(S)) = 3, F(#(S+c)) = F(#(S)*3 + c) = F(F(#(S)*3) + F(c)) = F(F(3*3)) + c) = F(1 + c)

state definition

0 F(S) = 0

1 F(S) = 1

2 F(S) = 2

3 F(S) = 3

2 1 2
1 2 2

0 3
1
0

1
1