FA-81301 / Music interval and transposition theory / Open access
Staff position and ledger lines for a clef: alto clef anchored at its middle line · case 01
Middle C in alto clef is placed on the bottom line instead of the middle line.
ROOT CAUSE
The alto reference uses the clef middle-line pitch C4 instead of the bottom-line pitch F3.
VERIFIED REPAIR
Restore the alto clef reference step so that it reads `'alto': ('F', 3)`.
Unsuccessful approach: Using F4 keeps the letter but puts the reference an octave too high.
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': ('C', 4), '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]), (['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['C4', 'alto'], [4, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['A4', 'alto'], [9, 0])], [(['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2])], [(['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['H4', 'treble'], None), (['A4', 'alto'], [9, 0])]]
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, 0] | [-1, 0] | Passed |
| oracle 3 | [-3, 1] | [-3, 1] | Passed |
| oracle 4 | [-4, 2] | [-4, 2] | Passed |
| oracle 5 | [0, 0] | [4, 0] | Failed |
| oracle 6 | [-8, 4] | [-4, 2] | Failed |
| oracle 7 | [5, 0] | [9, 0] | Failed |
SHA-256 / c71cbf5c4e94010b7e1bf7cf40f483bd149b77441d747d76d3d61a390075a66e
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', 4), '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]), (['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['C4', 'alto'], [4, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['A4', 'alto'], [9, 0])], [(['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2])], [(['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['H4', 'treble'], None), (['A4', 'alto'], [9, 0])]]
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, 0] | [-1, 0] | Passed |
| oracle 3 | [-3, 1] | [-3, 1] | Passed |
| oracle 4 | [-4, 2] | [-4, 2] | Passed |
| oracle 5 | [-3, 1] | [4, 0] | Failed |
| oracle 6 | [-11, 5] | [-4, 2] | Failed |
| oracle 7 | [2, 0] | [9, 0] | Failed |
SHA-256 / 4d12f0f5ffa28fc28aedccfa41390b875649059322f93756ea6573e0d4271e29
3 / The verified repair
Exit 0"""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]), (['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['C4', 'alto'], [4, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['B3', 'treble'], [-3, 1]), (['A3', 'treble'], [-4, 2]), (['F5', 'treble'], [8, 0]), (['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['A4', 'alto'], [9, 0])], [(['G5', 'treble'], [9, 0]), (['A5', 'treble'], [10, 1]), (['C6', 'treble'], [12, 2]), (['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['C4', 'alto'], [4, 0]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2])], [(['C#4', 'treble'], [-2, 1]), (['Fx4', 'treble'], [1, 0]), (['Bb3', 'treble'], [-3, 1]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['F3', 'alto'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['A4', 'alto'], [9, 0])], [(['C4', 'alto'], [4, 0]), (['C4', 'bass'], [10, 1]), (['E2', 'bass'], [-2, 1]), (['C4', 'tenor'], [6, 0]), (['G2', 'bass'], [0, 0]), (['B2', 'alto'], [-4, 2]), (['H4', 'treble'], None), (['A4', 'alto'], [9, 0])]]
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, 0] | [-1, 0] | Passed |
| oracle 3 | [-3, 1] | [-3, 1] | Passed |
| oracle 4 | [-4, 2] | [-4, 2] | Passed |
| oracle 5 | [4, 0] | [4, 0] | Passed |
| oracle 6 | [-4, 2] | [-4, 2] | Passed |
| oracle 7 | [9, 0] | [9, 0] | Passed |
SHA-256 / bcbdbc54d48281f628097f298917064012fbb82eb2e6321d4ab9c266671e2831
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.820268+00:00.
Case digest / 83bfa68929badb989419bc83ff5efa1da38c8822d822fbaab4ab9df4fe1676b3