Simple circuit simulations of classical and quantum Turing machines

by   Yuri Gurevich, et al.
University of Michigan

We construct reversible Boolean circuits efficiently simulating reversible Turing machines. Both the circuits and the simulation proof are rather simple. Then we give a fairly straightforward generalization of the circuits and the simulation proof to the quantum case.



There are no comments yet.


page 6


Revisiting the simulation of quantum Turing machines by quantum circuits

Yao (1993) proved that quantum Turing machines and uniformly generated q...

Circuit pedantry

Boolean and quantum circuits have commonalities and differences. To form...

Characteristics of Reversible Circuits for Error Detection

In this work, we consider error detection via simulation for reversible ...

Efficient ancilla-free reversible and quantum circuits for the Hidden Weighted Bit function

The Hidden Weighted Bit function plays an important role in the study of...

StoqMA meets distribution testing

𝖲𝗍𝗈𝗊𝖬𝖠 captures the computational hardness of approximating the ground e...

A Schematic Definition of Quantum Polynomial Time Computability

In the past four decades, the notion of quantum polynomial-time computab...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1. Introduction

The origin of this paper was our dissatisfaction with the standard definition of the uniform circuit complexity. In the circuit computation model, a computational problem is associated with a family of circuits where each circuit handles -bit inputs in the Boolean case or

-qubit inputs in the quantum case. The most common uniformity condition requires that a single logspace

111Another popular uniformity condition uses polynomial-time rather than logspace, but logspace uniformity is more common. Turing machine computes every given in unary notation.

This complexity-theoretic uniformity is important for theoretical purposes but is not used for practical programming. Instead, circuits are usually described parametrically, and this suffices to guarantee uniformity.

A natural problem arises to formalize the notion of parametric uniformity so that one can deal with it theoretically. In order to address this problem, we looked around for challenging examples. In this connection, we came across a recent paper [6] by Abel Molina and John Watrous describing circuits that simulate quantum Turing machines. We tried to achieve such simulations by parametric circuits. This paper reports our results in this direction as well as analogous results for reversible classical Turing machines.

We should emphasize though that the idea of parametric uniformity is just a motivation as far as this paper is concerned. We intend to formalize parametric uniformity for Boolean and quantum circuits elsewhere [5]. For the time being we use the notion of parametrized circuits informally.

It is well known that Turing machines are efficiently simulated by (uniform families of) Boolean circuits. In extended abstract [9], Andrew Yao sketched a proof that quantum Turing machines are efficiently simulated by (rather sophisticated) quantum circuits. In paper [6], Molina and Watrous give an elegant proof of Yao’s result, but their circuits and their proofs are still rather involved.

A question arises whether simpler quantum circuits can simulate quantum Turing machines. A related question is whether reversible Turing machines can be efficiently simulated by reversible Boolean circuits.

In this paper, we construct reversible Boolean circuits which efficiently simulate reversible Turing machines. Both the circuits and the simulation proof are rather simple. Then we give a fairly straightforward generalization of the circuits and the simulation proof to the quantum case.

2. Preliminaries

The reader may want to skip this section and consult it only if and when needed.

Reversible Boolean circuits and quantum circuits are mathematical notions requiring precise definitions, and so are Boolean circuit algorithms and quantum circuit algorithms. Not finding such definitions in popular textbooks, we produced definitions in [3] and [4]. To make this paper self-contained, we reproduce those definitions here with minor changes. An added advantage is useful terminology that arises in the course of the definitions.

Definition 2.1.

A syntactic circuit consists of the following components.

  1. Disjoint finite sets of input nodes, output nodes, and gates.

  2. For each gate , two disjoint nonempty finite sets, the set of the entries of and the set of the exits of .
    The sets associated with any gate are disjoint from those associated with any other gate and from the sets in (1). The input nodes and gate exits will be called producers. The gate entries and output nodes will be called consumers.

  3. A set of wires. Each wire begins at a producer and ends at a consumer. Each producer is the beginning of at least one wire. Each consumer is the end of exactly one wire.

  4. A gate is a direct prerequisite of a gate if some wire goes from an exit of to an entry of . The direct prerequisite relation is acyclic. Its transitive closure is called the prerequisite relation (without “direct”).

Definition 2.2.

