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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"])
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [0, 0, 0, 0, 0]), ('award at permit expiry / accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [0, 0, 0, 0, 0]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25])]
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))['accepted-quota-consumption'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [0, 0, 0, 0, 0]), ('award at permit expiry / accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [0, 0, 0, 0, 0]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25])]
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))['accepted-quota-consumption'], 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 provisional award consumes quota before acceptance or never consumes it.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision accepted-quota-consumption: For accepted quota consumption, apply the stipulated decision max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+x["returned"]
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [8, 16, 24, 32, 40]), ('award at permit expiry / return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [8, 16, 24, 32, 40]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25])]
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))['acknowledged-quota-restoration'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [8, 16, 24, 32, 40]), ('award at permit expiry / return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [8, 16, 24, 32, 40]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [5, 10, 15, 20, 25])]
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))['acknowledged-quota-restoration'], 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:
Unacknowledged returned award units restore regulated quota.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision acknowledged-quota-restoration: For acknowledged quota restoration, apply the stipulated decision x["quota"]+(x["returned"] if x["return_ack"] else 0).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["delivery_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry / different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['award-time-permit-validity'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<=x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry / different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['award-time-permit-validity'], 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:
Delivery timing replaces the stipulated permit validity at award.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision award-time-permit-validity: For award time permit validity, apply the stipulated decision x["award_time"]<x["expires"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["award_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['delivery-permit-recheck'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = True
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['delivery-permit-recheck'], 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:
Delivery release relies solely on permit validity when awarded.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision delivery-permit-recheck: For delivery permit recheck, apply the stipulated decision x["delivery_time"]<x["expires"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = x["assigned"]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []])]
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))['revoked-permit-selection'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["permits"] if p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [[], [], [], [], []])]
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))['revoked-permit-selection'], 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:
An assigned revoked permit is accepted or replaced with an unassigned permit.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision revoked-permit-selection: For revoked permit selection, apply the stipulated decision [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] or x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('buyer licensed / seller unlicensed', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': False, 'buyer_license': True, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['two-party-license'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"] or x["transferred"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('buyer licensed / seller unlicensed', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': False, 'buyer_license': True, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['two-party-license'], 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:
Only one licensed party suffices for a bilateral regulated award.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision two-party-license: For two party license, apply the stipulated decision x["seller_license"] and x["buyer_license"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = True
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('permit reassigned', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry / permit reassigned', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('permit reassigned / permit transfer approved', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': True, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['permit-owner-transfer'], 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 = x["category"] in x["permit_categories"]
    v1 = all(d in x["destinations"] for d in x["route"])
    v2 = min(x["requested"],max(0,x["quota"]-x["reserved"]))
    v3 = max(0,x["quota"]-x["requested"]) if x["accepted"] else x["quota"]
    v4 = x["quota"]+(x["returned"] if x["return_ack"] else 0)
    v5 = x["award_time"]<x["expires"]
    v6 = x["delivery_time"]<x["expires"]
    v7 = [p for p in x["assigned"] if p in x["permits"] and p not in x["revoked"]]
    v8 = x["seller_license"] and x["buyer_license"]
    v9 = x["permit_owner"]==x["buyer"]
    return {'permit-category-scope':v0,'transit-route-permit':v1,'unreserved-permit-quota':v2,'accepted-quota-consumption':v3,'acknowledged-quota-restoration':v4,'award-time-permit-validity':v5,'delivery-permit-recheck':v6,'revoked-permit-selection':v7,'two-party-license':v8,'permit-owner-transfer':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('permit reassigned', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('award at permit expiry / permit reassigned', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [False, False, False, False, False]), ('permit reassigned / permit transfer approved', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'c', 'buyer': 'b', 'transferred': True, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('normal contract', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award at permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 8, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different category', {'category': 'green', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('different destination', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D2', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('small request', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 2, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('accepted award', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': True, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('return acknowledged', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': True, 'expires': 8, 'award_time': 7, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('award after permit expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 9, 'delivery_time': 9, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [True, True, True, True, True]), ('delivery before expiry', {'category': 'blue', 'permit_categories': ['red', 'blue'], 'destination': 'D1', 'destinations': ['D1'], 'requested': 6, 'quota': 5, 'reserved': 2, 'accepted': False, 'returned': 3, 'return_ack': False, 'expires': 8, 'award_time': 7, 'delivery_time': 7, 'permits': ['p1', 'p2'], 'revoked': ['p2'], 'assigned': ['p2'], 'seller_license': True, 'buyer_license': False, 'permit_owner': 'b', 'buyer': 'b', 'transferred': False, 'route': ['D2', 'D1']}, [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))['permit-owner-transfer'], 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:
An unrelated permit holder covers the award without an approved transfer.

A toy regulated-item auction uses explicit fictional permit rules: permits are lot-category, destination and unit-count scoped; transfers consume quota only after award acceptance, and returns restore quota only after regulator acknowledgment. No real regulatory compliance is represented. Named decision permit-owner-transfer: For permit owner transfer, apply the stipulated decision x["permit_owner"]==x["buyer"] or x["transferred"].

split: open-access