FA-81041 / Music interval and transposition theory / Open access
Pitch-class set normal form (right-packed): normal form reports lifted pitch values · case 01
A wrapped normal form such as [11,0,4] is returned as [11,12,16].
ROOT CAUSE
The chosen rotation is returned with its octave-lifted working values instead of pitch classes.
VERIFIED REPAIR
Restore the reduced output step so that it reads `[p % 12 for p in rot]`.
Unsuccessful approach: Reducing only values above 12 still leaves a lifted 12 in the output.
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, 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, 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]), ([9, 0, 4, 4, 16], [9, 0, 4])], [([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, 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]), ([-1, 0, 1], [11, 0, 1])], [([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, 6], [0, 6]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 3, 7, 10], [7, 10, 0, 3])], [([11, 0, 4], [11, 0, 4]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([1, 5, 8], [1, 5, 8]), ([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, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([10, 2, 5], [10, 2, 5]), ([5], [5]), ([], []), ([3, 15, 27], [3]), ([-1, 0, 1], [11, 0, 1]), ([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])]]
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, 12, 16] | [11, 0, 4] | Failed |
| oracle 3 | [0, 1, 5, 6, 8] | [0, 1, 5, 6, 8] | Passed |
| oracle 4 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 5 | [0, 1, 2, 5, 6, 7, 9] | [0, 1, 2, 5, 6, 7, 9] | Passed |
| oracle 6 | [9, 10, 12, 13, 14, 16, 17, 19] | [9, 10, 0, 1, 2, 4, 5, 7] | Failed |
| oracle 7 | [9, 12, 16] | [9, 0, 4] | Failed |
SHA-256 / 09bfcc04555d3f50c4e0d2a405b2bebbd7d410067329c5adfcc01d0ed0651e8f
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[0])
if best is None or cand < best[0]:
best = (cand, [p - 12 if p > 12 else p 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, 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]), ([9, 0, 4, 4, 16], [9, 0, 4])], [([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, 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]), ([-1, 0, 1], [11, 0, 1])], [([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, 6], [0, 6]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 3, 7, 10], [7, 10, 0, 3])], [([11, 0, 4], [11, 0, 4]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([1, 5, 8], [1, 5, 8]), ([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, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([10, 2, 5], [10, 2, 5]), ([5], [5]), ([], []), ([3, 15, 27], [3]), ([-1, 0, 1], [11, 0, 1]), ([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])]]
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, 12, 4] | [11, 0, 4] | Failed |
| oracle 3 | [0, 1, 5, 6, 8] | [0, 1, 5, 6, 8] | Passed |
| oracle 4 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 5 | [0, 1, 2, 5, 6, 7, 9] | [0, 1, 2, 5, 6, 7, 9] | Passed |
| oracle 6 | [9, 10, 12, 1, 2, 4, 5, 7] | [9, 10, 0, 1, 2, 4, 5, 7] | Failed |
| oracle 7 | [9, 12, 4] | [9, 0, 4] | Failed |
SHA-256 / 096c0e04a9657a50e64b27f593d742fcc2b7a494abcaaf4b6717ae26a78ec613
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, 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]), ([9, 0, 4, 4, 16], [9, 0, 4])], [([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, 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]), ([-1, 0, 1], [11, 0, 1])], [([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, 6], [0, 6]), ([2, 5, 9], [2, 5, 9]), ([10, 2, 5], [10, 2, 5]), ([1, 5, 8], [1, 5, 8]), ([0, 1, 4, 6], [0, 1, 4, 6]), ([0, 3, 7, 10], [7, 10, 0, 3])], [([11, 0, 4], [11, 0, 4]), ([9, 0, 4, 4, 16], [9, 0, 4]), ([1, 5, 8], [1, 5, 8]), ([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, 3, 5, 8, 9], [8, 9, 0, 1, 3, 5]), ([10, 2, 5], [10, 2, 5]), ([5], [5]), ([], []), ([3, 15, 27], [3]), ([-1, 0, 1], [11, 0, 1]), ([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])]]
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 | [0, 2, 3, 6, 7, 9] | [0, 2, 3, 6, 7, 9] | Passed |
| oracle 5 | [0, 1, 2, 5, 6, 7, 9] | [0, 1, 2, 5, 6, 7, 9] | Passed |
| oracle 6 | [9, 10, 0, 1, 2, 4, 5, 7] | [9, 10, 0, 1, 2, 4, 5, 7] | Passed |
| oracle 7 | [9, 0, 4] | [9, 0, 4] | Passed |
SHA-256 / 7cb8e7802dba9487dbcd2edde564a7c52fbd507d329b7ed27ef99942c70804cf
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.302206+00:00.
Case digest / 184c6bad151194bb50d384e6b2c5aa5dd9b24d4b1e2ab6a13ffb57bb1a8441e7