简体   繁体   中英

How to construct this turing machine?

How can we construct TMs such that it accepts(Give description only):

a + b = c

a . b = c

Input is of the form a#b#c.

a,b and c belongs to {0,1}* and are positive binary unsigned integers.

I know that we can construct TMs if the input has unary representation but how to solve if it has binary representation?

Well, binary addition and multiplication are a bit more involved than in the unary case, but not that difficult. For addition:

  1. sum the two lowest bits. If the sum is zero or one, this is the lowest bit of the result. If the sum is two, then the lowest bit is zero and you have a carry.
  2. Proceed to the next-lowest bit. Sum the two and the possible carry.If the sum is zero or one, this is the current bit of the result. If the sum is two, then the current bit is zero and you have a carry. If the sum is three, then the current bit is one and you have a carry.
  3. Repeat 2 until all bits are processed.

For multiplication you can use a method like this one . This will be some work to program on a TM if you really have to do it in detail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM