Turing Machines

Warmup

  • Write a Turing Machine $ M_1$ such that $ M(w) = 1$ iff $ w$ is a binary encoding of the value $ 4$ . Try not to use more than $ 5$ states.
  • Write a Turing Machine $ M_2$ such that $ M(w) = 1$ iff $ w$ is a binary encoding of the value $ 4$ , and $ M(w) = 0$ otherwise;
  • What is the difference between $ M_1$ and $ M_2$ ?

Let $$ f(w) = \left\{\begin{array}{cc}1 & w=0^*100 \\ 0 & \text{otherwise} \end{array}\right. $$

Observe the difference between a mathematical function such as $ f$ , which is merely a mapping between entities, and a Turing Machine, which is a computational procedure illustrating how to determine an output value starting from an input value.

The notation $0^*100$ is a regular expression. An excellent reference for details on regular expressions is [1] .

We observe that $ f$ is the problem of establishing if a word is the binary encoding of the value $ 4$ . The Turing Machine $ M_1$ accepts $ f$ , while $ M_2$ decides $ f$ . The notions of acceptance and decision will be formally defined in the following lecture. Until then, we observe that: $$ \forall w\in\Sigma^*: M(w) = f(w) $$ captures the intuitive notion of 'solvability'. A Turing Machine 'solves' $ f$ , if $ M$ always halts, and the output of $ M$ for any problem instance $ w$ coincides with the answer assigned to $ w$ by $ f$ . The informal notion of 'solvability' will be replaced by decision and acceptance, in the following lecture.

More problems

  1. Checking if a binary string ends with $100$
  2. Checking if a binary string has the same number of ones and zeros (lecture)
  3. Checking if a number is a palindrome (you may assume, for simplicity, that the $|w|$ is even)
  4. Identify a function whic h cannot be computed by a Turing Machine
  5. Reversing a string

References