FAILURE MAP
← Case archive

FA-80901 / Music interval and transposition theory / Open access

Interval quality and number naming: compound octave reference counted every eight numbers · case 01

Double-octave compounds such as C4 to C6 lose one octave of reference span and return None.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The compound octave count divides the generic number by eight, treating the octave as eight steps of stride.

VERIFIED REPAIR

Restore the compound reference step so that it reads `12 * ((number - 1) // 7)`.

Unsuccessful approach: Dividing the unshifted number by seven adds an octave to every seventh, so C4 to B4 is no longer M7.

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 // 8)
    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', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['G4', 'F5'], 'm7')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15')], [(['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15')], [(['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['G4', 'F5'], 'm7')], [(['C4', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['G4', 'F5'], 'm7')]]
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 fixtureActualExpectedOutcome
oracle 0M3M3Passed
oracle 1m3m3Passed
oracle 2P5P5Passed
oracle 3d5d5Passed
oracle 4A4A4Passed
oracle 5M7M7Passed
oracle 6NoneP15Failed
oracle 7m7m7Passed

SHA-256 / 5cddbb701fae2ff0c00d03f78ec8f50990d961a2b69adcd3030c23d0ffb8569a

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 // 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', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['G4', 'F5'], 'm7')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15')], [(['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15')], [(['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['G4', 'F5'], 'm7')], [(['C4', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['G4', 'F5'], 'm7')]]
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 fixtureActualExpectedOutcome
oracle 0M3M3Passed
oracle 1m3m3Passed
oracle 2P5P5Passed
oracle 3d5d5Passed
oracle 4A4A4Passed
oracle 5NoneM7Failed
oracle 6P15P15Passed
oracle 7Nonem7Failed

SHA-256 / 9c6abfb507084725d56c7389f3512d2c3800916bb0d91db0a5f5db3c9c92d5bd

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', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['G4', 'F5'], 'm7')], [(['C4', 'Gb4'], 'd5'), (['C4', 'F#4'], 'A4'), (['C4', 'C5'], 'P8'), (['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'B4'], 'M7'), (['C4', 'Bb4'], 'm7'), (['C4', 'C6'], 'P15')], [(['C4', 'D5'], 'M9'), (['C4', 'C4'], 'P1'), (['C4', 'C#4'], 'A1'), (['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bb4'], 'm7'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15')], [(['B#3', 'C4'], 'd2'), (['E4', 'F4'], 'm2'), (['C4', 'Bbb4'], 'd7'), (['C4', 'C6'], 'P15'), (['C4', 'G5'], 'P12'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['G4', 'F5'], 'm7')], [(['C4', 'B4'], 'M7'), (['C4', 'C6'], 'P15'), (['C4', 'F5'], 'P11'), (['D4', 'C4'], None), (['C4', 'B#3'], None), (['B3', 'C4'], 'm2'), (['F4', 'B4'], 'A4'), (['G4', 'F5'], 'm7')]]
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 fixtureActualExpectedOutcome
oracle 0M3M3Passed
oracle 1m3m3Passed
oracle 2P5P5Passed
oracle 3d5d5Passed
oracle 4A4A4Passed
oracle 5M7M7Passed
oracle 6P15P15Passed
oracle 7m7m7Passed

SHA-256 / d453858efa6e6cb0529f001354461729cc473ec70ca3581f308f9246216647ef

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.028655+00:00.

Case digest / e25c8b5c28d95f8f271e84bd078d78a53aadb692ecc1d2931c803bb9945a5227