Question

Question 2 10 pts Let x and y be positive integers (x, y > 0) represented in unary. Assume that x > y. Design a Turing Machin
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Let the input tape be int the form 00....000w(x)0w(y)000...00

The transition graph of the given turing machine is as follows:-

1(1,1,R) (2,2,R) (1+X,R) (0,0,R) lavo Qu2 Ov3 (0,2,R) Co,O,R) (0, 2, RY 4 (W7 (1,Y, R) K (X,X,R) (0, 2,6) (2, 1, R) ave aus

Here for all the values of x we insert 3 Z at the end of the string, then after inserting all Z we subtract y number of Z from the tape, and at last we convert all the Z into 1, which will be the final output string.

To check the turing machine let us take an input string w(x) =111 and w(y) = 11, the transition table for the given string is as follows:-

Present state Input symbol Change to Next state Move
q0 1 X q1 R
q1 1 1 q1 R
q1 1 1 q1 R
q1 0 0 q2 R
q2 1 1 q2 R
q2 1 1 q2 R
q2 0 Z q3 R
q3 0 Z q4 R
q4 0 Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 1 1 q5 L
q5 1 1 q5 L
q5 0 0 q6 L
q6 1 1 q6 L
q6 1 1 q6 L
q6 X X q0 R
q0 1 X q1 R
q1 1 1 q1 R
q1 0 0 q2 R
q2 1 1 q2 R
q2 1 1 q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 0 Z q3 R
q3 0 Z q4 R
q4 0 Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 1 1 q5 L
q5 1 1 q5 L
q5 0 0 q6 L
q6 1 1 q6 L
q6 X X q0 R
q0 1 X q1 R
q1 0 0 q2 R
q2 1 1 q2 R
q2 1 1 q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 Z Z q2 R
q2 0 Z q3 R
q3 0 Z q4 R
q4 0 Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 Z Z q5 L
q5 1 1 q5 L
q5 1 1 q5 L
q5 0 0 q6 L
q6 X X q0 R
q0 0 0 q7 R
q7 1 Y q8 R
q8 1 1 q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 0 0 q9 L
q9 Z 0 q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 1 1 q10 L
q10 Y Y q7 R
q7 1 Y q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 Z Z q8 R
q8 0 0 q9 L
q9 Z 0 q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Z Z q10 L
q10 Y Y q7 R
q7 Z 1 q11 R
q11 Z 1 q11 R
q11 Z 1 q11 R
q11 Z 1 q11 R
q11 Z 1 q11 R
q11 Z 1 q11 R
q11 Z 1 q11 R
q11 0 0 qf R

Since the machine reaches to state qf therefore machine will stop, the final status of input tape will be in the form 0XXX0YY111111100, where the output is 1111111, which is correct

1(1,1,R) (2,2,R) (1+X,R) (0,0,R) lavo Qu2 Ov3 (0,2,R) Co,O,R) (0, 2, RY 4 (W7 (1,Y, R) K (X,X,R) (0, 2,6)' (2, 1, R) ave aus (1,1,L) (2,2,2) (2,2,R) ai (0,0,6) (0,0,L) qua (2,0,4) (2, 1, R) (Y,Y, R) Coll) (0,0,R) D (2,2,1) af) (1,1,L)

1(1,1,R) (2,2,R) (1+X,R) (0,0,R) Qu2 lavo Ov3 (0,2,R) Co,O,R) (0, 2, RY 4 (W7 (1,Y, R) K (X,X,R) (0, 2,6)' (2, 1, R) ave aus (1,1,L) (2,2,2) (2,2,R) ai (0,0,6) (0,0,L) qua (2,0,4) (2, 1, R) (Y,Y, R) Coll) (0,0,R) D (2,2,1) af) (1,1,L)

Add a comment
Know the answer?
Add Answer to:
Question 2 10 pts Let x and y be positive integers (x, y > 0) represented...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT