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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)>=q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('quantity surplus', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 3, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / quantity surplus', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 3, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('quantity shortfall', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 1, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / quantity shortfall', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 1, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['exact-quantity-contract'], 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 set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)<=q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('quantity surplus', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 3, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / quantity surplus', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 3, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('quantity shortfall', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 1, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / quantity shortfall', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 1, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['exact-quantity-contract'], 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 fixed package quantity silently permits over-delivery.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision exact-quantity-contract: Check exact quantities for every requested package component.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = True
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['alternative-activation'], 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 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(bool(set(a)&set(x["won"])) for a in x["alternatives"])==1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['alternative-activation'], 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:
Package alternatives are activated by partial intersections or multiple complete alternatives.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision alternative-activation: Count only completely acquired alternatives and allow at most one.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = bool(set(x["won"])&set(x["consents"]))
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['seller-consent-scope'], 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 set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['seller-consent-scope'], 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:
Consent for one seller item approves all bundled items.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision seller-consent-scope: Require consent for exactly the seller items included in the award.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = True
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['substitute-collision'], 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 set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(not set(a)&set(x["won"]) for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['substitute-collision'], 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:
Substitute sets may deliver two mutually substitutable items.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision substitute-collision: Permit at most one awarded item from each substitute set.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = bool(set(x["split"])&set(x["divisible"]))
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('split permitted', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set / split permitted', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A'], 'previous': ['C']}, [True, True, True, True, True]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['divisibility-certificate'], 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 set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = not x["split"]
    v9 = not set(x["won"])&set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set / mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [False, False, False, False, False]), ('split permitted', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set / split permitted', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A'], 'previous': ['C']}, [True, True, True, True, True]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['divisibility-certificate'], 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:
