FAILURE MAP
← Case archive

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

Pitch-class set normal form (right-packed): symmetric sets start on the highest pitch class · case 01

The augmented triad [0,4,8] returns [8,0,4] and the diminished seventh starts on 9.

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

ROOT CAUSE

The final tie-break prefers the largest starting pitch class.

VERIFIED REPAIR

Restore the full tie break step so that it reads `cand = (key, rot[0])`.

Unsuccessful approach: Breaking ties on the last reduced member prefers rotations ending on 0, which again starts symmetric sets high.

Case contract

Input a list of integers (reduced mod 12, duplicates removed). Return the normal form: among all rotations of the ascending set, choose the one with the smallest span first-to-last, then smallest span first-to-penultimate, and so on toward the second element; a full tie picks the rotation starting on the lowest pitch class. Empty input returns []; non-integer input returns None.

Why this case matters

Post-tonal analysis tools use normal form to compare and catalogue pitch-class sets.

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
    pcs = sorted(set(v % 12 for v in x))
    if not pcs:
        return []
    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)]
        cand = (key, -rot[0])
        if best is None or cand < best[0]:
            best = (cand, [p % 12 for p in rot])
    return best[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 4, 7]), ([7, 4, 0], [0, 4, 7]), ([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 4, 8], [0, 4, 8]), ([0, 6], [0, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])], [([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([0, 1, 6, 7], [0, 1, 6, 7])], [([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 6, 7], [0, 1, 6, 7]), ([1, 4, 7, 10, 1], [1, 4, 7, 10])], [([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 1, 3, 7], [0, 1, 3, 7]), ([5], [5]), ([], []), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([1, 4, 7, 10, 1], [1, 4, 7, 10]), ([0, 1, 4, 5, 8, 9], [0, 1, 4, 5, 8, 9])]]
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, 4, 7]Passed
oracle 1[0, 4, 7][0, 4, 7]Passed
oracle 2[11, 0, 4][11, 0, 4]Passed
oracle 3[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 4[8, 9, 0, 1, 3, 5][8, 9, 0, 1, 3, 5]Passed
oracle 5[8, 0, 4][0, 4, 8]Failed
oracle 6[6, 0][0, 6]Failed
oracle 7[10, 0, 2, 4, 6, 8][0, 2, 4, 6, 8, 10]Failed

SHA-256 / 1590962b96f647e82d0a9efe7148e0fd27d003e32f98b7fc38d84008888fb455

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
    pcs = sorted(set(v % 12 for v in x))
    if not pcs:
        return []
    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)]
        cand = (key, rot[-1] % 12)
        if best is None or cand < best[0]:
            best = (cand, [p % 12 for p in rot])
    return best[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 4, 7]), ([7, 4, 0], [0, 4, 7]), ([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 4, 8], [0, 4, 8]), ([0, 6], [0, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])], [([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([0, 1, 6, 7], [0, 1, 6, 7])], [([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 6, 7], [0, 1, 6, 7]), ([1, 4, 7, 10, 1], [1, 4, 7, 10])], [([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 1, 3, 7], [0, 1, 3, 7]), ([5], [5]), ([], []), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([1, 4, 7, 10, 1], [1, 4, 7, 10]), ([0, 1, 4, 5, 8, 9], [0, 1, 4, 5, 8, 9])]]
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, 4, 7]Passed
oracle 1[0, 4, 7][0, 4, 7]Passed
oracle 2[11, 0, 4][11, 0, 4]Passed
oracle 3[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 4[8, 9, 0, 1, 3, 5][8, 9, 0, 1, 3, 5]Passed
oracle 5[4, 8, 0][0, 4, 8]Failed
oracle 6[6, 0][0, 6]Failed
oracle 7[2, 4, 6, 8, 10, 0][0, 2, 4, 6, 8, 10]Failed

SHA-256 / bbd2696b88ca1e2b380a48f8643b02f4e3c8f0673d1a5f22fa564e8c987c6bc0

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
    pcs = sorted(set(v % 12 for v in x))
    if not pcs:
        return []
    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)]
        cand = (key, rot[0])
        if best is None or cand < best[0]:
            best = (cand, [p % 12 for p in rot])
    return best[1]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 4, 7], [0, 4, 7]), ([7, 4, 0], [0, 4, 7]), ([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 4, 8], [0, 4, 8]), ([0, 6], [0, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([0, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])], [([0, 1, 2, 5, 6, 7, 9], [0, 1, 2, 5, 6, 7, 9]), ([0, 1, 2, 4, 5, 7, 9, 10], [9, 10, 0, 1, 2, 4, 5, 7]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([0, 1, 6, 7], [0, 1, 6, 7])], [([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 2, 4, 6, 8, 10], [0, 2, 4, 6, 8, 10]), ([0, 1, 6, 7], [0, 1, 6, 7]), ([1, 4, 7, 10, 1], [1, 4, 7, 10])], [([11, 2, 6], [11, 2, 6]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 1, 3, 7], [0, 1, 3, 7]), ([5], [5]), ([], []), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]), ([1, 4, 7, 10, 1], [1, 4, 7, 10]), ([0, 1, 4, 5, 8, 9], [0, 1, 4, 5, 8, 9])]]
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, 4, 7]Passed
oracle 1[0, 4, 7][0, 4, 7]Passed
oracle 2[11, 0, 4][11, 0, 4]Passed
oracle 3[0, 1, 5, 6, 8][0, 1, 5, 6, 8]Passed
oracle 4[8, 9, 0, 1, 3, 5][8, 9, 0, 1, 3, 5]Passed
oracle 5[0, 4, 8][0, 4, 8]Passed
oracle 6[0, 6][0, 6]Passed
oracle 7[0, 2, 4, 6, 8, 10][0, 2, 4, 6, 8, 10]Passed

SHA-256 / 869def97b20cdaa6ae5d737ee8fb818b5c7fa548c3f5f5593e5d9424f39bebbf

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

Case digest / a89588b2559df7015fa92d530c00c3557fda6257426982c263e08c8a658ccefa