FA-81061 / Music interval and transposition theory / Open access
Pitch-class set prime form (right-packed): empty set treated as invalid · case 01
The empty set returns None instead of the empty prime form [].
ROOT CAUSE
The empty-input guard returns the invalid-input sentinel.
VERIFIED REPAIR
Restore the empty set step so that it reads `if not x: return []`.
Unsuccessful approach: Returning [0] invents a pitch class that was never in the set.
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 None
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]), ([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, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([], [])], [([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, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([], [])], [([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([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]), ([], [])], [([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, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([], [])], [([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]), ([], []), ([6], [0])]]
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, 3, 7] | [0, 3, 7] | Passed |
| oracle 3 | [0, 1, 5, 6, 8] | [0, 1, 5, 6, 8] | Passed |
| oracle 4 | [0, 1, 4, 5, 7, 9] | [0, 1, 4, 5, 7, 9] | Passed |
| oracle 5 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 6 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 7 | None | [] | Failed |
SHA-256 / 085341ec36370e88d7bcae332b7ce7f2af780229cbbfd848bbe179c32de6ddc7
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 [0]
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]), ([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, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([], [])], [([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, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([], [])], [([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([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]), ([], [])], [([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, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([], [])], [([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]), ([], []), ([6], [0])]]
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, 3, 7] | [0, 3, 7] | Passed |
| oracle 3 | [0, 1, 5, 6, 8] | [0, 1, 5, 6, 8] | Passed |
| oracle 4 | [0, 1, 4, 5, 7, 9] | [0, 1, 4, 5, 7, 9] | Passed |
| oracle 5 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 6 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 7 | [0] | [] | Failed |
SHA-256 / e88e4a2d108fdd2d2f919a2265307c5170ff080743acd7d77feed8b3b9cbd79e
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]), ([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, 2, 3, 6, 7, 9], [0, 2, 3, 6, 7, 9]), ([0, 4, 8], [0, 4, 8]), ([], [])], [([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, 6, 9], [0, 3, 6, 9]), ([0, 1, 4], [0, 1, 4]), ([0, 3, 4], [0, 1, 4]), ([], [])], [([0, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([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]), ([], [])], [([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, 1, 5], [0, 1, 5]), ([7, 11, 2, 5], [0, 2, 5, 8]), ([], [])], [([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]), ([], []), ([6], [0])]]
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, 3, 7] | [0, 3, 7] | Passed |
| oracle 3 | [0, 1, 5, 6, 8] | [0, 1, 5, 6, 8] | Passed |
| oracle 4 | [0, 1, 4, 5, 7, 9] | [0, 1, 4, 5, 7, 9] | Passed |
| oracle 5 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 6 | [0, 4, 8] | [0, 4, 8] | Passed |
| oracle 7 | [] | [] | Passed |
SHA-256 / 846eccbb8431947ac1f08a5aad2370699d2357e42e7f22bd314044b24db6ae94
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.503337+00:00.
Case digest / 7203d254d39f3ffb51013f3dd3976a50175d95fa9c14cebaaff4065483aec88f