FA-80961 / Music interval and transposition theory / Open access
Key signature size for a named tonic: signature folded through pitch class · case 01
Gb major reports six sharps and C# major reports one sharp: enharmonic keys collapse onto one pitch class.
ROOT CAUSE
The fifths count is reduced modulo twelve as if the key were a pitch class, discarding the spelled tonic.
VERIFIED REPAIR
Restore the enharmonic identity step so that it reads `fifths = base[tonic[0]] + 7 * acc`.
Unsuccessful approach: Shifting the fold window only moves the collision: F# major becomes six flats and C# major becomes five flats.
Case contract
Input [tonic, mode] with tonic a letter optionally followed by one # or b, and mode major or minor. The signature is the letter position on the line of fifths (F -1, C 0, G 1, D 2, A 3, E 4, B 5) plus 7 per sharp and minus 7 per flat; minor keys use the relative major, three fifths flatward. Return the count (positive sharps, negative flats) or None if it lies outside -7..7 or the input is invalid.
Why this case matters
Pitch spelling and interval arithmetic decide the notes that notation, transposition and analysis tools display or play.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
if not isinstance(x, list) or len(x) != 2:
return None
tonic, mode = x
if mode not in ('major', 'minor'):
return None
if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
return None
rest = tonic[1:]
if rest not in ('', '#', 'b'):
return None
acc = {'': 0, '#': 1, 'b': -1}[rest]
fifths = (base[tonic[0]] + 7 * acc + 5) % 12 - 5
if mode == 'minor':
fifths -= 3
if fifths < -7 or fifths > 7:
return None
return fifths
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['C#', 'minor'], 4)], [(['C#', 'major'], 7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['Cb', 'major'], -7), (['E', 'minor'], 1), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['F', 'minor'], -4)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['F', 'minor'], -4), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['G#', 'minor'], 5), (['A#', 'minor'], 7), (['Fb', 'major'], None), (['C', 'dorian'], None), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['Bb', 'major'], -2)]]
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 | 0 | Passed |
| oracle 1 | 1 | 1 | Passed |
| oracle 2 | -1 | -1 | Passed |
| oracle 3 | 6 | 6 | Passed |
| oracle 4 | 6 | -6 | Failed |
| oracle 5 | 5 | -7 | Failed |
| oracle 6 | -5 | -5 | Passed |
| oracle 7 | None | 4 | Failed |
SHA-256 / 69590f074822937e4b57e83e8be6935236cf8c73d977520e6118d8061a660cdd
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
if not isinstance(x, list) or len(x) != 2:
return None
tonic, mode = x
if mode not in ('major', 'minor'):
return None
if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
return None
rest = tonic[1:]
if rest not in ('', '#', 'b'):
return None
acc = {'': 0, '#': 1, 'b': -1}[rest]
fifths = (base[tonic[0]] + 7 * acc + 6) % 12 - 6
if mode == 'minor':
fifths -= 3
if fifths < -7 or fifths > 7:
return None
return fifths
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['C#', 'minor'], 4)], [(['C#', 'major'], 7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['Cb', 'major'], -7), (['E', 'minor'], 1), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['F', 'minor'], -4)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['F', 'minor'], -4), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['G#', 'minor'], 5), (['A#', 'minor'], 7), (['Fb', 'major'], None), (['C', 'dorian'], None), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['Bb', 'major'], -2)]]
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 | 0 | Passed |
| oracle 1 | 1 | 1 | Passed |
| oracle 2 | -1 | -1 | Passed |
| oracle 3 | -6 | 6 | Failed |
| oracle 4 | -6 | -6 | Passed |
| oracle 5 | 5 | -7 | Failed |
| oracle 6 | -5 | -5 | Passed |
| oracle 7 | None | 4 | Failed |
SHA-256 / 8dff007e21722611ca036f1eb3a287603e2530eaf07a91d39e955d8bab48ae09
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = {'F': -1, 'C': 0, 'G': 1, 'D': 2, 'A': 3, 'E': 4, 'B': 5}
if not isinstance(x, list) or len(x) != 2:
return None
tonic, mode = x
if mode not in ('major', 'minor'):
return None
if not isinstance(tonic, str) or not tonic or tonic[0] not in base:
return None
rest = tonic[1:]
if rest not in ('', '#', 'b'):
return None
acc = {'': 0, '#': 1, 'b': -1}[rest]
fifths = base[tonic[0]] + 7 * acc
if mode == 'minor':
fifths -= 3
if fifths < -7 or fifths > 7:
return None
return fifths
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'major'], 0), (['G', 'major'], 1), (['F', 'major'], -1), (['F#', 'major'], 6), (['Gb', 'major'], -6), (['Cb', 'major'], -7), (['Db', 'major'], -5), (['C#', 'minor'], 4)], [(['C#', 'major'], 7), (['Db', 'major'], -5), (['B', 'major'], 5), (['A', 'minor'], 0), (['E', 'minor'], 1), (['D', 'minor'], -1), (['C#', 'minor'], 4), (['G#', 'minor'], 5)], [(['Cb', 'major'], -7), (['E', 'minor'], 1), (['D', 'minor'], -1), (['Eb', 'minor'], -6), (['Ab', 'minor'], -7), (['G#', 'minor'], 5), (['D#', 'minor'], 6), (['F', 'minor'], -4)], [(['C#', 'minor'], 4), (['Ab', 'minor'], -7), (['D#', 'minor'], 6), (['A#', 'minor'], 7), (['F', 'minor'], -4), (['Bb', 'minor'], -5), (['C', 'dorian'], None), (['C', 'Major'], None)], [(['G#', 'minor'], 5), (['A#', 'minor'], 7), (['Fb', 'major'], None), (['C', 'dorian'], None), (['C', 'Major'], None), (['H', 'major'], None), (['Cx', 'major'], None), (['Bb', 'major'], -2)]]
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 | 0 | Passed |
| oracle 1 | 1 | 1 | Passed |
| oracle 2 | -1 | -1 | Passed |
| oracle 3 | 6 | 6 | Passed |
| oracle 4 | -6 | -6 | Passed |
| oracle 5 | -7 | -7 | Passed |
| oracle 6 | -5 | -5 | Passed |
| oracle 7 | 4 | 4 | Passed |
SHA-256 / 6e439222722bd7986e488497fef5d095acfed3b65062057ca67622a5ff48be0a
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:58.620184+00:00.
Case digest / fb30f2101125a1486cba8c38bd31a8b7ce3ba6e99f79a7e99b711b7e5b67b095