FA-91146 / Quantum circuit simulation / Open access
QFT controlled-phase angles are halved · case 01
QFT of |1> on two qubits produces phases at multiples of 45 degrees instead of 90 degrees.
ROOT CAUSE
The rotation between qubits q and k uses pi / 2**(q-k+1), shifting every angle by one binary place.
VERIFIED REPAIR
Use pi / 2**(q-k) so neighbouring qubits get a CP(pi/2).
Unsuccessful approach: The attempted repair uses pi / 2**(q-k-1), doubling the angles instead.
Case 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).
Why this case matters
QFT circuits are the core of phase estimation and arithmetic; decomposition slips produce bit-reversed or dephased spectra.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import cmath
N = 1
observations = []
def solve(x):
n, j, inverse = x
dim = 1 << n
seq = []
for q in reversed(range(n)):
seq.append(('h', q))
for k in reversed(range(q)):
seq.append(('cp', k, q, math.pi / 2 ** (q - k + 1)))
for q in range(n // 2):
seq.append(('swap', q, n - 1 - q))
if inverse:
seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]
st = [0j] * dim
st[j] = 1 + 0j
r = 1 / math.sqrt(2)
for g in seq:
if g[0] == 'h':
m = 1 << g[1]
for i in range(dim):
if not i & m:
a, b = st[i], st[i | m]
st[i], st[i | m] = (a + b) * r, (a - b) * r
elif g[0] == 'cp':
mask = (1 << g[1]) | (1 << g[2])
ph = cmath.exp(1j * g[3])
for i in range(dim):
if i & mask == mask:
st[i] *= ph
else:
a, b = 1 << g[1], 1 << g[2]
for i in range(dim):
if i & a and not i & b:
k2 = (i ^ a) | b
st[i], st[k2] = st[k2], st[i]
return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['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]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: qft n=2 j=1 | [[0.5, 0.0], [0.353553, 0.353553], [-0.5, 0.0], [-0.353553, -0.353553]] | [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]] | Failed |
| regression: qft n=2 j=1 inverse | [[0.5, 0.0], [0.353553, -0.353553], [-0.5, 0.0], [-0.353553, 0.353553]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Failed |
| regression: qft n=2 j=3 | [[0.5, 0.0], [-0.353553, -0.353553], [-0.5, 0.0], [0.353553, 0.353553]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Failed |
| control: qft n=1 j=0 | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=0 inverse | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 inverse | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
SHA-256 / 1aba4fb92623c71a56c7d5436b5eebbc5e1821f4c3b6a1ece7a5e8bd86052770
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
import math
import cmath
N = 1
observations = []
def solve(x):
n, j, inverse = x
dim = 1 << n
seq = []
for q in reversed(range(n)):
seq.append(('h', q))
for k in reversed(range(q)):
seq.append(('cp', k, q, math.pi / 2 ** (q - k - 1)))
for q in range(n // 2):
seq.append(('swap', q, n - 1 - q))
if inverse:
seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]
st = [0j] * dim
st[j] = 1 + 0j
r = 1 / math.sqrt(2)
for g in seq:
if g[0] == 'h':
m = 1 << g[1]
for i in range(dim):
if not i & m:
a, b = st[i], st[i | m]
st[i], st[i | m] = (a + b) * r, (a - b) * r
elif g[0] == 'cp':
mask = (1 << g[1]) | (1 << g[2])
ph = cmath.exp(1j * g[3])
for i in range(dim):
if i & mask == mask:
st[i] *= ph
else:
a, b = 1 << g[1], 1 << g[2]
for i in range(dim):
if i & a and not i & b:
k2 = (i ^ a) | b
st[i], st[k2] = st[k2], st[i]
return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['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]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: qft n=2 j=1 | [[0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0], [0.5, 0.0]] | [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]] | Failed |
| regression: qft n=2 j=1 inverse | [[0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0], [0.5, 0.0]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Failed |
| regression: qft n=2 j=3 | [[0.5, 0.0], [0.5, 0.0], [-0.5, 0.0], [-0.5, 0.0]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Failed |
| control: qft n=1 j=0 | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=0 inverse | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 inverse | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
SHA-256 / 691afac5bfbe907481133c00979b437cc74b5bfba30623a4016e44246b0a76d1
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
import math
import cmath
N = 1
observations = []
def solve(x):
n, j, inverse = x
dim = 1 << n
seq = []
for q in reversed(range(n)):
seq.append(('h', q))
for k in reversed(range(q)):
seq.append(('cp', k, q, math.pi / 2 ** (q - k)))
for q in range(n // 2):
seq.append(('swap', q, n - 1 - q))
if inverse:
seq = [(g[0], g[1], g[2], -g[3]) if g[0] == 'cp' else g for g in reversed(seq)]
st = [0j] * dim
st[j] = 1 + 0j
r = 1 / math.sqrt(2)
for g in seq:
if g[0] == 'h':
m = 1 << g[1]
for i in range(dim):
if not i & m:
a, b = st[i], st[i | m]
st[i], st[i | m] = (a + b) * r, (a - b) * r
elif g[0] == 'cp':
mask = (1 << g[1]) | (1 << g[2])
ph = cmath.exp(1j * g[3])
for i in range(dim):
if i & mask == mask:
st[i] *= ph
else:
a, b = 1 << g[1], 1 << g[2]
for i in range(dim):
if i & a and not i & b:
k2 = (i ^ a) | b
st[i], st[k2] = st[k2], st[i]
return [[round(v.real, 6) + 0.0, round(v.imag, 6) + 0.0] for v in st]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['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]]]]]
for label, args, expected in fixtures[N-1]:
check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression: qft n=2 j=1 | [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]] | [[0.5, 0.0], [0.0, 0.5], [-0.5, 0.0], [0.0, -0.5]] | Passed |
| regression: qft n=2 j=1 inverse | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Passed |
| regression: qft n=2 j=3 | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | [[0.5, 0.0], [0.0, -0.5], [-0.5, 0.0], [0.0, 0.5]] | Passed |
| control: qft n=1 j=0 | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=0 inverse | [[0.707107, 0.0], [0.707107, 0.0]] | [[0.707107, 0.0], [0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
| control: qft n=1 j=1 inverse | [[0.707107, 0.0], [-0.707107, 0.0]] | [[0.707107, 0.0], [-0.707107, 0.0]] | Passed |
SHA-256 / e0f5a3930c446a316827375207d6ed7266941e3835c9d299a3a6491f0a96c04f
Verification & scope
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.
Observations recorded using Python 3.12.14 at 2026-09-29T14:51:33.197187+00:00.
Case digest / e798bde836f376306ea6fef71598a66ea541c05389a4f93d8c0100910db11483