FAILURE MAP
← Case archive

FA-81056 / Music interval and transposition theory / Open access

Pitch-class set prime form (right-packed): retrograde used in place of inversion · case 01

Major and minor triads get different prime forms: [0,4,7] returns [0,4,7] instead of [0,3,7].

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

ROOT CAUSE

The comparison candidate is the retrograde of the input, which has the same pitch-class set, instead of its inversion.

VERIFIED REPAIR

Restore the inversion operator step so that it reads `b = normal([(-p) % 12 for p in x])`.

Unsuccessful approach: Transposing by a tritone is still a transposition, not an inversion, so the candidate never differs.

Case contract

Input a list of integers. Compute the right-packed normal form of the set and of its inversion (p -> -p mod 12), transpose each to start on 0, and return whichever is more packed: compare the last value, then the penultimate, and so on toward the second (the original wins ties). Empty input returns []; non-integers return None.

Why this case matters

Set-class labelling depends on prime forms being computed identically for every member of a class.

1 / The failure

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

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or not all(isinstance(v, int) for v in x):
        return None
    def normal(values):
        pcs = sorted(set(p % 12 for p in values))
        n = len(pcs)
        best = None
        for r in range(n):
            rot = pcs[r:] + [p + 12 for p in pcs[:r]]
            key = [rot[-1] - rot[0]] + [rot[j] - rot[0] for j in range(n - 2, 0, -1)]
            if best is None or (key, rot[0]) < best[0]:
                best = ((key, rot[0]), rot)
        return [p - best[1][0] for p in best[1]]
    if not x:
        return []
    a = normal(x)
    b = normal(x[::-1])
    ka = [a[-1]] + a[-2:0:-1]
    kb = [b[-1]] + b[-2:0:-1]
    return a if ka <= kb else b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([6], [0]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 3, 6, 10], [0, 2, 5, 8])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, 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
oracle 0[0, 4, 7][0, 3, 7]Failed
oracle 1[0, 3, 7][0, 3, 7]Passed
oracle 2[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 3[0, 1, 4, 5, 7, 9][0, 1, 4, 5, 7, 9]Passed
oracle 4[0, 2, 3, 6, 7, 9][0, 2, 3, 6, 7, 9]Passed
oracle 5[0, 4, 8][0, 4, 8]Passed
oracle 6[0, 3, 4][0, 1, 4]Failed
oracle 7[0, 3, 6, 8][0, 2, 5, 8]Failed

SHA-256 / c8fcc610fca4cbb9445281a5fd5d4cb9cb976d193a160c2bdc6e27e6c12fe4b1

2 / The unsuccessful fix

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

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or not all(isinstance(v, int) for v in x):
        return None
    def normal(values):
        pcs = sorted(set(p % 12 for p in values))
        n = len(pcs)
        best = None
        for r in range(n):
            rot = pcs[r:] + [p + 12 for p in pcs[:r]]
            key = [rot[-1] - rot[0]] + [rot[j] - rot[0] for j in range(n - 2, 0, -1)]
            if best is None or (key, rot[0]) < best[0]:
                best = ((key, rot[0]), rot)
        return [p - best[1][0] for p in best[1]]
    if not x:
        return []
    a = normal(x)
    b = normal([(p + 6) % 12 for p in x])
    ka = [a[-1]] + a[-2:0:-1]
    kb = [b[-1]] + b[-2:0:-1]
    return a if ka <= kb else b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([6], [0]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 3, 6, 10], [0, 2, 5, 8])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, 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
oracle 0[0, 4, 7][0, 3, 7]Failed
oracle 1[0, 3, 7][0, 3, 7]Passed
oracle 2[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 3[0, 1, 4, 5, 7, 9][0, 1, 4, 5, 7, 9]Passed
oracle 4[0, 2, 3, 6, 7, 9][0, 2, 3, 6, 7, 9]Passed
oracle 5[0, 4, 8][0, 4, 8]Passed
oracle 6[0, 3, 4][0, 1, 4]Failed
oracle 7[0, 3, 6, 8][0, 2, 5, 8]Failed

SHA-256 / 36ef4f3f64cee4b7bf2fb3140246a48a0ee84965a2d54fd6612b4b073d6629f5

3 / The verified repair

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

N = 1
observations = []
def solve(x):
    if not isinstance(x, list) or not all(isinstance(v, int) for v in x):
        return None
    def normal(values):
        pcs = sorted(set(p % 12 for p in values))
        n = len(pcs)
        best = None
        for r in range(n):
            rot = pcs[r:] + [p + 12 for p in pcs[:r]]
            key = [rot[-1] - rot[0]] + [rot[j] - rot[0] for j in range(n - 2, 0, -1)]
            if best is None or (key, rot[0]) < best[0]:
                best = ((key, rot[0]), rot)
        return [p - best[1][0] for p in best[1]]
    if not x:
        return []
    a = normal(x)
    b = normal([(-p) % 12 for p in x])
    ka = [a[-1]] + a[-2:0:-1]
    kb = [b[-1]] + b[-2:0:-1]
    return a if ka <= kb else b
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 5, 7], [0, 2, 7]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([10, 1, 5], [0, 3, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([6], [0]), ([0, 4, 7, 10], [0, 2, 5, 8]), ([0, 3, 6, 10], [0, 2, 5, 8])]]
for i, (args, expected) in enumerate(fixtures[N-1]):
    check("oracle %d" % i, 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
oracle 0[0, 3, 7][0, 3, 7]Passed
oracle 1[0, 3, 7][0, 3, 7]Passed
oracle 2[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 3[0, 1, 4, 5, 7, 9][0, 1, 4, 5, 7, 9]Passed
oracle 4[0, 2, 3, 6, 7, 9][0, 2, 3, 6, 7, 9]Passed
oracle 5[0, 4, 8][0, 4, 8]Passed
oracle 6[0, 1, 4][0, 1, 4]Passed
oracle 7[0, 2, 5, 8][0, 2, 5, 8]Passed

SHA-256 / 1d1b143553c1f4e8bbd16a912ac8bb5d2873048862e676dfd6560f9453399f36

Verification & scope

A deterministic bounded teaching model with a stipulated toy contract; it is not a complete music notation or theory engine. 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:49:59.347398+00:00.

Case digest / 3fb6053afe5f91744520dc3bfca5225326c09e86653c2bd15788191153649cce