# ORF523: Turing Machines

So far we have seen several algorithms to solve various optimization problems. For example for LPs we have seen that the ellipsoid method has a computational complexity of roughly $latex {O(n^4)}&fg=000000$, and we improved this bound with Interior Point Methods which have a complexity of roughly $latex {O(n^{3.5})}&fg=000000$. But how can we be sure that we are not missing some amazing algorithm with $latex {O(n^{2.1942})}&fg=000000$ complexity? Proving that such an algorithm does not exist is a task that falls within the realm of lower bounds.

It is often said that lower bounds are more difficult than upper bounds. This is not always true (though it will be bitter true here…). However what is certainly true is that lower bounds are conceptually more difficult than upper bounds. Indeed when one wants to talk about impossibility results, one need to have the ‘rules of the game’ carefully formalized. In particular for us this means defining precisely what we mean by ‘computation’.

Thus our first task is to have a formal model of computation, and this is achieved via Turing Machines. Once the model is well defined we discuss the state of computational lower bounds within that framework (and as we will see, very little is known).

This post is simply a rewriting of parts of Chapter 1 of the book ‘Computational Complexity’ by Arora and Barak.

Turing Machines

A Turing Machine $latex {M}&fg=000000$ is a pair $latex {(Q,\delta)}&fg=000000$, where $latex {Q}&fg=000000$ is a finite set that contains the set $latex {\{\mathrm{START}, \mathrm{HALT}\}}&fg=000000$, and $latex {\delta}&fg=000000$ is a mapping from $latex {Q \times \{\triangleright, \Box, 0,1\}}&fg=000000$ to $latex {Q \times \{\triangleright, \Box, 0,1\} \times \{L, R\}}&fg=000000$. The set $latex {Q}&fg=000000$ is called the set of states of $latex {M}&fg=000000$, and the mapping $latex {\delta}&fg=000000$ is the transition function of $latex {M}&fg=000000$.

A Turing Machine can be applied to an input $latex {x \in \{0,1\}^*}&fg=000000$ in the following way. Imagine an infinite tape indexed by $latex {{\mathbb N}}&fg=000000$. On the $latex {0^{th}}&fg=000000$ location is the start symbol $latex {\triangleright}&fg=000000$, then the string $latex {x}&fg=000000$ is written on the next locations (from location $latex {1}&fg=000000$ to location $latex {|x|}&fg=000000$), and in all other locations the blank symbol $latex {\Box}&fg=000000$ is written. The Turing Machine also has a head that starts on the $latex {0^{th}}&fg=000000$ location. Finally the state of $latex {M}&fg=000000$ is initialized to $latex {\mathrm{START}}&fg=000000$. The conditions we just described form the start configuration of $latex {M}&fg=000000$ on $latex {x}&fg=000000$. Now the Turing Machine iteratively applies the transition function as follows. Assume that the Turing Machine is in state $latex {q \in Q}&fg=000000$, that its head is in location $latex {i}&fg=000000$, and that the symbol written on the tape at location $latex {i}&fg=000000$ is $latex {\sigma}&fg=000000$. Then the Turing Machine changes its state to $latex {\delta(q, \sigma)_1}&fg=000000$, it replaces the symbol at location $latex {i}&fg=000000$ by $latex {\delta(q, \sigma)_2}&fg=000000$, and its head moves to location $latex {i+1}&fg=000000$ if $latex {\delta(q,\sigma)_3 = R}&fg=000000$ or to location $latex {i-1}&fg=000000$ if $latex {\delta(q, \sigma)_3 = L}&fg=000000$ (we assume that when the head reads a symbol $latex {\triangleright}&fg=000000$ it always move right and it does not modify the symbol).

We define the output of $latex {M}&fg=000000$ on $latex {x}&fg=000000$ as the string in $latex {\{0,1\}^*}&fg=000000$ which is written on the tape when the Turing Machine reaches the state $latex {\mathrm{HALT}}&fg=000000$. We denote this output by $latex {M(x)}&fg=000000$ (note that this output is only well defined if $latex {M}&fg=000000$ reaches the state $latex {\mathrm{HALT}}&fg=000000$ in finite time).

What do we do with Turing Machines? Well we use them to compute things, and in particular to compute mappings from $latex {\{0,1\}^*}&fg=000000$ to itself. Let $latex {f : \{0,1\}^* \rightarrow \{0,1\}^*}&fg=000000$ be such a mapping. We say that $latex {M}&fg=000000$ computes $latex {f}&fg=000000$ if for any $latex {x \in \{0,1\}^*}&fg=000000$, one has $latex {M(x) = f(x)}&fg=000000$. Let $latex {T : {\mathbb N} \rightarrow {\mathbb N}}&fg=000000$, we say that $latex {M}&fg=000000$ computes $latex {f}&fg=000000$ in $latex {T(n)}&fg=000000$-time if for any $latex {x \in \{0,1\}^*}&fg=000000$, one has $latex {M(x) = f(x)}&fg=000000$, and $latex {M}&fg=000000$ reaches the state $latex {\mathrm{HALT}}&fg=000000$ in at most $latex {O(T(|x|))}&fg=000000$ steps.

