B2: Left Action in Another Fourier Basis

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 500 points

Problem Statement

Let nn be a positive integer. For integers m,km, k with 0≤m<20 \leq m < 2, 0≤k<2n0 \leq k < 2^{n}, define E(m,k)E(m, k) as the following state:

E(m,k)=12n+1∑0≤a<2∑0≤b<2(−1)am+bk∣a⟩∣b⟩∣0⟩n−1+12n∑1≤c<2n−1(XmRck⊗I1⊗In−1)(∣0⟩∣0⟩+∣1⟩∣1⟩)∣c⟩n−1\begin{align} E(m, k) = & \frac{1}{\sqrt{2^{n+1}}} \sum_{0 \leq a < 2} \sum_{0 \leq b < 2} (-1)^{am + bk} \ket{a} \ket{b} \ket{0}_{n-1} \nonumber \\ & + \frac{1}{\sqrt{2^n}} \sum_{1 \leq c < 2^{n-1}} \left( X^m R^{ck} \otimes I_1 \otimes I_{n-1} \right) \left( \ket{0}\ket{0} + \ket{1}\ket{1} \right) \ket{c}_{n-1} \nonumber \end{align}

where the matrices XX and RR are given by the XX gate and the rotation gate Rz(2π/2n−1)Rz\left( 2 \pi / 2^{n - 1} \right), respectively:

X=(0110),R=Rz(2π2n−1)=(exp⁡(−2πi2n)00exp⁡(2πi2n))X = \begin{pmatrix} 0 & 1 \\ 1 & 0 \end{pmatrix}, \quad R = Rz\left( \frac{2 \pi}{2^{n - 1}} \right) = \begin{pmatrix} \exp \left( - \frac{2\pi i}{2^n} \right) & 0 \\ 0 & \exp \left( \frac{2\pi i}{2^n} \right) \end{pmatrix}

Given integers nn, mleftm_{\text{left}} and kleftk_{\text{left}}, implement an n+1n+1-qubit oracle OO on a quantum circuit qc\mathrm{qc}.

For any pair of integers (m,k)(m,k) in the ranges above, the oracle must satisfy

E(m,k)→OE(m′,k′)E(m, k) \xrightarrow{O} E(m', k')

where m′m' and k′k' are integers satisfying

Xm′Rk′=XmleftRkleftXmRkX^{m'} R^{k'} = X^{m_\text{left}} R^{k_\text{left}} X^{m} R^{k}

Note: We recommend referring to the hints for this problem.

Constraints

  • 2≤n≤102 \leq n \leq 10
  • 0≤mleft<20 \leq m_{\text{left}} < 2
  • 0≤kleft<2n0 \leq k_{\text{left}} < 2^n
  • The quantum circuit depth must not exceed 3030.
  • Integers must be encoded by little-endian.
  • Global phase is ignored in judge.
  • The submitted code must follow the specified format:
from qiskit import QuantumCircuit
 
 
def solve(n: int, m_left: int, k_left: int) -> QuantumCircuit:
    qc = QuantumCircuit(n + 1)
    # Write your code here:
 
    return qc

Hints

Open
  • The existence of 0≤m′<20 \leq m' < 2 and 0≤k′<2n0 \leq k' < 2^{n} is ensured by the following argument.
    First, the matrices XX and RR satisfy X2=R2n=I,RX=XR−1X^2 = R^{2^n} = I, \quad RX = XR^{-1} Using these relations, we compute: Xm′Rk′=XmleftRkleftXmRk=Xmleft(RkleftXm)Rk=Xmleft(XmR(−1)mkleft)Rk=Xmleft+mR(−1)mkleft+k\begin{align} X^{m'} R^{k'} & = X^{m_\text{left}} R^{k_\text{left}} X^{m} R^{k} \nonumber \\ & = X^{m_\text{left}} \left( R^{k_\text{left}} X^{m} \right) R^{k} \nonumber \\ & = X^{m_\text{left}} \left( X^{m} R^{(-1)^m k_{\text{left}}} \right) R^{k} \nonumber \\ & = X^{m_\text{left} + m} R^{(-1)^m k_{\text{left}} + k} \nonumber \end{align} from which we obtain m′=mleft+m (mod 2)k′=(−1)mkleft+k (mod 2n)\begin{gather} m' = m_{\text{left}} + m \ \left(\text{mod} \ 2 \right) \nonumber \\ k' = (-1)^{m} k_{\text{left}} + k \ \left(\text{mod} \ 2^{n} \right) \nonumber \end{gather}

Please sign in to submit your answer.