0
$\begingroup$

A quantum boolean oracle is an operator that should work as follows: $ \sum_x U_f |x, 0> = \sum_x |x, f(x)>$.

Now, suppose that I have two input qubits and two output qubits and I want to implement the following $f(x)$:

  • f(00) = 00
  • f(01) = 10
  • f(10) = 11
  • f(11) = 01

The above function is just an example (I'm looking for a more general answer). How can I implement something like that in Qiskit? I saw TruthTable Method, but it seems to work correctly only in the case of one output qubit.

$\endgroup$

1 Answer 1

1
$\begingroup$

Generally speaking (also in classical compuatation) , output with more than 1 bit, is implemented by seperate function for each bit. Same fir qubits which are acting like bits, but in superpositions of different states in the same time.

So in this case, all you have to do, is to create 2 ancilla qubits instead of 1, each one with its relevant oracle.

The first oracle:

f(00) = 0

f(01) = 1

f(10) = 1

f(11) = 0

The second:

f(00) = 0

f(01) = 0

f(10) = 1

f(11) = 1

$\endgroup$
5
  • $\begingroup$ I don't think this is a good advice. Can you point to some example of classical computation where we implement these kind of functions bitwise? I can think of many of cases where we don't do this. (i.e. boolean circuits for sum, multiplication, whatever..) $\endgroup$
    – asdf
    Sep 5, 2022 at 10:39
  • $\begingroup$ Actually you gave example to the cases that are doing it, for example full adder of few bits geeksforgeeks.org/4-bit-binary-adder-subtractor $\endgroup$
    – Ron Cohen
    Sep 6, 2022 at 4:36
  • $\begingroup$ The output may also depend on another output, but yet, calculated seperatly $\endgroup$
    – Ron Cohen
    Sep 6, 2022 at 4:37
  • $\begingroup$ Oh, I see what you mean now! Tnx! But that actually does not lead to many optimization to the circuit, no? $\endgroup$
    – asdf
    Sep 6, 2022 at 14:11
  • $\begingroup$ I order to make optimization you can use things like Karnoo maps, seperatly to each output, in the classical case. $\endgroup$
    – Ron Cohen
    Sep 7, 2022 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.