FA-67926 / Traffic signal timing plans / Open access
Yellow and all-red intervals: the far crosswalk is added when no pedestrians are present · case 01
Yellow and all-red intervals returns a wrong result when the far crosswalk is added when no pedestrians are present.
ROOT CAUSE
The pedestrian flag is inverted, so the clearance distance includes the crosswalk exactly when it should not.
VERIFIED REPAIR
Restore the far crosswalk width rule so that the step reads `(x['crosswalk_ft'] if x['ped'] else 0)`.
Unsuccessful approach: Adding half the crosswalk still under-clears the far crosswalk when pedestrians are present.
Case contract
Input {speed_mph, grade_pct (uphill positive), reaction_tenths, decel ft/s^2, width_ft, veh_len_ft, crosswalk_ft, ped}. v = 1.467*speed ft/s; yellow = t + v/(2a + 2*32.2*grade/100), rounded UP to 0.1 s and clamped to [3.0, 6.0]; a non-positive denominator returns 'invalid'. All-red = (W + vehicle length)/v where W includes the far crosswalk when ped is true, rounded UP to 0.1 s and clamped to [1.0, 6.0]. Return tenths.
Why this case matters
Signal timing arithmetic is exact and integer or rational; a wrong rule silently produces unsafe or inefficient timing plans.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
v = Fraction(x['speed_mph']) * Fraction(1467, 1000)
t = Fraction(x['reaction_tenths'], 10)
den = 2 * x['decel'] + 2 * Fraction(322, 10) * Fraction(x['grade_pct'], 100)
if den <= 0:
return 'invalid'
yl = max(30, min(60, math.ceil((t + v / den) * 10)))
w = x['width_ft'] + (x['crosswalk_ft'] if not x['ped'] else 0)
rd = max(10, min(60, math.ceil((w + x['veh_len_ft']) / v * 10)))
return {'yellow_tenths': yl, 'red_tenths': rd}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 55, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 93, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 44, 'red_tenths': 16}), ({'speed_mph': 65, 'grade_pct': 3, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 61, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 45, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': 4, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 62, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 49, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 50, 'grade_pct': 0, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 40, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 45, 'red_tenths': 17}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 41, 'veh_len_ft': 16, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 53, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': 3, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 57, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 54, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19})], [({'speed_mph': 30, 'grade_pct': 5, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 30, 'red_tenths': 20}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 60, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -6, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 55, 'veh_len_ft': 25, 'crosswalk_ft': 15, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 56, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 47, 'red_tenths': 10}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 44, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 54, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16})], [({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 8, 'width_ft': 124, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 50, 'grade_pct': 6, 'reaction_tenths': 12, 'decel': 11, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 41, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 20, 'grade_pct': -2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 114, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 31, 'red_tenths': 51}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 20, 'grade_pct': 6, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 135, 'veh_len_ft': 40, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 30, 'red_tenths': 60}), ({'speed_mph': 60, 'grade_pct': -4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': 6, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 80, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 43, 'red_tenths': 12}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 12, 'width_ft': 69, 'veh_len_ft': 16, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 66, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 35, 'red_tenths': 23}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 70, 'grade_pct': 6, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 46, 'veh_len_ft': 16, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 59, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 48, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing 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 |
|---|---|---|---|
| timing oracle 0 | {'red_tenths': 16, 'yellow_tenths': 48} | {'red_tenths': 17, 'yellow_tenths': 48} | Failed |
| timing oracle 1 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 2 | {'red_tenths': 15, 'yellow_tenths': 44} | {'red_tenths': 16, 'yellow_tenths': 44} | Failed |
| timing oracle 3 | {'red_tenths': 10, 'yellow_tenths': 45} | {'red_tenths': 10, 'yellow_tenths': 45} | Passed |
| timing oracle 4 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 5 | {'red_tenths': 15, 'yellow_tenths': 60} | {'red_tenths': 16, 'yellow_tenths': 60} | Failed |
| timing oracle 6 | {'red_tenths': 21, 'yellow_tenths': 33} | {'red_tenths': 19, 'yellow_tenths': 33} | Failed |
| timing oracle 7 | {'red_tenths': 10, 'yellow_tenths': 49} | {'red_tenths': 10, 'yellow_tenths': 49} | Passed |
SHA-256 / c7627ebd452c129268bc0d65589cb5e26e7a6179c68c51e2d1fa5602fa2ef16e
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
v = Fraction(x['speed_mph']) * Fraction(1467, 1000)
t = Fraction(x['reaction_tenths'], 10)
den = 2 * x['decel'] + 2 * Fraction(322, 10) * Fraction(x['grade_pct'], 100)
if den <= 0:
return 'invalid'
yl = max(30, min(60, math.ceil((t + v / den) * 10)))
w = x['width_ft'] + (x['crosswalk_ft'] // 2 if x['ped'] else 0)
rd = max(10, min(60, math.ceil((w + x['veh_len_ft']) / v * 10)))
return {'yellow_tenths': yl, 'red_tenths': rd}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 55, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 93, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 44, 'red_tenths': 16}), ({'speed_mph': 65, 'grade_pct': 3, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 61, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 45, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': 4, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 62, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 49, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 50, 'grade_pct': 0, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 40, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 45, 'red_tenths': 17}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 41, 'veh_len_ft': 16, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 53, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': 3, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 57, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 54, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19})], [({'speed_mph': 30, 'grade_pct': 5, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 30, 'red_tenths': 20}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 60, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -6, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 55, 'veh_len_ft': 25, 'crosswalk_ft': 15, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 56, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 47, 'red_tenths': 10}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 44, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 54, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16})], [({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 8, 'width_ft': 124, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 50, 'grade_pct': 6, 'reaction_tenths': 12, 'decel': 11, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 41, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 20, 'grade_pct': -2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 114, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 31, 'red_tenths': 51}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 20, 'grade_pct': 6, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 135, 'veh_len_ft': 40, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 30, 'red_tenths': 60}), ({'speed_mph': 60, 'grade_pct': -4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': 6, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 80, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 43, 'red_tenths': 12}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 12, 'width_ft': 69, 'veh_len_ft': 16, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 66, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 35, 'red_tenths': 23}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 70, 'grade_pct': 6, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 46, 'veh_len_ft': 16, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 59, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 48, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing 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 |
|---|---|---|---|
| timing oracle 0 | {'red_tenths': 16, 'yellow_tenths': 48} | {'red_tenths': 17, 'yellow_tenths': 48} | Failed |
| timing oracle 1 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 2 | {'red_tenths': 15, 'yellow_tenths': 44} | {'red_tenths': 16, 'yellow_tenths': 44} | Failed |
| timing oracle 3 | {'red_tenths': 10, 'yellow_tenths': 45} | {'red_tenths': 10, 'yellow_tenths': 45} | Passed |
| timing oracle 4 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 5 | {'red_tenths': 16, 'yellow_tenths': 60} | {'red_tenths': 16, 'yellow_tenths': 60} | Passed |
| timing oracle 6 | {'red_tenths': 19, 'yellow_tenths': 33} | {'red_tenths': 19, 'yellow_tenths': 33} | Passed |
| timing oracle 7 | {'red_tenths': 10, 'yellow_tenths': 49} | {'red_tenths': 10, 'yellow_tenths': 49} | Passed |
SHA-256 / b18f00a545cd738a85ee9f088dddfd1c30bff177130a757f3aea3f4ff158ccc7
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(x):
v = Fraction(x['speed_mph']) * Fraction(1467, 1000)
t = Fraction(x['reaction_tenths'], 10)
den = 2 * x['decel'] + 2 * Fraction(322, 10) * Fraction(x['grade_pct'], 100)
if den <= 0:
return 'invalid'
yl = max(30, min(60, math.ceil((t + v / den) * 10)))
w = x['width_ft'] + (x['crosswalk_ft'] if x['ped'] else 0)
rd = max(10, min(60, math.ceil((w + x['veh_len_ft']) / v * 10)))
return {'yellow_tenths': yl, 'red_tenths': rd}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 55, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 93, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 44, 'red_tenths': 16}), ({'speed_mph': 65, 'grade_pct': 3, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 61, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 45, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': 4, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 62, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 49, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 50, 'grade_pct': 0, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 70, 'veh_len_ft': 40, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 45, 'red_tenths': 17}), ({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 41, 'veh_len_ft': 16, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 53, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': 3, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 57, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 54, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19})], [({'speed_mph': 30, 'grade_pct': 5, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 47, 'veh_len_ft': 25, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 30, 'red_tenths': 20}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 60, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -6, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 55, 'veh_len_ft': 25, 'crosswalk_ft': 15, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': 7, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 56, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': False}, {'yellow_tenths': 47, 'red_tenths': 10}), ({'speed_mph': 70, 'grade_pct': 4, 'reaction_tenths': 8, 'decel': 10, 'width_ft': 44, 'veh_len_ft': 20, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 54, 'red_tenths': 10}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16})], [({'speed_mph': 65, 'grade_pct': 2, 'reaction_tenths': 8, 'decel': 8, 'width_ft': 124, 'veh_len_ft': 20, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 50, 'grade_pct': 6, 'reaction_tenths': 12, 'decel': 11, 'width_ft': 40, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 41, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 20, 'grade_pct': -2, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 114, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': True}, {'yellow_tenths': 31, 'red_tenths': 51}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 20, 'grade_pct': 6, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 135, 'veh_len_ft': 40, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 30, 'red_tenths': 60}), ({'speed_mph': 60, 'grade_pct': -4, 'reaction_tenths': 12, 'decel': 10, 'width_ft': 57, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})], [({'speed_mph': 65, 'grade_pct': 6, 'reaction_tenths': 8, 'decel': 12, 'width_ft': 80, 'veh_len_ft': 25, 'crosswalk_ft': 8, 'ped': False}, {'yellow_tenths': 43, 'red_tenths': 12}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 12, 'width_ft': 69, 'veh_len_ft': 16, 'crosswalk_ft': 15, 'ped': True}, {'yellow_tenths': 58, 'red_tenths': 10}), ({'speed_mph': 30, 'grade_pct': -6, 'reaction_tenths': 10, 'decel': 11, 'width_ft': 66, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 35, 'red_tenths': 23}), ({'speed_mph': 65, 'grade_pct': -7, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 120, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 16}), ({'speed_mph': 30, 'grade_pct': 0, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 60, 'veh_len_ft': 20, 'crosswalk_ft': 12, 'ped': False}, {'yellow_tenths': 33, 'red_tenths': 19}), ({'speed_mph': 70, 'grade_pct': 6, 'reaction_tenths': 15, 'decel': 10, 'width_ft': 46, 'veh_len_ft': 16, 'crosswalk_ft': 12, 'ped': True}, {'yellow_tenths': 59, 'red_tenths': 10}), ({'speed_mph': 45, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 10, 'width_ft': 80, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 48, 'red_tenths': 17}), ({'speed_mph': 70, 'grade_pct': -4, 'reaction_tenths': 10, 'decel': 8, 'width_ft': 48, 'veh_len_ft': 20, 'crosswalk_ft': 10, 'ped': True}, {'yellow_tenths': 60, 'red_tenths': 10})]]
for i, (args, expected) in enumerate(fixtures[N-1]):
check('timing 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 |
|---|---|---|---|
| timing oracle 0 | {'red_tenths': 17, 'yellow_tenths': 48} | {'red_tenths': 17, 'yellow_tenths': 48} | Passed |
| timing oracle 1 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 2 | {'red_tenths': 16, 'yellow_tenths': 44} | {'red_tenths': 16, 'yellow_tenths': 44} | Passed |
| timing oracle 3 | {'red_tenths': 10, 'yellow_tenths': 45} | {'red_tenths': 10, 'yellow_tenths': 45} | Passed |
| timing oracle 4 | {'red_tenths': 10, 'yellow_tenths': 60} | {'red_tenths': 10, 'yellow_tenths': 60} | Passed |
| timing oracle 5 | {'red_tenths': 16, 'yellow_tenths': 60} | {'red_tenths': 16, 'yellow_tenths': 60} | Passed |
| timing oracle 6 | {'red_tenths': 19, 'yellow_tenths': 33} | {'red_tenths': 19, 'yellow_tenths': 33} | Passed |
| timing oracle 7 | {'red_tenths': 10, 'yellow_tenths': 49} | {'red_tenths': 10, 'yellow_tenths': 49} | Passed |
SHA-256 / 12db4543688c47c8526f0df77a2b79f06315521bbe0d76bac3bfd29483a94b2a
Verification & scope
A deterministic, bounded toy model with a stipulated contract; it makes no claim of conformance to any agency manual or standard. 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:57.413865+00:00.
Case digest / 589113fa93df5ef2cb8dd3c83190fb29f48d561ff43802ac4dd848e01929a4ff