Consider a syntactic circuit.

  • A gate bout of the circuit is a nonempty set of gates which form an antichain (so that no gate is a prerequisite of another gate ).

  • A schedule over the circuit is a sequence of disjoint gate bouts such that every gate belongs to some bout and all prerequisites of belong to earlier bouts where .

  • A schedule is eager if every comprises all gates whose prerequisites are all in (so that in particular comprises all gates with no prerequisites).

Definition 2.3.

A Boolean circuit is a syntactic circuit together with an assignment, to each gate , of a Boolean function

An algorithm over the Boolean circuit is given by a schedule over the underlying syntactic circuit. An algorithm is eager if the schedule is eager.

Intuitively, the algorithm given by a schedule first fires all gates in parallel, then it fires all gates in parallel, and so on. Thus is the number of steps of the algorithm. All algorithms over the same Boolean circuit  compute the same Boolean function

but may differ in the number of steps. Below, for simplicity, we restrict attention to eager algorithms.

Proviso 2.4.

Below, by default, a Boolean circuit is identified with its eager algorithm.

Definition 2.5.

A Boolean circuit is reversible if

  1. each gate function is a bijection (so that in particular has equally many entries and exits), and

  2. each provider has exactly one outgoing wire (so that the wires determine a bijection from producers to consumers).

3. Turing machines

We presume a basic familiarity with Turing machines, in short TMs, and specify a particular TM species. In this paper, by default, a Turing machine is deterministic and has one two-way infinite tape whose cells are indexed by integers. We also assume that the tape head moves at every step. A Turing machine is given by a finite set of (control) states, a tape alphabet  including a special blank symbol, and a partial transition function

If the machine is in state , its head is scanning symbol in tape cell , and , then in one step the machine will change state to , write in the tape cell , and move the tape head to cell . (The change is vacuous if and the writing is vacuous if .) If is undefined then the machine halts. Initially, the tape is almost everywhere blank, i.e., the number of nonblank cells is finite.

A configuration of a Turing machine is a triple

where  is the set of integers and the function is almost everywhere blank. The configuration means that the state is , the tape head is in tape cell , and is what is written on the tape. (Of course, the blanks far to the left or the right can be ignored. But notationally it simpler to use all of  as the domain of .) Notice that the notion of configuration depends only on and , not on .

Obviously, the transition function  gives rise to a partial successor function on the configurations. In detail, if , then the successor of configuration is the configuration

where the symbol @ indicates that symbol is written at cell , so that and for all . Accordingly is a predecessor of . If is undefined, then has no successor.

3.1. Reversible Turing machines

Definition 3.1.

A Turing machine is reversible if every configuration has at most one predecessor.

Arbitrary Turing machines are efficiently simulated by reversible ones; see [7, §5]. The criterion of reversibility of TM in terms of  is found in [7, §]. We present it in a form convenient for our purposes, and we use the following notation:

Proposition 3.2.

A Turing machine is reversible if and only if  has the following two properties.


and are disjoint.


For every pair , there is at most one pair such that for some .


Let be almost everywhere blank.

If the separability requirement fails, then is irreversible. Indeed, if and , then configurations

have the same successor .

If the separability requirement holds but the injectivity requirement fails, then is irreversible. Indeed, if maps distinct pairs to triples respectively, then by the separability requirement, and therefore configurations have the same successor .

If both requirements hold, then is reversible. Indeed suppose that configurations and have the same successor where . Let , so that . Then coincide with except possibly at . Then . By injectivity, and , and so . ∎

Taking into account the separability property, states in  and  will be called negative and positive respectively when the Turing machine in question is reversible. If , extend arbitrarily so that they remain disjoint and .

Lemma 3.3.

The transition function  of a Turing machine can be extended to a total function in such a way that

  1. if, starting with an initial configuration , never halts, then the modified machine works exactly as on that initial configuration, and

  2. if is reversible then is reversible.


Claim (1) is obvious no matter how  is extended to a total function . To prove claim (2), assume that is reversible. By the separability property and the convention just before the lemma, and partition .

If , let . By the injectivity property, is an injective map from to . Extend to a bijection from to in an arbitrary way. If and , define . Clearly is reversible. ∎

3.2. Looped Turing machine

This paper is devoted to easy circuit simulation of reversible Turing machines and of quantum Turing machines. Following the example of Molina and Watrous [6], we separate concerns and work primarily with machines where  is total, so that the machine never halts. We address the halting-related issues in §4.4.

Fix an arbitrary Turing machine with total transition function . never hangs. Further, fix a positive integer , and restrict attention to -step computations of where the initial configuration is blank outside the segment of the tape. During such a computation the head of is confined to the segment .

