A7: Zeta / Moebius Transform II

Time Limit: 3 seconds

Memory Limit: 512 MiB

Score: 300 points

Problem Statement

You are given an integer nn.

Let us define [n]={1,2,⋯ ,n}[n] = \{1, 2, \cdots, n\}, and for a subset SS of [n][n], define a quantum state ∣S⟩\ket{S} by

∣S⟩=∣∑s∈S2s−1⟩.\begin{equation} \ket{S} = \ket{\textstyle \sum_{s \in S} 2^{s - 1}} \nonumber. \end{equation}

Let ∣S∣|S| denotes the number of elements in a set SS. Implement the following operation on a quantum circuit qc\mathrm{qc} with 2n2n qubits.

∑S⊆[n]aS∣S⟩n∣0⟩n→qc13n∑S⊆T⊆[n]aT∣S⟩n∣0⟩n+13n∑T⊆S⊆[n](−1)(∣S∣−∣T∣)aT∣S⟩n∣2n−1⟩n+∑i=12n−2∑S⊆[n]bS,i∣S⟩n∣i⟩n\begin{align} \sum_{S \subseteq [n]} a_S \ket{S}_n \ket{0}_n \xrightarrow{\mathrm{qc}} &\sqrt{\frac{1}{3^n}} \sum_{S \subseteq T \subseteq [n]} a_T \ket{S}_n \ket{0}_n \nonumber\\ &+ \sqrt{\frac{1}{3^n}} \sum_{T \subseteq S \subseteq [n]} (-1)^{(|S| - |T|)} a_T \ket{S}_n \ket{2^n - 1}_n\nonumber\\ &+ \sum_{i = 1}^{2^n - 2} \sum_{S \subseteq [n]} b_{S, i} \ket{S}_n \ket{i}_n\nonumber\\ \end{align}

Here, aSa_S represents the probability amplitude of a state ∣S⟩n∣0⟩n\ket{S}_n\ket{0}_n, while bS,ib_{S, i} represents an arbitrary probability amplitude of a state ∣S⟩n∣i⟩n\ket{S}_n \ket{i}_n (any values are permitted).

Constraints

  • 1≤n≤51 \leq n \leq 5
  • The circuit depth must not exceed 88.
  • Global phase is ignored in judge.
  • The submitted code must follow the specified format:
from qiskit import QuantumCircuit
 
 
def solve(n: int) -> QuantumCircuit:
    qc = QuantumCircuit(2 * n)
    # Write your code here:
 
    return qc

Sample Input

  • n=1n = 1: Implemented circuit qc\mathrm{qc} should perform the following transformation.
a0∣00⟩+a1∣10⟩→qc13{(a0+a1)∣00⟩+a1∣10⟩+a0∣01⟩−(a0−a1)∣11⟩}\begin{equation} a_0 \ket {00} + a_1 \ket {10} \xrightarrow{\mathrm{qc}} \frac{1}{\sqrt{3}} \lbrace (a_0 + a_1) \ket{00} + a_1 \ket{10} + a_0 \ket{01} - (a_0 -a_1) \ket{11} \rbrace \nonumber \end{equation}

Hints

Open
  • For subsets AA and BB of [n][n], "A⊆BA \subseteq B" can be rephrased as "for any S∈[n]S \in [n], A∩{S}⊆B∩{S}A \cap \lbrace S \rbrace \subseteq B \cap \lbrace S \rbrace".

Please sign in to submit your answer.