# Is it possible to run the Grover algorithm under specific condition

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.

• 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"? Commented Dec 18, 2021 at 16:40
• @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. Commented Dec 19, 2021 at 8:33