209k views
5 votes
Design a TM that computes the function: f(x) = {1 ifxis even, where x is given in unary notation with 1's only to TM. For example,

if x = 3, the input x = 111; if x = 2, the input x = 11. So, if the length of x is even, the output '1' is written only on the tape; otherwise, the output '0' is written only on the tape. The rest of the tape is blanks except the output 0/1. The head position is on the output 1/0.
Use the tape symbol г = {1, 0, _} where '_' is a blank symbol. Draw its transition function of the TM

User Jiaming
by
7.8k points

1 Answer

3 votes

Final answer:

The question relates to creating a Turing Machine that outputs '1' for an even unary number or '0' for an odd unary number. The Turing Machine sequentially checks pairs of '1's on the tape and moves to a halt state after determining the parity, writing the appropriate output.

Step-by-step explanation:

The student's question revolves around designing a Turing Machine (TM) that computes a function to determine if a given number in unary notation is even or odd. The Turing Machine should output '1' if the number is even and '0' if it's odd, and these operations should be represented by the transition functions along with the tape symbols used by the machine.

To begin, we can outline aa simple version of such a TM. First, understand that the unary notation consists solely of 1's. An even number in unary notation would have pairs of 1's, whereas an odd number would have at least one standalone 1.

To design a Turing machine that computes the function f(x) = {1 if x is even}, we can follow the steps below:

Read the input, which is given in unary notation.

Count the number of '1's in the input tape.

If the count is even, write '1' on the tape as the output and move the head position to the output symbol.

If the count is odd, write '0' on the tape as the output and move the head position to the output symbol.

You can draw the transition function of the Turing machine based on these steps and the given tape symbols.

User Flavio Wuensche
by
8.3k points