Problem C1

Statement
Copy Copied
Description:
Implement a quantum oracle on $$$N$$$ qubits which checks whether the bits in the input vector $$$\vec{x}$$$ alternate (i.e., implements the function $$$f(\vec{x}) = 1$$$ if $$$\vec{x}$$$ does not have a pair of adjacent bits in state 00 or 11).

You have to implement an operation which takes the following inputs:

- an array of $$$N$$$ ($$$1 \le N \le 7$$$) qubits $$$x$$$ in an arbitrary state (input register),
- a qubit $$$y$$$ in an arbitrary state (output qubit),

and performs a transformation $$$|x\rangle|y\rangle \rightarrow |x\rangle|y \oplus f(x)\rangle$$$. The operation doesn't have an output; its "output" is the state in which it leaves the qubits. Note that the input register $$$x$$$ has to remain unchanged after applying the operation.

Your code should have the following signature:

Note: the operation has to have an adjoint specified for it; adjoint auto means that the adjoint will be generated automatically. For details on adjoint, see Operation Definitions.

You are not allowed to use measurements in your operation.

Input Format:
None

Output Format:
None

Note:
None