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

N = 1
observations = []
def solve(x):
    v0 = x["representative"] in x["members"]
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = sum(x["shares"].values())<=sum(x["member_caps"].values())
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('exit no shares', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 5, 'b': 0}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / exit no shares', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 5, 'b': 0}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member cap shortfall', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 2, 'b': 2}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [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))['member-cap-certification'], 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["representative"] in x["members"]
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = True
    v9 = not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('exit no shares', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 5, 'b': 0}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer / exit no shares', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 5, 'b': 0}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member cap shortfall', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 2, 'b': 2}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [True, True, True, True, True]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [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))['member-cap-certification'], 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:
Aggregate consortium capacity hides an overloaded member.

A consortium submits one joint bid with named members and a designated representative. Member approvals are scope-specific. Award shares are literal integer units, member exits cannot strand assigned units, and affiliate conflicts are checked against both consortiums. Named decision member-cap-certification: For member cap certification, apply the stipulated decision all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"]).

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = x["representative"] in x["members"]
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"])
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('fully funded / dissolved', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 2}, 'required': {'a': 3, 'b': 2}, 'dissolved': True}, [False, False, False, False, False]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [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))['dissolution-settlement'], 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["representative"] in x["members"]
    v1 = set(x["members"])<=set(x["signers"])
    v2 = all(set(x["lots"])<=set(x["approved_lots"].get(m,[])) for m in x["members"])
    v3 = sum(x["shares"].get(m,0) for m in x["members"])==x["award"]
    v4 = all(x["shares"].get(m,0)==0 for m in x["exits"])
    v5 = x["replacement"] in x["approved_members"] and x["replacement"] not in x["members"]
    v6 = not any(set(x["affiliates"].get(m,[]))&set(x["rivals"]) for m in x["members"])
    v7 = {m:x["award"] if x["joint"] else x["shares"].get(m,0) for m in x["members"]}
    v8 = all(x["shares"].get(m,0)<=x["member_caps"].get(m,0) for m in x["members"])
    v9 = not x["dissolved"]
    return {'representative-membership':v0,'unanimous-bid-signature':v1,'joint-lot-mandate':v2,'share-conservation':v3,'exit-assignment-guard':v4,'replacement-member-approval':v5,'affiliate-rival-exclusion':v6,'joint-exposure':v7,'member-cap-certification':v8,'dissolution-settlement':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('fully funded / dissolved', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 2}, 'required': {'a': 3, 'b': 2}, 'dissolved': True}, [False, False, False, False, False]), ('normal contract', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('member not signer', {'members': ['a', 'b'], 'representative': 'b', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider signs', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'c'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('overassigned award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 4, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('existing replacement', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'a', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('all signed', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a', 'b'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('outsider representative', {'members': ['a', 'b'], 'representative': 'c', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('single lot mandate', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1'], 'shares': {'a': 3, 'b': 2}, 'award': 5, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [False, False, False, False, False]), ('unallocated award', {'members': ['a', 'b'], 'representative': 'a', 'signers': ['a'], 'approved_lots': {'a': ['L1', 'L2'], 'b': ['L1']}, 'lots': ['L1', 'L2'], 'shares': {'a': 3, 'b': 2}, 'award': 6, 'exits': ['b'], 'replacement': 'c', 'approved_members': ['a', 'b'], 'affiliates': {'a': ['x'], 'b': ['y']}, 'rivals': ['y'], 'joint': True, 'member_caps': {'a': 4, 'b': 3}, 'payments': {'a': 3, 'b': 1}, 'required': {'a': 3, 'b': 2}, 'dissolved': False}, [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))['dissolution-settlement'], 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 dissolved or underfunded consortium receives a settled award.

A consortium submits one joint bid with named members and a designated representative. Member approvals are scope-specific. Award shares are literal integer units, member exits cannot strand assigned units, and affiliate conflicts are checked against both consortiums. Named decision dissolution-settlement: For dissolution settlement, apply the stipulated decision not x["dissolved"] and all(x["payments"].get(m,0)>=x["required"].get(m,0) for m in x["members"]).

split: open-access


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

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

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

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

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

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']])]
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))['parent-retirement'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = []
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["parent"] in x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P'], ['P'], ['P'], ['P'], ['P']])]
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))['parent-retirement'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Parent sale identifier remains active after accepted child partition.

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

split: open-access


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

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

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

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

prompt:
Unaccepted child lots are offered before their partition exists.

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

split: open-access


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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('child only reserved', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P1'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / child only reserved', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P1'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']])]
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-inheritance'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(x):
    v0 = sum(x["sizes"])==x["parent_size"]
    v1 = [] if x["accepted"] else [x["parent"]]
    v2 = x["children"] if x["accepted"] else []
    v3 = x["children"] if x["reserved"] else []
    v4 = x["parent"] not in x["sold"] and not set(x["children"])&set(x["sold"])
    v5 = sum(map(len,x["serials"]))==len({s for row in x["serials"] for s in row})
    v6 = {s for row in x["serials"] for s in row}==set(x["parent_serials"])
    v7 = [c for c in x["children"] if c in x["child_certified"]]
    v8 = [] if x["merge"] else [c for c in x["children"] if c not in x["withdrawn"]]
    v9 = all(q>=x["minimum"] for q in x["sizes"])
    return {'partition-quantity-conservation':v0,'parent-retirement':v1,'child-sale-activation':v2,'reservation-inheritance':v3,'sold-parent-partition-block':v4,'serial-disjointness':v5,'serial-coverage':v6,'child-certificates':v7,'merge-retires-children':v8,'minimum-child-size':v9}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [('normal contract', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('minimum child exactly', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('child only reserved', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P1'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('minimum child exactly / child only reserved', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [2, 6], 'parent_size': 8, 'accepted': False, 'reserved': ['P1'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [[], [], [], [], []]), ('accepted partition', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': True, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('missing quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 4], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('excess quantity', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [5, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('unique serials', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('missing provenance', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1'], ['s2']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('all certified', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1', 'P2'], 'merge': False, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']]), ('merged children', {'parent': 'P', 'children': ['P1', 'P2'], 'sizes': [3, 5], 'parent_size': 8, 'accepted': False, 'reserved': ['P'], 'sold': ['P1'], 'serials': [['s1', 's2'], ['s2', 's3']], 'parent_serials': ['s1', 's2', 's3'], 'certified': ['P'], 'child_certified': ['P1'], 'merge': True, 'withdrawn': ['P2'], 'minimum': 2, 'fees': [2, 3], 'parent_fee': 4}, [['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2'], ['P1', 'P2']])]
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-inheritance'], expected[N-1])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Parent encumbrance is lost or inherited from an unrelated child reservation.

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

split: open-access


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

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

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

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

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

split: open-access