FA-81046 / Music interval and transposition theory / Open access
Pitch-class set prime form (right-packed): less packed candidate preferred · case 01
The major triad [0,4,7] keeps the prime form [0,4,7] instead of [0,3,7]: the less packed of the two candidates wins.
ROOT CAUSE
The comparison between the original and inverted candidates is written with its operands swapped, selecting the looser packing.
VERIFIED REPAIR
Restore the packing comparison step so that it reads `a if ka <= kb else b`.
Unsuccessful approach: Comparing only the spans never prefers the inversion, because inversion preserves span.
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([(-p) % 12 for p in x])
ka = [a[-1]] + a[-2:0:-1]
kb = [b[-1]] + b[-2:0:-1]
return a if kb <= ka 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]), ([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, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 3, 4], [0, 1, 4]), ([], []), ([6], [0]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [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, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([0, 4, 7, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 0 | [0, 4, 7] | [0, 3, 7] | Failed |
| oracle 1 | [0, 4, 7] | [0, 3, 7] | Failed |
| oracle 2 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 3 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 4 | [0, 3, 6, 9] | [0, 3, 6, 9] | Passed |
| oracle 5 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 6 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 7 | [0, 3, 6, 8] | [0, 2, 5, 8] | Failed |
SHA-256 / 2732ee28bf16daafbd572b2194e20536514fd5fe4a1f07849a63b6b2d18482a0
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) % 12 for p in x])
ka = [a[-1]] + a[-2:0:-1]
kb = [b[-1]] + b[-2:0:-1]
return a if a[-1] <= b[-1] 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]), ([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, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 3, 4], [0, 1, 4]), ([], []), ([6], [0]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [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, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([0, 4, 7, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 0 | [0, 4, 7] | [0, 3, 7] | Failed |
| oracle 1 | [0, 4, 7] | [0, 3, 7] | Failed |
| oracle 2 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 3 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 4 | [0, 3, 6, 9] | [0, 3, 6, 9] | Passed |
| oracle 5 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 6 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 7 | [0, 3, 6, 8] | [0, 2, 5, 8] | Failed |
SHA-256 / fa9e595de14e700c80d0ca31417b7f45b27e1f033d68fcb72d7be25bd1993081
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]), ([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, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([0, 2, 7], [0, 2, 7]), ([0, 5, 7], [0, 2, 7]), ([0, 1, 2, 3], [0, 1, 2, 3]), ([], []), ([0, 4, 7, 10], [0, 2, 5, 8])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 3, 4], [0, 1, 4]), ([], []), ([6], [0]), ([0, 2, 6, 7], [0, 1, 5, 7])], [([0, 4, 7], [0, 3, 7]), ([0, 3, 7], [0, 3, 7]), ([2, 6, 9], [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, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([7, 11, 2, 5], [0, 2, 5, 8])], [([2, 6, 9], [0, 3, 7]), ([0, 1, 3, 5, 8, 9], [0, 1, 4, 5, 7, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([4, 5, 8], [0, 1, 4]), ([1, 2, 4, 8], [0, 1, 3, 7]), ([0, 1, 5], [0, 1, 5]), ([0, 4, 7, 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 fixture | Actual | Expected | Outcome |
|---|---|---|---|
| oracle 0 | [0, 3, 7] | [0, 3, 7] | Passed |
| oracle 1 | [0, 3, 7] | [0, 3, 7] | Passed |
| oracle 2 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 3 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 4 | [0, 3, 6, 9] | [0, 3, 6, 9] | Passed |
| oracle 5 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 6 | [0, 2, 7] | [0, 2, 7] | Passed |
| oracle 7 | [0, 2, 5, 8] | [0, 2, 5, 8] | Passed |
SHA-256 / 7b68e371915aee9865800db0480fc3be74ffc5f4bc35a7fa288554f7f131fddc
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.339488+00:00.
Case digest / 4627e1d3b7e47e8048cc4f2a95309637ffdcbda1c369373b31cb98997e1b4ca0