{"abstract":"QFT of |1> on two qubits produces phases at multiples of 45 degrees instead of 90 degrees.","category":"Quantum circuit simulation","checks":7,"contract":"Input [n, j, inverse]. Build the textbook QFT on n qubits (qubit 0 = LSB): for q from n-1 down to 0 apply H(q) then CP(pi / 2**(q-k)) between q and each k < q (k descending), then swap q with n-1-q for q < n//2; the inverse is the reversed sequence with negated phases. Apply it to |j> and return the amplitudes as [re, im] rounded to 6 decimals (QFT|j> = sum_k e^{2 pi i jk/N}|k>/sqrt N).","evaluation_group":"w2-quantum_circuit_simulation-qft-gate-decomposition","failed_approach":"The attempted repair uses pi / 2**(q-k-1), doubling the angles instead.","family":"w2-quantum_circuit_simulation-qft-gate-decomposition-controlled-phase-exponent","id":"FA-91146","implementations":{"attempt":{"sha256":"691afac5bfbe907481133c00979b437cc74b5bfba30623a4016e44246b0a76d1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport cmath\nN = 1\nobservations = []\ndef solve(x):\n    n, j, inverse = x\n    dim = 1 << n\n    seq = []\n    for q in reversed(range(n)):\n        seq.append(('h', q))\n        for k in reversed(range(q)):\n            seq.append(('cp', k, q, math.pi / 2 ** (q - k - 1)))\n    for q in range(n // 2):\n        seq.append(('swap', q, n - 1 - q))\n    if inverse:\n        seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]\n    st = [0j] * dim\n    st[j] = 1 + 0j\n    r = 1 / math.sqrt(2)\n    for g in seq:\n        if g[0] == 'h':\n            m = 1 << g[1]\n            for i in range(dim):\n                if not i & m:\n                    a, b = st[i], st[i | m]\n                    st[i], st[i | m] = (a + b) * r, (a - b) * r\n        elif g[0] == 'cp':\n            mask = (1 << g[1]) | (1 << g[2])\n            ph = cmath.exp(1j * g[3])\n            for i in range(dim):\n                if i & mask == mask:\n                    st[i] *= ph\n        else:\n            a, b = 1 << g[1], 1 << g[2]\n            for i in range(dim):\n                if i & a and not i & b:\n                    k2 = (i ^ a) | b\n                    st[i], st[k2] = st[k2], st[i]\n    return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: qft n=2 j=1', [2, 1, False], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=2 j=1 inverse', [2, 1, True], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]]], [['regression: qft n=2 j=3 inverse', [2, 3, True], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=2', [2, 2, False], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]], ['control: qft n=2 j=2 inverse', [2, 2, True], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]]], [['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=2 inverse', [3, 2, True], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['control: qft n=3 j=0', [3, 0, False], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=0 inverse', [3, 0, True], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=4', [3, 4, False], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]], ['control: qft n=3 j=4 inverse', [3, 4, True], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]]], [['regression: qft n=3 j=3 inverse', [3, 3, True], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=5', [3, 5, False], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['control: qft n=4 j=0', [4, 0, False], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=4 j=0 inverse', [4, 0, True], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]]], [['regression: qft n=3 j=6', [3, 6, False], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=6 inverse', [3, 6, True], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=3', [3, 3, False], [[0.353553, 0.0], [-0.25, 0.25], [0.0, -0.353553], [0.25, 0.25], [-0.353553, 0.0], [0.25, -0.25], [0.0, 0.353553], [-0.25, -0.25]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"1aba4fb92623c71a56c7d5436b5eebbc5e1821f4c3b6a1ece7a5e8bd86052770","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport cmath\nN = 1\nobservations = []\ndef solve(x):\n    n, j, inverse = x\n    dim = 1 << n\n    seq = []\n    for q in reversed(range(n)):\n        seq.append(('h', q))\n        for k in reversed(range(q)):\n            seq.append(('cp', k, q, math.pi / 2 ** (q - k + 1)))\n    for q in range(n // 2):\n        seq.append(('swap', q, n - 1 - q))\n    if inverse:\n        seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]\n    st = [0j] * dim\n    st[j] = 1 + 0j\n    r = 1 / math.sqrt(2)\n    for g in seq:\n        if g[0] == 'h':\n            m = 1 << g[1]\n            for i in range(dim):\n                if not i & m:\n                    a, b = st[i], st[i | m]\n                    st[i], st[i | m] = (a + b) * r, (a - b) * r\n        elif g[0] == 'cp':\n            mask = (1 << g[1]) | (1 << g[2])\n            ph = cmath.exp(1j * g[3])\n            for i in range(dim):\n                if i & mask == mask:\n                    st[i] *= ph\n        else:\n            a, b = 1 << g[1], 1 << g[2]\n            for i in range(dim):\n                if i & a and not i & b:\n                    k2 = (i ^ a) | b\n                    st[i], st[k2] = st[k2], st[i]\n    return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: qft n=2 j=1', [2, 1, False], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=2 j=1 inverse', [2, 1, True], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]]], [['regression: qft n=2 j=3 inverse', [2, 3, True], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=2', [2, 2, False], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]], ['control: qft n=2 j=2 inverse', [2, 2, True], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]]], [['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=2 inverse', [3, 2, True], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['control: qft n=3 j=0', [3, 0, False], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=0 inverse', [3, 0, True], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=4', [3, 4, False], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]], ['control: qft n=3 j=4 inverse', [3, 4, True], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]]], [['regression: qft n=3 j=3 inverse', [3, 3, True], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=5', [3, 5, False], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['control: qft n=4 j=0', [4, 0, False], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=4 j=0 inverse', [4, 0, True], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]]], [['regression: qft n=3 j=6', [3, 6, False], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=6 inverse', [3, 6, True], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=3', [3, 3, False], [[0.353553, 0.0], [-0.25, 0.25], [0.0, -0.353553], [0.25, 0.25], [-0.353553, 0.0], [0.25, -0.25], [0.0, 0.353553], [-0.25, -0.25]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"e0f5a3930c446a316827375207d6ed7266941e3835c9d299a3a6491f0a96c04f","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nimport cmath\nN = 1\nobservations = []\ndef solve(x):\n    n, j, inverse = x\n    dim = 1 << n\n    seq = []\n    for q in reversed(range(n)):\n        seq.append(('h', q))\n        for k in reversed(range(q)):\n            seq.append(('cp', k, q, math.pi / 2 ** (q - k)))\n    for q in range(n // 2):\n        seq.append(('swap', q, n - 1 - q))\n    if inverse:\n        seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]\n    st = [0j] * dim\n    st[j] = 1 + 0j\n    r = 1 / math.sqrt(2)\n    for g in seq:\n        if g[0] == 'h':\n            m = 1 << g[1]\n            for i in range(dim):\n                if not i & m:\n                    a, b = st[i], st[i | m]\n                    st[i], st[i | m] = (a + b) * r, (a - b) * r\n        elif g[0] == 'cp':\n            mask = (1 << g[1]) | (1 << g[2])\n            ph = cmath.exp(1j * g[3])\n            for i in range(dim):\n                if i & mask == mask:\n                    st[i] *= ph\n        else:\n            a, b = 1 << g[1], 1 << g[2]\n            for i in range(dim):\n                if i & a and not i & b:\n                    k2 = (i ^ a) | b\n                    st[i], st[k2] = st[k2], st[i]\n    return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression: qft n=2 j=1', [2, 1, False], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=2 j=1 inverse', [2, 1, True], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]]], [['regression: qft n=2 j=3 inverse', [2, 3, True], [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['regression: qft n=2 j=3', [2, 3, False], [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=2', [2, 2, False], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]], ['control: qft n=2 j=2 inverse', [2, 2, True], [[0.5, 0.0], [-0.5, 0.0], [0.5, 0.0], [-0.5, 0.0]]]], [['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=2 inverse', [3, 2, True], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=1', [3, 1, False], [[0.353553, 0.0], [0.25, 0.25], [0.0, 0.353553], [-0.25, 0.25], [-0.353553, 0.0], [-0.25, -0.25], [0.0, -0.353553], [0.25, -0.25]]], ['control: qft n=3 j=0', [3, 0, False], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=0 inverse', [3, 0, True], [[0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0], [0.353553, 0.0]]], ['control: qft n=3 j=4', [3, 4, False], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]], ['control: qft n=3 j=4 inverse', [3, 4, True], [[0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0], [0.353553, 0.0], [-0.353553, 0.0]]]], [['regression: qft n=3 j=3 inverse', [3, 3, True], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=5', [3, 5, False], [[0.353553, 0.0], [-0.25, -0.25], [0.0, 0.353553], [0.25, -0.25], [-0.353553, 0.0], [0.25, 0.25], [0.0, -0.353553], [-0.25, 0.25]]], ['regression: qft n=3 j=2', [3, 2, False], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['control: qft n=4 j=0', [4, 0, False], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=4 j=0 inverse', [4, 0, True], [[0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0], [0.25, 0.0]]], ['control: qft n=1 j=0', [1, 0, False], [[0.707107, 0.0], [0.707107, 0.0]]], ['control: qft n=1 j=0 inverse', [1, 0, True], [[0.707107, 0.0], [0.707107, 0.0]]]], [['regression: qft n=3 j=6', [3, 6, False], [[0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553], [0.353553, 0.0], [0.0, -0.353553], [-0.353553, 0.0], [0.0, 0.353553]]], ['regression: qft n=3 j=6 inverse', [3, 6, True], [[0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553], [0.353553, 0.0], [0.0, 0.353553], [-0.353553, 0.0], [0.0, -0.353553]]], ['regression: qft n=3 j=3', [3, 3, False], [[0.353553, 0.0], [-0.25, 0.25], [0.0, -0.353553], [0.25, 0.25], [-0.353553, 0.0], [0.25, -0.25], [0.0, 0.353553], [-0.25, -0.25]]], ['control: qft n=1 j=1', [1, 1, False], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=1 j=1 inverse', [1, 1, True], [[0.707107, 0.0], [-0.707107, 0.0]]], ['control: qft n=2 j=0', [2, 0, False], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]], ['control: qft n=2 j=0 inverse', [2, 0, True], [[0.5, 0.0], [0.5, 0.0], [0.5, 0.0], [0.5, 0.0]]]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"A deterministic bounded teaching model with a stipulated toy contract; amplitudes are rounded to fixed decimals for strict JSON output. It is not a production quantum SDK and claims no standards conformance. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-quantum_circuit_simulation-qft-gate-decomposition-controlled-phase-exponent","generated_at":"2026-09-29T14:51:33.197187+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"QFT circuits are the core of phase estimation and arithmetic; decomposition slips produce bit-reversed or dephased spectra.","repair":"Use pi / 2**(q-k) so neighbouring qubits get a CP(pi/2).","root_cause":"The rotation between qubits q and k uses pi / 2**(q-k+1), shifting every angle by one binary place.","sha256":"e798bde836f376306ea6fef71598a66ea541c05389a4f93d8c0100910db11483","title":"QFT controlled-phase angles are halved · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":42.133,"exit_code":1,"observations":[{"actual":[[0.5,0.0],[-0.5,0.0],[-0.5,0.0],[0.5,0.0]],"check":"regression: qft n=2 j=1","expected":[[0.5,0.0],[0.0,0.5],[-0.5,0.0],[0.0,-0.5]],"passed":false},{"actual":[[0.5,0.0],[-0.5,0.0],[-0.5,0.0],[0.5,0.0]],"check":"regression: qft n=2 j=1 inverse","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":false},{"actual":[[0.5,0.0],[0.5,0.0],[-0.5,0.0],[-0.5,0.0]],"check":"regression: qft n=2 j=3","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":false},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0 inverse","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1 inverse","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: qft n=2 j=1\", \"actual\": [[0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0], [0.5, 0.0]], \"expected\": [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]], \"passed\": false}, {\"check\": \"regression: qft n=2 j=1 inverse\", \"actual\": [[0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0], [0.5, 0.0]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": false}, {\"check\": \"regression: qft n=2 j=3\", \"actual\": [[0.5, 0.0], [0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": false}, {\"check\": \"control: qft n=1 j=0\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=0 inverse\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1 inverse\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":42.7,"exit_code":1,"observations":[{"actual":[[0.5,0.0],[0.353553,0.353553],[-0.5,0.0],[-0.353553,-0.353553]],"check":"regression: qft n=2 j=1","expected":[[0.5,0.0],[0.0,0.5],[-0.5,0.0],[0.0,-0.5]],"passed":false},{"actual":[[0.5,0.0],[0.353553,-0.353553],[-0.5,0.0],[-0.353553,0.353553]],"check":"regression: qft n=2 j=1 inverse","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":false},{"actual":[[0.5,0.0],[-0.353553,-0.353553],[-0.5,0.0],[0.353553,0.353553]],"check":"regression: qft n=2 j=3","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":false},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0 inverse","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1 inverse","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: qft n=2 j=1\", \"actual\": [[0.5, 0.0], [0.353553, 0.353553], [-0.5, 0.0], [-0.353553, -0.353553]], \"expected\": [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]], \"passed\": false}, {\"check\": \"regression: qft n=2 j=1 inverse\", \"actual\": [[0.5, 0.0], [0.353553, -0.353553], [-0.5, 0.0], [-0.353553, 0.353553]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": false}, {\"check\": \"regression: qft n=2 j=3\", \"actual\": [[0.5, 0.0], [-0.353553, -0.353553], [-0.5, 0.0], [0.353553, 0.353553]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": false}, {\"check\": \"control: qft n=1 j=0\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=0 inverse\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1 inverse\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":41.01,"exit_code":0,"observations":[{"actual":[[0.5,0.0],[0.0,0.5],[-0.5,0.0],[0.0,-0.5]],"check":"regression: qft n=2 j=1","expected":[[0.5,0.0],[0.0,0.5],[-0.5,0.0],[0.0,-0.5]],"passed":true},{"actual":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"check":"regression: qft n=2 j=1 inverse","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":true},{"actual":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"check":"regression: qft n=2 j=3","expected":[[0.5,0.0],[0.0,-0.5],[-0.5,0.0],[0.0,0.5]],"passed":true},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[0.707107,0.0]],"check":"control: qft n=1 j=0 inverse","expected":[[0.707107,0.0],[0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true},{"actual":[[0.707107,0.0],[-0.707107,0.0]],"check":"control: qft n=1 j=1 inverse","expected":[[0.707107,0.0],[-0.707107,0.0]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression: qft n=2 j=1\", \"actual\": [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]], \"expected\": [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]], \"passed\": true}, {\"check\": \"regression: qft n=2 j=1 inverse\", \"actual\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": true}, {\"check\": \"regression: qft n=2 j=3\", \"actual\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"expected\": [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]], \"passed\": true}, {\"check\": \"control: qft n=1 j=0\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=0 inverse\", \"actual\": [[0.707107, 0.0], [0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}, {\"check\": \"control: qft n=1 j=1 inverse\", \"actual\": [[0.707107, 0.0], [-0.707107, 0.0]], \"expected\": [[0.707107, 0.0], [-0.707107, 0.0]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}