FA-67056 / Railway interlocking logic / Open access
Absolute block bell-code working: cancel scope · case 01
Cancelling a block with a train in it frees the section.
ROOT CAUSE
Cancel is accepted from train_on_line as well as line_clear.
VERIFIED REPAIR
Only withdraw a line_clear; a train on line needs a complete arrival.
Unsuccessful approach: Guarding the cancel with the clearing point still frees an occupied block when the clearing point is clear.
Case contract
A block section between two boxes is normal, line_clear or train_on_line. An offer is accepted (line_clear) only from normal with the clearing point clear, otherwise alarm refused. A departure without line clear raises unauthorised-departure; any departure puts the train on line. arrive_complete returns train_on_line to normal; arrive_no_tail raises tail-missing and keeps the block occupied. cancel only withdraws line_clear. cp_blocked/cp_clear set the clearing point.
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):
state = 'normal'
cp = True
alarms = []
for ev in x['events']:
if ev == 'cp_blocked':
cp = False
elif ev == 'cp_clear':
cp = True
elif ev == 'offer':
if state == 'normal' and cp:
state = 'line_clear'
else:
alarms.append('refused')
elif ev == 'depart':
if state != 'line_clear':
alarms.append('unauthorised-departure')
state = 'train_on_line'
elif ev == 'arrive_complete':
if state == 'train_on_line':
state = 'normal'
elif ev == 'arrive_no_tail':
alarms.append('tail-missing')
elif ev == 'cancel':
if state != 'normal':
state = 'normal'
return {'state': state, 'alarms': alarms}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 22', {'events': ['depart', 'cp_clear', 'offer', 'arrive_no_tail', 'cancel', 'cancel', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 1', {'events': ['cp_blocked', 'depart', 'arrive_no_tail', 'cp_clear', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure']}), ('control 4', {'events': ['cancel', 'arrive_no_tail', 'offer', 'offer', 'depart', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused', 'tail-missing']}), ('control 7', {'events': ['offer', 'arrive_no_tail', 'arrive_complete', 'cp_clear', 'cp_clear', 'arrive_no_tail']}, {'state': 'line_clear', 'alarms': ['tail-missing', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('boundary: second train into occupied block', {'events': ['offer', 'depart', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: departure without offer', {'events': ['depart', 'arrive_complete']}, {'state': 'normal', 'alarms': ['unauthorised-departure']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('control 12', {'events': ['depart', 'cp_clear', 'arrive_complete', 'depart', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'unauthorised-departure']}), ('control 15', {'events': ['arrive_complete', 'cp_clear', 'cancel']}, {'state': 'normal', 'alarms': []}), ('control 18', {'events': ['cp_clear', 'depart', 'offer', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 80', {'events': ['depart', 'offer', 'depart', 'cancel', 'cp_clear', 'arrive_no_tail', 'offer', 'cancel', 'offer', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing', 'refused', 'refused']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('control 23', {'events': ['depart', 'cp_blocked', 'arrive_no_tail', 'offer', 'cp_clear']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'refused']}), ('control 26', {'events': ['cp_clear', 'offer', 'cp_clear', 'cp_clear', 'cp_blocked', 'cp_clear', 'cp_blocked', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 29', {'events': ['arrive_complete', 'depart', 'offer', 'depart', 'arrive_complete', 'arrive_no_tail', 'cp_clear']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('control 76', {'events': ['offer', 'offer', 'cp_blocked', 'cancel', 'cp_blocked', 'cp_blocked', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('boundary: arrival report while only line clear', {'events': ['offer', 'arrive_complete', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 34', {'events': ['cp_blocked', 'arrive_no_tail', 'cancel', 'cp_clear', 'offer', 'arrive_complete', 'cp_blocked']}, {'state': 'line_clear', 'alarms': ['tail-missing']}), ('control 37', {'events': ['offer', 'depart', 'cp_clear', 'cp_clear']}, {'state': 'train_on_line', 'alarms': []}), ('control 40', {'events': ['arrive_complete', 'cp_clear', 'arrive_no_tail']}, {'state': 'normal', 'alarms': ['tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 65', {'events': ['offer', 'depart', 'arrive_complete', 'depart', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 45', {'events': ['depart', 'depart', 'depart', 'cp_blocked', 'depart', 'offer', 'arrive_complete', 'offer']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'refused', 'refused']}), ('control 48', {'events': ['cp_clear', 'cp_blocked', 'arrive_no_tail', 'depart', 'offer', 'offer', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'unauthorised-departure', 'refused', 'refused', 'tail-missing', 'refused']}), ('control 51', {'events': ['cp_clear', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused']})]]
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: cancel with train on line | {'alarms': [], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'train_on_line'} | Failed |
| sampled regression 35 | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'normal'} | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'train_on_line'} | Failed |
| sampled regression 22 | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'normal'} | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'train_on_line'} | Failed |
| boundary: offer with clearing point fouled | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| boundary: second offer while line clear | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| control 1 | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | Passed |
| control 4 | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | Passed |
| control 7 | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | Passed |
SHA-256 / 573f2bf38e13f8ac73a65712e6d95b83443e43be60f856d9d3e8d64b531994a6
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
state = 'normal'
cp = True
alarms = []
for ev in x['events']:
if ev == 'cp_blocked':
cp = False
elif ev == 'cp_clear':
cp = True
elif ev == 'offer':
if state == 'normal' and cp:
state = 'line_clear'
else:
alarms.append('refused')
elif ev == 'depart':
if state != 'line_clear':
alarms.append('unauthorised-departure')
state = 'train_on_line'
elif ev == 'arrive_complete':
if state == 'train_on_line':
state = 'normal'
elif ev == 'arrive_no_tail':
alarms.append('tail-missing')
elif ev == 'cancel':
if state != 'normal' and cp:
state = 'normal'
return {'state': state, 'alarms': alarms}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 22', {'events': ['depart', 'cp_clear', 'offer', 'arrive_no_tail', 'cancel', 'cancel', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 1', {'events': ['cp_blocked', 'depart', 'arrive_no_tail', 'cp_clear', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure']}), ('control 4', {'events': ['cancel', 'arrive_no_tail', 'offer', 'offer', 'depart', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused', 'tail-missing']}), ('control 7', {'events': ['offer', 'arrive_no_tail', 'arrive_complete', 'cp_clear', 'cp_clear', 'arrive_no_tail']}, {'state': 'line_clear', 'alarms': ['tail-missing', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('boundary: second train into occupied block', {'events': ['offer', 'depart', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: departure without offer', {'events': ['depart', 'arrive_complete']}, {'state': 'normal', 'alarms': ['unauthorised-departure']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('control 12', {'events': ['depart', 'cp_clear', 'arrive_complete', 'depart', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'unauthorised-departure']}), ('control 15', {'events': ['arrive_complete', 'cp_clear', 'cancel']}, {'state': 'normal', 'alarms': []}), ('control 18', {'events': ['cp_clear', 'depart', 'offer', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 80', {'events': ['depart', 'offer', 'depart', 'cancel', 'cp_clear', 'arrive_no_tail', 'offer', 'cancel', 'offer', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing', 'refused', 'refused']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('control 23', {'events': ['depart', 'cp_blocked', 'arrive_no_tail', 'offer', 'cp_clear']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'refused']}), ('control 26', {'events': ['cp_clear', 'offer', 'cp_clear', 'cp_clear', 'cp_blocked', 'cp_clear', 'cp_blocked', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 29', {'events': ['arrive_complete', 'depart', 'offer', 'depart', 'arrive_complete', 'arrive_no_tail', 'cp_clear']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('control 76', {'events': ['offer', 'offer', 'cp_blocked', 'cancel', 'cp_blocked', 'cp_blocked', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('boundary: arrival report while only line clear', {'events': ['offer', 'arrive_complete', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 34', {'events': ['cp_blocked', 'arrive_no_tail', 'cancel', 'cp_clear', 'offer', 'arrive_complete', 'cp_blocked']}, {'state': 'line_clear', 'alarms': ['tail-missing']}), ('control 37', {'events': ['offer', 'depart', 'cp_clear', 'cp_clear']}, {'state': 'train_on_line', 'alarms': []}), ('control 40', {'events': ['arrive_complete', 'cp_clear', 'arrive_no_tail']}, {'state': 'normal', 'alarms': ['tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 65', {'events': ['offer', 'depart', 'arrive_complete', 'depart', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 45', {'events': ['depart', 'depart', 'depart', 'cp_blocked', 'depart', 'offer', 'arrive_complete', 'offer']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'refused', 'refused']}), ('control 48', {'events': ['cp_clear', 'cp_blocked', 'arrive_no_tail', 'depart', 'offer', 'offer', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'unauthorised-departure', 'refused', 'refused', 'tail-missing', 'refused']}), ('control 51', {'events': ['cp_clear', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused']})]]
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: cancel with train on line | {'alarms': [], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'train_on_line'} | Failed |
| sampled regression 35 | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'normal'} | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'train_on_line'} | Failed |
| sampled regression 22 | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'normal'} | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'train_on_line'} | Failed |
| boundary: offer with clearing point fouled | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| boundary: second offer while line clear | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| control 1 | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | Passed |
| control 4 | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | Passed |
| control 7 | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | Passed |
SHA-256 / c10a576c79b8845bde12134c281723c848c2a57fe78fc21df7aaa6ebbc200b10
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
state = 'normal'
cp = True
alarms = []
for ev in x['events']:
if ev == 'cp_blocked':
cp = False
elif ev == 'cp_clear':
cp = True
elif ev == 'offer':
if state == 'normal' and cp:
state = 'line_clear'
else:
alarms.append('refused')
elif ev == 'depart':
if state != 'line_clear':
alarms.append('unauthorised-departure')
state = 'train_on_line'
elif ev == 'arrive_complete':
if state == 'train_on_line':
state = 'normal'
elif ev == 'arrive_no_tail':
alarms.append('tail-missing')
elif ev == 'cancel':
if state == 'line_clear':
state = 'normal'
return {'state': state, 'alarms': alarms}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 22', {'events': ['depart', 'cp_clear', 'offer', 'arrive_no_tail', 'cancel', 'cancel', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 1', {'events': ['cp_blocked', 'depart', 'arrive_no_tail', 'cp_clear', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure']}), ('control 4', {'events': ['cancel', 'arrive_no_tail', 'offer', 'offer', 'depart', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused', 'tail-missing']}), ('control 7', {'events': ['offer', 'arrive_no_tail', 'arrive_complete', 'cp_clear', 'cp_clear', 'arrive_no_tail']}, {'state': 'line_clear', 'alarms': ['tail-missing', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('boundary: second train into occupied block', {'events': ['offer', 'depart', 'depart']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: departure without offer', {'events': ['depart', 'arrive_complete']}, {'state': 'normal', 'alarms': ['unauthorised-departure']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('control 12', {'events': ['depart', 'cp_clear', 'arrive_complete', 'depart', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'unauthorised-departure']}), ('control 15', {'events': ['arrive_complete', 'cp_clear', 'cancel']}, {'state': 'normal', 'alarms': []}), ('control 18', {'events': ['cp_clear', 'depart', 'offer', 'cp_blocked']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 80', {'events': ['depart', 'offer', 'depart', 'cancel', 'cp_clear', 'arrive_no_tail', 'offer', 'cancel', 'offer', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing', 'refused', 'refused']}), ('boundary: train arrives without tail lamp', {'events': ['offer', 'depart', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('control 23', {'events': ['depart', 'cp_blocked', 'arrive_no_tail', 'offer', 'cp_clear']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing', 'refused']}), ('control 26', {'events': ['cp_clear', 'offer', 'cp_clear', 'cp_clear', 'cp_blocked', 'cp_clear', 'cp_blocked', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 29', {'events': ['arrive_complete', 'depart', 'offer', 'depart', 'arrive_complete', 'arrive_no_tail', 'cp_clear']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'refused', 'unauthorised-departure', 'tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('control 76', {'events': ['offer', 'offer', 'cp_blocked', 'cancel', 'cp_blocked', 'cp_blocked', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused', 'refused']}), ('boundary: cancel of line clear', {'events': ['offer', 'cancel', 'offer']}, {'state': 'line_clear', 'alarms': []}), ('boundary: arrival report while only line clear', {'events': ['offer', 'arrive_complete', 'depart']}, {'state': 'train_on_line', 'alarms': []}), ('control 34', {'events': ['cp_blocked', 'arrive_no_tail', 'cancel', 'cp_clear', 'offer', 'arrive_complete', 'cp_blocked']}, {'state': 'line_clear', 'alarms': ['tail-missing']}), ('control 37', {'events': ['offer', 'depart', 'cp_clear', 'cp_clear']}, {'state': 'train_on_line', 'alarms': []}), ('control 40', {'events': ['arrive_complete', 'cp_clear', 'arrive_no_tail']}, {'state': 'normal', 'alarms': ['tail-missing']})], [('regression: cancel with train on line', {'events': ['offer', 'depart', 'cancel', 'offer']}, {'state': 'train_on_line', 'alarms': ['refused']}), ('sampled regression 35', {'events': ['cp_clear', 'depart', 'cancel', 'cp_blocked', 'arrive_no_tail']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure', 'tail-missing']}), ('sampled regression 65', {'events': ['offer', 'depart', 'arrive_complete', 'depart', 'cancel']}, {'state': 'train_on_line', 'alarms': ['unauthorised-departure']}), ('boundary: offer with clearing point fouled', {'events': ['cp_blocked', 'offer', 'cp_clear', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('boundary: second offer while line clear', {'events': ['offer', 'offer']}, {'state': 'line_clear', 'alarms': ['refused']}), ('control 45', {'events': ['depart', 'depart', 'depart', 'cp_blocked', 'depart', 'offer', 'arrive_complete', 'offer']}, {'state': 'normal', 'alarms': ['unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'unauthorised-departure', 'refused', 'refused']}), ('control 48', {'events': ['cp_clear', 'cp_blocked', 'arrive_no_tail', 'depart', 'offer', 'offer', 'arrive_no_tail', 'offer']}, {'state': 'train_on_line', 'alarms': ['tail-missing', 'unauthorised-departure', 'refused', 'refused', 'tail-missing', 'refused']}), ('control 51', {'events': ['cp_clear', 'cp_blocked', 'offer']}, {'state': 'normal', 'alarms': ['refused']})]]
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: cancel with train on line | {'alarms': ['refused'], 'state': 'train_on_line'} | {'alarms': ['refused'], 'state': 'train_on_line'} | Passed |
| sampled regression 35 | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'train_on_line'} | {'alarms': ['unauthorised-departure', 'tail-missing'], 'state': 'train_on_line'} | Passed |
| sampled regression 22 | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'train_on_line'} | {'alarms': ['unauthorised-departure', 'refused', 'tail-missing', 'tail-missing'], 'state': 'train_on_line'} | Passed |
| boundary: offer with clearing point fouled | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| boundary: second offer while line clear | {'alarms': ['refused'], 'state': 'line_clear'} | {'alarms': ['refused'], 'state': 'line_clear'} | Passed |
| control 1 | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | {'alarms': ['unauthorised-departure', 'tail-missing', 'unauthorised-departure'], 'state': 'train_on_line'} | Passed |
| control 4 | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | {'alarms': ['tail-missing', 'refused', 'tail-missing'], 'state': 'train_on_line'} | Passed |
| control 7 | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | {'alarms': ['tail-missing', 'tail-missing'], 'state': 'line_clear'} | Passed |
SHA-256 / 3269c6d13b628184104ba4e317c74f6f88864c89f4d289e81dac08b428688af1
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:49.397628+00:00.
Case digest / 098800ab959a45689e7b41a3c8f1e422c5ba560719467c4c86bb66598dc2d7e0