FA-81006 / Music interval and transposition theory / Open access
Modal scale spelling from a tonic: mode pattern rotated the wrong way · case 01
D dorian is spelled with F# and C# because the step pattern is rotated right, yielding the locrian-side pattern order.
ROOT CAUSE
The major step pattern is rotated right by the mode index instead of left.
THE FAILURE
The major step pattern is rotated right by the mode index instead of left.
Unsuccessful approach: Rotating left by one extra position treats ionian as dorian, so every mode is off by one.
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] + 6) % 12 - 6
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']), (['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']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['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']), (['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'])], [(['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']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B'])], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['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', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['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']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab'])]]
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 | ['C', 'D', 'E', 'F', 'G', 'A', 'B'] | ['C', 'D', 'E', 'F', 'G', 'A', 'B'] | Passed |
| oracle 1 | ['D', 'Eb', 'F', 'G', 'Ab', 'Bb', 'C'] | ['D', 'E', 'F', 'G', 'A', 'B', 'C'] | Failed |
| oracle 2 | ['E', 'F#', 'G', 'A', 'B', 'C', 'D'] | ['E', 'F', 'G', 'A', 'B', 'C', 'D'] | Failed |
| oracle 3 | ['F', 'G', 'A', 'Bb', 'C', 'D', 'Eb'] | ['F', 'G', 'A', 'B', 'C', 'D', 'E'] | Failed |
| oracle 4 | ['G', 'A', 'B', 'C#', 'D', 'E', 'F#'] | ['G', 'A', 'B', 'C', 'D', 'E', 'F'] | Failed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 61bd5830bdaa3862e8da4b11690dea47943444df1e9c0b5ab17312fed88352dc
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 + 1:] + steps[:k + 1]
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] + 6) % 12 - 6
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']), (['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']), (['D', 'major'], None), (['H', 'ionian'], None), (['Cq', 'ionian'], None)], [(['C', 'ionian'], ['C', 'D', 'E', 'F', 'G', 'A', 'B']), (['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']), (['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'])], [(['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']), (['C', 'phrygian'], ['C', 'Db', 'Eb', 'F', 'G', 'Ab', 'Bb']), (['C', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B'])], [(['F', 'lydian'], ['F', 'G', 'A', 'B', 'C', 'D', 'E']), (['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['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', 'lydian'], ['C', 'D', 'E', 'F#', 'G', 'A', 'B']), (['C', 'locrian'], ['C', 'Db', 'Eb', 'F', 'Gb', 'Ab', 'Bb']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db'])], [(['G', 'mixolydian'], ['G', 'A', 'B', 'C', 'D', 'E', 'F']), (['A', 'aeolian'], ['A', 'B', 'C', 'D', 'E', 'F', 'G']), (['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']), (['Eb', 'aeolian'], ['Eb', 'F', 'Gb', 'Ab', 'Bb', 'Cb', 'Db']), (['F#', 'ionian'], ['F#', 'G#', 'A#', 'B', 'C#', 'D#', 'E#']), (['Bb', 'mixolydian'], ['Bb', 'C', 'D', 'Eb', 'F', 'G', 'Ab'])]]
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 | ['C', 'D', 'Eb', 'F', 'G', 'A', 'Bb'] | ['C', 'D', 'E', 'F', 'G', 'A', 'B'] | Failed |
| oracle 1 | ['D', 'Eb', 'F', 'G', 'A', 'Bb', 'C'] | ['D', 'E', 'F', 'G', 'A', 'B', 'C'] | Failed |
| oracle 2 | ['E', 'F#', 'G#', 'A#', 'B', 'C#', 'D#'] | ['E', 'F', 'G', 'A', 'B', 'C', 'D'] | Failed |
| oracle 3 | ['F', 'G', 'A', 'Bb', 'C', 'D', 'Eb'] | ['F', 'G', 'A', 'B', 'C', 'D', 'E'] | Failed |
| oracle 4 | ['G', 'A', 'Bb', 'C', 'D', 'Eb', 'F'] | ['G', 'A', 'B', 'C', 'D', 'E', 'F'] | Failed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 875af2989737072ed504e4971bee2f3fcf5b3aa6608b78990f1bbbd41097eb55
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.208430+00:00.
Case digest / 75d56261162bd9280a672afbf04d194ef3ab76d8ee0dc116279c03f165ef876d