FAILURE MAP
← Case archive

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

Modal scale spelling from a tonic: flat degrees reported as eleven-semitone sharps · case 01

Every scale containing a flat degree returns None because a flat is folded to +11 and rejected.

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

ROOT CAUSE

The alteration is reduced into 0..11 instead of a signed window around the natural letter.

THE FAILURE

The alteration is reduced into 0..11 instead of a signed window around the natural letter.

Unsuccessful approach: Dropping the fold entirely breaks degrees that wrap past B to C, e.g. C# locrian.

Case contract

Input [tonic, mode]: tonic is a letter plus optional accidental from "", #, b, x, bb; mode is one of the seven church modes ionian..locrian. The step pattern is the major pattern 2 2 1 2 2 2 1 rotated left by the mode index. Each degree uses the next letter; its alteration is the pitch-class difference from the natural letter folded into -6..5. Return the seven names, or None if any alteration exceeds two or input is invalid.

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}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = (pc - base[letter]) % 12
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Dx', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Dx', 'ionian'], None), (['D', 'major'], None), (['Abb', 'locrian'], None), (['H', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['Fb', 'locrian'], ['Fb', 'Gbb', 'Abb', 'Bbb', 'Cbb', 'Dbb', 'Ebb'])]]
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 0['C', 'D', 'E', 'F', 'G', 'A', 'B']['C', 'D', 'E', 'F', 'G', 'A', 'B']Passed
oracle 1['D', 'E', 'F', 'G', 'A', 'B', 'C']['D', 'E', 'F', 'G', 'A', 'B', 'C']Passed
oracle 2['G', 'A', 'B', 'C', 'D', 'E', 'F']['G', 'A', 'B', 'C', 'D', 'E', 'F']Passed
oracle 3None['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']Failed
oracle 4['C', 'D', 'E', 'F#', 'G', 'A', 'B']['C', 'D', 'E', 'F#', 'G', 'A', 'B']Passed
oracle 5None['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']Failed
oracle 6['C#', 'D', 'E', 'F#', 'G', 'A', 'B']['C#', 'D', 'E', 'F#', 'G', 'A', 'B']Passed
oracle 7NoneNonePassed

SHA-256 / d8635d0ef61598bb38a9ebd3719498bdbb0d93ab0acdcd0d5eaf926153c72de6

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}
    modes = ['ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']
    if not isinstance(x, list) or len(x) != 2:
        return None
    tonic, mode = x
    if mode not in modes or not isinstance(tonic, str) or not tonic or tonic[0] not in base:
        return None
    signs = {'': 0, '#': 1, 'b': -1, 'x': 2, 'bb': -2}
    if tonic[1:] not in signs:
        return None
    steps = [2, 2, 1, 2, 2, 2, 1]
    k = modes.index(mode)
    steps = steps[k:] + steps[:k]
    pc = base[tonic[0]] + signs[tonic[1:]]
    li = 'CDEFGAB'.index(tonic[0])
    out = []
    for step in steps:
        letter = 'CDEFGAB'[li % 7]
        alter = pc - base[letter]
        if abs(alter) > 2:
            return None
        out.append(letter + {0: '', 1: '#', -1: 'b', 2: 'x', -2: 'bb'}[alter])
        pc += step
        li += 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['C#', 'locrian'], ['C#', 'D', 'E', 'F#', 'G', 'A', 'B']), (['Dx', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Dx', 'ionian'], None), (['D', 'major'], None), (['Abb', 'locrian'], None), (['H', 'ionian'], None)], [(['D', 'dorian'], ['D', 'E', 'F', 'G', 'A', 'B', 'C']), (['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['E', 'phrygian'], ['E', 'F', 'G', 'A', 'B', 'C', 'D']), (['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['Gb', 'lydian'], ['Gb', 'Ab', 'Bb', 'C', 'Db', 'Eb', 'F'])], [(['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['B', 'locrian'], ['B', 'C', 'D', 'E', 'F', 'G', 'A']), (['C', 'dorian'], ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab']), (['Fb', 'locrian'], ['Fb', 'Gbb', 'Abb', 'Bbb', 'Cbb', 'Dbb', 'Ebb'])]]
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 0['C', 'D', 'E', 'F', 'G', 'A', 'B']['C', 'D', 'E', 'F', 'G', 'A', 'B']Passed
oracle 1None['D', 'E', 'F', 'G', 'A', 'B', 'C']Failed
oracle 2None['G', 'A', 'B', 'C', 'D', 'E', 'F']Failed
oracle 3['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb']Passed
oracle 4['C', 'D', 'E', 'F#', 'G', 'A', 'B']['C', 'D', 'E', 'F#', 'G', 'A', 'B']Passed
oracle 5['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']Passed
oracle 6['C#', 'D', 'E', 'F#', 'G', 'A', 'B']['C#', 'D', 'E', 'F#', 'G', 'A', 'B']Passed
oracle 7NoneNonePassed

SHA-256 / 74e70e2791aeef469aa25e42af879ff8dc58e274fcb7f0732550cc0e30684aed

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

Case digest / f87f8bb2fa7d31c7559865c5ada8e44aab33abe142e7d0200e5851aa6c732508