2
$\begingroup$

I'm referring to the Grover implementation for the 3-SAT problem:

https://qiskit.org/textbook/ch-applications/satisfiability-grover.html

For the given problem

Problem description

the generated quantum circuit is as follows:

Quantum Circuit

Can someone interpret how the circuit relates to the 5 clauses described above?

Thanks Kurt

$\endgroup$

1 Answer 1

1
$\begingroup$

Note that $f(v_1,v_2,v_3)$ can be written as $1\oplus v_1\oplus v_2 \oplus v_3\oplus v_2*v_3 \oplus v_1*v_2*v_3$ where $\oplus$ is the exclusive OR (XOR) and $*$ is AND but written like this is easier to the computation as AND behaves as the usual product and $\oplus$ behaves like a (binary) sum.

You can check it yourself (or using qiskit/python) as shown here

$v_1$ $v_2$ $v_3$ $f(v_1,v_2,v_3)$ output phase
0 0 0 1 1
0 0 1 0 -1
0 1 0 0 -1
0 1 1 0 -1
1 0 0 0 -1
1 0 1 1 1
1 1 0 1 1
1 1 1 0 -1

Here output phase is the global phase of the circuit output state.

If you can write the function in terms of AND and XOR, then it is straightforward. For this case the $x*y*z$ represents the CCZ gate, the $y*z$ is just a CX gate and the rest are simple Z gates (the 1 is not important because the system is the same up to a global phae), so we can write it analogously as:

enter image description here

You can also use this rule to read the original circuit, which reads $$v_1v_2v_3\oplus(\neg v_2*v_3)\oplus v_2\oplus v_1$$ $$=v_1v_2v_3\oplus(1\oplus v_2)v_3\oplus v_2\oplus v_1=v_1\oplus v_2 \oplus v_3\oplus v_2v_3 \oplus v_1v_2v_3$$ here I removed the $*$ for easier reading.

$\endgroup$
3
  • $\begingroup$ Thanks for the answer. So the idea is to first rewrite the 5 clauses (simplify them) and then express them in a quantum circuit as opposed to expressing all 5 clauses (as is) directly in the circuit, right? $\endgroup$ Commented Aug 26, 2022 at 11:31
  • $\begingroup$ @KurtStockinger I wrote a bit more $\endgroup$
    – Mauricio
    Commented Aug 26, 2022 at 12:15
  • $\begingroup$ @KurtStockinger did this solve the problem? Please consider accepting the answer if it does. I may provide more details if needed. $\endgroup$
    – Mauricio
    Commented Aug 30, 2022 at 8:11

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.