1
$\begingroup$

The Grover algorithm deals with sorting in an unstructured database and we can build an oracle (target function f) to achieve this. The oracle returns 1 if the element we search is founded otherwise 0. Now my question is whether it is possible to add a condition into the oracle such as I'm looking odd element from a list l where l = [0,1,2,3,4,5]. As far as I know, the Grover algorithm can't do a search under a specific condition, correct? Thank you for your answer. enter image description here

$\endgroup$
2
  • $\begingroup$ Yes, that is possible. What have you tried so far in order to define a function that does that? How could you describe that "mathematically"? $\endgroup$
    – Fleeep
    Dec 18, 2021 at 16:40
  • $\begingroup$ @Fleep Thank you for your reply. Actually I want to solve the following problem: There two ruels r1 and r2 where r1:element 0 -> element 1 and r2: element 2 -> element 3. Is it possible to fine which rule contain which element by the Grover algorithm? I've done the following circuit in Qiskit but don't have clue about the further step. $\endgroup$ Dec 19, 2021 at 8:33

2 Answers 2

1
$\begingroup$

Yes, it's possible. In Grover, or more generally amplitude amplification, you perform the following repeatedly:

  1. Reflect on the good space
  2. Reflect on the initial state

During the reflection about the good space, you must mark the good space and during this marking process, you can add any condition you like including checking whether or not the "data part" of your state is in a certain list. What would this "condition checking" look like in a circuit? Exactly as it would look like in a classical computer.

$\endgroup$
0
$\begingroup$

See this tutorial of Microsoft . Refer to the SAT oracle tutorials, where you can implement a very general oracle.

$\endgroup$

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.