broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
N = 1
observations = []
def solve(r):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = first_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = r['target'] - coordinate
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = r['target'] - coordinate
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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 active.

Virtual clock has anchor A at monotonic M0, rate p0/q0 until switch S, then p1/q1 thereafter. Readings may precede M0 and use first rate. The switch is continuous. Report exact coordinate, active rate, continuity anchor, next target delta and inverse monotonic coordinate for a target at or after switch. All rates positive.

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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = r['anchor'] + delta * active
    until = r['target'] - coordinate
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = (join if second else r['anchor']) + delta
    until = r['target'] - coordinate
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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 coordinate.

Virtual clock has anchor A at monotonic M0, rate p0/q0 until switch S, then p1/q1 thereafter. Readings may precede M0 and use first rate. The switch is continuous. Report exact coordinate, active rate, continuity anchor, next target delta and inverse monotonic coordinate for a target at or after switch. All rates positive.

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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = coordinate - r['target']
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = abs(r['target'] - coordinate)
    inverse = r['switch'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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 until.

Virtual clock has anchor A at monotonic M0, rate p0/q0 until switch S, then p1/q1 thereafter. Readings may precede M0 and use first rate. The switch is continuous. Report exact coordinate, active rate, continuity anchor, next target delta and inverse monotonic coordinate for a target at or after switch. All rates positive.

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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = r['target'] - coordinate
    inverse = r['mono_origin'] + (r['target'] - join) / second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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):
    first_span = r['switch'] - r['mono_origin']
    first_rate = Fraction(r['p0'],r['q0'])
    second_rate = Fraction(r['p1'],r['q1'])
    join = r['anchor'] + first_span * first_rate
    second = r['reading'] >= r['switch']
    delta = r['reading'] - (r['switch'] if second else r['mono_origin'])
    active = second_rate if second else first_rate
    coordinate = (join if second else r['anchor']) + delta * active
    until = r['target'] - coordinate
    inverse = r['switch'] + (r['target'] - join) * second_rate
    return [str(coordinate),str(active),str(join),str(until),str(inverse)]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 5, 'target': 130}), ['185/2', '3/2', '115', '75/2', '85/2'])
check('fixture 2', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}), ['100', '3/2', '115', '30', '85/2'])
check('fixture 3', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 19, 'target': 130}), ['227/2', '3/2', '115', '33/2', '85/2'])
check('fixture 4', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 20, 'target': 130}), ['115', '2/3', '115', '15', '85/2'])
check('fixture 5', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 21, 'target': 130}), ['347/3', '2/3', '115', '43/3', '85/2'])
check('fixture 6', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 30, 'target': 130}), ['365/3', '2/3', '115', '25/3', '85/2'])
check('fixture 7', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 50, 'target': 120}), ['135', '2/3', '115', '-15', '55/2'])
check('fixture 8', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 25, 'target': 115}), ['355/3', '2/3', '115', '-10/3', '20'])
check('fixture 9', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 15, 'target': 116}), ['215/2', '3/2', '115', '17/2', '43/2'])
check('fixture 10', solve({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 100, 'target': 130}), ['505/3', '2/3', '115', '-115/3', '85/2'])
variant = [({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 6, 'target': 130}, ['94', '3/2', '115', '36', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 7, 'target': 130}, ['191/2', '3/2', '115', '69/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 8, 'target': 130}, ['97', '3/2', '115', '33', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 9, 'target': 130}, ['197/2', '3/2', '115', '63/2', '85/2']), ({'mono_origin': 10, 'anchor': 100, 'switch': 20, 'p0': 3, 'q0': 2, 'p1': 2, 'q1': 3, 'reading': 10, 'target': 130}, ['100', '3/2', '115', '30', '85/2'])]
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 inverse.

Virtual clock has anchor A at monotonic M0, rate p0/q0 until switch S, then p1/q1 thereafter. Readings may precede M0 and use first rate. The switch is continuous. Report exact coordinate, active rate, continuity anchor, next target delta and inverse monotonic coordinate for a target at or after switch. All rates positive.

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):
    age = abs(r['now'] - r['last_sync'])
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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):
    age = r['now']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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 age.

Clock quality state is determined from oscillator validity, acquisition lock count, elapsed time since last sync, max holdover, phase jump and lock threshold. Unknown oscillator is invalid; otherwise large phase jump requires reacquisition, recent sufficient lock is synchronized, old but bounded history is holdover, and missing/expired history is unsynchronized. Return usability and conservative uncertainty growth for holdover only.

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):
    age = r['now'] - r['last_sync']
    history = age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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):
    age = r['now'] - r['last_sync']
    history = r['has_sync']
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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 history.

Clock quality state is determined from oscillator validity, acquisition lock count, elapsed time since last sync, max holdover, phase jump and lock threshold. Unknown oscillator is invalid; otherwise large phase jump requires reacquisition, recent sufficient lock is synchronized, old but bounded history is holdover, and missing/expired history is unsynchronized. Return usability and conservative uncertainty growth for holdover only.

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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = r['phase_jump'] > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) >= r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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 jumped.

Clock quality state is determined from oscillator validity, acquisition lock count, elapsed time since last sync, max holdover, phase jump and lock threshold. Unknown oscillator is invalid; otherwise large phase jump requires reacquisition, recent sufficient lock is synchronized, old but bounded history is holdover, and missing/expired history is unsynchronized. Return usability and conservative uncertainty growth for holdover only.

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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] > r['required']
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] > 0
    recent = history and age <= r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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 locked.

Clock quality state is determined from oscillator validity, acquisition lock count, elapsed time since last sync, max holdover, phase jump and lock threshold. Unknown oscillator is invalid; otherwise large phase jump requires reacquisition, recent sufficient lock is synchronized, old but bounded history is holdover, and missing/expired history is unsynchronized. Return usability and conservative uncertainty growth for holdover only.

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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history and age < r['fresh_window']
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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):
    age = r['now'] - r['last_sync']
    history = r['has_sync'] and age >= 0
    jumped = abs(r['phase_jump']) > r['jump_limit']
    locked = r['lock_count'] >= r['required']
    recent = history
    holdover = history and age <= r['max_holdover']
    state = 'invalid' if not r['oscillator'] else ('acquire' if jumped else ('locked' if recent and locked else ('holdover' if holdover else 'unsynced')))
    growth = (age * r['drift'] + 999) // 1000 if state == 'holdover' else 0
    error = r['base_error'] + growth if state in ('locked','holdover') else None
    usable = state in ('locked','holdover') and error <= r['error_limit']
    return [state,error,usable]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
check('fixture 1', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['locked', 2, True])
check('fixture 2', solve({'now': 105, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 3}), ['locked', 2, True])
check('fixture 3', solve({'now': 106, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 2}), ['holdover', 3, False])
check('fixture 4', solve({'now': 120, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 4, True])
check('fixture 5', solve({'now': 121, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 6', solve({'now': 99, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 7', solve({'now': 100, 'last_sync': 100, 'has_sync': False, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['unsynced', None, False])
check('fixture 8', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': -6, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['acquire', None, False])
check('fixture 9', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 5, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['locked', 2, True])
check('fixture 10', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 1, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 2, True])
check('fixture 11', solve({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': False, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['invalid', None, False])
check('fixture 12', solve({'now': 110, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 2, 'error_limit': 5}), ['holdover', 3, True])
variant = [({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 3, 'error_limit': 2}, ['locked', 3, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 4, 'error_limit': 2}, ['locked', 4, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 5, 'error_limit': 2}, ['locked', 5, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 6, 'error_limit': 2}, ['locked', 6, False]), ({'now': 100, 'last_sync': 100, 'has_sync': True, 'phase_jump': 0, 'jump_limit': 5, 'lock_count': 3, 'required': 3, 'fresh_window': 5, 'max_holdover': 20, 'oscillator': True, 'drift': 100, 'base_error': 7, 'error_limit': 2}, ['locked', 7, False])]
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 recent.

Clock quality state is determined from oscillator validity, acquisition lock count, elapsed time since last sync, max holdover, phase jump and lock threshold. Unknown oscillator is invalid; otherwise large phase jump requires reacquisition, recent sufficient lock is synchronized, old but bounded history is holdover, and missing/expired history is unsynchronized. Return usability and conservative uncertainty growth for holdover only.

split: open-access