FA-81091 / Music interval and transposition theory / Open access
Five-limit just ratio for a semitone interval: octave factor multiplied instead of exponentiated · case 01
Every interval smaller than an octave returns 0/1 and a twelfth returns 3/1 only by coincidence.
ROOT CAUSE
The octave multiplier is written as 2 * octaves instead of 2 to the power of octaves.
VERIFIED REPAIR
Restore the octave factor step so that it reads `2 ** (n // 12)`.
Unsuccessful approach: Moving the parenthesis applies integer division to 2**n, which is zero for small intervals.
Case contract
Input an integer semitone count (negative = descending). Ascending ratios use the table 1/1 16/15 9/8 6/5 5/4 4/3 45/32 3/2 8/5 5/3 9/5 15/8 per pitch class, times 2 per octave. A descending interval is the reciprocal of the ascending one of the same size. Return "p/q" in lowest terms (always with a denominator); non-integers and booleans return None.
Why this case matters
Tuning tables and retuning tools convert interval sizes to exact frequency ratios.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
table = ['1/1', '16/15', '9/8', '6/5', '5/4', '4/3', '45/32', '3/2', '8/5', '5/3', '9/5', '15/8']
if not isinstance(x, int) or isinstance(x, bool):
return None
n = abs(x)
r = Fraction(table[n % 12]) * 2 * (n // 12)
if x < 0:
r = 1 / r
return str(r.numerator) + '/' + str(r.denominator)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (True, None), ('3', None), (2.0, None), (None, None)], [(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (None, None)], [(2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3')], [(3, '6/5'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8')], [(4, '5/4'), (5, '4/3'), (6, '45/32'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8'), (12, '2/1')]]
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 | 0/1 | 1/1 | Failed |
| oracle 1 | 0/1 | 16/15 | Failed |
| oracle 2 | 0/1 | 9/8 | Failed |
| oracle 3 | 0/1 | 6/5 | Failed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 268705bada6ff0ed091c6f4d846c7b4fadc082c96212b9a00e496fcfc9401fff
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
table = ['1/1', '16/15', '9/8', '6/5', '5/4', '4/3', '45/32', '3/2', '8/5', '5/3', '9/5', '15/8']
if not isinstance(x, int) or isinstance(x, bool):
return None
n = abs(x)
r = Fraction(table[n % 12]) * (2 ** n // 12)
if x < 0:
r = 1 / r
return str(r.numerator) + '/' + str(r.denominator)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (True, None), ('3', None), (2.0, None), (None, None)], [(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (None, None)], [(2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3')], [(3, '6/5'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8')], [(4, '5/4'), (5, '4/3'), (6, '45/32'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8'), (12, '2/1')]]
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 | 0/1 | 1/1 | Failed |
| oracle 1 | 0/1 | 16/15 | Failed |
| oracle 2 | 0/1 | 9/8 | Failed |
| oracle 3 | 0/1 | 6/5 | Failed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 67c7425fd470cab9507510b3cb1981640ac1a274cf416b0c477aad006aa59b74
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(x):
table = ['1/1', '16/15', '9/8', '6/5', '5/4', '4/3', '45/32', '3/2', '8/5', '5/3', '9/5', '15/8']
if not isinstance(x, int) or isinstance(x, bool):
return None
n = abs(x)
r = Fraction(table[n % 12]) * 2 ** (n // 12)
if x < 0:
r = 1 / r
return str(r.numerator) + '/' + str(r.denominator)
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (True, None), ('3', None), (2.0, None), (None, None)], [(0, '1/1'), (1, '16/15'), (2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (None, None)], [(2, '9/8'), (3, '6/5'), (4, '5/4'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3')], [(3, '6/5'), (5, '4/3'), (6, '45/32'), (7, '3/2'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8')], [(4, '5/4'), (5, '4/3'), (6, '45/32'), (8, '8/5'), (9, '5/3'), (10, '9/5'), (11, '15/8'), (12, '2/1')]]
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 | 1/1 | 1/1 | Passed |
| oracle 1 | 16/15 | 16/15 | Passed |
| oracle 2 | 9/8 | 9/8 | Passed |
| oracle 3 | 6/5 | 6/5 | Passed |
| oracle 4 | None | None | Passed |
| oracle 5 | None | None | Passed |
| oracle 6 | None | None | Passed |
| oracle 7 | None | None | Passed |
SHA-256 / 31a902dd1ad95983ece6ba9bc4be5f52e94797a863c2b4d540cf9937272207d0
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.893907+00:00.
Case digest / 36209210284dbbdc8510e45cf678ef511ccd351036ab1b7ee3e5eea86996881f