Translation of Quantum Circuits into Quantum Turing Machines for Deutsch and Deutsch-Jozsa Problems

We want in this article to show the usefulness of Quantum Turing Machine (QTM) in a high-level didactic context as well as in theoretical studies. We use QTM to show its equivalence with quantum circuit model for Deutsch and Deutsch-Jozsa algorithms. Further we introduce a strategy of translation from Quantum Circuit to Quantum Turing models by these examples. Moreover we illustrate some features of Quantum Computing such as superposition from a QTM point of view and starting with few simple examples very known in Quantum Circuit form.

Further [7][8] offer a demonstration of equivalence of QTM and Quantum Circuit families by a general methodology of translation between them, but without showing some translation like that which is the matter of this article.
In [9] a good landscape of different quantum computing models as well as quantum languages is illustrated.

The Deutsch problem
One of the simplest quantum algorithms is Deutsch's algorithm, his study is a initial obliged step for the Quantum Computing students. This algorithm is about the functions from the set {0, 1} to the set {0, 1}. There are 4 such functions that we can describe as follows: Note that the third function may would be written also I(x), where I is the identity function. (1), i.e., it is one to one, and reversible. Differently, a function is constant, that is f(0) = f (1). The four functions above include two balanced and two constant functions. Deutsch's algorithm solves the following problem: Given a function f : {0, 1} → {0, 1} as a black box, where one can evaluate an input, but having no knowledge about how the function is defined, he has to determine if the function is constant or not. With a classical computer, one would have to first evaluate f on an input, then evaluate f on the second input and then compare the outputs: with a classical computer, f must be evaluated twice. A quantum computer can be in two states at one time. We shall use this superposition of states to evaluate both inputs at one time. We can show one particular input to feed the black-box-function in a way that obtained output give us the complete answer.

Starting with a quantum gate for a one step evaluation
Let f the function to evaluate, then the following black-box U f will be the corresponding quantum gate : Figure 1 Quantum gate for f evaluation The top input, , will be the qubit value that we want to evaluate and the bottom input, , is a control qubit for the output.
The top output will be the same as the input qubit that is the identity function for that qubit, so to preserve the reversibility, that is a must for quantum gates. The bottom output will be the qubit where is XOR, the exclusive-or operation (binary addition modulo 2). Briefly we can represent the quantum gate for f as : (1) And , obviously, if we apply twice it, we obtain the identity gate, as the reader can check quickly applying U f twice to initial inputs and taking in mind the associative and idem-potency properties of XOR operator. In the following Figure we can see as U f U f = I.

Figure 2 U f is unitary
Let us take a first view at a quantum algorithm to solve this problem [10]. Rather than evaluating f twice, as in classical solution, we shall try to take an advantage of superposition of states. Instead of having the top input to be either in state or in state , we shall put the top input in state which is the superposition equally balanced as amplitudes of both. The Hadamard gate can place a qubit in such a state, in fact . Thus we have the following quantum circuit:

Figure 3 Evaluating two values in one step
In matrix representation this circuit corresponds to . Here H is the Hadamard gate and I is the Identity gate, that in the figure is omitted. We examine the states of the system at every step time. In we have the state . Then, after the application of U f we have the final state in as . Measuring the bottom qubit we will have with the same probability as result f(0) and f(1), loosing so the advantage of quantum superposition.

Deutsch Algorithm
Now use the previous lesson to actually give Deutsch's algorithm. Deutsch's algorithm works by setting both the top and the bottom qubits into a superposition again using the Hadamard gates. We will also apply an Hadamard gate on the results of the top qubit.

Figure 4 Quantum Circuit for Deutsch algorithm
In terms of matrices this can be written as .
Here too H are the Hadamard gates and I is the Identity gate, that in the figure is omitted.
Given that and , in we have the state .

