FA-81141 / Music interval and transposition theory / Open access
Written key signature for a transposing part: transposition counted in fourths · case 01
A part written a whole step up from C major gets ten sharps-worth reduced to two flats instead of two sharps.
ROOT CAUSE
The key movement multiplies the semitone shift by five (fourths) instead of seven (fifths).
VERIFIED REPAIR
Restore the fifths per semitone step so that it reads `(7 * shift) % 12`.
Unsuccessful approach: Using the raw semitone count as a fifths count only works for shifts of 0 and 12.
Case contract
Input [concert_fifths, written_semitones_above_concert] with concert_fifths -7..7 and an integer semitone shift. The key moves by (7 * shift) mod 12 fifths; the written signature is concert_fifths plus that move, then normalised into -5..6 by adding or subtracting 12 (so six flats is written as six sharps). Invalid input returns None.
Why this case matters
Part extraction must print a transposed key signature consistent with the transposed notes.
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 len(x) != 2:
return None
concert, shift = x
if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
return None
move = (5 * shift) % 12
r = concert + move
while r > 6:
r -= 12
while r < -5:
r += 12
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([0, 9], 3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 1], -5)], [([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([-7, 0], 5), ([0, 0], 0), ([0, -1], 5), ([0, 12], 0), ([8, 0], None)], [([-3, 2], -1), ([0, 3], -3), ([0, 7], 1), ([-2, 9], 1), ([8, 0], None), ([0, '2'], None), ([-8, 0], None), ([-9, 2], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 7], 1), ([0, 1], -5), ([3, -3], 6), ([-9, 2], None)], [([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([0, -1], 5), ([-5, 7], -4)]]
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 | -2 | 2 | Failed |
| oracle 1 | -5 | -1 | Failed |
| oracle 2 | -3 | 3 | Failed |
| oracle 3 | 6 | 6 | Passed |
| oracle 4 | 6 | 6 | Passed |
| oracle 5 | -5 | -5 | Passed |
| oracle 6 | 5 | 5 | Passed |
| oracle 7 | 5 | -5 | Failed |
SHA-256 / aee580dbebc3728b5f74f44ff63743a07c2193836a6a33ad17212cfab3db6cdf
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 len(x) != 2:
return None
concert, shift = x
if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
return None
move = shift % 12
r = concert + move
while r > 6:
r -= 12
while r < -5:
r += 12
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([0, 9], 3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 1], -5)], [([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([-7, 0], 5), ([0, 0], 0), ([0, -1], 5), ([0, 12], 0), ([8, 0], None)], [([-3, 2], -1), ([0, 3], -3), ([0, 7], 1), ([-2, 9], 1), ([8, 0], None), ([0, '2'], None), ([-8, 0], None), ([-9, 2], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 7], 1), ([0, 1], -5), ([3, -3], 6), ([-9, 2], None)], [([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([0, -1], 5), ([-5, 7], -4)]]
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 | 2 | 2 | Passed |
| oracle 1 | -1 | -1 | Passed |
| oracle 2 | -3 | 3 | Failed |
| oracle 3 | 6 | 6 | Passed |
| oracle 4 | 6 | 6 | Passed |
| oracle 5 | -5 | -5 | Passed |
| oracle 6 | 5 | 5 | Passed |
| oracle 7 | 1 | -5 | Failed |
SHA-256 / cac457ca68952785d6220b5c41b1ca8d6cbdbbc315aec97edb966da3f4c6339c
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 len(x) != 2:
return None
concert, shift = x
if not isinstance(concert, int) or not isinstance(shift, int) or concert < -7 or concert > 7:
return None
move = (7 * shift) % 12
r = concert + move
while r > 6:
r -= 12
while r < -5:
r += 12
return r
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([0, 2], 2), ([-3, 2], -1), ([0, 9], 3), ([-6, 0], 6), ([6, 0], 6), ([7, 0], -5), ([-7, 0], 5), ([0, 1], -5)], [([0, -2], -2), ([0, 9], 3), ([0, 3], -3), ([-7, 0], 5), ([0, 0], 0), ([0, -1], 5), ([0, 12], 0), ([8, 0], None)], [([-3, 2], -1), ([0, 3], -3), ([0, 7], 1), ([-2, 9], 1), ([8, 0], None), ([0, '2'], None), ([-8, 0], None), ([-9, 2], None)], [([0, 2], 2), ([0, -2], -2), ([-3, 2], -1), ([0, 9], 3), ([0, 7], 1), ([0, 1], -5), ([3, -3], 6), ([-9, 2], None)], [([-3, 2], -1), ([0, 9], 3), ([0, 3], -3), ([0, 7], 1), ([0, 14], 2), ([1, 2], 3), ([0, -1], 5), ([-5, 7], -4)]]
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 | 2 | 2 | Passed |
| oracle 1 | -1 | -1 | Passed |
| oracle 2 | 3 | 3 | Passed |
| oracle 3 | 6 | 6 | Passed |
| oracle 4 | 6 | 6 | Passed |
| oracle 5 | -5 | -5 | Passed |
| oracle 6 | 5 | 5 | Passed |
| oracle 7 | -5 | -5 | Passed |
SHA-256 / f956c9f6882f0b9f3bada7dd39b676102968b7a3166b8427bcf291dc9a4dee41
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:50:00.291643+00:00.
Case digest / e054c8ff30fe193135e182c64a592144ed6cc2ef0b595806f6812f6a7d7f647e