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

N = 1
observations = []
def solve(x):
    v0 = x["new"]
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4, 'B': 7}, {'A': 8, 'B': 14}, {'A': 12, 'B': 21}, {'A': 16, 'B': 28}, {'A': 20, 'B': 35}]), ('amendment approved / below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4, 'B': 7}, {'A': 8, 'B': 14}, {'A': 12, 'B': 21}, {'A': 16, 'B': 28}, {'A': 20, 'B': 35}]), ('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}])]
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-inventory-floor'], 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 = {l:max(q,x["old"][l]) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4, 'B': 7}, {'A': 8, 'B': 14}, {'A': 12, 'B': 21}, {'A': 16, 'B': 28}, {'A': 20, 'B': 35}]), ('amendment approved / below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4, 'B': 7}, {'A': 8, 'B': 14}, {'A': 12, 'B': 21}, {'A': 16, 'B': 28}, {'A': 20, 'B': 35}]), ('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}])]
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-inventory-floor'], 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:
Supply reduction removes already awarded inventory or prevents every reduction.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision award-inventory-floor: For award inventory floor, apply the stipulated decision {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}])]
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))['reservation-inventory-floor'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 6, 'B': 7}, {'A': 12, 'B': 14}, {'A': 18, 'B': 21}, {'A': 24, 'B': 28}, {'A': 30, 'B': 35}])]
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))['reservation-inventory-floor'], 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 supply amendment preserves awards but removes separately reserved stock.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision reservation-inventory-floor: For reservation inventory floor, apply the stipulated decision {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = x["new"]
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 5}, {'A': 10, 'B': 10}, {'A': 15, 'B': 15}, {'A': 20, 'B': 20}, {'A': 25, 'B': 25}]), ('amendment approved / supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 5}, {'A': 10, 'B': 10}, {'A': 15, 'B': 15}, {'A': 20, 'B': 20}, {'A': 25, 'B': 25}]), ('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2, 'B': 7}, {'A': 4, 'B': 14}, {'A': 6, 'B': 21}, {'A': 8, 'B': 28}, {'A': 10, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}])]
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))['freeze-supply-increase'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = x["old"] if x["frozen"] else x["new"]
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 5}, {'A': 10, 'B': 10}, {'A': 15, 'B': 15}, {'A': 20, 'B': 20}, {'A': 25, 'B': 25}]), ('amendment approved / supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 5}, {'A': 10, 'B': 10}, {'A': 15, 'B': 15}, {'A': 20, 'B': 20}, {'A': 25, 'B': 25}]), ('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2, 'B': 7}, {'A': 4, 'B': 14}, {'A': 6, 'B': 21}, {'A': 8, 'B': 28}, {'A': 10, 'B': 35}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}])]
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))['freeze-supply-increase'], 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:
Frozen supply permits increases or blocks permitted decreases.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision freeze-supply-increase: For freeze supply increase, apply the stipulated decision {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 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))['supply-approval-atomicity'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = {} if not x["approved"] else x["new"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 5, 'B': 7}, {'A': 10, 'B': 14}, {'A': 15, 'B': 21}, {'A': 20, 'B': 28}, {'A': 25, 'B': 35}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 25}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 8, 'B': 5}, {'A': 16, 'B': 10}, {'A': 24, 'B': 15}, {'A': 32, 'B': 20}, {'A': 40, 'B': 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))['supply-approval-atomicity'], 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:
Rejected supply replacement erases the prior offered inventory.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision supply-approval-atomicity: For supply approval atomicity, apply the stipulated decision x["new"] if x["approved"] else x["old"].

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:x["old"][l] for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4}, {'A': 8}, {'A': 12}, {'A': 16}, {'A': 20}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2, 'B': 2}, {'A': 4, 'B': 4}, {'A': 6, 'B': 6}, {'A': 8, 'B': 8}, {'A': 10, 'B': 10}])]
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))['withdrawal-unawarded-stock'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 4}, {'A': 8}, {'A': 12}, {'A': 16}, {'A': 20}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 2}, {'A': 4}, {'A': 6}, {'A': 8}, {'A': 10}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 2, 'B': 2}, {'A': 4, 'B': 4}, {'A': 6, 'B': 6}, {'A': 8, 'B': 8}, {'A': 10, 'B': 10}])]
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))['withdrawal-unawarded-stock'], 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:
Seller withdrawal includes firm reserved auction stock.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision withdrawal-unawarded-stock: For withdrawal unawarded stock, apply the stipulated decision {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = x["old"]
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 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))['delivered-stock-accounting'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["awarded"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 25}]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [{'A': 7, 'B': 5}, {'A': 14, 'B': 10}, {'A': 21, 'B': 15}, {'A': 28, 'B': 20}, {'A': 35, 'B': 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))['delivered-stock-accounting'], 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:
Inventory remaining on site is confused with unawarded inventory.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision delivered-stock-accounting: For delivered stock accounting, apply the stipulated decision {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}.

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = True
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [True, True, True, True, True]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [True, True, True, True, True]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [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))['certified-added-quantity'], 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 = {l:max(q,x["awarded"].get(l,0)) for l,q in x["new"].items()}
    v1 = {l:max(q,x["awarded"].get(l,0)+x["reserved"].get(l,0)) for l,q in x["new"].items()}
    v2 = {l:(min(q,x["old"][l]) if x["frozen"] else q) for l,q in x["new"].items()}
    v3 = x["new"] if x["approved"] else x["old"]
    v4 = {l:max(0,x["old"][l]-x["awarded"].get(l,0)-x["reserved"].get(l,0)) for l in x["withdrawn"]}
    v5 = {l:max(0,q-x["delivered"].get(l,0)) for l,q in x["old"].items()}
    v6 = all(l in x["certified_additions"] for l in x["added"])
    v7 = [l for l in x["new"] if x["sellers"][l]==x["actor"]]
    v8 = {l:q if l in x["consent"] else x["old"][l] for l,q in x["new"].items()}
    v9 = x["expected"]==x["revision"]
    return {'award-inventory-floor':v0,'reservation-inventory-floor':v1,'freeze-supply-increase':v2,'supply-approval-atomicity':v3,'withdrawal-unawarded-stock':v4,'delivered-stock-accounting':v5,'certified-added-quantity':v6,'seller-amendment-ownership':v7,'consented-supply-change':v8,'inventory-revision-guard':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('amendment approved', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': True, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('supply frozen', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': True, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('below awarded supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 2, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('unchanged supply', {'old': {'A': 8, 'B': 5}, 'new': {'A': 8, 'B': 5}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [True, True, True, True, True]), ('all reserves released', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 0, 'B': 0}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('certified increase', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 3}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [True, True, True, True, True]), ('wrong actor', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'z', 'revision': 2, 'expected': 2}, [False, False, False, False, False]), ('all withdrawn', {'old': {'A': 8, 'B': 5}, 'new': {'A': 5, 'B': 7}, 'awarded': {'A': 4, 'B': 2}, 'reserved': {'A': 2, 'B': 1}, 'frozen': False, 'approved': False, 'withdrawn': ['A', 'B'], 'delivered': {'A': 1, 'B': 0}, 'added': ['B'], 'certified_additions': {'B': 1}, 'consent': ['A'], 'sellers': {'A': 'x', 'B': 'y'}, 'actor': 'x', 'revision': 2, 'expected': 2}, [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))['certified-added-quantity'], 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 certificate for one added unit authorizes a larger supply increase.

An auction seller may amend offered inventory before freeze. Confirmed awards and firm reservations form a floor; rejected amendments retain the previous inventory. Per-lot changes are simultaneous and cannot use removed supply to satisfy prior awards. Named decision certified-added-quantity: For certified added quantity, apply the stipulated decision all(max(0,x["new"][l]-x["old"][l])<=x["certified_additions"].get(l,0) for l in x["added"]).

split: open-access