FA-80936 / Music interval and transposition theory / Open access
Spelled transposition by named interval: double accidentals rejected · case 01
Legitimate results like Bbb4 or D##5 are rejected even though two accidentals are within contract.
ROOT CAUSE
The accidental guard allows at most one sharp or flat.
VERIFIED REPAIR
Restore the accidental limit step so that it reads `abs(new_acc) > 2`.
Unsuccessful approach: Checking only the sharp side admits triple flats such as Fbbb.
Case contract
Input [note, interval, direction]. note: letter, # or b accidentals, nonnegative octave. interval: quality letter (P, M, m, A, d) and generic number >= 1 with perfect-class numbers 1, 4, 5 (compounds reduce by 7). Direction up or down moves the letter by number-1 steps and the pitch by the interval size; the result is spelled with the moved letter, octave taken from the letter position. Results needing more than two accidentals, or a negative octave, return None.
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 = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
if not isinstance(x, list) or len(x) != 3:
return None
note, ivl, direction = x
if direction not in ('up', 'down'):
return None
if not isinstance(note, str) or len(note) < 2 or note[0] not in base:
return None
i = 1
acc = 0
while i < len(note) and note[i] in '#b':
acc += 1 if note[i] == '#' else -1
i += 1
if not note[i:].isdigit():
return None
octave = int(note[i:])
if not isinstance(ivl, str) or len(ivl) < 2 or not ivl[1:].isdigit():
return None
quality = ivl[0]
number = int(ivl[1:])
if number < 1:
return None
simple = (number - 1) % 7 + 1
perfect = simple in (1, 4, 5)
offsets = {'P': 0, 'A': 1, 'd': -1} if perfect else {'M': 0, 'm': -1, 'A': 1, 'd': -2}
if quality not in offsets:
return None
size = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7) + offsets[quality]
sign = 1 if direction == 'up' else -1
idx = 'CDEFGAB'.index(note[0]) + 7 * octave + sign * (number - 1)
pitch = 12 * octave + base[note[0]] + acc + sign * size
letter = 'CDEFGAB'[idx % 7]
new_octave = idx // 7
new_acc = pitch - (12 * new_octave + base[letter])
if abs(new_acc) > 1 or new_octave < 0:
return None
return letter + ('#' * new_acc if new_acc > 0 else 'b' * -new_acc) + str(new_octave)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'M3', 'up'], 'E4'), (['C4', 'M3', 'down'], 'Ab3'), (['B3', 'm2', 'up'], 'C4'), (['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['C4', 'd7', 'up'], 'Bbb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None)], [(['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['F#4', 'A4', 'up'], 'B#4'), (['C4', 'd5', 'up'], 'Gb4'), (['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd5', 'up'], 'Gb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['C4', 'M9', 'up'], 'D5'), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['Bb4', 'd2', 'up'], 'Cbb5')], [(['C4', 'd7', 'up'], 'Bbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['A4', 'M6', 'up'], 'F#5'), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['C4', 'X3', 'up'], None), (['C4', 'M4', 'up'], None), (['C4', 'P3', 'up'], None), (['Bb4', 'd2', 'up'], 'Cbb5')]]
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 | E4 | E4 | Passed |
| oracle 1 | Ab3 | Ab3 | Passed |
| oracle 2 | C4 | C4 | Passed |
| oracle 3 | B3 | B3 | Passed |
| oracle 4 | A#4 | A#4 | Passed |
| oracle 5 | None | Bbb4 | Failed |
| oracle 6 | None | Fbb4 | Failed |
| oracle 7 | None | None | Passed |
SHA-256 / 48251ceebdb816d999020d2d92950adf1cb81584a445f46e40dce6815a9cddba
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
if not isinstance(x, list) or len(x) != 3:
return None
note, ivl, direction = x
if direction not in ('up', 'down'):
return None
if not isinstance(note, str) or len(note) < 2 or note[0] not in base:
return None
i = 1
acc = 0
while i < len(note) and note[i] in '#b':
acc += 1 if note[i] == '#' else -1
i += 1
if not note[i:].isdigit():
return None
octave = int(note[i:])
if not isinstance(ivl, str) or len(ivl) < 2 or not ivl[1:].isdigit():
return None
quality = ivl[0]
number = int(ivl[1:])
if number < 1:
return None
simple = (number - 1) % 7 + 1
perfect = simple in (1, 4, 5)
offsets = {'P': 0, 'A': 1, 'd': -1} if perfect else {'M': 0, 'm': -1, 'A': 1, 'd': -2}
if quality not in offsets:
return None
size = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7) + offsets[quality]
sign = 1 if direction == 'up' else -1
idx = 'CDEFGAB'.index(note[0]) + 7 * octave + sign * (number - 1)
pitch = 12 * octave + base[note[0]] + acc + sign * size
letter = 'CDEFGAB'[idx % 7]
new_octave = idx // 7
new_acc = pitch - (12 * new_octave + base[letter])
if new_acc > 2 or new_octave < 0:
return None
return letter + ('#' * new_acc if new_acc > 0 else 'b' * -new_acc) + str(new_octave)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'M3', 'up'], 'E4'), (['C4', 'M3', 'down'], 'Ab3'), (['B3', 'm2', 'up'], 'C4'), (['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['C4', 'd7', 'up'], 'Bbb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None)], [(['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['F#4', 'A4', 'up'], 'B#4'), (['C4', 'd5', 'up'], 'Gb4'), (['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd5', 'up'], 'Gb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['C4', 'M9', 'up'], 'D5'), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['Bb4', 'd2', 'up'], 'Cbb5')], [(['C4', 'd7', 'up'], 'Bbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['A4', 'M6', 'up'], 'F#5'), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['C4', 'X3', 'up'], None), (['C4', 'M4', 'up'], None), (['C4', 'P3', 'up'], None), (['Bb4', 'd2', 'up'], 'Cbb5')]]
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 | E4 | E4 | Passed |
| oracle 1 | Ab3 | Ab3 | Passed |
| oracle 2 | C4 | C4 | Passed |
| oracle 3 | B3 | B3 | Passed |
| oracle 4 | A#4 | A#4 | Passed |
| oracle 5 | Bbb4 | Bbb4 | Passed |
| oracle 6 | Fbb4 | Fbb4 | Passed |
| oracle 7 | Ebbb4 | None | Failed |
SHA-256 / 0602736ce2257c47515aad988acc5a528f3446ed3568affcab629ad7edff2992
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = {'C': 0, 'D': 2, 'E': 4, 'F': 5, 'G': 7, 'A': 9, 'B': 11}
if not isinstance(x, list) or len(x) != 3:
return None
note, ivl, direction = x
if direction not in ('up', 'down'):
return None
if not isinstance(note, str) or len(note) < 2 or note[0] not in base:
return None
i = 1
acc = 0
while i < len(note) and note[i] in '#b':
acc += 1 if note[i] == '#' else -1
i += 1
if not note[i:].isdigit():
return None
octave = int(note[i:])
if not isinstance(ivl, str) or len(ivl) < 2 or not ivl[1:].isdigit():
return None
quality = ivl[0]
number = int(ivl[1:])
if number < 1:
return None
simple = (number - 1) % 7 + 1
perfect = simple in (1, 4, 5)
offsets = {'P': 0, 'A': 1, 'd': -1} if perfect else {'M': 0, 'm': -1, 'A': 1, 'd': -2}
if quality not in offsets:
return None
size = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7) + offsets[quality]
sign = 1 if direction == 'up' else -1
idx = 'CDEFGAB'.index(note[0]) + 7 * octave + sign * (number - 1)
pitch = 12 * octave + base[note[0]] + acc + sign * size
letter = 'CDEFGAB'[idx % 7]
new_octave = idx // 7
new_acc = pitch - (12 * new_octave + base[letter])
if abs(new_acc) > 2 or new_octave < 0:
return None
return letter + ('#' * new_acc if new_acc > 0 else 'b' * -new_acc) + str(new_octave)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'M3', 'up'], 'E4'), (['C4', 'M3', 'down'], 'Ab3'), (['B3', 'm2', 'up'], 'C4'), (['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['C4', 'd7', 'up'], 'Bbb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None)], [(['C4', 'm2', 'down'], 'B3'), (['E4', 'A4', 'up'], 'A#4'), (['F#4', 'A4', 'up'], 'B#4'), (['C4', 'd5', 'up'], 'Gb4'), (['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd5', 'up'], 'Gb4'), (['Db4', 'd3', 'up'], 'Fbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'P8', 'up'], 'C5'), (['C4', 'M9', 'up'], 'D5'), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['Bb4', 'd2', 'up'], 'Cbb5')], [(['C4', 'd7', 'up'], 'Bbb4'), (['Cb4', 'd3', 'up'], None), (['C4', 'M10', 'down'], 'Ab2'), (['G4', 'P5', 'up'], 'D5'), (['A4', 'M6', 'up'], 'F#5'), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['G#4', 'A5', 'up'], 'D##5')], [(['C4', 'd3', 'up'], 'Ebb4'), (['Cb4', 'd3', 'up'], None), (['E#4', 'A6', 'up'], None), (['C0', 'm2', 'down'], None), (['C4', 'X3', 'up'], None), (['C4', 'M4', 'up'], None), (['C4', 'P3', 'up'], None), (['Bb4', 'd2', 'up'], 'Cbb5')]]
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 | E4 | E4 | Passed |
| oracle 1 | Ab3 | Ab3 | Passed |
| oracle 2 | C4 | C4 | Passed |
| oracle 3 | B3 | B3 | Passed |
| oracle 4 | A#4 | A#4 | Passed |
| oracle 5 | Bbb4 | Bbb4 | Passed |
| oracle 6 | Fbb4 | Fbb4 | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 475ffc31d507f51d3c1f157610d90c2d80a4fee678e5c6f8f09fde06bf9c904a
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.576186+00:00.
Case digest / e2ed2705a2780dd3dfc5482226006eff47924903cbbe62273480d0bec667e61c