broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['minute'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for second.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second'))
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and abs(r['generation_before']-r['generation_after']) <= 1
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for bcd.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for hour_valid.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 60
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute < 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for minute_valid.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 60
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second < 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for second_valid.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = True
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for mode_valid.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for converted_hour.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and mode_valid
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    hour = (r['hour'] >> 4) * 10 + (r['hour'] & 15)
    minute = (r['minute'] >> 4) * 10 + (r['minute'] & 15)
    second = (r['second'] >> 4) * 10 + (r['second'] & 15)
    bcd = all(0 <= r[k] <= 255 and r[k] >> 4 <= 9 and r[k] & 15 <= 9 for k in ('hour','minute','second')) and r['generation_before'] == r['generation_after']
    hour_valid = 1 <= hour <= 12 if r['twelve'] else 0 <= hour <= 23
    minute_valid = 0 <= minute <= 59
    second_valid = 0 <= second <= 59
    mode_valid = r['twelve'] or not r['pm']
    converted_hour = hour % 12 + 12 * int(r['pm']) if r['twelve'] else hour
    valid = bcd and hour_valid and minute_valid and second_valid and r['running']
    return [valid,converted_hour,minute,second]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 34, 56])
check('fixture 2', solve({'hour': 18, 'minute': 89, 'second': 89, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 12, 59, 59])
check('fixture 3', solve({'hour': 35, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 23, 0, 0])
check('fixture 4', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 0, 0, 0])
check('fixture 5', solve({'hour': 0, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 0, 0, 0])
check('fixture 6', solve({'hour': 19, 'minute': 0, 'second': 0, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 7', solve({'hour': 16, 'minute': 96, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 60, 0])
check('fixture 8', solve({'hour': 16, 'minute': 0, 'second': 96, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 10, 0, 60])
check('fixture 9', solve({'hour': 26, 'minute': 0, 'second': 0, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 20, 0, 0])
check('fixture 10', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': False, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 1, 0, 0])
check('fixture 11', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': False, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [False, 13, 0, 0])
check('fixture 12', solve({'hour': 1, 'minute': 0, 'second': 0, 'twelve': True, 'pm': True, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 13, 0, 0])
check('fixture 13', solve({'hour': 16, 'minute': 89, 'second': 88, 'twelve': False, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}), [True, 10, 59, 58])
check('fixture 14', solve({'hour': 18, 'minute': 52, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 2}), [False, 0, 34, 56])
variant = [({'hour': 18, 'minute': 1, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 1, 56]), ({'hour': 18, 'minute': 2, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 2, 56]), ({'hour': 18, 'minute': 3, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 3, 56]), ({'hour': 18, 'minute': 4, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 4, 56]), ({'hour': 18, 'minute': 5, 'second': 86, 'twelve': True, 'pm': False, 'running': True, 'previous_hour': 17, 'generation_before': 1, 'generation_after': 1}, [True, 0, 5, 56])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for valid.

Controlled RTC snapshot consists of packed BCD hour/minute/second bytes, an hour-mode flag, PM flag and oscillator-running flag. Decode BCD only if each nibble is decimal. In twelve-hour mode valid hours are 1..12; in twenty-four-hour mode 0..23 and PM is forbidden. A stopped oscillator invalidates the reading. Return valid and 24-hour components. Equal generation stamps before and after register reads are required for a coherent snapshot; previous_hour is stale diagnostic context and must not replace the current hour.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    a_end = r['a'] + r['qa'] - 1
    b_end = r['b'] + r['qb']
    compatible = r['domain_a'] == r['domain_b']
    low = max(r['a'],r['b'])
    high = min(a_end,b_end)
    overlap = compatible and low < high
    definite_before = compatible and a_end <= r['b']
    possible_before = compatible and r['a'] < b_end
    equal = compatible and r['a'] == r['b'] and r['qa'] == r['qb']
    contains = r['a'] <= r['query'] < a_end
    return [None if not overlap else [low,high],definite_before,possible_before,equal,contains, None if not compatible else [min(r['a'],r['b']),max(a_end,b_end)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'a': 10, 'qa': 10, 'b': 15, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}), [[15, 20], False, True, False, True, [10, 35]])
check('fixture 2', solve({'a': 10, 'qa': 10, 'b': 20, 'qb': 2, 'query': 20, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 22]])
check('fixture 3', solve({'a': 10, 'qa': 10, 'b': 10, 'qb': 2, 'query': 15, 'domain_a': 'utc', 'domain_b': 'utc'}), [[10, 12], False, True, False, True, [10, 20]])
check('fixture 4', solve({'a': 20, 'qa': 2, 'b': 10, 'qb': 10, 'query': 21, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [10, 22]])
check('fixture 5', solve({'a': 0, 'qa': 1, 'b': 0, 'qb': 1, 'query': 0, 'domain_a': 'mono', 'domain_b': 'mono'}), [[0, 1], False, True, True, True, [0, 1]])
check('fixture 6', solve({'a': 0, 'qa': 10, 'b': 2, 'qb': 3, 'query': 2, 'domain_a': 'a', 'domain_b': 'b'}), [None, False, False, False, True, None])
check('fixture 7', solve({'a': -10, 'qa': 5, 'b': -8, 'qb': 1, 'query': -5, 'domain_a': 'utc', 'domain_b': 'utc'}), [[-8, -7], False, True, False, False, [-10, -5]])
check('fixture 8', solve({'a': 0, 'qa': 3, 'b': 2, 'qb': 1, 'query': 1, 'domain_a': 'utc', 'domain_b': 'utc'}), [[2, 3], False, True, False, True, [0, 3]])
check('fixture 9', solve({'a': 10, 'qa': 1, 'b': 20, 'qb': 1, 'query': 11, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 21]])
check('fixture 10', solve({'a': 0, 'qa': 1, 'b': -1, 'qb': 1, 'query': 0, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [-1, 1]])
variant = [({'a': 10, 'qa': 10, 'b': 16, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[16, 20], False, True, False, True, [10, 36]]), ({'a': 10, 'qa': 10, 'b': 17, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[17, 20], False, True, False, True, [10, 37]]), ({'a': 10, 'qa': 10, 'b': 18, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[18, 20], False, True, False, True, [10, 38]]), ({'a': 10, 'qa': 10, 'b': 19, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[19, 20], False, True, False, True, [10, 39]]), ({'a': 10, 'qa': 10, 'b': 20, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [None, True, True, False, True, [10, 40]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    a_end = r['qa']
    b_end = r['b'] + r['qb']
    compatible = r['domain_a'] == r['domain_b']
    low = max(r['a'],r['b'])
    high = min(a_end,b_end)
    overlap = compatible and low < high
    definite_before = compatible and a_end <= r['b']
    possible_before = compatible and r['a'] < b_end
    equal = compatible and r['a'] == r['b'] and r['qa'] == r['qb']
    contains = r['a'] <= r['query'] < a_end
    return [None if not overlap else [low,high],definite_before,possible_before,equal,contains, None if not compatible else [min(r['a'],r['b']),max(a_end,b_end)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'a': 10, 'qa': 10, 'b': 15, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}), [[15, 20], False, True, False, True, [10, 35]])
check('fixture 2', solve({'a': 10, 'qa': 10, 'b': 20, 'qb': 2, 'query': 20, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 22]])
check('fixture 3', solve({'a': 10, 'qa': 10, 'b': 10, 'qb': 2, 'query': 15, 'domain_a': 'utc', 'domain_b': 'utc'}), [[10, 12], False, True, False, True, [10, 20]])
check('fixture 4', solve({'a': 20, 'qa': 2, 'b': 10, 'qb': 10, 'query': 21, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [10, 22]])
check('fixture 5', solve({'a': 0, 'qa': 1, 'b': 0, 'qb': 1, 'query': 0, 'domain_a': 'mono', 'domain_b': 'mono'}), [[0, 1], False, True, True, True, [0, 1]])
check('fixture 6', solve({'a': 0, 'qa': 10, 'b': 2, 'qb': 3, 'query': 2, 'domain_a': 'a', 'domain_b': 'b'}), [None, False, False, False, True, None])
check('fixture 7', solve({'a': -10, 'qa': 5, 'b': -8, 'qb': 1, 'query': -5, 'domain_a': 'utc', 'domain_b': 'utc'}), [[-8, -7], False, True, False, False, [-10, -5]])
check('fixture 8', solve({'a': 0, 'qa': 3, 'b': 2, 'qb': 1, 'query': 1, 'domain_a': 'utc', 'domain_b': 'utc'}), [[2, 3], False, True, False, True, [0, 3]])
check('fixture 9', solve({'a': 10, 'qa': 1, 'b': 20, 'qb': 1, 'query': 11, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 21]])
check('fixture 10', solve({'a': 0, 'qa': 1, 'b': -1, 'qb': 1, 'query': 0, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [-1, 1]])
variant = [({'a': 10, 'qa': 10, 'b': 16, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[16, 20], False, True, False, True, [10, 36]]), ({'a': 10, 'qa': 10, 'b': 17, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[17, 20], False, True, False, True, [10, 37]]), ({'a': 10, 'qa': 10, 'b': 18, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[18, 20], False, True, False, True, [10, 38]]), ({'a': 10, 'qa': 10, 'b': 19, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[19, 20], False, True, False, True, [10, 39]]), ({'a': 10, 'qa': 10, 'b': 20, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [None, True, True, False, True, [10, 40]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for a_end.

A timestamp rounded down to resolution q represents half-open [stamp,stamp+q). Preserve domain tag; q positive. Comparing two buckets yields exact intersection and possible/definite-before relations, equality of represented sets and union envelope. Query membership is half-open. This model handles precision buckets, not point timestamps.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    a_end = r['a'] + r['qa']
    b_end = r['b'] + r['qa']
    compatible = r['domain_a'] == r['domain_b']
    low = max(r['a'],r['b'])
    high = min(a_end,b_end)
    overlap = compatible and low < high
    definite_before = compatible and a_end <= r['b']
    possible_before = compatible and r['a'] < b_end
    equal = compatible and r['a'] == r['b'] and r['qa'] == r['qb']
    contains = r['a'] <= r['query'] < a_end
    return [None if not overlap else [low,high],definite_before,possible_before,equal,contains, None if not compatible else [min(r['a'],r['b']),max(a_end,b_end)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'a': 10, 'qa': 10, 'b': 15, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}), [[15, 20], False, True, False, True, [10, 35]])
check('fixture 2', solve({'a': 10, 'qa': 10, 'b': 20, 'qb': 2, 'query': 20, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 22]])
check('fixture 3', solve({'a': 10, 'qa': 10, 'b': 10, 'qb': 2, 'query': 15, 'domain_a': 'utc', 'domain_b': 'utc'}), [[10, 12], False, True, False, True, [10, 20]])
check('fixture 4', solve({'a': 20, 'qa': 2, 'b': 10, 'qb': 10, 'query': 21, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [10, 22]])
check('fixture 5', solve({'a': 0, 'qa': 1, 'b': 0, 'qb': 1, 'query': 0, 'domain_a': 'mono', 'domain_b': 'mono'}), [[0, 1], False, True, True, True, [0, 1]])
check('fixture 6', solve({'a': 0, 'qa': 10, 'b': 2, 'qb': 3, 'query': 2, 'domain_a': 'a', 'domain_b': 'b'}), [None, False, False, False, True, None])
check('fixture 7', solve({'a': -10, 'qa': 5, 'b': -8, 'qb': 1, 'query': -5, 'domain_a': 'utc', 'domain_b': 'utc'}), [[-8, -7], False, True, False, False, [-10, -5]])
check('fixture 8', solve({'a': 0, 'qa': 3, 'b': 2, 'qb': 1, 'query': 1, 'domain_a': 'utc', 'domain_b': 'utc'}), [[2, 3], False, True, False, True, [0, 3]])
check('fixture 9', solve({'a': 10, 'qa': 1, 'b': 20, 'qb': 1, 'query': 11, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 21]])
check('fixture 10', solve({'a': 0, 'qa': 1, 'b': -1, 'qb': 1, 'query': 0, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [-1, 1]])
variant = [({'a': 10, 'qa': 10, 'b': 16, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[16, 20], False, True, False, True, [10, 36]]), ({'a': 10, 'qa': 10, 'b': 17, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[17, 20], False, True, False, True, [10, 37]]), ({'a': 10, 'qa': 10, 'b': 18, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[18, 20], False, True, False, True, [10, 38]]), ({'a': 10, 'qa': 10, 'b': 19, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[19, 20], False, True, False, True, [10, 39]]), ({'a': 10, 'qa': 10, 'b': 20, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [None, True, True, False, True, [10, 40]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    a_end = r['a'] + r['qa']
    b_end = r['b'] + r['qb'] - 1
    compatible = r['domain_a'] == r['domain_b']
    low = max(r['a'],r['b'])
    high = min(a_end,b_end)
    overlap = compatible and low < high
    definite_before = compatible and a_end <= r['b']
    possible_before = compatible and r['a'] < b_end
    equal = compatible and r['a'] == r['b'] and r['qa'] == r['qb']
    contains = r['a'] <= r['query'] < a_end
    return [None if not overlap else [low,high],definite_before,possible_before,equal,contains, None if not compatible else [min(r['a'],r['b']),max(a_end,b_end)]]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'a': 10, 'qa': 10, 'b': 15, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}), [[15, 20], False, True, False, True, [10, 35]])
check('fixture 2', solve({'a': 10, 'qa': 10, 'b': 20, 'qb': 2, 'query': 20, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 22]])
check('fixture 3', solve({'a': 10, 'qa': 10, 'b': 10, 'qb': 2, 'query': 15, 'domain_a': 'utc', 'domain_b': 'utc'}), [[10, 12], False, True, False, True, [10, 20]])
check('fixture 4', solve({'a': 20, 'qa': 2, 'b': 10, 'qb': 10, 'query': 21, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [10, 22]])
check('fixture 5', solve({'a': 0, 'qa': 1, 'b': 0, 'qb': 1, 'query': 0, 'domain_a': 'mono', 'domain_b': 'mono'}), [[0, 1], False, True, True, True, [0, 1]])
check('fixture 6', solve({'a': 0, 'qa': 10, 'b': 2, 'qb': 3, 'query': 2, 'domain_a': 'a', 'domain_b': 'b'}), [None, False, False, False, True, None])
check('fixture 7', solve({'a': -10, 'qa': 5, 'b': -8, 'qb': 1, 'query': -5, 'domain_a': 'utc', 'domain_b': 'utc'}), [[-8, -7], False, True, False, False, [-10, -5]])
check('fixture 8', solve({'a': 0, 'qa': 3, 'b': 2, 'qb': 1, 'query': 1, 'domain_a': 'utc', 'domain_b': 'utc'}), [[2, 3], False, True, False, True, [0, 3]])
check('fixture 9', solve({'a': 10, 'qa': 1, 'b': 20, 'qb': 1, 'query': 11, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, True, True, False, False, [10, 21]])
check('fixture 10', solve({'a': 0, 'qa': 1, 'b': -1, 'qb': 1, 'query': 0, 'domain_a': 'utc', 'domain_b': 'utc'}), [None, False, False, False, True, [-1, 1]])
variant = [({'a': 10, 'qa': 10, 'b': 16, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[16, 20], False, True, False, True, [10, 36]]), ({'a': 10, 'qa': 10, 'b': 17, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[17, 20], False, True, False, True, [10, 37]]), ({'a': 10, 'qa': 10, 'b': 18, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[18, 20], False, True, False, True, [10, 38]]), ({'a': 10, 'qa': 10, 'b': 19, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [[19, 20], False, True, False, True, [10, 39]]), ({'a': 10, 'qa': 10, 'b': 20, 'qb': 20, 'query': 10, 'domain_a': 'utc', 'domain_b': 'utc'}, [None, True, True, False, True, [10, 40]])]
check("variant capture", solve(variant[N-1][0]), variant[N-1][1])
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)

prompt:
The decoded time state disagrees with the explicit regression oracle for b_end.

A timestamp rounded down to resolution q represents half-open [stamp,stamp+q). Preserve domain tag; q positive. Comparing two buckets yields exact intersection and possible/definite-before relations, equality of represented sets and union envelope. Query membership is half-open. This model handles precision buckets, not point timestamps.

split: open-access