Solution5

advertisement
Solution: Assignment 5
1a.
1234567891011-
A’
B’
C’
A.B
A.C
B.C
A’.B.C
A.C.B’
A.B.C’
A.C.B’ + A.B.C’
A’.B.C + A.C.B’ + A.B.C’
b.
A
0
0
0
0
1
1
1
1
B
0
0
1
1
0
0
1
1
C
0
1
0
1
0
1
0
1
OUTPUT
0
0
0
1
0
1
1
0
c. Exactly when two inputs are 1 and one input is 0.
d.
2-
3-
4{
1 = (1, 1, 1, R, 2)
2 = (2, 1, 1, R, 2)
3 = (2, blank, blank, R, 3)
4 = (3, 1, blank, L, 4)
5 = (4, blank, 1, R, 2)
}
111b1111bbb…
State = 1
Next Instruction = 1
State = 2
Next Instruction = 2
State = 2
Next Instruction = 2
State = 2
Next Instruction = 3
State = 3
Next Instruction = 4
State = 4
Next Instruction = 5
State = 2
Next Instruction = 3
State = 3
Next Instruction = 4
State = 4
Next Instruction = 5
State = 2
Next Instruction = 3
State = 3
Next Instruction = 4
State = 4
Next Instruction = 5
^
111b1111bbb…
^
111b1111bbb…
^
111b1111bbb…
^
111b1111bbb…
^
111bb111bbb…
^
1111b111bbb…
^
1111b111bbb…
^
1111bb11bbb…
^
11111b11bbb…
^
11111b11bbb…
^
11111bb1bbb…
^
111111b1bbb…
State = 2
Next Instruction = 3
State = 3
Next Instruction = 4
State = 4
Next Instruction = 5
State = 2
Next Instruction = 3
State = 3
Next Instruction = HALT
^
111111b1bbb…
^
111111bbbbb…
^
1111111bbbb…
^
1111111bbbb…
^
5{
1= (1, 0, 1, R, 1)
2= (1, 1 , 2, R, 1)
3= (1 , 2, 3, R, 1)
4= (1, 3, 4, R, 1)
5= (1, 4, 5, R, 1)
6= (1, 5, 6, R, 1)
7= (1, 6, 7, R, 1)
8= (1, 7, 8, R, 1)
9= (1, 8, 9, R, 1)
10=(1, 9, 0, R, 1)
}
17289302bbb…
^
State = 1
Next Instruction = 2
27289302bbb…
State = 1
Next Instruction = 8
State = 1
Next Instruction = 3
State = 1
Next Instruction = 9
State = 1
Next Instruction = 10
State = 1
Next Instruction = 4
State = 1
Next Instruction = 1
State = 1
Next Instruction = 3
State = 1
Next Instruction = HALT
^
28289302bbb…
^
28389302bbb…
^
28399302bbb…
^
28390302bbb…
^
28390402bbb…
^
28390412bbb…
^
28390413bbb…
^
6This is the TM program: { (1, 0, b, R, 1) } (try it yourselves.)
7a
1
1
1
1
0
0
0
0
s1
0
0
1
1
0
0
1
1
s0
0
1
0
1
0
1
0
1
x3
0
0
0
1
0
0
0
0
x2
0
0
1
0
0
0
0
0
x1
0
1
0
0
0
0
0
0
x0
1
0
0
0
0
0
0
0
8a- The definition of computation does not depend on the entity which performs it. To be more precise,
the definition of the computation is not concerned with the amount the memory, architecture or type of
the processor of the computer which is performing the computation. Thus we need a very general and
abstract machine which captures the essence of computer and can perform any task that can be done
by any computer and this abstract machine is TM. Then we can discuss the theory of computation in
context of a standard machine without being trapped in it details or limitations.
b- A TM algorithm is a TM program with a finite number of TM instructions which eventually halts on
any input (initial tape content).
Download