8

I'm currently working on a reduction from $A_{TM}$ to another language, and have been reading through some example proofs. I've come across the situation where, for example, we have $L = \{ \langle M,w \rangle | \text{ ...etc} \}$, where obviously this would normally stand for $M$ being a TM and $w$ being a string. However, later in the proofs, we replace the $w$ (a string) with an "encoding of a turing machine". Sometimes it's even "an encoding of the TM, $M$".

I'm rather lost on this idea. How do we pass an "encoding of a TM" into a parameter for a string? How do we run that on a TM? Maybe I'm misunderstanding the definition of an "encoding of a TM", which I assume to be the TM itself somehow converted into a string format.

Would anyone mind explaining this to me? I'm sure truly understanding this concept would immensely help me in writing further reductions.

Raphael
  • 73,212
  • 30
  • 182
  • 400
user3472798
  • 481
  • 2
  • 5
  • 9

2 Answers2

8

A Turing machine $M$ can be described as a 7-tuple $(Q,F,q_0,\Sigma,\Gamma,\delta, blank)$. This means that if someone gives you this 7-tuple, then the TM is well-defined, and you can precisely define how it behaves, etc.

The encoding of a TM, usually denoted as $\langle M \rangle$ is a string that encompasses all the information of the 7-tuple describing $M$. You can think of it as "writing the 7-tuple as a binary string" (but this is a simplification). So the encoding of M, is just a string that describes how the TM works.

The last observation is that if you know the encoding - you know everything about the TM; specifically, if $\langle M \rangle$ is given as an input (to a machine $M'$), the TM $M'$ can "run" or "simulate" what $M$ would have done on any given input -- the machine $M'$ knows the states $Q$ of $M$ and the transition $\delta$ of $M$, so it can imitate its actions, step by step.

Ran G.
  • 20,884
  • 3
  • 61
  • 117
6

Part of your confusion seems to be about the nature of $\langle\,M\,\rangle$. That's just a string like any other, except that it is a complete description of $M$. For example, a managable project for an introductory programming course might be to write a program which, when given an input describing a TM, shows the action of that TM on some input. What would such a program need as a description of a TM? We might decide to do something like this:

  1. A list of the states, [q0, q1, ... , qn].
  2. A description of which states are start, accept, and reject states, s, a, r, where each of these is one of q0 ... qn
  3. A list of move rules, of the form (p, a, r, b, d) corresponding to the move $\delta(p, a) = (r, b, d)$, i.e., in state $p$ with input $a$, change to state $r$, write $b$ on the tape, and move in direction $d$ (left or right).

With that information, the program to simulate the TM wouldn't be too hard to write. The point here is that the string

[q1, q2], q1, q1, q2, [(q1, 0, q1, 1, R), (q1, 1, q2, 1, L), ... ] 

would be a complete description of a TM, suitable for use as the basis of the simulation by our assigned program. This description is what we call $\langle\,M\,\rangle$. Now we might further encode this in a more limited alphabet, but that's immaterial. The point is that it can be done: any TM can be described by a suitable string.

Rick Decker
  • 15,016
  • 5
  • 43
  • 54