Expressive power of Turing Machines

Any programming language can be simulated by a Turing Machine. This bold claim is even easy to prove (though we will not do it). In fact the Church thesis states that every physically realizable computation device can be simulated by a Turing Machine. Of course this is not a theorem, but it is a widely accepted belief.

A stronger version of the Church thesis states that any function which is computable in $latex {n^c}&fg=000000$-time (for some constant $latex {c>0}&fg=000000$) on a physically realizable computation device can be computed by a Turing Machine in $latex {n^{c’}}&fg=000000$-time. Again this is a theorem if one considers specific alternative models of computation (for instance Turing Machines with larger alphabet than $latex {\{0,1\}}&fg=000000$, or with multiple tapes), but in general it is just a belief. This stronger version might even be false, as suggested by some recent results on algorithms for quantum computers. However at this point we do not know if quantum computers are physically realizable.

Example: computing the solution of an LP

Consider the problem of computing the solution of a standard LP. That is, we want to construct a Turing Machine $latex {M}&fg=000000$ that takes as input an LP encoded as a string $latex {x \in \{0,1\}^*}&fg=000000$, and outputs its solution also encoded as a string in $latex {\{0,1\}^*}&fg=000000$. In this setting we need a little bit of caution, in particular we now want the LP to be defined with rational numbers rather than real numbers, since in the former case one has a trivial encoding as a string in $latex {\{0,1\}^*}&fg=000000$. Furthermore to bound the time complexity of the Turing Machine $latex {M}&fg=000000$ (which would for instance be the code for the ellipsoid method together with Khachiyan’s rounding) we now need to control the size of the rational numbers we are manipulating! These subtleties make the formal treament of LP much more complicated than what we did earlier in this course. However in the end one can still prove that the solution to rational LPs can be computed in polynomial-time (that is in $latex {n^c}&fg=000000$-time for some constant $latex {c>0}&fg=000000$).

Is everything computable?

This section is slightly outside of the theme of optimization, but the idea is so beautiful that I could not resist presenting it. Now that we have a model of computation we can ask this very simple question: is it possible for any function $latex {f : \{0,1\}^* \rightarrow \{0,1\}^*}&fg=000000$ to find a Turing Machine $latex {M}&fg=000000$ that computes $latex {f}&fg=000000$? This question has mind-blowing philosophical interpretation but I won’t go into that. At the very least it is a very cool question! The answer is equally awesome: there exists functions which are uncomputable. We can even exhibit such a function in a few lines, using a diagonalization argument (which is reminiscent from Cantor’s proof of uncountability of real numbers).

First note that any Turing Machine $latex {M}&fg=000000$ can be encoded as a string in $latex {\{0,1\}^*}&fg=000000$ (one just need to code the state space and the transition function). We denote by $latex {\llcorner M \lrcorner}&fg=000000$ the encoding of $latex {M}&fg=000000$ as a string, and by $latex {M_x}&fg=000000$ the Turing Machine that corresponds to the encoding $latex {x \in \{0,1\}^*}&fg=000000$ (of course we can assume that any string encodes some Turing Machine). Now consider the function $latex {f : \{0,1\}^* \rightarrow \{0,1\}}&fg=000000$ that outputs $latex {0}&fg=000000$ if and only if $latex {M_x}&fg=000000$ outputs $latex {1}&fg=000000$ on $latex {x}&fg=000000$. Assume that $latex {f}&fg=000000$ is computable, so that there exists $latex {M}&fg=000000$ that can compute $latex {f}&fg=000000$. In particular $latex {M}&fg=000000$ outputs $latex {1}&fg=000000$ on $latex {\llcorner M \lrcorner}&fg=000000$ if and only if $latex {f(\llcorner M \lrcorner) = 0}&fg=000000$, which happens if and only if $latex {M(\llcorner M \lrcorner) = 0}&fg=000000$. We arrive at a contradiction, and thus this function is not computable!

Lower bounds?

Let us step back for a moment and recall why we went into the trouble of defining precisely a model of computation. Our primary goal was to show some impossibility results, that would yield ‘some kind’ of optimality for the algorithms that we derived in the previous lectures. Unfortunately we have absolutely no idea on how to do that. We basically cannot say anything beyond trivial statements such as: ‘well your Turing Machine better has to read the entire input…’ (this is not entirely true, for instance slightly more refined things can be said when you restrict the space complexity of your Turing Machine, see this paper by Ryan Williams). This state of affair is immensely disappointing in my opinion. In the next lecture I will present the now standard NP completness argument that can be interpreted as a way to certify that certain problems are indeed very difficult.

This entry was posted in Theoretical Computer Science. Bookmark the permalink.