So we have in
, applying the U f gate, the following state: (2) That the reader can easily verify is equivalent to: Given that and , we have in , applying the H gate on the top qubit, the following state, omitting the phase : Clearly now a measure on the first qubit solves the problem!
The reader should notice the fact that the output of the top qubit of U f should not change from being the same as the input. This is not the case because of the inclusion of the Hadamard matrices. This is the essence of the fact that the top and the bottom qubits are both part of the same input. We gain access to the information, but not create it from the null. There are four possible functions, and we know that with a classical computer we needed two bits of information to determine which of the four functions we were given. The core idea of the Deutsch algorithm is to transform data in such a way to answer to the question "Is the function balanced or constant?" and not to the question "What is the value of the function on 0?" or the question "What is the value of the function on 1?" as the direct way does. But, given in this way, the measure done on the top qubit answers to the first of the three above questions, and so it determinates which group among two groups the function belongs. defined, given before that you are assured that each function considered is either balanced or constant.
Our aim is to determine if the function is balanced or constant. Notice that when n = 1, this is exactly the problem that the Deutsch algorithm solved. Classically, this algorithm can be solved by evaluating the function on different inputs. The best case scenario is when the first two different inputs have different outputs, which assures us that the function is balanced. In contrast, to be sure that the function is constant, one must evaluate the function on more than half the possible inputs. Different would be the case of a probabilistic algorithm [11]. If the top qubit line in Deutsch-Jozsa algorithm is generalized with to n qubit lines, representing the domain of the new group of functions, and this change is propagated coherently to the whole quantum circuit, we have the Deutsch-Jozsa algorithm starting from the Deutsch algorithm, in quantum circuit notation.

A Quantum Turing Machine For Deutsch algorithm
We give the following definition of a Quantum Turing Machine. Follow some other features with the aim to define and explain the meaning of configuration and computation :  A tape is a pair of strings w L and w R such that w L ϵ and w R ϵ .
 h ϵ Γ is the head of the tape whenever is the rightmost symbol of w L .
The initial configuration is <q 0 , where w ϵ Γ* is the input.
 An final configuration is <q F , where q F ϵ F and w ϵ Γ* is the output. We assume that if a final configuration is the superposition of more than one then all them are in a final state. So, for each configuration c 0 and all its successor configurations c 1 , . . . , c k the following sentence must be true: if α i is the amplitude assigned to the transition from c 0 to the configuration c i , then α =1 (5) where |α i | 2 represents the probability of transition from c 0 to c i , but c 1 , . . . , c k occur in parallelism and so step by step until a measurement is not effectuated.
Note that after the first step the starting configuration c 0 can be also a superposition of configurations, in this case the next configuration is always determined by the transition function, but weighting each component of c 0 with the relative amplitude.
We will represent the transition function with a matrix adding some conditions, with the aim to represent the Deutsch algorithm with a QTM . Referring to Deutsch algorithm we assume having a single tape with two symbols representing initial top and bottom qubits. then if we define δ with the following rules, we have a QTM that performs the Deutsch algorithm. Note that these are written taking in mind the relative circuit design and the operating principles of Hadamard (H) gate.
The reader should observe that no head move is present in the rules and the initial qubits are generated from blank symbol in the initial rule. The real input is not given on the tape but by the function f embedded in the rules 11,12,13 and 14.
Note that we can substitute superposition among rules, represented apparently by indeterminism, by superposition on the tape. For example rules from 7 to 10 may be substituted with the following couple of rules: or equivalently with the following couple of rule Further, always taking in mind the same principle, they may be substituted by a single equation, expressing all the superposition on the tape instead that by the multiplicity of rules : Similarly, rules from 15 to 18 may be rewritten in the following form: Anyway, independently of the form chosen for the rules, this QTM perfectly simulates the Deutsch algorithm. It starts with a blank tape and in the initial state, writing the fixed symbol 01 on it representing the top and bottom qubit of the corresponding quantum circuit.
The group of rules from 7 to 10 represent applying Hadamard gates to both qubits, and so we advance one step in quantum algorithm state. The rues from 11 to 14, applied to superposition of states obtained by previous step, result in simultaneous calculus of f(0) and f(1) performed by U f gate.
Finally the rules from 15 to 18 correspond to apply the Hadamard gate to the top qubit and Identity gate to the bottom qubit in the last step. Now we have reached the final state, and reading on the tape the first symbol we obtain the answer of the Deutsch problem.