User:Omnissiahs hierophant/sandbox

Cool papers

 * Decoherence and Schrödingers cat

Basis translation
We can perform basis translations to obtain other circuits that performs the same action as $$\left(P(\delta) \cdot X\right)^2$$.

Let $$XU=Y$$ and we get from matrix multiplication that $$U=\begin{bmatrix} i & 0 \\ 0 & -i\end{bmatrix} = iZ$$.


 * $$XU = X\sqrt{U}^2 = \sqrt{U}^{\dagger} X \sqrt{U} = Y$$
 * $$P(\delta)U = \sqrt{U}^{\dagger} P(\delta) \sqrt{U} = P(\delta)$$

That is, after performing the basis shift, $$X$$ becomes $$Y$$, but $$P(\delta)$$ remains unchanged.


 * $$\left(P(\delta) \cdot X\right)^2 = \left(P(\delta) \cdot Y\right)^2$$

Circuit implementation of Grover's Algorithm
For simplicity we will just assume that Grover's 'unordered database' (or haystack, in which we find the needle) is the state space provided by an $$n$$-qubit quantum register. That is, let $$N = 2^n$$. We call the (single) solution state $$|\omega\rangle$$.

The algorithm consists of four parts.
 * 1) Initialization of the register to a uniform superposition $$|s\rangle = \frac{1}{\sqrt{2^n}} \sum_{x=0}^{2^n-1} |x\rangle$$
 * 2) An oracle $$U_\omega$$ that marks a basis state (or eigenstate) by flipping its phase
 * 3) The Grover diffusion operator $$U_s$$, that amplifies quantum states that $$U_\omega$$ marked (inversion about the mean)
 * 4) Measurement

Step 2-3 can repeated $$\pi/4 \sqrt{N}$$ times, for highest probability of success.

In theory it is also possible to execute $$(U_s \cdot U_\omega)^{\frac{\pi \sqrt{N}}{4}}$$ but in practice it is probably intractable to accurately factorize this matrix into a circuit. If possible, it would result in a 100% probability of success, without repetition.

Implementation of $$U_\omega$$
In short, the oracle $$U_\omega$$ flips the phase of the state that we are seeking. The gate $$U_\omega$$ operates on a quantum register with size $$n$$ and can be implemented as two functions: A boolean arithmetic function $$F_b$$ that outputs $$|1\rangle^{\otimes n}$$ only when the sought-after state $$|\omega\rangle$$ is found, and a controlled Pauli-Z gate $$CZ_n$$ (that span all $$n$$ qubits so its size equals $$F_b$$. That is, it usually have many more than a single control qubit.) The whole $$U_\omega$$ function is then the series circuit: $$U_\omega = F_b^\dagger \cdot CZ_n \cdot F_b.$$ The final adjoint operator $$F_b^\dagger$$ is for restoring the register it operates on, so that all $$U_\omega$$ does is to flip the phase for the single state $$\omega$$.

The boolean arithmetic function $$F_b$$
$$F_b$$ solves the decision problem of determining if a specific solution $$x$$ is a solution to the problem at hand. This is a boolean logic circuit $$F_b : |x\rangle \mapsto \begin{cases} |1^{\otimes n}\rangle & \mbox{for }x=\omega \\ |\mbox{any other value}\rangle & \mbox{otherwise.}\end{cases}$$

Note that since $$F_b$$ performs a boolean arithmetic function, its matrix elements are all zeroes and ones. In other words, it does not introduce phase shifts, or result in superpositions if given basis states. A further consequence of this is that it is a one-to-one permutation of all possible input values to the output values (which means that one has to use ancilla qubits for operations that are not otherwise easily made bijective). That the matrix only contains entries that are zero or one also means that $$F_b$$ preserves phase, and is "transparent" to the action of $$CZ_n$$. Since $$F_b$$ is by necessity a Hermitian matrix, the adjoint $$F_b^\dagger$$ is just $$F_b$$ backwards.

Because it operates a superposition (linear combination) it will solve this decision problem for every possible value $$0 \le x \le N-1$$ simultaneously.

Also, $$U_\omega = F_b^\dagger \cdot CZ_n \cdot F_b$$ is the change of basis of the $$CZ_n$$ operator, so that it performs a phase inversion in the $$F_b$$-basis.

In toy examples used for teaching, $$F_b$$ is usually just Pauli-X gates that invert the controls for the Pauli-Z phase flip gate, so that $$U_\omega$$ flips the phase of a known constant.

Implementation of Grover's diffusion operator $$U_s$$
let $$s = |0\rangle^{\otimes n}$$

A common circuit implementation for the diffiusion operator is:

$$U_s = 2 \left|s\right\rangle \left\langle s\right| - I = X^{\otimes n} \cdot CZ_n \cdot X^{\otimes n}$$