-2

One question I came across was, given a binary sequence a_0, ..., a_{n-1} how many transitions does it take such that when given a non-negative integer i it outputs a_i if i < n and 0 otherwise. You can assume the input starts with a 1 unless i is 0.

Using https://martinugarte.com/turingmachine/ I simulated the following Turing machines to try and get an idea for how many states this should take

Sequence with n=2, 5 transitions

//Sequence is 0,1
name: Sequence
init: one
accept: end

one,0
end,0,-

one,1
two,_,>

two,_
end,1,-

two,0
end,0,-

two,1
end,0,-

Sequenced with n=3, 8 transitions

//Sequence is 0,1,0
name: Sequence
init: one
accept: end

one,0
end,0,-

one,1
two,_,>

two,_
end,1,-

two,0
three,_,>

two,1
end,0,-

three,_
end,0,-

three,0
end,0,-

three,1
end,0,-

Sequence with n=4, 11 transitions

//Sequence is 0,1,0,1
name: Sequence
init: one
accept: end

one,0
end,0,-

one,1
two,_,>

two,_
end,1,-

two,0
three0,_,>

two,1
three1,_,>

three0,_
end,0,-

three0,0
end,0,-

three0,1
end,0,-

three1,_
end,1,-

three1,0
end,0,-

three1,1
end,0,-

From this I'd guess that it is roughly O(n) states required to specify a sequence n long. Can you prove this?

ruler501
  • 197
  • 1
  • 1
  • 12
  • In the n=3 example, couldn't you have `two,0:end,0,-` and do without `three` entirely? And when you say "states", do you mean "transitions"? – Beta Apr 28 '15 at 00:08
  • @Beta that works thanks. Wouldn't work for a genetic sequence though so I'll leave my example as is. I was taught that a state is basically the same as a transition. Is this wrong in modern literature? – ruler501 Apr 28 '15 at 02:05

1 Answers1

0

This is true by induction. Take the base case to be n=2, the following Turing machine can easily be modified to work for any length 2 sequence

//Sequence is 0,1
name: Sequence 
init: one
accept: end

one,0 end,0,-

one,1 two,_,>

two,_ end,1,-

two,0 end,0,-

two,1 end,0,-

Now for the inductive step assume it works for length n and is ordered like above. If we specify them like six0101 for 10101x we replace the smallest one that goes to end, sorted by the number that the transition acts on at that point, for instance,

six0101,0
end,0,-

acts on 101010. Make this transition go to three new transitions, in the example it would go to seven01010 which on blank would output a_n and stop. On 0,1 it would output 0 and stop. This adds 3 transitions to the Turing machine. satisfying the inductive step.

In fact this proves that for binary Turing machines the states needed have an upper bound of 3n-1 transitions. This can be generalized to c-character Turing machines with the following upper bound (c+1)n-1

ruler501
  • 197
  • 1
  • 1
  • 12