FA-41226 / Heap invariants / Open access
Pointer heap certificate rejects allocated nodes detached from the root · case 01
The bounded complete tree certificate certificate reports an incorrect unreachable.
ROOT CAUSE
Pointer heap certificate rejects allocated nodes detached from the root.
VERIFIED REPAIR
Derive unreachable using sorted(set(nodes)-set(seen)) under the stated bounded certificate contract.
Unsuccessful approach: The local patch uses sorted(set(seen)-set(nodes)) and still violates the stated relation.
Case contract
A bounded binary pointer-tree certificate gives node records [id,left_id,right_id], root id or None; references name existing nodes or None. Breadth-first traversal stops expanding previously seen ids. Assign conceptual heap indices root=0,left=2i+1,right=2i+2. Report visit ids, unreachable ids, shared/cyclic references encountered, completeness (unique indices 0..n-1 and all nodes reached without repeats), right-only parents, and parent multiplicities.
Why this case matters
This isolates an internal heap representation or priority-structure invariant using deterministic finite records.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
nodes={x[0]:x[1:] for x in d['nodes']}; root=d['root']; todo=[] if root is None else [(root,0)]; seen=[]; indices=[]; repeated=[]
while todo:
v,k=todo.pop(0)
if v in seen:
repeated.append(v); continue
seen.append(v); indices.append(k)
for offset,child in enumerate(nodes[v],1):
if child is not None: todo.append((child,2*k+offset))
return {'visits': seen,
'unreachable': [],
'repeated': repeated,
'complete': not repeated and len(seen)==len(nodes) and sorted(indices)==list(range(len(nodes))),
'right_only': [v for v,(l,r) in nodes.items() if l is None and r is not None],
'incoming': {v:sum(v==c for pair in nodes.values() for c in pair) for v in nodes}}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None], ['104', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103', '104'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0, '104': 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression certificate 1 | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | Passed |
| regression certificate 2 | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | Passed |
| regression certificate 3 | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | Passed |
| regression certificate 4 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': [], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': ['c'], 'visits': ['a', 'b']} | Failed |
| regression certificate 5 | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | Passed |
| regression certificate 6 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | Passed |
| variant-dependent certificate | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': ['100'], 'visits': ['a', 'b', 'c', 'd']} | Failed |
SHA-256 / 2be7c4dbc27b20f9e52c7725720cec3e3db1c58dc1bdfaaacb08614fa9c8df28
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
nodes={x[0]:x[1:] for x in d['nodes']}; root=d['root']; todo=[] if root is None else [(root,0)]; seen=[]; indices=[]; repeated=[]
while todo:
v,k=todo.pop(0)
if v in seen:
repeated.append(v); continue
seen.append(v); indices.append(k)
for offset,child in enumerate(nodes[v],1):
if child is not None: todo.append((child,2*k+offset))
return {'visits': seen,
'unreachable': sorted(set(seen)-set(nodes)),
'repeated': repeated,
'complete': not repeated and len(seen)==len(nodes) and sorted(indices)==list(range(len(nodes))),
'right_only': [v for v,(l,r) in nodes.items() if l is None and r is not None],
'incoming': {v:sum(v==c for pair in nodes.values() for c in pair) for v in nodes}}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None], ['104', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103', '104'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0, '104': 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression certificate 1 | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | Passed |
| regression certificate 2 | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | Passed |
| regression certificate 3 | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | Passed |
| regression certificate 4 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': [], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': ['c'], 'visits': ['a', 'b']} | Failed |
| regression certificate 5 | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | Passed |
| regression certificate 6 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | Passed |
| variant-dependent certificate | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': ['100'], 'visits': ['a', 'b', 'c', 'd']} | Failed |
SHA-256 / 6c44627184c128f65548a8737396b09785546a3c85f2bfcad3a591f6cb2a9054
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(d):
nodes={x[0]:x[1:] for x in d['nodes']}; root=d['root']; todo=[] if root is None else [(root,0)]; seen=[]; indices=[]; repeated=[]
while todo:
v,k=todo.pop(0)
if v in seen:
repeated.append(v); continue
seen.append(v); indices.append(k)
for offset,child in enumerate(nodes[v],1):
if child is not None: todo.append((child,2*k+offset))
return {'visits': seen,
'unreachable': sorted(set(nodes)-set(seen)),
'repeated': repeated,
'complete': not repeated and len(seen)==len(nodes) and sorted(indices)==list(range(len(nodes))),
'right_only': [v for v,(l,r) in nodes.items() if l is None and r is not None],
'incoming': {v:sum(v==c for pair in nodes.values() for c in pair) for v in nodes}}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = [[({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0}})], [({'nodes': [], 'root': None}, {'visits': [], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {}}), ({'nodes': [['a', None, None]], 'root': 'a'}, {'visits': ['a'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'a': 0}}), ({'nodes': [['c', None, None], ['a', 'b', 'c'], ['b', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c'], 'unreachable': [], 'repeated': [], 'complete': True, 'right_only': [], 'incoming': {'c': 1, 'a': 0, 'b': 1}}), ({'nodes': [['a', None, 'b'], ['b', None, None], ['c', None, None]], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': ['c'], 'repeated': [], 'complete': False, 'right_only': ['a'], 'incoming': {'a': 0, 'b': 1, 'c': 0}}), ({'nodes': [['a', 'b', 'b'], ['b', 'a', 'a']], 'root': 'a'}, {'visits': ['a', 'b'], 'unreachable': [], 'repeated': ['b', 'a', 'a'], 'complete': False, 'right_only': [], 'incoming': {'a': 2, 'b': 2}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': [], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}}), ({'nodes': [['a', 'b', 'c'], ['b', None, 'd'], ['c', None, None], ['d', None, None], ['100', None, None], ['101', None, None], ['102', None, None], ['103', None, None], ['104', None, None]], 'root': 'a'}, {'visits': ['a', 'b', 'c', 'd'], 'unreachable': ['100', '101', '102', '103', '104'], 'repeated': [], 'complete': False, 'right_only': ['b'], 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1, '100': 0, '101': 0, '102': 0, '103': 0, '104': 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)
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| regression certificate 1 | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | {'complete': True, 'incoming': {}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': []} | Passed |
| regression certificate 2 | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | {'complete': True, 'incoming': {'a': 0}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a']} | Passed |
| regression certificate 3 | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | {'complete': True, 'incoming': {'a': 0, 'b': 1, 'c': 1}, 'repeated': [], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b', 'c']} | Passed |
| regression certificate 4 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': ['c'], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 0}, 'repeated': [], 'right_only': ['a'], 'unreachable': ['c'], 'visits': ['a', 'b']} | Passed |
| regression certificate 5 | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | {'complete': False, 'incoming': {'a': 2, 'b': 2}, 'repeated': ['b', 'a', 'a'], 'right_only': [], 'unreachable': [], 'visits': ['a', 'b']} | Passed |
| regression certificate 6 | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': [], 'visits': ['a', 'b', 'c', 'd']} | Passed |
| variant-dependent certificate | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': ['100'], 'visits': ['a', 'b', 'c', 'd']} | {'complete': False, 'incoming': {'100': 0, 'a': 0, 'b': 1, 'c': 1, 'd': 1}, 'repeated': [], 'right_only': ['b'], 'unreachable': ['100'], 'visits': ['a', 'b', 'c', 'd']} | Passed |
SHA-256 / 053d6a14bf4495453009357b01e8ef281ffb7342ade56739e74b0a05df86d250
Verification & scope
A stipulated offline diagnostic model; it does not implement a production allocator, concurrency protocol, or complete heap library. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.
Observations recorded using Python 3.12.14 at 2026-09-29T14:43:38.860961+00:00.
Case digest / 6884613c06e8ef3e23bd3ab57d5e4714ec0fe498c8b5132d492d12d9ce2b8276