Truncate the tape of to the segment , bend that segment into a loop, and identify the end cells and , resulting in cells altogether. Let , be the resulting looped-tape Turing machine.

View the cell indices as residues modulo , and by default interpret index modifications modulo . If the state of is , its head is scanning symbol in cell (modulo of course), and , then in one step changes its state to , writes in cell , and moves the head to cell . As far as our -step computations are concerned, there is no difference between and .

A configuration of is a triple

the role of  is played by the set of residues modulo . As in the case of ,  induces a successor function on the configurations. As in the case of , is reversible if every configuration has at most one predecessor. Proposition 3.2 remains valid for , with the same proof. It follows that is reversible if and only if is reversible.

4. Boolean circuit simulation

We will simulate -step computations of the looped-tape Turing machine with a Boolean circuit of depth where rows of gates are staggered like the bricks in the brick wall of Figure 1.

Figure 1. A brick wall (American bond). Source: Wikimedia [8]

For our purposes, it is convenient to view the brick wall as being composed of half bricks, intended to represent tape cells of at various stages of computation. Each half brick is uniquely determined by two coordinates.

Horizontal coordinate:

The brick wall comprises vertical columns of half bricks. Number the vertical columns left to right using the residues modulo . This gives us the horizontal coordinate .

Vertical coordinate:

The wall has rows of bricks. Number them top down: . This gives us the vertical coordinate .

A brick comprising the half bricks and represents a circuit gate denoted . Notice that half brick is the left half of its brick if and only if is even. Thus, if is even, then half brick belongs to ; and, if

is odd, then half brick

belongs to gate .

The use of residues modulo for numbering the columns hints at a property of our brick wall which is not reflected in Figure 1. Our wall is bent into a cylinder, reflecting the loop structure of . The two half bricks at the ends of row 1 (or any other odd-numbered row) are the two halves of the same brick.

Think of the brick wall as a greedy circuit algorithm where each brick is a gate. The algorithm is greedy in the sense that, at each step, it executes all the gates that can be executed. All the gates of row 0 fire at the first step of the algorithm, all the gates of row 1 fire at the second step, and so on.

For every , the subcircuit composed of rows and will transform any configuration

of the looped Turing machine into the successor configuration. However, for technical reasons, the circuit works with richer data. We introduce annotated versions of every state . It is presumed that the sets

are disjoint. Let . Every row of the brick wall circuit will compute a unary operation on the set

of extended configurations of .

4.1. The brick function

All bricks (that is all brick gates) compute the same function , the brick function. A cell datum is an element of the set . Thus, a cell datum has the form or where and . In the first case, it is scanned, and, in the second, it is unscanned. A brick datum is a pair of cell data where at most one cell datum is scanned. Thus, a brick datum has the form , , or , where and . In the first case, it is a one-head datum, and, in the second, it is no-head datum.

A brick (or brick gate) computes the brick function transforming any input brick datum to an output brick datum. Such inputs and outputs can, if desired, easily be coded as tuples of bits to make the circuits Boolean.

In the rest of this subsection, we define the brick function . To begin, unsurprisingly


In other words, a no-head input is simply copied into the output. (For brevity, we’ll write for .) Suppose that the input brick datum includes the scanned cell. Three cases arise depending on whether the state symbol is in , , or .

First suppose that the state symbol is in , so that the input datum has the form or . Let . Then


Thus indicates successful execution of the -transition, and indicates incomplete execution when the brick updated the state and tape symbol but couldn’t move the head.

Second, after a successful execution, all that remains is to remove . We must, however, also define on 2-data with that cannot arise in the Turing machine simulation. In such “garbage” cases, we simply interchange the two cell data in the input brick datum.


Finally, after an incomplete execution, what remains is to move the head in the appropriate direction and remove . Again, we define on “garbage” cases by interchanging the two cell data in the input brick datum.


This completes the definition of the brick function .

4.2. Reversibility

Theorem 4.1.

If Turing machine is reversible, then the brick wall circuit is reversible.


It suffices to prove that the brick gate is reversible, i.e., that the function defined above is a bijection. Obviously, is bijective on no-head inputs. So we may restrict attention to one-head inputs. Since every injection from a finite set to a finite set of the same cardinality is a bijection, it suffices to prove that on one-head inputs. To this end, assume .

