I guess, I understood simple Deutsch Algorithm (if unary function is balanced or constant) as described here: Introduction to quantum computing: The Deutsch algorithm
I need to test it. I was wondering how I would implement all the four function oracles. I was hoping to find it, already implemented somewhere on IBM Quantum Experience.
Could someone please point me to an implementation for the same?
EDIT: Kind of answering the question: I guess my issue was: I was trying to find $f(x)$ somewhere inside the bigger black box. But if I let go of that (what if I don't want to?), then things become really simple by realizing: we had function: $x \rightarrow f(x)$ But this is not reversible, so we wanted to implement black box with function: $|x, y\rangle \rightarrow |x, f(x) \oplus y\rangle$.
So here is what this translates to four possible functions:
1) $f(x) = 0$: $f(x) \oplus y = 0 \oplus y = y$, So, black box doesn't do anything
2) $f(x) = 1$: $f(x) \oplus y = 1 \oplus y = \bar{y}$ So, black box simply negate the $y$.
3) $f(x) = \bar{x}$: $f(x) \oplus y = \bar{x} \oplus y$ (which is also $\overline{x \oplus y}$)
So, we can implement it in two ways:
Option 1: for $x$: not it twice so that finally we get $x$. for $y$: when $x$ is notted once, at that point use it as control to CNOT $y$ and output that.
Option 2: $x$ is outputted as it is. For $y$ take $x$ as control and CNOT it. Then NOT it. Here CNOT gives $x \oplus y$, and when we NOT it we get $\overline{(x \oplus y)}$ which is same as $\bar{x} \oplus y$
4) $f(x) = x:$ For $y$ simply CNOT it with $x$, using $x$ as control.
I verified it (on IBM Q Experience) and it seems to be working. :-) I see that in all 4 implementation it is possible to not change $x$ at all. But yet, when we measure it, it's value is changing!!! I guess I still have to turn my head around that.