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

N = 1
observations = []
def solve(d):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[i],i],
    'changed_handles': [] if i==j else [a[i],a[j]],
    'bijective': len(set(after))==len(pos)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[j],j],
    'changed_handles': [] if i==j else [a[i],a[j]],
    'bijective': len(set(after))==len(pos)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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 indexed swap certificate reports an incorrect second moved.

An indexed heap swap receives unique entry ids in slots, an exact inverse position map, and two in-range positions i,j. Swap the records, update both inverse-map locations, keep cardinality and membership, and report the two moved identities. Self-swap is allowed.

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[j],i],
    'changed_handles': [a[i],a[j]],
    'bijective': len(set(after))==len(pos)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[j],i],
    'changed_handles': [],
    'bijective': len(set(after))==len(pos)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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 indexed swap certificate reports an incorrect changed handles.

An indexed heap swap receives unique entry ids in slots, an exact inverse position map, and two in-range positions i,j. Swap the records, update both inverse-map locations, keep cardinality and membership, and report the two moved identities. Self-swap is allowed.

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[j],i],
    'changed_handles': [] if i==j else [a[i],a[j]],
    'bijective': len(set(a[:i]+[a[j]]+a[i+1:]))==len(pos)}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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):
    a=d['slots']; i=d['i']; j=d['j']; after=list(a); after[i],after[j]=after[j],after[i]; pos={x:k for k,x in enumerate(a)}
    return {'slots': after,
    'positions': {x:k for k,x in enumerate(after)},
    'first_moved': [a[i],j],
    'second_moved': [a[j],i],
    'changed_handles': [] if i==j else [a[i],a[j]],
    'bijective': i!=j}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 1, 'j': 3}, {'slots': ['q', 't', 's', 'r', 'u'], 'positions': {'q': 0, 't': 1, 's': 2, 'r': 3, 'u': 4}, 'first_moved': ['r', 3], 'second_moved': ['t', 1], 'changed_handles': ['r', 't'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 2, 'j': 4}, {'slots': ['q', 'r', 'u', 't', 's'], 'positions': {'q': 0, 'r': 1, 'u': 2, 't': 3, 's': 4}, 'first_moved': ['s', 4], 'second_moved': ['u', 2], 'changed_handles': ['s', 'u'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 3, 'j': 0}, {'slots': ['t', 'r', 's', 'q', 'u'], 'positions': {'t': 0, 'r': 1, 's': 2, 'q': 3, 'u': 4}, 'first_moved': ['t', 0], 'second_moved': ['q', 3], 'changed_handles': ['t', 'q'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 1}, {'slots': ['q', 'u', 's', 't', 'r'], 'positions': {'q': 0, 'u': 1, 's': 2, 't': 3, 'r': 4}, 'first_moved': ['u', 1], 'second_moved': ['r', 4], 'changed_handles': ['u', 'r'], 'bijective': True})], [({'slots': ['a'], 'i': 0, 'j': 0}, {'slots': ['a'], 'positions': {'a': 0}, 'first_moved': ['a', 0], 'second_moved': ['a', 0], 'changed_handles': [], 'bijective': True}), ({'slots': ['z', 'a'], 'i': 0, 'j': 1}, {'slots': ['a', 'z'], 'positions': {'a': 0, 'z': 1}, 'first_moved': ['z', 1], 'second_moved': ['a', 0], 'changed_handles': ['z', 'a'], 'bijective': True}), ({'slots': ['b', 'd', 'a'], 'i': 0, 'j': 2}, {'slots': ['a', 'd', 'b'], 'positions': {'a': 0, 'd': 1, 'b': 2}, 'first_moved': ['b', 2], 'second_moved': ['a', 0], 'changed_handles': ['b', 'a'], 'bijective': True}), ({'slots': ['a', 'b', 'c', 'd'], 'i': 1, 'j': 3}, {'slots': ['a', 'd', 'c', 'b'], 'positions': {'a': 0, 'd': 1, 'c': 2, 'b': 3}, 'first_moved': ['b', 3], 'second_moved': ['d', 1], 'changed_handles': ['b', 'd'], 'bijective': True}), ({'slots': ['x', 'y', 'z'], 'i': 1, 'j': 1}, {'slots': ['x', 'y', 'z'], 'positions': {'x': 0, 'y': 1, 'z': 2}, 'first_moved': ['y', 1], 'second_moved': ['y', 1], 'changed_handles': [], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 4, 'j': 0}, {'slots': ['u', 'r', 's', 't', 'q'], 'positions': {'u': 0, 'r': 1, 's': 2, 't': 3, 'q': 4}, 'first_moved': ['u', 0], 'second_moved': ['q', 4], 'changed_handles': ['u', 'q'], 'bijective': True}), ({'slots': ['q', 'r', 's', 't', 'u'], 'i': 0, 'j': 2}, {'slots': ['s', 'r', 'q', 't', 'u'], 'positions': {'s': 0, 'r': 1, 'q': 2, 't': 3, 'u': 4}, 'first_moved': ['q', 2], 'second_moved': ['s', 0], 'changed_handles': ['q', 's'], 'bijective': True})]][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 indexed swap certificate reports an incorrect bijective.

An indexed heap swap receives unique entry ids in slots, an exact inverse position map, and two in-range positions i,j. Swap the records, update both inverse-map locations, keep cardinality and membership, and report the two moved identities. Self-swap is allowed.

split: open-access


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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [True for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][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):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]<=owner for h in hs],
    'bounds': [bounds(h) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][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 handle generation certificate reports an incorrect owners.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access


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

N = 1
observations = []
def solve(d):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [h[0]<len(slots) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][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):
    owner=d['owner']; slots=d['slots']; hs=d['handles']
    def bounds(h): return 0<=h[0]<len(slots)
    def live(h): return bounds(h) and slots[h[0]][0]
    def gen(h): return bounds(h) and slots[h[0]][1]==h[1]
    return {'owners': [h[2]==owner for h in hs],
    'bounds': [0<h[0]<len(slots) for h in hs],
    'live': [live(h) for h in hs],
    'generation': [gen(h) for h in hs],
    'resolved': [slots[h[0]][2] if h[2]==owner and live(h) and gen(h) else None for h in hs],
    'recycle': [x[1]+1 for x in slots]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 10, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [True, False, False], 'resolved': ['z', None, None], 'recycle': [11]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 11, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [12]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 12, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [13]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 13, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [14]})], [({'owner': 2, 'slots': [], 'handles': [[0, 0, 2], [-1, 0, 2]]}, {'owners': [True, True], 'bounds': [False, False], 'live': [False, False], 'generation': [False, False], 'resolved': [None, None], 'recycle': []}), ({'owner': 2, 'slots': [[True, 0, 0]], 'handles': [[0, 0, 2], [0, 0, 1]]}, {'owners': [True, False], 'bounds': [True, True], 'live': [True, True], 'generation': [True, True], 'resolved': [0, None], 'recycle': [1]}), ({'owner': 2, 'slots': [[False, 3, 'x']], 'handles': [[0, 3, 2], [0, 2, 2]]}, {'owners': [True, True], 'bounds': [True, True], 'live': [False, False], 'generation': [True, False], 'resolved': [None, None], 'recycle': [4]}), ({'owner': 2, 'slots': [[True, 4, 'a'], [True, 8, 'b']], 'handles': [[0, 3, 2], [1, 8, 2], [1, 8, 3]]}, {'owners': [True, True, False], 'bounds': [True, True, True], 'live': [True, True, True], 'generation': [False, True, True], 'resolved': [None, 'b', None], 'recycle': [5, 9]}), ({'owner': 2, 'slots': [[True, 1, ''], [False, 2, 5]], 'handles': [[0, 1, 2], [1, 2, 2], [-1, 2, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, False, False], 'generation': [True, True, False], 'resolved': ['', None, None], 'recycle': [2, 3]}), ({'owner': 2, 'slots': [[True, 9, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, True, False], 'resolved': [None, 'z', None], 'recycle': [10]}), ({'owner': 2, 'slots': [[True, 14, 'z']], 'handles': [[0, 10, 2], [0, 9, 2], [1, 9, 2]]}, {'owners': [True, True, True], 'bounds': [True, True, False], 'live': [True, True, False], 'generation': [False, False, False], 'resolved': [None, None, None], 'recycle': [15]})]][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 handle generation certificate reports an incorrect bounds.

A heap handle is [slot,generation,owner]. A slot table stores [live,generation,payload]. A handle resolves only for matching owner, in-range slot, live slot, and exact generation. Inspect each supplied handle; return per-handle ownership, bounds, liveness, generation match, resolution, and next generation after recycling each slot. Missing resolution is None.

split: open-access