FA-80906 / Music interval and transposition theory / Open access
Interval quality and number naming: fourth handled as an imperfect interval · case 01
The perfect fourth C4-F4 is named M4 and the augmented fourth C4-F#4 becomes an A4 only by accident of offsets.
ROOT CAUSE
The perfect-class set lists 1, 5 and 8, but simple numbers are reduced to 1..7 so 8 never occurs and 4 is missing.
VERIFIED REPAIR
Restore the perfect class membership step so that it reads `simple in (1, 4, 5)`.
Unsuccessful approach: Removing the unison from the perfect class names C4-C4 M1 instead of P1.
Case contract
Input [lower, upper] spelled pitches (letter, # or b accidentals, nonnegative octave). The generic number counts letter steps plus 7 per spelled octave plus one; quality compares the semitone span with the major/perfect reference (compounds add 12 per octave). Perfect class for simple numbers 1, 4, 5: P, A, d, AA, dd; others: M, m, A, d, AA, dd. Descending letter order or unrepresentable quality returns 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}
def parse(s):
if not isinstance(s, str) or len(s) < 2 or s[0] not in base:
return None
i = 1
acc = 0
while i < len(s) and s[i] in '#b':
acc += 1 if s[i] == '#' else -1
i += 1
if not s[i:].isdigit():
return None
octave = int(s[i:])
return ['CDEFGAB'.index(s[0]) + 7 * octave, 12 * octave + base[s[0]] + acc]
if not isinstance(x, list) or len(x) != 2:
return None
lo, hi = parse(x[0]), parse(x[1])
if lo is None or hi is None:
return None
steps = hi[0] - lo[0]
semis = hi[1] - lo[1]
if steps < 0:
return None
number = steps + 1
simple = (number - 1) % 7 + 1
ref = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7)
d = semis - ref
if simple in (1, 5, 8):
q = {0: 'P', 1: 'A', -1: 'd', 2: 'AA', -2: 'dd'}.get(d)
else:
q = {0: 'M', -1: 'm', 1: 'A', -2: 'd', 2: 'AA', -3: 'dd'}.get(d)
if q is None:
return None
return q + str(number)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'E4'], 'M3'), (['C4', 'Eb4'], 'm3'), (['C4', 'G4'], 'P5'), (['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'F5'], 'P11'), (['D4', 'D4'], 'P1')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['C4', 'Fb4'], 'd4')], [(['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11')], [(['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['D4', 'C4'], None), (['C4', 'Fb4'], 'd4'), (['D4', 'D4'], 'P1')], [(['C4', 'C5'], 'P8'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['D4', 'D4'], 'P1')]]
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 | M3 | M3 | Passed |
| oracle 1 | m3 | m3 | Passed |
| oracle 2 | P5 | P5 | Passed |
| oracle 3 | d5 | d5 | Passed |
| oracle 4 | A4 | A4 | Passed |
| oracle 5 | P8 | P8 | Passed |
| oracle 6 | M11 | P11 | Failed |
| oracle 7 | P1 | P1 | Passed |
SHA-256 / 8535af2513db675d66b2629c1198f20f0bfd7a2c5ac0fc45a432ab94186f683c
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}
def parse(s):
if not isinstance(s, str) or len(s) < 2 or s[0] not in base:
return None
i = 1
acc = 0
while i < len(s) and s[i] in '#b':
acc += 1 if s[i] == '#' else -1
i += 1
if not s[i:].isdigit():
return None
octave = int(s[i:])
return ['CDEFGAB'.index(s[0]) + 7 * octave, 12 * octave + base[s[0]] + acc]
if not isinstance(x, list) or len(x) != 2:
return None
lo, hi = parse(x[0]), parse(x[1])
if lo is None or hi is None:
return None
steps = hi[0] - lo[0]
semis = hi[1] - lo[1]
if steps < 0:
return None
number = steps + 1
simple = (number - 1) % 7 + 1
ref = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7)
d = semis - ref
if simple in (4, 5):
q = {0: 'P', 1: 'A', -1: 'd', 2: 'AA', -2: 'dd'}.get(d)
else:
q = {0: 'M', -1: 'm', 1: 'A', -2: 'd', 2: 'AA', -3: 'dd'}.get(d)
if q is None:
return None
return q + str(number)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'E4'], 'M3'), (['C4', 'Eb4'], 'm3'), (['C4', 'G4'], 'P5'), (['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'F5'], 'P11'), (['D4', 'D4'], 'P1')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['C4', 'Fb4'], 'd4')], [(['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11')], [(['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['D4', 'C4'], None), (['C4', 'Fb4'], 'd4'), (['D4', 'D4'], 'P1')], [(['C4', 'C5'], 'P8'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['D4', 'D4'], 'P1')]]
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 | M3 | M3 | Passed |
| oracle 1 | m3 | m3 | Passed |
| oracle 2 | P5 | P5 | Passed |
| oracle 3 | d5 | d5 | Passed |
| oracle 4 | A4 | A4 | Passed |
| oracle 5 | M8 | P8 | Failed |
| oracle 6 | P11 | P11 | Passed |
| oracle 7 | M1 | P1 | Failed |
SHA-256 / e8336dea42b46fc90183687e4147a534aafabd5ce85f2c1613fbf831834a69dd
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}
def parse(s):
if not isinstance(s, str) or len(s) < 2 or s[0] not in base:
return None
i = 1
acc = 0
while i < len(s) and s[i] in '#b':
acc += 1 if s[i] == '#' else -1
i += 1
if not s[i:].isdigit():
return None
octave = int(s[i:])
return ['CDEFGAB'.index(s[0]) + 7 * octave, 12 * octave + base[s[0]] + acc]
if not isinstance(x, list) or len(x) != 2:
return None
lo, hi = parse(x[0]), parse(x[1])
if lo is None or hi is None:
return None
steps = hi[0] - lo[0]
semis = hi[1] - lo[1]
if steps < 0:
return None
number = steps + 1
simple = (number - 1) % 7 + 1
ref = [0, 2, 4, 5, 7, 9, 11][simple - 1] + 12 * ((number - 1) // 7)
d = semis - ref
if simple in (1, 4, 5):
q = {0: 'P', 1: 'A', -1: 'd', 2: 'AA', -2: 'dd'}.get(d)
else:
q = {0: 'M', -1: 'm', 1: 'A', -2: 'd', 2: 'AA', -3: 'dd'}.get(d)
if q is None:
return None
return q + str(number)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C4', 'E4'], 'M3'), (['C4', 'Eb4'], 'm3'), (['C4', 'G4'], 'P5'), (['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'F5'], 'P11'), (['D4', 'D4'], 'P1')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['C4', 'Fb4'], 'd4')], [(['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11')], [(['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['D4', 'C4'], None), (['C4', 'Fb4'], 'd4'), (['D4', 'D4'], 'P1')], [(['C4', 'C5'], 'P8'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['D4', 'D4'], 'P1')]]
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 | M3 | M3 | Passed |
| oracle 1 | m3 | m3 | Passed |
| oracle 2 | P5 | P5 | Passed |
| oracle 3 | d5 | d5 | Passed |
| oracle 4 | A4 | A4 | Passed |
| oracle 5 | P8 | P8 | Passed |
| oracle 6 | P11 | P11 | Passed |
| oracle 7 | P1 | P1 | Passed |
SHA-256 / 0d2ae9a3515c9bd4d168a85662c150aad7fdaadfffd60586fce403b2a87cf69c
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.077160+00:00.
Case digest / 0f57471c795dbda1e92cd1c0e6744276a2693e4234c675a22ca972118a4ee3d3