FA-81001 / Music interval and transposition theory / Open access
Key signature and measure accidental resolution: double flat token rejected · case 01
Any passage containing a double flat such as Gbb4 or Bbb4 is rejected as invalid.
ROOT CAUSE
The sign whitelist omits the bb double-flat token although the alteration table defines it.
VERIFIED REPAIR
Restore the double flat token step so that it reads `'x', 'bb')`.
Unsuccessful approach: Whitelisting a triple flat instead of the double flat still rejects bb tokens.
Case contract
Input [fifths, tokens]. fifths -7..7 gives signature sharps on F C G D A E B or flats on B E A D G C F. Tokens are "|" (barline) or letter + optional sign (# b x bb n) + single-digit octave. An explicit sign sets the alteration for that letter in that octave until the next barline (n = 0 cancels the signature); otherwise the signature applies. Return the MIDI numbers (C4 = 60) or None if any token or the signature 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):
if not isinstance(x, list) or len(x) != 2:
return None
fifths, tokens = x
if not isinstance(fifths, int) or fifths < -7 or fifths > 7:
return None
base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
keysig = {}
if fifths > 0:
for letter in 'FCGDAEB'[:fifths]:
keysig[letter] = 1
else:
for letter in 'BEADGCF'[:-fifths]:
keysig[letter] = -1
marks = {}
out = []
for tok in tokens:
if tok == '|':
marks = {}
continue
letter, sign, octave = tok[0], tok[1:-1], tok[-1]
if letter not in base or not octave.isdigit() or sign not in ('', '#', 'b', 'n', 'x'):
return None
slot = letter + octave
if sign:
marks[slot] = {'#': 1, 'b': -1, 'n': 0, 'x': 2, 'bb': -2}[sign]
alter = marks[slot] if slot in marks else keysig.get(letter, 0)
out.append(12 * (int(octave) + 1) + base[letter] + alter)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, ['F4', 'Fn4', 'F4', '|', 'F4']], [66, 65, 65, 66]), ([0, ['C#4', 'C4', '|', 'C4']], [61, 61, 60]), ([0, ['C#4', 'C5', 'C4']], [61, 72, 61]), ([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([5, ['A4', 'An4', '|', 'A4']], [70, 69, 70]), ([0, ['B#3', 'C4', 'B3', '|', 'B3']], [60, 60, 60, 59]), ([-5, ['G4', 'Gn4', 'G4', 'G5']], [66, 67, 67, 78]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])]]
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 | [66, 65, 65, 66] | [66, 65, 65, 66] | Passed |
| oracle 1 | [61, 61, 60] | [61, 61, 60] | Passed |
| oracle 2 | [61, 72, 61] | [61, 72, 61] | Passed |
| oracle 3 | [70, 71, 71, 70] | [70, 71, 71, 70] | Passed |
| oracle 4 | [63, 68, 70, 62] | [63, 68, 70, 62] | Passed |
| oracle 5 | [66, 73, 67] | [66, 73, 67] | Passed |
| oracle 6 | None | [65, 65, 67] | Failed |
| oracle 7 | None | [69, 69, 70] | Failed |
SHA-256 / 1a1cdee0d02f0f2f4da5453f2aecbfdba3bd0e4fd070d7d7a52e6a947e916605
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
fifths, tokens = x
if not isinstance(fifths, int) or fifths < -7 or fifths > 7:
return None
base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
keysig = {}
if fifths > 0:
for letter in 'FCGDAEB'[:fifths]:
keysig[letter] = 1
else:
for letter in 'BEADGCF'[:-fifths]:
keysig[letter] = -1
marks = {}
out = []
for tok in tokens:
if tok == '|':
marks = {}
continue
letter, sign, octave = tok[0], tok[1:-1], tok[-1]
if letter not in base or not octave.isdigit() or sign not in ('', '#', 'b', 'n', 'x', 'bbb'):
return None
slot = letter + octave
if sign:
marks[slot] = {'#': 1, 'b': -1, 'n': 0, 'x': 2, 'bb': -2}[sign]
alter = marks[slot] if slot in marks else keysig.get(letter, 0)
out.append(12 * (int(octave) + 1) + base[letter] + alter)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, ['F4', 'Fn4', 'F4', '|', 'F4']], [66, 65, 65, 66]), ([0, ['C#4', 'C4', '|', 'C4']], [61, 61, 60]), ([0, ['C#4', 'C5', 'C4']], [61, 72, 61]), ([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([5, ['A4', 'An4', '|', 'A4']], [70, 69, 70]), ([0, ['B#3', 'C4', 'B3', '|', 'B3']], [60, 60, 60, 59]), ([-5, ['G4', 'Gn4', 'G4', 'G5']], [66, 67, 67, 78]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])]]
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 | [66, 65, 65, 66] | [66, 65, 65, 66] | Passed |
| oracle 1 | [61, 61, 60] | [61, 61, 60] | Passed |
| oracle 2 | [61, 72, 61] | [61, 72, 61] | Passed |
| oracle 3 | [70, 71, 71, 70] | [70, 71, 71, 70] | Passed |
| oracle 4 | [63, 68, 70, 62] | [63, 68, 70, 62] | Passed |
| oracle 5 | [66, 73, 67] | [66, 73, 67] | Passed |
| oracle 6 | None | [65, 65, 67] | Failed |
| oracle 7 | None | [69, 69, 70] | Failed |
SHA-256 / 6e2cfbea63d5f7367b15234360df1402df788911a2efafa886086ac919036f0f
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
fifths, tokens = x
if not isinstance(fifths, int) or fifths < -7 or fifths > 7:
return None
base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
keysig = {}
if fifths > 0:
for letter in 'FCGDAEB'[:fifths]:
keysig[letter] = 1
else:
for letter in 'BEADGCF'[:-fifths]:
keysig[letter] = -1
marks = {}
out = []
for tok in tokens:
if tok == '|':
marks = {}
continue
letter, sign, octave = tok[0], tok[1:-1], tok[-1]
if letter not in base or not octave.isdigit() or sign not in ('', '#', 'b', 'n', 'x', 'bb'):
return None
slot = letter + octave
if sign:
marks[slot] = {'#': 1, 'b': -1, 'n': 0, 'x': 2, 'bb': -2}[sign]
alter = marks[slot] if slot in marks else keysig.get(letter, 0)
out.append(12 * (int(octave) + 1) + base[letter] + alter)
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([1, ['F4', 'Fn4', 'F4', '|', 'F4']], [66, 65, 65, 66]), ([0, ['C#4', 'C4', '|', 'C4']], [61, 61, 60]), ([0, ['C#4', 'C5', 'C4']], [61, 72, 61]), ([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-1, ['B4', 'Bn4', 'B4', '|', 'B4']], [70, 71, 71, 70]), ([-3, ['E4', 'A4', 'B4', 'D4']], [63, 68, 70, 62]), ([2, ['F4', 'C5', 'G4']], [66, 73, 67]), ([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([-2, ['Eb4', 'E4', 'En4', 'E4']], [63, 63, 64, 64]), ([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([3, ['Fx4', 'F4', '|', 'F4', 'G4']], [67, 67, 66, 68]), ([-7, ['F4', 'C4', 'B3']], [64, 59, 58]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([7, ['B3', 'E4', 'C4']], [60, 65, 61]), ([8, ['C4']], None), ([0, ['H4']], None), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])], [([0, ['Gbb4', 'G4', '|', 'G4']], [65, 65, 67]), ([0, ['C#44']], None), ([4, ['D4', 'Dn4', 'D5', 'D4']], [63, 62, 75, 62]), ([-4, ['D4', 'Db4', 'D4', '|', 'D4']], [61, 61, 61, 61]), ([5, ['A4', 'An4', '|', 'A4']], [70, 69, 70]), ([0, ['B#3', 'C4', 'B3', '|', 'B3']], [60, 60, 60, 59]), ([-5, ['G4', 'Gn4', 'G4', 'G5']], [66, 67, 67, 78]), ([-1, ['Bbb4', 'B4', '|', 'B4']], [69, 69, 70])]]
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 | [66, 65, 65, 66] | [66, 65, 65, 66] | Passed |
| oracle 1 | [61, 61, 60] | [61, 61, 60] | Passed |
| oracle 2 | [61, 72, 61] | [61, 72, 61] | Passed |
| oracle 3 | [70, 71, 71, 70] | [70, 71, 71, 70] | Passed |
| oracle 4 | [63, 68, 70, 62] | [63, 68, 70, 62] | Passed |
| oracle 5 | [66, 73, 67] | [66, 73, 67] | Passed |
| oracle 6 | [65, 65, 67] | [65, 65, 67] | Passed |
| oracle 7 | [69, 69, 70] | [69, 69, 70] | Passed |
SHA-256 / be7fca27aa96dc334cae6f78fd00a47eb1af42cfea21a1a4b0598170158590e5
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.007133+00:00.
Case digest / 4b7b77bb694a535ff3f5d69a482d4cc3560a594cac1cda8f749dd4136ff49e28