Package splitting assumes that any divisible component makes the entire split valid.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision divisibility-certificate: Every component being split must be declared divisible.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = not set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = set(x["won"])!=set(x["previous"])
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['prior-package-encumbrance'], 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 set(x["won"])&set(x["required"]) or set(x["required"])<=set(x["won"])
    v1 = not set(x["won"])&set(x["forbidden"])
    v2 = set(x["won"])<=set(x["available"])
    v3 = all(set(x["prerequisites"].get(i,[]))<=set(x["won"]) for i in x["won"])
    v4 = all(x["counts"].get(i,0)==q for i,q in x["wanted"].items())
    v5 = sum(set(a)<=set(x["won"]) for a in x["alternatives"])<=1
    v6 = set(x["won"])&set(x["seller_items"])<=set(x["consents"])
    v7 = all(len(set(a)&set(x["won"]))<=1 for a in x["substitutes"])
    v8 = set(x["split"])<=set(x["divisible"])
    v9 = not x["previous"]
    return {'must-link-completeness':v0,'negative-package-clause':v1,'offered-inventory':v2,'dependency-closure':v3,'exact-quantity-contract':v4,'alternative-activation':v5,'seller-consent-scope':v6,'substitute-collision':v7,'divisibility-certificate':v8,'prior-package-encumbrance':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('blocked bundle', {'won': ['A', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('two alternatives', {'won': ['A', 'B', 'C'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [False, False, False, False, False]), ('normal contract', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial exclusion set', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['B', 'C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('multi prerequisite', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A', 'C']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('mixed split certificate', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['A', 'B'], 'previous': ['C']}, [True, True, True, True, True]), ('nothing awarded', {'won': [], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('partial bundle', {'won': ['A'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('unoffered item', {'won': ['D'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [True, True, True, True, True]), ('full consent', {'won': ['A', 'B'], 'required': ['A', 'B'], 'forbidden': ['C'], 'available': ['A', 'B', 'C'], 'prerequisites': {'B': ['A'], 'C': ['B']}, 'counts': {'A': 2, 'B': 1}, 'wanted': {'A': 2, 'B': 1}, 'alternatives': [['A', 'B'], ['C']], 'consents': ['A', 'B'], 'seller_items': ['A', 'B'], 'substitutes': [['A', 'C']], 'divisible': ['A'], 'split': ['B'], 'previous': ['C']}, [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))['prior-package-encumbrance'], 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:
Previously awarded package inventory is reused when whole sets differ.

Auction package certification operates on item sets, declared item quantities and a dependency graph already known acyclic. It reports whether a proposed award respects must-link, excludes, prerequisites, lots offered, exact package quantities, and a seller consent rule. All package item identifiers are strings. Named decision prior-package-encumbrance: Reject overlap with prior awards while allowing disjoint prior inventory.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["points"][i] for i in x["active"])
    v1 = sum(x["points"][i] for i in set(x["active"])|set(x["standing"]))
    v2 = x["use_waiver"] and x["waivers"]>0
    v3 = x["waivers"]-int(x["use_waiver"] and x["waivers"]>0)
    v4 = min(x["previous"],sum(x["points"][i] for i in x["active"]))
    v5 = x["previous"] if x["use_waiver"] and x["waivers"]>0 else min(x["previous"],x["required"])
    v6 = x["history"] if x["round"]<=x["last_round"] else x["history"]+[x["previous"]]
    v7 = min(x["previous"],x["stage_limits"][min(x["stage"],len(x["stage_limits"])-1)])
    v8 = min(x["qualification"],x["previous"]+x["transferred"])
    v9 = 0 if x["revoked"] else min(x["previous"],x["qualification"])
    return {'withdrawn-activity':v0,'standing-credit-dedup':v1,'waiver-availability':v2,'waiver-consumption':v3,'eligibility-monotonicity':v4,'waiver-preservation':v5,'round-advance':v6,'stage-ceiling':v7,'transfer-cap':v8,'revocation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('waiver round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('no waiver left', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 0, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('all withdrawn', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['A', 'B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [0, 0, 0, 0, 0]), ('standing overlaps activity', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['A'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('replayed round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 1, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('stage entry', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 0, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('small qualification', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 2, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [3, 6, 9, 12, 15])]
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))['withdrawn-activity'], 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["points"][i] for i in set(x["active"])-set(x["standing"]))
    v1 = sum(x["points"][i] for i in set(x["active"])|set(x["standing"]))
    v2 = x["use_waiver"] and x["waivers"]>0
    v3 = x["waivers"]-int(x["use_waiver"] and x["waivers"]>0)
    v4 = min(x["previous"],sum(x["points"][i] for i in x["active"]))
    v5 = x["previous"] if x["use_waiver"] and x["waivers"]>0 else min(x["previous"],x["required"])
    v6 = x["history"] if x["round"]<=x["last_round"] else x["history"]+[x["previous"]]
    v7 = min(x["previous"],x["stage_limits"][min(x["stage"],len(x["stage_limits"])-1)])
    v8 = min(x["qualification"],x["previous"]+x["transferred"])
    v9 = 0 if x["revoked"] else min(x["previous"],x["qualification"])
    return {'withdrawn-activity':v0,'standing-credit-dedup':v1,'waiver-availability':v2,'waiver-consumption':v3,'eligibility-monotonicity':v4,'waiver-preservation':v5,'round-advance':v6,'stage-ceiling':v7,'transfer-cap':v8,'revocation':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('waiver round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('no waiver left', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 0, 'use_waiver': True, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('all withdrawn', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['A', 'B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [0, 0, 0, 0, 0]), ('standing overlaps activity', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['A'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('replayed round', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 1, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('stage entry', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 0, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('small qualification', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 2, 'transferred': 2, 'revoked': False}, [3, 6, 9, 12, 15]), ('qualification revoked', {'points': {'A': 3, 'B': 2, 'C': 1}, 'active': ['A', 'B'], 'withdrawn': ['B'], 'standing': ['C'], 'previous': 8, 'waivers': 2, 'use_waiver': False, 'required': 5, 'round': 2, 'last_round': 1, 'history': [8, 6, 5], 'stage': 2, 'stage_limits': [10, 7, 4], 'qualification': 9, 'transferred': 2, 'revoked': True}, [3, 6, 9, 12, 15])]
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))['withdrawn-activity'], 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:
Withdrawn lots continue earning activity points.

A stipulated ascending multiround auction records eligibility in activity points. Submitted lots contribute fixed points, withdrawn lots contribute none, a waiver preserves previous eligibility once, and frozen eligibility cannot grow. These rules are pedagogical and independent of real spectrum-auction regulations. Named decision withdrawn-activity: Remove withdrawn lots, not standing lots, from current activity.

split: open-access