First of all I'm very new to the quantum computing world so this might seem trivial to you, but it's a hump I was unable to get over for days now.
So I'm talking about the version that Qiskit has implemented for their 3-SAT example
Their example clauses look like this:
I recreated their code and printed the circuit to get an understanding of how the oracle works:
Obviously the first 3 Qubits represent the variables, the 5 Qubits labelled c
seem to be simple booleans that indicate wether a clause is satisfied, the one labelled o
is some sort of output and the remaining 3 are some sort of ancillaries.
What happens in the first 3 Qubits seems obvious as well (not 100% confident though), it just transforms the given clauses into binary values on the qubits.
After the modification of the qubits there is an OR-Circuit that checks wether any one of the qubits satisfies the given clause. If that is the case, it flips the Qubit representing the corresponding clause (c0
for the first clause). I think it also flips the a0
Qubit, but I am unsure as to what the purpose of this is.
This is repeated for every clause, until an AND-Circuit finally checks if all clauses are satisfied. I fail to understand what it does to the ancillary Qubits though.
After that the entire Circuit apart from the AND-Circuit is repeated to get back to the initial state.
I am confused as to how the output of this oracle actually looks. In other examples of Grover's Oracle it just flips the correct combinations but in this case that does not seem to make sense. Also I am confused as to where the measurement is actually taken, is it the ancilliary qubits?
I am sorry for presenting such a broad and vague question, but I don't know how to explain the issue I have any further.
For completeness sake I will also add the entire algorithm to hopefully clear up some confusion:
The Grover's algorithm in this case can be described as this circuit: