FA-68331 / Traffic signal timing plans / Open access
Overlap phase indication: parents in red clearance are not treated as terminating · case 01
Overlap phase indication returns a wrong result when parents in red clearance are not treated as terminating.
ROOT CAUSE
A parent in red clearance drops the overlap to red even when the next phase is another parent.
VERIFIED REPAIR
Restore the terminating parent states rule so that the step reads `cur.get(p) in ('Y', 'RC')`.
Unsuccessful approach: Accepting steady red as terminating revives overlaps for parents that are not timing.
Case contract
Input {parents, not_during, state: [[phase, G|Y|RC|R]] for timing phases, next: phases to be served next}. The overlap is red while any not_during phase is green. Otherwise it is green while any parent is green. If a parent is terminating (Y or RC) the overlap stays green when any next phase is a parent; otherwise it is yellow if any terminating parent is in yellow, else red. Otherwise red.
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
N = 1
observations = []
def solve(x):
par = set(x['parents'])
nd = set(x['not_during'])
cur = {ph: iv for ph, iv in x['state']}
if any(cur.get(p) == 'G' for p in nd):
return 'R'
if any(cur.get(p) == 'G' for p in par):
return 'G'
terminating = [p for p in sorted(par) if cur.get(p) == 'Y']
if terminating:
if any(p in par for p in x['next']):
return 'G'
if any(cur[p] == 'Y' for p in terminating):
return 'Y'
return 'R'
return 'R'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'parents': [3, 4, 8], 'not_during': [2, 6], 'state': [[4, 'R'], [5, 'RC']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [1, 2, 4], 'not_during': [], 'state': [[8, 'G'], [4, 'RC']], 'next': [2, 7]}, 'G'), ({'parents': [4, 7], 'not_during': [2, 3], 'state': [[7, 'R'], [2, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [3, 4, 5], 'not_during': [2, 7], 'state': [[8, 'RC'], [3, 'RC'], [6, 'RC']], 'next': [5]}, 'G'), ({'parents': [5, 6], 'not_during': [7], 'state': [[3, 'G'], [6, 'R']], 'next': [4, 6]}, 'R')], [({'parents': [1, 4], 'not_during': [8], 'state': [[3, 'Y'], [5, 'G']], 'next': []}, 'R'), ({'parents': [3, 4, 8], 'not_during': [5], 'state': [[1, 'G'], [4, 'RC']], 'next': [4]}, 'G'), ({'parents': [1, 5], 'not_during': [], 'state': [[6, 'G'], [8, 'Y']], 'next': []}, 'R'), ({'parents': [4, 5, 7], 'not_during': [3], 'state': [[5, 'RC'], [1, 'Y']], 'next': [5]}, 'G'), ({'parents': [5, 7], 'not_during': [4, 6], 'state': [[3, 'Y'], [5, 'RC']], 'next': [3, 8]}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y')], [({'parents': [2, 4], 'not_during': [3, 5], 'state': [[6, 'G'], [5, 'G']], 'next': [1, 5]}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [2], 'not_during': [], 'state': [[6, 'Y'], [7, 'G'], [8, 'G']], 'next': []}, 'R'), ({'parents': [3], 'not_during': [], 'state': [[4, 'RC']], 'next': [7]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3, 4], 'not_during': [], 'state': [[6, 'R'], [4, 'RC'], [5, 'Y']], 'next': [2, 6]}, 'G'), ({'parents': [6, 7], 'not_during': [2], 'state': [[4, 'G'], [1, 'Y'], [7, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G')], [({'parents': [4], 'not_during': [3], 'state': [[7, 'R'], [5, 'R'], [4, 'RC']], 'next': [4, 8]}, 'G'), ({'parents': [8], 'not_during': [1, 7], 'state': [[3, 'RC'], [2, 'R']], 'next': []}, 'R'), ({'parents': [2, 6, 8], 'not_during': [3, 5], 'state': [[1, 'R'], [3, 'Y']], 'next': [6, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [], 'state': [[1, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [1, 3, 5], 'not_during': [4, 6], 'state': [[3, 'R']], 'next': [4, 5]}, 'R')], [({'parents': [1, 2, 6], 'not_during': [3], 'state': [[6, 'RC'], [3, 'RC'], [5, 'G']], 'next': [2, 6]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [5], 'not_during': [], 'state': [[8, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [5], 'not_during': [2], 'state': [[4, 'RC'], [2, 'R'], [6, 'G']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [5], 'state': [[1, 'RC'], [4, 'RC'], [2, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [5, 7, 8], 'not_during': [2, 3], 'state': [[7, 'RC'], [6, 'G'], [8, 'RC']], 'next': []}, 'R')]]
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 | R | R | Passed |
| timing oracle 1 | R | G | Failed |
| timing oracle 2 | R | R | Passed |
| timing oracle 3 | Y | Y | Passed |
| timing oracle 4 | R | G | Failed |
| timing oracle 5 | R | R | Passed |
| timing oracle 6 | R | G | Failed |
| timing oracle 7 | R | R | Passed |
SHA-256 / 133eac6d1051c3d2039b3158133ffe05be3acebea0a38f5acab9f913d2d35482
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
par = set(x['parents'])
nd = set(x['not_during'])
cur = {ph: iv for ph, iv in x['state']}
if any(cur.get(p) == 'G' for p in nd):
return 'R'
if any(cur.get(p) == 'G' for p in par):
return 'G'
terminating = [p for p in sorted(par) if cur.get(p) in ('Y', 'R')]
if terminating:
if any(p in par for p in x['next']):
return 'G'
if any(cur[p] == 'Y' for p in terminating):
return 'Y'
return 'R'
return 'R'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'parents': [3, 4, 8], 'not_during': [2, 6], 'state': [[4, 'R'], [5, 'RC']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [1, 2, 4], 'not_during': [], 'state': [[8, 'G'], [4, 'RC']], 'next': [2, 7]}, 'G'), ({'parents': [4, 7], 'not_during': [2, 3], 'state': [[7, 'R'], [2, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [3, 4, 5], 'not_during': [2, 7], 'state': [[8, 'RC'], [3, 'RC'], [6, 'RC']], 'next': [5]}, 'G'), ({'parents': [5, 6], 'not_during': [7], 'state': [[3, 'G'], [6, 'R']], 'next': [4, 6]}, 'R')], [({'parents': [1, 4], 'not_during': [8], 'state': [[3, 'Y'], [5, 'G']], 'next': []}, 'R'), ({'parents': [3, 4, 8], 'not_during': [5], 'state': [[1, 'G'], [4, 'RC']], 'next': [4]}, 'G'), ({'parents': [1, 5], 'not_during': [], 'state': [[6, 'G'], [8, 'Y']], 'next': []}, 'R'), ({'parents': [4, 5, 7], 'not_during': [3], 'state': [[5, 'RC'], [1, 'Y']], 'next': [5]}, 'G'), ({'parents': [5, 7], 'not_during': [4, 6], 'state': [[3, 'Y'], [5, 'RC']], 'next': [3, 8]}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y')], [({'parents': [2, 4], 'not_during': [3, 5], 'state': [[6, 'G'], [5, 'G']], 'next': [1, 5]}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [2], 'not_during': [], 'state': [[6, 'Y'], [7, 'G'], [8, 'G']], 'next': []}, 'R'), ({'parents': [3], 'not_during': [], 'state': [[4, 'RC']], 'next': [7]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3, 4], 'not_during': [], 'state': [[6, 'R'], [4, 'RC'], [5, 'Y']], 'next': [2, 6]}, 'G'), ({'parents': [6, 7], 'not_during': [2], 'state': [[4, 'G'], [1, 'Y'], [7, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G')], [({'parents': [4], 'not_during': [3], 'state': [[7, 'R'], [5, 'R'], [4, 'RC']], 'next': [4, 8]}, 'G'), ({'parents': [8], 'not_during': [1, 7], 'state': [[3, 'RC'], [2, 'R']], 'next': []}, 'R'), ({'parents': [2, 6, 8], 'not_during': [3, 5], 'state': [[1, 'R'], [3, 'Y']], 'next': [6, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [], 'state': [[1, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [1, 3, 5], 'not_during': [4, 6], 'state': [[3, 'R']], 'next': [4, 5]}, 'R')], [({'parents': [1, 2, 6], 'not_during': [3], 'state': [[6, 'RC'], [3, 'RC'], [5, 'G']], 'next': [2, 6]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [5], 'not_during': [], 'state': [[8, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [5], 'not_during': [2], 'state': [[4, 'RC'], [2, 'R'], [6, 'G']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [5], 'state': [[1, 'RC'], [4, 'RC'], [2, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [5, 7, 8], 'not_during': [2, 3], 'state': [[7, 'RC'], [6, 'G'], [8, 'RC']], 'next': []}, 'R')]]
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 | R | R | Passed |
| timing oracle 1 | R | G | Failed |
| timing oracle 2 | R | R | Passed |
| timing oracle 3 | Y | Y | Passed |
| timing oracle 4 | R | G | Failed |
| timing oracle 5 | R | R | Passed |
| timing oracle 6 | R | G | Failed |
| timing oracle 7 | G | R | Failed |
SHA-256 / fb9b1cc130676e705891774f63f2dc739462b540259757c4e8fc9c795a25165a
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
par = set(x['parents'])
nd = set(x['not_during'])
cur = {ph: iv for ph, iv in x['state']}
if any(cur.get(p) == 'G' for p in nd):
return 'R'
if any(cur.get(p) == 'G' for p in par):
return 'G'
terminating = [p for p in sorted(par) if cur.get(p) in ('Y', 'RC')]
if terminating:
if any(p in par for p in x['next']):
return 'G'
if any(cur[p] == 'Y' for p in terminating):
return 'Y'
return 'R'
return 'R'
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[({'parents': [3, 4, 8], 'not_during': [2, 6], 'state': [[4, 'R'], [5, 'RC']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [1, 2, 4], 'not_during': [], 'state': [[8, 'G'], [4, 'RC']], 'next': [2, 7]}, 'G'), ({'parents': [4, 7], 'not_during': [2, 3], 'state': [[7, 'R'], [2, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [3, 4, 5], 'not_during': [2, 7], 'state': [[8, 'RC'], [3, 'RC'], [6, 'RC']], 'next': [5]}, 'G'), ({'parents': [5, 6], 'not_during': [7], 'state': [[3, 'G'], [6, 'R']], 'next': [4, 6]}, 'R')], [({'parents': [1, 4], 'not_during': [8], 'state': [[3, 'Y'], [5, 'G']], 'next': []}, 'R'), ({'parents': [3, 4, 8], 'not_during': [5], 'state': [[1, 'G'], [4, 'RC']], 'next': [4]}, 'G'), ({'parents': [1, 5], 'not_during': [], 'state': [[6, 'G'], [8, 'Y']], 'next': []}, 'R'), ({'parents': [4, 5, 7], 'not_during': [3], 'state': [[5, 'RC'], [1, 'Y']], 'next': [5]}, 'G'), ({'parents': [5, 7], 'not_during': [4, 6], 'state': [[3, 'Y'], [5, 'RC']], 'next': [3, 8]}, 'R'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y')], [({'parents': [2, 4], 'not_during': [3, 5], 'state': [[6, 'G'], [5, 'G']], 'next': [1, 5]}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [2], 'not_during': [], 'state': [[6, 'Y'], [7, 'G'], [8, 'G']], 'next': []}, 'R'), ({'parents': [3], 'not_during': [], 'state': [[4, 'RC']], 'next': [7]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3, 4], 'not_during': [], 'state': [[6, 'R'], [4, 'RC'], [5, 'Y']], 'next': [2, 6]}, 'G'), ({'parents': [6, 7], 'not_during': [2], 'state': [[4, 'G'], [1, 'Y'], [7, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G')], [({'parents': [4], 'not_during': [3], 'state': [[7, 'R'], [5, 'R'], [4, 'RC']], 'next': [4, 8]}, 'G'), ({'parents': [8], 'not_during': [1, 7], 'state': [[3, 'RC'], [2, 'R']], 'next': []}, 'R'), ({'parents': [2, 6, 8], 'not_during': [3, 5], 'state': [[1, 'R'], [3, 'Y']], 'next': [6, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [], 'state': [[1, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [1, 3, 5], 'not_during': [4, 6], 'state': [[3, 'R']], 'next': [4, 5]}, 'R')], [({'parents': [1, 2, 6], 'not_during': [3], 'state': [[6, 'RC'], [3, 'RC'], [5, 'G']], 'next': [2, 6]}, 'G'), ({'parents': [2, 3], 'not_during': [], 'state': [[2, 'RC'], [6, 'RC']], 'next': [3, 7]}, 'G'), ({'parents': [5], 'not_during': [], 'state': [[8, 'G']], 'next': [3, 8]}, 'R'), ({'parents': [4, 5], 'not_during': [], 'state': [[4, 'RC'], [5, 'Y']], 'next': [1]}, 'Y'), ({'parents': [5], 'not_during': [2], 'state': [[4, 'RC'], [2, 'R'], [6, 'G']], 'next': []}, 'R'), ({'parents': [2, 3], 'not_during': [5], 'state': [[3, 'G'], [5, 'G']], 'next': []}, 'R'), ({'parents': [1, 4], 'not_during': [5], 'state': [[1, 'RC'], [4, 'RC'], [2, 'RC']], 'next': [4, 7]}, 'G'), ({'parents': [5, 7, 8], 'not_during': [2, 3], 'state': [[7, 'RC'], [6, 'G'], [8, 'RC']], 'next': []}, 'R')]]
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 | R | R | Passed |
| timing oracle 1 | G | G | Passed |
| timing oracle 2 | R | R | Passed |
| timing oracle 3 | Y | Y | Passed |
| timing oracle 4 | G | G | Passed |
| timing oracle 5 | R | R | Passed |
| timing oracle 6 | G | G | Passed |
| timing oracle 7 | R | R | Passed |
SHA-256 / 68ef636fb7c94a5758ccf110a288ed8421060c65c2eb935062d30ab540939c22
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:48:01.250575+00:00.
Case digest / 71b9467bb52ecd8be40c90ac6f959aa35bf3bf5e1c94f9f88437b6a52fd6d4eb