FA-81736 / MIDI event timing / Open access
Same-pitch and monophonic overlap truncation: zero-length notes kept · case 01
A note truncated to nothing (or given with start equal to end) is still emitted with zero duration.
ROOT CAUSE
The survivor test keeps notes whose end equals their start.
VERIFIED REPAIR
Restore the zero length removal step so that it reads `if e > s:`.
Unsuccessful approach: Requiring more than one tick also discards legitimate one-tick notes.
Case contract
Input [notes, mode] where notes are [start, end, pitch] in any order and mode is poly or mono. Sort by start then pitch. Each note ends no later than the start of the next note that starts strictly later and has the same pitch (poly) or any pitch (mono). Notes whose length becomes zero or negative are removed. Return the notes in sorted order; unknown mode returns None.
Why this case matters
MIDI sequencers, file readers and synth drivers depend on exact event ordering and tick/time arithmetic.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 2:
return None
notes, mode = x
if mode not in ('poly', 'mono'):
return None
order = sorted(notes, key=lambda n: (n[0], n[2]))
out = []
for i, (s, e, p) in enumerate(order):
for s2, e2, p2 in order[i + 1:]:
if s2 > s and (mode == 'mono' or p2 == p):
e = min(e, s2)
break
if e >= s:
out.append([s, e, p])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]])], [([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[0, 10, 60], [10, 20, 60]], 'poly'], [[0, 10, 60], [10, 20, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])], [([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[0, 10, 62], [4, 6, 60]], 'mono'], [[0, 4, 62], [4, 6, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])]]
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, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 1 | [[0, 10, 60], [5, 15, 62]] | [[0, 10, 60], [5, 15, 62]] | Passed |
| oracle 2 | [[0, 5, 60], [5, 15, 62]] | [[0, 5, 60], [5, 15, 62]] | Passed |
| oracle 3 | [[0, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 4 | [[0, 2, 60], [2, 3, 60]] | [[0, 2, 60], [2, 3, 60]] | Passed |
| oracle 5 | [[0, 10, 60], [0, 10, 64]] | [[0, 10, 60], [0, 10, 64]] | Passed |
| oracle 6 | [[3, 3, 60]] | [] | Failed |
| oracle 7 | [[0, 1, 60], [1, 3, 60], [3, 5, 60]] | [[0, 1, 60], [1, 3, 60], [3, 5, 60]] | Passed |
SHA-256 / 17f7bad9f39373728bff7e13672e33863d9e7c243c7cc64cedf0ba8337d5cc50
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 2:
return None
notes, mode = x
if mode not in ('poly', 'mono'):
return None
order = sorted(notes, key=lambda n: (n[0], n[2]))
out = []
for i, (s, e, p) in enumerate(order):
for s2, e2, p2 in order[i + 1:]:
if s2 > s and (mode == 'mono' or p2 == p):
e = min(e, s2)
break
if e > s + 1:
out.append([s, e, p])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]])], [([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[0, 10, 60], [10, 20, 60]], 'poly'], [[0, 10, 60], [10, 20, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])], [([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[0, 10, 62], [4, 6, 60]], 'mono'], [[0, 4, 62], [4, 6, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])]]
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, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 1 | [[0, 10, 60], [5, 15, 62]] | [[0, 10, 60], [5, 15, 62]] | Passed |
| oracle 2 | [[0, 5, 60], [5, 15, 62]] | [[0, 5, 60], [5, 15, 62]] | Passed |
| oracle 3 | [[0, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 4 | [[0, 2, 60]] | [[0, 2, 60], [2, 3, 60]] | Failed |
| oracle 5 | [[0, 10, 60], [0, 10, 64]] | [[0, 10, 60], [0, 10, 64]] | Passed |
| oracle 6 | [] | [] | Passed |
| oracle 7 | [[1, 3, 60], [3, 5, 60]] | [[0, 1, 60], [1, 3, 60], [3, 5, 60]] | Failed |
SHA-256 / 3ebfe4ea8c8ffbf01fe2b6130e87d3de97d587983d0057b881677e122e989a2a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
if not isinstance(x, list) or len(x) != 2:
return None
notes, mode = x
if mode not in ('poly', 'mono'):
return None
order = sorted(notes, key=lambda n: (n[0], n[2]))
out = []
for i, (s, e, p) in enumerate(order):
for s2, e2, p2 in order[i + 1:]:
if s2 > s and (mode == 'mono' or p2 == p):
e = min(e, s2)
break
if e > s:
out.append([s, e, p])
return out
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]])], [([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [0, 10, 64]], 'mono'], [[0, 10, 60], [0, 10, 64]]), ([[[0, 10, 60], [10, 20, 60]], 'poly'], [[0, 10, 60], [10, 20, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])], [([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 10, 60]], 'legato'], None), ([[[0, 20, 60], [2, 4, 62], [6, 8, 64]], 'mono'], [[0, 2, 60], [2, 4, 62], [6, 8, 64]]), ([[[0, 10, 62], [4, 6, 60]], 'mono'], [[0, 4, 62], [4, 6, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 4, 60], [2, 3, 60]], 'poly'], [[0, 2, 60], [2, 3, 60]]), ([[[0, 5, 60], [5, 6, 62]], 'mono'], [[0, 5, 60], [5, 6, 62]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]]), ([[[0, 9, 70], [1, 5, 72], [2, 4, 70]], 'poly'], [[0, 2, 70], [1, 5, 72], [2, 4, 70]])], [([[[0, 10, 60], [5, 15, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 10, 60], [5, 15, 62]], 'poly'], [[0, 10, 60], [5, 15, 62]]), ([[[0, 10, 60], [5, 15, 62]], 'mono'], [[0, 5, 60], [5, 15, 62]]), ([[[5, 15, 60], [0, 10, 60]], 'poly'], [[0, 5, 60], [5, 15, 60]]), ([[[0, 1, 60], [0, 8, 60], [1, 9, 60]], 'poly'], [[0, 1, 60], [0, 1, 60], [1, 9, 60]]), ([[[3, 3, 60]], 'poly'], []), ([[[0, 2, 60], [1, 9, 60], [3, 5, 60]], 'poly'], [[0, 1, 60], [1, 3, 60], [3, 5, 60]]), ([[[1, 2, 60], [2, 3, 60], [3, 4, 60]], 'poly'], [[1, 2, 60], [2, 3, 60], [3, 4, 60]])]]
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, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 1 | [[0, 10, 60], [5, 15, 62]] | [[0, 10, 60], [5, 15, 62]] | Passed |
| oracle 2 | [[0, 5, 60], [5, 15, 62]] | [[0, 5, 60], [5, 15, 62]] | Passed |
| oracle 3 | [[0, 5, 60], [5, 15, 60]] | [[0, 5, 60], [5, 15, 60]] | Passed |
| oracle 4 | [[0, 2, 60], [2, 3, 60]] | [[0, 2, 60], [2, 3, 60]] | Passed |
| oracle 5 | [[0, 10, 60], [0, 10, 64]] | [[0, 10, 60], [0, 10, 64]] | Passed |
| oracle 6 | [] | [] | Passed |
| oracle 7 | [[0, 1, 60], [1, 3, 60], [3, 5, 60]] | [[0, 1, 60], [1, 3, 60], [3, 5, 60]] | Passed |
SHA-256 / 7f96ee326ad416c86a9ce7d2b1d1bccb9c3bcfc857972b9f58ba34740db07e5f
Verification & scope
A deterministic bounded teaching model with a stipulated toy contract; it is not a complete Standard MIDI File or MIDI 1.0/2.0 implementation. 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:05.716336+00:00.
Case digest / b5b0742a19c0cdebc69bc619961d0cf627f33b3aca613e3efbcc1fa0a6237c2a