4
$\begingroup$

The book "Computational Complexity: A modern approach" by Sanjeev Arora and Boaz Barak contains the following claim:

Claim 1.5 For every $f : \{0, 1\}^∗ \to \{0, 1\}$ and time-constructible $T : N \to N$, if $f$ is computable in time $T(n)$ by a TM $M$ using alphabet , then it is computable in time $4\log|\Gamma|T(n)$ by a TM $\tilde{M̃}$ using the alphabet $\{0, 1,\square,\rhd \}$.

(TM denotes "Turing Machine and the characters $\square$ and $\rhd$ are used to denote blanks and the starting cell of the TM's tape respectively)

What I don't understand is the factor of $4$ that appears in the running time of $\tilde{M}$. The idea of the proof is that the elements of $\Gamma$ can be encoded in $\log|\Gamma|$ bits and $\tilde M$ can be designed to read and write $\log|\Gamma|$ cells at a time. So to simulate one step of $M$ $\tilde M$ would use $\log|\Gamma|$ steps to read the encoding of a single element of $\Gamma$ and $\log|\Gamma|$ more to write one on it's tape. Wouldn't this make the running time of $\tilde M$ $2\log|\Gamma|T(n)$ as opposed to $4\log|\Gamma|T(n)$?

Any help resolving this problem is much appreciated. Thanks in advance!

$\endgroup$
0

1 Answer 1

5
+50
$\begingroup$

I think it is not doable with factor 2, yet it is doable with factor 3 plus a constant -- so factor 4 is there for safety I guess.

I am not trying to suggest a proof, but an intuition: The machine $\widetilde{M}$ encodes each letter $\gamma$ in $\Gamma$ as a binary number whose length is $log(|\Gamma|)$. Now in order for $\widetilde{M}$ to simulate a step of $M$ (assume that $M$ is in state $q$, about to read $\gamma$, and its transition function specifies that $\delta(q, \gamma) = (q, \gamma', R)$, where $\gamma'\neq \gamma$), the machine $\widetilde{M}$ needs to:

1- Read the current letter $\gamma$ that the head of $M$ points to, and remember it: this takes about $log(|\Gamma|)$ steps as we need to make a pass over $\gamma$'s description.

2- Now $\widetilde{M}$ needs to write $\gamma'$ instead of $\gamma$, which also takes about $log(|\Gamma|)$ steps. Note that we do here is write $\gamma'$ backwards instead of moving left to the beginning of $\gamma$'s description before writing $\gamma'$. The latter allows us to modify $\gamma$ to $\gamma'$ while doing only one pass over $\gamma$'s description.

3- Finally, since $\widetilde{M}$'s head needs to move back one letter right to $\gamma'$ as specified by $M$'s transition function, we actually need to perform more $log(|\Gamma|)$ steps.

In the worst case, we need to at least read the current letter (one pass), modify it (another pass), and update the head's position (a final pass). So we make in total three passes to simulate a single step of $M$. Note that it is not possible to do it with a factor of 2 (2 passes) as reading $\gamma$, modifying it to $\gamma'$, and updating the head (this is what you missed) requires at least 3 passes to in the worst case.

Notes:

1- The used model and the input's encoding make a difference when you seek an exact expression. So I think we lack context here. For example, when you make a pass you may step on the cell between two consecutive letters of $M$, and then you need to move the head to an adjacent cell, which gives you an additional 1-2 steps, but if you use a machine with a head that can stay at the same cell upon performing a transition then it might differ a bit. Anyway, note that (assuming adjacent letters have no separating tape cells) you can try to use the state-space of the machine to reduce/avoid these additional steps, for example, by holding a counter whose value is at most $log(|\Gamma|)$. So a careful analysis requires us to know the model we use, the encoding of the input, and whether we need to perform minor optimizations -- the main point here that I want you to get is that we need at least 3 passes, and we can do it with exactly 3 passes, and I leave the implementation details to you.

2- Again, we lack context here. Given the answer suggested by you in the question's body, I assumed that the input of $\widetilde{M}$ is already in an appropriate format. If not then that needs to be clarified in the question's body -- different input encodings induce different runtimes. Anyway, I think I gave you the intuition you needed and the crux behind $\widetilde{M}$'s operation.

$\endgroup$
10
  • $\begingroup$ To Bader Abu Radi: Thank you very much for your answer. I will read your answer and try to understand it. $\endgroup$ Commented Aug 3 at 2:06
  • $\begingroup$ To Bader Abu Radi: I have a question about your answer. You wrote: "its transition function specifies that $\delta(q, \gamma)=(q, \gamma', R)$". Why does the Turing machine $M$ stay in the same state after the transition? $\endgroup$ Commented Aug 3 at 9:49
  • 1
    $\begingroup$ This is an example, I chose that arbitrarily as modifying the state does not affect the answer. $\endgroup$ Commented Aug 3 at 9:50
  • 1
    $\begingroup$ It depends on the input's format -- we need more context here. For example, if the input is presented as <a>_<b>_... where "_" stands for blank, and <a> is a binary encoding of the letter a, then you can step on the blank symbol that separates between two binary numbers. At the end of the day, you need to separate between the numbers in order to know when the encoding of a letter ends. $\endgroup$ Commented Aug 5 at 12:27
  • 2
    $\begingroup$ Thank you for the answer. Somehow I failed to realise that the head has to make a 3rd pass back to the start of the next translated (into binary) alphabet on the tape. Silly me. $\endgroup$ Commented Aug 8 at 1:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.