First we suppose that are defined by different equation systems (2)–(4). By symmetry, we may assume that is defined by a later equation system and that is defined by one of the upper equations in (2), in (3), or in (4). By inspection, there are only three cases:

  1. has the form and is defined the first upper equation in (2), while is defined by the second lower equation in (3).

  2. has the form and is defined the second upper equation in (2), while is defined by the second lower equation in (4).

  3. has the form and is defined by the first upper equation in (3), while is defined by the first lower equation in (4).

None of the three cases is possible because of the separability property of .

Thus are defined by the same equation system. If are defined by system (2), then they are defined by the same equation in (2), and then we have by the injectivity property of . If are both defined by (3) or are both defined by (4), then obviously . ∎

4.3. Simulation

Theorem 4.2.

The brick wall circuit algorithm simulates any -step computation of .


It suffices to prove that, for every , the two-row subcircuit, composed of rows and , transforms an arbitrary configuration of into the successor configuration. Since all these two-row circuits are isomorphic, we may restrict attention to the two-row circuit composed of rows 0 and 1.

Let . Two cases arise depending on the parity of . If is even, then the scanned cell is handled by brick which works with input where ; otherwise is handled by brick which works with input where . By symmetry, we may assume that is even.

According to (1), no-head inputs are just copied into outputs. So we pay attention only to one-head inputs. Let .

If , then brick transforms to , and thus row 0 transforms configuration to an extended configuration , so that the scanned cell is handled by brick which works with input . That brick transforms this input into , and therefore the resulting configuration is as required.

If , then gate transforms into , and thus row 0 transforms configuration to an extended configuration , so that the scanned cell is handled by brick which works with input . That brick transforms this input into , and therefore the resulting configuration is as required. ∎

4.4. Premature halting problem

In the preceding part of this section, we have assumed that the looped Turing machine does not have halting computations. Every computation will proceed for (at least) the steps that we want to simulate with a Boolean circuit. In the present subsection, we comment on the situation where the TM’s computations could halt.

Of course, if steps are completed before the TM halts, then our previous results apply to those steps, and subsequent halting is irrelevant. The real issue concerns premature halting, before step

. We cannot simply cut off our circuit at the moment of TM’s halting, as that moment may depend on the input. Is circuit simulation of such a TM nevertheless possible?

First, let us agree on a reasonable definition of Boolean circuit simulation in this situation. A simulation of a TM by a circuit  includes an encoding of initial TM states as inputs to  and a decoding of outputs of  as information about TM configurations. If the TM arrives at a halting configuration , then the circuit’s output should code or, more generally, a required amount of information about , e.g. a version of where is replaced by its restriction to a vicinity of the cell . Whatever it is, the required amount of information as well as a coding scheme should be agreed on ahead of time.

In the absence of any reversibility considerations, this situation is easy to address. Define an extension of our Turing machine so that any halting configuration gets a successor configuration which preserves the required information about . For example, could be itself. (This requires allowing the TM’s head to stay at the same cell, but our work above can easily be extended to cover this option.) Instead of halting, is idling, pretending to compute without doing much. Then let the circuit simulate .

But making the extended machine reversible is not obvious. Let be the set of halting configurations and all their descendants, i.e., successors, successors of successors, etc. Then is closed under the successor operation. Assume that is reversible, so that the successor operation is injective. Since the total number of configurations is finite, the successor operation is a bijection on . Accordingly, the successor of a nonhalting configuration cannot be halting. Thus, every nonhalting initial configuration yields a nonhalting computation.

What can one do? Well, keep from being closed under the successor operation. Starting from a halting configuration , the extended machine will eventually halt, but not before marching around for sufficiently many steps.

Let  where and are disjoint unions and respectively, and let be a function from to such that if and then


Recall that, just before Lemma 3.3, we arranged that and partition .

is reversible because  has the separability and injectivity properties. It remains to check that, on no input, halts before step . Fix some input . If doesn’t halt before step on input , we are done. So suppose that, after steps, arrives at a halting configuration on input .

By symmetry, we may assume without loss of generality that . Abbreviate to ; we have that is undefined. The successor of is , whose successor is , and so on. Eventually, after steps (counting from the halting of ), has converted every into and halts.

It follows that, on input , will perform at least steps without halting. Its configuration after steps is where

The halting configuration of is easily recoverable from the configuration ; just move the head to the cell of the first primed symbol and then remove all the primes.

Extend the transition function of to a total function

