broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    c=d['child']; p=d['parent']; children=d['children']; roots=d['roots']; degree=d['degree']
    return {'parent_children': [x for x in children if x!=c],
    'root_append': roots+[c],
    'degree': degree-1,
    'child_parent': None,
    'mark': d["mark"],
    'descendants': d["descendants"]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103, 104]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103, 104]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    c=d['child']; p=d['parent']; children=d['children']; roots=d['roots']; degree=d['degree']
    return {'parent_children': [x for x in children if x!=c],
    'root_append': roots+[c],
    'degree': degree-1,
    'child_parent': None,
    'mark': len(d["descendants"])>0,
    'descendants': d["descendants"]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103, 104]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103, 104]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cut certificate reports an incorrect mark.

A Fibonacci cut certificate has child c, parent p, ordered parent children, root ids, parent degree, child mark, and node keys. Cut detaches c, promotes it to the end of roots, clears its mark and parent, and decrements parent degree; it does not erase descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    c=d['child']; p=d['parent']; children=d['children']; roots=d['roots']; degree=d['degree']
    return {'parent_children': [x for x in children if x!=c],
    'root_append': roots+[c],
    'degree': degree-1,
    'child_parent': None,
    'mark': False,
    'descendants': []}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103, 104]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103, 104]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    c=d['child']; p=d['parent']; children=d['children']; roots=d['roots']; degree=d['degree']
    return {'parent_children': [x for x in children if x!=c],
    'root_append': roots+[c],
    'degree': degree-1,
    'child_parent': None,
    'mark': False,
    'descendants': d["descendants"]+[p]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103]})], [({'child': 1, 'parent': 9, 'children': [1], 'roots': [9], 'degree': 1, 'mark': True, 'descendants': []}, {'parent_children': [], 'root_append': [9, 1], 'degree': 0, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 2, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 8], 'degree': 3, 'mark': True, 'descendants': [4, 5]}, {'parent_children': [1, 3], 'root_append': [9, 8, 2], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': [4, 5]}), ({'child': 1, 'parent': 9, 'children': [1, 2], 'roots': [9], 'degree': 2, 'mark': False, 'descendants': [3]}, {'parent_children': [2], 'root_append': [9, 1], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [3]}), ({'child': 3, 'parent': 9, 'children': [1, 2, 3], 'roots': [9, 7], 'degree': 3, 'mark': False, 'descendants': []}, {'parent_children': [1, 2], 'root_append': [9, 7, 3], 'degree': 2, 'child_parent': None, 'mark': False, 'descendants': []}), ({'child': 4, 'parent': 9, 'children': [4, 5], 'roots': [9, 6], 'degree': 2, 'mark': True, 'descendants': [1]}, {'parent_children': [5], 'root_append': [9, 6, 4], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [1]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8]}), ({'child': 2, 'parent': 9, 'children': [3, 2], 'roots': [9], 'degree': 2, 'mark': True, 'descendants': [7, 8, 100, 101, 102, 103, 104]}, {'parent_children': [3], 'root_append': [9, 2], 'degree': 1, 'child_parent': None, 'mark': False, 'descendants': [7, 8, 100, 101, 102, 103, 104]})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cut certificate reports an incorrect descendants.

A Fibonacci cut certificate has child c, parent p, ordered parent children, root ids, parent degree, child mark, and node keys. Cut detaches c, promotes it to the end of roots, clears its mark and parent, and decrements parent degree; it does not erase descendants.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': [x[0] for x in path if x[2]],
    'new_mark': marked,
    'cleared': cut,
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': [x[0] for x in path if not x[1]],
    'new_mark': marked,
    'cleared': cut,
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cascade certificate reports an incorrect cuts.

A cascading-cut path runs from the parent of an initially cut node upward as [id,is_root,marked]. Stop at a root or first unmarked nonroot; mark that first unmarked node. Previously marked nonroots are cut and unmarked. Report cut ids, marked stop, cleared ids, visited count, promoted count, and potential change roots+2*marks.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': path[0][0] if path else None,
    'cleared': cut,
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': next((x[0] for x in path if not x[2]),None),
    'cleared': cut,
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cascade certificate reports an incorrect new mark.

A cascading-cut path runs from the parent of an initially cut node upward as [id,is_root,marked]. Stop at a root or first unmarked nonroot; mark that first unmarked node. Previously marked nonroots are cut and unmarked. Report cut ids, marked stop, cleared ids, visited count, promoted count, and potential change roots+2*marks.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': marked,
    'cleared': [],
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': marked,
    'cleared': cut[:-1],
    'visits': visited,
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cascade certificate reports an incorrect cleared.

A cascading-cut path runs from the parent of an initially cut node upward as [id,is_root,marked]. Stop at a root or first unmarked nonroot; mark that first unmarked node. Previously marked nonroots are cut and unmarked. Report cut ids, marked stop, cleared ids, visited count, promoted count, and potential change roots+2*marks.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': marked,
    'cleared': cut,
    'visits': len(path),
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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

N = 1
observations = []
def solve(d):
    path=d['path']; cut=[]; marked=None; visited=0
    for ident,root,mark in path:
        visited+=1
        if root: break
        if not mark:
            marked=ident; break
        cut.append(ident)
    return {'cuts': cut,
    'new_mark': marked,
    'cleared': cut,
    'visits': len(cut),
    'promoted_count': len(cut),
    'potential_delta': -len(cut)+(2 if marked is not None else 0)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100], 'new_mark': 1, 'cleared': [100], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101], 'new_mark': 1, 'cleared': [100, 101], 'visits': 3, 'promoted_count': 2, 'potential_delta': 0})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102], 'new_mark': 1, 'cleared': [100, 101, 102], 'visits': 4, 'promoted_count': 3, 'potential_delta': -1})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103], 'new_mark': 1, 'cleared': [100, 101, 102, 103], 'visits': 5, 'promoted_count': 4, 'potential_delta': -2})], [({'path': []}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 0, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, True, False]]}, {'cuts': [], 'new_mark': None, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 0}), ({'path': [[1, False, False], [2, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[1, False, True], [2, False, False], [3, True, False]]}, {'cuts': [1], 'new_mark': 2, 'cleared': [1], 'visits': 2, 'promoted_count': 1, 'potential_delta': 1}), ({'path': [[1, False, True], [2, False, True], [3, True, True]]}, {'cuts': [1, 2], 'new_mark': None, 'cleared': [1, 2], 'visits': 3, 'promoted_count': 2, 'potential_delta': -2}), ({'path': [[1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [], 'new_mark': 1, 'cleared': [], 'visits': 1, 'promoted_count': 0, 'potential_delta': 2}), ({'path': [[100, False, True], [101, False, True], [102, False, True], [103, False, True], [104, False, True], [1, False, False], [2, False, True], [3, True, False]]}, {'cuts': [100, 101, 102, 103, 104], 'new_mark': 1, 'cleared': [100, 101, 102, 103, 104], 'visits': 6, 'promoted_count': 5, 'potential_delta': -3})]][N-1]
check('regression certificate 1', solve(cases[0][0]), cases[0][1])
check('regression certificate 2', solve(cases[1][0]), cases[1][1])
check('regression certificate 3', solve(cases[2][0]), cases[2][1])
check('regression certificate 4', solve(cases[3][0]), cases[3][1])
check('regression certificate 5', solve(cases[4][0]), cases[4][1])
check('regression certificate 6', solve(cases[5][0]), cases[5][1])
check('variant-dependent certificate', solve(cases[6][0]), cases[6][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 bounded fibonacci cascade certificate reports an incorrect visits.

A cascading-cut path runs from the parent of an initially cut node upward as [id,is_root,marked]. Stop at a root or first unmarked nonroot; mark that first unmarked node. Previously marked nonroots are cut and unmarked. Report cut ids, marked stop, cleared ids, visited count, promoted count, and potential change roots+2*marks.

split: open-access