FAILURE MAP
← Case archive

FA-90976 / Quantum circuit simulation / Open access

Pauli product multiplies the operands in reverse order · case 01

X*Y is reported as -iZ, the value of Y*X.

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

ROOT CAUSE

The per-qubit loop zips (s2, s1), computing the product in the wrong order for non-commuting positions.

VERIFIED REPAIR

Zip (s1, s2) so the left operand is looked up first.

Unsuccessful approach: The attempted repair keeps the reversed zip and adds a blanket -1 phase, which only fixes an odd number of anticommuting positions.

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(s2, s1):
        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: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['regression: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['repair check: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['repair check: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']], ['repair check: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']]], [['regression: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['repair check: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['regression: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']], ['repair check: random product 17', [[3, 'X'], [0, 'X']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]]]
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: X times Y[3, 'Z'][1, 'Z']Failed
regression: Y times X[1, 'Z'][3, 'Z']Failed
repair check: square of Y[0, 'I'][0, 'I']Passed
control: length mismatchlength-mismatchlength-mismatchPassed
regression: X times Z[1, 'Y'][3, 'Y']Failed
regression: Z times X[3, 'Y'][1, 'Y']Failed
regression: negative phase input[2, 'Y'][0, 'Y']Failed

SHA-256 / 65ce9ffb4bd9933c57c40c67310ccdaa02b2272553159023e09a4123ca1d1965

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 + 2
    out = []
    for a, b in zip(s2, s1):
        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: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['regression: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['repair check: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['repair check: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']], ['repair check: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']]], [['regression: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['repair check: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['regression: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']], ['repair check: random product 17', [[3, 'X'], [0, 'X']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]]]
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: X times Y[1, 'Z'][1, 'Z']Passed
regression: Y times X[3, 'Z'][3, 'Z']Passed
repair check: square of Y[2, 'I'][0, 'I']Failed
control: length mismatchlength-mismatchlength-mismatchPassed
regression: X times Z[3, 'Y'][3, 'Y']Passed
regression: Z times X[1, 'Y'][1, 'Y']Passed
regression: negative phase input[0, 'Y'][0, 'Y']Passed

SHA-256 / bdeb9f2f09e2b8ce7d9f04250dfa8bc8f2be8757613902a3602b37e63e0feaba

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: X times Y', [[0, 'X'], [0, 'Y']], [1, 'Z']], ['regression: Y times X', [[0, 'Y'], [0, 'X']], [3, 'Z']], ['repair check: square of Y', [[0, 'Y'], [0, 'Y']], [0, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']]], [['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['repair check: anticommuting pair twice', [[0, 'XY'], [0, 'YX']], [0, 'ZZ']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: X times Z', [[0, 'X'], [0, 'Z']], [3, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']], ['repair check: random product 4', [[0, 'YXY'], [1, 'IZZ']], [1, 'YYX']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: Z times X', [[0, 'Z'], [0, 'X']], [1, 'Y']], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']]], [['regression: random product 5', [[0, 'YIXX'], [2, 'ZIYY']], [1, 'XIZZ']], ['regression: random product 7', [[3, 'Z'], [2, 'Y']], [0, 'X']], ['repair check: random product 9', [[0, 'I'], [3, 'I']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: negative phase input', [[-1, 'Z'], [0, 'X']], [0, 'Y']], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']]], [['regression: random product 10', [[1, 'XIZX'], [0, 'IYIZ']], [0, 'XYZY']], ['regression: random product 11', [[-2, 'ZXI'], [3, 'IZX']], [0, 'ZYX']], ['repair check: random product 17', [[3, 'X'], [0, 'X']], [3, 'I']], ['control: length mismatch', [[0, 'X'], [0, 'XY']], 'length-mismatch'], ['regression: random product 0', [[0, 'YY'], [2, 'ZY']], [3, 'XI']], ['regression: random product 1', [[-2, 'ZZI'], [2, 'ZXI']], [1, 'IYI']], ['regression: random product 2', [[0, 'Y'], [1, 'X']], [0, 'Z']]]]
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: X times Y[1, 'Z'][1, 'Z']Passed
regression: Y times X[3, 'Z'][3, 'Z']Passed
repair check: square of Y[0, 'I'][0, 'I']Passed
control: length mismatchlength-mismatchlength-mismatchPassed
regression: X times Z[3, 'Y'][3, 'Y']Passed
regression: Z times X[1, 'Y'][1, 'Y']Passed
regression: negative phase input[0, 'Y'][0, 'Y']Passed

SHA-256 / 418eb5cbbd993d6a680b9b098dda9255705bb935a03ad8c31ca9fe74598b373f

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

Case digest / 730ec015a6393efce1aac9171f5082069248b8774d872357493afdb384e99681