FAILURE MAP
← Case archive

FA-90981 / Quantum circuit simulation / Open access

Pauli product reduces the phase with a single subtraction · case 01

Inputs with negative phase powers or several anticommuting positions return phase exponents outside 0..3.

Verified by executionVariant 1 · 7 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The final reduction subtracts 4 once when k >= 4 instead of taking k modulo 4.

VERIFIED REPAIR

Return k % 4, which also maps negative powers into range.

Unsuccessful approach: The attempted repair takes abs(k) % 4, which maps i**-1 to i instead of -i.

Case contract

Input [[k1, s1], [k2, s2]] representing i**k1 * s1 and i**k2 * s2 (Pauli strings over IXYZ, equal length). Return [k mod 4, s] with i**k * s = (i**k1 s1)(i**k2 s2), using XY=iZ, YZ=iX, ZX=iY and the reversed products with -i. Error "length-mismatch".

Why this case matters

Pauli-frame and stabilizer bookkeeping multiply Pauli strings constantly; one phase slip flips measurement signs.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    (k1, s1), (k2, s2) = x
    if len(s1) != len(s2):
        return 'length-mismatch'
    table = {('X', 'Y'): (1, 'Z'), ('Y', 'Z'): (1, 'X'), ('Z', 'X'): (1, 'Y'),
             ('Y', 'X'): (3, 'Z'), ('Z', 'Y'): (3, 'X'), ('X', 'Z'): (3, 'Y')}
    k = k1 + k2
    out = []
    for a, b in zip(s1, s2):
        if a == 'I':
            out.append(b)
        elif b == 'I':
            out.append(a)
        elif a == b:
            out.append('I')
        else:
            dk, c = table[(a, b)]
            k += dk
            out.append(c)
    return [k if k < 4 else k - 4, ''.join(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['control: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['control: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['control: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']]], [['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: identity factors', [[1, 'II'], [2, 'IZ']], [3, 'IZ']], ['control: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['control: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['control: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['control: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]], [['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['control: random product 3', [[1, 'Y'], [0, 'Z']], [2, 'X']], ['control: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['control: random product 6', [[0, 'Z'], [0, 'Z']], [0, 'I']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']]], [['regression: random product 43', [[2, 'ZY'], [0, 'YX']], [0, 'XZ']], ['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: random product 8', [[-1, 'XZIY'], [3, 'IXYY']], [3, 'XYYI']], ['control: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['control: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']]]]
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 fixtureActualExpectedOutcome
regression: phases wrap[8, 'YY'][0, 'YY']Failed
regression: random product 7[4, 'X'][0, 'X']Failed
regression: random product 14[-1, 'Y'][3, 'Y']Failed
control: X times Y[1, 'Z'][1, 'Z']Passed
control: Y times X[3, 'Z'][3, 'Z']Passed
control: X times Z[3, 'Y'][3, 'Y']Passed
control: Z times X[1, 'Y'][1, 'Y']Passed

SHA-256 / 8769e307a157a9bfc21a80c342b88373e508826c1c84a4a2cea1b8ca84877b88

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    (k1, s1), (k2, s2) = x
    if len(s1) != len(s2):
        return 'length-mismatch'
    table = {('X', 'Y'): (1, 'Z'), ('Y', 'Z'): (1, 'X'), ('Z', 'X'): (1, 'Y'),
             ('Y', 'X'): (3, 'Z'), ('Z', 'Y'): (3, 'X'), ('X', 'Z'): (3, 'Y')}
    k = k1 + k2
    out = []
    for a, b in zip(s1, s2):
        if a == 'I':
            out.append(b)
        elif b == 'I':
            out.append(a)
        elif a == b:
            out.append('I')
        else:
            dk, c = table[(a, b)]
            k += dk
            out.append(c)
    return [abs(k) % 4, ''.join(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['control: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['control: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['control: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']]], [['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: identity factors', [[1, 'II'], [2, 'IZ']], [3, 'IZ']], ['control: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['control: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['control: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['control: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]], [['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['control: random product 3', [[1, 'Y'], [0, 'Z']], [2, 'X']], ['control: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['control: random product 6', [[0, 'Z'], [0, 'Z']], [0, 'I']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']]], [['regression: random product 43', [[2, 'ZY'], [0, 'YX']], [0, 'XZ']], ['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: random product 8', [[-1, 'XZIY'], [3, 'IXYY']], [3, 'XYYI']], ['control: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['control: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']]]]
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 fixtureActualExpectedOutcome
regression: phases wrap[0, 'YY'][0, 'YY']Passed
regression: random product 7[0, 'X'][0, 'X']Passed
regression: random product 14[1, 'Y'][3, 'Y']Failed
control: X times Y[1, 'Z'][1, 'Z']Passed
control: Y times X[3, 'Z'][3, 'Z']Passed
control: X times Z[3, 'Y'][3, 'Y']Passed
control: Z times X[1, 'Y'][1, 'Y']Passed

SHA-256 / 25d2715671158f894c99cf128bdf727f578b957312ac55c0c7778e1f4e919997

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    (k1, s1), (k2, s2) = x
    if len(s1) != len(s2):
        return 'length-mismatch'
    table = {('X', 'Y'): (1, 'Z'), ('Y', 'Z'): (1, 'X'), ('Z', 'X'): (1, 'Y'),
             ('Y', 'X'): (3, 'Z'), ('Z', 'Y'): (3, 'X'), ('X', 'Z'): (3, 'Y')}
    k = k1 + k2
    out = []
    for a, b in zip(s1, s2):
        if a == 'I':
            out.append(b)
        elif b == 'I':
            out.append(a)
        elif a == b:
            out.append('I')
        else:
            dk, c = table[(a, b)]
            k += dk
            out.append(c)
    return [k % 4, ''.join(out)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['control: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['control: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['control: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']]], [['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: identity factors', [[1, 'II'], [2, 'IZ']], [3, 'IZ']], ['control: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: phases wrap', [[3, 'XX'], [3, 'ZZ']], [0, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['control: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['control: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['control: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]], [['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['regression: random product 31', [[1, 'YYZ'], [3, 'XXI']], [2, 'ZZZ']], ['control: random product 3', [[1, 'Y'], [0, 'Z']], [2, 'X']], ['control: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['control: random product 6', [[0, 'Z'], [0, 'Z']], [0, 'I']], ['regression: random product 33', [[2, 'IZYY'], [3, 'ZYXY']], [3, 'ZXZI']]], [['regression: random product 43', [[2, 'ZY'], [0, 'YX']], [0, 'XZ']], ['regression: random product 47', [[-2, 'II'], [0, 'YY']], [2, 'YY']], ['regression: random product 14', [[-2, 'Z'], [0, 'X']], [3, 'Y']], ['control: random product 8', [[-1, 'XZIY'], [3, 'IXYY']], [3, 'XYYI']], ['control: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['control: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']]]]
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 fixtureActualExpectedOutcome
regression: phases wrap[0, 'YY'][0, 'YY']Passed
regression: random product 7[0, 'X'][0, 'X']Passed
regression: random product 14[3, 'Y'][3, 'Y']Passed
control: X times Y[1, 'Z'][1, 'Z']Passed
control: Y times X[3, 'Z'][3, 'Z']Passed
control: X times Z[3, 'Y'][3, 'Y']Passed
control: Z times X[1, 'Y'][1, 'Y']Passed

SHA-256 / 9e23b92f4f1ead0338f3806c740725a55abb623aefefa91dabd26796209a89bf

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:31.675862+00:00.

Case digest / bb9cb29a4bda275963d42b7771031ed83e67c993be2338c504161400cb51792f