Question

In: Computer Science

Design a Turing machine that, given a positive binary number n greater than or equal to...

Design a Turing machine that, given a positive binary number n greater than or equal to 2, subtracts 2 from this number. Test it, step-by-step, on the example of n = 2.

Solutions

Expert Solution

Turing machine which subtracts two numbers.

Draw image:

Steps:

Step-1. If 0 found convert 0 into X and go right then convert all 0’s into 0’s and go right.
Step-2. Then convert C into C and go right then convert all X into X and go right.
Step-3. Then convert 0 into X and go left then convert all X into X and go left.
Step-4. Then convert C into C and go left then convert all 0’s into 0’s and go left then convert all X into X and go right and repeat the whole process.
Step-5. Otherwise, if C found convert C into C and go right then convert all X into B and go right then convert 0 into 0 and go left and then stop the machine.

Here, q0 shows the initial state, and q1, q2, q3, q4, q5are the transition states, and q6shows the final state.
And X, 0, C are the variables used for subtraction, and R, L shows right and left.

Number n greater than or equal to 2,

Steps:

Step-1. If 0 found convert all 0’s into 0’s and go right then convert C into C and go right
Step-2. If X found then convert all X into X and go right or if 0 found then convert 0 into X and go left and go to the next step otherwise go to 5th step
Step-3. Then convert all X into X and go left then convert C into C and go left
Step-4. Then convert all 0’s into 0’s and go left then convert B into B and go right then convert 0 into B and go right and repeat the whole process
Step-5. Otherwise, if B found convert B into B and go left then convert all X into B and go left then convert C into B and go left and then stop the machine.

Here, q0 shows the initial state, and q1, q2, q3, q4, q5are the transition states, and q6shows the final state.


Related Solutions

Let n greater than or equal to 2 and let k1,...,kn be positive integers. Recall that...
Let n greater than or equal to 2 and let k1,...,kn be positive integers. Recall that Ck1,..., Ckn denote the cyclic groups of order k1,...,kn. Prove by induction that their direct product Ck1×Ck2×....×Ckn is cyclic if and only if the ki's are pairwise coprime which means gcd(ki,kj)=1 for every i not equals j in {1,...n}.
Prove that if n is greater than or equal to 4 then the center of the...
Prove that if n is greater than or equal to 4 then the center of the alternating subgroup An is the trivial subgroup. What is Z(An) for n = 0,1,2,3 ?
Design a Turing Machine to construct the function f(n) = 4 [1/4 n] + 2, (that...
Design a Turing Machine to construct the function f(n) = 4 [1/4 n] + 2, (that is, 2 more than 4 times the integer part of 1/4 n) for n Element N. Do not just produce a TM, but also describe briefly how it works. There is a TM in the Cooper notes that does something similar. You may modify it to produce the required TM, or produce a machine totally independently.
Design a combinational circuit with four inputs (A, B, C and D) and four outputs (W, X, Y and Z). When the binary input is less than 10 the binary output is two greater than the input. When the binary input is equal or greater than 10 the binary output
Design a combinational circuit with four inputs (A, B, C and D) and four outputs (W, X, Y and Z). When the binary input is less than ten the binary output is two greater than the input. When the binary input is equal or greater than ten the binary output is three less than the input.
Prove that if G is a connected graph of order n is greater than or equal...
Prove that if G is a connected graph of order n is greater than or equal to 3, then its square G^(2) is 2-connected
prove or disprove A Turing machine with two tapes is no more powerful than a Turing...
prove or disprove A Turing machine with two tapes is no more powerful than a Turing machine with one tape. (That is, both types of machines can compute the same set of functions.) The cardinality of the set of irrational numbers is greater than the cardinality of the set of all rational numbers. The cardinality of the set of all algebraic numbers is exactly the same as the cardinality of all real numbers.
Consider the following hypothesis test: H0: n greater than or equal to 20 Ha: n less...
Consider the following hypothesis test: H0: n greater than or equal to 20 Ha: n less than 20 a sample of 45 provided a sample mean of 19.6. the population standard deviation is 1.8 a.  Compute the value of the test statistic (to 2 decimals). Enter negative value as negative number. _______ b. what is the p-value? (3 decimals) d. using a=0.05, what is the critical value for the test statistic (to 3 decimals)? Enter negative value as negative number. ________...
Design an efficient algorithm to compute the number of binary strings with length n that satisfy...
Design an efficient algorithm to compute the number of binary strings with length n that satisfy 1 the regular expression ((0 + 11 + 101)∗ (1101))∗ .
Prove that the language L={(M, N): M is a Turing machine and N is a DFA...
Prove that the language L={(M, N): M is a Turing machine and N is a DFA with L(M) =L(N)} is undecidable. You need to derive a reduction from Atm={(M, w)|Turing machine M accepts w} to L. (In layman's terms please, no other theorems involved)
Create a 3-tape Turing machine that implements multiplication with binary numbers. The first tape and the...
Create a 3-tape Turing machine that implements multiplication with binary numbers. The first tape and the second tape hold the numbers being multiplied and the third tape holds the product of the first two tapes. The two binary numbers may be different lengths.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT