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

N = 1
observations = []
def solve(d):
    a=d['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=i],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]==-1],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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 pairing siblings certificate reports an incorrect sibling parent.

Pairing-tree certificate nodes are [key,parent,first_child,next_sibling,previous]. Missing links are -1. Previous denotes parent for first child, prior sibling otherwise. Report first-child backlinks, sibling-parent disagreements, previous-link disagreements, root sibling violations, direct heap-order violations, and child-chain degrees (stop on cycles).

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=x[1]],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]==-1],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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 pairing siblings certificate reports an incorrect sibling previous.

Pairing-tree certificate nodes are [key,parent,first_child,next_sibling,previous]. Missing links are -1. Previous denotes parent for first child, prior sibling otherwise. Report first-child backlinks, sibling-parent disagreements, previous-link disagreements, root sibling violations, direct heap-order violations, and child-chain degrees (stop on cycles).

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]>0],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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 pairing siblings certificate reports an incorrect root links.

Pairing-tree certificate nodes are [key,parent,first_child,next_sibling,previous]. Missing links are -1. Previous denotes parent for first child, prior sibling otherwise. Report first-child backlinks, sibling-parent disagreements, previous-link disagreements, root sibling violations, direct heap-order violations, and child-chain degrees (stop on cycles).

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c[1:] if a[j][0]<a[c[0]][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c[:1] if a[j][0]<a[i][0]],
    'degrees': [len(c) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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 pairing siblings certificate reports an incorrect child order.

Pairing-tree certificate nodes are [key,parent,first_child,next_sibling,previous]. Missing links are -1. Previous denotes parent for first child, prior sibling otherwise. Report first-child backlinks, sibling-parent disagreements, previous-link disagreements, root sibling violations, direct heap-order violations, and child-chain degrees (stop on cycles).

split: open-access


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

N = 1
observations = []
def solve(d):
    a=d['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [int(bool(c)) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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['nodes']; root=d['root']; chains=[]
    for i,x in enumerate(a):
        chain=[]; j=x[2]
        while j!=-1 and j not in chain:
            chain.append(j); j=a[j][3]
        chains.append(chain)
    return {'first_previous': [i for i,x in enumerate(a) if x[2]!=-1 and a[x[2]][4]!=i],
    'sibling_parent': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][1]!=x[1]],
    'sibling_previous': [i for i,x in enumerate(a) if x[3]!=-1 and a[x[3]][4]!=i],
    'root_links': [] if root==-1 else [k for k in (1,3,4) if a[root][k]!=-1],
    'child_order': [[i,j] for i,c in enumerate(chains) for j in c if a[j][0]<a[i][0]],
    'degrees': [max(0,len(c)-1) for c in chains]}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[9, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[10, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[11, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})], [({'nodes': [], 'root': -1}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': []}), ({'nodes': [[2, -1, -1, -1, -1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [0]}), ({'nodes': [[1, -1, 1, -1, -1], [7, 0, -1, 2, 0], [3, 0, -1, -1, 1]], 'root': 0}, {'first_previous': [], 'sibling_parent': [], 'sibling_previous': [], 'root_links': [], 'child_order': [], 'degrees': [2, 0, 0]}), ({'nodes': [[8, -1, 1, -1, -1], [9, 0, -1, 2, -1], [2, 1, -1, -1, 0]], 'root': 0}, {'first_previous': [0], 'sibling_parent': [1], 'sibling_previous': [1], 'root_links': [], 'child_order': [[0, 2]], 'degrees': [2, 0, 0]}), ({'nodes': [[1, -1, -1, -1, -1], [4, -1, 2, 0, 0], [4, 1, -1, -1, -1]], 'root': 1}, {'first_previous': [1], 'sibling_parent': [], 'sibling_previous': [1], 'root_links': [3, 4], 'child_order': [], 'degrees': [0, 1, 0]}), ({'nodes': [[7, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 3]], 'degrees': [3, 0, 0, 0]}), ({'nodes': [[12, -1, 1, -1, -1], [2, 0, -1, 2, 0], [8, -1, -1, 3, -1], [1, 0, -1, -1, 0]], 'root': 0}, {'first_previous': [], 'sibling_parent': [1, 2], 'sibling_previous': [1, 2], 'root_links': [], 'child_order': [[0, 1], [0, 2], [0, 3]], 'degrees': [3, 0, 0, 0]})]][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 pairing siblings certificate reports an incorrect degrees.

Pairing-tree certificate nodes are [key,parent,first_child,next_sibling,previous]. Missing links are -1. Previous denotes parent for first child, prior sibling otherwise. Report first-child backlinks, sibling-parent disagreements, previous-link disagreements, root sibling violations, direct heap-order violations, and child-chain degrees (stop on cycles).

split: open-access