From my understanding, Grover's algorithm is often misinterpreted as being able to find elements in lists. And when people try to understand the oracle function in terms of this, it leads to confusion.
I understand that Grover's algorithm finds the input to a function that returns true in $\sqrt{n}$ steps. (And that this is the more general purpose where it's useful.) But I don't see why this can't be used to also efficiently find elements in unsorted lists.
For example, if the function is $x == 5$ (that is, it returns TRUE when the input is 5, and false otherwise) and I have the list $\{4, 8, 2, 3, 1, 9, 10, 12, 5 \}$ (so no duplicates of 5). Grover's algorithm CAN find this in 3 steps, no?
I guess the issue is that the efficiency of writing this function to return true if x==5 and return false if x $\neq 5$ is costly enough that you don't actually get speedup (similar to what is said here)?
EDIT: To try to make my question more clear. In a nutshell it is: "What exactly in the math of grover's algorithm prevents it from being used to efficiently find an element in an unsorted list?"
Possible answers:
- Based on this question: Grover's cannot efficiently find elements in lists because the oracle specifically requires knowing where the state is in the database, and by doing so makes it impossible to actually find something that was not already known.
My confusion: Is it really impossible to write an oracle as I've written above that simply checks for a value in a set of inputs? (If what I wrote above isn't clear, then I think it's better explained in @gIS's answer here. ) So there really is no algorithmic way of constructing a function to find a specific element in a list? Seems far fetched to say that it's impossible for a quantum computer to do this.
- Grover's algorithm isn't efficient because encoding the classical information to quantum data is slow and makes the overall process inefficient.
My confusion: then if everything is uploaded at first in a sort of "QuantumRAM" you only have to deal with this overhead once - so it would be efficient if multiple searches are performed.
- Grover's algorithm isn't efficient because the oracle function that would check for the actual desired value in the list is prohibitively costly.
My confusion: Can this be made a bit more explicitly if it's true? How costly is such a function to check an element in a list. It seems very counterintuitive such a simple function would be too costly to be worth implementing.