FA-81026 / Music interval and transposition theory / Open access
Pitch-class set normal form (right-packed): wrapped members not lifted an octave · case 01
Rotations that wrap past 11 produce negative spans, so a wrapped rotation such as [11,0,4] is never chosen correctly.
ROOT CAUSE
Members moved to the end of a rotation are not raised by twelve, so the span arithmetic sees them below the first member.
VERIFIED REPAIR
Restore the rotation wrap step so that it reads `[p + 12 for p in pcs[:r]]`.
Unsuccessful approach: Lifting one element too many duplicates the rotation start, making every span twelve and every choice a tie.
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:] + 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, 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]), ([], [])], [([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, 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, 4, 8], [0, 4, 8])], [([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9])], [([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([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]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 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 | [4, 7, 0] | [0, 4, 7] | Failed |
| oracle 1 | [4, 7, 0] | [0, 4, 7] | Failed |
| oracle 2 | [11, 0, 4] | [11, 0, 4] | Passed |
| oracle 3 | [5, 6, 8, 0, 1] | [0, 1, 5, 6, 8] | Failed |
| oracle 4 | [8, 9, 0, 1, 3, 5] | [8, 9, 0, 1, 3, 5] | Passed |
| oracle 5 | [6, 7, 9, 0, 2, 3] | [0, 2, 3, 6, 7, 9] | Failed |
| oracle 6 | [5, 6, 7, 9, 0, 1, 2] | [0, 1, 2, 5, 6, 7, 9] | Failed |
| oracle 7 | [] | [] | Passed |
SHA-256 / 48691764dcef6357784f06bcf831bb092f13b8c12d43aa52a3d6c9ed5c71039c
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 + 1]]
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, 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]), ([], [])], [([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, 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, 4, 8], [0, 4, 8])], [([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9])], [([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([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]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 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 | [4, 7, 0, 4] | [0, 4, 7] | Failed |
| oracle 1 | [4, 7, 0, 4] | [0, 4, 7] | Failed |
| oracle 2 | [11, 0, 4, 11] | [11, 0, 4] | Failed |
| oracle 3 | [0, 1, 5, 6, 8, 0] | [0, 1, 5, 6, 8] | Failed |
| oracle 4 | [8, 9, 0, 1, 3, 5, 8] | [8, 9, 0, 1, 3, 5] | Failed |
| oracle 5 | [2, 3, 6, 7, 9, 0, 2] | [0, 2, 3, 6, 7, 9] | Failed |
| oracle 6 | [0, 1, 2, 5, 6, 7, 9, 0] | [0, 1, 2, 5, 6, 7, 9] | Failed |
| oracle 7 | [] | [] | Passed |
SHA-256 / 32797b63e1bd0d076c73d6acdd77e0b12898170787f89b78ae8210a08f67290b
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, 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]), ([], [])], [([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, 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, 4, 8], [0, 4, 8])], [([11, 0, 4], [11, 0, 4]), ([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6])], [([0, 1, 5, 6, 8], [0, 1, 5, 6, 8]), ([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, 4, 8], [0, 4, 8]), ([0, 3, 6, 9], [0, 3, 6, 9]), ([0, 6], [0, 6]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9])], [([0, 1, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([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]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 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, 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, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 6 | [0, 1, 2, 5, 6, 7, 9] | [0, 1, 2, 5, 6, 7, 9] | Passed |
| oracle 7 | [] | [] | Passed |
SHA-256 / 30e577db9966a94df4611aaf999ebb18819c8803fccd1b0f9163e5113d54814f
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.253845+00:00.
Case digest / c74f8df5af5fac1b493bbfa2963edac8bb5d4d0de320232cfce5cd7bba24e13c