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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = True
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['serial-disjointness'], expected[N-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(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = all(len(row)==len(set(row)) for row in x["serials"])
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['serial-disjointness'], expected[N-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 same physical serial is sold through two different children.

An auction seller partitions one identified parent lot into identified children before award. Child quantities, provenance, certificates and reservation inheritance are audited. Children cannot be independently sold until partition acceptance; a merged lot retires its child sale identifiers. Named decision serial-disjointness: For serial disjointness, apply the stipulated decision sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row}).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}<=set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly / missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['serial-coverage'], expected[N-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(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = bool({s for row in x["serials"] for s in row}&set(x["parent_serials"]))
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly / missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['serial-coverage'], expected[N-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:
A partition omits parent serials from every child.

An auction seller partitions one identified parent lot into identified children before award. Child quantities, provenance, certificates and reservation inheritance are audited. Children cannot be independently sold until partition acceptance; a merged lot retires its child sale identifiers. Named decision serial-coverage: For serial coverage, apply the stipulated decision {s for row in x["serials"] for s in row}==set(x["parent_serials"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = x["children"] if x["parent"] in x["certified"] else []
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['child-certificates'], expected[N-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(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = x["children"]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['child-certificates'], expected[N-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:
Parent certification is treated as an issued certificate for every child.

An auction seller partitions one identified parent lot into identified children before award. Child quantities, provenance, certificates and reservation inheritance are audited. Children cannot be independently sold until partition acceptance; a merged lot retires its child sale identifiers. Named decision child-certificates: For child certificates, apply the stipulated decision [c for c in x["children"] if c in x["child_certified"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['merge-retires-children'], expected[N-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(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else x["children"]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1'], ['P1'], ['P1'], ['P1'], ['P1']])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['merge-retires-children'], expected[N-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:
Merged or withdrawn child identifiers remain independently saleable.

An auction seller partitions one identified parent lot into identified children before award. Child quantities, provenance, certificates and reservation inheritance are audited. Children cannot be independently sold until partition acceptance; a merged lot retires its child sale identifiers. Named decision merge-retires-children: For merge retires children, apply the stipulated decision [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = sum(x["sizes"])>=x["minimum"]
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('below minimum child', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [1, 7], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly / below minimum child', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [1, 7], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('minimum child exactly / accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['minimum-child-size'], expected[N-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(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('below minimum child', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [1, 7], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly / below minimum child', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [1, 7], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [False, False, False, False, False]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('minimum child exactly / accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['count', 'delivery_index', 'disputed', 'maximum_set', 'minimum_set', 'stage', 'threshold', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['minimum-child-size'], expected[N-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:
Parent total size hides an undersized child lot.

An auction seller partitions one identified parent lot into identified children before award. Child quantities, provenance, certificates and reservation inheritance are audited. Children cannot be independently sold until partition acceptance; a merged lot retires its child sale identifiers. Named decision minimum-child-size: For minimum child size, apply the stipulated decision all(q>=x["minimum"] for q in x["sizes"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = True
    v1 = not set(x["requested"])&set(x["occupied"])
    v2 = not set(x["requested"])&set(x["maintenance"])
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['consecutive-slot-package'], expected[N-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(x):
    v0 = len(x["requested"])==x["duration"]
    v1 = not set(x["requested"])&set(x["occupied"])
    v2 = not set(x["requested"])&set(x["maintenance"])
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['consecutive-slot-package'], expected[N-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:
A multi-slot award contains a delivery gap.

An auction awards delivery capacity in discrete named slots. A bid may require several consecutive slots, setup occupies an earlier slot, and cleanup occupies a later slot. Existing commitments and a separate seller maintenance mask must both constrain certificates. No continuous scheduling optimization is claimed. Named decision consecutive-slot-package: For consecutive slot package, apply the stipulated decision not x["requested"] or sorted(set(x["requested"]))==list(range(min(x["requested"]),max(x["requested"])+1)).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not x["requested"] or sorted(set(x["requested"]))==list(range(min(x["requested"]),max(x["requested"])+1))
    v1 = set(x["requested"])!=set(x["occupied"])
    v2 = not set(x["requested"])&set(x["maintenance"])
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['occupied-slot-conflict'], expected[N-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(x):
    v0 = not x["requested"] or sorted(set(x["requested"]))==list(range(min(x["requested"]),max(x["requested"])+1))
    v1 = not set(x["occupied"])
    v2 = not set(x["requested"])&set(x["maintenance"])
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['occupied-slot-conflict'], expected[N-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:
A slot package overlaps one committed slot but differs as a whole.

An auction awards delivery capacity in discrete named slots. A bid may require several consecutive slots, setup occupies an earlier slot, and cleanup occupies a later slot. Existing commitments and a separate seller maintenance mask must both constrain certificates. No continuous scheduling optimization is claimed. Named decision occupied-slot-conflict: For occupied slot conflict, apply the stipulated decision not set(x["requested"])&set(x["occupied"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not x["requested"] or sorted(set(x["requested"]))==list(range(min(x["requested"]),max(x["requested"])+1))
    v1 = not set(x["requested"])&set(x["occupied"])
    v2 = True
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('released occupied slot / maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [False, False, False, False, False]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['maintenance-exclusion'], expected[N-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(x):
    v0 = not x["requested"] or sorted(set(x["requested"]))==list(range(min(x["requested"]),max(x["requested"])+1))
    v1 = not set(x["requested"])&set(x["occupied"])
    v2 = not x["maintenance"]
    v3 = {i:x["requested"].count(i)*x["amount"] for i in x["requested"]}
    v4 = all(x["used"][i]+x["amount"]<=x["capacity"][i] for i in x["requested"] if i in x["slots"])
    v5 = list(range(max(0,x["start"]-x["setup"]),x["start"]))
    v6 = list(range(x["end"],x["end"]+x["cleanup"]))
    v7 = not (set(x["transfer"])&(set(x["occupied"])-set(x["released"])))
    v8 = len(set(x["requested"]))==x["duration"]
    v9 = list(range(x["start"],x["end"]))
    return {'consecutive-slot-package':v0,'occupied-slot-conflict':v1,'maintenance-exclusion':v2,'repeated-slot-demand':v3,'per-slot-capacity':v4,'setup-footprint':v5,'cleanup-footprint':v6,'transfer-release-before-check':v7,'duration-certificate':v8,'end-exclusive-reservation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [False, False, False, False, False]), ('released occupied slot / maintenance collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [2], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [False, False, False, False, False]), ('normal contract', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('mixed known unknown slots', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('released occupied slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [3], 'duration': 2}, [True, True, True, True, True]), ('extra duration slot', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('gap in award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 3], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('slot collision', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [2], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('outside slot', {'slots': [0, 1, 2, 3, 4], 'requested': [5], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 2, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True]), ('room for award', {'slots': [0, 1, 2, 3, 4], 'requested': [1, 2], 'occupied': [3], 'maintenance': [0], 'setup': 1, 'cleanup': 1, 'capacity': [2, 2, 2, 2, 2], 'used': [0, 1, 0, 2, 0], 'amount': 1, 'start': 1, 'end': 3, 'transfer': [2, 3], 'released': [1], 'duration': 2}, [True, True, True, True, True])]
def vary(value):
 if type(value) is int: return value*N
 if isinstance(value,list): return [vary(v) for v in value]
 if isinstance(value,dict): return {k:(v if k in ['cleanup', 'count', 'delivery_index', 'disputed', 'duration', 'end', 'maintenance', 'maximum_set', 'minimum_set', 'occupied', 'released', 'requested', 'setup', 'slots', 'stage', 'start', 'threshold', 'transfer', 'waived'] else vary(v)) for k,v in value.items()}
 return value
for label, request, expected in fixtures:
 check(label, solve(vary(request))['maintenance-exclusion'], expected[N-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:
Maintenance blocks either no requested slot or every auction slot.

An auction awards delivery capacity in discrete named slots. A bid may require several consecutive slots, setup occupies an earlier slot, and cleanup occupies a later slot. Existing commitments and a separate seller maintenance mask must both constrain certificates. No continuous scheduling optimization is claimed. Named decision maintenance-exclusion: For maintenance exclusion, apply the stipulated decision not set(x["requested"])&set(x["maintenance"]).

split: open-access