I want two know how can I add two positive or negative integers using the same Turing Machine

I am using unary numbers in the following way:

0 = 1; 1 = 11; 2 = 111; 3 = 1111 ...

I know how to add two postive integers and I am using this site for tests: https://turingmachinesimulator.com/

name: add two positive integers

init: q0

accept: q3


q0,1 q1,_,>

q1,* q3,_,>

q1,1 q2,_,>

q2,1 q2,1,>

q2,* q3,1,>

This is pretty simple, but when it comes to negative integers I have no idea where to start.

  • $\begingroup$ What, to a/your TM, is a negative integer? $\endgroup$ – greybeard Sep 26 at 17:40
  • $\begingroup$ @greybeard I think, maybe I am wrong, there are not positive or negative integers in the TM, only a procedure that gives what I want. In the "positive integer" addition what the TM does is: erase the first two one's and when it finds a '*' it writes a one in that position, the TM is not adding numbers. When it comes to "negative integers" I think there must be an additional symbol that when it is read it starts a different procedure that would give the same output that we get when adding -2+3 for example. I dont know what else to do in the negative integer procedure. $\endgroup$ – David Hume Sep 27 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.