FAILURE MAP
← Case archive

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

Interval inversion by quality and number: octave excluded from perfect intervals · case 01

P8 and P15 are rejected while M8 would be accepted.

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

ROOT CAUSE

The set of perfect-class numbers omits the octave.

THE FAILURE

The set of perfect-class numbers omits the octave.

Unsuccessful approach: Omitting the fourth instead rejects P4 and accepts M4.

Case contract

Input an interval string: quality from P, M, m, A, d, AA, dd followed by a positive integer. Compound numbers above 8 reduce by 7 until <= 8. P is valid only for 1, 4, 5, 8; M and m only for 2, 3, 6, 7. Inversion maps M<->m, A<->d, AA<->dd, P->P and number n -> 9-n. Invalid input 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):
    swap = {'M': 'm', 'm': 'M', 'A': 'd', 'd': 'A', 'AA': 'dd', 'dd': 'AA', 'P': 'P'}
    if not isinstance(x, str):
        return None
    q = x.rstrip('0123456789')
    digits = x[len(q):]
    if q not in swap or not digits.isdigit() or int(digits) < 1:
        return None
    n = int(digits)
    while n > 8:
        n -= 7
    perfect = n in (1, 4, 5)
    if (q == 'P' and not perfect) or (q in ('M', 'm') and perfect):
        return None
    return swap[q] + str(9 - n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('M3', 'm6'), ('m3', 'M6'), ('P5', 'P4'), ('P4', 'P5'), ('P1', 'P8'), ('P8', 'P1'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P1', 'P8'), ('P8', 'P1'), ('A4', 'd5'), ('d5', 'A4'), ('M2', 'm7'), ('P15', 'P1'), ('M4', None)], [('P4', 'P5'), ('M2', 'm7'), ('m7', 'M2'), ('M10', 'm6'), ('P15', 'P1'), ('P12', 'P4'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P8', 'P1'), ('P12', 'P4'), ('AA4', 'dd5'), ('dd5', 'AA4'), ('A1', 'd8'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P8', 'P1'), ('P15', 'P1'), ('A1', 'd8'), ('d8', 'A1'), ('M6', 'm3'), ('m9', 'M7'), ('M4', None)]]
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 0m6m6Passed
oracle 1M6M6Passed
oracle 2P4P4Passed
oracle 3P5P5Passed
oracle 4P8P8Passed
oracle 5NoneP1Failed
oracle 6NoneNonePassed
oracle 7NoneP1Failed

SHA-256 / 19bccbf8d032fd7e7f1bfb29b0de15014c67acdf5533320cfffcb4ec0a4c0980

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(x):
    swap = {'M': 'm', 'm': 'M', 'A': 'd', 'd': 'A', 'AA': 'dd', 'dd': 'AA', 'P': 'P'}
    if not isinstance(x, str):
        return None
    q = x.rstrip('0123456789')
    digits = x[len(q):]
    if q not in swap or not digits.isdigit() or int(digits) < 1:
        return None
    n = int(digits)
    while n > 8:
        n -= 7
    perfect = n in (1, 5, 8)
    if (q == 'P' and not perfect) or (q in ('M', 'm') and perfect):
        return None
    return swap[q] + str(9 - n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('M3', 'm6'), ('m3', 'M6'), ('P5', 'P4'), ('P4', 'P5'), ('P1', 'P8'), ('P8', 'P1'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P1', 'P8'), ('P8', 'P1'), ('A4', 'd5'), ('d5', 'A4'), ('M2', 'm7'), ('P15', 'P1'), ('M4', None)], [('P4', 'P5'), ('M2', 'm7'), ('m7', 'M2'), ('M10', 'm6'), ('P15', 'P1'), ('P12', 'P4'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P8', 'P1'), ('P12', 'P4'), ('AA4', 'dd5'), ('dd5', 'AA4'), ('A1', 'd8'), ('M4', None), ('P22', 'P1')], [('P4', 'P5'), ('P8', 'P1'), ('P15', 'P1'), ('A1', 'd8'), ('d8', 'A1'), ('M6', 'm3'), ('m9', 'M7'), ('M4', None)]]
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 0m6m6Passed
oracle 1M6M6Passed
oracle 2P4P4Passed
oracle 3NoneP5Failed
oracle 4P8P8Passed
oracle 5P1P1Passed
oracle 6m5NoneFailed
oracle 7P1P1Passed

SHA-256 / cedc6d39d6a70db275cbade2ed79e7f2865b94833af6ec758860582083796487

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

Case digest / 9aa8b35100ca7da76aa327677b9e10bf50e71c69df00c7e43e2a55e285dffd8e