as in the proof of Lemma 3.3. The resulting TM is reversible and so, by Theorem 4.2, an appropriate brick wall circuit  simulates -step computations of . But works exactly as on the initial configurations of , and so  simulates -step computations of .

5. Quantum Turing machine

Quantum Turing machines, in short QTMs, were introduced by David Deutsch [2], thoroughly studied by Ethan Bernstein and Umesh Vazirani [1], and recently presented elegantly by Abel Molina and John Watrous in article [6] which is our main reference on QTMs.

Like a classical Turing machine, a quantum Turing machine is also given by a triple where and  are disjoint finite sets, but now  is a function

Quantum Turing machines are also subject to a unitarity requirement to be introduced below. We abbreviate to .

A classical configuration of is a triple

This notion coincides with the notion of configuration in §3 for the same and ; the change in  makes no difference. Initially a QTM is in a classical configuration, just like a classical TM with the same states and alphabet (but of course later the QTM can enter a quantum superposition of classical configurations).

Our goal is a simple quantum-circuit simulation of -step computations of a given QTM

Here is an arbitrary but fixed positive integer. It is presumed that, initially, the head is in cell 0, and the tape is blank outside the segment . As in the classical case, we may assume without loss of generality that has a looped tape whose cells are numbered by residues modulo . Accordingly, a classical configuration of the looped-tape QTM is a triple

To simplify the exposition, we separate concerns and abstract from two issues, as in [6].

  1. The transition function  of our looped-tape QTM is total.

  2. We place no computability restrictions on the complex numbers appearing in . “Any computationally offensive properties possessed by  will be inherited by the quantum circuits that result from the simulation,” [6, §3].

5.1. The Hilbert space of the QTM

For any finite set , let be the Hilbert space with an orthonormal basis , the canonical basis for . If are canonical bases for Hilbert spaces respectively then the canonical basis for

is the orthonormal basis composed of vectors

where , range over respectively.

Let CELL be the Hilbert space

, and consider the tensor product

. Each classical configuration of the looped-tape QTM is represented by a vector


Intuitively, these vectors are the ones where exactly one cell contains a head. The Hilbert space  of is the subspace of generated by vectors which form the canonical basis for . Thus, as in [6], the canonical orthonormal basis for the Hilbert space of the QTM of interest consists of vectors representing classical configurations of the QTM.

Finally, we can complete the definition of quantum Turing machine . It is required that the transformation

be unitary. This represents any one step in the computation of .

5.2. Transition function

View every as a vector

in the Hilbert space . Let

so that .

Proposition 5.1.

 has the following three properties.

The three claims222Orthogonality and separability here are the analogs of injectivity and separability in Proposition 3.2. form a part of Theorem 5.3 in [1], but it seems useful to spell out a detailed proof.


Let be an arbitrary element of ; for example, may be everywhere blank.

Unit length. If is a classical configuration of the form , then . Since is unitary, we have

Orthogonality. If , then canonical basis vectors and of are orthogonal, and so are their images:


Separability. For any , the canonical basis configurations and are orthogonal, and therefore so are their images:

A summand in the upper sum are orthogonal to every summand in the lower sum unless and . Similarly, a summand in the lower sum is orthogonal to every summand in the upper sum unless and . Setting , we have

The separability property follows. ∎

6. Quantum circuit simulation

We convert the reversible Boolean brick wall circuit, used to simulate -step computations of a reversible Turing machine, to a quantum circuit simulating -step computations of the quantum Turing machine of the previous section. As in §4, we use annotated versions of states of . Again, sets

are disjoint and . The obvious bijections and give rise to obvious isomorphisms from to and to respectively.

The quantum brick circuit works with an extension of the Hilbert space of our QTM . Let be the Hilbert space . The extended space is the subspace of the tensor product generated by vectors


Every row of the quantum brick wall circuit will compute a linear operator on .

To simplify the exposition, our quantum circuit works with qudits in Hilbert spaces and . Obviously such quantum circuits can be easily simulated by qubit-based circuits.

6.1. The brick operator

Let BRICK be the subspace of tensor product generated by vectors

Vectors and are one-head vectors, and vectors are no-head vectors.

All gates of our quantum circuit are copies of a single quantum gate, called the (quantum) brick gate, which computes a linear operator on BRICK. By linearity, it suffices to define on a set of vectors spanning BRICK. We do that in equations (7)–(10).

We start with no-head inputs. just copies any such input into its output.


Let range over . The operator