Skip to content

11.2 Computation Traces

Step-by-step evolution of Turing machine configurations and how computations are represented as traces.

A Turing machine does not compute in one large jump. It computes step by step. A computation trace records these steps.

Each step changes the machine from one configuration to the next.

A configuration contains all information needed to continue the computation:

ComponentMeaning
current statethe machine’s internal state
tape contentsthe symbols written on the tape
head positionthe cell currently being scanned

Once these are known, the next step is determined by the transition function.

A configuration is often written by placing the current state next to the symbol under the head.

For example, suppose the tape contains:

1011 1011

and the head is reading the first symbol while the machine is in state q0q_0. We may write:

q01011 q_0 1011

If the head is reading the third symbol, we may write:

10q011 10q_0 11

This notation means that the state symbol marks the current head position.

One-Step Transitions

A one-step transition is written as:

CC C \vdash C'

This means configuration CC changes into configuration CC' in one machine step.

If:

δ(q,a)=(q,b,R) \delta(q,a)=(q',b,R)

then the machine does the following:

  1. it reads aa
  2. it writes bb
  3. it moves right
  4. it enters state qq'

For example, if the current configuration is:

xqay xqay

where xx and yy are strings, and the head reads aa, then after moving right we get:

xbqy xbq'y

Here bb replaces aa, and the state symbol moves one position to the right.

For a left move, if:

δ(q,a)=(q,b,L) \delta(q,a)=(q',b,L)

and the current configuration is:

xcqay xcqay

then the next configuration is:

xqcby xq'cby

The symbol bb replaces aa, and the head moves left onto the previous cell containing cc.

Multi-Step Computations

A full computation is a sequence:

C0C1C2 C_0 \vdash C_1 \vdash C_2 \vdash \cdots

The initial configuration is C0C_0. It contains the input word, the start state, and the initial head position.

We write:

CC C \vdash^* C'

to mean that CC' is reachable from CC in zero or more steps.

So:

CC C \vdash^* C

is always true, because zero steps are allowed.

If there is a sequence:

C0C1Cn C_0 \vdash C_1 \vdash \cdots \vdash C_n

then:

C0Cn C_0 \vdash^* C_n

Halting Traces

A computation halts when the machine reaches a halting state, such as:

qaccept q_{\mathrm{accept}}

or:

qreject q_{\mathrm{reject}}

If the machine reaches qacceptq_{\mathrm{accept}}, we say it accepts the input. If it reaches qrejectq_{\mathrm{reject}}, we say it rejects the input.

A halting trace has finite length:

C0C1Cn C_0 \vdash C_1 \vdash \cdots \vdash C_n

where CnC_n is halting.

A non-halting trace is infinite:

C0C1C2 C_0 \vdash C_1 \vdash C_2 \vdash \cdots

In that case, the machine runs forever.

Example Trace

Consider the simple machine from the previous section. It scans right until it sees a blank.

Its rules are:

δ(q0,0)=(q0,0,R) \delta(q_0,0)=(q_0,0,R) δ(q0,1)=(q0,1,R) \delta(q_0,1)=(q_0,1,R) δ(q0,)=(qhalt,,R) \delta(q_0,\sqcup)=(q_{\mathrm{halt}},\sqcup,R)

On input:

1011 1011

the trace is:

q010111q001110q011101q011011q01011qhalt q_0 1011 \vdash 1q_0 011 \vdash 10q_0 11 \vdash 101q_0 1 \vdash 1011q_0 \sqcup \vdash 1011\sqcup q_{\mathrm{halt}}\sqcup

This trace shows the head moving right across the input. The tape contents do not change, but the position of the state symbol changes.

The final configuration contains qhaltq_{\mathrm{halt}}, so the computation stops.

Traces as Evidence

A computation trace is useful because it gives concrete evidence of what the machine does.

To show that a machine accepts an input, we can display a finite trace ending in:

qaccept q_{\mathrm{accept}}

To show that a machine rejects an input, we can display a finite trace ending in:

qreject q_{\mathrm{reject}}

Showing that a machine never halts is harder. A finite trace can show only finite behavior. To prove non-halting, we need a general argument, such as showing that the machine repeats a pattern forever.

Determinism and Traces

For a deterministic Turing machine, each configuration has at most one next configuration.

So from a fixed input, there is only one possible trace:

C0C1C2 C_0 \vdash C_1 \vdash C_2 \vdash \cdots

This makes deterministic computation easy to reason about. There is no branching.

For nondeterministic machines, one configuration may have many possible next configurations. Then computation forms a tree rather than a single path. Deterministic machines are enough for the main computability theory developed here.

A computation trace is the operational view of a Turing machine. It turns the transition function into an explicit sequence of configurations, making the behavior of the machine visible one step at a time.