FA-81291 / Music interval and transposition theory / Open access
Staff position and ledger lines for a clef: lower ledger count rounded the wrong way · case 01
B3 in treble clef (just below middle C) reports two ledger lines instead of one.
ROOT CAUSE
Negation is applied after floor division, so odd negative positions round away from the staff.
THE FAILURE
Negation is applied after floor division, so odd negative positions round away from the staff.
Unsuccessful approach: Rounding the positive distance up gives D4, which hangs below the bottom line, a ledger line it does not need.
Case contract
Input [note, clef] where note is a letter, accidentals (# b x, ignored for placement) and a nonnegative octave, and clef is treble (bottom line E4), bass (G2), alto (F3) or tenor (D3). Position counts diatonic steps above the bottom line (lines are even positions 0..8). Ledger lines: below the staff (-position)//2 for negative positions, above (position-8)//2 for positions over 8, else 0. Return [position, ledgers] or None when invalid.
Why this case matters
Engraving and notation-rendering code places noteheads and ledger lines from pitch spellings.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = 'CDEFGAB'
refs = {'treble': ('E', 4), 'bass': ('G', 2), 'alto': ('F', 3), 'tenor': ('D', 3)}
if not isinstance(x, list) or len(x) != 2 or x[1] not in refs:
return None
note, clef = x
if not isinstance(note, str) or len(note) < 2 or note[0] not in base:
return None
tail = note[1:].lstrip('#bx')
if not tail.isdigit():
return None
letter, octave = refs[clef]
pos = (int(tail) * 7 + base.index(note[0])) - (octave * 7 + base.index(letter))
if pos < 0:
ledgers = -(pos // 2)
elif pos > 8:
ledgers = (pos - 8) // 2
else:
ledgers = 0
return [pos, ledgers]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['E4', 'treble'], [0, 0]), (['C4', 'treble'], [-2, 1]), (['D4', 'treble'], [-1, 0]), (['A3', 'treble'], [-4, 2]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['Bb3', 'treble'], [-3, 1]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['B3', 'treble'], [-3, 1]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['B3', 'treble'], [-3, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1])], [(['B3', 'treble'], [-3, 1]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['H4', 'treble'], None), (['G3', 'treble'], [-5, 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] | [0, 0] | Passed |
| oracle 1 | [-2, 1] | [-2, 1] | Passed |
| oracle 2 | [-1, 1] | [-1, 0] | Failed |
| oracle 3 | [-4, 2] | [-4, 2] | Passed |
| oracle 4 | [8, 0] | [8, 0] | Passed |
| oracle 5 | [9, 0] | [9, 0] | Passed |
| oracle 6 | [-3, 2] | [-3, 1] | Failed |
| oracle 7 | [-5, 3] | [-5, 2] | Failed |
SHA-256 / 15a5d3ea07548dbaa28cf8cd2468992ae189394f8528d8375805adaef87c4a76
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
base = 'CDEFGAB'
refs = {'treble': ('E', 4), 'bass': ('G', 2), 'alto': ('F', 3), 'tenor': ('D', 3)}
if not isinstance(x, list) or len(x) != 2 or x[1] not in refs:
return None
note, clef = x
if not isinstance(note, str) or len(note) < 2 or note[0] not in base:
return None
tail = note[1:].lstrip('#bx')
if not tail.isdigit():
return None
letter, octave = refs[clef]
pos = (int(tail) * 7 + base.index(note[0])) - (octave * 7 + base.index(letter))
if pos < 0:
ledgers = (-pos + 1) // 2
elif pos > 8:
ledgers = (pos - 8) // 2
else:
ledgers = 0
return [pos, ledgers]
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['E4', 'treble'], [0, 0]), (['C4', 'treble'], [-2, 1]), (['D4', 'treble'], [-1, 0]), (['A3', 'treble'], [-4, 2]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['Bb3', 'treble'], [-3, 1]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['B3', 'treble'], [-3, 1]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['B3', 'treble'], [-3, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1])], [(['B3', 'treble'], [-3, 1]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['G3', 'treble'], [-5, 2])], [(['D4', 'treble'], [-1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['H4', 'treble'], None), (['G3', 'treble'], [-5, 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] | [0, 0] | Passed |
| oracle 1 | [-2, 1] | [-2, 1] | Passed |
| oracle 2 | [-1, 1] | [-1, 0] | Failed |
| oracle 3 | [-4, 2] | [-4, 2] | Passed |
| oracle 4 | [8, 0] | [8, 0] | Passed |
| oracle 5 | [9, 0] | [9, 0] | Passed |
| oracle 6 | [-3, 2] | [-3, 1] | Failed |
| oracle 7 | [-5, 3] | [-5, 2] | Failed |
SHA-256 / 5e5704eddd2c1744a09c261168a9015be70f55e74f76de9978fb2db4c247ddd0
HELD IN THE MEMBER ARCHIVE
The verified repair and its recorded checks are member-only.
This mechanism has 8 recorded checks per implementation. The open-access tier publishes the failure and the unsuccessful fix; the repaired source that passes every check, and the observations that prove it, are available to members.
Every case sharing this mechanism uses the same contract and the same repair, so this one record is held back for all of them.
Member access is invitation-based. Sign in with your invited account to inspect the repair.
Sign in to the archive ↗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:01.777924+00:00.
Case digest / d91c1273409a6ab2403776fbda46c2375017ace44489ece5ed08c424427366da