FA-67146 / Railway interlocking logic / Open access
Train describer berth stepping: clash detection · case 01
Overwriting a description in an occupied berth goes unreported.
ROOT CAUSE
The destination berth is overwritten without recording a clash.
THE FAILURE
The destination berth is overwritten without recording a clash.
Unsuccessful approach: Ignoring equal headcodes misses two distinct trains carrying the same headcode.
Case contract
A train describer has berths 0..n-1. interpose writes a headcode, cancel blanks a berth. step i moves the description from berth i to i+1 (or out of the area from the last berth, recorded in exited); stepping an empty berth carries the unknown description ????. Stepping onto a filled berth records a clash at the destination and the stepped description overwrites it. The source berth is always blanked.
Why this case matters
Interlocking logic decides whether trains may be given authority; a wrong decision at this point either grants unsafe movements or strands traffic.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
n = x['berths']
b = [None] * n
clashes = []
exited = []
for ev in x['events']:
kind = ev[0]
if kind == 'interpose':
b[ev[1]] = ev[2]
elif kind == 'cancel':
b[ev[1]] = None
elif kind == 'step':
i = ev[1]
tid = b[i] if b[i] is not None else '????'
b[i] = None
if i == n - 1:
exited.append(tid)
else:
b[i + 1] = tid
return {'berths': b, 'clashes': clashes, 'exited': exited}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 6', {'berths': 4, 'events': [['interpose', 1, '1A01'], ['step', 2], ['interpose', 1, '9Z10'], ['interpose', 1, '1A01'], ['step', 0], ['interpose', 3, '9Z10'], ['step', 1], ['step', 2], ['interpose', 1, '1A01']]}, {'berths': [None, '1A01', None, '????'], 'clashes': [1, 3], 'exited': []}), ('sampled regression 2', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['interpose', 1, '9Z10'], ['step', 1], ['interpose', 1, '2B17'], ['interpose', 2, '9Z10'], ['interpose', 2, '5X99']]}, {'berths': [None, '2B17', '5X99'], 'clashes': [2], 'exited': []}), ('boundary: step from an empty berth', {'berths': 3, 'events': [['step', 0]]}, {'berths': [None, '????', None], 'clashes': [], 'exited': []}), ('control 1', {'berths': 5, 'events': [['cancel', 1], ['step', 3], ['step', 4], ['step', 1], ['interpose', 1, '1A01'], ['cancel', 2], ['interpose', 0, '2B17'], ['step', 4]]}, {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']}), ('control 4', {'berths': 4, 'events': [['step', 1], ['cancel', 0], ['step', 0]]}, {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []}), ('sampled regression 7', {'berths': 4, 'events': [['interpose', 3, '5X99'], ['step', 1], ['step', 1]]}, {'berths': [None, None, '????', '5X99'], 'clashes': [2], 'exited': []})], [('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 14', {'berths': 4, 'events': [['step', 0], ['interpose', 0, '1A01'], ['step', 0], ['interpose', 3, '1A01'], ['interpose', 0, '1A01'], ['interpose', 3, '9Z10'], ['interpose', 2, '2B17'], ['cancel', 0], ['step', 3]]}, {'berths': [None, '1A01', '2B17', None], 'clashes': [1], 'exited': ['9Z10']}), ('sampled regression 16', {'berths': 4, 'events': [['step', 0], ['cancel', 3], ['step', 0], ['interpose', 3, '5X99'], ['interpose', 0, '9Z10'], ['step', 3], ['interpose', 2, '5X99'], ['step', 2]]}, {'berths': ['9Z10', '????', None, '5X99'], 'clashes': [1], 'exited': ['5X99']}), ('boundary: exit from the last berth', {'berths': 3, 'events': [['interpose', 1, '2B17'], ['step', 1], ['step', 2]]}, {'berths': [None, None, None], 'clashes': [], 'exited': ['2B17']}), ('boundary: unknown train leaves the area', {'berths': 2, 'events': [['step', 1]]}, {'berths': [None, None], 'clashes': [], 'exited': ['????']}), ('sampled regression 12', {'berths': 3, 'events': [['step', 1], ['interpose', 1, '5X99'], ['cancel', 0], ['cancel', 1], ['step', 2], ['step', 0], ['step', 0]]}, {'berths': [None, '????', None], 'clashes': [1], 'exited': ['????']}), ('control 15', {'berths': 4, 'events': [['step', 0], ['interpose', 3, '5X99'], ['cancel', 2]]}, {'berths': [None, '????', None, '5X99'], 'clashes': [], 'exited': []}), ('sampled regression 18', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['cancel', 2], ['step', 0], ['step', 0], ['cancel', 1], ['step', 0], ['step', 1], ['step', 0]]}, {'berths': [None, '????', '????'], 'clashes': [1], 'exited': []})], [('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 26', {'berths': 5, 'events': [['step', 1], ['cancel', 3], ['interpose', 4, '5X99'], ['cancel', 2], ['interpose', 1, '9Z10'], ['interpose', 3, '1A01'], ['step', 3], ['step', 2], ['step', 1]]}, {'berths': [None, None, '9Z10', '????', '1A01'], 'clashes': [4], 'exited': []}), ('sampled regression 30', {'berths': 4, 'events': [['step', 0], ['step', 1], ['step', 3], ['step', 1], ['interpose', 2, '5X99'], ['interpose', 1, '5X99']]}, {'berths': [None, '5X99', '5X99', None], 'clashes': [2], 'exited': ['????']}), ('boundary: stepping from the penultimate berth', {'berths': 4, 'events': [['interpose', 2, '5X99'], ['step', 2]]}, {'berths': [None, None, None, '5X99'], 'clashes': [], 'exited': []}), ('sampled regression 23', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['step', 1], ['step', 2], ['cancel', 1], ['interpose', 0, '1A01'], ['step', 2]]}, {'berths': ['1A01', None, None], 'clashes': [2], 'exited': ['????', '????']}), ('sampled regression 29', {'berths': 5, 'events': [['interpose', 4, '1A01'], ['cancel', 4], ['step', 1], ['interpose', 1, '2B17'], ['step', 3], ['cancel', 3], ['interpose', 2, '9Z10'], ['step', 1]]}, {'berths': [None, None, '2B17', None, '????'], 'clashes': [2], 'exited': []}), ('sampled regression 32', {'berths': 3, 'events': [['step', 0], ['step', 0], ['interpose', 1, '2B17'], ['step', 1], ['interpose', 2, '5X99'], ['interpose', 1, '2B17'], ['step', 2], ['cancel', 0], ['step', 0]]}, {'berths': [None, '????', None], 'clashes': [1, 1], 'exited': ['5X99']})], [('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 34', {'berths': 3, 'events': [['step', 2], ['step', 0], ['interpose', 2, '9Z10'], ['step', 1], ['cancel', 1], ['step', 0], ['step', 2]]}, {'berths': [None, '????', None], 'clashes': [2], 'exited': ['????', '????']}), ('sampled regression 44', {'berths': 3, 'events': [['step', 1], ['step', 1], ['interpose', 1, '9Z10']]}, {'berths': [None, '9Z10', '????'], 'clashes': [2], 'exited': []}), ('boundary: stepping from the penultimate berth', {'berths': 4, 'events': [['interpose', 2, '5X99'], ['step', 2]]}, {'berths': [None, None, None, '5X99'], 'clashes': [], 'exited': []}), ('boundary: step from an empty berth', {'berths': 3, 'events': [['step', 0]]}, {'berths': [None, '????', None], 'clashes': [], 'exited': []}), ('control 37', {'berths': 4, 'events': [['step', 1], ['cancel', 1], ['step', 3], ['interpose', 0, '9Z10']]}, {'berths': ['9Z10', None, '????', None], 'clashes': [], 'exited': ['????']}), ('sampled regression 40', {'berths': 4, 'events': [['step', 3], ['step', 1], ['interpose', 3, '5X99'], ['step', 2], ['interpose', 2, '5X99'], ['step', 3], ['step', 0], ['step', 1]]}, {'berths': [None, None, '????', None], 'clashes': [3, 2], 'exited': ['????', '????']}), ('control 43', {'berths': 4, 'events': [['interpose', 2, '9Z10'], ['interpose', 3, '5X99'], ['step', 0], ['interpose', 2, '1A01']]}, {'berths': [None, '????', '1A01', '5X99'], 'clashes': [], 'exited': []})], [('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 48', {'berths': 4, 'events': [['step', 2], ['step', 2], ['step', 0], ['step', 0], ['interpose', 0, '9Z10'], ['interpose', 1, '1A01'], ['cancel', 2], ['step', 2]]}, {'berths': ['9Z10', '1A01', None, '????'], 'clashes': [3, 1, 3], 'exited': []}), ('sampled regression 55', {'berths': 3, 'events': [['interpose', 1, '1A01'], ['step', 0], ['step', 2], ['step', 2], ['step', 2], ['step', 0], ['step', 0], ['interpose', 1, '1A01']]}, {'berths': [None, '1A01', None], 'clashes': [1, 1, 1], 'exited': ['????', '????', '????']}), ('boundary: normal stepping', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['step', 0], ['step', 1]]}, {'berths': [None, None, '1A01'], 'clashes': [], 'exited': []}), ('control 45', {'berths': 3, 'events': [['interpose', 0, '9Z10'], ['interpose', 0, '5X99'], ['interpose', 0, '2B17']]}, {'berths': ['2B17', None, None], 'clashes': [], 'exited': []}), ('sampled regression 51', {'berths': 3, 'events': [['step', 2], ['step', 2], ['interpose', 1, '5X99'], ['interpose', 1, '9Z10'], ['step', 0], ['step', 0], ['interpose', 2, '9Z10'], ['step', 0], ['step', 0]]}, {'berths': [None, '????', '9Z10'], 'clashes': [1, 1, 1, 1], 'exited': ['????', '????']}), ('sampled regression 54', {'berths': 3, 'events': [['step', 2], ['step', 2], ['step', 2], ['step', 1], ['interpose', 2, '5X99'], ['step', 0], ['step', 1], ['step', 2]]}, {'berths': [None, None, None], 'clashes': [2], 'exited': ['????', '????', '????', '????']})]]
for label, args, expected in fixtures[N-1]:
check(label, 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 |
|---|---|---|---|
| regression: clash with a different train | {'berths': [None, '1A01', None], 'clashes': [], 'exited': []} | {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []} | Failed |
| regression: clash with the same headcode | {'berths': [None, '1A01', None], 'clashes': [], 'exited': []} | {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []} | Failed |
| sampled regression 6 | {'berths': [None, '1A01', None, '????'], 'clashes': [], 'exited': []} | {'berths': [None, '1A01', None, '????'], 'clashes': [1, 3], 'exited': []} | Failed |
| sampled regression 2 | {'berths': [None, '2B17', '5X99'], 'clashes': [], 'exited': []} | {'berths': [None, '2B17', '5X99'], 'clashes': [2], 'exited': []} | Failed |
| boundary: step from an empty berth | {'berths': [None, '????', None], 'clashes': [], 'exited': []} | {'berths': [None, '????', None], 'clashes': [], 'exited': []} | Passed |
| control 1 | {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']} | {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']} | Passed |
| control 4 | {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []} | {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []} | Passed |
| sampled regression 7 | {'berths': [None, None, '????', '5X99'], 'clashes': [], 'exited': []} | {'berths': [None, None, '????', '5X99'], 'clashes': [2], 'exited': []} | Failed |
SHA-256 / a1af369e4aecadac713e896790720de28918c40f37523d36d32cdc38641b7447
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
n = x['berths']
b = [None] * n
clashes = []
exited = []
for ev in x['events']:
kind = ev[0]
if kind == 'interpose':
b[ev[1]] = ev[2]
elif kind == 'cancel':
b[ev[1]] = None
elif kind == 'step':
i = ev[1]
tid = b[i] if b[i] is not None else '????'
b[i] = None
if i == n - 1:
exited.append(tid)
else:
if b[i + 1] is not None and b[i + 1] != tid:
clashes.append(i + 1)
b[i + 1] = tid
return {'berths': b, 'clashes': clashes, 'exited': exited}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 6', {'berths': 4, 'events': [['interpose', 1, '1A01'], ['step', 2], ['interpose', 1, '9Z10'], ['interpose', 1, '1A01'], ['step', 0], ['interpose', 3, '9Z10'], ['step', 1], ['step', 2], ['interpose', 1, '1A01']]}, {'berths': [None, '1A01', None, '????'], 'clashes': [1, 3], 'exited': []}), ('sampled regression 2', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['interpose', 1, '9Z10'], ['step', 1], ['interpose', 1, '2B17'], ['interpose', 2, '9Z10'], ['interpose', 2, '5X99']]}, {'berths': [None, '2B17', '5X99'], 'clashes': [2], 'exited': []}), ('boundary: step from an empty berth', {'berths': 3, 'events': [['step', 0]]}, {'berths': [None, '????', None], 'clashes': [], 'exited': []}), ('control 1', {'berths': 5, 'events': [['cancel', 1], ['step', 3], ['step', 4], ['step', 1], ['interpose', 1, '1A01'], ['cancel', 2], ['interpose', 0, '2B17'], ['step', 4]]}, {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']}), ('control 4', {'berths': 4, 'events': [['step', 1], ['cancel', 0], ['step', 0]]}, {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []}), ('sampled regression 7', {'berths': 4, 'events': [['interpose', 3, '5X99'], ['step', 1], ['step', 1]]}, {'berths': [None, None, '????', '5X99'], 'clashes': [2], 'exited': []})], [('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 14', {'berths': 4, 'events': [['step', 0], ['interpose', 0, '1A01'], ['step', 0], ['interpose', 3, '1A01'], ['interpose', 0, '1A01'], ['interpose', 3, '9Z10'], ['interpose', 2, '2B17'], ['cancel', 0], ['step', 3]]}, {'berths': [None, '1A01', '2B17', None], 'clashes': [1], 'exited': ['9Z10']}), ('sampled regression 16', {'berths': 4, 'events': [['step', 0], ['cancel', 3], ['step', 0], ['interpose', 3, '5X99'], ['interpose', 0, '9Z10'], ['step', 3], ['interpose', 2, '5X99'], ['step', 2]]}, {'berths': ['9Z10', '????', None, '5X99'], 'clashes': [1], 'exited': ['5X99']}), ('boundary: exit from the last berth', {'berths': 3, 'events': [['interpose', 1, '2B17'], ['step', 1], ['step', 2]]}, {'berths': [None, None, None], 'clashes': [], 'exited': ['2B17']}), ('boundary: unknown train leaves the area', {'berths': 2, 'events': [['step', 1]]}, {'berths': [None, None], 'clashes': [], 'exited': ['????']}), ('sampled regression 12', {'berths': 3, 'events': [['step', 1], ['interpose', 1, '5X99'], ['cancel', 0], ['cancel', 1], ['step', 2], ['step', 0], ['step', 0]]}, {'berths': [None, '????', None], 'clashes': [1], 'exited': ['????']}), ('control 15', {'berths': 4, 'events': [['step', 0], ['interpose', 3, '5X99'], ['cancel', 2]]}, {'berths': [None, '????', None, '5X99'], 'clashes': [], 'exited': []}), ('sampled regression 18', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['cancel', 2], ['step', 0], ['step', 0], ['cancel', 1], ['step', 0], ['step', 1], ['step', 0]]}, {'berths': [None, '????', '????'], 'clashes': [1], 'exited': []})], [('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 26', {'berths': 5, 'events': [['step', 1], ['cancel', 3], ['interpose', 4, '5X99'], ['cancel', 2], ['interpose', 1, '9Z10'], ['interpose', 3, '1A01'], ['step', 3], ['step', 2], ['step', 1]]}, {'berths': [None, None, '9Z10', '????', '1A01'], 'clashes': [4], 'exited': []}), ('sampled regression 30', {'berths': 4, 'events': [['step', 0], ['step', 1], ['step', 3], ['step', 1], ['interpose', 2, '5X99'], ['interpose', 1, '5X99']]}, {'berths': [None, '5X99', '5X99', None], 'clashes': [2], 'exited': ['????']}), ('boundary: stepping from the penultimate berth', {'berths': 4, 'events': [['interpose', 2, '5X99'], ['step', 2]]}, {'berths': [None, None, None, '5X99'], 'clashes': [], 'exited': []}), ('sampled regression 23', {'berths': 3, 'events': [['interpose', 2, '9Z10'], ['step', 1], ['step', 2], ['cancel', 1], ['interpose', 0, '1A01'], ['step', 2]]}, {'berths': ['1A01', None, None], 'clashes': [2], 'exited': ['????', '????']}), ('sampled regression 29', {'berths': 5, 'events': [['interpose', 4, '1A01'], ['cancel', 4], ['step', 1], ['interpose', 1, '2B17'], ['step', 3], ['cancel', 3], ['interpose', 2, '9Z10'], ['step', 1]]}, {'berths': [None, None, '2B17', None, '????'], 'clashes': [2], 'exited': []}), ('sampled regression 32', {'berths': 3, 'events': [['step', 0], ['step', 0], ['interpose', 1, '2B17'], ['step', 1], ['interpose', 2, '5X99'], ['interpose', 1, '2B17'], ['step', 2], ['cancel', 0], ['step', 0]]}, {'berths': [None, '????', None], 'clashes': [1, 1], 'exited': ['5X99']})], [('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 34', {'berths': 3, 'events': [['step', 2], ['step', 0], ['interpose', 2, '9Z10'], ['step', 1], ['cancel', 1], ['step', 0], ['step', 2]]}, {'berths': [None, '????', None], 'clashes': [2], 'exited': ['????', '????']}), ('sampled regression 44', {'berths': 3, 'events': [['step', 1], ['step', 1], ['interpose', 1, '9Z10']]}, {'berths': [None, '9Z10', '????'], 'clashes': [2], 'exited': []}), ('boundary: stepping from the penultimate berth', {'berths': 4, 'events': [['interpose', 2, '5X99'], ['step', 2]]}, {'berths': [None, None, None, '5X99'], 'clashes': [], 'exited': []}), ('boundary: step from an empty berth', {'berths': 3, 'events': [['step', 0]]}, {'berths': [None, '????', None], 'clashes': [], 'exited': []}), ('control 37', {'berths': 4, 'events': [['step', 1], ['cancel', 1], ['step', 3], ['interpose', 0, '9Z10']]}, {'berths': ['9Z10', None, '????', None], 'clashes': [], 'exited': ['????']}), ('sampled regression 40', {'berths': 4, 'events': [['step', 3], ['step', 1], ['interpose', 3, '5X99'], ['step', 2], ['interpose', 2, '5X99'], ['step', 3], ['step', 0], ['step', 1]]}, {'berths': [None, None, '????', None], 'clashes': [3, 2], 'exited': ['????', '????']}), ('control 43', {'berths': 4, 'events': [['interpose', 2, '9Z10'], ['interpose', 3, '5X99'], ['step', 0], ['interpose', 2, '1A01']]}, {'berths': [None, '????', '1A01', '5X99'], 'clashes': [], 'exited': []})], [('regression: clash with a different train', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '2B17'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('regression: clash with the same headcode', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['interpose', 1, '1A01'], ['step', 0]]}, {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []}), ('sampled regression 48', {'berths': 4, 'events': [['step', 2], ['step', 2], ['step', 0], ['step', 0], ['interpose', 0, '9Z10'], ['interpose', 1, '1A01'], ['cancel', 2], ['step', 2]]}, {'berths': ['9Z10', '1A01', None, '????'], 'clashes': [3, 1, 3], 'exited': []}), ('sampled regression 55', {'berths': 3, 'events': [['interpose', 1, '1A01'], ['step', 0], ['step', 2], ['step', 2], ['step', 2], ['step', 0], ['step', 0], ['interpose', 1, '1A01']]}, {'berths': [None, '1A01', None], 'clashes': [1, 1, 1], 'exited': ['????', '????', '????']}), ('boundary: normal stepping', {'berths': 3, 'events': [['interpose', 0, '1A01'], ['step', 0], ['step', 1]]}, {'berths': [None, None, '1A01'], 'clashes': [], 'exited': []}), ('control 45', {'berths': 3, 'events': [['interpose', 0, '9Z10'], ['interpose', 0, '5X99'], ['interpose', 0, '2B17']]}, {'berths': ['2B17', None, None], 'clashes': [], 'exited': []}), ('sampled regression 51', {'berths': 3, 'events': [['step', 2], ['step', 2], ['interpose', 1, '5X99'], ['interpose', 1, '9Z10'], ['step', 0], ['step', 0], ['interpose', 2, '9Z10'], ['step', 0], ['step', 0]]}, {'berths': [None, '????', '9Z10'], 'clashes': [1, 1, 1, 1], 'exited': ['????', '????']}), ('sampled regression 54', {'berths': 3, 'events': [['step', 2], ['step', 2], ['step', 2], ['step', 1], ['interpose', 2, '5X99'], ['step', 0], ['step', 1], ['step', 2]]}, {'berths': [None, None, None], 'clashes': [2], 'exited': ['????', '????', '????', '????']})]]
for label, args, expected in fixtures[N-1]:
check(label, 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 |
|---|---|---|---|
| regression: clash with a different train | {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []} | {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []} | Passed |
| regression: clash with the same headcode | {'berths': [None, '1A01', None], 'clashes': [], 'exited': []} | {'berths': [None, '1A01', None], 'clashes': [1], 'exited': []} | Failed |
| sampled regression 6 | {'berths': [None, '1A01', None, '????'], 'clashes': [1, 3], 'exited': []} | {'berths': [None, '1A01', None, '????'], 'clashes': [1, 3], 'exited': []} | Passed |
| sampled regression 2 | {'berths': [None, '2B17', '5X99'], 'clashes': [], 'exited': []} | {'berths': [None, '2B17', '5X99'], 'clashes': [2], 'exited': []} | Failed |
| boundary: step from an empty berth | {'berths': [None, '????', None], 'clashes': [], 'exited': []} | {'berths': [None, '????', None], 'clashes': [], 'exited': []} | Passed |
| control 1 | {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']} | {'berths': ['2B17', '1A01', None, None, None], 'clashes': [], 'exited': ['????', '????']} | Passed |
| control 4 | {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []} | {'berths': [None, '????', '????', None], 'clashes': [], 'exited': []} | Passed |
| sampled regression 7 | {'berths': [None, None, '????', '5X99'], 'clashes': [], 'exited': []} | {'berths': [None, None, '????', '5X99'], 'clashes': [2], 'exited': []} | Failed |
SHA-256 / addf0138164b161e44cca92a2b69ec6b07c543cb9b7c627c43277a623fde679a
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
Stipulated toy interlocking contract for a bounded teaching model; it makes no claim of conformance to any railway signalling standard and omits real safety cases. 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:47:50.074266+00:00.
Case digest / 30e95bde422ff087802168c701ed5394c25eef42eb03cdfaa9b30103b94b676c